]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - keyboards/infinity60/led_controller.h
several improvements for mitosis:datagrok (#1960)
[qmk_firmware.git] / keyboards / infinity60 / led_controller.h
index 75819ec4e03f06dae5ce32e8e2d90292016e79cc..e4b47176464e56e6ab7ac1674941bc44d7ed8f42 100644 (file)
@@ -1,5 +1,6 @@
 /*
 Copyright 2016 flabbergast <s3+flabbergast@sdfeu.org>
+Copyright 2017 jpetermans <tibcmhhm@gmail.com>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -32,8 +33,8 @@ msg_t is31_read_register(uint8_t page, uint8_t reg, uint8_t *result);
 
 void led_controller_init(void);
 
-#define CAPS_LOCK_LED_ADDRESS 0x46
-#define NUM_LOCK_LED_ADDRESS 0x85
+#define CAPS_LOCK_LED_ADDRESS 46 //pin matrix location
+#define NUM_LOCK_LED_ADDRESS 85
 
 /* =============================
  * IS31 chip related definitions
@@ -58,7 +59,7 @@ void led_controller_init(void);
 
 #define IS31_REG_DISPLAYOPT 0x05
 #define IS31_REG_DISPLAYOPT_INTENSITY_SAME 0x20 // same intensity for all frames
-#define IS31_REG_DISPLAYOPT_BLINK_ENABLE 0x8
+#define IS31_REG_DISPLAYOPT_BLINK_ENABLE 0x08
 // D2:D0 bits blink period time (*0.27s)
 
 #define IS31_REG_AUDIOSYNC 0x06
@@ -75,7 +76,8 @@ void led_controller_init(void);
 // D2:D0 extinguish time (3.5ms*2^i)
 
 #define IS31_REG_SHUTDOWN 0x0A
-#define IS31_REG_SHUTDOWN_ON 0x1
+#define IS31_REG_SHUTDOWN_OFF 0x1
+#define IS31_REG_SHUTDOWN_ON 0x0
 
 #define IS31_REG_AGCCTRL 0x0B
 #define IS31_REG_ADCRATE 0x0C
@@ -86,24 +88,33 @@ void led_controller_init(void);
 #define IS31_TIMEOUT 10000 // needs to be long enough to write a whole page
 
 /* ========================================
- * LED Thread related definitions/functions
+ * LED Thread related items
  * ========================================*/
 
 extern mailbox_t led_mailbox;
 
-void set_led_bit (uint8_t *led_control_reg, uint8_t led_msg, uint8_t toggle_on);
-void set_lock_leds (uint8_t *led_control_reg, uint8_t lock_status);
-void write_led_page (uint8_t page, const uint8_t *led_array, uint8_t led_count);
+void set_led_bit (uint8_t page, uint8_t *led_control_reg, uint8_t led_addr, uint8_t action);
+void set_lock_leds (uint8_t led_addr, uint8_t led_action, uint8_t page);
+void write_led_byte (uint8_t page, uint8_t row, uint8_t led_byte);
+void write_led_page (uint8_t page, uint8_t *led_array, uint8_t led_count);
 
 // constants for signaling the LED controller thread
 enum led_msg_t {
     KEY_LIGHT,
+    SET_FULL_ROW,
+    OFF_LED,
+    ON_LED,
     TOGGLE_LED,
+    BLINK_OFF_LED,
+    BLINK_ON_LED,
+    BLINK_TOGGLE_LED,
     TOGGLE_ALL,
     TOGGLE_BACKLIGHT,
-    TOGGLE_LAYER_LEDS,
-    TOGGLE_LOCK_LED,
-    MODE_BREATH,
+    DISPLAY_PAGE,
+    RESET_PAGE,
+    TOGGLE_NUM_LOCK,
+    TOGGLE_CAPS_LOCK,
+    TOGGLE_BREATH,
     STEP_BRIGHTNESS
 };