Skip to content

Commit 57eb4a0

Browse files
committed
STM32 F1: move F1 to I2C common code
Now that F1 HAL has been updated to support required APIs, the F1 family can also be moved to common code.
1 parent e7cab5c commit 57eb4a0

File tree

8 files changed

+77
-488
lines changed

8 files changed

+77
-488
lines changed

targets/TARGET_STM/TARGET_STM32F1/TARGET_BLUEPILL_F103C8/objects.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,6 @@ struct analogin_s {
6060
uint8_t channel;
6161
};
6262

63-
struct i2c_s {
64-
I2CName i2c;
65-
uint32_t slave;
66-
};
67-
6863
struct can_s {
6964
CANName can;
7065
int index;

targets/TARGET_STM/TARGET_STM32F1/TARGET_DISCO_F100RB/objects.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,6 @@ struct analogin_s {
6060
uint8_t channel;
6161
};
6262

63-
struct i2c_s {
64-
I2CName i2c;
65-
uint32_t slave;
66-
};
67-
6863
#include "common_objects.h"
6964
#include "gpio_object.h"
7065

targets/TARGET_STM/TARGET_STM32F1/TARGET_NUCLEO_F103RB/objects.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,6 @@ struct analogin_s {
6060
uint8_t channel;
6161
};
6262

63-
struct i2c_s {
64-
I2CName i2c;
65-
uint32_t slave;
66-
};
67-
6863
struct can_s {
6964
CANName can;
7065
int index;

targets/TARGET_STM/TARGET_STM32F1/common_objects.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,34 @@ struct spi_s {
8282
#endif
8383
};
8484

85+
struct i2c_s {
86+
/* The 1st 2 members I2CName i2c
87+
* and I2C_HandleTypeDef handle should
88+
* be kept as the first members of this struct
89+
* to ensure i2c_get_obj to work as expected
90+
*/
91+
I2CName i2c;
92+
I2C_HandleTypeDef handle;
93+
uint8_t index;
94+
int hz;
95+
PinName sda;
96+
PinName scl;
97+
IRQn_Type event_i2cIRQ;
98+
IRQn_Type error_i2cIRQ;
99+
uint32_t XferOperation;
100+
volatile uint8_t event;
101+
#if DEVICE_I2CSLAVE
102+
uint8_t slave;
103+
volatile uint8_t pending_slave_tx_master_rx;
104+
volatile uint8_t pending_slave_rx_maxter_tx;
105+
#endif
106+
#if DEVICE_I2C_ASYNCH
107+
uint32_t address;
108+
uint8_t stop;
109+
uint8_t available_events;
110+
#endif
111+
};
112+
85113
#include "gpio_object.h"
86114

87115
#ifdef __cplusplus

0 commit comments

Comments
 (0)