mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
* new ESPNOWRadio driver
* refactored the examples/*/main.cpp modules, moving radio specifics to variants/*/target modules * new Generic_ESPNOW_* target envs
This commit is contained in:
parent
9c165add61
commit
2224bddcb5
39 changed files with 568 additions and 249 deletions
29
variants/generic_espnow/target.cpp
Normal file
29
variants/generic_espnow/target.cpp
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#include <Arduino.h>
|
||||
#include "target.h"
|
||||
#include <helpers/ArduinoHelpers.h>
|
||||
|
||||
ESP32Board board;
|
||||
|
||||
ESPNOWRadio radio_driver;
|
||||
|
||||
bool radio_init() {
|
||||
// NOTE: radio_driver.begin() is called by Dispatcher::begin(), so not needed here
|
||||
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(uint8_t dbm) {
|
||||
radio_driver.setTxPower(dbm);
|
||||
}
|
||||
|
||||
mesh::LocalIdentity radio_new_identity() {
|
||||
StdRNG rng; // TODO: need stronger True-RNG here
|
||||
return mesh::LocalIdentity(&rng); // create new random identity
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue