Skip to content

Commit

Permalink
fixup! drivers/at86rf215: Add driver for the AT86RF215 radio
Browse files Browse the repository at this point in the history
  • Loading branch information
benpicco committed Sep 16, 2019
1 parent e07eb44 commit d477617
Show file tree
Hide file tree
Showing 3 changed files with 179 additions and 84 deletions.
8 changes: 8 additions & 0 deletions drivers/at86rf215/at86rf215_fsk.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#define FSK_CENTER_FREQUENCY_SUBGHZ (863125U) /* Hz */
#define FSK_CENTER_FREQUENCY_24GHZ (2400200U - CCF0_24G_OFFSET) /* Hz */

/* also used by at86rf215_netdev.c */
const uint8_t at86rf215_fsk_srate_10kHz[] = {
[FSK_SRATE_50K] = 5,
[FSK_SRATE_100K] = 10,
Expand All @@ -37,6 +38,13 @@ const uint8_t at86rf215_fsk_srate_10kHz[] = {
[FSK_SRATE_400K] = 40
};

/* Table 6-57, index is symbol rate */
static const uint8_t FSKPE_Val[3][6] = {
{ 0x02, 0x0E, 0x3E, 0x74, 0x05, 0x13 }, /* FSKPE0 */
{ 0x03, 0x0F, 0x3F, 0x7F, 0x3C, 0x29 }, /* FSKPE1 */
{ 0xFC, 0xF0, 0xC0, 0x80, 0xC3, 0xC7 } /* FSKPE2 */
};

/* table 6-51: Symbol Rate Settings */
static uint8_t _TXDFE_SR(at86rf215_t *dev, uint8_t srate)
{
Expand Down
46 changes: 43 additions & 3 deletions drivers/at86rf215/include/at86rf215_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,18 @@
extern "C" {
#endif

/* Minimum reset pulse width (tRST) */
/*
* @brief Minimum reset pulse width (tRST)
*/
#define AT86RF215_RESET_PULSE_WIDTH (16U)
/* The typical transition time to TRX_OFF after reset (tPOWERON) */
/*
* @brief The typical transition time to TRX_OFF after reset (tPOWERON)
*/
#define AT86RF215_RESET_DELAY (16U)

/* This is used to calculate the ACK timeout based on the bitrate.
* AT86RF233 uses an ACK timeout of 54 symbol periods, or 864 µs @ 250 kbit/s
* -> 864µs * 250kbit/s = 216 bit */
// #define AT86RF215_ACK_PERIOD_IN_BITS (216U)
#define AT86RF215_ACK_PERIOD_IN_SYMBOLS (54U)
#define AT86RF215_ACK_PERIOD_IN_BITS (AT86RF215_ACK_PERIOD_IN_SYMBOLS * 4)

Expand All @@ -47,20 +50,57 @@ extern "C" {
/* MR-QPSK */
#define AT86RF215_MR_OQPSK_MODE(n) ((n) << OQPSKPHRTX_MOD_SHIFT)

/**
* @brief Symbol Rates for register values, in 10kHz
*/
extern const uint8_t at86rf215_fsk_srate_10kHz[];

/**
* @brief Perform a reset of the entire chip.
* @param dev device to reset, will also reset sibling device
* @return 0 on success, error if device is not availiable
*/
int at86rf215_hardware_reset(at86rf215_t *dev);

/**
* @brief Write to a register at address `addr` from device `dev`.
*
* @param[in] dev device to write to
* @param[in] addr address of the register to write
* @param[in] value value to write to the given register
*/
void at86rf215_reg_write(const at86rf215_t *dev, uint16_t reg, uint8_t val);

void at86rf215_reg_write_bytes(const at86rf215_t *dev, uint16_t reg, const void *data, size_t len);

/**
* @brief Read from a register at address `addr` from device `dev`.
*
* @param[in] dev device to read from
* @param[in] addr address of the register to read
*
* @return the value of the specified register
*/
uint8_t at86rf215_reg_read(const at86rf215_t *dev, uint16_t regAddr16);

void at86rf215_reg_read_bytes(const at86rf215_t *dev, uint16_t reg, void *data, size_t len);

/**
* @brief Enable / Disable the ACK filter
*
* @param[in] dev device to configure
* @param[in] on if true, only ACK frames are received
* if false, only non-ACK frames are received
*/
void at86rf215_filter_ack(at86rf215_t *dev, bool on);

/**
* @brief Read random data from the RNG
*
* @param[in] dev device to configure
* @param[out] data buffer to copy the random data to
* @param[in] len number of random bytes to store in data
*/
void at86rf215_get_random(at86rf215_t *dev, uint8_t *data, size_t len);

/** FSK **/
Expand Down
Loading

0 comments on commit d477617

Please sign in to comment.