Clean up a bit, add exit to launcher function.
This commit is contained in:
parent
68328d5a85
commit
a56e6942f1
2 changed files with 30 additions and 12 deletions
|
@ -0,0 +1,20 @@
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "hardware.h"
|
||||||
|
#include "pax_gfx.h"
|
||||||
|
#include "pax_codecs.h"
|
||||||
|
#include "ili9341.h"
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
|
#include "freertos/task.h"
|
||||||
|
#include "freertos/queue.h"
|
||||||
|
#include "esp_system.h"
|
||||||
|
#include "nvs.h"
|
||||||
|
#include "nvs_flash.h"
|
||||||
|
#include "wifi_connect.h"
|
||||||
|
#include "wifi_connection.h"
|
||||||
|
#include "soc/rtc.h"
|
||||||
|
#include "soc/rtc_cntl_reg.h"
|
||||||
|
|
||||||
|
void disp_flush();
|
||||||
|
void exit_to_launcher();
|
22
main/main.c
22
main/main.c
|
@ -2,18 +2,6 @@
|
||||||
// This file contains a simple hello world app which you can base you own apps on.
|
// This file contains a simple hello world app which you can base you own apps on.
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "hardware.h"
|
|
||||||
#include "pax_gfx.h"
|
|
||||||
#include "pax_codecs.h"
|
|
||||||
#include "ili9341.h"
|
|
||||||
#include "freertos/FreeRTOS.h"
|
|
||||||
#include "freertos/task.h"
|
|
||||||
#include "freertos/queue.h"
|
|
||||||
#include "esp_system.h"
|
|
||||||
#include "nvs.h"
|
|
||||||
#include "nvs_flash.h"
|
|
||||||
#include "wifi_connect.h"
|
|
||||||
#include "wifi_connection.h"
|
|
||||||
|
|
||||||
static pax_buf_t buf;
|
static pax_buf_t buf;
|
||||||
xQueueHandle buttonQueue;
|
xQueueHandle buttonQueue;
|
||||||
|
@ -24,6 +12,11 @@ void disp_flush() {
|
||||||
ili9341_write(get_ili9341(), buf.buf);
|
ili9341_write(get_ili9341(), buf.buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void exit_to_launcher() {
|
||||||
|
REG_WRITE(RTC_CNTL_STORE0_REG, 0);
|
||||||
|
esp_restart();
|
||||||
|
}
|
||||||
|
|
||||||
void app_main() {
|
void app_main() {
|
||||||
// Init HW.
|
// Init HW.
|
||||||
bsp_init();
|
bsp_init();
|
||||||
|
@ -60,5 +53,10 @@ void app_main() {
|
||||||
// Await any button press and do another cycle.
|
// Await any button press and do another cycle.
|
||||||
rp2040_input_message_t message;
|
rp2040_input_message_t message;
|
||||||
xQueueReceive(buttonQueue, &message, portMAX_DELAY);
|
xQueueReceive(buttonQueue, &message, portMAX_DELAY);
|
||||||
|
|
||||||
|
if (message.input == RP2040_INPUT_BUTTON_HOME && message.state) {
|
||||||
|
// If home is pressed, exit to launcher.
|
||||||
|
exit_to_launcher();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue