Browse Source
Default button polarity to active-LOW across all firmware types
Nearly all LoRa boards use a boot button that pulls to ground when
pressed.
pull/1612/head
Wessel Nieboer
4 months ago
committed by
Wessel Nieboer
No known key found for this signature in database
GPG Key ID: 27BB1C3D63DEEFFF
11 changed files with
27 additions and
11 deletions
-
examples/simple_repeater/UITask.cpp
-
examples/simple_room_server/UITask.cpp
-
examples/simple_sensor/UITask.cpp
-
src/helpers/ESP32Board.h
-
variants/minewsemi_me25ls01/MinewsemiME25LS01Board.h
-
variants/minewsemi_me25ls01/platformio.ini
-
variants/t1000-e/T1000eBoard.h
-
variants/t1000-e/platformio.ini
-
variants/thinknode_m3/platformio.ini
-
variants/wio-e5-mini/platformio.ini
-
variants/xiao_nrf52/XiaoNrf52Board.h
|
|
|
@ -2,6 +2,10 @@ |
|
|
|
#include <Arduino.h> |
|
|
|
#include <helpers/CommonCLI.h> |
|
|
|
|
|
|
|
#ifndef USER_BTN_PRESSED |
|
|
|
#define USER_BTN_PRESSED LOW |
|
|
|
#endif |
|
|
|
|
|
|
|
#define AUTO_OFF_MILLIS 20000 // 20 seconds
|
|
|
|
#define BOOT_SCREEN_MILLIS 4000 // 4 seconds
|
|
|
|
|
|
|
|
@ -85,7 +89,7 @@ void UITask::loop() { |
|
|
|
if (millis() >= _next_read) { |
|
|
|
int btnState = digitalRead(PIN_USER_BTN); |
|
|
|
if (btnState != _prevBtnState) { |
|
|
|
if (btnState == LOW) { // pressed?
|
|
|
|
if (btnState == USER_BTN_PRESSED) { // pressed?
|
|
|
|
if (_display->isOn()) { |
|
|
|
// TODO: any action ?
|
|
|
|
} else { |
|
|
|
|
|
|
|
@ -2,6 +2,10 @@ |
|
|
|
#include <Arduino.h> |
|
|
|
#include <helpers/CommonCLI.h> |
|
|
|
|
|
|
|
#ifndef USER_BTN_PRESSED |
|
|
|
#define USER_BTN_PRESSED LOW |
|
|
|
#endif |
|
|
|
|
|
|
|
#define AUTO_OFF_MILLIS 20000 // 20 seconds
|
|
|
|
#define BOOT_SCREEN_MILLIS 4000 // 4 seconds
|
|
|
|
|
|
|
|
@ -85,7 +89,7 @@ void UITask::loop() { |
|
|
|
if (millis() >= _next_read) { |
|
|
|
int btnState = digitalRead(PIN_USER_BTN); |
|
|
|
if (btnState != _prevBtnState) { |
|
|
|
if (btnState == LOW) { // pressed?
|
|
|
|
if (btnState == USER_BTN_PRESSED) { // pressed?
|
|
|
|
if (_display->isOn()) { |
|
|
|
// TODO: any action ?
|
|
|
|
} else { |
|
|
|
|
|
|
|
@ -2,6 +2,10 @@ |
|
|
|
#include <Arduino.h> |
|
|
|
#include <helpers/CommonCLI.h> |
|
|
|
|
|
|
|
#ifndef USER_BTN_PRESSED |
|
|
|
#define USER_BTN_PRESSED LOW |
|
|
|
#endif |
|
|
|
|
|
|
|
#define AUTO_OFF_MILLIS 20000 // 20 seconds
|
|
|
|
#define BOOT_SCREEN_MILLIS 4000 // 4 seconds
|
|
|
|
|
|
|
|
@ -85,7 +89,7 @@ void UITask::loop() { |
|
|
|
if (millis() >= _next_read) { |
|
|
|
int btnState = digitalRead(PIN_USER_BTN); |
|
|
|
if (btnState != _prevBtnState) { |
|
|
|
if (btnState == LOW) { // pressed?
|
|
|
|
if (btnState == USER_BTN_PRESSED) { // pressed?
|
|
|
|
if (_display->isOn()) { |
|
|
|
// TODO: any action ?
|
|
|
|
} else { |
|
|
|
|
|
|
|
@ -3,6 +3,10 @@ |
|
|
|
#include <MeshCore.h> |
|
|
|
#include <Arduino.h> |
|
|
|
|
|
|
|
#ifndef USER_BTN_PRESSED |
|
|
|
#define USER_BTN_PRESSED LOW |
|
|
|
#endif |
|
|
|
|
|
|
|
#if defined(ESP_PLATFORM) |
|
|
|
|
|
|
|
#include <rom/rtc.h> |
|
|
|
|
|
|
|
@ -63,7 +63,7 @@ public: |
|
|
|
digitalWrite(LED_PIN, LOW); |
|
|
|
#endif |
|
|
|
#ifdef BUTTON_PIN |
|
|
|
nrf_gpio_cfg_sense_input(digitalPinToInterrupt(BUTTON_PIN), NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_HIGH); |
|
|
|
nrf_gpio_cfg_sense_input(digitalPinToInterrupt(BUTTON_PIN), NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW); |
|
|
|
#endif |
|
|
|
sd_power_system_off(); |
|
|
|
} |
|
|
|
|
|
|
|
@ -21,7 +21,6 @@ build_flags = ${nrf52840_me25ls01.build_flags} |
|
|
|
-I variants/minewsemi_me25ls01 |
|
|
|
-D me25ls01 |
|
|
|
-D PIN_USER_BTN=27 |
|
|
|
-D USER_BTN_PRESSED=HIGH |
|
|
|
-D PIN_STATUS_LED=39 |
|
|
|
-D P_LORA_TX_LED=22 |
|
|
|
-D RADIO_CLASS=CustomLR1110 |
|
|
|
|
|
|
|
@ -78,14 +78,14 @@ public: |
|
|
|
digitalWrite(LED_PIN, HIGH); |
|
|
|
#endif |
|
|
|
#ifdef BUTTON_PIN |
|
|
|
while(digitalRead(BUTTON_PIN)); |
|
|
|
while(digitalRead(BUTTON_PIN) == LOW); |
|
|
|
#endif |
|
|
|
#ifdef LED_PIN |
|
|
|
digitalWrite(LED_PIN, LOW); |
|
|
|
#endif |
|
|
|
|
|
|
|
#ifdef BUTTON_PIN |
|
|
|
nrf_gpio_cfg_sense_input(BUTTON_PIN, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_SENSE_HIGH); |
|
|
|
nrf_gpio_cfg_sense_input(BUTTON_PIN, NRF_GPIO_PIN_NOPULL, NRF_GPIO_PIN_SENSE_LOW); |
|
|
|
#endif |
|
|
|
|
|
|
|
sd_power_system_off(); |
|
|
|
|
|
|
|
@ -10,7 +10,6 @@ build_flags = ${nrf52_base.build_flags} |
|
|
|
-I src/helpers/ui |
|
|
|
-D T1000_E |
|
|
|
-D PIN_USER_BTN=6 |
|
|
|
-D USER_BTN_PRESSED=HIGH |
|
|
|
-D PIN_STATUS_LED=24 |
|
|
|
-D RADIO_CLASS=CustomLR1110 |
|
|
|
-D WRAPPER_CLASS=CustomLR1110Wrapper |
|
|
|
|
|
|
|
@ -10,7 +10,6 @@ build_flags = ${nrf52_base.build_flags} |
|
|
|
-I src/helpers/ui |
|
|
|
-D THINKNODE_M3 |
|
|
|
-D PIN_USER_BTN=12 |
|
|
|
-D USER_BTN_PRESSED=LOW |
|
|
|
-D PIN_STATUS_LED=35 |
|
|
|
-D RADIO_CLASS=CustomLR1110 |
|
|
|
-D WRAPPER_CLASS=CustomLR1110Wrapper |
|
|
|
|
|
|
|
@ -9,7 +9,6 @@ build_flags = ${stm32_base.build_flags} |
|
|
|
-D RX_BOOSTED_GAIN=true |
|
|
|
-D P_LORA_TX_LED=LED_RED |
|
|
|
-D PIN_USER_BTN=USER_BTN |
|
|
|
-D USER_BTN_PRESSED=LOW |
|
|
|
-I variants/wio-e5-mini |
|
|
|
build_src_filter = ${stm32_base.build_src_filter} |
|
|
|
+<../variants/wio-e5-mini> |
|
|
|
|
|
|
|
@ -4,6 +4,10 @@ |
|
|
|
#include <Arduino.h> |
|
|
|
#include <helpers/NRF52Board.h> |
|
|
|
|
|
|
|
#ifndef USER_BTN_PRESSED |
|
|
|
#define USER_BTN_PRESSED LOW |
|
|
|
#endif |
|
|
|
|
|
|
|
#ifdef XIAO_NRF52 |
|
|
|
|
|
|
|
class XiaoNrf52Board : public NRF52BoardDCDC { |
|
|
|
@ -35,7 +39,7 @@ public: |
|
|
|
// set led on and wait for button release before poweroff
|
|
|
|
digitalWrite(PIN_LED, LOW); |
|
|
|
#ifdef PIN_USER_BTN |
|
|
|
while(digitalRead(PIN_USER_BTN) == LOW); |
|
|
|
while(digitalRead(PIN_USER_BTN) == USER_BTN_PRESSED); |
|
|
|
#endif |
|
|
|
digitalWrite(LED_GREEN, HIGH); |
|
|
|
digitalWrite(LED_BLUE, HIGH); |
|
|
|
|