-
Notifications
You must be signed in to change notification settings - Fork 302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Defender datos personales y privacidad #10
Comments
Optimized high speed nRF24L01+ driver class documentation v1.4.10 TMRh20 2020 - Optimized fork of the nRF24L01+ driver Main Page Related Pages Topics Classes Files Examples
Class List Class Index Class Members Protected Member Functions | Protected Attributes | List of all members RF24 Class Reference Driver class for nRF24L01(+) 2.4GHz Wireless Transceiver. More... #include <RF24.h> Public Member Functions Primary public interface These are the main methods you need to operate the chip RF24 (rf24_gpio_pin_t _cepin, rf24_gpio_pin_t _cspin, uint32_t _spi_speed=RF24_SPI_SPEED) RF24 (uint32_t _spi_speed=RF24_SPI_SPEED) bool begin (void) bool begin (_SPI *spiBus) bool begin (_SPI *spiBus, rf24_gpio_pin_t _cepin, rf24_gpio_pin_t _cspin) bool begin (rf24_gpio_pin_t _cepin, rf24_gpio_pin_t _cspin) bool isChipConnected () void startListening (void) void stopListening (void) bool available (void) void read (void *buf, uint8_t len) bool write (const void *buf, uint8_t len) void openWritingPipe (const uint8_t *address) void openReadingPipe (uint8_t number, const uint8_t *address) Deprecated Methods provided for backwards compatibility. void openReadingPipe (uint8_t number, uint64_t address) void openWritingPipe (uint64_t address) bool isAckPayloadAvailable (void) Protected Member Functions void beginTransaction () void endTransaction () void read_register (uint8_t reg, uint8_t *buf, uint8_t len) uint8_t read_register (uint8_t reg) Protected Attributes bool ack_payloads_enabled uint8_t addr_width bool dynamic_payloads_enabled Advanced Operation Methods you can use to drive the chip in more advanced ways bool failureDetected void printDetails (void) void printPrettyDetails (void) uint16_t sprintfPrettyDetails (char *debugging_information) void encodeRadioDetails (uint8_t *encoded_status) bool available (uint8_t *pipe_num) bool rxFifoFull () uint8_t isFifo (bool about_tx) bool isFifo (bool about_tx, bool check_empty) void powerDown (void) void powerUp (void) bool write (const void *buf, uint8_t len, const bool multicast) bool writeFast (const void *buf, uint8_t len) bool writeFast (const void *buf, uint8_t len, const bool multicast) bool writeBlocking (const void *buf, uint8_t len, uint32_t timeout) bool txStandBy () bool txStandBy (uint32_t timeout, bool startTx=0) bool writeAckPayload (uint8_t pipe, const void *buf, uint8_t len) void whatHappened (bool &tx_ok, bool &tx_fail, bool &rx_ready) void startFastWrite (const void *buf, uint8_t len, const bool multicast, bool startTx=1) bool startWrite (const void *buf, uint8_t len, const bool multicast) void reUseTX () uint8_t flush_tx (void) uint8_t flush_rx (void) bool testCarrier (void) bool testRPD (void) bool isValid () void closeReadingPipe (uint8_t pipe) Optional Configurators Methods you can use to get or set the configuration of the chip. None are required. Calling begin() sets up a reasonable set of defaults. uint32_t txDelay uint32_t csDelay void setAddressWidth (uint8_t a_width) void setRetries (uint8_t delay, uint8_t count) void setChannel (uint8_t channel) uint8_t getChannel (void) void setPayloadSize (uint8_t size) uint8_t getPayloadSize (void) uint8_t getDynamicPayloadSize (void) void enableAckPayload (void) void disableAckPayload (void) void enableDynamicPayloads (void) void disableDynamicPayloads (void) void enableDynamicAck () bool isPVariant (void) void setAutoAck (bool enable) void setAutoAck (uint8_t pipe, bool enable) void setPALevel (uint8_t level, bool lnaEnable=1) uint8_t getPALevel (void) uint8_t getARC (void) bool setDataRate (rf24_datarate_e speed) rf24_datarate_e getDataRate (void) void setCRCLength (rf24_crclength_e length) rf24_crclength_e getCRCLength (void) void disableCRC (void) void maskIRQ (bool tx_ok, bool tx_fail, bool rx_ready) void startConstCarrier (rf24_pa_dbm_e level, uint8_t channel) void stopConstCarrier (void) void toggleAllPipes (bool isEnabled) Open or close all data pipes. Detailed Description Driver class for nRF24L01(+) 2.4GHz Wireless Transceiver. Examplesexamples/AcknowledgementPayloads/AcknowledgementPayloads.ino, examples/GettingStarted/GettingStarted.ino, examples/InterruptConfigure/InterruptConfigure.ino, examples/ManualAcknowledgements/ManualAcknowledgements.ino, examples/MulticeiverDemo/MulticeiverDemo.ino, examples/StreamingData/StreamingData.ino, examples/old_backups/GettingStarted_HandlingFailures/GettingStarted_HandlingFailures.ino, examples/old_backups/TransferTimeouts/TransferTimeouts.ino, examples/old_backups/pingpair_dyn/pingpair_dyn.ino, examples/old_backups/pingpair_irq/pingpair_irq.ino, examples/old_backups/pingpair_sleepy/pingpair_sleepy.ino, examples/rf24_ATTiny/rf24ping85/rf24ping85.ino, examples/scanner/scanner.ino, examples_linux/acknowledgementPayloads.cpp, examples_linux/gettingstarted.cpp, examples_linux/manualAcknowledgements.cpp, examples_linux/multiceiverDemo.cpp, examples_linux/scanner.cpp, and examples_linux/streamingData.cpp. Definition at line 115 of file RF24.h. Constructor & Destructor Documentation ◆ RF24() [1/2] RF24::RF24(rf24_gpio_pin_t_cepin,rf24_gpio_pin_t_cspin,uint32_t_spi_speed = RF24_SPI_SPEED ) RF24 Constructor Creates a new instance of this driver. Before using, you create an instance and send in the unique pins that this chip is connected to. See Related Pages for device specific information Parameters_cepinThe pin attached to Chip Enable on the RF module_cspinThe pin attached to Chip Select (often labeled CSN) on the radio module. For the Arduino Due board, the Arduino Due extended SPI feature is not supported. This means that the Due's pins 4, 10, or 52 are not mandated options (can use any digital output pin) for the radio's CSN pin. _spi_speedThe SPI speed in Hz ie: 1000000 == 1Mhz Users can specify default SPI speed by modifying RF24_SPI_SPEED in RF24_config.h For Arduino, the default SPI speed will only be properly configured this way on devices supporting SPI TRANSACTIONS Older/Unsupported Arduino devices will use a default clock divider & settings configuration For Linux: The old way of setting SPI speeds using BCM2835 driver enums has been removed as of v1.3.7 Definition at line 564 of file RF24.cpp. ◆ RF24() [2/2] RF24::RF24(uint32_t_spi_speed = RF24_SPI_SPEED) A constructor for initializing the radio's hardware dynamically WarningYou MUST use begin(rf24_gpio_pin_t, rf24_gpio_pin_t) or begin(_SPI*, rf24_gpio_pin_t, rf24_gpio_pin_t) to pass both the digital output pin numbers connected to the radio's CE and CSN pins.Parameters_spi_speedThe SPI speed in Hz ie: 1000000 == 1Mhz Users can specify default SPI speed by modifying RF24_SPI_SPEED in RF24_config.h For Arduino, the default SPI speed will only be properly configured this way on devices supporting SPI TRANSACTIONS Older/Unsupported Arduino devices will use a default clock divider & settings configuration For Linux: The old way of setting SPI speeds using BCM2835 driver enums has been removed as of v1.3.7 Definition at line 572 of file RF24.cpp. Member Function Documentation ◆ beginTransaction() void RF24::beginTransaction()inlineprotected SPI transactions Common code for SPI transactions including CSN toggle Definition at line 117 of file RF24.cpp. ◆ endTransaction() void RF24::endTransaction()inlineprotected Definition at line 135 of file RF24.cpp. ◆ read_register() [1/2] void RF24::read_register(uint8_treg,uint8_t *buf,uint8_tlen )protected Read a chunk of data in from a register ParametersregWhich register. Use constants from nRF24L01.h[out]bufWhere to put the datalenHow many bytes of data to transferNoteThis returns nothing. Older versions of this function returned the status byte, but that it now saved to a private member on all SPI transactions. Definition at line 149 of file RF24.cpp. ◆ read_register() [2/2] uint8_t RF24::read_register(uint8_treg)protected Read single byte from a register ParametersregWhich register. Use constants from nRF24L01.hReturnsCurrent value of register reg Definition at line 200 of file RF24.cpp. ◆ begin() [1/4] bool RF24::begin(void) Begin operation of the chip Call this in setup(), before calling any other methods. if (!radio.begin()) { Serial.println(F("radio hardware not responding!")); while (1) {} // hold program in infinite loop to prevent subsequent errors } Returns true if the radio was successfully initialized false if the MCU failed to communicate with the radio hardware Definition at line 954 of file RF24.cpp. ◆ begin() [2/4] bool RF24::begin(_SPI *spiBus) Same as begin(), but allows specifying a non-default SPI bus to use. NoteThis function assumes the SPI::begin() method was called before to calling this function.WarningThis function is for the Arduino platforms onlyParametersspiBusA pointer or reference to an instantiated SPI bus object. The _SPI datatype is a "wrapped" definition that will represent various SPI implementations based on the specified platform.See alsoReview the Arduino support page.Returnssame result as begin() Definition at line 926 of file RF24.cpp. ◆ begin() [3/4] bool RF24::begin(_SPI *spiBus,rf24_gpio_pin_t_cepin,rf24_gpio_pin_t_cspin ) Same as begin(), but allows dynamically specifying a SPI bus, CE pin, and CSN pin to use. NoteThis function assumes the SPI::begin() method was called before to calling this function.WarningThis function is for the Arduino platforms onlyParametersspiBusA pointer or reference to an instantiated SPI bus object. The _SPI datatype is a "wrapped" definition that will represent various SPI implementations based on the specified platform._cepinThe pin attached to Chip Enable on the RF module_cspinThe pin attached to Chip Select (often labeled CSN) on the radio module. For the Arduino Due board, the Arduino Due extended SPI feature is not supported. This means that the Due's pins 4, 10, or 52 are not mandated options (can use any digital output pin) for the radio's CSN pin. See alsoReview the Arduino support page.Returnssame result as begin() Definition at line 934 of file RF24.cpp. ◆ begin() [4/4] bool RF24::begin(rf24_gpio_pin_t_cepin,rf24_gpio_pin_t_cspin ) Same as begin(), but allows dynamically specifying a CE pin and CSN pin to use. Parameters_cepinThe pin attached to Chip Enable on the RF module_cspinThe pin attached to Chip Select (often labeled CSN) on the radio module. For the Arduino Due board, the Arduino Due extended SPI feature is not supported. This means that the Due's pins 4, 10, or 52 are not mandated options (can use any digital output pin) for the radio's CSN pin. Returnssame result as begin() Definition at line 945 of file RF24.cpp. ◆ isChipConnected() bool RF24::isChipConnected() Checks if the chip is connected to the SPI bus Definition at line 1111 of file RF24.cpp. ◆ startListening() void RF24::startListening(void) Start listening on the pipes opened for reading. Be sure to call openReadingPipe() first. Do not call write() while in this mode, without first calling stopListening(). Call available() to check for incoming traffic, and read() to get it. Open reading pipe 1 using address 0xCCCECCCECC byte address[] = {0xCC, 0xCE, 0xCC, 0xCE, 0xCC}; radio.openReadingPipe(1,address); radio.startListening(); NoteIf there was a call to openReadingPipe() about pipe 0 prior to calling this function, then this function will re-write the address that was last set to reading pipe 0. This is because openWritingPipe() will overwrite the address to reading pipe 0 for proper auto-ack functionality. Definition at line 1125 of file RF24.cpp. ◆ stopListening() void RF24::stopListening(void) Stop listening for incoming messages, and switch to transmit mode. Do this before calling write(). radio.stopListening(); radio.write(&data, sizeof(data)); NoteWhen the ACK payloads feature is enabled, the TX FIFO buffers are flushed when calling this function. This is meant to discard any ACK payloads that were not appended to acknowledgment packets. Definition at line 1149 of file RF24.cpp. ◆ available() [1/2] bool RF24::available(void) Check whether there are bytes available to be read if(radio.available()){ radio.read(&data,sizeof(data)); } See alsoavailable(uint8_t*)ReturnsTrue if there is a payload available, false if none isWarningThis function relies on the information about the pipe number that received the next available payload. According to the datasheet, the data about the pipe number that received the next available payload is "unreliable" during a FALLING transition on the IRQ pin. This means you should call whatHappened() before calling this function during an ISR (Interrupt Service Routine). For example: void isrCallbackFunction() { bool tx_ds, tx_df, rx_dr; radio.whatHappened(tx_ds, tx_df, rx_dr); // resets the IRQ pin to HIGH radio.available(); // returned data should now be reliable } void setup() { pinMode(IRQ_PIN, INPUT); attachInterrupt(digitalPinToInterrupt(IRQ_PIN), isrCallbackFunction, FALLING); } Definition at line 1489 of file RF24.cpp. ◆ read() void RF24::read(void *buf,uint8_tlen ) Read payload data from the RX FIFO buffer(s). The length of data read is usually the next available payload's length See also getPayloadSize() getDynamicPayloadSize() NoteI specifically chose void* as a data type to make it easier for beginners to use. No casting needed.ParametersbufPointer to a buffer where the data should be writtenlenMaximum number of bytes to read into the buffer. This value should match the length of the object referenced using the buf parameter. The absolute maximum number of bytes that can be read in one call is 32 (for dynamic payload lengths) or whatever number was previously passed to setPayloadSize() (for static payload lengths).Remarks Remember that each call to read() fetches data from the RX FIFO beginning with the first byte from the first available payload. A payload is not removed from the RX FIFO until it's entire length (or more) is fetched using read(). If len parameter's value is less than the available payload's length, then the payload remains in the RX FIFO. If len parameter's value is greater than the first of multiple available payloads, then the data saved to the buf parameter's object will be supplemented with data from the next available payload. If len parameter's value is greater than the last available payload's length, then the last byte in the payload is used as padding for the data saved to the buf parameter's object. The nRF24L01 will repeatedly use the last byte from the last payload even when read() is called with an empty RX FIFO. NoteTo use this function in the python wrapper, remember that only the len parameter is required because this function (in the python wrapper) returns the payload data as a buffer protocol object (bytearray object). let
|
Hack neural networks. Web prollet hack.
The text was updated successfully, but these errors were encountered: