38 #define TM_NRF24L01_H 100
114 #include "stm32fxxx_hal.h"
116 #include "tm_stm32_spi.h"
117 #include "tm_stm32_gpio.h"
127 #define NRF24L01_SPI SPI3
128 #define NRF24L01_SPI_PINS TM_SPI_PinsPack_2
132 #ifndef NRF24L01_CSN_PIN
133 #define NRF24L01_CSN_PORT GPIOD
134 #define NRF24L01_CSN_PIN GPIO_PIN_7
138 #ifndef NRF24L01_CE_PIN
139 #define NRF24L01_CE_PORT GPIOD
140 #define NRF24L01_CE_PIN GPIO_PIN_8
144 #define NRF24L01_CE_LOW TM_GPIO_SetPinLow(NRF24L01_CE_PORT, NRF24L01_CE_PIN)
145 #define NRF24L01_CE_HIGH TM_GPIO_SetPinHigh(NRF24L01_CE_PORT, NRF24L01_CE_PIN)
146 #define NRF24L01_CSN_LOW TM_GPIO_SetPinLow(NRF24L01_CSN_PORT, NRF24L01_CSN_PIN)
147 #define NRF24L01_CSN_HIGH TM_GPIO_SetPinHigh(NRF24L01_CSN_PORT, NRF24L01_CSN_PIN)
150 #define NRF24L01_IRQ_DATA_READY 0x40
151 #define NRF24L01_IRQ_TRAN_OK 0x20
152 #define NRF24L01_IRQ_MAX_RT 0x10
167 typedef union _TM_NRF24L01_IRQ_t {
351 void TM_NRF24L01_WriteRegister(uint8_t reg, uint8_t value);
void TM_NRF24L01_SetMyAddress(uint8_t *adr)
Sets own address. This is used for settings own id when communication with other modules.
enum _TM_NRF24L01_Transmit_Status_t TM_NRF24L01_Transmit_Status_t
Transmission status enumeration.
void TM_NRF24L01_SetTxAddress(uint8_t *adr)
Sets address you will communicate with.
Definition: tm_stm32_nrf24l01.h:182
uint8_t TM_NRF24L01_Read_Interrupts(TM_NRF24L01_IRQ_t *IRQ)
Reads interrupts from NRF.
TM_NRF24L01_Transmit_Status_t TM_NRF24L01_GetTransmissionStatus(void)
Gets transmissions status.
union _TM_NRF24L01_IRQ_t TM_NRF24L01_IRQ_t
Interrupt structure.
void TM_NRF24L01_Transmit(uint8_t *data)
Transmits data with NRF24L01+ to another NRF module.
void TM_NRF24L01_PowerDown(void)
Sets NRF24L01+ to power down mode.
Definition: tm_stm32_nrf24l01.h:193
void TM_NRF24L01_PowerUpTx(void)
Sets NRF24L01+ to TX mode.
Interrupt structure.
Definition: tm_stm32_nrf24l01.h:167
void TM_NRF24L01_Clear_Interrupts(void)
Clears interrupt status.
Definition: tm_stm32_nrf24l01.h:191
enum _TM_NRF24L01_OutputPower_t TM_NRF24L01_OutputPower_t
Output power enumeration.
Definition: tm_stm32_nrf24l01.h:203
Definition: tm_stm32_nrf24l01.h:192
uint8_t TM_NRF24L01_DataReady(void)
Checks if data is ready to be read from NRF24L01+.
_TM_NRF24L01_DataRate_t
Data rate enumeration.
Definition: tm_stm32_nrf24l01.h:190
Definition: tm_stm32_nrf24l01.h:200
uint8_t TM_NRF24L01_GetRetransmissionsCount(void)
Gets number of retransmissions needed in last transmission.
Definition: tm_stm32_nrf24l01.h:183
enum _TM_NRF24L01_DataRate_t TM_NRF24L01_DataRate_t
Data rate enumeration.
void TM_NRF24L01_PowerUpRx(void)
Sets NRF24L01+ to RX mode.
uint8_t TM_NRF24L01_Init(uint8_t channel, uint8_t payload_size)
Initializes NRF24L01+ module.
Definition: tm_stm32_nrf24l01.h:202
Definition: tm_stm32_nrf24l01.h:184
void TM_NRF24L01_SetChannel(uint8_t channel)
Sets working channel.
_TM_NRF24L01_Transmit_Status_t
Transmission status enumeration.
Definition: tm_stm32_nrf24l01.h:181
Definition: tm_stm32_nrf24l01.h:201
_TM_NRF24L01_OutputPower_t
Output power enumeration.
Definition: tm_stm32_nrf24l01.h:199
uint8_t Status
Definition: tm_stm32_nrf24l01.h:175
void TM_NRF24L01_GetData(uint8_t *data)
Gets data from NRF24L01+.
uint8_t TM_NRF24L01_GetStatus(void)
Gets NRLF+ status register value.
void TM_NRF24L01_SetRF(TM_NRF24L01_DataRate_t DataRate, TM_NRF24L01_OutputPower_t OutPwr)
Sets RF parameters for NRF24L01+.