2026-03-19 3:53 AM - edited 2026-03-19 9:25 AM
I've always found it a little irritating:
#define CLK_A_Pin GPIO_PIN_0
#define CLK_A_GPIO_Port GPIOFWhy is it deemed necessary to have "GPIO" in one, but not the other?
Surely, that should be either:
#define CLK_A_GPIO_Pin GPIO_PIN_0
#define CLK_A_GPIO_Port GPIOF("GPIO" in both),
Or:
#define CLK_A_Pin GPIO_PIN_0
#define CLK_A_Port GPIOF("GPIO" in neither)
(There isn't a label for "suggestion" - so "bug report" is the nearest option)
Solved! Go to Solution.
2026-03-19 6:34 AM
Hello @Andrew Neil
Your change request ID is #0060783
I will keep you posted with updates.
@Andrew Neil wrote:
I haven't had a chance to try CubeMX2 yet - does the same apply there?
Any question related to MX2 should be posted in the MX2 forum, where you can receive complete technical support from the dedicated team.
STM32CubeMX2 (MCUs) - STMicroelectronics Community
THX
Ghofrane
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2026-03-19 5:31 AM
Hello @Andrew Neil
I believe your request is valid and reasonable.
It will improve clarity and consistency, especially in larger projects, and will also help with code readability and maintainability.
I am raising this change request with our development team.
THX
Ghofrane
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2026-03-19 5:47 AM
@Ghofrane GSOURI wrote:I believe your request is valid and reasonable.
Thanks.
I haven't had a chance to try CubeMX2 yet - does the same apply there?
2026-03-19 6:34 AM
Hello @Andrew Neil
Your change request ID is #0060783
I will keep you posted with updates.
@Andrew Neil wrote:
I haven't had a chance to try CubeMX2 yet - does the same apply there?
Any question related to MX2 should be posted in the MX2 forum, where you can receive complete technical support from the dedicated team.
STM32CubeMX2 (MCUs) - STMicroelectronics Community
THX
Ghofrane
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2026-03-19 6:53 AM - edited 2026-03-19 6:54 AM
I do agree with @Andrew Neil , meanwhile that may break completion of previously generated code of user projects.
2026-03-19 7:15 AM
@mƎALLEm wrote:I do agree with @Andrew Neil , meanwhile that may break completion of previously generated code of user projects.
I agree. It should be an option for the user to select a different pin naming. The default should be backwards compatible.
Personally I think pin and port both need to be uppercase. It's convention to have #define constants all upper case.
So I would prefer if it was something like this:
#define CLK_A_GPIO_PIN GPIO_PIN_0
#define CLK_A_GPIO_PORT GPIOF
2026-03-19 7:23 AM
@mƎALLEm @unsigned_char_array Yes, there would be an issue if an old project were opened in a newer CubeMX which made this change.
That should, at the very least, give a warning.
Preferably an option to change or not.
@Ghofrane GSOURI I forgot to say that my preference would be for both names to not have the "GPIO"; ie,
#define CLK_A_Pin GPIO_PIN_0 #define CLK_A_Port GPIOF
I'm all for brevity; the "GPIO" seems entirely redundant.
2026-03-19 7:26 AM
@unsigned_char_array wrote:I think pin and port both need to be uppercase. It's convention to have #define constants all upper case
Agreed.
But this would affect all #define symbols generated by CubeMX - not just pin/port names.
Maybe start a separate thread for that ... ?
2026-03-19 7:50 AM
@Andrew Neil wrote:
@unsigned_char_array wrote:I think pin and port both need to be uppercase. It's convention to have #define constants all upper case
Agreed.
But this would affect all #define symbols generated by CubeMX - not just pin/port names.
Maybe start a separate thread for that ... ?
To my knowledge only GPIO macros have lower case in them. But I could be wrong.
2026-03-19 8:07 AM
@unsigned_char_array wrote:
To my knowledge only GPIO macros have lower case in them. But I could be wrong.
Also applies to User Constants; eg,
Although these are all user-entered - so, if you want an uppercase-only policy, then don't enter lowercase in any of these fields.