mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
examples: Move blink code to main task
This commit is contained in:
parent
f746b0d761
commit
94594af13f
@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
#define BLINK_GPIO CONFIG_BLINK_GPIO
|
#define BLINK_GPIO CONFIG_BLINK_GPIO
|
||||||
|
|
||||||
void blink_task(void *pvParameter)
|
void app_main()
|
||||||
{
|
{
|
||||||
/* Configure the IOMUX register for pad BLINK_GPIO (some pads are
|
/* Configure the IOMUX register for pad BLINK_GPIO (some pads are
|
||||||
muxed to GPIO on reset already, but some default to other
|
muxed to GPIO on reset already, but some default to other
|
||||||
@ -30,15 +30,12 @@ void blink_task(void *pvParameter)
|
|||||||
gpio_set_direction(BLINK_GPIO, GPIO_MODE_OUTPUT);
|
gpio_set_direction(BLINK_GPIO, GPIO_MODE_OUTPUT);
|
||||||
while(1) {
|
while(1) {
|
||||||
/* Blink off (output low) */
|
/* Blink off (output low) */
|
||||||
|
printf("Turning off the LED\n");
|
||||||
gpio_set_level(BLINK_GPIO, 0);
|
gpio_set_level(BLINK_GPIO, 0);
|
||||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||||
/* Blink on (output high) */
|
/* Blink on (output high) */
|
||||||
|
printf("Turning on the LED\n");
|
||||||
gpio_set_level(BLINK_GPIO, 1);
|
gpio_set_level(BLINK_GPIO, 1);
|
||||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void app_main()
|
|
||||||
{
|
|
||||||
xTaskCreate(&blink_task, "blink_task", configMINIMAL_STACK_SIZE, NULL, 5, NULL);
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user