|
|
@ -104,26 +104,40 @@ typedef enum{
|
|
|
|
/*! typedef for the i2c states*/
|
|
|
|
/*! typedef for the i2c states*/
|
|
|
|
typedef enum
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
{
|
|
|
|
i2cNotInitialized, /*!< Default Peripheral is not yet Initialized **DEFAULT** */
|
|
|
|
i2cHwIdle, /*!< Hardware is in Idle Mode **DEFAULT** */
|
|
|
|
i2cInitialized, /*!< I2C CHannle is initilized but not neceserly ready */
|
|
|
|
i2cHwStartGenerated, /*!< Generated the star condition */
|
|
|
|
i2cStartGenrated, /*!< Generated the star condition */
|
|
|
|
i2cHwOutputBufferFull, /*!< The output buffer of the I2C Periferal is Full */
|
|
|
|
i2cSlaveAddressSent, /*!< The Salve Address Was Sent to the bus */
|
|
|
|
i2cHwOutputBufferEmpty, /*!< The output buffer of the I2C Periferal is Empty */
|
|
|
|
i2cOutputBufferFull, /*!< The output buffer of the I2C Periferal is Full */
|
|
|
|
i2cHwInputBufferFull, /*!< The input buffer of the I2C Periferal Is Full */
|
|
|
|
i2cOutputBufferEmpty, /*!< The output buffer of the I2C Periferal is Empty */
|
|
|
|
i2cHwInputBufferEmpty, /*!< The input buffer of the I2C Periferal Is Empty */
|
|
|
|
i2cInputBufferFull, /*!< The input buffer of the I2C Periferal Is Full */
|
|
|
|
i2cHwSentRead, /*!< Sent read request */
|
|
|
|
i2cInputBufferEmpty, /*!< The input buffer of the I2C Periferal Is Empty */
|
|
|
|
i2cHwSentWrite, /*!< Sent write request */
|
|
|
|
i2cReady, /*!< Peripheral Initialized and ready for use */
|
|
|
|
i2cHwGotAck, /*!< Recieved ACK */
|
|
|
|
i2cBusy, /*!< An internal process is ongoing */
|
|
|
|
i2cHwGotNack, /*!< Recieved NACK */
|
|
|
|
i2cSlaveNotFound, /*!< Desired Slave was not able to be found */
|
|
|
|
i2cHwSentAck, /*!< Sent ACK */
|
|
|
|
i2cTransmitting, /*!< Data Transmission process is ongoing */
|
|
|
|
i2cHwSentNack, /*!< Sent NACK */
|
|
|
|
i2cRecieving, /*!< Data Reception process is ongoing */
|
|
|
|
i2cHwStopGenerated, /*!< Generated the star condition */
|
|
|
|
i2cListening, /*!< Address Listen Mode is ongoing */
|
|
|
|
i2cHwError /*!< Error */
|
|
|
|
i2cListeningAndTransmitting,/*!< Address Listen Mode and ongoing Data Transmission */
|
|
|
|
} i2cHardwareState_t;
|
|
|
|
i2cListeningAndRecieveing, /*!< Address Listen Mode and ongoing Data Reception */
|
|
|
|
|
|
|
|
i2cAbort, /*!< Abort user request ongoing */
|
|
|
|
typedef enum
|
|
|
|
i2cTimeout, /*!< Timeout state */
|
|
|
|
{
|
|
|
|
i2cError /*!< Error */
|
|
|
|
i2cPerifNotInitialized, /*!< Default Peripheral is not yet Initialized **DEFAULT** */
|
|
|
|
} i2cState_t;
|
|
|
|
i2cPerifInitialized, /*!< I2C CHannle is initilized but not neceserly ready */
|
|
|
|
|
|
|
|
i2cPerifSlaveAddressSent, /*!< The Salve Address Was Sent to the bus */
|
|
|
|
|
|
|
|
i2cPerifTransferComplete, /*!< A full communication process is complete (wire or Read) */
|
|
|
|
|
|
|
|
i2cPerifTransferOngoign, /*!< A full communication process is in progress (wire or Read) */
|
|
|
|
|
|
|
|
i2cPerifReady, /*!< Peripheral Initialized and ready for use */
|
|
|
|
|
|
|
|
i2cPerifSlaveNotFound, /*!< Desired Slave was not able to be found */
|
|
|
|
|
|
|
|
i2cPerifTransmitting, /*!< Data Transmission process is ongoing */
|
|
|
|
|
|
|
|
i2cPerifRecieving, /*!< Data Reception process is ongoing */
|
|
|
|
|
|
|
|
i2cPerifListening, /*!< Address Listen Mode is ongoing */
|
|
|
|
|
|
|
|
i2cPerifListeningAndTransmitting, /*!< Address Listen Mode and ongoing Data Transmission */
|
|
|
|
|
|
|
|
i2cPerifListeningAndRecieveing, /*!< Address Listen Mode and ongoing Data Reception */
|
|
|
|
|
|
|
|
i2cPerifAbort, /*!< Abort user request ongoing */
|
|
|
|
|
|
|
|
i2cPerifTimeout, /*!< Timeout state */
|
|
|
|
|
|
|
|
i2cPerifError /*!< Error */
|
|
|
|
|
|
|
|
} i2cPeriferalState_t;
|
|
|
|
|
|
|
|
|
|
|
|
/*! Struture a an i2c channel with all the required propereties*/
|
|
|
|
/*! Struture a an i2c channel with all the required propereties*/
|
|
|
|
typedef struct i2c_t
|
|
|
|
typedef struct i2c_t
|
|
|
@ -139,7 +153,8 @@ typedef struct i2c_t
|
|
|
|
i2cClockStretching_t stretching; /*!< Clock Stretching enable onyl in slave mode */
|
|
|
|
i2cClockStretching_t stretching; /*!< Clock Stretching enable onyl in slave mode */
|
|
|
|
i2cWakeUpTypes_t wakeOn; /*!< Define on which type of action the i2c channel should
|
|
|
|
i2cWakeUpTypes_t wakeOn; /*!< Define on which type of action the i2c channel should
|
|
|
|
wake up. Only if de prefiral goes to sleep */
|
|
|
|
wake up. Only if de prefiral goes to sleep */
|
|
|
|
i2cState_t state; /*!< The current sitate of the I2C Bus */
|
|
|
|
i2cHardwareState_t hardwareState; /*!< The current sitate of the I2C Bus */
|
|
|
|
|
|
|
|
i2cPeriferalState_t periferalState; /*!< The current sitate of the I2C Bus */
|
|
|
|
}i2c_t;
|
|
|
|
}i2c_t;
|
|
|
|
|
|
|
|
|
|
|
|
/***************************************************************************************************
|
|
|
|
/***************************************************************************************************
|
|
|
@ -273,12 +288,12 @@ void i2cDisablePeriferal(i2c_t *i2cHardware);
|
|
|
|
* Depending if the I2C channel was initiated as slave or master.
|
|
|
|
* Depending if the I2C channel was initiated as slave or master.
|
|
|
|
* this function will adapt himself to the selected oppeartion mode (Polling / Int / DMA)
|
|
|
|
* this function will adapt himself to the selected oppeartion mode (Polling / Int / DMA)
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
* @param devAddress is the address of the device to which the read command will be sent
|
|
|
|
* @param slaveAddress is the address of the device to which the read command will be sent
|
|
|
|
* @param registerAddress is the regiter to be red from the device
|
|
|
|
* @param registerAddress is the regiter to be red from the device
|
|
|
|
* @param data is the data to be written
|
|
|
|
* @param data is the data to be written
|
|
|
|
* @param dataLenght is the total quantity of 8 bit data to be written.
|
|
|
|
* @param dataLenght is the total quantity of 8 bit data to be written.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void i2cWrite(i2c_t *i2cHardware, uint16_t *devAddress, uint8_t *registerAddress, uint8_t *data, uint8_t dataLenght);
|
|
|
|
void i2cWrite(i2c_t *i2cHardware, uint16_t *slaveAddress, uint8_t *registerAddress, uint8_t *data, uint8_t *dataLenght);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief Reads the given amount of data to the selected device. This function will
|
|
|
|
* @brief Reads the given amount of data to the selected device. This function will
|
|
|
@ -286,51 +301,51 @@ void i2cWrite(i2c_t *i2cHardware, uint16_t *devAddress, uint8_t *registerAddress
|
|
|
|
* Depending if the I2C channel was initiated as slave or master.
|
|
|
|
* Depending if the I2C channel was initiated as slave or master.
|
|
|
|
* this function will adapt himself to the selected oppeartion mode (Polling / Int / DMA)
|
|
|
|
* this function will adapt himself to the selected oppeartion mode (Polling / Int / DMA)
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
* @param devAddress is the address of the device to which the read command will be sent
|
|
|
|
* @param slaveAddress is the address of the device to which the read command will be sent
|
|
|
|
* @param registerAddress is the regiter to be red from the device
|
|
|
|
* @param registerAddress is the regiter to be red from the device
|
|
|
|
* @param data is the data which has been red
|
|
|
|
* @param data is the data which has been red
|
|
|
|
* @paran dataLenght is the total quantity of 8 bit data to be red
|
|
|
|
* @paran dataLenght is the total quantity of 8 bit data to be red
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void i2cRead(i2c_t *i2cHardware, uint16_t *devAddress, uint8_t *registerAddress, uint8_t *data, uint8_t dataLenght);
|
|
|
|
void i2cRead(i2c_t *i2cHardware, uint16_t *slaveAddress, uint8_t *registerAddress, uint8_t *data, uint8_t *dataLenght);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief Recieve a Single Byte as master from from the given devices register.
|
|
|
|
* @brief Recieve a Single Byte as master from from the given devices register.
|
|
|
|
* this function will adapt himself to the selected oppeartion mode (Polling / Int / DMA)
|
|
|
|
* this function will adapt himself to the selected oppeartion mode (Polling / Int / DMA)
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
* @param devAddress is the address of the device to which the read command will be sent
|
|
|
|
* @param slaveAddress is the address of the device to which the read command will be sent
|
|
|
|
* @param registerAddress is the regiter to be red from the device
|
|
|
|
* @param registerAddress is the regiter to be red from the device
|
|
|
|
* @param data is the data whic has been red
|
|
|
|
* @param data is the data whic has been red
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void i2cMasterRecieve(i2c_t *i2cHardware, uint16_t slaveAddress, uint8_t registerAddress, uint8_t *data);
|
|
|
|
void i2cMasterRecieve(i2c_t *i2cHardware, uint16_t *slaveAddress, uint8_t *registerAddress, uint8_t *data);
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief Sends a Single Byte as master to the given devices register.
|
|
|
|
* @brief Sends a Single Byte as master to the given devices register.
|
|
|
|
* this function will adapt himself to the selected oppeartion mode (Polling / Int / DMA)
|
|
|
|
* this function will adapt himself to the selected oppeartion mode (Polling / Int / DMA)
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
* @param devAddress is the address of the device to which the send command will be sent
|
|
|
|
* @param slaveAddress is the address of the device to which the send command will be sent
|
|
|
|
* @param registerAddress is the regiter to be written to the device
|
|
|
|
* @param registerAddress is the regiter to be written to the device
|
|
|
|
* @param data is the data to be sent
|
|
|
|
* @param data is the data to be sent
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void i2cMasterSend(i2c_t *i2cHardware, uint16_t *devAddress, uint8_t *registerAddress, uint8_t *data);
|
|
|
|
void i2cMasterSend(i2c_t *i2cHardware, uint16_t *slaveAddress, uint8_t *registerAddress, uint8_t *data);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief Recieve a Single Byte as slave from given devices register.
|
|
|
|
* @brief Recieve a Single Byte as slave from given devices register.
|
|
|
|
* this function will adapt himself to the selected oppeartion mode (Polling / Int / DMA)
|
|
|
|
* this function will adapt himself to the selected oppeartion mode (Polling / Int / DMA)
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
* @param devAddress is the address of the device to which the read command will be sent
|
|
|
|
* @param slaveAddress is the address of the device to which the read command will be sent
|
|
|
|
* @param registerAddress is the regiter to be red from the device
|
|
|
|
* @param registerAddress is the regiter to be red from the device
|
|
|
|
* @param data is the data whic has been red
|
|
|
|
* @param data is the data whic has been red
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void i2cSlaveRecieve(i2c_t *i2cHardware, uint16_t *devAddress, uint8_t *registerAddress, uint8_t *data);
|
|
|
|
void i2cSlaveRecieve(i2c_t *i2cHardware, uint16_t *slaveAddress, uint8_t *registerAddress, uint8_t *data);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief Recieve a Single Byte as slave from the given devices register.
|
|
|
|
* @brief Recieve a Single Byte as slave from the given devices register.
|
|
|
|
* this function will adapt himself to the selected oppeartion mode (Polling / Int / DMA)
|
|
|
|
* this function will adapt himself to the selected oppeartion mode (Polling / Int / DMA)
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
* @param devAddress is the address of the device to which the read command will be sent
|
|
|
|
* @param slaveAddress is the address of the device to which the read command will be sent
|
|
|
|
* @param registerAddress is the regiter to be red from the device
|
|
|
|
* @param registerAddress is the regiter to be red from the device
|
|
|
|
* @param data is the data whic has been red
|
|
|
|
* @param data is the data whic has been red
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void i2cSlaveSend(i2c_t *i2cHardware, uint16_t *devAddress, uint8_t *registerAddress, uint8_t *data);
|
|
|
|
void i2cSlaveSend(i2c_t *i2cHardware, uint16_t *slaveAddress, uint8_t *registerAddress, uint8_t *data);
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************************************
|
|
|
|
/**************************************************************************************************
|
|
|
|
I2C Hardware functions
|
|
|
|
I2C Hardware functions
|
|
|
@ -341,12 +356,6 @@ void i2cSlaveSend(i2c_t *i2cHardware, uint16_t *devAddress, uint8_t *registerAdd
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void i2cIsPeriferalReady(i2c_t *i2cHardware);
|
|
|
|
void i2cIsPeriferalReady(i2c_t *i2cHardware);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @brief Checks if the device is ready for any type of communication
|
|
|
|
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
void i2cWaitForPeriferal(i2c_t *i2cHardware);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief Generates a Start condition.
|
|
|
|
* @brief Generates a Start condition.
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
@ -377,14 +386,14 @@ void i2cGenerateAck(i2c_t *i2cHardware);
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
* @param slaveAddress The address of the slave to be communicated
|
|
|
|
* @param slaveAddress The address of the slave to be communicated
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void i2cSendSlaveAddress(i2c_t *i2cHardware, uint16_t slaveAddress);
|
|
|
|
void i2cSendSlaveAddress(i2c_t *i2cHardware, uint16_t *slaveAddress);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief Send the register that we want to read or write.
|
|
|
|
* @brief Send the register that we want to read or write.
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
* @param registerAddress the register that need to be accessed
|
|
|
|
* @param registerAddress the register that need to be accessed
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void i2cSendRegisterAddress(i2c_t *i2cHardware, uint8_t registerAddress);
|
|
|
|
void i2cSendRegisterAddress(i2c_t *i2cHardware, uint8_t *registerAddress);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief Initiates a Write command with the previously set slave address.
|
|
|
|
* @brief Initiates a Write command with the previously set slave address.
|
|
|
@ -411,6 +420,30 @@ void i2cIsOutputBufferEmpty(i2c_t *i2cHardware);
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void i2cIsInputBufferEmpty(i2c_t *i2cHardware);
|
|
|
|
void i2cIsInputBufferEmpty(i2c_t *i2cHardware);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @brief reads the I2C input buffer
|
|
|
|
|
|
|
|
* is sent to the i2c BUS.
|
|
|
|
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
|
|
|
|
* @param data pointer to the data that need to be read and returned
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
void i2cReadInputRegister(i2c_t *i2cHardware, uint8_t *data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @brief writes to the I2C output buffer
|
|
|
|
|
|
|
|
* is sent to the i2c BUS.
|
|
|
|
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
|
|
|
|
* @param data pointer to the data that need to be read and returned
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
void i2cSetOutputRegister(i2c_t *i2cHardware, uint8_t *data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @brief Checks is transfer is complete
|
|
|
|
|
|
|
|
* is sent to the i2c BUS.
|
|
|
|
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
|
|
|
|
* @param data pointer to the data that need to be read and returned
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
void i2cIsTransferComplete(i2c_t *i2cHardware);
|
|
|
|
/**************************************************************************************************
|
|
|
|
/**************************************************************************************************
|
|
|
|
I2C Communication functions Polling / Blocking Mode
|
|
|
|
I2C Communication functions Polling / Blocking Mode
|
|
|
|
***************************************************************************************************/
|
|
|
|
***************************************************************************************************/
|
|
|
@ -418,37 +451,37 @@ void i2cIsInputBufferEmpty(i2c_t *i2cHardware);
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief Recieve a Single Byte in polling mode as master from from the given devices register.
|
|
|
|
* @brief Recieve a Single Byte in polling mode as master from from the given devices register.
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
* @param devAddress is the address of the device to which the read command will be sent
|
|
|
|
* @param slaveAddress is the address of the device to which the read command will be sent
|
|
|
|
* @param registerAddress is the regiter to be red from the device
|
|
|
|
* @param registerAddress is the regiter to be red from the device
|
|
|
|
* @param data is the data whic has been red
|
|
|
|
* @param data is the data whic has been red
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void i2cMasterRecievePolling(i2c_t *i2cHardware, uint16_t *devAddress, uint8_t *registerAddress, uint8_t *data);
|
|
|
|
void i2cMasterRecievePolling(i2c_t *i2cHardware, uint16_t *slaveAddress, uint8_t *registerAddress, uint8_t *data);
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief Sends a Single Byte in polling mode as master to the given devices register.
|
|
|
|
* @brief Sends a Single Byte in polling mode as master to the given devices register.
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
* @param devAddress is the address of the device to which the send command will be sent
|
|
|
|
* @param slaveAddress is the address of the device to which the send command will be sent
|
|
|
|
* @param registerAddress is the regiter to be written to the device
|
|
|
|
* @param registerAddress is the regiter to be written to the device
|
|
|
|
* @param data is the data to be sent
|
|
|
|
* @param data is the data to be sent
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void i2cMasterSendPolling(i2c_t *i2cHardware, uint16_t *devAddress, uint8_t *registerAddress, uint8_t *data);
|
|
|
|
void i2cMasterSendPolling(i2c_t *i2cHardware, uint16_t *slaveAddress, uint8_t *registerAddress, uint8_t *data);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief Recieve a Single Byte in polling mide as slave from the given devices register.
|
|
|
|
* @brief Recieve a Single Byte in polling mide as slave from the given devices register.
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
* @param devAddress is the address of the device to which the read command will be sent
|
|
|
|
* @param slaveAddress is the address of the device to which the read command will be sent
|
|
|
|
* @param registerAddress is the regiter to be red from the device
|
|
|
|
* @param registerAddress is the regiter to be red from the device
|
|
|
|
* @param data is the data whic has been red
|
|
|
|
* @param data is the data whic has been red
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void i2cSlaveRecievePolling(i2c_t *i2cHardware, uint16_t *devAddress, uint8_t *registerAddress, uint8_t *data);
|
|
|
|
void i2cSlaveRecievePolling(i2c_t *i2cHardware, uint16_t *slaveAddress, uint8_t *registerAddress, uint8_t *data);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief Recieve a Single Byte in polling mode as slave from the given devices register.
|
|
|
|
* @brief Recieve a Single Byte in polling mode as slave from the given devices register.
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
* @param devAddress is the address of the device to which the read command will be sent
|
|
|
|
* @param slaveAddress is the address of the device to which the read command will be sent
|
|
|
|
* @param registerAddress is the regiter to be red from the device
|
|
|
|
* @param registerAddress is the regiter to be red from the device
|
|
|
|
* @param data is the data whic has been red
|
|
|
|
* @param data is the data whic has been red
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
void i2cSlaveSendPolling(i2c_t *i2cHardware, uint16_t *devAddress, uint8_t *registerAddress, uint8_t *data);
|
|
|
|
void i2cSlaveSendPolling(i2c_t *i2cHardware, uint16_t *slaveAddress, uint8_t *registerAddress, uint8_t *data);
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************************************
|
|
|
|
/**************************************************************************************************
|
|
|
|
I2C Arbitration Functions for Multymaster mode and slaves clock stretching
|
|
|
|
I2C Arbitration Functions for Multymaster mode and slaves clock stretching
|
|
|
@ -478,17 +511,17 @@ void i2cDiscoverDevices(i2c_t *i2cHardware, uint16_t *devices, uint8_t deviceCou
|
|
|
|
* @brief This function will try to communicate with a device with every speed
|
|
|
|
* @brief This function will try to communicate with a device with every speed
|
|
|
|
* allowed by his hardware to find out the maximum communication sppeed possible.
|
|
|
|
* allowed by his hardware to find out the maximum communication sppeed possible.
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
* @param devAddress is the address of the device to which the read command will be sent
|
|
|
|
* @param slaveAddress is the address of the device to which the read command will be sent
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
i2cSpeed_t i2cTestDeviceSpeed(i2c_t *i2cHardware, uint16_t *devAddress);
|
|
|
|
i2cSpeed_t i2cTestDeviceSpeed(i2c_t *i2cHardware, uint16_t *slaveAddress);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief This function will read the device info register (if awailable) as follows :
|
|
|
|
* @brief This function will read the device info register (if awailable) as follows :
|
|
|
|
* I2c Standart : 3 Bytes (24 bits) | 12 Bits : Manufacturer info | 9 Bits: Part Identification | 3 Bits DIE Rev.
|
|
|
|
* I2c Standart : 3 Bytes (24 bits) | 12 Bits : Manufacturer info | 9 Bits: Part Identification | 3 Bits DIE Rev.
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
* @param i2cHardware is the beforehand declared i2c channel with his opperation modes
|
|
|
|
* @param devAddress is the address of the device to be red
|
|
|
|
* @param slaveAddress is the address of the device to be red
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
uint32_t i2cReadDeviceInfo(i2c_t *i2cHardware, uint16_t *devAddress);
|
|
|
|
uint32_t i2cReadDeviceInfo(i2c_t *i2cHardware, uint16_t *slaveAddress);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief The selected i2c channel is put on sleep.
|
|
|
|
* @brief The selected i2c channel is put on sleep.
|
|
|
|