-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathesp32-pokit.ino
61 lines (48 loc) · 1.28 KB
/
esp32-pokit.ino
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include <M5StickCPlus.h>
#include "shared.h"
#include "ble_data.h"
#include "display.h"
#include "ble_com.h"
// #include <WiFi.h>
#include "esp_pm.h"
#include "driver/adc.h"
uint8_t current_brightness = 7;
void setup() {
Serial.begin(115200);
Serial.setTimeout(10);
// //Config DFS
// esp_pm_config_esp32_t pm_config;
// pm_config.max_freq_mhz = 80;
// pm_config.min_freq_mhz = 10; //RTC_CPU_FREQ_XTAL,;
// pm_config.light_sleep_enable = false;
// ESP_ERROR_CHECK(esp_pm_configure(&pm_config));
adc_power_off();
// // WiFi.mode(WIFI_OFF);
M5.begin();
M5.Axp.ScreenBreath(current_brightness);
display_init();
init_pokit();
}
void loop() {
M5.update();
if (M5.BtnA.wasPressed()) {
pokit_settings_t new_settings = get_pokit_current_settings();
new_settings.mode += 1;
new_settings.mode = new_settings.mode >= 9 ? 1 : new_settings.mode;
mutex_lock(pokit_settings_mutex);
pokit_current_settings = new_settings;
mutex_unlock(pokit_settings_mutex);
update_pokit_settings();
}
if (M5.BtnB.wasPressed()) {
current_brightness++;
current_brightness >= 15 && (current_brightness = 7);
M5.Axp.ScreenBreath(current_brightness);
}
draw();
if (Serial.available()) {
Serial.readString();
ESP.restart();
}
delay(100);
}