37 #ifndef DRIVER_NRF24L01_H
38 #define DRIVER_NRF24L01_H
168 uint8_t (*
spi_read)(uint8_t reg, uint8_t *buf, uint16_t len);
169 uint8_t (*
spi_write)(uint8_t reg, uint8_t *buf, uint16_t len);
210 #define DRIVER_NRF24L01_LINK_INIT(HANDLE, STRUCTURE) memset(HANDLE, 0, sizeof(STRUCTURE))
218 #define DRIVER_NRF24L01_LINK_SPI_INIT(HANDLE, FUC) (HANDLE)->spi_init = FUC
226 #define DRIVER_NRF24L01_LINK_SPI_DEINIT(HANDLE, FUC) (HANDLE)->spi_deinit = FUC
234 #define DRIVER_NRF24L01_LINK_SPI_READ(HANDLE, FUC) (HANDLE)->spi_read = FUC
242 #define DRIVER_NRF24L01_LINK_SPI_WRITE(HANDLE, FUC) (HANDLE)->spi_write = FUC
250 #define DRIVER_NRF24L01_LINK_GPIO_INIT(HANDLE, FUC) (HANDLE)->gpio_init = FUC
258 #define DRIVER_NRF24L01_LINK_GPIO_DEINIT(HANDLE, FUC) (HANDLE)->gpio_deinit = FUC
266 #define DRIVER_NRF24L01_LINK_GPIO_WRITE(HANDLE, FUC) (HANDLE)->gpio_write = FUC
274 #define DRIVER_NRF24L01_LINK_DELAY_MS(HANDLE, FUC) (HANDLE)->delay_ms = FUC
282 #define DRIVER_NRF24L01_LINK_DEBUG_PRINT(HANDLE, FUC) (HANDLE)->debug_print = FUC
290 #define DRIVER_NRF24L01_LINK_RECEIVE_CALLBACK(HANDLE, FUC) (HANDLE)->receive_callback = FUC
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
struct nrf24l01_handle_s nrf24l01_handle_t
nrf24l01 handle structure definition
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
struct nrf24l01_info_s nrf24l01_info_t
nrf24l01 information structure definition
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
nrf24l01_fifo_status_t
nrf24l01 fifo status enumeration definition
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_OUTPUT_POWER_NEGATIVE_6_DBM
@ NRF24L01_OUTPUT_POWER_NEGATIVE_12_DBM
@ NRF24L01_OUTPUT_POWER_0_DBM
@ NRF24L01_OUTPUT_POWER_NEGATIVE_18_DBM
@ NRF24L01_CONFIG_MASK_TX_DS
@ NRF24L01_CONFIG_MASK_MAX_RT
@ NRF24L01_CONFIG_MASK_RX_DR
@ NRF24L01_INTERRUPT_TX_DS
@ NRF24L01_INTERRUPT_MAX_RT
@ NRF24L01_INTERRUPT_RX_DR
@ NRF24L01_INTERRUPT_TX_FULL
@ NRF24L01_ADDRESS_WIDTH_3_BYTES
@ NRF24L01_ADDRESS_WIDTH_ILLEGAL
@ NRF24L01_ADDRESS_WIDTH_4_BYTES
@ NRF24L01_ADDRESS_WIDTH_5_BYTES
@ NRF24L01_FIFO_STATUS_TX_FULL
@ NRF24L01_FIFO_STATUS_TX_REUSE
@ NRF24L01_FIFO_STATUS_TX_EMPTY
@ NRF24L01_FIFO_STATUS_RX_EMPTY
@ NRF24L01_FIFO_STATUS_RX_FULL
@ NRF24L01_DATA_RATE_250K
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