42 #define CHIP_NAME "Nordic nRF24L01"
43 #define MANUFACTURER_NAME "Nordic"
44 #define SUPPLY_VOLTAGE_MIN 1.9f
45 #define SUPPLY_VOLTAGE_MAX 3.6f
46 #define MAX_CURRENT 13.50f
47 #define TEMPERATURE_MIN -40.0f
48 #define TEMPERATURE_MAX 85.0f
49 #define DRIVER_VERSION 1000
54 #define NRF24L01_COMMAND_R_REGISTER 0x00
55 #define NRF24L01_COMMAND_W_REGISTER 0x20
56 #define NRF24L01_COMMAND_R_RX_PAYLOAD 0x61
57 #define NRF24L01_COMMAND_W_TX_PAYLOAD 0xA0
58 #define NRF24L01_COMMAND_FLUSH_TX 0xE1
59 #define NRF24L01_COMMAND_FLUSH_RX 0xE2
60 #define NRF24L01_COMMAND_REUSE_TX_PL 0xE3
61 #define NRF24L01_COMMAND_R_RX_PL_WID 0x60
62 #define NRF24L01_COMMAND_W_ACK_PAYLOAD 0xA8
63 #define NRF24L01_COMMAND_W_TX_PAYLOAD_NO_ACK 0xB0
64 #define NRF24L01_COMMAND_NOP 0xFF
69 #define NRF24L01_REG_CONFIG 0x00
70 #define NRF24L01_REG_EN_AA 0x01
71 #define NRF24L01_REG_EN_RXADDR 0x02
72 #define NRF24L01_REG_SETUP_AW 0x03
73 #define NRF24L01_REG_SETUP_RETR 0x04
74 #define NRF24L01_REG_RF_CH 0x05
75 #define NRF24L01_REG_RF_SETUP 0x06
76 #define NRF24L01_REG_STATUS 0x07
77 #define NRF24L01_REG_OBSERVE_TX 0x08
78 #define NRF24L01_REG_RPD 0x09
79 #define NRF24L01_REG_RX_ADDR_P0 0x0A
80 #define NRF24L01_REG_RX_ADDR_P1 0x0B
81 #define NRF24L01_REG_RX_ADDR_P2 0x0C
82 #define NRF24L01_REG_RX_ADDR_P3 0x0D
83 #define NRF24L01_REG_RX_ADDR_P4 0x0E
84 #define NRF24L01_REG_RX_ADDR_P5 0x0F
85 #define NRF24L01_REG_TX_ADDR 0x10
86 #define NRF24L01_REG_RX_PW_P0 0x11
87 #define NRF24L01_REG_RX_PW_P1 0x12
88 #define NRF24L01_REG_RX_PW_P2 0x13
89 #define NRF24L01_REG_RX_PW_P3 0x14
90 #define NRF24L01_REG_RX_PW_P4 0x15
91 #define NRF24L01_REG_RX_PW_P5 0x16
92 #define NRF24L01_REG_FIFO_STATUS 0x17
93 #define NRF24L01_REG_DYNPD 0x1C
94 #define NRF24L01_REG_FEATURE 0x1D
107 static uint8_t a_nrf24l01_spi_read(
nrf24l01_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
130 static uint8_t a_nrf24l01_spi_write(
nrf24l01_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
165 handle->
debug_print(
"nrf24l01: spi_init is null.\n");
171 handle->
debug_print(
"nrf24l01: spi_deinit is null.\n");
177 handle->
debug_print(
"nrf24l01: spi_read is null.\n");
183 handle->
debug_print(
"nrf24l01: spi_write is null.\n");
189 handle->
debug_print(
"nrf24l01: gpio_init is null.\n");
195 handle->
debug_print(
"nrf24l01: gpio_deinit is null.\n");
201 handle->
debug_print(
"nrf24l01: gpio_write is null.\n");
207 handle->
debug_print(
"nrf24l01: delay_ms is null.\n");
213 handle->
debug_print(
"nrf24l01: receive_callback is null.\n");
220 handle->
debug_print(
"nrf24l01: gpio init failed.\n");
226 handle->
debug_print(
"nrf24l01: spi init failed.\n");
273 handle->
debug_print(
"nrf24l01: get config failed.\n");
281 handle->
debug_print(
"nrf24l01: set config failed.\n");
288 handle->
debug_print(
"nrf24l01: gpio deinit failed.\n");
295 handle->
debug_print(
"nrf24l01: spi deinit failed.\n");
328 handle->
debug_print(
"nrf24l01: gpio write failed.\n");
369 handle->
debug_print(
"nrf24l01: len is over 32.\n");
374 memcpy((uint8_t *)buffer, buf, len);
376 for (i = 0; i < k; i++)
379 buffer[i] = buffer[len - 1 - i];
380 buffer[len - 1 - i] = tmp;
385 handle->
debug_print(
"nrf24l01: gpio write failed.\n");
392 handle->
debug_print(
"nrf24l01: set tx payload failed.\n");
398 handle->
debug_print(
"nrf24l01: gpio write failed.\n");
403 while ((timeout != 0) && (handle->
finished == 0))
453 handle->
debug_print(
"nrf24l01: gpio write failed.\n");
460 handle->
debug_print(
"nrf24l01: get status register failed.\n");
468 handle->
debug_print(
"nrf24l01: set status register failed.\n");
474 if (((prev >> 0) & 0x01) != 0)
481 if (((prev >> 4) & 0x01) != 0)
486 handle->
debug_print(
"nrf24l01: flush tx failed.\n");
497 if (((prev >> 5) & 0x01) != 0)
505 if (((prev >> 6) & 0x01) != 0)
517 handle->
debug_print(
"nrf24l01: get payload width failed.\n");
527 handle->
debug_print(
"nrf24l01: flush rx failed.\n");
536 handle->
debug_print(
"nrf24l01: get rx payload failed.\n");
542 for (i = 0; i < k; i++)
545 buffer[i] = buffer[width - 1 - i];
546 buffer[width - 1 - i] = tmp;
548 num = (prev >> 1) & 0x7;
557 handle->
debug_print(
"nrf24l01: gpio write failed.\n");
594 handle->
debug_print(
"nrf24l01: get config failed.\n");
598 prev &= ~(1 << config);
599 prev |= enable << config;
603 handle->
debug_print(
"nrf24l01: set config failed.\n");
640 handle->
debug_print(
"nrf24l01: get config failed.\n");
677 handle->
debug_print(
"nrf24l01: get config failed.\n");
686 handle->
debug_print(
"nrf24l01: set config failed.\n");
722 handle->
debug_print(
"nrf24l01: get config failed.\n");
760 handle->
debug_print(
"nrf24l01: get auto acknowledgment failed.\n");
764 prev &= ~(1 << pipe);
765 prev |= enable << pipe;
769 handle->
debug_print(
"nrf24l01: set auto acknowledgment failed.\n");
806 handle->
debug_print(
"nrf24l01: get auto acknowledgment failed.\n");
844 handle->
debug_print(
"nrf24l01: get rx address failed.\n");
848 prev &= ~(1 << pipe);
849 prev |= enable << pipe;
853 handle->
debug_print(
"nrf24l01: set rx address failed.\n");
890 handle->
debug_print(
"nrf24l01: get rx address failed.\n");
927 handle->
debug_print(
"nrf24l01: get setup of address widths failed.\n");
936 handle->
debug_print(
"nrf24l01: set setup of address widths failed.\n");
972 handle->
debug_print(
"nrf24l01: get setup of address widths failed.\n");
1008 handle->
debug_print(
"nrf24l01: delay is over 0xF.\n");
1016 handle->
debug_print(
"nrf24l01: get setup of automatic retransmission failed.\n");
1020 prev &= ~(0xF << 4);
1025 handle->
debug_print(
"nrf24l01: set setup of automatic retransmission failed.\n");
1061 handle->
debug_print(
"nrf24l01: get setup of automatic retransmission failed.\n");
1065 *delay = (prev >> 4) & 0xF;
1092 *reg = (uint8_t)(us / 250);
1119 *us = (uint32_t)(reg) * 250;
1151 handle->
debug_print(
"nrf24l01: count is over 0xF.\n");
1159 handle->
debug_print(
"nrf24l01: get setup of automatic retransmission failed.\n");
1163 prev &= ~(0xF << 0);
1168 handle->
debug_print(
"nrf24l01: set setup of automatic retransmission failed.\n");
1204 handle->
debug_print(
"nrf24l01: get setup of automatic retransmission failed.\n");
1208 *count = (prev >> 0) & 0xF;
1240 handle->
debug_print(
"nrf24l01: freq is over 0x7F.\n");
1248 handle->
debug_print(
"nrf24l01: get rf channel failed.\n");
1252 prev &= ~(0x7F << 0);
1257 handle->
debug_print(
"nrf24l01: set rf channel failed.\n");
1293 handle->
debug_print(
"nrf24l01: get rf channel failed.\n");
1297 *freq = prev & 0x7F;
1330 handle->
debug_print(
"nrf24l01: get rf setup register failed.\n");
1335 prev |= enable << 7;
1339 handle->
debug_print(
"nrf24l01: set rf setup register failed.\n");
1375 handle->
debug_print(
"nrf24l01: get rf setup register failed.\n");
1412 handle->
debug_print(
"nrf24l01: get rf setup register failed.\n");
1417 prev |= enable << 4;
1421 handle->
debug_print(
"nrf24l01: set rf setup register failed.\n");
1457 handle->
debug_print(
"nrf24l01: get rf setup register failed.\n");
1494 handle->
debug_print(
"nrf24l01: get rf setup register failed.\n");
1500 prev |= ((rate >> 0) & 0x1) << 3;
1501 prev |= ((rate >> 1) & 0x1) << 5;
1505 handle->
debug_print(
"nrf24l01: set rf setup register failed.\n");
1541 handle->
debug_print(
"nrf24l01: get rf setup register failed.\n");
1578 handle->
debug_print(
"nrf24l01: get rf setup register failed.\n");
1587 handle->
debug_print(
"nrf24l01: set rf setup register failed.\n");
1623 handle->
debug_print(
"nrf24l01: get rf setup register failed.\n");
1661 handle->
debug_print(
"nrf24l01: get status register failed.\n");
1698 handle->
debug_print(
"nrf24l01: get status register failed.\n");
1702 prev &= ~(1 << type);
1707 handle->
debug_print(
"nrf24l01: set status register failed.\n");
1743 handle->
debug_print(
"nrf24l01: get status register failed.\n");
1747 *number = (prev >> 1) & 0x7;
1780 handle->
debug_print(
"nrf24l01: get transmit observe register failed.\n");
1784 *count = (prev >> 4) & 0xF;
1817 handle->
debug_print(
"nrf24l01: get transmit observe register failed.\n");
1821 *count = (prev >> 0) & 0xF;
1854 handle->
debug_print(
"nrf24l01: get rpd failed.\n");
1898 handle->
debug_print(
"nrf24l01: get setup of address widths failed.\n");
1905 handle->
debug_print(
"nrf24l01: len is too long with %d.\n", 0);
1915 handle->
debug_print(
"nrf24l01: len is too long with %d.\n", width);
1921 memcpy((uint8_t *)buffer, addr, len);
1922 for (i = 0; i < k; i++)
1925 buffer[i] = buffer[len - 1 - i];
1926 buffer[len - 1 - i] = tmp;
1931 handle->
debug_print(
"nrf24l01: set receive address data pipe p0 register failed.\n");
1973 handle->
debug_print(
"nrf24l01: get setup of address widths failed.\n");
1980 handle->
debug_print(
"nrf24l01: len is too long with %d.\n", 0);
1990 handle->
debug_print(
"nrf24l01: len is too short with %d.\n", width);
1999 handle->
debug_print(
"nrf24l01: get receive address data pipe p0 register failed.\n");
2004 for (i = 0; i < k; i++)
2007 addr[i] = addr[(*len) - 1 - i];
2008 addr[(*len) - 1 - i] = tmp;
2049 handle->
debug_print(
"nrf24l01: get setup of address widths failed.\n");
2056 handle->
debug_print(
"nrf24l01: len is too long with %d.\n", 0);
2066 handle->
debug_print(
"nrf24l01: len is too long with %d.\n", width);
2072 memcpy((uint8_t *)buffer, addr, len);
2073 for (i = 0; i < k; i++)
2076 buffer[i] = buffer[len - 1 - i];
2077 buffer[len - 1 - i] = tmp;
2082 handle->
debug_print(
"nrf24l01: set receive address data pipe p1 register failed.\n");
2124 handle->
debug_print(
"nrf24l01: get setup of address widths failed.\n");
2131 handle->
debug_print(
"nrf24l01: len is too long with %d.\n", 0);
2141 handle->
debug_print(
"nrf24l01: len is too short with %d.\n", width);
2150 handle->
debug_print(
"nrf24l01: get receive address data pipe p1 register failed.\n");
2155 for (i = 0; i < k; i++)
2158 addr[i] = addr[(*len) - 1 - i];
2159 addr[(*len) - 1 - i] = tmp;
2192 handle->
debug_print(
"nrf24l01: set receive address data pipe p2 register failed.\n");
2227 handle->
debug_print(
"nrf24l01: get receive address data pipe p2 register failed.\n");
2262 handle->
debug_print(
"nrf24l01: set receive address data pipe p3 register failed.\n");
2297 handle->
debug_print(
"nrf24l01: get receive address data pipe p3 register failed.\n");
2332 handle->
debug_print(
"nrf24l01: set receive address data pipe p4 register failed.\n");
2367 handle->
debug_print(
"nrf24l01: get receive address data pipe p4 register failed.\n");
2402 handle->
debug_print(
"nrf24l01: set receive address data pipe p5 register failed.\n");
2437 handle->
debug_print(
"nrf24l01: get receive address data pipe p5 register failed.\n");
2480 handle->
debug_print(
"nrf24l01: get setup of address widths failed.\n");
2487 handle->
debug_print(
"nrf24l01: len is too long with %d.\n", 0);
2497 handle->
debug_print(
"nrf24l01: len is too long with %d.\n", width);
2503 memcpy((uint8_t *)buffer, addr, len);
2504 for (i = 0; i < k; i++)
2507 buffer[i] = buffer[len - 1 - i];
2508 buffer[len - 1 - i] = tmp;
2513 handle->
debug_print(
"nrf24l01: set tx address failed.\n");
2555 handle->
debug_print(
"nrf24l01: get setup of address widths failed.\n");
2562 handle->
debug_print(
"nrf24l01: len is too long with %d.\n", 0);
2572 handle->
debug_print(
"nrf24l01: len is too short with %d.\n", width);
2581 handle->
debug_print(
"nrf24l01: get tx address failed.\n");
2586 for (i = 0; i < k; i++)
2589 addr[i] = addr[(*len) - 1 - i];
2590 addr[(*len) - 1 - i] = tmp;
2622 handle->
debug_print(
"nrf24l01: num is over 0x3F.\n");
2630 handle->
debug_print(
"nrf24l01: set pipe 0 payload number failed.\n");
2665 handle->
debug_print(
"nrf24l01: get pipe 0 payload number failed.\n");
2669 *num = (*num) & 0x3F;
2700 handle->
debug_print(
"nrf24l01: num is over 0x3F.\n");
2708 handle->
debug_print(
"nrf24l01: set pipe 1 payload number failed.\n");
2743 handle->
debug_print(
"nrf24l01: get pipe 1 payload number failed.\n");
2747 *num = (*num) & 0x3F;
2778 handle->
debug_print(
"nrf24l01: num is over 0x3F.\n");
2786 handle->
debug_print(
"nrf24l01: set pipe 2 payload number failed.\n");
2821 handle->
debug_print(
"nrf24l01: get pipe 2 payload number failed.\n");
2825 *num = (*num) & 0x3F;
2856 handle->
debug_print(
"nrf24l01: num is over 0x3F.\n");
2864 handle->
debug_print(
"nrf24l01: set pipe 3 payload number failed.\n");
2899 handle->
debug_print(
"nrf24l01: get pipe 3 payload number failed.\n");
2903 *num = (*num) & 0x3F;
2934 handle->
debug_print(
"nrf24l01: num is over 0x3F.\n");
2942 handle->
debug_print(
"nrf24l01: set pipe 4 payload number failed.\n");
2977 handle->
debug_print(
"nrf24l01: get pipe 4 payload number failed.\n");
2981 *num = (*num) & 0x3F;
3012 handle->
debug_print(
"nrf24l01: num is over 0x3F.\n");
3020 handle->
debug_print(
"nrf24l01: set pipe 5 payload number failed.\n");
3055 handle->
debug_print(
"nrf24l01: get pipe 5 payload number failed.\n");
3059 *num = (*num) & 0x3F;
3091 handle->
debug_print(
"nrf24l01: get fifo status failed.\n");
3128 handle->
debug_print(
"nrf24l01: get dynamic payload length register failed.\n");
3132 prev &= ~(1 << pipe);
3133 prev |= enable << pipe;
3137 handle->
debug_print(
"nrf24l01: set dynamic payload length register failed.\n");
3174 handle->
debug_print(
"nrf24l01: get dynamic payload length register failed.\n");
3211 handle->
debug_print(
"nrf24l01: get feature register failed.\n");
3216 prev |= enable << 2;
3220 handle->
debug_print(
"nrf24l01: set feature register failed.\n");
3256 handle->
debug_print(
"nrf24l01: get feature register failed.\n");
3293 handle->
debug_print(
"nrf24l01: get feature register failed.\n");
3298 prev |= enable << 1;
3302 handle->
debug_print(
"nrf24l01: set feature register failed.\n");
3338 handle->
debug_print(
"nrf24l01: get feature register failed.\n");
3375 handle->
debug_print(
"nrf24l01: get feature register failed.\n");
3380 prev |= enable << 0;
3384 handle->
debug_print(
"nrf24l01: set feature register failed.\n");
3420 handle->
debug_print(
"nrf24l01: get feature register failed.\n");
3459 handle->
debug_print(
"nrf24l01: len is over 32.\n");
3467 handle->
debug_print(
"nrf24l01: get rx payload failed.\n");
3472 for (i = 0; i < k; i++)
3475 buf[i] = buf[len - 1 - i];
3476 buf[len - 1 - i] = tmp;
3513 handle->
debug_print(
"nrf24l01: len is over 32.\n");
3518 for (i = 0; i < len; i++)
3523 for (i = 0; i < k; i++)
3526 buffer[i] = buffer[len - 1 - i];
3527 buffer[len - 1 - i] = tmp;
3532 handle->
debug_print(
"nrf24l01: set tx payload failed.\n");
3566 handle->
debug_print(
"nrf24l01: flush tx failed.\n");
3600 handle->
debug_print(
"nrf24l01: flush rx failed.\n");
3634 handle->
debug_print(
"nrf24l01: reuse tx payload failed.\n");
3669 handle->
debug_print(
"nrf24l01: get payload width failed.\n");
3709 handle->
debug_print(
"nrf24l01: len is over 32.\n");
3714 for (i = 0; i < len; i++)
3719 for (i = 0; i < k; i++)
3722 buffer[i] = buffer[len - 1 - i];
3723 buffer[len - 1 - i] = tmp;
3726 (uint8_t *)buffer, len);
3729 handle->
debug_print(
"nrf24l01: set payload with ack failed.\n");
3768 handle->
debug_print(
"nrf24l01: len is over 32.\n");
3773 for (i = 0; i < len; i++)
3778 for (i = 0; i < k; i++)
3781 buffer[i] = buffer[len - 1 - i];
3782 buffer[len - 1 - i] = tmp;
3788 handle->
debug_print(
"nrf24l01: set payload with no ack failed.\n");
3854 return a_nrf24l01_spi_write(handle, reg, buf, len);
3881 return a_nrf24l01_spi_read(handle, reg, buf, len);
#define NRF24L01_COMMAND_FLUSH_RX
#define NRF24L01_REG_FEATURE
#define NRF24L01_COMMAND_FLUSH_TX
#define NRF24L01_REG_RX_PW_P4
#define NRF24L01_REG_STATUS
#define NRF24L01_REG_EN_RXADDR
#define NRF24L01_REG_RX_PW_P5
#define NRF24L01_COMMAND_NOP
#define NRF24L01_REG_RX_ADDR_P1
#define NRF24L01_REG_EN_AA
#define NRF24L01_COMMAND_R_REGISTER
chip command definition
#define NRF24L01_REG_OBSERVE_TX
#define NRF24L01_REG_RX_ADDR_P5
#define SUPPLY_VOLTAGE_MAX
#define NRF24L01_REG_RX_PW_P1
#define NRF24L01_COMMAND_W_TX_PAYLOAD_NO_ACK
#define NRF24L01_REG_RX_ADDR_P3
#define NRF24L01_REG_CONFIG
chip register definition
#define NRF24L01_REG_RF_SETUP
#define NRF24L01_REG_RX_PW_P3
#define NRF24L01_REG_DYNPD
#define NRF24L01_COMMAND_R_RX_PAYLOAD
#define NRF24L01_REG_RX_ADDR_P4
#define NRF24L01_REG_RX_PW_P2
#define MANUFACTURER_NAME
#define SUPPLY_VOLTAGE_MIN
#define NRF24L01_REG_SETUP_RETR
#define NRF24L01_REG_RX_ADDR_P2
#define NRF24L01_REG_FIFO_STATUS
#define NRF24L01_REG_SETUP_AW
#define NRF24L01_REG_TX_ADDR
#define NRF24L01_COMMAND_W_ACK_PAYLOAD
#define NRF24L01_REG_RF_CH
#define NRF24L01_COMMAND_W_REGISTER
#define CHIP_NAME
chip information definition
#define NRF24L01_COMMAND_REUSE_TX_PL
#define NRF24L01_COMMAND_R_RX_PL_WID
#define NRF24L01_REG_RX_PW_P0
#define NRF24L01_COMMAND_W_TX_PAYLOAD
#define NRF24L01_REG_RX_ADDR_P0
driver nrf24l01 header file
uint8_t nrf24l01_get_rx_pipe_2_address(nrf24l01_handle_t *handle, uint8_t *addr)
get the rx pipe 2 address
nrf24l01_output_power_t
nrf24l01 output power enumeration definition
uint8_t nrf24l01_get_pipe_4_payload_number(nrf24l01_handle_t *handle, uint8_t *num)
get the pipe 4 payload number
uint8_t nrf24l01_flush_tx(nrf24l01_handle_t *handle)
flush tx
uint8_t nrf24l01_get_auto_retransmit_delay(nrf24l01_handle_t *handle, uint8_t *delay)
get the auto retransmit delay
uint8_t nrf24l01_get_rx_pipe_3_address(nrf24l01_handle_t *handle, uint8_t *addr)
get the rx pipe 3 address
uint8_t nrf24l01_get_fifo_status(nrf24l01_handle_t *handle, uint8_t *status)
get the fifo status
uint8_t nrf24l01_get_pipe_1_payload_number(nrf24l01_handle_t *handle, uint8_t *num)
get the pipe 1 payload number
uint8_t nrf24l01_set_dynamic_payload(nrf24l01_handle_t *handle, nrf24l01_bool_t enable)
enable or disable the dynamic payload
uint8_t nrf24l01_set_rx_pipe_3_address(nrf24l01_handle_t *handle, uint8_t addr)
set the rx pipe 3 address
uint8_t nrf24l01_set_tx_address(nrf24l01_handle_t *handle, uint8_t *addr, uint8_t len)
set the tx address
uint8_t nrf24l01_set_pipe_2_payload_number(nrf24l01_handle_t *handle, uint8_t num)
set the pipe 2 payload number
uint8_t nrf24l01_set_pipe_0_payload_number(nrf24l01_handle_t *handle, uint8_t num)
set the pipe 0 payload number
uint8_t nrf24l01_write_tx_payload(nrf24l01_handle_t *handle, uint8_t *buf, uint8_t len)
write the tx payload
uint8_t nrf24l01_set_tx_payload_with_no_ack(nrf24l01_handle_t *handle, nrf24l01_bool_t enable)
enable or disable the tx payload with no ack
uint8_t nrf24l01_get_interrupt(nrf24l01_handle_t *handle, nrf24l01_interrupt_t type, nrf24l01_bool_t *enable)
get the interrupt status
uint8_t nrf24l01_set_pipe_dynamic_payload(nrf24l01_handle_t *handle, nrf24l01_pipe_t pipe, nrf24l01_bool_t enable)
enable or disable the pipe dynamic payload
nrf24l01_config_t
nrf24l01 config enumeration definition
uint8_t nrf24l01_get_retransmitted_packet_count(nrf24l01_handle_t *handle, uint8_t *count)
get the retransmitted packet count
uint8_t nrf24l01_nop(nrf24l01_handle_t *handle)
nop
uint8_t nrf24l01_get_rx_pipe_1_address(nrf24l01_handle_t *handle, uint8_t *addr, uint8_t *len)
get the rx pipe 1 address
uint8_t nrf24l01_set_auto_retransmit_count(nrf24l01_handle_t *handle, uint8_t count)
set the auto retransmit count
uint8_t nrf24l01_get_dynamic_payload(nrf24l01_handle_t *handle, nrf24l01_bool_t *enable)
get the dynamic payload status
uint8_t nrf24l01_set_pipe_4_payload_number(nrf24l01_handle_t *handle, uint8_t num)
set the pipe 4 payload number
uint8_t nrf24l01_send(nrf24l01_handle_t *handle, uint8_t *buf, uint8_t len)
send data
uint8_t nrf24l01_set_payload_with_ack(nrf24l01_handle_t *handle, nrf24l01_bool_t enable)
enable or disable the payload with ack
uint8_t nrf24l01_write_payload_with_no_ack(nrf24l01_handle_t *handle, uint8_t *buf, uint8_t len)
write the payload with no ack
uint8_t nrf24l01_set_config(nrf24l01_handle_t *handle, nrf24l01_config_t config, nrf24l01_bool_t enable)
enable or disable configure
uint8_t nrf24l01_get_received_power_detector(nrf24l01_handle_t *handle, nrf24l01_bool_t *enable)
get the received power detector
uint8_t nrf24l01_get_rx_payload_width(nrf24l01_handle_t *handle, uint8_t *width)
get the rx payload width
uint8_t nrf24l01_set_output_power(nrf24l01_handle_t *handle, nrf24l01_output_power_t power)
set the output power
uint8_t nrf24l01_set_rx_pipe_1_address(nrf24l01_handle_t *handle, uint8_t *addr, uint8_t len)
set the rx pipe 1 address
uint8_t nrf24l01_get_payload_with_ack(nrf24l01_handle_t *handle, nrf24l01_bool_t *enable)
get the payload with ack status
uint8_t nrf24l01_get_mode(nrf24l01_handle_t *handle, nrf24l01_mode_t *mode)
get the chip mode
nrf24l01_mode_t
nrf24l01 mode enumeration definition
uint8_t nrf24l01_auto_retransmit_delay_convert_to_data(nrf24l01_handle_t *handle, uint8_t reg, uint32_t *us)
convert the register raw data to the delay
uint8_t nrf24l01_set_channel_frequency(nrf24l01_handle_t *handle, uint8_t freq)
set the channel frequency
uint8_t nrf24l01_get_address_width(nrf24l01_handle_t *handle, nrf24l01_address_width_t *width)
get the address width
uint8_t nrf24l01_get_pipe_0_payload_number(nrf24l01_handle_t *handle, uint8_t *num)
get the pipe 0 payload number
uint8_t nrf24l01_get_auto_retransmit_count(nrf24l01_handle_t *handle, uint8_t *count)
get the auto retransmit count
uint8_t nrf24l01_irq_handler(nrf24l01_handle_t *handle)
irq handler
uint8_t nrf24l01_set_auto_acknowledgment(nrf24l01_handle_t *handle, nrf24l01_pipe_t pipe, nrf24l01_bool_t enable)
enable or disable auto acknowledgment
uint8_t nrf24l01_get_pipe_2_payload_number(nrf24l01_handle_t *handle, uint8_t *num)
get the pipe 2 payload number
uint8_t nrf24l01_clear_interrupt(nrf24l01_handle_t *handle, nrf24l01_interrupt_t type)
clear the interrupt status
uint8_t nrf24l01_get_output_power(nrf24l01_handle_t *handle, nrf24l01_output_power_t *power)
get the output power
uint8_t nrf24l01_get_auto_acknowledgment(nrf24l01_handle_t *handle, nrf24l01_pipe_t pipe, nrf24l01_bool_t *enable)
get the auto acknowledgment status
uint8_t nrf24l01_get_rx_pipe_0_address(nrf24l01_handle_t *handle, uint8_t *addr, uint8_t *len)
get the rx pipe 0 address
uint8_t nrf24l01_get_tx_address(nrf24l01_handle_t *handle, uint8_t *addr, uint8_t *len)
get the tx address
uint8_t nrf24l01_get_pipe_dynamic_payload(nrf24l01_handle_t *handle, nrf24l01_pipe_t pipe, nrf24l01_bool_t *enable)
get the pipe dynamic payload status
uint8_t nrf24l01_set_pipe_3_payload_number(nrf24l01_handle_t *handle, uint8_t num)
set the pipe 3 payload number
uint8_t nrf24l01_get_config(nrf24l01_handle_t *handle, nrf24l01_config_t config, nrf24l01_bool_t *enable)
get the configure
uint8_t nrf24l01_write_payload_with_ack(nrf24l01_handle_t *handle, nrf24l01_pipe_t pipe, uint8_t *buf, uint8_t len)
write the payload with ack
uint8_t nrf24l01_get_rx_pipe(nrf24l01_handle_t *handle, nrf24l01_pipe_t pipe, nrf24l01_bool_t *enable)
get the rx pipe status
uint8_t nrf24l01_auto_retransmit_delay_convert_to_register(nrf24l01_handle_t *handle, uint32_t us, uint8_t *reg)
convert the delay to the register raw data
uint8_t nrf24l01_get_data_pipe_number(nrf24l01_handle_t *handle, uint8_t *number)
get the data pipe number
uint8_t nrf24l01_get_data_rate(nrf24l01_handle_t *handle, nrf24l01_data_rate_t *rate)
get the data rate
uint8_t nrf24l01_read_rx_payload(nrf24l01_handle_t *handle, uint8_t *buf, uint8_t len)
read the rx payload
uint8_t nrf24l01_get_rx_pipe_5_address(nrf24l01_handle_t *handle, uint8_t *addr)
get the rx pipe 5 address
uint8_t nrf24l01_get_channel_frequency(nrf24l01_handle_t *handle, uint8_t *freq)
get the channel frequency
uint8_t nrf24l01_set_rx_pipe_5_address(nrf24l01_handle_t *handle, uint8_t addr)
set the rx pipe 5 address
nrf24l01_interrupt_t
nrf24l01 interrupt enumeration definition
uint8_t nrf24l01_set_address_width(nrf24l01_handle_t *handle, nrf24l01_address_width_t width)
set the address width
uint8_t nrf24l01_set_active(nrf24l01_handle_t *handle, nrf24l01_bool_t enable)
enable or disable the chip
nrf24l01_address_width_t
nrf24l01 address width enumeration definition
uint8_t nrf24l01_get_lost_packet_count(nrf24l01_handle_t *handle, uint8_t *count)
get the lost packet count
uint8_t nrf24l01_set_rx_pipe(nrf24l01_handle_t *handle, nrf24l01_pipe_t pipe, nrf24l01_bool_t enable)
enable or disable rx pipe
nrf24l01_pipe_t
nrf24l01 pipe enumeration definition
uint8_t nrf24l01_get_continuous_carrier_transmit(nrf24l01_handle_t *handle, nrf24l01_bool_t *enable)
get the continuous carrier transmit status
uint8_t nrf24l01_info(nrf24l01_info_t *info)
get chip's information
uint8_t nrf24l01_set_pipe_5_payload_number(nrf24l01_handle_t *handle, uint8_t num)
set the pipe 5 payload number
uint8_t nrf24l01_set_continuous_carrier_transmit(nrf24l01_handle_t *handle, nrf24l01_bool_t enable)
enable or disable continuous carrier transmit
uint8_t nrf24l01_init(nrf24l01_handle_t *handle)
initialize the chip
uint8_t nrf24l01_set_force_pll_lock_signal(nrf24l01_handle_t *handle, nrf24l01_bool_t enable)
enable or disable force pll lock signal
uint8_t nrf24l01_get_pipe_3_payload_number(nrf24l01_handle_t *handle, uint8_t *num)
get the pipe 3 payload number
uint8_t nrf24l01_set_rx_pipe_2_address(nrf24l01_handle_t *handle, uint8_t addr)
set the rx pipe 2 address
uint8_t nrf24l01_get_rx_pipe_4_address(nrf24l01_handle_t *handle, uint8_t *addr)
get the rx pipe 4 address
uint8_t nrf24l01_get_force_pll_lock_signal(nrf24l01_handle_t *handle, nrf24l01_bool_t *enable)
get the force pll lock signal status
uint8_t nrf24l01_set_mode(nrf24l01_handle_t *handle, nrf24l01_mode_t mode)
set the chip mode
uint8_t nrf24l01_set_auto_retransmit_delay(nrf24l01_handle_t *handle, uint8_t delay)
set the auto retransmit delay
uint8_t nrf24l01_get_pipe_5_payload_number(nrf24l01_handle_t *handle, uint8_t *num)
get the pipe 5 payload number
uint8_t nrf24l01_set_pipe_1_payload_number(nrf24l01_handle_t *handle, uint8_t num)
set the pipe 1 payload number
uint8_t nrf24l01_flush_rx(nrf24l01_handle_t *handle)
flush rx
nrf24l01_data_rate_t
nrf24l01 data rate enumeration definition
uint8_t nrf24l01_deinit(nrf24l01_handle_t *handle)
close the chip
uint8_t nrf24l01_set_data_rate(nrf24l01_handle_t *handle, nrf24l01_data_rate_t rate)
set the data rate
uint8_t nrf24l01_get_tx_payload_with_no_ack(nrf24l01_handle_t *handle, nrf24l01_bool_t *enable)
get the tx payload with no ack status
nrf24l01_bool_t
nrf24l01 bool enumeration definition
uint8_t nrf24l01_set_rx_pipe_0_address(nrf24l01_handle_t *handle, uint8_t *addr, uint8_t len)
set the rx pipe 0 address
uint8_t nrf24l01_reuse_tx_payload(nrf24l01_handle_t *handle)
reuse the tx payload
uint8_t nrf24l01_set_rx_pipe_4_address(nrf24l01_handle_t *handle, uint8_t addr)
set the rx pipe 4 address
@ NRF24L01_INTERRUPT_TX_DS
@ NRF24L01_INTERRUPT_MAX_RT
@ NRF24L01_INTERRUPT_RX_DR
@ NRF24L01_INTERRUPT_TX_FULL
uint8_t nrf24l01_get_reg(nrf24l01_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
get the chip register
uint8_t nrf24l01_set_reg(nrf24l01_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
set the chip register
nrf24l01 handle structure definition
uint8_t(* gpio_write)(uint8_t value)
uint8_t(* spi_init)(void)
void(* delay_ms)(uint32_t ms)
uint8_t(* spi_read)(uint8_t reg, uint8_t *buf, uint16_t len)
uint8_t(* spi_write)(uint8_t reg, uint8_t *buf, uint16_t len)
void(* debug_print)(const char *const fmt,...)
uint8_t(* spi_deinit)(void)
uint8_t(* gpio_init)(void)
uint8_t(* gpio_deinit)(void)
void(* receive_callback)(uint8_t type, uint8_t num, uint8_t *buf, uint8_t len)
nrf24l01 information structure definition
float supply_voltage_max_v
char manufacturer_name[32]
float supply_voltage_min_v