init
This commit is contained in:
3
main/CMakeLists.txt
Normal file
3
main/CMakeLists.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
idf_component_register(SRCS "hello_world_main.c"
|
||||
PRIV_REQUIRES spi_flash esp_driver_gpio
|
||||
INCLUDE_DIRS "")
|
||||
34
main/hello_world_main.c
Normal file
34
main/hello_world_main.c
Normal file
@@ -0,0 +1,34 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
#include "sdkconfig.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "esp_chip_info.h"
|
||||
#include "esp_flash.h"
|
||||
#include "esp_system.h"
|
||||
#include "driver/gpio.h"
|
||||
|
||||
#define LED_GPIO 15
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
|
||||
gpio_config_t io_conf = {
|
||||
.pin_bit_mask = LED_GPIO,
|
||||
.mode = GPIO_MODE_OUTPUT,
|
||||
.pull_up_en = GPIO_PULLUP_DISABLE,
|
||||
.pull_down_en = GPIO_PULLDOWN_DISABLE,
|
||||
.intr_type = GPIO_INTR_DISABLE, // No interrupt for now
|
||||
};
|
||||
|
||||
esp_err_t ret = gpio_config(&io_conf);
|
||||
|
||||
while(1) {
|
||||
printf("hello");
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
gpio_set_level(LED_GPIO, 1);
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
gpio_set_level(LED_GPIO, 0);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user