diff options
author | yiancar <yiangosyiangou@cytanet.com.cy> | 2019-05-16 05:09:36 +0100 |
---|---|---|
committer | MechMerlin <30334081+mechmerlin@users.noreply.github.com> | 2019-05-15 21:09:36 -0700 |
commit | acd3e79add2d47ab664b831936e5b6e71d3b8e15 (patch) | |
tree | 7fede0ba898a56246cbd02d72378d84c03974f8d | |
parent | 8680c50d07604836b0fc7c3f97bd77c7830ea083 (diff) | |
download | qmk_firmware-acd3e79add2d47ab664b831936e5b6e71d3b8e15.tar.gz qmk_firmware-acd3e79add2d47ab664b831936e5b6e71d3b8e15.zip |
NK65 Addition (#5865)
* Nk65 initial commit
* Minor fix for compatibility
* Make everything pretty
* Update keyboards/nk65/config.h
Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>
* Update keyboards/nk65/readme.md
Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>
* Chmod Dummy
* Update getting_started_introduction.md
* Revert "Update getting_started_introduction.md"
This reverts commit daf446acf7ae4ae00488b389ce04f2cfca708d44.
23 files changed, 4644 insertions, 1397 deletions
diff --git a/drivers/issi/is31fl3733.c b/drivers/issi/is31fl3733.c index c18ed7ca3..aa247f4e8 100644 --- a/drivers/issi/is31fl3733.c +++ b/drivers/issi/is31fl3733.c | |||
@@ -75,10 +75,10 @@ uint8_t g_twi_transfer_buffer[20]; | |||
75 | // buffers and the transfers in IS31FL3733_write_pwm_buffer() but it's | 75 | // buffers and the transfers in IS31FL3733_write_pwm_buffer() but it's |
76 | // probably not worth the extra complexity. | 76 | // probably not worth the extra complexity. |
77 | uint8_t g_pwm_buffer[DRIVER_COUNT][192]; | 77 | uint8_t g_pwm_buffer[DRIVER_COUNT][192]; |
78 | bool g_pwm_buffer_update_required = false; | 78 | bool g_pwm_buffer_update_required[DRIVER_COUNT] = { false }; |
79 | 79 | ||
80 | uint8_t g_led_control_registers[DRIVER_COUNT][24] = { { 0 }, { 0 } }; | 80 | uint8_t g_led_control_registers[DRIVER_COUNT][24] = { { 0 }, { 0 } }; |
81 | bool g_led_control_registers_update_required = false; | 81 | bool g_led_control_registers_update_required[DRIVER_COUNT] = { false }; |
82 | 82 | ||
83 | void IS31FL3733_write_register( uint8_t addr, uint8_t reg, uint8_t data ) | 83 | void IS31FL3733_write_register( uint8_t addr, uint8_t reg, uint8_t data ) |
84 | { | 84 | { |
@@ -123,12 +123,13 @@ void IS31FL3733_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer ) | |||
123 | } | 123 | } |
124 | } | 124 | } |
125 | 125 | ||
126 | void IS31FL3733_init( uint8_t addr ) | 126 | void IS31FL3733_init( uint8_t addr, uint8_t sync) |
127 | { | 127 | { |
128 | // In order to avoid the LEDs being driven with garbage data | 128 | // In order to avoid the LEDs being driven with garbage data |
129 | // in the LED driver's PWM registers, shutdown is enabled last. | 129 | // in the LED driver's PWM registers, shutdown is enabled last. |
130 | // Set up the mode and other settings, clear the PWM registers, | 130 | // Set up the mode and other settings, clear the PWM registers, |
131 | // then disable software shutdown. | 131 | // then disable software shutdown. |
132 | // Sync is passed so set it according to the datasheet. | ||
132 | 133 | ||
133 | // Unlock the command register. | 134 | // Unlock the command register. |
134 | IS31FL3733_write_register( addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5 ); | 135 | IS31FL3733_write_register( addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5 ); |
@@ -161,7 +162,7 @@ void IS31FL3733_init( uint8_t addr ) | |||
161 | // Set global current to maximum. | 162 | // Set global current to maximum. |
162 | IS31FL3733_write_register( addr, ISSI_REG_GLOBALCURRENT, 0xFF ); | 163 | IS31FL3733_write_register( addr, ISSI_REG_GLOBALCURRENT, 0xFF ); |
163 | // Disable software shutdown. | 164 | // Disable software shutdown. |
164 | IS31FL3733_write_register( addr, ISSI_REG_CONFIGURATION, 0x01 ); | 165 | IS31FL3733_write_register( addr, ISSI_REG_CONFIGURATION, (sync << 6) | 0x01 ); |
165 | 166 | ||
166 | // Wait 10ms to ensure the device has woken up. | 167 | // Wait 10ms to ensure the device has woken up. |
167 | #ifdef __AVR__ | 168 | #ifdef __AVR__ |
@@ -179,7 +180,7 @@ void IS31FL3733_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ) | |||
179 | g_pwm_buffer[led.driver][led.r] = red; | 180 | g_pwm_buffer[led.driver][led.r] = red; |
180 | g_pwm_buffer[led.driver][led.g] = green; | 181 | g_pwm_buffer[led.driver][led.g] = green; |
181 | g_pwm_buffer[led.driver][led.b] = blue; | 182 | g_pwm_buffer[led.driver][led.b] = blue; |
182 | g_pwm_buffer_update_required = true; | 183 | g_pwm_buffer_update_required[led.driver] = true; |
183 | } | 184 | } |
184 | } | 185 | } |
185 | 186 | ||
@@ -218,35 +219,34 @@ void IS31FL3733_set_led_control_register( uint8_t index, bool red, bool green, b | |||
218 | g_led_control_registers[led.driver][control_register_b] &= ~(1 << bit_b); | 219 | g_led_control_registers[led.driver][control_register_b] &= ~(1 << bit_b); |
219 | } | 220 | } |
220 | 221 | ||
221 | g_led_control_registers_update_required = true; | 222 | g_led_control_registers_update_required[led.driver] = true; |
222 | 223 | ||
223 | } | 224 | } |
224 | 225 | ||
225 | void IS31FL3733_update_pwm_buffers( uint8_t addr1, uint8_t addr2 ) | 226 | void IS31FL3733_update_pwm_buffers( uint8_t addr, uint8_t index ) |
226 | { | 227 | { |
227 | if ( g_pwm_buffer_update_required ) | 228 | if ( g_pwm_buffer_update_required[index] ) |
228 | { | 229 | { |
229 | // Firstly we need to unlock the command register and select PG1 | 230 | // Firstly we need to unlock the command register and select PG1 |
230 | IS31FL3733_write_register( addr1, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5 ); | 231 | IS31FL3733_write_register( addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5 ); |
231 | IS31FL3733_write_register( addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM ); | 232 | IS31FL3733_write_register( addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM ); |
232 | 233 | ||
233 | IS31FL3733_write_pwm_buffer( addr1, g_pwm_buffer[0] ); | 234 | IS31FL3733_write_pwm_buffer( addr, g_pwm_buffer[index] ); |
234 | //IS31FL3733_write_pwm_buffer( addr2, g_pwm_buffer[1] ); | ||
235 | } | 235 | } |
236 | g_pwm_buffer_update_required = false; | 236 | g_pwm_buffer_update_required[index] = false; |
237 | } | 237 | } |
238 | 238 | ||
239 | void IS31FL3733_update_led_control_registers( uint8_t addr1, uint8_t addr2 ) | 239 | void IS31FL3733_update_led_control_registers( uint8_t addr, uint8_t index ) |
240 | { | 240 | { |
241 | if ( g_led_control_registers_update_required ) | 241 | if ( g_led_control_registers_update_required[index] ) |
242 | { | 242 | { |
243 | // Firstly we need to unlock the command register and select PG0 | 243 | // Firstly we need to unlock the command register and select PG0 |
244 | IS31FL3733_write_register( addr1, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5 ); | 244 | IS31FL3733_write_register( addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5 ); |
245 | IS31FL3733_write_register( addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL ); | 245 | IS31FL3733_write_register( addr, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL ); |
246 | for ( int i=0; i<24; i++ ) | 246 | for ( int i=0; i<24; i++ ) |
247 | { | 247 | { |
248 | IS31FL3733_write_register(addr1, i, g_led_control_registers[0][i] ); | 248 | IS31FL3733_write_register(addr, i, g_led_control_registers[index][i] ); |
249 | //IS31FL3733_write_register(addr2, i, g_led_control_registers[1][i] ); | ||
250 | } | 249 | } |
251 | } | 250 | } |
251 | g_led_control_registers_update_required[index] = false; | ||
252 | } | 252 | } |
diff --git a/drivers/issi/is31fl3733.h b/drivers/issi/is31fl3733.h index 3d23b188a..e117b2546 100644 --- a/drivers/issi/is31fl3733.h +++ b/drivers/issi/is31fl3733.h | |||
@@ -32,7 +32,7 @@ typedef struct is31_led { | |||
32 | 32 | ||
33 | extern const is31_led g_is31_leds[DRIVER_LED_TOTAL]; | 33 | extern const is31_led g_is31_leds[DRIVER_LED_TOTAL]; |
34 | 34 | ||
35 | void IS31FL3733_init( uint8_t addr ); | 35 | void IS31FL3733_init( uint8_t addr, uint8_t sync ); |
36 | void IS31FL3733_write_register( uint8_t addr, uint8_t reg, uint8_t data ); | 36 | void IS31FL3733_write_register( uint8_t addr, uint8_t reg, uint8_t data ); |
37 | void IS31FL3733_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer ); | 37 | void IS31FL3733_write_pwm_buffer( uint8_t addr, uint8_t *pwm_buffer ); |
38 | 38 | ||
@@ -45,8 +45,8 @@ void IS31FL3733_set_led_control_register( uint8_t index, bool red, bool green, b | |||
45 | // (eg. from a timer interrupt). | 45 | // (eg. from a timer interrupt). |
46 | // Call this while idle (in between matrix scans). | 46 | // Call this while idle (in between matrix scans). |
47 | // If the buffer is dirty, it will update the driver with the buffer. | 47 | // If the buffer is dirty, it will update the driver with the buffer. |
48 | void IS31FL3733_update_pwm_buffers( uint8_t addr1, uint8_t addr2 ); | 48 | void IS31FL3733_update_pwm_buffers( uint8_t addr, uint8_t index ); |
49 | void IS31FL3733_update_led_control_registers( uint8_t addr1, uint8_t addr2 ); | 49 | void IS31FL3733_update_led_control_registers( uint8_t addr, uint8_t index ); |
50 | 50 | ||
51 | #define A_1 0x00 | 51 | #define A_1 0x00 |
52 | #define A_2 0x01 | 52 | #define A_2 0x01 |
diff --git a/keyboards/nk65/boards/GENERIC_STM32_F303XC/board.c b/keyboards/nk65/boards/GENERIC_STM32_F303XC/board.c new file mode 100755 index 000000000..4331155df --- /dev/null +++ b/keyboards/nk65/boards/GENERIC_STM32_F303XC/board.c | |||
@@ -0,0 +1,126 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #include "hal.h" | ||
18 | |||
19 | #if HAL_USE_PAL || defined(__DOXYGEN__) | ||
20 | /** | ||
21 | * @brief PAL setup. | ||
22 | * @details Digital I/O ports static configuration as defined in @p board.h. | ||
23 | * This variable is used by the HAL when initializing the PAL driver. | ||
24 | */ | ||
25 | const PALConfig pal_default_config = { | ||
26 | #if STM32_HAS_GPIOA | ||
27 | {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, | ||
28 | VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH}, | ||
29 | #endif | ||
30 | #if STM32_HAS_GPIOB | ||
31 | {VAL_GPIOB_MODER, VAL_GPIOB_OTYPER, VAL_GPIOB_OSPEEDR, VAL_GPIOB_PUPDR, | ||
32 | VAL_GPIOB_ODR, VAL_GPIOB_AFRL, VAL_GPIOB_AFRH}, | ||
33 | #endif | ||
34 | #if STM32_HAS_GPIOC | ||
35 | {VAL_GPIOC_MODER, VAL_GPIOC_OTYPER, VAL_GPIOC_OSPEEDR, VAL_GPIOC_PUPDR, | ||
36 | VAL_GPIOC_ODR, VAL_GPIOC_AFRL, VAL_GPIOC_AFRH}, | ||
37 | #endif | ||
38 | #if STM32_HAS_GPIOD | ||
39 | {VAL_GPIOD_MODER, VAL_GPIOD_OTYPER, VAL_GPIOD_OSPEEDR, VAL_GPIOD_PUPDR, | ||
40 | VAL_GPIOD_ODR, VAL_GPIOD_AFRL, VAL_GPIOD_AFRH}, | ||
41 | #endif | ||
42 | #if STM32_HAS_GPIOE | ||
43 | {VAL_GPIOE_MODER, VAL_GPIOE_OTYPER, VAL_GPIOE_OSPEEDR, VAL_GPIOE_PUPDR, | ||
44 | VAL_GPIOE_ODR, VAL_GPIOE_AFRL, VAL_GPIOE_AFRH}, | ||
45 | #endif | ||
46 | #if STM32_HAS_GPIOF | ||
47 | {VAL_GPIOF_MODER, VAL_GPIOF_OTYPER, VAL_GPIOF_OSPEEDR, VAL_GPIOF_PUPDR, | ||
48 | VAL_GPIOF_ODR, VAL_GPIOF_AFRL, VAL_GPIOF_AFRH}, | ||
49 | #endif | ||
50 | #if STM32_HAS_GPIOG | ||
51 | {VAL_GPIOG_MODER, VAL_GPIOG_OTYPER, VAL_GPIOG_OSPEEDR, VAL_GPIOG_PUPDR, | ||
52 | VAL_GPIOG_ODR, VAL_GPIOG_AFRL, VAL_GPIOG_AFRH}, | ||
53 | #endif | ||
54 | #if STM32_HAS_GPIOH | ||
55 | {VAL_GPIOH_MODER, VAL_GPIOH_OTYPER, VAL_GPIOH_OSPEEDR, VAL_GPIOH_PUPDR, | ||
56 | VAL_GPIOH_ODR, VAL_GPIOH_AFRL, VAL_GPIOH_AFRH}, | ||
57 | #endif | ||
58 | #if STM32_HAS_GPIOI | ||
59 | {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, | ||
60 | VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH} | ||
61 | #endif | ||
62 | }; | ||
63 | #endif | ||
64 | |||
65 | void enter_bootloader_mode_if_requested(void); | ||
66 | |||
67 | /** | ||
68 | * @brief Early initialization code. | ||
69 | * @details This initialization must be performed just after stack setup | ||
70 | * and before any other initialization. | ||
71 | */ | ||
72 | void __early_init(void) { | ||
73 | enter_bootloader_mode_if_requested(); | ||
74 | stm32_clock_init(); | ||
75 | } | ||
76 | |||
77 | #if HAL_USE_SDC || defined(__DOXYGEN__) | ||
78 | /** | ||
79 | * @brief SDC card detection. | ||
80 | */ | ||
81 | bool sdc_lld_is_card_inserted(SDCDriver *sdcp) { | ||
82 | |||
83 | (void)sdcp; | ||
84 | /* TODO: Fill the implementation.*/ | ||
85 | return true; | ||
86 | } | ||
87 | |||
88 | /** | ||
89 | * @brief SDC card write protection detection. | ||
90 | */ | ||
91 | bool sdc_lld_is_write_protected(SDCDriver *sdcp) { | ||
92 | |||
93 | (void)sdcp; | ||
94 | /* TODO: Fill the implementation.*/ | ||
95 | return false; | ||
96 | } | ||
97 | #endif /* HAL_USE_SDC */ | ||
98 | |||
99 | #if HAL_USE_MMC_SPI || defined(__DOXYGEN__) | ||
100 | /** | ||
101 | * @brief MMC_SPI card detection. | ||
102 | */ | ||
103 | bool mmc_lld_is_card_inserted(MMCDriver *mmcp) { | ||
104 | |||
105 | (void)mmcp; | ||
106 | /* TODO: Fill the implementation.*/ | ||
107 | return true; | ||
108 | } | ||
109 | |||
110 | /** | ||
111 | * @brief MMC_SPI card write protection detection. | ||
112 | */ | ||
113 | bool mmc_lld_is_write_protected(MMCDriver *mmcp) { | ||
114 | |||
115 | (void)mmcp; | ||
116 | /* TODO: Fill the implementation.*/ | ||
117 | return false; | ||
118 | } | ||
119 | #endif | ||
120 | |||
121 | /** | ||
122 | * @brief Board-specific initialization code. | ||
123 | * @todo Add your board-specific code, if any. | ||
124 | */ | ||
125 | void boardInit(void) { | ||
126 | } | ||
diff --git a/keyboards/nk65/boards/GENERIC_STM32_F303XC/board.h b/keyboards/nk65/boards/GENERIC_STM32_F303XC/board.h new file mode 100755 index 000000000..54df72ea6 --- /dev/null +++ b/keyboards/nk65/boards/GENERIC_STM32_F303XC/board.h | |||
@@ -0,0 +1,1187 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef _BOARD_H_ | ||
18 | #define _BOARD_H_ | ||
19 | |||
20 | /* | ||
21 | * Setup for NK65 Keyboard | ||
22 | */ | ||
23 | |||
24 | /* | ||
25 | * Board identifier. | ||
26 | */ | ||
27 | #define BOARD_GENERIC_STM32_F303XC | ||
28 | #define BOARD_NAME "NK65 PCB" | ||
29 | |||
30 | /* | ||
31 | * Board oscillators-related settings. | ||
32 | * NOTE: LSE not fitted. | ||
33 | */ | ||
34 | #if !defined(STM32_LSECLK) | ||
35 | #define STM32_LSECLK 0U | ||
36 | #endif | ||
37 | |||
38 | #define STM32_LSEDRV (3U << 3U) | ||
39 | |||
40 | #if !defined(STM32_HSECLK) | ||
41 | #define STM32_HSECLK 8000000U | ||
42 | #endif | ||
43 | |||
44 | // #define STM32_HSE_BYPASS | ||
45 | |||
46 | /* | ||
47 | * MCU type as defined in the ST header. | ||
48 | */ | ||
49 | #define STM32F303xC | ||
50 | |||
51 | /* | ||
52 | * IO pins assignments. | ||
53 | */ | ||
54 | #define GPIOA_PIN0 0U | ||
55 | #define GPIOA_PIN1 1U | ||
56 | #define GPIOA_PIN2 2U | ||
57 | #define GPIOA_PIN3 3U | ||
58 | #define GPIOA_PIN4 4U | ||
59 | #define GPIOA_PIN5 5U | ||
60 | #define GPIOA_PIN6 6U | ||
61 | #define GPIOA_PIN7 7U | ||
62 | #define GPIOA_PIN8 8U | ||
63 | #define GPIOA_PIN9 9U | ||
64 | #define GPIOA_PIN10 10U | ||
65 | #define GPIOA_USB_DM 11U | ||
66 | #define GPIOA_USB_DP 12U | ||
67 | #define GPIOA_SWDIO 13U | ||
68 | #define GPIOA_SWCLK 14U | ||
69 | #define GPIOA_PIN15 15U | ||
70 | |||
71 | #define GPIOB_PIN0 0U | ||
72 | #define GPIOB_PIN1 1U | ||
73 | #define GPIOB_PIN2 2U | ||
74 | #define GPIOB_PIN3 3U | ||
75 | #define GPIOB_PIN4 4U | ||
76 | #define GPIOB_PIN5 5U | ||
77 | #define GPIOB_PIN6 6U | ||
78 | #define GPIOB_PIN7 7U | ||
79 | #define GPIOB_PIN8 8U | ||
80 | #define GPIOB_PIN9 9U | ||
81 | #define GPIOB_PIN10 10U | ||
82 | #define GPIOB_PIN11 11U | ||
83 | #define GPIOB_PIN12 12U | ||
84 | #define GPIOB_PIN13 13U | ||
85 | #define GPIOB_PIN14 14U | ||
86 | #define GPIOB_PIN15 15U | ||
87 | |||
88 | #define GPIOC_PIN0 0U | ||
89 | #define GPIOC_PIN1 1U | ||
90 | #define GPIOC_PIN2 2U | ||
91 | #define GPIOC_PIN3 3U | ||
92 | #define GPIOC_PIN4 4U | ||
93 | #define GPIOC_PIN5 5U | ||
94 | #define GPIOC_PIN6 6U | ||
95 | #define GPIOC_PIN7 7U | ||
96 | #define GPIOC_PIN8 8U | ||
97 | #define GPIOC_PIN9 9U | ||
98 | #define GPIOC_PIN10 10U | ||
99 | #define GPIOC_PIN11 11U | ||
100 | #define GPIOC_PIN12 12U | ||
101 | #define GPIOC_PIN13 13U | ||
102 | #define GPIOC_PIN14 14U | ||
103 | #define GPIOC_PIN15 15U | ||
104 | |||
105 | #define GPIOD_PIN0 0U | ||
106 | #define GPIOD_PIN1 1U | ||
107 | #define GPIOD_PIN2 2U | ||
108 | #define GPIOD_PIN3 3U | ||
109 | #define GPIOD_PIN4 4U | ||
110 | #define GPIOD_PIN5 5U | ||
111 | #define GPIOD_PIN6 6U | ||
112 | #define GPIOD_PIN7 7U | ||
113 | #define GPIOD_PIN8 8U | ||
114 | #define GPIOD_PIN9 9U | ||
115 | #define GPIOD_PIN10 10U | ||
116 | #define GPIOD_PIN11 11U | ||
117 | #define GPIOD_PIN12 12U | ||
118 | #define GPIOD_PIN13 13U | ||
119 | #define GPIOD_PIN14 14U | ||
120 | #define GPIOD_PIN15 15U | ||
121 | |||
122 | #define GPIOE_PIN0 0U | ||
123 | #define GPIOE_PIN1 1U | ||
124 | #define GPIOE_PIN2 2U | ||
125 | #define GPIOE_PIN3 3U | ||
126 | #define GPIOE_PIN4 4U | ||
127 | #define GPIOE_PIN5 5U | ||
128 | #define GPIOE_PIN6 6U | ||
129 | #define GPIOE_PIN7 7U | ||
130 | #define GPIOE_PIN8 8U | ||
131 | #define GPIOE_PIN9 9U | ||
132 | #define GPIOE_PIN10 10U | ||
133 | #define GPIOE_PIN11 11U | ||
134 | #define GPIOE_PIN12 12U | ||
135 | #define GPIOE_PIN13 13U | ||
136 | #define GPIOE_PIN14 14U | ||
137 | #define GPIOE_PIN15 15U | ||
138 | |||
139 | #define GPIOF_I2C2_SDA 0U | ||
140 | #define GPIOF_I2C2_SCL 1U | ||
141 | #define GPIOF_PIN2 2U | ||
142 | #define GPIOF_PIN3 3U | ||
143 | #define GPIOF_PIN4 4U | ||
144 | #define GPIOF_PIN5 5U | ||
145 | #define GPIOF_PIN6 6U | ||
146 | #define GPIOF_PIN7 7U | ||
147 | #define GPIOF_PIN8 8U | ||
148 | #define GPIOF_PIN9 9U | ||
149 | #define GPIOF_PIN10 10U | ||
150 | #define GPIOF_PIN11 11U | ||
151 | #define GPIOF_PIN12 12U | ||
152 | #define GPIOF_PIN13 13U | ||
153 | #define GPIOF_PIN14 14U | ||
154 | #define GPIOF_PIN15 15U | ||
155 | |||
156 | #define GPIOG_PIN0 0U | ||
157 | #define GPIOG_PIN1 1U | ||
158 | #define GPIOG_PIN2 2U | ||
159 | #define GPIOG_PIN3 3U | ||
160 | #define GPIOG_PIN4 4U | ||
161 | #define GPIOG_PIN5 5U | ||
162 | #define GPIOG_PIN6 6U | ||
163 | #define GPIOG_PIN7 7U | ||
164 | #define GPIOG_PIN8 8U | ||
165 | #define GPIOG_PIN9 9U | ||
166 | #define GPIOG_PIN10 10U | ||
167 | #define GPIOG_PIN11 11U | ||
168 | #define GPIOG_PIN12 12U | ||
169 | #define GPIOG_PIN13 13U | ||
170 | #define GPIOG_PIN14 14U | ||
171 | #define GPIOG_PIN15 15U | ||
172 | |||
173 | #define GPIOH_PIN0 0U | ||
174 | #define GPIOH_PIN1 1U | ||
175 | #define GPIOH_PIN2 2U | ||
176 | #define GPIOH_PIN3 3U | ||
177 | #define GPIOH_PIN4 4U | ||
178 | #define GPIOH_PIN5 5U | ||
179 | #define GPIOH_PIN6 6U | ||
180 | #define GPIOH_PIN7 7U | ||
181 | #define GPIOH_PIN8 8U | ||
182 | #define GPIOH_PIN9 9U | ||
183 | #define GPIOH_PIN10 10U | ||
184 | #define GPIOH_PIN11 11U | ||
185 | #define GPIOH_PIN12 12U | ||
186 | #define GPIOH_PIN13 13U | ||
187 | #define GPIOH_PIN14 14U | ||
188 | #define GPIOH_PIN15 15U | ||
189 | |||
190 | /* | ||
191 | * IO lines assignments. | ||
192 | */ | ||
193 | #define LINE_L3GD20_SDI PAL_LINE(GPIOA, 7U) | ||
194 | #define LINE_USB_DM PAL_LINE(GPIOA, 11U) | ||
195 | #define LINE_USB_DP PAL_LINE(GPIOA, 12U) | ||
196 | #define LINE_SWDIO PAL_LINE(GPIOA, 13U) | ||
197 | #define LINE_SWCLK PAL_LINE(GPIOA, 14U) | ||
198 | |||
199 | #define LINE_PIN6 PAL_LINE(GPIOF, 0U) | ||
200 | #define LINE_PIN7 PAL_LINE(GPIOF, 1U) | ||
201 | |||
202 | #define LINE_CAPS_LOCK PAL_LINE(GPIOB, 7U) | ||
203 | |||
204 | |||
205 | /* | ||
206 | * I/O ports initial setup, this configuration is established soon after reset | ||
207 | * in the initialization code. | ||
208 | * Please refer to the STM32 Reference Manual for details. | ||
209 | */ | ||
210 | #define PIN_MODE_INPUT(n) (0U << ((n) * 2U)) | ||
211 | #define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U)) | ||
212 | #define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U)) | ||
213 | #define PIN_MODE_ANALOG(n) (3U << ((n) * 2U)) | ||
214 | #define PIN_ODR_LOW(n) (0U << (n)) | ||
215 | #define PIN_ODR_HIGH(n) (1U << (n)) | ||
216 | #define PIN_OTYPE_PUSHPULL(n) (0U << (n)) | ||
217 | #define PIN_OTYPE_OPENDRAIN(n) (1U << (n)) | ||
218 | #define PIN_OSPEED_VERYLOW(n) (0U << ((n) * 2U)) | ||
219 | #define PIN_OSPEED_LOW(n) (1U << ((n) * 2U)) | ||
220 | #define PIN_OSPEED_MEDIUM(n) (2U << ((n) * 2U)) | ||
221 | #define PIN_OSPEED_HIGH(n) (3U << ((n) * 2U)) | ||
222 | #define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U)) | ||
223 | #define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U)) | ||
224 | #define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U)) | ||
225 | #define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U)) | ||
226 | |||
227 | /* | ||
228 | * GPIOA setup: | ||
229 | * | ||
230 | * PA0 - NC | ||
231 | * PA1 - NC | ||
232 | * PA2 - COL1 | ||
233 | * PA3 - COL2 | ||
234 | * PA4 - SPEAKER1 | ||
235 | * PA5 - SPEAKER2 | ||
236 | * PA6 - COL3 | ||
237 | * PA7 - COL8 | ||
238 | * PA8 - COL6 | ||
239 | * PA9 - COL7 | ||
240 | * PA10 - ROW5 | ||
241 | * PA11 - USB_DM (alternate 14). | ||
242 | * PA12 - USB_DP (alternate 14). | ||
243 | * PA13 - SWDIO (alternate 0). | ||
244 | * PA14 - SWCLK (alternate 0). | ||
245 | * PA15 - ROW4 | ||
246 | */ | ||
247 | #define VAL_GPIOA_MODER (PIN_MODE_INPUT(GPIOA_PIN0) | \ | ||
248 | PIN_MODE_ALTERNATE(GPIOA_PIN1) | \ | ||
249 | PIN_MODE_INPUT(GPIOA_PIN2) | \ | ||
250 | PIN_MODE_INPUT(GPIOA_PIN3) | \ | ||
251 | PIN_MODE_INPUT(GPIOA_PIN4) | \ | ||
252 | PIN_MODE_INPUT(GPIOA_PIN5) | \ | ||
253 | PIN_MODE_INPUT(GPIOA_PIN6) | \ | ||
254 | PIN_MODE_INPUT(GPIOA_PIN7) | \ | ||
255 | PIN_MODE_INPUT(GPIOA_PIN8) | \ | ||
256 | PIN_MODE_INPUT(GPIOA_PIN9) | \ | ||
257 | PIN_MODE_INPUT(GPIOA_PIN10) | \ | ||
258 | PIN_MODE_ALTERNATE(GPIOA_USB_DM) | \ | ||
259 | PIN_MODE_ALTERNATE(GPIOA_USB_DP) | \ | ||
260 | PIN_MODE_ALTERNATE(GPIOA_SWDIO) | \ | ||
261 | PIN_MODE_ALTERNATE(GPIOA_SWCLK) | \ | ||
262 | PIN_MODE_INPUT(GPIOA_PIN15)) | ||
263 | #define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(GPIOA_PIN0) | \ | ||
264 | PIN_OTYPE_PUSHPULL(GPIOA_PIN1) | \ | ||
265 | PIN_OTYPE_PUSHPULL(GPIOA_PIN2) | \ | ||
266 | PIN_OTYPE_PUSHPULL(GPIOA_PIN3) | \ | ||
267 | PIN_OTYPE_PUSHPULL(GPIOA_PIN4) | \ | ||
268 | PIN_OTYPE_PUSHPULL(GPIOA_PIN5) | \ | ||
269 | PIN_OTYPE_PUSHPULL(GPIOA_PIN6) | \ | ||
270 | PIN_OTYPE_PUSHPULL(GPIOA_PIN7) | \ | ||
271 | PIN_OTYPE_PUSHPULL(GPIOA_PIN8) | \ | ||
272 | PIN_OTYPE_PUSHPULL(GPIOA_PIN9) | \ | ||
273 | PIN_OTYPE_PUSHPULL(GPIOA_PIN10) | \ | ||
274 | PIN_OTYPE_PUSHPULL(GPIOA_USB_DM) | \ | ||
275 | PIN_OTYPE_PUSHPULL(GPIOA_USB_DP) | \ | ||
276 | PIN_OTYPE_PUSHPULL(GPIOA_SWDIO) | \ | ||
277 | PIN_OTYPE_PUSHPULL(GPIOA_SWCLK) | \ | ||
278 | PIN_OTYPE_PUSHPULL(GPIOA_PIN15)) | ||
279 | #define VAL_GPIOA_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOA_PIN0) | \ | ||
280 | PIN_OSPEED_HIGH(GPIOA_PIN1) | \ | ||
281 | PIN_OSPEED_VERYLOW(GPIOA_PIN2) | \ | ||
282 | PIN_OSPEED_VERYLOW(GPIOA_PIN3) | \ | ||
283 | PIN_OSPEED_VERYLOW(GPIOA_PIN4) | \ | ||
284 | PIN_OSPEED_VERYLOW(GPIOA_PIN5) | \ | ||
285 | PIN_OSPEED_VERYLOW(GPIOA_PIN6) | \ | ||
286 | PIN_OSPEED_VERYLOW(GPIOA_PIN7) | \ | ||
287 | PIN_OSPEED_VERYLOW(GPIOA_PIN8) | \ | ||
288 | PIN_OSPEED_VERYLOW(GPIOA_PIN9) | \ | ||
289 | PIN_OSPEED_VERYLOW(GPIOA_PIN10) | \ | ||
290 | PIN_OSPEED_HIGH(GPIOA_USB_DM) | \ | ||
291 | PIN_OSPEED_VERYLOW(GPIOA_USB_DP) | \ | ||
292 | PIN_OSPEED_HIGH(GPIOA_SWDIO) | \ | ||
293 | PIN_OSPEED_HIGH(GPIOA_SWCLK) | \ | ||
294 | PIN_OSPEED_VERYLOW(GPIOA_PIN15)) | ||
295 | #define VAL_GPIOA_PUPDR (PIN_PUPDR_FLOATING(GPIOA_PIN0) | \ | ||
296 | PIN_PUPDR_FLOATING(GPIOA_PIN1) | \ | ||
297 | PIN_PUPDR_PULLUP(GPIOA_PIN2) | \ | ||
298 | PIN_PUPDR_PULLUP(GPIOA_PIN3) | \ | ||
299 | PIN_PUPDR_PULLUP(GPIOA_PIN4) | \ | ||
300 | PIN_PUPDR_PULLUP(GPIOA_PIN5) | \ | ||
301 | PIN_PUPDR_PULLUP(GPIOA_PIN6) | \ | ||
302 | PIN_PUPDR_FLOATING(GPIOA_PIN7) | \ | ||
303 | PIN_PUPDR_PULLUP(GPIOA_PIN8) | \ | ||
304 | PIN_PUPDR_PULLUP(GPIOA_PIN9) | \ | ||
305 | PIN_PUPDR_PULLUP(GPIOA_PIN10) | \ | ||
306 | PIN_PUPDR_FLOATING(GPIOA_USB_DM) | \ | ||
307 | PIN_PUPDR_FLOATING(GPIOA_USB_DP) | \ | ||
308 | PIN_PUPDR_PULLUP(GPIOA_SWDIO) | \ | ||
309 | PIN_PUPDR_PULLDOWN(GPIOA_SWCLK) | \ | ||
310 | PIN_PUPDR_PULLUP(GPIOA_PIN15)) | ||
311 | #define VAL_GPIOA_ODR (PIN_ODR_HIGH(GPIOA_PIN0) | \ | ||
312 | PIN_ODR_HIGH(GPIOA_PIN1) | \ | ||
313 | PIN_ODR_HIGH(GPIOA_PIN2) | \ | ||
314 | PIN_ODR_HIGH(GPIOA_PIN3) | \ | ||
315 | PIN_ODR_HIGH(GPIOA_PIN4) | \ | ||
316 | PIN_ODR_HIGH(GPIOA_PIN5) | \ | ||
317 | PIN_ODR_HIGH(GPIOA_PIN6) | \ | ||
318 | PIN_ODR_HIGH(GPIOA_PIN7) | \ | ||
319 | PIN_ODR_HIGH(GPIOA_PIN8) | \ | ||
320 | PIN_ODR_HIGH(GPIOA_PIN9) | \ | ||
321 | PIN_ODR_HIGH(GPIOA_PIN10) | \ | ||
322 | PIN_ODR_HIGH(GPIOA_USB_DM) | \ | ||
323 | PIN_ODR_HIGH(GPIOA_USB_DP) | \ | ||
324 | PIN_ODR_HIGH(GPIOA_SWDIO) | \ | ||
325 | PIN_ODR_HIGH(GPIOA_SWCLK) | \ | ||
326 | PIN_ODR_HIGH(GPIOA_PIN15)) | ||
327 | #define VAL_GPIOA_AFRL (PIN_AFIO_AF(GPIOA_PIN0, 0) | \ | ||
328 | PIN_AFIO_AF(GPIOA_PIN1, 1) | \ | ||
329 | PIN_AFIO_AF(GPIOA_PIN2, 0) | \ | ||
330 | PIN_AFIO_AF(GPIOA_PIN3, 0) | \ | ||
331 | PIN_AFIO_AF(GPIOA_PIN4, 0) | \ | ||
332 | PIN_AFIO_AF(GPIOA_PIN5, 5) | \ | ||
333 | PIN_AFIO_AF(GPIOA_PIN6, 5) | \ | ||
334 | PIN_AFIO_AF(GPIOA_PIN7, 5)) | ||
335 | #define VAL_GPIOA_AFRH (PIN_AFIO_AF(GPIOA_PIN8, 0) | \ | ||
336 | PIN_AFIO_AF(GPIOA_PIN9, 0) | \ | ||
337 | PIN_AFIO_AF(GPIOA_PIN10, 0) | \ | ||
338 | PIN_AFIO_AF(GPIOA_USB_DM, 14) | \ | ||
339 | PIN_AFIO_AF(GPIOA_USB_DP, 14) | \ | ||
340 | PIN_AFIO_AF(GPIOA_SWDIO, 0) | \ | ||
341 | PIN_AFIO_AF(GPIOA_SWCLK, 0) | \ | ||
342 | PIN_AFIO_AF(GPIOA_PIN15, 0)) | ||
343 | |||
344 | /* | ||
345 | * GPIOB setup: | ||
346 | * | ||
347 | * PB0 - PIN0 (input pullup). | ||
348 | * PB1 - PIN1 (input pullup). | ||
349 | * PB2 - PIN2 (input pullup). | ||
350 | * PB3 - PIN3 (alternate 0). | ||
351 | * PB4 - PIN4 (input pullup). | ||
352 | * PB5 - PIN5 (input pullup). | ||
353 | * PB6 - PIN6 LSM303DLHC_SCL (alternate 4). | ||
354 | * PB7 - PIN7 LSM303DLHC_SDA (alternate 4). | ||
355 | * PB8 - PIN8 (input pullup). | ||
356 | * PB9 - PIN9 (input pullup). | ||
357 | * PB10 - PIN10 (input pullup). | ||
358 | * PB11 - PIN11 (input pullup). | ||
359 | * PB12 - PIN12 (input pullup). | ||
360 | * PB13 - PIN13 (input pullup). | ||
361 | * PB14 - PIN14 (input pullup). | ||
362 | * PB15 - PIN15 (input pullup). | ||
363 | */ | ||
364 | #define VAL_GPIOB_MODER (PIN_MODE_INPUT(GPIOB_PIN0) | \ | ||
365 | PIN_MODE_INPUT(GPIOB_PIN1) | \ | ||
366 | PIN_MODE_INPUT(GPIOB_PIN2) | \ | ||
367 | PIN_MODE_ALTERNATE(GPIOB_PIN3) | \ | ||
368 | PIN_MODE_INPUT(GPIOB_PIN4) | \ | ||
369 | PIN_MODE_INPUT(GPIOB_PIN5) | \ | ||
370 | PIN_MODE_ALTERNATE(GPIOB_PIN6) | \ | ||
371 | PIN_MODE_OUTPUT(GPIOB_PIN7) | \ | ||
372 | PIN_MODE_INPUT(GPIOB_PIN8) | \ | ||
373 | PIN_MODE_INPUT(GPIOB_PIN9) | \ | ||
374 | PIN_MODE_INPUT(GPIOB_PIN10) | \ | ||
375 | PIN_MODE_INPUT(GPIOB_PIN11) | \ | ||
376 | PIN_MODE_INPUT(GPIOB_PIN12) | \ | ||
377 | PIN_MODE_INPUT(GPIOB_PIN13) | \ | ||
378 | PIN_MODE_INPUT(GPIOB_PIN14) | \ | ||
379 | PIN_MODE_INPUT(GPIOB_PIN15)) | ||
380 | #define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(GPIOB_PIN0) | \ | ||
381 | PIN_OTYPE_PUSHPULL(GPIOB_PIN1) | \ | ||
382 | PIN_OTYPE_PUSHPULL(GPIOB_PIN2) | \ | ||
383 | PIN_OTYPE_PUSHPULL(GPIOB_PIN3) | \ | ||
384 | PIN_OTYPE_PUSHPULL(GPIOB_PIN4) | \ | ||
385 | PIN_OTYPE_PUSHPULL(GPIOB_PIN5) | \ | ||
386 | PIN_OTYPE_OPENDRAIN(GPIOB_PIN6) | \ | ||
387 | PIN_OTYPE_PUSHPULL(GPIOB_PIN7) | \ | ||
388 | PIN_OTYPE_PUSHPULL(GPIOB_PIN8) | \ | ||
389 | PIN_OTYPE_PUSHPULL(GPIOB_PIN9) | \ | ||
390 | PIN_OTYPE_PUSHPULL(GPIOB_PIN10) | \ | ||
391 | PIN_OTYPE_PUSHPULL(GPIOB_PIN11) | \ | ||
392 | PIN_OTYPE_PUSHPULL(GPIOB_PIN12) | \ | ||
393 | PIN_OTYPE_PUSHPULL(GPIOB_PIN13) | \ | ||
394 | PIN_OTYPE_PUSHPULL(GPIOB_PIN14) | \ | ||
395 | PIN_OTYPE_PUSHPULL(GPIOB_PIN15)) | ||
396 | #define VAL_GPIOB_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOB_PIN0) | \ | ||
397 | PIN_OSPEED_VERYLOW(GPIOB_PIN1) | \ | ||
398 | PIN_OSPEED_VERYLOW(GPIOB_PIN2) | \ | ||
399 | PIN_OSPEED_HIGH(GPIOB_PIN3) | \ | ||
400 | PIN_OSPEED_VERYLOW(GPIOB_PIN4) | \ | ||
401 | PIN_OSPEED_VERYLOW(GPIOB_PIN5) | \ | ||
402 | PIN_OSPEED_HIGH(GPIOB_PIN6) | \ | ||
403 | PIN_OSPEED_VERYLOW(GPIOB_PIN7) | \ | ||
404 | PIN_OSPEED_VERYLOW(GPIOB_PIN8) | \ | ||
405 | PIN_OSPEED_VERYLOW(GPIOB_PIN9) | \ | ||
406 | PIN_OSPEED_VERYLOW(GPIOB_PIN10) | \ | ||
407 | PIN_OSPEED_VERYLOW(GPIOB_PIN11) | \ | ||
408 | PIN_OSPEED_VERYLOW(GPIOB_PIN12) | \ | ||
409 | PIN_OSPEED_VERYLOW(GPIOB_PIN13) | \ | ||
410 | PIN_OSPEED_VERYLOW(GPIOB_PIN14) | \ | ||
411 | PIN_OSPEED_VERYLOW(GPIOB_PIN15)) | ||
412 | #define VAL_GPIOB_PUPDR (PIN_PUPDR_PULLUP(GPIOB_PIN0) | \ | ||
413 | PIN_PUPDR_PULLUP(GPIOB_PIN1) | \ | ||
414 | PIN_PUPDR_PULLUP(GPIOB_PIN2) | \ | ||
415 | PIN_PUPDR_FLOATING(GPIOB_PIN3) | \ | ||
416 | PIN_PUPDR_PULLUP(GPIOB_PIN4) | \ | ||
417 | PIN_PUPDR_PULLUP(GPIOB_PIN5) | \ | ||
418 | PIN_PUPDR_FLOATING(GPIOB_PIN6) | \ | ||
419 | PIN_PUPDR_PULLDOWN(GPIOB_PIN7) | \ | ||
420 | PIN_PUPDR_PULLUP(GPIOB_PIN8) | \ | ||
421 | PIN_PUPDR_PULLUP(GPIOB_PIN9) | \ | ||
422 | PIN_PUPDR_PULLUP(GPIOB_PIN10) | \ | ||
423 | PIN_PUPDR_PULLUP(GPIOB_PIN11) | \ | ||
424 | PIN_PUPDR_PULLUP(GPIOB_PIN12) | \ | ||
425 | PIN_PUPDR_PULLUP(GPIOB_PIN13) | \ | ||
426 | PIN_PUPDR_PULLUP(GPIOB_PIN14) | \ | ||
427 | PIN_PUPDR_PULLUP(GPIOB_PIN15)) | ||
428 | #define VAL_GPIOB_ODR (PIN_ODR_HIGH(GPIOB_PIN0) | \ | ||
429 | PIN_ODR_HIGH(GPIOB_PIN1) | \ | ||
430 | PIN_ODR_HIGH(GPIOB_PIN2) | \ | ||
431 | PIN_ODR_HIGH(GPIOB_PIN3) | \ | ||
432 | PIN_ODR_HIGH(GPIOB_PIN4) | \ | ||
433 | PIN_ODR_HIGH(GPIOB_PIN5) | \ | ||
434 | PIN_ODR_HIGH(GPIOB_PIN6) | \ | ||
435 | PIN_ODR_LOW(GPIOB_PIN7) | \ | ||
436 | PIN_ODR_HIGH(GPIOB_PIN8) | \ | ||
437 | PIN_ODR_HIGH(GPIOB_PIN9) | \ | ||
438 | PIN_ODR_HIGH(GPIOB_PIN10) | \ | ||
439 | PIN_ODR_HIGH(GPIOB_PIN11) | \ | ||
440 | PIN_ODR_HIGH(GPIOB_PIN12) | \ | ||
441 | PIN_ODR_HIGH(GPIOB_PIN13) | \ | ||
442 | PIN_ODR_HIGH(GPIOB_PIN14) | \ | ||
443 | PIN_ODR_HIGH(GPIOB_PIN15)) | ||
444 | #define VAL_GPIOB_AFRL (PIN_AFIO_AF(GPIOB_PIN0, 0) | \ | ||
445 | PIN_AFIO_AF(GPIOB_PIN1, 0) | \ | ||
446 | PIN_AFIO_AF(GPIOB_PIN2, 0) | \ | ||
447 | PIN_AFIO_AF(GPIOB_PIN3, 0) | \ | ||
448 | PIN_AFIO_AF(GPIOB_PIN4, 0) | \ | ||
449 | PIN_AFIO_AF(GPIOB_PIN5, 0) | \ | ||
450 | PIN_AFIO_AF(GPIOB_PIN6, 4) | \ | ||
451 | PIN_AFIO_AF(GPIOB_PIN7, 0)) | ||
452 | #define VAL_GPIOB_AFRH (PIN_AFIO_AF(GPIOB_PIN8, 0) | \ | ||
453 | PIN_AFIO_AF(GPIOB_PIN9, 0) | \ | ||
454 | PIN_AFIO_AF(GPIOB_PIN10, 0) | \ | ||
455 | PIN_AFIO_AF(GPIOB_PIN11, 0) | \ | ||
456 | PIN_AFIO_AF(GPIOB_PIN12, 0) | \ | ||
457 | PIN_AFIO_AF(GPIOB_PIN13, 0) | \ | ||
458 | PIN_AFIO_AF(GPIOB_PIN14, 0) | \ | ||
459 | PIN_AFIO_AF(GPIOB_PIN15, 0)) | ||
460 | |||
461 | /* | ||
462 | * GPIOC setup: | ||
463 | * | ||
464 | * PC0 - PIN0 (input pullup). | ||
465 | * PC1 - PIN1 (input pullup). | ||
466 | * PC2 - PIN2 (input pullup). | ||
467 | * PC3 - PIN3 (input pullup). | ||
468 | * PC4 - PIN4 (input pullup). | ||
469 | * PC5 - PIN5 (input pullup). | ||
470 | * PC6 - PIN6 (input pullup). | ||
471 | * PC7 - PIN7 (input pullup). | ||
472 | * PC8 - PIN8 (input pullup). | ||
473 | * PC9 - PIN9 (input pullup). | ||
474 | * PC10 - PIN10 (input pullup). | ||
475 | * PC11 - PIN11 (input pullup). | ||
476 | * PC12 - PIN12 (input pullup). | ||
477 | * PC13 - PIN13 (input pullup). | ||
478 | * PC14 - PIN14 (input floating). | ||
479 | * PC15 - PIN15 (input floating). | ||
480 | */ | ||
481 | #define VAL_GPIOC_MODER (PIN_MODE_INPUT(GPIOC_PIN0) | \ | ||
482 | PIN_MODE_INPUT(GPIOC_PIN1) | \ | ||
483 | PIN_MODE_INPUT(GPIOC_PIN2) | \ | ||
484 | PIN_MODE_INPUT(GPIOC_PIN3) | \ | ||
485 | PIN_MODE_INPUT(GPIOC_PIN4) | \ | ||
486 | PIN_MODE_INPUT(GPIOC_PIN5) | \ | ||
487 | PIN_MODE_INPUT(GPIOC_PIN6) | \ | ||
488 | PIN_MODE_INPUT(GPIOC_PIN7) | \ | ||
489 | PIN_MODE_INPUT(GPIOC_PIN8) | \ | ||
490 | PIN_MODE_INPUT(GPIOC_PIN9) | \ | ||
491 | PIN_MODE_INPUT(GPIOC_PIN10) | \ | ||
492 | PIN_MODE_INPUT(GPIOC_PIN11) | \ | ||
493 | PIN_MODE_INPUT(GPIOC_PIN12) | \ | ||
494 | PIN_MODE_INPUT(GPIOC_PIN13) | \ | ||
495 | PIN_MODE_INPUT(GPIOC_PIN14) | \ | ||
496 | PIN_MODE_INPUT(GPIOC_PIN15)) | ||
497 | #define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(GPIOC_PIN0) | \ | ||
498 | PIN_OTYPE_PUSHPULL(GPIOC_PIN1) | \ | ||
499 | PIN_OTYPE_PUSHPULL(GPIOC_PIN2) | \ | ||
500 | PIN_OTYPE_PUSHPULL(GPIOC_PIN3) | \ | ||
501 | PIN_OTYPE_PUSHPULL(GPIOC_PIN4) | \ | ||
502 | PIN_OTYPE_PUSHPULL(GPIOC_PIN5) | \ | ||
503 | PIN_OTYPE_PUSHPULL(GPIOC_PIN6) | \ | ||
504 | PIN_OTYPE_PUSHPULL(GPIOC_PIN7) | \ | ||
505 | PIN_OTYPE_PUSHPULL(GPIOC_PIN8) | \ | ||
506 | PIN_OTYPE_PUSHPULL(GPIOC_PIN9) | \ | ||
507 | PIN_OTYPE_PUSHPULL(GPIOC_PIN10) | \ | ||
508 | PIN_OTYPE_PUSHPULL(GPIOC_PIN11) | \ | ||
509 | PIN_OTYPE_PUSHPULL(GPIOC_PIN12) | \ | ||
510 | PIN_OTYPE_PUSHPULL(GPIOC_PIN13) | \ | ||
511 | PIN_OTYPE_PUSHPULL(GPIOC_PIN14) | \ | ||
512 | PIN_OTYPE_PUSHPULL(GPIOC_PIN15)) | ||
513 | #define VAL_GPIOC_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOC_PIN0) | \ | ||
514 | PIN_OSPEED_VERYLOW(GPIOC_PIN1) | \ | ||
515 | PIN_OSPEED_VERYLOW(GPIOC_PIN2) | \ | ||
516 | PIN_OSPEED_VERYLOW(GPIOC_PIN3) | \ | ||
517 | PIN_OSPEED_VERYLOW(GPIOC_PIN4) | \ | ||
518 | PIN_OSPEED_VERYLOW(GPIOC_PIN5) | \ | ||
519 | PIN_OSPEED_VERYLOW(GPIOC_PIN6) | \ | ||
520 | PIN_OSPEED_VERYLOW(GPIOC_PIN7) | \ | ||
521 | PIN_OSPEED_VERYLOW(GPIOC_PIN8) | \ | ||
522 | PIN_OSPEED_VERYLOW(GPIOC_PIN9) | \ | ||
523 | PIN_OSPEED_VERYLOW(GPIOC_PIN10) | \ | ||
524 | PIN_OSPEED_VERYLOW(GPIOC_PIN11) | \ | ||
525 | PIN_OSPEED_VERYLOW(GPIOC_PIN12) | \ | ||
526 | PIN_OSPEED_VERYLOW(GPIOC_PIN13) | \ | ||
527 | PIN_OSPEED_HIGH(GPIOC_PIN14) | \ | ||
528 | PIN_OSPEED_HIGH(GPIOC_PIN15)) | ||
529 | #define VAL_GPIOC_PUPDR (PIN_PUPDR_PULLUP(GPIOC_PIN0) | \ | ||
530 | PIN_PUPDR_PULLUP(GPIOC_PIN1) | \ | ||
531 | PIN_PUPDR_PULLUP(GPIOC_PIN2) | \ | ||
532 | PIN_PUPDR_PULLUP(GPIOC_PIN3) | \ | ||
533 | PIN_PUPDR_PULLUP(GPIOC_PIN4) | \ | ||
534 | PIN_PUPDR_PULLUP(GPIOC_PIN5) | \ | ||
535 | PIN_PUPDR_PULLUP(GPIOC_PIN6) | \ | ||
536 | PIN_PUPDR_PULLUP(GPIOC_PIN7) | \ | ||
537 | PIN_PUPDR_PULLUP(GPIOC_PIN8) | \ | ||
538 | PIN_PUPDR_PULLUP(GPIOC_PIN9) | \ | ||
539 | PIN_PUPDR_PULLUP(GPIOC_PIN10) | \ | ||
540 | PIN_PUPDR_PULLUP(GPIOC_PIN11) | \ | ||
541 | PIN_PUPDR_PULLUP(GPIOC_PIN12) | \ | ||
542 | PIN_PUPDR_PULLUP(GPIOC_PIN13) | \ | ||
543 | PIN_PUPDR_FLOATING(GPIOC_PIN14) | \ | ||
544 | PIN_PUPDR_FLOATING(GPIOC_PIN15)) | ||
545 | #define VAL_GPIOC_ODR (PIN_ODR_HIGH(GPIOC_PIN0) | \ | ||
546 | PIN_ODR_HIGH(GPIOC_PIN1) | \ | ||
547 | PIN_ODR_HIGH(GPIOC_PIN2) | \ | ||
548 | PIN_ODR_HIGH(GPIOC_PIN3) | \ | ||
549 | PIN_ODR_HIGH(GPIOC_PIN4) | \ | ||
550 | PIN_ODR_HIGH(GPIOC_PIN5) | \ | ||
551 | PIN_ODR_HIGH(GPIOC_PIN6) | \ | ||
552 | PIN_ODR_HIGH(GPIOC_PIN7) | \ | ||
553 | PIN_ODR_HIGH(GPIOC_PIN8) | \ | ||
554 | PIN_ODR_HIGH(GPIOC_PIN9) | \ | ||
555 | PIN_ODR_HIGH(GPIOC_PIN10) | \ | ||
556 | PIN_ODR_HIGH(GPIOC_PIN11) | \ | ||
557 | PIN_ODR_HIGH(GPIOC_PIN12) | \ | ||
558 | PIN_ODR_HIGH(GPIOC_PIN13) | \ | ||
559 | PIN_ODR_HIGH(GPIOC_PIN14) | \ | ||
560 | PIN_ODR_HIGH(GPIOC_PIN15)) | ||
561 | #define VAL_GPIOC_AFRL (PIN_AFIO_AF(GPIOC_PIN0, 0) | \ | ||
562 | PIN_AFIO_AF(GPIOC_PIN1, 0) | \ | ||
563 | PIN_AFIO_AF(GPIOC_PIN2, 0) | \ | ||
564 | PIN_AFIO_AF(GPIOC_PIN3, 0) | \ | ||
565 | PIN_AFIO_AF(GPIOC_PIN4, 0) | \ | ||
566 | PIN_AFIO_AF(GPIOC_PIN5, 0) | \ | ||
567 | PIN_AFIO_AF(GPIOC_PIN6, 0) | \ | ||
568 | PIN_AFIO_AF(GPIOC_PIN7, 0)) | ||
569 | #define VAL_GPIOC_AFRH (PIN_AFIO_AF(GPIOC_PIN8, 0) | \ | ||
570 | PIN_AFIO_AF(GPIOC_PIN9, 0) | \ | ||
571 | PIN_AFIO_AF(GPIOC_PIN10, 0) | \ | ||
572 | PIN_AFIO_AF(GPIOC_PIN11, 0) | \ | ||
573 | PIN_AFIO_AF(GPIOC_PIN12, 0) | \ | ||
574 | PIN_AFIO_AF(GPIOC_PIN13, 0) | \ | ||
575 | PIN_AFIO_AF(GPIOC_PIN14, 0) | \ | ||
576 | PIN_AFIO_AF(GPIOC_PIN15, 0)) | ||
577 | |||
578 | /* | ||
579 | * GPIOD setup: | ||
580 | * | ||
581 | * PD0 - PIN0 (input pullup). | ||
582 | * PD1 - PIN1 (input pullup). | ||
583 | * PD2 - PIN2 (input pullup). | ||
584 | * PD3 - PIN3 (input pullup). | ||
585 | * PD4 - PIN4 (input pullup). | ||
586 | * PD5 - PIN5 (input pullup). | ||
587 | * PD6 - PIN6 (input pullup). | ||
588 | * PD7 - PIN7 (input pullup). | ||
589 | * PD8 - PIN8 (input pullup). | ||
590 | * PD9 - PIN9 (input pullup). | ||
591 | * PD11 - PIN10 (input pullup). | ||
592 | * PD11 - PIN11 (input pullup). | ||
593 | * PD12 - PIN12 (input pullup). | ||
594 | * PD13 - PIN13 (input pullup). | ||
595 | * PD14 - PIN14 (input pullup). | ||
596 | * PD15 - PIN15 (input pullup). | ||
597 | */ | ||
598 | #define VAL_GPIOD_MODER (PIN_MODE_INPUT(GPIOD_PIN0) | \ | ||
599 | PIN_MODE_INPUT(GPIOD_PIN1) | \ | ||
600 | PIN_MODE_INPUT(GPIOD_PIN2) | \ | ||
601 | PIN_MODE_INPUT(GPIOD_PIN3) | \ | ||
602 | PIN_MODE_INPUT(GPIOD_PIN4) | \ | ||
603 | PIN_MODE_INPUT(GPIOD_PIN5) | \ | ||
604 | PIN_MODE_INPUT(GPIOD_PIN6) | \ | ||
605 | PIN_MODE_INPUT(GPIOD_PIN7) | \ | ||
606 | PIN_MODE_INPUT(GPIOD_PIN8) | \ | ||
607 | PIN_MODE_INPUT(GPIOD_PIN9) | \ | ||
608 | PIN_MODE_INPUT(GPIOD_PIN10) | \ | ||
609 | PIN_MODE_INPUT(GPIOD_PIN11) | \ | ||
610 | PIN_MODE_INPUT(GPIOD_PIN12) | \ | ||
611 | PIN_MODE_INPUT(GPIOD_PIN13) | \ | ||
612 | PIN_MODE_INPUT(GPIOD_PIN14) | \ | ||
613 | PIN_MODE_INPUT(GPIOD_PIN15)) | ||
614 | #define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(GPIOD_PIN0) | \ | ||
615 | PIN_OTYPE_PUSHPULL(GPIOD_PIN1) | \ | ||
616 | PIN_OTYPE_PUSHPULL(GPIOD_PIN2) | \ | ||
617 | PIN_OTYPE_PUSHPULL(GPIOD_PIN3) | \ | ||
618 | PIN_OTYPE_PUSHPULL(GPIOD_PIN4) | \ | ||
619 | PIN_OTYPE_PUSHPULL(GPIOD_PIN5) | \ | ||
620 | PIN_OTYPE_PUSHPULL(GPIOD_PIN6) | \ | ||
621 | PIN_OTYPE_PUSHPULL(GPIOD_PIN7) | \ | ||
622 | PIN_OTYPE_PUSHPULL(GPIOD_PIN8) | \ | ||
623 | PIN_OTYPE_PUSHPULL(GPIOD_PIN9) | \ | ||
624 | PIN_OTYPE_PUSHPULL(GPIOD_PIN10) | \ | ||
625 | PIN_OTYPE_PUSHPULL(GPIOD_PIN11) | \ | ||
626 | PIN_OTYPE_PUSHPULL(GPIOD_PIN12) | \ | ||
627 | PIN_OTYPE_PUSHPULL(GPIOD_PIN13) | \ | ||
628 | PIN_OTYPE_PUSHPULL(GPIOD_PIN14) | \ | ||
629 | PIN_OTYPE_PUSHPULL(GPIOD_PIN15)) | ||
630 | #define VAL_GPIOD_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOD_PIN0) | \ | ||
631 | PIN_OSPEED_VERYLOW(GPIOD_PIN1) | \ | ||
632 | PIN_OSPEED_VERYLOW(GPIOD_PIN2) | \ | ||
633 | PIN_OSPEED_VERYLOW(GPIOD_PIN3) | \ | ||
634 | PIN_OSPEED_VERYLOW(GPIOD_PIN4) | \ | ||
635 | PIN_OSPEED_VERYLOW(GPIOD_PIN5) | \ | ||
636 | PIN_OSPEED_VERYLOW(GPIOD_PIN6) | \ | ||
637 | PIN_OSPEED_VERYLOW(GPIOD_PIN7) | \ | ||
638 | PIN_OSPEED_VERYLOW(GPIOD_PIN8) | \ | ||
639 | PIN_OSPEED_VERYLOW(GPIOD_PIN9) | \ | ||
640 | PIN_OSPEED_VERYLOW(GPIOD_PIN10) | \ | ||
641 | PIN_OSPEED_VERYLOW(GPIOD_PIN11) | \ | ||
642 | PIN_OSPEED_VERYLOW(GPIOD_PIN12) | \ | ||
643 | PIN_OSPEED_VERYLOW(GPIOD_PIN13) | \ | ||
644 | PIN_OSPEED_VERYLOW(GPIOD_PIN14) | \ | ||
645 | PIN_OSPEED_VERYLOW(GPIOD_PIN15)) | ||
646 | #define VAL_GPIOD_PUPDR (PIN_PUPDR_PULLUP(GPIOD_PIN0) | \ | ||
647 | PIN_PUPDR_PULLUP(GPIOD_PIN1) | \ | ||
648 | PIN_PUPDR_PULLUP(GPIOD_PIN2) | \ | ||
649 | PIN_PUPDR_PULLUP(GPIOD_PIN3) | \ | ||
650 | PIN_PUPDR_PULLUP(GPIOD_PIN4) | \ | ||
651 | PIN_PUPDR_PULLUP(GPIOD_PIN5) | \ | ||
652 | PIN_PUPDR_PULLUP(GPIOD_PIN6) | \ | ||
653 | PIN_PUPDR_PULLUP(GPIOD_PIN7) | \ | ||
654 | PIN_PUPDR_PULLUP(GPIOD_PIN8) | \ | ||
655 | PIN_PUPDR_PULLUP(GPIOD_PIN9) | \ | ||
656 | PIN_PUPDR_PULLUP(GPIOD_PIN10) | \ | ||
657 | PIN_PUPDR_PULLUP(GPIOD_PIN11) | \ | ||
658 | PIN_PUPDR_PULLUP(GPIOD_PIN12) | \ | ||
659 | PIN_PUPDR_PULLUP(GPIOD_PIN13) | \ | ||
660 | PIN_PUPDR_PULLUP(GPIOD_PIN14) | \ | ||
661 | PIN_PUPDR_PULLUP(GPIOD_PIN15)) | ||
662 | #define VAL_GPIOD_ODR (PIN_ODR_HIGH(GPIOD_PIN0) | \ | ||
663 | PIN_ODR_HIGH(GPIOD_PIN1) | \ | ||
664 | PIN_ODR_HIGH(GPIOD_PIN2) | \ | ||
665 | PIN_ODR_HIGH(GPIOD_PIN3) | \ | ||
666 | PIN_ODR_HIGH(GPIOD_PIN4) | \ | ||
667 | PIN_ODR_HIGH(GPIOD_PIN5) | \ | ||
668 | PIN_ODR_HIGH(GPIOD_PIN6) | \ | ||
669 | PIN_ODR_HIGH(GPIOD_PIN7) | \ | ||
670 | PIN_ODR_HIGH(GPIOD_PIN8) | \ | ||
671 | PIN_ODR_HIGH(GPIOD_PIN9) | \ | ||
672 | PIN_ODR_HIGH(GPIOD_PIN10) | \ | ||
673 | PIN_ODR_HIGH(GPIOD_PIN11) | \ | ||
674 | PIN_ODR_HIGH(GPIOD_PIN12) | \ | ||
675 | PIN_ODR_HIGH(GPIOD_PIN13) | \ | ||
676 | PIN_ODR_HIGH(GPIOD_PIN14) | \ | ||
677 | PIN_ODR_HIGH(GPIOD_PIN15)) | ||
678 | #define VAL_GPIOD_AFRL (PIN_AFIO_AF(GPIOD_PIN0, 0) | \ | ||
679 | PIN_AFIO_AF(GPIOD_PIN1, 0) | \ | ||
680 | PIN_AFIO_AF(GPIOD_PIN2, 0) | \ | ||
681 | PIN_AFIO_AF(GPIOD_PIN3, 0) | \ | ||
682 | PIN_AFIO_AF(GPIOD_PIN4, 0) | \ | ||
683 | PIN_AFIO_AF(GPIOD_PIN5, 0) | \ | ||
684 | PIN_AFIO_AF(GPIOD_PIN6, 0) | \ | ||
685 | PIN_AFIO_AF(GPIOD_PIN7, 0)) | ||
686 | #define VAL_GPIOD_AFRH (PIN_AFIO_AF(GPIOD_PIN8, 0) | \ | ||
687 | PIN_AFIO_AF(GPIOD_PIN9, 0) | \ | ||
688 | PIN_AFIO_AF(GPIOD_PIN10, 0) | \ | ||
689 | PIN_AFIO_AF(GPIOD_PIN11, 0) | \ | ||
690 | PIN_AFIO_AF(GPIOD_PIN12, 0) | \ | ||
691 | PIN_AFIO_AF(GPIOD_PIN13, 0) | \ | ||
692 | PIN_AFIO_AF(GPIOD_PIN14, 0) | \ | ||
693 | PIN_AFIO_AF(GPIOD_PIN15, 0)) | ||
694 | |||
695 | /* | ||
696 | * GPIOE setup: | ||
697 | * | ||
698 | * PE0 - PIN0 (input pullup). | ||
699 | * PE1 - PIN1 (input pullup). | ||
700 | * PE2 - PIN2 (input pullup). | ||
701 | * PE3 - PIN3 L3GD20_CS (output pushpull maximum). | ||
702 | * PE4 - PIN4 (input pullup). | ||
703 | * PE5 - PIN5 (input pullup). | ||
704 | * PE6 - PIN6 (input pullup). | ||
705 | * PE7 - PIN7 (input pullup). | ||
706 | * PE8 - PIN8 (output pushpull maximum). | ||
707 | * PE9 - PIN9 (output pushpull maximum). | ||
708 | * PE10 - PIN10 (output pushpull maximum). | ||
709 | * PE11 - PIN11 (output pushpull maximum). | ||
710 | * PE12 - PIN12 (output pushpull maximum). | ||
711 | * PE13 - PIN13 (output pushpull maximum). | ||
712 | * PE14 - PIN14 (output pushpull maximum). | ||
713 | * PE15 - PIN15 (output pushpull maximum). | ||
714 | */ | ||
715 | #define VAL_GPIOE_MODER (PIN_MODE_INPUT(GPIOE_PIN0) | \ | ||
716 | PIN_MODE_INPUT(GPIOE_PIN1) | \ | ||
717 | PIN_MODE_INPUT(GPIOE_PIN2) |\ | ||
718 | PIN_MODE_OUTPUT(GPIOE_PIN3) | \ | ||
719 | PIN_MODE_INPUT(GPIOE_PIN4) |\ | ||
720 | PIN_MODE_INPUT(GPIOE_PIN5) |\ | ||
721 | PIN_MODE_INPUT(GPIOE_PIN6) | \ | ||
722 | PIN_MODE_INPUT(GPIOE_PIN7) | \ | ||
723 | PIN_MODE_OUTPUT(GPIOE_PIN8) | \ | ||
724 | PIN_MODE_OUTPUT(GPIOE_PIN9) | \ | ||
725 | PIN_MODE_OUTPUT(GPIOE_PIN10) | \ | ||
726 | PIN_MODE_OUTPUT(GPIOE_PIN11) | \ | ||
727 | PIN_MODE_OUTPUT(GPIOE_PIN12) | \ | ||
728 | PIN_MODE_OUTPUT(GPIOE_PIN13) | \ | ||
729 | PIN_MODE_OUTPUT(GPIOE_PIN14) | \ | ||
730 | PIN_MODE_OUTPUT(GPIOE_PIN15)) | ||
731 | #define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(GPIOE_PIN0) |\ | ||
732 | PIN_OTYPE_PUSHPULL(GPIOE_PIN1) |\ | ||
733 | PIN_OTYPE_PUSHPULL(GPIOE_PIN2) |\ | ||
734 | PIN_OTYPE_PUSHPULL(GPIOE_PIN3) | \ | ||
735 | PIN_OTYPE_PUSHPULL(GPIOE_PIN4) |\ | ||
736 | PIN_OTYPE_PUSHPULL(GPIOE_PIN5) |\ | ||
737 | PIN_OTYPE_PUSHPULL(GPIOE_PIN6) | \ | ||
738 | PIN_OTYPE_PUSHPULL(GPIOE_PIN7) | \ | ||
739 | PIN_OTYPE_PUSHPULL(GPIOE_PIN8) | \ | ||
740 | PIN_OTYPE_PUSHPULL(GPIOE_PIN9) | \ | ||
741 | PIN_OTYPE_PUSHPULL(GPIOE_PIN10) |\ | ||
742 | PIN_OTYPE_PUSHPULL(GPIOE_PIN11) | \ | ||
743 | PIN_OTYPE_PUSHPULL(GPIOE_PIN12) | \ | ||
744 | PIN_OTYPE_PUSHPULL(GPIOE_PIN13) | \ | ||
745 | PIN_OTYPE_PUSHPULL(GPIOE_PIN14) |\ | ||
746 | PIN_OTYPE_PUSHPULL(GPIOE_PIN15)) | ||
747 | #define VAL_GPIOE_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOE_PIN0) |\ | ||
748 | PIN_OSPEED_VERYLOW(GPIOE_PIN1) |\ | ||
749 | PIN_OSPEED_VERYLOW(GPIOE_PIN2) |\ | ||
750 | PIN_OSPEED_HIGH(GPIOE_PIN3) | \ | ||
751 | PIN_OSPEED_VERYLOW(GPIOE_PIN4) |\ | ||
752 | PIN_OSPEED_VERYLOW(GPIOE_PIN5) |\ | ||
753 | PIN_OSPEED_VERYLOW(GPIOE_PIN6) | \ | ||
754 | PIN_OSPEED_VERYLOW(GPIOE_PIN7) | \ | ||
755 | PIN_OSPEED_HIGH(GPIOE_PIN8) | \ | ||
756 | PIN_OSPEED_HIGH(GPIOE_PIN9) | \ | ||
757 | PIN_OSPEED_HIGH(GPIOE_PIN10) | \ | ||
758 | PIN_OSPEED_HIGH(GPIOE_PIN11) | \ | ||
759 | PIN_OSPEED_HIGH(GPIOE_PIN12) | \ | ||
760 | PIN_OSPEED_HIGH(GPIOE_PIN13) | \ | ||
761 | PIN_OSPEED_HIGH(GPIOE_PIN14) | \ | ||
762 | PIN_OSPEED_HIGH(GPIOE_PIN15)) | ||
763 | #define VAL_GPIOE_PUPDR (PIN_PUPDR_PULLUP(GPIOE_PIN0) | \ | ||
764 | PIN_PUPDR_PULLUP(GPIOE_PIN1) | \ | ||
765 | PIN_PUPDR_PULLUP(GPIOE_PIN2) |\ | ||
766 | PIN_PUPDR_FLOATING(GPIOE_PIN3) | \ | ||
767 | PIN_PUPDR_PULLUP(GPIOE_PIN4) |\ | ||
768 | PIN_PUPDR_PULLUP(GPIOE_PIN5) |\ | ||
769 | PIN_PUPDR_PULLUP(GPIOE_PIN6) | \ | ||
770 | PIN_PUPDR_PULLUP(GPIOE_PIN7) | \ | ||
771 | PIN_PUPDR_PULLUP(GPIOE_PIN8) | \ | ||
772 | PIN_PUPDR_PULLUP(GPIOE_PIN9) | \ | ||
773 | PIN_PUPDR_PULLUP(GPIOE_PIN10) | \ | ||
774 | PIN_PUPDR_FLOATING(GPIOE_PIN11) | \ | ||
775 | PIN_PUPDR_PULLUP(GPIOE_PIN12) | \ | ||
776 | PIN_PUPDR_FLOATING(GPIOE_PIN13) | \ | ||
777 | PIN_PUPDR_FLOATING(GPIOE_PIN14) |\ | ||
778 | PIN_PUPDR_FLOATING(GPIOE_PIN15)) | ||
779 | #define VAL_GPIOE_ODR (PIN_ODR_HIGH(GPIOE_PIN0) | \ | ||
780 | PIN_ODR_HIGH(GPIOE_PIN1) | \ | ||
781 | PIN_ODR_HIGH(GPIOE_PIN2) | \ | ||
782 | PIN_ODR_HIGH(GPIOE_PIN3) | \ | ||
783 | PIN_ODR_HIGH(GPIOE_PIN4) | \ | ||
784 | PIN_ODR_HIGH(GPIOE_PIN5) | \ | ||
785 | PIN_ODR_HIGH(GPIOE_PIN6) | \ | ||
786 | PIN_ODR_HIGH(GPIOE_PIN7) | \ | ||
787 | PIN_ODR_LOW(GPIOE_PIN8) | \ | ||
788 | PIN_ODR_LOW(GPIOE_PIN9) | \ | ||
789 | PIN_ODR_LOW(GPIOE_PIN10) | \ | ||
790 | PIN_ODR_LOW(GPIOE_PIN11) | \ | ||
791 | PIN_ODR_LOW(GPIOE_PIN12) | \ | ||
792 | PIN_ODR_LOW(GPIOE_PIN13) | \ | ||
793 | PIN_ODR_LOW(GPIOE_PIN14) | \ | ||
794 | PIN_ODR_LOW(GPIOE_PIN15)) | ||
795 | #define VAL_GPIOE_AFRL (PIN_AFIO_AF(GPIOE_PIN0, 0) | \ | ||
796 | PIN_AFIO_AF(GPIOE_PIN1, 0) | \ | ||
797 | PIN_AFIO_AF(GPIOE_PIN2, 0) |\ | ||
798 | PIN_AFIO_AF(GPIOE_PIN3, 0) | \ | ||
799 | PIN_AFIO_AF(GPIOE_PIN4, 0) |\ | ||
800 | PIN_AFIO_AF(GPIOE_PIN5, 0) |\ | ||
801 | PIN_AFIO_AF(GPIOE_PIN6, 0) | \ | ||
802 | PIN_AFIO_AF(GPIOE_PIN7, 0)) | ||
803 | #define VAL_GPIOE_AFRH (PIN_AFIO_AF(GPIOE_PIN8, 0) | \ | ||
804 | PIN_AFIO_AF(GPIOE_PIN9, 0) | \ | ||
805 | PIN_AFIO_AF(GPIOE_PIN10, 0) | \ | ||
806 | PIN_AFIO_AF(GPIOE_PIN11, 0) | \ | ||
807 | PIN_AFIO_AF(GPIOE_PIN12, 0) | \ | ||
808 | PIN_AFIO_AF(GPIOE_PIN13, 0) | \ | ||
809 | PIN_AFIO_AF(GPIOE_PIN14, 0) | \ | ||
810 | PIN_AFIO_AF(GPIOE_PIN15, 0)) | ||
811 | |||
812 | /* | ||
813 | * GPIOF setup: | ||
814 | * | ||
815 | * PF0 - I2C2_SDA (input floating). | ||
816 | * PF1 - I2C2_SCL (input floating). | ||
817 | * PF2 - PIN2 (input pullup). | ||
818 | * PF3 - PIN3 (input pullup). | ||
819 | * PF4 - PIN4 (input pullup). | ||
820 | * PF5 - PIN5 (input pullup). | ||
821 | * PF6 - PIN6 (input pullup). | ||
822 | * PF7 - PIN7 (input pullup). | ||
823 | * PF8 - PIN8 (input pullup). | ||
824 | * PF9 - PIN9 (input pullup). | ||
825 | * PF10 - PIN10 (input pullup). | ||
826 | * PF11 - PIN11 (input pullup). | ||
827 | * PF12 - PIN12 (input pullup). | ||
828 | * PF13 - PIN13 (input pullup). | ||
829 | * PF14 - PIN14 (input pullup). | ||
830 | * PF15 - PIN15 (input pullup). | ||
831 | */ | ||
832 | #define VAL_GPIOF_MODER (PIN_MODE_INPUT(GPIOF_I2C2_SDA) | \ | ||
833 | PIN_MODE_INPUT(GPIOF_I2C2_SCL) | \ | ||
834 | PIN_MODE_INPUT(GPIOF_PIN2) | \ | ||
835 | PIN_MODE_INPUT(GPIOF_PIN3) | \ | ||
836 | PIN_MODE_INPUT(GPIOF_PIN4) | \ | ||
837 | PIN_MODE_INPUT(GPIOF_PIN5) | \ | ||
838 | PIN_MODE_INPUT(GPIOF_PIN6) | \ | ||
839 | PIN_MODE_INPUT(GPIOF_PIN7) | \ | ||
840 | PIN_MODE_INPUT(GPIOF_PIN8) | \ | ||
841 | PIN_MODE_INPUT(GPIOF_PIN9) | \ | ||
842 | PIN_MODE_INPUT(GPIOF_PIN10) | \ | ||
843 | PIN_MODE_INPUT(GPIOF_PIN11) | \ | ||
844 | PIN_MODE_INPUT(GPIOF_PIN12) | \ | ||
845 | PIN_MODE_INPUT(GPIOF_PIN13) | \ | ||
846 | PIN_MODE_INPUT(GPIOF_PIN14) | \ | ||
847 | PIN_MODE_INPUT(GPIOF_PIN15)) | ||
848 | #define VAL_GPIOF_OTYPER (PIN_OTYPE_PUSHPULL(GPIOF_I2C2_SDA) | \ | ||
849 | PIN_OTYPE_PUSHPULL(GPIOF_I2C2_SCL) | \ | ||
850 | PIN_OTYPE_PUSHPULL(GPIOF_PIN2) | \ | ||
851 | PIN_OTYPE_PUSHPULL(GPIOF_PIN3) | \ | ||
852 | PIN_OTYPE_PUSHPULL(GPIOF_PIN4) | \ | ||
853 | PIN_OTYPE_PUSHPULL(GPIOF_PIN5) | \ | ||
854 | PIN_OTYPE_PUSHPULL(GPIOF_PIN6) | \ | ||
855 | PIN_OTYPE_PUSHPULL(GPIOF_PIN7) | \ | ||
856 | PIN_OTYPE_PUSHPULL(GPIOF_PIN8) | \ | ||
857 | PIN_OTYPE_PUSHPULL(GPIOF_PIN9) | \ | ||
858 | PIN_OTYPE_PUSHPULL(GPIOF_PIN10) | \ | ||
859 | PIN_OTYPE_PUSHPULL(GPIOF_PIN11) | \ | ||
860 | PIN_OTYPE_PUSHPULL(GPIOF_PIN12) | \ | ||
861 | PIN_OTYPE_PUSHPULL(GPIOF_PIN13) | \ | ||
862 | PIN_OTYPE_PUSHPULL(GPIOF_PIN14) | \ | ||
863 | PIN_OTYPE_PUSHPULL(GPIOF_PIN15)) | ||
864 | #define VAL_GPIOF_OSPEEDR (PIN_OSPEED_HIGH(GPIOF_I2C2_SDA) | \ | ||
865 | PIN_OSPEED_HIGH(GPIOF_I2C2_SCL) | \ | ||
866 | PIN_OSPEED_VERYLOW(GPIOF_PIN2) | \ | ||
867 | PIN_OSPEED_VERYLOW(GPIOF_PIN3) | \ | ||
868 | PIN_OSPEED_VERYLOW(GPIOF_PIN4) | \ | ||
869 | PIN_OSPEED_VERYLOW(GPIOF_PIN5) | \ | ||
870 | PIN_OSPEED_VERYLOW(GPIOF_PIN6) | \ | ||
871 | PIN_OSPEED_VERYLOW(GPIOF_PIN7) | \ | ||
872 | PIN_OSPEED_VERYLOW(GPIOF_PIN8) | \ | ||
873 | PIN_OSPEED_VERYLOW(GPIOF_PIN9) | \ | ||
874 | PIN_OSPEED_VERYLOW(GPIOF_PIN10) | \ | ||
875 | PIN_OSPEED_VERYLOW(GPIOF_PIN11) | \ | ||
876 | PIN_OSPEED_VERYLOW(GPIOF_PIN12) | \ | ||
877 | PIN_OSPEED_VERYLOW(GPIOF_PIN13) | \ | ||
878 | PIN_OSPEED_VERYLOW(GPIOF_PIN14) | \ | ||
879 | PIN_OSPEED_VERYLOW(GPIOF_PIN15)) | ||
880 | #define VAL_GPIOF_PUPDR (PIN_PUPDR_FLOATING(GPIOF_I2C2_SDA) | \ | ||
881 | PIN_PUPDR_FLOATING(GPIOF_I2C2_SCL) | \ | ||
882 | PIN_PUPDR_PULLUP(GPIOF_PIN2) | \ | ||
883 | PIN_PUPDR_PULLUP(GPIOF_PIN3) | \ | ||
884 | PIN_PUPDR_PULLUP(GPIOF_PIN4) | \ | ||
885 | PIN_PUPDR_PULLUP(GPIOF_PIN5) | \ | ||
886 | PIN_PUPDR_PULLUP(GPIOF_PIN6) | \ | ||
887 | PIN_PUPDR_PULLUP(GPIOF_PIN7) | \ | ||
888 | PIN_PUPDR_PULLUP(GPIOF_PIN8) | \ | ||
889 | PIN_PUPDR_PULLUP(GPIOF_PIN9) | \ | ||
890 | PIN_PUPDR_PULLUP(GPIOF_PIN10) | \ | ||
891 | PIN_PUPDR_PULLUP(GPIOF_PIN11) | \ | ||
892 | PIN_PUPDR_PULLUP(GPIOF_PIN12) | \ | ||
893 | PIN_PUPDR_PULLUP(GPIOF_PIN13) | \ | ||
894 | PIN_PUPDR_PULLUP(GPIOF_PIN14) | \ | ||
895 | PIN_PUPDR_PULLUP(GPIOF_PIN15)) | ||
896 | #define VAL_GPIOF_ODR (PIN_ODR_HIGH(GPIOF_I2C2_SDA) | \ | ||
897 | PIN_ODR_HIGH(GPIOF_I2C2_SCL) | \ | ||
898 | PIN_ODR_HIGH(GPIOF_PIN2) | \ | ||
899 | PIN_ODR_HIGH(GPIOF_PIN3) | \ | ||
900 | PIN_ODR_HIGH(GPIOF_PIN4) | \ | ||
901 | PIN_ODR_HIGH(GPIOF_PIN5) | \ | ||
902 | PIN_ODR_HIGH(GPIOF_PIN6) | \ | ||
903 | PIN_ODR_HIGH(GPIOF_PIN7) | \ | ||
904 | PIN_ODR_HIGH(GPIOF_PIN8) | \ | ||
905 | PIN_ODR_HIGH(GPIOF_PIN9) | \ | ||
906 | PIN_ODR_HIGH(GPIOF_PIN10) | \ | ||
907 | PIN_ODR_HIGH(GPIOF_PIN11) | \ | ||
908 | PIN_ODR_HIGH(GPIOF_PIN12) | \ | ||
909 | PIN_ODR_HIGH(GPIOF_PIN13) | \ | ||
910 | PIN_ODR_HIGH(GPIOF_PIN14) | \ | ||
911 | PIN_ODR_HIGH(GPIOF_PIN15)) | ||
912 | #define VAL_GPIOF_AFRL (PIN_AFIO_AF(GPIOF_I2C2_SDA, 0) | \ | ||
913 | PIN_AFIO_AF(GPIOF_I2C2_SCL, 0) | \ | ||
914 | PIN_AFIO_AF(GPIOF_PIN2, 0) | \ | ||
915 | PIN_AFIO_AF(GPIOF_PIN3, 0) | \ | ||
916 | PIN_AFIO_AF(GPIOF_PIN4, 0) | \ | ||
917 | PIN_AFIO_AF(GPIOF_PIN5, 0) | \ | ||
918 | PIN_AFIO_AF(GPIOF_PIN6, 0) | \ | ||
919 | PIN_AFIO_AF(GPIOF_PIN7, 0)) | ||
920 | #define VAL_GPIOF_AFRH (PIN_AFIO_AF(GPIOF_PIN8, 0) | \ | ||
921 | PIN_AFIO_AF(GPIOF_PIN9, 0) | \ | ||
922 | PIN_AFIO_AF(GPIOF_PIN10, 0) | \ | ||
923 | PIN_AFIO_AF(GPIOF_PIN11, 0) | \ | ||
924 | PIN_AFIO_AF(GPIOF_PIN12, 0) | \ | ||
925 | PIN_AFIO_AF(GPIOF_PIN13, 0) | \ | ||
926 | PIN_AFIO_AF(GPIOF_PIN14, 0) | \ | ||
927 | PIN_AFIO_AF(GPIOF_PIN15, 0)) | ||
928 | |||
929 | /* | ||
930 | * GPIOG setup: | ||
931 | * | ||
932 | * PG0 - PIN0 (input pullup). | ||
933 | * PG1 - PIN1 (input pullup). | ||
934 | * PG2 - PIN2 (input pullup). | ||
935 | * PG3 - PIN3 (input pullup). | ||
936 | * PG4 - PIN4 (input pullup). | ||
937 | * PG5 - PIN5 (input pullup). | ||
938 | * PG6 - PIN6 (input pullup). | ||
939 | * PG7 - PIN7 (input pullup). | ||
940 | * PG8 - PIN8 (input pullup). | ||
941 | * PG9 - PIN9 (input pullup). | ||
942 | * PG10 - PIN10 (input pullup). | ||
943 | * PG11 - PIN11 (input pullup). | ||
944 | * PG12 - PIN12 (input pullup). | ||
945 | * PG13 - PIN13 (input pullup). | ||
946 | * PG14 - PIN14 (input pullup). | ||
947 | * PG15 - PIN15 (input pullup). | ||
948 | */ | ||
949 | #define VAL_GPIOG_MODER (PIN_MODE_INPUT(GPIOG_PIN0) | \ | ||
950 | PIN_MODE_INPUT(GPIOG_PIN1) | \ | ||
951 | PIN_MODE_INPUT(GPIOG_PIN2) | \ | ||
952 | PIN_MODE_INPUT(GPIOG_PIN3) | \ | ||
953 | PIN_MODE_INPUT(GPIOG_PIN4) | \ | ||
954 | PIN_MODE_INPUT(GPIOG_PIN5) | \ | ||
955 | PIN_MODE_INPUT(GPIOG_PIN6) | \ | ||
956 | PIN_MODE_INPUT(GPIOG_PIN7) | \ | ||
957 | PIN_MODE_INPUT(GPIOG_PIN8) | \ | ||
958 | PIN_MODE_INPUT(GPIOG_PIN9) | \ | ||
959 | PIN_MODE_INPUT(GPIOG_PIN10) | \ | ||
960 | PIN_MODE_INPUT(GPIOG_PIN11) | \ | ||
961 | PIN_MODE_INPUT(GPIOG_PIN12) | \ | ||
962 | PIN_MODE_INPUT(GPIOG_PIN13) | \ | ||
963 | PIN_MODE_INPUT(GPIOG_PIN14) | \ | ||
964 | PIN_MODE_INPUT(GPIOG_PIN15)) | ||
965 | #define VAL_GPIOG_OTYPER (PIN_OTYPE_PUSHPULL(GPIOG_PIN0) | \ | ||
966 | PIN_OTYPE_PUSHPULL(GPIOG_PIN1) | \ | ||
967 | PIN_OTYPE_PUSHPULL(GPIOG_PIN2) | \ | ||
968 | PIN_OTYPE_PUSHPULL(GPIOG_PIN3) | \ | ||
969 | PIN_OTYPE_PUSHPULL(GPIOG_PIN4) | \ | ||
970 | PIN_OTYPE_PUSHPULL(GPIOG_PIN5) | \ | ||
971 | PIN_OTYPE_PUSHPULL(GPIOG_PIN6) | \ | ||
972 | PIN_OTYPE_PUSHPULL(GPIOG_PIN7) | \ | ||
973 | PIN_OTYPE_PUSHPULL(GPIOG_PIN8) | \ | ||
974 | PIN_OTYPE_PUSHPULL(GPIOG_PIN9) | \ | ||
975 | PIN_OTYPE_PUSHPULL(GPIOG_PIN10) | \ | ||
976 | PIN_OTYPE_PUSHPULL(GPIOG_PIN11) | \ | ||
977 | PIN_OTYPE_PUSHPULL(GPIOG_PIN12) | \ | ||
978 | PIN_OTYPE_PUSHPULL(GPIOG_PIN13) | \ | ||
979 | PIN_OTYPE_PUSHPULL(GPIOG_PIN14) | \ | ||
980 | PIN_OTYPE_PUSHPULL(GPIOG_PIN15)) | ||
981 | #define VAL_GPIOG_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOG_PIN0) | \ | ||
982 | PIN_OSPEED_VERYLOW(GPIOG_PIN1) | \ | ||
983 | PIN_OSPEED_VERYLOW(GPIOG_PIN2) | \ | ||
984 | PIN_OSPEED_VERYLOW(GPIOG_PIN3) | \ | ||
985 | PIN_OSPEED_VERYLOW(GPIOG_PIN4) | \ | ||
986 | PIN_OSPEED_VERYLOW(GPIOG_PIN5) | \ | ||
987 | PIN_OSPEED_VERYLOW(GPIOG_PIN6) | \ | ||
988 | PIN_OSPEED_VERYLOW(GPIOG_PIN7) | \ | ||
989 | PIN_OSPEED_VERYLOW(GPIOG_PIN8) | \ | ||
990 | PIN_OSPEED_VERYLOW(GPIOG_PIN9) | \ | ||
991 | PIN_OSPEED_VERYLOW(GPIOG_PIN10) | \ | ||
992 | PIN_OSPEED_VERYLOW(GPIOG_PIN11) | \ | ||
993 | PIN_OSPEED_VERYLOW(GPIOG_PIN12) | \ | ||
994 | PIN_OSPEED_VERYLOW(GPIOG_PIN13) | \ | ||
995 | PIN_OSPEED_VERYLOW(GPIOG_PIN14) | \ | ||
996 | PIN_OSPEED_VERYLOW(GPIOG_PIN15)) | ||
997 | #define VAL_GPIOG_PUPDR (PIN_PUPDR_PULLUP(GPIOG_PIN0) | \ | ||
998 | PIN_PUPDR_PULLUP(GPIOG_PIN1) | \ | ||
999 | PIN_PUPDR_PULLUP(GPIOG_PIN2) | \ | ||
1000 | PIN_PUPDR_PULLUP(GPIOG_PIN3) | \ | ||
1001 | PIN_PUPDR_PULLUP(GPIOG_PIN4) | \ | ||
1002 | PIN_PUPDR_PULLUP(GPIOG_PIN5) | \ | ||
1003 | PIN_PUPDR_PULLUP(GPIOG_PIN6) | \ | ||
1004 | PIN_PUPDR_PULLUP(GPIOG_PIN7) | \ | ||
1005 | PIN_PUPDR_PULLUP(GPIOG_PIN8) | \ | ||
1006 | PIN_PUPDR_PULLUP(GPIOG_PIN9) | \ | ||
1007 | PIN_PUPDR_PULLUP(GPIOG_PIN10) | \ | ||
1008 | PIN_PUPDR_PULLUP(GPIOG_PIN11) | \ | ||
1009 | PIN_PUPDR_PULLUP(GPIOG_PIN12) | \ | ||
1010 | PIN_PUPDR_PULLUP(GPIOG_PIN13) | \ | ||
1011 | PIN_PUPDR_PULLUP(GPIOG_PIN14) | \ | ||
1012 | PIN_PUPDR_PULLUP(GPIOG_PIN15)) | ||
1013 | #define VAL_GPIOG_ODR (PIN_ODR_HIGH(GPIOG_PIN0) | \ | ||
1014 | PIN_ODR_HIGH(GPIOG_PIN1) | \ | ||
1015 | PIN_ODR_HIGH(GPIOG_PIN2) | \ | ||
1016 | PIN_ODR_HIGH(GPIOG_PIN3) | \ | ||
1017 | PIN_ODR_HIGH(GPIOG_PIN4) | \ | ||
1018 | PIN_ODR_HIGH(GPIOG_PIN5) | \ | ||
1019 | PIN_ODR_HIGH(GPIOG_PIN6) | \ | ||
1020 | PIN_ODR_HIGH(GPIOG_PIN7) | \ | ||
1021 | PIN_ODR_HIGH(GPIOG_PIN8) | \ | ||
1022 | PIN_ODR_HIGH(GPIOG_PIN9) | \ | ||
1023 | PIN_ODR_HIGH(GPIOG_PIN10) | \ | ||
1024 | PIN_ODR_HIGH(GPIOG_PIN11) | \ | ||
1025 | PIN_ODR_HIGH(GPIOG_PIN12) | \ | ||
1026 | PIN_ODR_HIGH(GPIOG_PIN13) | \ | ||
1027 | PIN_ODR_HIGH(GPIOG_PIN14) | \ | ||
1028 | PIN_ODR_HIGH(GPIOG_PIN15)) | ||
1029 | #define VAL_GPIOG_AFRL (PIN_AFIO_AF(GPIOG_PIN0, 0) | \ | ||
1030 | PIN_AFIO_AF(GPIOG_PIN1, 0) | \ | ||
1031 | PIN_AFIO_AF(GPIOG_PIN2, 0) | \ | ||
1032 | PIN_AFIO_AF(GPIOG_PIN3, 0) | \ | ||
1033 | PIN_AFIO_AF(GPIOG_PIN4, 0) | \ | ||
1034 | PIN_AFIO_AF(GPIOG_PIN5, 0) | \ | ||
1035 | PIN_AFIO_AF(GPIOG_PIN6, 0) | \ | ||
1036 | PIN_AFIO_AF(GPIOG_PIN7, 0)) | ||
1037 | #define VAL_GPIOG_AFRH (PIN_AFIO_AF(GPIOG_PIN8, 0) | \ | ||
1038 | PIN_AFIO_AF(GPIOG_PIN9, 0) | \ | ||
1039 | PIN_AFIO_AF(GPIOG_PIN10, 0) | \ | ||
1040 | PIN_AFIO_AF(GPIOG_PIN11, 0) | \ | ||
1041 | PIN_AFIO_AF(GPIOG_PIN12, 0) | \ | ||
1042 | PIN_AFIO_AF(GPIOG_PIN13, 0) | \ | ||
1043 | PIN_AFIO_AF(GPIOG_PIN14, 0) | \ | ||
1044 | PIN_AFIO_AF(GPIOG_PIN15, 0)) | ||
1045 | |||
1046 | /* | ||
1047 | * GPIOH setup: | ||
1048 | * | ||
1049 | * PH0 - PIN0 (input pullup). | ||
1050 | * PH1 - PIN1 (input pullup). | ||
1051 | * PH2 - PIN2 (input pullup). | ||
1052 | * PH3 - PIN3 (input pullup). | ||
1053 | * PH4 - PIN4 (input pullup). | ||
1054 | * PH5 - PIN5 (input pullup). | ||
1055 | * PH6 - PIN6 (input pullup). | ||
1056 | * PH7 - PIN7 (input pullup). | ||
1057 | * PH8 - PIN8 (input pullup). | ||
1058 | * PH9 - PIN9 (input pullup). | ||
1059 | * PH10 - PIN10 (input pullup). | ||
1060 | * PH11 - PIN11 (input pullup). | ||
1061 | * PH12 - PIN12 (input pullup). | ||
1062 | * PH13 - PIN13 (input pullup). | ||
1063 | * PH14 - PIN14 (input pullup). | ||
1064 | * PH15 - PIN15 (input pullup). | ||
1065 | */ | ||
1066 | #define VAL_GPIOH_MODER (PIN_MODE_INPUT(GPIOH_PIN0) | \ | ||
1067 | PIN_MODE_INPUT(GPIOH_PIN1) | \ | ||
1068 | PIN_MODE_INPUT(GPIOH_PIN2) | \ | ||
1069 | PIN_MODE_INPUT(GPIOH_PIN3) | \ | ||
1070 | PIN_MODE_INPUT(GPIOH_PIN4) | \ | ||
1071 | PIN_MODE_INPUT(GPIOH_PIN5) | \ | ||
1072 | PIN_MODE_INPUT(GPIOH_PIN6) | \ | ||
1073 | PIN_MODE_INPUT(GPIOH_PIN7) | \ | ||
1074 | PIN_MODE_INPUT(GPIOH_PIN8) | \ | ||
1075 | PIN_MODE_INPUT(GPIOH_PIN9) | \ | ||
1076 | PIN_MODE_INPUT(GPIOH_PIN10) | \ | ||
1077 | PIN_MODE_INPUT(GPIOH_PIN11) | \ | ||
1078 | PIN_MODE_INPUT(GPIOH_PIN12) | \ | ||
1079 | PIN_MODE_INPUT(GPIOH_PIN13) | \ | ||
1080 | PIN_MODE_INPUT(GPIOH_PIN14) | \ | ||
1081 | PIN_MODE_INPUT(GPIOH_PIN15)) | ||
1082 | #define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(GPIOH_PIN0) | \ | ||
1083 | PIN_OTYPE_PUSHPULL(GPIOH_PIN1) | \ | ||
1084 | PIN_OTYPE_PUSHPULL(GPIOH_PIN2) | \ | ||
1085 | PIN_OTYPE_PUSHPULL(GPIOH_PIN3) | \ | ||
1086 | PIN_OTYPE_PUSHPULL(GPIOH_PIN4) | \ | ||
1087 | PIN_OTYPE_PUSHPULL(GPIOH_PIN5) | \ | ||
1088 | PIN_OTYPE_PUSHPULL(GPIOH_PIN6) | \ | ||
1089 | PIN_OTYPE_PUSHPULL(GPIOH_PIN7) | \ | ||
1090 | PIN_OTYPE_PUSHPULL(GPIOH_PIN8) | \ | ||
1091 | PIN_OTYPE_PUSHPULL(GPIOH_PIN9) | \ | ||
1092 | PIN_OTYPE_PUSHPULL(GPIOH_PIN10) | \ | ||
1093 | PIN_OTYPE_PUSHPULL(GPIOH_PIN11) | \ | ||
1094 | PIN_OTYPE_PUSHPULL(GPIOH_PIN12) | \ | ||
1095 | PIN_OTYPE_PUSHPULL(GPIOH_PIN13) | \ | ||
1096 | PIN_OTYPE_PUSHPULL(GPIOH_PIN14) | \ | ||
1097 | PIN_OTYPE_PUSHPULL(GPIOH_PIN15)) | ||
1098 | #define VAL_GPIOH_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOH_PIN0) | \ | ||
1099 | PIN_OSPEED_VERYLOW(GPIOH_PIN1) | \ | ||
1100 | PIN_OSPEED_VERYLOW(GPIOH_PIN2) | \ | ||
1101 | PIN_OSPEED_VERYLOW(GPIOH_PIN3) | \ | ||
1102 | PIN_OSPEED_VERYLOW(GPIOH_PIN4) | \ | ||
1103 | PIN_OSPEED_VERYLOW(GPIOH_PIN5) | \ | ||
1104 | PIN_OSPEED_VERYLOW(GPIOH_PIN6) | \ | ||
1105 | PIN_OSPEED_VERYLOW(GPIOH_PIN7) | \ | ||
1106 | PIN_OSPEED_VERYLOW(GPIOH_PIN8) | \ | ||
1107 | PIN_OSPEED_VERYLOW(GPIOH_PIN9) | \ | ||
1108 | PIN_OSPEED_VERYLOW(GPIOH_PIN10) | \ | ||
1109 | PIN_OSPEED_VERYLOW(GPIOH_PIN11) | \ | ||
1110 | PIN_OSPEED_VERYLOW(GPIOH_PIN12) | \ | ||
1111 | PIN_OSPEED_VERYLOW(GPIOH_PIN13) | \ | ||
1112 | PIN_OSPEED_VERYLOW(GPIOH_PIN14) | \ | ||
1113 | PIN_OSPEED_VERYLOW(GPIOH_PIN15)) | ||
1114 | #define VAL_GPIOH_PUPDR (PIN_PUPDR_PULLUP(GPIOH_PIN0) | \ | ||
1115 | PIN_PUPDR_PULLUP(GPIOH_PIN1) | \ | ||
1116 | PIN_PUPDR_PULLUP(GPIOH_PIN2) | \ | ||
1117 | PIN_PUPDR_PULLUP(GPIOH_PIN3) | \ | ||
1118 | PIN_PUPDR_PULLUP(GPIOH_PIN4) | \ | ||
1119 | PIN_PUPDR_PULLUP(GPIOH_PIN5) | \ | ||
1120 | PIN_PUPDR_PULLUP(GPIOH_PIN6) | \ | ||
1121 | PIN_PUPDR_PULLUP(GPIOH_PIN7) | \ | ||
1122 | PIN_PUPDR_PULLUP(GPIOH_PIN8) | \ | ||
1123 | PIN_PUPDR_PULLUP(GPIOH_PIN9) | \ | ||
1124 | PIN_PUPDR_PULLUP(GPIOH_PIN10) | \ | ||
1125 | PIN_PUPDR_PULLUP(GPIOH_PIN11) | \ | ||
1126 | PIN_PUPDR_PULLUP(GPIOH_PIN12) | \ | ||
1127 | PIN_PUPDR_PULLUP(GPIOH_PIN13) | \ | ||
1128 | PIN_PUPDR_PULLUP(GPIOH_PIN14) | \ | ||
1129 | PIN_PUPDR_PULLUP(GPIOH_PIN15)) | ||
1130 | #define VAL_GPIOH_ODR (PIN_ODR_HIGH(GPIOH_PIN0) | \ | ||
1131 | PIN_ODR_HIGH(GPIOH_PIN1) | \ | ||
1132 | PIN_ODR_HIGH(GPIOH_PIN2) | \ | ||
1133 | PIN_ODR_HIGH(GPIOH_PIN3) | \ | ||
1134 | PIN_ODR_HIGH(GPIOH_PIN4) | \ | ||
1135 | PIN_ODR_HIGH(GPIOH_PIN5) | \ | ||
1136 | PIN_ODR_HIGH(GPIOH_PIN6) | \ | ||
1137 | PIN_ODR_HIGH(GPIOH_PIN7) | \ | ||
1138 | PIN_ODR_HIGH(GPIOH_PIN8) | \ | ||
1139 | PIN_ODR_HIGH(GPIOH_PIN9) | \ | ||
1140 | PIN_ODR_HIGH(GPIOH_PIN10) | \ | ||
1141 | PIN_ODR_HIGH(GPIOH_PIN11) | \ | ||
1142 | PIN_ODR_HIGH(GPIOH_PIN12) | \ | ||
1143 | PIN_ODR_HIGH(GPIOH_PIN13) | \ | ||
1144 | PIN_ODR_HIGH(GPIOH_PIN14) | \ | ||
1145 | PIN_ODR_HIGH(GPIOH_PIN15)) | ||
1146 | #define VAL_GPIOH_AFRL (PIN_AFIO_AF(GPIOH_PIN0, 0) | \ | ||
1147 | PIN_AFIO_AF(GPIOH_PIN1, 0) | \ | ||
1148 | PIN_AFIO_AF(GPIOH_PIN2, 0) | \ | ||
1149 | PIN_AFIO_AF(GPIOH_PIN3, 0) | \ | ||
1150 | PIN_AFIO_AF(GPIOH_PIN4, 0) | \ | ||
1151 | PIN_AFIO_AF(GPIOH_PIN5, 0) | \ | ||
1152 | PIN_AFIO_AF(GPIOH_PIN6, 0) | \ | ||
1153 | PIN_AFIO_AF(GPIOH_PIN7, 0)) | ||
1154 | #define VAL_GPIOH_AFRH (PIN_AFIO_AF(GPIOH_PIN8, 0) | \ | ||
1155 | PIN_AFIO_AF(GPIOH_PIN9, 0) | \ | ||
1156 | PIN_AFIO_AF(GPIOH_PIN10, 0) | \ | ||
1157 | PIN_AFIO_AF(GPIOH_PIN11, 0) | \ | ||
1158 | PIN_AFIO_AF(GPIOH_PIN12, 0) | \ | ||
1159 | PIN_AFIO_AF(GPIOH_PIN13, 0) | \ | ||
1160 | PIN_AFIO_AF(GPIOH_PIN14, 0) | \ | ||
1161 | PIN_AFIO_AF(GPIOH_PIN15, 0)) | ||
1162 | |||
1163 | |||
1164 | /* | ||
1165 | * USB bus activation macro, required by the USB driver. | ||
1166 | */ | ||
1167 | // #define usb_lld_connect_bus(usbp) | ||
1168 | #define usb_lld_connect_bus(usbp) (palSetPadMode(GPIOA, GPIOA_USB_DP, PAL_MODE_ALTERNATE(14))) | ||
1169 | // #define usb_lld_connect_bus(usbp) palSetPadMode(GPIOA, 12, PAL_MODE_INPUT) | ||
1170 | /* | ||
1171 | * USB bus de-activation macro, required by the USB driver. | ||
1172 | */ | ||
1173 | // #define usb_lld_disconnect_bus(usbp) | ||
1174 | #define usb_lld_disconnect_bus(usbp) (palSetPadMode(GPIOA, GPIOA_USB_DP, PAL_MODE_OUTPUT_PUSHPULL)); palClearPad(GPIOA, GPIOA_USB_DP) | ||
1175 | // #define usb_lld_disconnect_bus(usbp) palSetPadMode(GPIOA, 12, PAL_MODE_OUTPUT_PUSHPULL); palClearPad(GPIOA, 12) | ||
1176 | |||
1177 | #if !defined(_FROM_ASM_) | ||
1178 | #ifdef __cplusplus | ||
1179 | extern "C" { | ||
1180 | #endif | ||
1181 | void boardInit(void); | ||
1182 | #ifdef __cplusplus | ||
1183 | } | ||
1184 | #endif | ||
1185 | #endif /* _FROM_ASM_ */ | ||
1186 | |||
1187 | #endif /* _BOARD_H_ */ | ||
diff --git a/keyboards/nk65/boards/GENERIC_STM32_F303XC/board.mk b/keyboards/nk65/boards/GENERIC_STM32_F303XC/board.mk new file mode 100755 index 000000000..43377629a --- /dev/null +++ b/keyboards/nk65/boards/GENERIC_STM32_F303XC/board.mk | |||
@@ -0,0 +1,5 @@ | |||
1 | # List of all the board related files. | ||
2 | BOARDSRC = $(BOARD_PATH)/boards/GENERIC_STM32_F303XC/board.c | ||
3 | |||
4 | # Required include directories | ||
5 | BOARDINC = $(BOARD_PATH)/boards/GENERIC_STM32_F303XC | ||
diff --git a/keyboards/nk65/bootloader_defs.h b/keyboards/nk65/bootloader_defs.h new file mode 100755 index 000000000..3b0e9d20a --- /dev/null +++ b/keyboards/nk65/bootloader_defs.h | |||
@@ -0,0 +1,7 @@ | |||
1 | /* Address for jumping to bootloader on STM32 chips. */ | ||
2 | /* It is chip dependent, the correct number can be looked up here: | ||
3 | * http://www.st.com/web/en/resource/technical/document/application_note/CD00167594.pdf | ||
4 | * This also requires a patch to chibios: | ||
5 | * <tmk_dir>/tmk_core/tool/chibios/ch-bootloader-jump.patch | ||
6 | */ | ||
7 | #define STM32_BOOTLOADER_ADDRESS 0x1FFFD800 | ||
diff --git a/keyboards/nk65/chconf.h b/keyboards/nk65/chconf.h new file mode 100755 index 000000000..1d9f12ff1 --- /dev/null +++ b/keyboards/nk65/chconf.h | |||
@@ -0,0 +1,520 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | /** | ||
18 | * @file templates/chconf.h | ||
19 | * @brief Configuration file template. | ||
20 | * @details A copy of this file must be placed in each project directory, it | ||
21 | * contains the application specific kernel settings. | ||
22 | * | ||
23 | * @addtogroup config | ||
24 | * @details Kernel related settings and hooks. | ||
25 | * @{ | ||
26 | */ | ||
27 | |||
28 | #ifndef CHCONF_H | ||
29 | #define CHCONF_H | ||
30 | |||
31 | #define _CHIBIOS_RT_CONF_ | ||
32 | |||
33 | /*===========================================================================*/ | ||
34 | /** | ||
35 | * @name System timers settings | ||
36 | * @{ | ||
37 | */ | ||
38 | /*===========================================================================*/ | ||
39 | |||
40 | /** | ||
41 | * @brief System time counter resolution. | ||
42 | * @note Allowed values are 16 or 32 bits. | ||
43 | */ | ||
44 | #define CH_CFG_ST_RESOLUTION 32 | ||
45 | |||
46 | /** | ||
47 | * @brief System tick frequency. | ||
48 | * @details Frequency of the system timer that drives the system ticks. This | ||
49 | * setting also defines the system tick time unit. | ||
50 | */ | ||
51 | #define CH_CFG_ST_FREQUENCY 100000 | ||
52 | |||
53 | /** | ||
54 | * @brief Time delta constant for the tick-less mode. | ||
55 | * @note If this value is zero then the system uses the classic | ||
56 | * periodic tick. This value represents the minimum number | ||
57 | * of ticks that is safe to specify in a timeout directive. | ||
58 | * The value one is not valid, timeouts are rounded up to | ||
59 | * this value. | ||
60 | */ | ||
61 | #define CH_CFG_ST_TIMEDELTA 2 | ||
62 | |||
63 | /** @} */ | ||
64 | |||
65 | /*===========================================================================*/ | ||
66 | /** | ||
67 | * @name Kernel parameters and options | ||
68 | * @{ | ||
69 | */ | ||
70 | /*===========================================================================*/ | ||
71 | |||
72 | /** | ||
73 | * @brief Round robin interval. | ||
74 | * @details This constant is the number of system ticks allowed for the | ||
75 | * threads before preemption occurs. Setting this value to zero | ||
76 | * disables the preemption for threads with equal priority and the | ||
77 | * round robin becomes cooperative. Note that higher priority | ||
78 | * threads can still preempt, the kernel is always preemptive. | ||
79 | * @note Disabling the round robin preemption makes the kernel more compact | ||
80 | * and generally faster. | ||
81 | * @note The round robin preemption is not supported in tickless mode and | ||
82 | * must be set to zero in that case. | ||
83 | */ | ||
84 | #define CH_CFG_TIME_QUANTUM 0 | ||
85 | |||
86 | /** | ||
87 | * @brief Managed RAM size. | ||
88 | * @details Size of the RAM area to be managed by the OS. If set to zero | ||
89 | * then the whole available RAM is used. The core memory is made | ||
90 | * available to the heap allocator and/or can be used directly through | ||
91 | * the simplified core memory allocator. | ||
92 | * | ||
93 | * @note In order to let the OS manage the whole RAM the linker script must | ||
94 | * provide the @p __heap_base__ and @p __heap_end__ symbols. | ||
95 | * @note Requires @p CH_CFG_USE_MEMCORE. | ||
96 | */ | ||
97 | #define CH_CFG_MEMCORE_SIZE 0 | ||
98 | |||
99 | /** | ||
100 | * @brief Idle thread automatic spawn suppression. | ||
101 | * @details When this option is activated the function @p chSysInit() | ||
102 | * does not spawn the idle thread. The application @p main() | ||
103 | * function becomes the idle thread and must implement an | ||
104 | * infinite loop. | ||
105 | */ | ||
106 | #define CH_CFG_NO_IDLE_THREAD FALSE | ||
107 | |||
108 | /** @} */ | ||
109 | |||
110 | /*===========================================================================*/ | ||
111 | /** | ||
112 | * @name Performance options | ||
113 | * @{ | ||
114 | */ | ||
115 | /*===========================================================================*/ | ||
116 | |||
117 | /** | ||
118 | * @brief OS optimization. | ||
119 | * @details If enabled then time efficient rather than space efficient code | ||
120 | * is used when two possible implementations exist. | ||
121 | * | ||
122 | * @note This is not related to the compiler optimization options. | ||
123 | * @note The default is @p TRUE. | ||
124 | */ | ||
125 | #define CH_CFG_OPTIMIZE_SPEED TRUE | ||
126 | |||
127 | /** @} */ | ||
128 | |||
129 | /*===========================================================================*/ | ||
130 | /** | ||
131 | * @name Subsystem options | ||
132 | * @{ | ||
133 | */ | ||
134 | /*===========================================================================*/ | ||
135 | |||
136 | /** | ||
137 | * @brief Time Measurement APIs. | ||
138 | * @details If enabled then the time measurement APIs are included in | ||
139 | * the kernel. | ||
140 | * | ||
141 | * @note The default is @p TRUE. | ||
142 | */ | ||
143 | #define CH_CFG_USE_TM TRUE | ||
144 | |||
145 | /** | ||
146 | * @brief Threads registry APIs. | ||
147 | * @details If enabled then the registry APIs are included in the kernel. | ||
148 | * | ||
149 | * @note The default is @p TRUE. | ||
150 | */ | ||
151 | #define CH_CFG_USE_REGISTRY TRUE | ||
152 | |||
153 | /** | ||
154 | * @brief Threads synchronization APIs. | ||
155 | * @details If enabled then the @p chThdWait() function is included in | ||
156 | * the kernel. | ||
157 | * | ||
158 | * @note The default is @p TRUE. | ||
159 | */ | ||
160 | #define CH_CFG_USE_WAITEXIT TRUE | ||
161 | |||
162 | /** | ||
163 | * @brief Semaphores APIs. | ||
164 | * @details If enabled then the Semaphores APIs are included in the kernel. | ||
165 | * | ||
166 | * @note The default is @p TRUE. | ||
167 | */ | ||
168 | #define CH_CFG_USE_SEMAPHORES TRUE | ||
169 | |||
170 | /** | ||
171 | * @brief Semaphores queuing mode. | ||
172 | * @details If enabled then the threads are enqueued on semaphores by | ||
173 | * priority rather than in FIFO order. | ||
174 | * | ||
175 | * @note The default is @p FALSE. Enable this if you have special | ||
176 | * requirements. | ||
177 | * @note Requires @p CH_CFG_USE_SEMAPHORES. | ||
178 | */ | ||
179 | #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE | ||
180 | |||
181 | /** | ||
182 | * @brief Mutexes APIs. | ||
183 | * @details If enabled then the mutexes APIs are included in the kernel. | ||
184 | * | ||
185 | * @note The default is @p TRUE. | ||
186 | */ | ||
187 | #define CH_CFG_USE_MUTEXES TRUE | ||
188 | |||
189 | /** | ||
190 | * @brief Enables recursive behavior on mutexes. | ||
191 | * @note Recursive mutexes are heavier and have an increased | ||
192 | * memory footprint. | ||
193 | * | ||
194 | * @note The default is @p FALSE. | ||
195 | * @note Requires @p CH_CFG_USE_MUTEXES. | ||
196 | */ | ||
197 | #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE | ||
198 | |||
199 | /** | ||
200 | * @brief Conditional Variables APIs. | ||
201 | * @details If enabled then the conditional variables APIs are included | ||
202 | * in the kernel. | ||
203 | * | ||
204 | * @note The default is @p TRUE. | ||
205 | * @note Requires @p CH_CFG_USE_MUTEXES. | ||
206 | */ | ||
207 | #define CH_CFG_USE_CONDVARS TRUE | ||
208 | |||
209 | /** | ||
210 | * @brief Conditional Variables APIs with timeout. | ||
211 | * @details If enabled then the conditional variables APIs with timeout | ||
212 | * specification are included in the kernel. | ||
213 | * | ||
214 | * @note The default is @p TRUE. | ||
215 | * @note Requires @p CH_CFG_USE_CONDVARS. | ||
216 | */ | ||
217 | #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE | ||
218 | |||
219 | /** | ||
220 | * @brief Events Flags APIs. | ||
221 | * @details If enabled then the event flags APIs are included in the kernel. | ||
222 | * | ||
223 | * @note The default is @p TRUE. | ||
224 | */ | ||
225 | #define CH_CFG_USE_EVENTS TRUE | ||
226 | |||
227 | /** | ||
228 | * @brief Events Flags APIs with timeout. | ||
229 | * @details If enabled then the events APIs with timeout specification | ||
230 | * are included in the kernel. | ||
231 | * | ||
232 | * @note The default is @p TRUE. | ||
233 | * @note Requires @p CH_CFG_USE_EVENTS. | ||
234 | */ | ||
235 | #define CH_CFG_USE_EVENTS_TIMEOUT TRUE | ||
236 | |||
237 | /** | ||
238 | * @brief Synchronous Messages APIs. | ||
239 | * @details If enabled then the synchronous messages APIs are included | ||
240 | * in the kernel. | ||
241 | * | ||
242 | * @note The default is @p TRUE. | ||
243 | */ | ||
244 | #define CH_CFG_USE_MESSAGES TRUE | ||
245 | |||
246 | /** | ||
247 | * @brief Synchronous Messages queuing mode. | ||
248 | * @details If enabled then messages are served by priority rather than in | ||
249 | * FIFO order. | ||
250 | * | ||
251 | * @note The default is @p FALSE. Enable this if you have special | ||
252 | * requirements. | ||
253 | * @note Requires @p CH_CFG_USE_MESSAGES. | ||
254 | */ | ||
255 | #define CH_CFG_USE_MESSAGES_PRIORITY TRUE | ||
256 | |||
257 | /** | ||
258 | * @brief Mailboxes APIs. | ||
259 | * @details If enabled then the asynchronous messages (mailboxes) APIs are | ||
260 | * included in the kernel. | ||
261 | * | ||
262 | * @note The default is @p TRUE. | ||
263 | * @note Requires @p CH_CFG_USE_SEMAPHORES. | ||
264 | */ | ||
265 | #define CH_CFG_USE_MAILBOXES TRUE | ||
266 | |||
267 | /** | ||
268 | * @brief Core Memory Manager APIs. | ||
269 | * @details If enabled then the core memory manager APIs are included | ||
270 | * in the kernel. | ||
271 | * | ||
272 | * @note The default is @p TRUE. | ||
273 | */ | ||
274 | #define CH_CFG_USE_MEMCORE TRUE | ||
275 | |||
276 | /** | ||
277 | * @brief Heap Allocator APIs. | ||
278 | * @details If enabled then the memory heap allocator APIs are included | ||
279 | * in the kernel. | ||
280 | * | ||
281 | * @note The default is @p TRUE. | ||
282 | * @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or | ||
283 | * @p CH_CFG_USE_SEMAPHORES. | ||
284 | * @note Mutexes are recommended. | ||
285 | */ | ||
286 | #define CH_CFG_USE_HEAP TRUE | ||
287 | |||
288 | /** | ||
289 | * @brief Memory Pools Allocator APIs. | ||
290 | * @details If enabled then the memory pools allocator APIs are included | ||
291 | * in the kernel. | ||
292 | * | ||
293 | * @note The default is @p TRUE. | ||
294 | */ | ||
295 | #define CH_CFG_USE_MEMPOOLS TRUE | ||
296 | |||
297 | /** | ||
298 | * @brief Dynamic Threads APIs. | ||
299 | * @details If enabled then the dynamic threads creation APIs are included | ||
300 | * in the kernel. | ||
301 | * | ||
302 | * @note The default is @p TRUE. | ||
303 | * @note Requires @p CH_CFG_USE_WAITEXIT. | ||
304 | * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. | ||
305 | */ | ||
306 | #define CH_CFG_USE_DYNAMIC TRUE | ||
307 | |||
308 | /** @} */ | ||
309 | |||
310 | /*===========================================================================*/ | ||
311 | /** | ||
312 | * @name Debug options | ||
313 | * @{ | ||
314 | */ | ||
315 | /*===========================================================================*/ | ||
316 | |||
317 | /** | ||
318 | * @brief Debug option, kernel statistics. | ||
319 | * | ||
320 | * @note The default is @p FALSE. | ||
321 | */ | ||
322 | #define CH_DBG_STATISTICS FALSE | ||
323 | |||
324 | /** | ||
325 | * @brief Debug option, system state check. | ||
326 | * @details If enabled the correct call protocol for system APIs is checked | ||
327 | * at runtime. | ||
328 | * | ||
329 | * @note The default is @p FALSE. | ||
330 | */ | ||
331 | #define CH_DBG_SYSTEM_STATE_CHECK FALSE | ||
332 | |||
333 | /** | ||
334 | * @brief Debug option, parameters checks. | ||
335 | * @details If enabled then the checks on the API functions input | ||
336 | * parameters are activated. | ||
337 | * | ||
338 | * @note The default is @p FALSE. | ||
339 | */ | ||
340 | #define CH_DBG_ENABLE_CHECKS FALSE | ||
341 | |||
342 | /** | ||
343 | * @brief Debug option, consistency checks. | ||
344 | * @details If enabled then all the assertions in the kernel code are | ||
345 | * activated. This includes consistency checks inside the kernel, | ||
346 | * runtime anomalies and port-defined checks. | ||
347 | * | ||
348 | * @note The default is @p FALSE. | ||
349 | */ | ||
350 | #define CH_DBG_ENABLE_ASSERTS FALSE | ||
351 | |||
352 | /** | ||
353 | * @brief Debug option, trace buffer. | ||
354 | * @details If enabled then the trace buffer is activated. | ||
355 | * | ||
356 | * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. | ||
357 | */ | ||
358 | #define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED | ||
359 | |||
360 | /** | ||
361 | * @brief Trace buffer entries. | ||
362 | * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is | ||
363 | * different from @p CH_DBG_TRACE_MASK_DISABLED. | ||
364 | */ | ||
365 | #define CH_DBG_TRACE_BUFFER_SIZE 128 | ||
366 | |||
367 | /** | ||
368 | * @brief Debug option, stack checks. | ||
369 | * @details If enabled then a runtime stack check is performed. | ||
370 | * | ||
371 | * @note The default is @p FALSE. | ||
372 | * @note The stack check is performed in a architecture/port dependent way. | ||
373 | * It may not be implemented or some ports. | ||
374 | * @note The default failure mode is to halt the system with the global | ||
375 | * @p panic_msg variable set to @p NULL. | ||
376 | */ | ||
377 | #define CH_DBG_ENABLE_STACK_CHECK TRUE | ||
378 | |||
379 | /** | ||
380 | * @brief Debug option, stacks initialization. | ||
381 | * @details If enabled then the threads working area is filled with a byte | ||
382 | * value when a thread is created. This can be useful for the | ||
383 | * runtime measurement of the used stack. | ||
384 | * | ||
385 | * @note The default is @p FALSE. | ||
386 | */ | ||
387 | #define CH_DBG_FILL_THREADS FALSE | ||
388 | |||
389 | /** | ||
390 | * @brief Debug option, threads profiling. | ||
391 | * @details If enabled then a field is added to the @p thread_t structure that | ||
392 | * counts the system ticks occurred while executing the thread. | ||
393 | * | ||
394 | * @note The default is @p FALSE. | ||
395 | * @note This debug option is not currently compatible with the | ||
396 | * tickless mode. | ||
397 | */ | ||
398 | #define CH_DBG_THREADS_PROFILING FALSE | ||
399 | |||
400 | /** @} */ | ||
401 | |||
402 | /*===========================================================================*/ | ||
403 | /** | ||
404 | * @name Kernel hooks | ||
405 | * @{ | ||
406 | */ | ||
407 | /*===========================================================================*/ | ||
408 | |||
409 | /** | ||
410 | * @brief Threads descriptor structure extension. | ||
411 | * @details User fields added to the end of the @p thread_t structure. | ||
412 | */ | ||
413 | #define CH_CFG_THREAD_EXTRA_FIELDS \ | ||
414 | /* Add threads custom fields here.*/ | ||
415 | |||
416 | /** | ||
417 | * @brief Threads initialization hook. | ||
418 | * @details User initialization code added to the @p chThdInit() API. | ||
419 | * | ||
420 | * @note It is invoked from within @p chThdInit() and implicitly from all | ||
421 | * the threads creation APIs. | ||
422 | */ | ||
423 | #define CH_CFG_THREAD_INIT_HOOK(tp) { \ | ||
424 | /* Add threads initialization code here.*/ \ | ||
425 | } | ||
426 | |||
427 | /** | ||
428 | * @brief Threads finalization hook. | ||
429 | * @details User finalization code added to the @p chThdExit() API. | ||
430 | */ | ||
431 | #define CH_CFG_THREAD_EXIT_HOOK(tp) { \ | ||
432 | /* Add threads finalization code here.*/ \ | ||
433 | } | ||
434 | |||
435 | /** | ||
436 | * @brief Context switch hook. | ||
437 | * @details This hook is invoked just before switching between threads. | ||
438 | */ | ||
439 | #define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \ | ||
440 | /* Context switch code here.*/ \ | ||
441 | } | ||
442 | |||
443 | /** | ||
444 | * @brief ISR enter hook. | ||
445 | */ | ||
446 | #define CH_CFG_IRQ_PROLOGUE_HOOK() { \ | ||
447 | /* IRQ prologue code here.*/ \ | ||
448 | } | ||
449 | |||
450 | /** | ||
451 | * @brief ISR exit hook. | ||
452 | */ | ||
453 | #define CH_CFG_IRQ_EPILOGUE_HOOK() { \ | ||
454 | /* IRQ epilogue code here.*/ \ | ||
455 | } | ||
456 | |||
457 | /** | ||
458 | * @brief Idle thread enter hook. | ||
459 | * @note This hook is invoked within a critical zone, no OS functions | ||
460 | * should be invoked from here. | ||
461 | * @note This macro can be used to activate a power saving mode. | ||
462 | */ | ||
463 | #define CH_CFG_IDLE_ENTER_HOOK() { \ | ||
464 | /* Idle-enter code here.*/ \ | ||
465 | } | ||
466 | |||
467 | /** | ||
468 | * @brief Idle thread leave hook. | ||
469 | * @note This hook is invoked within a critical zone, no OS functions | ||
470 | * should be invoked from here. | ||
471 | * @note This macro can be used to deactivate a power saving mode. | ||
472 | */ | ||
473 | #define CH_CFG_IDLE_LEAVE_HOOK() { \ | ||
474 | /* Idle-leave code here.*/ \ | ||
475 | } | ||
476 | |||
477 | /** | ||
478 | * @brief Idle Loop hook. | ||
479 | * @details This hook is continuously invoked by the idle thread loop. | ||
480 | */ | ||
481 | #define CH_CFG_IDLE_LOOP_HOOK() { \ | ||
482 | /* Idle loop code here.*/ \ | ||
483 | } | ||
484 | |||
485 | /** | ||
486 | * @brief System tick event hook. | ||
487 | * @details This hook is invoked in the system tick handler immediately | ||
488 | * after processing the virtual timers queue. | ||
489 | */ | ||
490 | #define CH_CFG_SYSTEM_TICK_HOOK() { \ | ||
491 | /* System tick event code here.*/ \ | ||
492 | } | ||
493 | |||
494 | /** | ||
495 | * @brief System halt hook. | ||
496 | * @details This hook is invoked in case to a system halting error before | ||
497 | * the system is halted. | ||
498 | */ | ||
499 | #define CH_CFG_SYSTEM_HALT_HOOK(reason) { \ | ||
500 | /* System halt code here.*/ \ | ||
501 | } | ||
502 | |||
503 | /** | ||
504 | * @brief Trace hook. | ||
505 | * @details This hook is invoked each time a new record is written in the | ||
506 | * trace buffer. | ||
507 | */ | ||
508 | #define CH_CFG_TRACE_HOOK(tep) { \ | ||
509 | /* Trace code here.*/ \ | ||
510 | } | ||
511 | |||
512 | /** @} */ | ||
513 | |||
514 | /*===========================================================================*/ | ||
515 | /* Port-specific settings (override port settings defaulted in chcore.h). */ | ||
516 | /*===========================================================================*/ | ||
517 | |||
518 | #endif /* CHCONF_H */ | ||
519 | |||
520 | /** @} */ | ||
diff --git a/keyboards/nk65/config.h b/keyboards/nk65/config.h new file mode 100755 index 000000000..0edb1bb62 --- /dev/null +++ b/keyboards/nk65/config.h | |||
@@ -0,0 +1,154 @@ | |||
1 | /* | ||
2 | Copyright 2019 Yiancar | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify | ||
5 | it under the terms of the GNU General Public License as published by | ||
6 | the Free Software Foundation, either version 2 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | #pragma once | ||
19 | |||
20 | #include "config_common.h" | ||
21 | |||
22 | /* USB Device descriptor parameter */ | ||
23 | #define VENDOR_ID 0x8968 | ||
24 | #define PRODUCT_ID 0x4E4B | ||
25 | #define DEVICE_VER 0x0001 | ||
26 | #define MANUFACTURER Yiancar-Designs | ||
27 | #define PRODUCT NK65 | ||
28 | #define DESCRIPTION A 65-percent, tool-free RGB keyboard | ||
29 | |||
30 | /* key matrix size */ | ||
31 | #define MATRIX_ROWS 5 | ||
32 | #define MATRIX_COLS 15 | ||
33 | |||
34 | #define MATRIX_ROW_PINS { B3, B4, B5, A8, A4 } | ||
35 | #define MATRIX_COL_PINS { A13, A10, A9, A14, A15, B8, B9, C13, C14, C15, A0, A1, A2, A3, A5 } | ||
36 | // To enable debugger set A13 A14 -> A5 A7 | ||
37 | |||
38 | /* COL2ROW, ROW2COL*/ | ||
39 | #define DIODE_DIRECTION COL2ROW | ||
40 | |||
41 | /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ | ||
42 | #define DEBOUNCING_DELAY 5 | ||
43 | |||
44 | /* define if matrix has ghost (lacks anti-ghosting diodes) */ | ||
45 | //#define MATRIX_HAS_GHOST | ||
46 | |||
47 | /* If defined, GRAVE_ESC will always act as ESC when CTRL is held. | ||
48 | * This is userful for the Windows task manager shortcut (ctrl+shift+esc). | ||
49 | */ | ||
50 | // #define GRAVE_ESC_CTRL_OVERRIDE | ||
51 | |||
52 | /* | ||
53 | * Force NKRO | ||
54 | * | ||
55 | * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved | ||
56 | * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the | ||
57 | * makefile for this to work.) | ||
58 | * | ||
59 | * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) | ||
60 | * until the next keyboard reset. | ||
61 | * | ||
62 | * NKRO may prevent your keystrokes from being detected in the BIOS, but it is | ||
63 | * fully operational during normal computer usage. | ||
64 | * | ||
65 | * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) | ||
66 | * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by | ||
67 | * bootmagic, NKRO mode will always be enabled until it is toggled again during a | ||
68 | * power-up. | ||
69 | * | ||
70 | */ | ||
71 | //#define FORCE_NKRO | ||
72 | |||
73 | /* | ||
74 | * Magic Key Options | ||
75 | * | ||
76 | * Magic keys are hotkey commands that allow control over firmware functions of | ||
77 | * the keyboard. They are best used in combination with the HID Listen program, | ||
78 | * found here: https://www.pjrc.com/teensy/hid_listen.html | ||
79 | * | ||
80 | * The options below allow the magic key functionality to be changed. This is | ||
81 | * useful if your keyboard/keypad is missing keys and you want magic key support. | ||
82 | * | ||
83 | */ | ||
84 | |||
85 | /* Backlight options */ | ||
86 | |||
87 | #define RGB_BACKLIGHT_ENABLED 1 | ||
88 | |||
89 | #define RGB_BACKLIGHT_NK65 | ||
90 | |||
91 | // they aren't really used if RGB_BACKLIGHT_HS60 defined | ||
92 | #define RGB_BACKLIGHT_USE_SPLIT_BACKSPACE 0 | ||
93 | #define RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT 0 | ||
94 | #define RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT 0 | ||
95 | #define RGB_BACKLIGHT_USE_7U_SPACEBAR 0 | ||
96 | #define RGB_BACKLIGHT_USE_ISO_ENTER 0 | ||
97 | #define RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS 0 | ||
98 | |||
99 | // disable backlight when USB suspended (PC sleep/hibernate/shutdown) | ||
100 | #define RGB_BACKLIGHT_DISABLE_WHEN_USB_SUSPENDED 0 | ||
101 | |||
102 | // disable backlight after timeout in minutes, 0 = no timeout | ||
103 | #define RGB_BACKLIGHT_DISABLE_AFTER_TIMEOUT 0 | ||
104 | |||
105 | // the default brightness | ||
106 | #define RGB_BACKLIGHT_BRIGHTNESS 255 | ||
107 | |||
108 | // the default effect (RGB test) | ||
109 | #define RGB_BACKLIGHT_EFFECT 255 | ||
110 | |||
111 | // the default effect speed (0-3) | ||
112 | #define RGB_BACKLIGHT_EFFECT_SPEED 0 | ||
113 | |||
114 | // the default color1 and color2 | ||
115 | #define RGB_BACKLIGHT_COLOR_1 { .h = 0, .s = 255 } | ||
116 | #define RGB_BACKLIGHT_COLOR_2 { .h = 127, .s = 255 } | ||
117 | |||
118 | #define DRIVER_COUNT 2 | ||
119 | #define DRIVER_LED_TOTAL 128 | ||
120 | |||
121 | // These define which keys in the matrix are alphas/mods | ||
122 | // Used for backlight effects so colors are different for | ||
123 | // alphas vs. mods | ||
124 | // Each value is for a row, bit 0 is column 0 | ||
125 | // Alpha=0 Mod=1 | ||
126 | #define RGB_BACKLIGHT_ALPHAS_MODS_ROW_0 0b0110000000000001 | ||
127 | #define RGB_BACKLIGHT_ALPHAS_MODS_ROW_1 0b0100000000000001 | ||
128 | #define RGB_BACKLIGHT_ALPHAS_MODS_ROW_2 0b0110000000000001 | ||
129 | #define RGB_BACKLIGHT_ALPHAS_MODS_ROW_3 0b0111000000000001 | ||
130 | #define RGB_BACKLIGHT_ALPHAS_MODS_ROW_4 0b0111111000000111 | ||
131 | |||
132 | #define RGB_BACKLIGHT_CAPS_LOCK_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 } | ||
133 | #define RGB_BACKLIGHT_LAYER_1_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 } | ||
134 | #define RGB_BACKLIGHT_LAYER_2_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 } | ||
135 | #define RGB_BACKLIGHT_LAYER_3_INDICATOR { .color = { .h = 0, .s = 0 }, .index = 255 } | ||
136 | |||
137 | // TODO: refactor with new user EEPROM code (coming soon) | ||
138 | #define EEPROM_MAGIC 0x451F | ||
139 | #define EEPROM_MAGIC_ADDR 32 | ||
140 | // Bump this every time we change what we store | ||
141 | // This will automatically reset the EEPROM with defaults | ||
142 | // and avoid loading invalid data from the EEPROM | ||
143 | #define EEPROM_VERSION 0x08 | ||
144 | #define EEPROM_VERSION_ADDR 34 | ||
145 | |||
146 | // Backlight config starts after EEPROM version | ||
147 | #define RGB_BACKLIGHT_CONFIG_EEPROM_ADDR 35 | ||
148 | // Dynamic keymap starts after backlight config (35+32) | ||
149 | #define DYNAMIC_KEYMAP_EEPROM_ADDR 67 | ||
150 | #define DYNAMIC_KEYMAP_LAYER_COUNT 4 | ||
151 | // Dynamic macro starts after dynamic keymaps (67+(4*5*15*2)) = (67+600) | ||
152 | #define DYNAMIC_KEYMAP_MACRO_EEPROM_ADDR 667 | ||
153 | #define DYNAMIC_KEYMAP_MACRO_EEPROM_SIZE 398 | ||
154 | #define DYNAMIC_KEYMAP_MACRO_COUNT 16 | ||
diff --git a/keyboards/nk65/halconf.h b/keyboards/nk65/halconf.h new file mode 100755 index 000000000..c3e0cbb72 --- /dev/null +++ b/keyboards/nk65/halconf.h | |||
@@ -0,0 +1,388 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | /** | ||
18 | * @file templates/halconf.h | ||
19 | * @brief HAL configuration header. | ||
20 | * @details HAL configuration file, this file allows to enable or disable the | ||
21 | * various device drivers from your application. You may also use | ||
22 | * this file in order to override the device drivers default settings. | ||
23 | * | ||
24 | * @addtogroup HAL_CONF | ||
25 | * @{ | ||
26 | */ | ||
27 | |||
28 | #ifndef HALCONF_H | ||
29 | #define HALCONF_H | ||
30 | |||
31 | #include "mcuconf.h" | ||
32 | |||
33 | /** | ||
34 | * @brief Enables the PAL subsystem. | ||
35 | */ | ||
36 | #if !defined(HAL_USE_PAL) || defined(__DOXYGEN__) | ||
37 | #define HAL_USE_PAL TRUE | ||
38 | #endif | ||
39 | |||
40 | /** | ||
41 | * @brief Enables the ADC subsystem. | ||
42 | */ | ||
43 | #if !defined(HAL_USE_ADC) || defined(__DOXYGEN__) | ||
44 | #define HAL_USE_ADC FALSE | ||
45 | #endif | ||
46 | |||
47 | /** | ||
48 | * @brief Enables the CAN subsystem. | ||
49 | */ | ||
50 | #if !defined(HAL_USE_CAN) || defined(__DOXYGEN__) | ||
51 | #define HAL_USE_CAN FALSE | ||
52 | #endif | ||
53 | |||
54 | /** | ||
55 | * @brief Enables the DAC subsystem. | ||
56 | */ | ||
57 | #if !defined(HAL_USE_DAC) || defined(__DOXYGEN__) | ||
58 | #define HAL_USE_DAC TRUE | ||
59 | #endif | ||
60 | |||
61 | /** | ||
62 | * @brief Enables the EXT subsystem. | ||
63 | */ | ||
64 | #if !defined(HAL_USE_EXT) || defined(__DOXYGEN__) | ||
65 | #define HAL_USE_EXT FALSE | ||
66 | #endif | ||
67 | |||
68 | /** | ||
69 | * @brief Enables the GPT subsystem. | ||
70 | */ | ||
71 | #if !defined(HAL_USE_GPT) || defined(__DOXYGEN__) | ||
72 | #define HAL_USE_GPT TRUE | ||
73 | #endif | ||
74 | |||
75 | /** | ||
76 | * @brief Enables the I2C subsystem. | ||
77 | */ | ||
78 | #if !defined(HAL_USE_I2C) || defined(__DOXYGEN__) | ||
79 | #define HAL_USE_I2C TRUE | ||
80 | #endif | ||
81 | |||
82 | /** | ||
83 | * @brief Enables the I2S subsystem. | ||
84 | */ | ||
85 | #if !defined(HAL_USE_I2S) || defined(__DOXYGEN__) | ||
86 | #define HAL_USE_I2S FALSE | ||
87 | #endif | ||
88 | |||
89 | /** | ||
90 | * @brief Enables the ICU subsystem. | ||
91 | */ | ||
92 | #if !defined(HAL_USE_ICU) || defined(__DOXYGEN__) | ||
93 | #define HAL_USE_ICU FALSE | ||
94 | #endif | ||
95 | |||
96 | /** | ||
97 | * @brief Enables the MAC subsystem. | ||
98 | */ | ||
99 | #if !defined(HAL_USE_MAC) || defined(__DOXYGEN__) | ||
100 | #define HAL_USE_MAC FALSE | ||
101 | #endif | ||
102 | |||
103 | /** | ||
104 | * @brief Enables the MMC_SPI subsystem. | ||
105 | */ | ||
106 | #if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__) | ||
107 | #define HAL_USE_MMC_SPI FALSE | ||
108 | #endif | ||
109 | |||
110 | /** | ||
111 | * @brief Enables the PWM subsystem. | ||
112 | */ | ||
113 | #if !defined(HAL_USE_PWM) || defined(__DOXYGEN__) | ||
114 | #define HAL_USE_PWM FALSE | ||
115 | #endif | ||
116 | |||
117 | /** | ||
118 | * @brief Enables the QSPI subsystem. | ||
119 | */ | ||
120 | #if !defined(HAL_USE_QSPI) || defined(__DOXYGEN__) | ||
121 | #define HAL_USE_QSPI FALSE | ||
122 | #endif | ||
123 | |||
124 | /** | ||
125 | * @brief Enables the RTC subsystem. | ||
126 | */ | ||
127 | #if !defined(HAL_USE_RTC) || defined(__DOXYGEN__) | ||
128 | #define HAL_USE_RTC FALSE | ||
129 | #endif | ||
130 | |||
131 | /** | ||
132 | * @brief Enables the SDC subsystem. | ||
133 | */ | ||
134 | #if !defined(HAL_USE_SDC) || defined(__DOXYGEN__) | ||
135 | #define HAL_USE_SDC FALSE | ||
136 | #endif | ||
137 | |||
138 | /** | ||
139 | * @brief Enables the SERIAL subsystem. | ||
140 | */ | ||
141 | #if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__) | ||
142 | #define HAL_USE_SERIAL FALSE | ||
143 | #endif | ||
144 | |||
145 | /** | ||
146 | * @brief Enables the SERIAL over USB subsystem. | ||
147 | */ | ||
148 | #if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__) | ||
149 | #define HAL_USE_SERIAL_USB TRUE | ||
150 | #endif | ||
151 | |||
152 | /** | ||
153 | * @brief Enables the SPI subsystem. | ||
154 | */ | ||
155 | #if !defined(HAL_USE_SPI) || defined(__DOXYGEN__) | ||
156 | #define HAL_USE_SPI FALSE | ||
157 | #endif | ||
158 | |||
159 | /** | ||
160 | * @brief Enables the UART subsystem. | ||
161 | */ | ||
162 | #if !defined(HAL_USE_UART) || defined(__DOXYGEN__) | ||
163 | #define HAL_USE_UART FALSE | ||
164 | #endif | ||
165 | |||
166 | /** | ||
167 | * @brief Enables the USB subsystem. | ||
168 | */ | ||
169 | #if !defined(HAL_USE_USB) || defined(__DOXYGEN__) | ||
170 | #define HAL_USE_USB TRUE | ||
171 | #endif | ||
172 | |||
173 | /** | ||
174 | * @brief Enables the WDG subsystem. | ||
175 | */ | ||
176 | #if !defined(HAL_USE_WDG) || defined(__DOXYGEN__) | ||
177 | #define HAL_USE_WDG FALSE | ||
178 | #endif | ||
179 | |||
180 | /*===========================================================================*/ | ||
181 | /* ADC driver related settings. */ | ||
182 | /*===========================================================================*/ | ||
183 | |||
184 | /** | ||
185 | * @brief Enables synchronous APIs. | ||
186 | * @note Disabling this option saves both code and data space. | ||
187 | */ | ||
188 | #if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__) | ||
189 | #define ADC_USE_WAIT TRUE | ||
190 | #endif | ||
191 | |||
192 | /** | ||
193 | * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs. | ||
194 | * @note Disabling this option saves both code and data space. | ||
195 | */ | ||
196 | #if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
197 | #define ADC_USE_MUTUAL_EXCLUSION TRUE | ||
198 | #endif | ||
199 | |||
200 | /*===========================================================================*/ | ||
201 | /* CAN driver related settings. */ | ||
202 | /*===========================================================================*/ | ||
203 | |||
204 | /** | ||
205 | * @brief Sleep mode related APIs inclusion switch. | ||
206 | */ | ||
207 | #if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__) | ||
208 | #define CAN_USE_SLEEP_MODE TRUE | ||
209 | #endif | ||
210 | |||
211 | /*===========================================================================*/ | ||
212 | /* I2C driver related settings. */ | ||
213 | /*===========================================================================*/ | ||
214 | |||
215 | /** | ||
216 | * @brief Enables the mutual exclusion APIs on the I2C bus. | ||
217 | */ | ||
218 | #if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
219 | #define I2C_USE_MUTUAL_EXCLUSION TRUE | ||
220 | #endif | ||
221 | |||
222 | /*===========================================================================*/ | ||
223 | /* MAC driver related settings. */ | ||
224 | /*===========================================================================*/ | ||
225 | |||
226 | /** | ||
227 | * @brief Enables an event sources for incoming packets. | ||
228 | */ | ||
229 | #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) | ||
230 | #define MAC_USE_ZERO_COPY FALSE | ||
231 | #endif | ||
232 | |||
233 | /** | ||
234 | * @brief Enables an event sources for incoming packets. | ||
235 | */ | ||
236 | #if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__) | ||
237 | #define MAC_USE_EVENTS TRUE | ||
238 | #endif | ||
239 | |||
240 | /*===========================================================================*/ | ||
241 | /* MMC_SPI driver related settings. */ | ||
242 | /*===========================================================================*/ | ||
243 | |||
244 | /** | ||
245 | * @brief Delays insertions. | ||
246 | * @details If enabled this options inserts delays into the MMC waiting | ||
247 | * routines releasing some extra CPU time for the threads with | ||
248 | * lower priority, this may slow down the driver a bit however. | ||
249 | * This option is recommended also if the SPI driver does not | ||
250 | * use a DMA channel and heavily loads the CPU. | ||
251 | */ | ||
252 | #if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__) | ||
253 | #define MMC_NICE_WAITING TRUE | ||
254 | #endif | ||
255 | |||
256 | /*===========================================================================*/ | ||
257 | /* SDC driver related settings. */ | ||
258 | /*===========================================================================*/ | ||
259 | |||
260 | /** | ||
261 | * @brief Number of initialization attempts before rejecting the card. | ||
262 | * @note Attempts are performed at 10mS intervals. | ||
263 | */ | ||
264 | #if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__) | ||
265 | #define SDC_INIT_RETRY 100 | ||
266 | #endif | ||
267 | |||
268 | /** | ||
269 | * @brief Include support for MMC cards. | ||
270 | * @note MMC support is not yet implemented so this option must be kept | ||
271 | * at @p FALSE. | ||
272 | */ | ||
273 | #if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__) | ||
274 | #define SDC_MMC_SUPPORT FALSE | ||
275 | #endif | ||
276 | |||
277 | /** | ||
278 | * @brief Delays insertions. | ||
279 | * @details If enabled this options inserts delays into the MMC waiting | ||
280 | * routines releasing some extra CPU time for the threads with | ||
281 | * lower priority, this may slow down the driver a bit however. | ||
282 | */ | ||
283 | #if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__) | ||
284 | #define SDC_NICE_WAITING TRUE | ||
285 | #endif | ||
286 | |||
287 | /*===========================================================================*/ | ||
288 | /* SERIAL driver related settings. */ | ||
289 | /*===========================================================================*/ | ||
290 | |||
291 | /** | ||
292 | * @brief Default bit rate. | ||
293 | * @details Configuration parameter, this is the baud rate selected for the | ||
294 | * default configuration. | ||
295 | */ | ||
296 | #if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__) | ||
297 | #define SERIAL_DEFAULT_BITRATE 38400 | ||
298 | #endif | ||
299 | |||
300 | /** | ||
301 | * @brief Serial buffers size. | ||
302 | * @details Configuration parameter, you can change the depth of the queue | ||
303 | * buffers depending on the requirements of your application. | ||
304 | * @note The default is 16 bytes for both the transmission and receive | ||
305 | * buffers. | ||
306 | */ | ||
307 | #if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) | ||
308 | #define SERIAL_BUFFERS_SIZE 16 | ||
309 | #endif | ||
310 | |||
311 | /*===========================================================================*/ | ||
312 | /* SERIAL_USB driver related setting. */ | ||
313 | /*===========================================================================*/ | ||
314 | |||
315 | /** | ||
316 | * @brief Serial over USB buffers size. | ||
317 | * @details Configuration parameter, the buffer size must be a multiple of | ||
318 | * the USB data endpoint maximum packet size. | ||
319 | * @note The default is 256 bytes for both the transmission and receive | ||
320 | * buffers. | ||
321 | */ | ||
322 | #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) | ||
323 | #define SERIAL_USB_BUFFERS_SIZE 1 | ||
324 | #endif | ||
325 | |||
326 | /** | ||
327 | * @brief Serial over USB number of buffers. | ||
328 | * @note The default is 2 buffers. | ||
329 | */ | ||
330 | #if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__) | ||
331 | #define SERIAL_USB_BUFFERS_NUMBER 2 | ||
332 | #endif | ||
333 | |||
334 | /*===========================================================================*/ | ||
335 | /* SPI driver related settings. */ | ||
336 | /*===========================================================================*/ | ||
337 | |||
338 | /** | ||
339 | * @brief Enables synchronous APIs. | ||
340 | * @note Disabling this option saves both code and data space. | ||
341 | */ | ||
342 | #if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__) | ||
343 | #define SPI_USE_WAIT TRUE | ||
344 | #endif | ||
345 | |||
346 | /** | ||
347 | * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. | ||
348 | * @note Disabling this option saves both code and data space. | ||
349 | */ | ||
350 | #if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
351 | #define SPI_USE_MUTUAL_EXCLUSION TRUE | ||
352 | #endif | ||
353 | |||
354 | /*===========================================================================*/ | ||
355 | /* UART driver related settings. */ | ||
356 | /*===========================================================================*/ | ||
357 | |||
358 | /** | ||
359 | * @brief Enables synchronous APIs. | ||
360 | * @note Disabling this option saves both code and data space. | ||
361 | */ | ||
362 | #if !defined(UART_USE_WAIT) || defined(__DOXYGEN__) | ||
363 | #define UART_USE_WAIT FALSE | ||
364 | #endif | ||
365 | |||
366 | /** | ||
367 | * @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs. | ||
368 | * @note Disabling this option saves both code and data space. | ||
369 | */ | ||
370 | #if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) | ||
371 | #define UART_USE_MUTUAL_EXCLUSION FALSE | ||
372 | #endif | ||
373 | |||
374 | /*===========================================================================*/ | ||
375 | /* USB driver related settings. */ | ||
376 | /*===========================================================================*/ | ||
377 | |||
378 | /** | ||
379 | * @brief Enables synchronous APIs. | ||
380 | * @note Disabling this option saves both code and data space. | ||
381 | */ | ||
382 | #if !defined(USB_USE_WAIT) || defined(__DOXYGEN__) | ||
383 | #define USB_USE_WAIT TRUE | ||
384 | #endif | ||
385 | |||
386 | #endif /* HALCONF_H */ | ||
387 | |||
388 | /** @} */ | ||
diff --git a/keyboards/nk65/info.json b/keyboards/nk65/info.json new file mode 100755 index 000000000..ea227f71d --- /dev/null +++ b/keyboards/nk65/info.json | |||
@@ -0,0 +1,12 @@ | |||
1 | { | ||
2 | "keyboard_name": "NK65", | ||
3 | "url": "", | ||
4 | "maintainer": "yiancar", | ||
5 | "width": 16, | ||
6 | "height": 5, | ||
7 | "layouts": { | ||
8 | "LAYOUT": { | ||
9 | "layout": [{"label":"Esc", "x":0, "y":0}, {"label":"!", "x":1, "y":0}, {"label":"@", "x":2, "y":0}, {"label":"#", "x":3, "y":0}, {"label":"$", "x":4, "y":0}, {"label":"%", "x":5, "y":0}, {"label":"^", "x":6, "y":0}, {"label":"&", "x":7, "y":0}, {"label":"*", "x":8, "y":0}, {"label":"(", "x":9, "y":0}, {"label":")", "x":10, "y":0}, {"label":"_", "x":11, "y":0}, {"label":"+", "x":12, "y":0}, {"label":"Backspace", "x":13, "y":0, "w":2}, {"label":"Home", "x":15, "y":0}, {"label":"Tab", "x":0, "y":1, "w":1.5}, {"label":"Q", "x":1.5, "y":1}, {"label":"W", "x":2.5, "y":1}, {"label":"E", "x":3.5, "y":1}, {"label":"R", "x":4.5, "y":1}, {"label":"T", "x":5.5, "y":1}, {"label":"Y", "x":6.5, "y":1}, {"label":"U", "x":7.5, "y":1}, {"label":"I", "x":8.5, "y":1}, {"label":"O", "x":9.5, "y":1}, {"label":"P", "x":10.5, "y":1}, {"label":"{", "x":11.5, "y":1}, {"label":"}", "x":12.5, "y":1}, {"label":"|", "x":13.5, "y":1, "w":1.5}, {"label":"Page Up", "x":15, "y":1}, {"label":"Caps Lock", "x":0, "y":2, "w":1.75}, {"label":"A", "x":1.75, "y":2}, {"label":"S", "x":2.75, "y":2}, {"label":"D", "x":3.75, "y":2}, {"label":"F", "x":4.75, "y":2}, {"label":"G", "x":5.75, "y":2}, {"label":"H", "x":6.75, "y":2}, {"label":"J", "x":7.75, "y":2}, {"label":"K", "x":8.75, "y":2}, {"label":"L", "x":9.75, "y":2}, {"label":":", "x":10.75, "y":2}, {"label":"\"", "x":11.75, "y":2}, {"label":"Enter", "x":12.75, "y":2, "w":2.25}, {"label":"Page Down", "x":15, "y":2}, {"label":"Shift", "x":0, "y":3, "w":2.25}, {"label":"Z", "x":2.25, "y":3}, {"label":"X", "x":3.25, "y":3}, {"label":"C", "x":4.25, "y":3}, {"label":"V", "x":5.25, "y":3}, {"label":"B", "x":6.25, "y":3}, {"label":"N", "x":7.25, "y":3}, {"label":"M", "x":8.25, "y":3}, {"label":"<", "x":9.25, "y":3}, {"label":">", "x":10.25, "y":3}, {"label":"?", "x":11.25, "y":3}, {"label":"Shift", "x":12.25, "y":3, "w":1.75}, {"label":"\u2191", "x":14, "y":3}, {"label":"End", "x":15, "y":3}, {"label":"Ctrl", "x":0, "y":4, "w":1.25}, {"label":"Win", "x":1.25, "y":4, "w":1.25}, {"label":"Alt", "x":2.5, "y":4, "w":1.25}, {"x":3.75, "y":4, "w":6.25}, {"label":"Alt", "x":10, "y":4}, {"label":"Fn", "x":11, "y":4}, {"label":"Ctrl", "x":12, "y":4}, {"label":"\u2190", "x":13, "y":4}, {"label":"\u2193", "x":14, "y":4}, {"label":"\u2192", "x":15, "y":4}] | ||
10 | } | ||
11 | } | ||
12 | } \ No newline at end of file | ||
diff --git a/keyboards/nk65/keymaps/default/keymap.c b/keyboards/nk65/keymaps/default/keymap.c new file mode 100755 index 000000000..a793a8bf4 --- /dev/null +++ b/keyboards/nk65/keymaps/default/keymap.c | |||
@@ -0,0 +1,58 @@ | |||
1 | /* Copyright 2019 Yiancar | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | #include QMK_KEYBOARD_H | ||
17 | |||
18 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
19 | [0] = LAYOUT_65_ansi( /* Base */ | ||
20 | KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_HOME,\ | ||
21 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGUP,\ | ||
22 | KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN,\ | ||
23 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END, \ | ||
24 | KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), | ||
25 | |||
26 | [1] = LAYOUT_65_ansi( /* FN */ | ||
27 | KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_TRNS,\ | ||
28 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, KC_TRNS,\ | ||
29 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\ | ||
30 | KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, BR_DEC, BR_INC, ES_DEC, ES_INC, KC_TRNS, KC_TRNS, KC_TRNS,\ | ||
31 | KC_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), | ||
32 | |||
33 | [2] = LAYOUT_65_ansi( /* Empty for dynamic keymaps */ | ||
34 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\ | ||
35 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\ | ||
36 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\ | ||
37 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\ | ||
38 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), | ||
39 | |||
40 | [3] = LAYOUT_65_ansi( /* Empty for dynamic keymaps */ | ||
41 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\ | ||
42 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\ | ||
43 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\ | ||
44 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\ | ||
45 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), | ||
46 | }; | ||
47 | |||
48 | void matrix_init_user(void) { | ||
49 | //user initialization | ||
50 | } | ||
51 | |||
52 | void matrix_scan_user(void) { | ||
53 | //user matrix | ||
54 | } | ||
55 | |||
56 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
57 | return true; | ||
58 | } \ No newline at end of file | ||
diff --git a/keyboards/nk65/keymaps/default/readme.md b/keyboards/nk65/keymaps/default/readme.md new file mode 100755 index 000000000..27bcd0501 --- /dev/null +++ b/keyboards/nk65/keymaps/default/readme.md | |||
@@ -0,0 +1,6 @@ | |||
1 | The default keymap for NK65. VIA support disabled. | ||
2 | ========================================================= | ||
3 | |||
4 |  | ||
5 | |||
6 | Default layer is normal ANSI 65% \ No newline at end of file | ||
diff --git a/keyboards/nk65/keymaps/default_via/keymap.c b/keyboards/nk65/keymaps/default_via/keymap.c new file mode 100755 index 000000000..a793a8bf4 --- /dev/null +++ b/keyboards/nk65/keymaps/default_via/keymap.c | |||
@@ -0,0 +1,58 @@ | |||
1 | /* Copyright 2019 Yiancar | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | #include QMK_KEYBOARD_H | ||
17 | |||
18 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
19 | [0] = LAYOUT_65_ansi( /* Base */ | ||
20 | KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_HOME,\ | ||
21 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_PGUP,\ | ||
22 | KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGDN,\ | ||
23 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_END, \ | ||
24 | KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT), | ||
25 | |||
26 | [1] = LAYOUT_65_ansi( /* FN */ | ||
27 | KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_TRNS,\ | ||
28 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, KC_TRNS,\ | ||
29 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, S1_DEC, S1_INC, S2_DEC, S2_INC, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\ | ||
30 | KC_TRNS, EF_DEC, EF_INC, H1_DEC, H1_INC, H2_DEC, H2_INC, BR_DEC, BR_INC, ES_DEC, ES_INC, KC_TRNS, KC_TRNS, KC_TRNS,\ | ||
31 | KC_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), | ||
32 | |||
33 | [2] = LAYOUT_65_ansi( /* Empty for dynamic keymaps */ | ||
34 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\ | ||
35 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\ | ||
36 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\ | ||
37 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\ | ||
38 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), | ||
39 | |||
40 | [3] = LAYOUT_65_ansi( /* Empty for dynamic keymaps */ | ||
41 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\ | ||
42 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\ | ||
43 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\ | ||
44 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\ | ||
45 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), | ||
46 | }; | ||
47 | |||
48 | void matrix_init_user(void) { | ||
49 | //user initialization | ||
50 | } | ||
51 | |||
52 | void matrix_scan_user(void) { | ||
53 | //user matrix | ||
54 | } | ||
55 | |||
56 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
57 | return true; | ||
58 | } \ No newline at end of file | ||
diff --git a/keyboards/nk65/keymaps/default_via/readme.md b/keyboards/nk65/keymaps/default_via/readme.md new file mode 100755 index 000000000..6689191e4 --- /dev/null +++ b/keyboards/nk65/keymaps/default_via/readme.md | |||
@@ -0,0 +1,6 @@ | |||
1 | The default keymap for NK65. VIA support enabled. | ||
2 | ========================================================= | ||
3 | |||
4 |  | ||
5 | |||
6 | Default layer is normal ANSI 65% \ No newline at end of file | ||
diff --git a/keyboards/nk65/keymaps/default_via/rules.mk b/keyboards/nk65/keymaps/default_via/rules.mk new file mode 100755 index 000000000..deb4fc889 --- /dev/null +++ b/keyboards/nk65/keymaps/default_via/rules.mk | |||
@@ -0,0 +1,67 @@ | |||
1 | # project specific files | ||
2 | SRC = keyboards/zeal60/zeal60.c \ | ||
3 | keyboards/zeal60/rgb_backlight.c \ | ||
4 | drivers/issi/is31fl3733.c \ | ||
5 | quantum/color.c \ | ||
6 | drivers/arm/i2c_master.c | ||
7 | |||
8 | ## chip/board settings | ||
9 | # the next two should match the directories in | ||
10 | # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) | ||
11 | MCU_FAMILY = STM32 | ||
12 | MCU_SERIES = STM32F3xx | ||
13 | |||
14 | # Linker script to use | ||
15 | # it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/ | ||
16 | # or <this_dir>/ld/ | ||
17 | MCU_LDSCRIPT = STM32F303xC | ||
18 | |||
19 | # Startup code to use | ||
20 | # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/ | ||
21 | MCU_STARTUP = stm32f3xx | ||
22 | |||
23 | # Board: it should exist either in <chibios>/os/hal/boards/ | ||
24 | # or <this_dir>/boards | ||
25 | BOARD = GENERIC_STM32_F303XC | ||
26 | |||
27 | # Cortex version | ||
28 | MCU = cortex-m4 | ||
29 | |||
30 | # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 | ||
31 | ARMV = 7 | ||
32 | |||
33 | USE_FPU = yes | ||
34 | |||
35 | # Vector table for application | ||
36 | # 0x00000000-0x00001000 area is occupied by bootlaoder.*/ | ||
37 | # The CORTEX_VTOR... is needed only for MCHCK/Infinity KB | ||
38 | # OPT_DEFS = -DCORTEX_VTOR_INIT=0x08005000 | ||
39 | OPT_DEFS = | ||
40 | |||
41 | # Do not put the microcontroller into power saving mode | ||
42 | # when we get USB suspend event. We want it to keep updating | ||
43 | # backlight effects. | ||
44 | OPT_DEFS += -DNO_SUSPEND_POWER_DOWN | ||
45 | |||
46 | # Options to pass to dfu-util when flashing | ||
47 | DFU_ARGS = -d 0483:df11 -a 0 -s 0x08000000:leave | ||
48 | DFU_SUFFIX_ARGS = -p DF11 -v 0483 | ||
49 | |||
50 | # Build Options | ||
51 | # comment out to disable the options. | ||
52 | # | ||
53 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | ||
54 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration | ||
55 | MOUSEKEY_ENABLE = yes # Mouse keys | ||
56 | EXTRAKEY_ENABLE = yes # Audio control and System control | ||
57 | CONSOLE_ENABLE = no # Console for debug | ||
58 | COMMAND_ENABLE = no # Commands for debug and configuration | ||
59 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | ||
60 | NKRO_ENABLE = yes # USB Nkey Rollover | ||
61 | AUDIO_ENABLE = no # Audio output on port C6 | ||
62 | NO_USB_STARTUP_CHECK = no # Disable initialization only when usb is plugged in | ||
63 | #SERIAL_LINK_ENABLE = yes | ||
64 | |||
65 | RAW_ENABLE = yes | ||
66 | DYNAMIC_KEYMAP_ENABLE = yes | ||
67 | CIE1931_CURVE = yes | ||
diff --git a/keyboards/nk65/mcuconf.h b/keyboards/nk65/mcuconf.h new file mode 100755 index 000000000..ce608f904 --- /dev/null +++ b/keyboards/nk65/mcuconf.h | |||
@@ -0,0 +1,257 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio | ||
3 | |||
4 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | you may not use this file except in compliance with the License. | ||
6 | You may obtain a copy of the License at | ||
7 | |||
8 | http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | |||
10 | Unless required by applicable law or agreed to in writing, software | ||
11 | distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | See the License for the specific language governing permissions and | ||
14 | limitations under the License. | ||
15 | */ | ||
16 | |||
17 | #ifndef MCUCONF_H | ||
18 | #define MCUCONF_H | ||
19 | |||
20 | /* | ||
21 | * STM32F3xx drivers configuration. | ||
22 | * The following settings override the default settings present in | ||
23 | * the various device driver implementation headers. | ||
24 | * Note that the settings for each driver only have effect if the whole | ||
25 | * driver is enabled in halconf.h. | ||
26 | * | ||
27 | * IRQ priorities: | ||
28 | * 15...0 Lowest...Highest. | ||
29 | * | ||
30 | * DMA priorities: | ||
31 | * 0...3 Lowest...Highest. | ||
32 | */ | ||
33 | |||
34 | #define STM32F3xx_MCUCONF | ||
35 | |||
36 | /* | ||
37 | * HAL driver system settings. | ||
38 | */ | ||
39 | #define STM32_NO_INIT FALSE | ||
40 | #define STM32_PVD_ENABLE FALSE | ||
41 | #define STM32_PLS STM32_PLS_LEV0 | ||
42 | #define STM32_HSI_ENABLED TRUE | ||
43 | #define STM32_LSI_ENABLED TRUE | ||
44 | #define STM32_HSE_ENABLED TRUE | ||
45 | #define STM32_LSE_ENABLED FALSE | ||
46 | #define STM32_SW STM32_SW_PLL | ||
47 | #define STM32_PLLSRC STM32_PLLSRC_HSE | ||
48 | #define STM32_PREDIV_VALUE 1 | ||
49 | #define STM32_PLLMUL_VALUE 9 | ||
50 | #define STM32_HPRE STM32_HPRE_DIV1 | ||
51 | #define STM32_PPRE1 STM32_PPRE1_DIV2 | ||
52 | #define STM32_PPRE2 STM32_PPRE2_DIV2 | ||
53 | #define STM32_MCOSEL STM32_MCOSEL_NOCLOCK | ||
54 | #define STM32_ADC12PRES STM32_ADC12PRES_DIV1 | ||
55 | #define STM32_ADC34PRES STM32_ADC34PRES_DIV1 | ||
56 | #define STM32_USART1SW STM32_USART1SW_PCLK | ||
57 | #define STM32_USART2SW STM32_USART2SW_PCLK | ||
58 | #define STM32_USART3SW STM32_USART3SW_PCLK | ||
59 | #define STM32_UART4SW STM32_UART4SW_PCLK | ||
60 | #define STM32_UART5SW STM32_UART5SW_PCLK | ||
61 | #define STM32_I2C1SW STM32_I2C1SW_SYSCLK | ||
62 | #define STM32_I2C2SW STM32_I2C2SW_SYSCLK | ||
63 | #define STM32_TIM1SW STM32_TIM1SW_PCLK2 | ||
64 | #define STM32_TIM8SW STM32_TIM8SW_PCLK2 | ||
65 | #define STM32_RTCSEL STM32_RTCSEL_LSI | ||
66 | #define STM32_USB_CLOCK_REQUIRED TRUE | ||
67 | #define STM32_USBPRE STM32_USBPRE_DIV1P5 | ||
68 | |||
69 | #undef STM32_HSE_BYPASS | ||
70 | // #error "oh no" | ||
71 | // #endif | ||
72 | |||
73 | /* | ||
74 | * ADC driver system settings. | ||
75 | */ | ||
76 | #define STM32_ADC_DUAL_MODE FALSE | ||
77 | #define STM32_ADC_COMPACT_SAMPLES FALSE | ||
78 | #define STM32_ADC_USE_ADC1 FALSE | ||
79 | #define STM32_ADC_USE_ADC2 FALSE | ||
80 | #define STM32_ADC_USE_ADC3 FALSE | ||
81 | #define STM32_ADC_USE_ADC4 FALSE | ||
82 | #define STM32_ADC_ADC1_DMA_STREAM STM32_DMA_STREAM_ID(1, 1) | ||
83 | #define STM32_ADC_ADC2_DMA_STREAM STM32_DMA_STREAM_ID(2, 1) | ||
84 | #define STM32_ADC_ADC3_DMA_STREAM STM32_DMA_STREAM_ID(2, 5) | ||
85 | #define STM32_ADC_ADC4_DMA_STREAM STM32_DMA_STREAM_ID(2, 2) | ||
86 | #define STM32_ADC_ADC1_DMA_PRIORITY 2 | ||
87 | #define STM32_ADC_ADC2_DMA_PRIORITY 2 | ||
88 | #define STM32_ADC_ADC3_DMA_PRIORITY 2 | ||
89 | #define STM32_ADC_ADC4_DMA_PRIORITY 2 | ||
90 | #define STM32_ADC_ADC12_IRQ_PRIORITY 5 | ||
91 | #define STM32_ADC_ADC3_IRQ_PRIORITY 5 | ||
92 | #define STM32_ADC_ADC4_IRQ_PRIORITY 5 | ||
93 | #define STM32_ADC_ADC1_DMA_IRQ_PRIORITY 5 | ||
94 | #define STM32_ADC_ADC2_DMA_IRQ_PRIORITY 5 | ||
95 | #define STM32_ADC_ADC3_DMA_IRQ_PRIORITY 5 | ||
96 | #define STM32_ADC_ADC4_DMA_IRQ_PRIORITY 5 | ||
97 | #define STM32_ADC_ADC12_CLOCK_MODE ADC_CCR_CKMODE_AHB_DIV1 | ||
98 | #define STM32_ADC_ADC34_CLOCK_MODE ADC_CCR_CKMODE_AHB_DIV1 | ||
99 | |||
100 | /* | ||
101 | * CAN driver system settings. | ||
102 | */ | ||
103 | #define STM32_CAN_USE_CAN1 FALSE | ||
104 | #define STM32_CAN_CAN1_IRQ_PRIORITY 11 | ||
105 | |||
106 | /* | ||
107 | * DAC driver system settings. | ||
108 | */ | ||
109 | #define STM32_DAC_DUAL_MODE FALSE | ||
110 | #define STM32_DAC_USE_DAC1_CH1 TRUE | ||
111 | #define STM32_DAC_USE_DAC1_CH2 TRUE | ||
112 | #define STM32_DAC_DAC1_CH1_IRQ_PRIORITY 10 | ||
113 | #define STM32_DAC_DAC1_CH2_IRQ_PRIORITY 10 | ||
114 | #define STM32_DAC_DAC1_CH1_DMA_PRIORITY 2 | ||
115 | #define STM32_DAC_DAC1_CH2_DMA_PRIORITY 2 | ||
116 | |||
117 | /* | ||
118 | * EXT driver system settings. | ||
119 | */ | ||
120 | #define STM32_EXT_EXTI0_IRQ_PRIORITY 6 | ||
121 | #define STM32_EXT_EXTI1_IRQ_PRIORITY 6 | ||
122 | #define STM32_EXT_EXTI2_IRQ_PRIORITY 6 | ||
123 | #define STM32_EXT_EXTI3_IRQ_PRIORITY 6 | ||
124 | #define STM32_EXT_EXTI4_IRQ_PRIORITY 6 | ||
125 | #define STM32_EXT_EXTI5_9_IRQ_PRIORITY 6 | ||
126 | #define STM32_EXT_EXTI10_15_IRQ_PRIORITY 6 | ||
127 | #define STM32_EXT_EXTI16_IRQ_PRIORITY 6 | ||
128 | #define STM32_EXT_EXTI17_IRQ_PRIORITY 6 | ||
129 | #define STM32_EXT_EXTI18_IRQ_PRIORITY 6 | ||
130 | #define STM32_EXT_EXTI19_IRQ_PRIORITY 6 | ||
131 | #define STM32_EXT_EXTI20_IRQ_PRIORITY 6 | ||
132 | #define STM32_EXT_EXTI21_22_29_IRQ_PRIORITY 6 | ||
133 | #define STM32_EXT_EXTI30_32_IRQ_PRIORITY 6 | ||
134 | #define STM32_EXT_EXTI33_IRQ_PRIORITY 6 | ||
135 | |||
136 | /* | ||
137 | * GPT driver system settings. | ||
138 | */ | ||
139 | #define STM32_GPT_USE_TIM1 FALSE | ||
140 | #define STM32_GPT_USE_TIM2 FALSE | ||
141 | #define STM32_GPT_USE_TIM3 FALSE | ||
142 | #define STM32_GPT_USE_TIM4 TRUE | ||
143 | #define STM32_GPT_USE_TIM6 TRUE | ||
144 | #define STM32_GPT_USE_TIM7 TRUE | ||
145 | #define STM32_GPT_USE_TIM8 TRUE | ||
146 | #define STM32_GPT_TIM1_IRQ_PRIORITY 7 | ||
147 | #define STM32_GPT_TIM2_IRQ_PRIORITY 7 | ||
148 | #define STM32_GPT_TIM3_IRQ_PRIORITY 7 | ||
149 | #define STM32_GPT_TIM4_IRQ_PRIORITY 7 | ||
150 | #define STM32_GPT_TIM6_IRQ_PRIORITY 7 | ||
151 | #define STM32_GPT_TIM7_IRQ_PRIORITY 7 | ||
152 | #define STM32_GPT_TIM8_IRQ_PRIORITY 7 | ||
153 | |||
154 | /* | ||
155 | * I2C driver system settings. | ||
156 | */ | ||
157 | #define STM32_I2C_USE_I2C1 TRUE | ||
158 | #define STM32_I2C_USE_I2C2 FALSE | ||
159 | #define STM32_I2C_BUSY_TIMEOUT 50 | ||
160 | #define STM32_I2C_I2C1_IRQ_PRIORITY 10 | ||
161 | #define STM32_I2C_I2C2_IRQ_PRIORITY 10 | ||
162 | #define STM32_I2C_USE_DMA TRUE | ||
163 | #define STM32_I2C_I2C1_DMA_PRIORITY 1 | ||
164 | #define STM32_I2C_I2C2_DMA_PRIORITY 1 | ||
165 | #define STM32_I2C_DMA_ERROR_HOOK(i2cp) osalSysHalt("DMA failure") | ||
166 | |||
167 | /* | ||
168 | * ICU driver system settings. | ||
169 | */ | ||
170 | #define STM32_ICU_USE_TIM1 FALSE | ||
171 | #define STM32_ICU_USE_TIM2 FALSE | ||
172 | #define STM32_ICU_USE_TIM3 FALSE | ||
173 | #define STM32_ICU_USE_TIM4 FALSE | ||
174 | #define STM32_ICU_USE_TIM8 FALSE | ||
175 | #define STM32_ICU_TIM1_IRQ_PRIORITY 7 | ||
176 | #define STM32_ICU_TIM2_IRQ_PRIORITY 7 | ||
177 | #define STM32_ICU_TIM3_IRQ_PRIORITY 7 | ||
178 | #define STM32_ICU_TIM4_IRQ_PRIORITY 7 | ||
179 | #define STM32_ICU_TIM8_IRQ_PRIORITY 7 | ||
180 | |||
181 | /* | ||
182 | * PWM driver system settings. | ||
183 | */ | ||
184 | #define STM32_PWM_USE_ADVANCED FALSE | ||
185 | #define STM32_PWM_USE_TIM1 FALSE | ||
186 | #define STM32_PWM_USE_TIM2 FALSE | ||
187 | #define STM32_PWM_USE_TIM3 FALSE | ||
188 | #define STM32_PWM_USE_TIM4 FALSE | ||
189 | #define STM32_PWM_USE_TIM8 FALSE | ||
190 | #define STM32_PWM_TIM1_IRQ_PRIORITY 7 | ||
191 | #define STM32_PWM_TIM2_IRQ_PRIORITY 7 | ||
192 | #define STM32_PWM_TIM3_IRQ_PRIORITY 7 | ||
193 | #define STM32_PWM_TIM4_IRQ_PRIORITY 7 | ||
194 | #define STM32_PWM_TIM8_IRQ_PRIORITY 7 | ||
195 | |||
196 | /* | ||
197 | * SERIAL driver system settings. | ||
198 | */ | ||
199 | #define STM32_SERIAL_USE_USART1 FALSE | ||
200 | #define STM32_SERIAL_USE_USART2 FALSE | ||
201 | #define STM32_SERIAL_USE_USART3 FALSE | ||
202 | #define STM32_SERIAL_USE_UART4 FALSE | ||
203 | #define STM32_SERIAL_USE_UART5 FALSE | ||
204 | #define STM32_SERIAL_USART1_PRIORITY 12 | ||
205 | #define STM32_SERIAL_USART2_PRIORITY 12 | ||
206 | #define STM32_SERIAL_USART3_PRIORITY 12 | ||
207 | #define STM32_SERIAL_UART4_PRIORITY 12 | ||
208 | #define STM32_SERIAL_UART5_PRIORITY 12 | ||
209 | |||
210 | /* | ||
211 | * SPI driver system settings. | ||
212 | */ | ||
213 | #define STM32_SPI_USE_SPI1 FALSE | ||
214 | #define STM32_SPI_USE_SPI2 FALSE | ||
215 | #define STM32_SPI_USE_SPI3 FALSE | ||
216 | #define STM32_SPI_SPI1_DMA_PRIORITY 1 | ||
217 | #define STM32_SPI_SPI2_DMA_PRIORITY 1 | ||
218 | #define STM32_SPI_SPI3_DMA_PRIORITY 1 | ||
219 | #define STM32_SPI_SPI1_IRQ_PRIORITY 10 | ||
220 | #define STM32_SPI_SPI2_IRQ_PRIORITY 10 | ||
221 | #define STM32_SPI_SPI3_IRQ_PRIORITY 10 | ||
222 | #define STM32_SPI_DMA_ERROR_HOOK(spip) osalSysHalt("DMA failure") | ||
223 | |||
224 | /* | ||
225 | * ST driver system settings. | ||
226 | */ | ||
227 | #define STM32_ST_IRQ_PRIORITY 8 | ||
228 | #define STM32_ST_USE_TIMER 2 | ||
229 | |||
230 | /* | ||
231 | * UART driver system settings. | ||
232 | */ | ||
233 | #define STM32_UART_USE_USART1 FALSE | ||
234 | #define STM32_UART_USE_USART2 FALSE | ||
235 | #define STM32_UART_USE_USART3 FALSE | ||
236 | #define STM32_UART_USART1_IRQ_PRIORITY 12 | ||
237 | #define STM32_UART_USART2_IRQ_PRIORITY 12 | ||
238 | #define STM32_UART_USART3_IRQ_PRIORITY 12 | ||
239 | #define STM32_UART_USART1_DMA_PRIORITY 0 | ||
240 | #define STM32_UART_USART2_DMA_PRIORITY 0 | ||
241 | #define STM32_UART_USART3_DMA_PRIORITY 0 | ||
242 | #define STM32_UART_DMA_ERROR_HOOK(uartp) osalSysHalt("DMA failure") | ||
243 | |||
244 | /* | ||
245 | * USB driver system settings. | ||
246 | */ | ||
247 | #define STM32_USB_USE_USB1 TRUE | ||
248 | #define STM32_USB_LOW_POWER_ON_SUSPEND FALSE | ||
249 | #define STM32_USB_USB1_HP_IRQ_PRIORITY 13 | ||
250 | #define STM32_USB_USB1_LP_IRQ_PRIORITY 14 | ||
251 | |||
252 | /* | ||
253 | * WDG driver system settings. | ||
254 | */ | ||
255 | #define STM32_WDG_USE_IWDG FALSE | ||
256 | |||
257 | #endif /* MCUCONF_H */ | ||
diff --git a/keyboards/nk65/nk65.c b/keyboards/nk65/nk65.c new file mode 100755 index 000000000..495246218 --- /dev/null +++ b/keyboards/nk65/nk65.c | |||
@@ -0,0 +1,18 @@ | |||
1 | /* Copyright 2019 Yiancar | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | #ifndef RGB_BACKLIGHT_NK65 | ||
17 | #error RGB_BACKLIGHT_NK65 not defined, recheck config.h | ||
18 | #endif | ||
diff --git a/keyboards/nk65/nk65.h b/keyboards/nk65/nk65.h new file mode 100755 index 000000000..e45360541 --- /dev/null +++ b/keyboards/nk65/nk65.h | |||
@@ -0,0 +1,38 @@ | |||
1 | /* Copyright 2019 Yiancar | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | #pragma once | ||
17 | |||
18 | #define XXX KC_NO | ||
19 | |||
20 | #include "quantum.h" | ||
21 | #include "../zeal60/rgb_backlight_keycodes.h" | ||
22 | #include "../zeal60/zeal60_keycodes.h" | ||
23 | |||
24 | // This a shortcut to help you visually see your layout. | ||
25 | |||
26 | #define LAYOUT_65_ansi( \ | ||
27 | K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E, \ | ||
28 | K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K2C, K1E, \ | ||
29 | K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2D, K2E, \ | ||
30 | K30, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, \ | ||
31 | K40, K41, K42, K46, K49, K4A, K4B, K4C, K4D, K4E \ | ||
32 | ) { \ | ||
33 | { K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, K0C, K0D, K0E }, \ | ||
34 | { K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, XXX, K1E }, \ | ||
35 | { K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E }, \ | ||
36 | { K30, XXX, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B, K3C, K3D, K3E }, \ | ||
37 | { K40, K41, K42, XXX, XXX, XXX, K46, XXX, XXX, K49, K4A, K4B, K4C, K4D, K4E } \ | ||
38 | } | ||
diff --git a/keyboards/nk65/readme.md b/keyboards/nk65/readme.md new file mode 100755 index 000000000..c893c9782 --- /dev/null +++ b/keyboards/nk65/readme.md | |||
@@ -0,0 +1,37 @@ | |||
1 | NK65 | ||
2 | ========= | ||
3 | |||
4 | [NK65]() | ||
5 | |||
6 | This is a standard fixed layout 65% PCB. It supports VIA and full per-key RGB. | ||
7 | |||
8 | Keyboard Maintainer: [Yiancar](http://yiancar-designs.com/) and on [github](https://github.com/yiancar) | ||
9 | Hardware Supported: A 65% keyboard with STM32F303CC | ||
10 | Hardware Availability: https://novelkeys.xyz/ | ||
11 | |||
12 | Due to the RGB implementation, the NK65 is currently not compatible with community layouts. | ||
13 | |||
14 | ## Instructions | ||
15 | |||
16 | ### Build | ||
17 | |||
18 | Make example for this keyboard (after setting up your build environment): | ||
19 | |||
20 | make nk65:default_via | ||
21 | |||
22 | See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). | ||
23 | |||
24 | ### Reset | ||
25 | |||
26 | - Unplug | ||
27 | - Hold Escape | ||
28 | - Plug In | ||
29 | - Unplug | ||
30 | - Release Escape | ||
31 | |||
32 | ### Flash | ||
33 | |||
34 | - Unplug | ||
35 | - Hold Escape | ||
36 | - Plug In | ||
37 | - Flash using QMK Toolbox or dfu-util (`make nk65:<keymap>:dfu-util`) | ||
diff --git a/keyboards/nk65/rules.mk b/keyboards/nk65/rules.mk new file mode 100755 index 000000000..946722780 --- /dev/null +++ b/keyboards/nk65/rules.mk | |||
@@ -0,0 +1,69 @@ | |||
1 | # project specific files | ||
2 | SRC = keyboards/zeal60/zeal60.c \ | ||
3 | keyboards/zeal60/rgb_backlight.c \ | ||
4 | drivers/issi/is31fl3733.c \ | ||
5 | quantum/color.c \ | ||
6 | drivers/arm/i2c_master.c | ||
7 | |||
8 | ## chip/board settings | ||
9 | # the next two should match the directories in | ||
10 | # <chibios>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) | ||
11 | MCU_FAMILY = STM32 | ||
12 | MCU_SERIES = STM32F3xx | ||
13 | |||
14 | # Linker script to use | ||
15 | # it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/ | ||
16 | # or <this_dir>/ld/ | ||
17 | MCU_LDSCRIPT = STM32F303xC | ||
18 | |||
19 | # Startup code to use | ||
20 | # - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/ | ||
21 | MCU_STARTUP = stm32f3xx | ||
22 | |||
23 | # Board: it should exist either in <chibios>/os/hal/boards/ | ||
24 | # or <this_dir>/boards | ||
25 | BOARD = GENERIC_STM32_F303XC | ||
26 | |||
27 | # Cortex version | ||
28 | MCU = cortex-m4 | ||
29 | |||
30 | # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 | ||
31 | ARMV = 7 | ||
32 | |||
33 | USE_FPU = yes | ||
34 | |||
35 | # Vector table for application | ||
36 | # 0x00000000-0x00001000 area is occupied by bootlaoder.*/ | ||
37 | # The CORTEX_VTOR... is needed only for MCHCK/Infinity KB | ||
38 | # OPT_DEFS = -DCORTEX_VTOR_INIT=0x08005000 | ||
39 | OPT_DEFS = | ||
40 | |||
41 | # Do not put the microcontroller into power saving mode | ||
42 | # when we get USB suspend event. We want it to keep updating | ||
43 | # backlight effects. | ||
44 | OPT_DEFS += -DNO_SUSPEND_POWER_DOWN | ||
45 | |||
46 | # Options to pass to dfu-util when flashing | ||
47 | DFU_ARGS = -d 0483:df11 -a 0 -s 0x08000000:leave | ||
48 | DFU_SUFFIX_ARGS = -p DF11 -v 0483 | ||
49 | |||
50 | # Build Options | ||
51 | # comment out to disable the options. | ||
52 | # | ||
53 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | ||
54 | BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration | ||
55 | MOUSEKEY_ENABLE = yes # Mouse keys | ||
56 | EXTRAKEY_ENABLE = yes # Audio control and System control | ||
57 | CONSOLE_ENABLE = no # Console for debug | ||
58 | COMMAND_ENABLE = no # Commands for debug and configuration | ||
59 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | ||
60 | NKRO_ENABLE = yes # USB Nkey Rollover | ||
61 | AUDIO_ENABLE = no # Audio output on port C6 | ||
62 | NO_USB_STARTUP_CHECK = no # Disable initialization only when usb is plugged in | ||
63 | #SERIAL_LINK_ENABLE = yes | ||
64 | |||
65 | RAW_ENABLE = no | ||
66 | DYNAMIC_KEYMAP_ENABLE = no | ||
67 | CIE1931_CURVE = yes | ||
68 | |||
69 | LAYOUTS = 65_ansi | ||
diff --git a/keyboards/zeal60/rgb_backlight.c b/keyboards/zeal60/rgb_backlight.c index d5f206fdc..a3f7151bf 100644 --- a/keyboards/zeal60/rgb_backlight.c +++ b/keyboards/zeal60/rgb_backlight.c | |||
@@ -15,9 +15,9 @@ | |||
15 | */ | 15 | */ |
16 | #if RGB_BACKLIGHT_ENABLED | 16 | #if RGB_BACKLIGHT_ENABLED |
17 | 17 | ||
18 | #if defined (RGB_BACKLIGHT_ZEAL60) || defined (RGB_BACKLIGHT_ZEAL65) || defined (RGB_BACKLIGHT_M60_A) || defined(RGB_BACKLIGHT_M6_B) || defined(RGB_BACKLIGHT_KOYU) || defined(RGB_BACKLIGHT_HS60) | 18 | #if defined(RGB_BACKLIGHT_ZEAL60) || defined(RGB_BACKLIGHT_ZEAL65) || defined(RGB_BACKLIGHT_M60_A) || defined(RGB_BACKLIGHT_M6_B) || defined(RGB_BACKLIGHT_KOYU) || defined(RGB_BACKLIGHT_HS60) || defined(RGB_BACKLIGHT_NK65) |
19 | #else | 19 | #else |
20 | #error None of the following was defined: RGB_BACKLIGHT_ZEAL60, RGB_BACKLIGHT_ZEAL65, RGB_BACKLIGHT_M60_A, RGB_BACKLIGHT_M6_B, RGB_BACKLIGHT_KOYU | 20 | #error None of the following was defined: RGB_BACKLIGHT_ZEAL60, RGB_BACKLIGHT_ZEAL65, RGB_BACKLIGHT_M60_A, RGB_BACKLIGHT_M6_B, RGB_BACKLIGHT_KOYU, RGB_BACKLIGHT_HS60, RGB_BACKLIGHT_NK65 |
21 | #endif | 21 | #endif |
22 | 22 | ||
23 | #ifndef MAX | 23 | #ifndef MAX |
@@ -33,7 +33,7 @@ | |||
33 | #include "rgb_backlight_api.h" | 33 | #include "rgb_backlight_api.h" |
34 | #include "rgb_backlight_keycodes.h" | 34 | #include "rgb_backlight_keycodes.h" |
35 | 35 | ||
36 | #if !defined(RGB_BACKLIGHT_HS60) | 36 | #if !defined(RGB_BACKLIGHT_HS60) && !defined(RGB_BACKLIGHT_NK65) |
37 | #include <avr/io.h> | 37 | #include <avr/io.h> |
38 | #include <util/delay.h> | 38 | #include <util/delay.h> |
39 | #include <avr/interrupt.h> | 39 | #include <avr/interrupt.h> |
@@ -47,12 +47,15 @@ | |||
47 | #include "progmem.h" | 47 | #include "progmem.h" |
48 | #include "quantum/color.h" | 48 | #include "quantum/color.h" |
49 | 49 | ||
50 | #if defined (RGB_BACKLIGHT_M6_B) | 50 | #if defined(RGB_BACKLIGHT_M6_B) |
51 | #include "drivers/issi/is31fl3218.h" | 51 | #include "drivers/issi/is31fl3218.h" |
52 | #define BACKLIGHT_LED_COUNT 6 | 52 | #define BACKLIGHT_LED_COUNT 6 |
53 | #elif defined (RGB_BACKLIGHT_HS60) | 53 | #elif defined(RGB_BACKLIGHT_HS60) |
54 | #include "drivers/issi/is31fl3733.h" | 54 | #include "drivers/issi/is31fl3733.h" |
55 | #define BACKLIGHT_LED_COUNT 64 | 55 | #define BACKLIGHT_LED_COUNT 64 |
56 | #elif defined(RGB_BACKLIGHT_NK65) | ||
57 | #include "drivers/issi/is31fl3733.h" | ||
58 | #define BACKLIGHT_LED_COUNT 69 | ||
56 | #else | 59 | #else |
57 | #include "drivers/issi/is31fl3731.h" | 60 | #include "drivers/issi/is31fl3731.h" |
58 | #define BACKLIGHT_LED_COUNT 72 | 61 | #define BACKLIGHT_LED_COUNT 72 |
@@ -61,31 +64,31 @@ | |||
61 | #define BACKLIGHT_EFFECT_MAX 10 | 64 | #define BACKLIGHT_EFFECT_MAX 10 |
62 | 65 | ||
63 | backlight_config g_config = { | 66 | backlight_config g_config = { |
64 | .use_split_backspace = RGB_BACKLIGHT_USE_SPLIT_BACKSPACE, | 67 | .use_split_backspace = RGB_BACKLIGHT_USE_SPLIT_BACKSPACE, |
65 | .use_split_left_shift = RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT, | 68 | .use_split_left_shift = RGB_BACKLIGHT_USE_SPLIT_LEFT_SHIFT, |
66 | .use_split_right_shift = RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT, | 69 | .use_split_right_shift = RGB_BACKLIGHT_USE_SPLIT_RIGHT_SHIFT, |
67 | .use_7u_spacebar = RGB_BACKLIGHT_USE_7U_SPACEBAR, | 70 | .use_7u_spacebar = RGB_BACKLIGHT_USE_7U_SPACEBAR, |
68 | .use_iso_enter = RGB_BACKLIGHT_USE_ISO_ENTER, | 71 | .use_iso_enter = RGB_BACKLIGHT_USE_ISO_ENTER, |
69 | .disable_hhkb_blocker_leds = RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS, | 72 | .disable_hhkb_blocker_leds = RGB_BACKLIGHT_DISABLE_HHKB_BLOCKER_LEDS, |
70 | .disable_when_usb_suspended = RGB_BACKLIGHT_DISABLE_WHEN_USB_SUSPENDED, | 73 | .disable_when_usb_suspended = RGB_BACKLIGHT_DISABLE_WHEN_USB_SUSPENDED, |
71 | .disable_after_timeout = RGB_BACKLIGHT_DISABLE_AFTER_TIMEOUT, | 74 | .disable_after_timeout = RGB_BACKLIGHT_DISABLE_AFTER_TIMEOUT, |
72 | .brightness = RGB_BACKLIGHT_BRIGHTNESS, | 75 | .brightness = RGB_BACKLIGHT_BRIGHTNESS, |
73 | .effect = RGB_BACKLIGHT_EFFECT, | 76 | .effect = RGB_BACKLIGHT_EFFECT, |
74 | .effect_speed = RGB_BACKLIGHT_EFFECT_SPEED, | 77 | .effect_speed = RGB_BACKLIGHT_EFFECT_SPEED, |
75 | .color_1 = RGB_BACKLIGHT_COLOR_1, | 78 | .color_1 = RGB_BACKLIGHT_COLOR_1, |
76 | .color_2 = RGB_BACKLIGHT_COLOR_2, | 79 | .color_2 = RGB_BACKLIGHT_COLOR_2, |
77 | .caps_lock_indicator = RGB_BACKLIGHT_CAPS_LOCK_INDICATOR, | 80 | .caps_lock_indicator = RGB_BACKLIGHT_CAPS_LOCK_INDICATOR, |
78 | .layer_1_indicator = RGB_BACKLIGHT_LAYER_1_INDICATOR, | 81 | .layer_1_indicator = RGB_BACKLIGHT_LAYER_1_INDICATOR, |
79 | .layer_2_indicator = RGB_BACKLIGHT_LAYER_2_INDICATOR, | 82 | .layer_2_indicator = RGB_BACKLIGHT_LAYER_2_INDICATOR, |
80 | .layer_3_indicator = RGB_BACKLIGHT_LAYER_3_INDICATOR, | 83 | .layer_3_indicator = RGB_BACKLIGHT_LAYER_3_INDICATOR, |
81 | .alphas_mods = { | 84 | .alphas_mods = { |
82 | RGB_BACKLIGHT_ALPHAS_MODS_ROW_0, | 85 | RGB_BACKLIGHT_ALPHAS_MODS_ROW_0, |
83 | RGB_BACKLIGHT_ALPHAS_MODS_ROW_1, | 86 | RGB_BACKLIGHT_ALPHAS_MODS_ROW_1, |
84 | RGB_BACKLIGHT_ALPHAS_MODS_ROW_2, | 87 | RGB_BACKLIGHT_ALPHAS_MODS_ROW_2, |
85 | RGB_BACKLIGHT_ALPHAS_MODS_ROW_3, | 88 | RGB_BACKLIGHT_ALPHAS_MODS_ROW_3, |
86 | RGB_BACKLIGHT_ALPHAS_MODS_ROW_4 }, | 89 | RGB_BACKLIGHT_ALPHAS_MODS_ROW_4 }, |
87 | #if defined(RGB_BACKLIGHT_M6_B) | 90 | #if defined(RGB_BACKLIGHT_M6_B) |
88 | .custom_color = { { 0, 255 }, { 43, 255 }, { 85, 255 }, { 128, 255 }, { 171, 255 }, { 213, 255 } } | 91 | .custom_color = { { 0, 255 }, { 43, 255 }, { 85, 255 }, { 128, 255 }, { 171, 255 }, { 213, 255 } } |
89 | #endif | 92 | #endif |
90 | }; | 93 | }; |
91 | 94 | ||
@@ -107,7 +110,6 @@ uint32_t g_any_key_hit = 0; | |||
107 | // set to 0 for write, 1 for read (as per I2C protocol) | 110 | // set to 0 for write, 1 for read (as per I2C protocol) |
108 | // ADDR_2 is not needed. it is here as a dummy | 111 | // ADDR_2 is not needed. it is here as a dummy |
109 | #define ISSI_ADDR_1 0x50 | 112 | #define ISSI_ADDR_1 0x50 |
110 | #define ISSI_ADDR_2 0x50 | ||
111 | 113 | ||
112 | const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { | 114 | const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { |
113 | /* Refer to IS31 manual for these locations | 115 | /* Refer to IS31 manual for these locations |
@@ -182,6 +184,152 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { | |||
182 | {0, K_16, J_16, L_16}, //LA64 | 184 | {0, K_16, J_16, L_16}, //LA64 |
183 | }; | 185 | }; |
184 | 186 | ||
187 | #elif defined(RGB_BACKLIGHT_NK65) | ||
188 | |||
189 | // This is a 7-bit address, that gets left-shifted and bit 0 | ||
190 | // set to 0 for write, 1 for read (as per I2C protocol) | ||
191 | // ADDR_2 is not needed. it is here as a dummy | ||
192 | #define ISSI_ADDR_1 0x50 | ||
193 | #define ISSI_ADDR_2 0x52 | ||
194 | |||
195 | const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { | ||
196 | /* Refer to IS31 manual for these locations | ||
197 | * driver | ||
198 | * | R location | ||
199 | * | | G location | ||
200 | * | | | B location | ||
201 | * | | | | */ | ||
202 | {0, B_1, A_1, C_1}, //LA1 | ||
203 | {0, E_1, D_1, F_1}, //LA2 | ||
204 | {0, H_1, G_1, I_1}, //LA3 | ||
205 | {0, K_1, J_1, L_1}, //LA4 | ||
206 | {0, B_2, A_2, C_2}, //LA5 | ||
207 | {0, E_2, D_2, F_2}, //LA6 | ||
208 | {0, H_2, G_2, I_2}, //LA7 | ||
209 | {0, K_2, J_2, L_2}, //LA8 | ||
210 | {0, B_3, A_3, C_3}, //LA9 | ||
211 | {0, E_3, D_3, F_3}, //LA10 | ||
212 | {0, H_3, G_3, I_3}, //LA11 | ||
213 | {0, K_3, J_3, L_3}, //LA12 | ||
214 | {0, B_4, A_4, C_4}, //LA13 | ||
215 | {0, E_4, D_4, F_4}, //LA14 | ||
216 | {0, H_4, G_4, I_4}, //LA15 | ||
217 | {0, K_4, J_4, L_4}, //LA16 | ||
218 | {0, B_5, A_5, C_5}, //LA17 | ||
219 | {0, E_5, D_5, F_5}, //LA18 | ||
220 | {0, H_5, G_5, I_5}, //LA19 | ||
221 | {0, K_5, J_5, L_5}, //LA20 | ||
222 | {0, B_6, A_6, C_6}, //LA21 | ||
223 | {0, E_6, D_6, F_6}, //LA22 | ||
224 | {0, H_6, G_6, I_6}, //LA23 | ||
225 | {0, K_6, J_6, L_6}, //LA24 | ||
226 | {0, B_7, A_7, C_7}, //LA25 | ||
227 | {0, E_7, D_7, F_7}, //LA26 | ||
228 | {0, H_7, G_7, I_7}, //LA27 | ||
229 | {0, K_7, J_7, L_7}, //LA28 | ||
230 | {0, B_8, A_8, C_8}, //LA29 | ||
231 | {0, E_8, D_8, F_8}, //LA30 | ||
232 | {0, H_8, G_8, I_8}, //LA31 | ||
233 | {0, K_8, J_8, L_8}, //LA32 | ||
234 | {0, B_9, A_9, C_9}, //LA33 | ||
235 | {0, E_9, D_9, F_9}, //LA34 | ||
236 | {0, H_9, G_9, I_9}, //LA35 | ||
237 | {0, K_9, J_9, L_9}, //LA36 | ||
238 | {0, B_10, A_10, C_10}, //LA37 | ||
239 | {0, E_10, D_10, F_10}, //LA38 | ||
240 | {0, H_10, G_10, I_10}, //LA39 | ||
241 | {0, K_10, J_10, L_10}, //LA40 | ||
242 | {0, B_11, A_11, C_11}, //LA41 | ||
243 | {0, E_11, D_11, F_11}, //LA42 | ||
244 | {0, H_11, G_11, I_11}, //LA43 | ||
245 | {0, K_11, J_11, L_11}, //LA44 | ||
246 | {0, B_12, A_12, C_12}, //LA45 | ||
247 | {0, E_12, D_12, F_12}, //LA46 | ||
248 | {0, H_12, G_12, I_12}, //LA47 | ||
249 | {0, K_12, J_12, L_12}, //LA48 | ||
250 | {0, B_13, A_13, C_13}, //LA49 | ||
251 | {0, E_13, D_13, F_13}, //LA50 | ||
252 | {0, H_13, G_13, I_13}, //LA51 | ||
253 | {0, K_13, J_13, L_13}, //LA52 | ||
254 | {0, B_14, A_14, C_14}, //LA53 | ||
255 | {0, E_14, D_14, F_14}, //LA54 | ||
256 | {0, H_14, G_14, I_14}, //LA55 | ||
257 | {0, K_14, J_14, L_14}, //LA56 | ||
258 | {0, B_15, A_15, C_15}, //LA57 | ||
259 | {0, E_15, D_15, F_15}, //LA58 | ||
260 | {0, H_15, G_15, I_15}, //LA59 | ||
261 | {0, K_15, J_15, L_15}, //LA60 | ||
262 | {0, B_16, A_16, C_16}, //LA61 | ||
263 | {0, E_16, D_16, F_16}, //LA62 | ||
264 | {0, H_16, G_16, I_16}, //LA63 | ||
265 | {0, K_16, J_16, L_16}, //LA64 | ||
266 | |||
267 | {1, B_1, A_1, C_1}, //LB1 | ||
268 | {1, E_1, D_1, F_1}, //LB2 | ||
269 | {1, H_1, G_1, I_1}, //LB3 | ||
270 | {1, K_1, J_1, L_1}, //LB4 | ||
271 | {1, B_2, A_2, C_2}, //LB5 | ||
272 | {1, E_2, D_2, F_2}, //LB6 | ||
273 | {1, H_2, G_2, I_2}, //LB7 | ||
274 | {1, K_2, J_2, L_2}, //LB8 | ||
275 | {1, B_3, A_3, C_3}, //LB9 | ||
276 | {1, E_3, D_3, F_3}, //LB10 | ||
277 | {1, H_3, G_3, I_3}, //LB11 | ||
278 | {1, K_3, J_3, L_3}, //LB12 | ||
279 | {1, B_4, A_4, C_4}, //LB13 | ||
280 | {1, E_4, D_4, F_4}, //LB14 | ||
281 | {1, H_4, G_4, I_4}, //LB15 | ||
282 | {1, K_4, J_4, L_4}, //LB16 | ||
283 | {1, B_5, A_5, C_5}, //LB17 | ||
284 | {1, E_5, D_5, F_5}, //LB18 | ||
285 | {1, H_5, G_5, I_5}, //LB19 | ||
286 | {1, K_5, J_5, L_5}, //LB20 | ||
287 | {1, B_6, A_6, C_6}, //LB21 | ||
288 | {1, E_6, D_6, F_6}, //LB22 | ||
289 | {1, H_6, G_6, I_6}, //LB23 | ||
290 | {1, K_6, J_6, L_6}, //LB24 | ||
291 | {1, B_7, A_7, C_7}, //LB25 | ||
292 | {1, E_7, D_7, F_7}, //LB26 | ||
293 | {1, H_7, G_7, I_7}, //LB27 | ||
294 | {1, K_7, J_7, L_7}, //LB28 | ||
295 | {1, B_8, A_8, C_8}, //LB29 | ||
296 | {1, E_8, D_8, F_8}, //LB30 | ||
297 | {1, H_8, G_8, I_8}, //LB31 | ||
298 | {1, K_8, J_8, L_8}, //LB32 | ||
299 | {1, B_9, A_9, C_9}, //LB33 | ||
300 | {1, E_9, D_9, F_9}, //LB34 | ||
301 | {1, H_9, G_9, I_9}, //LB35 | ||
302 | {1, K_9, J_9, L_9}, //LB36 | ||
303 | {1, B_10, A_10, C_10}, //LB37 | ||
304 | {1, E_10, D_10, F_10}, //LB38 | ||
305 | {1, H_10, G_10, I_10}, //LB39 | ||
306 | {1, K_10, J_10, L_10}, //LB40 | ||
307 | {1, B_11, A_11, C_11}, //LB41 | ||
308 | {1, E_11, D_11, F_11}, //LB42 | ||
309 | {1, H_11, G_11, I_11}, //LB43 | ||
310 | {1, K_11, J_11, L_11}, //LB44 | ||
311 | {1, B_12, A_12, C_12}, //LB45 | ||
312 | {1, E_12, D_12, F_12}, //LB46 | ||
313 | {1, H_12, G_12, I_12}, //LB47 | ||
314 | {1, K_12, J_12, L_12}, //LB48 | ||
315 | {1, B_13, A_13, C_13}, //LB49 | ||
316 | {1, E_13, D_13, F_13}, //LB50 | ||
317 | {1, H_13, G_13, I_13}, //LB51 | ||
318 | {1, K_13, J_13, L_13}, //LB52 | ||
319 | {1, B_14, A_14, C_14}, //LB53 | ||
320 | {1, E_14, D_14, F_14}, //LB54 | ||
321 | {1, H_14, G_14, I_14}, //LB55 | ||
322 | {1, K_14, J_14, L_14}, //LB56 | ||
323 | {1, B_15, A_15, C_15}, //LB57 | ||
324 | {1, E_15, D_15, F_15}, //LB58 | ||
325 | {1, H_15, G_15, I_15}, //LB59 | ||
326 | {1, K_15, J_15, L_15}, //LB60 | ||
327 | {1, B_16, A_16, C_16}, //LB61 | ||
328 | {1, E_16, D_16, F_16}, //LB62 | ||
329 | {1, H_16, G_16, I_16}, //LB63 | ||
330 | {1, K_16, J_16, L_16}, //LB64 | ||
331 | }; | ||
332 | |||
185 | #elif !defined(RGB_BACKLIGHT_M6_B) | 333 | #elif !defined(RGB_BACKLIGHT_M6_B) |
186 | // This is a 7-bit address, that gets left-shifted and bit 0 | 334 | // This is a 7-bit address, that gets left-shifted and bit 0 |
187 | // set to 0 for write, 1 for read (as per I2C protocol) | 335 | // set to 0 for write, 1 for read (as per I2C protocol) |
@@ -195,269 +343,292 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { | |||
195 | * | | G location | 343 | * | | G location |
196 | * | | | B location | 344 | * | | | B location |
197 | * | | | | */ | 345 | * | | | | */ |
198 | {0, C2_1, C3_1, C4_1}, // LA0 | 346 | {0, C2_1, C3_1, C4_1}, // LA0 |
199 | {0, C1_1, C3_2, C4_2}, // LA1 | 347 | {0, C1_1, C3_2, C4_2}, // LA1 |
200 | {0, C1_2, C2_2, C4_3}, // LA2 | 348 | {0, C1_2, C2_2, C4_3}, // LA2 |
201 | {0, C1_3, C2_3, C3_3}, // LA3 | 349 | {0, C1_3, C2_3, C3_3}, // LA3 |
202 | {0, C1_4, C2_4, C3_4}, // LA4 | 350 | {0, C1_4, C2_4, C3_4}, // LA4 |
203 | {0, C1_5, C2_5, C3_5}, // LA5 | 351 | {0, C1_5, C2_5, C3_5}, // LA5 |
204 | {0, C1_6, C2_6, C3_6}, // LA6 | 352 | {0, C1_6, C2_6, C3_6}, // LA6 |
205 | {0, C1_7, C2_7, C3_7}, // LA7 | 353 | {0, C1_7, C2_7, C3_7}, // LA7 |
206 | {0, C1_8, C2_8, C3_8}, // LA8 | 354 | {0, C1_8, C2_8, C3_8}, // LA8 |
207 | {0, C9_1, C8_1, C7_1}, // LA9 | 355 | {0, C9_1, C8_1, C7_1}, // LA9 |
208 | {0, C9_2, C8_2, C7_2}, // LA10 | 356 | {0, C9_2, C8_2, C7_2}, // LA10 |
209 | {0, C9_3, C8_3, C7_3}, // LA11 | 357 | {0, C9_3, C8_3, C7_3}, // LA11 |
210 | {0, C9_4, C8_4, C7_4}, // LA12 | 358 | {0, C9_4, C8_4, C7_4}, // LA12 |
211 | {0, C9_5, C8_5, C7_5}, // LA13 | 359 | {0, C9_5, C8_5, C7_5}, // LA13 |
212 | {0, C9_6, C8_6, C7_6}, // LA14 | 360 | {0, C9_6, C8_6, C7_6}, // LA14 |
213 | {0, C9_7, C8_7, C6_6}, // LA15 | 361 | {0, C9_7, C8_7, C6_6}, // LA15 |
214 | {0, C9_8, C7_7, C6_7}, // LA16 | 362 | {0, C9_8, C7_7, C6_7}, // LA16 |
215 | {0, C8_8, C7_8, C6_8}, // LA17 | 363 | {0, C8_8, C7_8, C6_8}, // LA17 |
216 | 364 | ||
217 | {0, C2_9, C3_9, C4_9}, // LB0 | 365 | {0, C2_9, C3_9, C4_9}, // LB0 |
218 | {0, C1_9, C3_10, C4_10}, // LB1 | 366 | {0, C1_9, C3_10, C4_10}, // LB1 |
219 | {0, C1_10, C2_10, C4_11}, // LB2 | 367 | {0, C1_10, C2_10, C4_11}, // LB2 |
220 | {0, C1_11, C2_11, C3_11}, // LB3 | 368 | {0, C1_11, C2_11, C3_11}, // LB3 |
221 | {0, C1_12, C2_12, C3_12}, // LB4 | 369 | {0, C1_12, C2_12, C3_12}, // LB4 |
222 | {0, C1_13, C2_13, C3_13}, // LB5 | 370 | {0, C1_13, C2_13, C3_13}, // LB5 |
223 | {0, C1_14, C2_14, C3_14}, // LB6 | 371 | {0, C1_14, C2_14, C3_14}, // LB6 |
224 | {0, C1_15, C2_15, C3_15}, // LB7 | 372 | {0, C1_15, C2_15, C3_15}, // LB7 |
225 | {0, C1_16, C2_16, C3_16}, // LB8 | 373 | {0, C1_16, C2_16, C3_16}, // LB8 |
226 | {0, C9_9, C8_9, C7_9}, // LB9 | 374 | {0, C9_9, C8_9, C7_9}, // LB9 |
227 | {0, C9_10, C8_10, C7_10}, // LB10 | 375 | {0, C9_10, C8_10, C7_10}, // LB10 |
228 | {0, C9_11, C8_11, C7_11}, // LB11 | 376 | {0, C9_11, C8_11, C7_11}, // LB11 |
229 | {0, C9_12, C8_12, C7_12}, // LB12 | 377 | {0, C9_12, C8_12, C7_12}, // LB12 |
230 | {0, C9_13, C8_13, C7_13}, // LB13 | 378 | {0, C9_13, C8_13, C7_13}, // LB13 |
231 | {0, C9_14, C8_14, C7_14}, // LB14 | 379 | {0, C9_14, C8_14, C7_14}, // LB14 |
232 | {0, C9_15, C8_15, C6_14}, // LB15 | 380 | {0, C9_15, C8_15, C6_14}, // LB15 |
233 | {0, C9_16, C7_15, C6_15}, // LB16 | 381 | {0, C9_16, C7_15, C6_15}, // LB16 |
234 | {0, C8_16, C7_16, C6_16}, // LB17 | 382 | {0, C8_16, C7_16, C6_16}, // LB17 |
235 | 383 | ||
236 | {1, C2_1, C3_1, C4_1}, // LC0 | 384 | {1, C2_1, C3_1, C4_1}, // LC0 |
237 | {1, C1_1, C3_2, C4_2}, // LC1 | 385 | {1, C1_1, C3_2, C4_2}, // LC1 |
238 | {1, C1_2, C2_2, C4_3}, // LC2 | 386 | {1, C1_2, C2_2, C4_3}, // LC2 |
239 | {1, C1_3, C2_3, C3_3}, // LC3 | 387 | {1, C1_3, C2_3, C3_3}, // LC3 |
240 | {1, C1_4, C2_4, C3_4}, // LC4 | 388 | {1, C1_4, C2_4, C3_4}, // LC4 |
241 | {1, C1_5, C2_5, C3_5}, // LC5 | 389 | {1, C1_5, C2_5, C3_5}, // LC5 |
242 | {1, C1_6, C2_6, C3_6}, // LC6 | 390 | {1, C1_6, C2_6, C3_6}, // LC6 |
243 | {1, C1_7, C2_7, C3_7}, // LC7 | 391 | {1, C1_7, C2_7, C3_7}, // LC7 |
244 | {1, C1_8, C2_8, C3_8}, // LC8 | 392 | {1, C1_8, C2_8, C3_8}, // LC8 |
245 | {1, C9_1, C8_1, C7_1}, // LC9 | 393 | {1, C9_1, C8_1, C7_1}, // LC9 |
246 | {1, C9_2, C8_2, C7_2}, // LC10 | 394 | {1, C9_2, C8_2, C7_2}, // LC10 |
247 | {1, C9_3, C8_3, C7_3}, // LC11 | 395 | {1, C9_3, C8_3, C7_3}, // LC11 |
248 | {1, C9_4, C8_4, C7_4}, // LC12 | 396 | {1, C9_4, C8_4, C7_4}, // LC12 |
249 | {1, C9_5, C8_5, C7_5}, // LC13 | 397 | {1, C9_5, C8_5, C7_5}, // LC13 |
250 | {1, C9_6, C8_6, C7_6}, // LC14 | 398 | {1, C9_6, C8_6, C7_6}, // LC14 |
251 | {1, C9_7, C8_7, C6_6}, // LC15 | 399 | {1, C9_7, C8_7, C6_6}, // LC15 |
252 | {1, C9_8, C7_7, C6_7}, // LC16 | 400 | {1, C9_8, C7_7, C6_7}, // LC16 |
253 | {1, C8_8, C7_8, C6_8}, // LC17 | 401 | {1, C8_8, C7_8, C6_8}, // LC17 |
254 | 402 | ||
255 | {1, C2_9, C3_9, C4_9}, // LD0 | 403 | {1, C2_9, C3_9, C4_9}, // LD0 |
256 | {1, C1_9, C3_10, C4_10}, // LD1 | 404 | {1, C1_9, C3_10, C4_10}, // LD1 |
257 | {1, C1_10, C2_10, C4_11}, // LD2 | 405 | {1, C1_10, C2_10, C4_11}, // LD2 |
258 | {1, C1_11, C2_11, C3_11}, // LD3 | 406 | {1, C1_11, C2_11, C3_11}, // LD3 |
259 | {1, C1_12, C2_12, C3_12}, // LD4 | 407 | {1, C1_12, C2_12, C3_12}, // LD4 |
260 | {1, C1_13, C2_13, C3_13}, // LD5 | 408 | {1, C1_13, C2_13, C3_13}, // LD5 |
261 | {1, C1_14, C2_14, C3_14}, // LD6 | 409 | {1, C1_14, C2_14, C3_14}, // LD6 |
262 | {1, C1_15, C2_15, C3_15}, // LD7 | 410 | {1, C1_15, C2_15, C3_15}, // LD7 |
263 | {1, C1_16, C2_16, C3_16}, // LD8 | 411 | {1, C1_16, C2_16, C3_16}, // LD8 |
264 | {1, C9_9, C8_9, C7_9}, // LD9 | 412 | {1, C9_9, C8_9, C7_9}, // LD9 |
265 | {1, C9_10, C8_10, C7_10}, // LD10 | 413 | {1, C9_10, C8_10, C7_10}, // LD10 |
266 | {1, C9_11, C8_11, C7_11}, // LD11 | 414 | {1, C9_11, C8_11, C7_11}, // LD11 |
267 | {1, C9_12, C8_12, C7_12}, // LD12 | 415 | {1, C9_12, C8_12, C7_12}, // LD12 |
268 | {1, C9_13, C8_13, C7_13}, // LD13 | 416 | {1, C9_13, C8_13, C7_13}, // LD13 |
269 | {1, C9_14, C8_14, C7_14}, // LD14 | 417 | {1, C9_14, C8_14, C7_14}, // LD14 |
270 | {1, C9_15, C8_15, C6_14}, // LD15 | 418 | {1, C9_15, C8_15, C6_14}, // LD15 |
271 | {1, C9_16, C7_15, C6_15}, // LD16 | 419 | {1, C9_16, C7_15, C6_15}, // LD16 |
272 | {1, C8_16, C7_16, C6_16}, // LD17 | 420 | {1, C8_16, C7_16, C6_16}, // LD17 |
273 | }; | 421 | }; |
274 | #endif // !defined(RGB_BACKLIGHT_M6_B) | 422 | #endif // !defined(RGB_BACKLIGHT_M6_B) |
275 | 423 | ||
276 | 424 | ||
277 | typedef struct Point { | 425 | typedef struct Point { |
278 | uint8_t x; | 426 | uint8_t x; |
279 | uint8_t y; | 427 | uint8_t y; |
280 | } Point; | 428 | } Point; |
281 | 429 | ||
282 | 430 | ||
283 | // index in range 0..71 (LA0..LA17, LB0..LB17, LC0..LC17, LD0..LD17) | 431 | // index in range 0..71 (LA0..LA17, LB0..LB17, LC0..LC17, LD0..LD17) |
284 | // point values in range x=0..224 y=0..64 | 432 | // point values in range x=0..224 y=0..64 |
285 | // origin is center of top-left key (i.e Esc) | 433 | // origin is center of top-left key (i.e Esc) |
286 | #if defined (RGB_BACKLIGHT_ZEAL65) | 434 | #if defined(RGB_BACKLIGHT_ZEAL65) |
287 | const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = { | 435 | const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = { |
288 | // LA0..LA17 | 436 | // LA0..LA17 |
289 | {120,16}, {104,16}, {88,16}, {72,16}, {56,16}, {40,16}, {24,16}, {4,16}, {4,32}, | 437 | {120,16}, {104,16}, {88,16}, {72,16}, {56,16}, {40,16}, {24,16}, {4,16}, {4,32}, |
290 | {128,0}, {112,0}, {96,0}, {80,0}, {64,0}, {48,0}, {32,0}, {16,0}, {0,0}, | 438 | {128,0}, {112,0}, {96,0}, {80,0}, {64,0}, {48,0}, {32,0}, {16,0}, {0,0}, |
291 | // LB0..LB17 | 439 | // LB0..LB17 |
292 | {144,0}, {160,0}, {176,0}, {192,0}, {216,0}, {224,0}, {240,0}, {240,16}, {240,32}, | 440 | {144,0}, {160,0}, {176,0}, {192,0}, {216,0}, {224,0}, {240,0}, {240,16}, {240,32}, |
293 | {136,16}, {152,16}, {168,16}, {184,16}, {200,16}, {220,16}, {240,48}, {240,64}, {224,64}, | 441 | {136,16}, {152,16}, {168,16}, {184,16}, {200,16}, {220,16}, {240,48}, {240,64}, {224,64}, |
294 | // LC0..LC17 | 442 | // LC0..LC17 |
295 | {96,64}, {100,48}, {84,48}, {68,48}, {52,48}, {36,48}, {255,255}, {48,60}, {28,64}, | 443 | {96,64}, {100,48}, {84,48}, {68,48}, {52,48}, {36,48}, {255,255}, {48,60}, {28,64}, |
296 | {108,32}, {92,32}, {76,32}, {60,32}, {44,32}, {28,32}, {20,44}, {10,48}, {4,64}, | 444 | {108,32}, {92,32}, {76,32}, {60,32}, {44,32}, {28,32}, {20,44}, {10,48}, {4,64}, |
297 | // LD0..LD17 | 445 | // LD0..LD17 |
298 | {124,32}, {140,32}, {156,32}, {172,32}, {188,32}, {214,32}, {180,48}, {202,48}, {224,48}, | 446 | {124,32}, {140,32}, {156,32}, {172,32}, {188,32}, {214,32}, {180,48}, {202,48}, {224,48}, |
299 | {116,48}, {132,48}, {148,48}, {164,48}, {255,255}, {144,60}, {164,64}, {188,64}, {208,64} | 447 | {116,48}, {132,48}, {148,48}, {164,48}, {255,255}, {144,60}, {164,64}, {188,64}, {208,64} |
300 | }; | 448 | }; |
301 | const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = { | 449 | const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = { |
302 | // LA0..LA17 | 450 | // LA0..LA17 |
303 | {64,128}, {75,132}, {84,145}, {91,164}, {97,187}, {102,213}, {105,242}, {109,255}, {128,243}, | 451 | {64,128}, {75,132}, {84,145}, {91,164}, {97,187}, {102,213}, {105,242}, {109,255}, {128,243}, |
304 | {61,255}, {67,255}, {72,255}, {77,255}, {82,255}, {86,255}, {90,255}, {93,255}, {96,255}, | 452 | {61,255}, {67,255}, {72,255}, {77,255}, {82,255}, {86,255}, {90,255}, {93,255}, {96,255}, |
305 | // LB0..LB17 | 453 | // LB0..LB17 |
306 | {56,255}, {51,255}, {46,255}, {42,255}, {37,255}, {35,255}, {32,255}, {19,255}, {0,255}, | 454 | {56,255}, {51,255}, {46,255}, {42,255}, {37,255}, {35,255}, {32,255}, {19,255}, {0,255}, |
307 | {53,132}, {44,145}, {37,164}, {31,187}, {26,213}, {22,249}, {237,255}, {224,255}, {221,255}, | 455 | {53,132}, {44,145}, {37,164}, {31,187}, {26,213}, {22,249}, {237,255}, {224,255}, {221,255}, |
308 | // LC0..LC17 | 456 | // LC0..LC17 |
309 | {184,255}, {179,135}, {170,149}, {163,169}, {157,193}, {153,220}, {255,255}, {167,255}, {165,255}, | 457 | {184,255}, {179,135}, {170,149}, {163,169}, {157,193}, {153,220}, {255,255}, {167,255}, {165,255}, |
310 | {128,26}, {128,60}, {128,94}, {128,128}, {128,162}, {128,196}, {145,233}, {148,255}, {161,255}, | 458 | {128,26}, {128,60}, {128,94}, {128,128}, {128,162}, {128,196}, {145,233}, {148,255}, {161,255}, |
311 | // LD0..LD17 | 459 | // LD0..LD17 |
312 | {0,9}, {0,43}, {0,77}, {0,111}, {0,145}, {0,201}, {224,181}, {230,217}, {235,255}, | 460 | {0,9}, {0,43}, {0,77}, {0,111}, {0,145}, {0,201}, {224,181}, {230,217}, {235,255}, |
313 | {189,128}, {200,131}, {210,141}, {218,159}, {255,255}, {201,228}, {206,255}, {213,255}, {218,255} | 461 | {189,128}, {200,131}, {210,141}, {218,159}, {255,255}, {201,228}, {206,255}, {213,255}, {218,255} |
314 | }; | 462 | }; |
315 | #elif defined (RGB_BACKLIGHT_KOYU) | 463 | #elif defined(RGB_BACKLIGHT_KOYU) |
316 | const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = { | 464 | const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = { |
317 | // LA0..LA17 | 465 | // LA0..LA17 |
318 | {120,16}, {104,16}, {88,16}, {72,16}, {56,16}, {40,16}, {24,16}, {4,16}, {4,32}, | 466 | {120,16}, {104,16}, {88,16}, {72,16}, {56,16}, {40,16}, {24,16}, {4,16}, {4,32}, |
319 | {128,0}, {112,0}, {96,0}, {80,0}, {64,0}, {48,0}, {32,0}, {16,0}, {0,0}, | 467 | {128,0}, {112,0}, {96,0}, {80,0}, {64,0}, {48,0}, {32,0}, {16,0}, {0,0}, |
320 | // LB0..LB17 | 468 | // LB0..LB17 |
321 | {144,0}, {160,0}, {176,0}, {192,0}, {208,0}, {224,0}, {240,0}, {240,16}, {240,32}, | 469 | {144,0}, {160,0}, {176,0}, {192,0}, {208,0}, {224,0}, {240,0}, {240,16}, {240,32}, |
322 | {136,16}, {152,16}, {168,16}, {184,16}, {200,16}, {220,16}, {240,48}, {240,64}, {224,64}, | 470 | {136,16}, {152,16}, {168,16}, {184,16}, {200,16}, {220,16}, {240,48}, {240,64}, {224,64}, |
323 | // LC0..LC17 | 471 | // LC0..LC17 |
324 | {112,64}, {100,48}, {84,48}, {68,48}, {52,48}, {36,48}, {64,60}, {44,60}, {24,64}, | 472 | {112,64}, {100,48}, {84,48}, {68,48}, {52,48}, {36,48}, {64,60}, {44,60}, {24,64}, |
325 | {108,32}, {92,32}, {76,32}, {60,32}, {44,32}, {28,32}, {255,255}, {10,48}, {4,64}, | 473 | {108,32}, {92,32}, {76,32}, {60,32}, {44,32}, {28,32}, {255,255}, {10,48}, {4,64}, |
326 | // LD0..LD17 | 474 | // LD0..LD17 |
327 | {124,32}, {140,32}, {156,32}, {172,32}, {188,32}, {214,32}, {180,48}, {202,48}, {224,48}, | 475 | {124,32}, {140,32}, {156,32}, {172,32}, {188,32}, {214,32}, {180,48}, {202,48}, {224,48}, |
328 | {116,48}, {132,48}, {148,48}, {164,48}, {255,255}, {160,60}, {180,64}, {208,64}, {255,255} | 476 | {116,48}, {132,48}, {148,48}, {164,48}, {255,255}, {160,60}, {180,64}, {208,64}, {255,255} |
329 | }; | 477 | }; |
330 | const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = { | 478 | const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = { |
331 | // LA0..LA17 | 479 | // LA0..LA17 |
332 | {64,128}, {75,132}, {84,145}, {91,164}, {97,187}, {102,213}, {105,242}, {109,255}, {128,243}, | 480 | {64,128}, {75,132}, {84,145}, {91,164}, {97,187}, {102,213}, {105,242}, {109,255}, {128,243}, |
333 | {61,255}, {67,255}, {72,255}, {77,255}, {82,255}, {86,255}, {90,255}, {93,255}, {96,255}, | 481 | {61,255}, {67,255}, {72,255}, {77,255}, {82,255}, {86,255}, {90,255}, {93,255}, {96,255}, |
334 | // LB0..LB17 | 482 | // LB0..LB17 |
335 | {56,255}, {51,255}, {46,255}, {42,255}, {38,255}, {35,255}, {32,255}, {19,255}, {0,255}, | 483 | {56,255}, {51,255}, {46,255}, {42,255}, {38,255}, {35,255}, {32,255}, {19,255}, {0,255}, |
336 | {53,132}, {44,145}, {37,164}, {31,187}, {26,213}, {22,249}, {237,255}, {224,255}, {221,255}, | 484 | {53,132}, {44,145}, {37,164}, {31,187}, {26,213}, {22,249}, {237,255}, {224,255}, {221,255}, |
337 | // LC0..LC17 | 485 | // LC0..LC17 |
338 | {189,255}, {179,135}, {170,149}, {163,169}, {157,193}, {153,220}, {172,252}, {169,255}, {165,255}, | 486 | {189,255}, {179,135}, {170,149}, {163,169}, {157,193}, {153,220}, {172,252}, {169,255}, {165,255}, |
339 | {128,26}, {128,60}, {128,94}, {128,128}, {128,162}, {128,196}, {255,255}, {148,255}, {161,255}, | 487 | {128,26}, {128,60}, {128,94}, {128,128}, {128,162}, {128,196}, {255,255}, {148,255}, {161,255}, |
340 | // LD0..LD17 | 488 | // LD0..LD17 |
341 | {0,9}, {0,43}, {0,77}, {0,111}, {0,145}, {0,201}, {224,181}, {230,217}, {235,255}, | 489 | {0,9}, {0,43}, {0,77}, {0,111}, {0,145}, {0,201}, {224,181}, {230,217}, {235,255}, |
342 | {189,128}, {200,131}, {210,141}, {218,159}, {255,255}, {207,238}, {211,255}, {218,255}, {255,255} | 490 | {189,128}, {200,131}, {210,141}, {218,159}, {255,255}, {207,238}, {211,255}, {218,255}, {255,255} |
343 | }; | 491 | }; |
344 | #elif defined (RGB_BACKLIGHT_ZEAL60) || defined (RGB_BACKLIGHT_M60_A) | 492 | #elif defined(RGB_BACKLIGHT_ZEAL60) || defined(RGB_BACKLIGHT_M60_A) |
345 | const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = { | 493 | const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = { |
346 | // LA0..LA17 | 494 | // LA0..LA17 |
347 | {120,16}, {104,16}, {88,16}, {72,16}, {56,16}, {40,16}, {24,16}, {4,16}, {4,32}, | 495 | {120,16}, {104,16}, {88,16}, {72,16}, {56,16}, {40,16}, {24,16}, {4,16}, {4,32}, |
348 | {128,0}, {112,0}, {96,0}, {80,0}, {64,0}, {48,0}, {32,0}, {16,0}, {0,0}, | 496 | {128,0}, {112,0}, {96,0}, {80,0}, {64,0}, {48,0}, {32,0}, {16,0}, {0,0}, |
349 | // LB0..LB17 | 497 | // LB0..LB17 |
350 | {144,0}, {160,0}, {176,0}, {192,0}, {216,0}, {224,0}, {255,255}, {255,255}, {255,255}, | 498 | {144,0}, {160,0}, {176,0}, {192,0}, {216,0}, {224,0}, {255,255}, {255,255}, {255,255}, |
351 | {136,16}, {152,16}, {168,16}, {184,16}, {200,16}, {220,16}, {255,255}, {255,255}, {255,255}, | 499 | {136,16}, {152,16}, {168,16}, {184,16}, {200,16}, {220,16}, {255,255}, {255,255}, {255,255}, |
352 | // LC0..LC17 | 500 | // LC0..LC17 |
353 | {102,64}, {100,48}, {84,48}, {68,48}, {52,48}, {36,48}, {60,64}, {43,64}, {23,64}, | 501 | {102,64}, {100,48}, {84,48}, {68,48}, {52,48}, {36,48}, {60,64}, {43,64}, {23,64}, |
354 | {108,32}, {92,32}, {76,32}, {60,32}, {44,32}, {28,32}, {20,48}, {2,48}, {3,64}, | 502 | {108,32}, {92,32}, {76,32}, {60,32}, {44,32}, {28,32}, {20,48}, {2,48}, {3,64}, |
355 | // LD0..LD17 | 503 | // LD0..LD17 |
356 | {124,32}, {140,32}, {156,32}, {172,32}, {188,32}, {214,32}, {180,48}, {210,48}, {224,48}, | 504 | {124,32}, {140,32}, {156,32}, {172,32}, {188,32}, {214,32}, {180,48}, {210,48}, {224,48}, |
357 | {116,48}, {132,48}, {148,48}, {164,48}, {144,64}, {161,64}, {181,64}, {201,64}, {221,64} | 505 | {116,48}, {132,48}, {148,48}, {164,48}, {144,64}, {161,64}, {181,64}, {201,64}, {221,64} |
358 | }; | 506 | }; |
359 | const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = { | 507 | const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = { |
360 | // LA0..LA17 | 508 | // LA0..LA17 |
361 | {58,129}, {70,129}, {80,139}, {89,157}, {96,181}, {101,208}, {105,238}, {109,255}, {128,247}, {58,255}, | 509 | {58,129}, {70,129}, {80,139}, {89,157}, {96,181}, {101,208}, {105,238}, {109,255}, {128,247}, {58,255}, |
362 | {64,255}, {70,255}, {75,255}, {80,255}, {85,255}, {89,255}, {93,255}, {96,255}, | 510 | {64,255}, {70,255}, {75,255}, {80,255}, {85,255}, {89,255}, {93,255}, {96,255}, |
363 | // LB0..LB17 | 511 | // LB0..LB17 |
364 | {53,255}, {48,255}, {43,255}, {39,255}, {34,255}, {32,255}, {255,255}, {255,255}, {255,255}, | 512 | {53,255}, {48,255}, {43,255}, {39,255}, {34,255}, {32,255}, {255,255}, {255,255}, {255,255}, |
365 | {48,139}, {39,157}, {32,181}, {27,208}, {23,238}, {19,255}, {255,255}, {255,255}, {255,255}, | 513 | {48,139}, {39,157}, {32,181}, {27,208}, {23,238}, {19,255}, {255,255}, {255,255}, {255,255}, |
366 | // LC0..LC17 | 514 | // LC0..LC17 |
367 | {188,255}, {183,131}, {173,143}, {165,163}, {159,188}, {154,216}, {172,252}, {170,255}, {165,255}, | 515 | {188,255}, {183,131}, {173,143}, {165,163}, {159,188}, {154,216}, {172,252}, {170,255}, {165,255}, |
368 | {128,9}, {128,46}, {128,82}, {128,119}, {128,155}, {128,192}, {150,244}, {147,255}, {161,255}, | 516 | {128,9}, {128,46}, {128,82}, {128,119}, {128,155}, {128,192}, {150,244}, {147,255}, {161,255}, |
369 | // LD0..LD17 | 517 | // LD0..LD17 |
370 | {0,27}, {0,64}, {0,101}, {0,137}, {0,174}, {255,233}, {228,201}, {235,255}, {237,255}, | 518 | {0,27}, {0,64}, {0,101}, {0,137}, {0,174}, {255,233}, {228,201}, {235,255}, {237,255}, |
371 | {195,128}, {206,136}, {215,152}, {222,175}, {205,234}, {209,255}, {214,255}, {219,255}, {223,255} | 519 | {195,128}, {206,136}, {215,152}, {222,175}, {205,234}, {209,255}, {214,255}, {219,255}, {223,255} |
372 | }; | 520 | }; |
373 | #elif defined (RGB_BACKLIGHT_HS60) && defined (HS60_ANSI) | 521 | #elif defined(RGB_BACKLIGHT_HS60) && defined(HS60_ANSI) |
374 | const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = { | 522 | const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = { |
375 | // LA1..LA47 | 523 | // LA1..LA47 |
376 | {0,0}, {4,16}, {6,32}, {10,48}, {16,0}, {24,16}, {28,32}, {36,48}, {32,0}, {40,16}, {44,32}, {52,48}, | 524 | {0,0}, {4,16}, {6,32}, {10,48}, {16,0}, {24,16}, {28,32}, {36,48}, {32,0}, {40,16}, {44,32}, {52,48}, |
377 | {48,0}, {56,16}, {60,32}, {68,48}, {64,0}, {72,16}, {76,32}, {84,48}, {80,0}, {88,16}, {92,32}, {100,48}, | 525 | {48,0}, {56,16}, {60,32}, {68,48}, {64,0}, {72,16}, {76,32}, {84,48}, {80,0}, {88,16}, {92,32}, {100,48}, |
378 | {96,0}, {104,16}, {108,32}, {116,48}, {112,0}, {120,16}, {124,32}, {132,48}, {128,0}, {136,16}, {140,32}, | 526 | {96,0}, {104,16}, {108,32}, {116,48}, {112,0}, {120,16}, {124,32}, {132,48}, {128,0}, {136,16}, {140,32}, |
379 | {148,48}, {144,0}, {152,16}, {156,32}, {164,48}, {160,0}, {168,16}, {172,32}, {180,48}, {176,0}, {184, 16}, {188,32}, | 527 | {148,48}, {144,0}, {152,16}, {156,32}, {164,48}, {160,0}, {168,16}, {172,32}, {180,48}, {176,0}, {184, 16}, {188,32}, |
380 | {255,255},// LA48 does not exist, dummy | 528 | {255,255},// LA48 does not exist, dummy |
381 | // LA49..LA50 | 529 | // LA49..LA50 |
382 | {192,0}, {200,16}, | 530 | {192,0}, {200,16}, |
383 | {255,255},// LA51 does not exit, dummy | 531 | {255,255},// LA51 does not exit, dummy |
384 | // LA52..LA60 | 532 | // LA52..LA60 |
385 | {210,48}, {216,0}, {220,16}, {214,32}, {222,64}, {2,64}, {22,64}, {42,64}, {102,64}, | 533 | {210,48}, {216,0}, {220,16}, {214,32}, {222,64}, {2,64}, {22,64}, {42,64}, {102,64}, |
386 | {255,255},// LA61 does not exit, dummy | 534 | {255,255},// LA61 does not exit, dummy |
387 | {162,64}, {182,64}, {202,64} | 535 | {162,64}, {182,64}, {202,64} |
388 | }; | 536 | }; |
389 | const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = { | 537 | const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = { |
390 | // LA1..LA47 | 538 | // LA1..LA47 |
391 | {96,255}, {109,255}, {128,242}, {148,255}, {93,255}, {105,238}, {128,192}, {154,216}, {89,255}, {101,208}, {128,155}, {159,188}, | 539 | {96,255}, {109,255}, {128,242}, {148,255}, {93,255}, {105,238}, {128,192}, {154,216}, {89,255}, {101,208}, {128,155}, {159,188}, |
392 | {85,255}, {96,181}, {128,119}, {165,163}, {81,255}, {89,157}, {128,82}, {173,143}, {75,255}, {81,139}, {128,46}, {183,131}, | 540 | {85,255}, {96,181}, {128,119}, {165,163}, {81,255}, {89,157}, {128,82}, {173,143}, {75,255}, {81,139}, {128,46}, {183,131}, |
393 | {70,255}, {70,129}, {129,9}, {195,128}, {64,255}, {58,129}, {255,27}, {206,136}, {58,255}, {47,139}, {255,64}, {215,152}, | 541 | {70,255}, {70,129}, {129,9}, {195,128}, {64,255}, {58,129}, {255,27}, {206,136}, {58,255}, {47,139}, {255,64}, {215,152}, |
394 | {53,255}, {39,157}, {255,101}, {222,175}, {47,255}, {32,181}, {255,137}, {228,201}, {43,255}, {27,208}, {255, 174}, | 542 | {53,255}, {39,157}, {255,101}, {222,175}, {47,255}, {32,181}, {255,137}, {228,201}, {43,255}, {27,208}, {255, 174}, |
395 | {255,255},// LA48 does not exist, dummy | 543 | {255,255},// LA48 does not exist, dummy |
396 | // LA49..LA50 | 544 | // LA49..LA50 |
397 | {39,255}, {23,238}, | 545 | {39,255}, {23,238}, |
398 | {255,255},// LA51 does not exit, dummy | 546 | {255,255},// LA51 does not exit, dummy |
399 | // LA52..LA60 | 547 | // LA52..LA60 |
400 | {235,255}, {33,255}, {19,255}, {255,233}, {224,255}, {160,255}, {164,255}, {169,255}, {188,255}, | 548 | {235,255}, {33,255}, {19,255}, {255,233}, {224,255}, {160,255}, {164,255}, {169,255}, {188,255}, |
401 | {255,255},// LA61 does not exit, dummy | 549 | {255,255},// LA61 does not exit, dummy |
402 | {209,255}, {215,255}, {220,255} | 550 | {209,255}, {215,255}, {220,255} |
403 | }; | 551 | }; |
404 | #elif defined (RGB_BACKLIGHT_HS60) && defined (HS60_HHKB) | 552 | #elif defined(RGB_BACKLIGHT_HS60) && defined(HS60_HHKB) |
405 | const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = { | 553 | const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = { |
406 | // LA1..LA60 | 554 | // LA1..LA60 |
407 | {0,0}, {4,16}, {6,32}, {10,48}, {16,0}, {24,16}, {28,32}, {36,48}, {32,0}, {40,16}, {44,32}, {52,48}, | 555 | {0,0}, {4,16}, {6,32}, {10,48}, {16,0}, {24,16}, {28,32}, {36,48}, {32,0}, {40,16}, {44,32}, {52,48}, |
408 | {48,0}, {56,16}, {60,32}, {68,48}, {64,0}, {72,16}, {76,32}, {84,48}, {80,0}, {88,16}, {92,32}, {100,48}, | 556 | {48,0}, {56,16}, {60,32}, {68,48}, {64,0}, {72,16}, {76,32}, {84,48}, {80,0}, {88,16}, {92,32}, {100,48}, |
409 | {96,0}, {104,16}, {108,32}, {116,48}, {112,0}, {120,16}, {124,32}, {132,48}, {128,0}, {136,16}, {140,32}, | 557 | {96,0}, {104,16}, {108,32}, {116,48}, {112,0}, {120,16}, {124,32}, {132,48}, {128,0}, {136,16}, {140,32}, |
410 | {148,48}, {144,0}, {152,16}, {156,32}, {164,48}, {160,0}, {168,16}, {172,32}, {180,48}, {176,0}, {184, 16}, {188,32}, | 558 | {148,48}, {144,0}, {152,16}, {156,32}, {164,48}, {160,0}, {168,16}, {172,32}, {180,48}, {176,0}, {184, 16}, {188,32}, |
411 | {224,0}, {192,0}, {200,16}, {202,48}, {224,48}, {208,0}, {220,16}, {214,32}, {220,64}, {4,64}, {24,64}, {44,64}, {112,64}, | 559 | {224,0}, {192,0}, {200,16}, {202,48}, {224,48}, {208,0}, {220,16}, {214,32}, {220,64}, {4,64}, {24,64}, {44,64}, {112,64}, |
412 | {255,255}, {255,255}, // LA61..LA62 does not exit, dummy | 560 | {255,255}, {255,255}, // LA61..LA62 does not exit, dummy |
413 | // LA63..LA64 | 561 | // LA63..LA64 |
414 | {180,64}, {200,64} | 562 | {180,64}, {200,64} |
415 | }; | 563 | }; |
416 | const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = { | 564 | const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = { |
417 | // LA1..LA60 | 565 | // LA1..LA60 |
418 | {96,255}, {109,255}, {128,242}, {148,255}, {93,255}, {105,238}, {128,192}, {154,216}, {89,255}, {101,208}, {128,155}, {159,188}, | 566 | {96,255}, {109,255}, {128,242}, {148,255}, {93,255}, {105,238}, {128,192}, {154,216}, {89,255}, {101,208}, {128,155}, {159,188}, |
419 | {85,255}, {96,181}, {128,119}, {165,163}, {81,255}, {89,157}, {128,82}, {173,143}, {75,255}, {81,139}, {128,46}, {183,131}, | 567 | {85,255}, {96,181}, {128,119}, {165,163}, {81,255}, {89,157}, {128,82}, {173,143}, {75,255}, {81,139}, {128,46}, {183,131}, |
420 | {70,255}, {70,129}, {129,9}, {195,128}, {64,255}, {58,129}, {255,27}, {206,136}, {58,255}, {47,139}, {255,64}, {215,152}, | 568 | {70,255}, {70,129}, {129,9}, {195,128}, {64,255}, {58,129}, {255,27}, {206,136}, {58,255}, {47,139}, {255,64}, {215,152}, |
421 | {53,255}, {39,157}, {255,101}, {222,175}, {47,255}, {32,181}, {255,137}, {228,201}, {43,255}, {27,208}, {255, 174}, {32,255}, | 569 | {53,255}, {39,157}, {255,101}, {222,175}, {47,255}, {32,181}, {255,137}, {228,201}, {43,255}, {27,208}, {255, 174}, {32,255}, |
422 | {39,255}, {23,238}, {233,242}, {237,255}, {35,255}, {19,255}, {255,233}, {223,255}, {161,255}, {165,255}, {170,255}, {192,255}, | 570 | {39,255}, {23,238}, {233,242}, {237,255}, {35,255}, {19,255}, {255,233}, {223,255}, {161,255}, {165,255}, {170,255}, {192,255}, |
423 | {255,255}, {255,255}, // LA61..LA62 does not exit, dummy | 571 | {255,255}, {255,255}, // LA61..LA62 does not exit, dummy |
424 | // LA63..LA64 | 572 | // LA63..LA64 |
425 | {214,255}, {219,255} | 573 | {214,255}, {219,255} |
426 | }; | 574 | }; |
427 | #elif defined (RGB_BACKLIGHT_HS60) //HS60_ISO | 575 | #elif defined(RGB_BACKLIGHT_HS60) //HS60_ISO |
428 | const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = { | 576 | const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = { |
429 | // LA1..LA50 | 577 | // LA1..LA50 |
430 | {0,0}, {4,16}, {6,32}, {2,48}, {16,0}, {24,16}, {28,32}, {36,48}, {32,0}, {40,16}, {44,32}, {52,48}, {48,0}, | 578 | {0,0}, {4,16}, {6,32}, {2,48}, {16,0}, {24,16}, {28,32}, {36,48}, {32,0}, {40,16}, {44,32}, {52,48}, {48,0}, |
431 | {56,16}, {60,32}, {68,48}, {64,0}, {72,16}, {76,32}, {84,48}, {80,0}, {88,16}, {92,32}, {100,48}, {96,0}, {104,16}, | 579 | {56,16}, {60,32}, {68,48}, {64,0}, {72,16}, {76,32}, {84,48}, {80,0}, {88,16}, {92,32}, {100,48}, {96,0}, {104,16}, |
432 | {108,32}, {116,48}, {112,0}, {120,16}, {124,32}, {132,48}, {128,0}, {136,16}, {140,32}, {148,48}, {144,0}, {152,16}, | 580 | {108,32}, {116,48}, {112,0}, {120,16}, {124,32}, {132,48}, {128,0}, {136,16}, {140,32}, {148,48}, {144,0}, {152,16}, |
433 | {156,32}, {164,48}, {160,0}, {168,16}, {172,32}, {180,48}, {176,0}, {184, 16}, {188,32}, {20,48}, {192,0}, {200,16}, | 581 | {156,32}, {164,48}, {160,0}, {168,16}, {172,32}, {180,48}, {176,0}, {184, 16}, {188,32}, {20,48}, {192,0}, {200,16}, |
434 | {255,255},// LA51 does not exit, dummy | 582 | {255,255},// LA51 does not exit, dummy |
435 | // LA52..LA60 | 583 | // LA52..LA60 |
436 | {210,48}, {216,0}, {220,16}, {222,24}, {222,64}, {2,64}, {22,64}, {42,64}, {102,64}, | 584 | {210,48}, {216,0}, {220,16}, {222,24}, {222,64}, {2,64}, {22,64}, {42,64}, {102,64}, |
437 | {255,255},// LA61 does not exit, dummy | 585 | {255,255},// LA61 does not exit, dummy |
438 | {162,64}, {182,64}, {202,64} | 586 | {162,64}, {182,64}, {202,64} |
439 | }; | 587 | }; |
440 | const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = { | 588 | const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = { |
441 | // LA1..LA50 | 589 | // LA1..LA50 |
442 | {96,255}, {109,255}, {128,242}, {147,255}, {93,255}, {105,238}, {128,192}, {154,216}, {89,255}, {101,208}, {128,155}, {159,188}, {85,255}, | 590 | {96,255}, {109,255}, {128,242}, {147,255}, {93,255}, {105,238}, {128,192}, {154,216}, {89,255}, {101,208}, {128,155}, {159,188}, {85,255}, |
443 | {96,181}, {128,119}, {165,163}, {81,255}, {89,157}, {128,82}, {173,143}, {75,255}, {81,139}, {128,46}, {183,131}, {70,255}, {70,129}, | 591 | {96,181}, {128,119}, {165,163}, {81,255}, {89,157}, {128,82}, {173,143}, {75,255}, {81,139}, {128,46}, {183,131}, {70,255}, {70,129}, |
444 | {129,9}, {195,128}, {64,255}, {58,129}, {255,27}, {206,136}, {58,255}, {47,139}, {255,64}, {215,152}, {53,255}, {39,157}, {255,101}, | 592 | {129,9}, {195,128}, {64,255}, {58,129}, {255,27}, {206,136}, {58,255}, {47,139}, {255,64}, {215,152}, {53,255}, {39,157}, {255,101}, |
445 | {222,175}, {47,255}, {32,181}, {255,137}, {228,201}, {43,255}, {27,208}, {255, 174}, {150,246}, {39,255}, {23,238}, | 593 | {222,175}, {47,255}, {32,181}, {255,137}, {228,201}, {43,255}, {27,208}, {255, 174}, {150,246}, {39,255}, {23,238}, |
446 | {255,255},// LA51 does not exit, dummy | 594 | {255,255},// LA51 does not exit, dummy |
447 | // LA52..LA60 | 595 | // LA52..LA60 |
448 | {235,255}, {33,255}, {19,255}, {10,255}, {224,255}, {160,255}, {164,255}, {169,255}, {188,255}, | 596 | {235,255}, {33,255}, {19,255}, {10,255}, {224,255}, {160,255}, {164,255}, {169,255}, {188,255}, |
449 | {255,255},// LA61 does not exit, dummy | 597 | {255,255},// LA61 does not exit, dummy |
450 | {209,255}, {215,255}, {220,255} | 598 | {209,255}, {215,255}, {220,255} |
451 | }; | 599 | }; |
452 | #elif defined (RGB_BACKLIGHT_M6_B) | 600 | #elif defined(RGB_BACKLIGHT_NK65) |
601 | const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = { | ||
602 | // LA1..LA60 | ||
603 | {0,0}, {4,16}, {6,32}, {10,48}, {16,0}, {24,16}, {28,32}, {36,48}, {32,0}, {40,16}, {44,32}, {52,48}, | ||
604 | {48,0}, {56,16}, {60,32}, {68,48}, {64,0}, {72,16}, {76,32}, {84,48}, {80,0}, {88,16}, {92,32}, {100,48}, | ||
605 | {96,0}, {104,16}, {108,32}, {116,48}, {112,0}, {120,16}, {124,32}, {132,48}, {128,0}, {136,16}, {140,32}, | ||
606 | {148,48}, {144,0}, {152,16}, {156,32}, {164,48}, {160,0}, {168,16}, {172,32}, {180,48}, {176,0}, {184, 16}, {188,32}, | ||
607 | {160,64}, {192,0}, {200,16}, {210,48}, {224,48}, {216,0}, {220,16}, {214,32}, {224,64}, {2,64}, {22,64}, {42,64}, {102,64}, | ||
608 | {255,255},// LA61 does not exit, dummy | ||
609 | //LA62..LB5 | ||
610 | {176,64}, {192,64}, {208,64}, {240,0}, {240,16}, {240,48}, {240,64}, {240,32} | ||
611 | }; | ||
612 | const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = { | ||
613 | // LA1..LA60 | ||
614 | {96,255}, {109,255}, {128,242}, {148,255}, {93,255}, {105,238}, {128,192}, {154,216}, {89,255}, {101,208}, {128,155}, {159,188}, | ||
615 | {85,255}, {96,181}, {128,119}, {165,163}, {81,255}, {89,157}, {128,82}, {173,143}, {75,255}, {81,139}, {128,46}, {183,131}, | ||
616 | {70,255}, {70,129}, {129,9}, {195,128}, {64,255}, {58,129}, {255,27}, {206,136}, {58,255}, {47,139}, {255,64}, {215,152}, | ||
617 | {53,255}, {39,157}, {255,101}, {222,175}, {47,255}, {32,181}, {255,137}, {228,201}, {43,255}, {27,208}, {255, 174}, | ||
618 | {208,255}, {39,255}, {23,238}, {235,255}, {235,255}, {33,255}, {19,255}, {255,233}, {224,255}, {160,255}, {164,255}, {169,255}, {188,255}, | ||
619 | {255,255},// LA61 does not exit, dummy | ||
620 | //LA62..LB5 | ||
621 | {221,255}, {225,255}, {229,255}, {22,255}, {12,255}, {244,255}, {234,255}, {255,255}, | ||
622 | }; | ||
623 | #elif defined(RGB_BACKLIGHT_M6_B) | ||
453 | // M6-B is really simple: | 624 | // M6-B is really simple: |
454 | // 0 3 5 | 625 | // 0 3 5 |
455 | // 1 2 4 | 626 | // 1 2 4 |
456 | const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = { | 627 | const Point g_map_led_to_point[BACKLIGHT_LED_COUNT] PROGMEM = { |
457 | {0,0}, {0,16}, {16,16}, {16,0}, {32,16}, {32,0} | 628 | {0,0}, {0,16}, {16,16}, {16,0}, {32,16}, {32,0} |
458 | }; | 629 | }; |
459 | const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = { | 630 | const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = { |
460 | {160,255}, {96,255}, {77,255}, {179,255}, {51,255}, {205,255} | 631 | {160,255}, {96,255}, {77,255}, {179,255}, {51,255}, {205,255} |
461 | }; | 632 | }; |
462 | #endif | 633 | #endif |
463 | 634 | ||
@@ -467,58 +638,58 @@ const Point g_map_led_to_point_polar[BACKLIGHT_LED_COUNT] PROGMEM = { | |||
467 | // or having a large "bitmap" and sampling them. | 638 | // or having a large "bitmap" and sampling them. |
468 | void map_led_to_point( uint8_t index, Point *point ) | 639 | void map_led_to_point( uint8_t index, Point *point ) |
469 | { | 640 | { |
470 | // Slightly messy way to get Point structs out of progmem. | 641 | // Slightly messy way to get Point structs out of progmem. |
471 | uint8_t *addr = (uint8_t*)&g_map_led_to_point[index]; | 642 | uint8_t *addr = (uint8_t*)&g_map_led_to_point[index]; |
472 | point->x = pgm_read_byte(addr); | 643 | point->x = pgm_read_byte(addr); |
473 | point->y = pgm_read_byte(addr+1); | 644 | point->y = pgm_read_byte(addr+1); |
474 | 645 | ||
475 | #if defined (RGB_BACKLIGHT_M6_B) | 646 | #if defined(RGB_BACKLIGHT_M6_B) || defined(RGB_BACKLIGHT_HS60) || defined(RGB_BACKLIGHT_NK65) |
476 | return; | 647 | return; |
477 | #endif | 648 | #endif |
478 | 649 | ||
479 | switch (index) | 650 | switch (index) |
480 | { | 651 | { |
481 | case 18+4: // LB4A | 652 | case 18+4: // LB4A |
482 | if ( g_config.use_split_backspace ) | 653 | if ( g_config.use_split_backspace ) |
483 | point->x -= 8; | 654 | point->x -= 8; |
484 | break; | 655 | break; |
485 | #if defined (RGB_BACKLIGHT_ZEAL60) | 656 | #if defined(RGB_BACKLIGHT_ZEAL60) |
486 | case 18+14: // LB14A | 657 | case 18+14: // LB14A |
487 | if ( g_config.use_iso_enter ) | 658 | if ( g_config.use_iso_enter ) |
488 | point->y += 8; // extremely pedantic | 659 | point->y += 8; // extremely pedantic |
489 | break; | 660 | break; |
490 | case 54+5: // LD5A | 661 | case 54+5: // LD5A |
491 | if ( !g_config.use_iso_enter ) | 662 | if ( !g_config.use_iso_enter ) |
492 | point->x -= 10; | 663 | point->x -= 10; |
493 | break; | 664 | break; |
494 | case 36+16: // LC16A | 665 | case 36+16: // LC16A |
495 | if ( !g_config.use_split_left_shift ) | 666 | if ( !g_config.use_split_left_shift ) |
496 | point->x += 8; | 667 | point->x += 8; |
497 | break; | 668 | break; |
498 | #endif | 669 | #endif |
499 | #if defined (RGB_BACKLIGHT_ZEAL60) || defined (RGB_BACKLIGHT_M60_A) | 670 | #if defined(RGB_BACKLIGHT_ZEAL60) || defined(RGB_BACKLIGHT_M60_A) |
500 | case 36+0: // LC0A | 671 | case 36+0: // LC0A |
501 | if ( g_config.use_7u_spacebar ) | 672 | if ( g_config.use_7u_spacebar ) |
502 | point->x += 10; | 673 | point->x += 10; |
503 | break; | 674 | break; |
504 | case 36+6: // LC6A | 675 | case 36+6: // LC6A |
505 | if ( g_config.use_7u_spacebar ) | 676 | if ( g_config.use_7u_spacebar ) |
506 | point->x += 4; | 677 | point->x += 4; |
507 | break; | 678 | break; |
508 | case 54+7: // LD7A | 679 | case 54+7: // LD7A |
509 | if ( !g_config.use_split_right_shift ) | 680 | if ( !g_config.use_split_right_shift ) |
510 | point->x -= 8; | 681 | point->x -= 8; |
511 | break; | 682 | break; |
512 | #endif | 683 | #endif |
513 | } | 684 | } |
514 | } | 685 | } |
515 | 686 | ||
516 | void map_led_to_point_polar( uint8_t index, Point *point ) | 687 | void map_led_to_point_polar( uint8_t index, Point *point ) |
517 | { | 688 | { |
518 | // Slightly messy way to get Point structs out of progmem. | 689 | // Slightly messy way to get Point structs out of progmem. |
519 | uint8_t *addr = (uint8_t*)&g_map_led_to_point_polar[index]; | 690 | uint8_t *addr = (uint8_t*)&g_map_led_to_point_polar[index]; |
520 | point->x = pgm_read_byte(addr); | 691 | point->x = pgm_read_byte(addr); |
521 | point->y = pgm_read_byte(addr+1); | 692 | point->y = pgm_read_byte(addr+1); |
522 | } | 693 | } |
523 | 694 | ||
524 | // | 695 | // |
@@ -526,7 +697,7 @@ void map_led_to_point_polar( uint8_t index, Point *point ) | |||
526 | // | 697 | // |
527 | 698 | ||
528 | 699 | ||
529 | #if defined (RGB_BACKLIGHT_ZEAL65) | 700 | #if defined(RGB_BACKLIGHT_ZEAL65) |
530 | // Note: Left spacebar stab is at 4,2 (LC7) | 701 | // Note: Left spacebar stab is at 4,2 (LC7) |
531 | // Right spacebar stab is at 4,9 (D14) | 702 | // Right spacebar stab is at 4,9 (D14) |
532 | // | 703 | // |
@@ -536,11 +707,11 @@ void map_led_to_point_polar( uint8_t index, Point *point ) | |||
536 | // C16, C15, C5, C4, C3, C2, C1, D9, D10, D11, D12, D6, D7, D8, B15 | 707 | // C16, C15, C5, C4, C3, C2, C1, D9, D10, D11, D12, D6, D7, D8, B15 |
537 | // C17, C8, C7, ---, ---, ---, ---, C0, ---, D14, D15, D16, D17, B17, B16 | 708 | // C17, C8, C7, ---, ---, ---, ---, C0, ---, D14, D15, D16, D17, B17, B16 |
538 | const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { | 709 | const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { |
539 | { 0+17, 0+16, 0+15, 0+14, 0+13, 0+12, 0+11, 0+10, 0+9, 18+0, 18+1, 18+2, 18+3, 18+4, 18+6 }, | 710 | { 0+17, 0+16, 0+15, 0+14, 0+13, 0+12, 0+11, 0+10, 0+9, 18+0, 18+1, 18+2, 18+3, 18+4, 18+6 }, |
540 | { 0+7, 0+6, 0+5, 0+4, 0+3, 0+2, 0+1, 0+0, 18+9, 18+10, 18+11, 18+12, 18+13, 18+14, 18+7 }, | 711 | { 0+7, 0+6, 0+5, 0+4, 0+3, 0+2, 0+1, 0+0, 18+9, 18+10, 18+11, 18+12, 18+13, 18+14, 18+7 }, |
541 | { 0+8, 36+14, 36+13, 36+12, 36+11, 36+10, 36+9, 54+0, 54+1, 54+2, 54+3, 54+4, 54+5, 18+5, 18+8 }, | 712 | { 0+8, 36+14, 36+13, 36+12, 36+11, 36+10, 36+9, 54+0, 54+1, 54+2, 54+3, 54+4, 54+5, 18+5, 18+8 }, |
542 | { 36+16, 36+15, 36+5, 36+4, 36+3, 36+2, 36+1, 54+9, 54+10, 54+11, 54+12, 54+6, 54+7, 54+8, 18+15 }, | 713 | { 36+16, 36+15, 36+5, 36+4, 36+3, 36+2, 36+1, 54+9, 54+10, 54+11, 54+12, 54+6, 54+7, 54+8, 18+15 }, |
543 | { 36+17, 36+8, 36+7, 255, 255, 255, 255, 36+0, 255, 54+14, 54+15, 54+16, 54+17, 18+17, 18+16 } | 714 | { 36+17, 36+8, 36+7, 255, 255, 255, 255, 36+0, 255, 54+14, 54+15, 54+16, 54+17, 18+17, 18+16 } |
544 | }; | 715 | }; |
545 | #elif defined(RGB_BACKLIGHT_KOYU) | 716 | #elif defined(RGB_BACKLIGHT_KOYU) |
546 | // Note: Left spacebar stab is at 4,4 (LC6) | 717 | // Note: Left spacebar stab is at 4,4 (LC6) |
@@ -552,13 +723,13 @@ const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { | |||
552 | // C16, C15, C5, C4, C3, C2, C1, D9, D10, D11, D12, D6, D7, D8, B15 | 723 | // C16, C15, C5, C4, C3, C2, C1, D9, D10, D11, D12, D6, D7, D8, B15 |
553 | // C17, C8, C7, C6, ---, ---, ---, C0, ---, ---, D14, D15, D16, B17, B16 | 724 | // C17, C8, C7, C6, ---, ---, ---, C0, ---, ---, D14, D15, D16, B17, B16 |
554 | const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { | 725 | const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { |
555 | { 0+17, 0+16, 0+15, 0+14, 0+13, 0+12, 0+11, 0+10, 0+9, 18+0, 18+1, 18+2, 18+3, 18+4, 18+6 }, | 726 | { 0+17, 0+16, 0+15, 0+14, 0+13, 0+12, 0+11, 0+10, 0+9, 18+0, 18+1, 18+2, 18+3, 18+4, 18+6 }, |
556 | { 0+7, 0+6, 0+5, 0+4, 0+3, 0+2, 0+1, 0+0, 18+9, 18+10, 18+11, 18+12, 18+13, 18+14, 18+7 }, | 727 | { 0+7, 0+6, 0+5, 0+4, 0+3, 0+2, 0+1, 0+0, 18+9, 18+10, 18+11, 18+12, 18+13, 18+14, 18+7 }, |
557 | { 0+8, 36+14, 36+13, 36+12, 36+11, 36+10, 36+9, 54+0, 54+1, 54+2, 54+3, 54+4, 54+5, 18+5, 18+8 }, | 728 | { 0+8, 36+14, 36+13, 36+12, 36+11, 36+10, 36+9, 54+0, 54+1, 54+2, 54+3, 54+4, 54+5, 18+5, 18+8 }, |
558 | { 36+16, 36+15, 36+5, 36+4, 36+3, 36+2, 36+1, 54+9, 54+10, 54+11, 54+12, 54+6, 54+7, 54+8, 18+15 }, | 729 | { 36+16, 36+15, 36+5, 36+4, 36+3, 36+2, 36+1, 54+9, 54+10, 54+11, 54+12, 54+6, 54+7, 54+8, 18+15 }, |
559 | { 36+17, 36+8, 36+7, 36+6, 255, 255, 255, 36+0, 255, 255, 54+14, 54+15, 54+16, 18+17, 18+16 } | 730 | { 36+17, 36+8, 36+7, 36+6, 255, 255, 255, 36+0, 255, 255, 54+14, 54+15, 54+16, 18+17, 18+16 } |
560 | }; | 731 | }; |
561 | #elif defined (RGB_BACKLIGHT_ZEAL60) || defined (RGB_BACKLIGHT_M60_A) | 732 | #elif defined(RGB_BACKLIGHT_ZEAL60) || defined(RGB_BACKLIGHT_M60_A) |
562 | // Note: Left spacebar stab is at 4,3 (LC6) | 733 | // Note: Left spacebar stab is at 4,3 (LC6) |
563 | // Right spacebar stab is at 4,9 (LD13) or 4,10 (LD14) | 734 | // Right spacebar stab is at 4,9 (LD13) or 4,10 (LD14) |
564 | // | 735 | // |
@@ -568,13 +739,13 @@ const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { | |||
568 | // C16, C15, C5, C4, C3, C2, C1, D9, D10, D11, D12, D6, D7, D8, | 739 | // C16, C15, C5, C4, C3, C2, C1, D9, D10, D11, D12, D6, D7, D8, |
569 | // C17, C8, C7, C6, ---, ---, ---, C0, ---, D13, D14, D15, D16, D17, | 740 | // C17, C8, C7, C6, ---, ---, ---, C0, ---, D13, D14, D15, D16, D17, |
570 | const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { | 741 | const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { |
571 | { 0+17, 0+16, 0+15, 0+14, 0+13, 0+12, 0+11, 0+10, 0+9, 18+0, 18+1, 18+2, 18+3, 18+4 }, | 742 | { 0+17, 0+16, 0+15, 0+14, 0+13, 0+12, 0+11, 0+10, 0+9, 18+0, 18+1, 18+2, 18+3, 18+4 }, |
572 | { 0+7, 0+6, 0+5, 0+4, 0+3, 0+2, 0+1, 0+0, 18+9, 18+10, 18+11, 18+12, 18+13, 18+14 }, | 743 | { 0+7, 0+6, 0+5, 0+4, 0+3, 0+2, 0+1, 0+0, 18+9, 18+10, 18+11, 18+12, 18+13, 18+14 }, |
573 | { 0+8, 36+14, 36+13, 36+12, 36+11, 36+10, 36+9, 54+0, 54+1, 54+2, 54+3, 54+4, 54+5, 18+5 }, | 744 | { 0+8, 36+14, 36+13, 36+12, 36+11, 36+10, 36+9, 54+0, 54+1, 54+2, 54+3, 54+4, 54+5, 18+5 }, |
574 | { 36+16, 36+15, 36+5, 36+4, 36+3, 36+2, 36+1, 54+9, 54+10, 54+11, 54+12, 54+6, 54+7, 54+8 }, | 745 | { 36+16, 36+15, 36+5, 36+4, 36+3, 36+2, 36+1, 54+9, 54+10, 54+11, 54+12, 54+6, 54+7, 54+8 }, |
575 | { 36+17, 36+8, 36+7, 36+6, 255, 255, 255, 36+0, 255, 54+13, 54+14, 54+15, 54+16, 54+17 } | 746 | { 36+17, 36+8, 36+7, 36+6, 255, 255, 255, 36+0, 255, 54+13, 54+14, 54+15, 54+16, 54+17 } |
576 | }; | 747 | }; |
577 | #elif defined (RGB_BACKLIGHT_HS60) && defined (HS60_ANSI) | 748 | #elif defined(RGB_BACKLIGHT_HS60) && defined(HS60_ANSI) |
578 | // | 749 | // |
579 | // LA1, LA5, LA9, LA13, LA17, LA21, LA25, LA29, LA33, LA37, LA41, LA45, LA49, LA53, | 750 | // LA1, LA5, LA9, LA13, LA17, LA21, LA25, LA29, LA33, LA37, LA41, LA45, LA49, LA53, |
580 | // LA2, LA6, LA10, LA14, LA18, LA22, LA26, LA30, LA34, LA38, LA42, LA46, LA50, ---, | 751 | // LA2, LA6, LA10, LA14, LA18, LA22, LA26, LA30, LA34, LA38, LA42, LA46, LA50, ---, |
@@ -582,13 +753,13 @@ const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { | |||
582 | // LA4, ---, LA8, LA12, LA16, LA20, LA24, LA28, LA32, LA36, LA40, LA44, ---, LA52, | 753 | // LA4, ---, LA8, LA12, LA16, LA20, LA24, LA28, LA32, LA36, LA40, LA44, ---, LA52, |
583 | // LA57, LA58, LA59, ---, ---, ---, LA60, ---, ---, ---, LA62, LA63, LA64, LA56 | 754 | // LA57, LA58, LA59, ---, ---, ---, LA60, ---, ---, ---, LA62, LA63, LA64, LA56 |
584 | const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { | 755 | const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { |
585 | { 1-1, 5-1, 9-1, 13-1, 17-1, 21-1, 25-1, 29-1, 33-1, 37-1, 41-1, 45-1, 49-1, 53-1 }, | 756 | { 1-1, 5-1, 9-1, 13-1, 17-1, 21-1, 25-1, 29-1, 33-1, 37-1, 41-1, 45-1, 49-1, 53-1 }, |
586 | { 2-1, 6-1, 10-1, 14-1, 18-1, 22-1, 26-1, 30-1, 34-1, 38-1, 42-1, 46-1, 50-1, 255 }, | 757 | { 2-1, 6-1, 10-1, 14-1, 18-1, 22-1, 26-1, 30-1, 34-1, 38-1, 42-1, 46-1, 50-1, 255 }, |
587 | { 3-1, 7-1, 11-1, 15-1, 19-1, 23-1, 27-1, 31-1, 35-1, 39-1, 43-1, 47-1, 54-1, 55-1 }, | 758 | { 3-1, 7-1, 11-1, 15-1, 19-1, 23-1, 27-1, 31-1, 35-1, 39-1, 43-1, 47-1, 54-1, 55-1 }, |
588 | { 4-1, 255, 8-1, 12-1, 16-1, 20-1, 24-1, 28-1, 32-1, 36-1, 40-1, 44-1, 255, 52-1 }, | 759 | { 4-1, 255, 8-1, 12-1, 16-1, 20-1, 24-1, 28-1, 32-1, 36-1, 40-1, 44-1, 255, 52-1 }, |
589 | { 57-1, 58-1, 59-1, 255, 255, 255, 60-1, 255, 255, 255, 62-1, 63-1, 64-1, 56-1 } | 760 | { 57-1, 58-1, 59-1, 255, 255, 255, 60-1, 255, 255, 255, 62-1, 63-1, 64-1, 56-1 } |
590 | }; | 761 | }; |
591 | #elif defined (RGB_BACKLIGHT_HS60) && defined (HS60_HHKB) | 762 | #elif defined(RGB_BACKLIGHT_HS60) && defined(HS60_HHKB) |
592 | // | 763 | // |
593 | // LA1, LA5, LA9, LA13, LA17, LA21, LA25, LA29, LA33, LA37, LA41, LA45, LA49, LA53, | 764 | // LA1, LA5, LA9, LA13, LA17, LA21, LA25, LA29, LA33, LA37, LA41, LA45, LA49, LA53, |
594 | // LA2, LA6, LA10, LA14, LA18, LA22, LA26, LA30, LA34, LA38, LA42, LA46, LA50, LA48, | 765 | // LA2, LA6, LA10, LA14, LA18, LA22, LA26, LA30, LA34, LA38, LA42, LA46, LA50, LA48, |
@@ -596,13 +767,13 @@ const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { | |||
596 | // LA4, ---, LA8, LA12, LA16, LA20, LA24, LA28, LA32, LA36, LA40, LA44, LA51, LA52, | 767 | // LA4, ---, LA8, LA12, LA16, LA20, LA24, LA28, LA32, LA36, LA40, LA44, LA51, LA52, |
597 | // LA57, LA58, LA59, ---, ---, ---, LA60, ---, ---, ---, ---, LA63, LA64, LA56 | 768 | // LA57, LA58, LA59, ---, ---, ---, LA60, ---, ---, ---, ---, LA63, LA64, LA56 |
598 | const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { | 769 | const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { |
599 | { 1-1, 5-1, 9-1, 13-1, 17-1, 21-1, 25-1, 29-1, 33-1, 37-1, 41-1, 45-1, 49-1, 53-1 }, | 770 | { 1-1, 5-1, 9-1, 13-1, 17-1, 21-1, 25-1, 29-1, 33-1, 37-1, 41-1, 45-1, 49-1, 53-1 }, |
600 | { 2-1, 6-1, 10-1, 14-1, 18-1, 22-1, 26-1, 30-1, 34-1, 38-1, 42-1, 46-1, 50-1, 48-1 }, | 771 | { 2-1, 6-1, 10-1, 14-1, 18-1, 22-1, 26-1, 30-1, 34-1, 38-1, 42-1, 46-1, 50-1, 48-1 }, |
601 | { 3-1, 7-1, 11-1, 15-1, 19-1, 23-1, 27-1, 31-1, 35-1, 39-1, 43-1, 47-1, 54-1, 55-1 }, | 772 | { 3-1, 7-1, 11-1, 15-1, 19-1, 23-1, 27-1, 31-1, 35-1, 39-1, 43-1, 47-1, 54-1, 55-1 }, |
602 | { 4-1, 255, 8-1, 12-1, 16-1, 20-1, 24-1, 28-1, 32-1, 36-1, 40-1, 44-1, 51-1, 52-1 }, | 773 | { 4-1, 255, 8-1, 12-1, 16-1, 20-1, 24-1, 28-1, 32-1, 36-1, 40-1, 44-1, 51-1, 52-1 }, |
603 | { 57-1, 58-1, 59-1, 255, 255, 255, 60-1, 255, 255, 255, 255, 63-1, 64-1, 56-1 } | 774 | { 57-1, 58-1, 59-1, 255, 255, 255, 60-1, 255, 255, 255, 255, 63-1, 64-1, 56-1 } |
604 | }; | 775 | }; |
605 | #elif defined (RGB_BACKLIGHT_HS60) //HS60_ISO | 776 | #elif defined(RGB_BACKLIGHT_HS60) //HS60_ISO |
606 | // | 777 | // |
607 | // LA1, LA5, LA9, LA13, LA17, LA21, LA25, LA29, LA33, LA37, LA41, LA45, LA49, LA53, | 778 | // LA1, LA5, LA9, LA13, LA17, LA21, LA25, LA29, LA33, LA37, LA41, LA45, LA49, LA53, |
608 | // LA2, LA6, LA10, LA14, LA18, LA22, LA26, LA30, LA34, LA38, LA42, LA46, LA50, ---, | 779 | // LA2, LA6, LA10, LA14, LA18, LA22, LA26, LA30, LA34, LA38, LA42, LA46, LA50, ---, |
@@ -610,75 +781,94 @@ const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { | |||
610 | // LA4, LA48, LA8, LA12, LA16, LA20, LA24, LA28, LA32, LA36, LA40, LA44, ---, LA52, | 781 | // LA4, LA48, LA8, LA12, LA16, LA20, LA24, LA28, LA32, LA36, LA40, LA44, ---, LA52, |
611 | // LA57, LA58, LA59, ---, ---, ---, LA60, ---, ---, ---, LA62, LA63, LA64, LA56 | 782 | // LA57, LA58, LA59, ---, ---, ---, LA60, ---, ---, ---, LA62, LA63, LA64, LA56 |
612 | const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { | 783 | const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { |
613 | { 1-1, 5-1, 9-1, 13-1, 17-1, 21-1, 25-1, 29-1, 33-1, 37-1, 41-1, 45-1, 49-1, 53-1 }, | 784 | { 1-1, 5-1, 9-1, 13-1, 17-1, 21-1, 25-1, 29-1, 33-1, 37-1, 41-1, 45-1, 49-1, 53-1 }, |
614 | { 2-1, 6-1, 10-1, 14-1, 18-1, 22-1, 26-1, 30-1, 34-1, 38-1, 42-1, 46-1, 50-1, 255 }, | 785 | { 2-1, 6-1, 10-1, 14-1, 18-1, 22-1, 26-1, 30-1, 34-1, 38-1, 42-1, 46-1, 50-1, 255 }, |
615 | { 3-1, 7-1, 11-1, 15-1, 19-1, 23-1, 27-1, 31-1, 35-1, 39-1, 43-1, 47-1, 54-1, 55-1 }, | 786 | { 3-1, 7-1, 11-1, 15-1, 19-1, 23-1, 27-1, 31-1, 35-1, 39-1, 43-1, 47-1, 54-1, 55-1 }, |
616 | { 4-1, 48-1, 8-1, 12-1, 16-1, 20-1, 24-1, 28-1, 32-1, 36-1, 40-1, 44-1, 255, 52-1 }, | 787 | { 4-1, 48-1, 8-1, 12-1, 16-1, 20-1, 24-1, 28-1, 32-1, 36-1, 40-1, 44-1, 255, 52-1 }, |
617 | { 57-1, 58-1, 59-1, 255, 255, 255, 60-1, 255, 255, 255, 62-1, 63-1, 64-1, 56-1 } | 788 | { 57-1, 58-1, 59-1, 255, 255, 255, 60-1, 255, 255, 255, 62-1, 63-1, 64-1, 56-1 } |
789 | }; | ||
790 | #elif defined(RGB_BACKLIGHT_NK65) | ||
791 | // | ||
792 | // LA1, LA5, LA9, LA13, LA17, LA21, LA25, LA29, LA33, LA37, LA41, LA45, LA49, LA53, LB1, | ||
793 | // LA2, LA6, LA10, LA14, LA18, LA22, LA26, LA30, LA34, LA38, LA42, LA46, LA50, ---, LB2, | ||
794 | // LA3, LA7, LA11, LA15, LA19, LA23, LA27, LA31, LA35, LA39, LA43, LA47, LA54, LA55, LB5, | ||
795 | // LA4, ---, LA8, LA12, LA16, LA20, LA24, LA28, LA32, LA36, LA40, LA44, LA51, LA52, LB3, | ||
796 | // LA57, LA58, LA59, ---, ---, ---, LA60, ---, ---, LA48, LA62, LA63, LA64, LA56, LB4 | ||
797 | const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { | ||
798 | { 1-1, 5-1, 9-1, 13-1, 17-1, 21-1, 25-1, 29-1, 33-1, 37-1, 41-1, 45-1, 49-1, 53-1, 1+64-1 }, | ||
799 | { 2-1, 6-1, 10-1, 14-1, 18-1, 22-1, 26-1, 30-1, 34-1, 38-1, 42-1, 46-1, 50-1, 255, 2+64-1 }, | ||
800 | { 3-1, 7-1, 11-1, 15-1, 19-1, 23-1, 27-1, 31-1, 35-1, 39-1, 43-1, 47-1, 54-1, 55-1, 5+64-1 }, | ||
801 | { 4-1, 255, 8-1, 12-1, 16-1, 20-1, 24-1, 28-1, 32-1, 36-1, 40-1, 44-1, 51-1, 52-1, 3+64-1 }, | ||
802 | { 57-1, 58-1, 59-1, 255, 255, 255, 60-1, 255, 255, 48-1, 62-1, 63-1, 64-1, 56-1, 4+64-1 } | ||
618 | }; | 803 | }; |
619 | #elif defined (RGB_BACKLIGHT_M6_B) | 804 | #elif defined(RGB_BACKLIGHT_M6_B) |
620 | // M6-B is really simple: | 805 | // M6-B is really simple: |
621 | // 0 3 5 | 806 | // 0 3 5 |
622 | // 1 2 4 | 807 | // 1 2 4 |
623 | const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { | 808 | const uint8_t g_map_row_column_to_led[MATRIX_ROWS][MATRIX_COLS] PROGMEM = { |
624 | { 0, 3, 5, 1, 2, 4 } | 809 | { 0, 3, 5, 1, 2, 4 } |
625 | }; | 810 | }; |
626 | #endif | 811 | #endif |
627 | 812 | ||
628 | void map_row_column_to_led( uint8_t row, uint8_t column, uint8_t *led ) | 813 | void map_row_column_to_led( uint8_t row, uint8_t column, uint8_t *led ) |
629 | { | 814 | { |
630 | *led = 255; | 815 | *led = 255; |
631 | if ( row < MATRIX_ROWS && column < MATRIX_COLS ) | 816 | if ( row < MATRIX_ROWS && column < MATRIX_COLS ) |
632 | { | 817 | { |
633 | *led = pgm_read_byte(&g_map_row_column_to_led[row][column]); | 818 | *led = pgm_read_byte(&g_map_row_column_to_led[row][column]); |
634 | } | 819 | } |
635 | } | 820 | } |
636 | 821 | ||
637 | void backlight_update_pwm_buffers(void) | 822 | void backlight_update_pwm_buffers(void) |
638 | { | 823 | { |
639 | #if defined (RGB_BACKLIGHT_M6_B) | 824 | #if defined(RGB_BACKLIGHT_M6_B) |
640 | IS31FL3218_update_pwm_buffers(); | 825 | IS31FL3218_update_pwm_buffers(); |
641 | #elif defined (RGB_BACKLIGHT_HS60) | 826 | #elif defined(RGB_BACKLIGHT_HS60) |
642 | IS31FL3733_update_pwm_buffers( ISSI_ADDR_1, ISSI_ADDR_2 ); | 827 | IS31FL3733_update_pwm_buffers( ISSI_ADDR_1, 0 ); |
643 | IS31FL3733_update_led_control_registers( ISSI_ADDR_1, ISSI_ADDR_2 ); | 828 | IS31FL3733_update_led_control_registers( ISSI_ADDR_1, 0 ); |
829 | #elif defined(RGB_BACKLIGHT_NK65) | ||
830 | IS31FL3733_update_pwm_buffers( ISSI_ADDR_1, 0 ); | ||
831 | IS31FL3733_update_pwm_buffers( ISSI_ADDR_2, 1 ); | ||
832 | IS31FL3733_update_led_control_registers( ISSI_ADDR_1, 0 ); | ||
833 | IS31FL3733_update_led_control_registers( ISSI_ADDR_2, 1 ); | ||
644 | #else | 834 | #else |
645 | IS31FL3731_update_pwm_buffers( ISSI_ADDR_1, ISSI_ADDR_2 ); | 835 | IS31FL3731_update_pwm_buffers( ISSI_ADDR_1, ISSI_ADDR_2 ); |
646 | IS31FL3731_update_led_control_registers( ISSI_ADDR_1, ISSI_ADDR_2 ); | 836 | IS31FL3731_update_led_control_registers( ISSI_ADDR_1, ISSI_ADDR_2 ); |
647 | #endif | 837 | #endif |
648 | } | 838 | } |
649 | 839 | ||
650 | void backlight_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ) | 840 | void backlight_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ) |
651 | { | 841 | { |
652 | #if defined (RGB_BACKLIGHT_M6_B) | 842 | #if defined(RGB_BACKLIGHT_M6_B) |
653 | IS31FL3218_set_color( index, red, green, blue ); | 843 | IS31FL3218_set_color( index, red, green, blue ); |
654 | #elif defined (RGB_BACKLIGHT_HS60) | 844 | #elif defined(RGB_BACKLIGHT_HS60) || defined(RGB_BACKLIGHT_NK65) |
655 | IS31FL3733_set_color( index, red, green, blue ); | 845 | IS31FL3733_set_color( index, red, green, blue ); |
656 | #else | 846 | #else |
657 | IS31FL3731_set_color( index, red, green, blue ); | 847 | IS31FL3731_set_color( index, red, green, blue ); |
658 | #endif | 848 | #endif |
659 | } | 849 | } |
660 | 850 | ||
661 | void backlight_set_color_all( uint8_t red, uint8_t green, uint8_t blue ) | 851 | void backlight_set_color_all( uint8_t red, uint8_t green, uint8_t blue ) |
662 | { | 852 | { |
663 | #if defined (RGB_BACKLIGHT_M6_B) | 853 | #if defined(RGB_BACKLIGHT_M6_B) |
664 | IS31FL3218_set_color_all( red, green, blue ); | 854 | IS31FL3218_set_color_all( red, green, blue ); |
665 | #elif defined (RGB_BACKLIGHT_HS60) | 855 | #elif defined(RGB_BACKLIGHT_HS60) || defined(RGB_BACKLIGHT_NK65) |
666 | IS31FL3733_set_color_all( red, green, blue ); | 856 | IS31FL3733_set_color_all( red, green, blue ); |
667 | #else | 857 | #else |
668 | IS31FL3731_set_color_all( red, green, blue ); | 858 | IS31FL3731_set_color_all( red, green, blue ); |
669 | #endif | 859 | #endif |
670 | } | 860 | } |
671 | 861 | ||
672 | void backlight_set_key_hit(uint8_t row, uint8_t column) | 862 | void backlight_set_key_hit(uint8_t row, uint8_t column) |
673 | { | 863 | { |
674 | uint8_t led; | 864 | uint8_t led; |
675 | map_row_column_to_led(row,column,&led); | 865 | map_row_column_to_led(row,column,&led); |
676 | g_key_hit[led] = 0; | 866 | g_key_hit[led] = 0; |
677 | 867 | ||
678 | g_any_key_hit = 0; | 868 | g_any_key_hit = 0; |
679 | } | 869 | } |
680 | 870 | ||
681 | #if !defined(RGB_BACKLIGHT_HS60) | 871 | #if !defined(RGB_BACKLIGHT_HS60) && !defined(RGB_BACKLIGHT_NK65) |
682 | // This is (F_CPU/1024) / 20 Hz | 872 | // This is (F_CPU/1024) / 20 Hz |
683 | // = 15625 Hz / 20 Hz | 873 | // = 15625 Hz / 20 Hz |
684 | // = 781 | 874 | // = 781 |
@@ -686,95 +876,95 @@ void backlight_set_key_hit(uint8_t row, uint8_t column) | |||
686 | 876 | ||
687 | void backlight_timer_init(void) | 877 | void backlight_timer_init(void) |
688 | { | 878 | { |
689 | static uint8_t backlight_timer_is_init = 0; | 879 | static uint8_t backlight_timer_is_init = 0; |
690 | if ( backlight_timer_is_init ) | 880 | if ( backlight_timer_is_init ) |
691 | { | 881 | { |
692 | return; | 882 | return; |
693 | } | 883 | } |
694 | backlight_timer_is_init = 1; | 884 | backlight_timer_is_init = 1; |
695 | 885 | ||
696 | // Timer 3 setup | 886 | // Timer 3 setup |
697 | TCCR3B = _BV(WGM32) | // CTC mode OCR3A as TOP | 887 | TCCR3B = _BV(WGM32) | // CTC mode OCR3A as TOP |
698 | _BV(CS32) | _BV(CS30); // prescale by /1024 | 888 | _BV(CS32) | _BV(CS30); // prescale by /1024 |
699 | // Set TOP value | 889 | // Set TOP value |
700 | uint8_t sreg = SREG; | 890 | uint8_t sreg = SREG; |
701 | cli(); | 891 | cli(); |
702 | 892 | ||
703 | OCR3AH = (TIMER3_TOP >> 8) & 0xff; | 893 | OCR3AH = (TIMER3_TOP >> 8) & 0xff; |
704 | OCR3AL = TIMER3_TOP & 0xff; | 894 | OCR3AL = TIMER3_TOP & 0xff; |
705 | SREG = sreg; | 895 | SREG = sreg; |
706 | } | 896 | } |
707 | 897 | ||
708 | void backlight_timer_enable(void) | 898 | void backlight_timer_enable(void) |
709 | { | 899 | { |
710 | TIMSK3 |= _BV(OCIE3A); | 900 | TIMSK3 |= _BV(OCIE3A); |
711 | } | 901 | } |
712 | 902 | ||
713 | void backlight_timer_disable(void) | 903 | void backlight_timer_disable(void) |
714 | { | 904 | { |
715 | TIMSK3 &= ~_BV(OCIE3A); | 905 | TIMSK3 &= ~_BV(OCIE3A); |
716 | } | 906 | } |
717 | #else //STM32, use GPT with TIM4. Enable in halconf.h | 907 | #else //STM32, use GPT with TIM4. Enable in halconf.h |
718 | static void gpt_backlight_timer_task(GPTDriver *gptp); | 908 | static void gpt_backlight_timer_task(GPTDriver *gptp); |
719 | // Timer setup at 200Khz, callback at 10k ticks = 20Hz | 909 | // Timer setup at 200Khz, callback at 10k ticks = 20Hz |
720 | static GPTConfig gpt4cfg1 = { | 910 | static GPTConfig gpt4cfg1 = { |
721 | .frequency = 200000U, | 911 | .frequency = 200000U, |
722 | .callback = gpt_backlight_timer_task | 912 | .callback = gpt_backlight_timer_task |
723 | }; | 913 | }; |
724 | 914 | ||
725 | void backlight_timer_init(void) | 915 | void backlight_timer_init(void) |
726 | { | 916 | { |
727 | gptStart(&GPTD4, &gpt4cfg1); | 917 | gptStart(&GPTD4, &gpt4cfg1); |
728 | } | 918 | } |
729 | 919 | ||
730 | void backlight_timer_enable(void) | 920 | void backlight_timer_enable(void) |
731 | { | 921 | { |
732 | gptStartContinuous(&GPTD4, 10000); | 922 | gptStartContinuous(&GPTD4, 10000); |
733 | } | 923 | } |
734 | 924 | ||
735 | void backlight_timer_disable(void) | 925 | void backlight_timer_disable(void) |
736 | { | 926 | { |
737 | gptStopTimer(&GPTD4); | 927 | gptStopTimer(&GPTD4); |
738 | } | 928 | } |
739 | #endif //!defined(RGB_BACKLIGHT_HS60) | 929 | #endif //!defined(RGB_BACKLIGHT_HS60) && !defined(RGB_BACKLIGHT_NK65) |
740 | 930 | ||
741 | void backlight_set_suspend_state(bool state) | 931 | void backlight_set_suspend_state(bool state) |
742 | { | 932 | { |
743 | g_suspend_state = state; | 933 | g_suspend_state = state; |
744 | } | 934 | } |
745 | 935 | ||
746 | void backlight_set_indicator_state(uint8_t state) | 936 | void backlight_set_indicator_state(uint8_t state) |
747 | { | 937 | { |
748 | g_indicator_state = state; | 938 | g_indicator_state = state; |
749 | } | 939 | } |
750 | 940 | ||
751 | void backlight_effect_rgb_test(void) | 941 | void backlight_effect_rgb_test(void) |
752 | { | 942 | { |
753 | // Mask out bits 4 and 5 | 943 | // Mask out bits 4 and 5 |
754 | // This 2-bit value will stay the same for 16 ticks. | 944 | // This 2-bit value will stay the same for 16 ticks. |
755 | switch ( (g_tick & 0x30) >> 4 ) | 945 | switch ( (g_tick & 0x30) >> 4 ) |
756 | { | 946 | { |
757 | case 0: | 947 | case 0: |
758 | { | 948 | { |
759 | backlight_set_color_all( 255, 0, 0 ); | 949 | backlight_set_color_all( 255, 0, 0 ); |
760 | break; | 950 | break; |
761 | } | 951 | } |
762 | case 1: | 952 | case 1: |
763 | { | 953 | { |
764 | backlight_set_color_all( 0, 255, 0 ); | 954 | backlight_set_color_all( 0, 255, 0 ); |
765 | break; | 955 | break; |
766 | } | 956 | } |
767 | case 2: | 957 | case 2: |
768 | { | 958 | { |
769 | backlight_set_color_all( 0, 0, 255 ); | 959 | backlight_set_color_all( 0, 0, 255 ); |
770 | break; | 960 | break; |
771 | } | 961 | } |
772 | case 3: | 962 | case 3: |
773 | { | 963 | { |
774 | backlight_set_color_all( 255, 255, 255 ); | 964 | backlight_set_color_all( 255, 255, 255 ); |
775 | break; | 965 | break; |
776 | } | 966 | } |
777 | } | 967 | } |
778 | } | 968 | } |
779 | 969 | ||
780 | #if defined(RGB_DEBUGGING_ONLY) | 970 | #if defined(RGB_DEBUGGING_ONLY) |
@@ -785,1179 +975,1221 @@ void backlight_effect_rgb_test(void) | |||
785 | // ONLY USE THIS FOR TESTING LEDS! | 975 | // ONLY USE THIS FOR TESTING LEDS! |
786 | void backlight_effect_single_LED_test(void) | 976 | void backlight_effect_single_LED_test(void) |
787 | { | 977 | { |
788 | static uint8_t color = 0; // 0,1,2 for R,G,B | 978 | static uint8_t color = 0; // 0,1,2 for R,G,B |
789 | static uint8_t row = 0; | 979 | static uint8_t row = 0; |
790 | static uint8_t column = 0; | 980 | static uint8_t column = 0; |
791 | 981 | ||
792 | static uint8_t tick = 0; | 982 | static uint8_t tick = 0; |
793 | tick++; | 983 | tick++; |
794 | 984 | ||
795 | if ( tick > 2 ) | 985 | if ( tick > 2 ) |
796 | { | 986 | { |
797 | tick = 0; | 987 | tick = 0; |
798 | column++; | 988 | column++; |
799 | } | 989 | } |
800 | if ( column > 14 ) | 990 | if ( column > 14 ) |
801 | { | 991 | { |
802 | column = 0; | 992 | column = 0; |
803 | row++; | 993 | row++; |
804 | } | 994 | } |
805 | if ( row > 4 ) | 995 | if ( row > 4 ) |
806 | { | 996 | { |
807 | row = 0; | 997 | row = 0; |
808 | color++; | 998 | color++; |
809 | } | 999 | } |
810 | if ( color > 2 ) | 1000 | if ( color > 2 ) |
811 | { | 1001 | { |
812 | color = 0; | 1002 | color = 0; |
813 | } | 1003 | } |
814 | 1004 | ||
815 | uint8_t led; | 1005 | uint8_t led; |
816 | map_row_column_to_led( row, column, &led ); | 1006 | map_row_column_to_led( row, column, &led ); |
817 | backlight_set_color_all( 255, 255, 255 ); | 1007 | backlight_set_color_all( 255, 255, 255 ); |
818 | backlight_test_led( led, color==0, color==1, color==2 ); | 1008 | backlight_test_led( led, color==0, color==1, color==2 ); |
819 | } | 1009 | } |
820 | #endif // defined(RGB_DEBUGGING_ONLY) | 1010 | #endif // defined(RGB_DEBUGGING_ONLY) |
821 | 1011 | ||
822 | // All LEDs off | 1012 | // All LEDs off |
823 | void backlight_effect_all_off(void) | 1013 | void backlight_effect_all_off(void) |
824 | { | 1014 | { |
825 | backlight_set_color_all( 0, 0, 0 ); | 1015 | backlight_set_color_all( 0, 0, 0 ); |
826 | } | 1016 | } |
827 | 1017 | ||
828 | // Solid color | 1018 | // Solid color |
829 | void backlight_effect_solid_color(void) | 1019 | void backlight_effect_solid_color(void) |
830 | { | 1020 | { |
831 | HSV hsv = { .h = g_config.color_1.h, .s = g_config.color_1.s, .v = g_config.brightness }; | 1021 | HSV hsv = { .h = g_config.color_1.h, .s = g_config.color_1.s, .v = g_config.brightness }; |
832 | RGB rgb = hsv_to_rgb( hsv ); | 1022 | RGB rgb = hsv_to_rgb( hsv ); |
833 | backlight_set_color_all( rgb.r, rgb.g, rgb.b ); | 1023 | backlight_set_color_all( rgb.r, rgb.g, rgb.b ); |
834 | } | 1024 | } |
835 | 1025 | ||
836 | // alphas = color1, mods = color2 | 1026 | // alphas = color1, mods = color2 |
837 | void backlight_effect_alphas_mods(void) | 1027 | void backlight_effect_alphas_mods(void) |
838 | { | 1028 | { |
839 | RGB rgb1 = hsv_to_rgb( (HSV){ .h = g_config.color_1.h, .s = g_config.color_1.s, .v = g_config.brightness } ); | 1029 | RGB rgb1 = hsv_to_rgb( (HSV){ .h = g_config.color_1.h, .s = g_config.color_1.s, .v = g_config.brightness } ); |
840 | RGB rgb2 = hsv_to_rgb( (HSV){ .h = g_config.color_2.h, .s = g_config.color_2.s, .v = g_config.brightness } ); | 1030 | RGB rgb2 = hsv_to_rgb( (HSV){ .h = g_config.color_2.h, .s = g_config.color_2.s, .v = g_config.brightness } ); |
841 | 1031 | ||
842 | for ( int row = 0; row < MATRIX_ROWS; row++ ) | 1032 | for ( int row = 0; row < MATRIX_ROWS; row++ ) |
843 | { | 1033 | { |
844 | for ( int column = 0; column < MATRIX_COLS; column++ ) | 1034 | for ( int column = 0; column < MATRIX_COLS; column++ ) |
845 | { | 1035 | { |
846 | uint8_t index; | 1036 | uint8_t index; |
847 | map_row_column_to_led( row, column, &index ); | 1037 | map_row_column_to_led( row, column, &index ); |
848 | if ( index < BACKLIGHT_LED_COUNT ) | 1038 | if ( index < BACKLIGHT_LED_COUNT ) |
849 | { | 1039 | { |
850 | if ( ( g_config.alphas_mods[row] & (1<<column) ) == 0 ) | 1040 | if ( ( g_config.alphas_mods[row] & (1<<column) ) == 0 ) |
851 | { | 1041 | { |
852 | backlight_set_color( index, rgb1.r, rgb1.g, rgb1.b ); | 1042 | backlight_set_color( index, rgb1.r, rgb1.g, rgb1.b ); |
853 | } | 1043 | } |
854 | else | 1044 | else |
855 | { | 1045 | { |
856 | backlight_set_color( index, rgb2.r, rgb2.g, rgb2.b ); | 1046 | backlight_set_color( index, rgb2.r, rgb2.g, rgb2.b ); |
857 | } | 1047 | } |
858 | } | 1048 | } |
859 | } | 1049 | } |
860 | } | 1050 | } |
861 | } | 1051 | } |
862 | 1052 | ||
863 | void backlight_effect_gradient_up_down(void) | 1053 | void backlight_effect_gradient_up_down(void) |
864 | { | 1054 | { |
865 | int16_t h1 = g_config.color_1.h; | 1055 | int16_t h1 = g_config.color_1.h; |
866 | int16_t h2 = g_config.color_2.h; | 1056 | int16_t h2 = g_config.color_2.h; |
867 | int16_t deltaH = h2 - h1; | 1057 | int16_t deltaH = h2 - h1; |
868 | 1058 | ||
869 | // Take the shortest path between hues | 1059 | // Take the shortest path between hues |
870 | if ( deltaH > 127 ) | 1060 | if ( deltaH > 127 ) |
871 | { | 1061 | { |
872 | deltaH -= 256; | 1062 | deltaH -= 256; |
873 | } | 1063 | } |
874 | else if ( deltaH < -127 ) | 1064 | else if ( deltaH < -127 ) |
875 | { | 1065 | { |
876 | deltaH += 256; | 1066 | deltaH += 256; |
877 | } | 1067 | } |
878 | // Divide delta by 4, this gives the delta per row | 1068 | // Divide delta by 4, this gives the delta per row |
879 | deltaH /= 4; | 1069 | deltaH /= 4; |
880 | 1070 | ||
881 | int16_t s1 = g_config.color_1.s; | 1071 | int16_t s1 = g_config.color_1.s; |
882 | int16_t s2 = g_config.color_2.s; | 1072 | int16_t s2 = g_config.color_2.s; |
883 | int16_t deltaS = ( s2 - s1 ) / 4; | 1073 | int16_t deltaS = ( s2 - s1 ) / 4; |
884 | 1074 | ||
885 | HSV hsv = { .h = 0, .s = 255, .v = g_config.brightness }; | 1075 | HSV hsv = { .h = 0, .s = 255, .v = g_config.brightness }; |
886 | RGB rgb; | 1076 | RGB rgb; |
887 | Point point; | 1077 | Point point; |
888 | for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ ) | 1078 | for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ ) |
889 | { | 1079 | { |
890 | map_led_to_point( i, &point ); | 1080 | map_led_to_point( i, &point ); |
891 | // The y range will be 0..64, map this to 0..4 | 1081 | // The y range will be 0..64, map this to 0..4 |
892 | uint8_t y = (point.y>>4); | 1082 | uint8_t y = (point.y>>4); |
893 | // Relies on hue being 8-bit and wrapping | 1083 | // Relies on hue being 8-bit and wrapping |
894 | hsv.h = g_config.color_1.h + ( deltaH * y ); | 1084 | hsv.h = g_config.color_1.h + ( deltaH * y ); |
895 | hsv.s = g_config.color_1.s + ( deltaS * y ); | 1085 | hsv.s = g_config.color_1.s + ( deltaS * y ); |
896 | rgb = hsv_to_rgb( hsv ); | 1086 | rgb = hsv_to_rgb( hsv ); |
897 | backlight_set_color( i, rgb.r, rgb.g, rgb.b ); | 1087 | backlight_set_color( i, rgb.r, rgb.g, rgb.b ); |
898 | } | 1088 | } |
899 | } | 1089 | } |
900 | 1090 | ||
901 | void backlight_effect_raindrops(bool initialize) | 1091 | void backlight_effect_raindrops(bool initialize) |
902 | { | 1092 | { |
903 | int16_t h1 = g_config.color_1.h; | 1093 | int16_t h1 = g_config.color_1.h; |
904 | int16_t h2 = g_config.color_2.h; | 1094 | int16_t h2 = g_config.color_2.h; |
905 | int16_t deltaH = h2 - h1; | 1095 | int16_t deltaH = h2 - h1; |
906 | deltaH /= 4; | 1096 | deltaH /= 4; |
907 | 1097 | ||
908 | // Take the shortest path between hues | 1098 | // Take the shortest path between hues |
909 | if ( deltaH > 127 ) | 1099 | if ( deltaH > 127 ) |
910 | { | 1100 | { |
911 | deltaH -= 256; | 1101 | deltaH -= 256; |
912 | } | 1102 | } |
913 | else if ( deltaH < -127 ) | 1103 | else if ( deltaH < -127 ) |
914 | { | 1104 | { |
915 | deltaH += 256; | 1105 | deltaH += 256; |
916 | } | 1106 | } |
917 | 1107 | ||
918 | int16_t s1 = g_config.color_1.s; | 1108 | int16_t s1 = g_config.color_1.s; |
919 | int16_t s2 = g_config.color_2.s; | 1109 | int16_t s2 = g_config.color_2.s; |
920 | int16_t deltaS = ( s2 - s1 ) / 4; | 1110 | int16_t deltaS = ( s2 - s1 ) / 4; |
921 | 1111 | ||
922 | HSV hsv; | 1112 | HSV hsv; |
923 | RGB rgb; | 1113 | RGB rgb; |
924 | 1114 | ||
925 | // Change one LED every tick | 1115 | // Change one LED every tick |
926 | uint8_t led_to_change = ( g_tick & 0x000 ) == 0 ? rand() % BACKLIGHT_LED_COUNT : 255; | 1116 | uint8_t led_to_change = ( g_tick & 0x000 ) == 0 ? rand() % BACKLIGHT_LED_COUNT : 255; |
927 | 1117 | ||
928 | for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ ) | 1118 | for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ ) |
929 | { | 1119 | { |
930 | // If initialize, all get set to random colors | 1120 | // If initialize, all get set to random colors |
931 | // If not, all but one will stay the same as before. | 1121 | // If not, all but one will stay the same as before. |
932 | if ( initialize || i == led_to_change ) | 1122 | if ( initialize || i == led_to_change ) |
933 | { | 1123 | { |
934 | hsv.h = h1 + ( deltaH * ( rand() & 0x03 ) ); | 1124 | hsv.h = h1 + ( deltaH * ( rand() & 0x03 ) ); |
935 | hsv.s = s1 + ( deltaS * ( rand() & 0x03 ) ); | 1125 | hsv.s = s1 + ( deltaS * ( rand() & 0x03 ) ); |
936 | // Override brightness with global brightness control | 1126 | // Override brightness with global brightness control |
937 | hsv.v = g_config.brightness;; | 1127 | hsv.v = g_config.brightness;; |
938 | 1128 | ||
939 | rgb = hsv_to_rgb( hsv ); | 1129 | rgb = hsv_to_rgb( hsv ); |
940 | backlight_set_color( i, rgb.r, rgb.g, rgb.b ); | 1130 | backlight_set_color( i, rgb.r, rgb.g, rgb.b ); |
941 | } | 1131 | } |
942 | } | 1132 | } |
943 | } | 1133 | } |
944 | 1134 | ||
945 | void backlight_effect_cycle_all(void) | 1135 | void backlight_effect_cycle_all(void) |
946 | { | 1136 | { |
947 | uint8_t offset = ( g_tick << g_config.effect_speed ) & 0xFF; | 1137 | uint8_t offset = ( g_tick << g_config.effect_speed ) & 0xFF; |
948 | 1138 | ||
949 | // Relies on hue being 8-bit and wrapping | 1139 | // Relies on hue being 8-bit and wrapping |
950 | for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ ) | 1140 | for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ ) |
951 | { | 1141 | { |
952 | uint16_t offset2 = g_key_hit[i]<<2; | 1142 | uint16_t offset2 = g_key_hit[i]<<2; |
953 | // stabilizer LEDs use spacebar hits | 1143 | #if !defined(RGB_BACKLIGHT_HS60) && !defined(RGB_BACKLIGHT_NK65) |
954 | if ( i == 36+6 || i == 54+13 || // LC6, LD13 | 1144 | // stabilizer LEDs use spacebar hits |
955 | ( g_config.use_7u_spacebar && i == 54+14 ) ) // LD14 | 1145 | if ( i == 36+6 || i == 54+13 || // LC6, LD13 |
956 | { | 1146 | ( g_config.use_7u_spacebar && i == 54+14 ) ) // LD14 |
957 | offset2 = g_key_hit[36+0]<<2; | 1147 | { |
958 | } | 1148 | offset2 = g_key_hit[36+0]<<2; |
959 | offset2 = (offset2<=63) ? (63-offset2) : 0; | 1149 | } |
960 | 1150 | #endif | |
961 | HSV hsv = { .h = offset+offset2, .s = 255, .v = g_config.brightness }; | 1151 | offset2 = (offset2<=63) ? (63-offset2) : 0; |
962 | RGB rgb = hsv_to_rgb( hsv ); | 1152 | |
963 | backlight_set_color( i, rgb.r, rgb.g, rgb.b ); | 1153 | HSV hsv = { .h = offset+offset2, .s = 255, .v = g_config.brightness }; |
964 | } | 1154 | RGB rgb = hsv_to_rgb( hsv ); |
1155 | backlight_set_color( i, rgb.r, rgb.g, rgb.b ); | ||
1156 | } | ||
965 | } | 1157 | } |
966 | 1158 | ||
967 | void backlight_effect_cycle_left_right(void) | 1159 | void backlight_effect_cycle_left_right(void) |
968 | { | 1160 | { |
969 | uint8_t offset = ( g_tick << g_config.effect_speed ) & 0xFF; | 1161 | uint8_t offset = ( g_tick << g_config.effect_speed ) & 0xFF; |
970 | HSV hsv = { .h = 0, .s = 255, .v = g_config.brightness }; | 1162 | HSV hsv = { .h = 0, .s = 255, .v = g_config.brightness }; |
971 | RGB rgb; | 1163 | RGB rgb; |
972 | Point point; | 1164 | Point point; |
973 | for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ ) | 1165 | for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ ) |
974 | { | 1166 | { |
975 | uint16_t offset2 = g_key_hit[i]<<2; | 1167 | uint16_t offset2 = g_key_hit[i]<<2; |
976 | // stabilizer LEDs use spacebar hits | 1168 | #if !defined(RGB_BACKLIGHT_HS60) && !defined(RGB_BACKLIGHT_NK65) |
977 | if ( i == 36+6 || i == 54+13 || // LC6, LD13 | 1169 | // stabilizer LEDs use spacebar hits |
978 | ( g_config.use_7u_spacebar && i == 54+14 ) ) // LD14 | 1170 | if ( i == 36+6 || i == 54+13 || // LC6, LD13 |
979 | { | 1171 | ( g_config.use_7u_spacebar && i == 54+14 ) ) // LD14 |
980 | offset2 = g_key_hit[36+0]<<2; | 1172 | { |
981 | } | 1173 | offset2 = g_key_hit[36+0]<<2; |
982 | offset2 = (offset2<=63) ? (63-offset2) : 0; | 1174 | } |
983 | 1175 | #endif | |
984 | map_led_to_point( i, &point ); | 1176 | offset2 = (offset2<=63) ? (63-offset2) : 0; |
985 | // Relies on hue being 8-bit and wrapping | 1177 | |
986 | hsv.h = point.x + offset + offset2; | 1178 | map_led_to_point( i, &point ); |
987 | rgb = hsv_to_rgb( hsv ); | 1179 | // Relies on hue being 8-bit and wrapping |
988 | backlight_set_color( i, rgb.r, rgb.g, rgb.b ); | 1180 | hsv.h = point.x + offset + offset2; |
989 | } | 1181 | rgb = hsv_to_rgb( hsv ); |
1182 | backlight_set_color( i, rgb.r, rgb.g, rgb.b ); | ||
1183 | } | ||
990 | } | 1184 | } |
991 | 1185 | ||
992 | void backlight_effect_cycle_up_down(void) | 1186 | void backlight_effect_cycle_up_down(void) |
993 | { | 1187 | { |
994 | uint8_t offset = ( g_tick << g_config.effect_speed ) & 0xFF; | 1188 | uint8_t offset = ( g_tick << g_config.effect_speed ) & 0xFF; |
995 | HSV hsv = { .h = 0, .s = 255, .v = g_config.brightness }; | 1189 | HSV hsv = { .h = 0, .s = 255, .v = g_config.brightness }; |
996 | RGB rgb; | 1190 | RGB rgb; |
997 | Point point; | 1191 | Point point; |
998 | for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ ) | 1192 | for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ ) |
999 | { | 1193 | { |
1000 | uint16_t offset2 = g_key_hit[i]<<2; | 1194 | uint16_t offset2 = g_key_hit[i]<<2; |
1001 | // stabilizer LEDs use spacebar hits | 1195 | #if !defined(RGB_BACKLIGHT_HS60) && !defined(RGB_BACKLIGHT_NK65) |
1002 | if ( i == 36+6 || i == 54+13 || // LC6, LD13 | 1196 | // stabilizer LEDs use spacebar hits |
1003 | ( g_config.use_7u_spacebar && i == 54+14 ) ) // LD14 | 1197 | if ( i == 36+6 || i == 54+13 || // LC6, LD13 |
1004 | { | 1198 | ( g_config.use_7u_spacebar && i == 54+14 ) ) // LD14 |
1005 | offset2 = g_key_hit[36+0]<<2; | 1199 | { |
1006 | } | 1200 | offset2 = g_key_hit[36+0]<<2; |
1007 | offset2 = (offset2<=63) ? (63-offset2) : 0; | 1201 | } |
1008 | 1202 | #endif | |
1009 | map_led_to_point( i, &point ); | 1203 | offset2 = (offset2<=63) ? (63-offset2) : 0; |
1010 | // Relies on hue being 8-bit and wrapping | 1204 | |
1011 | hsv.h = point.y + offset + offset2; | 1205 | map_led_to_point( i, &point ); |
1012 | rgb = hsv_to_rgb( hsv ); | 1206 | // Relies on hue being 8-bit and wrapping |
1013 | backlight_set_color( i, rgb.r, rgb.g, rgb.b ); | 1207 | hsv.h = point.y + offset + offset2; |
1014 | } | 1208 | rgb = hsv_to_rgb( hsv ); |
1209 | backlight_set_color( i, rgb.r, rgb.g, rgb.b ); | ||
1210 | } | ||
1015 | } | 1211 | } |
1016 | 1212 | ||
1017 | void backlight_effect_jellybean_raindrops( bool initialize ) | 1213 | void backlight_effect_jellybean_raindrops( bool initialize ) |
1018 | { | 1214 | { |
1019 | HSV hsv; | 1215 | HSV hsv; |
1020 | RGB rgb; | 1216 | RGB rgb; |
1021 | 1217 | ||
1022 | // Change one LED every tick | 1218 | // Change one LED every tick |
1023 | uint8_t led_to_change = ( g_tick & 0x000 ) == 0 ? rand() % BACKLIGHT_LED_COUNT : 255; | 1219 | uint8_t led_to_change = ( g_tick & 0x000 ) == 0 ? rand() % BACKLIGHT_LED_COUNT : 255; |
1024 | 1220 | ||
1025 | for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ ) | 1221 | for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ ) |
1026 | { | 1222 | { |
1027 | // If initialize, all get set to random colors | 1223 | // If initialize, all get set to random colors |
1028 | // If not, all but one will stay the same as before. | 1224 | // If not, all but one will stay the same as before. |
1029 | if ( initialize || i == led_to_change ) | 1225 | if ( initialize || i == led_to_change ) |
1030 | { | 1226 | { |
1031 | hsv.h = rand() & 0xFF; | 1227 | hsv.h = rand() & 0xFF; |
1032 | hsv.s = rand() & 0xFF; | 1228 | hsv.s = rand() & 0xFF; |
1033 | // Override brightness with global brightness control | 1229 | // Override brightness with global brightness control |
1034 | hsv.v = g_config.brightness;; | 1230 | hsv.v = g_config.brightness;; |
1035 | 1231 | ||
1036 | rgb = hsv_to_rgb( hsv ); | 1232 | rgb = hsv_to_rgb( hsv ); |
1037 | backlight_set_color( i, rgb.r, rgb.g, rgb.b ); | 1233 | backlight_set_color( i, rgb.r, rgb.g, rgb.b ); |
1038 | } | 1234 | } |
1039 | } | 1235 | } |
1040 | } | 1236 | } |
1041 | 1237 | ||
1042 | void backlight_effect_cycle_radial1(void) | 1238 | void backlight_effect_cycle_radial1(void) |
1043 | { | 1239 | { |
1044 | uint8_t offset = ( g_tick << g_config.effect_speed ) & 0xFF; | 1240 | uint8_t offset = ( g_tick << g_config.effect_speed ) & 0xFF; |
1045 | HSV hsv = { .h = 0, .s = 255, .v = g_config.brightness }; | 1241 | HSV hsv = { .h = 0, .s = 255, .v = g_config.brightness }; |
1046 | RGB rgb; | 1242 | RGB rgb; |
1047 | Point point; | 1243 | Point point; |
1048 | for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ ) | 1244 | for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ ) |
1049 | { | 1245 | { |
1050 | map_led_to_point_polar( i, &point ); | 1246 | map_led_to_point_polar( i, &point ); |
1051 | // Relies on hue being 8-bit and wrapping | 1247 | // Relies on hue being 8-bit and wrapping |
1052 | hsv.h = point.x + offset; | 1248 | hsv.h = point.x + offset; |
1053 | hsv.s = point.y; | 1249 | hsv.s = point.y; |
1054 | rgb = hsv_to_rgb( hsv ); | 1250 | rgb = hsv_to_rgb( hsv ); |
1055 | backlight_set_color( i, rgb.r, rgb.g, rgb.b ); | 1251 | backlight_set_color( i, rgb.r, rgb.g, rgb.b ); |
1056 | } | 1252 | } |
1057 | } | 1253 | } |
1058 | 1254 | ||
1059 | void backlight_effect_cycle_radial2(void) | 1255 | void backlight_effect_cycle_radial2(void) |
1060 | { | 1256 | { |
1061 | uint8_t offset = ( g_tick << g_config.effect_speed ) & 0xFF; | 1257 | uint8_t offset = ( g_tick << g_config.effect_speed ) & 0xFF; |
1062 | 1258 | ||
1063 | HSV hsv = { .h = 0, .s = g_config.color_1.s, .v = g_config.brightness }; | 1259 | HSV hsv = { .h = 0, .s = g_config.color_1.s, .v = g_config.brightness }; |
1064 | RGB rgb; | 1260 | RGB rgb; |
1065 | Point point; | 1261 | Point point; |
1066 | for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ ) | 1262 | for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ ) |
1067 | { | 1263 | { |
1068 | map_led_to_point_polar( i, &point ); | 1264 | map_led_to_point_polar( i, &point ); |
1069 | uint8_t offset2 = offset + point.x; | 1265 | uint8_t offset2 = offset + point.x; |
1070 | if ( offset2 & 0x80 ) | 1266 | if ( offset2 & 0x80 ) |
1071 | { | 1267 | { |
1072 | offset2 = ~offset2; | 1268 | offset2 = ~offset2; |
1073 | } | 1269 | } |
1074 | offset2 = offset2 >> 2; | 1270 | offset2 = offset2 >> 2; |
1075 | hsv.h = g_config.color_1.h + offset2; | 1271 | hsv.h = g_config.color_1.h + offset2; |
1076 | hsv.s = 127 + ( point.y >> 1 ); | 1272 | hsv.s = 127 + ( point.y >> 1 ); |
1077 | rgb = hsv_to_rgb( hsv ); | 1273 | rgb = hsv_to_rgb( hsv ); |
1078 | backlight_set_color( i, rgb.r, rgb.g, rgb.b ); | 1274 | backlight_set_color( i, rgb.r, rgb.g, rgb.b ); |
1079 | } | 1275 | } |
1080 | } | 1276 | } |
1081 | 1277 | ||
1082 | #if defined(RGB_BACKLIGHT_M6_B) | 1278 | #if defined(RGB_BACKLIGHT_M6_B) |
1083 | void backlight_effect_custom_colors(void) | 1279 | void backlight_effect_custom_colors(void) |
1084 | { | 1280 | { |
1085 | RGB rgb; | 1281 | RGB rgb; |
1086 | for ( uint8_t i = 0; i < 6; i++ ) | 1282 | for ( uint8_t i = 0; i < 6; i++ ) |
1087 | { | 1283 | { |
1088 | HSV hsv = { .h = g_config.custom_color[i].h, .s = g_config.custom_color[i].s, .v = g_config.brightness }; | 1284 | HSV hsv = { .h = g_config.custom_color[i].h, .s = g_config.custom_color[i].s, .v = g_config.brightness }; |
1089 | rgb = hsv_to_rgb( hsv ); | 1285 | rgb = hsv_to_rgb( hsv ); |
1090 | uint8_t led; | 1286 | uint8_t led; |
1091 | map_row_column_to_led( 0, i, &led ); | 1287 | map_row_column_to_led( 0, i, &led ); |
1092 | backlight_set_color( led, rgb.r, rgb.g, rgb.b ); | 1288 | backlight_set_color( led, rgb.r, rgb.g, rgb.b ); |
1093 | } | 1289 | } |
1094 | } | 1290 | } |
1095 | #endif | 1291 | #endif |
1096 | 1292 | ||
1097 | void backlight_effect_indicators_set_colors( uint8_t index, HS color ) | 1293 | void backlight_effect_indicators_set_colors( uint8_t index, HS color ) |
1098 | { | 1294 | { |
1099 | HSV hsv = { .h = color.h, .s = color.s, .v = g_config.brightness }; | 1295 | HSV hsv = { .h = color.h, .s = color.s, .v = g_config.brightness }; |
1100 | RGB rgb = hsv_to_rgb( hsv ); | 1296 | RGB rgb = hsv_to_rgb( hsv ); |
1101 | if ( index == 254 ) | 1297 | if ( index == 254 ) |
1102 | { | 1298 | { |
1103 | backlight_set_color_all( rgb.r, rgb.g, rgb.b ); | 1299 | backlight_set_color_all( rgb.r, rgb.g, rgb.b ); |
1104 | } | 1300 | } |
1105 | else | 1301 | else |
1106 | { | 1302 | { |
1107 | backlight_set_color( index, rgb.r, rgb.g, rgb.b ); | 1303 | backlight_set_color( index, rgb.r, rgb.g, rgb.b ); |
1108 | 1304 | ||
1109 | // If the spacebar LED is the indicator, | 1305 | // If the spacebar LED is the indicator, |
1110 | // do the same for the spacebar stabilizers | 1306 | // do the same for the spacebar stabilizers |
1111 | if ( index == 36+0 ) // LC0 | 1307 | if ( index == 36+0 ) // LC0 |
1112 | { | 1308 | { |
1113 | #if defined (RGB_BACKLIGHT_ZEAL65) | 1309 | #if defined(RGB_BACKLIGHT_ZEAL65) |
1114 | backlight_set_color( 36+7, rgb.r, rgb.g, rgb.b ); // LC7 | 1310 | backlight_set_color( 36+7, rgb.r, rgb.g, rgb.b ); // LC7 |
1115 | backlight_set_color( 54+14, rgb.r, rgb.g, rgb.b ); // LD14 | 1311 | backlight_set_color( 54+14, rgb.r, rgb.g, rgb.b ); // LD14 |
1116 | #elif defined (RGB_BACKLIGHT_KOYU) | 1312 | #elif defined(RGB_BACKLIGHT_KOYU) |
1117 | backlight_set_color( 36+6, rgb.r, rgb.g, rgb.b ); // LC6 | 1313 | backlight_set_color( 36+6, rgb.r, rgb.g, rgb.b ); // LC6 |
1118 | backlight_set_color( 54+14, rgb.r, rgb.g, rgb.b ); // LD14 | 1314 | backlight_set_color( 54+14, rgb.r, rgb.g, rgb.b ); // LD14 |
1119 | #elif defined (RGB_BACKLIGHT_ZEAL60) || defined (RGB_BACKLIGHT_M60_A) | 1315 | #elif defined(RGB_BACKLIGHT_ZEAL60) || defined(RGB_BACKLIGHT_M60_A) |
1120 | backlight_set_color( 36+6, rgb.r, rgb.g, rgb.b ); // LC6 | 1316 | backlight_set_color( 36+6, rgb.r, rgb.g, rgb.b ); // LC6 |
1121 | backlight_set_color( 54+13, rgb.r, rgb.g, rgb.b ); // LD13 | 1317 | backlight_set_color( 54+13, rgb.r, rgb.g, rgb.b ); // LD13 |
1122 | if ( g_config.use_7u_spacebar ) | 1318 | if ( g_config.use_7u_spacebar ) |
1123 | { | 1319 | { |
1124 | backlight_set_color( 54+14, rgb.r, rgb.g, rgb.b ); // LD14 | 1320 | backlight_set_color( 54+14, rgb.r, rgb.g, rgb.b ); // LD14 |
1125 | } | 1321 | } |
1126 | #endif | 1322 | #endif |
1127 | } | 1323 | } |
1128 | } | 1324 | } |
1129 | } | 1325 | } |
1130 | 1326 | ||
1131 | // This runs after another backlight effect and replaces | 1327 | // This runs after another backlight effect and replaces |
1132 | // colors already set | 1328 | // colors already set |
1133 | void backlight_effect_indicators(void) | 1329 | void backlight_effect_indicators(void) |
1134 | { | 1330 | { |
1135 | if ( g_config.caps_lock_indicator.index != 255 && | 1331 | if ( g_config.caps_lock_indicator.index != 255 && |
1136 | ( g_indicator_state & (1<<USB_LED_CAPS_LOCK) ) ) | 1332 | ( g_indicator_state & (1<<USB_LED_CAPS_LOCK) ) ) |
1137 | { | 1333 | { |
1138 | backlight_effect_indicators_set_colors( g_config.caps_lock_indicator.index, g_config.caps_lock_indicator.color ); | 1334 | backlight_effect_indicators_set_colors( g_config.caps_lock_indicator.index, g_config.caps_lock_indicator.color ); |
1139 | } | 1335 | } |
1140 | 1336 | ||
1141 | // This if/else if structure allows higher layers to | 1337 | #if defined(RGB_BACKLIGHT_NK65) |
1142 | // override lower ones. If we set layer 3's indicator | 1338 | if ( g_indicator_state & (1<<USB_LED_CAPS_LOCK) ) |
1143 | // to none, then it will NOT show layer 2 or layer 1 | 1339 | { |
1144 | // indicators, even if those layers are on via the | 1340 | IS31FL3733_set_color( 7+64-1, 0, 255, 0 ); |
1145 | // MO13/MO23 Fn combo magic. | 1341 | } else { |
1146 | // | 1342 | IS31FL3733_set_color( 7+64-1, 0, 0, 0 ); |
1147 | // Basically we want to handle the case where layer 3 is | 1343 | } |
1148 | // still the backlight configuration layer and we don't | 1344 | if ( g_indicator_state & (1<<USB_LED_SCROLL_LOCK) ) |
1149 | // want "all LEDs" indicators hiding the backlight effect, | 1345 | { |
1150 | // but still allow end users to do whatever they want. | 1346 | IS31FL3733_set_color( 6+64-1, 255, 0, 255 ); |
1151 | if ( IS_LAYER_ON(3) ) | 1347 | } else { |
1152 | { | 1348 | IS31FL3733_set_color( 6+64-1, 0, 0, 0 ); |
1153 | if ( g_config.layer_3_indicator.index != 255 ) | 1349 | } |
1154 | { | 1350 | if ( g_indicator_state & (1<<USB_LED_NUM_LOCK) ) |
1155 | backlight_effect_indicators_set_colors( g_config.layer_3_indicator.index, g_config.layer_3_indicator.color ); | 1351 | { |
1156 | } | 1352 | IS31FL3733_set_color( 6+64-1, 0, 255, 0 ); |
1157 | } | 1353 | } else { |
1158 | else if ( IS_LAYER_ON(2) ) | 1354 | IS31FL3733_set_color( 6+64-1, 0, 0, 0 ); |
1159 | { | 1355 | } |
1160 | if ( g_config.layer_2_indicator.index != 255 ) | 1356 | #endif |
1161 | { | 1357 | |
1162 | backlight_effect_indicators_set_colors( g_config.layer_2_indicator.index, g_config.layer_2_indicator.color ); | 1358 | // This if/else if structure allows higher layers to |
1163 | } | 1359 | // override lower ones. If we set layer 3's indicator |
1164 | } | 1360 | // to none, then it will NOT show layer 2 or layer 1 |
1165 | else if ( IS_LAYER_ON(1) ) | 1361 | // indicators, even if those layers are on via the |
1166 | { | 1362 | // MO13/MO23 Fn combo magic. |
1167 | if ( g_config.layer_1_indicator.index != 255 ) | 1363 | // |
1168 | { | 1364 | // Basically we want to handle the case where layer 3 is |
1169 | backlight_effect_indicators_set_colors( g_config.layer_1_indicator.index, g_config.layer_1_indicator.color ); | 1365 | // still the backlight configuration layer and we don't |
1170 | } | 1366 | // want "all LEDs" indicators hiding the backlight effect, |
1171 | } | 1367 | // but still allow end users to do whatever they want. |
1368 | if ( IS_LAYER_ON(3) ) | ||
1369 | { | ||
1370 | if ( g_config.layer_3_indicator.index != 255 ) | ||
1371 | { | ||
1372 | backlight_effect_indicators_set_colors( g_config.layer_3_indicator.index, g_config.layer_3_indicator.color ); | ||
1373 | } | ||
1374 | } | ||
1375 | else if ( IS_LAYER_ON(2) ) | ||
1376 | { | ||
1377 | if ( g_config.layer_2_indicator.index != 255 ) | ||
1378 | { | ||
1379 | backlight_effect_indicators_set_colors( g_config.layer_2_indicator.index, g_config.layer_2_indicator.color ); | ||
1380 | } | ||
1381 | } | ||
1382 | else if ( IS_LAYER_ON(1) ) | ||
1383 | { | ||
1384 | if ( g_config.layer_1_indicator.index != 255 ) | ||
1385 | { | ||
1386 | backlight_effect_indicators_set_colors( g_config.layer_1_indicator.index, g_config.layer_1_indicator.color ); | ||
1387 | } | ||
1388 | } | ||
1172 | } | 1389 | } |
1173 | 1390 | ||
1174 | #if !defined(RGB_BACKLIGHT_HS60) | 1391 | #if !defined(RGB_BACKLIGHT_HS60) && !defined(RGB_BACKLIGHT_NK65) |
1175 | ISR(TIMER3_COMPA_vect) | 1392 | ISR(TIMER3_COMPA_vect) |
1176 | #else //STM32 interrupt | 1393 | #else //STM32 interrupt |
1177 | static void gpt_backlight_timer_task(GPTDriver *gptp) | 1394 | static void gpt_backlight_timer_task(GPTDriver *gptp) |
1178 | #endif | 1395 | #endif |
1179 | { | 1396 | { |
1180 | // delay 1 second before driving LEDs or doing anything else | 1397 | // delay 1 second before driving LEDs or doing anything else |
1181 | static uint8_t startup_tick = 0; | 1398 | static uint8_t startup_tick = 0; |
1182 | if ( startup_tick < 20 ) | 1399 | if ( startup_tick < 20 ) |
1183 | { | 1400 | { |
1184 | startup_tick++; | 1401 | startup_tick++; |
1185 | return; | 1402 | return; |
1186 | } | 1403 | } |
1187 | 1404 | ||
1188 | g_tick++; | 1405 | g_tick++; |
1189 | 1406 | ||
1190 | if ( g_any_key_hit < 0xFFFFFFFF ) | 1407 | if ( g_any_key_hit < 0xFFFFFFFF ) |
1191 | { | 1408 | { |
1192 | g_any_key_hit++; | 1409 | g_any_key_hit++; |
1193 | } | 1410 | } |
1194 | 1411 | ||
1195 | for ( int led = 0; led < BACKLIGHT_LED_COUNT; led++ ) | 1412 | for ( int led = 0; led < BACKLIGHT_LED_COUNT; led++ ) |
1196 | { | 1413 | { |
1197 | if ( g_key_hit[led] < 255 ) | 1414 | if ( g_key_hit[led] < 255 ) |
1198 | { | 1415 | { |
1199 | g_key_hit[led]++; | 1416 | g_key_hit[led]++; |
1200 | } | 1417 | } |
1201 | } | 1418 | } |
1202 | 1419 | ||
1203 | // Factory default magic value | 1420 | // Factory default magic value |
1204 | if ( g_config.effect == 255 ) | 1421 | if ( g_config.effect == 255 ) |
1205 | { | 1422 | { |
1206 | backlight_effect_rgb_test(); | 1423 | backlight_effect_rgb_test(); |
1207 | return; | 1424 | return; |
1208 | } | 1425 | } |
1209 | 1426 | ||
1210 | // Ideally we would also stop sending zeros to the LED driver PWM buffers | 1427 | // Ideally we would also stop sending zeros to the LED driver PWM buffers |
1211 | // while suspended and just do a software shutdown. This is a cheap hack for now. | 1428 | // while suspended and just do a software shutdown. This is a cheap hack for now. |
1212 | bool suspend_backlight = ((g_suspend_state && g_config.disable_when_usb_suspended) || | 1429 | bool suspend_backlight = ((g_suspend_state && g_config.disable_when_usb_suspended) || |
1213 | (g_config.disable_after_timeout > 0 && g_any_key_hit > g_config.disable_after_timeout * 60 * 20)); | 1430 | (g_config.disable_after_timeout > 0 && g_any_key_hit > g_config.disable_after_timeout * 60 * 20)); |
1214 | uint8_t effect = suspend_backlight ? 0 : g_config.effect; | 1431 | uint8_t effect = suspend_backlight ? 0 : g_config.effect; |
1215 | 1432 | ||
1216 | // Keep track of the effect used last time, | 1433 | // Keep track of the effect used last time, |
1217 | // detect change in effect, so each effect can | 1434 | // detect change in effect, so each effect can |
1218 | // have an optional initialization. | 1435 | // have an optional initialization. |
1219 | static uint8_t effect_last = 255; | 1436 | static uint8_t effect_last = 255; |
1220 | bool initialize = effect != effect_last; | 1437 | bool initialize = effect != effect_last; |
1221 | effect_last = effect; | 1438 | effect_last = effect; |
1222 | 1439 | ||
1223 | // this gets ticked at 20 Hz. | 1440 | // this gets ticked at 20 Hz. |
1224 | // each effect can opt to do calculations | 1441 | // each effect can opt to do calculations |
1225 | // and/or request PWM buffer updates. | 1442 | // and/or request PWM buffer updates. |
1226 | switch ( effect ) | 1443 | switch ( effect ) |
1227 | { | 1444 | { |
1228 | case 0: | 1445 | case 0: |
1229 | backlight_effect_all_off(); | 1446 | backlight_effect_all_off(); |
1230 | break; | 1447 | break; |
1231 | case 1: | 1448 | case 1: |
1232 | backlight_effect_solid_color(); | 1449 | backlight_effect_solid_color(); |
1233 | break; | 1450 | break; |
1234 | case 2: | 1451 | case 2: |
1235 | #if defined(RGB_BACKLIGHT_M6_B) | 1452 | #if defined(RGB_BACKLIGHT_M6_B) |
1236 | backlight_effect_custom_colors(); | 1453 | backlight_effect_custom_colors(); |
1237 | #else | 1454 | #else |
1238 | backlight_effect_alphas_mods(); | 1455 | backlight_effect_alphas_mods(); |
1239 | #endif | 1456 | #endif |
1240 | break; | 1457 | break; |
1241 | case 3: | 1458 | case 3: |
1242 | backlight_effect_gradient_up_down(); | 1459 | backlight_effect_gradient_up_down(); |
1243 | break; | 1460 | break; |
1244 | case 4: | 1461 | case 4: |
1245 | backlight_effect_raindrops( initialize ); | 1462 | backlight_effect_raindrops( initialize ); |
1246 | break; | 1463 | break; |
1247 | case 5: | 1464 | case 5: |
1248 | backlight_effect_cycle_all(); | 1465 | backlight_effect_cycle_all(); |
1249 | break; | 1466 | break; |
1250 | case 6: | 1467 | case 6: |
1251 | backlight_effect_cycle_left_right(); | 1468 | backlight_effect_cycle_left_right(); |
1252 | break; | 1469 | break; |
1253 | case 7: | 1470 | case 7: |
1254 | backlight_effect_cycle_up_down(); | 1471 | backlight_effect_cycle_up_down(); |
1255 | break; | 1472 | break; |
1256 | case 8: | 1473 | case 8: |
1257 | backlight_effect_jellybean_raindrops( initialize ); | 1474 | backlight_effect_jellybean_raindrops( initialize ); |
1258 | break; | 1475 | break; |
1259 | case 9: | 1476 | case 9: |
1260 | backlight_effect_cycle_radial1(); | 1477 | backlight_effect_cycle_radial1(); |
1261 | break; | 1478 | break; |
1262 | case 10: | 1479 | case 10: |
1263 | backlight_effect_cycle_radial2(); | 1480 | backlight_effect_cycle_radial2(); |
1264 | break; | 1481 | break; |
1265 | default: | 1482 | default: |
1266 | backlight_effect_all_off(); | 1483 | backlight_effect_all_off(); |
1267 | break; | 1484 | break; |
1268 | } | 1485 | } |
1269 | 1486 | ||
1270 | if ( ! suspend_backlight ) | 1487 | if ( ! suspend_backlight ) |
1271 | { | 1488 | { |
1272 | #if !defined(RGB_BACKLIGHT_M6_B) | 1489 | #if !defined(RGB_BACKLIGHT_M6_B) |
1273 | backlight_effect_indicators(); | 1490 | backlight_effect_indicators(); |
1274 | #endif | 1491 | #endif |
1275 | } | 1492 | } |
1276 | } | 1493 | } |
1277 | 1494 | ||
1278 | void backlight_set_indicator_index( uint8_t *index, uint8_t row, uint8_t column ) | 1495 | void backlight_set_indicator_index( uint8_t *index, uint8_t row, uint8_t column ) |
1279 | { | 1496 | { |
1280 | if ( row >= MATRIX_ROWS ) | 1497 | if ( row >= MATRIX_ROWS ) |
1281 | { | 1498 | { |
1282 | // Special value, 255=none, 254=all | 1499 | // Special value, 255=none, 254=all |
1283 | *index = row; | 1500 | *index = row; |
1284 | } | 1501 | } |
1285 | else | 1502 | else |
1286 | { | 1503 | { |
1287 | map_row_column_to_led( row, column, index ); | 1504 | map_row_column_to_led( row, column, index ); |
1288 | } | 1505 | } |
1289 | } | 1506 | } |
1290 | 1507 | ||
1291 | void backlight_get_indicator_row_col( uint8_t index, uint8_t *row, uint8_t *column ) | 1508 | void backlight_get_indicator_row_col( uint8_t index, uint8_t *row, uint8_t *column ) |
1292 | { | 1509 | { |
1293 | if ( index == 255 || index == 254 ) | 1510 | if ( index == 255 || index == 254 ) |
1294 | { | 1511 | { |
1295 | // Special value, 255=none, 254=all | 1512 | // Special value, 255=none, 254=all |
1296 | *row = index; | 1513 | *row = index; |
1297 | *column = 0; | 1514 | *column = 0; |
1298 | return; | 1515 | return; |
1299 | } | 1516 | } |
1300 | for ( uint8_t r = 0; r < MATRIX_ROWS; r++ ) | 1517 | for ( uint8_t r = 0; r < MATRIX_ROWS; r++ ) |
1301 | { | 1518 | { |
1302 | for ( uint8_t c = 0; c < MATRIX_COLS; c++ ) | 1519 | for ( uint8_t c = 0; c < MATRIX_COLS; c++ ) |
1303 | { | 1520 | { |
1304 | uint8_t i = 255; | 1521 | uint8_t i = 255; |
1305 | map_row_column_to_led( r, c, &i ); | 1522 | map_row_column_to_led( r, c, &i ); |
1306 | if ( i == index ) | 1523 | if ( i == index ) |
1307 | { | 1524 | { |
1308 | *row = r; | 1525 | *row = r; |
1309 | *column = c; | 1526 | *column = c; |
1310 | return; | 1527 | return; |
1311 | } | 1528 | } |
1312 | } | 1529 | } |
1313 | } | 1530 | } |
1314 | } | 1531 | } |
1315 | 1532 | ||
1316 | // Some helpers for setting/getting HSV | 1533 | // Some helpers for setting/getting HSV |
1317 | void _set_color( HS *color, uint8_t *data ) | 1534 | void _set_color( HS *color, uint8_t *data ) |
1318 | { | 1535 | { |
1319 | color->h = data[0]; | 1536 | color->h = data[0]; |
1320 | color->s = data[1]; | 1537 | color->s = data[1]; |
1321 | } | 1538 | } |
1322 | 1539 | ||
1323 | void _get_color( HS *color, uint8_t *data ) | 1540 | void _get_color( HS *color, uint8_t *data ) |
1324 | { | 1541 | { |
1325 | data[0] = color->h; | 1542 | data[0] = color->h; |
1326 | data[1] = color->s; | 1543 | data[1] = color->s; |
1327 | } | 1544 | } |
1328 | 1545 | ||
1329 | void backlight_config_set_value( uint8_t *data ) | 1546 | void backlight_config_set_value( uint8_t *data ) |
1330 | { | 1547 | { |
1331 | bool reinitialize = false; | 1548 | bool reinitialize = false; |
1332 | uint8_t *value_id = &(data[0]); | 1549 | uint8_t *value_id = &(data[0]); |
1333 | uint8_t *value_data = &(data[1]); | 1550 | uint8_t *value_data = &(data[1]); |
1334 | switch ( *value_id ) | 1551 | switch ( *value_id ) |
1335 | { | 1552 | { |
1336 | #if defined (RGB_BACKLIGHT_ZEAL60) || defined(RGB_BACKLIGHT_ZEAL65) | 1553 | #if defined (RGB_BACKLIGHT_ZEAL60) || defined(RGB_BACKLIGHT_ZEAL65) |
1337 | case id_use_split_backspace: | 1554 | case id_use_split_backspace: |
1338 | { | 1555 | { |
1339 | g_config.use_split_backspace = (bool)*value_data; | 1556 | g_config.use_split_backspace = (bool)*value_data; |
1340 | reinitialize = true; | 1557 | reinitialize = true; |
1341 | break; | 1558 | break; |
1342 | } | 1559 | } |
1343 | #endif | 1560 | #endif |
1344 | #if defined (RGB_BACKLIGHT_ZEAL60) | 1561 | #if defined (RGB_BACKLIGHT_ZEAL60) |
1345 | case id_use_split_left_shift: | 1562 | case id_use_split_left_shift: |
1346 | { | 1563 | { |
1347 | g_config.use_split_left_shift = (bool)*value_data; | 1564 | g_config.use_split_left_shift = (bool)*value_data; |
1348 | reinitialize = true; | 1565 | reinitialize = true; |
1349 | break; | 1566 | break; |
1350 | } | 1567 | } |
1351 | case id_use_split_right_shift: | 1568 | case id_use_split_right_shift: |
1352 | { | 1569 | { |
1353 | g_config.use_split_right_shift = (bool)*value_data; | 1570 | g_config.use_split_right_shift = (bool)*value_data; |
1354 | reinitialize = true; | 1571 | reinitialize = true; |
1355 | break; | 1572 | break; |
1356 | } | 1573 | } |
1357 | case id_use_7u_spacebar: | 1574 | case id_use_7u_spacebar: |
1358 | { | 1575 | { |
1359 | g_config.use_7u_spacebar = (bool)*value_data; | 1576 | g_config.use_7u_spacebar = (bool)*value_data; |
1360 | reinitialize = true; | 1577 | reinitialize = true; |
1361 | break; | 1578 | break; |
1362 | } | 1579 | } |
1363 | case id_use_iso_enter: | 1580 | case id_use_iso_enter: |
1364 | { | 1581 | { |
1365 | g_config.use_iso_enter = (bool)*value_data; | 1582 | g_config.use_iso_enter = (bool)*value_data; |
1366 | reinitialize = true; | 1583 | reinitialize = true; |
1367 | break; | 1584 | break; |
1368 | } | 1585 | } |
1369 | case id_disable_hhkb_blocker_leds: | 1586 | case id_disable_hhkb_blocker_leds: |
1370 | { | 1587 | { |
1371 | g_config.disable_hhkb_blocker_leds = (bool)*value_data; | 1588 | g_config.disable_hhkb_blocker_leds = (bool)*value_data; |
1372 | reinitialize = true; | 1589 | reinitialize = true; |
1373 | break; | 1590 | break; |
1374 | } | 1591 | } |
1375 | #endif | 1592 | #endif |
1376 | case id_disable_when_usb_suspended: | 1593 | case id_disable_when_usb_suspended: |
1377 | { | 1594 | { |
1378 | g_config.disable_when_usb_suspended = (bool)*value_data; | 1595 | g_config.disable_when_usb_suspended = (bool)*value_data; |
1379 | break; | 1596 | break; |
1380 | } | 1597 | } |
1381 | case id_disable_after_timeout: | 1598 | case id_disable_after_timeout: |
1382 | { | 1599 | { |
1383 | g_config.disable_after_timeout = *value_data; | 1600 | g_config.disable_after_timeout = *value_data; |
1384 | break; | 1601 | break; |
1385 | } | 1602 | } |
1386 | case id_brightness: | 1603 | case id_brightness: |
1387 | { | 1604 | { |
1388 | g_config.brightness = *value_data; | 1605 | g_config.brightness = *value_data; |
1389 | break; | 1606 | break; |
1390 | } | 1607 | } |
1391 | case id_effect: | 1608 | case id_effect: |
1392 | { | 1609 | { |
1393 | g_config.effect = *value_data; | 1610 | g_config.effect = *value_data; |
1394 | break; | 1611 | break; |
1395 | } | 1612 | } |
1396 | case id_effect_speed: | 1613 | case id_effect_speed: |
1397 | { | 1614 | { |
1398 | g_config.effect_speed = *value_data; | 1615 | g_config.effect_speed = *value_data; |
1399 | break; | 1616 | break; |
1400 | } | 1617 | } |
1401 | case id_color_1: | 1618 | case id_color_1: |
1402 | { | 1619 | { |
1403 | _set_color( &(g_config.color_1), value_data ); | 1620 | _set_color( &(g_config.color_1), value_data ); |
1404 | break; | 1621 | break; |
1405 | } | 1622 | } |
1406 | case id_color_2: | 1623 | case id_color_2: |
1407 | { | 1624 | { |
1408 | _set_color( &(g_config.color_2), value_data ); | 1625 | _set_color( &(g_config.color_2), value_data ); |
1409 | break; | 1626 | break; |
1410 | } | 1627 | } |
1411 | case id_caps_lock_indicator_color: | 1628 | case id_caps_lock_indicator_color: |
1412 | { | 1629 | { |
1413 | _set_color( &(g_config.caps_lock_indicator.color), value_data ); | 1630 | _set_color( &(g_config.caps_lock_indicator.color), value_data ); |
1414 | break; | 1631 | break; |
1415 | } | 1632 | } |
1416 | case id_caps_lock_indicator_row_col: | 1633 | case id_caps_lock_indicator_row_col: |
1417 | { | 1634 | { |
1418 | backlight_set_indicator_index( &(g_config.caps_lock_indicator.index), value_data[0], value_data[1] ); | 1635 | backlight_set_indicator_index( &(g_config.caps_lock_indicator.index), value_data[0], value_data[1] ); |
1419 | break; | 1636 | break; |
1420 | } | 1637 | } |
1421 | case id_layer_1_indicator_color: | 1638 | case id_layer_1_indicator_color: |
1422 | { | 1639 | { |
1423 | _set_color( &(g_config.layer_1_indicator.color), value_data ); | 1640 | _set_color( &(g_config.layer_1_indicator.color), value_data ); |
1424 | break; | 1641 | break; |
1425 | } | 1642 | } |
1426 | case id_layer_1_indicator_row_col: | 1643 | case id_layer_1_indicator_row_col: |
1427 | { | 1644 | { |
1428 | backlight_set_indicator_index( &(g_config.layer_1_indicator.index), value_data[0], value_data[1] ); | 1645 | backlight_set_indicator_index( &(g_config.layer_1_indicator.index), value_data[0], value_data[1] ); |
1429 | break; | 1646 | break; |
1430 | } | 1647 | } |
1431 | case id_layer_2_indicator_color: | 1648 | case id_layer_2_indicator_color: |
1432 | { | 1649 | { |
1433 | _set_color( &(g_config.layer_2_indicator.color), value_data ); | 1650 | _set_color( &(g_config.layer_2_indicator.color), value_data ); |
1434 | break; | 1651 | break; |
1435 | } | 1652 | } |
1436 | case id_layer_2_indicator_row_col: | 1653 | case id_layer_2_indicator_row_col: |
1437 | { | 1654 | { |
1438 | backlight_set_indicator_index( &(g_config.layer_2_indicator.index), value_data[0], value_data[1] ); | 1655 | backlight_set_indicator_index( &(g_config.layer_2_indicator.index), value_data[0], value_data[1] ); |
1439 | break; | 1656 | break; |
1440 | } | 1657 | } |
1441 | case id_layer_3_indicator_color: | 1658 | case id_layer_3_indicator_color: |
1442 | { | 1659 | { |
1443 | _set_color( &(g_config.layer_3_indicator.color), value_data ); | 1660 | _set_color( &(g_config.layer_3_indicator.color), value_data ); |
1444 | break; | 1661 | break; |
1445 | } | 1662 | } |
1446 | case id_layer_3_indicator_row_col: | 1663 | case id_layer_3_indicator_row_col: |
1447 | { | 1664 | { |
1448 | backlight_set_indicator_index( &(g_config.layer_3_indicator.index), value_data[0], value_data[1] ); | 1665 | backlight_set_indicator_index( &(g_config.layer_3_indicator.index), value_data[0], value_data[1] ); |
1449 | break; | 1666 | break; |
1450 | } | 1667 | } |
1451 | case id_alphas_mods: | 1668 | case id_alphas_mods: |
1452 | { | 1669 | { |
1453 | for ( int i=0; i<5; i++ ) | 1670 | for ( int i=0; i<5; i++ ) |
1454 | { | 1671 | { |
1455 | g_config.alphas_mods[i] = ( *(value_data+i*2) << 8 ) | ( *(value_data+i*2+1) ); | 1672 | g_config.alphas_mods[i] = ( *(value_data+i*2) << 8 ) | ( *(value_data+i*2+1) ); |
1456 | } | 1673 | } |
1457 | } | 1674 | } |
1458 | #if defined(RGB_BACKLIGHT_M6_B) | 1675 | #if defined(RGB_BACKLIGHT_M6_B) |
1459 | case id_custom_color: | 1676 | case id_custom_color: |
1460 | { | 1677 | { |
1461 | uint8_t index = value_data[0]; | 1678 | uint8_t index = value_data[0]; |
1462 | if ( index >= 0 && index <= 6 ) | 1679 | if ( index >= 0 && index <= 6 ) |
1463 | { | 1680 | { |
1464 | _set_color( &(g_config.custom_color[index]), &(value_data[1]) ); | 1681 | _set_color( &(g_config.custom_color[index]), &(value_data[1]) ); |
1465 | } | 1682 | } |
1466 | } | 1683 | } |
1467 | #endif | 1684 | #endif |
1468 | } | 1685 | } |
1469 | 1686 | ||
1470 | if ( reinitialize ) | 1687 | if ( reinitialize ) |
1471 | { | 1688 | { |
1472 | backlight_init_drivers(); | 1689 | backlight_init_drivers(); |
1473 | } | 1690 | } |
1474 | } | 1691 | } |
1475 | 1692 | ||
1476 | void backlight_config_get_value( uint8_t *data ) | 1693 | void backlight_config_get_value( uint8_t *data ) |
1477 | { | 1694 | { |
1478 | uint8_t *value_id = &(data[0]); | 1695 | uint8_t *value_id = &(data[0]); |
1479 | uint8_t *value_data = &(data[1]); | 1696 | uint8_t *value_data = &(data[1]); |
1480 | switch ( *value_id ) | 1697 | switch ( *value_id ) |
1481 | { | 1698 | { |
1482 | case id_use_split_backspace: | 1699 | case id_use_split_backspace: |
1483 | { | 1700 | { |
1484 | *value_data = ( g_config.use_split_backspace ? 1 : 0 ); | 1701 | *value_data = ( g_config.use_split_backspace ? 1 : 0 ); |
1485 | break; | 1702 | break; |
1486 | } | 1703 | } |
1487 | case id_use_split_left_shift: | 1704 | case id_use_split_left_shift: |
1488 | { | 1705 | { |
1489 | *value_data = ( g_config.use_split_left_shift ? 1 : 0 ); | 1706 | *value_data = ( g_config.use_split_left_shift ? 1 : 0 ); |
1490 | break; | 1707 | break; |
1491 | } | 1708 | } |
1492 | case id_use_split_right_shift: | 1709 | case id_use_split_right_shift: |
1493 | { | 1710 | { |
1494 | *value_data = ( g_config.use_split_right_shift ? 1 : 0 ); | 1711 | *value_data = ( g_config.use_split_right_shift ? 1 : 0 ); |
1495 | break; | 1712 | break; |
1496 | } | 1713 | } |
1497 | case id_use_7u_spacebar: | 1714 | case id_use_7u_spacebar: |
1498 | { | 1715 | { |
1499 | *value_data = ( g_config.use_7u_spacebar ? 1 : 0 ); | 1716 | *value_data = ( g_config.use_7u_spacebar ? 1 : 0 ); |
1500 | break; | 1717 | break; |
1501 | } | 1718 | } |
1502 | case id_use_iso_enter: | 1719 | case id_use_iso_enter: |
1503 | { | 1720 | { |
1504 | *value_data = ( g_config.use_iso_enter ? 1 : 0 ); | 1721 | *value_data = ( g_config.use_iso_enter ? 1 : 0 ); |
1505 | break; | 1722 | break; |
1506 | } | 1723 | } |
1507 | case id_disable_when_usb_suspended: | 1724 | case id_disable_when_usb_suspended: |
1508 | { | 1725 | { |
1509 | *value_data = ( g_config.disable_when_usb_suspended ? 1 : 0 ); | 1726 | *value_data = ( g_config.disable_when_usb_suspended ? 1 : 0 ); |
1510 | break; | 1727 | break; |
1511 | } | 1728 | } |
1512 | case id_disable_hhkb_blocker_leds: | 1729 | case id_disable_hhkb_blocker_leds: |
1513 | { | 1730 | { |
1514 | *value_data = ( g_config.disable_hhkb_blocker_leds ? 1 : 0 ); | 1731 | *value_data = ( g_config.disable_hhkb_blocker_leds ? 1 : 0 ); |
1515 | break; | 1732 | break; |
1516 | } | 1733 | } |
1517 | case id_disable_after_timeout: | 1734 | case id_disable_after_timeout: |
1518 | { | 1735 | { |
1519 | *value_data = g_config.disable_after_timeout; | 1736 | *value_data = g_config.disable_after_timeout; |
1520 | break; | 1737 | break; |
1521 | } | 1738 | } |
1522 | case id_brightness: | 1739 | case id_brightness: |
1523 | { | 1740 | { |
1524 | *value_data = g_config.brightness; | 1741 | *value_data = g_config.brightness; |
1525 | break; | 1742 | break; |
1526 | } | 1743 | } |
1527 | case id_effect: | 1744 | case id_effect: |
1528 | { | 1745 | { |
1529 | *value_data = g_config.effect; | 1746 | *value_data = g_config.effect; |
1530 | break; | 1747 | break; |
1531 | } | 1748 | } |
1532 | case id_effect_speed: | 1749 | case id_effect_speed: |
1533 | { | 1750 | { |
1534 | *value_data = g_config.effect_speed; | 1751 | *value_data = g_config.effect_speed; |
1535 | break; | 1752 | break; |
1536 | } | 1753 | } |
1537 | case id_color_1: | 1754 | case id_color_1: |
1538 | { | 1755 | { |
1539 | _get_color( &(g_config.color_1), value_data ); | 1756 | _get_color( &(g_config.color_1), value_data ); |
1540 | break; | 1757 | break; |
1541 | } | 1758 | } |
1542 | case id_color_2: | 1759 | case id_color_2: |
1543 | { | 1760 | { |
1544 | _get_color( &(g_config.color_2), value_data ); | 1761 | _get_color( &(g_config.color_2), value_data ); |
1545 | break; | 1762 | break; |
1546 | } | 1763 | } |
1547 | case id_caps_lock_indicator_color: | 1764 | case id_caps_lock_indicator_color: |
1548 | { | 1765 | { |
1549 | _get_color( &(g_config.caps_lock_indicator.color), value_data ); | 1766 | _get_color( &(g_config.caps_lock_indicator.color), value_data ); |
1550 | break; | 1767 | break; |
1551 | } | 1768 | } |
1552 | case id_caps_lock_indicator_row_col: | 1769 | case id_caps_lock_indicator_row_col: |
1553 | { | 1770 | { |
1554 | backlight_get_indicator_row_col( g_config.caps_lock_indicator.index, &(value_data[0]), &(value_data[1]) ); | 1771 | backlight_get_indicator_row_col( g_config.caps_lock_indicator.index, &(value_data[0]), &(value_data[1]) ); |
1555 | break; | 1772 | break; |
1556 | } | 1773 | } |
1557 | case id_layer_1_indicator_color: | 1774 | case id_layer_1_indicator_color: |
1558 | { | 1775 | { |
1559 | _get_color( &(g_config.layer_1_indicator.color), value_data ); | 1776 | _get_color( &(g_config.layer_1_indicator.color), value_data ); |
1560 | break; | 1777 | break; |
1561 | } | 1778 | } |
1562 | case id_layer_1_indicator_row_col: | 1779 | case id_layer_1_indicator_row_col: |
1563 | { | 1780 | { |
1564 | backlight_get_indicator_row_col( g_config.layer_1_indicator.index, &(value_data[0]), &(value_data[1]) ); | 1781 | backlight_get_indicator_row_col( g_config.layer_1_indicator.index, &(value_data[0]), &(value_data[1]) ); |
1565 | break; | 1782 | break; |
1566 | } | 1783 | } |
1567 | case id_layer_2_indicator_color: | 1784 | case id_layer_2_indicator_color: |
1568 | { | 1785 | { |
1569 | _get_color( &(g_config.layer_2_indicator.color), value_data ); | 1786 | _get_color( &(g_config.layer_2_indicator.color), value_data ); |
1570 | break; | 1787 | break; |
1571 | } | 1788 | } |
1572 | case id_layer_2_indicator_row_col: | 1789 | case id_layer_2_indicator_row_col: |
1573 | { | 1790 | { |
1574 | backlight_get_indicator_row_col( g_config.layer_2_indicator.index, &(value_data[0]), &(value_data[1]) ); | 1791 | backlight_get_indicator_row_col( g_config.layer_2_indicator.index, &(value_data[0]), &(value_data[1]) ); |
1575 | break; | 1792 | break; |
1576 | } | 1793 | } |
1577 | case id_layer_3_indicator_color: | 1794 | case id_layer_3_indicator_color: |
1578 | { | 1795 | { |
1579 | _get_color( &(g_config.layer_3_indicator.color), value_data ); | 1796 | _get_color( &(g_config.layer_3_indicator.color), value_data ); |
1580 | break; | 1797 | break; |
1581 | } | 1798 | } |
1582 | case id_layer_3_indicator_row_col: | 1799 | case id_layer_3_indicator_row_col: |
1583 | { | 1800 | { |
1584 | backlight_get_indicator_row_col( g_config.layer_3_indicator.index, &(value_data[0]), &(value_data[1]) ); | 1801 | backlight_get_indicator_row_col( g_config.layer_3_indicator.index, &(value_data[0]), &(value_data[1]) ); |
1585 | break; | 1802 | break; |
1586 | } | 1803 | } |
1587 | case id_alphas_mods: | 1804 | case id_alphas_mods: |
1588 | { | 1805 | { |
1589 | for ( int i=0; i<5; i++ ) | 1806 | for ( int i=0; i<5; i++ ) |
1590 | { | 1807 | { |
1591 | *(value_data+i*2) = g_config.alphas_mods[i] >> 8; | 1808 | *(value_data+i*2) = g_config.alphas_mods[i] >> 8; |
1592 | *(value_data+i*2+1) = g_config.alphas_mods[i] & 0xFF; | 1809 | *(value_data+i*2+1) = g_config.alphas_mods[i] & 0xFF; |
1593 | } | 1810 | } |
1594 | } | 1811 | } |
1595 | #if defined(RGB_BACKLIGHT_M6_B) | 1812 | #if defined(RGB_BACKLIGHT_M6_B) |
1596 | case id_custom_color: | 1813 | case id_custom_color: |
1597 | { | 1814 | { |
1598 | uint8_t index = value_data[0]; | 1815 | uint8_t index = value_data[0]; |
1599 | if ( index >= 0 && index <= 6 ) | 1816 | if ( index >= 0 && index <= 6 ) |
1600 | { | 1817 | { |
1601 | _get_color( &(g_config.custom_color[index]), &(value_data[1]) ); | 1818 | _get_color( &(g_config.custom_color[index]), &(value_data[1]) ); |
1602 | } | 1819 | } |
1603 | } | 1820 | } |
1604 | #endif | 1821 | #endif |
1605 | } | 1822 | } |
1606 | } | 1823 | } |
1607 | 1824 | ||
1608 | void backlight_config_set_alphas_mods( uint16_t *alphas_mods ) | 1825 | void backlight_config_set_alphas_mods( uint16_t *alphas_mods ) |
1609 | { | 1826 | { |
1610 | for ( int i=0; i<5; i++ ) | 1827 | for ( int i=0; i<5; i++ ) |
1611 | { | 1828 | { |
1612 | g_config.alphas_mods[i] = alphas_mods[i]; | 1829 | g_config.alphas_mods[i] = alphas_mods[i]; |
1613 | } | 1830 | } |
1614 | 1831 | ||
1615 | backlight_config_save(); | 1832 | backlight_config_save(); |
1616 | } | 1833 | } |
1617 | 1834 | ||
1618 | void backlight_config_load(void) | 1835 | void backlight_config_load(void) |
1619 | { | 1836 | { |
1620 | eeprom_read_block( &g_config, ((void*)RGB_BACKLIGHT_CONFIG_EEPROM_ADDR), sizeof(backlight_config) ); | 1837 | eeprom_read_block( &g_config, ((void*)RGB_BACKLIGHT_CONFIG_EEPROM_ADDR), sizeof(backlight_config) ); |
1621 | } | 1838 | } |
1622 | 1839 | ||
1623 | void backlight_config_save(void) | 1840 | void backlight_config_save(void) |
1624 | { | 1841 | { |
1625 | eeprom_update_block( &g_config, ((void*)RGB_BACKLIGHT_CONFIG_EEPROM_ADDR), sizeof(backlight_config) ); | 1842 | eeprom_update_block( &g_config, ((void*)RGB_BACKLIGHT_CONFIG_EEPROM_ADDR), sizeof(backlight_config) ); |
1626 | } | 1843 | } |
1627 | 1844 | ||
1628 | void backlight_init_drivers(void) | 1845 | void backlight_init_drivers(void) |
1629 | { | 1846 | { |
1630 | // Initialize I2C | 1847 | // Initialize I2C |
1631 | i2c_init(); | 1848 | i2c_init(); |
1632 | 1849 | ||
1633 | #if defined(RGB_BACKLIGHT_M6_B) | 1850 | #if defined(RGB_BACKLIGHT_M6_B) |
1634 | IS31FL3218_init(); | 1851 | IS31FL3218_init(); |
1635 | #elif defined(RGB_BACKLIGHT_HS60) | 1852 | #elif defined(RGB_BACKLIGHT_HS60) |
1636 | IS31FL3733_init( ISSI_ADDR_1 ); | 1853 | IS31FL3733_init( ISSI_ADDR_1, 0 ); |
1637 | 1854 | ||
1638 | for ( int index = 0; index < BACKLIGHT_LED_COUNT; index++ ) | 1855 | for ( int index = 0; index < DRIVER_LED_TOTAL; index++ ) |
1639 | { | 1856 | { |
1640 | #if defined (HS60_ANSI) | 1857 | #if defined(HS60_ANSI) |
1641 | bool enabled = !( ( index == 48-1 ) || //LA48 | 1858 | bool enabled = !( ( index == 48-1 ) || //LA48 |
1642 | ( index == 51-1 ) || //LA51 | 1859 | ( index == 51-1 ) || //LA51 |
1643 | ( index == 61-1 ) ); //LA61 | 1860 | ( index == 61-1 ) ); //LA61 |
1644 | #elif defined (HS60_HHKB) | 1861 | #elif defined(HS60_HHKB) |
1645 | bool enabled = !( ( index == 61-1 ) || //LA61 | 1862 | bool enabled = !( ( index == 61-1 ) || //LA61 |
1646 | ( index == 62-1 ) ); //LA62 | 1863 | ( index == 62-1 ) ); //LA62 |
1647 | #else //HS60_ISO | 1864 | #else //HS60_ISO |
1648 | bool enabled = !( ( index == 51-1 ) || //LA51 | 1865 | bool enabled = !( ( index == 51-1 ) || //LA51 |
1649 | ( index == 61-1 ) ); //LA61 | 1866 | ( index == 61-1 ) ); //LA61 |
1650 | #endif | 1867 | #endif |
1651 | // This only caches it for later | 1868 | // This only caches it for later |
1652 | IS31FL3733_set_led_control_register( index, enabled, enabled, enabled ); | 1869 | IS31FL3733_set_led_control_register( index, enabled, enabled, enabled ); |
1653 | } | 1870 | } |
1654 | // This actually updates the LED drivers | 1871 | // This actually updates the LED drivers |
1655 | IS31FL3733_update_led_control_registers( ISSI_ADDR_1, ISSI_ADDR_2 ); | 1872 | IS31FL3733_update_led_control_registers( ISSI_ADDR_1, 0 ); |
1873 | #elif defined(RGB_BACKLIGHT_NK65) | ||
1874 | IS31FL3733_init( ISSI_ADDR_1, 0 ); | ||
1875 | IS31FL3733_init( ISSI_ADDR_2, 0 ); | ||
1876 | |||
1877 | for ( int index = 0; index < DRIVER_LED_TOTAL; index++ ) | ||
1878 | { | ||
1879 | bool enabled = !( ( index == 61-1 ) || //LA61 | ||
1880 | ( index > 6+64-1 ) ); //LB7-LB64 | ||
1881 | // This only caches it for later | ||
1882 | IS31FL3733_set_led_control_register( index, enabled, enabled, enabled ); | ||
1883 | } | ||
1884 | IS31FL3733_set_led_control_register( 7+64-1, 0, 1, 0 ); //Enable LB7 green enable for indicators | ||
1885 | // This actually updates the LED drivers | ||
1886 | IS31FL3733_update_led_control_registers( ISSI_ADDR_1, 0 ); | ||
1887 | IS31FL3733_update_led_control_registers( ISSI_ADDR_2, 1 ); | ||
1656 | #else | 1888 | #else |
1657 | IS31FL3731_init( ISSI_ADDR_1 ); | 1889 | IS31FL3731_init( ISSI_ADDR_1 ); |
1658 | IS31FL3731_init( ISSI_ADDR_2 ); | 1890 | IS31FL3731_init( ISSI_ADDR_2 ); |
1659 | 1891 | ||
1660 | for ( int index = 0; index < BACKLIGHT_LED_COUNT; index++ ) | 1892 | for ( int index = 0; index < DRIVER_LED_TOTAL; index++ ) |
1661 | { | 1893 | { |
1662 | // OR the possible "disabled" cases together, then NOT the result to get the enabled state | 1894 | // OR the possible "disabled" cases together, then NOT the result to get the enabled state |
1663 | // LC6 LD13 not present on Zeal65 | 1895 | // LC6 LD13 not present on Zeal65 |
1664 | #if defined (RGB_BACKLIGHT_ZEAL65) | 1896 | #if defined(RGB_BACKLIGHT_ZEAL65) |
1665 | bool enabled = !( ( index == 18+5 && !g_config.use_split_backspace ) || // LB5 | 1897 | bool enabled = !( ( index == 18+5 && !g_config.use_split_backspace ) || // LB5 |
1666 | ( index == 36+6 ) || // LC6 | 1898 | ( index == 36+6 ) || // LC6 |
1667 | ( index == 54+13 ) ); // LD13 | 1899 | ( index == 54+13 ) ); // LD13 |
1668 | #elif defined (RGB_BACKLIGHT_KOYU) | 1900 | #elif defined(RGB_BACKLIGHT_KOYU) |
1669 | bool enabled = !( ( index == 36+15 ) || // LC15 | 1901 | bool enabled = !( ( index == 36+15 ) || // LC15 |
1670 | ( index == 54+13 ) || // LD13 | 1902 | ( index == 54+13 ) || // LD13 |
1671 | ( index == 54+17 ) ); // LD17 | 1903 | ( index == 54+17 ) ); // LD17 |
1672 | #elif defined (RGB_BACKLIGHT_M60_A) | 1904 | #elif defined(RGB_BACKLIGHT_M60_A) |
1673 | bool enabled = !( | 1905 | bool enabled = !( |
1674 | // LB6 LB7 LB8 LB15 LB16 LB17 not present on M60-A | 1906 | // LB6 LB7 LB8 LB15 LB16 LB17 not present on M60-A |
1675 | ( index == 18+6 ) || // LB6 | 1907 | ( index == 18+6 ) || // LB6 |
1676 | ( index == 18+7 ) || // LB7 | 1908 | ( index == 18+7 ) || // LB7 |
1677 | ( index == 18+8 ) || // LB8 | 1909 | ( index == 18+8 ) || // LB8 |
1678 | ( index == 18+15 ) || // LB15 | 1910 | ( index == 18+15 ) || // LB15 |
1679 | ( index == 18+16 ) || // LB16 | 1911 | ( index == 18+16 ) || // LB16 |
1680 | ( index == 18+17 ) || // LB17 | 1912 | ( index == 18+17 ) || // LB17 |
1681 | // HHKB blockers (LC17, LD17) and ISO extra keys (LC15,LD13) not present on M60-A | 1913 | // HHKB blockers (LC17, LD17) and ISO extra keys (LC15,LD13) not present on M60-A |
1682 | ( index == 36+17 ) || // LC17 | 1914 | ( index == 36+17 ) || // LC17 |
1683 | ( index == 54+17 ) || // LD17 | 1915 | ( index == 54+17 ) || // LD17 |
1684 | ( index == 36+15 ) || // LC15 | 1916 | ( index == 36+15 ) || // LC15 |
1685 | ( index == 54+13 ) ); // LD13 | 1917 | ( index == 54+13 ) ); // LD13 |
1686 | #elif defined (RGB_BACKLIGHT_ZEAL60) | 1918 | #elif defined(RGB_BACKLIGHT_ZEAL60) |
1687 | // LB6 LB7 LB8 LB15 LB16 LB17 not present on Zeal60 | 1919 | // LB6 LB7 LB8 LB15 LB16 LB17 not present on Zeal60 |
1688 | bool enabled = !( ( index == 18+5 && !g_config.use_split_backspace ) || // LB5 | 1920 | bool enabled = !( ( index == 18+5 && !g_config.use_split_backspace ) || // LB5 |
1689 | ( index == 36+15 && !g_config.use_split_left_shift ) || // LC15 | 1921 | ( index == 36+15 && !g_config.use_split_left_shift ) || // LC15 |
1690 | ( index == 54+8 && !g_config.use_split_right_shift ) || // LD8 | 1922 | ( index == 54+8 && !g_config.use_split_right_shift ) || // LD8 |
1691 | ( index == 54+13 && g_config.use_7u_spacebar ) || // LD13 | 1923 | ( index == 54+13 && g_config.use_7u_spacebar ) || // LD13 |
1692 | ( index == 36+17 && g_config.disable_hhkb_blocker_leds ) || // LC17 | 1924 | ( index == 36+17 && g_config.disable_hhkb_blocker_leds ) || // LC17 |
1693 | ( index == 54+17 && g_config.disable_hhkb_blocker_leds ) || // LD17 | 1925 | ( index == 54+17 && g_config.disable_hhkb_blocker_leds ) || // LD17 |
1694 | ( index == 18+6 ) || // LB6 | 1926 | ( index == 18+6 ) || // LB6 |
1695 | ( index == 18+7 ) || // LB7 | 1927 | ( index == 18+7 ) || // LB7 |
1696 | ( index == 18+8 ) || // LB8 | 1928 | ( index == 18+8 ) || // LB8 |
1697 | ( index == 18+15 ) || // LB15 | 1929 | ( index == 18+15 ) || // LB15 |
1698 | ( index == 18+16 ) || // LB16 | 1930 | ( index == 18+16 ) || // LB16 |
1699 | ( index == 18+17 ) ); // LB17 | 1931 | ( index == 18+17 ) ); // LB17 |
1700 | #endif | 1932 | #endif |
1701 | // This only caches it for later | 1933 | // This only caches it for later |
1702 | IS31FL3731_set_led_control_register( index, enabled, enabled, enabled ); | 1934 | IS31FL3731_set_led_control_register( index, enabled, enabled, enabled ); |
1703 | } | 1935 | } |
1704 | // This actually updates the LED drivers | 1936 | // This actually updates the LED drivers |
1705 | IS31FL3731_update_led_control_registers( ISSI_ADDR_1, ISSI_ADDR_2 ); | 1937 | IS31FL3731_update_led_control_registers( ISSI_ADDR_1, ISSI_ADDR_2 ); |
1706 | #endif // !defined(RGB_BACKLIGHT_M6_B) | 1938 | #endif // !defined(RGB_BACKLIGHT_M6_B) |
1707 | 1939 | ||
1708 | // TODO: put the 1 second startup delay here? | 1940 | // TODO: put the 1 second startup delay here? |
1709 | 1941 | ||
1710 | // clear the key hits | 1942 | // clear the key hits |
1711 | for ( int led=0; led<BACKLIGHT_LED_COUNT; led++ ) | 1943 | for ( int led=0; led<BACKLIGHT_LED_COUNT; led++ ) |
1712 | { | 1944 | { |
1713 | g_key_hit[led] = 255; | 1945 | g_key_hit[led] = 255; |
1714 | } | 1946 | } |
1715 | } | 1947 | } |
1716 | 1948 | ||
1717 | bool process_record_backlight(uint16_t keycode, keyrecord_t *record) | 1949 | bool process_record_backlight(uint16_t keycode, keyrecord_t *record) |
1718 | { | 1950 | { |
1719 | // Record keypresses for backlight effects | 1951 | // Record keypresses for backlight effects |
1720 | if ( record->event.pressed ) | 1952 | if ( record->event.pressed ) |
1721 | { | 1953 | { |
1722 | backlight_set_key_hit( record->event.key.row, record->event.key.col ); | 1954 | backlight_set_key_hit( record->event.key.row, record->event.key.col ); |
1723 | } | 1955 | } |
1724 | 1956 | ||
1725 | switch(keycode) | 1957 | switch(keycode) |
1726 | { | 1958 | { |
1727 | case BR_INC: | 1959 | case BR_INC: |
1728 | if (record->event.pressed) | 1960 | if (record->event.pressed) |
1729 | { | 1961 | { |
1730 | backlight_brightness_increase(); | 1962 | backlight_brightness_increase(); |
1731 | } | 1963 | } |
1732 | return false; | 1964 | return false; |
1733 | break; | 1965 | break; |
1734 | case BR_DEC: | 1966 | case BR_DEC: |
1735 | if (record->event.pressed) | 1967 | if (record->event.pressed) |
1736 | { | 1968 | { |
1737 | backlight_brightness_decrease(); | 1969 | backlight_brightness_decrease(); |
1738 | } | 1970 | } |
1739 | return false; | 1971 | return false; |
1740 | break; | 1972 | break; |
1741 | case EF_INC: | 1973 | case EF_INC: |
1742 | if (record->event.pressed) | 1974 | if (record->event.pressed) |
1743 | { | 1975 | { |
1744 | backlight_effect_increase(); | 1976 | backlight_effect_increase(); |
1745 | } | 1977 | } |
1746 | return false; | 1978 | return false; |
1747 | break; | 1979 | break; |
1748 | case EF_DEC: | 1980 | case EF_DEC: |
1749 | if (record->event.pressed) | 1981 | if (record->event.pressed) |
1750 | { | 1982 | { |
1751 | backlight_effect_decrease(); | 1983 | backlight_effect_decrease(); |
1752 | } | 1984 | } |
1753 | return false; | 1985 | return false; |
1754 | break; | 1986 | break; |
1755 | case ES_INC: | 1987 | case ES_INC: |
1756 | if (record->event.pressed) | 1988 | if (record->event.pressed) |
1757 | { | 1989 | { |
1758 | backlight_effect_speed_increase(); | 1990 | backlight_effect_speed_increase(); |
1759 | } | 1991 | } |
1760 | return false; | 1992 | return false; |
1761 | break; | 1993 | break; |
1762 | case ES_DEC: | 1994 | case ES_DEC: |
1763 | if (record->event.pressed) | 1995 | if (record->event.pressed) |
1764 | { | 1996 | { |
1765 | backlight_effect_speed_decrease(); | 1997 | backlight_effect_speed_decrease(); |
1766 | } | 1998 | } |
1767 | return false; | 1999 | return false; |
1768 | break; | 2000 | break; |
1769 | case H1_INC: | 2001 | case H1_INC: |
1770 | if (record->event.pressed) | 2002 | if (record->event.pressed) |
1771 | { | 2003 | { |
1772 | backlight_color_1_hue_increase(); | 2004 | backlight_color_1_hue_increase(); |
1773 | } | 2005 | } |
1774 | return false; | 2006 | return false; |
1775 | break; | 2007 | break; |
1776 | case H1_DEC: | 2008 | case H1_DEC: |
1777 | if (record->event.pressed) | 2009 | if (record->event.pressed) |
1778 | { | 2010 | { |
1779 | backlight_color_1_hue_decrease(); | 2011 | backlight_color_1_hue_decrease(); |
1780 | } | 2012 | } |
1781 | return false; | 2013 | return false; |
1782 | break; | 2014 | break; |
1783 | case S1_INC: | 2015 | case S1_INC: |
1784 | if (record->event.pressed) | 2016 | if (record->event.pressed) |
1785 | { | 2017 | { |
1786 | backlight_color_1_sat_increase(); | 2018 | backlight_color_1_sat_increase(); |
1787 | } | 2019 | } |
1788 | return false; | 2020 | return false; |
1789 | break; | 2021 | break; |
1790 | case S1_DEC: | 2022 | case S1_DEC: |
1791 | if (record->event.pressed) | 2023 | if (record->event.pressed) |
1792 | { | 2024 | { |
1793 | backlight_color_1_sat_decrease(); | 2025 | backlight_color_1_sat_decrease(); |
1794 | break; | 2026 | break; |
1795 | } | 2027 | } |
1796 | return false; | 2028 | return false; |
1797 | break; | 2029 | break; |
1798 | case H2_INC: | 2030 | case H2_INC: |
1799 | if (record->event.pressed) | 2031 | if (record->event.pressed) |
1800 | { | 2032 | { |
1801 | backlight_color_2_hue_increase(); | 2033 | backlight_color_2_hue_increase(); |
1802 | } | 2034 | } |
1803 | return false; | 2035 | return false; |
1804 | break; | 2036 | break; |
1805 | case H2_DEC: | 2037 | case H2_DEC: |
1806 | if (record->event.pressed) | 2038 | if (record->event.pressed) |
1807 | { | 2039 | { |
1808 | backlight_color_2_hue_decrease(); | 2040 | backlight_color_2_hue_decrease(); |
1809 | } | 2041 | } |
1810 | return false; | 2042 | return false; |
1811 | break; | 2043 | break; |
1812 | case S2_INC: | 2044 | case S2_INC: |
1813 | if (record->event.pressed) | 2045 | if (record->event.pressed) |
1814 | { | 2046 | { |
1815 | backlight_color_2_sat_increase(); | 2047 | backlight_color_2_sat_increase(); |
1816 | } | 2048 | } |
1817 | return false; | 2049 | return false; |
1818 | break; | 2050 | break; |
1819 | case S2_DEC: | 2051 | case S2_DEC: |
1820 | if (record->event.pressed) | 2052 | if (record->event.pressed) |
1821 | { | 2053 | { |
1822 | backlight_color_2_sat_decrease(); | 2054 | backlight_color_2_sat_decrease(); |
1823 | break; | 2055 | break; |
1824 | } | 2056 | } |
1825 | return false; | 2057 | return false; |
1826 | break; | 2058 | break; |
1827 | } | 2059 | } |
1828 | 2060 | ||
1829 | return true; | 2061 | return true; |
1830 | } | 2062 | } |
1831 | 2063 | ||
1832 | // Deals with the messy details of incrementing an integer | 2064 | // Deals with the messy details of incrementing an integer |
1833 | uint8_t increment( uint8_t value, uint8_t step, uint8_t min, uint8_t max ) | 2065 | uint8_t increment( uint8_t value, uint8_t step, uint8_t min, uint8_t max ) |
1834 | { | 2066 | { |
1835 | int16_t new_value = value; | 2067 | int16_t new_value = value; |
1836 | new_value += step; | 2068 | new_value += step; |
1837 | return MIN( MAX( new_value, min ), max ); | 2069 | return MIN( MAX( new_value, min ), max ); |
1838 | } | 2070 | } |
1839 | 2071 | ||
1840 | uint8_t decrement( uint8_t value, uint8_t step, uint8_t min, uint8_t max ) | 2072 | uint8_t decrement( uint8_t value, uint8_t step, uint8_t min, uint8_t max ) |
1841 | { | 2073 | { |
1842 | int16_t new_value = value; | 2074 | int16_t new_value = value; |
1843 | new_value -= step; | 2075 | new_value -= step; |
1844 | return MIN( MAX( new_value, min ), max ); | 2076 | return MIN( MAX( new_value, min ), max ); |
1845 | } | 2077 | } |
1846 | 2078 | ||
1847 | void backlight_effect_increase(void) | 2079 | void backlight_effect_increase(void) |
1848 | { | 2080 | { |
1849 | g_config.effect = increment( g_config.effect, 1, 0, BACKLIGHT_EFFECT_MAX ); | 2081 | g_config.effect = increment( g_config.effect, 1, 0, BACKLIGHT_EFFECT_MAX ); |
1850 | backlight_config_save(); | 2082 | backlight_config_save(); |
1851 | } | 2083 | } |
1852 | 2084 | ||
1853 | void backlight_effect_decrease(void) | 2085 | void backlight_effect_decrease(void) |
1854 | { | 2086 | { |
1855 | g_config.effect = decrement( g_config.effect, 1, 0, BACKLIGHT_EFFECT_MAX ); | 2087 | g_config.effect = decrement( g_config.effect, 1, 0, BACKLIGHT_EFFECT_MAX ); |
1856 | backlight_config_save(); | 2088 | backlight_config_save(); |
1857 | } | 2089 | } |
1858 | 2090 | ||
1859 | void backlight_effect_speed_increase(void) | 2091 | void backlight_effect_speed_increase(void) |
1860 | { | 2092 | { |
1861 | g_config.effect_speed = increment( g_config.effect_speed, 1, 0, 3 ); | 2093 | g_config.effect_speed = increment( g_config.effect_speed, 1, 0, 3 ); |
1862 | backlight_config_save(); | 2094 | backlight_config_save(); |
1863 | } | 2095 | } |
1864 | 2096 | ||
1865 | void backlight_effect_speed_decrease(void) | 2097 | void backlight_effect_speed_decrease(void) |
1866 | { | 2098 | { |
1867 | g_config.effect_speed = decrement( g_config.effect_speed, 1, 0, 3 ); | 2099 | g_config.effect_speed = decrement( g_config.effect_speed, 1, 0, 3 ); |
1868 | backlight_config_save(); | 2100 | backlight_config_save(); |
1869 | } | 2101 | } |
1870 | 2102 | ||
1871 | void backlight_brightness_increase(void) | 2103 | void backlight_brightness_increase(void) |
1872 | { | 2104 | { |
1873 | g_config.brightness = increment( g_config.brightness, 8, 0, 255 ); | 2105 | g_config.brightness = increment( g_config.brightness, 8, 0, 255 ); |
1874 | backlight_config_save(); | 2106 | backlight_config_save(); |
1875 | } | 2107 | } |
1876 | 2108 | ||
1877 | void backlight_brightness_decrease(void) | 2109 | void backlight_brightness_decrease(void) |
1878 | { | 2110 | { |
1879 | g_config.brightness = decrement( g_config.brightness, 8, 0, 255 ); | 2111 | g_config.brightness = decrement( g_config.brightness, 8, 0, 255 ); |
1880 | backlight_config_save(); | 2112 | backlight_config_save(); |
1881 | } | 2113 | } |
1882 | 2114 | ||
1883 | void backlight_color_1_hue_increase(void) | 2115 | void backlight_color_1_hue_increase(void) |
1884 | { | 2116 | { |
1885 | g_config.color_1.h = increment( g_config.color_1.h, 8, 0, 255 ); | 2117 | g_config.color_1.h = increment( g_config.color_1.h, 8, 0, 255 ); |
1886 | backlight_config_save(); | 2118 | backlight_config_save(); |
1887 | } | 2119 | } |
1888 | 2120 | ||
1889 | void backlight_color_1_hue_decrease(void) | 2121 | void backlight_color_1_hue_decrease(void) |
1890 | { | 2122 | { |
1891 | g_config.color_1.h = decrement( g_config.color_1.h, 8, 0, 255 ); | 2123 | g_config.color_1.h = decrement( g_config.color_1.h, 8, 0, 255 ); |
1892 | backlight_config_save(); | 2124 | backlight_config_save(); |
1893 | } | 2125 | } |
1894 | 2126 | ||
1895 | void backlight_color_1_sat_increase(void) | 2127 | void backlight_color_1_sat_increase(void) |
1896 | { | 2128 | { |
1897 | g_config.color_1.s = increment( g_config.color_1.s, 8, 0, 255 ); | 2129 | g_config.color_1.s = increment( g_config.color_1.s, 8, 0, 255 ); |
1898 | backlight_config_save(); | 2130 | backlight_config_save(); |
1899 | } | 2131 | } |
1900 | 2132 | ||
1901 | void backlight_color_1_sat_decrease(void) | 2133 | void backlight_color_1_sat_decrease(void) |
1902 | { | 2134 | { |
1903 | g_config.color_1.s = decrement( g_config.color_1.s, 8, 0, 255 ); | 2135 | g_config.color_1.s = decrement( g_config.color_1.s, 8, 0, 255 ); |
1904 | backlight_config_save(); | 2136 | backlight_config_save(); |
1905 | } | 2137 | } |
1906 | 2138 | ||
1907 | void backlight_color_2_hue_increase(void) | 2139 | void backlight_color_2_hue_increase(void) |
1908 | { | 2140 | { |
1909 | g_config.color_2.h = increment( g_config.color_2.h, 8, 0, 255 ); | 2141 | g_config.color_2.h = increment( g_config.color_2.h, 8, 0, 255 ); |
1910 | backlight_config_save(); | 2142 | backlight_config_save(); |
1911 | } | 2143 | } |
1912 | 2144 | ||
1913 | void backlight_color_2_hue_decrease(void) | 2145 | void backlight_color_2_hue_decrease(void) |
1914 | { | 2146 | { |
1915 | g_config.color_2.h = decrement( g_config.color_2.h, 8, 0, 255 ); | 2147 | g_config.color_2.h = decrement( g_config.color_2.h, 8, 0, 255 ); |
1916 | backlight_config_save(); | 2148 | backlight_config_save(); |
1917 | } | 2149 | } |
1918 | 2150 | ||
1919 | void backlight_color_2_sat_increase(void) | 2151 | void backlight_color_2_sat_increase(void) |
1920 | { | 2152 | { |
1921 | g_config.color_2.s = increment( g_config.color_2.s, 8, 0, 255 ); | 2153 | g_config.color_2.s = increment( g_config.color_2.s, 8, 0, 255 ); |
1922 | backlight_config_save(); | 2154 | backlight_config_save(); |
1923 | } | 2155 | } |
1924 | 2156 | ||
1925 | void backlight_color_2_sat_decrease(void) | 2157 | void backlight_color_2_sat_decrease(void) |
1926 | { | 2158 | { |
1927 | g_config.color_2.s = decrement( g_config.color_2.s, 8, 0, 255 ); | 2159 | g_config.color_2.s = decrement( g_config.color_2.s, 8, 0, 255 ); |
1928 | backlight_config_save(); | 2160 | backlight_config_save(); |
1929 | } | 2161 | } |
1930 | 2162 | ||
1931 | #if defined(RGB_DEBUGGING_ONLY) | 2163 | #if defined(RGB_DEBUGGING_ONLY) |
1932 | void backlight_test_led( uint8_t index, bool red, bool green, bool blue ) | 2164 | void backlight_test_led( uint8_t index, bool red, bool green, bool blue ) |
1933 | { | 2165 | { |
1934 | for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ ) | 2166 | for ( int i=0; i<BACKLIGHT_LED_COUNT; i++ ) |
1935 | { | 2167 | { |
1936 | if ( i == index ) | 2168 | if ( i == index ) |
1937 | { | 2169 | { |
1938 | IS31FL3731_set_led_control_register( i, red, green, blue ); | 2170 | IS31FL3731_set_led_control_register( i, red, green, blue ); |
1939 | } | 2171 | } |
1940 | else | 2172 | else |
1941 | { | 2173 | { |
1942 | IS31FL3731_set_led_control_register( i, false, false, false ); | 2174 | IS31FL3731_set_led_control_register( i, false, false, false ); |
1943 | } | 2175 | } |
1944 | } | 2176 | } |
1945 | } | 2177 | } |
1946 | 2178 | ||
1947 | void backlight_debug_led( bool state ) | 2179 | void backlight_debug_led( bool state ) |
1948 | { | 2180 | { |
1949 | if (state) | 2181 | if (state) |
1950 | { | 2182 | { |
1951 | // Output high. | 2183 | // Output high. |
1952 | DDRE |= (1<<6); | 2184 | DDRE |= (1<<6); |
1953 | PORTE |= (1<<6); | 2185 | PORTE |= (1<<6); |
1954 | } | 2186 | } |
1955 | else | 2187 | else |
1956 | { | 2188 | { |
1957 | // Output low. | 2189 | // Output low. |
1958 | DDRE &= ~(1<<6); | 2190 | DDRE &= ~(1<<6); |
1959 | PORTE &= ~(1<<6); | 2191 | PORTE &= ~(1<<6); |
1960 | } | 2192 | } |
1961 | } | 2193 | } |
1962 | #endif // defined(RGB_DEBUGGING_ONLY) | 2194 | #endif // defined(RGB_DEBUGGING_ONLY) |
1963 | 2195 | ||
diff --git a/quantum/led_matrix_drivers.c b/quantum/led_matrix_drivers.c index 4ee509ee5..cb91821a4 100644 --- a/quantum/led_matrix_drivers.c +++ b/quantum/led_matrix_drivers.c | |||
@@ -53,16 +53,16 @@ static void init(void) { | |||
53 | #endif | 53 | #endif |
54 | #else | 54 | #else |
55 | #ifdef LED_DRIVER_ADDR_1 | 55 | #ifdef LED_DRIVER_ADDR_1 |
56 | IS31FL3733_init(LED_DRIVER_ADDR_1); | 56 | IS31FL3733_init(LED_DRIVER_ADDR_1, 0 ); |
57 | #endif | 57 | #endif |
58 | #ifdef LED_DRIVER_ADDR_2 | 58 | #ifdef LED_DRIVER_ADDR_2 |
59 | IS31FL3733_init(LED_DRIVER_ADDR_2); | 59 | IS31FL3733_init(LED_DRIVER_ADDR_2, 0 ); |
60 | #endif | 60 | #endif |
61 | #ifdef LED_DRIVER_ADDR_3 | 61 | #ifdef LED_DRIVER_ADDR_3 |
62 | IS31FL3733_init(LED_DRIVER_ADDR_3); | 62 | IS31FL3733_init(LED_DRIVER_ADDR_3, 0 ); |
63 | #endif | 63 | #endif |
64 | #ifdef LED_DRIVER_ADDR_4 | 64 | #ifdef LED_DRIVER_ADDR_4 |
65 | IS31FL3733_init(LED_DRIVER_ADDR_4); | 65 | IS31FL3733_init(LED_DRIVER_ADDR_4, 0 ); |
66 | #endif | 66 | #endif |
67 | #endif | 67 | #endif |
68 | 68 | ||
diff --git a/quantum/rgb_matrix_drivers.c b/quantum/rgb_matrix_drivers.c index 1d64dc909..2a3aa9a5e 100644 --- a/quantum/rgb_matrix_drivers.c +++ b/quantum/rgb_matrix_drivers.c | |||
@@ -34,7 +34,7 @@ static void init( void ) | |||
34 | IS31FL3731_init( DRIVER_ADDR_1 ); | 34 | IS31FL3731_init( DRIVER_ADDR_1 ); |
35 | IS31FL3731_init( DRIVER_ADDR_2 ); | 35 | IS31FL3731_init( DRIVER_ADDR_2 ); |
36 | #elif defined(IS31FL3733) | 36 | #elif defined(IS31FL3733) |
37 | IS31FL3733_init( DRIVER_ADDR_1 ); | 37 | IS31FL3733_init( DRIVER_ADDR_1, 0 ); |
38 | #else | 38 | #else |
39 | IS31FL3737_init( DRIVER_ADDR_1 ); | 39 | IS31FL3737_init( DRIVER_ADDR_1 ); |
40 | #endif | 40 | #endif |
@@ -53,7 +53,8 @@ static void init( void ) | |||
53 | #ifdef IS31FL3731 | 53 | #ifdef IS31FL3731 |
54 | IS31FL3731_update_led_control_registers( DRIVER_ADDR_1, DRIVER_ADDR_2 ); | 54 | IS31FL3731_update_led_control_registers( DRIVER_ADDR_1, DRIVER_ADDR_2 ); |
55 | #elif defined(IS31FL3733) | 55 | #elif defined(IS31FL3733) |
56 | IS31FL3733_update_led_control_registers( DRIVER_ADDR_1, DRIVER_ADDR_2 ); | 56 | IS31FL3733_update_led_control_registers( DRIVER_ADDR_1, 0 ); |
57 | IS31FL3733_update_led_control_registers( DRIVER_ADDR_2, 1 ); | ||
57 | #else | 58 | #else |
58 | IS31FL3737_update_led_control_registers( DRIVER_ADDR_1, DRIVER_ADDR_2 ); | 59 | IS31FL3737_update_led_control_registers( DRIVER_ADDR_1, DRIVER_ADDR_2 ); |
59 | #endif | 60 | #endif |
@@ -74,7 +75,8 @@ const rgb_matrix_driver_t rgb_matrix_driver = { | |||
74 | #elif defined(IS31FL3733) | 75 | #elif defined(IS31FL3733) |
75 | static void flush( void ) | 76 | static void flush( void ) |
76 | { | 77 | { |
77 | IS31FL3733_update_pwm_buffers( DRIVER_ADDR_1, DRIVER_ADDR_2 ); | 78 | IS31FL3733_update_pwm_buffers( DRIVER_ADDR_1, 0); |
79 | IS31FL3733_update_pwm_buffers( DRIVER_ADDR_2, 1); | ||
78 | } | 80 | } |
79 | 81 | ||
80 | const rgb_matrix_driver_t rgb_matrix_driver = { | 82 | const rgb_matrix_driver_t rgb_matrix_driver = { |