btclock_v3/src/lib/screen_handler.hpp

61 lines
1.3 KiB
C++
Raw Normal View History

2023-11-07 00:11:12 +00:00
#pragma once
2023-11-07 20:26:15 +00:00
#include <esp_timer.h>
2023-11-07 00:11:12 +00:00
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
2023-11-12 12:29:52 +00:00
#include "price_fetch.hpp"
#include "shared.hpp"
2023-11-07 00:11:12 +00:00
#include "lib/epd.hpp"
// extern TaskHandle_t priceUpdateTaskHandle;
// extern TaskHandle_t blockUpdateTaskHandle;
// extern TaskHandle_t timeUpdateTaskHandle;
extern TaskHandle_t workerTaskHandle;
2023-11-07 20:26:15 +00:00
extern TaskHandle_t taskScreenRotateTaskHandle;
extern esp_timer_handle_t screenRotateTimer;
extern esp_timer_handle_t minuteTimer;
extern QueueHandle_t workQueue;
typedef enum
{
TASK_PRICE_UPDATE,
TASK_BLOCK_UPDATE,
TASK_TIME_UPDATE
} TaskType;
typedef struct
{
TaskType type;
char data;
} WorkItem;
void workerTask(void *pvParameters);
2023-11-07 20:26:15 +00:00
uint getCurrentScreen();
void setCurrentScreen(uint newScreen);
2023-11-08 11:18:59 +00:00
void nextScreen();
void previousScreen();
void showSystemStatusScreen();
2023-11-07 20:26:15 +00:00
void setupTimeUpdateTimer(void *pvParameters);
void setupScreenRotateTimer(void *pvParameters);
void IRAM_ATTR minuteTimerISR(void* arg);
void IRAM_ATTR screenRotateTimerISR(void* arg);
2023-11-07 00:11:12 +00:00
// void taskPriceUpdate(void *pvParameters);
// void taskBlockUpdate(void *pvParameters);
// void taskTimeUpdate(void *pvParameters);
2023-11-07 20:26:15 +00:00
void taskScreenRotate(void *pvParameters);
uint getTimerSeconds();
bool isTimerActive();
void setTimerActive(bool status);
2023-11-08 11:18:59 +00:00
void toggleTimerActive();
2023-11-07 00:11:12 +00:00
2023-11-07 20:26:15 +00:00
void setupTasks();