|
|
|
@ -4,17 +4,17 @@
|
|
|
|
|
//uint32_t i2cCR2;
|
|
|
|
|
//uint32_t i2cISR;
|
|
|
|
|
|
|
|
|
|
void i2cInit( i2c_t *i2cHardware, /*!< Pointer to I2C hardware Object */
|
|
|
|
|
i2cCh_t channelNo, /*!< The harware channel to be used */
|
|
|
|
|
i2cMode_t mode, /*!< Master, Slave or Multymaster Modes */
|
|
|
|
|
uint16_t mainAddress, /*!< First and Main address of the device */
|
|
|
|
|
uint16_t secondAddress, /*!< Second address if dual addresse mode is configured */
|
|
|
|
|
i2cAddressCount_t addressCount, /*!< Single or multiple */
|
|
|
|
|
i2cAddressSize_t addressSize, /*!< 10 or 7 bit address size */
|
|
|
|
|
i2cSpeed_t speed, /*!< Bus Speed */
|
|
|
|
|
i2cOpperationMode_t opperationMode, /*!< Blocking or non blocking polling, Int or DMA */
|
|
|
|
|
i2cClockStretching_t stretching, /*!< Clock Stretching enable onyl in slave mode */
|
|
|
|
|
i2cWakeUpTypes_t wakeOn) /*!< Wake up condition */
|
|
|
|
|
void i2cInit( i2c_t *i2cHardware,
|
|
|
|
|
i2cCh_t channelNo,
|
|
|
|
|
i2cMode_t mode,
|
|
|
|
|
uint16_t mainAddress,
|
|
|
|
|
uint16_t secondAddress,
|
|
|
|
|
i2cAddressCount_t addressCount,
|
|
|
|
|
i2cAddressSize_t addressSize,
|
|
|
|
|
i2cSpeed_t speed,
|
|
|
|
|
i2cOpperationMode_t opperationMode,
|
|
|
|
|
i2cClockStretching_t stretching,
|
|
|
|
|
i2cWakeUpTypes_t wakeOn)
|
|
|
|
|
{
|
|
|
|
|
i2cHardware->channelNo = channelNo;
|
|
|
|
|
i2cHardware->mode = mode;
|
|
|
|
@ -71,7 +71,7 @@ void i2cRead(i2c_t *i2cHardware, uint16_t *slaveAddress, uint8_t *registerAddres
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// this function still doesn't implment 10 bit oopeartion TODO
|
|
|
|
|
// this function still doesn't implment 10 bit oopeartion
|
|
|
|
|
void i2cMasterRecieve(i2c_t *i2cHardware, uint16_t *slaveAddress, uint8_t *registerAddress, uint8_t *data)
|
|
|
|
|
{
|
|
|
|
|
switch(i2cHardware->opperationMode)
|
|
|
|
|