diff options
| -rw-r--r-- | drivers/issi/is31fl3218.h | 1 | ||||
| -rw-r--r-- | drivers/issi/is31fl3731-simple.c | 15 | ||||
| -rw-r--r-- | drivers/issi/is31fl3731-simple.h | 8 | ||||
| -rw-r--r-- | drivers/issi/is31fl3731.c | 18 | ||||
| -rw-r--r-- | drivers/issi/is31fl3731.h | 5 | ||||
| -rw-r--r-- | drivers/issi/is31fl3733.c | 19 | ||||
| -rw-r--r-- | drivers/issi/is31fl3733.h | 5 | ||||
| -rw-r--r-- | drivers/issi/is31fl3736.c | 21 | ||||
| -rw-r--r-- | drivers/issi/is31fl3737.c | 23 | ||||
| -rw-r--r-- | drivers/issi/is31fl3737.h | 5 |
10 files changed, 25 insertions, 95 deletions
diff --git a/drivers/issi/is31fl3218.h b/drivers/issi/is31fl3218.h index a70cc1e79..fa760da19 100644 --- a/drivers/issi/is31fl3218.h +++ b/drivers/issi/is31fl3218.h | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | * You should have received a copy of the GNU General Public License | 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/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ | 15 | */ |
| 16 | |||
| 16 | #pragma once | 17 | #pragma once |
| 17 | 18 | ||
| 18 | #include <stdint.h> | 19 | #include <stdint.h> |
diff --git a/drivers/issi/is31fl3731-simple.c b/drivers/issi/is31fl3731-simple.c index fad4676de..bd3bb4746 100644 --- a/drivers/issi/is31fl3731-simple.c +++ b/drivers/issi/is31fl3731-simple.c | |||
| @@ -16,21 +16,9 @@ | |||
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ | 17 | */ |
| 18 | 18 | ||
| 19 | #ifdef __AVR__ | ||
| 20 | # include <avr/interrupt.h> | ||
| 21 | # include <avr/io.h> | ||
| 22 | # include <util/delay.h> | ||
| 23 | #else | ||
| 24 | # include "wait.h" | ||
| 25 | #endif | ||
| 26 | |||
| 27 | #include <stdint.h> | ||
| 28 | #include <stdbool.h> | ||
| 29 | #include <string.h> | ||
| 30 | #include "is31fl3731-simple.h" | 19 | #include "is31fl3731-simple.h" |
| 31 | #include "i2c_master.h" | 20 | #include "i2c_master.h" |
| 32 | #include "progmem.h" | 21 | #include "wait.h" |
| 33 | #include "print.h" | ||
| 34 | 22 | ||
| 35 | // This is a 7-bit address, that gets left-shifted and bit 0 | 23 | // This is a 7-bit address, that gets left-shifted and bit 0 |
| 36 | // set to 0 for write, 1 for read (as per I2C protocol) | 24 | // set to 0 for write, 1 for read (as per I2C protocol) |
| @@ -156,6 +144,7 @@ void IS31FL3731_init(uint8_t addr) { | |||
| 156 | 144 | ||
| 157 | // enable software shutdown | 145 | // enable software shutdown |
| 158 | IS31FL3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x00); | 146 | IS31FL3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x00); |
| 147 | |||
| 159 | // this delay was copied from other drivers, might not be needed | 148 | // this delay was copied from other drivers, might not be needed |
| 160 | wait_ms(10); | 149 | wait_ms(10); |
| 161 | 150 | ||
diff --git a/drivers/issi/is31fl3731-simple.h b/drivers/issi/is31fl3731-simple.h index a223c351e..85b458753 100644 --- a/drivers/issi/is31fl3731-simple.h +++ b/drivers/issi/is31fl3731-simple.h | |||
| @@ -16,8 +16,10 @@ | |||
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ | 17 | */ |
| 18 | 18 | ||
| 19 | #ifndef IS31FL3731_DRIVER_H | 19 | #pragma once |
| 20 | #define IS31FL3731_DRIVER_H | 20 | |
| 21 | #include <stdint.h> | ||
| 22 | #include <stdbool.h> | ||
| 21 | 23 | ||
| 22 | typedef struct is31_led { | 24 | typedef struct is31_led { |
| 23 | uint8_t driver : 2; | 25 | uint8_t driver : 2; |
| @@ -203,5 +205,3 @@ void IS31FL3731_update_led_control_registers(uint8_t addr, uint8_t index); | |||
| 203 | #define C9_14 0xB1 | 205 | #define C9_14 0xB1 |
| 204 | #define C9_15 0xB2 | 206 | #define C9_15 0xB2 |
| 205 | #define C9_16 0xB3 | 207 | #define C9_16 0xB3 |
| 206 | |||
| 207 | #endif // IS31FL3731_DRIVER_H | ||
diff --git a/drivers/issi/is31fl3731.c b/drivers/issi/is31fl3731.c index 0b6f3e985..9f006b817 100644 --- a/drivers/issi/is31fl3731.c +++ b/drivers/issi/is31fl3731.c | |||
| @@ -15,18 +15,9 @@ | |||
| 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | #ifdef __AVR__ | ||
| 19 | # include <avr/interrupt.h> | ||
| 20 | # include <avr/io.h> | ||
| 21 | # include <util/delay.h> | ||
| 22 | #else | ||
| 23 | # include "wait.h" | ||
| 24 | #endif | ||
| 25 | |||
| 26 | #include "is31fl3731.h" | 18 | #include "is31fl3731.h" |
| 27 | #include <string.h> | ||
| 28 | #include "i2c_master.h" | 19 | #include "i2c_master.h" |
| 29 | #include "progmem.h" | 20 | #include "wait.h" |
| 30 | 21 | ||
| 31 | // This is a 7-bit address, that gets left-shifted and bit 0 | 22 | // This is a 7-bit address, that gets left-shifted and bit 0 |
| 32 | // set to 0 for write, 1 for read (as per I2C protocol) | 23 | // set to 0 for write, 1 for read (as per I2C protocol) |
| @@ -141,12 +132,9 @@ void IS31FL3731_init(uint8_t addr) { | |||
| 141 | 132 | ||
| 142 | // enable software shutdown | 133 | // enable software shutdown |
| 143 | IS31FL3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x00); | 134 | IS31FL3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x00); |
| 144 | // this delay was copied from other drivers, might not be needed | 135 | |
| 145 | #ifdef __AVR__ | 136 | // this delay was copied from other drivers, might not be needed |
| 146 | _delay_ms(10); | ||
| 147 | #else | ||
| 148 | wait_ms(10); | 137 | wait_ms(10); |
| 149 | #endif | ||
| 150 | 138 | ||
| 151 | // picture mode | 139 | // picture mode |
| 152 | IS31FL3731_write_register(addr, ISSI_REG_CONFIG, ISSI_REG_CONFIG_PICTUREMODE); | 140 | IS31FL3731_write_register(addr, ISSI_REG_CONFIG, ISSI_REG_CONFIG_PICTUREMODE); |
diff --git a/drivers/issi/is31fl3731.h b/drivers/issi/is31fl3731.h index 6a7a45d8f..19e8e6251 100644 --- a/drivers/issi/is31fl3731.h +++ b/drivers/issi/is31fl3731.h | |||
| @@ -15,8 +15,7 @@ | |||
| 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | #ifndef IS31FL3731_DRIVER_H | 18 | #pragma once |
| 19 | #define IS31FL3731_DRIVER_H | ||
| 20 | 19 | ||
| 21 | #include <stdint.h> | 20 | #include <stdint.h> |
| 22 | #include <stdbool.h> | 21 | #include <stdbool.h> |
| @@ -207,5 +206,3 @@ void IS31FL3731_update_led_control_registers(uint8_t addr, uint8_t index); | |||
| 207 | #define C9_14 0xB1 | 206 | #define C9_14 0xB1 |
| 208 | #define C9_15 0xB2 | 207 | #define C9_15 0xB2 |
| 209 | #define C9_16 0xB3 | 208 | #define C9_16 0xB3 |
| 210 | |||
| 211 | #endif // IS31FL3731_DRIVER_H | ||
diff --git a/drivers/issi/is31fl3733.c b/drivers/issi/is31fl3733.c index e60f0e878..b913922b0 100644 --- a/drivers/issi/is31fl3733.c +++ b/drivers/issi/is31fl3733.c | |||
| @@ -16,18 +16,9 @@ | |||
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ | 17 | */ |
| 18 | 18 | ||
| 19 | #ifdef __AVR__ | ||
| 20 | # include <avr/interrupt.h> | ||
| 21 | # include <avr/io.h> | ||
| 22 | # include <util/delay.h> | ||
| 23 | #else | ||
| 24 | # include "wait.h" | ||
| 25 | #endif | ||
| 26 | |||
| 27 | #include <string.h> | ||
| 28 | #include "i2c_master.h" | ||
| 29 | #include "progmem.h" | ||
| 30 | #include "is31fl3733.h" | 19 | #include "is31fl3733.h" |
| 20 | #include "i2c_master.h" | ||
| 21 | #include "wait.h" | ||
| 31 | 22 | ||
| 32 | // This is a 7-bit address, that gets left-shifted and bit 0 | 23 | // This is a 7-bit address, that gets left-shifted and bit 0 |
| 33 | // set to 0 for write, 1 for read (as per I2C protocol) | 24 | // set to 0 for write, 1 for read (as per I2C protocol) |
| @@ -168,12 +159,8 @@ void IS31FL3733_init(uint8_t addr, uint8_t sync) { | |||
| 168 | // Disable software shutdown. | 159 | // Disable software shutdown. |
| 169 | IS31FL3733_write_register(addr, ISSI_REG_CONFIGURATION, (sync << 6) | 0x01); | 160 | IS31FL3733_write_register(addr, ISSI_REG_CONFIGURATION, (sync << 6) | 0x01); |
| 170 | 161 | ||
| 171 | // Wait 10ms to ensure the device has woken up. | 162 | // Wait 10ms to ensure the device has woken up. |
| 172 | #ifdef __AVR__ | ||
| 173 | _delay_ms(10); | ||
| 174 | #else | ||
| 175 | wait_ms(10); | 163 | wait_ms(10); |
| 176 | #endif | ||
| 177 | } | 164 | } |
| 178 | 165 | ||
| 179 | void IS31FL3733_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | 166 | void IS31FL3733_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { |
diff --git a/drivers/issi/is31fl3733.h b/drivers/issi/is31fl3733.h index 4cf186733..603d505a1 100644 --- a/drivers/issi/is31fl3733.h +++ b/drivers/issi/is31fl3733.h | |||
| @@ -16,8 +16,7 @@ | |||
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ | 17 | */ |
| 18 | 18 | ||
| 19 | #ifndef IS31FL3733_DRIVER_H | 19 | #pragma once |
| 20 | #define IS31FL3733_DRIVER_H | ||
| 21 | 20 | ||
| 22 | #include <stdint.h> | 21 | #include <stdint.h> |
| 23 | #include <stdbool.h> | 22 | #include <stdbool.h> |
| @@ -250,5 +249,3 @@ void IS31FL3733_update_led_control_registers(uint8_t addr, uint8_t index); | |||
| 250 | #define L_14 0xBD | 249 | #define L_14 0xBD |
| 251 | #define L_15 0xBE | 250 | #define L_15 0xBE |
| 252 | #define L_16 0xBF | 251 | #define L_16 0xBF |
| 253 | |||
| 254 | #endif // IS31FL3733_DRIVER_H | ||
diff --git a/drivers/issi/is31fl3736.c b/drivers/issi/is31fl3736.c index 754292425..9bd8fecfb 100644 --- a/drivers/issi/is31fl3736.c +++ b/drivers/issi/is31fl3736.c | |||
| @@ -14,18 +14,9 @@ | |||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | #ifdef __AVR__ | ||
| 18 | # include <avr/interrupt.h> | ||
| 19 | # include <avr/io.h> | ||
| 20 | # include <util/delay.h> | ||
| 21 | #else | ||
| 22 | # include "wait.h" | ||
| 23 | #endif | ||
| 24 | |||
| 25 | #include "is31fl3736.h" | 17 | #include "is31fl3736.h" |
| 26 | #include <string.h> | ||
| 27 | #include "i2c_master.h" | 18 | #include "i2c_master.h" |
| 28 | #include "progmem.h" | 19 | #include "wait.h" |
| 29 | 20 | ||
| 30 | // This is a 7-bit address, that gets left-shifted and bit 0 | 21 | // This is a 7-bit address, that gets left-shifted and bit 0 |
| 31 | // set to 0 for write, 1 for read (as per I2C protocol) | 22 | // set to 0 for write, 1 for read (as per I2C protocol) |
| @@ -154,12 +145,8 @@ void IS31FL3736_init(uint8_t addr) { | |||
| 154 | // Disable software shutdown. | 145 | // Disable software shutdown. |
| 155 | IS31FL3736_write_register(addr, ISSI_REG_CONFIGURATION, 0x01); | 146 | IS31FL3736_write_register(addr, ISSI_REG_CONFIGURATION, 0x01); |
| 156 | 147 | ||
| 157 | // Wait 10ms to ensure the device has woken up. | 148 | // Wait 10ms to ensure the device has woken up. |
| 158 | #ifdef __AVR__ | ||
| 159 | _delay_ms(10); | ||
| 160 | #else | ||
| 161 | wait_ms(10); | 149 | wait_ms(10); |
| 162 | #endif | ||
| 163 | } | 150 | } |
| 164 | 151 | ||
| 165 | void IS31FL3736_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | 152 | void IS31FL3736_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { |
| @@ -263,7 +250,7 @@ void IS31FL3736_update_pwm_buffers(uint8_t addr1, uint8_t addr2) { | |||
| 263 | IS31FL3736_write_register(addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM); | 250 | IS31FL3736_write_register(addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM); |
| 264 | 251 | ||
| 265 | IS31FL3736_write_pwm_buffer(addr1, g_pwm_buffer[0]); | 252 | IS31FL3736_write_pwm_buffer(addr1, g_pwm_buffer[0]); |
| 266 | // IS31FL3736_write_pwm_buffer( addr2, g_pwm_buffer[1] ); | 253 | // IS31FL3736_write_pwm_buffer(addr2, g_pwm_buffer[1]); |
| 267 | } | 254 | } |
| 268 | g_pwm_buffer_update_required = false; | 255 | g_pwm_buffer_update_required = false; |
| 269 | } | 256 | } |
| @@ -275,7 +262,7 @@ void IS31FL3736_update_led_control_registers(uint8_t addr1, uint8_t addr2) { | |||
| 275 | IS31FL3736_write_register(addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL); | 262 | IS31FL3736_write_register(addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL); |
| 276 | for (int i = 0; i < 24; i++) { | 263 | for (int i = 0; i < 24; i++) { |
| 277 | IS31FL3736_write_register(addr1, i, g_led_control_registers[0][i]); | 264 | IS31FL3736_write_register(addr1, i, g_led_control_registers[0][i]); |
| 278 | // IS31FL3736_write_register(addr2, i, g_led_control_registers[1][i] ); | 265 | // IS31FL3736_write_register(addr2, i, g_led_control_registers[1][i]); |
| 279 | } | 266 | } |
| 280 | } | 267 | } |
| 281 | } | 268 | } |
diff --git a/drivers/issi/is31fl3737.c b/drivers/issi/is31fl3737.c index 4cc46272e..37c5c58e4 100644 --- a/drivers/issi/is31fl3737.c +++ b/drivers/issi/is31fl3737.c | |||
| @@ -16,18 +16,9 @@ | |||
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ | 17 | */ |
| 18 | 18 | ||
| 19 | #ifdef __AVR__ | 19 | #include "is31fl3737.h" |
| 20 | # include <avr/interrupt.h> | ||
| 21 | # include <avr/io.h> | ||
| 22 | # include <util/delay.h> | ||
| 23 | #else | ||
| 24 | # include "wait.h" | ||
| 25 | #endif | ||
| 26 | |||
| 27 | #include <string.h> | ||
| 28 | #include "i2c_master.h" | 20 | #include "i2c_master.h" |
| 29 | #include "progmem.h" | 21 | #include "wait.h" |
| 30 | #include "rgb_matrix.h" | ||
| 31 | 22 | ||
| 32 | // This is a 7-bit address, that gets left-shifted and bit 0 | 23 | // This is a 7-bit address, that gets left-shifted and bit 0 |
| 33 | // set to 0 for write, 1 for read (as per I2C protocol) | 24 | // set to 0 for write, 1 for read (as per I2C protocol) |
| @@ -156,12 +147,8 @@ void IS31FL3737_init(uint8_t addr) { | |||
| 156 | // Disable software shutdown. | 147 | // Disable software shutdown. |
| 157 | IS31FL3737_write_register(addr, ISSI_REG_CONFIGURATION, 0x01); | 148 | IS31FL3737_write_register(addr, ISSI_REG_CONFIGURATION, 0x01); |
| 158 | 149 | ||
| 159 | // Wait 10ms to ensure the device has woken up. | 150 | // Wait 10ms to ensure the device has woken up. |
| 160 | #ifdef __AVR__ | ||
| 161 | _delay_ms(10); | ||
| 162 | #else | ||
| 163 | wait_ms(10); | 151 | wait_ms(10); |
| 164 | #endif | ||
| 165 | } | 152 | } |
| 166 | 153 | ||
| 167 | void IS31FL3737_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { | 154 | void IS31FL3737_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) { |
| @@ -217,7 +204,7 @@ void IS31FL3737_update_pwm_buffers(uint8_t addr1, uint8_t addr2) { | |||
| 217 | IS31FL3737_write_register(addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM); | 204 | IS31FL3737_write_register(addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM); |
| 218 | 205 | ||
| 219 | IS31FL3737_write_pwm_buffer(addr1, g_pwm_buffer[0]); | 206 | IS31FL3737_write_pwm_buffer(addr1, g_pwm_buffer[0]); |
| 220 | // IS31FL3737_write_pwm_buffer( addr2, g_pwm_buffer[1] ); | 207 | // IS31FL3737_write_pwm_buffer(addr2, g_pwm_buffer[1]); |
| 221 | } | 208 | } |
| 222 | g_pwm_buffer_update_required = false; | 209 | g_pwm_buffer_update_required = false; |
| 223 | } | 210 | } |
| @@ -229,7 +216,7 @@ void IS31FL3737_update_led_control_registers(uint8_t addr1, uint8_t addr2) { | |||
| 229 | IS31FL3737_write_register(addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL); | 216 | IS31FL3737_write_register(addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL); |
| 230 | for (int i = 0; i < 24; i++) { | 217 | for (int i = 0; i < 24; i++) { |
| 231 | IS31FL3737_write_register(addr1, i, g_led_control_registers[0][i]); | 218 | IS31FL3737_write_register(addr1, i, g_led_control_registers[0][i]); |
| 232 | // IS31FL3737_write_register(addr2, i, g_led_control_registers[1][i] ); | 219 | // IS31FL3737_write_register(addr2, i, g_led_control_registers[1][i]); |
| 233 | } | 220 | } |
| 234 | } | 221 | } |
| 235 | } | 222 | } |
diff --git a/drivers/issi/is31fl3737.h b/drivers/issi/is31fl3737.h index 2c2fb1964..a1d228177 100644 --- a/drivers/issi/is31fl3737.h +++ b/drivers/issi/is31fl3737.h | |||
| @@ -16,8 +16,7 @@ | |||
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ | 17 | */ |
| 18 | 18 | ||
| 19 | #ifndef IS31FL3737_DRIVER_H | 19 | #pragma once |
| 20 | #define IS31FL3737_DRIVER_H | ||
| 21 | 20 | ||
| 22 | #include <stdint.h> | 21 | #include <stdint.h> |
| 23 | #include <stdbool.h> | 22 | #include <stdbool.h> |
| @@ -202,5 +201,3 @@ void IS31FL3737_update_led_control_registers(uint8_t addr1, uint8_t addr2); | |||
| 202 | #define L_10 0xBB | 201 | #define L_10 0xBB |
| 203 | #define L_11 0xBC | 202 | #define L_11 0xBC |
| 204 | #define L_12 0xBD | 203 | #define L_12 0xBD |
| 205 | |||
| 206 | #endif // IS31FL3737_DRIVER_H | ||
