|
GPS Device
|
STM32F401RE I2C driver public API. More...


Go to the source code of this file.
Classes | |
| struct | I2C_CFG_ts |
| Configuration structure for initializing an I2C peripheral. More... | |
Macros | |
| #define | I2C_NAME_LEN 4 |
| Length of the null-terminated I2C peripheral name string (e.g. "I2C1"). | |
Enumerations | |
| enum | I2C_CLOCK_STRECH_te { I2C_CLOCK_STRETCH_ON , I2C_CLOCK_STRETCH_OFF } |
| I2C slave clock stretching enable/disable. More... | |
| enum | I2C_ACK_te { I2C_ACK_OFF , I2C_ACK_ON } |
| I2C acknowledge control. More... | |
| enum | I2C_SPEED_te { I2C_SPEED_100kHz = 100000 , I2C_SPEED_400kHz = 400000 } |
| I2C bus speed (SCL frequency). More... | |
Functions | |
| void | i2c_init (I2C_CFG_ts *i2c_cfg) |
| Initializes the I2C peripheral with the given configuration. | |
| void | i2c_deinit (I2C_REGDEF_ts const *i2c_instance) |
| Deinitializes the I2C peripheral and disables its clock. | |
| void | i2c_master_send (I2C_REGDEF_ts *i2c_instance, uint8_t slave_addr, uint8_t *tx_buffer, uint32_t len) |
| Blocking I2C master transmit. Sends a start condition, address, and data. | |
| void | i2c_master_send_continue (I2C_REGDEF_ts *i2c_instance, uint8_t *tx_buffer, uint32_t len) |
| Continues a transmission started by i2c_master_send without a new START or address phase. | |
| void | i2c_master_receive (I2C_REGDEF_ts *i2c_instance, uint8_t slave_addr, uint8_t *rx_buffer, uint32_t len) |
| Blocking I2C master receive. Sends a start condition, address, and reads data. | |
| void | i2c_master_set_comm (I2C_REGDEF_ts *i2c_instance, EN_STATUS_te en_status) |
| Enables or disables the I2C peripheral and controls bus ownership. | |
| void | i2c_get_name (I2C_REGDEF_ts const *i2c_instance, char *name) |
| Returns the name string of an I2C peripheral instance (e.g. "I2C1"). | |
STM32F401RE I2C driver public API.
This module provides a blocking master-mode I2C driver for the STM32F401RE. It supports standard mode (100 kHz) and fast mode (400 kHz) and handles peripheral clock management internally.
The driver separates bus ownership from peripheral initialization:
All transfer functions are blocking — they poll status flags and return only after the transfer completes.
Typical usage:
Definition in file stm32f401re_i2c.h.