Clean up a bit, add exit to launcher function.

This commit is contained in:
RobotMan2412 2022-06-20 23:14:16 +02:00
parent 68328d5a85
commit a56e6942f1
2 changed files with 30 additions and 12 deletions

View file

@ -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();

View file

@ -2,18 +2,6 @@
// This file contains a simple hello world app which you can base you own apps on.
#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;
xQueueHandle buttonQueue;
@ -24,6 +12,11 @@ void disp_flush() {
ili9341_write(get_ili9341(), buf.buf);
}
void exit_to_launcher() {
REG_WRITE(RTC_CNTL_STORE0_REG, 0);
esp_restart();
}
void app_main() {
// Init HW.
bsp_init();
@ -60,5 +53,10 @@ void app_main() {
// Await any button press and do another cycle.
rp2040_input_message_t message;
xQueueReceive(buttonQueue, &message, portMAX_DELAY);
if (message.input == RP2040_INPUT_BUTTON_HOME && message.state) {
// If home is pressed, exit to launcher.
exit_to_launcher();
}
}
}