planck.c
724 bytes
1#include "quantum.h"
2
3__attribute__ ((weak))
4void matrix_init_kb(void) {
5 // Turn status LED on, with the exception of THK
6 #if defined(__AVR_ATmega32U4__)
7 gpio_set_pin_output(E6);
8 gpio_write_pin_high(E6);
9 #endif
10
11 matrix_init_user();
12}
13
14#ifdef ENCODER_ENABLE
15bool encoder_update_kb(uint8_t index, bool clockwise) {
16 if (!encoder_update_user(index, clockwise)) { return false; }
17 if (get_highest_layer(layer_state) > 0) {
18 if (clockwise) {
19 tap_code_delay(KC_VOLU, 10);
20 } else {
21 tap_code_delay(KC_VOLD, 10);
22 }
23 } else {
24 if (clockwise) {
25 tap_code(KC_PGDN);
26 } else {
27 tap_code(KC_PGUP);
28 }
29 }
30 return true;
31}
32#endif