mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-04-20 22:13:47 +00:00
Merge pull request #123 from oltaco/faketec-support
Faketec display and button support.
This commit is contained in:
commit
390e8407c0
3 changed files with 52 additions and 26 deletions
|
|
@ -6,16 +6,37 @@
|
|||
|
||||
static BLEDfu bledfu;
|
||||
|
||||
void faketecBoard::begin() {
|
||||
// for future use, sub-classes SHOULD call this from their begin()
|
||||
startup_reason = BD_STARTUP_NORMAL;
|
||||
btn_prev_state = HIGH;
|
||||
|
||||
pinMode(PIN_VBAT_READ, INPUT);
|
||||
|
||||
#ifdef BUTTON_PIN
|
||||
pinMode(BUTTON_PIN, INPUT);
|
||||
#endif
|
||||
|
||||
#if defined(PIN_BOARD_SDA) && defined(PIN_BOARD_SCL)
|
||||
Wire.setPins(PIN_BOARD_SDA, PIN_BOARD_SCL);
|
||||
#endif
|
||||
|
||||
Wire.begin();
|
||||
|
||||
pinMode(SX126X_POWER_EN, OUTPUT);
|
||||
digitalWrite(SX126X_POWER_EN, HIGH);
|
||||
delay(10); // give sx1262 some time to power up
|
||||
}
|
||||
|
||||
static void connect_callback(uint16_t conn_handle) {
|
||||
(void)conn_handle;
|
||||
MESH_DEBUG_PRINTLN("BLE client connected");
|
||||
(void)conn_handle;
|
||||
MESH_DEBUG_PRINTLN("BLE client connected");
|
||||
}
|
||||
|
||||
static void disconnect_callback(uint16_t conn_handle, uint8_t reason) {
|
||||
(void)conn_handle;
|
||||
(void)reason;
|
||||
|
||||
MESH_DEBUG_PRINTLN("BLE client disconnected");
|
||||
(void)conn_handle;
|
||||
(void)reason;
|
||||
MESH_DEBUG_PRINTLN("BLE client disconnected");
|
||||
}
|
||||
|
||||
bool faketecBoard::startOTAUpdate() {
|
||||
|
|
|
|||
|
|
@ -23,24 +23,10 @@
|
|||
class faketecBoard : public mesh::MainBoard {
|
||||
protected:
|
||||
uint8_t startup_reason;
|
||||
uint8_t btn_prev_state;
|
||||
|
||||
public:
|
||||
void begin() {
|
||||
// for future use, sub-classes SHOULD call this from their begin()
|
||||
startup_reason = BD_STARTUP_NORMAL;
|
||||
|
||||
pinMode(PIN_VBAT_READ, INPUT);
|
||||
|
||||
#if defined(PIN_BOARD_SDA) && defined(PIN_BOARD_SCL)
|
||||
Wire.setPins(PIN_BOARD_SDA, PIN_BOARD_SCL)
|
||||
#endif
|
||||
|
||||
Wire.begin();
|
||||
|
||||
pinMode(SX126X_POWER_EN, OUTPUT);
|
||||
digitalWrite(SX126X_POWER_EN, HIGH);
|
||||
delay(10); // give sx1262 some time to power up
|
||||
}
|
||||
void begin();
|
||||
|
||||
uint8_t getStartupReason() const override { return startup_reason; }
|
||||
|
||||
|
|
@ -61,6 +47,17 @@ public:
|
|||
return "Faketec DIY";
|
||||
}
|
||||
|
||||
int buttonStateChanged() {
|
||||
#ifdef BUTTON_PIN
|
||||
uint8_t v = digitalRead(BUTTON_PIN);
|
||||
if (v != btn_prev_state) {
|
||||
btn_prev_state = v;
|
||||
return (v == LOW) ? 1 : -1;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
void reboot() override {
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,10 +9,18 @@ build_flags = ${nrf52840_base.build_flags}
|
|||
-D LORA_TX_POWER=22
|
||||
-D SX126X_CURRENT_LIMIT=130
|
||||
-D SX126X_RX_BOOSTED_GAIN=1
|
||||
-D DISPLAY_CLASS=SSD1306Display
|
||||
-D PIN_BOARD_SCL=7
|
||||
-D PIN_BOARD_SDA=8
|
||||
-D PIN_OLED_RESET=-1
|
||||
-D PIN_USER_BTN=6
|
||||
lib_deps=
|
||||
${nrf52840_base.lib_deps}
|
||||
adafruit/Adafruit SSD1306 @ ^2.5.13
|
||||
|
||||
[env:Faketec_Repeater]
|
||||
extends = faketec
|
||||
build_src_filter = ${faketec.build_src_filter} +<../examples/simple_repeater/main.cpp>
|
||||
build_src_filter = ${faketec.build_src_filter} +<../examples/simple_repeater> +<helpers/ui/*.cpp>
|
||||
build_flags =
|
||||
${faketec.build_flags}
|
||||
-D ADVERT_NAME="\"Faketec Repeater\""
|
||||
|
|
@ -27,7 +35,7 @@ lib_deps =
|
|||
|
||||
[env:Faketec_room_server]
|
||||
extends = faketec
|
||||
build_src_filter = ${faketec.build_src_filter} +<../examples/simple_room_server/main.cpp>
|
||||
build_src_filter = ${faketec.build_src_filter} +<../examples/simple_room_server> +<helpers/ui/*.cpp>
|
||||
build_flags =
|
||||
${faketec.build_flags}
|
||||
-D ADVERT_NAME="\"Test Room\""
|
||||
|
|
@ -63,7 +71,7 @@ build_flags =
|
|||
-D MAX_GROUP_CHANNELS=8
|
||||
; NOTE: DO NOT ENABLE --> -D MESH_PACKET_LOGGING=1
|
||||
; NOTE: DO NOT ENABLE --> -D MESH_DEBUG=1
|
||||
build_src_filter = ${faketec.build_src_filter} +<../examples/companion_radio/main.cpp>
|
||||
build_src_filter = ${faketec.build_src_filter} +<../examples/companion_radio> +<../examples/companion_radio> +<helpers/ui/*.cpp>
|
||||
lib_deps =
|
||||
${faketec.lib_deps}
|
||||
adafruit/RTClib @ ^2.1.3
|
||||
|
|
@ -81,7 +89,7 @@ build_flags =
|
|||
-D ENABLE_PRIVATE_KEY_IMPORT=1
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
build_src_filter = ${faketec.build_src_filter} +<helpers/nrf52/SerialBLEInterface.cpp> +<../examples/companion_radio/main.cpp>
|
||||
build_src_filter = ${faketec.build_src_filter} +<helpers/nrf52/SerialBLEInterface.cpp> +<../examples/companion_radio> +<helpers/ui/*.cpp>
|
||||
lib_deps =
|
||||
${faketec.lib_deps}
|
||||
adafruit/RTClib @ ^2.1.3
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue