diff options
author | Drashna Jaelre <drashna@live.com> | 2019-04-09 08:58:11 -0700 |
---|---|---|
committer | Drashna Jaelre <drashna@live.com> | 2019-04-09 08:58:11 -0700 |
commit | b6850bc043b1d129042f47501f0a1dc1e196f962 (patch) | |
tree | a0a772f278c3c494db3bc69103955af5561e1cae /keyboards/cannonkeys/stm32f072/keyboard.c | |
parent | 19ed62114a1f5d20aacb9cbe83105e977b9a2971 (diff) |
remove all keyboards but ergodox and planck
Diffstat (limited to 'keyboards/cannonkeys/stm32f072/keyboard.c')
-rw-r--r-- | keyboards/cannonkeys/stm32f072/keyboard.c | 120 |
1 files changed, 0 insertions, 120 deletions
diff --git a/keyboards/cannonkeys/stm32f072/keyboard.c b/keyboards/cannonkeys/stm32f072/keyboard.c deleted file mode 100644 index 4316d51867..0000000000 --- a/keyboards/cannonkeys/stm32f072/keyboard.c +++ /dev/null @@ -1,120 +0,0 @@ -#include "keyboard.h" -#include "ch.h" -#include "hal.h" -#include "led_custom.h" -#include "util.h" -#include "quantum.h" - -#include "tmk_core/common/eeprom.h" - -#include "ws2812.h" - -backlight_config_t kb_backlight_config = { - .enable = true, - .breathing = true, - .level = BACKLIGHT_LEVELS -}; - - -bool eeprom_is_valid(void) -{ - return (eeprom_read_word(((void*)EEPROM_MAGIC_ADDR)) == EEPROM_MAGIC && - eeprom_read_byte(((void*)EEPROM_VERSION_ADDR)) == EEPROM_VERSION); -} - -void eeprom_set_valid(bool valid) -{ - eeprom_update_word(((void*)EEPROM_MAGIC_ADDR), valid ? EEPROM_MAGIC : 0xFFFF); - eeprom_update_byte(((void*)EEPROM_VERSION_ADDR), valid ? EEPROM_VERSION : 0xFF); -} - -void eeprom_reset(void) -{ - eeprom_set_valid(false); - eeconfig_disable(); -} - -void save_backlight_config_to_eeprom(){ - eeprom_update_byte((uint8_t*)EEPROM_CUSTOM_BACKLIGHT, kb_backlight_config.raw); -} - -void load_custom_config(){ - kb_backlight_config.raw = eeprom_read_byte((uint8_t*)EEPROM_CUSTOM_BACKLIGHT); -} - -void eeprom_init_kb(void) -{ - // If the EEPROM has the magic, the data is good. - // OK to load from EEPROM. - if (eeprom_is_valid()) { - load_custom_config(); - } else { - // Save the magic number last, in case saving was interrupted - eeprom_set_valid(true); - } -} - -void matrix_init_kb(void){ - eeprom_init_kb(); - /* MOSI pin*/ - palSetPadMode(PORT_WS2812, PIN_WS2812, PAL_MODE_ALTERNATE(0)); - wait_ms(500); - -#ifdef RGBLIGHT_ENABLE - leds_init(); -#endif - backlight_init_ports(); -} - -void matrix_scan_kb(void) -{ - #ifdef RGBLIGHT_ENABLE - rgblight_task(); - #endif -} - -bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case BL_INC: - if (record->event.pressed) { - kb_backlight_config.level = kb_backlight_config.level + 1; - if(kb_backlight_config.level > BACKLIGHT_LEVELS){ - kb_backlight_config.level = BACKLIGHT_LEVELS; - } - backlight_set(kb_backlight_config.level); - save_backlight_config_to_eeprom(); - } - return false; - case BL_TOGG: - if (record->event.pressed) { - kb_backlight_config.enable = !kb_backlight_config.enable; - if(kb_backlight_config.enable){ - backlight_set(kb_backlight_config.level); - } else { - backlight_set(0); - } - save_backlight_config_to_eeprom(); - } - return false; - - case BL_DEC: - if (record->event.pressed) { - if(kb_backlight_config.level <= 1){ - kb_backlight_config.level = 0; - } else { - kb_backlight_config.level = kb_backlight_config.level - 1; - } - backlight_set(kb_backlight_config.level); - save_backlight_config_to_eeprom(); - } - return false; - case BL_BRTG: - if (record->event.pressed) { - kb_backlight_config.breathing = !kb_backlight_config.breathing; - breathing_toggle(); - save_backlight_config_to_eeprom(); - } - return false; - } - return true; -} |