Skip to content

Commit 0803c04

Browse files
Cruz Monrreal IICruz Monrreal II
authored andcommitted
Merge branch 'PR_LL_GPIO' of ssh://github.com/jeromecoutant/mbed into rollup
2 parents 143a976 + 4cf4cf1 commit 0803c04

File tree

3 files changed

+3
-210
lines changed

3 files changed

+3
-210
lines changed

targets/TARGET_STM/TARGET_STM32F2/pin_device.h

Lines changed: 1 addition & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -32,76 +32,7 @@
3232

3333
#include "cmsis.h"
3434

35-
// when LL is available, below include can be used
36-
// #include "stm32f2xx_ll_gpio.h"
37-
// until then let's define locally the required functions
38-
#define LL_GPIO_PIN_0 GPIO_BSRR_BS0 /*!< Select pin 0 */
39-
#define LL_GPIO_PIN_1 GPIO_BSRR_BS1 /*!< Select pin 1 */
40-
#define LL_GPIO_PIN_2 GPIO_BSRR_BS2 /*!< Select pin 2 */
41-
#define LL_GPIO_PIN_3 GPIO_BSRR_BS3 /*!< Select pin 3 */
42-
#define LL_GPIO_PIN_4 GPIO_BSRR_BS4 /*!< Select pin 4 */
43-
#define LL_GPIO_PIN_5 GPIO_BSRR_BS5 /*!< Select pin 5 */
44-
#define LL_GPIO_PIN_6 GPIO_BSRR_BS6 /*!< Select pin 6 */
45-
#define LL_GPIO_PIN_7 GPIO_BSRR_BS7 /*!< Select pin 7 */
46-
#define LL_GPIO_PIN_8 GPIO_BSRR_BS8 /*!< Select pin 8 */
47-
#define LL_GPIO_PIN_9 GPIO_BSRR_BS9 /*!< Select pin 9 */
48-
#define LL_GPIO_PIN_10 GPIO_BSRR_BS10 /*!< Select pin 10 */
49-
#define LL_GPIO_PIN_11 GPIO_BSRR_BS11 /*!< Select pin 11 */
50-
#define LL_GPIO_PIN_12 GPIO_BSRR_BS12 /*!< Select pin 12 */
51-
#define LL_GPIO_PIN_13 GPIO_BSRR_BS13 /*!< Select pin 13 */
52-
#define LL_GPIO_PIN_14 GPIO_BSRR_BS14 /*!< Select pin 14 */
53-
#define LL_GPIO_PIN_15 GPIO_BSRR_BS15 /*!< Select pin 15 */
54-
55-
#define LL_GPIO_MODE_INPUT ((uint32_t)0x00000000U) /*!< Select input mode */
56-
#define LL_GPIO_MODE_OUTPUT GPIO_MODER_MODE0_0 /*!< Select output mode */
57-
#define LL_GPIO_MODE_ALTERNATE GPIO_MODER_MODE0_1 /*!< Select alternate function mode */
58-
#define LL_GPIO_MODE_ANALOG GPIO_MODER_MODE0 /*!< Select analog mode */
59-
60-
#define LL_GPIO_OUTPUT_PUSHPULL ((uint32_t)0x00000000U) /*!< Select push-pull as output type */
61-
#define LL_GPIO_OUTPUT_OPENDRAIN GPIO_OTYPER_OT0 /*!< Select open-drain as output type */
62-
63-
#define LL_GPIO_PULL_NO ((uint32_t)0x00000000U) /*!< Select I/O no pull */
64-
#define LL_GPIO_PULL_UP GPIO_PUPDR_PUPD0_0 /*!< Select I/O pull up */
65-
#define LL_GPIO_PULL_DOWN GPIO_PUPDR_PUPD0_1 /*!< Select I/O pull down */
66-
67-
#define LL_GPIO_SPEED_FREQ_LOW ((uint32_t)0x00000000U) /*!< Select I/O low output speed */
68-
#define LL_GPIO_SPEED_FREQ_MEDIUM GPIO_OSPEEDER_OSPEEDR0_0 /*!< Select I/O medium output speed */
69-
#define LL_GPIO_SPEED_FREQ_HIGH GPIO_OSPEEDER_OSPEEDR0_1 /*!< Select I/O fast output speed */
70-
#define LL_GPIO_SPEED_FREQ_VERY_HIGH GPIO_OSPEEDER_OSPEEDR0 /*!< Select I/O high output speed */
71-
72-
__STATIC_INLINE void LL_GPIO_SetAFPin_0_7(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Alternate)
73-
{
74-
MODIFY_REG(GPIOx->AFR[0], (GPIO_AFRL_AFSEL0 << (POSITION_VAL(Pin) * 4U)),
75-
(Alternate << (POSITION_VAL(Pin) * 4U)));
76-
}
77-
78-
__STATIC_INLINE void LL_GPIO_SetAFPin_8_15(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Alternate)
79-
{
80-
MODIFY_REG(GPIOx->AFR[1], (GPIO_AFRH_AFSEL8 << (POSITION_VAL(Pin >> 8U) * 4U)),
81-
(Alternate << (POSITION_VAL(Pin >> 8U) * 4U)));
82-
}
83-
__STATIC_INLINE void LL_GPIO_SetPinMode(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Mode)
84-
{
85-
MODIFY_REG(GPIOx->MODER, (GPIO_MODER_MODE0 << (POSITION_VAL(Pin) * 2U)), (Mode << (POSITION_VAL(Pin) * 2U)));
86-
}
87-
__STATIC_INLINE uint32_t LL_GPIO_GetPinMode(GPIO_TypeDef *GPIOx, uint32_t Pin)
88-
{
89-
return (uint32_t)(READ_BIT(GPIOx->MODER, ((Pin * Pin) * GPIO_MODER_MODER0)) / (Pin * Pin));
90-
}
91-
__STATIC_INLINE void LL_GPIO_SetPinPull(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Pull)
92-
{
93-
MODIFY_REG(GPIOx->PUPDR, (GPIO_PUPDR_PUPD0 << (POSITION_VAL(Pin) * 2U)), (Pull << (POSITION_VAL(Pin) * 2U)));
94-
}
95-
__STATIC_INLINE void LL_GPIO_SetPinOutputType(GPIO_TypeDef *GPIOx, uint32_t PinMask, uint32_t OutputType)
96-
{
97-
MODIFY_REG(GPIOx->OTYPER, PinMask, (PinMask * OutputType));
98-
}
99-
__STATIC_INLINE void LL_GPIO_SetPinSpeed(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Speed)
100-
{
101-
MODIFY_REG(GPIOx->OSPEEDR, (GPIO_OSPEEDER_OSPEEDR0 << (POSITION_VAL(Pin) * 2U)),
102-
(Speed << (POSITION_VAL(Pin) * 2U)));
103-
}
104-
// Above lines shall be defined in LL when available
35+
#include "stm32f2xx_ll_gpio.h"
10536

10637
extern const uint32_t ll_pin_defines[16];
10738

targets/TARGET_STM/TARGET_STM32F4/pin_device.h

Lines changed: 1 addition & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -32,75 +32,7 @@
3232

3333
#include "cmsis.h"
3434

35-
// when LL is available, below include can be used
36-
// #include "stm32f4xx_ll_gpio.h"
37-
// until then let's define locally the required functions
38-
#define LL_GPIO_PIN_0 GPIO_BSRR_BS_0 /*!< Select pin 0 */
39-
#define LL_GPIO_PIN_1 GPIO_BSRR_BS_1 /*!< Select pin 1 */
40-
#define LL_GPIO_PIN_2 GPIO_BSRR_BS_2 /*!< Select pin 2 */
41-
#define LL_GPIO_PIN_3 GPIO_BSRR_BS_3 /*!< Select pin 3 */
42-
#define LL_GPIO_PIN_4 GPIO_BSRR_BS_4 /*!< Select pin 4 */
43-
#define LL_GPIO_PIN_5 GPIO_BSRR_BS_5 /*!< Select pin 5 */
44-
#define LL_GPIO_PIN_6 GPIO_BSRR_BS_6 /*!< Select pin 6 */
45-
#define LL_GPIO_PIN_7 GPIO_BSRR_BS_7 /*!< Select pin 7 */
46-
#define LL_GPIO_PIN_8 GPIO_BSRR_BS_8 /*!< Select pin 8 */
47-
#define LL_GPIO_PIN_9 GPIO_BSRR_BS_9 /*!< Select pin 9 */
48-
#define LL_GPIO_PIN_10 GPIO_BSRR_BS_10 /*!< Select pin 10 */
49-
#define LL_GPIO_PIN_11 GPIO_BSRR_BS_11 /*!< Select pin 11 */
50-
#define LL_GPIO_PIN_12 GPIO_BSRR_BS_12 /*!< Select pin 12 */
51-
#define LL_GPIO_PIN_13 GPIO_BSRR_BS_13 /*!< Select pin 13 */
52-
#define LL_GPIO_PIN_14 GPIO_BSRR_BS_14 /*!< Select pin 14 */
53-
#define LL_GPIO_PIN_15 GPIO_BSRR_BS_15 /*!< Select pin 15 */
54-
55-
#define LL_GPIO_MODE_INPUT ((uint32_t)0x00000000U) /*!< Select input mode */
56-
#define LL_GPIO_MODE_OUTPUT GPIO_MODER_MODER0_0 /*!< Select output mode */
57-
#define LL_GPIO_MODE_ALTERNATE GPIO_MODER_MODER0_1 /*!< Select alternate function mode */
58-
#define LL_GPIO_MODE_ANALOG GPIO_MODER_MODER0 /*!< Select analog mode */
59-
60-
#define LL_GPIO_OUTPUT_PUSHPULL ((uint32_t)0x00000000U) /*!< Select push-pull as output type */
61-
#define LL_GPIO_OUTPUT_OPENDRAIN GPIO_OTYPER_OT_0 /*!< Select open-drain as output type */
62-
63-
#define LL_GPIO_PULL_NO ((uint32_t)0x00000000U) /*!< Select I/O no pull */
64-
#define LL_GPIO_PULL_UP GPIO_PUPDR_PUPDR0_0 /*!< Select I/O pull up */
65-
#define LL_GPIO_PULL_DOWN GPIO_PUPDR_PUPDR0_1 /*!< Select I/O pull down */
66-
67-
#define LL_GPIO_SPEED_FREQ_LOW ((uint32_t)0x00000000U) /*!< Select I/O low output speed */
68-
#define LL_GPIO_SPEED_FREQ_MEDIUM GPIO_OSPEEDER_OSPEEDR0_0 /*!< Select I/O medium output speed */
69-
#define LL_GPIO_SPEED_FREQ_HIGH GPIO_OSPEEDER_OSPEEDR0_1 /*!< Select I/O fast output speed */
70-
#define LL_GPIO_SPEED_FREQ_VERY_HIGH GPIO_OSPEEDER_OSPEEDR0 /*!< Select I/O high output speed */
71-
72-
__STATIC_INLINE void LL_GPIO_SetAFPin_0_7(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Alternate)
73-
{
74-
MODIFY_REG(GPIOx->AFR[0], (0xFU << (POSITION_VAL(Pin) * 4U)),
75-
(Alternate << (POSITION_VAL(Pin) * 4U)));
76-
}
77-
__STATIC_INLINE void LL_GPIO_SetAFPin_8_15(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Alternate)
78-
{
79-
MODIFY_REG(GPIOx->AFR[1], (0xFU << (POSITION_VAL(Pin >> 8U) * 4U)),
80-
(Alternate << (POSITION_VAL(Pin >> 8U) * 4U)));
81-
}
82-
__STATIC_INLINE void LL_GPIO_SetPinMode(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Mode)
83-
{
84-
MODIFY_REG(GPIOx->MODER, (GPIO_MODER_MODER0 << (POSITION_VAL(Pin) * 2U)), (Mode << (POSITION_VAL(Pin) * 2U)));
85-
}
86-
__STATIC_INLINE uint32_t LL_GPIO_GetPinMode(GPIO_TypeDef *GPIOx, uint32_t Pin)
87-
{
88-
return (uint32_t)(READ_BIT(GPIOx->MODER, ((Pin * Pin) * GPIO_MODER_MODER0)) / (Pin * Pin));
89-
}
90-
__STATIC_INLINE void LL_GPIO_SetPinPull(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Pull)
91-
{
92-
MODIFY_REG(GPIOx->PUPDR, (GPIO_PUPDR_PUPDR0 << (POSITION_VAL(Pin) * 2U)), (Pull << (POSITION_VAL(Pin) * 2U)));
93-
}
94-
__STATIC_INLINE void LL_GPIO_SetPinOutputType(GPIO_TypeDef *GPIOx, uint32_t PinMask, uint32_t OutputType)
95-
{
96-
MODIFY_REG(GPIOx->OTYPER, PinMask, (PinMask * OutputType));
97-
}
98-
__STATIC_INLINE void LL_GPIO_SetPinSpeed(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Speed)
99-
{
100-
MODIFY_REG(GPIOx->OSPEEDR, (GPIO_OSPEEDER_OSPEEDR0 << (POSITION_VAL(Pin) * 2U)),
101-
(Speed << (POSITION_VAL(Pin) * 2U)));
102-
}
103-
// Above lines shall be defined in LL when available
35+
#include "stm32f4xx_ll_gpio.h"
10436

10537
extern const uint32_t ll_pin_defines[16];
10638

targets/TARGET_STM/TARGET_STM32F7/pin_device.h

Lines changed: 1 addition & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -32,77 +32,7 @@
3232

3333
#include "cmsis.h"
3434

35-
// when LL is available, below include can be used
36-
// #include "stm32f7xx_ll_gpio.h"
37-
// until then let's define locally the required functions
38-
#define LL_GPIO_PIN_0 GPIO_BSRR_BS_0 /*!< Select pin 0 */
39-
#define LL_GPIO_PIN_1 GPIO_BSRR_BS_1 /*!< Select pin 1 */
40-
#define LL_GPIO_PIN_2 GPIO_BSRR_BS_2 /*!< Select pin 2 */
41-
#define LL_GPIO_PIN_3 GPIO_BSRR_BS_3 /*!< Select pin 3 */
42-
#define LL_GPIO_PIN_4 GPIO_BSRR_BS_4 /*!< Select pin 4 */
43-
#define LL_GPIO_PIN_5 GPIO_BSRR_BS_5 /*!< Select pin 5 */
44-
#define LL_GPIO_PIN_6 GPIO_BSRR_BS_6 /*!< Select pin 6 */
45-
#define LL_GPIO_PIN_7 GPIO_BSRR_BS_7 /*!< Select pin 7 */
46-
#define LL_GPIO_PIN_8 GPIO_BSRR_BS_8 /*!< Select pin 8 */
47-
#define LL_GPIO_PIN_9 GPIO_BSRR_BS_9 /*!< Select pin 9 */
48-
#define LL_GPIO_PIN_10 GPIO_BSRR_BS_10 /*!< Select pin 10 */
49-
#define LL_GPIO_PIN_11 GPIO_BSRR_BS_11 /*!< Select pin 11 */
50-
#define LL_GPIO_PIN_12 GPIO_BSRR_BS_12 /*!< Select pin 12 */
51-
#define LL_GPIO_PIN_13 GPIO_BSRR_BS_13 /*!< Select pin 13 */
52-
#define LL_GPIO_PIN_14 GPIO_BSRR_BS_14 /*!< Select pin 14 */
53-
#define LL_GPIO_PIN_15 GPIO_BSRR_BS_15 /*!< Select pin 15 */
54-
55-
#define LL_GPIO_MODE_INPUT ((uint32_t)0x00000000U) /*!< Select input mode */
56-
#define LL_GPIO_MODE_OUTPUT GPIO_MODER_MODER0_0 /*!< Select output mode */
57-
#define LL_GPIO_MODE_ALTERNATE GPIO_MODER_MODER0_1 /*!< Select alternate function mode */
58-
#define LL_GPIO_MODE_ANALOG GPIO_MODER_MODER0 /*!< Select analog mode */
59-
60-
#define LL_GPIO_OUTPUT_PUSHPULL ((uint32_t)0x00000000U) /*!< Select push-pull as output type */
61-
#define LL_GPIO_OUTPUT_OPENDRAIN GPIO_OTYPER_OT_0 /*!< Select open-drain as output type */
62-
63-
#define LL_GPIO_PULL_NO ((uint32_t)0x00000000U) /*!< Select I/O no pull */
64-
#define LL_GPIO_PULL_UP GPIO_PUPDR_PUPDR0_0 /*!< Select I/O pull up */
65-
#define LL_GPIO_PULL_DOWN GPIO_PUPDR_PUPDR0_1 /*!< Select I/O pull down */
66-
67-
#define LL_GPIO_SPEED_FREQ_LOW ((uint32_t)0x00000000U) /*!< Select I/O low output speed */
68-
#define LL_GPIO_SPEED_FREQ_MEDIUM GPIO_OSPEEDER_OSPEEDR0_0 /*!< Select I/O medium output speed */
69-
#define LL_GPIO_SPEED_FREQ_HIGH GPIO_OSPEEDER_OSPEEDR0_1 /*!< Select I/O fast output speed */
70-
#define LL_GPIO_SPEED_FREQ_VERY_HIGH GPIO_OSPEEDER_OSPEEDR0 /*!< Select I/O high output speed */
71-
72-
73-
__STATIC_INLINE void LL_GPIO_SetAFPin_0_7(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Alternate)
74-
{
75-
MODIFY_REG(GPIOx->AFR[0], (0xFU << (POSITION_VAL(Pin) * 4U)),
76-
(Alternate << (POSITION_VAL(Pin) * 4U)));
77-
}
78-
79-
__STATIC_INLINE void LL_GPIO_SetAFPin_8_15(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Alternate)
80-
{
81-
MODIFY_REG(GPIOx->AFR[1], (0xFU << (POSITION_VAL(Pin >> 8U) * 4U)),
82-
(Alternate << (POSITION_VAL(Pin >> 8U) * 4U)));
83-
}
84-
__STATIC_INLINE void LL_GPIO_SetPinMode(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Mode)
85-
{
86-
MODIFY_REG(GPIOx->MODER, (GPIO_MODER_MODER0 << (POSITION_VAL(Pin) * 2U)), (Mode << (POSITION_VAL(Pin) * 2U)));
87-
}
88-
__STATIC_INLINE uint32_t LL_GPIO_GetPinMode(GPIO_TypeDef *GPIOx, uint32_t Pin)
89-
{
90-
return (uint32_t)(READ_BIT(GPIOx->MODER, ((Pin * Pin) * GPIO_MODER_MODER0)) / (Pin * Pin));
91-
}
92-
__STATIC_INLINE void LL_GPIO_SetPinPull(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Pull)
93-
{
94-
MODIFY_REG(GPIOx->PUPDR, (GPIO_PUPDR_PUPDR0 << (POSITION_VAL(Pin) * 2U)), (Pull << (POSITION_VAL(Pin) * 2U)));
95-
}
96-
__STATIC_INLINE void LL_GPIO_SetPinOutputType(GPIO_TypeDef *GPIOx, uint32_t PinMask, uint32_t OutputType)
97-
{
98-
MODIFY_REG(GPIOx->OTYPER, PinMask, (PinMask * OutputType));
99-
}
100-
__STATIC_INLINE void LL_GPIO_SetPinSpeed(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Speed)
101-
{
102-
MODIFY_REG(GPIOx->OSPEEDR, (GPIO_OSPEEDER_OSPEEDR0 << (POSITION_VAL(Pin) * 2U)),
103-
(Speed << (POSITION_VAL(Pin) * 2U)));
104-
}
105-
// Above lines shall be defined in LL when available
35+
#include "stm32f7xx_ll_gpio.h"
10636

10737
extern const uint32_t ll_pin_defines[16];
10838

0 commit comments

Comments
 (0)