4#ifndef PROTOCORE_CC1101_H
5#define PROTOCORE_CC1101_H
embed_bool protocore_cc1101_init(const uint8_t *work, const protocore_cc1101_bus *bus, const protocore_cc1101_config *cfg)
Reset the CC1101, apply cfg, set the channel, and confirm it is .
embed_bool protocore_cc1101_send(const uint8_t *work, const protocore_cc1101_bus *bus, const uint8_t *data, uint8_t len)
Transmit len bytes as a variable-length packet (leading length .
int16_t protocore_cc1101_rssi_dbm(const uint8_t *work, uint8_t raw)
Convert a raw CC1101 RSSI register value to dBm (TI datasheet .
int protocore_cc1101_recv(const uint8_t *work, const protocore_cc1101_bus *bus, uint8_t *buf, uint8_t cap, int16_t *rssi_dbm)
If a packet is waiting, read it (length byte + payload + appended .
void protocore_cc1101_set_rx(const uint8_t *work, const protocore_cc1101_bus *bus)
Flush RX and enter receive mode (strobe RX). Then poll .
void(* protocore_cc1101_spi_fn)(const uint8_t *tx, uint8_t *rx, uint8_t len, void *ctx)
Full-duplex SPI transfer of len bytes (chip-select toggled by the callback).
embed_bool protocore_cc1101_tx_done(const uint8_t *work, const protocore_cc1101_bus *bus)
True once the state machine returned to IDLE after a transmit.
#define PROTOCORE_UNUSED
Suppress the unused warning. Every module ends in a namespace most callers only partly use.
#define PROTOCORE_NS_LAYOUT(T,...)
Pin every dispatch slot of a table that is nothing but function pointers.
#define PROTOCORE_NS
Storage for a dispatch table. The const is load bearing.
Dispatch table. Addressed by offset, so the layout is asserted below.
void(* set_rx)(const uint8_t *, const protocore_cc1101_bus *)
int(* recv)(const uint8_t *, const protocore_cc1101_bus *, uint8_t *, uint8_t, int16_t *)
embed_bool(* init)(const uint8_t *, const protocore_cc1101_bus *, const protocore_cc1101_config *)
embed_bool(* send)(const uint8_t *, const protocore_cc1101_bus *, const uint8_t *, uint8_t)
embed_bool(* tx_done)(const uint8_t *, const protocore_cc1101_bus *)
int16_t(* rssi_dbm)(const uint8_t *, uint8_t)
The bus a driver call uses: your SPI transfer behind it.
protocore_cc1101_spi_fn spi
Radio configuration applied by protocore_cc1101_init().
const protocore_cc1101_reg * regs
SmartRF-exported register settings (may be null for none).
uint8_t channel
CHANNR (0x0A): channel number on top of the base frequency.
One modem-config register write (address + value).