mirror of https://github.com/meshcore-dev/MeshCore
Browse Source
* refactored the examples/*/main.cpp modules, moving radio specifics to variants/*/target modules * new Generic_ESPNOW_* target envspull/154/head
39 changed files with 568 additions and 249 deletions
@ -1,56 +0,0 @@ |
|||
|
|||
; ----------- Generic ESP32-C3 ------------ |
|||
|
|||
[env:Generic_C3_ESPNOW_terminal_chat] |
|||
extends = esp32_base |
|||
;board = esp32-c3-devkitm-1 |
|||
board = esp32-s3-devkitc-1 |
|||
build_flags = |
|||
${esp32_base.build_flags} |
|||
-I variants/espnow_c3 |
|||
; -D ARDUINO_USB_MODE=1 |
|||
; -D ARDUINO_USB_CDC_ON_BOOT=1 |
|||
; -D ESP32_CPU_FREQ=80 |
|||
-D MAX_CONTACTS=100 |
|||
-D MAX_GROUP_CHANNELS=1 |
|||
; -D ESPNOW_DEBUG_LOGGING=1 |
|||
; -D P_LORA_TX_LED=8 |
|||
-D P_LORA_TX_LED=35 |
|||
-D PIN_USER_BTN=0 |
|||
; -D MESH_PACKET_LOGGING=1 |
|||
; -D MESH_DEBUG=1 |
|||
build_src_filter = ${esp32_base.build_src_filter} |
|||
+<../examples/simple_secure_chat/main.cpp> |
|||
+<helpers/esp32/ESPNowRadio.cpp> |
|||
+<../variants/espnow_c3> |
|||
lib_deps = |
|||
${esp32_base.lib_deps} |
|||
densaugeo/base64 @ ~1.4.0 |
|||
|
|||
[env:Generic_C3_ESPNOW_repeater] |
|||
extends = esp32_base |
|||
board = esp32-c3-devkitm-1 |
|||
;board = esp32-s3-devkitc-1 |
|||
build_flags = |
|||
${esp32_base.build_flags} |
|||
-I variants/espnow_c3 |
|||
-D ARDUINO_USB_MODE=1 |
|||
-D ARDUINO_USB_CDC_ON_BOOT=1 |
|||
-D ESP32_CPU_FREQ=80 |
|||
-D ESPNOW_DEBUG_LOGGING=1 |
|||
; -D P_LORA_TX_LED=8 |
|||
; -D P_LORA_TX_LED=35 |
|||
-D PIN_USER_BTN=0 |
|||
; -D MESH_PACKET_LOGGING=1 |
|||
; -D MESH_DEBUG=1 |
|||
-D ADVERT_NAME='"ESPNOW Repeater"' |
|||
-D ADVERT_LAT=-37.0 |
|||
-D ADVERT_LON=145.0 |
|||
-D ADMIN_PASSWORD='"password"' |
|||
build_src_filter = ${esp32_base.build_src_filter} |
|||
+<../examples/simple_repeater/main.cpp> |
|||
+<helpers/esp32/ESPNowRadio.cpp> |
|||
+<../variants/espnow_c3> |
|||
lib_deps = |
|||
${esp32_base.lib_deps} |
|||
densaugeo/base64 @ ~1.4.0 |
|||
@ -1,11 +0,0 @@ |
|||
#include <Arduino.h> |
|||
#include "target.h" |
|||
|
|||
ESP32Board board; |
|||
|
|||
ESPNOWRadio radio; |
|||
|
|||
bool radio_init() { |
|||
// NOTE: radio.begin() is called by Dispatcher::begin(), so not needed here
|
|||
return true; // success
|
|||
} |
|||
@ -1,9 +0,0 @@ |
|||
#pragma once |
|||
|
|||
#include <helpers/ESP32Board.h> |
|||
#include <helpers/esp32/ESPNOWRadio.h> |
|||
|
|||
extern ESP32Board board; |
|||
extern ESPNOWRadio radio; |
|||
|
|||
bool radio_init(); |
|||
@ -0,0 +1,83 @@ |
|||
|
|||
; ----------- Generic ESP32-C3 ------------ |
|||
|
|||
[Generic_ESPNOW] |
|||
extends = esp32_base |
|||
board = esp32-c3-devkitm-1 |
|||
;board = esp32-s3-devkitm-1 |
|||
build_flags = |
|||
${esp32_base.build_flags} |
|||
-I variants/generic_espnow |
|||
; -D ESP32_CPU_FREQ=80 |
|||
-D PIN_BOARD_SDA=-1 |
|||
-D PIN_BOARD_SCL=-1 |
|||
; -D P_LORA_TX_LED=8 |
|||
-D PIN_USER_BTN=0 |
|||
; -D ARDUINO_USB_MODE=1 |
|||
; -D ARDUINO_USB_CDC_ON_BOOT=1 |
|||
; -D ESPNOW_DEBUG_LOGGING=1 |
|||
; -D MESH_PACKET_LOGGING=1 |
|||
; -D MESH_DEBUG=1 |
|||
build_src_filter = ${esp32_base.build_src_filter} |
|||
+<helpers/esp32/ESPNowRadio.cpp> |
|||
+<../variants/generic_espnow> |
|||
|
|||
[env:Generic_ESPNOW_terminal_chat] |
|||
extends = Generic_ESPNOW |
|||
build_flags = |
|||
${Generic_ESPNOW.build_flags} |
|||
-D MAX_CONTACTS=100 |
|||
-D MAX_GROUP_CHANNELS=1 |
|||
build_src_filter = ${Generic_ESPNOW.build_src_filter} |
|||
+<../examples/simple_secure_chat/main.cpp> |
|||
lib_deps = |
|||
${Generic_ESPNOW.lib_deps} |
|||
densaugeo/base64 @ ~1.4.0 |
|||
|
|||
[env:Generic_ESPNOW_repeater] |
|||
extends = Generic_ESPNOW |
|||
build_flags = |
|||
${Generic_ESPNOW.build_flags} |
|||
-D ADVERT_NAME='"ESPNOW Repeater"' |
|||
-D ADVERT_LAT=-37.0 |
|||
-D ADVERT_LON=145.0 |
|||
-D ADMIN_PASSWORD='"password"' |
|||
build_src_filter = ${Generic_ESPNOW.build_src_filter} |
|||
+<../examples/simple_repeater/main.cpp> |
|||
lib_deps = |
|||
${Generic_ESPNOW.lib_deps} |
|||
${esp32_ota.lib_deps} |
|||
densaugeo/base64 @ ~1.4.0 |
|||
|
|||
[env:Generic_ESPNOW_companion_radio_usb] |
|||
extends = Generic_ESPNOW |
|||
build_flags = |
|||
${Generic_ESPNOW.build_flags} |
|||
-D MAX_CONTACTS=100 |
|||
-D MAX_GROUP_CHANNELS=8 |
|||
; -D ENABLE_PRIVATE_KEY_IMPORT=1 |
|||
; -D ENABLE_PRIVATE_KEY_EXPORT=1 |
|||
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1 |
|||
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1 |
|||
; NOTE: DO NOT ENABLE --> -D ESPNOW_DEBUG_LOGGING=1 |
|||
build_src_filter = ${Generic_ESPNOW.build_src_filter} |
|||
+<../examples/companion_radio/main.cpp> |
|||
lib_deps = |
|||
${Generic_ESPNOW.lib_deps} |
|||
densaugeo/base64 @ ~1.4.0 |
|||
|
|||
[env:Generic_ESPNOW_room_server] |
|||
extends = Generic_ESPNOW |
|||
build_flags = |
|||
${Generic_ESPNOW.build_flags} |
|||
-D ADVERT_NAME='"Heltec Room"' |
|||
-D ADVERT_LAT=-37.0 |
|||
-D ADVERT_LON=145.0 |
|||
-D ADMIN_PASSWORD='"password"' |
|||
-D ROOM_PASSWORD='"hello"' |
|||
build_src_filter = ${Generic_ESPNOW.build_src_filter} |
|||
+<../examples/simple_room_server/main.cpp> |
|||
lib_deps = |
|||
${Generic_ESPNOW.lib_deps} |
|||
${esp32_ota.lib_deps} |
|||
|
|||
@ -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
|
|||
} |
|||
@ -0,0 +1,13 @@ |
|||
#pragma once |
|||
|
|||
#include <helpers/ESP32Board.h> |
|||
#include <helpers/esp32/ESPNOWRadio.h> |
|||
|
|||
extern ESP32Board board; |
|||
extern ESPNOWRadio radio_driver; |
|||
|
|||
bool radio_init(); |
|||
uint32_t radio_get_rng_seed(); |
|||
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr); |
|||
void radio_set_tx_power(uint8_t dbm); |
|||
mesh::LocalIdentity radio_new_identity(); |
|||
@ -1,9 +1,16 @@ |
|||
#pragma once |
|||
|
|||
#define RADIOLIB_STATIC_ONLY 1 |
|||
#include <RadioLib.h> |
|||
#include <helpers/RadioLibWrappers.h> |
|||
#include <helpers/HeltecV2Board.h> |
|||
#include <helpers/CustomSX1276Wrapper.h> |
|||
|
|||
extern HeltecV2Board board; |
|||
extern RADIO_CLASS radio; |
|||
extern WRAPPER_CLASS radio_driver; |
|||
|
|||
bool radio_init(); |
|||
uint32_t radio_get_rng_seed(); |
|||
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr); |
|||
void radio_set_tx_power(uint8_t dbm); |
|||
mesh::LocalIdentity radio_new_identity(); |
|||
|
|||
@ -1,9 +1,16 @@ |
|||
#pragma once |
|||
|
|||
#define RADIOLIB_STATIC_ONLY 1 |
|||
#include <RadioLib.h> |
|||
#include <helpers/RadioLibWrappers.h> |
|||
#include <helpers/HeltecV3Board.h> |
|||
#include <helpers/CustomSX1262Wrapper.h> |
|||
|
|||
extern HeltecV3Board board; |
|||
extern RADIO_CLASS radio; |
|||
extern WRAPPER_CLASS radio_driver; |
|||
|
|||
bool radio_init(); |
|||
uint32_t radio_get_rng_seed(); |
|||
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr); |
|||
void radio_set_tx_power(uint8_t dbm); |
|||
mesh::LocalIdentity radio_new_identity(); |
|||
|
|||
@ -1,9 +1,16 @@ |
|||
#pragma once |
|||
|
|||
#define RADIOLIB_STATIC_ONLY 1 |
|||
#include <RadioLib.h> |
|||
#include <helpers/RadioLibWrappers.h> |
|||
#include <helpers/ESP32Board.h> |
|||
#include <helpers/CustomSX1262Wrapper.h> |
|||
|
|||
extern ESP32Board board; |
|||
extern RADIO_CLASS radio; |
|||
extern WRAPPER_CLASS radio_driver; |
|||
|
|||
bool radio_init(); |
|||
uint32_t radio_get_rng_seed(); |
|||
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr); |
|||
void radio_set_tx_power(uint8_t dbm); |
|||
mesh::LocalIdentity radio_new_identity(); |
|||
|
|||
@ -1,9 +1,16 @@ |
|||
#pragma once |
|||
|
|||
#define RADIOLIB_STATIC_ONLY 1 |
|||
#include <RadioLib.h> |
|||
#include <helpers/RadioLibWrappers.h> |
|||
#include <helpers/TBeamBoard.h> |
|||
#include <helpers/CustomSX1276Wrapper.h> |
|||
|
|||
extern TBeamBoard board; |
|||
extern RADIO_CLASS radio; |
|||
extern WRAPPER_CLASS radio_driver; |
|||
|
|||
bool radio_init(); |
|||
uint32_t radio_get_rng_seed(); |
|||
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr); |
|||
void radio_set_tx_power(uint8_t dbm); |
|||
mesh::LocalIdentity radio_new_identity(); |
|||
|
|||
@ -1,9 +1,16 @@ |
|||
#pragma once |
|||
|
|||
#define RADIOLIB_STATIC_ONLY 1 |
|||
#include <RadioLib.h> |
|||
#include <helpers/RadioLibWrappers.h> |
|||
#include <helpers/LilyGoTLoraBoard.h> |
|||
#include <helpers/CustomSX1276Wrapper.h> |
|||
|
|||
extern LilyGoTLoraBoard board; |
|||
extern RADIO_CLASS radio; |
|||
extern WRAPPER_CLASS radio_driver; |
|||
|
|||
bool radio_init(); |
|||
uint32_t radio_get_rng_seed(); |
|||
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr); |
|||
void radio_set_tx_power(uint8_t dbm); |
|||
mesh::LocalIdentity radio_new_identity(); |
|||
|
|||
@ -1,10 +1,17 @@ |
|||
#pragma once |
|||
|
|||
#define RADIOLIB_STATIC_ONLY 1 |
|||
#include <RadioLib.h> |
|||
#include <helpers/RadioLibWrappers.h> |
|||
#include <helpers/nrf52/FaketecBoard.h> |
|||
#include <helpers/CustomSX1262Wrapper.h> |
|||
#include <helpers/CustomLLCC68Wrapper.h> |
|||
|
|||
extern FaketecBoard board; |
|||
extern RADIO_CLASS radio; |
|||
extern WRAPPER_CLASS radio_driver; |
|||
|
|||
bool radio_init(); |
|||
uint32_t radio_get_rng_seed(); |
|||
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr); |
|||
void radio_set_tx_power(uint8_t dbm); |
|||
mesh::LocalIdentity radio_new_identity(); |
|||
|
|||
@ -1,9 +1,16 @@ |
|||
#pragma once |
|||
|
|||
#define RADIOLIB_STATIC_ONLY 1 |
|||
#include <RadioLib.h> |
|||
#include <helpers/RadioLibWrappers.h> |
|||
#include <helpers/nrf52/RAK4631Board.h> |
|||
#include <helpers/CustomSX1262Wrapper.h> |
|||
|
|||
extern RAK4631Board board; |
|||
extern RADIO_CLASS radio; |
|||
extern WRAPPER_CLASS radio_driver; |
|||
|
|||
bool radio_init(); |
|||
uint32_t radio_get_rng_seed(); |
|||
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr); |
|||
void radio_set_tx_power(uint8_t dbm); |
|||
mesh::LocalIdentity radio_new_identity(); |
|||
|
|||
@ -1,9 +1,16 @@ |
|||
#pragma once |
|||
|
|||
#define RADIOLIB_STATIC_ONLY 1 |
|||
#include <RadioLib.h> |
|||
#include <helpers/RadioLibWrappers.h> |
|||
#include <helpers/StationG2Board.h> |
|||
#include <helpers/CustomSX1262Wrapper.h> |
|||
|
|||
extern StationG2Board board; |
|||
extern RADIO_CLASS radio; |
|||
extern WRAPPER_CLASS radio_driver; |
|||
|
|||
bool radio_init(); |
|||
uint32_t radio_get_rng_seed(); |
|||
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr); |
|||
void radio_set_tx_power(uint8_t dbm); |
|||
mesh::LocalIdentity radio_new_identity(); |
|||
|
|||
@ -1,9 +1,16 @@ |
|||
#pragma once |
|||
|
|||
#define RADIOLIB_STATIC_ONLY 1 |
|||
#include <RadioLib.h> |
|||
#include <helpers/RadioLibWrappers.h> |
|||
#include <helpers/nrf52/T1000eBoard.h> |
|||
#include <helpers/CustomLR1110Wrapper.h> |
|||
|
|||
extern T1000eBoard board; |
|||
extern RADIO_CLASS radio; |
|||
extern WRAPPER_CLASS radio_driver; |
|||
|
|||
bool radio_init(); |
|||
uint32_t radio_get_rng_seed(); |
|||
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr); |
|||
void radio_set_tx_power(uint8_t dbm); |
|||
mesh::LocalIdentity radio_new_identity(); |
|||
|
|||
@ -1,9 +1,16 @@ |
|||
#pragma once |
|||
|
|||
#define RADIOLIB_STATIC_ONLY 1 |
|||
#include <RadioLib.h> |
|||
#include <helpers/RadioLibWrappers.h> |
|||
#include <helpers/nrf52/T114Board.h> |
|||
#include <helpers/CustomSX1262Wrapper.h> |
|||
|
|||
extern T114Board board; |
|||
extern RADIO_CLASS radio; |
|||
extern WRAPPER_CLASS radio_driver; |
|||
|
|||
bool radio_init(); |
|||
uint32_t radio_get_rng_seed(); |
|||
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr); |
|||
void radio_set_tx_power(uint8_t dbm); |
|||
mesh::LocalIdentity radio_new_identity(); |
|||
|
|||
@ -1,9 +1,16 @@ |
|||
#pragma once |
|||
|
|||
#define RADIOLIB_STATIC_ONLY 1 |
|||
#include <RadioLib.h> |
|||
#include <helpers/RadioLibWrappers.h> |
|||
#include <helpers/nrf52/TechoBoard.h> |
|||
#include <helpers/CustomSX1262Wrapper.h> |
|||
|
|||
extern TechoBoard board; |
|||
extern RADIO_CLASS radio; |
|||
extern WRAPPER_CLASS radio_driver; |
|||
|
|||
bool radio_init(); |
|||
uint32_t radio_get_rng_seed(); |
|||
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr); |
|||
void radio_set_tx_power(uint8_t dbm); |
|||
mesh::LocalIdentity radio_new_identity(); |
|||
|
|||
@ -1,10 +1,17 @@ |
|||
#pragma once |
|||
|
|||
#define RADIOLIB_STATIC_ONLY 1 |
|||
#include <RadioLib.h> |
|||
#include <helpers/RadioLibWrappers.h> |
|||
#include <helpers/XiaoC3Board.h> |
|||
#include <helpers/CustomSX1262Wrapper.h> |
|||
#include <helpers/CustomSX1268Wrapper.h> |
|||
|
|||
extern XiaoC3Board board; |
|||
extern RADIO_CLASS radio; |
|||
extern WRAPPER_CLASS radio_driver; |
|||
|
|||
bool radio_init(); |
|||
uint32_t radio_get_rng_seed(); |
|||
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr); |
|||
void radio_set_tx_power(uint8_t dbm); |
|||
mesh::LocalIdentity radio_new_identity(); |
|||
|
|||
@ -1,9 +1,16 @@ |
|||
#pragma once |
|||
|
|||
#define RADIOLIB_STATIC_ONLY 1 |
|||
#include <RadioLib.h> |
|||
#include <helpers/RadioLibWrappers.h> |
|||
#include <helpers/ESP32Board.h> |
|||
#include <helpers/CustomSX1262Wrapper.h> |
|||
|
|||
extern ESP32Board board; |
|||
extern RADIO_CLASS radio; |
|||
extern WRAPPER_CLASS radio_driver; |
|||
|
|||
bool radio_init(); |
|||
uint32_t radio_get_rng_seed(); |
|||
void radio_set_params(float freq, float bw, uint8_t sf, uint8_t cr); |
|||
void radio_set_tx_power(uint8_t dbm); |
|||
mesh::LocalIdentity radio_new_identity(); |
|||
|
|||
Loading…
Reference in new issue