36 lines
705 B
C
36 lines
705 B
C
#pragma once
|
|
|
|
#include <Arduino.h>
|
|
#include <freertos/FreeRTOS.h>
|
|
#include <freertos/queue.h>
|
|
#include <freertos/semphr.h>
|
|
|
|
enum class CmdType : uint8_t {
|
|
VolumeDelta, // value: signed change in %
|
|
VolumeSet, // value: absolute 0..100
|
|
RelayToggle,
|
|
RelaySet, // value: 0 / 1
|
|
};
|
|
|
|
struct Command {
|
|
CmdType type;
|
|
int16_t value;
|
|
};
|
|
|
|
struct AppState {
|
|
uint8_t volume; // 0..100
|
|
bool relay;
|
|
};
|
|
|
|
// Created in main.cpp
|
|
extern QueueHandle_t cmdQueue;
|
|
|
|
bool sendCommand(CmdType type, int16_t value = 0);
|
|
AppState getState();
|
|
void setState(const AppState &s);
|
|
|
|
void controlTask(void *arg);
|
|
void encoderTask(void *arg);
|
|
void webTask(void *arg);
|
|
void displayTask(void *arg);
|