TM STM32Fxxx HAL Libraries  v1.0.0
Libraries for STM32Fxxx (F0, F4 and F7 series) devices based on HAL drivers from ST from Tilen Majerle
TM_NRF24L01P_Functions

Library Functions. More...

Functions

uint8_t TM_NRF24L01_Init (uint8_t channel, uint8_t payload_size)
 Initializes NRF24L01+ module. More...
 
void TM_NRF24L01_SetMyAddress (uint8_t *adr)
 Sets own address. This is used for settings own id when communication with other modules. More...
 
void TM_NRF24L01_SetTxAddress (uint8_t *adr)
 Sets address you will communicate with. More...
 
uint8_t TM_NRF24L01_GetRetransmissionsCount (void)
 Gets number of retransmissions needed in last transmission. More...
 
void TM_NRF24L01_PowerUpTx (void)
 Sets NRF24L01+ to TX mode. More...
 
void TM_NRF24L01_PowerUpRx (void)
 Sets NRF24L01+ to RX mode. More...
 
void TM_NRF24L01_PowerDown (void)
 Sets NRF24L01+ to power down mode. More...
 
TM_NRF24L01_Transmit_Status_t TM_NRF24L01_GetTransmissionStatus (void)
 Gets transmissions status. More...
 
void TM_NRF24L01_Transmit (uint8_t *data)
 Transmits data with NRF24L01+ to another NRF module. More...
 
uint8_t TM_NRF24L01_DataReady (void)
 Checks if data is ready to be read from NRF24L01+. More...
 
void TM_NRF24L01_GetData (uint8_t *data)
 Gets data from NRF24L01+. More...
 
void TM_NRF24L01_SetChannel (uint8_t channel)
 Sets working channel. More...
 
void TM_NRF24L01_SetRF (TM_NRF24L01_DataRate_t DataRate, TM_NRF24L01_OutputPower_t OutPwr)
 Sets RF parameters for NRF24L01+. More...
 
uint8_t TM_NRF24L01_GetStatus (void)
 Gets NRLF+ status register value. More...
 
uint8_t TM_NRF24L01_Read_Interrupts (TM_NRF24L01_IRQ_t *IRQ)
 Reads interrupts from NRF. More...
 
void TM_NRF24L01_Clear_Interrupts (void)
 Clears interrupt status. More...
 
void TM_NRF24L01_WriteRegister (uint8_t reg, uint8_t value)
 

Detailed Description

Library Functions.

Here are listed very basic functions to work with NRF modules

Function Documentation

void TM_NRF24L01_Clear_Interrupts ( void  )

Clears interrupt status.

Parameters
None
Return values
None
uint8_t TM_NRF24L01_DataReady ( void  )

Checks if data is ready to be read from NRF24L01+.

Parameters
None
Return values
Dataready status:
  • 0: No data available for receive in bufferReturns
  • > 0: Data is ready to be collected
void TM_NRF24L01_GetData ( uint8_t *  data)

Gets data from NRF24L01+.

Parameters
*dataPointer to 8-bits array where data from NRF will be saved
Return values
None
uint8_t TM_NRF24L01_GetRetransmissionsCount ( void  )

Gets number of retransmissions needed in last transmission.

Parameters
None
Return values
Numberof retransmissions, between 0 and 15.
uint8_t TM_NRF24L01_GetStatus ( void  )

Gets NRLF+ status register value.

Parameters
None
Return values
Statusregister from NRF
TM_NRF24L01_Transmit_Status_t TM_NRF24L01_GetTransmissionStatus ( void  )

Gets transmissions status.

Parameters
None
Return values
Transmissionstatus. Return is based on TM_NRF24L01_Transmit_Status_t enumeration
uint8_t TM_NRF24L01_Init ( uint8_t  channel,
uint8_t  payload_size 
)

Initializes NRF24L01+ module.

Parameters
channelchannel you will use for communication, from 0 to 125 eg. working frequency from 2.4 to 2.525 GHz
payload_sizemaximum data to be sent in one packet from one NRF to another.
Note
Maximal payload size is 32bytes
Return values
1
void TM_NRF24L01_PowerDown ( void  )

Sets NRF24L01+ to power down mode.

Note
In power down mode, you are not able to transmit/receive data. You can wake up device using TM_NRF24L01_PowerUpTx() or TM_NRF24L01_PowerUpRx() functions
Parameters
None
Return values
None
void TM_NRF24L01_PowerUpRx ( void  )

Sets NRF24L01+ to RX mode.

Note
In this mode is NRF able to receive data from another NRF module. This is default mode and should be used all the time, except when sending data
Parameters
None
Return values
None
void TM_NRF24L01_PowerUpTx ( void  )

Sets NRF24L01+ to TX mode.

Note
In this mode is NRF able to send data to another NRF module
Parameters
None
Return values
None
uint8_t TM_NRF24L01_Read_Interrupts ( TM_NRF24L01_IRQ_t IRQ)

Reads interrupts from NRF.

Parameters
*IRQPointer to TM_NRF24L01_IRQ_t where IRQ status will be saved
Return values
IRQstatus
  • 0: No interrupts are active
  • > 0: At least one interrupt is active
void TM_NRF24L01_SetChannel ( uint8_t  channel)

Sets working channel.

Note
Channel value is just an offset in units MHz from 2.4GHz For example, if you select channel 65, then operation frequency will be set to 2.465GHz.
Parameters
channelRF channel where device will operate
Return values
None
void TM_NRF24L01_SetMyAddress ( uint8_t *  adr)

Sets own address. This is used for settings own id when communication with other modules.

Note
"Own" address of one device must be the same as "TX" address of other device (and vice versa), if you want to get successful communication
Parameters
*adrPointer to 5-bytes length array with address
Return values
None
void TM_NRF24L01_SetRF ( TM_NRF24L01_DataRate_t  DataRate,
TM_NRF24L01_OutputPower_t  OutPwr 
)

Sets RF parameters for NRF24L01+.

Parameters
DataRateData rate selection for NRF module. This parameter can be a value of TM_NRF24L01_DataRate_t enumeration
OutPwrOutput power selection for NRF module. This parameter can be a value of TM_NRF24L01_OutputPower_t enumeration
Return values
None
void TM_NRF24L01_SetTxAddress ( uint8_t *  adr)

Sets address you will communicate with.

Note
"Own" address of one device must be the same as "TX" address of other device (and vice versa), if you want to get successful communication
Parameters
*adrPointer to 5-bytes length array with address
Return values
None
void TM_NRF24L01_Transmit ( uint8_t *  data)

Transmits data with NRF24L01+ to another NRF module.

Parameters
*dataPointer to 8-bit array with data. Maximum length of array can be the same as "payload_size" parameter on initialization
Return values
None