[PATCH] Proposal for new GPIO API and example implementation for STM32F4 BSP

Karel Gardas karel at functional.vision
Sat Jun 25 19:46:39 UTC 2022


Hello Duc,

one reminder, your API should be more or less portable. That means the 
example which you produce as a testing example should be API-wise 
portable between various BSPs. Is that clear?

I know, I know, sometimes user led 1 on F4 is on different port/pin on 
F7 and then on H7 you get it on even different port/pin, but!

 > stm32f4_gpio_get_ctrl(GPIOD, &ctrl);

do you expect this to be called from app running on RPi4 for example? Or 
on beagle bone white? Or on stm32h757i-eval board?

Please generalize and make that bit portable too.

Thanks,
Karel

On 6/25/22 15:00, Duc Doan wrote:
> Hello Christian,
> 
> I forgot to send the sample code. Here it a code to turn on an LED:
> 
> /*****************************************/
> 
> // Obtain the pointer to the instance (port D)
> rtems_gpio_ctrl_t *ctrl;
> stm32f4_gpio_get_ctrl(GPIOD, &ctrl);
> 
> // enable clocks for port D
> rtems_gpio_initialize(ctrl);
> 
> // configure the pin
> rtems_gpio_set_pin_mode(ctrl, &LED_PIN, RTEMS_GPIO_PINMODE_OUTPUT_PP);
> rtems_gpio_set_pull(ctrl, &LED_PIN, RTEMS_GPIO_PULLUP);
> 
> // output to LED
> rtems_gpio_write(ctrl, &LED_PIN, RTEMS_GPIO_PIN_SET);
> 
> /*****************************************/
> 
> Best,
> 
> Duc Doan
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel



More information about the devel mailing list