Skip to content

Commit

Permalink
fixup! drivers/at86rf2xx: add support for ATmegaRF MCUs
Browse files Browse the repository at this point in the history
  • Loading branch information
benpicco committed Oct 22, 2019
1 parent 8892ff9 commit 35dfad6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/at86rf2xx/at86rf2xx_internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ void at86rf2xx_configure_phy(at86rf2xx_t *dev)
at86rf2xx_set_state(dev, prev_state);
}

#if defined(MODULE_AT86RF233) || defined(MODULE_AT86RF231) || defined(MODULE_AT86RFA1) || defined(MODULE_AT86RFR2)
#if AT86RF2XX_RANDOM_NUMBER_GENERATOR
void at86rf2xx_get_random(const at86rf2xx_t *dev, uint8_t *data, size_t len)
{
for (size_t byteCount = 0; byteCount < len; ++byteCount) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/at86rf2xx/include/at86rf2xx_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ void at86rf2xx_hardware_reset(at86rf2xx_t *dev);
*/
void at86rf2xx_configure_phy(at86rf2xx_t *dev);

#if defined(MODULE_AT86RF233) || defined(MODULE_AT86RF231) || defined(MODULE_AT86RFR2) || defined(DOXYGEN)
#if AT86RF2XX_RANDOM_NUMBER_GENERATOR || defined(DOXYGEN)
/**
* @brief Read random data from the RNG
*
Expand Down
17 changes: 17 additions & 0 deletions drivers/include/at86rf2xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,23 @@ extern "C" {
#define AT86RF2XX_HAVE_RETRIES (0)
#endif

/**
* @brief Random Number Generator
*
* Most AT86RF radios have the option to use the highest bits of the RSSI
* register as a source of randomness.
* See Section 11.2 of the at86rf233 reference manual. (RND_VALUE)
*/
#if defined(MODULE_AT86RF233) || defined(MODULE_AT86RF231) || defined(MODULE_AT86RFA1) || defined(MODULE_AT86RFR2)
#ifndef AT86RF2XX_RANDOM_NUMBER_GENERATOR
#define AT86RF2XX_RANDOM_NUMBER_GENERATOR (1)
#endif
#else
#ifndef AT86RF2XX_RANDOM_NUMBER_GENERATOR
#define AT86RF2XX_RANDOM_NUMBER_GENERATOR (0)
#endif
#endif

/**
* @brief Smart idle listening feature
*
Expand Down

0 comments on commit 35dfad6

Please sign in to comment.