diff options
author | Priyadi Iman Nurcahyo <priyadi@priyadi.net> | 2017-01-17 01:39:29 +0700 |
---|---|---|
committer | Priyadi Iman Nurcahyo <priyadi@priyadi.net> | 2017-01-17 01:39:29 +0700 |
commit | 11eb3d5491bc5d0d2e64d7b37282bc2304ea3247 (patch) | |
tree | c1ecd3ae463639a77fceee12d01aa6de39a47707 /keyboards/kinesis/alvicstep/alvicstep.c | |
parent | 87b675241a1cf535feaa7ae3454cab13bb6dba1e (diff) | |
parent | 6f448856151572f5bee329e68842cdda867fa66b (diff) |
Merge branch 'master' into promethium
Diffstat (limited to 'keyboards/kinesis/alvicstep/alvicstep.c')
-rw-r--r-- | keyboards/kinesis/alvicstep/alvicstep.c | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/keyboards/kinesis/alvicstep/alvicstep.c b/keyboards/kinesis/alvicstep/alvicstep.c new file mode 100644 index 0000000000..fba9f5136f --- /dev/null +++ b/keyboards/kinesis/alvicstep/alvicstep.c @@ -0,0 +1,105 @@ +#include "kinesis.h" + +// begin section origin https://github.com/alvicstep/tmk_keyboard + +void all_led_off(void) +{ + PORTD = 0b11111111; +} + +void all_led_on(void) +{ + PORTD = 0b00000000; +} +void num_lock_led_on(void) +{ + PORTD = 0b11101111; +} + +void caps_lock_led_on(void) +{ + PORTD = 0b01111111; +} + +void scroll_lock_led_on(void) +{ + PORTD = 0b11011111; +} +void keypad_led_on(void) +{ + PORTD = 0b10111111; +} +void blink_all_leds(void) +{ + all_led_on(); + _delay_ms(500); + + all_led_off(); + _delay_ms(100); + + caps_lock_led_on(); + _delay_ms(100); + + num_lock_led_on(); + _delay_ms(100); + + scroll_lock_led_on(); + _delay_ms(100); + + keypad_led_on(); + _delay_ms(100); + + //back + + scroll_lock_led_on(); + _delay_ms(100); + + num_lock_led_on(); + _delay_ms(100); + + caps_lock_led_on(); + _delay_ms(100); + + all_led_off(); +} + +// End section origin https://github.com/alvicstep/tmk_keyboard + + void matrix_init_kb(void) { + blink_all_leds(); + matrix_init_user(); +} + + +void matrix_scan_kb(void) { + // put your looping keyboard code here + // runs every cycle (a lot) + + matrix_scan_user(); +} + +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + // put your per-action keyboard code here + // runs for every action, just before processing by the firmware + + return process_record_user(keycode, record); +} + +void led_set_kb(uint8_t usb_led) { + // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here + +//Copyright 2014 Warren Janssens <warren.janssens@gmail.com> + uint8_t leds = 0xF0; + if (usb_led & 1 << USB_LED_NUM_LOCK) + leds &= ~0x10; + if (usb_led & 1 << USB_LED_CAPS_LOCK) + leds &= ~0x80; + if (usb_led & 1 << USB_LED_SCROLL_LOCK) + leds &= ~0x20; + PORTD = (PORTD & 0x0F) | leds; + + led_set_user(usb_led); + +} + + |