target.cpp 744 B

123456789101112131415161718192021222324252627282930313233
  1. #include <Arduino.h>
  2. #include "target.h"
  3. #include <helpers/ArduinoHelpers.h>
  4. ESP32Board board;
  5. ESPNOWRadio radio_driver;
  6. ESP32RTCClock rtc_clock;
  7. bool radio_init() {
  8. rtc_clock.begin();
  9. // NOTE: radio_driver.begin() is called by Dispatcher::begin(), so not needed here
  10. return true; // success
  11. }
  12. uint32_t radio_get_rng_seed() {
  13. return millis() + radio_driver.intID(); // TODO: where to get some entropy?
  14. }
  15. void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr) {
  16. // no-op
  17. }
  18. void radio_set_tx_power(uint8_t dbm) {
  19. radio_driver.setTxPower(dbm);
  20. }
  21. mesh::LocalIdentity radio_new_identity() {
  22. StdRNG rng; // TODO: need stronger True-RNG here
  23. return mesh::LocalIdentity(&rng); // create new random identity
  24. }