gpio: use default high speed for peripheral gpio
This commit is contained in:
parent
779727e321
commit
28a1ff7abe
|
@ -30,6 +30,11 @@
|
|||
#endif
|
||||
#include CHIP_PERIPHERAL_INCLUDE
|
||||
|
||||
void stm32AfInit(const stm32_af_pin_list_type list[], int size, const void *instance, GPIO_TypeDef *port, uint32_t pin, uint32_t mode, uint32_t pull) {
|
||||
stm32AfInitSpeed(list, size, instance, port, pin, mode, pull, GPIO_SPEED_FREQ_VERY_HIGH);
|
||||
}
|
||||
|
||||
|
||||
GPIO_TypeDef *stm32AfGetDefault(const stm32_af_pin_list_type list[], int size, const void *instance, uint32_t *pin) {
|
||||
for(int i=0; i<size; i++) {
|
||||
if (instance == list[i].instance) {
|
||||
|
|
|
@ -133,10 +133,15 @@ uint32_t stm32GetClockFrequency(void *instance);
|
|||
uint8_t stm32ADC1GetChannel(GPIO_TypeDef *port, uint32_t pin_mask);
|
||||
|
||||
/**
|
||||
* Internal: set the AF function for the selected peripheral on the selected pin
|
||||
* Internal: set the AF function for the selected peripheral on the selected pin, with GPIO_SPEED_FREQ_VERY_HIGH speed
|
||||
*/
|
||||
void stm32AfInit(const stm32_af_pin_list_type list[], int size, const void *instance, GPIO_TypeDef *port, uint32_t pin, uint32_t mode, uint32_t pull);
|
||||
|
||||
/**
|
||||
* Internal: set the AF function for the selected peripheral on the selected pin, with the specified GPIO speed
|
||||
*/
|
||||
void stm32AfInitSpeed(const stm32_af_pin_list_type list[], int size, const void *instance, GPIO_TypeDef *port, uint32_t pin, uint32_t mode, uint32_t pull, uint32_t speed);
|
||||
|
||||
/**
|
||||
* Internal: get the default pin for the given peripheral
|
||||
*/
|
||||
|
|
|
@ -37,7 +37,7 @@ int8_t stm32AfGet(const stm32_af_pin_list_type list[], int size, const void *ins
|
|||
return 0;
|
||||
}
|
||||
|
||||
void stm32AfInit(const stm32_af_pin_list_type list[], int size, const void *instance, GPIO_TypeDef *port, uint32_t pin, uint32_t mode, uint32_t pull) {
|
||||
void stm32AfInitSpeed(const stm32_af_pin_list_type list[], int size, const void *instance, GPIO_TypeDef *port, uint32_t pin, uint32_t mode, uint32_t pull, uint32_t speed) {
|
||||
if (stm32_pwm_disable_callback != NULL) {
|
||||
(*stm32_pwm_disable_callback)(port, pin);
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ void stm32AfInit(const stm32_af_pin_list_type list[], int size, const void *inst
|
|||
GPIO_InitStruct.Pin = pin;
|
||||
GPIO_InitStruct.Mode = mode;
|
||||
GPIO_InitStruct.Pull = pull;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_MEDIUM; // Slow signal slew rate to keep noise to minimum
|
||||
GPIO_InitStruct.Speed = speed;
|
||||
GPIO_InitStruct.Alternate = stm32AfGet(list, size, instance, port, pin);
|
||||
HAL_GPIO_Init(port, &GPIO_InitStruct);
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ stm32_af_callback stm32AfGet(const stm32_af_pin_list_type list[], int size, cons
|
|||
return 0;
|
||||
}
|
||||
|
||||
void stm32AfInit(const stm32_af_pin_list_type list[], int size, const void *instance, GPIO_TypeDef *port, uint32_t pin, uint32_t mode, uint32_t pull) {
|
||||
void stm32AfInitSpeed(const stm32_af_pin_list_type list[], int size, const void *instance, GPIO_TypeDef *port, uint32_t pin, uint32_t mode, uint32_t pull, uint32_t speed) {
|
||||
if (stm32_pwm_disable_callback != NULL) {
|
||||
(*stm32_pwm_disable_callback)(port, pin);
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ void stm32AfInit(const stm32_af_pin_list_type list[], int size, const void *inst
|
|||
GPIO_InitStruct.Pin = pin;
|
||||
GPIO_InitStruct.Mode = mode;
|
||||
GPIO_InitStruct.Pull = pull;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_MEDIUM; // Slow signal slew rate to keep noise to minimum
|
||||
GPIO_InitStruct.Speed = speed;
|
||||
HAL_GPIO_Init(port, &GPIO_InitStruct);
|
||||
|
||||
stm32AfGet(list, size, instance, port, pin)();
|
||||
|
|
Loading…
Reference in New Issue