Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
2018-5-5 first commit
  • Loading branch information
xuhongv committed May 5, 2018
1 parent 68f7b04 commit d32f6b1
Show file tree
Hide file tree
Showing 15 changed files with 139 additions and 0 deletions.
9 changes: 9 additions & 0 deletions 1_hello_world/Makefile
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

5 changes: 5 additions & 0 deletions 1_hello_world/README.md
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 added 1_hello_world/alreadyBin/bootloader.bin
Binary file not shown.
Binary file added 1_hello_world/alreadyBin/hello-world.bin
Binary file not shown.
Binary file not shown.
5 changes: 5 additions & 0 deletions 1_hello_world/main/component.mk
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.)

44 changes: 44 additions & 0 deletions 1_hello_world/main/hello_world_main.c
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);

}
9 changes: 9 additions & 0 deletions 2_blink_led/Makefile
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

5 changes: 5 additions & 0 deletions 2_blink_led/README.md
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 added 2_blink_led/alreadyBin/2_blink_led.bin
Binary file not shown.
Binary file added 2_blink_led/alreadyBin/bootloader.bin
Binary file not shown.
Binary file not shown.
14 changes: 14 additions & 0 deletions 2_blink_led/main/Kconfig.projbuild
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
44 changes: 44 additions & 0 deletions 2_blink_led/main/blink.c
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);
}
4 changes: 4 additions & 0 deletions 2_blink_led/main/component.mk
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.)

0 comments on commit d32f6b1

Please sign in to comment.