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

Duc Doan dtbpkmte at gmail.com
Sat Jun 25 13:00:45 UTC 2022


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


More information about the devel mailing list