You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.1 KiB
67 lines
1.1 KiB
#include "rpcWiFi.h" |
|
|
|
#define DEBUG (false) |
|
|
|
const char *WIFI_SSID = "TortugaNoT"; |
|
const char *WIFI_PASS = "april302021"; |
|
const char *OWNTONE_SERVER_ADDRESS = "http://192.168.1.2:3689"; |
|
|
|
typedef struct AppState { |
|
unsigned long sinceBoot; |
|
|
|
bool wifiOnline; |
|
IPAddress wifiIP; |
|
|
|
int volume; // out of 100; |
|
} AppState; |
|
|
|
AppState AppStateMake(void) { |
|
AppState out; |
|
out.sinceBoot = 0; |
|
out.wifiOnline = false; |
|
out.wifiIP = IPAddress(); |
|
out.volume = 0; |
|
return out; |
|
} |
|
|
|
AppState state; |
|
|
|
void debug() { |
|
wifiDebug(&state); |
|
uiDebug(&state); |
|
apiDebug(&state); |
|
} |
|
|
|
void handleInput() { |
|
|
|
} |
|
|
|
void setup() { |
|
state = AppStateMake(); |
|
|
|
uiSetup(&state); |
|
wifiJoin(&state); |
|
apiSetup(&state); |
|
|
|
// prepare buttons |
|
pinMode(WIO_KEY_A, INPUT_PULLUP); |
|
pinMode(WIO_KEY_B, INPUT_PULLUP); |
|
pinMode(WIO_KEY_C, INPUT_PULLUP); |
|
pinMode(WIO_5S_UP, INPUT_PULLUP); |
|
pinMode(WIO_5S_DOWN, INPUT_PULLUP); |
|
pinMode(WIO_5S_LEFT, INPUT_PULLUP); |
|
pinMode(WIO_5S_RIGHT, INPUT_PULLUP); |
|
pinMode(WIO_5S_PRESS, INPUT_PULLUP); |
|
} |
|
|
|
void loop() { |
|
if (DEBUG) { |
|
debug(); |
|
} |
|
|
|
state.sinceBoot = millis(); |
|
|
|
uiLoop(&state); |
|
wifiLoop(&state); |
|
apiLoop(&state); |
|
}
|
|
|