Separate the configuration to hardware configuration and user configuration. Implement async I2C EEPROM handling. Remove USB functions that dealt with EEPROM and individual LEDs because they were dependent on sync I2C functions.

This commit is contained in:
László Monda
2017-07-22 23:49:47 +02:00
parent cbb0a02f19
commit 8ed4a6ba09
8 changed files with 153 additions and 64 deletions

View File

@@ -1,28 +0,0 @@
#include "fsl_i2c.h"
#include "i2c_addresses.h"
status_t I2cRead(I2C_Type *baseAddress, uint8_t i2cAddress, uint8_t *data, uint8_t size)
{
i2c_master_transfer_t masterXfer;
masterXfer.slaveAddress = i2cAddress;
masterXfer.direction = kI2C_Read;
masterXfer.subaddress = 0;
masterXfer.subaddressSize = 0;
masterXfer.data = data;
masterXfer.dataSize = size;
masterXfer.flags = kI2C_TransferDefaultFlag;
return I2C_MasterTransferBlocking(baseAddress, &masterXfer);
}
status_t I2cWrite(I2C_Type *baseAddress, uint8_t i2cAddress, uint8_t *data, uint8_t size)
{
i2c_master_transfer_t masterXfer;
masterXfer.slaveAddress = i2cAddress;
masterXfer.direction = kI2C_Write;
masterXfer.subaddress = 0;
masterXfer.subaddressSize = 0;
masterXfer.data = data;
masterXfer.dataSize = size;
masterXfer.flags = kI2C_TransferDefaultFlag;
return I2C_MasterTransferBlocking(baseAddress, &masterXfer);
}

View File

@@ -27,9 +27,4 @@
#define IS_I2C_LED_DRIVER_ADDRESS(address) \
(I2C_ADDRESS_LED_DRIVER_LEFT <= (address) && (address) <= I2C_ADDRESS_LED_DRIVER_RIGHT)
// Functions:
status_t I2cRead(I2C_Type *baseAddress, uint8_t i2cAddress, uint8_t *data, uint8_t size);
status_t I2cWrite(I2C_Type *baseAddress, uint8_t i2cAddress, uint8_t *data, uint8_t size);
#endif