|
|
|
@ -64,14 +64,14 @@ typedef enum{
|
|
|
|
|
|
|
|
|
|
/*! Enum of possible I2C Address count */
|
|
|
|
|
typedef enum{
|
|
|
|
|
i2cAddressCountSingle, /*!< Only one adress for communication **DEFAULT** */
|
|
|
|
|
i2cAddressCountDual /*!< Dual adresses for one device respondng to two adresses */
|
|
|
|
|
i2cAddressCountSingle, /*!< Only one address for communication **DEFAULT** */
|
|
|
|
|
i2cAddressCountDual /*!< Dual addresses for one device respondng to two addresses */
|
|
|
|
|
}i2cAddressCount_t;
|
|
|
|
|
|
|
|
|
|
/*! Enum for clock strechning activation. Can only be implmented as Slave
|
|
|
|
|
* for more information : https://www.i2c-bus.org/clock-stretching/ */
|
|
|
|
|
typedef enum{
|
|
|
|
|
i2cCLockStrechingDisable, /*!< We assume that the master and slave have compatible
|
|
|
|
|
i2cClockStrechingDisable, /*!< We assume that the master and slave have compatible
|
|
|
|
|
Clock frequencies **DEFAULT** */
|
|
|
|
|
i2cClockStrechingEnable /*!< In situations where an I2C slave is not able to co-operate
|
|
|
|
|
with the clock speed given by the master and needs to slow down.
|
|
|
|
@ -82,7 +82,7 @@ typedef enum{
|
|
|
|
|
typedef enum{
|
|
|
|
|
i2cWakeUpDisabled, /*!< No wake up is possible this is the default mode also means that
|
|
|
|
|
the sleep function is not implmentes **DEFAULT** */
|
|
|
|
|
i2cWakeUpOnAddressMatch /*!< Wakes up on adress match, this can be harware dependent */
|
|
|
|
|
i2cWakeUpOnAddressMatch /*!< Wakes up on address match, this can be harware dependent */
|
|
|
|
|
}i2cWakeUpTypes_t;
|
|
|
|
|
|
|
|
|
|
/*! Enum operation mode of the i2c channel */
|
|
|
|
@ -113,14 +113,14 @@ typedef enum
|
|
|
|
|
} i2cState_t;
|
|
|
|
|
|
|
|
|
|
/*! Struture a an i2c channel with all the required propereties*/
|
|
|
|
|
typedef struct
|
|
|
|
|
typedef struct i2c_t
|
|
|
|
|
{
|
|
|
|
|
i2cCh_t channelNo; /*!< The harware channel to be used */
|
|
|
|
|
i2cMode_t mode; /*!< Master, Slave or Multymaster Modes */
|
|
|
|
|
uint16_t adress; /*!< First and Main address of the device */
|
|
|
|
|
uint16_t adressSecond; /*!< Second adress if dual adresse mode is configured */
|
|
|
|
|
i2cAddressCount_t addresCount; /*!< Single or multiple */
|
|
|
|
|
i2cAddressSize_t adressSize; /*!< 10 or 7 bit adress size */
|
|
|
|
|
uint16_t address; /*!< First and Main address of the device */
|
|
|
|
|
uint16_t addressSecond; /*!< 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 */
|
|
|
|
|
i2cClockStreching_t streching; /*!< Clock Streching enable onyl in slave mode */
|
|
|
|
@ -161,7 +161,7 @@ void i2cSetMode(i2c_t *i2cHardware, i2cMode_t mode);
|
|
|
|
|
* @param channel is the i2c hardware channel
|
|
|
|
|
* @param size Is the Adress isze to be used 7 Bit or 10 Bit
|
|
|
|
|
* @param addressOne The forst address for the device
|
|
|
|
|
* @param addressTwo The second address for the device only if dual adress mode is not defined
|
|
|
|
|
* @param addressTwo The second address for the device only if dual address mode is not defined
|
|
|
|
|
*/
|
|
|
|
|
void i2cSetAddress(i2c_t *i2cHardware, i2cAddressSize_t size, uint16_t addressOne, uint16_t addressTwo);
|
|
|
|
|
|
|
|
|
@ -206,6 +206,12 @@ void i2cSetTimeout(i2c_t *i2cHardware, uint8_t timeout);
|
|
|
|
|
* @brief Resets the i2c Periferal to it's inital state.
|
|
|
|
|
* @param channel is the beforehand declared i2c channel with his opperation modes
|
|
|
|
|
*/
|
|
|
|
|
void i2cPeriferalReset(i2c_t *i2cHardware);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Resets the i2c to it's inital state.
|
|
|
|
|
* @param channel is the beforehand declared i2c channel with his opperation modes
|
|
|
|
|
*/
|
|
|
|
|
void i2cReset(i2c_t *i2cHardware);
|
|
|
|
|
|
|
|
|
|
/**************************************************************************************************
|
|
|
|
@ -333,7 +339,7 @@ void i2cBusClear(); // I2C Standart : in case if SCL is stuck
|
|
|
|
|
***************************************************************************************************/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief This function will scan every for possible adresses to discover devices on the bus.
|
|
|
|
|
* @brief This function will scan every for possible addresses to discover devices on the bus.
|
|
|
|
|
* And write them to the Devices list given to him. This function will not discover more
|
|
|
|
|
* devices than what he is told.
|
|
|
|
|
* @param channel is the beforehand declared i2c channel with his opperation modes
|
|
|
|
|