hi
a simply blinky demo with xTask ( FreeRTOS )
we can mask the gpio too.
but this shows the simple things.
have used simple api:
Code: Select all
GPIO_OUTPUT_SET( gpio_no, bit_value )
for your free using:
Code: Select all
/*
* user_main.c
*
* Created on: 30.12.2015
* Author: rudi ;-)
* Free Blinky example by using the xtask in freertos
* do not forget to use lib: driver
* in makefile for gpio
*
*/
// change this to your right paths
#include <esp_common.h>
#include <../driver_lib/include/gpio.h>
#include <../freertos/task.h>
#include <../freertos/FreeRTOS.h>
// select your gpio here
// do not use gpio 23
// there is no gpio 23 :) on esp31b alias esp32beta
const int gpio = 22;
/* task to blink an LED.
* simple used
* GPIO_OUTPUT_SET( gpio_no, bit_value )
* 1s (1000ms) high
* 3s (3000ms) low
* if you connect led+ to powersupply+ and led- to the gpiopin 22
* then led is on if pin is low ( 0 ) and will 3s (3000ms) on, and 1s (1000ms) off
*/
void blinkyTask(void *pvParameters)
{
// ESP32
// GPIO_OUTPUT_SET( gpio_no, bit_value )
while(1) {
printf("GPIO:%i goes high\n",gpio);
GPIO_OUTPUT_SET( gpio, 1 );
vTaskDelay(1000 / portTICK_RATE_MS);
printf("GPIO:%i goes low\n", gpio);
GPIO_OUTPUT_SET( gpio, 0 );
vTaskDelay(3000 / portTICK_RATE_MS);
}
}
void user_init(void)
{
printf("Hi - this is the ESP32beta Blinky Demo using xTask (FreeRTOS)\n");
xTaskCreate(blinkyTask, (signed char *)"blinkyTask", 256, NULL, 2, NULL);
}
best wishes
rudi
edit: named topic to "ESP32beta" ( ESP31B ) because we have later ESP32 "release"
edit2: As long as there is no available "Guide" as ESP32 FreeRTOS documentary online and if you're not familiar with FreeRTOS, maybe help in the meantime, the ESP8266. There are good sections enable the easy entry into the ESP32. Then combine it with useful sections of ESP32_RTOS_API_Referenz. Hope this helps for the meantime.
http://bbs.espressif.com/viewtopic.php?f=51&t=822#p1569
@admin
can you create a "code example" extra topic, please?