mostly compiling
This commit is contained in:
		
							parent
							
								
									161c68b48a
								
							
						
					
					
						commit
						874f5a5c07
					
				
					 20 changed files with 2955 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -16,7 +16,7 @@
 | 
			
		|||
 */
 | 
			
		||||
 | 
			
		||||
#include "is31fl3731.h"
 | 
			
		||||
#include <util/delay.h>
 | 
			
		||||
#include "wait.h"
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include "twi2c.h"
 | 
			
		||||
#include "progmem.h"
 | 
			
		||||
| 
						 | 
				
			
			@ -123,7 +123,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
 | 
			
		||||
  _delay_ms( 10 );
 | 
			
		||||
  wait_ms( 10 );
 | 
			
		||||
 | 
			
		||||
  // picture mode
 | 
			
		||||
  IS31FL3731_write_register( addr, ISSI_REG_CONFIG, ISSI_REG_CONFIG_PICTUREMODE );
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,12 +17,15 @@
 | 
			
		|||
#include "twi2c.h"
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <hal.h>
 | 
			
		||||
#include "hal_i2cslave.h"
 | 
			
		||||
#include "chprintf.h"
 | 
			
		||||
#include "memstreams.h"
 | 
			
		||||
#include "printf.h"
 | 
			
		||||
#include "matrix.h"
 | 
			
		||||
 | 
			
		||||
#ifdef I2C_SLAVE_ENABLE
 | 
			
		||||
 | 
			
		||||
#include "hal_i2cslave.h"
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * I2C slave test routine.
 | 
			
		||||
 *
 | 
			
		||||
| 
						 | 
				
			
			@ -39,6 +42,8 @@
 | 
			
		|||
 | 
			
		||||
I2CSlaveMsgCB twi2c_slave_message_process, catchError, clearAfterSend;
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
static uint8_t twi2c_address;
 | 
			
		||||
 | 
			
		||||
static const I2CConfig I2CConfig = {
 | 
			
		||||
| 
						 | 
				
			
			@ -60,6 +65,9 @@ uint8_t  txBody[MATRIX_ROWS/2];                       /* Return message buffer f
 | 
			
		|||
 | 
			
		||||
BaseSequentialStream *chp = NULL;           // Used for serial logging
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifdef I2C_SLAVE_ENABLE
 | 
			
		||||
 | 
			
		||||
// Handler when something sent to us
 | 
			
		||||
const I2CSlaveMsg echoRx =
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -102,6 +110,7 @@ I2CSlaveMsg echoReply = {  /* this is in RAM so size may be updated */
 | 
			
		|||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Track I2C errors
 | 
			
		||||
 */
 | 
			
		||||
| 
						 | 
				
			
			@ -131,6 +140,8 @@ extern void matrix_copy(matrix_row_t * copy);
 | 
			
		|||
 | 
			
		||||
const char hexString[16] = "0123456789abcdef";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 *  Message processor - looks at received message, determines reply as quickly as possible
 | 
			
		||||
 *
 | 
			
		||||
| 
						 | 
				
			
			@ -198,6 +209,8 @@ void twi2c_slave_task(void) {
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
uint8_t twi2c_start(uint8_t address) {
 | 
			
		||||
  twi2c_address = address;
 | 
			
		||||
  i2cStart(&I2C_DRIVER, &I2CConfig);
 | 
			
		||||
| 
						 | 
				
			
			@ -216,8 +229,9 @@ void twi2c_init(void) {
 | 
			
		|||
  // I2C_DRIVER.i2c->FLT = 4;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint8_t buffer[1] = {0};
 | 
			
		||||
 | 
			
		||||
uint8_t twi2c_write(uint8_t data) {
 | 
			
		||||
  uint8_t buffer[1] = {0};
 | 
			
		||||
  return i2cMasterTransmitTimeout(&I2C_DRIVER, twi2c_address/2, &data, 1, buffer, 1, MS2ST(100));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -24,10 +24,14 @@
 | 
			
		|||
#define slaveI2Caddress  0x30       /* Address in our terms - halved by later code */
 | 
			
		||||
//#define myOtherI2Caddress 0x19
 | 
			
		||||
 | 
			
		||||
#ifdef I2C_SLAVE_ENABLE
 | 
			
		||||
 | 
			
		||||
I2CSlaveMsgCB twi2c_slave_message_process, catchError, clearAfterSend;
 | 
			
		||||
 | 
			
		||||
void twi2c_slave_init(void);
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
void twi2c_init(void);
 | 
			
		||||
uint8_t twi2c_start(uint8_t address);
 | 
			
		||||
uint8_t twi2c_write(uint8_t data);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue