summaryrefslogtreecommitdiffstats
path: root/keyboards/kinesis/alvicstep/alvicstep.c
blob: 735032d6a426615f765311d5c6ec5862a25f518a (plain)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#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 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);

}