Remove IS31FLCOMMON code (#22800)
This commit is contained in:
parent
8a6b7003f7
commit
f583d2fef0
@ -1,329 +0,0 @@
|
|||||||
/* Copyright 2017 Jason Williams
|
|
||||||
* Copyright 2018 Jack Humbert
|
|
||||||
* Copyright 2018 Yiancar
|
|
||||||
* Copyright 2020 MelGeek
|
|
||||||
* Copyright 2021 MasterSpoon
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "is31flcommon.h"
|
|
||||||
#include "i2c_master.h"
|
|
||||||
#include "wait.h"
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
// Set defaults for Timeout and Persistence
|
|
||||||
#ifndef ISSI_TIMEOUT
|
|
||||||
# define ISSI_TIMEOUT 100
|
|
||||||
#endif
|
|
||||||
#ifndef ISSI_PERSISTENCE
|
|
||||||
# define ISSI_PERSISTENCE 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uint8_t i2c_transfer_buffer[20];
|
|
||||||
|
|
||||||
// These buffers match the PWM & scaling registers.
|
|
||||||
// Storing them like this is optimal for I2C transfers to the registers.
|
|
||||||
uint8_t g_pwm_buffer[DRIVER_COUNT][ISSI_MAX_LEDS];
|
|
||||||
bool g_pwm_buffer_update_required[DRIVER_COUNT] = {false};
|
|
||||||
|
|
||||||
uint8_t g_scaling_buffer[DRIVER_COUNT][ISSI_SCALING_SIZE];
|
|
||||||
bool g_scaling_buffer_update_required[DRIVER_COUNT] = {false};
|
|
||||||
|
|
||||||
// For writing of single register entry
|
|
||||||
void IS31FL_write_single_register(uint8_t addr, uint8_t reg, uint8_t data) {
|
|
||||||
// Set register address and register data ready to write
|
|
||||||
i2c_transfer_buffer[0] = reg;
|
|
||||||
i2c_transfer_buffer[1] = data;
|
|
||||||
|
|
||||||
#if ISSI_PERSISTENCE > 0
|
|
||||||
for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
|
|
||||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, 2, ISSI_TIMEOUT) == 0) break;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
i2c_transmit(addr << 1, i2c_transfer_buffer, 2, ISSI_TIMEOUT);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// For writing of mulitple register entries to make use of address auto increment
|
|
||||||
// Once the controller has been called and we have written the first bit of data
|
|
||||||
// the controller will move to the next register meaning we can write sequential blocks.
|
|
||||||
bool IS31FL_write_multi_registers(uint8_t addr, uint8_t *source_buffer, uint8_t buffer_size, uint8_t transfer_size, uint8_t start_reg_addr) {
|
|
||||||
// Split the buffer into chunks to transfer
|
|
||||||
for (int i = 0; i < buffer_size; i += transfer_size) {
|
|
||||||
// Set the first entry of transfer buffer to the first register we want to write
|
|
||||||
i2c_transfer_buffer[0] = i + start_reg_addr;
|
|
||||||
// Copy the section of our source buffer into the transfer buffer after first register address
|
|
||||||
memcpy(i2c_transfer_buffer + 1, source_buffer + i, transfer_size);
|
|
||||||
|
|
||||||
#if ISSI_PERSISTENCE > 0
|
|
||||||
for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
|
|
||||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, transfer_size + 1, ISSI_TIMEOUT) != 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if (i2c_transmit(addr << 1, i2c_transfer_buffer, transfer_size + 1, ISSI_TIMEOUT) != 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void IS31FL_unlock_register(uint8_t addr, uint8_t page) {
|
|
||||||
// unlock the command register and select Page to write
|
|
||||||
IS31FL_write_single_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, ISSI_REGISTER_UNLOCK);
|
|
||||||
IS31FL_write_single_register(addr, ISSI_COMMANDREGISTER, page);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IS31FL_common_init(uint8_t addr, uint8_t ssr) {
|
|
||||||
// Setup phase, need to take out of software shutdown and configure
|
|
||||||
// ISSI_SSR_x is passed to allow Master / Slave setting where applicable
|
|
||||||
|
|
||||||
// Unlock the command register & select Function Register
|
|
||||||
IS31FL_unlock_register(addr, ISSI_PAGE_FUNCTION);
|
|
||||||
// Set Configuration Register to remove Software shutdown
|
|
||||||
IS31FL_write_single_register(addr, ISSI_REG_CONFIGURATION, ISSI_CONFIGURATION);
|
|
||||||
// Set Golbal Current Control Register
|
|
||||||
IS31FL_write_single_register(addr, ISSI_REG_GLOBALCURRENT, ISSI_GLOBALCURRENT);
|
|
||||||
// Set Pull up & Down for SWx CSy
|
|
||||||
IS31FL_write_single_register(addr, ISSI_REG_PULLDOWNUP, ISSI_PULLDOWNUP);
|
|
||||||
// Set Tempature Status
|
|
||||||
#ifdef ISSI_REG_TEMP
|
|
||||||
IS31FL_write_single_register(addr, ISSI_REG_TEMP, ISSI_TEMP);
|
|
||||||
#endif
|
|
||||||
// Set Spread Spectrum Register, passed through as sets SYNC function
|
|
||||||
IS31FL_write_single_register(addr, ISSI_REG_SSR, ssr);
|
|
||||||
// Set PWM Frequency Enable Register if applicable
|
|
||||||
#ifdef ISSI_REG_PWM_ENABLE
|
|
||||||
IS31FL_write_single_register(addr, ISSI_REG_PWM_ENABLE, ISSI_PWM_ENABLE);
|
|
||||||
#endif
|
|
||||||
// Set PWM Frequency Register if applicable
|
|
||||||
#ifdef ISSI_REG_PWM_SET
|
|
||||||
IS31FL_write_single_register(addr, ISSI_REG_PWM_SET, ISSI_PWM_SET);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Wait 10ms to ensure the device has woken up.
|
|
||||||
wait_ms(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IS31FL_common_update_pwm_register(uint8_t addr, uint8_t index) {
|
|
||||||
if (g_pwm_buffer_update_required[index]) {
|
|
||||||
// Queue up the correct page
|
|
||||||
IS31FL_unlock_register(addr, ISSI_PAGE_PWM);
|
|
||||||
// Hand off the update to IS31FL_write_multi_registers
|
|
||||||
IS31FL_write_multi_registers(addr, g_pwm_buffer[index], ISSI_MAX_LEDS, ISSI_PWM_TRF_SIZE, ISSI_PWM_REG_1ST);
|
|
||||||
// Update flags that pwm_buffer has been updated
|
|
||||||
g_pwm_buffer_update_required[index] = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef ISSI_MANUAL_SCALING
|
|
||||||
void IS31FL_set_manual_scaling_buffer(void) {
|
|
||||||
is31_led led;
|
|
||||||
is31_led scale;
|
|
||||||
for (int i = 0; i < ISSI_MANUAL_SCALING; i++) {
|
|
||||||
memcpy_P(&scale, (&g_is31_scaling[i]), sizeof(scale));
|
|
||||||
|
|
||||||
# ifdef RGB_MATRIX_ENABLE
|
|
||||||
if (scale.driver >= 0 && scale.driver < RGB_MATRIX_LED_COUNT) {
|
|
||||||
memcpy_P(&led, (&g_is31_leds[scale.driver]), sizeof(led));
|
|
||||||
|
|
||||||
if (g_scaling_buffer[led.driver][led.r] = scale.r && g_scaling_buffer[led.driver][led.g] = scale.g && g_scaling_buffer[led.driver][led.b] = scale.b) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
g_scaling_buffer[led.driver][led.r] = scale.r;
|
|
||||||
g_scaling_buffer[led.driver][led.g] = scale.g;
|
|
||||||
g_scaling_buffer[led.driver][led.b] = scale.b;
|
|
||||||
# elif defined(LED_MATRIX_ENABLE)
|
|
||||||
if (scale.driver >= 0 && scale.driver < LED_MATRIX_LED_COUNT) {
|
|
||||||
memcpy_P(&led, (&g_is31_leds[scale.driver]), sizeof(led));
|
|
||||||
|
|
||||||
if (g_scaling_buffer[led.driver][led.v] == scale.v) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
g_scaling_buffer[led.driver][led.v] = scale.v;
|
|
||||||
# endif
|
|
||||||
g_scaling_buffer_update_required[led.driver] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void IS31FL_common_update_scaling_register(uint8_t addr, uint8_t index) {
|
|
||||||
if (g_scaling_buffer_update_required[index]) {
|
|
||||||
// Queue up the correct page
|
|
||||||
IS31FL_unlock_register(addr, ISSI_PAGE_SCALING);
|
|
||||||
// Hand off the update to IS31FL_write_multi_registers
|
|
||||||
IS31FL_write_multi_registers(addr, g_scaling_buffer[index], ISSI_SCALING_SIZE, ISSI_SCALING_TRF_SIZE, ISSI_SCL_REG_1ST);
|
|
||||||
// Update flags that scaling_buffer has been updated
|
|
||||||
g_scaling_buffer_update_required[index] = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void IS31FL_common_flush(void) {
|
|
||||||
IS31FL_common_update_pwm_register(DRIVER_ADDR_1, 0);
|
|
||||||
#if defined(DRIVER_ADDR_2)
|
|
||||||
IS31FL_common_update_pwm_register(DRIVER_ADDR_2, 1);
|
|
||||||
# if defined(DRIVER_ADDR_3)
|
|
||||||
IS31FL_common_update_pwm_register(DRIVER_ADDR_3, 2);
|
|
||||||
# if defined(DRIVER_ADDR_4)
|
|
||||||
IS31FL_common_update_pwm_register(DRIVER_ADDR_4, 3);
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef RGB_MATRIX_ENABLE
|
|
||||||
void IS31FL_RGB_init_drivers(void) {
|
|
||||||
i2c_init();
|
|
||||||
|
|
||||||
IS31FL_common_init(DRIVER_ADDR_1, ISSI_SSR_1);
|
|
||||||
# if defined(DRIVER_ADDR_2)
|
|
||||||
IS31FL_common_init(DRIVER_ADDR_2, ISSI_SSR_2);
|
|
||||||
# if defined(DRIVER_ADDR_3)
|
|
||||||
IS31FL_common_init(DRIVER_ADDR_3, ISSI_SSR_3);
|
|
||||||
# if defined(DRIVER_ADDR_4)
|
|
||||||
IS31FL_common_init(DRIVER_ADDR_4, ISSI_SSR_4);
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
|
|
||||||
for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) {
|
|
||||||
IS31FL_RGB_set_scaling_buffer(i, true, true, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// This actually updates the LED drivers
|
|
||||||
# ifdef ISSI_MANUAL_SCALING
|
|
||||||
IS31FL_set_manual_scaling_buffer();
|
|
||||||
# endif
|
|
||||||
|
|
||||||
IS31FL_common_update_scaling_register(DRIVER_ADDR_1, 0);
|
|
||||||
# if defined(DRIVER_ADDR_2)
|
|
||||||
IS31FL_common_update_scaling_register(DRIVER_ADDR_2, 1);
|
|
||||||
# if defined(DRIVER_ADDR_3)
|
|
||||||
IS31FL_common_update_scaling_register(DRIVER_ADDR_3, 2);
|
|
||||||
# if defined(DRIVER_ADDR_4)
|
|
||||||
IS31FL_common_update_scaling_register(DRIVER_ADDR_4, 3);
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// Colour is set by adjusting PWM register
|
|
||||||
void IS31FL_RGB_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
|
|
||||||
if (index >= 0 && index < RGB_MATRIX_LED_COUNT) {
|
|
||||||
is31_led led;
|
|
||||||
memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
|
|
||||||
|
|
||||||
g_pwm_buffer[led.driver][led.r] = red;
|
|
||||||
g_pwm_buffer[led.driver][led.g] = green;
|
|
||||||
g_pwm_buffer[led.driver][led.b] = blue;
|
|
||||||
g_pwm_buffer_update_required[led.driver] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void IS31FL_RGB_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
|
|
||||||
for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) {
|
|
||||||
IS31FL_RGB_set_color(i, red, green, blue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Setup Scaling register that decides the peak current of each LED
|
|
||||||
void IS31FL_RGB_set_scaling_buffer(uint8_t index, bool red, bool green, bool blue) {
|
|
||||||
is31_led led;
|
|
||||||
memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
|
|
||||||
if (red) {
|
|
||||||
g_scaling_buffer[led.driver][led.r] = ISSI_SCAL_RED;
|
|
||||||
} else {
|
|
||||||
g_scaling_buffer[led.driver][led.r] = ISSI_SCAL_RED_OFF;
|
|
||||||
}
|
|
||||||
if (green) {
|
|
||||||
g_scaling_buffer[led.driver][led.g] = ISSI_SCAL_GREEN;
|
|
||||||
} else {
|
|
||||||
g_scaling_buffer[led.driver][led.g] = ISSI_SCAL_GREEN_OFF;
|
|
||||||
}
|
|
||||||
if (blue) {
|
|
||||||
g_scaling_buffer[led.driver][led.b] = ISSI_SCAL_BLUE;
|
|
||||||
} else {
|
|
||||||
g_scaling_buffer[led.driver][led.b] = ISSI_SCAL_BLUE_OFF;
|
|
||||||
}
|
|
||||||
g_scaling_buffer_update_required[led.driver] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#elif defined(LED_MATRIX_ENABLE)
|
|
||||||
// LED Matrix Specific scripts
|
|
||||||
void IS31FL_simple_init_drivers(void) {
|
|
||||||
i2c_init();
|
|
||||||
|
|
||||||
IS31FL_common_init(DRIVER_ADDR_1, ISSI_SSR_1);
|
|
||||||
# if defined(DRIVER_ADDR_2)
|
|
||||||
IS31FL_common_init(DRIVER_ADDR_2, ISSI_SSR_2);
|
|
||||||
# if defined(DRIVER_ADDR_3)
|
|
||||||
IS31FL_common_init(DRIVER_ADDR_3, ISSI_SSR_3);
|
|
||||||
# if defined(DRIVER_ADDR_4)
|
|
||||||
IS31FL_common_init(DRIVER_ADDR_4, ISSI_SSR_4);
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
|
|
||||||
for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) {
|
|
||||||
IS31FL_simple_set_scaling_buffer(i, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// This actually updates the LED drivers
|
|
||||||
# ifdef ISSI_MANUAL_SCALING
|
|
||||||
IS31FL_set_manual_scaling_buffer();
|
|
||||||
# endif
|
|
||||||
|
|
||||||
IS31FL_common_update_scaling_register(DRIVER_ADDR_1, 0);
|
|
||||||
# if defined(DRIVER_ADDR_2)
|
|
||||||
IS31FL_common_update_scaling_register(DRIVER_ADDR_2, 1);
|
|
||||||
# if defined(DRIVER_ADDR_3)
|
|
||||||
IS31FL_common_update_scaling_register(DRIVER_ADDR_3, 2);
|
|
||||||
# if defined(DRIVER_ADDR_4)
|
|
||||||
IS31FL_common_update_scaling_register(DRIVER_ADDR_4, 3);
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void IS31FL_simple_set_scaling_buffer(uint8_t index, bool value) {
|
|
||||||
is31_led led;
|
|
||||||
memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
|
|
||||||
if (value) {
|
|
||||||
g_scaling_buffer[led.driver][led.v] = ISSI_SCAL_LED;
|
|
||||||
} else {
|
|
||||||
g_scaling_buffer[led.driver][led.v] = ISSI_SCAL_LED_OFF;
|
|
||||||
}
|
|
||||||
g_scaling_buffer_update_required[led.driver] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void IS31FL_simple_set_brightness(int index, uint8_t value) {
|
|
||||||
if (index >= 0 && index < LED_MATRIX_LED_COUNT) {
|
|
||||||
is31_led led;
|
|
||||||
memcpy_P(&led, (&g_is31_leds[index]), sizeof(led));
|
|
||||||
|
|
||||||
g_pwm_buffer[led.driver][led.v] = value;
|
|
||||||
g_pwm_buffer_update_required[led.driver] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void IS31FL_simple_set_brigntness_all(uint8_t value) {
|
|
||||||
for (int i = 0; i < LED_MATRIX_LED_COUNT; i++) {
|
|
||||||
IS31FL_simple_set_brightness(i, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
@ -1,84 +0,0 @@
|
|||||||
/* Copyright 2017 Jason Williams
|
|
||||||
* Copyright 2018 Jack Humbert
|
|
||||||
* Copyright 2018 Yiancar
|
|
||||||
* Copyright 2020 MelGeek
|
|
||||||
* Copyright 2021 MasterSpoon
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include "progmem.h"
|
|
||||||
#include "util.h"
|
|
||||||
|
|
||||||
#if defined DRIVER_ADDR_4
|
|
||||||
# define DRIVER_COUNT 4
|
|
||||||
#elif defined DRIVER_ADDR_3
|
|
||||||
# define DRIVER_COUNT 3
|
|
||||||
#elif defined DRIVER_ADDR_2
|
|
||||||
# define DRIVER_COUNT 2
|
|
||||||
#elif defined DRIVER_ADDR_1
|
|
||||||
# define DRIVER_COUNT 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef RGB_MATRIX_ENABLE
|
|
||||||
typedef struct is31_led {
|
|
||||||
uint8_t driver : 2;
|
|
||||||
uint8_t r;
|
|
||||||
uint8_t g;
|
|
||||||
uint8_t b;
|
|
||||||
} PACKED is31_led;
|
|
||||||
|
|
||||||
extern const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT];
|
|
||||||
|
|
||||||
#elif defined(LED_MATRIX_ENABLE)
|
|
||||||
typedef struct is31_led {
|
|
||||||
uint8_t driver : 2;
|
|
||||||
uint8_t v;
|
|
||||||
} PACKED is31_led;
|
|
||||||
|
|
||||||
extern const is31_led PROGMEM g_is31_leds[LED_MATRIX_LED_COUNT];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ISSI_MANUAL_SCALING
|
|
||||||
extern const is31_led PROGMEM g_is31_scaling[];
|
|
||||||
void IS31FL_set_manual_scaling_buffer(void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void IS31FL_write_single_register(uint8_t addr, uint8_t reg, uint8_t data);
|
|
||||||
bool IS31FL_write_multi_registers(uint8_t addr, uint8_t *source_buffer, uint8_t buffer_size, uint8_t transfer_size, uint8_t start_reg_addr);
|
|
||||||
void IS31FL_unlock_register(uint8_t addr, uint8_t page);
|
|
||||||
void IS31FL_common_init(uint8_t addr, uint8_t ssr);
|
|
||||||
|
|
||||||
void IS31FL_common_update_pwm_register(uint8_t addr, uint8_t index);
|
|
||||||
void IS31FL_common_update_scaling_register(uint8_t addr, uint8_t index);
|
|
||||||
|
|
||||||
void IS31FL_common_flush(void);
|
|
||||||
|
|
||||||
#ifdef RGB_MATRIX_ENABLE
|
|
||||||
// RGB Matrix Specific scripts
|
|
||||||
void IS31FL_RGB_init_drivers(void);
|
|
||||||
void IS31FL_RGB_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
|
|
||||||
void IS31FL_RGB_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
|
|
||||||
void IS31FL_RGB_set_scaling_buffer(uint8_t index, bool red, bool green, bool blue);
|
|
||||||
#elif defined(LED_MATRIX_ENABLE)
|
|
||||||
// LED Matrix Specific scripts
|
|
||||||
void IS31FL_simple_init_drivers(void);
|
|
||||||
void IS31FL_simple_set_scaling_buffer(uint8_t index, bool value);
|
|
||||||
void IS31FL_simple_set_brightness(int index, uint8_t value);
|
|
||||||
void IS31FL_simple_set_brigntness_all(uint8_t value);
|
|
||||||
#endif
|
|
@ -35,8 +35,8 @@
|
|||||||
#define EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN C12
|
#define EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN C12
|
||||||
|
|
||||||
/* I2C Config for LED Driver */
|
/* I2C Config for LED Driver */
|
||||||
#define DRIVER_COUNT 2
|
#define SNLED27351_I2C_ADDRESS_1 SNLED27351_I2C_ADDRESS_GND
|
||||||
#define DRIVER_ADDR_1 0b1110100
|
#define SNLED27351_I2C_ADDRESS_2 SNLED27351_I2C_ADDRESS_VDDIO
|
||||||
#define DRIVER_ADDR_2 0b1110111
|
|
||||||
#define I2C1_OPMODE OPMODE_I2C
|
#define I2C1_OPMODE OPMODE_I2C
|
||||||
#define I2C1_CLOCK_SPEED 400000 /* 400000 */
|
#define I2C1_CLOCK_SPEED 400000 /* 400000 */
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
"caps_lock": "A15"
|
"caps_lock": "A15"
|
||||||
},
|
},
|
||||||
"rgb_matrix": {
|
"rgb_matrix": {
|
||||||
"driver": "ckled2001",
|
"driver": "snled27351",
|
||||||
"max_brightness": 180,
|
"max_brightness": 180,
|
||||||
"animations": {
|
"animations": {
|
||||||
"breathing": true,
|
"breathing": true,
|
||||||
|
@ -33,10 +33,10 @@
|
|||||||
#define SPI_MOSI_PIN A7
|
#define SPI_MOSI_PIN A7
|
||||||
#define SPI_MISO_PIN A6
|
#define SPI_MISO_PIN A6
|
||||||
|
|
||||||
#define DRIVER_1_CS A15
|
#define AW20216S_CS_PIN_1 A15
|
||||||
#define DRIVER_2_CS B15
|
#define AW20216S_CS_PIN_2 B15
|
||||||
#define DRIVER_1_EN C13
|
#define AW20216S_EN_PIN_1 C13
|
||||||
#define DRIVER_2_EN C13
|
#define AW20216S_EN_PIN_2 C13
|
||||||
|
|
||||||
#define DRIVER_COUNT 2
|
#define DRIVER_COUNT 2
|
||||||
#define DRIVER_1_LED_TOTAL 66
|
#define DRIVER_1_LED_TOTAL 66
|
||||||
|
@ -80,7 +80,7 @@
|
|||||||
"solid_multisplash": true
|
"solid_multisplash": true
|
||||||
},
|
},
|
||||||
"center_point": [76, 25],
|
"center_point": [76, 25],
|
||||||
"driver": "aw20216",
|
"driver": "aw20216s",
|
||||||
"layout": [
|
"layout": [
|
||||||
{ "flags": 4, "matrix": [1, 3], "x": 0, "y": 0 },
|
{ "flags": 4, "matrix": [1, 3], "x": 0, "y": 0 },
|
||||||
{ "flags": 4, "matrix": [2, 6], "x": 20, "y": 0 },
|
{ "flags": 4, "matrix": [2, 6], "x": 20, "y": 0 },
|
||||||
|
@ -32,10 +32,10 @@
|
|||||||
#define SPI_MOSI_PIN A7
|
#define SPI_MOSI_PIN A7
|
||||||
#define SPI_MISO_PIN A6
|
#define SPI_MISO_PIN A6
|
||||||
|
|
||||||
#define DRIVER_1_CS A15
|
#define AW20216S_CS_PIN_1 A15
|
||||||
#define DRIVER_2_CS B15
|
#define AW20216S_CS_PIN_2 B15
|
||||||
#define DRIVER_1_EN C13
|
#define AW20216S_EN_PIN_1 C13
|
||||||
#define DRIVER_2_EN C13
|
#define AW20216S_EN_PIN_2 C13
|
||||||
|
|
||||||
#define DRIVER_1_LED_TOTAL 68
|
#define DRIVER_1_LED_TOTAL 68
|
||||||
#define DRIVER_2_LED_TOTAL 54
|
#define DRIVER_2_LED_TOTAL 54
|
||||||
|
@ -79,7 +79,7 @@
|
|||||||
"solid_multisplash": true
|
"solid_multisplash": true
|
||||||
},
|
},
|
||||||
"center_point": [87, 35],
|
"center_point": [87, 35],
|
||||||
"driver": "aw20216",
|
"driver": "aw20216s",
|
||||||
"layout": [
|
"layout": [
|
||||||
{ "flags": 4, "matrix": [1, 3], "x": 0, "y": 0 },
|
{ "flags": 4, "matrix": [1, 3], "x": 0, "y": 0 },
|
||||||
{ "flags": 4, "matrix": [2, 6], "x": 20, "y": 0 },
|
{ "flags": 4, "matrix": [2, 6], "x": 20, "y": 0 },
|
||||||
|
@ -32,10 +32,10 @@
|
|||||||
#define SPI_MOSI_PIN A7
|
#define SPI_MOSI_PIN A7
|
||||||
#define SPI_MISO_PIN A6
|
#define SPI_MISO_PIN A6
|
||||||
|
|
||||||
#define DRIVER_1_CS A15
|
#define AW20216S_CS_PIN_1 A15
|
||||||
#define DRIVER_2_CS B15
|
#define AW20216S_CS_PIN_2 B15
|
||||||
#define DRIVER_1_EN C13
|
#define AW20216S_EN_PIN_1 C13
|
||||||
#define DRIVER_2_EN C13
|
#define AW20216S_EN_PIN_2 C13
|
||||||
|
|
||||||
#define DRIVER_1_LED_TOTAL 66
|
#define DRIVER_1_LED_TOTAL 66
|
||||||
#define DRIVER_2_LED_TOTAL 19
|
#define DRIVER_2_LED_TOTAL 19
|
||||||
|
@ -87,7 +87,7 @@
|
|||||||
"solid_multisplash": true
|
"solid_multisplash": true
|
||||||
},
|
},
|
||||||
"center_point": [76, 25],
|
"center_point": [76, 25],
|
||||||
"driver": "aw20216",
|
"driver": "aw20216s",
|
||||||
"layout": [
|
"layout": [
|
||||||
{ "flags": 4, "matrix": [1, 3], "x": 0, "y": 0 },
|
{ "flags": 4, "matrix": [1, 3], "x": 0, "y": 0 },
|
||||||
{ "flags": 4, "matrix": [2, 6], "x": 20, "y": 0 },
|
{ "flags": 4, "matrix": [2, 6], "x": 20, "y": 0 },
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
#define I2C1_SDA_PIN B9
|
#define I2C1_SDA_PIN B9
|
||||||
#define I2C1_SCL_PIN B8
|
#define I2C1_SCL_PIN B8
|
||||||
#define DRIVER_ADDR_1 0b1010000
|
#define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND
|
||||||
#define RGB_MATRIX_LED_COUNT 47
|
#define RGB_MATRIX_LED_COUNT 47
|
||||||
|
|
||||||
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
|
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#include "quantum.h"
|
#include "quantum.h"
|
||||||
|
|
||||||
#ifdef RGB_MATRIX_ENABLE
|
#ifdef RGB_MATRIX_ENABLE
|
||||||
const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT] = {
|
const is31fl3733_led_t PROGMEM g_is31fl3733_leds[IS31FL3733_LED_COUNT] = {
|
||||||
/* Refer to IS31 manual for these locations
|
/* Refer to IS31 manual for these locations
|
||||||
* driver
|
* driver
|
||||||
* | R location
|
* | R location
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
/* RGB Config */
|
/* RGB Config */
|
||||||
#define DRIVER_1_CS B6
|
#define AW20216S_CS_PIN_1 B6
|
||||||
#define DRIVER_1_EN B7
|
#define AW20216S_EN_PIN_1 B7
|
||||||
#define RGB_MATRIX_LED_COUNT 67
|
#define RGB_MATRIX_LED_COUNT 67
|
||||||
|
|
||||||
/* SPI Config */
|
/* SPI Config */
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
"on_state": 0
|
"on_state": 0
|
||||||
},
|
},
|
||||||
"rgb_matrix": {
|
"rgb_matrix": {
|
||||||
"driver": "aw20216",
|
"driver": "aw20216s",
|
||||||
"animations": {
|
"animations": {
|
||||||
"solid_color": true,
|
"solid_color": true,
|
||||||
"alphas_mods": true,
|
"alphas_mods": true,
|
||||||
|
@ -32,10 +32,10 @@
|
|||||||
#define SPI_MOSI_PIN A7
|
#define SPI_MOSI_PIN A7
|
||||||
#define SPI_MISO_PIN A6
|
#define SPI_MISO_PIN A6
|
||||||
|
|
||||||
#define DRIVER_1_CS A15
|
#define AW20216S_CS_PIN_1 A15
|
||||||
#define DRIVER_2_CS B15
|
#define AW20216S_CS_PIN_2 B15
|
||||||
#define DRIVER_1_EN C13
|
#define AW20216S_EN_PIN_1 C13
|
||||||
#define DRIVER_2_EN C13
|
#define AW20216S_EN_PIN_2 C13
|
||||||
|
|
||||||
#define DRIVER_1_LED_TOTAL 70
|
#define DRIVER_1_LED_TOTAL 70
|
||||||
#define DRIVER_2_LED_TOTAL 17
|
#define DRIVER_2_LED_TOTAL 17
|
||||||
|
@ -81,7 +81,7 @@
|
|||||||
"solid_multisplash": true
|
"solid_multisplash": true
|
||||||
},
|
},
|
||||||
"center_point": [78, 20],
|
"center_point": [78, 20],
|
||||||
"driver": "aw20216",
|
"driver": "aw20216s",
|
||||||
"layout": [
|
"layout": [
|
||||||
{ "flags": 4, "matrix": [1, 3], "x": 0, "y": 0 },
|
{ "flags": 4, "matrix": [1, 3], "x": 0, "y": 0 },
|
||||||
{ "flags": 4, "matrix": [2, 6], "x": 12.5, "y": 0 },
|
{ "flags": 4, "matrix": [2, 6], "x": 12.5, "y": 0 },
|
||||||
|
@ -38,5 +38,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
# define RGB_MATRIX_LED_PROCESS_LIMIT 4
|
# define RGB_MATRIX_LED_PROCESS_LIMIT 4
|
||||||
# define RGB_MATRIX_LED_FLUSH_LIMIT 26
|
# define RGB_MATRIX_LED_FLUSH_LIMIT 26
|
||||||
# define RGB_MATRIX_STARTUP_VAL 128
|
# define RGB_MATRIX_STARTUP_VAL 128
|
||||||
# define DRIVER_ADDR_1 0b0110000
|
# define IS31FL3741_I2C_ADDRESS_1 IS31FL3741_I2C_ADDRESS_GND
|
||||||
# define RGB_MATRIX_LED_COUNT 101
|
# define RGB_MATRIX_LED_COUNT 101
|
@ -105,14 +105,6 @@ const led_matrix_driver_t led_matrix_driver = {
|
|||||||
.set_value_all = is31fl3746a_set_value_all,
|
.set_value_all = is31fl3746a_set_value_all,
|
||||||
};
|
};
|
||||||
|
|
||||||
#elif defined(IS31FLCOMMON)
|
|
||||||
const led_matrix_driver_t led_matrix_driver = {
|
|
||||||
.init = IS31FL_simple_init_drivers,
|
|
||||||
.flush = IS31FL_common_flush,
|
|
||||||
.set_value = IS31FL_simple_set_brightness,
|
|
||||||
.set_value_all = IS31FL_simple_set_brigntness_all,
|
|
||||||
};
|
|
||||||
|
|
||||||
#elif defined(LED_MATRIX_SNLED27351)
|
#elif defined(LED_MATRIX_SNLED27351)
|
||||||
const led_matrix_driver_t led_matrix_driver = {
|
const led_matrix_driver_t led_matrix_driver = {
|
||||||
.init = snled27351_init_drivers,
|
.init = snled27351_init_drivers,
|
||||||
|
@ -25,8 +25,6 @@
|
|||||||
# include "is31fl3745-simple.h"
|
# include "is31fl3745-simple.h"
|
||||||
#elif defined(LED_MATRIX_IS31FL3746A)
|
#elif defined(LED_MATRIX_IS31FL3746A)
|
||||||
# include "is31fl3746a-simple.h"
|
# include "is31fl3746a-simple.h"
|
||||||
#elif defined(IS31FLCOMMON)
|
|
||||||
# include "is31flcommon.h"
|
|
||||||
#elif defined(LED_MATRIX_SNLED27351)
|
#elif defined(LED_MATRIX_SNLED27351)
|
||||||
# include "snled27351-simple.h"
|
# include "snled27351-simple.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -108,14 +108,6 @@ const rgb_matrix_driver_t rgb_matrix_driver = {
|
|||||||
.set_color_all = is31fl3746a_set_color_all,
|
.set_color_all = is31fl3746a_set_color_all,
|
||||||
};
|
};
|
||||||
|
|
||||||
#elif defined(IS31FLCOMMON)
|
|
||||||
const rgb_matrix_driver_t rgb_matrix_driver = {
|
|
||||||
.init = IS31FL_RGB_init_drivers,
|
|
||||||
.flush = IS31FL_common_flush,
|
|
||||||
.set_color = IS31FL_RGB_set_color,
|
|
||||||
.set_color_all = IS31FL_RGB_set_color_all,
|
|
||||||
};
|
|
||||||
|
|
||||||
#elif defined(RGB_MATRIX_SNLED27351)
|
#elif defined(RGB_MATRIX_SNLED27351)
|
||||||
const rgb_matrix_driver_t rgb_matrix_driver = {
|
const rgb_matrix_driver_t rgb_matrix_driver = {
|
||||||
.init = snled27351_init_drivers,
|
.init = snled27351_init_drivers,
|
||||||
|
@ -27,8 +27,6 @@
|
|||||||
# include "is31fl3745.h"
|
# include "is31fl3745.h"
|
||||||
#elif defined(RGB_MATRIX_IS31FL3746A)
|
#elif defined(RGB_MATRIX_IS31FL3746A)
|
||||||
# include "is31fl3746a.h"
|
# include "is31fl3746a.h"
|
||||||
#elif defined(IS31FLCOMMON)
|
|
||||||
# include "is31flcommon.h"
|
|
||||||
#elif defined(RGB_MATRIX_SNLED27351)
|
#elif defined(RGB_MATRIX_SNLED27351)
|
||||||
# include "snled27351.h"
|
# include "snled27351.h"
|
||||||
#elif defined(RGB_MATRIX_WS2812)
|
#elif defined(RGB_MATRIX_WS2812)
|
||||||
|
Loading…
Reference in New Issue
Block a user