From b73c935d3652df58fc573c83986424ab47a2ba14 Mon Sep 17 00:00:00 2001 From: jpetermans Date: Thu, 6 Apr 2017 13:45:15 -0700 Subject: Added tmk whitefox led files --- keyboards/infinity60/led_controller.h | 93 +++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 keyboards/infinity60/led_controller.h (limited to 'keyboards/infinity60/led_controller.h') diff --git a/keyboards/infinity60/led_controller.h b/keyboards/infinity60/led_controller.h new file mode 100644 index 0000000000..dcf346e043 --- /dev/null +++ b/keyboards/infinity60/led_controller.h @@ -0,0 +1,93 @@ +/* +Copyright 2016 flabbergast + +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 +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#ifndef _LED_CONTROLLER_H_ +#define _LED_CONTROLLER_H_ + +/* ========================= + * communication functions + * ========================= */ + +msg_t is31_write_data(uint8_t page, uint8_t *buffer, uint8_t size); +msg_t is31_write_register(uint8_t page, uint8_t reg, uint8_t data); +msg_t is31_read_register(uint8_t page, uint8_t reg, uint8_t *result); + +/* ============================= + * IS31 chip related definitions + * ============================= */ + +#define IS31_ADDR_DEFAULT 0x74 + +#define IS31_REG_CONFIG 0x00 +// bits in reg +#define IS31_REG_CONFIG_PICTUREMODE 0x00 +#define IS31_REG_CONFIG_AUTOPLAYMODE 0x08 +#define IS31_REG_CONFIG_AUDIOPLAYMODE 0x18 +// D2:D0 bits are starting frame for autoplay mode + +#define IS31_REG_PICTDISP 0x01 // D2:D0 frame select for picture mode + +#define IS31_REG_AUTOPLAYCTRL1 0x02 +// D6:D4 number of loops (000=infty) +// D2:D0 number of frames to be used + +#define IS31_REG_AUTOPLAYCTRL2 0x03 // D5:D0 delay time (*11ms) + +#define IS31_REG_DISPLAYOPT 0x05 +#define IS31_REG_DISPLAYOPT_INTENSITY_SAME 0x20 // same intensity for all frames +#define IS31_REG_DISPLAYOPT_BLINK_ENABLE 0x8 +// D2:D0 bits blink period time (*0.27s) + +#define IS31_REG_AUDIOSYNC 0x06 +#define IS31_REG_AUDIOSYNC_ENABLE 0x1 + +#define IS31_REG_FRAMESTATE 0x07 + +#define IS31_REG_BREATHCTRL1 0x08 +// D6:D4 fade out time (26ms*2^i) +// D2:D0 fade in time (26ms*2^i) + +#define IS31_REG_BREATHCTRL2 0x09 +#define IS31_REG_BREATHCTRL2_ENABLE 0x10 +// D2:D0 extinguish time (3.5ms*2^i) + +#define IS31_REG_SHUTDOWN 0x0A +#define IS31_REG_SHUTDOWN_ON 0x1 + +#define IS31_REG_AGCCTRL 0x0B +#define IS31_REG_ADCRATE 0x0C + +#define IS31_COMMANDREGISTER 0xFD +#define IS31_FUNCTIONREG 0x0B // helpfully called 'page nine' + +#define IS31_TIMEOUT 10000 // needs to be long enough to write a whole page + +/* ============================== + * LED Thread related definitions + * ============================== */ + +extern mailbox_t led_mailbox; + +// constants for signaling the LED controller thread +#define LED_MSG_CAPS_ON 1 +#define LED_MSG_CAPS_OFF 2 +#define LED_MSG_SLEEP_LED_ON 3 +#define LED_MSG_SLEEP_LED_OFF 4 +#define LED_MSG_ALL_TOGGLE 5 +#define LED_MSG_GAME_TOGGLE 6 + +#endif /* _LED_CONTROLLER_H_ */ -- cgit v1.2.3 From f66361d678047af31d9d48ca6c22afcc48756882 Mon Sep 17 00:00:00 2001 From: jpetermans Date: Thu, 6 Apr 2017 13:48:31 -0700 Subject: add led init function to header for use in keymap.c --- keyboards/infinity60/led_controller.h | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'keyboards/infinity60/led_controller.h') diff --git a/keyboards/infinity60/led_controller.h b/keyboards/infinity60/led_controller.h index dcf346e043..7db02389f8 100644 --- a/keyboards/infinity60/led_controller.h +++ b/keyboards/infinity60/led_controller.h @@ -26,6 +26,12 @@ msg_t is31_write_data(uint8_t page, uint8_t *buffer, uint8_t size); msg_t is31_write_register(uint8_t page, uint8_t reg, uint8_t data); msg_t is31_read_register(uint8_t page, uint8_t reg, uint8_t *result); +/* ========================= + * init functions + * ========================= */ + +void led_controller_init(void); + /* ============================= * IS31 chip related definitions * ============================= */ @@ -83,11 +89,13 @@ msg_t is31_read_register(uint8_t page, uint8_t reg, uint8_t *result); extern mailbox_t led_mailbox; // constants for signaling the LED controller thread -#define LED_MSG_CAPS_ON 1 -#define LED_MSG_CAPS_OFF 2 -#define LED_MSG_SLEEP_LED_ON 3 -#define LED_MSG_SLEEP_LED_OFF 4 -#define LED_MSG_ALL_TOGGLE 5 -#define LED_MSG_GAME_TOGGLE 6 +enum led_msg_t { + LED_MSG_CAPS_ON, + LED_MSG_CAPS_OFF, + LED_MSG_SLEEP_LED_ON, + LED_MSG_SLEEP_LED_OFF, + LED_MSG_ALL_TOGGLE, + LED_MSG_GAME_TOGGLE +}; #endif /* _LED_CONTROLLER_H_ */ -- cgit v1.2.3 From dda858c437e2fd0336f070ccb5d1f6e412815d9a Mon Sep 17 00:00:00 2001 From: jpetermans Date: Mon, 10 Apr 2017 17:36:47 -0700 Subject: revised led controller code to allow for more options unable to switch picture displays --- keyboards/infinity60/led_controller.h | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'keyboards/infinity60/led_controller.h') diff --git a/keyboards/infinity60/led_controller.h b/keyboards/infinity60/led_controller.h index 7db02389f8..75819ec4e0 100644 --- a/keyboards/infinity60/led_controller.h +++ b/keyboards/infinity60/led_controller.h @@ -26,12 +26,15 @@ msg_t is31_write_data(uint8_t page, uint8_t *buffer, uint8_t size); msg_t is31_write_register(uint8_t page, uint8_t reg, uint8_t data); msg_t is31_read_register(uint8_t page, uint8_t reg, uint8_t *result); -/* ========================= - * init functions - * ========================= */ +/* ============================ + * init functions/definitions + * ============================*/ void led_controller_init(void); +#define CAPS_LOCK_LED_ADDRESS 0x46 +#define NUM_LOCK_LED_ADDRESS 0x85 + /* ============================= * IS31 chip related definitions * ============================= */ @@ -82,20 +85,26 @@ void led_controller_init(void); #define IS31_TIMEOUT 10000 // needs to be long enough to write a whole page -/* ============================== - * LED Thread related definitions - * ============================== */ +/* ======================================== + * LED Thread related definitions/functions + * ========================================*/ 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); + // constants for signaling the LED controller thread enum led_msg_t { - LED_MSG_CAPS_ON, - LED_MSG_CAPS_OFF, - LED_MSG_SLEEP_LED_ON, - LED_MSG_SLEEP_LED_OFF, - LED_MSG_ALL_TOGGLE, - LED_MSG_GAME_TOGGLE + KEY_LIGHT, + TOGGLE_LED, + TOGGLE_ALL, + TOGGLE_BACKLIGHT, + TOGGLE_LAYER_LEDS, + TOGGLE_LOCK_LED, + MODE_BREATH, + STEP_BRIGHTNESS }; #endif /* _LED_CONTROLLER_H_ */ -- cgit v1.2.3 From 0881f2dbfa6887347afad577def01c246050df61 Mon Sep 17 00:00:00 2001 From: jpetermans Date: Tue, 11 Apr 2017 23:33:48 -0700 Subject: fixed write_led_page col shift, added option for lock led display --- keyboards/infinity60/led_controller.h | 1 + 1 file changed, 1 insertion(+) (limited to 'keyboards/infinity60/led_controller.h') diff --git a/keyboards/infinity60/led_controller.h b/keyboards/infinity60/led_controller.h index 75819ec4e0..e9d897303b 100644 --- a/keyboards/infinity60/led_controller.h +++ b/keyboards/infinity60/led_controller.h @@ -34,6 +34,7 @@ void led_controller_init(void); #define CAPS_LOCK_LED_ADDRESS 0x46 #define NUM_LOCK_LED_ADDRESS 0x85 +#define BACKLIGHT_OFF_LOCK_LED_OFF 1 //set to 0 to show lock leds even if backlight off /* ============================= * IS31 chip related definitions -- cgit v1.2.3 From 15635817b5ae6068c5c79a9b67a0d97839893a7e Mon Sep 17 00:00:00 2001 From: jpetermans Date: Wed, 12 Apr 2017 23:32:38 -0700 Subject: Updated lock led init --- keyboards/infinity60/led_controller.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'keyboards/infinity60/led_controller.h') diff --git a/keyboards/infinity60/led_controller.h b/keyboards/infinity60/led_controller.h index e9d897303b..7408620182 100644 --- a/keyboards/infinity60/led_controller.h +++ b/keyboards/infinity60/led_controller.h @@ -32,9 +32,9 @@ 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 BACKLIGHT_OFF_LOCK_LED_OFF 1 //set to 0 to show lock leds even if backlight off +#define CAPS_LOCK_LED_ADDRESS 46 +#define NUM_LOCK_LED_ADDRESS 85 +#define BACKLIGHT_OFF_LOCK_LED_OFF 0 //set to 0 to show lock leds even if backlight off /* ============================= * IS31 chip related definitions @@ -93,7 +93,7 @@ void led_controller_init(void); 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 set_lock_leds (uint8_t lock_type, uint8_t lock_status); void write_led_page (uint8_t page, const uint8_t *led_array, uint8_t led_count); // constants for signaling the LED controller thread @@ -103,7 +103,8 @@ enum led_msg_t { TOGGLE_ALL, TOGGLE_BACKLIGHT, TOGGLE_LAYER_LEDS, - TOGGLE_LOCK_LED, + TOGGLE_NUM_LOCK, + TOGGLE_CAPS_LOCK, MODE_BREATH, STEP_BRIGHTNESS }; -- cgit v1.2.3 From 1b1adf35bb746a875c2b846e1b1b405075c94847 Mon Sep 17 00:00:00 2001 From: jpetermans Date: Thu, 13 Apr 2017 17:15:24 -0700 Subject: more flexible led processing functions, all and on/off/toggle functioning --- keyboards/infinity60/led_controller.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'keyboards/infinity60/led_controller.h') diff --git a/keyboards/infinity60/led_controller.h b/keyboards/infinity60/led_controller.h index 7408620182..0f2d62d3da 100644 --- a/keyboards/infinity60/led_controller.h +++ b/keyboards/infinity60/led_controller.h @@ -32,7 +32,7 @@ msg_t is31_read_register(uint8_t page, uint8_t reg, uint8_t *result); void led_controller_init(void); -#define CAPS_LOCK_LED_ADDRESS 46 +#define CAPS_LOCK_LED_ADDRESS 46 //pin matrix location #define NUM_LOCK_LED_ADDRESS 85 #define BACKLIGHT_OFF_LOCK_LED_OFF 0 //set to 0 to show lock leds even if backlight off @@ -87,18 +87,20 @@ 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 functions/definitions * ========================================*/ 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 lock_type, uint8_t lock_status); +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 lock_type, uint8_t led_on); void write_led_page (uint8_t page, const uint8_t *led_array, uint8_t led_count); // constants for signaling the LED controller thread enum led_msg_t { KEY_LIGHT, + OFF_LED, + ON_LED, TOGGLE_LED, TOGGLE_ALL, TOGGLE_BACKLIGHT, -- cgit v1.2.3 From c0ec1756afda7a49848faff23781bf54cd9fa3c3 Mon Sep 17 00:00:00 2001 From: jpetermans Date: Fri, 14 Apr 2017 18:20:12 -0700 Subject: Added backlight step functionality --- keyboards/infinity60/led_controller.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'keyboards/infinity60/led_controller.h') diff --git a/keyboards/infinity60/led_controller.h b/keyboards/infinity60/led_controller.h index 0f2d62d3da..1511004714 100644 --- a/keyboards/infinity60/led_controller.h +++ b/keyboards/infinity60/led_controller.h @@ -104,7 +104,7 @@ enum led_msg_t { TOGGLE_LED, TOGGLE_ALL, TOGGLE_BACKLIGHT, - TOGGLE_LAYER_LEDS, + TOGGLE_PAGE_LEDS, TOGGLE_NUM_LOCK, TOGGLE_CAPS_LOCK, MODE_BREATH, -- cgit v1.2.3 From b3945c103cfa4c8f30a656d626dba75ad7f0af85 Mon Sep 17 00:00:00 2001 From: jpetermans Date: Wed, 26 Apr 2017 23:12:25 -0700 Subject: Simplified processing in led_controller; more control at user level. --- keyboards/infinity60/led_controller.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'keyboards/infinity60/led_controller.h') diff --git a/keyboards/infinity60/led_controller.h b/keyboards/infinity60/led_controller.h index 1511004714..b06113b077 100644 --- a/keyboards/infinity60/led_controller.h +++ b/keyboards/infinity60/led_controller.h @@ -94,7 +94,7 @@ extern mailbox_t led_mailbox; 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 lock_type, uint8_t led_on); -void write_led_page (uint8_t page, const uint8_t *led_array, uint8_t led_count); +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 { @@ -104,7 +104,8 @@ enum led_msg_t { TOGGLE_LED, TOGGLE_ALL, TOGGLE_BACKLIGHT, - TOGGLE_PAGE_LEDS, + DISPLAY_PAGE, + RESET_PAGE, TOGGLE_NUM_LOCK, TOGGLE_CAPS_LOCK, MODE_BREATH, -- cgit v1.2.3 From b27fb216efaa095d19b0175b9f64f96ff5e3544a Mon Sep 17 00:00:00 2001 From: jpetermans Date: Sun, 30 Apr 2017 16:27:46 -0700 Subject: Testing initial blink support --- keyboards/infinity60/led_controller.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'keyboards/infinity60/led_controller.h') diff --git a/keyboards/infinity60/led_controller.h b/keyboards/infinity60/led_controller.h index b06113b077..455f060500 100644 --- a/keyboards/infinity60/led_controller.h +++ b/keyboards/infinity60/led_controller.h @@ -34,7 +34,6 @@ void led_controller_init(void); #define CAPS_LOCK_LED_ADDRESS 46 //pin matrix location #define NUM_LOCK_LED_ADDRESS 85 -#define BACKLIGHT_OFF_LOCK_LED_OFF 0 //set to 0 to show lock leds even if backlight off /* ============================= * IS31 chip related definitions @@ -93,12 +92,16 @@ void led_controller_init(void); extern mailbox_t led_mailbox; 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 lock_type, uint8_t led_on); +void set_lock_leds (uint8_t led_addr, uint8_t led_action); +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, + BLINK_OFF_LED, + BLINK_ON_LED, + BLINK_TOGGLE_LED, OFF_LED, ON_LED, TOGGLE_LED, -- cgit v1.2.3 From 52f671c23eaeff9547e2a02154f0a056278b113c Mon Sep 17 00:00:00 2001 From: jpetermans Date: Mon, 8 May 2017 11:57:40 -0700 Subject: small code cleanup --- keyboards/infinity60/led_controller.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'keyboards/infinity60/led_controller.h') diff --git a/keyboards/infinity60/led_controller.h b/keyboards/infinity60/led_controller.h index 455f060500..7bdef7ae63 100644 --- a/keyboards/infinity60/led_controller.h +++ b/keyboards/infinity60/led_controller.h @@ -31,6 +31,7 @@ msg_t is31_read_register(uint8_t page, uint8_t reg, uint8_t *result); * ============================*/ void led_controller_init(void); +void print_debug (uint8_t page); #define CAPS_LOCK_LED_ADDRESS 46 //pin matrix location #define NUM_LOCK_LED_ADDRESS 85 @@ -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 @@ -86,32 +87,33 @@ void led_controller_init(void); #define IS31_TIMEOUT 10000 // needs to be long enough to write a whole page /* ======================================== - * LED Thread related functions/definitions + * LED Thread related items * ========================================*/ extern mailbox_t led_mailbox; 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); +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, - BLINK_OFF_LED, - BLINK_ON_LED, - BLINK_TOGGLE_LED, + SET_FULL_ROW, OFF_LED, ON_LED, TOGGLE_LED, + BLINK_OFF_LED, + BLINK_ON_LED, + BLINK_TOGGLE_LED, TOGGLE_ALL, TOGGLE_BACKLIGHT, DISPLAY_PAGE, RESET_PAGE, TOGGLE_NUM_LOCK, TOGGLE_CAPS_LOCK, - MODE_BREATH, + TOGGLE_BREATH, STEP_BRIGHTNESS }; -- cgit v1.2.3 From 2c5b5519706e72022f83054d3e3249e3cd4bd1f3 Mon Sep 17 00:00:00 2001 From: jpetermans Date: Mon, 8 May 2017 14:35:08 -0700 Subject: CLeaned out debug code --- keyboards/infinity60/led_controller.h | 1 - 1 file changed, 1 deletion(-) (limited to 'keyboards/infinity60/led_controller.h') diff --git a/keyboards/infinity60/led_controller.h b/keyboards/infinity60/led_controller.h index 7bdef7ae63..457b21a925 100644 --- a/keyboards/infinity60/led_controller.h +++ b/keyboards/infinity60/led_controller.h @@ -31,7 +31,6 @@ msg_t is31_read_register(uint8_t page, uint8_t reg, uint8_t *result); * ============================*/ void led_controller_init(void); -void print_debug (uint8_t page); #define CAPS_LOCK_LED_ADDRESS 46 //pin matrix location #define NUM_LOCK_LED_ADDRESS 85 -- cgit v1.2.3 From 9af272e4bb685faabd1d879231f2718f0c00b32d Mon Sep 17 00:00:00 2001 From: jpetermans Date: Tue, 30 May 2017 21:52:44 -0700 Subject: Update lock led processing and remove debug msgs --- keyboards/infinity60/led_controller.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'keyboards/infinity60/led_controller.h') diff --git a/keyboards/infinity60/led_controller.h b/keyboards/infinity60/led_controller.h index 457b21a925..eb6060f260 100644 --- a/keyboards/infinity60/led_controller.h +++ b/keyboards/infinity60/led_controller.h @@ -75,7 +75,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 -- cgit v1.2.3