ptt-fhss
Bare-metal PTT firmware for nRF52840 with FHSS
Loading...
Searching...
No Matches
Macros | Functions | Variables
radio.h File Reference

RADIO peripheral driver – NRF_1Mbit proprietary mode. More...

#include <stdbool.h>
#include <stdint.h>

Go to the source code of this file.

Macros

#define PTT_FLAG_ACTIVE   0x01u
 PTT button is held on the transmitting side.
 

Functions

struct __attribute__ ((packed))
 PTT packet transmitted on every FHSS hop.
 
void radio_init (void)
 Configure the RADIO peripheral (mode, packet format, address, CRC, power).
 
void radio_set_channel (uint8_t ch)
 Set the RF channel.
 
void radio_tx (const uint8_t *data, uint8_t len)
 Transmit one packet synchronously.
 
void radio_tx_burst (void)
 Transmit one FHSS hop: advance channel, send PTT frame, hold dwell time.
 
bool radio_rx_burst (ptt_frame_t *frame_out)
 Receive one FHSS hop: advance channel, listen for FHSS_DWELL_MS ms.
 

Variables

 ptt_frame_t
 

Detailed Description

RADIO peripheral driver – NRF_1Mbit proprietary mode.

Macro Definition Documentation

◆ PTT_FLAG_ACTIVE

#define PTT_FLAG_ACTIVE   0x01u

PTT button is held on the transmitting side.

Function Documentation

◆ __attribute__()

struct __attribute__ ( (packed)  )

PTT packet transmitted on every FHSS hop.

The receiver uses slot to resynchronise its FHSS counter after receiving the first packet.

< Sender's FHSS slot number at time of transmission.

< Bitmask: PTT_FLAG_ACTIVE when voice channel is open.

◆ radio_init()

void radio_init ( void  )

Configure the RADIO peripheral (mode, packet format, address, CRC, power).

◆ radio_rx_burst()

bool radio_rx_burst ( ptt_frame_t frame_out)

Receive one FHSS hop: advance channel, listen for FHSS_DWELL_MS ms.

If a packet with a valid CRC arrives during the dwell window, frame_out is filled and the function returns true. The caller should then call fhss_set_slot(frame_out->slot + 1) to synchronise the hopping sequence.

Parameters
frame_outDestination for the received frame (must not be NULL).
Returns
true if a valid packet was received, false on timeout or CRC error.

◆ radio_set_channel()

void radio_set_channel ( uint8_t  ch)

Set the RF channel.

Parameters
chChannel index 0-39, maps to 2400+ch MHz (MAP=0).

◆ radio_tx()

void radio_tx ( const uint8_t *  data,
uint8_t  len 
)

Transmit one packet synchronously.

Loads data into the internal packet buffer, asserts TASKS_TXEN, and returns after EVENTS_END fires. RADIO is DISABLED automatically via the END_DISABLE shortcut before the function returns.

Parameters
dataPayload bytes.
lenPayload length (0-255 bytes).

◆ radio_tx_burst()

void radio_tx_burst ( void  )

Transmit one FHSS hop: advance channel, send PTT frame, hold dwell time.

Call repeatedly in a loop while the PTT button is held. Each call occupies exactly FHSS_DWELL_MS milliseconds.

Variable Documentation

◆ ptt_frame_t

ptt_frame_t