1 #include "promethium.h"
5 #include "musical_notes.h"
7 float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_A4, 0.0625);
8 float fauxclicky_released_note[2] = MUSICAL_NOTE(_A4, 0.0625);
9 float fauxclicky_beep_note[2] = MUSICAL_NOTE(_C6, 0.25);
11 // cubic fit {3.3, 0}, {3.5, 2.9}, {3.6, 5}, {3.7, 8.6}, {3.8, 36}, {3.9, 62}, {4.0, 73}, {4.05, 83}, {4.1, 89}, {4.15, 94}, {4.2, 100}
13 uint8_t battery_level(void) {
14 float voltage = analogRead(BATTERY_PIN) * 2 * 3.3 / 1024;
15 if (voltage < MIN_VOLTAGE) return 0;
16 if (voltage > MAX_VOLTAGE) return 255;
17 return (voltage - MIN_VOLTAGE) / (MAX_VOLTAGE - MIN_VOLTAGE) * 255;
20 __attribute__ ((weak))
21 void battery_poll(uint8_t level) {
24 void matrix_init_kb(void) {
28 void matrix_scan_kb(void) {
29 static uint16_t counter = BATTERY_POLL;
32 if (counter > BATTERY_POLL) {
34 battery_poll(battery_level());
40 void led_set_kb(uint8_t usb_led) {
41 led_set_user(usb_led);
44 __attribute__ ((weak))
45 void led_set_user(uint8_t usb_led) {