|
ptt-fhss
Bare-metal PTT firmware for nRF52840 with FHSS
|
RADIO peripheral driver implementation. More...
Macros | |
| #define | MAX_PAYLOAD 255u |
| #define | BUF_SIZE (1u + MAX_PAYLOAD) |
| #define | DEFAULT_CHANNEL 20u /* 2400 + 20 = 2420 MHz (MAP=0) */ |
| #define | RADIO_BASE0 0x12345678u |
| #define | RADIO_PREFIX0 0xABu /* logical address 0: RADIO_BASE0 + RADIO_PREFIX0[7:0] */ |
Functions | |
| static void | timer_init (void) |
| static void | dwell_start (void) |
| static void | dwell_wait (void) |
| 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 | |
| static uint8_t | pkt_buf [BUF_SIZE] |
RADIO peripheral driver implementation.
| #define BUF_SIZE (1u + MAX_PAYLOAD) |
| #define DEFAULT_CHANNEL 20u /* 2400 + 20 = 2420 MHz (MAP=0) */ |
| #define MAX_PAYLOAD 255u |
| #define RADIO_BASE0 0x12345678u |
| #define RADIO_PREFIX0 0xABu /* logical address 0: RADIO_BASE0 + RADIO_PREFIX0[7:0] */ |
|
static |
|
static |
| void radio_init | ( | void | ) |
Configure the RADIO peripheral (mode, packet format, address, CRC, power).
| 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.
| frame_out | Destination for the received frame (must not be NULL). |
| void radio_set_channel | ( | uint8_t | ch | ) |
Set the RF channel.
| ch | Channel index 0-39, maps to 2400+ch MHz (MAP=0). |
| 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.
| data | Payload bytes. |
| len | Payload length (0-255 bytes). |
| 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.
|
static |
|
static |