Tuesday, April 26, 2016

Configuring and trigger GPIO on FreeRTOS



On my MQTT broker I wanted to have also a visual view of incoming packets along with monitoring the WiFi connection.

To do that I need to control the RGB led connected on my Witty module.

Controlling the GPIO assume two steps:

1. Configuring the GPIO

        #include "gpio.h"
        #define LED13_GPIO 13

    GPIO_ConfigTypeDef led13;
    led13.GPIO_Pin = GPIO_Pin_13;
    led13.GPIO_Mode = GPIO_Mode_Output;
    led13.GPIO_Pullup = GPIO_PullUp_DIS;
    led13.GPIO_IntrType = GPIO_PIN_INTR_DISABLE;

    gpio_config(&led13);

2. Triggering the GPIO 

    GPIO_OUTPUT_SET(LED13_GPIO,1); 
    vTaskDelay(100 / portTICK_RATE_MS);

    GPIO_OUTPUT_SET(LED13_GPIO,0);

No comments:

Post a Comment