Page 1 of 1

PIN_MAP in STM32 cores

Posted: Thu Feb 13, 2020 12:53 am
by bit_factory
Hi everybody,
passing from Roger Clark to STM32 cores I've noticed there is no structure analogue to PIN_MAP present in the last one.

My problem is to get the GPIO port of a given pin referred by his macro. For example I need to get the GPIO pointer of PA12 pin.
With Clarks library the pointer is PIN_MAP[PA12].gpio_device
Is in STM32 cores an analogue struct, macro or function to get the same result?

Any help very grateful Thank you

Re: PIN_MAP in STM32 cores

Posted: Thu Feb 13, 2020 6:38 am
by fpiSTM
The STM32 core is based on CMSIS.
So you can directly access to GPIO port register it by their name:

Code: Select all

GPIOA->IDR

Re: PIN_MAP in STM32 cores

Posted: Thu Feb 13, 2020 9:31 pm
by bit_factory
I know,
but with maple I can do that:

Code: Select all


#define RS_PIN PA6
gpio_dev* RS_GPIO = PIN_MAP[RS_PIN].gpio_device;
...
//now I can use RS_GPIO that points to GPIOA (the port device of PA6 pin)

I'm looking for something similiar with The STM32 core

Thank

Re: PIN_MAP in STM32 cores

Posted: Fri Feb 14, 2020 6:21 am
by fpiSTM
This implementation is not available in STM32 core.
What do you want achieve ?

Maybe this is you what you looking for:

Code: Select all

digitalPinToPort(PA12);
This will return the GPIOA register pointer.