PIN_MAP in STM32 cores

Post here first, or if you can't find a relevant section!
Post Reply
bit_factory
Posts: 7
Joined: Sun Jan 26, 2020 11:23 pm

PIN_MAP in STM32 cores

Post 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

User avatar
fpiSTM
Posts: 261
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 5
Location: Le Mans
Contact:

Re: PIN_MAP in STM32 cores

Post 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

bit_factory
Posts: 7
Joined: Sun Jan 26, 2020 11:23 pm

Re: PIN_MAP in STM32 cores

Post 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

User avatar
fpiSTM
Posts: 261
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 5
Location: Le Mans
Contact:

Re: PIN_MAP in STM32 cores

Post 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.

Post Reply

Return to “General discussion”