File tree Expand file tree Collapse file tree 5 files changed +18
-5
lines changed
examples/companion_radio/ui-new Expand file tree Collapse file tree 5 files changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -716,10 +716,14 @@ void UITask::loop() {
716716 _analogue_pin_read_millis = millis ();
717717 }
718718#endif
719- #if defined(DISP_BACKLIGHT) && defined( BACKLIGHT_BTN)
719+ #if defined(BACKLIGHT_BTN)
720720 if (millis () > next_backlight_btn_check) {
721721 bool touch_state = digitalRead (PIN_BUTTON2);
722+ #if defined(DISP_BACKLIGHT)
722723 digitalWrite (DISP_BACKLIGHT, !touch_state);
724+ #elif defined(EXP_PIN_BACKLIGHT)
725+ expander.digitalWrite (EXP_PIN_BACKLIGHT, !touch_state);
726+ #endif
723727 next_backlight_btn_check = millis () + 300 ;
724728 }
725729#endif
Original file line number Diff line number Diff line change 11
22#include " GxEPDDisplay.h"
33
4+ #ifdef EXP_PIN_BACKLIGHT
5+ #include < PCA9557.h>
6+ extern PCA9557 expander;
7+ #endif
8+
49#ifndef DISPLAY_ROTATION
510 #define DISPLAY_ROTATION 3
611#endif
@@ -35,13 +40,17 @@ void GxEPDDisplay::turnOn() {
3540 if (!_init) begin ();
3641#if defined(DISP_BACKLIGHT) && !defined(BACKLIGHT_BTN)
3742 digitalWrite (DISP_BACKLIGHT, HIGH);
43+ #elif defined(EXP_PIN_BACKLIGHT) && !defined(BACKLIGHT_BTN)
44+ expander.digitalWrite (EXP_PIN_BACKLIGHT, HIGH);
3845#endif
3946 _isOn = true ;
4047}
4148
4249void GxEPDDisplay::turnOff () {
4350#if defined(DISP_BACKLIGHT) && !defined(BACKLIGHT_BTN)
4451 digitalWrite (DISP_BACKLIGHT, LOW);
52+ #elif defined(EXP_PIN_BACKLIGHT) && !defined(BACKLIGHT_BTN)
53+ expander.digitalWrite (EXP_PIN_BACKLIGHT, LOW);
4554#endif
4655 _isOn = false ;
4756}
Original file line number Diff line number Diff line change 33PCA9557 expander (0x18 , &Wire1);
44
55void ThinknodeM5Board::begin () {
6- // Start expander
6+ // Start expander and configure pins
77 Wire1.begin (48 , 47 );
88 expander.pinMode (EXP_PIN_POWER, OUTPUT); // eink
99 expander.pinMode (EXP_PIN_BACKLIGHT, OUTPUT); // peripherals
1010 expander.pinMode (EXP_PIN_LED, OUTPUT); // peripherals
1111 expander.digitalWrite (EXP_PIN_POWER, HIGH);
1212 expander.digitalWrite (EXP_PIN_BACKLIGHT, LOW);
1313 expander.digitalWrite (EXP_PIN_LED, LOW);
14-
1514 ESP32Board::begin ();
1615 }
1716
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ build_flags = ${esp32_base.build_flags}
1818 -D P_LORA_MISO =7
1919 -D P_LORA_MOSI =15
2020 -D PIN_USER_BTN =21
21+ -D PIN_BUTTON2 =14
2122 -D EXP_PIN_LED =1
2223# -D PIN_STATUS_LED=1 ; leds are on PCA !!!
2324# -D LED_STATE_ON=HIGH
@@ -29,6 +30,8 @@ build_flags = ${esp32_base.build_flags}
2930 -D EINK_SCALE_Y =1.5625f
3031 -D EINK_X_OFFSET =0
3132 -D EINK_Y_OFFSET =10
33+ -D BACKLIGHT_BTN =PIN_BUTTON2
34+ -D AUTO_OFF_MILLIS =0
3235 -D SX126X_DIO2_AS_RF_SWITCH =true
3336 -D SX126X_DIO3_TCXO_VOLTAGE =3.3
3437 -D SX126X_CURRENT_LIMIT =140
Original file line number Diff line number Diff line change @@ -24,8 +24,6 @@ SensorManager sensors;
2424bool radio_init () {
2525 fallback_clock.begin ();
2626 rtc_clock.begin (Wire);
27- // pinMode(21, INPUT);
28- // pinMode(48, OUTPUT);
2927 pinMode (P_LORA_EN, OUTPUT);
3028 digitalWrite (P_LORA_EN, HIGH);
3129 #if defined(P_LORA_SCLK)
You can’t perform that action at this time.
0 commit comments