wip
This commit is contained in:
		
							parent
							
								
									5e66140fbc
								
							
						
					
					
						commit
						471722f495
					
				
					 5 changed files with 11 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -67,9 +67,10 @@ uint8_t i2c_start(uint8_t address)
 | 
			
		|||
 | 
			
		||||
int8_t i2c_transmit(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout)
 | 
			
		||||
{
 | 
			
		||||
  //xprintf("i2c_transmit(0x%x, 0x%x, %d, 0x%x) address:0x%x\n", address, data, length, timeout, address >> 1);
 | 
			
		||||
  i2c_address = address;
 | 
			
		||||
  i2cStart(&I2C_DRIVER, &i2cconfig);
 | 
			
		||||
  int8_t result = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), data, length, 0, 0, MS2ST(timeout));
 | 
			
		||||
  int8_t result = i2cMasterTransmitTimeout(&I2C_DRIVER, i2c_address, data, length, 0, 0, MS2ST(timeout));
 | 
			
		||||
  return result;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -42,7 +42,7 @@
 | 
			
		|||
#define ISSI_BANK_FUNCTIONREG 0x0B    // FIXME: Not on 3235?
 | 
			
		||||
 | 
			
		||||
#ifndef ISSI_TIMEOUT
 | 
			
		||||
  #define ISSI_TIMEOUT 255
 | 
			
		||||
  #define ISSI_TIMEOUT 100
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef ISSI_PERSISTENCE
 | 
			
		||||
| 
						 | 
				
			
			@ -79,12 +79,12 @@ void IS31FL3235A_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
 | 
			
		|||
 | 
			
		||||
    #if ISSI_PERSISTENCE > 0
 | 
			
		||||
        for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
 | 
			
		||||
            if (i2c_transmit(addr << 1, g_3235a_transfer_buffer, 2, ISSI_TIMEOUT) == 0) {
 | 
			
		||||
            if (i2c_transmit(addr, g_3235a_transfer_buffer, 2, ISSI_TIMEOUT) == 0) {
 | 
			
		||||
              break;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    #else
 | 
			
		||||
        if (i2c_transmit(addr << 1, g_3235a_transfer_buffer, 2, ISSI_TIMEOUT) == -1) {
 | 
			
		||||
        if (i2c_transmit(addr, g_3235a_transfer_buffer, 2, ISSI_TIMEOUT) == -1) {
 | 
			
		||||
            // When we encounter a timeout ChibiOS says the bus must be reset as it's in an unknown state
 | 
			
		||||
            xprintf("i2c transmit timeout, resetting i2c bus!\n");
 | 
			
		||||
            i2c_stop(ISSI_TIMEOUT);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,6 +33,7 @@
 | 
			
		|||
#endif
 | 
			
		||||
#ifndef IS31FL3235A_DRIVER_ADDR_1
 | 
			
		||||
    #define IS31FL3235A_DRIVER_ADDR_1 0b0111111
 | 
			
		||||
    //#define IS31FL3235A_DRIVER_ADDR_1 0x7E
 | 
			
		||||
#endif
 | 
			
		||||
#ifndef IS31FL3235A_DRIVER_ADDR_2
 | 
			
		||||
    #define IS31FL3235A_DRIVER_ADDR_2 0b0111110
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -132,10 +132,12 @@
 | 
			
		|||
 | 
			
		||||
// For the rgb7seg
 | 
			
		||||
#define IS31FL3235A_COUNT 1
 | 
			
		||||
/*
 | 
			
		||||
#define I2C_DRIVER I2CD2
 | 
			
		||||
#define I2C1_BANK GPIOA
 | 
			
		||||
#define I2C1_SCL 9
 | 
			
		||||
#define I2C1_SDA 10
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
// 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)
 | 
			
		||||
| 
						 | 
				
			
			@ -147,10 +149,10 @@
 | 
			
		|||
#define LED_DRIVER_ADDR_1 0b1110100
 | 
			
		||||
 | 
			
		||||
/* For the LED driver
 | 
			
		||||
 */
 | 
			
		||||
#define I2C1_BANK GPIOB
 | 
			
		||||
#define I2C1_SCL 8
 | 
			
		||||
#define I2C1_SDA 9
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#define LED_DRIVER_COUNT 1
 | 
			
		||||
#define LED_DRIVER_LED_COUNT 71
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -39,10 +39,10 @@ OPT_DEFS =
 | 
			
		|||
DFU_ARGS = -d 0483:df11 -a 0 -s 0x08000000:leave
 | 
			
		||||
 | 
			
		||||
# LED Configuration
 | 
			
		||||
#LED_MATRIX_ENABLE = IS31FL3731
 | 
			
		||||
LED_MATRIX_ENABLE = IS31FL3731
 | 
			
		||||
 | 
			
		||||
# QWIIC Devices
 | 
			
		||||
QWIIC_ENABLE = RGB7SEG
 | 
			
		||||
#QWIIC_ENABLE = RGB7SEG
 | 
			
		||||
 | 
			
		||||
# Build Options
 | 
			
		||||
#   comment out to disable the options.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue