NAME
    `Device::BusPirate::Chip::nRF24L01P' - use an nRF24L01+ chip with
    `Device::BusPirate'

DESCRIPTION
    This Device::BusPirate::Chip subclass provides specific communication to
    a Nordic Semiconductor nRF24L01+ chip attached to the Bus Pirate via
    SPI.

    The reader is presumed to be familiar with the general operation of this
    chip; the documentation here will not attempt to explain or define
    chip-specific concepts or features, only the use of this module to
    access them.

METHODS
  $nrf->clear_caches
    The chip object stores a cache of the register values it last read or
    wrote, so it can optimise updates of configuration. This method clears
    these caches, ensuring a fresh SPI transfer next time the register needs
    to be read.

    This should not normally be necessary, other than for debugging.

  $status = $nrf->latest_status
    Returns the latest cached copy of the status register from the most
    recent SPI interaction. As this method does not perform any IO, it
    returns its result immediately rather than via a Future.

    Returns a HASH reference containing the following boolean fields

     RX_DR TX_DS MAX_RT TX_FULL

    Also returned is a field called `RX_P_NO', which is either a pipe number
    (0 to 5) or undef.

  $nrf->reset_interrupt->get
    Clears the interrupt flags in the `STATUS' register.

  $status = $nrf->read_status->get
    Reads and returns the current content of the status register as a HASH
    reference as per `latest_status'.

  $config = $nrf->read_config->get
  $nrf->change_config( %config )->get
    Reads or writes the chip-wide configuration. This is an amalgamation of
    all the non-pipe-specific configuration registers; `CONFIG', `SETUP_AW',
    `SETUP_RETR', `RF_CH', `RF_SETUP', `TX_ADDR' and `FEATURE'.

    When reading, the fields are returned in a HASH reference whose names
    are the original bitfield names found in the Nordic Semiconductor data
    sheet. When writing, these fields are accepted as named parameters to
    the `change_config' method directly.

    Some of the fields have special processing for convenience. They are:

    * CRCO
        Gives the CRC length in bytes, as either 1 or 2.

    * AW
        Gives the full address width in bytes, between 3 and 5.

    * ARD
        Gives the auto retransmit delay in microseconds directly; a multiple
        of 250 between 250 and 4000.

    * RF_DR
        Gives the RF data rate in bytes/sec; omits the `RF_DR_LOW' and
        `RF_DR_HIGH' fields; as 250000, 1000000 or 2000000

    * RF_PWR
        Gives the RF output power in dBm directly, as -18, -12, -6 or 0.

    * TX_ADDR
        Gives the PTX address as a string of 5 capital hexadecimal encoded
        octets, separated by colons.

    Whenever the config is read it is cached within the `$chip' instance.
    Whenever it is written, any missing fields in the passed configuration
    are pre-filled by the cached config, and only those registers that need
    writing will be written.

  $config = $nrf->read_rx_config( $pipeno )->get
  $nrf->change_rx_config( $pipeno, %config )->get
    Reads or writes the per-pipe RX configuration. This is composed of the
    per-pipe bits of the `EN_AA' and `EN_RXADDR' registers and its
    `RX_ADDR_Pn' register.

    Addresses are given as a string of 5 octets in capitalised hexadecimal
    notation, separated by colons.

    When reading an address from pipes 2 to 5, the address of pipe 1 is used
    to build a complete address string to return. When writing and address
    to these pipes, all but the final byte is ignored.

  $counts = $nrf->observe_tx_counts->get
    Reads the `OBSERVE_TX' register and returns the two counts from it.

  $rpd = $nrf->rpd->get
    Reads the `RPD' register

  $status = $nrf->fifo_status->get
    Reads the `FIFO_STATUS' register and returns the five bit fields from
    it.

  $nrf->pwr_up( $pwr )->get
    A convenient shortcut to setting the `PWR_UP' configuration bit.

  $nrf->chip_enable( $ce )->get
    A wrapper around the underlying `aux' method. This presumes that the
    `CE' pin is attached to the `AUX' Bus Pirate line.

  $len = $nrf->read_rx_payload_width->get
    Returns the width of the most recently received payload, when in `DPL'
    mode. Remember that `DPL' needs to be enabled (using `EN_DPL') on both
    the transmitter and receiver before this will work.

  $data = $nrf->read_rx_payload( $len )->get
    Reads the most recently received RX FIFO payload buffer.

  $nrf->write_tx_payload( $data, %opts )->get
    Writes the next TX FIFO payload buffer. Takes the following options:

    no_ack => BOOL
        If true, uses the `W_TX_PAYLOAD_NO_ACK' command, requesting that
        this payload does not requre auto-ACK.

  $nrf->flush_rx_fifo->get
  $nrf->flush_tx_fifo->get
    Flush the RX or TX FIFOs, discarding all their contents.

AUTHOR
    Paul Evans <leonerd@leonerd.org.uk>

