Any way to set it up so that any key press will briefly turn on one or both LEDs? Just a fun thought I had.
Try this patch, you can add it to your keymap file. It turns on Leds for 100ms when any key is pressed. Also compiled hex file are attached just for a try.
diff --git a/keyboard/fc660c/unimap.c b/keyboard/fc660c/unimap.c
index 77c3350..9dbd04c 100644
--- a/keyboard/fc660c/unimap.c
+++ b/keyboard/fc660c/unimap.c
@@ -17,3 +17,21 @@ const action_t actionmaps[][UNIMAP_ROWS][UNIMAP_COLS] PROGMEM = {
LCTL,LGUI,LALT, SPC, RALT,RCTL,GRV, LEFT,DOWN,RGHT
),
};
+
+
+#define LED_ON() PORTB &= ~(1<<5 | 1<<6)
+#define LED_OFF() PORTB |= (1<<5 | 1<<6)
+#define LED_DURATION 100
+static uint16_t last_ms = 0;
+void hook_matrix_change(keyevent_t event) {
+ if (event.pressed) {
+ LED_ON();
+ last_ms = timer_read();
+ }
+}
+
+void hook_keyboard_loop(void) {
+ if (TIMER_DIFF_16(last_ms, timer_read()) > LED_DURATION) {
+ LED_OFF();
+ }
+}
EDIT: Fixed message quote.
Hi Hasu,
I wanted to do the same for the insert LED to blink per keystroke. I tried your hex file, it works. However when i added the code from you quote my led do nothing.
This is the code i added at the end of my file.
----------------------------------------------------------------------
#define LED_ON() PORTB &= ~(1<<5 | 1<<6)
#define LED_OFF() PORTB |= (1<<5 | 1<<6)
#define LED_DURATION 100
static uint16_t last_ms = 0;
void hook_matrix_change(keyevent_t event) {
if (event.pressed) {
LED_ON();
last_ms = timer_read();
}
}
void hook_keyboard_loop(void) {
if (TIMER_DIFF_16(last_ms, timer_read()) > LED_DURATION) {
LED_OFF();
}
}
--------------------------------------------------------------------------------------
I didnt add the upper portion of the code from your quote because it gives errors whenever I compiled. And i guess they are not necessary?
Thanks in advanced.