2017-11-16 17:53:12 +00:00
|
|
|
/*! \file radio.h
|
|
|
|
\brief RF1A Radio Module Driver
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
//! Set to 1 if the watch has a radio.
|
|
|
|
extern int has_radio;
|
|
|
|
|
|
|
|
//! Called at boot. Gracefully fails if no radio.
|
|
|
|
void radio_init();
|
|
|
|
|
|
|
|
//! Turns the radio on. Returns zero on failure.
|
2017-12-03 21:16:41 +00:00
|
|
|
void radio_on();
|
2017-11-16 17:53:12 +00:00
|
|
|
|
2017-11-28 22:24:10 +00:00
|
|
|
//! Sets the radio frequency.
|
|
|
|
void radio_setfreq(float freq);
|
2017-11-30 20:48:22 +00:00
|
|
|
//! Sets the raw radio frequency registers.
|
|
|
|
void radio_setrawfreq(uint8_t freq2, uint8_t freq1, uint8_t freq0);
|
2017-11-30 01:20:06 +00:00
|
|
|
//! Gets the radio frequency.
|
|
|
|
uint32_t radio_getfreq();
|
2017-11-28 22:24:10 +00:00
|
|
|
|
2017-11-19 04:08:23 +00:00
|
|
|
//! Restarts the radio. (Call this after radio_on().)
|
|
|
|
void radio_resetcore();
|
|
|
|
|
2017-11-16 17:53:12 +00:00
|
|
|
//! Turns the radio off.
|
2017-12-03 21:16:41 +00:00
|
|
|
void radio_off();
|
2017-11-16 22:18:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
//! Read a register from the radio.
|
|
|
|
uint8_t radio_readreg(uint8_t addr);
|
|
|
|
//! Write to a register in the radio.
|
|
|
|
void radio_writereg(uint8_t addr, uint8_t value);
|
2017-12-03 21:16:41 +00:00
|
|
|
|
|
|
|
//! Read multiple bytes from a register.
|
|
|
|
void radio_readburstreg(uint8_t addr,
|
|
|
|
uint8_t *buffer, uint8_t count);
|
|
|
|
//! Write multiple bytes to a register.
|
|
|
|
void radio_writeburstreg(uint8_t addr,
|
|
|
|
uint8_t *buffer, uint8_t count);
|
|
|
|
|
2018-04-05 19:32:05 +00:00
|
|
|
//! Writes a set of values ot the power table.
|
|
|
|
void radio_writepatable(uint8_t *table, uint8_t count);
|
|
|
|
|
2017-11-16 22:18:38 +00:00
|
|
|
//! Strobe a radio register.
|
|
|
|
uint8_t radio_strobe(uint8_t strobe);
|
2017-11-19 04:08:23 +00:00
|
|
|
|
2017-12-04 19:14:09 +00:00
|
|
|
//! Writes a table of radio settings until the first null pair.
|
2017-12-05 03:57:44 +00:00
|
|
|
void radio_writesettings(const uint8_t *settings);
|
2017-11-19 04:08:23 +00:00
|
|
|
|
|
|
|
//! Writes one value to the power table.
|
2017-11-30 01:20:06 +00:00
|
|
|
void radio_writepower(uint8_t value);
|
2017-11-19 19:13:52 +00:00
|
|
|
|
2017-11-30 01:20:06 +00:00
|
|
|
//! Read the RSSI.
|
|
|
|
int radio_getrssi();
|
|
|
|
//! Read the radio MARC state.
|
|
|
|
int radio_getstate();
|