|
|
|
@ -11,7 +11,8 @@ ESP32RTCClock rtc_clock; |
|
|
|
bool radio_init() { |
|
|
|
rtc_clock.begin(); |
|
|
|
|
|
|
|
// NOTE: radio_driver.begin() is called by Dispatcher::begin(), so not needed here
|
|
|
|
radio_driver.init(); |
|
|
|
|
|
|
|
return true; // success
|
|
|
|
} |
|
|
|
|
|
|
|
@ -27,7 +28,16 @@ void radio_set_tx_power(uint8_t dbm) { |
|
|
|
radio_driver.setTxPower(dbm); |
|
|
|
} |
|
|
|
|
|
|
|
// NOTE: as we are using the WiFi radio, the ESP_IDF will have enabled hardware RNG:
|
|
|
|
// https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/system/random.html
|
|
|
|
class ESP_RNG : public mesh::RNG { |
|
|
|
public: |
|
|
|
void random(uint8_t* dest, size_t sz) override { |
|
|
|
esp_fill_random(dest, sz); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
mesh::LocalIdentity radio_new_identity() { |
|
|
|
StdRNG rng; // TODO: need stronger True-RNG here
|
|
|
|
ESP_RNG rng; |
|
|
|
return mesh::LocalIdentity(&rng); // create new random identity
|
|
|
|
} |
|
|
|
|