forked from xuhongv/StudyInEsp32
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2018-5-5 first commit
- Loading branch information
Showing
15 changed files
with
139 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# | ||
# This is a project Makefile. It is assumed the directory this Makefile resides in is a | ||
# project subdirectory. | ||
# | ||
|
||
PROJECT_NAME := hello-world | ||
|
||
include $(IDF_PATH)/make/project.mk | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Hello World Example | ||
|
||
Starts a FreeRTOS task to print "Hello World" | ||
|
||
See the README.md file in the upper level 'examples' directory for more information about examples. |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# | ||
# "main" pseudo-component makefile. | ||
# | ||
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* Hello World 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 "esp_spi_flash.h" | ||
|
||
|
||
void app_main() | ||
{ | ||
printf("Hello world!\n"); | ||
|
||
/* Print chip information */ | ||
|
||
esp_chip_info_t chip_info; | ||
esp_chip_info(&chip_info); | ||
|
||
|
||
printf("--------------------------------------------\n\r "); | ||
|
||
printf("Hellow World , Esp32 !!\n\r "); | ||
|
||
printf("This is ESP32 chip with %d CPU cores, WiFi%s%s, ", | ||
chip_info.cores, | ||
(chip_info.features & CHIP_FEATURE_BT) ? "/BT" : "", | ||
(chip_info.features & CHIP_FEATURE_BLE) ? "/BLE" : ""); | ||
|
||
printf("silicon revision %d, ", chip_info.revision); | ||
|
||
printf("%dMB %s flash\n", spi_flash_get_chip_size() / (1024 * 1024), | ||
(chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external"); | ||
|
||
|
||
printf("--------------------------------------------\n\r "); | ||
fflush(stdout); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# | ||
# This is a project Makefile. It is assumed the directory this Makefile resides in is a | ||
# project subdirectory. | ||
# | ||
|
||
PROJECT_NAME := 2_blink_led | ||
|
||
include $(IDF_PATH)/make/project.mk | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Blink Example | ||
|
||
Starts a FreeRTOS task to blink an LED | ||
|
||
See the README.md file in the upper level 'examples' directory for more information about examples. |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
menu "Example Configuration" | ||
|
||
config BLINK_GPIO | ||
int "Blink GPIO number" | ||
range 0 34 | ||
default 5 | ||
help | ||
GPIO number (IOxx) to blink on and off. | ||
|
||
Some GPIOs are used for other purposes (flash connections, etc.) and cannot be used to blink. | ||
|
||
GPIOs 35-39 are input-only so cannot be used as outputs. | ||
|
||
endmenu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* 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 "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 16 | ||
|
||
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_PERIOD_MS); | ||
/* Blink on (output high) */ | ||
gpio_set_level(BLINK_GPIO, 1); | ||
vTaskDelay(1000 / portTICK_PERIOD_MS); | ||
} | ||
} | ||
|
||
void app_main() | ||
{ | ||
xTaskCreate(&blink_task, "blink_task", configMINIMAL_STACK_SIZE, NULL, 5, NULL); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# | ||
# "main" pseudo-component makefile. | ||
# | ||
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) |