Skip to content

Commit 0751932

Browse files
Jamie Smithmultiplemonomials
Jamie Smith
authored andcommitted
Rethink STM32 I2C v2 HAL
1 parent 7ab5260 commit 0751932

File tree

15 files changed

+443
-515
lines changed

15 files changed

+443
-515
lines changed

targets/TARGET_STM/TARGET_STM32F0/objects.h

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -77,39 +77,6 @@ struct serial_s {
7777
#endif
7878
};
7979

80-
struct i2c_s {
81-
/* The 1st 2 members I2CName i2c
82-
* and I2C_HandleTypeDef handle should
83-
* be kept as the first members of this struct
84-
* to ensure i2c_get_obj to work as expected
85-
*/
86-
I2CName i2c;
87-
I2C_HandleTypeDef handle;
88-
uint8_t index;
89-
int hz;
90-
PinName sda;
91-
PinName scl;
92-
IRQn_Type event_i2cIRQ;
93-
IRQn_Type error_i2cIRQ;
94-
uint32_t XferOperation;
95-
volatile uint8_t event;
96-
volatile int pending_start;
97-
int current_hz;
98-
#if DEVICE_I2CSLAVE
99-
uint8_t slave;
100-
volatile uint8_t pending_slave_tx_master_rx;
101-
volatile uint8_t pending_slave_rx_maxter_tx;
102-
uint8_t *slave_rx_buffer;
103-
volatile uint16_t slave_rx_buffer_size;
104-
volatile uint16_t slave_rx_count;
105-
#endif
106-
#if DEVICE_I2C_ASYNCH
107-
uint32_t address;
108-
uint8_t stop;
109-
uint8_t available_events;
110-
#endif
111-
};
112-
11380
struct analogin_s {
11481
ADC_HandleTypeDef handle;
11582
PinName pin;

targets/TARGET_STM/TARGET_STM32F3/objects.h

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -90,41 +90,6 @@ struct serial_s {
9090
#endif
9191
};
9292

93-
struct i2c_s {
94-
/* The 1st 2 members I2CName i2c
95-
* and I2C_HandleTypeDef handle should
96-
* be kept as the first members of this struct
97-
* to ensure i2c_get_obj to work as expected
98-
*/
99-
I2CName i2c;
100-
I2C_HandleTypeDef handle;
101-
uint8_t index;
102-
int hz;
103-
PinName sda;
104-
PinName scl;
105-
int sda_func;
106-
int scl_func;
107-
IRQn_Type event_i2cIRQ;
108-
IRQn_Type error_i2cIRQ;
109-
uint32_t XferOperation;
110-
volatile uint8_t event;
111-
volatile int pending_start;
112-
int current_hz;
113-
#if DEVICE_I2CSLAVE
114-
uint8_t slave;
115-
volatile uint8_t pending_slave_tx_master_rx;
116-
volatile uint8_t pending_slave_rx_maxter_tx;
117-
uint8_t *slave_rx_buffer;
118-
volatile uint16_t slave_rx_buffer_size;
119-
volatile uint16_t slave_rx_count;
120-
#endif
121-
#if DEVICE_I2C_ASYNCH
122-
uint32_t address;
123-
uint8_t stop;
124-
uint8_t available_events;
125-
#endif
126-
};
127-
12893
struct dac_s {
12994
DACName dac;
13095
PinName pin;

targets/TARGET_STM/TARGET_STM32F7/objects.h

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -108,39 +108,6 @@ struct serial_s {
108108
#endif
109109
};
110110

111-
struct i2c_s {
112-
/* The 1st 2 members I2CName i2c
113-
* and I2C_HandleTypeDef handle should
114-
* be kept as the first members of this struct
115-
* to ensure i2c_get_obj to work as expected
116-
*/
117-
I2CName i2c;
118-
I2C_HandleTypeDef handle;
119-
uint8_t index;
120-
int hz;
121-
PinName sda;
122-
PinName scl;
123-
IRQn_Type event_i2cIRQ;
124-
IRQn_Type error_i2cIRQ;
125-
uint32_t XferOperation;
126-
volatile uint8_t event;
127-
volatile int pending_start;
128-
int current_hz;
129-
#if DEVICE_I2CSLAVE
130-
uint8_t slave;
131-
volatile uint8_t pending_slave_tx_master_rx;
132-
volatile uint8_t pending_slave_rx_maxter_tx;
133-
uint8_t *slave_rx_buffer;
134-
volatile uint16_t slave_rx_buffer_size;
135-
volatile uint16_t slave_rx_count;
136-
#endif
137-
#if DEVICE_I2C_ASYNCH
138-
uint32_t address;
139-
uint8_t stop;
140-
uint8_t available_events;
141-
#endif
142-
};
143-
144111
struct analogin_s {
145112
ADC_HandleTypeDef handle;
146113
PinName pin;

targets/TARGET_STM/TARGET_STM32G0/objects.h

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -89,41 +89,6 @@ struct serial_s {
8989
#endif
9090
};
9191

92-
struct i2c_s {
93-
/* The 1st 2 members I2CName i2c
94-
* and I2C_HandleTypeDef handle should
95-
* be kept as the first members of this struct
96-
* to ensure i2c_get_obj to work as expected
97-
*/
98-
I2CName i2c;
99-
I2C_HandleTypeDef handle;
100-
uint8_t index;
101-
int hz;
102-
PinName sda;
103-
PinName scl;
104-
int sda_func;
105-
int scl_func;
106-
IRQn_Type event_i2cIRQ;
107-
IRQn_Type error_i2cIRQ;
108-
uint32_t XferOperation;
109-
volatile uint8_t event;
110-
volatile int pending_start;
111-
int current_hz;
112-
#if DEVICE_I2CSLAVE
113-
uint8_t slave;
114-
volatile uint8_t pending_slave_tx_master_rx;
115-
volatile uint8_t pending_slave_rx_maxter_tx;
116-
uint8_t *slave_rx_buffer;
117-
volatile uint16_t slave_rx_buffer_size;
118-
volatile uint16_t slave_rx_count;
119-
#endif
120-
#if DEVICE_I2C_ASYNCH
121-
uint32_t address;
122-
uint8_t stop;
123-
uint8_t available_events;
124-
#endif
125-
};
126-
12792
struct flash_s {
12893
/* nothing to be stored for now */
12994
uint32_t dummy;

targets/TARGET_STM/TARGET_STM32G4/objects.h

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -88,41 +88,6 @@ struct serial_s {
8888
#endif
8989
};
9090

91-
struct i2c_s {
92-
/* The 1st 2 members I2CName i2c
93-
* and I2C_HandleTypeDef handle should
94-
* be kept as the first members of this struct
95-
* to ensure i2c_get_obj to work as expected
96-
*/
97-
I2CName i2c;
98-
I2C_HandleTypeDef handle;
99-
uint8_t index;
100-
int hz;
101-
PinName sda;
102-
PinName scl;
103-
int sda_func;
104-
int scl_func;
105-
IRQn_Type event_i2cIRQ;
106-
IRQn_Type error_i2cIRQ;
107-
uint32_t XferOperation;
108-
volatile uint8_t event;
109-
volatile int pending_start;
110-
int current_hz;
111-
#if DEVICE_I2CSLAVE
112-
uint8_t slave;
113-
volatile uint8_t pending_slave_tx_master_rx;
114-
volatile uint8_t pending_slave_rx_maxter_tx;
115-
uint8_t *slave_rx_buffer;
116-
volatile uint16_t slave_rx_buffer_size;
117-
volatile uint16_t slave_rx_count;
118-
#endif
119-
#if DEVICE_I2C_ASYNCH
120-
uint32_t address;
121-
uint8_t stop;
122-
uint8_t available_events;
123-
#endif
124-
};
125-
12691
struct dac_s {
12792
DACName dac;
12893
PinName pin;

targets/TARGET_STM/TARGET_STM32H7/objects.h

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -97,39 +97,6 @@ struct serial_s {
9797
#endif
9898
};
9999

100-
struct i2c_s {
101-
/* The 1st 2 members I2CName i2c
102-
* and I2C_HandleTypeDef handle should
103-
* be kept as the first members of this struct
104-
* to ensure i2c_get_obj to work as expected
105-
*/
106-
I2CName i2c;
107-
I2C_HandleTypeDef handle;
108-
uint8_t index;
109-
int hz;
110-
PinName sda;
111-
PinName scl;
112-
IRQn_Type event_i2cIRQ;
113-
IRQn_Type error_i2cIRQ;
114-
uint32_t XferOperation;
115-
volatile uint8_t event;
116-
volatile int pending_start;
117-
int current_hz;
118-
#if DEVICE_I2CSLAVE
119-
uint8_t slave;
120-
volatile uint8_t pending_slave_tx_master_rx;
121-
volatile uint8_t pending_slave_rx_maxter_tx;
122-
uint8_t *slave_rx_buffer;
123-
volatile uint16_t slave_rx_buffer_size;
124-
volatile uint16_t slave_rx_count;
125-
#endif
126-
#if DEVICE_I2C_ASYNCH
127-
uint32_t address;
128-
uint8_t stop;
129-
uint8_t available_events;
130-
#endif
131-
};
132-
133100
struct analogin_s {
134101
ADC_HandleTypeDef handle;
135102
PinName pin;

targets/TARGET_STM/TARGET_STM32L0/objects.h

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -91,41 +91,6 @@ struct serial_s {
9191
#endif
9292
};
9393

94-
struct i2c_s {
95-
/* The 1st 2 members I2CName i2c
96-
* and I2C_HandleTypeDef handle should
97-
* be kept as the first members of this struct
98-
* to ensure i2c_get_obj to work as expected
99-
*/
100-
I2CName i2c;
101-
I2C_HandleTypeDef handle;
102-
uint8_t index;
103-
int hz;
104-
PinName sda;
105-
PinName scl;
106-
int sda_func;
107-
int scl_func;
108-
IRQn_Type event_i2cIRQ;
109-
IRQn_Type error_i2cIRQ;
110-
uint32_t XferOperation;
111-
volatile uint8_t event;
112-
volatile int pending_start;
113-
int current_hz;
114-
#if DEVICE_I2CSLAVE
115-
uint8_t slave;
116-
volatile uint8_t pending_slave_tx_master_rx;
117-
volatile uint8_t pending_slave_rx_maxter_tx;
118-
uint8_t *slave_rx_buffer;
119-
volatile uint16_t slave_rx_buffer_size;
120-
volatile uint16_t slave_rx_count;
121-
#endif
122-
#if DEVICE_I2C_ASYNCH
123-
uint32_t address;
124-
uint8_t stop;
125-
uint8_t available_events;
126-
#endif
127-
};
128-
12994
#if DEVICE_FLASH
13095
struct flash_s {
13196
/* nothing to be stored for now */

targets/TARGET_STM/TARGET_STM32L4/objects.h

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -87,41 +87,6 @@ struct serial_s {
8787
#endif
8888
};
8989

90-
struct i2c_s {
91-
/* The 1st 2 members I2CName i2c
92-
* and I2C_HandleTypeDef handle should
93-
* be kept as the first members of this struct
94-
* to ensure i2c_get_obj to work as expected
95-
*/
96-
I2CName i2c;
97-
I2C_HandleTypeDef handle;
98-
uint8_t index;
99-
int hz;
100-
PinName sda;
101-
PinName scl;
102-
int sda_func;
103-
int scl_func;
104-
IRQn_Type event_i2cIRQ;
105-
IRQn_Type error_i2cIRQ;
106-
uint32_t XferOperation;
107-
volatile uint8_t event;
108-
volatile int pending_start;
109-
int current_hz;
110-
#if DEVICE_I2CSLAVE
111-
uint8_t slave;
112-
volatile uint8_t pending_slave_tx_master_rx;
113-
volatile uint8_t pending_slave_rx_maxter_tx;
114-
uint8_t *slave_rx_buffer;
115-
volatile uint16_t slave_rx_buffer_size;
116-
volatile uint16_t slave_rx_count;
117-
#endif
118-
#if DEVICE_I2C_ASYNCH
119-
uint32_t address;
120-
uint8_t stop;
121-
uint8_t available_events;
122-
#endif
123-
};
124-
12590
struct flash_s {
12691
/* nothing to be stored for now */
12792
uint32_t dummy;

targets/TARGET_STM/TARGET_STM32L5/objects.h

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -97,39 +97,6 @@ struct serial_s {
9797
#endif
9898
};
9999

100-
struct i2c_s {
101-
/* The 1st 2 members I2CName i2c
102-
* and I2C_HandleTypeDef handle should
103-
* be kept as the first members of this struct
104-
* to ensure i2c_get_obj to work as expected
105-
*/
106-
I2CName i2c;
107-
I2C_HandleTypeDef handle;
108-
uint8_t index;
109-
int hz;
110-
PinName sda;
111-
PinName scl;
112-
IRQn_Type event_i2cIRQ;
113-
IRQn_Type error_i2cIRQ;
114-
uint32_t XferOperation;
115-
volatile uint8_t event;
116-
volatile int pending_start;
117-
int current_hz;
118-
#if DEVICE_I2CSLAVE
119-
uint8_t slave;
120-
volatile uint8_t pending_slave_tx_master_rx;
121-
volatile uint8_t pending_slave_rx_maxter_tx;
122-
uint8_t *slave_rx_buffer;
123-
volatile uint16_t slave_rx_buffer_size;
124-
volatile uint16_t slave_rx_count;
125-
#endif
126-
#if DEVICE_I2C_ASYNCH
127-
uint32_t address;
128-
uint8_t stop;
129-
uint8_t available_events;
130-
#endif
131-
};
132-
133100
struct flash_s {
134101
/* nothing to be stored for now */
135102
uint32_t dummy;

0 commit comments

Comments
 (0)