GlobLib
HAL and API libraries for MCUs and hardware.
stm32f103cb_i2c.h
Go to the documentation of this file.
1 #ifndef STM32F103CB_I2C_H_
2 #define STM32F103CB_I2C_H_
3 
49 #include "stm32f103cb_gpio.h"
50 #include "stm32f103cb_debug.h"
51 #include <libopencm3/stm32/i2c.h>
52 #include <stdint.h>
53 
57 #define I2C_TIMEOUT 500000
58 
62 #define I2C_MY_ADDRESS 0x32
63 
68 typedef enum{
69 
72 }i2c_periph;
73 
74 
82 mcu_error I2C_setup(i2c_periph peripheral);
90 mcu_error I2C_start(i2c_periph peripheral);
98 mcu_error I2C_stop(i2c_periph peripheral);
108 mcu_error I2C_address(i2c_periph peripheral, uint8_t address, uint8_t operation);
117 mcu_error I2C_write(i2c_periph peripheral, uint8_t byte);
128 uint8_t I2C_read(i2c_periph peripheral);
139 uint8_t I2C_repeatRead(i2c_periph peripheral);
140 
143 #endif
mcu_error I2C_address(i2c_periph peripheral, uint8_t address, uint8_t operation)
Send a seven bit address on the bus.
Header file for stm32f103cb DEBUG.
Header file for stm32f103 GPIO.
mcu_error I2C_setup(i2c_periph peripheral)
Initialize I2C data structure and setup port.
mcu_error I2C_stop(i2c_periph peripheral)
Generate a stop condition on the bus.
Second I2C port.
uint8_t I2C_read(i2c_periph peripheral)
Read one byte from the bus without acknowledge generation.
i2c_periph
I2C ports available on the MCU.
First I2C port.
mcu_error I2C_start(i2c_periph peripheral)
Generate a start condition on the bus.
uint8_t I2C_repeatRead(i2c_periph peripheral)
Read one byte from the bus with acknowledge generation.
mcu_error I2C_write(i2c_periph peripheral, uint8_t byte)
Send one byte on the bus.
mcu_error
Error enumerators for the Debug peripheral.