|
|
@ -302,45 +302,38 @@ void matrix_init_user(void)
|
|
|
|
void led_set_user(uint8_t usb_led)
|
|
|
|
void led_set_user(uint8_t usb_led)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
static uint8_t old_usb_led = 0;
|
|
|
|
static uint8_t old_usb_led = 0;
|
|
|
|
static bool first_run = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Skip first execution to avoid beeps caused by LED states being detected on power-up
|
|
|
|
if ((usb_led & (1<<USB_LED_CAPS_LOCK)) && !(old_usb_led & (1<<USB_LED_CAPS_LOCK)))
|
|
|
|
if (!first_run)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
// If CAPS LK LED is turning on...
|
|
|
|
if ((usb_led & (1<<USB_LED_CAPS_LOCK)) && !(old_usb_led & (1<<USB_LED_CAPS_LOCK)))
|
|
|
|
PLAY_NOTE_ARRAY(tone_caps_on, false, LEGATO);
|
|
|
|
{
|
|
|
|
}
|
|
|
|
// If CAPS LK LED is turning on...
|
|
|
|
else if (!(usb_led & (1<<USB_LED_CAPS_LOCK)) && (old_usb_led & (1<<USB_LED_CAPS_LOCK)))
|
|
|
|
PLAY_NOTE_ARRAY(tone_caps_on, false, LEGATO);
|
|
|
|
{
|
|
|
|
}
|
|
|
|
// If CAPS LK LED is turning off...
|
|
|
|
else if (!(usb_led & (1<<USB_LED_CAPS_LOCK)) && (old_usb_led & (1<<USB_LED_CAPS_LOCK)))
|
|
|
|
PLAY_NOTE_ARRAY(tone_caps_off, false, LEGATO);
|
|
|
|
{
|
|
|
|
}
|
|
|
|
// If CAPS LK LED is turning off...
|
|
|
|
else if ((usb_led & (1<<USB_LED_NUM_LOCK)) && !(old_usb_led & (1<<USB_LED_NUM_LOCK)))
|
|
|
|
PLAY_NOTE_ARRAY(tone_caps_off, false, LEGATO);
|
|
|
|
{
|
|
|
|
}
|
|
|
|
// If NUM LK LED is turning on...
|
|
|
|
else if ((usb_led & (1<<USB_LED_NUM_LOCK)) && !(old_usb_led & (1<<USB_LED_NUM_LOCK)))
|
|
|
|
PLAY_NOTE_ARRAY(tone_numlk_on, false, LEGATO);
|
|
|
|
{
|
|
|
|
}
|
|
|
|
// If NUM LK LED is turning on...
|
|
|
|
else if (!(usb_led & (1<<USB_LED_NUM_LOCK)) && (old_usb_led & (1<<USB_LED_NUM_LOCK)))
|
|
|
|
PLAY_NOTE_ARRAY(tone_numlk_on, false, LEGATO);
|
|
|
|
{
|
|
|
|
}
|
|
|
|
// If NUM LED is turning off...
|
|
|
|
else if (!(usb_led & (1<<USB_LED_NUM_LOCK)) && (old_usb_led & (1<<USB_LED_NUM_LOCK)))
|
|
|
|
PLAY_NOTE_ARRAY(tone_numlk_off, false, LEGATO);
|
|
|
|
{
|
|
|
|
}
|
|
|
|
// If NUM LED is turning off...
|
|
|
|
else if ((usb_led & (1<<USB_LED_SCROLL_LOCK)) && !(old_usb_led & (1<<USB_LED_SCROLL_LOCK)))
|
|
|
|
PLAY_NOTE_ARRAY(tone_numlk_off, false, LEGATO);
|
|
|
|
{
|
|
|
|
}
|
|
|
|
// If SCROLL LK LED is turning on...
|
|
|
|
else if ((usb_led & (1<<USB_LED_SCROLL_LOCK)) && !(old_usb_led & (1<<USB_LED_SCROLL_LOCK)))
|
|
|
|
PLAY_NOTE_ARRAY(tone_scroll_on, false, LEGATO);
|
|
|
|
{
|
|
|
|
}
|
|
|
|
// If SCROLL LK LED is turning on...
|
|
|
|
else if (!(usb_led & (1<<USB_LED_SCROLL_LOCK)) && (old_usb_led & (1<<USB_LED_SCROLL_LOCK)))
|
|
|
|
PLAY_NOTE_ARRAY(tone_scroll_on, false, LEGATO);
|
|
|
|
{
|
|
|
|
}
|
|
|
|
// If SCROLL LED is turning off...
|
|
|
|
else if (!(usb_led & (1<<USB_LED_SCROLL_LOCK)) && (old_usb_led & (1<<USB_LED_SCROLL_LOCK)))
|
|
|
|
PLAY_NOTE_ARRAY(tone_scroll_off, false, LEGATO);
|
|
|
|
{
|
|
|
|
}
|
|
|
|
// If SCROLL LED is turning off...
|
|
|
|
|
|
|
|
PLAY_NOTE_ARRAY(tone_scroll_off, false, LEGATO);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
old_usb_led = usb_led;
|
|
|
|
old_usb_led = usb_led;
|
|
|
|
first_run = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|