Files
esp32vga/main/app.h
T
jimmyandClaude Opus 5.5 9f84330b91 Move project to repo root and add Makefile
The Makefile wraps the build, USB and WiFi flashing, the serial monitor
and font generation, with toolchain paths that can be overridden.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 12:45:11 +13:00

77 lines
2.1 KiB
C

#pragma once
#include <stdbool.h>
#include <stdint.h>
typedef enum {
CONTENT_TEST,
CONTENT_PLASMA,
CONTENT_STARS,
CONTENT_CLOCK,
CONTENT_MANDEL,
CONTENT_MESSAGE,
CONTENT_IMAGE,
CONTENT_HALLOWEEN, // new modes go at the end: the index is saved in NVS
CONTENT_HAUNT,
CONTENT_GHOSTS,
CONTENT_EYES,
CONTENT_BATS,
CONTENT_PUMPKIN,
CONTENT_SCARE,
CONTENT_COUNT,
} content_id_t;
#define MSG_MAX 256
#define MSG_SIZE_FILL 4 // as large as fits the screen
typedef struct {
char text[MSG_MAX + 1];
uint8_t fg, bg; // RGB332
uint8_t size; // 0 small .. 3 huge, or MSG_SIZE_FILL
} message_t;
// Slot number for an image held in RAM only (not saved to flash)
#define SLOT_LIVE (-1)
// What the screen should show. Changed by the web server, read by the
// display task.
typedef struct {
content_id_t content;
int slot;
message_t msg;
} show_t;
const char *content_key(content_id_t c);
const char *content_name(content_id_t c);
int content_from_key(const char *key); // -1 if unknown
// Thread-safe; any task may call these
void app_get_show(show_t *out);
void app_show(content_id_t c, int slot);
void app_set_message(const message_t *m);
void app_refresh(void); // redraw the current content (e.g. network info changed)
// Image shown for SLOT_LIVE; take the lock while reading or writing it
extern uint8_t *live_image;
void live_image_lock(void);
void live_image_unlock(void);
// Network status for on-screen info (implemented in web.c)
typedef struct {
char ap_ssid[33], ap_pass[65], ap_ip[16];
char sta_ssid[33], sta_ip[16];
bool sta_connected;
} net_info_t;
void net_get_info(net_info_t *out);
// Image gallery in the "gallery" flash partition (implemented in gallery.c)
#define GALLERY_NAME_MAX 31
void gallery_init(void);
int gallery_slots(void);
bool gallery_name(int slot, char *name); // false if the slot is empty
bool gallery_read(int slot, uint8_t *dst); // W*H bytes
bool gallery_write(int slot, const char *name, const uint8_t *data);
bool gallery_delete(int slot);
void web_start(void);