Some checks failed
Build and deploy Docs site to GitHub Pages / github-pages (push) Has been cancelled
PR Build Check / build (Heltec_v3_companion_radio_ble) (push) Has been cancelled
PR Build Check / build (Heltec_v3_repeater) (push) Has been cancelled
PR Build Check / build (Heltec_v3_room_server) (push) Has been cancelled
PR Build Check / build (LilyGo_Tlora_C6_repeater_) (push) Has been cancelled
PR Build Check / build (PicoW_repeater) (push) Has been cancelled
PR Build Check / build (RAK_4631_companion_radio_ble) (push) Has been cancelled
PR Build Check / build (RAK_4631_repeater) (push) Has been cancelled
PR Build Check / build (RAK_4631_room_server) (push) Has been cancelled
PR Build Check / build (wio-e5-mini_repeater) (push) Has been cancelled
- MeshCore-based Simple Sensor firmware - Heltec T114 without display - BME280 sensor support (temp/humidity/pressure) - Radio: 868.856018 MHz, SF7, BW62.5 kHz, CR4/7 - 2-byte path hash - PlatformIO project
45 lines
984 B
C++
45 lines
984 B
C++
#include <Arduino.h>
|
|
#include "target.h"
|
|
#include <helpers/ArduinoHelpers.h>
|
|
|
|
ESP32Board board;
|
|
|
|
ESPNOWRadio radio_driver;
|
|
|
|
ESP32RTCClock rtc_clock;
|
|
SensorManager sensors;
|
|
|
|
bool radio_init() {
|
|
rtc_clock.begin();
|
|
|
|
radio_driver.init();
|
|
|
|
return true; // success
|
|
}
|
|
|
|
uint32_t radio_get_rng_seed() {
|
|
return millis() + radio_driver.intID(); // TODO: where to get some entropy?
|
|
}
|
|
|
|
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr) {
|
|
// no-op
|
|
}
|
|
|
|
void radio_set_tx_power(int8_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() {
|
|
ESP_RNG rng;
|
|
return mesh::LocalIdentity(&rng); // create new random identity
|
|
}
|