summaryrefslogtreecommitdiff
path: root/src/driver.h
blob: f2e9f0526e76ffe0be0f63830befe81aeea608cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <cstdint>

#define DISPLAY_WIDTH 320
#define DISPLAY_HEIGHT 240

void display_setup(void);
void display_on(void);
void display_off(void);
void display_begin(void); // call before drawing
void display_end(void); // flushes to screen
void display_clear(uint16_t color);
void display_set_pixel(int32_t x, int32_t y, uint16_t color);

void button_setup(void);
bool button_get(void); // true if currently pressed


typedef struct {
    const char *uri;
    const char *method;
    const char *body; // nullable
} WifiRequest;

typedef struct {
    int status;
    const char *content_type;
    const char *body;
} WifiResponse;

typedef WifiResponse (*WifiHandler)(const WifiRequest *req);

void wifi_setup(void);
void wifi_hotspot_start(const char *ssid, const char *password, WifiHandler handler);
void wifi_hotspot_stop(void);
void wifi_tick(void); // call in loop() while hotspot is active