Clean up ISSI driver includes (#7734)

* Clean up ISSI driver includes

* Missed an endif
master
fauxpark 2019-12-30 05:21:58 +11:00 committed by Drashna Jaelre
parent 25aaeb4f40
commit 8af1501328
10 changed files with 25 additions and 95 deletions

View File

@ -13,6 +13,7 @@
* 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>

View File

@ -16,21 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef __AVR__
# include <avr/interrupt.h>
# include <avr/io.h>
# include <util/delay.h>
#else
# include "wait.h"
#endif
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include "is31fl3731-simple.h"
#include "i2c_master.h"
#include "progmem.h"
#include "print.h"
#include "wait.h"
// This is a 7-bit address, that gets left-shifted and bit 0
// set to 0 for write, 1 for read (as per I2C protocol)
@ -156,6 +144,7 @@ void IS31FL3731_init(uint8_t addr) {
// enable software shutdown
IS31FL3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x00);
// this delay was copied from other drivers, might not be needed
wait_ms(10);

View File

@ -16,8 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef IS31FL3731_DRIVER_H
#define IS31FL3731_DRIVER_H
#pragma once
#include <stdint.h>
#include <stdbool.h>
typedef struct is31_led {
uint8_t driver : 2;
@ -203,5 +205,3 @@ void IS31FL3731_update_led_control_registers(uint8_t addr, uint8_t index);
#define C9_14 0xB1
#define C9_15 0xB2
#define C9_16 0xB3
#endif // IS31FL3731_DRIVER_H

View File

@ -15,18 +15,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef __AVR__
# include <avr/interrupt.h>
# include <avr/io.h>
# include <util/delay.h>
#else
# include "wait.h"
#endif
#include "is31fl3731.h"
#include <string.h>
#include "i2c_master.h"
#include "progmem.h"
#include "wait.h"
// This is a 7-bit address, that gets left-shifted and bit 0
// set to 0 for write, 1 for read (as per I2C protocol)
@ -141,12 +132,9 @@ void IS31FL3731_init(uint8_t addr) {
// enable software shutdown
IS31FL3731_write_register(addr, ISSI_REG_SHUTDOWN, 0x00);
// this delay was copied from other drivers, might not be needed
#ifdef __AVR__
_delay_ms(10);
#else
// this delay was copied from other drivers, might not be needed
wait_ms(10);
#endif
// picture mode
IS31FL3731_write_register(addr, ISSI_REG_CONFIG, ISSI_REG_CONFIG_PICTUREMODE);

View File

@ -15,8 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef IS31FL3731_DRIVER_H
#define IS31FL3731_DRIVER_H
#pragma once
#include <stdint.h>
#include <stdbool.h>
@ -207,5 +206,3 @@ void IS31FL3731_update_led_control_registers(uint8_t addr, uint8_t index);
#define C9_14 0xB1
#define C9_15 0xB2
#define C9_16 0xB3
#endif // IS31FL3731_DRIVER_H

View File

@ -16,18 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef __AVR__
# include <avr/interrupt.h>
# include <avr/io.h>
# include <util/delay.h>
#else
# include "wait.h"
#endif
#include <string.h>
#include "i2c_master.h"
#include "progmem.h"
#include "is31fl3733.h"
#include "i2c_master.h"
#include "wait.h"
// This is a 7-bit address, that gets left-shifted and bit 0
// 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) {
// Disable software shutdown.
IS31FL3733_write_register(addr, ISSI_REG_CONFIGURATION, (sync << 6) | 0x01);
// Wait 10ms to ensure the device has woken up.
#ifdef __AVR__
_delay_ms(10);
#else
// Wait 10ms to ensure the device has woken up.
wait_ms(10);
#endif
}
void IS31FL3733_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {

View File

@ -16,8 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef IS31FL3733_DRIVER_H
#define IS31FL3733_DRIVER_H
#pragma once
#include <stdint.h>
#include <stdbool.h>
@ -250,5 +249,3 @@ void IS31FL3733_update_led_control_registers(uint8_t addr, uint8_t index);
#define L_14 0xBD
#define L_15 0xBE
#define L_16 0xBF
#endif // IS31FL3733_DRIVER_H

View File

@ -14,18 +14,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef __AVR__
# include <avr/interrupt.h>
# include <avr/io.h>
# include <util/delay.h>
#else
# include "wait.h"
#endif
#include "is31fl3736.h"
#include <string.h>
#include "i2c_master.h"
#include "progmem.h"
#include "wait.h"
// This is a 7-bit address, that gets left-shifted and bit 0
// set to 0 for write, 1 for read (as per I2C protocol)
@ -154,12 +145,8 @@ void IS31FL3736_init(uint8_t addr) {
// Disable software shutdown.
IS31FL3736_write_register(addr, ISSI_REG_CONFIGURATION, 0x01);
// Wait 10ms to ensure the device has woken up.
#ifdef __AVR__
_delay_ms(10);
#else
// Wait 10ms to ensure the device has woken up.
wait_ms(10);
#endif
}
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) {
IS31FL3736_write_register(addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM);
IS31FL3736_write_pwm_buffer(addr1, g_pwm_buffer[0]);
// IS31FL3736_write_pwm_buffer( addr2, g_pwm_buffer[1] );
// IS31FL3736_write_pwm_buffer(addr2, g_pwm_buffer[1]);
}
g_pwm_buffer_update_required = false;
}
@ -275,7 +262,7 @@ void IS31FL3736_update_led_control_registers(uint8_t addr1, uint8_t addr2) {
IS31FL3736_write_register(addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL);
for (int i = 0; i < 24; i++) {
IS31FL3736_write_register(addr1, i, g_led_control_registers[0][i]);
// IS31FL3736_write_register(addr2, i, g_led_control_registers[1][i] );
// IS31FL3736_write_register(addr2, i, g_led_control_registers[1][i]);
}
}
}

View File

@ -16,18 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef __AVR__
# include <avr/interrupt.h>
# include <avr/io.h>
# include <util/delay.h>
#else
# include "wait.h"
#endif
#include <string.h>
#include "is31fl3737.h"
#include "i2c_master.h"
#include "progmem.h"
#include "rgb_matrix.h"
#include "wait.h"
// This is a 7-bit address, that gets left-shifted and bit 0
// set to 0 for write, 1 for read (as per I2C protocol)
@ -156,12 +147,8 @@ void IS31FL3737_init(uint8_t addr) {
// Disable software shutdown.
IS31FL3737_write_register(addr, ISSI_REG_CONFIGURATION, 0x01);
// Wait 10ms to ensure the device has woken up.
#ifdef __AVR__
_delay_ms(10);
#else
// Wait 10ms to ensure the device has woken up.
wait_ms(10);
#endif
}
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) {
IS31FL3737_write_register(addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM);
IS31FL3737_write_pwm_buffer(addr1, g_pwm_buffer[0]);
// IS31FL3737_write_pwm_buffer( addr2, g_pwm_buffer[1] );
// IS31FL3737_write_pwm_buffer(addr2, g_pwm_buffer[1]);
}
g_pwm_buffer_update_required = false;
}
@ -229,7 +216,7 @@ void IS31FL3737_update_led_control_registers(uint8_t addr1, uint8_t addr2) {
IS31FL3737_write_register(addr1, ISSI_COMMANDREGISTER, ISSI_PAGE_LEDCONTROL);
for (int i = 0; i < 24; i++) {
IS31FL3737_write_register(addr1, i, g_led_control_registers[0][i]);
// IS31FL3737_write_register(addr2, i, g_led_control_registers[1][i] );
// IS31FL3737_write_register(addr2, i, g_led_control_registers[1][i]);
}
}
}

View File

@ -16,8 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef IS31FL3737_DRIVER_H
#define IS31FL3737_DRIVER_H
#pragma once
#include <stdint.h>
#include <stdbool.h>
@ -202,5 +201,3 @@ void IS31FL3737_update_led_control_registers(uint8_t addr1, uint8_t addr2);
#define L_10 0xBB
#define L_11 0xBC
#define L_12 0xBD
#endif // IS31FL3737_DRIVER_H