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>
This commit is contained in:
		
							parent
							
								
									7ae0f371cf
								
							
						
					
					
						commit
						0c72501763
					
				
					 11 changed files with 136 additions and 10 deletions
				
			
		| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
/* Copyright 2017 Jason Williams
 | 
			
		||||
 * Copyright 2018 Jack Humbert
 | 
			
		||||
 * Copyright 2019 Clueboard
 | 
			
		||||
 * Copyright 2021 Doni Crosby
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
| 
						 | 
				
			
			@ -40,6 +41,9 @@
 | 
			
		|||
 | 
			
		||||
#define ISSI_REG_PICTUREFRAME 0x01
 | 
			
		||||
 | 
			
		||||
// Not defined in the datasheet -- See AN for IC
 | 
			
		||||
#define ISSI_REG_GHOST_IMAGE_PREVENTION 0xC2  // Set bit 4 to enable de-ghosting
 | 
			
		||||
 | 
			
		||||
#define ISSI_REG_SHUTDOWN 0x0A
 | 
			
		||||
#define ISSI_REG_AUDIOSYNC 0x06
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -144,6 +148,9 @@ void IS31FL3731_init(uint8_t addr) {
 | 
			
		|||
 | 
			
		||||
    // enable software shutdown
 | 
			
		||||
    IS31FL3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x00);
 | 
			
		||||
#ifdef ISSI_3731_DEGHOST  // set to enable de-ghosting of the array
 | 
			
		||||
    IS31FL3731_write_register(addr, ISSI_REG_GHOST_IMAGE_PREVENTION, 0x10);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    // this delay was copied from other drivers, might not be needed
 | 
			
		||||
    wait_ms(10);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,6 @@
 | 
			
		|||
/* Copyright 2017 Jason Williams
 | 
			
		||||
 * Copyright 2018 Jack Humbert
 | 
			
		||||
 * Copyright 2021 Doni Crosby
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
| 
						 | 
				
			
			@ -39,6 +40,9 @@
 | 
			
		|||
 | 
			
		||||
#define ISSI_REG_PICTUREFRAME 0x01
 | 
			
		||||
 | 
			
		||||
// Not defined in the datasheet -- See AN for IC
 | 
			
		||||
#define ISSI_REG_GHOST_IMAGE_PREVENTION 0xC2  // Set bit 4 to enable de-ghosting
 | 
			
		||||
 | 
			
		||||
#define ISSI_REG_SHUTDOWN 0x0A
 | 
			
		||||
#define ISSI_REG_AUDIOSYNC 0x06
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -132,6 +136,9 @@ void IS31FL3731_init(uint8_t addr) {
 | 
			
		|||
 | 
			
		||||
    // enable software shutdown
 | 
			
		||||
    IS31FL3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x00);
 | 
			
		||||
#ifdef ISSI_3731_DEGHOST  // set to enable de-ghosting of the array
 | 
			
		||||
    IS31FL3731_write_register(addr, ISSI_REG_GHOST_IMAGE_PREVENTION, 0x10);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    // this delay was copied from other drivers, might not be needed
 | 
			
		||||
    wait_ms(10);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
/* Copyright 2017 Jason Williams
 | 
			
		||||
 * Copyright 2018 Jack Humbert
 | 
			
		||||
 * Copyright 2018 Yiancar
 | 
			
		||||
 * Copyright 2021 Doni Crosby
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
| 
						 | 
				
			
			@ -58,6 +59,12 @@
 | 
			
		|||
 | 
			
		||||
#ifndef ISSI_PWM_FREQUENCY
 | 
			
		||||
#    define ISSI_PWM_FREQUENCY 0b000  // PFS - IS31FL3733B only
 | 
			
		||||
#ifndef ISSI_SWPULLUP
 | 
			
		||||
#    define ISSI_SWPULLUP PUR_0R
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef ISSI_CSPULLUP
 | 
			
		||||
#    define ISSI_CSPULLUP PUR_0R
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
// Transfer buffer for TWITransmitData()
 | 
			
		||||
| 
						 | 
				
			
			@ -158,6 +165,10 @@ void IS31FL3733_init(uint8_t addr, uint8_t sync) {
 | 
			
		|||
 | 
			
		||||
    // Select PG3
 | 
			
		||||
    IS31FL3733_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION);
 | 
			
		||||
    // Set de-ghost pull-up resistors (SWx)
 | 
			
		||||
    IS31FL3733_write_register(addr, ISSI_REG_SWPULLUP, ISSI_SWPULLUP);
 | 
			
		||||
    // Set de-ghost pull-down resistors (CSx)
 | 
			
		||||
    IS31FL3733_write_register(addr, ISSI_REG_CSPULLUP, ISSI_CSPULLUP);
 | 
			
		||||
    // Set global current to maximum.
 | 
			
		||||
    IS31FL3733_write_register(addr, ISSI_REG_GLOBALCURRENT, 0xFF);
 | 
			
		||||
    // Disable software shutdown.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
/* Copyright 2017 Jason Williams
 | 
			
		||||
 * Copyright 2018 Jack Humbert
 | 
			
		||||
 * Copyright 2018 Yiancar
 | 
			
		||||
 * Copyright 2021 Doni Crosby
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
| 
						 | 
				
			
			@ -47,6 +48,14 @@ void IS31FL3733_set_led_control_register(uint8_t index, bool red, bool green, bo
 | 
			
		|||
void IS31FL3733_update_pwm_buffers(uint8_t addr, uint8_t index);
 | 
			
		||||
void IS31FL3733_update_led_control_registers(uint8_t addr, uint8_t index);
 | 
			
		||||
 | 
			
		||||
#define PUR_0R 0x00    // No PUR resistor
 | 
			
		||||
#define PUR_05KR 0x02  // 0.5k Ohm resistor in t_NOL
 | 
			
		||||
#define PUR_3KR 0x03   // 3.0k Ohm resistor on all the time
 | 
			
		||||
#define PUR_4KR 0x04   // 4.0k Ohm resistor on all the time
 | 
			
		||||
#define PUR_8KR 0x05   // 8.0k Ohm resistor on all the time
 | 
			
		||||
#define PUR_16KR 0x06  // 16k Ohm resistor on all the time
 | 
			
		||||
#define PUR_32KR 0x07  // 32k Ohm resistor in t_NOL
 | 
			
		||||
 | 
			
		||||
#define A_1 0x00
 | 
			
		||||
#define A_2 0x01
 | 
			
		||||
#define A_3 0x02
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,5 @@
 | 
			
		|||
/* Copyright 2018 Jason Williams (Wilba)
 | 
			
		||||
 * Copyright 2021 Doni Crosby
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
| 
						 | 
				
			
			@ -54,6 +55,14 @@
 | 
			
		|||
#    define ISSI_PERSISTENCE 0
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef ISSI_SWPULLUP
 | 
			
		||||
#    define ISSI_SWPULLUP PUR_0R
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef ISSI_CSPULLUP
 | 
			
		||||
#    define ISSI_CSPULLUP PUR_0R
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
// Transfer buffer for TWITransmitData()
 | 
			
		||||
uint8_t g_twi_transfer_buffer[20];
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -140,6 +149,10 @@ void IS31FL3736_init(uint8_t addr) {
 | 
			
		|||
 | 
			
		||||
    // Select PG3
 | 
			
		||||
    IS31FL3736_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION);
 | 
			
		||||
    // Set de-ghost pull-up resistors (SWx)
 | 
			
		||||
    IS31FL3736_write_register(addr, ISSI_REG_SWPULLUP, ISSI_SWPULLUP);
 | 
			
		||||
    // Set de-ghost pull-down resistors (CSx)
 | 
			
		||||
    IS31FL3736_write_register(addr, ISSI_REG_CSPULLUP, ISSI_CSPULLUP);
 | 
			
		||||
    // Set global current to maximum.
 | 
			
		||||
    IS31FL3736_write_register(addr, ISSI_REG_GLOBALCURRENT, 0xFF);
 | 
			
		||||
    // Disable software shutdown.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,5 @@
 | 
			
		|||
/* Copyright 2018 Jason Williams (Wilba)
 | 
			
		||||
 * Copyright 2021 Doni Crosby
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
| 
						 | 
				
			
			@ -60,6 +61,15 @@ void IS31FL3736_mono_set_led_control_register(uint8_t index, bool enabled);
 | 
			
		|||
void IS31FL3736_update_pwm_buffers(uint8_t addr1, uint8_t addr2);
 | 
			
		||||
void IS31FL3736_update_led_control_registers(uint8_t addr1, uint8_t addr2);
 | 
			
		||||
 | 
			
		||||
#define PUR_0R 0x00    // No PUR resistor
 | 
			
		||||
#define PUR_05KR 0x01  // 0.5k Ohm resistor
 | 
			
		||||
#define PUR_1KR 0x02   // 1.0k Ohm resistor
 | 
			
		||||
#define PUR_2KR 0x03   // 2.0k Ohm resistor
 | 
			
		||||
#define PUR_4KR 0x04   // 4.0k Ohm resistor
 | 
			
		||||
#define PUR_8KR 0x05   // 8.0k Ohm resistor
 | 
			
		||||
#define PUR_16KR 0x06  // 16k Ohm resistor
 | 
			
		||||
#define PUR_32KR 0x07  // 32k Ohm resistor
 | 
			
		||||
 | 
			
		||||
#define A_1 0x00
 | 
			
		||||
#define A_2 0x02
 | 
			
		||||
#define A_3 0x04
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
/* Copyright 2017 Jason Williams
 | 
			
		||||
 * Copyright 2018 Jack Humbert
 | 
			
		||||
 * Copyright 2018 Yiancar
 | 
			
		||||
 * Copyright 2021 Doni Crosby
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
| 
						 | 
				
			
			@ -56,6 +57,14 @@
 | 
			
		|||
#    define ISSI_PERSISTENCE 0
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef ISSI_SWPULLUP
 | 
			
		||||
#    define ISSI_SWPULLUP PUR_0R
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef ISSI_CSPULLUP
 | 
			
		||||
#    define ISSI_CSPULLUP PUR_0R
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
// Transfer buffer for TWITransmitData()
 | 
			
		||||
uint8_t g_twi_transfer_buffer[20];
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -143,6 +152,10 @@ void IS31FL3737_init(uint8_t addr) {
 | 
			
		|||
 | 
			
		||||
    // Select PG3
 | 
			
		||||
    IS31FL3737_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION);
 | 
			
		||||
    // Set de-ghost pull-up resistors (SWx)
 | 
			
		||||
    IS31FL3737_write_register(addr, ISSI_REG_SWPULLUP, ISSI_SWPULLUP);
 | 
			
		||||
    // Set de-ghost pull-down resistors (CSx)
 | 
			
		||||
    IS31FL3737_write_register(addr, ISSI_REG_CSPULLUP, ISSI_CSPULLUP);
 | 
			
		||||
    // Set global current to maximum.
 | 
			
		||||
    IS31FL3737_write_register(addr, ISSI_REG_GLOBALCURRENT, 0xFF);
 | 
			
		||||
    // Disable software shutdown.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
/* Copyright 2017 Jason Williams
 | 
			
		||||
 * Copyright 2018 Jack Humbert
 | 
			
		||||
 * Copyright 2018 Yiancar
 | 
			
		||||
 * Copyright 2021 Doni Crosby
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
| 
						 | 
				
			
			@ -47,6 +48,15 @@ void IS31FL3737_set_led_control_register(uint8_t index, bool red, bool green, bo
 | 
			
		|||
void IS31FL3737_update_pwm_buffers(uint8_t addr1, uint8_t addr2);
 | 
			
		||||
void IS31FL3737_update_led_control_registers(uint8_t addr1, uint8_t addr2);
 | 
			
		||||
 | 
			
		||||
#define PUR_0R 0x00    // No PUR resistor
 | 
			
		||||
#define PUR_05KR 0x01  // 0.5k Ohm resistor in t_NOL
 | 
			
		||||
#define PUR_1KR 0x02   // 1.0k Ohm resistor in t_NOL
 | 
			
		||||
#define PUR_2KR 0x03   // 2.0k Ohm resistor in t_NOL
 | 
			
		||||
#define PUR_4KR 0x04   // 4.0k Ohm resistor in t_NOL
 | 
			
		||||
#define PUR_8KR 0x05   // 8.0k Ohm resistor in t_NOL
 | 
			
		||||
#define PUR_16KR 0x06  // 16k Ohm resistor in t_NOL
 | 
			
		||||
#define PUR_32KR 0x07  // 32k Ohm resistor in t_NOL
 | 
			
		||||
 | 
			
		||||
#define A_1 0x00
 | 
			
		||||
#define A_2 0x01
 | 
			
		||||
#define A_3 0x02
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -61,6 +61,14 @@
 | 
			
		|||
#    define ISSI_PERSISTENCE 0
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef ISSI_SWPULLUP
 | 
			
		||||
#    define ISSI_SWPULLUP PUR_32KR
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef ISSI_CSPULLUP
 | 
			
		||||
#    define ISSI_CSPULLUP PUR_32KR
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define ISSI_MAX_LEDS 351
 | 
			
		||||
 | 
			
		||||
// Transfer buffer for TWITransmitData()
 | 
			
		||||
| 
						 | 
				
			
			@ -157,7 +165,7 @@ void IS31FL3741_init(uint8_t addr) {
 | 
			
		|||
    // Set Golbal Current Control Register
 | 
			
		||||
    IS31FL3741_write_register(addr, ISSI_REG_GLOBALCURRENT, 0xFF);
 | 
			
		||||
    // Set Pull up & Down for SWx CSy
 | 
			
		||||
    IS31FL3741_write_register(addr, ISSI_REG_PULLDOWNUP, 0x77);
 | 
			
		||||
    IS31FL3741_write_register(addr, ISSI_REG_PULLDOWNUP, ((ISSI_CSPULLUP << 4) | ISSI_SWPULLUP));
 | 
			
		||||
 | 
			
		||||
    // IS31FL3741_update_led_scaling_registers(addr, 0xFF, 0xFF, 0xFF);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -51,6 +51,15 @@ void IS31FL3741_set_scaling_registers(const is31_led *pled, uint8_t red, uint8_t
 | 
			
		|||
 | 
			
		||||
void IS31FL3741_set_pwm_buffer(const is31_led *pled, uint8_t red, uint8_t green, uint8_t blue);
 | 
			
		||||
 | 
			
		||||
#define PUR_0R 0x00    // No PUR resistor
 | 
			
		||||
#define PUR_05KR 0x01  // 0.5k Ohm resistor
 | 
			
		||||
#define PUR_1KR 0x02   // 1.0k Ohm resistor
 | 
			
		||||
#define PUR_2KR 0x03   // 2.0k Ohm resistor
 | 
			
		||||
#define PUR_4KR 0x04   // 4.0k Ohm resistor
 | 
			
		||||
#define PUR_8KR 0x05   // 8.0k Ohm resistor
 | 
			
		||||
#define PUR_16KR 0x06  // 16k Ohm resistor
 | 
			
		||||
#define PUR_32KR 0x07  // 32k Ohm resistor
 | 
			
		||||
 | 
			
		||||
#define CS1_SW1 0x00
 | 
			
		||||
#define CS2_SW1 0x01
 | 
			
		||||
#define CS3_SW1 0x02
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue