aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authordonicrosby <doni.crosby1995@gmail.com>2021-11-01 19:40:01 -0400
committerGitHub <noreply@github.com>2021-11-02 10:40:01 +1100
commit0c725017638ec86011191bf835735fb6c569d298 (patch)
treed5c1076063ade21423de710ae9837b6edd16ae80 /drivers
parent7ae0f371cf55a589a4735098f52e722f579de41d (diff)
downloadqmk_firmware-0c725017638ec86011191bf835735fb6c569d298.tar.gz
qmk_firmware-0c725017638ec86011191bf835735fb6c569d298.zip
Enable de-ghosting for RGB/LED matrix on all ISSI LED drivers (#14508)
* Initial work for de-ghost enable * Dumb mistake with the redefine * Added Copywrite stuff on source files * Fixed whitespace errors * Added support for all ISSI LED drivers * Updated docs for support for ISSI LED driver pull-up pull-down * Applied clang format * Added 'boolean' flag to enable de-ghosting for the is31fl3731 IC * Fixed some of the grammer in the docs * Fixed comment placement and grammer of comment * Fixed whitespace errors from lint Co-authored-by: donicrosby <donicrosby1995@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/led/issi/is31fl3731-simple.c7
-rw-r--r--drivers/led/issi/is31fl3731.c7
-rw-r--r--drivers/led/issi/is31fl3733.c11
-rw-r--r--drivers/led/issi/is31fl3733.h9
-rw-r--r--drivers/led/issi/is31fl3736.c13
-rw-r--r--drivers/led/issi/is31fl3736.h10
-rw-r--r--drivers/led/issi/is31fl3737.c13
-rw-r--r--drivers/led/issi/is31fl3737.h10
-rw-r--r--drivers/led/issi/is31fl3741.c10
-rw-r--r--drivers/led/issi/is31fl3741.h9
10 files changed, 98 insertions, 1 deletions
diff --git a/drivers/led/issi/is31fl3731-simple.c b/drivers/led/issi/is31fl3731-simple.c
index d295772f5..9d28ea91d 100644
--- a/drivers/led/issi/is31fl3731-simple.c
+++ b/drivers/led/issi/is31fl3731-simple.c
@@ -1,6 +1,7 @@
1/* Copyright 2017 Jason Williams 1/* Copyright 2017 Jason Williams
2 * Copyright 2018 Jack Humbert 2 * Copyright 2018 Jack Humbert
3 * Copyright 2019 Clueboard 3 * Copyright 2019 Clueboard
4 * Copyright 2021 Doni Crosby
4 * 5 *
5 * This program is free software: you can redistribute it and/or modify 6 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -40,6 +41,9 @@
40 41
41#define ISSI_REG_PICTUREFRAME 0x01 42#define ISSI_REG_PICTUREFRAME 0x01
42 43
44// Not defined in the datasheet -- See AN for IC
45#define ISSI_REG_GHOST_IMAGE_PREVENTION 0xC2 // Set bit 4 to enable de-ghosting
46
43#define ISSI_REG_SHUTDOWN 0x0A 47#define ISSI_REG_SHUTDOWN 0x0A
44#define ISSI_REG_AUDIOSYNC 0x06 48#define ISSI_REG_AUDIOSYNC 0x06
45 49
@@ -144,6 +148,9 @@ void IS31FL3731_init(uint8_t addr) {
144 148
145 // enable software shutdown 149 // enable software shutdown
146 IS31FL3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x00); 150 IS31FL3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x00);
151#ifdef ISSI_3731_DEGHOST // set to enable de-ghosting of the array
152 IS31FL3731_write_register(addr, ISSI_REG_GHOST_IMAGE_PREVENTION, 0x10);
153#endif
147 154
148 // this delay was copied from other drivers, might not be needed 155 // this delay was copied from other drivers, might not be needed
149 wait_ms(10); 156 wait_ms(10);
diff --git a/drivers/led/issi/is31fl3731.c b/drivers/led/issi/is31fl3731.c
index 110bdc1be..fbf24c30f 100644
--- a/drivers/led/issi/is31fl3731.c
+++ b/drivers/led/issi/is31fl3731.c
@@ -1,5 +1,6 @@
1/* Copyright 2017 Jason Williams 1/* Copyright 2017 Jason Williams
2 * Copyright 2018 Jack Humbert 2 * Copyright 2018 Jack Humbert
3 * Copyright 2021 Doni Crosby
3 * 4 *
4 * This program is free software: you can redistribute it and/or modify 5 * 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 * it under the terms of the GNU General Public License as published by
@@ -39,6 +40,9 @@
39 40
40#define ISSI_REG_PICTUREFRAME 0x01 41#define ISSI_REG_PICTUREFRAME 0x01
41 42
43// Not defined in the datasheet -- See AN for IC
44#define ISSI_REG_GHOST_IMAGE_PREVENTION 0xC2 // Set bit 4 to enable de-ghosting
45
42#define ISSI_REG_SHUTDOWN 0x0A 46#define ISSI_REG_SHUTDOWN 0x0A
43#define ISSI_REG_AUDIOSYNC 0x06 47#define ISSI_REG_AUDIOSYNC 0x06
44 48
@@ -132,6 +136,9 @@ void IS31FL3731_init(uint8_t addr) {
132 136
133 // enable software shutdown 137 // enable software shutdown
134 IS31FL3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x00); 138 IS31FL3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x00);
139#ifdef ISSI_3731_DEGHOST // set to enable de-ghosting of the array
140 IS31FL3731_write_register(addr, ISSI_REG_GHOST_IMAGE_PREVENTION, 0x10);
141#endif
135 142
136 // this delay was copied from other drivers, might not be needed 143 // this delay was copied from other drivers, might not be needed
137 wait_ms(10); 144 wait_ms(10);
diff --git a/drivers/led/issi/is31fl3733.c b/drivers/led/issi/is31fl3733.c
index 4ddd827ca..c64d03513 100644
--- a/drivers/led/issi/is31fl3733.c
+++ b/drivers/led/issi/is31fl3733.c
@@ -1,6 +1,7 @@
1/* Copyright 2017 Jason Williams 1/* Copyright 2017 Jason Williams
2 * Copyright 2018 Jack Humbert 2 * Copyright 2018 Jack Humbert
3 * Copyright 2018 Yiancar 3 * Copyright 2018 Yiancar
4 * Copyright 2021 Doni Crosby
4 * 5 *
5 * This program is free software: you can redistribute it and/or modify 6 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -58,6 +59,12 @@
58 59
59#ifndef ISSI_PWM_FREQUENCY 60#ifndef ISSI_PWM_FREQUENCY
60# define ISSI_PWM_FREQUENCY 0b000 // PFS - IS31FL3733B only 61# define ISSI_PWM_FREQUENCY 0b000 // PFS - IS31FL3733B only
62#ifndef ISSI_SWPULLUP
63# define ISSI_SWPULLUP PUR_0R
64#endif
65
66#ifndef ISSI_CSPULLUP
67# define ISSI_CSPULLUP PUR_0R
61#endif 68#endif
62 69
63// Transfer buffer for TWITransmitData() 70// Transfer buffer for TWITransmitData()
@@ -158,6 +165,10 @@ void IS31FL3733_init(uint8_t addr, uint8_t sync) {
158 165
159 // Select PG3 166 // Select PG3
160 IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION); 167 IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION);
168 // Set de-ghost pull-up resistors (SWx)
169 IS31FL3733_write_register(addr, ISSI_REG_SWPULLUP, ISSI_SWPULLUP);
170 // Set de-ghost pull-down resistors (CSx)
171 IS31FL3733_write_register(addr, ISSI_REG_CSPULLUP, ISSI_CSPULLUP);
161 // Set global current to maximum. 172 // Set global current to maximum.
162 IS31FL3733_write_register(addr, ISSI_REG_GLOBALCURRENT, 0xFF); 173 IS31FL3733_write_register(addr, ISSI_REG_GLOBALCURRENT, 0xFF);
163 // Disable software shutdown. 174 // Disable software shutdown.
diff --git a/drivers/led/issi/is31fl3733.h b/drivers/led/issi/is31fl3733.h
index 64fd38eb1..daa226b41 100644
--- a/drivers/led/issi/is31fl3733.h
+++ b/drivers/led/issi/is31fl3733.h
@@ -1,6 +1,7 @@
1/* Copyright 2017 Jason Williams 1/* Copyright 2017 Jason Williams
2 * Copyright 2018 Jack Humbert 2 * Copyright 2018 Jack Humbert
3 * Copyright 2018 Yiancar 3 * Copyright 2018 Yiancar
4 * Copyright 2021 Doni Crosby
4 * 5 *
5 * This program is free software: you can redistribute it and/or modify 6 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -47,6 +48,14 @@ void IS31FL3733_set_led_control_register(uint8_t index, bool red, bool green, bo
47void IS31FL3733_update_pwm_buffers(uint8_t addr, uint8_t index); 48void IS31FL3733_update_pwm_buffers(uint8_t addr, uint8_t index);
48void IS31FL3733_update_led_control_registers(uint8_t addr, uint8_t index); 49void IS31FL3733_update_led_control_registers(uint8_t addr, uint8_t index);
49 50
51#define PUR_0R 0x00 // No PUR resistor
52#define PUR_05KR 0x02 // 0.5k Ohm resistor in t_NOL
53#define PUR_3KR 0x03 // 3.0k Ohm resistor on all the time
54#define PUR_4KR 0x04 // 4.0k Ohm resistor on all the time
55#define PUR_8KR 0x05 // 8.0k Ohm resistor on all the time
56#define PUR_16KR 0x06 // 16k Ohm resistor on all the time
57#define PUR_32KR 0x07 // 32k Ohm resistor in t_NOL
58
50#define A_1 0x00 59#define A_1 0x00
51#define A_2 0x01 60#define A_2 0x01
52#define A_3 0x02 61#define A_3 0x02
diff --git a/drivers/led/issi/is31fl3736.c b/drivers/led/issi/is31fl3736.c
index 7dece1b1e..dcaabba2e 100644
--- a/drivers/led/issi/is31fl3736.c
+++ b/drivers/led/issi/is31fl3736.c
@@ -1,4 +1,5 @@
1/* Copyright 2018 Jason Williams (Wilba) 1/* Copyright 2018 Jason Williams (Wilba)
2 * Copyright 2021 Doni Crosby
2 * 3 *
3 * This program is free software: you can redistribute it and/or modify 4 * 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 * it under the terms of the GNU General Public License as published by
@@ -54,6 +55,14 @@
54# define ISSI_PERSISTENCE 0 55# define ISSI_PERSISTENCE 0
55#endif 56#endif
56 57
58#ifndef ISSI_SWPULLUP
59# define ISSI_SWPULLUP PUR_0R
60#endif
61
62#ifndef ISSI_CSPULLUP
63# define ISSI_CSPULLUP PUR_0R
64#endif
65
57// Transfer buffer for TWITransmitData() 66// Transfer buffer for TWITransmitData()
58uint8_t g_twi_transfer_buffer[20]; 67uint8_t g_twi_transfer_buffer[20];
59 68
@@ -140,6 +149,10 @@ void IS31FL3736_init(uint8_t addr) {
140 149
141 // Select PG3 150 // Select PG3
142 IS31FL3736_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION); 151 IS31FL3736_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION);
152 // Set de-ghost pull-up resistors (SWx)
153 IS31FL3736_write_register(addr, ISSI_REG_SWPULLUP, ISSI_SWPULLUP);
154 // Set de-ghost pull-down resistors (CSx)
155 IS31FL3736_write_register(addr, ISSI_REG_CSPULLUP, ISSI_CSPULLUP);
143 // Set global current to maximum. 156 // Set global current to maximum.
144 IS31FL3736_write_register(addr, ISSI_REG_GLOBALCURRENT, 0xFF); 157 IS31FL3736_write_register(addr, ISSI_REG_GLOBALCURRENT, 0xFF);
145 // Disable software shutdown. 158 // Disable software shutdown.
diff --git a/drivers/led/issi/is31fl3736.h b/drivers/led/issi/is31fl3736.h
index c956c87f7..a30be9055 100644
--- a/drivers/led/issi/is31fl3736.h
+++ b/drivers/led/issi/is31fl3736.h
@@ -1,4 +1,5 @@
1/* Copyright 2018 Jason Williams (Wilba) 1/* Copyright 2018 Jason Williams (Wilba)
2 * Copyright 2021 Doni Crosby
2 * 3 *
3 * This program is free software: you can redistribute it and/or modify 4 * 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 * it under the terms of the GNU General Public License as published by
@@ -60,6 +61,15 @@ void IS31FL3736_mono_set_led_control_register(uint8_t index, bool enabled);
60void IS31FL3736_update_pwm_buffers(uint8_t addr1, uint8_t addr2); 61void IS31FL3736_update_pwm_buffers(uint8_t addr1, uint8_t addr2);
61void IS31FL3736_update_led_control_registers(uint8_t addr1, uint8_t addr2); 62void IS31FL3736_update_led_control_registers(uint8_t addr1, uint8_t addr2);
62 63
64#define PUR_0R 0x00 // No PUR resistor
65#define PUR_05KR 0x01 // 0.5k Ohm resistor
66#define PUR_1KR 0x02 // 1.0k Ohm resistor
67#define PUR_2KR 0x03 // 2.0k Ohm resistor
68#define PUR_4KR 0x04 // 4.0k Ohm resistor
69#define PUR_8KR 0x05 // 8.0k Ohm resistor
70#define PUR_16KR 0x06 // 16k Ohm resistor
71#define PUR_32KR 0x07 // 32k Ohm resistor
72
63#define A_1 0x00 73#define A_1 0x00
64#define A_2 0x02 74#define A_2 0x02
65#define A_3 0x04 75#define A_3 0x04
diff --git a/drivers/led/issi/is31fl3737.c b/drivers/led/issi/is31fl3737.c
index 0bb4ddd42..62862e0d4 100644
--- a/drivers/led/issi/is31fl3737.c
+++ b/drivers/led/issi/is31fl3737.c
@@ -1,6 +1,7 @@
1/* Copyright 2017 Jason Williams 1/* Copyright 2017 Jason Williams
2 * Copyright 2018 Jack Humbert 2 * Copyright 2018 Jack Humbert
3 * Copyright 2018 Yiancar 3 * Copyright 2018 Yiancar
4 * Copyright 2021 Doni Crosby
4 * 5 *
5 * This program is free software: you can redistribute it and/or modify 6 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -56,6 +57,14 @@
56# define ISSI_PERSISTENCE 0 57# define ISSI_PERSISTENCE 0
57#endif 58#endif
58 59
60#ifndef ISSI_SWPULLUP
61# define ISSI_SWPULLUP PUR_0R
62#endif
63
64#ifndef ISSI_CSPULLUP
65# define ISSI_CSPULLUP PUR_0R
66#endif
67
59// Transfer buffer for TWITransmitData() 68// Transfer buffer for TWITransmitData()
60uint8_t g_twi_transfer_buffer[20]; 69uint8_t g_twi_transfer_buffer[20];
61 70
@@ -143,6 +152,10 @@ void IS31FL3737_init(uint8_t addr) {
143 152
144 // Select PG3 153 // Select PG3
145 IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION); 154 IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION);
155 // Set de-ghost pull-up resistors (SWx)
156 IS31FL3737_write_register(addr, ISSI_REG_SWPULLUP, ISSI_SWPULLUP);
157 // Set de-ghost pull-down resistors (CSx)
158 IS31FL3737_write_register(addr, ISSI_REG_CSPULLUP, ISSI_CSPULLUP);
146 // Set global current to maximum. 159 // Set global current to maximum.
147 IS31FL3737_write_register(addr, ISSI_REG_GLOBALCURRENT, 0xFF); 160 IS31FL3737_write_register(addr, ISSI_REG_GLOBALCURRENT, 0xFF);
148 // Disable software shutdown. 161 // Disable software shutdown.
diff --git a/drivers/led/issi/is31fl3737.h b/drivers/led/issi/is31fl3737.h
index 06886e9c9..97917f1d4 100644
--- a/drivers/led/issi/is31fl3737.h
+++ b/drivers/led/issi/is31fl3737.h
@@ -1,6 +1,7 @@
1/* Copyright 2017 Jason Williams 1/* Copyright 2017 Jason Williams
2 * Copyright 2018 Jack Humbert 2 * Copyright 2018 Jack Humbert
3 * Copyright 2018 Yiancar 3 * Copyright 2018 Yiancar
4 * Copyright 2021 Doni Crosby
4 * 5 *
5 * This program is free software: you can redistribute it and/or modify 6 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -47,6 +48,15 @@ void IS31FL3737_set_led_control_register(uint8_t index, bool red, bool green, bo
47void IS31FL3737_update_pwm_buffers(uint8_t addr1, uint8_t addr2); 48void IS31FL3737_update_pwm_buffers(uint8_t addr1, uint8_t addr2);
48void IS31FL3737_update_led_control_registers(uint8_t addr1, uint8_t addr2); 49void IS31FL3737_update_led_control_registers(uint8_t addr1, uint8_t addr2);
49 50
51#define PUR_0R 0x00 // No PUR resistor
52#define PUR_05KR 0x01 // 0.5k Ohm resistor in t_NOL
53#define PUR_1KR 0x02 // 1.0k Ohm resistor in t_NOL
54#define PUR_2KR 0x03 // 2.0k Ohm resistor in t_NOL
55#define PUR_4KR 0x04 // 4.0k Ohm resistor in t_NOL
56#define PUR_8KR 0x05 // 8.0k Ohm resistor in t_NOL
57#define PUR_16KR 0x06 // 16k Ohm resistor in t_NOL
58#define PUR_32KR 0x07 // 32k Ohm resistor in t_NOL
59
50#define A_1 0x00 60#define A_1 0x00
51#define A_2 0x01 61#define A_2 0x01
52#define A_3 0x02 62#define A_3 0x02
diff --git a/drivers/led/issi/is31fl3741.c b/drivers/led/issi/is31fl3741.c
index 24a273514..5084f3b9f 100644
--- a/drivers/led/issi/is31fl3741.c
+++ b/drivers/led/issi/is31fl3741.c
@@ -61,6 +61,14 @@
61# define ISSI_PERSISTENCE 0 61# define ISSI_PERSISTENCE 0
62#endif 62#endif
63 63
64#ifndef ISSI_SWPULLUP
65# define ISSI_SWPULLUP PUR_32KR
66#endif
67
68#ifndef ISSI_CSPULLUP
69# define ISSI_CSPULLUP PUR_32KR
70#endif
71
64#define ISSI_MAX_LEDS 351 72#define ISSI_MAX_LEDS 351
65 73
66// Transfer buffer for TWITransmitData() 74// Transfer buffer for TWITransmitData()
@@ -157,7 +165,7 @@ void IS31FL3741_init(uint8_t addr) {
157 // Set Golbal Current Control Register 165 // Set Golbal Current Control Register
158 IS31FL3741_write_register(addr, ISSI_REG_GLOBALCURRENT, 0xFF); 166 IS31FL3741_write_register(addr, ISSI_REG_GLOBALCURRENT, 0xFF);
159 // Set Pull up & Down for SWx CSy 167 // Set Pull up & Down for SWx CSy
160 IS31FL3741_write_register(addr, ISSI_REG_PULLDOWNUP, 0x77); 168 IS31FL3741_write_register(addr, ISSI_REG_PULLDOWNUP, ((ISSI_CSPULLUP << 4) | ISSI_SWPULLUP));
161 169
162 // IS31FL3741_update_led_scaling_registers(addr, 0xFF, 0xFF, 0xFF); 170 // IS31FL3741_update_led_scaling_registers(addr, 0xFF, 0xFF, 0xFF);
163 171
diff --git a/drivers/led/issi/is31fl3741.h b/drivers/led/issi/is31fl3741.h
index 163a03523..563022b9b 100644
--- a/drivers/led/issi/is31fl3741.h
+++ b/drivers/led/issi/is31fl3741.h
@@ -51,6 +51,15 @@ void IS31FL3741_set_scaling_registers(const is31_led *pled, uint8_t red, uint8_t
51 51
52void IS31FL3741_set_pwm_buffer(const is31_led *pled, uint8_t red, uint8_t green, uint8_t blue); 52void IS31FL3741_set_pwm_buffer(const is31_led *pled, uint8_t red, uint8_t green, uint8_t blue);
53 53
54#define PUR_0R 0x00 // No PUR resistor
55#define PUR_05KR 0x01 // 0.5k Ohm resistor
56#define PUR_1KR 0x02 // 1.0k Ohm resistor
57#define PUR_2KR 0x03 // 2.0k Ohm resistor
58#define PUR_4KR 0x04 // 4.0k Ohm resistor
59#define PUR_8KR 0x05 // 8.0k Ohm resistor
60#define PUR_16KR 0x06 // 16k Ohm resistor
61#define PUR_32KR 0x07 // 32k Ohm resistor
62
54#define CS1_SW1 0x00 63#define CS1_SW1 0x00
55#define CS2_SW1 0x01 64#define CS2_SW1 0x01
56#define CS3_SW1 0x02 65#define CS3_SW1 0x02