nRFBareRadio is a library to use the Radio peripheral in a nRF51 or nRF52 Nordic microcontroller in "bare" mode transmitting raw packets, instead of the usual BLE protocols.

Embed: (wiki syntax)

« Back to documentation index

BareRadio Class Reference

BareRadio Class Reference

BareRadio represents and controls the RADIO peripheral in a nRF51 or nRF52 Nordic microcontroller. More...

#include <nRFBareRadio.h>

Public Member Functions

 BareRadio ()
 Initialises a BareRadio instance.
int ConfigClock ()
 Configures the high speed clock.
void Setup (int mode, RadioAddress address, RadioConfig &config)
 Configures the radio at either a transmitter or a receiver, using a supplied address and configuration objects.
void Transmit (char *data)
 Transmits a packet using data from a supplied buffer, which must be at least as long as the data length configured.
int Receive (char *data)
 Checks if a packet was received, and if received fills the supplied buffer with the corresponding data.

Detailed Description

BareRadio represents and controls the RADIO peripheral in a nRF51 or nRF52 Nordic microcontroller.

Should be initialised with a RadioAddress and a RadioConfig objects.

Definition at line 196 of file nRFBareRadio.h.


Constructor & Destructor Documentation

BareRadio (  )

Initialises a BareRadio instance.

Definition at line 27 of file nRFBareRadio.cpp.


Member Function Documentation

int ConfigClock (  )

Configures the high speed clock.

You don't have to call this manually since it's called by the constructor on instantiation.

Returns:
1 if the clock was successfully configured, 0 on task timeout.

Definition at line 33 of file nRFBareRadio.cpp.

int Receive ( char *  data )

Checks if a packet was received, and if received fills the supplied buffer with the corresponding data.

If no packet was received, the buffer is kept unchanged.

Parameters:
dataThe buffer to be filled as array of char or array of unsigned char
Returns:
1 if a packet was received and the buffer was changed, 0 otherwise

Definition at line 162 of file nRFBareRadio.cpp.

void Setup ( int  mode,
RadioAddress  address,
RadioConfig config 
)

Configures the radio at either a transmitter or a receiver, using a supplied address and configuration objects.

Parameters:
modeThe radio mode, either RADIO_MODE_RX or RADIO_MODE_TX
addressA RadioAddress object previously filled
configA RadioConfig object previously configured

Definition at line 46 of file nRFBareRadio.cpp.

void Transmit ( char *  data )

Transmits a packet using data from a supplied buffer, which must be at least as long as the data length configured.

Parameters:
dataThe buffer as array of char or array of unsigned char

Definition at line 147 of file nRFBareRadio.cpp.