mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
a98ab8d801
Add notes that current NVS layout defaults are a Work In Progress and not yet integrated with the partition table.
49 lines
1.4 KiB
C
49 lines
1.4 KiB
C
/* Blink Example
|
|
|
|
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
|
|
|
Unless required by applicable law or agreed to in writing, this
|
|
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
CONDITIONS OF ANY KIND, either express or implied.
|
|
*/
|
|
#include <stdio.h>
|
|
#include "freertos/FreeRTOS.h"
|
|
#include "freertos/task.h"
|
|
#include "esp_system.h"
|
|
#include "nvs_flash.h"
|
|
#include "driver/gpio.h"
|
|
#include "sdkconfig.h"
|
|
|
|
/* Can run 'make menuconfig' to choose the GPIO to blink,
|
|
or you can edit the following line and set a number here.
|
|
*/
|
|
#define BLINK_GPIO CONFIG_BLINK_GPIO
|
|
|
|
void blink_task(void *pvParameter)
|
|
{
|
|
/* Configure the IOMUX register for pad BLINK_GPIO (some pads are
|
|
muxed to GPIO on reset already, but some default to other
|
|
functions and need to be switched to GPIO. Consult the
|
|
Technical Reference for a list of pads and their default
|
|
functions.)
|
|
*/
|
|
gpio_pad_select_gpio(BLINK_GPIO);
|
|
/* Set the GPIO as a push/pull output */
|
|
gpio_set_direction(BLINK_GPIO, GPIO_MODE_OUTPUT);
|
|
while(1) {
|
|
/* Blink off (output low) */
|
|
gpio_set_level(BLINK_GPIO, 0);
|
|
vTaskDelay(1000 / portTICK_RATE_MS);
|
|
/* Blink on (output high) */
|
|
gpio_set_level(BLINK_GPIO, 1);
|
|
vTaskDelay(1000 / portTICK_RATE_MS);
|
|
}
|
|
}
|
|
|
|
void app_main()
|
|
{
|
|
nvs_flash_init();
|
|
system_init();
|
|
xTaskCreate(&blink_task, "blink_task", 512, NULL, 5, NULL);
|
|
}
|