├── .gitignore ├── .settings ├── language.settings.xml ├── org.eclipse.cdt.codan.core.prefs ├── org.eclipse.cdt.core.prefs └── org.eclipse.ltk.core.refactoring.prefs ├── .vscode ├── c_cpp_properties.json └── tasks.json ├── Documents ├── ER-TFTM035-6_Datasheet.pdf ├── ER-TFTM035-6_Interfacing.pdf ├── FT6236-FT6336-FT6436L-FT6436_Datasheet.pdf ├── ILI9341.pdf ├── ILI9488.pdf ├── ST7789S.pdf ├── ST7789V.pdf ├── STMPE610-ST Microelectronics.pdf ├── STMPE610.pdf └── XPT2046.pdf ├── Makefile ├── README.md ├── components ├── mkspiffs │ ├── .travis.yml │ ├── Makefile.projbuild │ ├── component.mk │ └── src │ │ ├── Makefile │ │ ├── README.md │ │ ├── appveyor.yml │ │ ├── main.cpp │ │ ├── spiffs │ │ ├── esp_spiffs.c │ │ ├── esp_spiffs.h │ │ ├── spiffs.h │ │ ├── spiffs_cache.c │ │ ├── spiffs_check.c │ │ ├── spiffs_config.h │ │ ├── spiffs_gc.c │ │ ├── spiffs_hydrogen.c │ │ ├── spiffs_nucleus.c │ │ └── spiffs_nucleus.h │ │ └── tclap │ │ ├── Arg.h │ │ ├── ArgException.h │ │ ├── ArgTraits.h │ │ ├── COPYING │ │ ├── CmdLine.h │ │ ├── CmdLineInterface.h │ │ ├── CmdLineOutput.h │ │ ├── Constraint.h │ │ ├── DocBookOutput.h │ │ ├── HelpVisitor.h │ │ ├── IgnoreRestVisitor.h │ │ ├── MultiArg.h │ │ ├── MultiSwitchArg.h │ │ ├── OptionalUnlabeledTracker.h │ │ ├── StandardTraits.h │ │ ├── StdOutput.h │ │ ├── SwitchArg.h │ │ ├── UnlabeledMultiArg.h │ │ ├── UnlabeledValueArg.h │ │ ├── ValueArg.h │ │ ├── ValuesConstraint.h │ │ ├── VersionVisitor.h │ │ ├── Visitor.h │ │ ├── XorHandler.h │ │ └── ZshCompletionOutput.h ├── spidriver │ ├── component.mk │ ├── spi_master_lobo.c │ └── spi_master_lobo.h ├── spiffs │ ├── component.mk │ ├── esp_spiffs.c │ ├── esp_spiffs.h │ ├── list.c │ ├── list.h │ ├── mutex.c │ ├── mutex.h │ ├── spiffs.h │ ├── spiffs_cache.c │ ├── spiffs_check.c │ ├── spiffs_config.h │ ├── spiffs_gc.c │ ├── spiffs_hydrogen.c │ ├── spiffs_nucleus.c │ ├── spiffs_nucleus.h │ ├── spiffs_vfs.c │ └── spiffs_vfs.h ├── spiffs_image │ ├── Makefile.projbuild │ ├── component.mk │ ├── image │ │ ├── fonts │ │ │ ├── BigFont.fon │ │ │ ├── DejaVuSans12.fon │ │ │ ├── DejaVuSans18.fon │ │ │ ├── DejaVuSans24.fon │ │ │ ├── DotMatrix_M.fon │ │ │ ├── Grotesk24x48.fon │ │ │ ├── SmallFont.fon │ │ │ ├── Ubuntu.fon │ │ │ ├── arial_bold.fon │ │ │ ├── ocrfont.c │ │ │ └── swiss721_outline.fon │ │ ├── images │ │ │ ├── test1.jpg │ │ │ ├── test2.jpg │ │ │ ├── test3.jpg │ │ │ ├── test4.jpg │ │ │ └── tiger.bmp │ │ └── spiffs.info │ └── spiffs_image.img └── tft │ ├── DefaultFont.c │ ├── DejaVuSans18.c │ ├── DejaVuSans24.c │ ├── SmallFont.c │ ├── Ubuntu16.c │ ├── comic24.c │ ├── component.mk │ ├── def_small.c │ ├── minya24.c │ ├── stmpe610.h │ ├── tft.c │ ├── tft.h │ ├── tftspi.c │ ├── tftspi.h │ └── tooney32.c ├── main ├── Kconfig.projbuild ├── component.mk └── tft_demo.c ├── partitions_example.csv ├── sdkconfig.defaults └── tools ├── DejaVuSans.ttf ├── Vera.ttf ├── def_small.c ├── dejavu.c ├── dejavuX.c ├── dejavuY.c ├── msvcp71.dll ├── msvcr71.dll ├── readme.txt ├── ttf2c_vc2003.exe └── vera.c /.gitignore: -------------------------------------------------------------------------------- 1 | .config 2 | *.o 3 | *.pyc 4 | *.a 5 | *.d 6 | 7 | # gtags 8 | GTAGS 9 | GRTAGS 10 | GPATH 11 | 12 | # emacs 13 | .dir-locals.el 14 | 15 | # emacs temp file suffixes 16 | *~ 17 | .#* 18 | \#*# 19 | 20 | sdkconfig 21 | sdkconfig.old 22 | sdkconfig.lobo 23 | .cproject 24 | .project 25 | .settings 26 | BUILD 27 | PBUILD 28 | build/ 29 | temp/ 30 | local/ 31 | *.dis 32 | *.elf 33 | *.map 34 | **/.DS_Store 35 | -------------------------------------------------------------------------------- /.settings/language.settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.settings/org.eclipse.cdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.2062137617.1047447828/ESP_IDF/delimiter=\: 3 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.2062137617.1047447828/ESP_IDF/operation=replace 4 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.2062137617.1047447828/ESP_IDF/value=/home/LoBo2_Razno/ESP32/esp-idf 5 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.2062137617.1047447828/IDF_PATH/delimiter=\: 6 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.2062137617.1047447828/IDF_PATH/operation=append 7 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.2062137617.1047447828/IDF_PATH/value=/home/LoBo2_Razno/ESP32/esp-idf 8 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.2062137617.1047447828/PATH/delimiter=\: 9 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.2062137617.1047447828/PATH/operation=replace 10 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.2062137617.1047447828/PATH/value=/bin\:/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/usr/games\:/usr/local/games\:/snap/bin\:/usr/lib/jvm/java-8-oracle/bin\:/usr/lib/jvm/java-8-oracle/db/bin\:/usr/lib/jvm/java-8-oracle/jre/bin\:/home/LoBo2_Razno/ESP32/xtensa-esp32-elf/bin 11 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.2062137617.1047447828/append=true 12 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.2062137617.1047447828/appendContributed=true 13 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.2062137617/IDF_PATH/delimiter=\: 14 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.2062137617/IDF_PATH/operation=append 15 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.2062137617/IDF_PATH/value=/home/LoBo2_Razno/ESP32/esp-idf 16 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.2062137617/PATH/delimiter=\: 17 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.2062137617/PATH/operation=replace 18 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.2062137617/PATH/value=/home/LoBo2_Razno/ESP32/xtensa-esp32-elf/bin\:/bin\:/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/usr/lib/jvm/java-8-oracle/bin\:/usr/lib/jvm/java-8-oracle/db/bin\:/usr/lib/jvm/java-8-oracle/jre/bin 19 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.2062137617/append=true 20 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.2062137617/appendContributed=true 21 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.458462299/IDF_PATH/delimiter=\: 22 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.458462299/IDF_PATH/operation=replace 23 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.458462299/IDF_PATH/value=/Users/jaumeolivepetrus/esp-idf 24 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.458462299/PATH/delimiter=\: 25 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.458462299/PATH/operation=replace 26 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.458462299/PATH/value=/usr/local/xtensa-esp32-elf/bin\:/bin\:/usr/bin\:/usr/sbin\:/sbin 27 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.458462299/append=true 28 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.458462299/appendContributed=true 29 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.458462299/v/delimiter=\: 30 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.458462299/v/operation=append 31 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.458462299/v/value=1 32 | -------------------------------------------------------------------------------- /.settings/org.eclipse.ltk.core.refactoring.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false 3 | -------------------------------------------------------------------------------- /.vscode/c_cpp_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "Mac", 5 | "includePath": [ 6 | "/usr/include", 7 | "/usr/local/include", 8 | "${workspaceRoot}" 9 | ], 10 | "defines": [], 11 | "intelliSenseMode": "clang-x64", 12 | "browse": { 13 | "path": [ 14 | "/usr/include", 15 | "/usr/local/include", 16 | "${workspaceRoot}" 17 | ], 18 | "limitSymbolsToIncludedHeaders": true, 19 | "databaseFilename": "" 20 | }, 21 | "macFrameworkPath": [ 22 | "/System/Library/Frameworks", 23 | "/Library/Frameworks" 24 | ] 25 | }, 26 | { 27 | "name": "Linux", 28 | "includePath": [ 29 | "/home/LoBo2_Razno/ESP32/esp-idf/components", 30 | "/home/LoBo2_Razno/ESP32/esp-idf/components/driver/include", 31 | "/home/LoBo2_Razno/ESP32/esp-idf/components/newlib/include", 32 | "/home/LoBo2_Razno/ESP32/esp-idf/components/freertos/include", 33 | "/home/LoBo2_Razno/ESP32/esp-idf/components/esp32/include", 34 | "/home/LoBo2_Razno/ESP32/esp-idf/components/log/include", 35 | "/home/LoBo2_Razno/ESP32/esp-idf/components/nvs_flash/include", 36 | "/home/LoBo2_Razno/ESP32/esp-idf/components/heap/include", 37 | "/home/LoBo2_Razno/ESP32/esp-idf/components/tcpip_adapter/include", 38 | "/home/LoBo2_Razno/ESP32/esp-idf/components/soc/include", 39 | "/home/LoBo2_Razno/ESP32/esp-idf/components/lwip/include/lwip", 40 | "/home/LoBo2_Razno/ESP32/esp-idf/components/lwip/include/lwip/port", 41 | "/home/LoBo2_Razno/ESP32/esp-idf/components/soc/esp32/include", 42 | "${workspaceRoot}/build/include", 43 | "${workspaceRoot}/components/tft", 44 | "${workspaceRoot}/components/spiffs", 45 | "${workspaceRoot}/components/spidriver", 46 | "/usr/include/c++/7", 47 | "/usr/include/x86_64-linux-gnu/c++/7", 48 | "/usr/include/c++/7/backward", 49 | "/usr/lib/gcc/x86_64-linux-gnu/7/include", 50 | "/usr/local/include", 51 | "/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed", 52 | "/usr/include/x86_64-linux-gnu", 53 | "/usr/include", 54 | "${workspaceRoot}" 55 | ], 56 | "defines": [], 57 | "intelliSenseMode": "clang-x64", 58 | "browse": { 59 | "path": [ 60 | "/home/LoBo2_Razno/ESP32/esp-idf/components", 61 | "/usr/include/c++/7", 62 | "/usr/include/x86_64-linux-gnu/c++/7", 63 | "/usr/include/c++/7/backward", 64 | "/usr/lib/gcc/x86_64-linux-gnu/7/include", 65 | "/usr/local/include", 66 | "/usr/lib/gcc/x86_64-linux-gnu/7/include-fixed", 67 | "/usr/include/x86_64-linux-gnu", 68 | "/usr/include", 69 | "${workspaceRoot}" 70 | ], 71 | "limitSymbolsToIncludedHeaders": true, 72 | "databaseFilename": "" 73 | } 74 | }, 75 | { 76 | "name": "Win32", 77 | "includePath": [ 78 | "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include", 79 | "${workspaceRoot}" 80 | ], 81 | "defines": [ 82 | "_DEBUG", 83 | "UNICODE" 84 | ], 85 | "intelliSenseMode": "msvc-x64", 86 | "browse": { 87 | "path": [ 88 | "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include/*", 89 | "${workspaceRoot}" 90 | ], 91 | "limitSymbolsToIncludedHeaders": true, 92 | "databaseFilename": "" 93 | } 94 | } 95 | ], 96 | "version": 3 97 | } -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.1.0", 3 | "command": "bash", 4 | "args": ["-c"], 5 | "isShellCommand": true, 6 | "showOutput": "always", 7 | "suppressTaskName": true, 8 | "options": { 9 | "cwd": "${workspaceRoot}" 10 | }, 11 | "tasks": [ 12 | { 13 | "taskName": "build app", 14 | "args": ["./BUILD all"], 15 | "isBuildCommand": false, 16 | "problemMatcher": { 17 | "owner": "cpp", 18 | "fileLocation": "absolute", 19 | "pattern": { 20 | "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", 21 | "file": 1, 22 | "line": 2, 23 | "column": 3, 24 | "severity": 4, 25 | "message": 5 26 | } 27 | } 28 | }, 29 | { 30 | "taskName": "build app -j8", 31 | "args": ["./BUILD -j8 all"], 32 | "isBuildCommand": true, 33 | "problemMatcher": { 34 | "owner": "cpp", 35 | "fileLocation": "absolute", 36 | "pattern": { 37 | "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", 38 | "file": 1, 39 | "line": 2, 40 | "column": 3, 41 | "severity": 4, 42 | "message": 5 43 | } 44 | } 45 | }, 46 | { 47 | "taskName": "clean app", 48 | "args": ["./BUILD clean"] 49 | }, 50 | { 51 | "taskName": "flash app", 52 | "args": ["make app-flash"] 53 | }, 54 | { 55 | "taskName": "monitor", 56 | "command": "gnome-terminal", 57 | "args": ["-e","make monitor"], 58 | "isShellCommand": false, 59 | "showOutput": "never" 60 | }, 61 | { 62 | "taskName": "menuconfig", 63 | "command": "gnome-terminal", 64 | "args": ["-e","make menuconfig"], 65 | "isShellCommand": false, 66 | "showOutput": "never" 67 | } 68 | ] 69 | } -------------------------------------------------------------------------------- /Documents/ER-TFTM035-6_Datasheet.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loboris/ESP32_TFT_library/aa21772f54a71887ec08b2e8bbaef9e304009891/Documents/ER-TFTM035-6_Datasheet.pdf -------------------------------------------------------------------------------- /Documents/ER-TFTM035-6_Interfacing.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loboris/ESP32_TFT_library/aa21772f54a71887ec08b2e8bbaef9e304009891/Documents/ER-TFTM035-6_Interfacing.pdf -------------------------------------------------------------------------------- /Documents/FT6236-FT6336-FT6436L-FT6436_Datasheet.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loboris/ESP32_TFT_library/aa21772f54a71887ec08b2e8bbaef9e304009891/Documents/FT6236-FT6336-FT6436L-FT6436_Datasheet.pdf -------------------------------------------------------------------------------- /Documents/ILI9341.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loboris/ESP32_TFT_library/aa21772f54a71887ec08b2e8bbaef9e304009891/Documents/ILI9341.pdf -------------------------------------------------------------------------------- /Documents/ILI9488.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loboris/ESP32_TFT_library/aa21772f54a71887ec08b2e8bbaef9e304009891/Documents/ILI9488.pdf -------------------------------------------------------------------------------- /Documents/ST7789S.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loboris/ESP32_TFT_library/aa21772f54a71887ec08b2e8bbaef9e304009891/Documents/ST7789S.pdf -------------------------------------------------------------------------------- /Documents/ST7789V.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loboris/ESP32_TFT_library/aa21772f54a71887ec08b2e8bbaef9e304009891/Documents/ST7789V.pdf -------------------------------------------------------------------------------- /Documents/STMPE610-ST Microelectronics.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loboris/ESP32_TFT_library/aa21772f54a71887ec08b2e8bbaef9e304009891/Documents/STMPE610-ST Microelectronics.pdf -------------------------------------------------------------------------------- /Documents/STMPE610.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loboris/ESP32_TFT_library/aa21772f54a71887ec08b2e8bbaef9e304009891/Documents/STMPE610.pdf -------------------------------------------------------------------------------- /Documents/XPT2046.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loboris/ESP32_TFT_library/aa21772f54a71887ec08b2e8bbaef9e304009891/Documents/XPT2046.pdf -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | 6 | PROJECT_NAME := tft_demo 7 | 8 | EXTRA_CFLAGS += --save-temps 9 | 10 | include $(IDF_PATH)/make/project.mk 11 | 12 | -------------------------------------------------------------------------------- /components/mkspiffs/.travis.yml: -------------------------------------------------------------------------------- 1 | language: cpp 2 | addons: 3 | apt: 4 | sources: 5 | - ubuntu-toolchain-r-test 6 | packages: 7 | - g++-4.8 8 | script: 9 | - export CXX="g++-4.8" CC="gcc-4.8" 10 | - make dist 11 | notifications: 12 | email: 13 | recipients: 14 | - ivan@esp8266.com 15 | on_success: change 16 | on_failure: always 17 | deploy: 18 | provider: releases 19 | api_key: 20 | secure: k/DDoCfLXIct8TcGjekKm5CAoTL6Wy6LXhI74Ssgc8VSbjJQ1crO2J4V5HnQw7QplgAXwqjkoAUkzEJiz34wqBaAv0w9o8+5jPwCP6rMQ/VEvbn1MPI52KIFbYqKxmXe5J24B00BttbGc773ldXPnvmv+qPWWcXDTpcosni2laBt3z8bxCGVwkQ7nuQUaAelzs21wQuhjmKQ6F1dgNN5XhdJ5qgFYYM8cwiigvcqIaCwLMcrOs7gj22TS242pzp38etWhfxUbqUKejWgOH4qYeU3Tf5gsu4WV0otbqXYMvV18gVSoAiMnodDfYJUNHlfelCAEqebvECrIvvE8D0syuVYz6fh2/BrxZ6HeiYj1CXILghOjPUZZZ7/chKglWnA1vL+6Uxn5LtyTJ5gbgMYXvKQUXrRVZ3Zd9xrmv/YaMnGq+6BDBkS30aXpSK2X0HvW9/6JyQ9L1sjnKdOzDmagvikHm2rrPXBRMMfYTt4nucgUBWqJqyFe0uGva/n8TG5RzOzdOgRxFx/lF8XudtR4Z4gUBUFpve/meVHVVK82+cxzfN97aFdxvBzyGq18EDjOEpDi7k7mZjXUycvD8UZ7o12sxJ0Zr6/9esiFUsaqyE+2Vi6bMbgEHGx7hfWbdfREnpOtjFLH+u5mAPIqOh89a/UJ6SbYm0cON+ewTMUkJ8= 21 | file: mkspiffs-$TRAVIS_TAG-linux64.tar.gz 22 | on: 23 | repo: igrr/mkspiffs 24 | tags: true 25 | -------------------------------------------------------------------------------- /components/mkspiffs/Makefile.projbuild: -------------------------------------------------------------------------------- 1 | MKSPIFFS_COMPONENT_PATH := $(COMPONENT_PATH) 2 | MKSPIFFS_BUILD_DIR=$(abspath $(MKSPIFFS_COMPONENT_PATH)/mkspiffs) 3 | 4 | # Custom recursive make for mkspiffs sub-project 5 | MKSPIFFS_MAKE=+$(MAKE) -C $(MKSPIFFS_COMPONENT_PATH)/src 6 | 7 | .PHONY: mkspiffs clean 8 | 9 | mkspiffs: $(SDKCONFIG_MAKEFILE) 10 | $(MKSPIFFS_MAKE) all 11 | 12 | clean: $(SDKCONFIG_MAKEFILE) 13 | $(MKSPIFFS_MAKE) clean 14 | 15 | -------------------------------------------------------------------------------- /components/mkspiffs/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Component Makefile 3 | # 4 | 5 | COMPONENT_SRCDIRS := 6 | COMPONENT_ADD_INCLUDEDIRS := 7 | -------------------------------------------------------------------------------- /components/mkspiffs/src/Makefile: -------------------------------------------------------------------------------- 1 | CFLAGS ?= -std=gnu99 -Os -Wall 2 | CXXFLAGS ?= -std=gnu++11 -Os -Wall 3 | 4 | ifeq ($(OS),Windows_NT) 5 | TARGET_OS := WINDOWS 6 | DIST_SUFFIX := windows 7 | ARCHIVE_CMD := 7z a 8 | ARCHIVE_EXTENSION := zip 9 | TARGET := mkspiffs.exe 10 | CC=gcc.exe 11 | CXX=g++.exe 12 | TARGET_CFLAGS := -mno-ms-bitfields 13 | TARGET_LDFLAGS := -Wl,-static -static-libgcc 14 | 15 | else 16 | UNAME_S := $(shell uname -s) 17 | ifeq ($(UNAME_S),Linux) 18 | TARGET_OS := LINUX 19 | UNAME_P := $(shell uname -p) 20 | ifeq ($(UNAME_P),x86_64) 21 | DIST_SUFFIX := linux64 22 | endif 23 | ifneq ($(filter %86,$(UNAME_P)),) 24 | DIST_SUFFIX := linux32 25 | endif 26 | CC=gcc 27 | CXX=g++ 28 | TARGET_CFLAGS = -std=gnu99 -Os -Wall -Itclap -Ispiffs -I. -D$(TARGET_OS) -DVERSION=\"$(VERSION)\" -D__NO_INLINE__ 29 | TARGET_CXXFLAGS = -std=gnu++11 -Os -Wall -Itclap -Ispiffs -I. -D$(TARGET_OS) -DVERSION=\"$(VERSION)\" -D__NO_INLINE__ 30 | endif 31 | ifeq ($(UNAME_S),Darwin) 32 | TARGET_OS := OSX 33 | DIST_SUFFIX := osx 34 | CC=clang 35 | CXX=clang++ 36 | TARGET_CFLAGS = -std=gnu99 -Os -Wall -Itclap -Ispiffs -I. -D$(TARGET_OS) -DVERSION=\"$(VERSION)\" -D__NO_INLINE__ -mmacosx-version-min=10.7 -arch x86_64 37 | TARGET_CXXFLAGS = -std=gnu++11 -Os -Wall -Itclap -Ispiffs -I. -D$(TARGET_OS) -DVERSION=\"$(VERSION)\" -D__NO_INLINE__ -mmacosx-version-min=10.7 -arch x86_64 -stdlib=libc++ 38 | TARGET_LDFLAGS = -arch x86_64 -stdlib=libc++ 39 | endif 40 | ARCHIVE_CMD := tar czf 41 | ARCHIVE_EXTENSION := tar.gz 42 | TARGET := mkspiffs 43 | endif 44 | 45 | OBJ := main.o \ 46 | spiffs/spiffs_cache.o \ 47 | spiffs/spiffs_check.o \ 48 | spiffs/spiffs_gc.o \ 49 | spiffs/spiffs_hydrogen.o \ 50 | spiffs/spiffs_nucleus.o \ 51 | 52 | VERSION ?= $(shell git describe --always) 53 | 54 | .PHONY: all clean 55 | 56 | all: $(TARGET) 57 | 58 | $(TARGET): 59 | @echo "Building mkspiffs ..." 60 | $(CC) $(TARGET_CFLAGS) -c spiffs/spiffs_cache.c -o spiffs/spiffs_cache.o 61 | $(CC) $(TARGET_CFLAGS) -c spiffs/spiffs_check.c -o spiffs/spiffs_check.o 62 | $(CC) $(TARGET_CFLAGS) -c spiffs/spiffs_gc.c -o spiffs/spiffs_gc.o 63 | $(CC) $(TARGET_CFLAGS) -c spiffs/spiffs_hydrogen.c -o spiffs/spiffs_hydrogen.o 64 | $(CC) $(TARGET_CFLAGS) -c spiffs/spiffs_nucleus.c -o spiffs/spiffs_nucleus.o 65 | $(CXX) $(TARGET_CXXFLAGS) -c main.cpp -o main.o 66 | $(CXX) $(TARGET_CFLAGS) -o $(TARGET) $(OBJ) $(TARGET_LDFLAGS) 67 | 68 | clean: 69 | @rm -f *.o 70 | @rm -f spiffs/*.o 71 | @rm -f $(TARGET) -------------------------------------------------------------------------------- /components/mkspiffs/src/README.md: -------------------------------------------------------------------------------- 1 | # mkspiffs 2 | Tool to build and unpack [SPIFFS](https://github.com/pellepl/spiffs) images. 3 | 4 | 5 | ## Usage 6 | 7 | ``` 8 | 9 | mkspiffs {-c |-u |-l|-i} [-d <0-5>] [-b ] 10 | [-p ] [-s ] [--] [--version] [-h] 11 | 12 | 13 | 14 | Where: 15 | 16 | -c , --create 17 | (OR required) create spiffs image from a directory 18 | -- OR -- 19 | -u , --unpack 20 | (OR required) unpack spiffs image to a directory 21 | -- OR -- 22 | -l, --list 23 | (OR required) list files in spiffs image 24 | -- OR -- 25 | -i, --visualize 26 | (OR required) visualize spiffs image 27 | 28 | 29 | -d <0-5>, --debug <0-5> 30 | Debug level. 0 means no debug output. 31 | 32 | -b , --block 33 | fs block size, in bytes 34 | 35 | -p , --page 36 | fs page size, in bytes 37 | 38 | -s , --size 39 | fs image size, in bytes 40 | 41 | --, --ignore_rest 42 | Ignores the rest of the labeled arguments following this flag. 43 | 44 | --version 45 | Displays version information and exits. 46 | 47 | -h, --help 48 | Displays usage information and exits. 49 | 50 | 51 | (required) spiffs image file 52 | 53 | 54 | ``` 55 | ## Build 56 | 57 | You need gcc (≥4.8) or clang(≥600.0.57), and make. On Windows, use MinGW. 58 | 59 | Run: 60 | ```bash 61 | $ make dist 62 | ``` 63 | 64 | ### Build status 65 | 66 | Linux | Windows 67 | ------|------- 68 | [![Linux build status](http://img.shields.io/travis/igrr/mkspiffs.svg)](https://travis-ci.org/igrr/mkspiffs) | [![Windows build status](http://img.shields.io/appveyor/ci/igrr/mkspiffs.svg)](https://ci.appveyor.com/project/igrr/mkspiffs) 69 | 70 | 71 | ## License 72 | 73 | MIT 74 | 75 | ## To do 76 | 77 | - [ ] Add more debug output and print SPIFFS debug output 78 | - [ ] Error handling 79 | - [ ] Determine the image size automatically when opening a file 80 | - [ ] Code cleanup 81 | -------------------------------------------------------------------------------- /components/mkspiffs/src/appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 0.0.{build} 2 | 3 | platform: 4 | - x86 5 | 6 | skip_commits: 7 | message: /\[ci skip\]/ 8 | 9 | matrix: 10 | fast_finish: true 11 | 12 | build_script: 13 | - SET PATH=C:\MinGW\bin;C:\MinGW\msys\1.0\bin;%PATH% 14 | - make dist 15 | 16 | artifacts: 17 | - path: '*.zip' 18 | 19 | deploy: 20 | release: $(PRODUCT_VERSION) 21 | provider: GitHub 22 | auth_token: 23 | secure: 'PGg5fnoBpP1Omzr6f3KIYDiD8J30rretQjSl/MITRpzvSCmN88kM6VDMz1TBGZTA' 24 | artifact: /.*\.zip/ 25 | draft: true 26 | prerelease: false 27 | on: 28 | appveyor_repo_tag: true 29 | -------------------------------------------------------------------------------- /components/mkspiffs/src/spiffs/esp_spiffs.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Lua RTOS, SPIFFS low access 3 | * 4 | * Copyright (C) 2015 - 2017 5 | * IBEROXARXA SERVICIOS INTEGRALES, S.L. & CSS IBÉRICA, S.L. 6 | * 7 | * Author: Jaume Olivé (jolive@iberoxarxa.com / jolive@whitecatboard.org) 8 | * 9 | * All rights reserved. 10 | * 11 | * Permission to use, copy, modify, and distribute this software 12 | * and its documentation for any purpose and without fee is hereby 13 | * granted, provided that the above copyright notice appear in all 14 | * copies and that both that the copyright notice and this 15 | * permission notice and warranty disclaimer appear in supporting 16 | * documentation, and that the name of the author not be used in 17 | * advertising or publicity pertaining to distribution of the 18 | * software without specific, written prior permission. 19 | * 20 | * The author disclaim all warranties with regard to this 21 | * software, including all implied warranties of merchantability 22 | * and fitness. In no event shall the author be liable for any 23 | * special, indirect or consequential damages or any damages 24 | * whatsoever resulting from loss of use, data or profits, whether 25 | * in an action of contract, negligence or other tortious action, 26 | * arising out of or in connection with the use or performance of 27 | * this software. 28 | */ 29 | 30 | #include 31 | 32 | #include "esp_spiffs.h" 33 | #include "esp_attr.h" 34 | 35 | #include "spiffs.h" 36 | 37 | #include 38 | 39 | s32_t esp32_spi_flash_read(u32_t addr, u32_t size, u8_t *dst) { 40 | u32_t aaddr; 41 | u8_t *buff = NULL; 42 | u8_t *abuff = NULL; 43 | u32_t asize; 44 | 45 | asize = size; 46 | 47 | // Align address to 4 byte 48 | aaddr = (addr + (4 - 1)) & (u32_t)-4; 49 | if (aaddr != addr) { 50 | aaddr -= 4; 51 | asize += (addr - aaddr); 52 | } 53 | 54 | // Align size to 4 byte 55 | asize = (asize + (4 - 1)) & (u32_t)-4; 56 | 57 | if ((aaddr != addr) || (asize != size)) { 58 | // Align buffer 59 | buff = malloc(asize + 4); 60 | if (!buff) { 61 | return SPIFFS_ERR_INTERNAL; 62 | } 63 | 64 | abuff = (u8_t *)(((ptrdiff_t)buff + (4 - 1)) & (u32_t)-4); 65 | 66 | if (spi_flash_read(aaddr, (void *)abuff, asize) != 0) { 67 | free(buff); 68 | return SPIFFS_ERR_INTERNAL; 69 | } 70 | 71 | memcpy(dst, abuff + (addr - aaddr), size); 72 | 73 | free(buff); 74 | } else { 75 | if (spi_flash_read(addr, (void *)dst, size) != 0) { 76 | return SPIFFS_ERR_INTERNAL; 77 | } 78 | } 79 | 80 | return SPIFFS_OK; 81 | } 82 | 83 | s32_t esp32_spi_flash_write(u32_t addr, u32_t size, const u8_t *src) { 84 | u32_t aaddr; 85 | u8_t *buff = NULL; 86 | u8_t *abuff = NULL; 87 | u32_t asize; 88 | 89 | asize = size; 90 | 91 | // Align address to 4 byte 92 | aaddr = (addr + (4 - 1)) & -4; 93 | if (aaddr != addr) { 94 | aaddr -= 4; 95 | asize += (addr - aaddr); 96 | } 97 | 98 | // Align size to 4 byte 99 | asize = (asize + (4 - 1)) & -4; 100 | 101 | if ((aaddr != addr) || (asize != size)) { 102 | // Align buffer 103 | buff = malloc(asize + 4); 104 | if (!buff) { 105 | return SPIFFS_ERR_INTERNAL; 106 | } 107 | 108 | abuff = (u8_t *)(((ptrdiff_t)buff + (4 - 1)) & -4); 109 | 110 | if (spi_flash_read(aaddr, (void *)abuff, asize) != 0) { 111 | free(buff); 112 | return SPIFFS_ERR_INTERNAL; 113 | } 114 | 115 | memcpy(abuff + (addr - aaddr), src, size); 116 | 117 | if (spi_flash_write(aaddr, (uint32_t *)abuff, asize) != 0) { 118 | free(buff); 119 | return SPIFFS_ERR_INTERNAL; 120 | } 121 | 122 | free(buff); 123 | } else { 124 | if (spi_flash_write(addr, (uint32_t *)src, size) != 0) { 125 | return SPIFFS_ERR_INTERNAL; 126 | } 127 | } 128 | 129 | return SPIFFS_OK; 130 | } 131 | 132 | s32_t IRAM_ATTR esp32_spi_flash_erase(u32_t addr, u32_t size) { 133 | if (spi_flash_erase_sector(addr >> 12) != 0) { 134 | return SPIFFS_ERR_INTERNAL; 135 | } 136 | 137 | return SPIFFS_OK; 138 | } 139 | -------------------------------------------------------------------------------- /components/mkspiffs/src/spiffs/esp_spiffs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Lua RTOS, write syscall implementation 3 | * 4 | * Copyright (C) 2015 - 2017 5 | * IBEROXARXA SERVICIOS INTEGRALES, S.L. & CSS IBÉRICA, S.L. 6 | * 7 | * Author: Jaume Olivé (jolive@iberoxarxa.com / jolive@whitecatboard.org) 8 | * 9 | * All rights reserved. 10 | * 11 | * Permission to use, copy, modify, and distribute this software 12 | * and its documentation for any purpose and without fee is hereby 13 | * granted, provided that the above copyright notice appear in all 14 | * copies and that both that the copyright notice and this 15 | * permission notice and warranty disclaimer appear in supporting 16 | * documentation, and that the name of the author not be used in 17 | * advertising or publicity pertaining to distribution of the 18 | * software without specific, written prior permission. 19 | * 20 | * The author disclaim all warranties with regard to this 21 | * software, including all implied warranties of merchantability 22 | * and fitness. In no event shall the author be liable for any 23 | * special, indirect or consequential damages or any damages 24 | * whatsoever resulting from loss of use, data or profits, whether 25 | * in an action of contract, negligence or other tortious action, 26 | * arising out of or in connection with the use or performance of 27 | * this software. 28 | */ 29 | 30 | #ifndef __ESP_SPIFFS_H__ 31 | #define __ESP_SPIFFS_H__ 32 | 33 | #include "spiffs.h" 34 | 35 | s32_t esp32_spi_flash_read(u32_t addr, u32_t size, u8_t *dst); 36 | s32_t esp32_spi_flash_write(u32_t addr, u32_t size, const u8_t *src); 37 | s32_t esp32_spi_flash_erase(u32_t addr, u32_t size); 38 | 39 | #define low_spiffs_read (spiffs_read *)esp32_spi_flash_read 40 | #define low_spiffs_write (spiffs_write *)esp32_spi_flash_write 41 | #define low_spiffs_erase (spiffs_erase *)esp32_spi_flash_erase 42 | 43 | #endif // __ESP_SPIFFS_H__ 44 | -------------------------------------------------------------------------------- /components/mkspiffs/src/tclap/ArgException.h: -------------------------------------------------------------------------------- 1 | // -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- 2 | 3 | /****************************************************************************** 4 | * 5 | * file: ArgException.h 6 | * 7 | * Copyright (c) 2003, Michael E. Smoot . 8 | * All rights reverved. 9 | * 10 | * See the file COPYING in the top directory of this distribution for 11 | * more information. 12 | * 13 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 16 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | * DEALINGS IN THE SOFTWARE. 20 | * 21 | *****************************************************************************/ 22 | 23 | 24 | #ifndef TCLAP_ARG_EXCEPTION_H 25 | #define TCLAP_ARG_EXCEPTION_H 26 | 27 | #include 28 | #include 29 | 30 | namespace TCLAP { 31 | 32 | /** 33 | * A simple class that defines and argument exception. Should be caught 34 | * whenever a CmdLine is created and parsed. 35 | */ 36 | class ArgException : public std::exception 37 | { 38 | public: 39 | 40 | /** 41 | * Constructor. 42 | * \param text - The text of the exception. 43 | * \param id - The text identifying the argument source. 44 | * \param td - Text describing the type of ArgException it is. 45 | * of the exception. 46 | */ 47 | ArgException( const std::string& text = "undefined exception", 48 | const std::string& id = "undefined", 49 | const std::string& td = "Generic ArgException") 50 | : std::exception(), 51 | _errorText(text), 52 | _argId( id ), 53 | _typeDescription(td) 54 | { } 55 | 56 | /** 57 | * Destructor. 58 | */ 59 | virtual ~ArgException() throw() { } 60 | 61 | /** 62 | * Returns the error text. 63 | */ 64 | std::string error() const { return ( _errorText ); } 65 | 66 | /** 67 | * Returns the argument id. 68 | */ 69 | std::string argId() const 70 | { 71 | if ( _argId == "undefined" ) 72 | return " "; 73 | else 74 | return ( "Argument: " + _argId ); 75 | } 76 | 77 | /** 78 | * Returns the arg id and error text. 79 | */ 80 | const char* what() const throw() 81 | { 82 | static std::string ex; 83 | ex = _argId + " -- " + _errorText; 84 | return ex.c_str(); 85 | } 86 | 87 | /** 88 | * Returns the type of the exception. Used to explain and distinguish 89 | * between different child exceptions. 90 | */ 91 | std::string typeDescription() const 92 | { 93 | return _typeDescription; 94 | } 95 | 96 | 97 | private: 98 | 99 | /** 100 | * The text of the exception message. 101 | */ 102 | std::string _errorText; 103 | 104 | /** 105 | * The argument related to this exception. 106 | */ 107 | std::string _argId; 108 | 109 | /** 110 | * Describes the type of the exception. Used to distinguish 111 | * between different child exceptions. 112 | */ 113 | std::string _typeDescription; 114 | 115 | }; 116 | 117 | /** 118 | * Thrown from within the child Arg classes when it fails to properly 119 | * parse the argument it has been passed. 120 | */ 121 | class ArgParseException : public ArgException 122 | { 123 | public: 124 | /** 125 | * Constructor. 126 | * \param text - The text of the exception. 127 | * \param id - The text identifying the argument source 128 | * of the exception. 129 | */ 130 | ArgParseException( const std::string& text = "undefined exception", 131 | const std::string& id = "undefined" ) 132 | : ArgException( text, 133 | id, 134 | std::string( "Exception found while parsing " ) + 135 | std::string( "the value the Arg has been passed." )) 136 | { } 137 | }; 138 | 139 | /** 140 | * Thrown from CmdLine when the arguments on the command line are not 141 | * properly specified, e.g. too many arguments, required argument missing, etc. 142 | */ 143 | class CmdLineParseException : public ArgException 144 | { 145 | public: 146 | /** 147 | * Constructor. 148 | * \param text - The text of the exception. 149 | * \param id - The text identifying the argument source 150 | * of the exception. 151 | */ 152 | CmdLineParseException( const std::string& text = "undefined exception", 153 | const std::string& id = "undefined" ) 154 | : ArgException( text, 155 | id, 156 | std::string( "Exception found when the values ") + 157 | std::string( "on the command line do not meet ") + 158 | std::string( "the requirements of the defined ") + 159 | std::string( "Args." )) 160 | { } 161 | }; 162 | 163 | /** 164 | * Thrown from Arg and CmdLine when an Arg is improperly specified, e.g. 165 | * same flag as another Arg, same name, etc. 166 | */ 167 | class SpecificationException : public ArgException 168 | { 169 | public: 170 | /** 171 | * Constructor. 172 | * \param text - The text of the exception. 173 | * \param id - The text identifying the argument source 174 | * of the exception. 175 | */ 176 | SpecificationException( const std::string& text = "undefined exception", 177 | const std::string& id = "undefined" ) 178 | : ArgException( text, 179 | id, 180 | std::string("Exception found when an Arg object ")+ 181 | std::string("is improperly defined by the ") + 182 | std::string("developer." )) 183 | { } 184 | 185 | }; 186 | 187 | class ExitException { 188 | public: 189 | ExitException(int estat) : _estat(estat) {} 190 | 191 | int getExitStatus() const { return _estat; } 192 | 193 | private: 194 | int _estat; 195 | }; 196 | 197 | } // namespace TCLAP 198 | 199 | #endif 200 | 201 | -------------------------------------------------------------------------------- /components/mkspiffs/src/tclap/ArgTraits.h: -------------------------------------------------------------------------------- 1 | // -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- 2 | 3 | /****************************************************************************** 4 | * 5 | * file: ArgTraits.h 6 | * 7 | * Copyright (c) 2007, Daniel Aarno, Michael E. Smoot . 8 | * All rights reverved. 9 | * 10 | * See the file COPYING in the top directory of this distribution for 11 | * more information. 12 | * 13 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 16 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | * DEALINGS IN THE SOFTWARE. 20 | * 21 | *****************************************************************************/ 22 | 23 | // This is an internal tclap file, you should probably not have to 24 | // include this directly 25 | 26 | #ifndef TCLAP_ARGTRAITS_H 27 | #define TCLAP_ARGTRAITS_H 28 | 29 | namespace TCLAP { 30 | 31 | // We use two empty structs to get compile type specialization 32 | // function to work 33 | 34 | /** 35 | * A value like argument value type is a value that can be set using 36 | * operator>>. This is the default value type. 37 | */ 38 | struct ValueLike { 39 | typedef ValueLike ValueCategory; 40 | virtual ~ValueLike() {} 41 | }; 42 | 43 | /** 44 | * A string like argument value type is a value that can be set using 45 | * operator=(string). Usefull if the value type contains spaces which 46 | * will be broken up into individual tokens by operator>>. 47 | */ 48 | struct StringLike { 49 | virtual ~StringLike() {} 50 | }; 51 | 52 | /** 53 | * A class can inherit from this object to make it have string like 54 | * traits. This is a compile time thing and does not add any overhead 55 | * to the inherenting class. 56 | */ 57 | struct StringLikeTrait { 58 | typedef StringLike ValueCategory; 59 | virtual ~StringLikeTrait() {} 60 | }; 61 | 62 | /** 63 | * A class can inherit from this object to make it have value like 64 | * traits. This is a compile time thing and does not add any overhead 65 | * to the inherenting class. 66 | */ 67 | struct ValueLikeTrait { 68 | typedef ValueLike ValueCategory; 69 | virtual ~ValueLikeTrait() {} 70 | }; 71 | 72 | /** 73 | * Arg traits are used to get compile type specialization when parsing 74 | * argument values. Using an ArgTraits you can specify the way that 75 | * values gets assigned to any particular type during parsing. The two 76 | * supported types are StringLike and ValueLike. 77 | */ 78 | template 79 | struct ArgTraits { 80 | typedef typename T::ValueCategory ValueCategory; 81 | virtual ~ArgTraits() {} 82 | //typedef ValueLike ValueCategory; 83 | }; 84 | 85 | #endif 86 | 87 | } // namespace 88 | -------------------------------------------------------------------------------- /components/mkspiffs/src/tclap/COPYING: -------------------------------------------------------------------------------- 1 | 2 | 3 | Copyright (c) 2003 Michael E. Smoot 4 | 5 | Permission is hereby granted, free of charge, to any person 6 | obtaining a copy of this software and associated documentation 7 | files (the "Software"), to deal in the Software without restriction, 8 | including without limitation the rights to use, copy, modify, merge, 9 | publish, distribute, sublicense, and/or sell copies of the Software, 10 | and to permit persons to whom the Software is furnished to do so, 11 | subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 18 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 20 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 21 | AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 22 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | THE SOFTWARE. 24 | 25 | 26 | -------------------------------------------------------------------------------- /components/mkspiffs/src/tclap/CmdLineInterface.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | * 4 | * file: CmdLineInterface.h 5 | * 6 | * Copyright (c) 2003, Michael E. Smoot . 7 | * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno. 8 | * All rights reverved. 9 | * 10 | * See the file COPYING in the top directory of this distribution for 11 | * more information. 12 | * 13 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 16 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | * DEALINGS IN THE SOFTWARE. 20 | * 21 | *****************************************************************************/ 22 | 23 | #ifndef TCLAP_COMMANDLINE_INTERFACE_H 24 | #define TCLAP_COMMANDLINE_INTERFACE_H 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | 33 | namespace TCLAP { 34 | 35 | class Arg; 36 | class CmdLineOutput; 37 | class XorHandler; 38 | 39 | /** 40 | * The base class that manages the command line definition and passes 41 | * along the parsing to the appropriate Arg classes. 42 | */ 43 | class CmdLineInterface 44 | { 45 | public: 46 | 47 | /** 48 | * Destructor 49 | */ 50 | virtual ~CmdLineInterface() {} 51 | 52 | /** 53 | * Adds an argument to the list of arguments to be parsed. 54 | * \param a - Argument to be added. 55 | */ 56 | virtual void add( Arg& a )=0; 57 | 58 | /** 59 | * An alternative add. Functionally identical. 60 | * \param a - Argument to be added. 61 | */ 62 | virtual void add( Arg* a )=0; 63 | 64 | /** 65 | * Add two Args that will be xor'd. 66 | * If this method is used, add does 67 | * not need to be called. 68 | * \param a - Argument to be added and xor'd. 69 | * \param b - Argument to be added and xor'd. 70 | */ 71 | virtual void xorAdd( Arg& a, Arg& b )=0; 72 | 73 | /** 74 | * Add a list of Args that will be xor'd. If this method is used, 75 | * add does not need to be called. 76 | * \param xors - List of Args to be added and xor'd. 77 | */ 78 | virtual void xorAdd( std::vector& xors )=0; 79 | 80 | /** 81 | * Parses the command line. 82 | * \param argc - Number of arguments. 83 | * \param argv - Array of arguments. 84 | */ 85 | virtual void parse(int argc, const char * const * argv)=0; 86 | 87 | /** 88 | * Parses the command line. 89 | * \param args - A vector of strings representing the args. 90 | * args[0] is still the program name. 91 | */ 92 | void parse(std::vector& args); 93 | 94 | /** 95 | * Returns the CmdLineOutput object. 96 | */ 97 | virtual CmdLineOutput* getOutput()=0; 98 | 99 | /** 100 | * \param co - CmdLineOutput object that we want to use instead. 101 | */ 102 | virtual void setOutput(CmdLineOutput* co)=0; 103 | 104 | /** 105 | * Returns the version string. 106 | */ 107 | virtual std::string& getVersion()=0; 108 | 109 | /** 110 | * Returns the program name string. 111 | */ 112 | virtual std::string& getProgramName()=0; 113 | 114 | /** 115 | * Returns the argList. 116 | */ 117 | virtual std::list& getArgList()=0; 118 | 119 | /** 120 | * Returns the XorHandler. 121 | */ 122 | virtual XorHandler& getXorHandler()=0; 123 | 124 | /** 125 | * Returns the delimiter string. 126 | */ 127 | virtual char getDelimiter()=0; 128 | 129 | /** 130 | * Returns the message string. 131 | */ 132 | virtual std::string& getMessage()=0; 133 | 134 | /** 135 | * Indicates whether or not the help and version switches were created 136 | * automatically. 137 | */ 138 | virtual bool hasHelpAndVersion()=0; 139 | 140 | /** 141 | * Resets the instance as if it had just been constructed so that the 142 | * instance can be reused. 143 | */ 144 | virtual void reset()=0; 145 | }; 146 | 147 | } //namespace 148 | 149 | 150 | #endif 151 | -------------------------------------------------------------------------------- /components/mkspiffs/src/tclap/CmdLineOutput.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | /****************************************************************************** 4 | * 5 | * file: CmdLineOutput.h 6 | * 7 | * Copyright (c) 2004, Michael E. Smoot 8 | * All rights reverved. 9 | * 10 | * See the file COPYING in the top directory of this distribution for 11 | * more information. 12 | * 13 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 16 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | * DEALINGS IN THE SOFTWARE. 20 | * 21 | *****************************************************************************/ 22 | 23 | #ifndef TCLAP_CMDLINEOUTPUT_H 24 | #define TCLAP_CMDLINEOUTPUT_H 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | namespace TCLAP { 34 | 35 | class CmdLineInterface; 36 | class ArgException; 37 | 38 | /** 39 | * The interface that any output object must implement. 40 | */ 41 | class CmdLineOutput 42 | { 43 | 44 | public: 45 | 46 | /** 47 | * Virtual destructor. 48 | */ 49 | virtual ~CmdLineOutput() {} 50 | 51 | /** 52 | * Generates some sort of output for the USAGE. 53 | * \param c - The CmdLine object the output is generated for. 54 | */ 55 | virtual void usage(CmdLineInterface& c)=0; 56 | 57 | /** 58 | * Generates some sort of output for the version. 59 | * \param c - The CmdLine object the output is generated for. 60 | */ 61 | virtual void version(CmdLineInterface& c)=0; 62 | 63 | /** 64 | * Generates some sort of output for a failure. 65 | * \param c - The CmdLine object the output is generated for. 66 | * \param e - The ArgException that caused the failure. 67 | */ 68 | virtual void failure( CmdLineInterface& c, 69 | ArgException& e )=0; 70 | 71 | }; 72 | 73 | } //namespace TCLAP 74 | #endif 75 | -------------------------------------------------------------------------------- /components/mkspiffs/src/tclap/Constraint.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | * 4 | * file: Constraint.h 5 | * 6 | * Copyright (c) 2005, Michael E. Smoot 7 | * All rights reverved. 8 | * 9 | * See the file COPYING in the top directory of this distribution for 10 | * more information. 11 | * 12 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 13 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 15 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 17 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 18 | * DEALINGS IN THE SOFTWARE. 19 | * 20 | *****************************************************************************/ 21 | 22 | #ifndef TCLAP_CONSTRAINT_H 23 | #define TCLAP_CONSTRAINT_H 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | namespace TCLAP { 33 | 34 | /** 35 | * The interface that defines the interaction between the Arg and Constraint. 36 | */ 37 | template 38 | class Constraint 39 | { 40 | 41 | public: 42 | /** 43 | * Returns a description of the Constraint. 44 | */ 45 | virtual std::string description() const =0; 46 | 47 | /** 48 | * Returns the short ID for the Constraint. 49 | */ 50 | virtual std::string shortID() const =0; 51 | 52 | /** 53 | * The method used to verify that the value parsed from the command 54 | * line meets the constraint. 55 | * \param value - The value that will be checked. 56 | */ 57 | virtual bool check(const T& value) const =0; 58 | 59 | /** 60 | * Destructor. 61 | * Silences warnings about Constraint being a base class with virtual 62 | * functions but without a virtual destructor. 63 | */ 64 | virtual ~Constraint() { ; } 65 | }; 66 | 67 | } //namespace TCLAP 68 | #endif 69 | -------------------------------------------------------------------------------- /components/mkspiffs/src/tclap/DocBookOutput.h: -------------------------------------------------------------------------------- 1 | // -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- 2 | 3 | /****************************************************************************** 4 | * 5 | * file: DocBookOutput.h 6 | * 7 | * Copyright (c) 2004, Michael E. Smoot 8 | * All rights reverved. 9 | * 10 | * See the file COPYING in the top directory of this distribution for 11 | * more information. 12 | * 13 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 16 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | * DEALINGS IN THE SOFTWARE. 20 | * 21 | *****************************************************************************/ 22 | 23 | #ifndef TCLAP_DOCBOOKOUTPUT_H 24 | #define TCLAP_DOCBOOKOUTPUT_H 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #include "CmdLineInterface.h" 33 | #include "CmdLineOutput.h" 34 | #include "XorHandler.h" 35 | #include "Arg.h" 36 | 37 | namespace TCLAP { 38 | 39 | /** 40 | * A class that generates DocBook output for usage() method for the 41 | * given CmdLine and its Args. 42 | */ 43 | class DocBookOutput : public CmdLineOutput 44 | { 45 | 46 | public: 47 | 48 | /** 49 | * Prints the usage to stdout. Can be overridden to 50 | * produce alternative behavior. 51 | * \param c - The CmdLine object the output is generated for. 52 | */ 53 | virtual void usage(CmdLineInterface& c); 54 | 55 | /** 56 | * Prints the version to stdout. Can be overridden 57 | * to produce alternative behavior. 58 | * \param c - The CmdLine object the output is generated for. 59 | */ 60 | virtual void version(CmdLineInterface& c); 61 | 62 | /** 63 | * Prints (to stderr) an error message, short usage 64 | * Can be overridden to produce alternative behavior. 65 | * \param c - The CmdLine object the output is generated for. 66 | * \param e - The ArgException that caused the failure. 67 | */ 68 | virtual void failure(CmdLineInterface& c, 69 | ArgException& e ); 70 | 71 | protected: 72 | 73 | /** 74 | * Substitutes the char r for string x in string s. 75 | * \param s - The string to operate on. 76 | * \param r - The char to replace. 77 | * \param x - What to replace r with. 78 | */ 79 | void substituteSpecialChars( std::string& s, char r, std::string& x ); 80 | void removeChar( std::string& s, char r); 81 | void basename( std::string& s ); 82 | 83 | void printShortArg(Arg* it); 84 | void printLongArg(Arg* it); 85 | 86 | char theDelimiter; 87 | }; 88 | 89 | 90 | inline void DocBookOutput::version(CmdLineInterface& _cmd) 91 | { 92 | std::cout << _cmd.getVersion() << std::endl; 93 | } 94 | 95 | inline void DocBookOutput::usage(CmdLineInterface& _cmd ) 96 | { 97 | std::list argList = _cmd.getArgList(); 98 | std::string progName = _cmd.getProgramName(); 99 | std::string xversion = _cmd.getVersion(); 100 | theDelimiter = _cmd.getDelimiter(); 101 | XorHandler xorHandler = _cmd.getXorHandler(); 102 | std::vector< std::vector > xorList = xorHandler.getXorList(); 103 | basename(progName); 104 | 105 | std::cout << "" << std::endl; 106 | std::cout << "" << std::endl << std::endl; 108 | 109 | std::cout << "" << std::endl; 110 | 111 | std::cout << "" << std::endl; 112 | std::cout << "" << progName << "" << std::endl; 113 | std::cout << "1" << std::endl; 114 | std::cout << "" << std::endl; 115 | 116 | std::cout << "" << std::endl; 117 | std::cout << "" << progName << "" << std::endl; 118 | std::cout << "" << _cmd.getMessage() << "" << std::endl; 119 | std::cout << "" << std::endl; 120 | 121 | std::cout << "" << std::endl; 122 | std::cout << "" << std::endl; 123 | 124 | std::cout << "" << progName << "" << std::endl; 125 | 126 | // xor 127 | for ( int i = 0; (unsigned int)i < xorList.size(); i++ ) 128 | { 129 | std::cout << "" << std::endl; 130 | for ( ArgVectorIterator it = xorList[i].begin(); 131 | it != xorList[i].end(); it++ ) 132 | printShortArg((*it)); 133 | 134 | std::cout << "" << std::endl; 135 | } 136 | 137 | // rest of args 138 | for (ArgListIterator it = argList.begin(); it != argList.end(); it++) 139 | if ( !xorHandler.contains( (*it) ) ) 140 | printShortArg((*it)); 141 | 142 | std::cout << "" << std::endl; 143 | std::cout << "" << std::endl; 144 | 145 | std::cout << "" << std::endl; 146 | std::cout << "Description" << std::endl; 147 | std::cout << "" << std::endl; 148 | std::cout << _cmd.getMessage() << std::endl; 149 | std::cout << "" << std::endl; 150 | std::cout << "" << std::endl; 151 | 152 | std::cout << "" << std::endl; 153 | std::cout << "Options" << std::endl; 154 | 155 | std::cout << "" << std::endl; 156 | 157 | for (ArgListIterator it = argList.begin(); it != argList.end(); it++) 158 | printLongArg((*it)); 159 | 160 | std::cout << "" << std::endl; 161 | std::cout << "" << std::endl; 162 | 163 | std::cout << "" << std::endl; 164 | std::cout << "Version" << std::endl; 165 | std::cout << "" << std::endl; 166 | std::cout << xversion << std::endl; 167 | std::cout << "" << std::endl; 168 | std::cout << "" << std::endl; 169 | 170 | std::cout << "" << std::endl; 171 | 172 | } 173 | 174 | inline void DocBookOutput::failure( CmdLineInterface& _cmd, 175 | ArgException& e ) 176 | { 177 | static_cast(_cmd); // unused 178 | std::cout << e.what() << std::endl; 179 | throw ExitException(1); 180 | } 181 | 182 | inline void DocBookOutput::substituteSpecialChars( std::string& s, 183 | char r, 184 | std::string& x ) 185 | { 186 | size_t p; 187 | while ( (p = s.find_first_of(r)) != std::string::npos ) 188 | { 189 | s.erase(p,1); 190 | s.insert(p,x); 191 | } 192 | } 193 | 194 | inline void DocBookOutput::removeChar( std::string& s, char r) 195 | { 196 | size_t p; 197 | while ( (p = s.find_first_of(r)) != std::string::npos ) 198 | { 199 | s.erase(p,1); 200 | } 201 | } 202 | 203 | inline void DocBookOutput::basename( std::string& s ) 204 | { 205 | size_t p = s.find_last_of('/'); 206 | if ( p != std::string::npos ) 207 | { 208 | s.erase(0, p + 1); 209 | } 210 | } 211 | 212 | inline void DocBookOutput::printShortArg(Arg* a) 213 | { 214 | std::string lt = "<"; 215 | std::string gt = ">"; 216 | 217 | std::string id = a->shortID(); 218 | substituteSpecialChars(id,'<',lt); 219 | substituteSpecialChars(id,'>',gt); 220 | removeChar(id,'['); 221 | removeChar(id,']'); 222 | 223 | std::string choice = "opt"; 224 | if ( a->isRequired() ) 225 | choice = "plain"; 226 | 227 | std::cout << "acceptsMultipleValues() ) 229 | std::cout << " rep='repeat'"; 230 | 231 | 232 | std::cout << '>'; 233 | if ( !a->getFlag().empty() ) 234 | std::cout << a->flagStartChar() << a->getFlag(); 235 | else 236 | std::cout << a->nameStartString() << a->getName(); 237 | if ( a->isValueRequired() ) 238 | { 239 | std::string arg = a->shortID(); 240 | removeChar(arg,'['); 241 | removeChar(arg,']'); 242 | removeChar(arg,'<'); 243 | removeChar(arg,'>'); 244 | arg.erase(0, arg.find_last_of(theDelimiter) + 1); 245 | std::cout << theDelimiter; 246 | std::cout << "" << arg << ""; 247 | } 248 | std::cout << "" << std::endl; 249 | 250 | } 251 | 252 | inline void DocBookOutput::printLongArg(Arg* a) 253 | { 254 | std::string lt = "<"; 255 | std::string gt = ">"; 256 | 257 | std::string desc = a->getDescription(); 258 | substituteSpecialChars(desc,'<',lt); 259 | substituteSpecialChars(desc,'>',gt); 260 | 261 | std::cout << "" << std::endl; 262 | 263 | if ( !a->getFlag().empty() ) 264 | { 265 | std::cout << "" << std::endl; 266 | std::cout << "" << std::endl; 269 | std::cout << "" << std::endl; 270 | } 271 | 272 | std::cout << "" << std::endl; 273 | std::cout << "" << std::endl; 287 | std::cout << "" << std::endl; 288 | 289 | std::cout << "" << std::endl; 290 | std::cout << "" << std::endl; 291 | std::cout << desc << std::endl; 292 | std::cout << "" << std::endl; 293 | std::cout << "" << std::endl; 294 | 295 | std::cout << "" << std::endl; 296 | } 297 | 298 | } //namespace TCLAP 299 | #endif 300 | -------------------------------------------------------------------------------- /components/mkspiffs/src/tclap/HelpVisitor.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | * 4 | * file: HelpVisitor.h 5 | * 6 | * Copyright (c) 2003, Michael E. Smoot . 7 | * All rights reverved. 8 | * 9 | * See the file COPYING in the top directory of this distribution for 10 | * more information. 11 | * 12 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 13 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 15 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 17 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 18 | * DEALINGS IN THE SOFTWARE. 19 | * 20 | *****************************************************************************/ 21 | 22 | #ifndef TCLAP_HELP_VISITOR_H 23 | #define TCLAP_HELP_VISITOR_H 24 | 25 | #include "CmdLineInterface.h" 26 | #include "CmdLineOutput.h" 27 | #include "Visitor.h" 28 | 29 | namespace TCLAP { 30 | 31 | /** 32 | * A Visitor object that calls the usage method of the given CmdLineOutput 33 | * object for the specified CmdLine object. 34 | */ 35 | class HelpVisitor: public Visitor 36 | { 37 | private: 38 | /** 39 | * Prevent accidental copying. 40 | */ 41 | HelpVisitor(const HelpVisitor& rhs); 42 | HelpVisitor& operator=(const HelpVisitor& rhs); 43 | 44 | protected: 45 | 46 | /** 47 | * The CmdLine the output will be generated for. 48 | */ 49 | CmdLineInterface* _cmd; 50 | 51 | /** 52 | * The output object. 53 | */ 54 | CmdLineOutput** _out; 55 | 56 | public: 57 | 58 | /** 59 | * Constructor. 60 | * \param cmd - The CmdLine the output will be generated for. 61 | * \param out - The type of output. 62 | */ 63 | HelpVisitor(CmdLineInterface* cmd, CmdLineOutput** out) 64 | : Visitor(), _cmd( cmd ), _out( out ) { } 65 | 66 | /** 67 | * Calls the usage method of the CmdLineOutput for the 68 | * specified CmdLine. 69 | */ 70 | void visit() { (*_out)->usage(*_cmd); throw ExitException(0); } 71 | 72 | }; 73 | 74 | } 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /components/mkspiffs/src/tclap/IgnoreRestVisitor.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | * 4 | * file: IgnoreRestVisitor.h 5 | * 6 | * Copyright (c) 2003, Michael E. Smoot . 7 | * All rights reverved. 8 | * 9 | * See the file COPYING in the top directory of this distribution for 10 | * more information. 11 | * 12 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 13 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 15 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 17 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 18 | * DEALINGS IN THE SOFTWARE. 19 | * 20 | *****************************************************************************/ 21 | 22 | 23 | #ifndef TCLAP_IGNORE_REST_VISITOR_H 24 | #define TCLAP_IGNORE_REST_VISITOR_H 25 | 26 | #include "Visitor.h" 27 | #include "Arg.h" 28 | 29 | namespace TCLAP { 30 | 31 | /** 32 | * A Vistor that tells the CmdLine to begin ignoring arguments after 33 | * this one is parsed. 34 | */ 35 | class IgnoreRestVisitor: public Visitor 36 | { 37 | public: 38 | 39 | /** 40 | * Constructor. 41 | */ 42 | IgnoreRestVisitor() : Visitor() {} 43 | 44 | /** 45 | * Sets Arg::_ignoreRest. 46 | */ 47 | void visit() { Arg::beginIgnoring(); } 48 | }; 49 | 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /components/mkspiffs/src/tclap/MultiSwitchArg.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | * 4 | * file: MultiSwitchArg.h 5 | * 6 | * Copyright (c) 2003, Michael E. Smoot . 7 | * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno. 8 | * Copyright (c) 2005, Michael E. Smoot, Daniel Aarno, Erik Zeek. 9 | * All rights reverved. 10 | * 11 | * See the file COPYING in the top directory of this distribution for 12 | * more information. 13 | * 14 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | * DEALINGS IN THE SOFTWARE. 21 | * 22 | *****************************************************************************/ 23 | 24 | 25 | #ifndef TCLAP_MULTI_SWITCH_ARG_H 26 | #define TCLAP_MULTI_SWITCH_ARG_H 27 | 28 | #include 29 | #include 30 | 31 | #include "SwitchArg.h" 32 | 33 | namespace TCLAP { 34 | 35 | /** 36 | * A multiple switch argument. If the switch is set on the command line, then 37 | * the getValue method will return the number of times the switch appears. 38 | */ 39 | class MultiSwitchArg : public SwitchArg 40 | { 41 | protected: 42 | 43 | /** 44 | * The value of the switch. 45 | */ 46 | int _value; 47 | 48 | /** 49 | * Used to support the reset() method so that ValueArg can be 50 | * reset to their constructed value. 51 | */ 52 | int _default; 53 | 54 | public: 55 | 56 | /** 57 | * MultiSwitchArg constructor. 58 | * \param flag - The one character flag that identifies this 59 | * argument on the command line. 60 | * \param name - A one word name for the argument. Can be 61 | * used as a long flag on the command line. 62 | * \param desc - A description of what the argument is for or 63 | * does. 64 | * \param init - Optional. The initial/default value of this Arg. 65 | * Defaults to 0. 66 | * \param v - An optional visitor. You probably should not 67 | * use this unless you have a very good reason. 68 | */ 69 | MultiSwitchArg(const std::string& flag, 70 | const std::string& name, 71 | const std::string& desc, 72 | int init = 0, 73 | Visitor* v = NULL); 74 | 75 | 76 | /** 77 | * MultiSwitchArg constructor. 78 | * \param flag - The one character flag that identifies this 79 | * argument on the command line. 80 | * \param name - A one word name for the argument. Can be 81 | * used as a long flag on the command line. 82 | * \param desc - A description of what the argument is for or 83 | * does. 84 | * \param parser - A CmdLine parser object to add this Arg to 85 | * \param init - Optional. The initial/default value of this Arg. 86 | * Defaults to 0. 87 | * \param v - An optional visitor. You probably should not 88 | * use this unless you have a very good reason. 89 | */ 90 | MultiSwitchArg(const std::string& flag, 91 | const std::string& name, 92 | const std::string& desc, 93 | CmdLineInterface& parser, 94 | int init = 0, 95 | Visitor* v = NULL); 96 | 97 | 98 | /** 99 | * Handles the processing of the argument. 100 | * This re-implements the SwitchArg version of this method to set the 101 | * _value of the argument appropriately. 102 | * \param i - Pointer the the current argument in the list. 103 | * \param args - Mutable list of strings. Passed 104 | * in from main(). 105 | */ 106 | virtual bool processArg(int* i, std::vector& args); 107 | 108 | /** 109 | * Returns int, the number of times the switch has been set. 110 | */ 111 | int getValue(); 112 | 113 | /** 114 | * Returns the shortID for this Arg. 115 | */ 116 | std::string shortID(const std::string& val) const; 117 | 118 | /** 119 | * Returns the longID for this Arg. 120 | */ 121 | std::string longID(const std::string& val) const; 122 | 123 | void reset(); 124 | 125 | }; 126 | 127 | ////////////////////////////////////////////////////////////////////// 128 | //BEGIN MultiSwitchArg.cpp 129 | ////////////////////////////////////////////////////////////////////// 130 | inline MultiSwitchArg::MultiSwitchArg(const std::string& flag, 131 | const std::string& name, 132 | const std::string& desc, 133 | int init, 134 | Visitor* v ) 135 | : SwitchArg(flag, name, desc, false, v), 136 | _value( init ), 137 | _default( init ) 138 | { } 139 | 140 | inline MultiSwitchArg::MultiSwitchArg(const std::string& flag, 141 | const std::string& name, 142 | const std::string& desc, 143 | CmdLineInterface& parser, 144 | int init, 145 | Visitor* v ) 146 | : SwitchArg(flag, name, desc, false, v), 147 | _value( init ), 148 | _default( init ) 149 | { 150 | parser.add( this ); 151 | } 152 | 153 | inline int MultiSwitchArg::getValue() { return _value; } 154 | 155 | inline bool MultiSwitchArg::processArg(int *i, std::vector& args) 156 | { 157 | if ( _ignoreable && Arg::ignoreRest() ) 158 | return false; 159 | 160 | if ( argMatches( args[*i] )) 161 | { 162 | // so the isSet() method will work 163 | _alreadySet = true; 164 | 165 | // Matched argument: increment value. 166 | ++_value; 167 | 168 | _checkWithVisitor(); 169 | 170 | return true; 171 | } 172 | else if ( combinedSwitchesMatch( args[*i] ) ) 173 | { 174 | // so the isSet() method will work 175 | _alreadySet = true; 176 | 177 | // Matched argument: increment value. 178 | ++_value; 179 | 180 | // Check for more in argument and increment value. 181 | while ( combinedSwitchesMatch( args[*i] ) ) 182 | ++_value; 183 | 184 | _checkWithVisitor(); 185 | 186 | return false; 187 | } 188 | else 189 | return false; 190 | } 191 | 192 | inline std::string 193 | MultiSwitchArg::shortID(const std::string& val) const 194 | { 195 | return Arg::shortID(val) + " ... "; 196 | } 197 | 198 | inline std::string 199 | MultiSwitchArg::longID(const std::string& val) const 200 | { 201 | return Arg::longID(val) + " (accepted multiple times)"; 202 | } 203 | 204 | inline void 205 | MultiSwitchArg::reset() 206 | { 207 | MultiSwitchArg::_value = MultiSwitchArg::_default; 208 | } 209 | 210 | ////////////////////////////////////////////////////////////////////// 211 | //END MultiSwitchArg.cpp 212 | ////////////////////////////////////////////////////////////////////// 213 | 214 | } //namespace TCLAP 215 | 216 | #endif 217 | -------------------------------------------------------------------------------- /components/mkspiffs/src/tclap/OptionalUnlabeledTracker.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | /****************************************************************************** 4 | * 5 | * file: OptionalUnlabeledTracker.h 6 | * 7 | * Copyright (c) 2005, Michael E. Smoot . 8 | * All rights reverved. 9 | * 10 | * See the file COPYING in the top directory of this distribution for 11 | * more information. 12 | * 13 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 16 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | * DEALINGS IN THE SOFTWARE. 20 | * 21 | *****************************************************************************/ 22 | 23 | 24 | #ifndef TCLAP_OPTIONAL_UNLABELED_TRACKER_H 25 | #define TCLAP_OPTIONAL_UNLABELED_TRACKER_H 26 | 27 | #include 28 | 29 | namespace TCLAP { 30 | 31 | class OptionalUnlabeledTracker 32 | { 33 | 34 | public: 35 | 36 | static void check( bool req, const std::string& argName ); 37 | 38 | static void gotOptional() { alreadyOptionalRef() = true; } 39 | 40 | static bool& alreadyOptional() { return alreadyOptionalRef(); } 41 | 42 | private: 43 | 44 | static bool& alreadyOptionalRef() { static bool ct = false; return ct; } 45 | }; 46 | 47 | 48 | inline void OptionalUnlabeledTracker::check( bool req, const std::string& argName ) 49 | { 50 | if ( OptionalUnlabeledTracker::alreadyOptional() ) 51 | throw( SpecificationException( 52 | "You can't specify ANY Unlabeled Arg following an optional Unlabeled Arg", 53 | argName ) ); 54 | 55 | if ( !req ) 56 | OptionalUnlabeledTracker::gotOptional(); 57 | } 58 | 59 | 60 | } // namespace TCLAP 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /components/mkspiffs/src/tclap/StandardTraits.h: -------------------------------------------------------------------------------- 1 | // -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- 2 | 3 | /****************************************************************************** 4 | * 5 | * file: StandardTraits.h 6 | * 7 | * Copyright (c) 2007, Daniel Aarno, Michael E. Smoot . 8 | * All rights reverved. 9 | * 10 | * See the file COPYING in the top directory of this distribution for 11 | * more information. 12 | * 13 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 16 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | * DEALINGS IN THE SOFTWARE. 20 | * 21 | *****************************************************************************/ 22 | 23 | // This is an internal tclap file, you should probably not have to 24 | // include this directly 25 | 26 | #ifndef TCLAP_STANDARD_TRAITS_H 27 | #define TCLAP_STANDARD_TRAITS_H 28 | 29 | #ifdef HAVE_CONFIG_H 30 | #include // To check for long long 31 | #endif 32 | 33 | // If Microsoft has already typedef'd wchar_t as an unsigned 34 | // short, then compiles will break because it's as if we're 35 | // creating ArgTraits twice for unsigned short. Thus... 36 | #ifdef _MSC_VER 37 | #ifndef _NATIVE_WCHAR_T_DEFINED 38 | #define TCLAP_DONT_DECLARE_WCHAR_T_ARGTRAITS 39 | #endif 40 | #endif 41 | 42 | namespace TCLAP { 43 | 44 | // ====================================================================== 45 | // Integer types 46 | // ====================================================================== 47 | 48 | /** 49 | * longs have value-like semantics. 50 | */ 51 | template<> 52 | struct ArgTraits { 53 | typedef ValueLike ValueCategory; 54 | }; 55 | 56 | /** 57 | * ints have value-like semantics. 58 | */ 59 | template<> 60 | struct ArgTraits { 61 | typedef ValueLike ValueCategory; 62 | }; 63 | 64 | /** 65 | * shorts have value-like semantics. 66 | */ 67 | template<> 68 | struct ArgTraits { 69 | typedef ValueLike ValueCategory; 70 | }; 71 | 72 | /** 73 | * chars have value-like semantics. 74 | */ 75 | template<> 76 | struct ArgTraits { 77 | typedef ValueLike ValueCategory; 78 | }; 79 | 80 | #ifdef HAVE_LONG_LONG 81 | /** 82 | * long longs have value-like semantics. 83 | */ 84 | template<> 85 | struct ArgTraits { 86 | typedef ValueLike ValueCategory; 87 | }; 88 | #endif 89 | 90 | // ====================================================================== 91 | // Unsigned integer types 92 | // ====================================================================== 93 | 94 | /** 95 | * unsigned longs have value-like semantics. 96 | */ 97 | template<> 98 | struct ArgTraits { 99 | typedef ValueLike ValueCategory; 100 | }; 101 | 102 | /** 103 | * unsigned ints have value-like semantics. 104 | */ 105 | template<> 106 | struct ArgTraits { 107 | typedef ValueLike ValueCategory; 108 | }; 109 | 110 | /** 111 | * unsigned shorts have value-like semantics. 112 | */ 113 | template<> 114 | struct ArgTraits { 115 | typedef ValueLike ValueCategory; 116 | }; 117 | 118 | /** 119 | * unsigned chars have value-like semantics. 120 | */ 121 | template<> 122 | struct ArgTraits { 123 | typedef ValueLike ValueCategory; 124 | }; 125 | 126 | // Microsoft implements size_t awkwardly. 127 | #if defined(_MSC_VER) && defined(_M_X64) 128 | /** 129 | * size_ts have value-like semantics. 130 | */ 131 | template<> 132 | struct ArgTraits { 133 | typedef ValueLike ValueCategory; 134 | }; 135 | #endif 136 | 137 | 138 | #ifdef HAVE_LONG_LONG 139 | /** 140 | * unsigned long longs have value-like semantics. 141 | */ 142 | template<> 143 | struct ArgTraits { 144 | typedef ValueLike ValueCategory; 145 | }; 146 | #endif 147 | 148 | // ====================================================================== 149 | // Float types 150 | // ====================================================================== 151 | 152 | /** 153 | * floats have value-like semantics. 154 | */ 155 | template<> 156 | struct ArgTraits { 157 | typedef ValueLike ValueCategory; 158 | }; 159 | 160 | /** 161 | * doubles have value-like semantics. 162 | */ 163 | template<> 164 | struct ArgTraits { 165 | typedef ValueLike ValueCategory; 166 | }; 167 | 168 | // ====================================================================== 169 | // Other types 170 | // ====================================================================== 171 | 172 | /** 173 | * bools have value-like semantics. 174 | */ 175 | template<> 176 | struct ArgTraits { 177 | typedef ValueLike ValueCategory; 178 | }; 179 | 180 | 181 | /** 182 | * wchar_ts have value-like semantics. 183 | */ 184 | #ifndef TCLAP_DONT_DECLARE_WCHAR_T_ARGTRAITS 185 | template<> 186 | struct ArgTraits { 187 | typedef ValueLike ValueCategory; 188 | }; 189 | #endif 190 | 191 | /** 192 | * Strings have string like argument traits. 193 | */ 194 | template<> 195 | struct ArgTraits { 196 | typedef StringLike ValueCategory; 197 | }; 198 | 199 | template 200 | void SetString(T &dst, const std::string &src) 201 | { 202 | dst = src; 203 | } 204 | 205 | } // namespace 206 | 207 | #endif 208 | 209 | -------------------------------------------------------------------------------- /components/mkspiffs/src/tclap/StdOutput.h: -------------------------------------------------------------------------------- 1 | // -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- 2 | 3 | /****************************************************************************** 4 | * 5 | * file: StdOutput.h 6 | * 7 | * Copyright (c) 2004, Michael E. Smoot 8 | * All rights reverved. 9 | * 10 | * See the file COPYING in the top directory of this distribution for 11 | * more information. 12 | * 13 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 16 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | * DEALINGS IN THE SOFTWARE. 20 | * 21 | *****************************************************************************/ 22 | 23 | #ifndef TCLAP_STDCMDLINEOUTPUT_H 24 | #define TCLAP_STDCMDLINEOUTPUT_H 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #include "CmdLineInterface.h" 33 | #include "CmdLineOutput.h" 34 | #include "XorHandler.h" 35 | #include "Arg.h" 36 | 37 | namespace TCLAP { 38 | 39 | /** 40 | * A class that isolates any output from the CmdLine object so that it 41 | * may be easily modified. 42 | */ 43 | class StdOutput : public CmdLineOutput 44 | { 45 | 46 | public: 47 | 48 | /** 49 | * Prints the usage to stdout. Can be overridden to 50 | * produce alternative behavior. 51 | * \param c - The CmdLine object the output is generated for. 52 | */ 53 | virtual void usage(CmdLineInterface& c); 54 | 55 | /** 56 | * Prints the version to stdout. Can be overridden 57 | * to produce alternative behavior. 58 | * \param c - The CmdLine object the output is generated for. 59 | */ 60 | virtual void version(CmdLineInterface& c); 61 | 62 | /** 63 | * Prints (to stderr) an error message, short usage 64 | * Can be overridden to produce alternative behavior. 65 | * \param c - The CmdLine object the output is generated for. 66 | * \param e - The ArgException that caused the failure. 67 | */ 68 | virtual void failure(CmdLineInterface& c, 69 | ArgException& e ); 70 | 71 | protected: 72 | 73 | /** 74 | * Writes a brief usage message with short args. 75 | * \param c - The CmdLine object the output is generated for. 76 | * \param os - The stream to write the message to. 77 | */ 78 | void _shortUsage( CmdLineInterface& c, std::ostream& os ) const; 79 | 80 | /** 81 | * Writes a longer usage message with long and short args, 82 | * provides descriptions and prints message. 83 | * \param c - The CmdLine object the output is generated for. 84 | * \param os - The stream to write the message to. 85 | */ 86 | void _longUsage( CmdLineInterface& c, std::ostream& os ) const; 87 | 88 | /** 89 | * This function inserts line breaks and indents long strings 90 | * according the params input. It will only break lines at spaces, 91 | * commas and pipes. 92 | * \param os - The stream to be printed to. 93 | * \param s - The string to be printed. 94 | * \param maxWidth - The maxWidth allowed for the output line. 95 | * \param indentSpaces - The number of spaces to indent the first line. 96 | * \param secondLineOffset - The number of spaces to indent the second 97 | * and all subsequent lines in addition to indentSpaces. 98 | */ 99 | void spacePrint( std::ostream& os, 100 | const std::string& s, 101 | int maxWidth, 102 | int indentSpaces, 103 | int secondLineOffset ) const; 104 | 105 | }; 106 | 107 | 108 | inline void StdOutput::version(CmdLineInterface& _cmd) 109 | { 110 | std::string progName = _cmd.getProgramName(); 111 | std::string xversion = _cmd.getVersion(); 112 | 113 | std::cout << std::endl << progName << " version: " 114 | << xversion << std::endl << std::endl; 115 | } 116 | 117 | inline void StdOutput::usage(CmdLineInterface& _cmd ) 118 | { 119 | std::cout << std::endl << "USAGE: " << std::endl << std::endl; 120 | 121 | _shortUsage( _cmd, std::cout ); 122 | 123 | std::cout << std::endl << std::endl << "Where: " << std::endl << std::endl; 124 | 125 | _longUsage( _cmd, std::cout ); 126 | 127 | std::cout << std::endl; 128 | 129 | } 130 | 131 | inline void StdOutput::failure( CmdLineInterface& _cmd, 132 | ArgException& e ) 133 | { 134 | std::string progName = _cmd.getProgramName(); 135 | 136 | std::cerr << "PARSE ERROR: " << e.argId() << std::endl 137 | << " " << e.error() << std::endl << std::endl; 138 | 139 | if ( _cmd.hasHelpAndVersion() ) 140 | { 141 | std::cerr << "Brief USAGE: " << std::endl; 142 | 143 | _shortUsage( _cmd, std::cerr ); 144 | 145 | std::cerr << std::endl << "For complete USAGE and HELP type: " 146 | << std::endl << " " << progName << " --help" 147 | << std::endl << std::endl; 148 | } 149 | else 150 | usage(_cmd); 151 | 152 | throw ExitException(1); 153 | } 154 | 155 | inline void 156 | StdOutput::_shortUsage( CmdLineInterface& _cmd, 157 | std::ostream& os ) const 158 | { 159 | std::list argList = _cmd.getArgList(); 160 | std::string progName = _cmd.getProgramName(); 161 | XorHandler xorHandler = _cmd.getXorHandler(); 162 | std::vector< std::vector > xorList = xorHandler.getXorList(); 163 | 164 | std::string s = progName + " "; 165 | 166 | // first the xor 167 | for ( int i = 0; static_cast(i) < xorList.size(); i++ ) 168 | { 169 | s += " {"; 170 | for ( ArgVectorIterator it = xorList[i].begin(); 171 | it != xorList[i].end(); it++ ) 172 | s += (*it)->shortID() + "|"; 173 | 174 | s[s.length()-1] = '}'; 175 | } 176 | 177 | // then the rest 178 | for (ArgListIterator it = argList.begin(); it != argList.end(); it++) 179 | if ( !xorHandler.contains( (*it) ) ) 180 | s += " " + (*it)->shortID(); 181 | 182 | // if the program name is too long, then adjust the second line offset 183 | int secondLineOffset = static_cast(progName.length()) + 2; 184 | if ( secondLineOffset > 75/2 ) 185 | secondLineOffset = static_cast(75/2); 186 | 187 | spacePrint( os, s, 75, 3, secondLineOffset ); 188 | } 189 | 190 | inline void 191 | StdOutput::_longUsage( CmdLineInterface& _cmd, 192 | std::ostream& os ) const 193 | { 194 | std::list argList = _cmd.getArgList(); 195 | std::string message = _cmd.getMessage(); 196 | XorHandler xorHandler = _cmd.getXorHandler(); 197 | std::vector< std::vector > xorList = xorHandler.getXorList(); 198 | 199 | // first the xor 200 | for ( int i = 0; static_cast(i) < xorList.size(); i++ ) 201 | { 202 | for ( ArgVectorIterator it = xorList[i].begin(); 203 | it != xorList[i].end(); 204 | it++ ) 205 | { 206 | spacePrint( os, (*it)->longID(), 75, 3, 3 ); 207 | spacePrint( os, (*it)->getDescription(), 75, 5, 0 ); 208 | 209 | if ( it+1 != xorList[i].end() ) 210 | spacePrint(os, "-- OR --", 75, 9, 0); 211 | } 212 | os << std::endl << std::endl; 213 | } 214 | 215 | // then the rest 216 | for (ArgListIterator it = argList.begin(); it != argList.end(); it++) 217 | if ( !xorHandler.contains( (*it) ) ) 218 | { 219 | spacePrint( os, (*it)->longID(), 75, 3, 3 ); 220 | spacePrint( os, (*it)->getDescription(), 75, 5, 0 ); 221 | os << std::endl; 222 | } 223 | 224 | os << std::endl; 225 | 226 | spacePrint( os, message, 75, 3, 0 ); 227 | } 228 | 229 | inline void StdOutput::spacePrint( std::ostream& os, 230 | const std::string& s, 231 | int maxWidth, 232 | int indentSpaces, 233 | int secondLineOffset ) const 234 | { 235 | int len = static_cast(s.length()); 236 | 237 | if ( (len + indentSpaces > maxWidth) && maxWidth > 0 ) 238 | { 239 | int allowedLen = maxWidth - indentSpaces; 240 | int start = 0; 241 | while ( start < len ) 242 | { 243 | // find the substring length 244 | // int stringLen = std::min( len - start, allowedLen ); 245 | // doing it this way to support a VisualC++ 2005 bug 246 | using namespace std; 247 | int stringLen = min( len - start, allowedLen ); 248 | 249 | // trim the length so it doesn't end in middle of a word 250 | if ( stringLen == allowedLen ) 251 | while ( stringLen >= 0 && 252 | s[stringLen+start] != ' ' && 253 | s[stringLen+start] != ',' && 254 | s[stringLen+start] != '|' ) 255 | stringLen--; 256 | 257 | // ok, the word is longer than the line, so just split 258 | // wherever the line ends 259 | if ( stringLen <= 0 ) 260 | stringLen = allowedLen; 261 | 262 | // check for newlines 263 | for ( int i = 0; i < stringLen; i++ ) 264 | if ( s[start+i] == '\n' ) 265 | stringLen = i+1; 266 | 267 | // print the indent 268 | for ( int i = 0; i < indentSpaces; i++ ) 269 | os << " "; 270 | 271 | if ( start == 0 ) 272 | { 273 | // handle second line offsets 274 | indentSpaces += secondLineOffset; 275 | 276 | // adjust allowed len 277 | allowedLen -= secondLineOffset; 278 | } 279 | 280 | os << s.substr(start,stringLen) << std::endl; 281 | 282 | // so we don't start a line with a space 283 | while ( s[stringLen+start] == ' ' && start < len ) 284 | start++; 285 | 286 | start += stringLen; 287 | } 288 | } 289 | else 290 | { 291 | for ( int i = 0; i < indentSpaces; i++ ) 292 | os << " "; 293 | os << s << std::endl; 294 | } 295 | } 296 | 297 | } //namespace TCLAP 298 | #endif 299 | -------------------------------------------------------------------------------- /components/mkspiffs/src/tclap/SwitchArg.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | * 4 | * file: SwitchArg.h 5 | * 6 | * Copyright (c) 2003, Michael E. Smoot . 7 | * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno. 8 | * All rights reverved. 9 | * 10 | * See the file COPYING in the top directory of this distribution for 11 | * more information. 12 | * 13 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 16 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | * DEALINGS IN THE SOFTWARE. 20 | * 21 | *****************************************************************************/ 22 | 23 | 24 | #ifndef TCLAP_SWITCH_ARG_H 25 | #define TCLAP_SWITCH_ARG_H 26 | 27 | #include 28 | #include 29 | 30 | #include "Arg.h" 31 | 32 | namespace TCLAP { 33 | 34 | /** 35 | * A simple switch argument. If the switch is set on the command line, then 36 | * the getValue method will return the opposite of the default value for the 37 | * switch. 38 | */ 39 | class SwitchArg : public Arg 40 | { 41 | protected: 42 | 43 | /** 44 | * The value of the switch. 45 | */ 46 | bool _value; 47 | 48 | /** 49 | * Used to support the reset() method so that ValueArg can be 50 | * reset to their constructed value. 51 | */ 52 | bool _default; 53 | 54 | public: 55 | 56 | /** 57 | * SwitchArg constructor. 58 | * \param flag - The one character flag that identifies this 59 | * argument on the command line. 60 | * \param name - A one word name for the argument. Can be 61 | * used as a long flag on the command line. 62 | * \param desc - A description of what the argument is for or 63 | * does. 64 | * \param def - The default value for this Switch. 65 | * \param v - An optional visitor. You probably should not 66 | * use this unless you have a very good reason. 67 | */ 68 | SwitchArg(const std::string& flag, 69 | const std::string& name, 70 | const std::string& desc, 71 | bool def = false, 72 | Visitor* v = NULL); 73 | 74 | 75 | /** 76 | * SwitchArg constructor. 77 | * \param flag - The one character flag that identifies this 78 | * argument on the command line. 79 | * \param name - A one word name for the argument. Can be 80 | * used as a long flag on the command line. 81 | * \param desc - A description of what the argument is for or 82 | * does. 83 | * \param parser - A CmdLine parser object to add this Arg to 84 | * \param def - The default value for this Switch. 85 | * \param v - An optional visitor. You probably should not 86 | * use this unless you have a very good reason. 87 | */ 88 | SwitchArg(const std::string& flag, 89 | const std::string& name, 90 | const std::string& desc, 91 | CmdLineInterface& parser, 92 | bool def = false, 93 | Visitor* v = NULL); 94 | 95 | 96 | /** 97 | * Handles the processing of the argument. 98 | * This re-implements the Arg version of this method to set the 99 | * _value of the argument appropriately. 100 | * \param i - Pointer the the current argument in the list. 101 | * \param args - Mutable list of strings. Passed 102 | * in from main(). 103 | */ 104 | virtual bool processArg(int* i, std::vector& args); 105 | 106 | /** 107 | * Checks a string to see if any of the chars in the string 108 | * match the flag for this Switch. 109 | */ 110 | bool combinedSwitchesMatch(std::string& combined); 111 | 112 | /** 113 | * Returns bool, whether or not the switch has been set. 114 | */ 115 | bool getValue(); 116 | 117 | virtual void reset(); 118 | 119 | private: 120 | /** 121 | * Checks to see if we've found the last match in 122 | * a combined string. 123 | */ 124 | bool lastCombined(std::string& combined); 125 | 126 | /** 127 | * Does the common processing of processArg. 128 | */ 129 | void commonProcessing(); 130 | }; 131 | 132 | ////////////////////////////////////////////////////////////////////// 133 | //BEGIN SwitchArg.cpp 134 | ////////////////////////////////////////////////////////////////////// 135 | inline SwitchArg::SwitchArg(const std::string& flag, 136 | const std::string& name, 137 | const std::string& desc, 138 | bool default_val, 139 | Visitor* v ) 140 | : Arg(flag, name, desc, false, false, v), 141 | _value( default_val ), 142 | _default( default_val ) 143 | { } 144 | 145 | inline SwitchArg::SwitchArg(const std::string& flag, 146 | const std::string& name, 147 | const std::string& desc, 148 | CmdLineInterface& parser, 149 | bool default_val, 150 | Visitor* v ) 151 | : Arg(flag, name, desc, false, false, v), 152 | _value( default_val ), 153 | _default(default_val) 154 | { 155 | parser.add( this ); 156 | } 157 | 158 | inline bool SwitchArg::getValue() { return _value; } 159 | 160 | inline bool SwitchArg::lastCombined(std::string& combinedSwitches ) 161 | { 162 | for ( unsigned int i = 1; i < combinedSwitches.length(); i++ ) 163 | if ( combinedSwitches[i] != Arg::blankChar() ) 164 | return false; 165 | 166 | return true; 167 | } 168 | 169 | inline bool SwitchArg::combinedSwitchesMatch(std::string& combinedSwitches ) 170 | { 171 | // make sure this is actually a combined switch 172 | if ( combinedSwitches.length() > 0 && 173 | combinedSwitches[0] != Arg::flagStartString()[0] ) 174 | return false; 175 | 176 | // make sure it isn't a long name 177 | if ( combinedSwitches.substr( 0, Arg::nameStartString().length() ) == 178 | Arg::nameStartString() ) 179 | return false; 180 | 181 | // make sure the delimiter isn't in the string 182 | if ( combinedSwitches.find_first_of( Arg::delimiter() ) != std::string::npos ) 183 | return false; 184 | 185 | // ok, we're not specifying a ValueArg, so we know that we have 186 | // a combined switch list. 187 | for ( unsigned int i = 1; i < combinedSwitches.length(); i++ ) 188 | if ( _flag.length() > 0 && 189 | combinedSwitches[i] == _flag[0] && 190 | _flag[0] != Arg::flagStartString()[0] ) 191 | { 192 | // update the combined switches so this one is no longer present 193 | // this is necessary so that no unlabeled args are matched 194 | // later in the processing. 195 | //combinedSwitches.erase(i,1); 196 | combinedSwitches[i] = Arg::blankChar(); 197 | return true; 198 | } 199 | 200 | // none of the switches passed in the list match. 201 | return false; 202 | } 203 | 204 | inline void SwitchArg::commonProcessing() 205 | { 206 | if ( _xorSet ) 207 | throw(CmdLineParseException( 208 | "Mutually exclusive argument already set!", toString())); 209 | 210 | if ( _alreadySet ) 211 | throw(CmdLineParseException("Argument already set!", toString())); 212 | 213 | _alreadySet = true; 214 | 215 | if ( _value == true ) 216 | _value = false; 217 | else 218 | _value = true; 219 | 220 | _checkWithVisitor(); 221 | } 222 | 223 | inline bool SwitchArg::processArg(int *i, std::vector& args) 224 | { 225 | if ( _ignoreable && Arg::ignoreRest() ) 226 | return false; 227 | 228 | // if the whole string matches the flag or name string 229 | if ( argMatches( args[*i] ) ) 230 | { 231 | commonProcessing(); 232 | 233 | return true; 234 | } 235 | // if a substring matches the flag as part of a combination 236 | else if ( combinedSwitchesMatch( args[*i] ) ) 237 | { 238 | // check again to ensure we don't misinterpret 239 | // this as a MultiSwitchArg 240 | if ( combinedSwitchesMatch( args[*i] ) ) 241 | throw(CmdLineParseException("Argument already set!", 242 | toString())); 243 | 244 | commonProcessing(); 245 | 246 | // We only want to return true if we've found the last combined 247 | // match in the string, otherwise we return true so that other 248 | // switches in the combination will have a chance to match. 249 | return lastCombined( args[*i] ); 250 | } 251 | else 252 | return false; 253 | } 254 | 255 | inline void SwitchArg::reset() 256 | { 257 | Arg::reset(); 258 | _value = _default; 259 | } 260 | ////////////////////////////////////////////////////////////////////// 261 | //End SwitchArg.cpp 262 | ////////////////////////////////////////////////////////////////////// 263 | 264 | } //namespace TCLAP 265 | 266 | #endif 267 | -------------------------------------------------------------------------------- /components/mkspiffs/src/tclap/UnlabeledMultiArg.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | * 4 | * file: UnlabeledMultiArg.h 5 | * 6 | * Copyright (c) 2003, Michael E. Smoot. 7 | * All rights reverved. 8 | * 9 | * See the file COPYING in the top directory of this distribution for 10 | * more information. 11 | * 12 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 13 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 15 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 17 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 18 | * DEALINGS IN THE SOFTWARE. 19 | * 20 | *****************************************************************************/ 21 | 22 | 23 | #ifndef TCLAP_MULTIPLE_UNLABELED_ARGUMENT_H 24 | #define TCLAP_MULTIPLE_UNLABELED_ARGUMENT_H 25 | 26 | #include 27 | #include 28 | 29 | #include "MultiArg.h" 30 | #include "OptionalUnlabeledTracker.h" 31 | 32 | namespace TCLAP { 33 | 34 | /** 35 | * Just like a MultiArg, except that the arguments are unlabeled. Basically, 36 | * this Arg will slurp up everything that hasn't been matched to another 37 | * Arg. 38 | */ 39 | template 40 | class UnlabeledMultiArg : public MultiArg 41 | { 42 | 43 | // If compiler has two stage name lookup (as gcc >= 3.4 does) 44 | // this is requried to prevent undef. symbols 45 | using MultiArg::_ignoreable; 46 | using MultiArg::_hasBlanks; 47 | using MultiArg::_extractValue; 48 | using MultiArg::_typeDesc; 49 | using MultiArg::_name; 50 | using MultiArg::_description; 51 | using MultiArg::_alreadySet; 52 | using MultiArg::toString; 53 | 54 | public: 55 | 56 | /** 57 | * Constructor. 58 | * \param name - The name of the Arg. Note that this is used for 59 | * identification, not as a long flag. 60 | * \param desc - A description of what the argument is for or 61 | * does. 62 | * \param req - Whether the argument is required on the command 63 | * line. 64 | * \param typeDesc - A short, human readable description of the 65 | * type that this object expects. This is used in the generation 66 | * of the USAGE statement. The goal is to be helpful to the end user 67 | * of the program. 68 | * \param ignoreable - Whether or not this argument can be ignored 69 | * using the "--" flag. 70 | * \param v - An optional visitor. You probably should not 71 | * use this unless you have a very good reason. 72 | */ 73 | UnlabeledMultiArg( const std::string& name, 74 | const std::string& desc, 75 | bool req, 76 | const std::string& typeDesc, 77 | bool ignoreable = false, 78 | Visitor* v = NULL ); 79 | /** 80 | * Constructor. 81 | * \param name - The name of the Arg. Note that this is used for 82 | * identification, not as a long flag. 83 | * \param desc - A description of what the argument is for or 84 | * does. 85 | * \param req - Whether the argument is required on the command 86 | * line. 87 | * \param typeDesc - A short, human readable description of the 88 | * type that this object expects. This is used in the generation 89 | * of the USAGE statement. The goal is to be helpful to the end user 90 | * of the program. 91 | * \param parser - A CmdLine parser object to add this Arg to 92 | * \param ignoreable - Whether or not this argument can be ignored 93 | * using the "--" flag. 94 | * \param v - An optional visitor. You probably should not 95 | * use this unless you have a very good reason. 96 | */ 97 | UnlabeledMultiArg( const std::string& name, 98 | const std::string& desc, 99 | bool req, 100 | const std::string& typeDesc, 101 | CmdLineInterface& parser, 102 | bool ignoreable = false, 103 | Visitor* v = NULL ); 104 | 105 | /** 106 | * Constructor. 107 | * \param name - The name of the Arg. Note that this is used for 108 | * identification, not as a long flag. 109 | * \param desc - A description of what the argument is for or 110 | * does. 111 | * \param req - Whether the argument is required on the command 112 | * line. 113 | * \param constraint - A pointer to a Constraint object used 114 | * to constrain this Arg. 115 | * \param ignoreable - Whether or not this argument can be ignored 116 | * using the "--" flag. 117 | * \param v - An optional visitor. You probably should not 118 | * use this unless you have a very good reason. 119 | */ 120 | UnlabeledMultiArg( const std::string& name, 121 | const std::string& desc, 122 | bool req, 123 | Constraint* constraint, 124 | bool ignoreable = false, 125 | Visitor* v = NULL ); 126 | 127 | /** 128 | * Constructor. 129 | * \param name - The name of the Arg. Note that this is used for 130 | * identification, not as a long flag. 131 | * \param desc - A description of what the argument is for or 132 | * does. 133 | * \param req - Whether the argument is required on the command 134 | * line. 135 | * \param constraint - A pointer to a Constraint object used 136 | * to constrain this Arg. 137 | * \param parser - A CmdLine parser object to add this Arg to 138 | * \param ignoreable - Whether or not this argument can be ignored 139 | * using the "--" flag. 140 | * \param v - An optional visitor. You probably should not 141 | * use this unless you have a very good reason. 142 | */ 143 | UnlabeledMultiArg( const std::string& name, 144 | const std::string& desc, 145 | bool req, 146 | Constraint* constraint, 147 | CmdLineInterface& parser, 148 | bool ignoreable = false, 149 | Visitor* v = NULL ); 150 | 151 | /** 152 | * Handles the processing of the argument. 153 | * This re-implements the Arg version of this method to set the 154 | * _value of the argument appropriately. It knows the difference 155 | * between labeled and unlabeled. 156 | * \param i - Pointer the the current argument in the list. 157 | * \param args - Mutable list of strings. Passed from main(). 158 | */ 159 | virtual bool processArg(int* i, std::vector& args); 160 | 161 | /** 162 | * Returns the a short id string. Used in the usage. 163 | * \param val - value to be used. 164 | */ 165 | virtual std::string shortID(const std::string& val="val") const; 166 | 167 | /** 168 | * Returns the a long id string. Used in the usage. 169 | * \param val - value to be used. 170 | */ 171 | virtual std::string longID(const std::string& val="val") const; 172 | 173 | /** 174 | * Opertor ==. 175 | * \param a - The Arg to be compared to this. 176 | */ 177 | virtual bool operator==(const Arg& a) const; 178 | 179 | /** 180 | * Pushes this to back of list rather than front. 181 | * \param argList - The list this should be added to. 182 | */ 183 | virtual void addToList( std::list& argList ) const; 184 | }; 185 | 186 | template 187 | UnlabeledMultiArg::UnlabeledMultiArg(const std::string& name, 188 | const std::string& desc, 189 | bool req, 190 | const std::string& typeDesc, 191 | bool ignoreable, 192 | Visitor* v) 193 | : MultiArg("", name, desc, req, typeDesc, v) 194 | { 195 | _ignoreable = ignoreable; 196 | OptionalUnlabeledTracker::check(true, toString()); 197 | } 198 | 199 | template 200 | UnlabeledMultiArg::UnlabeledMultiArg(const std::string& name, 201 | const std::string& desc, 202 | bool req, 203 | const std::string& typeDesc, 204 | CmdLineInterface& parser, 205 | bool ignoreable, 206 | Visitor* v) 207 | : MultiArg("", name, desc, req, typeDesc, v) 208 | { 209 | _ignoreable = ignoreable; 210 | OptionalUnlabeledTracker::check(true, toString()); 211 | parser.add( this ); 212 | } 213 | 214 | 215 | template 216 | UnlabeledMultiArg::UnlabeledMultiArg(const std::string& name, 217 | const std::string& desc, 218 | bool req, 219 | Constraint* constraint, 220 | bool ignoreable, 221 | Visitor* v) 222 | : MultiArg("", name, desc, req, constraint, v) 223 | { 224 | _ignoreable = ignoreable; 225 | OptionalUnlabeledTracker::check(true, toString()); 226 | } 227 | 228 | template 229 | UnlabeledMultiArg::UnlabeledMultiArg(const std::string& name, 230 | const std::string& desc, 231 | bool req, 232 | Constraint* constraint, 233 | CmdLineInterface& parser, 234 | bool ignoreable, 235 | Visitor* v) 236 | : MultiArg("", name, desc, req, constraint, v) 237 | { 238 | _ignoreable = ignoreable; 239 | OptionalUnlabeledTracker::check(true, toString()); 240 | parser.add( this ); 241 | } 242 | 243 | 244 | template 245 | bool UnlabeledMultiArg::processArg(int *i, std::vector& args) 246 | { 247 | 248 | if ( _hasBlanks( args[*i] ) ) 249 | return false; 250 | 251 | // never ignore an unlabeled multi arg 252 | 253 | 254 | // always take the first value, regardless of the start string 255 | _extractValue( args[(*i)] ); 256 | 257 | /* 258 | // continue taking args until we hit the end or a start string 259 | while ( (unsigned int)(*i)+1 < args.size() && 260 | args[(*i)+1].find_first_of( Arg::flagStartString() ) != 0 && 261 | args[(*i)+1].find_first_of( Arg::nameStartString() ) != 0 ) 262 | _extractValue( args[++(*i)] ); 263 | */ 264 | 265 | _alreadySet = true; 266 | 267 | return true; 268 | } 269 | 270 | template 271 | std::string UnlabeledMultiArg::shortID(const std::string& val) const 272 | { 273 | static_cast(val); // Ignore input, don't warn 274 | return std::string("<") + _typeDesc + "> ..."; 275 | } 276 | 277 | template 278 | std::string UnlabeledMultiArg::longID(const std::string& val) const 279 | { 280 | static_cast(val); // Ignore input, don't warn 281 | return std::string("<") + _typeDesc + "> (accepted multiple times)"; 282 | } 283 | 284 | template 285 | bool UnlabeledMultiArg::operator==(const Arg& a) const 286 | { 287 | if ( _name == a.getName() || _description == a.getDescription() ) 288 | return true; 289 | else 290 | return false; 291 | } 292 | 293 | template 294 | void UnlabeledMultiArg::addToList( std::list& argList ) const 295 | { 296 | argList.push_back( const_cast(static_cast(this)) ); 297 | } 298 | 299 | } 300 | 301 | #endif 302 | -------------------------------------------------------------------------------- /components/mkspiffs/src/tclap/ValuesConstraint.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | /****************************************************************************** 4 | * 5 | * file: ValuesConstraint.h 6 | * 7 | * Copyright (c) 2005, Michael E. Smoot 8 | * All rights reverved. 9 | * 10 | * See the file COPYING in the top directory of this distribution for 11 | * more information. 12 | * 13 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 16 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | * DEALINGS IN THE SOFTWARE. 20 | * 21 | *****************************************************************************/ 22 | 23 | #ifndef TCLAP_VALUESCONSTRAINT_H 24 | #define TCLAP_VALUESCONSTRAINT_H 25 | 26 | #include 27 | #include 28 | #include "Constraint.h" 29 | 30 | #ifdef HAVE_CONFIG_H 31 | #include 32 | #else 33 | #define HAVE_SSTREAM 34 | #endif 35 | 36 | #if defined(HAVE_SSTREAM) 37 | #include 38 | #elif defined(HAVE_STRSTREAM) 39 | #include 40 | #else 41 | #error "Need a stringstream (sstream or strstream) to compile!" 42 | #endif 43 | 44 | namespace TCLAP { 45 | 46 | /** 47 | * A Constraint that constrains the Arg to only those values specified 48 | * in the constraint. 49 | */ 50 | template 51 | class ValuesConstraint : public Constraint 52 | { 53 | 54 | public: 55 | 56 | /** 57 | * Constructor. 58 | * \param allowed - vector of allowed values. 59 | */ 60 | ValuesConstraint(std::vector& allowed); 61 | 62 | /** 63 | * Virtual destructor. 64 | */ 65 | virtual ~ValuesConstraint() {} 66 | 67 | /** 68 | * Returns a description of the Constraint. 69 | */ 70 | virtual std::string description() const; 71 | 72 | /** 73 | * Returns the short ID for the Constraint. 74 | */ 75 | virtual std::string shortID() const; 76 | 77 | /** 78 | * The method used to verify that the value parsed from the command 79 | * line meets the constraint. 80 | * \param value - The value that will be checked. 81 | */ 82 | virtual bool check(const T& value) const; 83 | 84 | protected: 85 | 86 | /** 87 | * The list of valid values. 88 | */ 89 | std::vector _allowed; 90 | 91 | /** 92 | * The string used to describe the allowed values of this constraint. 93 | */ 94 | std::string _typeDesc; 95 | 96 | }; 97 | 98 | template 99 | ValuesConstraint::ValuesConstraint(std::vector& allowed) 100 | : _allowed(allowed), 101 | _typeDesc("") 102 | { 103 | for ( unsigned int i = 0; i < _allowed.size(); i++ ) 104 | { 105 | 106 | #if defined(HAVE_SSTREAM) 107 | std::ostringstream os; 108 | #elif defined(HAVE_STRSTREAM) 109 | std::ostrstream os; 110 | #else 111 | #error "Need a stringstream (sstream or strstream) to compile!" 112 | #endif 113 | 114 | os << _allowed[i]; 115 | 116 | std::string temp( os.str() ); 117 | 118 | if ( i > 0 ) 119 | _typeDesc += "|"; 120 | _typeDesc += temp; 121 | } 122 | } 123 | 124 | template 125 | bool ValuesConstraint::check( const T& val ) const 126 | { 127 | if ( std::find(_allowed.begin(),_allowed.end(),val) == _allowed.end() ) 128 | return false; 129 | else 130 | return true; 131 | } 132 | 133 | template 134 | std::string ValuesConstraint::shortID() const 135 | { 136 | return _typeDesc; 137 | } 138 | 139 | template 140 | std::string ValuesConstraint::description() const 141 | { 142 | return _typeDesc; 143 | } 144 | 145 | 146 | } //namespace TCLAP 147 | #endif 148 | 149 | -------------------------------------------------------------------------------- /components/mkspiffs/src/tclap/VersionVisitor.h: -------------------------------------------------------------------------------- 1 | // -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- 2 | 3 | /****************************************************************************** 4 | * 5 | * file: VersionVisitor.h 6 | * 7 | * Copyright (c) 2003, Michael E. Smoot . 8 | * All rights reverved. 9 | * 10 | * See the file COPYING in the top directory of this distribution for 11 | * more information. 12 | * 13 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 16 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | * DEALINGS IN THE SOFTWARE. 20 | * 21 | *****************************************************************************/ 22 | 23 | 24 | #ifndef TCLAP_VERSION_VISITOR_H 25 | #define TCLAP_VERSION_VISITOR_H 26 | 27 | #include "CmdLineInterface.h" 28 | #include "CmdLineOutput.h" 29 | #include "Visitor.h" 30 | 31 | namespace TCLAP { 32 | 33 | /** 34 | * A Vistor that will call the version method of the given CmdLineOutput 35 | * for the specified CmdLine object and then exit. 36 | */ 37 | class VersionVisitor: public Visitor 38 | { 39 | private: 40 | /** 41 | * Prevent accidental copying 42 | */ 43 | VersionVisitor(const VersionVisitor& rhs); 44 | VersionVisitor& operator=(const VersionVisitor& rhs); 45 | 46 | protected: 47 | 48 | /** 49 | * The CmdLine of interest. 50 | */ 51 | CmdLineInterface* _cmd; 52 | 53 | /** 54 | * The output object. 55 | */ 56 | CmdLineOutput** _out; 57 | 58 | public: 59 | 60 | /** 61 | * Constructor. 62 | * \param cmd - The CmdLine the output is generated for. 63 | * \param out - The type of output. 64 | */ 65 | VersionVisitor( CmdLineInterface* cmd, CmdLineOutput** out ) 66 | : Visitor(), _cmd( cmd ), _out( out ) { } 67 | 68 | /** 69 | * Calls the version method of the output object using the 70 | * specified CmdLine. 71 | */ 72 | void visit() { 73 | (*_out)->version(*_cmd); 74 | throw ExitException(0); 75 | } 76 | 77 | }; 78 | 79 | } 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /components/mkspiffs/src/tclap/Visitor.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | * 4 | * file: Visitor.h 5 | * 6 | * Copyright (c) 2003, Michael E. Smoot . 7 | * All rights reverved. 8 | * 9 | * See the file COPYING in the top directory of this distribution for 10 | * more information. 11 | * 12 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 13 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 15 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 17 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 18 | * DEALINGS IN THE SOFTWARE. 19 | * 20 | *****************************************************************************/ 21 | 22 | 23 | #ifndef TCLAP_VISITOR_H 24 | #define TCLAP_VISITOR_H 25 | 26 | namespace TCLAP { 27 | 28 | /** 29 | * A base class that defines the interface for visitors. 30 | */ 31 | class Visitor 32 | { 33 | public: 34 | 35 | /** 36 | * Constructor. Does nothing. 37 | */ 38 | Visitor() { } 39 | 40 | /** 41 | * Destructor. Does nothing. 42 | */ 43 | virtual ~Visitor() { } 44 | 45 | /** 46 | * Does nothing. Should be overridden by child. 47 | */ 48 | virtual void visit() { } 49 | }; 50 | 51 | } 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /components/mkspiffs/src/tclap/XorHandler.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | * 4 | * file: XorHandler.h 5 | * 6 | * Copyright (c) 2003, Michael E. Smoot . 7 | * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno. 8 | * All rights reverved. 9 | * 10 | * See the file COPYING in the top directory of this distribution for 11 | * more information. 12 | * 13 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 16 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | * DEALINGS IN THE SOFTWARE. 20 | * 21 | *****************************************************************************/ 22 | 23 | #ifndef TCLAP_XORHANDLER_H 24 | #define TCLAP_XORHANDLER_H 25 | 26 | #include "Arg.h" 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | namespace TCLAP { 33 | 34 | /** 35 | * This class handles lists of Arg's that are to be XOR'd on the command 36 | * line. This is used by CmdLine and you shouldn't ever use it. 37 | */ 38 | class XorHandler 39 | { 40 | protected: 41 | 42 | /** 43 | * The list of of lists of Arg's to be or'd together. 44 | */ 45 | std::vector< std::vector > _orList; 46 | 47 | public: 48 | 49 | /** 50 | * Constructor. Does nothing. 51 | */ 52 | XorHandler( ) : _orList(std::vector< std::vector >()) {} 53 | 54 | /** 55 | * Add a list of Arg*'s that will be orred together. 56 | * \param ors - list of Arg* that will be xor'd. 57 | */ 58 | void add( std::vector& ors ); 59 | 60 | /** 61 | * Checks whether the specified Arg is in one of the xor lists and 62 | * if it does match one, returns the size of the xor list that the 63 | * Arg matched. If the Arg matches, then it also sets the rest of 64 | * the Arg's in the list. You shouldn't use this. 65 | * \param a - The Arg to be checked. 66 | */ 67 | int check( const Arg* a ); 68 | 69 | /** 70 | * Returns the XOR specific short usage. 71 | */ 72 | std::string shortUsage(); 73 | 74 | /** 75 | * Prints the XOR specific long usage. 76 | * \param os - Stream to print to. 77 | */ 78 | void printLongUsage(std::ostream& os); 79 | 80 | /** 81 | * Simply checks whether the Arg is contained in one of the arg 82 | * lists. 83 | * \param a - The Arg to be checked. 84 | */ 85 | bool contains( const Arg* a ); 86 | 87 | std::vector< std::vector >& getXorList(); 88 | 89 | }; 90 | 91 | 92 | ////////////////////////////////////////////////////////////////////// 93 | //BEGIN XOR.cpp 94 | ////////////////////////////////////////////////////////////////////// 95 | inline void XorHandler::add( std::vector& ors ) 96 | { 97 | _orList.push_back( ors ); 98 | } 99 | 100 | inline int XorHandler::check( const Arg* a ) 101 | { 102 | // iterate over each XOR list 103 | for ( int i = 0; static_cast(i) < _orList.size(); i++ ) 104 | { 105 | // if the XOR list contains the arg.. 106 | ArgVectorIterator ait = std::find( _orList[i].begin(), 107 | _orList[i].end(), a ); 108 | if ( ait != _orList[i].end() ) 109 | { 110 | // first check to see if a mutually exclusive switch 111 | // has not already been set 112 | for ( ArgVectorIterator it = _orList[i].begin(); 113 | it != _orList[i].end(); 114 | it++ ) 115 | if ( a != (*it) && (*it)->isSet() ) 116 | throw(CmdLineParseException( 117 | "Mutually exclusive argument already set!", 118 | (*it)->toString())); 119 | 120 | // go through and set each arg that is not a 121 | for ( ArgVectorIterator it = _orList[i].begin(); 122 | it != _orList[i].end(); 123 | it++ ) 124 | if ( a != (*it) ) 125 | (*it)->xorSet(); 126 | 127 | // return the number of required args that have now been set 128 | if ( (*ait)->allowMore() ) 129 | return 0; 130 | else 131 | return static_cast(_orList[i].size()); 132 | } 133 | } 134 | 135 | if ( a->isRequired() ) 136 | return 1; 137 | else 138 | return 0; 139 | } 140 | 141 | inline bool XorHandler::contains( const Arg* a ) 142 | { 143 | for ( int i = 0; static_cast(i) < _orList.size(); i++ ) 144 | for ( ArgVectorIterator it = _orList[i].begin(); 145 | it != _orList[i].end(); 146 | it++ ) 147 | if ( a == (*it) ) 148 | return true; 149 | 150 | return false; 151 | } 152 | 153 | inline std::vector< std::vector >& XorHandler::getXorList() 154 | { 155 | return _orList; 156 | } 157 | 158 | 159 | 160 | ////////////////////////////////////////////////////////////////////// 161 | //END XOR.cpp 162 | ////////////////////////////////////////////////////////////////////// 163 | 164 | } //namespace TCLAP 165 | 166 | #endif 167 | -------------------------------------------------------------------------------- /components/mkspiffs/src/tclap/ZshCompletionOutput.h: -------------------------------------------------------------------------------- 1 | // -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- 2 | 3 | /****************************************************************************** 4 | * 5 | * file: ZshCompletionOutput.h 6 | * 7 | * Copyright (c) 2006, Oliver Kiddle 8 | * All rights reverved. 9 | * 10 | * See the file COPYING in the top directory of this distribution for 11 | * more information. 12 | * 13 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 16 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | * DEALINGS IN THE SOFTWARE. 20 | * 21 | *****************************************************************************/ 22 | 23 | #ifndef TCLAP_ZSHCOMPLETIONOUTPUT_H 24 | #define TCLAP_ZSHCOMPLETIONOUTPUT_H 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #include "CmdLineInterface.h" 33 | #include "CmdLineOutput.h" 34 | #include "XorHandler.h" 35 | #include "Arg.h" 36 | 37 | namespace TCLAP { 38 | 39 | /** 40 | * A class that generates a Zsh completion function as output from the usage() 41 | * method for the given CmdLine and its Args. 42 | */ 43 | class ZshCompletionOutput : public CmdLineOutput 44 | { 45 | 46 | public: 47 | 48 | ZshCompletionOutput(); 49 | 50 | /** 51 | * Prints the usage to stdout. Can be overridden to 52 | * produce alternative behavior. 53 | * \param c - The CmdLine object the output is generated for. 54 | */ 55 | virtual void usage(CmdLineInterface& c); 56 | 57 | /** 58 | * Prints the version to stdout. Can be overridden 59 | * to produce alternative behavior. 60 | * \param c - The CmdLine object the output is generated for. 61 | */ 62 | virtual void version(CmdLineInterface& c); 63 | 64 | /** 65 | * Prints (to stderr) an error message, short usage 66 | * Can be overridden to produce alternative behavior. 67 | * \param c - The CmdLine object the output is generated for. 68 | * \param e - The ArgException that caused the failure. 69 | */ 70 | virtual void failure(CmdLineInterface& c, 71 | ArgException& e ); 72 | 73 | protected: 74 | 75 | void basename( std::string& s ); 76 | void quoteSpecialChars( std::string& s ); 77 | 78 | std::string getMutexList( CmdLineInterface& _cmd, Arg* a ); 79 | void printOption( Arg* it, std::string mutex ); 80 | void printArg( Arg* it ); 81 | 82 | std::map common; 83 | char theDelimiter; 84 | }; 85 | 86 | ZshCompletionOutput::ZshCompletionOutput() 87 | : common(std::map()), 88 | theDelimiter('=') 89 | { 90 | common["host"] = "_hosts"; 91 | common["hostname"] = "_hosts"; 92 | common["file"] = "_files"; 93 | common["filename"] = "_files"; 94 | common["user"] = "_users"; 95 | common["username"] = "_users"; 96 | common["directory"] = "_directories"; 97 | common["path"] = "_directories"; 98 | common["url"] = "_urls"; 99 | } 100 | 101 | inline void ZshCompletionOutput::version(CmdLineInterface& _cmd) 102 | { 103 | std::cout << _cmd.getVersion() << std::endl; 104 | } 105 | 106 | inline void ZshCompletionOutput::usage(CmdLineInterface& _cmd ) 107 | { 108 | std::list argList = _cmd.getArgList(); 109 | std::string progName = _cmd.getProgramName(); 110 | std::string xversion = _cmd.getVersion(); 111 | theDelimiter = _cmd.getDelimiter(); 112 | basename(progName); 113 | 114 | std::cout << "#compdef " << progName << std::endl << std::endl << 115 | "# " << progName << " version " << _cmd.getVersion() << std::endl << std::endl << 116 | "_arguments -s -S"; 117 | 118 | for (ArgListIterator it = argList.begin(); it != argList.end(); it++) 119 | { 120 | if ( (*it)->shortID().at(0) == '<' ) 121 | printArg((*it)); 122 | else if ( (*it)->getFlag() != "-" ) 123 | printOption((*it), getMutexList(_cmd, *it)); 124 | } 125 | 126 | std::cout << std::endl; 127 | } 128 | 129 | inline void ZshCompletionOutput::failure( CmdLineInterface& _cmd, 130 | ArgException& e ) 131 | { 132 | static_cast(_cmd); // unused 133 | std::cout << e.what() << std::endl; 134 | } 135 | 136 | inline void ZshCompletionOutput::quoteSpecialChars( std::string& s ) 137 | { 138 | size_t idx = s.find_last_of(':'); 139 | while ( idx != std::string::npos ) 140 | { 141 | s.insert(idx, 1, '\\'); 142 | idx = s.find_last_of(':', idx); 143 | } 144 | idx = s.find_last_of('\''); 145 | while ( idx != std::string::npos ) 146 | { 147 | s.insert(idx, "'\\'"); 148 | if (idx == 0) 149 | idx = std::string::npos; 150 | else 151 | idx = s.find_last_of('\'', --idx); 152 | } 153 | } 154 | 155 | inline void ZshCompletionOutput::basename( std::string& s ) 156 | { 157 | size_t p = s.find_last_of('/'); 158 | if ( p != std::string::npos ) 159 | { 160 | s.erase(0, p + 1); 161 | } 162 | } 163 | 164 | inline void ZshCompletionOutput::printArg(Arg* a) 165 | { 166 | static int count = 1; 167 | 168 | std::cout << " \\" << std::endl << " '"; 169 | if ( a->acceptsMultipleValues() ) 170 | std::cout << '*'; 171 | else 172 | std::cout << count++; 173 | std::cout << ':'; 174 | if ( !a->isRequired() ) 175 | std::cout << ':'; 176 | 177 | std::cout << a->getName() << ':'; 178 | std::map::iterator compArg = common.find(a->getName()); 179 | if ( compArg != common.end() ) 180 | { 181 | std::cout << compArg->second; 182 | } 183 | else 184 | { 185 | std::cout << "_guard \"^-*\" " << a->getName(); 186 | } 187 | std::cout << '\''; 188 | } 189 | 190 | inline void ZshCompletionOutput::printOption(Arg* a, std::string mutex) 191 | { 192 | std::string flag = a->flagStartChar() + a->getFlag(); 193 | std::string name = a->nameStartString() + a->getName(); 194 | std::string desc = a->getDescription(); 195 | 196 | // remove full stop and capitalisation from description as 197 | // this is the convention for zsh function 198 | if (!desc.compare(0, 12, "(required) ")) 199 | { 200 | desc.erase(0, 12); 201 | } 202 | if (!desc.compare(0, 15, "(OR required) ")) 203 | { 204 | desc.erase(0, 15); 205 | } 206 | size_t len = desc.length(); 207 | if (len && desc.at(--len) == '.') 208 | { 209 | desc.erase(len); 210 | } 211 | if (len) 212 | { 213 | desc.replace(0, 1, 1, tolower(desc.at(0))); 214 | } 215 | 216 | std::cout << " \\" << std::endl << " '" << mutex; 217 | 218 | if ( a->getFlag().empty() ) 219 | { 220 | std::cout << name; 221 | } 222 | else 223 | { 224 | std::cout << "'{" << flag << ',' << name << "}'"; 225 | } 226 | if ( theDelimiter == '=' && a->isValueRequired() ) 227 | std::cout << "=-"; 228 | quoteSpecialChars(desc); 229 | std::cout << '[' << desc << ']'; 230 | 231 | if ( a->isValueRequired() ) 232 | { 233 | std::string arg = a->shortID(); 234 | arg.erase(0, arg.find_last_of(theDelimiter) + 1); 235 | if ( arg.at(arg.length()-1) == ']' ) 236 | arg.erase(arg.length()-1); 237 | if ( arg.at(arg.length()-1) == ']' ) 238 | { 239 | arg.erase(arg.length()-1); 240 | } 241 | if ( arg.at(0) == '<' ) 242 | { 243 | arg.erase(arg.length()-1); 244 | arg.erase(0, 1); 245 | } 246 | size_t p = arg.find('|'); 247 | if ( p != std::string::npos ) 248 | { 249 | do 250 | { 251 | arg.replace(p, 1, 1, ' '); 252 | } 253 | while ( (p = arg.find_first_of('|', p)) != std::string::npos ); 254 | quoteSpecialChars(arg); 255 | std::cout << ": :(" << arg << ')'; 256 | } 257 | else 258 | { 259 | std::cout << ':' << arg; 260 | std::map::iterator compArg = common.find(arg); 261 | if ( compArg != common.end() ) 262 | { 263 | std::cout << ':' << compArg->second; 264 | } 265 | } 266 | } 267 | 268 | std::cout << '\''; 269 | } 270 | 271 | inline std::string ZshCompletionOutput::getMutexList( CmdLineInterface& _cmd, Arg* a) 272 | { 273 | XorHandler xorHandler = _cmd.getXorHandler(); 274 | std::vector< std::vector > xorList = xorHandler.getXorList(); 275 | 276 | if (a->getName() == "help" || a->getName() == "version") 277 | { 278 | return "(-)"; 279 | } 280 | 281 | std::ostringstream list; 282 | if ( a->acceptsMultipleValues() ) 283 | { 284 | list << '*'; 285 | } 286 | 287 | for ( int i = 0; static_cast(i) < xorList.size(); i++ ) 288 | { 289 | for ( ArgVectorIterator it = xorList[i].begin(); 290 | it != xorList[i].end(); 291 | it++) 292 | if ( a == (*it) ) 293 | { 294 | list << '('; 295 | for ( ArgVectorIterator iu = xorList[i].begin(); 296 | iu != xorList[i].end(); 297 | iu++ ) 298 | { 299 | bool notCur = (*iu) != a; 300 | bool hasFlag = !(*iu)->getFlag().empty(); 301 | if ( iu != xorList[i].begin() && (notCur || hasFlag) ) 302 | list << ' '; 303 | if (hasFlag) 304 | list << (*iu)->flagStartChar() << (*iu)->getFlag() << ' '; 305 | if ( notCur || hasFlag ) 306 | list << (*iu)->nameStartString() << (*iu)->getName(); 307 | } 308 | list << ')'; 309 | return list.str(); 310 | } 311 | } 312 | 313 | // wasn't found in xor list 314 | if (!a->getFlag().empty()) { 315 | list << "(" << a->flagStartChar() << a->getFlag() << ' ' << 316 | a->nameStartString() << a->getName() << ')'; 317 | } 318 | 319 | return list.str(); 320 | } 321 | 322 | } //namespace TCLAP 323 | #endif 324 | -------------------------------------------------------------------------------- /components/spidriver/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Main Makefile. This is basically the same as a component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | COMPONENT_SRCDIRS := . 7 | COMPONENT_ADD_INCLUDEDIRS := . 8 | -------------------------------------------------------------------------------- /components/spiffs/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Component Makefile 3 | # 4 | 5 | COMPONENT_SRCDIRS := . 6 | COMPONENT_ADD_INCLUDEDIRS := . 7 | COMPONENT_PRIV_INCLUDEDIRS := -------------------------------------------------------------------------------- /components/spiffs/esp_spiffs.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Lua RTOS, SPIFFS low access 3 | * 4 | * Copyright (C) 2015 - 2017 5 | * IBEROXARXA SERVICIOS INTEGRALES, S.L. & CSS IBÉRICA, S.L. 6 | * 7 | * Author: Jaume Olivé (jolive@iberoxarxa.com / jolive@whitecatboard.org) 8 | * 9 | * All rights reserved. 10 | * 11 | * Permission to use, copy, modify, and distribute this software 12 | * and its documentation for any purpose and without fee is hereby 13 | * granted, provided that the above copyright notice appear in all 14 | * copies and that both that the copyright notice and this 15 | * permission notice and warranty disclaimer appear in supporting 16 | * documentation, and that the name of the author not be used in 17 | * advertising or publicity pertaining to distribution of the 18 | * software without specific, written prior permission. 19 | * 20 | * The author disclaim all warranties with regard to this 21 | * software, including all implied warranties of merchantability 22 | * and fitness. In no event shall the author be liable for any 23 | * special, indirect or consequential damages or any damages 24 | * whatsoever resulting from loss of use, data or profits, whether 25 | * in an action of contract, negligence or other tortious action, 26 | * arising out of or in connection with the use or performance of 27 | * this software. 28 | */ 29 | 30 | #include 31 | 32 | #include "esp_spiffs.h" 33 | #include "esp_attr.h" 34 | 35 | #include "spiffs.h" 36 | 37 | #include 38 | 39 | s32_t IRAM_ATTR esp32_spi_flash_read(u32_t addr, u32_t size, u8_t *dst) { 40 | u32_t aaddr; 41 | u8_t *buff = NULL; 42 | u8_t *abuff = NULL; 43 | u32_t asize; 44 | 45 | asize = size; 46 | 47 | // Align address to 4 byte 48 | aaddr = (addr + (4 - 1)) & (u32_t)-4; 49 | if (aaddr != addr) { 50 | aaddr -= 4; 51 | asize += (addr - aaddr); 52 | } 53 | 54 | // Align size to 4 byte 55 | asize = (asize + (4 - 1)) & (u32_t)-4; 56 | 57 | if ((aaddr != addr) || (asize != size)) { 58 | // Align buffer 59 | buff = malloc(asize + 4); 60 | if (!buff) { 61 | return SPIFFS_ERR_INTERNAL; 62 | } 63 | 64 | abuff = (u8_t *)(((ptrdiff_t)buff + (4 - 1)) & (u32_t)-4); 65 | 66 | if (spi_flash_read(aaddr, (void *)abuff, asize) != 0) { 67 | free(buff); 68 | return SPIFFS_ERR_INTERNAL; 69 | } 70 | 71 | memcpy(dst, abuff + (addr - aaddr), size); 72 | 73 | free(buff); 74 | } else { 75 | if (spi_flash_read(addr, (void *)dst, size) != 0) { 76 | return SPIFFS_ERR_INTERNAL; 77 | } 78 | } 79 | 80 | return SPIFFS_OK; 81 | } 82 | 83 | s32_t IRAM_ATTR esp32_spi_flash_write(u32_t addr, u32_t size, const u8_t *src) { 84 | u32_t aaddr; 85 | u8_t *buff = NULL; 86 | u8_t *abuff = NULL; 87 | u32_t asize; 88 | 89 | asize = size; 90 | 91 | // Align address to 4 byte 92 | aaddr = (addr + (4 - 1)) & -4; 93 | if (aaddr != addr) { 94 | aaddr -= 4; 95 | asize += (addr - aaddr); 96 | } 97 | 98 | // Align size to 4 byte 99 | asize = (asize + (4 - 1)) & -4; 100 | 101 | if ((aaddr != addr) || (asize != size)) { 102 | // Align buffer 103 | buff = malloc(asize + 4); 104 | if (!buff) { 105 | return SPIFFS_ERR_INTERNAL; 106 | } 107 | 108 | abuff = (u8_t *)(((ptrdiff_t)buff + (4 - 1)) & -4); 109 | 110 | if (spi_flash_read(aaddr, (void *)abuff, asize) != 0) { 111 | free(buff); 112 | return SPIFFS_ERR_INTERNAL; 113 | } 114 | 115 | memcpy(abuff + (addr - aaddr), src, size); 116 | 117 | if (spi_flash_write(aaddr, (uint32_t *)abuff, asize) != 0) { 118 | free(buff); 119 | return SPIFFS_ERR_INTERNAL; 120 | } 121 | 122 | free(buff); 123 | } else { 124 | if (spi_flash_write(addr, (uint32_t *)src, size) != 0) { 125 | return SPIFFS_ERR_INTERNAL; 126 | } 127 | } 128 | 129 | return SPIFFS_OK; 130 | } 131 | 132 | s32_t IRAM_ATTR esp32_spi_flash_erase(u32_t addr, u32_t size) { 133 | if (spi_flash_erase_sector(addr >> 12) != 0) { 134 | return SPIFFS_ERR_INTERNAL; 135 | } 136 | 137 | return SPIFFS_OK; 138 | } 139 | -------------------------------------------------------------------------------- /components/spiffs/esp_spiffs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Lua RTOS, write syscall implementation 3 | * 4 | * Copyright (C) 2015 - 2017 5 | * IBEROXARXA SERVICIOS INTEGRALES, S.L. & CSS IBÉRICA, S.L. 6 | * 7 | * Author: Jaume Olivé (jolive@iberoxarxa.com / jolive@whitecatboard.org) 8 | * 9 | * All rights reserved. 10 | * 11 | * Permission to use, copy, modify, and distribute this software 12 | * and its documentation for any purpose and without fee is hereby 13 | * granted, provided that the above copyright notice appear in all 14 | * copies and that both that the copyright notice and this 15 | * permission notice and warranty disclaimer appear in supporting 16 | * documentation, and that the name of the author not be used in 17 | * advertising or publicity pertaining to distribution of the 18 | * software without specific, written prior permission. 19 | * 20 | * The author disclaim all warranties with regard to this 21 | * software, including all implied warranties of merchantability 22 | * and fitness. In no event shall the author be liable for any 23 | * special, indirect or consequential damages or any damages 24 | * whatsoever resulting from loss of use, data or profits, whether 25 | * in an action of contract, negligence or other tortious action, 26 | * arising out of or in connection with the use or performance of 27 | * this software. 28 | */ 29 | 30 | #ifndef __ESP_SPIFFS_H__ 31 | #define __ESP_SPIFFS_H__ 32 | 33 | #include "spiffs.h" 34 | 35 | s32_t esp32_spi_flash_read(u32_t addr, u32_t size, u8_t *dst); 36 | s32_t esp32_spi_flash_write(u32_t addr, u32_t size, const u8_t *src); 37 | s32_t esp32_spi_flash_erase(u32_t addr, u32_t size); 38 | 39 | #define low_spiffs_read (spiffs_read *)esp32_spi_flash_read 40 | #define low_spiffs_write (spiffs_write *)esp32_spi_flash_write 41 | #define low_spiffs_erase (spiffs_erase *)esp32_spi_flash_erase 42 | 43 | #endif // __ESP_SPIFFS_H__ 44 | -------------------------------------------------------------------------------- /components/spiffs/list.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Lua RTOS, list data structure 3 | * 4 | * Copyright (C) 2015 - 2017 5 | * IBEROXARXA SERVICIOS INTEGRALES, S.L. & CSS IBÉRICA, S.L. 6 | * 7 | * Author: Jaume Olivé (jolive@iberoxarxa.com / jolive@whitecatboard.org) 8 | * 9 | * All rights reserved. 10 | * 11 | * Permission to use, copy, modify, and distribute this software 12 | * and its documentation for any purpose and without fee is hereby 13 | * granted, provided that the above copyright notice appear in all 14 | * copies and that both that the copyright notice and this 15 | * permission notice and warranty disclaimer appear in supporting 16 | * documentation, and that the name of the author not be used in 17 | * advertising or publicity pertaining to distribution of the 18 | * software without specific, written prior permission. 19 | * 20 | * The author disclaim all warranties with regard to this 21 | * software, including all implied warranties of merchantability 22 | * and fitness. In no event shall the author be liable for any 23 | * special, indirect or consequential damages or any damages 24 | * whatsoever resulting from loss of use, data or profits, whether 25 | * in an action of contract, negligence or other tortious action, 26 | * arising out of or in connection with the use or performance of 27 | * this software. 28 | */ 29 | 30 | #include "esp_attr.h" 31 | 32 | #include 33 | #include 34 | #include 35 | 36 | #include "list.h" 37 | #include "mutex.h" 38 | 39 | void list_init(struct list *list, int first_index) { 40 | // Create the mutex 41 | mtx_init(&list->mutex, NULL, NULL, 0); 42 | 43 | mtx_lock(&list->mutex); 44 | 45 | list->indexes = 0; 46 | list->free = NULL; 47 | list->index = NULL; 48 | list->first_index = first_index; 49 | 50 | mtx_unlock(&list->mutex); 51 | } 52 | 53 | int list_add(struct list *list, void *item, int *item_index) { 54 | struct list_index *index = NULL; 55 | struct list_index *indexa = NULL; 56 | int grow = 0; 57 | 58 | mtx_lock(&list->mutex); 59 | 60 | // Get an index 61 | if (list->free) { 62 | // Get first free element 63 | index = list->free; 64 | list->free = index->next; 65 | } else { 66 | // Must grow index array 67 | grow = 1; 68 | } 69 | 70 | if (grow) { 71 | // Increment index count 72 | list->indexes++; 73 | 74 | // Create a new index array for allocate new index 75 | indexa = (struct list_index *)malloc(sizeof(struct list_index) * list->indexes); 76 | if (!indexa) { 77 | mtx_unlock(&list->mutex); 78 | return ENOMEM; 79 | } 80 | 81 | if (list->index) { 82 | // Copy current index array to new created 83 | bcopy(list->index, indexa, sizeof(struct list_index) * (list->indexes - 1)); 84 | 85 | // Free current index array 86 | free(list->index); 87 | } 88 | 89 | // Store new index array 90 | list->index = indexa; 91 | 92 | // Current index 93 | index = list->index + list->indexes - 1; 94 | 95 | // Initialize new index 96 | index->index = list->indexes - 1; 97 | 98 | } 99 | 100 | index->next = NULL; 101 | index->item = item; 102 | index->deleted = 0; 103 | 104 | // Return index 105 | *item_index = index->index + list->first_index; 106 | 107 | mtx_unlock(&list->mutex); 108 | 109 | return 0; 110 | } 111 | 112 | int IRAM_ATTR list_get(struct list *list, int index, void **item) { 113 | struct list_index *cindex = NULL; 114 | int iindex; 115 | 116 | mtx_lock(&list->mutex); 117 | 118 | if (!list->indexes) { 119 | mtx_unlock(&list->mutex); 120 | return EINVAL; 121 | } 122 | 123 | // Check index 124 | if (index < list->first_index) { 125 | mtx_unlock(&list->mutex); 126 | return EINVAL; 127 | } 128 | 129 | // Get new internal index 130 | iindex = index - list->first_index; 131 | 132 | // Test for a valid index 133 | if (iindex > list->indexes) { 134 | mtx_unlock(&list->mutex); 135 | return EINVAL; 136 | } 137 | 138 | cindex = list->index + iindex; 139 | 140 | if (cindex->deleted) { 141 | mtx_unlock(&list->mutex); 142 | return EINVAL; 143 | } 144 | 145 | *item = cindex->item; 146 | 147 | mtx_unlock(&list->mutex); 148 | 149 | return 0; 150 | } 151 | 152 | int list_remove(struct list *list, int index, int destroy) { 153 | struct list_index *cindex = NULL; 154 | int iindex; 155 | 156 | mtx_lock(&list->mutex); 157 | 158 | // Check index 159 | if (index < list->first_index) { 160 | mtx_unlock(&list->mutex); 161 | return EINVAL; 162 | } 163 | 164 | // Get new internal index 165 | iindex = index - list->first_index; 166 | 167 | // Test for a valid index 168 | if ((iindex < 0) || (iindex > list->indexes)) { 169 | mtx_unlock(&list->mutex); 170 | return EINVAL; 171 | } 172 | 173 | cindex = &list->index[iindex]; 174 | 175 | if (destroy) { 176 | free(cindex->item); 177 | } 178 | 179 | cindex->next = list->free; 180 | cindex->deleted = 1; 181 | list->free = cindex; 182 | 183 | mtx_unlock(&list->mutex); 184 | 185 | return 0; 186 | } 187 | 188 | int IRAM_ATTR list_first(struct list *list) { 189 | int index; 190 | int res = -1; 191 | 192 | mtx_lock(&list->mutex); 193 | 194 | for(index=0;index < list->indexes;index++) { 195 | if (!list->index[index].deleted) { 196 | res = index + list->first_index; 197 | break; 198 | } 199 | } 200 | 201 | mtx_unlock(&list->mutex); 202 | 203 | return res; 204 | } 205 | 206 | int IRAM_ATTR list_next(struct list *list, int index) { 207 | int res = -1; 208 | int iindex; 209 | 210 | mtx_lock(&list->mutex); 211 | 212 | // Check index 213 | if (index < list->first_index) { 214 | mtx_unlock(&list->mutex); 215 | return -1; 216 | } 217 | 218 | // Get new internal index 219 | iindex = index - list->first_index + 1; 220 | 221 | // Get next non deleted item on list 222 | for(;iindex < list->indexes;iindex++) { 223 | if (!list->index[iindex].deleted) { 224 | res = iindex + list->first_index; 225 | break; 226 | } 227 | } 228 | 229 | mtx_unlock(&list->mutex); 230 | 231 | return res; 232 | } 233 | 234 | void list_destroy(struct list *list, int items) { 235 | int index; 236 | 237 | mtx_lock(&list->mutex); 238 | 239 | if (items) { 240 | for(index=0;index < list->indexes;index++) { 241 | if (!list->index[index].deleted) { 242 | free(list->index[index].item); 243 | } 244 | } 245 | } 246 | 247 | free(list->index); 248 | 249 | mtx_unlock(&list->mutex); 250 | mtx_destroy(&list->mutex); 251 | } 252 | -------------------------------------------------------------------------------- /components/spiffs/list.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Lua RTOS, list data structure 3 | * 4 | * Copyright (C) 2015 - 2017 5 | * IBEROXARXA SERVICIOS INTEGRALES, S.L. & CSS IBÉRICA, S.L. 6 | * 7 | * Author: Jaume Olivé (jolive@iberoxarxa.com / jolive@whitecatboard.org) 8 | * 9 | * All rights reserved. 10 | * 11 | * Permission to use, copy, modify, and distribute this software 12 | * and its documentation for any purpose and without fee is hereby 13 | * granted, provided that the above copyright notice appear in all 14 | * copies and that both that the copyright notice and this 15 | * permission notice and warranty disclaimer appear in supporting 16 | * documentation, and that the name of the author not be used in 17 | * advertising or publicity pertaining to distribution of the 18 | * software without specific, written prior permission. 19 | * 20 | * The author disclaim all warranties with regard to this 21 | * software, including all implied warranties of merchantability 22 | * and fitness. In no event shall the author be liable for any 23 | * special, indirect or consequential damages or any damages 24 | * whatsoever resulting from loss of use, data or profits, whether 25 | * in an action of contract, negligence or other tortious action, 26 | * arising out of or in connection with the use or performance of 27 | * this software. 28 | */ 29 | 30 | #ifndef _LIST_H 31 | #define _LIST_H 32 | 33 | #include 34 | #include "mutex.h" 35 | 36 | struct list { 37 | struct mtx mutex; 38 | struct list_index *index; 39 | struct list_index *free; 40 | uint8_t indexes; 41 | uint8_t first_index; 42 | }; 43 | 44 | struct list_index { 45 | void *item; 46 | uint8_t index; 47 | uint8_t deleted; 48 | struct list_index *next; 49 | }; 50 | 51 | void list_init(struct list *list, int first_index); 52 | int list_add(struct list *list, void *item, int *item_index); 53 | int list_get(struct list *list, int index, void **item); 54 | int list_remove(struct list *list, int index, int destroy); 55 | int list_first(struct list *list); 56 | int list_next(struct list *list, int index); 57 | void list_destroy(struct list *list, int items); 58 | 59 | #endif /* LIST_H */ 60 | 61 | -------------------------------------------------------------------------------- /components/spiffs/mutex.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Lua RTOS, mutex api implementation over FreeRTOS 3 | * 4 | * Copyright (C) 2015 - 2017 5 | * IBEROXARXA SERVICIOS INTEGRALES, S.L. & CSS IBÉRICA, S.L. 6 | * 7 | * Author: Jaume Olivé (jolive@iberoxarxa.com / jolive@whitecatboard.org) 8 | * 9 | * All rights reserved. 10 | * 11 | * Permission to use, copy, modify, and distribute this software 12 | * and its documentation for any purpose and without fee is hereby 13 | * granted, provided that the above copyright notice appear in all 14 | * copies and that both that the copyright notice and this 15 | * permission notice and warranty disclaimer appear in supporting 16 | * documentation, and that the name of the author not be used in 17 | * advertising or publicity pertaining to distribution of the 18 | * software without specific, written prior permission. 19 | * 20 | * The author disclaim all warranties with regard to this 21 | * software, including all implied warranties of merchantability 22 | * and fitness. In no event shall the author be liable for any 23 | * special, indirect or consequential damages or any damages 24 | * whatsoever resulting from loss of use, data or profits, whether 25 | * in an action of contract, negligence or other tortious action, 26 | * arising out of or in connection with the use or performance of 27 | * this software. 28 | * 29 | * Modified by: LoBo (loboris@gmail.com / https://github.com/loboris) 30 | * 31 | */ 32 | 33 | #include "freertos/FreeRTOS.h" 34 | #include "esp_attr.h" 35 | #include "mutex.h" 36 | 37 | 38 | #define portEND_SWITCHING_ISR(xSwitchRequired) \ 39 | if (xSwitchRequired) { \ 40 | _frxt_setup_switch(); \ 41 | } 42 | 43 | extern unsigned port_interruptNesting[portNUM_PROCESSORS]; 44 | 45 | void _mtx_init() { 46 | } 47 | 48 | void mtx_init(struct mtx *mutex, const char *name, const char *type, int opts) { 49 | mutex->sem = xSemaphoreCreateBinary(); 50 | 51 | if (mutex->sem) { 52 | if (port_interruptNesting[xPortGetCoreID()] != 0) { 53 | BaseType_t xHigherPriorityTaskWoken = pdFALSE; 54 | xSemaphoreGiveFromISR( mutex->sem, &xHigherPriorityTaskWoken); 55 | portEND_SWITCHING_ISR( xHigherPriorityTaskWoken ); 56 | } else { 57 | xSemaphoreGive( mutex->sem ); 58 | } 59 | } 60 | } 61 | 62 | void IRAM_ATTR mtx_lock(struct mtx *mutex) { 63 | if (port_interruptNesting[xPortGetCoreID()] != 0) { 64 | BaseType_t xHigherPriorityTaskWoken = pdFALSE; 65 | xSemaphoreTakeFromISR( mutex->sem, &xHigherPriorityTaskWoken ); 66 | portEND_SWITCHING_ISR( xHigherPriorityTaskWoken ); 67 | } else { 68 | xSemaphoreTake( mutex->sem, portMAX_DELAY ); 69 | } 70 | } 71 | 72 | int mtx_trylock(struct mtx *mutex) { 73 | if (xSemaphoreTake( mutex->sem, 0 ) == pdTRUE) { 74 | return 1; 75 | } else { 76 | return 0; 77 | } 78 | } 79 | 80 | void IRAM_ATTR mtx_unlock(struct mtx *mutex) { 81 | if (port_interruptNesting[xPortGetCoreID()] != 0) { 82 | BaseType_t xHigherPriorityTaskWoken = pdFALSE; 83 | xSemaphoreGiveFromISR( mutex->sem, &xHigherPriorityTaskWoken ); 84 | portEND_SWITCHING_ISR( xHigherPriorityTaskWoken ); 85 | } else { 86 | xSemaphoreGive( mutex->sem ); 87 | } 88 | } 89 | 90 | void mtx_destroy(struct mtx *mutex) { 91 | if (port_interruptNesting[xPortGetCoreID()] != 0) { 92 | BaseType_t xHigherPriorityTaskWoken = pdFALSE; 93 | xSemaphoreGiveFromISR( mutex->sem, &xHigherPriorityTaskWoken ); 94 | portEND_SWITCHING_ISR( xHigherPriorityTaskWoken ); 95 | } else { 96 | xSemaphoreGive( mutex->sem ); 97 | } 98 | 99 | vSemaphoreDelete( mutex->sem ); 100 | 101 | mutex->sem = 0; 102 | } 103 | -------------------------------------------------------------------------------- /components/spiffs/mutex.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Lua RTOS, mutex api implementation over FreeRTOS 3 | * 4 | * Copyright (C) 2015 - 2017 5 | * IBEROXARXA SERVICIOS INTEGRALES, S.L. & CSS IBÉRICA, S.L. 6 | * 7 | * Author: Jaume Olivé (jolive@iberoxarxa.com / jolive@whitecatboard.org) 8 | * 9 | * All rights reserved. 10 | * 11 | * Permission to use, copy, modify, and distribute this software 12 | * and its documentation for any purpose and without fee is hereby 13 | * granted, provided that the above copyright notice appear in all 14 | * copies and that both that the copyright notice and this 15 | * permission notice and warranty disclaimer appear in supporting 16 | * documentation, and that the name of the author not be used in 17 | * advertising or publicity pertaining to distribution of the 18 | * software without specific, written prior permission. 19 | * 20 | * The author disclaim all warranties with regard to this 21 | * software, including all implied warranties of merchantability 22 | * and fitness. In no event shall the author be liable for any 23 | * special, indirect or consequential damages or any damages 24 | * whatsoever resulting from loss of use, data or profits, whether 25 | * in an action of contract, negligence or other tortious action, 26 | * arising out of or in connection with the use or performance of 27 | * this software. 28 | * 29 | * Modified by: LoBo (loboris@gmail.com / https://github.com/loboris) 30 | * 31 | */ 32 | 33 | #ifndef MUTEX_H_H 34 | #define MUTEX_H_H 35 | 36 | #include "freertos/FreeRTOS.h" 37 | #include "freertos/semphr.h" 38 | 39 | #define MUTEX_INITIALIZER {.sem = 0} 40 | 41 | struct mtx { 42 | SemaphoreHandle_t sem; 43 | }; 44 | 45 | 46 | void mtx_init(struct mtx *mutex, const char *name, const char *type, int opts); 47 | void mtx_lock(struct mtx *mutex); 48 | int mtx_trylock(struct mtx *mutex); 49 | void mtx_unlock(struct mtx *mutex); 50 | void mtx_destroy(struct mtx *mutex); 51 | 52 | #endif /* MUTEX_H_H */ 53 | 54 | -------------------------------------------------------------------------------- /components/spiffs/spiffs_cache.c: -------------------------------------------------------------------------------- 1 | /* 2 | * spiffs_cache.c 3 | * 4 | * Created on: Jun 23, 2013 5 | * Author: petera 6 | */ 7 | 8 | #include "spiffs.h" 9 | #include "spiffs_nucleus.h" 10 | 11 | #if SPIFFS_CACHE 12 | 13 | // returns cached page for give page index, or null if no such cached page 14 | static spiffs_cache_page *spiffs_cache_page_get(spiffs *fs, spiffs_page_ix pix) { 15 | spiffs_cache *cache = spiffs_get_cache(fs); 16 | if ((cache->cpage_use_map & cache->cpage_use_mask) == 0) return 0; 17 | int i; 18 | for (i = 0; i < cache->cpage_count; i++) { 19 | spiffs_cache_page *cp = spiffs_get_cache_page_hdr(fs, cache, i); 20 | if ((cache->cpage_use_map & (1<flags & SPIFFS_CACHE_FLAG_TYPE_WR) == 0 && 22 | cp->pix == pix ) { 23 | SPIFFS_CACHE_DBG("CACHE_GET: have cache page "_SPIPRIi" for "_SPIPRIpg"\n", i, pix); 24 | cp->last_access = cache->last_access; 25 | return cp; 26 | } 27 | } 28 | //SPIFFS_CACHE_DBG("CACHE_GET: no cache for "_SPIPRIpg"\n", pix); 29 | return 0; 30 | } 31 | 32 | // frees cached page 33 | static s32_t spiffs_cache_page_free(spiffs *fs, int ix, u8_t write_back) { 34 | s32_t res = SPIFFS_OK; 35 | spiffs_cache *cache = spiffs_get_cache(fs); 36 | spiffs_cache_page *cp = spiffs_get_cache_page_hdr(fs, cache, ix); 37 | if (cache->cpage_use_map & (1<flags & SPIFFS_CACHE_FLAG_TYPE_WR) == 0 && 40 | (cp->flags & SPIFFS_CACHE_FLAG_DIRTY)) { 41 | u8_t *mem = spiffs_get_cache_page(fs, cache, ix); 42 | res = SPIFFS_HAL_WRITE(fs, SPIFFS_PAGE_TO_PADDR(fs, cp->pix), SPIFFS_CFG_LOG_PAGE_SZ(fs), mem); 43 | } 44 | 45 | cp->flags = 0; 46 | cache->cpage_use_map &= ~(1 << ix); 47 | 48 | if (cp->flags & SPIFFS_CACHE_FLAG_TYPE_WR) { 49 | SPIFFS_CACHE_DBG("CACHE_FREE: free cache page "_SPIPRIi" objid "_SPIPRIid"\n", ix, cp->obj_id); 50 | } else { 51 | SPIFFS_CACHE_DBG("CACHE_FREE: free cache page "_SPIPRIi" pix "_SPIPRIpg"\n", ix, cp->pix); 52 | } 53 | } 54 | 55 | return res; 56 | } 57 | 58 | // removes the oldest accessed cached page 59 | static s32_t spiffs_cache_page_remove_oldest(spiffs *fs, u8_t flag_mask, u8_t flags) { 60 | s32_t res = SPIFFS_OK; 61 | spiffs_cache *cache = spiffs_get_cache(fs); 62 | 63 | if ((cache->cpage_use_map & cache->cpage_use_mask) != cache->cpage_use_mask) { 64 | // at least one free cpage 65 | return SPIFFS_OK; 66 | } 67 | 68 | // all busy, scan thru all to find the cpage which has oldest access 69 | int i; 70 | int cand_ix = -1; 71 | u32_t oldest_val = 0; 72 | for (i = 0; i < cache->cpage_count; i++) { 73 | spiffs_cache_page *cp = spiffs_get_cache_page_hdr(fs, cache, i); 74 | if ((cache->last_access - cp->last_access) > oldest_val && 75 | (cp->flags & flag_mask) == flags) { 76 | oldest_val = cache->last_access - cp->last_access; 77 | cand_ix = i; 78 | } 79 | } 80 | 81 | if (cand_ix >= 0) { 82 | res = spiffs_cache_page_free(fs, cand_ix, 1); 83 | } 84 | 85 | return res; 86 | } 87 | 88 | // allocates a new cached page and returns it, or null if all cache pages are busy 89 | static spiffs_cache_page *spiffs_cache_page_allocate(spiffs *fs) { 90 | spiffs_cache *cache = spiffs_get_cache(fs); 91 | if (cache->cpage_use_map == 0xffffffff) { 92 | // out of cache memory 93 | return 0; 94 | } 95 | int i; 96 | for (i = 0; i < cache->cpage_count; i++) { 97 | if ((cache->cpage_use_map & (1<cpage_use_map |= (1<last_access = cache->last_access; 101 | SPIFFS_CACHE_DBG("CACHE_ALLO: allocated cache page "_SPIPRIi"\n", i); 102 | return cp; 103 | } 104 | } 105 | // out of cache entries 106 | return 0; 107 | } 108 | 109 | // drops the cache page for give page index 110 | void spiffs_cache_drop_page(spiffs *fs, spiffs_page_ix pix) { 111 | spiffs_cache_page *cp = spiffs_cache_page_get(fs, pix); 112 | if (cp) { 113 | spiffs_cache_page_free(fs, cp->ix, 0); 114 | } 115 | } 116 | 117 | // ------------------------------ 118 | 119 | // reads from spi flash or the cache 120 | s32_t spiffs_phys_rd( 121 | spiffs *fs, 122 | u8_t op, 123 | spiffs_file fh, 124 | u32_t addr, 125 | u32_t len, 126 | u8_t *dst) { 127 | (void)fh; 128 | s32_t res = SPIFFS_OK; 129 | spiffs_cache *cache = spiffs_get_cache(fs); 130 | spiffs_cache_page *cp = spiffs_cache_page_get(fs, SPIFFS_PADDR_TO_PAGE(fs, addr)); 131 | cache->last_access++; 132 | if (cp) { 133 | // we've already got one, you see 134 | #if SPIFFS_CACHE_STATS 135 | fs->cache_hits++; 136 | #endif 137 | cp->last_access = cache->last_access; 138 | u8_t *mem = spiffs_get_cache_page(fs, cache, cp->ix); 139 | memcpy(dst, &mem[SPIFFS_PADDR_TO_PAGE_OFFSET(fs, addr)], len); 140 | } else { 141 | if ((op & SPIFFS_OP_TYPE_MASK) == SPIFFS_OP_T_OBJ_LU2) { 142 | // for second layer lookup functions, we do not cache in order to prevent shredding 143 | return SPIFFS_HAL_READ(fs, addr, len, dst); 144 | } 145 | #if SPIFFS_CACHE_STATS 146 | fs->cache_misses++; 147 | #endif 148 | // this operation will always free one cache page (unless all already free), 149 | // the result code stems from the write operation of the possibly freed cache page 150 | res = spiffs_cache_page_remove_oldest(fs, SPIFFS_CACHE_FLAG_TYPE_WR, 0); 151 | 152 | cp = spiffs_cache_page_allocate(fs); 153 | if (cp) { 154 | cp->flags = SPIFFS_CACHE_FLAG_WRTHRU; 155 | cp->pix = SPIFFS_PADDR_TO_PAGE(fs, addr); 156 | 157 | s32_t res2 = SPIFFS_HAL_READ(fs, 158 | addr - SPIFFS_PADDR_TO_PAGE_OFFSET(fs, addr), 159 | SPIFFS_CFG_LOG_PAGE_SZ(fs), 160 | spiffs_get_cache_page(fs, cache, cp->ix)); 161 | if (res2 != SPIFFS_OK) { 162 | // honor read failure before possible write failure (bad idea?) 163 | res = res2; 164 | } 165 | u8_t *mem = spiffs_get_cache_page(fs, cache, cp->ix); 166 | memcpy(dst, &mem[SPIFFS_PADDR_TO_PAGE_OFFSET(fs, addr)], len); 167 | } else { 168 | // this will never happen, last resort for sake of symmetry 169 | s32_t res2 = SPIFFS_HAL_READ(fs, addr, len, dst); 170 | if (res2 != SPIFFS_OK) { 171 | // honor read failure before possible write failure (bad idea?) 172 | res = res2; 173 | } 174 | } 175 | } 176 | return res; 177 | } 178 | 179 | // writes to spi flash and/or the cache 180 | s32_t spiffs_phys_wr( 181 | spiffs *fs, 182 | u8_t op, 183 | spiffs_file fh, 184 | u32_t addr, 185 | u32_t len, 186 | u8_t *src) { 187 | (void)fh; 188 | spiffs_page_ix pix = SPIFFS_PADDR_TO_PAGE(fs, addr); 189 | spiffs_cache *cache = spiffs_get_cache(fs); 190 | spiffs_cache_page *cp = spiffs_cache_page_get(fs, pix); 191 | 192 | if (cp && (op & SPIFFS_OP_COM_MASK) != SPIFFS_OP_C_WRTHRU) { 193 | // have a cache page 194 | // copy in data to cache page 195 | 196 | if ((op & SPIFFS_OP_COM_MASK) == SPIFFS_OP_C_DELE && 197 | (op & SPIFFS_OP_TYPE_MASK) != SPIFFS_OP_T_OBJ_LU) { 198 | // page is being deleted, wipe from cache - unless it is a lookup page 199 | spiffs_cache_page_free(fs, cp->ix, 0); 200 | return SPIFFS_HAL_WRITE(fs, addr, len, src); 201 | } 202 | 203 | u8_t *mem = spiffs_get_cache_page(fs, cache, cp->ix); 204 | memcpy(&mem[SPIFFS_PADDR_TO_PAGE_OFFSET(fs, addr)], src, len); 205 | 206 | cache->last_access++; 207 | cp->last_access = cache->last_access; 208 | 209 | if (cp->flags & SPIFFS_CACHE_FLAG_WRTHRU) { 210 | // page is being updated, no write-cache, just pass thru 211 | return SPIFFS_HAL_WRITE(fs, addr, len, src); 212 | } else { 213 | return SPIFFS_OK; 214 | } 215 | } else { 216 | // no cache page, no write cache - just write thru 217 | return SPIFFS_HAL_WRITE(fs, addr, len, src); 218 | } 219 | } 220 | 221 | #if SPIFFS_CACHE_WR 222 | // returns the cache page that this fd refers, or null if no cache page 223 | spiffs_cache_page *spiffs_cache_page_get_by_fd(spiffs *fs, spiffs_fd *fd) { 224 | spiffs_cache *cache = spiffs_get_cache(fs); 225 | 226 | if ((cache->cpage_use_map & cache->cpage_use_mask) == 0) { 227 | // all cpages free, no cpage cannot be assigned to obj_id 228 | return 0; 229 | } 230 | 231 | int i; 232 | for (i = 0; i < cache->cpage_count; i++) { 233 | spiffs_cache_page *cp = spiffs_get_cache_page_hdr(fs, cache, i); 234 | if ((cache->cpage_use_map & (1<flags & SPIFFS_CACHE_FLAG_TYPE_WR) && 236 | cp->obj_id == fd->obj_id) { 237 | return cp; 238 | } 239 | } 240 | 241 | return 0; 242 | } 243 | 244 | // allocates a new cache page and refers this to given fd - flushes an old cache 245 | // page if all cache is busy 246 | spiffs_cache_page *spiffs_cache_page_allocate_by_fd(spiffs *fs, spiffs_fd *fd) { 247 | // before this function is called, it is ensured that there is no already existing 248 | // cache page with same object id 249 | spiffs_cache_page_remove_oldest(fs, SPIFFS_CACHE_FLAG_TYPE_WR, 0); 250 | spiffs_cache_page *cp = spiffs_cache_page_allocate(fs); 251 | if (cp == 0) { 252 | // could not get cache page 253 | return 0; 254 | } 255 | 256 | cp->flags = SPIFFS_CACHE_FLAG_TYPE_WR; 257 | cp->obj_id = fd->obj_id; 258 | fd->cache_page = cp; 259 | return cp; 260 | } 261 | 262 | // unrefers all fds that this cache page refers to and releases the cache page 263 | void spiffs_cache_fd_release(spiffs *fs, spiffs_cache_page *cp) { 264 | if (cp == 0) return; 265 | u32_t i; 266 | spiffs_fd *fds = (spiffs_fd *)fs->fd_space; 267 | for (i = 0; i < fs->fd_count; i++) { 268 | spiffs_fd *cur_fd = &fds[i]; 269 | if (cur_fd->file_nbr != 0 && cur_fd->cache_page == cp) { 270 | cur_fd->cache_page = 0; 271 | } 272 | } 273 | spiffs_cache_page_free(fs, cp->ix, 0); 274 | 275 | cp->obj_id = 0; 276 | } 277 | 278 | #endif 279 | 280 | // initializes the cache 281 | void spiffs_cache_init(spiffs *fs) { 282 | if (fs->cache == 0) return; 283 | u32_t sz = fs->cache_size; 284 | u32_t cache_mask = 0; 285 | int i; 286 | int cache_entries = 287 | (sz - sizeof(spiffs_cache)) / (SPIFFS_CACHE_PAGE_SIZE(fs)); 288 | if (cache_entries <= 0) return; 289 | 290 | for (i = 0; i < cache_entries; i++) { 291 | cache_mask <<= 1; 292 | cache_mask |= 1; 293 | } 294 | 295 | spiffs_cache cache; 296 | memset(&cache, 0, sizeof(spiffs_cache)); 297 | cache.cpage_count = cache_entries; 298 | cache.cpages = (u8_t *)((u8_t *)fs->cache + sizeof(spiffs_cache)); 299 | 300 | cache.cpage_use_map = 0xffffffff; 301 | cache.cpage_use_mask = cache_mask; 302 | memcpy(fs->cache, &cache, sizeof(spiffs_cache)); 303 | 304 | spiffs_cache *c = spiffs_get_cache(fs); 305 | 306 | memset(c->cpages, 0, c->cpage_count * SPIFFS_CACHE_PAGE_SIZE(fs)); 307 | 308 | c->cpage_use_map &= ~(c->cpage_use_mask); 309 | for (i = 0; i < cache.cpage_count; i++) { 310 | spiffs_get_cache_page_hdr(fs, c, i)->ix = i; 311 | } 312 | } 313 | 314 | #endif // SPIFFS_CACHE 315 | -------------------------------------------------------------------------------- /components/spiffs/spiffs_vfs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * spiffs VFS public function 3 | * 4 | * Author: LoBo (loboris@gmail.com / https://github.com/loboris) 5 | * 6 | * Part of this code is copied from or inspired by LUA-RTOS_ESP32 project: 7 | * 8 | * https://github.com/whitecatboard/Lua-RTOS-ESP32 9 | * IBEROXARXA SERVICIOS INTEGRALES, S.L. & CSS IBÉRICA, S.L. 10 | * Jaume Olivé (jolive@iberoxarxa.com / jolive@whitecatboard.org) 11 | * 12 | */ 13 | 14 | #define SPIFFS_BASE_PATH "/spiffs" 15 | 16 | 17 | int spiffs_is_registered; 18 | int spiffs_is_mounted; 19 | 20 | void vfs_spiffs_register(); 21 | int spiffs_mount(); 22 | int spiffs_unmount(int unreg); 23 | void spiffs_fs_stat(uint32_t *total, uint32_t *used); 24 | -------------------------------------------------------------------------------- /components/spiffs_image/Makefile.projbuild: -------------------------------------------------------------------------------- 1 | SPIFFS_IMAGE_COMPONENT_PATH := $(COMPONENT_PATH) 2 | 3 | .PHONY: flashfs 4 | .PHONY: makefs 5 | .PHONY: copyfs 6 | 7 | flashfs: $(SDKCONFIG_MAKEFILE) mkspiffs 8 | @echo "Making spiffs image ..." 9 | @echo "$(ESPTOOLPY_WRITE_FLASH)" 10 | $(MKSPIFFS_COMPONENT_PATH)/../mkspiffs/src/mkspiffs -c $(SPIFFS_IMAGE_COMPONENT_PATH)/image -b $(CONFIG_SPIFFS_LOG_BLOCK_SIZE) -p $(CONFIG_SPIFFS_LOG_PAGE_SIZE) -s $(CONFIG_SPIFFS_SIZE) $(BUILD_DIR_BASE)/spiffs_image.img 11 | $(ESPTOOLPY_WRITE_FLASH) $(CONFIG_SPIFFS_BASE_ADDR) $(BUILD_DIR_BASE)/spiffs_image.img 12 | 13 | makefs: $(SDKCONFIG_MAKEFILE) mkspiffs 14 | @echo "Making spiffs image ..." 15 | @echo "$(ESPTOOLPY_WRITE_FLASH)" 16 | $(MKSPIFFS_COMPONENT_PATH)/../mkspiffs/src/mkspiffs -c $(SPIFFS_IMAGE_COMPONENT_PATH)/image -b $(CONFIG_SPIFFS_LOG_BLOCK_SIZE) -p $(CONFIG_SPIFFS_LOG_PAGE_SIZE) -s $(CONFIG_SPIFFS_SIZE) $(BUILD_DIR_BASE)/spiffs_image.img 17 | 18 | copyfs: 19 | @echo "Flashing spiffs image ..." 20 | @echo "$(ESPTOOLPY_WRITE_FLASH)" 21 | $(ESPTOOLPY_WRITE_FLASH) $(CONFIG_SPIFFS_BASE_ADDR) $(SPIFFS_IMAGE_COMPONENT_PATH)/spiffs_image.img 22 | -------------------------------------------------------------------------------- /components/spiffs_image/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Component Makefile 3 | # 4 | 5 | COMPONENT_SRCDIRS := 6 | COMPONENT_ADD_INCLUDEDIRS := 7 | -------------------------------------------------------------------------------- /components/spiffs_image/image/fonts/BigFont.fon: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loboris/ESP32_TFT_library/aa21772f54a71887ec08b2e8bbaef9e304009891/components/spiffs_image/image/fonts/BigFont.fon -------------------------------------------------------------------------------- /components/spiffs_image/image/fonts/DejaVuSans12.fon: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loboris/ESP32_TFT_library/aa21772f54a71887ec08b2e8bbaef9e304009891/components/spiffs_image/image/fonts/DejaVuSans12.fon -------------------------------------------------------------------------------- /components/spiffs_image/image/fonts/DejaVuSans18.fon: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loboris/ESP32_TFT_library/aa21772f54a71887ec08b2e8bbaef9e304009891/components/spiffs_image/image/fonts/DejaVuSans18.fon -------------------------------------------------------------------------------- /components/spiffs_image/image/fonts/DejaVuSans24.fon: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loboris/ESP32_TFT_library/aa21772f54a71887ec08b2e8bbaef9e304009891/components/spiffs_image/image/fonts/DejaVuSans24.fon -------------------------------------------------------------------------------- /components/spiffs_image/image/fonts/DotMatrix_M.fon: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loboris/ESP32_TFT_library/aa21772f54a71887ec08b2e8bbaef9e304009891/components/spiffs_image/image/fonts/DotMatrix_M.fon -------------------------------------------------------------------------------- /components/spiffs_image/image/fonts/Grotesk24x48.fon: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loboris/ESP32_TFT_library/aa21772f54a71887ec08b2e8bbaef9e304009891/components/spiffs_image/image/fonts/Grotesk24x48.fon -------------------------------------------------------------------------------- /components/spiffs_image/image/fonts/SmallFont.fon: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loboris/ESP32_TFT_library/aa21772f54a71887ec08b2e8bbaef9e304009891/components/spiffs_image/image/fonts/SmallFont.fon -------------------------------------------------------------------------------- /components/spiffs_image/image/fonts/Ubuntu.fon: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loboris/ESP32_TFT_library/aa21772f54a71887ec08b2e8bbaef9e304009891/components/spiffs_image/image/fonts/Ubuntu.fon -------------------------------------------------------------------------------- /components/spiffs_image/image/fonts/arial_bold.fon: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loboris/ESP32_TFT_library/aa21772f54a71887ec08b2e8bbaef9e304009891/components/spiffs_image/image/fonts/arial_bold.fon -------------------------------------------------------------------------------- /components/spiffs_image/image/fonts/swiss721_outline.fon: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loboris/ESP32_TFT_library/aa21772f54a71887ec08b2e8bbaef9e304009891/components/spiffs_image/image/fonts/swiss721_outline.fon -------------------------------------------------------------------------------- /components/spiffs_image/image/images/test1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loboris/ESP32_TFT_library/aa21772f54a71887ec08b2e8bbaef9e304009891/components/spiffs_image/image/images/test1.jpg -------------------------------------------------------------------------------- /components/spiffs_image/image/images/test2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loboris/ESP32_TFT_library/aa21772f54a71887ec08b2e8bbaef9e304009891/components/spiffs_image/image/images/test2.jpg -------------------------------------------------------------------------------- /components/spiffs_image/image/images/test3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loboris/ESP32_TFT_library/aa21772f54a71887ec08b2e8bbaef9e304009891/components/spiffs_image/image/images/test3.jpg -------------------------------------------------------------------------------- /components/spiffs_image/image/images/test4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loboris/ESP32_TFT_library/aa21772f54a71887ec08b2e8bbaef9e304009891/components/spiffs_image/image/images/test4.jpg -------------------------------------------------------------------------------- /components/spiffs_image/image/images/tiger.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loboris/ESP32_TFT_library/aa21772f54a71887ec08b2e8bbaef9e304009891/components/spiffs_image/image/images/tiger.bmp -------------------------------------------------------------------------------- /components/spiffs_image/image/spiffs.info: -------------------------------------------------------------------------------- 1 | INTRODUCTION 2 | 3 | Spiffs is a file system intended for SPI NOR flash devices on embedded targets. 4 | Spiffs is designed with following characteristics in mind: 5 | 6 | * Small (embedded) targets, sparse RAM without heap 7 | * Only big areas of data (blocks) can be erased 8 | * An erase will reset all bits in block to ones 9 | * Writing pulls one to zeroes 10 | * Zeroes can only be pulled to ones by erase 11 | * Wear leveling 12 | -------------------------------------------------------------------------------- /components/spiffs_image/spiffs_image.img: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loboris/ESP32_TFT_library/aa21772f54a71887ec08b2e8bbaef9e304009891/components/spiffs_image/spiffs_image.img -------------------------------------------------------------------------------- /components/tft/DefaultFont.c: -------------------------------------------------------------------------------- 1 | // Default font 2 | 3 | // ======================================================================== 4 | // This comes with no warranty, implied or otherwise 5 | 6 | // This data structure was designed to support Proportional fonts 7 | // fonts. Individual characters do not have to be multiples of 8 bits wide. 8 | // Any width is fine and does not need to be fixed. 9 | 10 | // The data bits are packed to minimize data requirements, but the tradeoff 11 | // is that a header is required per character. 12 | 13 | // Header Format: 14 | // ------------------------------------------------ 15 | // Character Width (Used as a marker to indicate use this format. i.e.: = 0x00) 16 | // Character Height 17 | // First Character (Reserved. 0x00) 18 | // Number Of Characters (Reserved. 0x00) 19 | 20 | // Individual Character Format: 21 | // ---------------------------- 22 | // Character Code 23 | // Adjusted Y Offset (start Y of visible pixels) 24 | // Width (width of the visible pixels) 25 | // Height (height of the visible pixels) 26 | // xOffset (start X of visible pixels) 27 | // xDelta (the distance to move the cursor. Effective width of the character.) 28 | // Data[n] 29 | 30 | // NOTE: You can remove any of these characters if they are not needed in 31 | // your application. The first character number in each Glyph indicates 32 | // the ASCII character code. Therefore, these do not have to be sequential. 33 | // Just remove all the content for a particular character to save space. 34 | // ======================================================================== 35 | 36 | // dejavu 37 | // Point Size : 12 38 | // Memory usage : 1158 bytes 39 | // # characters : 95 40 | 41 | const unsigned char tft_DefaultFont[] = 42 | { 43 | 0x00, 0x0B, 0x86, 0x04, 44 | 45 | // ' ' 46 | 0x20,0x0A,0x00,0x00,0x00,0x04, 47 | 48 | // '!' 49 | 0x21,0x01,0x01,0x09,0x02,0x05, 50 | 0xFD,0x80, 51 | // '"' 52 | 0x22,0x01,0x03,0x03,0x01,0x05, 53 | 0xB6,0x80, 54 | // '#' 55 | 0x23,0x02,0x08,0x08,0x01,0x0A, 56 | 0x12,0x14,0x7F,0x24,0x24,0xFE,0x28,0x48, 57 | // '$' 58 | 0x24,0x01,0x06,0x0B,0x02,0x08, 59 | 0x21,0xCA,0xA8,0xE0,0xE2,0xAA,0x70,0x82,0x00, 60 | // '%' 61 | 0x25,0x01,0x0A,0x09,0x00,0x0B, 62 | 0x61,0x24,0x89,0x22,0x50,0x6D,0x82,0x91,0x24,0x49,0x21,0x80, 63 | // '&' 64 | 0x26,0x01,0x09,0x09,0x01,0x0A, 65 | 0x30,0x24,0x10,0x0C,0x05,0x14,0x4A,0x19,0x8C,0x7B,0x00, 66 | // ''' 67 | 0x27,0x01,0x01,0x03,0x01,0x03, 68 | 0xE0, 69 | // '(' 70 | 0x28,0x00,0x03,0x0B,0x01,0x05, 71 | 0x69,0x49,0x24,0x48,0x80, 72 | // ')' 73 | 0x29,0x00,0x03,0x0B,0x01,0x05, 74 | 0x89,0x12,0x49,0x4A,0x00, 75 | // '*' 76 | 0x2A,0x01,0x05,0x06,0x01,0x06, 77 | 0x25,0x5C,0xEA,0x90, 78 | // '+' 79 | 0x2B,0x03,0x07,0x07,0x01,0x0A, 80 | 0x10,0x20,0x47,0xF1,0x02,0x04,0x00, 81 | // ',' 82 | 0x2C,0x08,0x01,0x03,0x01,0x04, 83 | 0xE0, 84 | // '-' 85 | 0x2D,0x06,0x03,0x01,0x01,0x04, 86 | 0xE0, 87 | // '.' 88 | 0x2E,0x08,0x01,0x02,0x01,0x04, 89 | 0xC0, 90 | // '/' 91 | 0x2F,0x01,0x04,0x0A,0x00,0x04, 92 | 0x11,0x22,0x24,0x44,0x88, 93 | // '0' 94 | 0x30,0x01,0x06,0x09,0x01,0x08, 95 | 0x79,0x28,0x61,0x86,0x18,0x52,0x78, 96 | // '1' 97 | 0x31,0x01,0x05,0x09,0x01,0x08, 98 | 0xE1,0x08,0x42,0x10,0x84,0xF8, 99 | // '2' 100 | 0x32,0x01,0x07,0x09,0x01,0x08, 101 | 0x79,0x18,0x10,0x20,0x82,0x08,0x20,0xFC, 102 | // '3' 103 | 0x33,0x01,0x06,0x09,0x01,0x08, 104 | 0x7A,0x10,0x41,0x38,0x30,0x63,0x78, 105 | // '4' 106 | 0x34,0x01,0x06,0x09,0x01,0x08, 107 | 0x18,0x62,0x92,0x4A,0x2F,0xC2,0x08, 108 | // '5' 109 | 0x35,0x01,0x06,0x09,0x01,0x08, 110 | 0xFA,0x08,0x3C,0x0C,0x10,0x63,0x78, 111 | // '6' 112 | 0x36,0x01,0x06,0x09,0x01,0x08, 113 | 0x39,0x18,0x3E,0xCE,0x18,0x53,0x78, 114 | // '7' 115 | 0x37,0x01,0x06,0x09,0x01,0x08, 116 | 0xFC,0x10,0x82,0x10,0x42,0x08,0x40, 117 | // '8' 118 | 0x38,0x01,0x06,0x09,0x01,0x08, 119 | 0x7B,0x38,0x73,0x7B,0x38,0x73,0x78, 120 | // '9' 121 | 0x39,0x01,0x06,0x09,0x01,0x08, 122 | 0x7B,0x28,0x61,0xCD,0xD0,0x62,0x70, 123 | // ':' 124 | 0x3A,0x04,0x01,0x06,0x01,0x04, 125 | 0xCC, 126 | // ';' 127 | 0x3B,0x04,0x01,0x07,0x01,0x04, 128 | 0xCE, 129 | // '<' 130 | 0x3C,0x03,0x08,0x06,0x01,0x0A, 131 | 0x03,0x1E,0xE0,0xE0,0x1E,0x03, 132 | // '=' 133 | 0x3D,0x05,0x08,0x03,0x01,0x0A, 134 | 0xFF,0x00,0xFF, 135 | // '>' 136 | 0x3E,0x03,0x08,0x06,0x01,0x0A, 137 | 0xC0,0x78,0x07,0x07,0x78,0xC0, 138 | // '?' 139 | 0x3F,0x01,0x05,0x09,0x00,0x06, 140 | 0x74,0x42,0x22,0x10,0x04,0x20, 141 | // '@' 142 | 0x40,0x01,0x0B,0x0B,0x01,0x0D, 143 | 0x1F,0x06,0x19,0x01,0x46,0x99,0x13,0x22,0x64,0x54,0x6C,0x40,0x04,0x10,0x7C,0x00, 144 | // 'A' 145 | 0x41,0x01,0x08,0x09,0x00,0x08, 146 | 0x18,0x18,0x24,0x24,0x24,0x42,0x7E,0x42,0x81, 147 | // 'B' 148 | 0x42,0x01,0x06,0x09,0x01,0x08, 149 | 0xFA,0x18,0x61,0xFA,0x18,0x61,0xF8, 150 | // 'C' 151 | 0x43,0x01,0x06,0x09,0x01,0x08, 152 | 0x39,0x18,0x20,0x82,0x08,0x11,0x38, 153 | // 'D' 154 | 0x44,0x01,0x07,0x09,0x01,0x09, 155 | 0xF9,0x0A,0x0C,0x18,0x30,0x60,0xC2,0xF8, 156 | // 'E' 157 | 0x45,0x01,0x06,0x09,0x01,0x08, 158 | 0xFE,0x08,0x20,0xFE,0x08,0x20,0xFC, 159 | // 'F' 160 | 0x46,0x01,0x05,0x09,0x01,0x07, 161 | 0xFC,0x21,0x0F,0xC2,0x10,0x80, 162 | // 'G' 163 | 0x47,0x01,0x07,0x09,0x01,0x09, 164 | 0x3C,0x86,0x04,0x08,0xF0,0x60,0xA1,0x3C, 165 | // 'H' 166 | 0x48,0x01,0x07,0x09,0x01,0x09, 167 | 0x83,0x06,0x0C,0x1F,0xF0,0x60,0xC1,0x82, 168 | // 'I' 169 | 0x49,0x01,0x01,0x09,0x01,0x03, 170 | 0xFF,0x80, 171 | // 'J' 172 | 0x4A,0x01,0x03,0x0B,0xFF,0x03, 173 | 0x24,0x92,0x49,0x27,0x00, 174 | // 'K' 175 | 0x4B,0x01,0x07,0x09,0x01,0x07, 176 | 0x85,0x12,0x45,0x0C,0x14,0x24,0x44,0x84, 177 | // 'L' 178 | 0x4C,0x01,0x05,0x09,0x01,0x06, 179 | 0x84,0x21,0x08,0x42,0x10,0xF8, 180 | // 'M' 181 | 0x4D,0x01,0x08,0x09,0x01,0x0A, 182 | 0x81,0xC3,0xC3,0xA5,0xA5,0x99,0x99,0x81,0x81, 183 | // 'N' 184 | 0x4E,0x01,0x07,0x09,0x01,0x09, 185 | 0xC3,0x86,0x8D,0x19,0x31,0x62,0xC3,0x86, 186 | // 'O' 187 | 0x4F,0x01,0x07,0x09,0x01,0x09, 188 | 0x38,0x8A,0x0C,0x18,0x30,0x60,0xA2,0x38, 189 | // 'P' 190 | 0x50,0x01,0x06,0x09,0x01,0x08, 191 | 0xFA,0x38,0x63,0xFA,0x08,0x20,0x80, 192 | // 'Q' 193 | 0x51,0x01,0x07,0x0B,0x01,0x09, 194 | 0x38,0x8A,0x0C,0x18,0x30,0x60,0xA2,0x38,0x10,0x10, 195 | // 'R' 196 | 0x52,0x01,0x07,0x09,0x01,0x08, 197 | 0xF9,0x1A,0x14,0x6F,0x91,0x21,0x42,0x82, 198 | // 'S' 199 | 0x53,0x01,0x06,0x09,0x01,0x08, 200 | 0x7B,0x18,0x30,0x78,0x30,0x63,0x78, 201 | // 'T' 202 | 0x54,0x01,0x07,0x09,0x00,0x07, 203 | 0xFE,0x20,0x40,0x81,0x02,0x04,0x08,0x10, 204 | // 'U' 205 | 0x55,0x01,0x07,0x09,0x01,0x09, 206 | 0x83,0x06,0x0C,0x18,0x30,0x60,0xA2,0x38, 207 | // 'V' 208 | 0x56,0x01,0x0A,0x09,0xFF,0x08, 209 | 0x40,0x90,0x22,0x10,0x84,0x21,0x04,0x81,0x20,0x30,0x0C,0x00, 210 | // 'W' 211 | 0x57,0x01,0x0B,0x09,0x00,0x0B, 212 | 0x84,0x28,0x89,0x11,0x27,0x22,0xA8,0x55,0x0E,0xE0,0x88,0x11,0x00, 213 | // 'X' 214 | 0x58,0x01,0x07,0x09,0x00,0x07, 215 | 0xC6,0x88,0xA1,0xC1,0x07,0x0A,0x22,0x82, 216 | // 'Y' 217 | 0x59,0x01,0x07,0x09,0x00,0x07, 218 | 0x82,0x89,0x11,0x43,0x82,0x04,0x08,0x10, 219 | // 'Z' 220 | 0x5A,0x01,0x07,0x09,0x01,0x09, 221 | 0xFE,0x04,0x10,0x41,0x04,0x10,0x40,0xFE, 222 | // '[' 223 | 0x5B,0x01,0x02,0x0B,0x02,0x05, 224 | 0xEA,0xAA,0xAC, 225 | // '\' 226 | 0x5C,0x01,0x04,0x0A,0x00,0x04, 227 | 0x88,0x44,0x42,0x22,0x11, 228 | // ']' 229 | 0x5D,0x01,0x02,0x0B,0x01,0x05, 230 | 0xD5,0x55,0x5C, 231 | // '^' 232 | 0x5E,0x01,0x08,0x03,0x01,0x0A, 233 | 0x18,0x24,0x42, 234 | // '_' 235 | 0x5F,0x0C,0x06,0x01,0x00,0x06, 236 | 0xFC, 237 | // '`' 238 | 0x60,0x00,0x03,0x02,0x01,0x06, 239 | 0x44, 240 | // 'a' 241 | 0x61,0x03,0x06,0x07,0x01,0x08, 242 | 0x7A,0x30,0x5F,0x86,0x37,0x40, 243 | // 'b' 244 | 0x62,0x00,0x06,0x0A,0x01,0x08, 245 | 0x82,0x08,0x2E,0xCA,0x18,0x61,0xCE,0xE0, 246 | // 'c' 247 | 0x63,0x03,0x05,0x07,0x01,0x07, 248 | 0x72,0x61,0x08,0x25,0xC0, 249 | // 'd' 250 | 0x64,0x00,0x06,0x0A,0x01,0x08, 251 | 0x04,0x10,0x5D,0xCE,0x18,0x61,0xCD,0xD0, 252 | // 'e' 253 | 0x65,0x03,0x06,0x07,0x01,0x08, 254 | 0x39,0x38,0x7F,0x81,0x13,0x80, 255 | // 'f' 256 | 0x66,0x00,0x04,0x0A,0x00,0x04, 257 | 0x34,0x4F,0x44,0x44,0x44, 258 | // 'g' 259 | 0x67,0x03,0x06,0x0A,0x01,0x08, 260 | 0x77,0x38,0x61,0x87,0x37,0x41,0x4C,0xE0, 261 | // 'h' 262 | 0x68,0x00,0x06,0x0A,0x01,0x08, 263 | 0x82,0x08,0x2E,0xC6,0x18,0x61,0x86,0x10, 264 | // 'i' 265 | 0x69,0x01,0x01,0x09,0x01,0x03, 266 | 0xBF,0x80, 267 | // 'j' 268 | 0x6A,0x01,0x02,0x0C,0x00,0x03, 269 | 0x45,0x55,0x56, 270 | // 'k' 271 | 0x6B,0x00,0x06,0x0A,0x01,0x07, 272 | 0x82,0x08,0x22,0x92,0x8E,0x28,0x92,0x20, 273 | // 'l' 274 | 0x6C,0x00,0x01,0x0A,0x01,0x03, 275 | 0xFF,0xC0, 276 | // 'm' 277 | 0x6D,0x03,0x09,0x07,0x01,0x0B, 278 | 0xB3,0x66,0x62,0x31,0x18,0x8C,0x46,0x22, 279 | // 'n' 280 | 0x6E,0x03,0x06,0x07,0x01,0x08, 281 | 0xBB,0x18,0x61,0x86,0x18,0x40, 282 | // 'o' 283 | 0x6F,0x03,0x06,0x07,0x01,0x08, 284 | 0x7B,0x38,0x61,0x87,0x37,0x80, 285 | // 'p' 286 | 0x70,0x03,0x06,0x0A,0x01,0x08, 287 | 0xBB,0x28,0x61,0x87,0x3B,0xA0,0x82,0x00, 288 | // 'q' 289 | 0x71,0x03,0x06,0x0A,0x01,0x08, 290 | 0x77,0x38,0x61,0x87,0x37,0x41,0x04,0x10, 291 | // 'r' 292 | 0x72,0x03,0x04,0x07,0x01,0x05, 293 | 0xBC,0x88,0x88,0x80, 294 | // 's' 295 | 0x73,0x03,0x06,0x07,0x01,0x07, 296 | 0x72,0x28,0x1C,0x0A,0x27,0x00, 297 | // 't' 298 | 0x74,0x01,0x04,0x09,0x00,0x05, 299 | 0x44,0xF4,0x44,0x44,0x30, 300 | // 'u' 301 | 0x75,0x03,0x06,0x07,0x01,0x08, 302 | 0x86,0x18,0x61,0x86,0x37,0x40, 303 | // 'v' 304 | 0x76,0x03,0x08,0x07,0xFF,0x06, 305 | 0x42,0x42,0x24,0x24,0x24,0x18,0x18, 306 | // 'w' 307 | 0x77,0x03,0x09,0x07,0x00,0x09, 308 | 0x88,0xC4,0x57,0x4A,0xA5,0x51,0x10,0x88, 309 | // 'x' 310 | 0x78,0x03,0x06,0x07,0x00,0x06, 311 | 0x85,0x24,0x8C,0x49,0x28,0x40, 312 | // 'y' 313 | 0x79,0x03,0x08,0x0A,0xFF,0x06, 314 | 0x42,0x42,0x24,0x24,0x14,0x18,0x08,0x08,0x10,0x60, 315 | // 'z' 316 | 0x7A,0x03,0x05,0x07,0x00,0x05, 317 | 0xF8,0x44,0x44,0x43,0xE0, 318 | // '{' 319 | 0x7B,0x01,0x05,0x0B,0x02,0x08, 320 | 0x19,0x08,0x42,0x60,0x84,0x21,0x06, 321 | // '|' 322 | 0x7C,0x01,0x01,0x0C,0x02,0x04, 323 | 0xFF,0xF0, 324 | // '}' 325 | 0x7D,0x01,0x05,0x0B,0x01,0x08, 326 | 0xC1,0x08,0x42,0x0C,0x84,0x21,0x30, 327 | // '~' 328 | 0x7E,0x04,0x08,0x03,0x01,0x0A, 329 | 0x00,0x71,0x8E, 330 | 331 | // Terminator 332 | 0xFF 333 | }; 334 | -------------------------------------------------------------------------------- /components/tft/SmallFont.c: -------------------------------------------------------------------------------- 1 | // SmallFont.c 2 | // Font type : Full (95 characters) 3 | // Font size : 8x12 pixels 4 | // Memory usage : 1144 bytes 5 | 6 | #if defined(__AVR__) 7 | #include 8 | #define fontdatatype const uint8_t 9 | #elif defined(__PIC32MX__) 10 | #define PROGMEM 11 | #define fontdatatype const unsigned char 12 | #elif defined(__arm__) 13 | #define PROGMEM 14 | #define fontdatatype const unsigned char 15 | #endif 16 | 17 | const unsigned char tft_SmallFont[1144] = 18 | { 19 | 0x08,0x0C,0x20,0x5F, 20 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // 21 | 0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, // ! 22 | 0x00,0x28,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // " 23 | 0x00,0x00,0x28,0x28,0xFC,0x28,0x50,0xFC,0x50,0x50,0x00,0x00, // # 24 | 0x00,0x20,0x78,0xA8,0xA0,0x60,0x30,0x28,0xA8,0xF0,0x20,0x00, // $ 25 | 0x00,0x00,0x48,0xA8,0xB0,0x50,0x28,0x34,0x54,0x48,0x00,0x00, // % 26 | 0x00,0x00,0x20,0x50,0x50,0x78,0xA8,0xA8,0x90,0x6C,0x00,0x00, // & 27 | 0x00,0x40,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ' 28 | 0x00,0x04,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x08,0x04,0x00, // ( 29 | 0x00,0x40,0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0x40,0x00, // ) 30 | 0x00,0x00,0x00,0x20,0xA8,0x70,0x70,0xA8,0x20,0x00,0x00,0x00, // * 31 | 0x00,0x00,0x20,0x20,0x20,0xF8,0x20,0x20,0x20,0x00,0x00,0x00, // + 32 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x80, // , 33 | 0x00,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00, // - 34 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00, // . 35 | 0x00,0x08,0x10,0x10,0x10,0x20,0x20,0x40,0x40,0x40,0x80,0x00, // / 36 | 37 | 0x00,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00, // 0 38 | 0x00,0x00,0x20,0x60,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, // 1 39 | 0x00,0x00,0x70,0x88,0x88,0x10,0x20,0x40,0x80,0xF8,0x00,0x00, // 2 40 | 0x00,0x00,0x70,0x88,0x08,0x30,0x08,0x08,0x88,0x70,0x00,0x00, // 3 41 | 0x00,0x00,0x10,0x30,0x50,0x50,0x90,0x78,0x10,0x18,0x00,0x00, // 4 42 | 0x00,0x00,0xF8,0x80,0x80,0xF0,0x08,0x08,0x88,0x70,0x00,0x00, // 5 43 | 0x00,0x00,0x70,0x90,0x80,0xF0,0x88,0x88,0x88,0x70,0x00,0x00, // 6 44 | 0x00,0x00,0xF8,0x90,0x10,0x20,0x20,0x20,0x20,0x20,0x00,0x00, // 7 45 | 0x00,0x00,0x70,0x88,0x88,0x70,0x88,0x88,0x88,0x70,0x00,0x00, // 8 46 | 0x00,0x00,0x70,0x88,0x88,0x88,0x78,0x08,0x48,0x70,0x00,0x00, // 9 47 | 0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x20,0x00,0x00, // : 48 | 0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x20,0x00, // ; 49 | 0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00,0x00, // < 50 | 0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0xF8,0x00,0x00,0x00,0x00, // = 51 | 0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00,0x00, // > 52 | 0x00,0x00,0x70,0x88,0x88,0x10,0x20,0x20,0x00,0x20,0x00,0x00, // ? 53 | 54 | 0x00,0x00,0x70,0x88,0x98,0xA8,0xA8,0xB8,0x80,0x78,0x00,0x00, // @ 55 | 0x00,0x00,0x20,0x20,0x30,0x50,0x50,0x78,0x48,0xCC,0x00,0x00, // A 56 | 0x00,0x00,0xF0,0x48,0x48,0x70,0x48,0x48,0x48,0xF0,0x00,0x00, // B 57 | 0x00,0x00,0x78,0x88,0x80,0x80,0x80,0x80,0x88,0x70,0x00,0x00, // C 58 | 0x00,0x00,0xF0,0x48,0x48,0x48,0x48,0x48,0x48,0xF0,0x00,0x00, // D 59 | 0x00,0x00,0xF8,0x48,0x50,0x70,0x50,0x40,0x48,0xF8,0x00,0x00, // E 60 | 0x00,0x00,0xF8,0x48,0x50,0x70,0x50,0x40,0x40,0xE0,0x00,0x00, // F 61 | 0x00,0x00,0x38,0x48,0x80,0x80,0x9C,0x88,0x48,0x30,0x00,0x00, // G 62 | 0x00,0x00,0xCC,0x48,0x48,0x78,0x48,0x48,0x48,0xCC,0x00,0x00, // H 63 | 0x00,0x00,0xF8,0x20,0x20,0x20,0x20,0x20,0x20,0xF8,0x00,0x00, // I 64 | 0x00,0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x90,0xE0,0x00, // J 65 | 0x00,0x00,0xEC,0x48,0x50,0x60,0x50,0x50,0x48,0xEC,0x00,0x00, // K 66 | 0x00,0x00,0xE0,0x40,0x40,0x40,0x40,0x40,0x44,0xFC,0x00,0x00, // L 67 | 0x00,0x00,0xD8,0xD8,0xD8,0xD8,0xA8,0xA8,0xA8,0xA8,0x00,0x00, // M 68 | 0x00,0x00,0xDC,0x48,0x68,0x68,0x58,0x58,0x48,0xE8,0x00,0x00, // N 69 | 0x00,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00, // O 70 | 71 | 0x00,0x00,0xF0,0x48,0x48,0x70,0x40,0x40,0x40,0xE0,0x00,0x00, // P 72 | 0x00,0x00,0x70,0x88,0x88,0x88,0x88,0xE8,0x98,0x70,0x18,0x00, // Q 73 | 0x00,0x00,0xF0,0x48,0x48,0x70,0x50,0x48,0x48,0xEC,0x00,0x00, // R 74 | 0x00,0x00,0x78,0x88,0x80,0x60,0x10,0x08,0x88,0xF0,0x00,0x00, // S 75 | 0x00,0x00,0xF8,0xA8,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, // T 76 | 0x00,0x00,0xCC,0x48,0x48,0x48,0x48,0x48,0x48,0x30,0x00,0x00, // U 77 | 0x00,0x00,0xCC,0x48,0x48,0x50,0x50,0x30,0x20,0x20,0x00,0x00, // V 78 | 0x00,0x00,0xA8,0xA8,0xA8,0x70,0x50,0x50,0x50,0x50,0x00,0x00, // W 79 | 0x00,0x00,0xD8,0x50,0x50,0x20,0x20,0x50,0x50,0xD8,0x00,0x00, // X 80 | 0x00,0x00,0xD8,0x50,0x50,0x20,0x20,0x20,0x20,0x70,0x00,0x00, // Y 81 | 0x00,0x00,0xF8,0x90,0x10,0x20,0x20,0x40,0x48,0xF8,0x00,0x00, // Z 82 | 0x00,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x00, // [ 83 | 0x00,0x40,0x40,0x40,0x20,0x20,0x10,0x10,0x10,0x08,0x00,0x00, // 84 | 0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x70,0x00, // ] 85 | 0x00,0x20,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ^ 86 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC, // _ 87 | 88 | 0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ` 89 | 0x00,0x00,0x00,0x00,0x00,0x30,0x48,0x38,0x48,0x3C,0x00,0x00, // a 90 | 0x00,0x00,0xC0,0x40,0x40,0x70,0x48,0x48,0x48,0x70,0x00,0x00, // b 91 | 0x00,0x00,0x00,0x00,0x00,0x38,0x48,0x40,0x40,0x38,0x00,0x00, // c 92 | 0x00,0x00,0x18,0x08,0x08,0x38,0x48,0x48,0x48,0x3C,0x00,0x00, // d 93 | 0x00,0x00,0x00,0x00,0x00,0x30,0x48,0x78,0x40,0x38,0x00,0x00, // e 94 | 0x00,0x00,0x1C,0x20,0x20,0x78,0x20,0x20,0x20,0x78,0x00,0x00, // f 95 | 0x00,0x00,0x00,0x00,0x00,0x3C,0x48,0x30,0x40,0x78,0x44,0x38, // g 96 | 0x00,0x00,0xC0,0x40,0x40,0x70,0x48,0x48,0x48,0xEC,0x00,0x00, // h 97 | 0x00,0x00,0x20,0x00,0x00,0x60,0x20,0x20,0x20,0x70,0x00,0x00, // i 98 | 0x00,0x00,0x10,0x00,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0xE0, // j 99 | 0x00,0x00,0xC0,0x40,0x40,0x5C,0x50,0x70,0x48,0xEC,0x00,0x00, // k 100 | 0x00,0x00,0xE0,0x20,0x20,0x20,0x20,0x20,0x20,0xF8,0x00,0x00, // l 101 | 0x00,0x00,0x00,0x00,0x00,0xF0,0xA8,0xA8,0xA8,0xA8,0x00,0x00, // m 102 | 0x00,0x00,0x00,0x00,0x00,0xF0,0x48,0x48,0x48,0xEC,0x00,0x00, // n 103 | 0x00,0x00,0x00,0x00,0x00,0x30,0x48,0x48,0x48,0x30,0x00,0x00, // o 104 | 105 | 0x00,0x00,0x00,0x00,0x00,0xF0,0x48,0x48,0x48,0x70,0x40,0xE0, // p 106 | 0x00,0x00,0x00,0x00,0x00,0x38,0x48,0x48,0x48,0x38,0x08,0x1C, // q 107 | 0x00,0x00,0x00,0x00,0x00,0xD8,0x60,0x40,0x40,0xE0,0x00,0x00, // r 108 | 0x00,0x00,0x00,0x00,0x00,0x78,0x40,0x30,0x08,0x78,0x00,0x00, // s 109 | 0x00,0x00,0x00,0x20,0x20,0x70,0x20,0x20,0x20,0x18,0x00,0x00, // t 110 | 0x00,0x00,0x00,0x00,0x00,0xD8,0x48,0x48,0x48,0x3C,0x00,0x00, // u 111 | 0x00,0x00,0x00,0x00,0x00,0xEC,0x48,0x50,0x30,0x20,0x00,0x00, // v 112 | 0x00,0x00,0x00,0x00,0x00,0xA8,0xA8,0x70,0x50,0x50,0x00,0x00, // w 113 | 0x00,0x00,0x00,0x00,0x00,0xD8,0x50,0x20,0x50,0xD8,0x00,0x00, // x 114 | 0x00,0x00,0x00,0x00,0x00,0xEC,0x48,0x50,0x30,0x20,0x20,0xC0, // y 115 | 0x00,0x00,0x00,0x00,0x00,0x78,0x10,0x20,0x20,0x78,0x00,0x00, // z 116 | 0x00,0x18,0x10,0x10,0x10,0x20,0x10,0x10,0x10,0x10,0x18,0x00, // { 117 | 0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, // | 118 | 0x00,0x60,0x20,0x20,0x20,0x10,0x20,0x20,0x20,0x20,0x60,0x00, // } 119 | 0x40,0xA4,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ~ 120 | }; 121 | -------------------------------------------------------------------------------- /components/tft/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Main Makefile. This is basically the same as a component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | COMPONENT_SRCDIRS := . 7 | COMPONENT_ADD_INCLUDEDIRS := . 8 | -------------------------------------------------------------------------------- /components/tft/def_small.c: -------------------------------------------------------------------------------- 1 | // This comes with no warranty, implied or otherwise 2 | 3 | // This data structure was designed to support Proportional fonts 4 | // on Arduinos. It can however handle any ttf font that has been converted 5 | // using the conversion program. These could be fixed width or proportional 6 | // fonts. Individual characters do not have to be multiples of 8 bits wide. 7 | // Any width is fine and does not need to be fixed. 8 | 9 | // The data bits are packed to minimize data requirements, but the tradeoff 10 | // is that a header is required per character. 11 | 12 | // def_small.c 13 | // Point Size : 9 14 | // Memory usage : 928 bytes 15 | // # characters : 95 16 | 17 | // Header Format (to make Arduino UTFT Compatible): 18 | // ------------------------------------------------ 19 | // Character Width (Used as a marker to indicate use this format. i.e.: = 0x00) 20 | // Character Height 21 | // First Character (Reserved. 0x00) 22 | // Number Of Characters (Reserved. 0x00) 23 | 24 | 25 | unsigned char tft_def_small[] = 26 | { 27 | 0x00, 0x08, 0x00, 0x00, 28 | 29 | // Individual Character Format: 30 | // ---------------------------- 31 | // Character Code 32 | // Adjusted Y Offset 33 | // Width 34 | // Height 35 | // xOffset 36 | // xDelta (the distance to move the cursor. Effective width of the character.) 37 | // Data[n] 38 | 39 | // NOTE: You can remove any of these characters if they are not needed in 40 | // your application. The first character number in each Glyph indicates 41 | // the ASCII character code. Therefore, these do not have to be sequential. 42 | // Just remove all the content for a particular character to save space. 43 | 44 | // ' ' 45 | 0x20,0x08,0x00,0x00,0x00,0x03, 46 | 47 | // '!' 48 | 0x21,0x01,0x01,0x07,0x01,0x03, 49 | 0xFA, 50 | // '"' 51 | 0x22,0x01,0x03,0x02,0x01,0x04, 52 | 0xB4, 53 | // '#' 54 | 0x23,0x01,0x06,0x07,0x01,0x08, 55 | 0x28,0xAF,0xCA,0xFD,0x45,0x00, 56 | // '$' 57 | 0x24,0x01,0x06,0x08,0x00,0x06, 58 | 0x21,0xEA,0x38,0x38,0xAF,0x08, 59 | // '%' 60 | 0x25,0x01,0x08,0x07,0x00,0x09, 61 | 0x44,0xA4,0xA8,0x5A,0x15,0x25,0x22, 62 | // '&' 63 | 0x26,0x01,0x06,0x07,0x01,0x08, 64 | 0x31,0x04,0x19,0x9E,0x66,0xC0, 65 | // ''' 66 | 0x27,0x01,0x01,0x02,0x01,0x02, 67 | 0xC0, 68 | // '(' 69 | 0x28,0x00,0x02,0x08,0x01,0x04, 70 | 0x4A,0xA1, 71 | // ')' 72 | 0x29,0x00,0x02,0x08,0x01,0x04, 73 | 0x85,0x52, 74 | // '*' 75 | 0x2A,0x01,0x05,0x04,0x00,0x05, 76 | 0xAB,0x9D,0x50, 77 | // '+' 78 | 0x2B,0x03,0x05,0x05,0x01,0x08, 79 | 0x21,0x3E,0x42,0x00, 80 | // ',' 81 | 0x2C,0x07,0x01,0x02,0x01,0x03, 82 | 0xC0, 83 | // '-' 84 | 0x2D,0x05,0x02,0x01,0x01,0x03, 85 | 0xC0, 86 | // '.' 87 | 0x2E,0x07,0x01,0x01,0x01,0x03, 88 | 0x80, 89 | // '/' 90 | 0x2F,0x01,0x03,0x07,0x00,0x03, 91 | 0x25,0x25,0x20, 92 | // '0' 93 | 0x30,0x01,0x04,0x07,0x01,0x06, 94 | 0x69,0x99,0x99,0x60, 95 | // '1' 96 | 0x31,0x01,0x03,0x07,0x02,0x06, 97 | 0xC9,0x24,0xB8, 98 | // '2' 99 | 0x32,0x01,0x05,0x07,0x01,0x06, 100 | 0x64,0x84,0x44,0x43,0xC0, 101 | // '3' 102 | 0x33,0x01,0x04,0x07,0x01,0x06, 103 | 0x69,0x16,0x11,0x60, 104 | // '4' 105 | 0x34,0x01,0x05,0x07,0x01,0x06, 106 | 0x11,0x94,0xA9,0x7C,0x40, 107 | // '5' 108 | 0x35,0x01,0x04,0x07,0x01,0x06, 109 | 0xF8,0x8E,0x11,0xE0, 110 | // '6' 111 | 0x36,0x01,0x04,0x07,0x01,0x06, 112 | 0x7C,0x8E,0x99,0x60, 113 | // '7' 114 | 0x37,0x01,0x04,0x07,0x01,0x06, 115 | 0xF1,0x22,0x24,0x40, 116 | // '8' 117 | 0x38,0x01,0x04,0x07,0x01,0x06, 118 | 0x69,0x96,0x99,0x60, 119 | // '9' 120 | 0x39,0x01,0x04,0x07,0x01,0x06, 121 | 0x69,0x97,0x13,0xE0, 122 | // ':' 123 | 0x3A,0x03,0x01,0x05,0x01,0x03, 124 | 0x88, 125 | // ';' 126 | 0x3B,0x03,0x01,0x06,0x01,0x03, 127 | 0x8C, 128 | // '<' 129 | 0x3C,0x03,0x06,0x05,0x01,0x08, 130 | 0x04,0xEE,0x0E,0x04, 131 | // '=' 132 | 0x3D,0x04,0x06,0x03,0x01,0x08, 133 | 0xFC,0x0F,0xC0, 134 | // '>' 135 | 0x3E,0x03,0x06,0x05,0x01,0x08, 136 | 0x81,0xC1,0xDC,0x80, 137 | // '?' 138 | 0x3F,0x01,0x04,0x07,0x01,0x05, 139 | 0xE1,0x24,0x40,0x40, 140 | // '@' 141 | 0x40,0x01,0x08,0x08,0x01,0x0A, 142 | 0x3C,0x42,0x9D,0xA5,0xA5,0x9E,0x40,0x38, 143 | // 'A' 144 | 0x41,0x01,0x06,0x07,0x00,0x06, 145 | 0x30,0xC4,0x92,0x7A,0x18,0x40, 146 | // 'B' 147 | 0x42,0x01,0x05,0x07,0x01,0x07, 148 | 0xF4,0x63,0xE8,0xC7,0xC0, 149 | // 'C' 150 | 0x43,0x01,0x05,0x07,0x01,0x07, 151 | 0x72,0x61,0x08,0x25,0xC0, 152 | // 'D' 153 | 0x44,0x01,0x05,0x07,0x01,0x07, 154 | 0xF4,0xE3,0x18,0xCF,0xC0, 155 | // 'E' 156 | 0x45,0x01,0x04,0x07,0x01,0x06, 157 | 0xF8,0x8F,0x88,0xF0, 158 | // 'F' 159 | 0x46,0x01,0x04,0x07,0x01,0x06, 160 | 0xF8,0x8F,0x88,0x80, 161 | // 'G' 162 | 0x47,0x01,0x05,0x07,0x01,0x07, 163 | 0x76,0x61,0x38,0xE5,0xC0, 164 | // 'H' 165 | 0x48,0x01,0x05,0x07,0x01,0x07, 166 | 0x8C,0x63,0xF8,0xC6,0x20, 167 | // 'I' 168 | 0x49,0x01,0x01,0x07,0x01,0x03, 169 | 0xFE, 170 | // 'J' 171 | 0x4A,0x01,0x02,0x09,0x00,0x03, 172 | 0x55,0x55,0x80, 173 | // 'K' 174 | 0x4B,0x01,0x05,0x07,0x01,0x06, 175 | 0x8C,0xA9,0x8A,0x4A,0x20, 176 | // 'L' 177 | 0x4C,0x01,0x04,0x07,0x01,0x05, 178 | 0x88,0x88,0x88,0xF0, 179 | // 'M' 180 | 0x4D,0x01,0x06,0x07,0x01,0x08, 181 | 0x87,0x3C,0xED,0xB6,0x18,0x40, 182 | // 'N' 183 | 0x4E,0x01,0x05,0x07,0x01,0x07, 184 | 0x8E,0x73,0x59,0xCE,0x20, 185 | // 'O' 186 | 0x4F,0x01,0x05,0x07,0x01,0x07, 187 | 0x76,0xE3,0x18,0xED,0xC0, 188 | // 'P' 189 | 0x50,0x01,0x04,0x07,0x01,0x06, 190 | 0xE9,0x9E,0x88,0x80, 191 | // 'Q' 192 | 0x51,0x01,0x05,0x08,0x01,0x07, 193 | 0x76,0xE3,0x18,0xE9,0xC2, 194 | // 'R' 195 | 0x52,0x01,0x05,0x07,0x01,0x06, 196 | 0xE4,0xA5,0xCA,0x4A,0x20, 197 | // 'S' 198 | 0x53,0x01,0x06,0x07,0x01,0x07, 199 | 0x72,0x28,0x1C,0x0A,0x27,0x00, 200 | // 'T' 201 | 0x54,0x01,0x05,0x07,0x00,0x05, 202 | 0xF9,0x08,0x42,0x10,0x80, 203 | // 'U' 204 | 0x55,0x01,0x05,0x07,0x01,0x07, 205 | 0x8C,0x63,0x18,0xC5,0xC0, 206 | // 'V' 207 | 0x56,0x01,0x06,0x07,0x00,0x06, 208 | 0x86,0x14,0x92,0x48,0xC3,0x00, 209 | // 'W' 210 | 0x57,0x01,0x09,0x07,0xFF,0x07, 211 | 0x49,0x24,0x8A,0x85,0x43,0xE0,0xA0,0x50, 212 | // 'X' 213 | 0x58,0x01,0x06,0x07,0x00,0x06, 214 | 0xCD,0x23,0x0C,0x31,0x28,0xC0, 215 | // 'Y' 216 | 0x59,0x01,0x05,0x07,0x00,0x05, 217 | 0x8A,0x9C,0x42,0x10,0x80, 218 | // 'Z' 219 | 0x5A,0x01,0x05,0x07,0x00,0x05, 220 | 0xF8,0x44,0x44,0x43,0xE0, 221 | // '[' 222 | 0x5B,0x01,0x02,0x08,0x01,0x04, 223 | 0xEA,0xAB, 224 | // '\' 225 | 0x5C,0x01,0x03,0x07,0x00,0x03, 226 | 0x91,0x24,0x48, 227 | // ']' 228 | 0x5D,0x01,0x02,0x08,0x01,0x04, 229 | 0xD5,0x57, 230 | // '^' 231 | 0x5E,0x01,0x06,0x02,0x01,0x08, 232 | 0x31,0x20, 233 | // '_' 234 | 0x5F,0x09,0x05,0x01,0x00,0x05, 235 | 0xF8, 236 | // '`' 237 | 0x60,0x00,0x02,0x02,0x01,0x05, 238 | 0x90, 239 | // 'a' 240 | 0x61,0x03,0x04,0x05,0x01,0x06, 241 | 0x61,0x79,0xF0, 242 | // 'b' 243 | 0x62,0x00,0x04,0x08,0x01,0x06, 244 | 0x88,0x8E,0x99,0x9E, 245 | // 'c' 246 | 0x63,0x03,0x04,0x05,0x01,0x06, 247 | 0x78,0x88,0x70, 248 | // 'd' 249 | 0x64,0x00,0x04,0x08,0x01,0x06, 250 | 0x11,0x17,0x99,0x97, 251 | // 'e' 252 | 0x65,0x03,0x04,0x05,0x01,0x06, 253 | 0x69,0xF8,0x70, 254 | // 'f' 255 | 0x66,0x00,0x04,0x08,0x00,0x03, 256 | 0x34,0x4E,0x44,0x44, 257 | // 'g' 258 | 0x67,0x03,0x04,0x07,0x01,0x06, 259 | 0x79,0x99,0x71,0x60, 260 | // 'h' 261 | 0x68,0x00,0x04,0x08,0x01,0x06, 262 | 0x88,0x8E,0x99,0x99, 263 | // 'i' 264 | 0x69,0x01,0x01,0x07,0x01,0x03, 265 | 0xBE, 266 | // 'j' 267 | 0x6A,0x01,0x02,0x09,0x00,0x03, 268 | 0x45,0x55,0x80, 269 | // 'k' 270 | 0x6B,0x00,0x04,0x08,0x01,0x05, 271 | 0x88,0x89,0xAC,0xA9, 272 | // 'l' 273 | 0x6C,0x00,0x01,0x08,0x01,0x03, 274 | 0xFF, 275 | // 'm' 276 | 0x6D,0x03,0x07,0x05,0x01,0x09, 277 | 0xED,0x26,0x4C,0x99,0x20, 278 | // 'n' 279 | 0x6E,0x03,0x04,0x05,0x01,0x06, 280 | 0xE9,0x99,0x90, 281 | // 'o' 282 | 0x6F,0x03,0x04,0x05,0x01,0x06, 283 | 0x69,0x99,0x60, 284 | // 'p' 285 | 0x70,0x03,0x04,0x07,0x01,0x06, 286 | 0xE9,0x99,0xE8,0x80, 287 | // 'q' 288 | 0x71,0x03,0x04,0x07,0x01,0x06, 289 | 0x79,0x99,0x71,0x10, 290 | // 'r' 291 | 0x72,0x03,0x03,0x05,0x01,0x04, 292 | 0xF2,0x48, 293 | // 's' 294 | 0x73,0x03,0x04,0x05,0x01,0x05, 295 | 0x68,0x62,0xE0, 296 | // 't' 297 | 0x74,0x02,0x04,0x06,0x00,0x04, 298 | 0x4F,0x44,0x47, 299 | // 'u' 300 | 0x75,0x03,0x04,0x05,0x01,0x06, 301 | 0x99,0x99,0x70, 302 | // 'v' 303 | 0x76,0x03,0x07,0x05,0xFF,0x05, 304 | 0x44,0x98,0xA1,0xC1,0x00, 305 | // 'w' 306 | 0x77,0x03,0x07,0x05,0x00,0x07, 307 | 0x93,0x76,0xBA,0x24,0x40, 308 | // 'x' 309 | 0x78,0x03,0x05,0x05,0x00,0x05, 310 | 0x8A,0x88,0xA8,0x80, 311 | // 'y' 312 | 0x79,0x03,0x07,0x07,0xFF,0x05, 313 | 0x44,0x88,0xA1,0xC1,0x02,0x18,0x00, 314 | // 'z' 315 | 0x7A,0x03,0x04,0x05,0x01,0x06, 316 | 0xF1,0x24,0xF0, 317 | // '{' 318 | 0x7B,0x01,0x03,0x08,0x01,0x05, 319 | 0x69,0x64,0x93, 320 | // '|' 321 | 0x7C,0x01,0x01,0x09,0x01,0x03, 322 | 0xFF,0x80, 323 | // '}' 324 | 0x7D,0x01,0x03,0x08,0x01,0x05, 325 | 0xC9,0x34,0x96, 326 | // '~' 327 | 0x7E,0x03,0x06,0x03,0x01,0x08, 328 | 0x01,0x91,0x80, 329 | 330 | // Terminator 331 | 0xFF 332 | }; 333 | -------------------------------------------------------------------------------- /components/tft/stmpe610.h: -------------------------------------------------------------------------------- 1 | /* 2 | STMPE610 Touch controller constants 3 | */ 4 | 5 | #ifndef _STMPE610_H 6 | #define _STMPE610_H 7 | 8 | #include 9 | 10 | #define STMPE610_SPI_MODE 1 11 | 12 | // Identification registers 13 | #define STMPE610_REG_CHP_ID 0x00 // 16-bit 14 | #define STMPE610_REG_ID_VER 0x02 15 | 16 | // System registers 17 | #define STMPE610_REG_SYS_CTRL1 0x03 18 | #define STMPE610_REG_SYS_CTRL2 0x04 19 | #define STMPE610_REG_SPI_CFG 0x08 20 | 21 | // Interrupt control registers 22 | #define STMPE610_REG_INT_CTRL 0x09 23 | #define STMPE610_REG_INT_EN 0x0A 24 | #define STMPE610_REG_INT_STA 0x0B 25 | #define STMPE610_REG_GPIO_INT_EN 0x0C 26 | #define STMPE610_REG_GPIO_INT_STA 0x0D 27 | #define STMPE610_REG_ADC_INT_EN 0x0E 28 | #define STMPE610_REG_ADC_INT_STA 0x0F 29 | 30 | // GPIO registers 31 | #define STMPE610_REG_GPIO_SET_PIN 0x10 32 | #define STMPE610_REG_GPIO_CLR_PIN 0x11 33 | #define STMPE610_REG_GPIO_MP_STA 0x12 34 | #define STMPE610_REG_GPIO_DIR 0x13 35 | #define STMPE610_REG_GPIO_ED 0x14 36 | #define STMPE610_REG_GPIO_RE 0x15 37 | #define STMPE610_REG_GPIO_FE 0x16 38 | #define STMPE610_REG_GPIO_AF 0x17 39 | 40 | // ADC registers 41 | #define STMPE610_REG_ADC_CTRL1 0x20 42 | #define STMPE610_REG_ADC_CTRL2 0x21 43 | #define STMPE610_REG_ADC_CAPT 0x22 44 | #define STMPE610_REG_ADC_DATA_CH0 0x30 // 16-bit 45 | #define STMPE610_REG_ADC_DATA_CH1 0x32 // 16-bit 46 | #define STMPE610_REG_ADC_DATA_CH4 0x38 // 16-bit 47 | #define STMPE610_REG_ADC_DATA_CH5 0x3A // 16-bit 48 | #define STMPE610_REG_ADC_DATA_CH6 0x3C // 16-bit 49 | #define STMPE610_REG_ADC_DATA_CH7 0x3E // 16-bit 50 | 51 | // Touchscreen registers 52 | #define STMPE610_REG_TSC_CTRL 0x40 53 | #define STMPE610_REG_TSC_CFG 0x41 54 | #define STMPE610_REG_WDW_TR_X 0x42 // 16-bit 55 | #define STMPE610_REG_WDW_TR_Y 0x44 // 16-bit 56 | #define STMPE610_REG_WDW_BL_X 0x46 // 16-bit 57 | #define STMPE610_REG_WDW_BL_Y 0x48 // 16-bit 58 | #define STMPE610_REG_FIFO_TH 0x4A 59 | #define STMPE610_REG_FIFO_STA 0x4B 60 | #define STMPE610_REG_FIFO_SIZE 0x4C 61 | #define STMPE610_REG_TSC_DATA_X 0x4D // 16-bit 62 | #define STMPE610_REG_TSC_DATA_Y 0x4F // 16-bit 63 | #define STMPE610_REG_TSC_DATA_Z 0x51 64 | #define STMPE610_REG_TSC_DATA_XYZ 0x52 // 32-bit 65 | #define STMPE610_REG_TSC_FRACT_XYZ 0x56 66 | #define STMPE610_REG_TSC_DATA 0x57 67 | #define STMPE610_REG_TSC_I_DRIVE 0x58 68 | #define STMPE610_REG_TSC_SHIELD 0x59 69 | 70 | 71 | #endif /* _STMPE610_H */ 72 | -------------------------------------------------------------------------------- /main/Kconfig.projbuild: -------------------------------------------------------------------------------- 1 | menu "TFT Display DEMO Configuration" 2 | 3 | config SPIFFS_BASE_ADDR 4 | hex "SPIFFS Base address" 5 | range 100000 1FFE000 6 | default 180000 7 | help 8 | Starting address of the SPIFFS area in ESP32 Flash 9 | 10 | config SPIFFS_SIZE 11 | int "SPIFFS Size in bytes" 12 | range 262144 2097152 13 | default 1048576 14 | 15 | config SPIFFS_LOG_BLOCK_SIZE 16 | int "SPIFFS Logical block size" 17 | range 4098 65536 18 | default 8192 19 | 20 | config SPIFFS_LOG_PAGE_SIZE 21 | int "SPIFFS Logical page size" 22 | range 256 2048 23 | default 256 24 | help 25 | Set it to the phisycal page size og the used SPI Flash chip. 26 | 27 | config EXAMPLE_DISPLAY_TYPE 28 | int 29 | default 0 if EXAMPLE_DISPLAY_TYPE0 30 | default 1 if EXAMPLE_DISPLAY_TYPE1 31 | default 2 if EXAMPLE_DISPLAY_TYPE2 32 | default 3 if EXAMPLE_DISPLAY_TYPE3 33 | 34 | choice 35 | prompt "Select predefined display configuration" 36 | default EXAMPLE_DISPLAY_TYPE0 37 | help 38 | Select predefined display configuration 39 | 40 | config EXAMPLE_DISPLAY_TYPE0 41 | bool "None" 42 | config EXAMPLE_DISPLAY_TYPE1 43 | bool "ESP-WROVER-KIT Display" 44 | config EXAMPLE_DISPLAY_TYPE2 45 | bool "Adafruit TFT Feather display" 46 | config EXAMPLE_DISPLAY_TYPE3 47 | bool "M5Stack TFT display" 48 | endchoice 49 | 50 | config EXAMPLE_USE_WIFI 51 | bool "Use wifi in TFT Demo" 52 | default n 53 | help 54 | If WiFi is used ntp server will be used to provide the exact time 55 | and file timestamps will be correct. 56 | 57 | config WIFI_SSID 58 | string "WiFi SSID" 59 | depends on EXAMPLE_USE_WIFI 60 | default "myssid" 61 | help 62 | SSID (network name) for the demo to connect to. 63 | 64 | config WIFI_PASSWORD 65 | string "WiFi Password" 66 | depends on EXAMPLE_USE_WIFI 67 | default "mypassword" 68 | help 69 | WiFi password (WPA or WPA2) for the demo to use. 70 | 71 | 72 | endmenu 73 | -------------------------------------------------------------------------------- /main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Main Makefile. This is basically the same as a component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | COMPONENT_SRCDIRS := . 7 | COMPONENT_ADD_INCLUDEDIRS := . 8 | -------------------------------------------------------------------------------- /partitions_example.csv: -------------------------------------------------------------------------------- 1 | # Name, Type, SubType, Offset, Size, Flags 2 | # Note: if you change the phy_init or app partition offset, make sure to change the offset in Kconfig.projbuild 3 | nvs, data, nvs, 0x9000, 0x6000, 4 | phy_init, data, phy, 0xf000, 0x1000, 5 | factory, app, factory, 0x10000, 1M, 6 | storage, data, spiffs, 0x180000, 1M, 7 | -------------------------------------------------------------------------------- /sdkconfig.defaults: -------------------------------------------------------------------------------- 1 | CONFIG_PARTITION_TABLE_CUSTOM=y 2 | CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_example.csv" 3 | CONFIG_PARTITION_TABLE_CUSTOM_APP_BIN_OFFSET=0x10000 4 | CONFIG_PARTITION_TABLE_FILENAME="partitions_example.csv" 5 | CONFIG_APP_OFFSET=0x10000 6 | CONFIG_ESP32_PANIC_PRINT_HALT=y 7 | CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y 8 | CONFIG_FREERTOS_HZ=1000 9 | CONFIG_MAIN_TASK_STACK_SIZE=8192 10 | CONFIG_TASK_WDT_TIMEOUT_S=20 11 | -------------------------------------------------------------------------------- /tools/DejaVuSans.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loboris/ESP32_TFT_library/aa21772f54a71887ec08b2e8bbaef9e304009891/tools/DejaVuSans.ttf -------------------------------------------------------------------------------- /tools/Vera.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loboris/ESP32_TFT_library/aa21772f54a71887ec08b2e8bbaef9e304009891/tools/Vera.ttf -------------------------------------------------------------------------------- /tools/def_small.c: -------------------------------------------------------------------------------- 1 | // This comes with no warranty, implied or otherwise 2 | 3 | // This data structure was designed to support Proportional fonts 4 | // on Arduinos. It can however handle any ttf font that has been converted 5 | // using the conversion program. These could be fixed width or proportional 6 | // fonts. Individual characters do not have to be multiples of 8 bits wide. 7 | // Any width is fine and does not need to be fixed. 8 | 9 | // The data bits are packed to minimize data requirements, but the tradeoff 10 | // is that a header is required per character. 11 | 12 | // def_small.c 13 | // Point Size : 9 14 | // Memory usage : 928 bytes 15 | // # characters : 95 16 | 17 | // Header Format (to make Arduino UTFT Compatible): 18 | // ------------------------------------------------ 19 | // Character Width (Used as a marker to indicate use this format. i.e.: = 0x00) 20 | // Character Height 21 | // First Character (Reserved. 0x00) 22 | // Number Of Characters (Reserved. 0x00) 23 | 24 | 25 | unsigned char tft_def_small[] = 26 | { 27 | 0x00, 0x08, 0x00, 0x00, 28 | 29 | // Individual Character Format: 30 | // ---------------------------- 31 | // Character Code 32 | // Adjusted Y Offset 33 | // Width 34 | // Height 35 | // xOffset 36 | // xDelta (the distance to move the cursor. Effective width of the character.) 37 | // Data[n] 38 | 39 | // NOTE: You can remove any of these characters if they are not needed in 40 | // your application. The first character number in each Glyph indicates 41 | // the ASCII character code. Therefore, these do not have to be sequential. 42 | // Just remove all the content for a particular character to save space. 43 | 44 | // ' ' 45 | 0x20,0x08,0x00,0x00,0x00,0x03, 46 | 47 | // '!' 48 | 0x21,0x01,0x01,0x07,0x01,0x03, 49 | 0xFA, 50 | // '"' 51 | 0x22,0x01,0x03,0x02,0x01,0x04, 52 | 0xB4, 53 | // '#' 54 | 0x23,0x01,0x06,0x07,0x01,0x08, 55 | 0x28,0xAF,0xCA,0xFD,0x45,0x00, 56 | // '$' 57 | 0x24,0x01,0x06,0x08,0x00,0x06, 58 | 0x21,0xEA,0x38,0x38,0xAF,0x08, 59 | // '%' 60 | 0x25,0x01,0x08,0x07,0x00,0x09, 61 | 0x44,0xA4,0xA8,0x5A,0x15,0x25,0x22, 62 | // '&' 63 | 0x26,0x01,0x06,0x07,0x01,0x08, 64 | 0x31,0x04,0x19,0x9E,0x66,0xC0, 65 | // ''' 66 | 0x27,0x01,0x01,0x02,0x01,0x02, 67 | 0xC0, 68 | // '(' 69 | 0x28,0x00,0x02,0x08,0x01,0x04, 70 | 0x4A,0xA1, 71 | // ')' 72 | 0x29,0x00,0x02,0x08,0x01,0x04, 73 | 0x85,0x52, 74 | // '*' 75 | 0x2A,0x01,0x05,0x04,0x00,0x05, 76 | 0xAB,0x9D,0x50, 77 | // '+' 78 | 0x2B,0x03,0x05,0x05,0x01,0x08, 79 | 0x21,0x3E,0x42,0x00, 80 | // ',' 81 | 0x2C,0x07,0x01,0x02,0x01,0x03, 82 | 0xC0, 83 | // '-' 84 | 0x2D,0x05,0x02,0x01,0x01,0x03, 85 | 0xC0, 86 | // '.' 87 | 0x2E,0x07,0x01,0x01,0x01,0x03, 88 | 0x80, 89 | // '/' 90 | 0x2F,0x01,0x03,0x07,0x00,0x03, 91 | 0x25,0x25,0x20, 92 | // '0' 93 | 0x30,0x01,0x04,0x07,0x01,0x06, 94 | 0x69,0x99,0x99,0x60, 95 | // '1' 96 | 0x31,0x01,0x03,0x07,0x02,0x06, 97 | 0xC9,0x24,0xB8, 98 | // '2' 99 | 0x32,0x01,0x05,0x07,0x01,0x06, 100 | 0x64,0x84,0x44,0x43,0xC0, 101 | // '3' 102 | 0x33,0x01,0x04,0x07,0x01,0x06, 103 | 0x69,0x16,0x11,0x60, 104 | // '4' 105 | 0x34,0x01,0x05,0x07,0x01,0x06, 106 | 0x11,0x94,0xA9,0x7C,0x40, 107 | // '5' 108 | 0x35,0x01,0x04,0x07,0x01,0x06, 109 | 0xF8,0x8E,0x11,0xE0, 110 | // '6' 111 | 0x36,0x01,0x04,0x07,0x01,0x06, 112 | 0x7C,0x8E,0x99,0x60, 113 | // '7' 114 | 0x37,0x01,0x04,0x07,0x01,0x06, 115 | 0xF1,0x22,0x24,0x40, 116 | // '8' 117 | 0x38,0x01,0x04,0x07,0x01,0x06, 118 | 0x69,0x96,0x99,0x60, 119 | // '9' 120 | 0x39,0x01,0x04,0x07,0x01,0x06, 121 | 0x69,0x97,0x13,0xE0, 122 | // ':' 123 | 0x3A,0x03,0x01,0x05,0x01,0x03, 124 | 0x88, 125 | // ';' 126 | 0x3B,0x03,0x01,0x06,0x01,0x03, 127 | 0x8C, 128 | // '<' 129 | 0x3C,0x03,0x06,0x05,0x01,0x08, 130 | 0x04,0xEE,0x0E,0x04, 131 | // '=' 132 | 0x3D,0x04,0x06,0x03,0x01,0x08, 133 | 0xFC,0x0F,0xC0, 134 | // '>' 135 | 0x3E,0x03,0x06,0x05,0x01,0x08, 136 | 0x81,0xC1,0xDC,0x80, 137 | // '?' 138 | 0x3F,0x01,0x04,0x07,0x01,0x05, 139 | 0xE1,0x24,0x40,0x40, 140 | // '@' 141 | 0x40,0x01,0x08,0x08,0x01,0x0A, 142 | 0x3C,0x42,0x9D,0xA5,0xA5,0x9E,0x40,0x38, 143 | // 'A' 144 | 0x41,0x01,0x06,0x07,0x00,0x06, 145 | 0x30,0xC4,0x92,0x7A,0x18,0x40, 146 | // 'B' 147 | 0x42,0x01,0x05,0x07,0x01,0x07, 148 | 0xF4,0x63,0xE8,0xC7,0xC0, 149 | // 'C' 150 | 0x43,0x01,0x05,0x07,0x01,0x07, 151 | 0x72,0x61,0x08,0x25,0xC0, 152 | // 'D' 153 | 0x44,0x01,0x05,0x07,0x01,0x07, 154 | 0xF4,0xE3,0x18,0xCF,0xC0, 155 | // 'E' 156 | 0x45,0x01,0x04,0x07,0x01,0x06, 157 | 0xF8,0x8F,0x88,0xF0, 158 | // 'F' 159 | 0x46,0x01,0x04,0x07,0x01,0x06, 160 | 0xF8,0x8F,0x88,0x80, 161 | // 'G' 162 | 0x47,0x01,0x05,0x07,0x01,0x07, 163 | 0x76,0x61,0x38,0xE5,0xC0, 164 | // 'H' 165 | 0x48,0x01,0x05,0x07,0x01,0x07, 166 | 0x8C,0x63,0xF8,0xC6,0x20, 167 | // 'I' 168 | 0x49,0x01,0x01,0x07,0x01,0x03, 169 | 0xFE, 170 | // 'J' 171 | 0x4A,0x01,0x02,0x09,0x00,0x03, 172 | 0x55,0x55,0x80, 173 | // 'K' 174 | 0x4B,0x01,0x05,0x07,0x01,0x06, 175 | 0x8C,0xA9,0x8A,0x4A,0x20, 176 | // 'L' 177 | 0x4C,0x01,0x04,0x07,0x01,0x05, 178 | 0x88,0x88,0x88,0xF0, 179 | // 'M' 180 | 0x4D,0x01,0x06,0x07,0x01,0x08, 181 | 0x87,0x3C,0xED,0xB6,0x18,0x40, 182 | // 'N' 183 | 0x4E,0x01,0x05,0x07,0x01,0x07, 184 | 0x8E,0x73,0x59,0xCE,0x20, 185 | // 'O' 186 | 0x4F,0x01,0x05,0x07,0x01,0x07, 187 | 0x76,0xE3,0x18,0xED,0xC0, 188 | // 'P' 189 | 0x50,0x01,0x04,0x07,0x01,0x06, 190 | 0xE9,0x9E,0x88,0x80, 191 | // 'Q' 192 | 0x51,0x01,0x05,0x08,0x01,0x07, 193 | 0x76,0xE3,0x18,0xE9,0xC2, 194 | // 'R' 195 | 0x52,0x01,0x05,0x07,0x01,0x06, 196 | 0xE4,0xA5,0xCA,0x4A,0x20, 197 | // 'S' 198 | 0x53,0x01,0x06,0x07,0x01,0x07, 199 | 0x72,0x28,0x1C,0x0A,0x27,0x00, 200 | // 'T' 201 | 0x54,0x01,0x05,0x07,0x00,0x05, 202 | 0xF9,0x08,0x42,0x10,0x80, 203 | // 'U' 204 | 0x55,0x01,0x05,0x07,0x01,0x07, 205 | 0x8C,0x63,0x18,0xC5,0xC0, 206 | // 'V' 207 | 0x56,0x01,0x06,0x07,0x00,0x06, 208 | 0x86,0x14,0x92,0x48,0xC3,0x00, 209 | // 'W' 210 | 0x57,0x01,0x09,0x07,0xFF,0x07, 211 | 0x49,0x24,0x8A,0x85,0x43,0xE0,0xA0,0x50, 212 | // 'X' 213 | 0x58,0x01,0x06,0x07,0x00,0x06, 214 | 0xCD,0x23,0x0C,0x31,0x28,0xC0, 215 | // 'Y' 216 | 0x59,0x01,0x05,0x07,0x00,0x05, 217 | 0x8A,0x9C,0x42,0x10,0x80, 218 | // 'Z' 219 | 0x5A,0x01,0x05,0x07,0x00,0x05, 220 | 0xF8,0x44,0x44,0x43,0xE0, 221 | // '[' 222 | 0x5B,0x01,0x02,0x08,0x01,0x04, 223 | 0xEA,0xAB, 224 | // '\' 225 | 0x5C,0x01,0x03,0x07,0x00,0x03, 226 | 0x91,0x24,0x48, 227 | // ']' 228 | 0x5D,0x01,0x02,0x08,0x01,0x04, 229 | 0xD5,0x57, 230 | // '^' 231 | 0x5E,0x01,0x06,0x02,0x01,0x08, 232 | 0x31,0x20, 233 | // '_' 234 | 0x5F,0x09,0x05,0x01,0x00,0x05, 235 | 0xF8, 236 | // '`' 237 | 0x60,0x00,0x02,0x02,0x01,0x05, 238 | 0x90, 239 | // 'a' 240 | 0x61,0x03,0x04,0x05,0x01,0x06, 241 | 0x61,0x79,0xF0, 242 | // 'b' 243 | 0x62,0x00,0x04,0x08,0x01,0x06, 244 | 0x88,0x8E,0x99,0x9E, 245 | // 'c' 246 | 0x63,0x03,0x04,0x05,0x01,0x06, 247 | 0x78,0x88,0x70, 248 | // 'd' 249 | 0x64,0x00,0x04,0x08,0x01,0x06, 250 | 0x11,0x17,0x99,0x97, 251 | // 'e' 252 | 0x65,0x03,0x04,0x05,0x01,0x06, 253 | 0x69,0xF8,0x70, 254 | // 'f' 255 | 0x66,0x00,0x04,0x08,0x00,0x03, 256 | 0x34,0x4E,0x44,0x44, 257 | // 'g' 258 | 0x67,0x03,0x04,0x07,0x01,0x06, 259 | 0x79,0x99,0x71,0x60, 260 | // 'h' 261 | 0x68,0x00,0x04,0x08,0x01,0x06, 262 | 0x88,0x8E,0x99,0x99, 263 | // 'i' 264 | 0x69,0x01,0x01,0x07,0x01,0x03, 265 | 0xBE, 266 | // 'j' 267 | 0x6A,0x01,0x02,0x09,0x00,0x03, 268 | 0x45,0x55,0x80, 269 | // 'k' 270 | 0x6B,0x00,0x04,0x08,0x01,0x05, 271 | 0x88,0x89,0xAC,0xA9, 272 | // 'l' 273 | 0x6C,0x00,0x01,0x08,0x01,0x03, 274 | 0xFF, 275 | // 'm' 276 | 0x6D,0x03,0x07,0x05,0x01,0x09, 277 | 0xED,0x26,0x4C,0x99,0x20, 278 | // 'n' 279 | 0x6E,0x03,0x04,0x05,0x01,0x06, 280 | 0xE9,0x99,0x90, 281 | // 'o' 282 | 0x6F,0x03,0x04,0x05,0x01,0x06, 283 | 0x69,0x99,0x60, 284 | // 'p' 285 | 0x70,0x03,0x04,0x07,0x01,0x06, 286 | 0xE9,0x99,0xE8,0x80, 287 | // 'q' 288 | 0x71,0x03,0x04,0x07,0x01,0x06, 289 | 0x79,0x99,0x71,0x10, 290 | // 'r' 291 | 0x72,0x03,0x03,0x05,0x01,0x04, 292 | 0xF2,0x48, 293 | // 's' 294 | 0x73,0x03,0x04,0x05,0x01,0x05, 295 | 0x68,0x62,0xE0, 296 | // 't' 297 | 0x74,0x02,0x04,0x06,0x00,0x04, 298 | 0x4F,0x44,0x47, 299 | // 'u' 300 | 0x75,0x03,0x04,0x05,0x01,0x06, 301 | 0x99,0x99,0x70, 302 | // 'v' 303 | 0x76,0x03,0x07,0x05,0xFF,0x05, 304 | 0x44,0x98,0xA1,0xC1,0x00, 305 | // 'w' 306 | 0x77,0x03,0x07,0x05,0x00,0x07, 307 | 0x93,0x76,0xBA,0x24,0x40, 308 | // 'x' 309 | 0x78,0x03,0x05,0x05,0x00,0x05, 310 | 0x8A,0x88,0xA8,0x80, 311 | // 'y' 312 | 0x79,0x03,0x07,0x07,0xFF,0x05, 313 | 0x44,0x88,0xA1,0xC1,0x02,0x18,0x00, 314 | // 'z' 315 | 0x7A,0x03,0x04,0x05,0x01,0x06, 316 | 0xF1,0x24,0xF0, 317 | // '{' 318 | 0x7B,0x01,0x03,0x08,0x01,0x05, 319 | 0x69,0x64,0x93, 320 | // '|' 321 | 0x7C,0x01,0x01,0x09,0x01,0x03, 322 | 0xFF,0x80, 323 | // '}' 324 | 0x7D,0x01,0x03,0x08,0x01,0x05, 325 | 0xC9,0x34,0x96, 326 | // '~' 327 | 0x7E,0x03,0x06,0x03,0x01,0x08, 328 | 0x01,0x91,0x80, 329 | 330 | // Terminator 331 | 0xFF 332 | }; 333 | -------------------------------------------------------------------------------- /tools/dejavu.c: -------------------------------------------------------------------------------- 1 | // This comes with no warranty, implied or otherwise 2 | 3 | // This data structure was designed to support Proportional fonts 4 | // on Arduinos. It can however handle any ttf font that has been converted 5 | // using the conversion program. These could be fixed width or proportional 6 | // fonts. Individual characters do not have to be multiples of 8 bits wide. 7 | // Any width is fine and does not need to be fixed. 8 | 9 | // The data bits are packed to minimize data requirements, but the tradeoff 10 | // is that a header is required per character. 11 | 12 | // dejavu.c 13 | // Point Size : 12 14 | // Memory usage : 1158 bytes 15 | // # characters : 95 16 | 17 | // Header Format (to make Arduino UTFT Compatible): 18 | // ------------------------------------------------ 19 | // Character Width (Used as a marker to indicate use this format. i.e.: = 0x00) 20 | // Character Height 21 | // First Character (Reserved. 0x00) 22 | // Number Of Characters (Reserved. 0x00) 23 | 24 | #include 25 | 26 | uint8_t dejavu12[] PROGMEM = 27 | { 28 | 0x00, 0x0B, 0x00, 0x00, 29 | 30 | // Individual Character Format: 31 | // ---------------------------- 32 | // Character Code 33 | // Adjusted Y Offset 34 | // Width 35 | // Height 36 | // xOffset 37 | // xDelta (the distance to move the cursor. Effective width of the character.) 38 | // Data[n] 39 | 40 | // NOTE: You can remove any of these characters if they are not needed in 41 | // your application. The first character number in each Glyph indicates 42 | // the ASCII character code. Therefore, these do not have to be sequential. 43 | // Just remove all the content for a particular character to save space. 44 | 45 | // ' ' 46 | 0x20,0x0A,0x00,0x00,0x00,0x04, 47 | 48 | // '!' 49 | 0x21,0x01,0x01,0x09,0x02,0x05, 50 | 0xFD,0x80, 51 | // '"' 52 | 0x22,0x01,0x03,0x03,0x01,0x05, 53 | 0xB6,0x80, 54 | // '#' 55 | 0x23,0x02,0x08,0x08,0x01,0x0A, 56 | 0x12,0x14,0x7F,0x24,0x24,0xFE,0x28,0x48, 57 | // '$' 58 | 0x24,0x01,0x06,0x0B,0x02,0x08, 59 | 0x21,0xCA,0xA8,0xE0,0xE2,0xAA,0x70,0x82,0x00, 60 | // '%' 61 | 0x25,0x01,0x0A,0x09,0x00,0x0B, 62 | 0x61,0x24,0x89,0x22,0x50,0x6D,0x82,0x91,0x24,0x49,0x21,0x80, 63 | // '&' 64 | 0x26,0x01,0x09,0x09,0x01,0x0A, 65 | 0x30,0x24,0x10,0x0C,0x05,0x14,0x4A,0x19,0x8C,0x7B,0x00, 66 | // ''' 67 | 0x27,0x01,0x01,0x03,0x01,0x03, 68 | 0xE0, 69 | // '(' 70 | 0x28,0x00,0x03,0x0B,0x01,0x05, 71 | 0x69,0x49,0x24,0x48,0x80, 72 | // ')' 73 | 0x29,0x00,0x03,0x0B,0x01,0x05, 74 | 0x89,0x12,0x49,0x4A,0x00, 75 | // '*' 76 | 0x2A,0x01,0x05,0x06,0x01,0x06, 77 | 0x25,0x5C,0xEA,0x90, 78 | // '+' 79 | 0x2B,0x03,0x07,0x07,0x01,0x0A, 80 | 0x10,0x20,0x47,0xF1,0x02,0x04,0x00, 81 | // ',' 82 | 0x2C,0x08,0x01,0x03,0x01,0x04, 83 | 0xE0, 84 | // '-' 85 | 0x2D,0x06,0x03,0x01,0x01,0x04, 86 | 0xE0, 87 | // '.' 88 | 0x2E,0x08,0x01,0x02,0x01,0x04, 89 | 0xC0, 90 | // '/' 91 | 0x2F,0x01,0x04,0x0A,0x00,0x04, 92 | 0x11,0x22,0x24,0x44,0x88, 93 | // '0' 94 | 0x30,0x01,0x06,0x09,0x01,0x08, 95 | 0x79,0x28,0x61,0x86,0x18,0x52,0x78, 96 | // '1' 97 | 0x31,0x01,0x05,0x09,0x01,0x08, 98 | 0xE1,0x08,0x42,0x10,0x84,0xF8, 99 | // '2' 100 | 0x32,0x01,0x07,0x09,0x01,0x08, 101 | 0x79,0x18,0x10,0x20,0x82,0x08,0x20,0xFC, 102 | // '3' 103 | 0x33,0x01,0x06,0x09,0x01,0x08, 104 | 0x7A,0x10,0x41,0x38,0x30,0x63,0x78, 105 | // '4' 106 | 0x34,0x01,0x06,0x09,0x01,0x08, 107 | 0x18,0x62,0x92,0x4A,0x2F,0xC2,0x08, 108 | // '5' 109 | 0x35,0x01,0x06,0x09,0x01,0x08, 110 | 0xFA,0x08,0x3C,0x0C,0x10,0x63,0x78, 111 | // '6' 112 | 0x36,0x01,0x06,0x09,0x01,0x08, 113 | 0x39,0x18,0x3E,0xCE,0x18,0x53,0x78, 114 | // '7' 115 | 0x37,0x01,0x06,0x09,0x01,0x08, 116 | 0xFC,0x10,0x82,0x10,0x42,0x08,0x40, 117 | // '8' 118 | 0x38,0x01,0x06,0x09,0x01,0x08, 119 | 0x7B,0x38,0x73,0x7B,0x38,0x73,0x78, 120 | // '9' 121 | 0x39,0x01,0x06,0x09,0x01,0x08, 122 | 0x7B,0x28,0x61,0xCD,0xD0,0x62,0x70, 123 | // ':' 124 | 0x3A,0x04,0x01,0x06,0x01,0x04, 125 | 0xCC, 126 | // ';' 127 | 0x3B,0x04,0x01,0x07,0x01,0x04, 128 | 0xCE, 129 | // '<' 130 | 0x3C,0x03,0x08,0x06,0x01,0x0A, 131 | 0x03,0x1E,0xE0,0xE0,0x1E,0x03, 132 | // '=' 133 | 0x3D,0x05,0x08,0x03,0x01,0x0A, 134 | 0xFF,0x00,0xFF, 135 | // '>' 136 | 0x3E,0x03,0x08,0x06,0x01,0x0A, 137 | 0xC0,0x78,0x07,0x07,0x78,0xC0, 138 | // '?' 139 | 0x3F,0x01,0x05,0x09,0x00,0x06, 140 | 0x74,0x42,0x22,0x10,0x04,0x20, 141 | // '@' 142 | 0x40,0x01,0x0B,0x0B,0x01,0x0D, 143 | 0x1F,0x06,0x19,0x01,0x46,0x99,0x13,0x22,0x64,0x54,0x6C,0x40,0x04,0x10,0x7C,0x00, 144 | // 'A' 145 | 0x41,0x01,0x08,0x09,0x00,0x08, 146 | 0x18,0x18,0x24,0x24,0x24,0x42,0x7E,0x42,0x81, 147 | // 'B' 148 | 0x42,0x01,0x06,0x09,0x01,0x08, 149 | 0xFA,0x18,0x61,0xFA,0x18,0x61,0xF8, 150 | // 'C' 151 | 0x43,0x01,0x06,0x09,0x01,0x08, 152 | 0x39,0x18,0x20,0x82,0x08,0x11,0x38, 153 | // 'D' 154 | 0x44,0x01,0x07,0x09,0x01,0x09, 155 | 0xF9,0x0A,0x0C,0x18,0x30,0x60,0xC2,0xF8, 156 | // 'E' 157 | 0x45,0x01,0x06,0x09,0x01,0x08, 158 | 0xFE,0x08,0x20,0xFE,0x08,0x20,0xFC, 159 | // 'F' 160 | 0x46,0x01,0x05,0x09,0x01,0x07, 161 | 0xFC,0x21,0x0F,0xC2,0x10,0x80, 162 | // 'G' 163 | 0x47,0x01,0x07,0x09,0x01,0x09, 164 | 0x3C,0x86,0x04,0x08,0xF0,0x60,0xA1,0x3C, 165 | // 'H' 166 | 0x48,0x01,0x07,0x09,0x01,0x09, 167 | 0x83,0x06,0x0C,0x1F,0xF0,0x60,0xC1,0x82, 168 | // 'I' 169 | 0x49,0x01,0x01,0x09,0x01,0x03, 170 | 0xFF,0x80, 171 | // 'J' 172 | 0x4A,0x01,0x03,0x0B,0xFF,0x03, 173 | 0x24,0x92,0x49,0x27,0x00, 174 | // 'K' 175 | 0x4B,0x01,0x07,0x09,0x01,0x07, 176 | 0x85,0x12,0x45,0x0C,0x14,0x24,0x44,0x84, 177 | // 'L' 178 | 0x4C,0x01,0x05,0x09,0x01,0x06, 179 | 0x84,0x21,0x08,0x42,0x10,0xF8, 180 | // 'M' 181 | 0x4D,0x01,0x08,0x09,0x01,0x0A, 182 | 0x81,0xC3,0xC3,0xA5,0xA5,0x99,0x99,0x81,0x81, 183 | // 'N' 184 | 0x4E,0x01,0x07,0x09,0x01,0x09, 185 | 0xC3,0x86,0x8D,0x19,0x31,0x62,0xC3,0x86, 186 | // 'O' 187 | 0x4F,0x01,0x07,0x09,0x01,0x09, 188 | 0x38,0x8A,0x0C,0x18,0x30,0x60,0xA2,0x38, 189 | // 'P' 190 | 0x50,0x01,0x06,0x09,0x01,0x08, 191 | 0xFA,0x38,0x63,0xFA,0x08,0x20,0x80, 192 | // 'Q' 193 | 0x51,0x01,0x07,0x0B,0x01,0x09, 194 | 0x38,0x8A,0x0C,0x18,0x30,0x60,0xA2,0x38,0x10,0x10, 195 | // 'R' 196 | 0x52,0x01,0x07,0x09,0x01,0x08, 197 | 0xF9,0x1A,0x14,0x6F,0x91,0x21,0x42,0x82, 198 | // 'S' 199 | 0x53,0x01,0x06,0x09,0x01,0x08, 200 | 0x7B,0x18,0x30,0x78,0x30,0x63,0x78, 201 | // 'T' 202 | 0x54,0x01,0x07,0x09,0x00,0x07, 203 | 0xFE,0x20,0x40,0x81,0x02,0x04,0x08,0x10, 204 | // 'U' 205 | 0x55,0x01,0x07,0x09,0x01,0x09, 206 | 0x83,0x06,0x0C,0x18,0x30,0x60,0xA2,0x38, 207 | // 'V' 208 | 0x56,0x01,0x0A,0x09,0xFF,0x08, 209 | 0x40,0x90,0x22,0x10,0x84,0x21,0x04,0x81,0x20,0x30,0x0C,0x00, 210 | // 'W' 211 | 0x57,0x01,0x0B,0x09,0x00,0x0B, 212 | 0x84,0x28,0x89,0x11,0x27,0x22,0xA8,0x55,0x0E,0xE0,0x88,0x11,0x00, 213 | // 'X' 214 | 0x58,0x01,0x07,0x09,0x00,0x07, 215 | 0xC6,0x88,0xA1,0xC1,0x07,0x0A,0x22,0x82, 216 | // 'Y' 217 | 0x59,0x01,0x07,0x09,0x00,0x07, 218 | 0x82,0x89,0x11,0x43,0x82,0x04,0x08,0x10, 219 | // 'Z' 220 | 0x5A,0x01,0x07,0x09,0x01,0x09, 221 | 0xFE,0x04,0x10,0x41,0x04,0x10,0x40,0xFE, 222 | // '[' 223 | 0x5B,0x01,0x02,0x0B,0x02,0x05, 224 | 0xEA,0xAA,0xAC, 225 | // '\' 226 | 0x5C,0x01,0x04,0x0A,0x00,0x04, 227 | 0x88,0x44,0x42,0x22,0x11, 228 | // ']' 229 | 0x5D,0x01,0x02,0x0B,0x01,0x05, 230 | 0xD5,0x55,0x5C, 231 | // '^' 232 | 0x5E,0x01,0x08,0x03,0x01,0x0A, 233 | 0x18,0x24,0x42, 234 | // '_' 235 | 0x5F,0x0C,0x06,0x01,0x00,0x06, 236 | 0xFC, 237 | // '`' 238 | 0x60,0x00,0x03,0x02,0x01,0x06, 239 | 0x44, 240 | // 'a' 241 | 0x61,0x03,0x06,0x07,0x01,0x08, 242 | 0x7A,0x30,0x5F,0x86,0x37,0x40, 243 | // 'b' 244 | 0x62,0x00,0x06,0x0A,0x01,0x08, 245 | 0x82,0x08,0x2E,0xCA,0x18,0x61,0xCE,0xE0, 246 | // 'c' 247 | 0x63,0x03,0x05,0x07,0x01,0x07, 248 | 0x72,0x61,0x08,0x25,0xC0, 249 | // 'd' 250 | 0x64,0x00,0x06,0x0A,0x01,0x08, 251 | 0x04,0x10,0x5D,0xCE,0x18,0x61,0xCD,0xD0, 252 | // 'e' 253 | 0x65,0x03,0x06,0x07,0x01,0x08, 254 | 0x39,0x38,0x7F,0x81,0x13,0x80, 255 | // 'f' 256 | 0x66,0x00,0x04,0x0A,0x00,0x04, 257 | 0x34,0x4F,0x44,0x44,0x44, 258 | // 'g' 259 | 0x67,0x03,0x06,0x0A,0x01,0x08, 260 | 0x77,0x38,0x61,0x87,0x37,0x41,0x4C,0xE0, 261 | // 'h' 262 | 0x68,0x00,0x06,0x0A,0x01,0x08, 263 | 0x82,0x08,0x2E,0xC6,0x18,0x61,0x86,0x10, 264 | // 'i' 265 | 0x69,0x01,0x01,0x09,0x01,0x03, 266 | 0xBF,0x80, 267 | // 'j' 268 | 0x6A,0x01,0x02,0x0C,0x00,0x03, 269 | 0x45,0x55,0x56, 270 | // 'k' 271 | 0x6B,0x00,0x06,0x0A,0x01,0x07, 272 | 0x82,0x08,0x22,0x92,0x8E,0x28,0x92,0x20, 273 | // 'l' 274 | 0x6C,0x00,0x01,0x0A,0x01,0x03, 275 | 0xFF,0xC0, 276 | // 'm' 277 | 0x6D,0x03,0x09,0x07,0x01,0x0B, 278 | 0xB3,0x66,0x62,0x31,0x18,0x8C,0x46,0x22, 279 | // 'n' 280 | 0x6E,0x03,0x06,0x07,0x01,0x08, 281 | 0xBB,0x18,0x61,0x86,0x18,0x40, 282 | // 'o' 283 | 0x6F,0x03,0x06,0x07,0x01,0x08, 284 | 0x7B,0x38,0x61,0x87,0x37,0x80, 285 | // 'p' 286 | 0x70,0x03,0x06,0x0A,0x01,0x08, 287 | 0xBB,0x28,0x61,0x87,0x3B,0xA0,0x82,0x00, 288 | // 'q' 289 | 0x71,0x03,0x06,0x0A,0x01,0x08, 290 | 0x77,0x38,0x61,0x87,0x37,0x41,0x04,0x10, 291 | // 'r' 292 | 0x72,0x03,0x04,0x07,0x01,0x05, 293 | 0xBC,0x88,0x88,0x80, 294 | // 's' 295 | 0x73,0x03,0x06,0x07,0x01,0x07, 296 | 0x72,0x28,0x1C,0x0A,0x27,0x00, 297 | // 't' 298 | 0x74,0x01,0x04,0x09,0x00,0x05, 299 | 0x44,0xF4,0x44,0x44,0x30, 300 | // 'u' 301 | 0x75,0x03,0x06,0x07,0x01,0x08, 302 | 0x86,0x18,0x61,0x86,0x37,0x40, 303 | // 'v' 304 | 0x76,0x03,0x08,0x07,0xFF,0x06, 305 | 0x42,0x42,0x24,0x24,0x24,0x18,0x18, 306 | // 'w' 307 | 0x77,0x03,0x09,0x07,0x00,0x09, 308 | 0x88,0xC4,0x57,0x4A,0xA5,0x51,0x10,0x88, 309 | // 'x' 310 | 0x78,0x03,0x06,0x07,0x00,0x06, 311 | 0x85,0x24,0x8C,0x49,0x28,0x40, 312 | // 'y' 313 | 0x79,0x03,0x08,0x0A,0xFF,0x06, 314 | 0x42,0x42,0x24,0x24,0x14,0x18,0x08,0x08,0x10,0x60, 315 | // 'z' 316 | 0x7A,0x03,0x05,0x07,0x00,0x05, 317 | 0xF8,0x44,0x44,0x43,0xE0, 318 | // '{' 319 | 0x7B,0x01,0x05,0x0B,0x02,0x08, 320 | 0x19,0x08,0x42,0x60,0x84,0x21,0x06, 321 | // '|' 322 | 0x7C,0x01,0x01,0x0C,0x02,0x04, 323 | 0xFF,0xF0, 324 | // '}' 325 | 0x7D,0x01,0x05,0x0B,0x01,0x08, 326 | 0xC1,0x08,0x42,0x0C,0x84,0x21,0x30, 327 | // '~' 328 | 0x7E,0x04,0x08,0x03,0x01,0x0A, 329 | 0x00,0x71,0x8E, 330 | 331 | // Terminator 332 | 0xFF 333 | }; -------------------------------------------------------------------------------- /tools/dejavuX.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loboris/ESP32_TFT_library/aa21772f54a71887ec08b2e8bbaef9e304009891/tools/dejavuX.c -------------------------------------------------------------------------------- /tools/dejavuY.c: -------------------------------------------------------------------------------- 1 | // This comes with no warranty, implied or otherwise 2 | 3 | // This data structure was designed to support Proportional fonts 4 | // on Arduinos. It can however handle any ttf font that has been converted 5 | // using the conversion program. These could be fixed width or proportional 6 | // fonts. Individual characters do not have to be multiples of 8 bits wide. 7 | // Any width is fine and does not need to be fixed. 8 | 9 | // The data bits are packed to minimize data requirements, but the tradeoff 10 | // is that a header is required per character. 11 | 12 | // dejavuY.c 13 | // Point Size : 18 14 | // Memory usage : 5 bytes 15 | // # characters : 256 16 | 17 | // Header Format (to make Arduino UTFT Compatible): 18 | // ------------------------------------------------ 19 | // Character Width (Used as a marker to indicate use this format. i.e.: = 0x00) 20 | // Character Height 21 | // First Character (Reserved. 0x00) 22 | // Number Of Characters (Reserved. 0x00) 23 | 24 | #include 25 | 26 | uint8_t dejavuY18[] PROGMEM = 27 | { 28 | 0x00, 0x00, 0x00, 0x00, 29 | 30 | // Individual Character Format: 31 | // ---------------------------- 32 | // Character Code 33 | // Adjusted Y Offset 34 | // Width 35 | // Height 36 | // xOffset 37 | // xDelta (the distance to move the cursor. Effective width of the character.) 38 | // Data[n] 39 | 40 | // NOTE: You can remove any of these characters if they are not needed in 41 | // your application. The first character number in each Glyph indicates 42 | // the ASCII character code. Therefore, these do not have to be sequential. 43 | // Just remove all the content for a particular character to save space. 44 | 45 | 46 | // Terminator 47 | 0xFF 48 | }; -------------------------------------------------------------------------------- /tools/msvcp71.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loboris/ESP32_TFT_library/aa21772f54a71887ec08b2e8bbaef9e304009891/tools/msvcp71.dll -------------------------------------------------------------------------------- /tools/msvcr71.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loboris/ESP32_TFT_library/aa21772f54a71887ec08b2e8bbaef9e304009891/tools/msvcr71.dll -------------------------------------------------------------------------------- /tools/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | Program to convert any ttf font to c source file that can be includes in ESP32 tft library. 3 | 4 | This is a windows program, but can be used under Linux with wine: 5 | 6 | Usage: 7 | 8 | ttf2c_vc2003.exe [ ] 9 | 10 | or, under Linux: 11 | 12 | wine ./ttf2c_vc2003.exe [ ] 13 | 14 | 15 | Example: 16 | -------- 17 | 18 | wine ./ttf2c_vc2003.exe 18 Vera.ttf vera.c 19 | 20 | 21 | After the c source is created, open it in editor and make following changes: 22 | 23 | Delete the line: 24 | 25 | #include 26 | 27 | Change the line: 28 | 29 | uint8_t vera18[] PROGMEM = 30 | 31 | to: 32 | 33 | unsigned char vera18[] = 34 | 35 | 36 | The font name ("vera18" here) will be different for different font, 37 | you can change it to any other name. 38 | 39 | -------------------------------------------------------------------------------- /tools/ttf2c_vc2003.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/loboris/ESP32_TFT_library/aa21772f54a71887ec08b2e8bbaef9e304009891/tools/ttf2c_vc2003.exe --------------------------------------------------------------------------------