Hi I've ran into a strange issue.
When wanting to read an analogue value from PB0 or PB1. I've had to use the defines PB0/1 but PB_0 and PB_1 will always return 0...
While PA_4 and PA_5 will return analogue values.
I'm trying to understand why that's the case, and if that could be a bug?
I had thought P## and P_## were meant to be interchangeable?
This is on the F030RCT6.
Thanks.
Difference in pin defines?
Difference in pin defines?
Just a dogs body developer, mostly making props and stuff...
Re: Difference in pin defines?
Totally wrong.Mangy_Dog wrote: Wed Dec 18, 2024 1:40 pm Hi I've ran into a strange issue.
When wanting to read an analogue value from PB0 or PB1. I've had to use the defines PB0/1 but PB_0 and PB_1 will always return 0...
While PA_4 and PA_5 will return analogue values.
I'm trying to understand why that's the case, and if that could be a bug?
I had thought P## and P_## were meant to be interchangeable?
This is on the F030RCT6.
Thanks.
PY_n is a PinName which is a concatenation of "GPIO_port << 4 | GPIO_PIN".
Ex:
Code: Select all
// Pin name definition
PA_0 = (PortA << 4) + 0x00,
In some case they can be equal, ex for a generic variant, PA0 is the pin number 0 so it matches. But if PA0 is not 0 on other variant it is not the same.
Always use pin number (PYn) with the standard Arduino API, the it is used to find the PinName (PY_n).
You can use the PinName for some extra API, simply check the prototype.