Skip to content

Commit dcd6b3e

Browse files
committed
bpp changes by @Spritetm
1 parent 4d99a99 commit dcd6b3e

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

esp32/Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ INC += -I../../components/badge
5454
INC += -I../../components/ugfx
5555
INC += -I../../components/graph
5656
INC += -I../../components/sha2017
57+
INC += -I../../components/bpp-recv
58+
INC += -I../../components/bpp-if
59+
INC += -I../../components/ed25519/include
60+
INC += -I../../components/redundancy
5761
INC += -I../../main
5862
INC += -I../../ugfx/src/gdisp/mcufont
5963
INC += -I../../ugfx
@@ -155,6 +159,7 @@ SRC_C = \
155159
machine_hw_spi.c \
156160
mpthreadport.c \
157161
esprtcmem.c \
162+
espdeepsleep.c \
158163
ugfx_containers.c \
159164
ugfx_widgets.c \
160165
ugfx_styles.c \
@@ -661,6 +666,15 @@ BADGE_COMPONENTS_O = $(addprefix $(BADGE)/components/,\
661666
sha2017/sha2017_ota.o \
662667
)
663668

669+
#Re-use libraries built while building non-micro-python project. Because kindly
670+
#fuck off with your ignore-all-esp-idf-and-make-me-state-every-single-thing-again-conventions
671+
#micropython makefile crap. Yes, I'm salty about that.
672+
BADGE_LIBS += ../../build/ed25519/libed25519.a
673+
BADGE_LIBS += ../../build/bpp-if/libbpp-if.a
674+
BADGE_LIBS += ../../build/bpp-recv/libbpp-recv.a
675+
BADGE_LIBS += ../../build/redundancy/libredundancy.a
676+
677+
664678
OBJ_ESPIDF += $(addprefix $(BUILD)/, $(BADGE_COMPONENTS_O))
665679

666680
################################################################################
@@ -698,6 +712,7 @@ APP_LD_ARGS += -L$(dir $(LIBSTDCXX_FILE_NAME)) -lstdc++
698712
APP_LD_ARGS += $(ESPCOMP)/newlib/lib/libc.a
699713
APP_LD_ARGS += $(ESPCOMP)/newlib/lib/libm.a
700714
APP_LD_ARGS += $(ESPCOMP)/esp32/libhal.a
715+
APP_LD_ARGS += $(BADGE_LIBS)
701716
APP_LD_ARGS += -L$(ESPCOMP)/esp32/lib -lcore -lnet80211 -lphy -lrtc -lpp -lwpa -lsmartconfig -lcoexist
702717
APP_LD_ARGS += $(OBJ)
703718
APP_LD_ARGS += --end-group

esp32/main.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@
5151
#include "uart.h"
5252
#include "modmachine.h"
5353
#include "mpthreadport.h"
54+
#include "badge_portexp.h"
55+
#include "badge_pins.h"
56+
#include "bpp_init.h"
57+
#include "driver/gpio.h"
5458

5559
// MicroPython runs as a task under FreeRTOS
5660
#define MP_TASK_PRIORITY (ESP_TASK_PRIO_MIN + 1)
@@ -121,10 +125,38 @@ void mp_task(void *pvParameter) {
121125
goto soft_reset;
122126
}
123127

128+
void do_bpp_bgnd() {
129+
//Kick off bpp
130+
bpp_init();
131+
printf("Bpp inited.\n");
132+
//immediately abort and reboot when touchpad detects something
133+
while(gpio_get_level(PIN_NUM_MPR121_INT)==1) {
134+
vTaskDelay(10);
135+
}
136+
printf("Touch detected. Exiting bpp, rebooting.\n");
137+
esp_restart();
138+
}
139+
124140
void app_main(void) {
125141
uint8_t magic = esp_rtcmem_read(0);
126142
uint8_t inv_magic = esp_rtcmem_read(1);
127143

144+
//Grab level of int pin of touchpad. If high, this was a
145+
//scheduled wakeup because of a deep sleep timeout. If low,
146+
//the user used the touchpad.
147+
//yes, this is v1 specific. Please add v0.x support yourself.
148+
gpio_config_t io_conf = {
149+
.mode = GPIO_MODE_INPUT,
150+
.pin_bit_mask = 1LL << PIN_NUM_MPR121_INT,
151+
.pull_down_en = 0,
152+
.pull_up_en = 1,
153+
};
154+
gpio_config(&io_conf);
155+
if (gpio_get_level(PIN_NUM_MPR121_INT)==1) {
156+
printf("Touch int is high. Starting bpp.\n");
157+
do_bpp_bgnd();
158+
}
159+
128160
if (magic == (uint8_t)~inv_magic) {
129161
printf("Magic checked out!\n");
130162
switch (magic) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy