|
TM STM32Fxxx HAL Libraries
v1.0.0
Libraries for STM32Fxxx (F0, F4 and F7 series) devices based on HAL drivers from ST from Tilen Majerle
|
Library Functions. More...
Functions | |
| TM_I2C_Result_t | TM_I2C_Init (I2C_TypeDef *I2Cx, TM_I2C_PinsPack_t pinspack, uint32_t clockSpeed) |
| Initializes I2C peripheral. More... | |
| TM_I2C_Result_t | TM_I2C_Read (I2C_TypeDef *I2Cx, uint8_t device_address, uint8_t register_address, uint8_t *data) |
| Reads single byte from device. More... | |
| TM_I2C_Result_t | TM_I2C_ReadMulti (I2C_TypeDef *I2Cx, uint8_t device_address, uint8_t register_address, uint8_t *data, uint16_t count) |
| Reads multiple bytes from device. More... | |
| TM_I2C_Result_t | TM_I2C_ReadNoRegister (I2C_TypeDef *I2Cx, uint8_t device_address, uint8_t *data) |
| Reads I2C data without specifying register address. More... | |
| TM_I2C_Result_t | TM_I2C_ReadMultiNoRegister (I2C_TypeDef *I2Cx, uint8_t device_address, uint8_t *data, uint16_t count) |
| Reads multiple bytes from device without specifying register address. More... | |
| TM_I2C_Result_t | TM_I2C_Read16 (I2C_TypeDef *I2Cx, uint8_t device_address, uint16_t register_address, uint8_t *data) |
| Reads single byte from device with 16-bit register address. More... | |
| TM_I2C_Result_t | TM_I2C_Write (I2C_TypeDef *I2Cx, uint8_t device_address, uint8_t register_address, uint8_t data) |
| Writes single byte to device. More... | |
| TM_I2C_Result_t | TM_I2C_WriteMulti (I2C_TypeDef *I2Cx, uint8_t device_address, uint16_t register_address, uint8_t *data, uint16_t count) |
| Writes multiple data to device. More... | |
| TM_I2C_Result_t | TM_I2C_WriteNoRegister (I2C_TypeDef *I2Cx, uint8_t device_address, uint8_t data) |
| Writes single byte to device without specifying register address, can be used for command write. More... | |
| TM_I2C_Result_t | TM_I2C_WriteMultiNoRegister (I2C_TypeDef *I2Cx, uint8_t device_address, uint8_t *data, uint16_t count) |
| Writes multiple data to device without register address. More... | |
| TM_I2C_Result_t | TM_I2C_Write16 (I2C_TypeDef *I2Cx, uint8_t device_address, uint16_t register_address, uint8_t data) |
| Writes single byte in a 16-bit length register address. More... | |
| TM_I2C_Result_t | TM_I2C_IsDeviceConnected (I2C_TypeDef *I2Cx, uint8_t address) |
| Checks if device is connected to I2C port and ready to use. More... | |
| void | TM_I2C_InitCustomPinsCallback (I2C_TypeDef *I2Cx, uint16_t AlternateFunction) |
| Callback for custom pins initialization. More... | |
| I2C_HandleTypeDef * | TM_I2C_GetHandle (I2C_TypeDef *I2Cx) |
| Gets pointer to I2C handle structure for specific I2C. More... | |
| TM_I2C_Result_t | TM_I2C_WriteReadRepeatedStart (I2C_TypeDef *I2Cx, uint8_t device_address, uint8_t write_register_address, uint8_t *write_data, uint16_t write_count, uint8_t read_register_address, uint8_t *read_data, uint16_t read_count) |
| Writes and receives amount of data via I2C using repeated start condition. More... | |
Library Functions.
| I2C_HandleTypeDef* TM_I2C_GetHandle | ( | I2C_TypeDef * | I2Cx | ) |
Gets pointer to I2C handle structure for specific I2C.
| *I2Cx | Pointer to I2Cx used for handle |
| Pointer | to I2C Handle structure |
| TM_I2C_Result_t TM_I2C_Init | ( | I2C_TypeDef * | I2Cx, |
| TM_I2C_PinsPack_t | pinspack, | ||
| uint32_t | clockSpeed | ||
| ) |
Initializes I2C peripheral.
| *I2Cx | Pointer to I2Cx peripheral you will use for iintialization |
| pinspack | Pinspack used for GPIO initialization. This parameter can be a value of TM_I2C_PinsPack_t enumeration |
| clockSpeed | Clock speed in units of Hz for I2C communication |
| Member | of TM_I2C_Result_t enumeration |
| void TM_I2C_InitCustomPinsCallback | ( | I2C_TypeDef * | I2Cx, |
| uint16_t | AlternateFunction | ||
| ) |
Callback for custom pins initialization.
When you call TM_I2C_Init() function, and if you pass TM_I2C_PinsPack_Custom to function, then this function will be called where you can initialize custom pins for I2C peripheral.
| *I2Cx | I2C for which initialization will be set |
| AlternateFunction | Alternate function which should be used for GPIO initialization |
| None |
| TM_I2C_Result_t TM_I2C_IsDeviceConnected | ( | I2C_TypeDef * | I2Cx, |
| uint8_t | address | ||
| ) |
Checks if device is connected to I2C port and ready to use.
| *I2Cx | Pointer to I2Cx peripheral to be used in communication |
| device_address | 7-bit, left aligned device address used for communication |
| Member | of TM_I2C_Result_t enumeration |
| TM_I2C_Result_t TM_I2C_Read | ( | I2C_TypeDef * | I2Cx, |
| uint8_t | device_address, | ||
| uint8_t | register_address, | ||
| uint8_t * | data | ||
| ) |
Reads single byte from device.
| *I2Cx | Pointer to I2Cx peripheral to be used in communication |
| device_address | 7-bit, left aligned device address used for communication |
| register_address | Register address from where read will be done |
| *data | Pointer to variable where data will be stored from read operation |
| Member | of TM_I2C_Result_t enumeration |
| TM_I2C_Result_t TM_I2C_Read16 | ( | I2C_TypeDef * | I2Cx, |
| uint8_t | device_address, | ||
| uint16_t | register_address, | ||
| uint8_t * | data | ||
| ) |
Reads single byte from device with 16-bit register address.
| *I2Cx | Pointer to I2Cx peripheral to be used in communication |
| device_address | 7-bit, left aligned device address used for communication |
| register_address | Register address from where read will be done |
| *data | Pointer to variable where data will be stored from read operation |
| Member | of TM_I2C_Result_t enumeration |
| TM_I2C_Result_t TM_I2C_ReadMulti | ( | I2C_TypeDef * | I2Cx, |
| uint8_t | device_address, | ||
| uint8_t | register_address, | ||
| uint8_t * | data, | ||
| uint16_t | count | ||
| ) |
Reads multiple bytes from device.
| *I2Cx | Pointer to I2Cx peripheral to be used in communication |
| device_address | 7-bit, left aligned device address used for communication |
| register_address | Register address from where read operation will start |
| *data | Pointer to variable where data will be stored from read operation |
| count | Number of elements to read from device |
| Member | of TM_I2C_Result_t enumeration |
| TM_I2C_Result_t TM_I2C_ReadMultiNoRegister | ( | I2C_TypeDef * | I2Cx, |
| uint8_t | device_address, | ||
| uint8_t * | data, | ||
| uint16_t | count | ||
| ) |
Reads multiple bytes from device without specifying register address.
| *I2Cx | Pointer to I2Cx peripheral to be used in communication |
| device_address | 7-bit, left aligned device address used for communication |
| *data | Pointer to variable where data will be stored from read operation |
| count | Number of elements to read from device |
| Member | of TM_I2C_Result_t enumeration |
| TM_I2C_Result_t TM_I2C_ReadNoRegister | ( | I2C_TypeDef * | I2Cx, |
| uint8_t | device_address, | ||
| uint8_t * | data | ||
| ) |
Reads I2C data without specifying register address.
| *I2Cx | Pointer to I2Cx peripheral to be used in communication |
| device_address | 7-bit, left aligned device address used for communication |
| *data | Pointer to variable where data will be stored from read operation |
| Member | of TM_I2C_Result_t enumeration |
| TM_I2C_Result_t TM_I2C_Write | ( | I2C_TypeDef * | I2Cx, |
| uint8_t | device_address, | ||
| uint8_t | register_address, | ||
| uint8_t | data | ||
| ) |
Writes single byte to device.
| *I2Cx | Pointer to I2Cx peripheral to be used in communication |
| device_address | 7-bit, left aligned device address used for communication |
| register_address | Register address where you want to write data |
| data | Data to be written to device |
| Member | of TM_I2C_Result_t enumeration |
| TM_I2C_Result_t TM_I2C_Write16 | ( | I2C_TypeDef * | I2Cx, |
| uint8_t | device_address, | ||
| uint16_t | register_address, | ||
| uint8_t | data | ||
| ) |
Writes single byte in a 16-bit length register address.
| *I2Cx | Pointer to I2Cx peripheral to be used in communication |
| device_address | 7-bit, left aligned device address used for communication |
| register_address | Register address where data will be written |
| data | Data byte to write |
| Member | of TM_I2C_Result_t enumeration |
| TM_I2C_Result_t TM_I2C_WriteMulti | ( | I2C_TypeDef * | I2Cx, |
| uint8_t | device_address, | ||
| uint16_t | register_address, | ||
| uint8_t * | data, | ||
| uint16_t | count | ||
| ) |
Writes multiple data to device.
| *I2Cx | Pointer to I2Cx peripheral to be used in communication |
| device_address | 7-bit, left aligned device address used for communication |
| register_address | Register address where data will be written |
| *data | Data to be written to device. |
| count | Number of elements to write starting at register register_address |
| Member | of TM_I2C_Result_t enumeration |
| TM_I2C_Result_t TM_I2C_WriteMultiNoRegister | ( | I2C_TypeDef * | I2Cx, |
| uint8_t | device_address, | ||
| uint8_t * | data, | ||
| uint16_t | count | ||
| ) |
Writes multiple data to device without register address.
| *I2Cx | Pointer to I2Cx peripheral to be used in communication |
| device_address | 7-bit, left aligned device address used for communication |
| *data | Pointer to data array t obe written to device. Array length is the same as number of elements you want to write |
| count | Number of elements to write |
| Member | of TM_I2C_Result_t enumeration |
| TM_I2C_Result_t TM_I2C_WriteNoRegister | ( | I2C_TypeDef * | I2Cx, |
| uint8_t | device_address, | ||
| uint8_t | data | ||
| ) |
Writes single byte to device without specifying register address, can be used for command write.
| *I2Cx | Pointer to I2Cx peripheral to be used in communication |
| device_address | 7-bit, left aligned device address used for communication |
| data | Data to be written to device |
| Member | of TM_I2C_Result_t enumeration |
| TM_I2C_Result_t TM_I2C_WriteReadRepeatedStart | ( | I2C_TypeDef * | I2Cx, |
| uint8_t | device_address, | ||
| uint8_t | write_register_address, | ||
| uint8_t * | write_data, | ||
| uint16_t | write_count, | ||
| uint8_t | read_register_address, | ||
| uint8_t * | read_data, | ||
| uint16_t | read_count | ||
| ) |
Writes and receives amount of data via I2C using repeated start condition.
| *I2Cx | Pointer to I2Cx peripheral to be used in communication |
| device_address | 7-bit, left aligned device address used for communication |
| write_register_address | Register address to start writing to |
| *write_data | Pointer to data array where data for write are stored |
| write_count | Number of elements to write |
| read_register_address | Register address where reading will start |
| *read_data | Pointer to array where data will be saved |
| read_count | Number of elements to read |
| Member | of TM_I2C_Result_t enumeration |