mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
Merge pull request #155 from oltaco/promicro-refactor
ProMicro refactoring
This commit is contained in:
commit
0a62ab663f
5 changed files with 33 additions and 33 deletions
|
|
@ -1,12 +1,12 @@
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include "FaketecBoard.h"
|
#include "PromicroBoard.h"
|
||||||
|
|
||||||
#include <bluefruit.h>
|
#include <bluefruit.h>
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
|
|
||||||
static BLEDfu bledfu;
|
static BLEDfu bledfu;
|
||||||
|
|
||||||
void FaketecBoard::begin() {
|
void PromicroBoard::begin() {
|
||||||
// for future use, sub-classes SHOULD call this from their begin()
|
// for future use, sub-classes SHOULD call this from their begin()
|
||||||
startup_reason = BD_STARTUP_NORMAL;
|
startup_reason = BD_STARTUP_NORMAL;
|
||||||
btn_prev_state = HIGH;
|
btn_prev_state = HIGH;
|
||||||
|
|
@ -39,7 +39,7 @@ static void disconnect_callback(uint16_t conn_handle, uint8_t reason) {
|
||||||
MESH_DEBUG_PRINTLN("BLE client disconnected");
|
MESH_DEBUG_PRINTLN("BLE client disconnected");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FaketecBoard::startOTAUpdate(const char* id, char reply[]) {
|
bool PromicroBoard::startOTAUpdate(const char* id, char reply[]) {
|
||||||
// Config the peripheral connection with maximum bandwidth
|
// Config the peripheral connection with maximum bandwidth
|
||||||
// more SRAM required by SoftDevice
|
// more SRAM required by SoftDevice
|
||||||
// Note: All config***() function must be called before begin()
|
// Note: All config***() function must be called before begin()
|
||||||
|
|
@ -50,7 +50,7 @@ bool FaketecBoard::startOTAUpdate(const char* id, char reply[]) {
|
||||||
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
|
// Set max power. Accepted values are: -40, -30, -20, -16, -12, -8, -4, 0, 4
|
||||||
Bluefruit.setTxPower(4);
|
Bluefruit.setTxPower(4);
|
||||||
// Set the BLE device name
|
// Set the BLE device name
|
||||||
Bluefruit.setName("Faketec_OTA");
|
Bluefruit.setName("ProMicro_OTA");
|
||||||
|
|
||||||
Bluefruit.Periph.setConnectCallback(connect_callback);
|
Bluefruit.Periph.setConnectCallback(connect_callback);
|
||||||
Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
|
Bluefruit.Periph.setDisconnectCallback(disconnect_callback);
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
#define PIN_VBAT_READ 17
|
#define PIN_VBAT_READ 17
|
||||||
#define ADC_MULTIPLIER (1.815f) // dependent on voltage divider resistors. TODO: more accurate battery tracking
|
#define ADC_MULTIPLIER (1.815f) // dependent on voltage divider resistors. TODO: more accurate battery tracking
|
||||||
|
|
||||||
class FaketecBoard : public mesh::MainBoard {
|
class PromicroBoard : public mesh::MainBoard {
|
||||||
protected:
|
protected:
|
||||||
uint8_t startup_reason;
|
uint8_t startup_reason;
|
||||||
uint8_t btn_prev_state;
|
uint8_t btn_prev_state;
|
||||||
|
|
@ -43,7 +43,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* getManufacturerName() const override {
|
const char* getManufacturerName() const override {
|
||||||
return "Faketec DIY";
|
return "ProMicro DIY";
|
||||||
}
|
}
|
||||||
|
|
||||||
int buttonStateChanged() {
|
int buttonStateChanged() {
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
[faketec]
|
[Faketec]
|
||||||
extends = nrf52840_base
|
extends = nrf52840_base
|
||||||
board = promicro_nrf52840
|
board = promicro_nrf52840
|
||||||
build_flags = ${nrf52840_base.build_flags}
|
build_flags = ${nrf52840_base.build_flags}
|
||||||
|
|
@ -15,17 +15,17 @@ build_flags = ${nrf52840_base.build_flags}
|
||||||
-D PIN_OLED_RESET=-1
|
-D PIN_OLED_RESET=-1
|
||||||
-D PIN_USER_BTN=6
|
-D PIN_USER_BTN=6
|
||||||
build_src_filter = ${nrf52840_base.build_src_filter}
|
build_src_filter = ${nrf52840_base.build_src_filter}
|
||||||
+<helpers/nrf52/FaketecBoard.cpp>
|
+<helpers/nrf52/PromicroBoard.cpp>
|
||||||
+<../variants/promicro>
|
+<../variants/promicro>
|
||||||
lib_deps=
|
lib_deps=
|
||||||
${nrf52840_base.lib_deps}
|
${nrf52840_base.lib_deps}
|
||||||
adafruit/Adafruit SSD1306 @ ^2.5.13
|
adafruit/Adafruit SSD1306 @ ^2.5.13
|
||||||
|
|
||||||
[env:Faketec_Repeater]
|
[env:Faketec_Repeater]
|
||||||
extends = faketec
|
extends = Faketec
|
||||||
build_src_filter = ${faketec.build_src_filter} +<../examples/simple_repeater> +<helpers/ui/*.cpp>
|
build_src_filter = ${Faketec.build_src_filter} +<../examples/simple_repeater> +<helpers/ui/*.cpp>
|
||||||
build_flags =
|
build_flags =
|
||||||
${faketec.build_flags}
|
${Faketec.build_flags}
|
||||||
-D ADVERT_NAME="\"Faketec Repeater\""
|
-D ADVERT_NAME="\"Faketec Repeater\""
|
||||||
-D ADVERT_LAT=-37.0
|
-D ADVERT_LAT=-37.0
|
||||||
-D ADVERT_LON=145.0
|
-D ADVERT_LON=145.0
|
||||||
|
|
@ -33,14 +33,14 @@ build_flags =
|
||||||
; -D MESH_PACKET_LOGGING=1
|
; -D MESH_PACKET_LOGGING=1
|
||||||
; -D MESH_DEBUG=1
|
; -D MESH_DEBUG=1
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${faketec.lib_deps}
|
${Faketec.lib_deps}
|
||||||
adafruit/RTClib @ ^2.1.3
|
adafruit/RTClib @ ^2.1.3
|
||||||
|
|
||||||
[env:Faketec_room_server]
|
[env:Faketec_room_server]
|
||||||
extends = faketec
|
extends = Faketec
|
||||||
build_src_filter = ${faketec.build_src_filter} +<../examples/simple_room_server> +<helpers/ui/*.cpp>
|
build_src_filter = ${Faketec.build_src_filter} +<../examples/simple_room_server> +<helpers/ui/*.cpp>
|
||||||
build_flags =
|
build_flags =
|
||||||
${faketec.build_flags}
|
${Faketec.build_flags}
|
||||||
-D ADVERT_NAME="\"Test Room\""
|
-D ADVERT_NAME="\"Test Room\""
|
||||||
-D ADVERT_LAT=-37.0
|
-D ADVERT_LAT=-37.0
|
||||||
-D ADVERT_LON=145.0
|
-D ADVERT_LON=145.0
|
||||||
|
|
@ -49,41 +49,41 @@ build_flags =
|
||||||
; -D MESH_PACKET_LOGGING=1
|
; -D MESH_PACKET_LOGGING=1
|
||||||
; -D MESH_DEBUG=1
|
; -D MESH_DEBUG=1
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${faketec.lib_deps}
|
${Faketec.lib_deps}
|
||||||
adafruit/RTClib @ ^2.1.3
|
adafruit/RTClib @ ^2.1.3
|
||||||
|
|
||||||
[env:Faketec_terminal_chat]
|
[env:Faketec_terminal_chat]
|
||||||
extends = faketec
|
extends = Faketec
|
||||||
build_flags =
|
build_flags =
|
||||||
${faketec.build_flags}
|
${Faketec.build_flags}
|
||||||
-D MAX_CONTACTS=100
|
-D MAX_CONTACTS=100
|
||||||
-D MAX_GROUP_CHANNELS=1
|
-D MAX_GROUP_CHANNELS=1
|
||||||
; -D MESH_PACKET_LOGGING=1
|
; -D MESH_PACKET_LOGGING=1
|
||||||
; -D MESH_DEBUG=1
|
; -D MESH_DEBUG=1
|
||||||
build_src_filter = ${faketec.build_src_filter} +<../examples/simple_secure_chat/main.cpp>
|
build_src_filter = ${Faketec.build_src_filter} +<../examples/simple_secure_chat/main.cpp>
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${faketec.lib_deps}
|
${Faketec.lib_deps}
|
||||||
densaugeo/base64 @ ~1.4.0
|
densaugeo/base64 @ ~1.4.0
|
||||||
adafruit/RTClib @ ^2.1.3
|
adafruit/RTClib @ ^2.1.3
|
||||||
|
|
||||||
[env:Faketec_companion_radio_usb]
|
[env:Faketec_companion_radio_usb]
|
||||||
extends = faketec
|
extends = Faketec
|
||||||
build_flags =
|
build_flags =
|
||||||
${faketec.build_flags}
|
${Faketec.build_flags}
|
||||||
-D MAX_CONTACTS=100
|
-D MAX_CONTACTS=100
|
||||||
-D MAX_GROUP_CHANNELS=8
|
-D MAX_GROUP_CHANNELS=8
|
||||||
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
|
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
|
||||||
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
|
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
|
||||||
build_src_filter = ${faketec.build_src_filter} +<../examples/companion_radio> +<../examples/companion_radio> +<helpers/ui/*.cpp>
|
build_src_filter = ${Faketec.build_src_filter} +<../examples/companion_radio> +<../examples/companion_radio> +<helpers/ui/*.cpp>
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${faketec.lib_deps}
|
${Faketec.lib_deps}
|
||||||
adafruit/RTClib @ ^2.1.3
|
adafruit/RTClib @ ^2.1.3
|
||||||
densaugeo/base64 @ ~1.4.0
|
densaugeo/base64 @ ~1.4.0
|
||||||
|
|
||||||
[env:Faketec_companion_radio_ble]
|
[env:Faketec_companion_radio_ble]
|
||||||
extends = faketec
|
extends = Faketec
|
||||||
build_flags =
|
build_flags =
|
||||||
${faketec.build_flags}
|
${Faketec.build_flags}
|
||||||
-D MAX_CONTACTS=100
|
-D MAX_CONTACTS=100
|
||||||
-D MAX_GROUP_CHANNELS=8
|
-D MAX_GROUP_CHANNELS=8
|
||||||
-D BLE_PIN_CODE=123456
|
-D BLE_PIN_CODE=123456
|
||||||
|
|
@ -92,9 +92,9 @@ build_flags =
|
||||||
-D ENABLE_PRIVATE_KEY_IMPORT=1
|
-D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||||
; -D MESH_PACKET_LOGGING=1
|
; -D MESH_PACKET_LOGGING=1
|
||||||
; -D MESH_DEBUG=1
|
; -D MESH_DEBUG=1
|
||||||
build_src_filter = ${faketec.build_src_filter} +<helpers/nrf52/SerialBLEInterface.cpp> +<../examples/companion_radio> +<helpers/ui/*.cpp>
|
build_src_filter = ${Faketec.build_src_filter} +<helpers/nrf52/SerialBLEInterface.cpp> +<../examples/companion_radio> +<helpers/ui/*.cpp>
|
||||||
lib_deps =
|
lib_deps =
|
||||||
${faketec.lib_deps}
|
${Faketec.lib_deps}
|
||||||
adafruit/RTClib @ ^2.1.3
|
adafruit/RTClib @ ^2.1.3
|
||||||
densaugeo/base64 @ ~1.4.0
|
densaugeo/base64 @ ~1.4.0
|
||||||
|
|
||||||
|
|
@ -103,14 +103,14 @@ extends = nrf52840_base
|
||||||
board = promicro_nrf52840
|
board = promicro_nrf52840
|
||||||
build_flags = ${nrf52840_base.build_flags}
|
build_flags = ${nrf52840_base.build_flags}
|
||||||
-I variants/promicro
|
-I variants/promicro
|
||||||
-D FAKETEC
|
-D PROMICROLLCC68
|
||||||
-D RADIO_CLASS=CustomLLCC68
|
-D RADIO_CLASS=CustomLLCC68
|
||||||
-D WRAPPER_CLASS=CustomLLCC68Wrapper
|
-D WRAPPER_CLASS=CustomLLCC68Wrapper
|
||||||
-D LORA_TX_POWER=22
|
-D LORA_TX_POWER=22
|
||||||
-D SX126X_CURRENT_LIMIT=130
|
-D SX126X_CURRENT_LIMIT=130
|
||||||
-D SX126X_RX_BOOSTED_GAIN=1
|
-D SX126X_RX_BOOSTED_GAIN=1
|
||||||
build_src_filter = ${nrf52840_base.build_src_filter}
|
build_src_filter = ${nrf52840_base.build_src_filter}
|
||||||
+<helpers/nrf52/FaketecBoard.cpp>
|
+<helpers/nrf52/PromicroBoard.cpp>
|
||||||
+<../variants/promicro>
|
+<../variants/promicro>
|
||||||
|
|
||||||
[env:ProMicroLLCC68_Repeater]
|
[env:ProMicroLLCC68_Repeater]
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
#include "target.h"
|
#include "target.h"
|
||||||
#include <helpers/ArduinoHelpers.h>
|
#include <helpers/ArduinoHelpers.h>
|
||||||
|
|
||||||
FaketecBoard board;
|
PromicroBoard board;
|
||||||
|
|
||||||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI);
|
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,12 @@
|
||||||
#define RADIOLIB_STATIC_ONLY 1
|
#define RADIOLIB_STATIC_ONLY 1
|
||||||
#include <RadioLib.h>
|
#include <RadioLib.h>
|
||||||
#include <helpers/RadioLibWrappers.h>
|
#include <helpers/RadioLibWrappers.h>
|
||||||
#include <helpers/nrf52/FaketecBoard.h>
|
#include <helpers/nrf52/PromicroBoard.h>
|
||||||
#include <helpers/CustomSX1262Wrapper.h>
|
#include <helpers/CustomSX1262Wrapper.h>
|
||||||
#include <helpers/CustomLLCC68Wrapper.h>
|
#include <helpers/CustomLLCC68Wrapper.h>
|
||||||
#include <helpers/AutoDiscoverRTCClock.h>
|
#include <helpers/AutoDiscoverRTCClock.h>
|
||||||
|
|
||||||
extern FaketecBoard board;
|
extern PromicroBoard board;
|
||||||
extern WRAPPER_CLASS radio_driver;
|
extern WRAPPER_CLASS radio_driver;
|
||||||
extern AutoDiscoverRTCClock rtc_clock;
|
extern AutoDiscoverRTCClock rtc_clock;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue