8000 Addition of top level README.md · programmer131/esp32-snippets@23f514f · GitHub
[go: up one dir, main page]

Skip to content

Commit 23f514f

Browse files
author
kolban
committed
Addition of top level README.md
1 parent 5fc8f4f commit 23f514f

File tree

5 files changed

+51
-10
lines changed

5 files changed

+51
-10
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ start:
77
new:
88
@echo "Creating a new ESP-IDF Template app"
99
@git clone https://github.com/espressif/esp-idf-template.git newapp
10+
@rm -rf newapp/.git
1011
@echo "New app can be found in newapp"

vfs/vfs-skeleton/main/main.c

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
/**
2+
* Test the Virtual File System
3+
*
4+
* Perform a test against the Virtual File System.
5+
*
6+
* For additional details and documentation see:
7+
* * Free book on ESP32 - https://leanpub.com/kolban-ESP32
8+
*
9+
*
10+
* Neil Kolban <kolban1@kolban.com>
11+
*
12+
*/
113
#include "freertos/FreeRTOS.h"
214
#include "esp_wifi.h"
315
#include "esp_system.h"
@@ -8,6 +20,7 @@
820
#include "driver/gpio.h"
921
#include "vfsTest.h"
1022
#include "stdio.h"
23+
#include "fcntl.h"
1124

1225
char tag[] = "vfs-skeleton";
1326
esp_err_t event_handler(void *ctx, system_event_t *event)
@@ -35,10 +48,18 @@ int app_main(void)
3548
ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &sta_config) );
3649
//ESP_ERROR_CHECK( esp_wifi_start() );
3750
//ESP_ERROR_CHECK( esp_wifi_connect() );
51+
52+
// Perform the tests on the VFS
3853
registerTestVFS("/data");
3954
ESP_LOGI(tag, "vfs registered");
40-
FILE *f = fopen("/data/x", "w");
41-
fprintf(f, "Hello!");
55+
56+
FILE *file = fopen("/data/x", "w");
57+
if (file == NULL) {
58+
ESP_LOGE(tag, "failed to open file");
59+
return 0;
60+
}
61+
62+
fprintf(file, "Hello!");
4263
return 0;
4364
}
4465

vfs/vfs-skeleton/main/vfsTest.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
/**
2+
* Test the Virtual File System
3+
*
4+
* Perform a test against the Virtual File System.
5+
*
6+
* For additional details and documentation see:
7+
* * Free book on ESP32 - https://leanpub.com/kolban-ESP32
8+
*
9+
*
10+
* Neil Kolban <kolban1@kolban.com>
11+
*
12+
*/
113
#include "vfsTest.h"
214
#include "esp_vfs.h"
315
#include "esp_log.h"
@@ -99,7 +111,7 @@ static int vfs_rename(const char *oldPath, const char *newPath) {
99111

100112

101113
/**
102-
* Resgister the VFS at the specified mount point.
114+
* Register the VFS at the specified mount point.
103115
* The callback functions are registered to handle the
104116
* different functions that may be requested against the
105117
* VFS.
@@ -108,6 +120,8 @@ void registerTestVFS(char *mountPoint) {
108120
esp_vfs_t vfs;
109121
esp_err_t err;
110122

123+
vfs.fd_offset = 0;
124+
vfs.flags = ESP_VFS_FLAG_DEFAULT;
111125
vfs.write = vfs_write;
112126
vfs.lseek = vfs_lseek;
113127
vfs.read = vfs_read;
@@ -118,7 +132,6 @@ void registerTestVFS(char *mountPoint) {
118132
vfs.link = vfs_link;
119133
vfs.rename = vfs_rename;
120134

121-
122135
err = esp_vfs_register(mountPoint, &vfs, NULL);
123136
if (err != ESP_OK) {
124137
ESP_LOGE(tag, "esp_vfs_register: err=%d", err);

vfs/vfs-skeleton/main/vfsTest.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
/*
2-
* vfsTest.h
1+
/**
2+
* Test the Virtual File System
3+
*
4+
* Perform a test against the Virtual File System.
5+
*
6+
* For additional details and documentation see:
7+
* * Free book on ESP32 - https://leanpub.com/kolban-ESP32
8+
*
9+
*
10+
* Neil Kolban <kolban1@kolban.com>
311
*
4-
* Created on: Nov 5, 2016
5-
* Author: kolban
612
*/
713

814
#ifndef MAIN_VFSTEST_H_

vfs/vfs-skeleton/sdkconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ CONFIG_NEWLIB_STDOUT_ADDCR=y
8888
# CONFIG_ULP_COPROC_ENABLED is not set
8989
CONFIG_ULP_COPROC_RESERVE_MEM=0
9090
# CONFIG_ESP32_PANIC_PRINT_HALT is not set
91-
CONFIG_ESP32_PANIC_PRINT_REBOOT=y
91+
# CONFIG_ESP32_PANIC_PRINT_REBOOT is not set
9292
# CONFIG_ESP32_PANIC_SILENT_REBOOT is not set
93-
# CONFIG_ESP32_PANIC_GDBSTUB is not set
93+
CONFIG_ESP32_PANIC_GDBSTUB=y
9494
CONFIG_ESP32_DEBUG_OCDAWARE=y
9595
CONFIG_INT_WDT=y
9696
CONFIG_INT_WDT_TIMEOUT_MS=300

0 commit comments

Comments
 (0)
0