-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stm32f4: Add support for UART4 to 10 #27
Changes from 3 commits
eaf0802
a4e4ec1
9dce1d8
e95c25d
4635d17
b6bebea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,52 +12,48 @@ | |
#include <pinmux/stm32/pinmux_stm32.h> | ||
#include <drivers/clock_control/stm32_clock_control.h> | ||
|
||
static const stm32_pin_func_t pin_pa9_funcs[] = { | ||
[STM32F4_PINMUX_FUNC_PA9_USART1_TX - 1] = | ||
STM32F4X_PIN_CONFIG_AF_PUSH_UP, | ||
#define PAD(AF, func) \ | ||
[AF - 1] = func | ||
|
||
static const stm32_pin_func_t pin_pa0_funcs[] = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is an interesting proposal (that would eventually deserve to be extended to whole stm32 family to keep consistency across STM32 series). Thought, please keep it easily readable and consistent across IPs. For instance: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes it would be good to extend to other STM32 as I also said in the cover letter. This can be done as a follow-up if you agree, especially considering that I do not have other STM32 on my desk right now. Sure, I will look into the consistency issue, thanks. |
||
PAD(STM32F4_PINMUX_FUNC_PA0_PWM2_CH1, STM32F4X_PIN_CONFIG_AF_PUSH_UP), | ||
}; | ||
|
||
static const stm32_pin_func_t pin_pa10_funcs[] = { | ||
[STM32F4_PINMUX_FUNC_PA10_USART1_RX - 1] = | ||
STM32F4X_PIN_CONFIG_AF_PUSH_UP, | ||
static const stm32_pin_func_t pin_pa2_funcs[] = { | ||
PAD(STM32F4_PINMUX_FUNC_PA2_USART2_TX, STM32F4X_PIN_CONFIG_AF_PUSH_UP), | ||
}; | ||
|
||
static const stm32_pin_func_t pin_pb6_funcs[] = { | ||
[STM32F4_PINMUX_FUNC_PB6_USART1_TX - 1] = | ||
STM32F4X_PIN_CONFIG_AF_PUSH_UP, | ||
static const stm32_pin_func_t pin_pa3_funcs[] = { | ||
PAD(STM32F4_PINMUX_FUNC_PA3_USART2_RX, STM32F4X_PIN_CONFIG_AF_PUSH_UP), | ||
}; | ||
|
||
static const stm32_pin_func_t pin_pb7_funcs[] = { | ||
[STM32F4_PINMUX_FUNC_PB7_USART1_RX - 1] = | ||
STM32F4X_PIN_CONFIG_AF_PUSH_UP, | ||
static const stm32_pin_func_t pin_pa9_funcs[] = { | ||
PAD(STM32F4_PINMUX_FUNC_PA9_USART1_TX, STM32F4X_PIN_CONFIG_AF_PUSH_UP), | ||
}; | ||
|
||
static const stm32_pin_func_t pin_pa2_funcs[] = { | ||
[STM32F4_PINMUX_FUNC_PA2_USART2_TX - 1] = | ||
STM32F4X_PIN_CONFIG_AF_PUSH_UP, | ||
static const stm32_pin_func_t pin_pa10_funcs[] = { | ||
PAD(STM32F4_PINMUX_FUNC_PA10_USART1_RX, STM32F4X_PIN_CONFIG_AF_PUSH_UP) | ||
}; | ||
|
||
static const stm32_pin_func_t pin_pa3_funcs[] = { | ||
[STM32F4_PINMUX_FUNC_PA3_USART2_RX - 1] = | ||
STM32F4X_PIN_CONFIG_AF_PUSH_UP, | ||
static const stm32_pin_func_t pin_pb6_funcs[] = { | ||
PAD(STM32F4_PINMUX_FUNC_PB6_USART1_TX, STM32F4X_PIN_CONFIG_AF_PUSH_UP), | ||
}; | ||
|
||
static const stm32_pin_func_t pin_pa0_funcs[] = { | ||
[STM32F4_PINMUX_FUNC_PA0_PWM2_CH1 - 1] = | ||
STM32F4X_PIN_CONFIG_AF_PUSH_UP, | ||
static const stm32_pin_func_t pin_pb7_funcs[] = { | ||
PAD(STM32F4_PINMUX_FUNC_PB7_USART1_RX, STM32F4X_PIN_CONFIG_AF_PUSH_UP), | ||
}; | ||
|
||
/** | ||
* @brief pin configuration | ||
*/ | ||
static const struct stm32_pinmux_conf pins[] = { | ||
STM32_PIN_CONF(STM32_PIN_PA0, pin_pa0_funcs), | ||
STM32_PIN_CONF(STM32_PIN_PA2, pin_pa2_funcs), | ||
STM32_PIN_CONF(STM32_PIN_PA3, pin_pa3_funcs), | ||
STM32_PIN_CONF(STM32_PIN_PA9, pin_pa9_funcs), | ||
STM32_PIN_CONF(STM32_PIN_PA10, pin_pa10_funcs), | ||
STM32_PIN_CONF(STM32_PIN_PB6, pin_pb6_funcs), | ||
STM32_PIN_CONF(STM32_PIN_PB7, pin_pb7_funcs), | ||
STM32_PIN_CONF(STM32_PIN_PA2, pin_pa2_funcs), | ||
STM32_PIN_CONF(STM32_PIN_PA3, pin_pa3_funcs), | ||
STM32_PIN_CONF(STM32_PIN_PA0, pin_pa0_funcs), | ||
}; | ||
|
||
int stm32_get_pin_config(int pin, int func) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to separate this on more than one line?