Skip to content

Commit 0aeea49

Browse files
Laurent MEUNIERLMESTM
authored andcommitted
[STM32] Deploy SPI_ASYNCH to all family
the SPI_ASYNCH feature has been already activated for STM32F4. This patchset makes it supported on all STM32 families by: - moving spi_s structure at family level instead of board level - using the F4 spi_api.c reference implementation and making it a common stm_spi_api.c file which makes maintenance a lot easier. - the only part that needs to be implemented for each family is the computation of the clock frequency input to the spi peripheral which is not the same accross families. So this is what remains in the spi_api.c of each family. Because of the introduction of the common file, all the above modifications needs to be done at once.
1 parent 1ba3499 commit 0aeea49

File tree

50 files changed

+852
-3113
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+852
-3113
lines changed

targets/TARGET_STM/TARGET_STM32F0/TARGET_DISCO_F051R8/objects.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,6 @@ struct dac_s {
6666
uint32_t channel;
6767
};
6868

69-
struct spi_s {
70-
SPIName spi;
71-
uint32_t bits;
72-
uint32_t cpol;
73-
uint32_t cpha;
74-
uint32_t mode;
75-
uint32_t nss;
76-
uint32_t br_presc;
77-
PinName pin_miso;
78-
PinName pin_mosi;
79-
PinName pin_sclk;
80-
PinName pin_ssel;
81-
};
82-
8369
struct i2c_s {
8470
I2CName i2c;
8571
};

targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F030R8/objects.h

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

63-
struct spi_s {
64-
SPIName spi;
65-
uint32_t bits;
66-
uint32_t cpol;
67-
uint32_t cpha;
68-
uint32_t mode;
69-
uint32_t nss;
70-
uint32_t br_presc;
71-
PinName pin_miso;
72-
PinName pin_mosi;
73-
PinName pin_sclk;
74-
PinName pin_ssel;
75-
};
76-
7763
struct i2c_s {
7864
I2CName i2c;
7965
};

targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F031K6/objects.h

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

63-
struct spi_s {
64-
SPIName spi;
65-
uint32_t bits;
66-
uint32_t cpol;
67-
uint32_t cpha;
68-
uint32_t mode;
69-
uint32_t nss;
70-
uint32_t br_presc;
71-
PinName pin_miso;
72-
PinName pin_mosi;
73-
PinName pin_sclk;
74-
PinName pin_ssel;
75-
};
76-
7763
struct i2c_s {
7864
I2CName i2c;
7965
};

targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F042K6/objects.h

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

63-
struct spi_s {
64-
SPIName spi;
65-
uint32_t bits;
66-
uint32_t cpol;
67-
uint32_t cpha;
68-
uint32_t mode;
69-
uint32_t nss;
70-
uint32_t br_presc;
71-
PinName pin_miso;
72-
PinName pin_mosi;
73-
PinName pin_sclk;
74-
PinName pin_ssel;
75-
};
76-
7763
struct i2c_s {
7864
I2CName i2c;
7965
};

targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F070RB/objects.h

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

63-
struct spi_s {
64-
SPIName spi;
65-
uint32_t bits;
66-
uint32_t cpol;
67-
uint32_t cpha;
68-
uint32_t mode;
69-
uint32_t nss;
70-
uint32_t br_presc;
71-
PinName pin_miso;
72-
PinName pin_mosi;
73-
PinName pin_sclk;
74-
PinName pin_ssel;
75-
};
76-
7763
struct i2c_s {
7864
I2CName i2c;
7965
};

targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F072RB/objects.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,6 @@ struct dac_s {
6666
uint32_t channel;
6767
};
6868

69-
struct spi_s {
70-
SPIName spi;
71-
uint32_t bits;
72-
uint32_t cpol;
73-
uint32_t cpha;
74-
uint32_t mode;
75-
uint32_t nss;
76-
uint32_t br_presc;
77-
PinName pin_miso;
78-
PinName pin_mosi;
79-
PinName pin_sclk;
80-
PinName pin_ssel;
81-
};
82-
8369
struct i2c_s {
8470
I2CName i2c;
8571
};

targets/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F091RC/objects.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,6 @@ struct dac_s {
6666
uint32_t channel;
6767
};
6868

69-
struct spi_s {
70-
SPIName spi;
71-
uint32_t bits;
72-
uint32_t cpol;
73-
uint32_t cpha;
74-
uint32_t mode;
75-
uint32_t nss;
76-
uint32_t br_presc;
77-
PinName pin_miso;
78-
PinName pin_mosi;
79-
PinName pin_sclk;
80-
PinName pin_ssel;
81-
};
82-
8369
struct i2c_s {
8470
I2CName i2c;
8571
};

targets/TARGET_STM/TARGET_STM32F0/common_objects.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,21 @@ struct pwmout_s {
4949
uint8_t inverted;
5050
};
5151

52+
struct spi_s {
53+
SPI_HandleTypeDef handle;
54+
IRQn_Type spiIRQ;
55+
SPIName spi;
56+
PinName pin_miso;
57+
PinName pin_mosi;
58+
PinName pin_sclk;
59+
PinName pin_ssel;
60+
#ifdef DEVICE_SPI_ASYNCH
61+
uint32_t event;
62+
uint8_t module;
63+
uint8_t transfer_type;
64+
#endif
65+
};
66+
5267
struct serial_s {
5368
UARTName uart;
5469
int index; // Used by irq

0 commit comments

Comments
 (0)