├── .gitattributes ├── .gitignore ├── LICENSE ├── NOTICE.md ├── README.md ├── examples └── Pong │ ├── Pong.bin │ ├── Pong.ino │ ├── README.md │ ├── desktop.ini │ ├── icon.bmp │ └── title.bmp ├── firmware.bin ├── library.properties ├── prototyping ├── __vm │ ├── Compile.vmps.xml │ ├── Configuration.Debug.vmps.xml │ └── Upload.vmps.xml └── prototyping.ino.lolin32.bin ├── schematics ├── MAKERphone-Brain-board-schematics.pdf ├── MAKERphone-Display-board-schematics.pdf ├── MAKERphone-Network-board-schematics-2.pdf ├── MAKERphone-Sound-board-schematics-1.pdf ├── MAKERphone-main-board-2G-schematics.pdf └── MAKERphone-main-board-4G-schematics.pdf └── src ├── FastLED ├── .gitignore ├── .library.json ├── FastLED.cpp ├── FastLED.h ├── LICENSE ├── PORTING.md ├── README.md ├── bitswap.cpp ├── bitswap.h ├── chipsets.h ├── color.h ├── colorpalettes.cpp ├── colorpalettes.h ├── colorutils.cpp ├── colorutils.h ├── controller.h ├── cpp_compat.h ├── dmx.h ├── docs │ ├── Doxyfile │ └── mainpage.dox ├── examples │ ├── AnalogOutput │ │ └── AnalogOutput.ino │ ├── Blink │ │ └── Blink.ino │ ├── ColorPalette │ │ └── ColorPalette.ino │ ├── ColorTemperature │ │ └── ColorTemperature.ino │ ├── Cylon │ │ └── Cylon.ino │ ├── DemoReel100 │ │ └── DemoReel100.ino │ ├── DemoReelESP32 │ │ └── DemoReelESP32.ino │ ├── Fire2012 │ │ └── Fire2012.ino │ ├── Fire2012WithPalette │ │ └── Fire2012WithPalette.ino │ ├── FirstLight │ │ └── FirstLight.ino │ ├── Multiple │ │ ├── ArrayOfLedArrays │ │ │ └── ArrayOfLedArrays.ino │ │ ├── MirroringSample │ │ │ └── MirroringSample.ino │ │ ├── MultiArrays │ │ │ └── MultiArrays.ino │ │ ├── MultipleStripsInOneArray │ │ │ └── MultipleStripsInOneArray.ino │ │ ├── OctoWS2811Demo │ │ │ └── OctoWS2811Demo.ino │ │ └── ParallelOutputDemo │ │ │ └── ParallelOutputDemo.ino │ ├── Noise │ │ └── Noise.ino │ ├── NoisePlayground │ │ └── NoisePlayground.ino │ ├── NoisePlusPalette │ │ └── NoisePlusPalette.ino │ ├── Pintest │ │ └── Pintest.ino │ ├── Ports │ │ └── PJRCSpectrumAnalyzer │ │ │ └── PJRCSpectrumAnalyzer.ino │ ├── RGBCalibrate │ │ └── RGBCalibrate.ino │ ├── RGBSetDemo │ │ └── RGBSetDemo.ino │ ├── SmartMatrix │ │ └── SmartMatrix.ino │ └── XYMatrix │ │ └── XYMatrix.ino ├── extras │ ├── AppleII.s65 │ ├── FastLED6502.s65 │ ├── RainbowDemo.bin.zip │ └── RainbowDemo.s65 ├── fastled_config.h ├── fastled_delay.h ├── fastled_progmem.h ├── fastpin.h ├── fastspi.h ├── fastspi_bitbang.h ├── fastspi_dma.h ├── fastspi_nop.h ├── fastspi_ref.h ├── fastspi_types.h ├── hsv2rgb.cpp ├── hsv2rgb.h ├── keywords.txt ├── led_sysdefs.h ├── lib8tion.cpp ├── lib8tion.h ├── lib8tion │ ├── math8.h │ ├── random8.h │ ├── scale8.h │ └── trig8.h ├── library.json ├── library.properties ├── noise.cpp ├── noise.h ├── pixelset.h ├── pixeltypes.h ├── platforms.h ├── platforms │ ├── avr │ │ ├── clockless_trinket.h │ │ ├── fastled_avr.h │ │ ├── fastpin_avr.h │ │ ├── fastspi_avr.h │ │ └── led_sysdefs_avr.h │ └── esp │ │ ├── 32 │ │ ├── clockless_block_esp32.h │ │ ├── clockless_esp32.h │ │ ├── clockless_esp32.h.orig │ │ ├── fastled_esp32.h │ │ ├── fastpin_esp32.h │ │ └── led_sysdefs_esp32.h │ │ └── 8266 │ │ ├── clockless_block_esp8266.h │ │ ├── clockless_esp8266.h │ │ ├── fastled_esp8266.h │ │ ├── fastpin_esp8266.h │ │ └── led_sysdefs_esp8266.h ├── power_mgt.cpp ├── power_mgt.h ├── preview_changes.txt ├── release_notes.md └── wiring.cpp ├── MAKERphone.cpp ├── MAKERphone.h ├── TFT_eSPI ├── .gitattributes ├── .gitignore ├── Fonts │ ├── Custom │ │ ├── Orbitron_Light_24.h │ │ ├── Orbitron_Light_32.h │ │ ├── Roboto_Thin_24.h │ │ ├── Satisfy_24.h │ │ └── Yellowtail_32.h │ ├── Font16.c │ ├── Font16.h │ ├── Font7srle.c │ ├── Font7srle.h │ ├── GFXFF │ │ ├── FreeMono12pt7b.h │ │ ├── FreeMono18pt7b.h │ │ ├── FreeMono24pt7b.h │ │ ├── FreeMono9pt7b.h │ │ ├── FreeMonoBold12pt7b.h │ │ ├── FreeMonoBold18pt7b.h │ │ ├── FreeMonoBold24pt7b.h │ │ ├── FreeMonoBold9pt7b.h │ │ ├── FreeMonoBoldOblique12pt7b.h │ │ ├── FreeMonoBoldOblique18pt7b.h │ │ ├── FreeMonoBoldOblique24pt7b.h │ │ ├── FreeMonoBoldOblique9pt7b.h │ │ ├── FreeMonoOblique12pt7b.h │ │ ├── FreeMonoOblique18pt7b.h │ │ ├── FreeMonoOblique24pt7b.h │ │ ├── FreeMonoOblique9pt7b.h │ │ ├── FreeSans12pt7b.h │ │ ├── FreeSans18pt7b.h │ │ ├── FreeSans24pt7b.h │ │ ├── FreeSans9pt7b.h │ │ ├── FreeSansBold12pt7b.h │ │ ├── FreeSansBold18pt7b.h │ │ ├── FreeSansBold24pt7b.h │ │ ├── FreeSansBold9pt7b.h │ │ ├── FreeSansBoldOblique12pt7b.h │ │ ├── FreeSansBoldOblique18pt7b.h │ │ ├── FreeSansBoldOblique24pt7b.h │ │ ├── FreeSansBoldOblique9pt7b.h │ │ ├── FreeSansOblique12pt7b.h │ │ ├── FreeSansOblique18pt7b.h │ │ ├── FreeSansOblique24pt7b.h │ │ ├── FreeSansOblique9pt7b.h │ │ ├── FreeSerif12pt7b.h │ │ ├── FreeSerif18pt7b.h │ │ ├── FreeSerif24pt7b.h │ │ ├── FreeSerif9pt7b.h │ │ ├── FreeSerifBold12pt7b.h │ │ ├── FreeSerifBold18pt7b.h │ │ ├── FreeSerifBold24pt7b.h │ │ ├── FreeSerifBold9pt7b.h │ │ ├── FreeSerifBoldItalic12pt7b.h │ │ ├── FreeSerifBoldItalic18pt7b.h │ │ ├── FreeSerifBoldItalic24pt7b.h │ │ ├── FreeSerifBoldItalic9pt7b.h │ │ ├── FreeSerifItalic12pt7b.h │ │ ├── FreeSerifItalic18pt7b.h │ │ ├── FreeSerifItalic24pt7b.h │ │ ├── FreeSerifItalic9pt7b.h │ │ ├── TomThumb.h │ │ ├── gfxfont.h │ │ ├── license.txt │ │ └── print.txt │ ├── TrueType │ │ └── Not_yet_supported.txt │ ├── font3x5.h │ └── glcdfont.c ├── README.md ├── README.txt ├── TFT_Drivers │ ├── EPD_Defines.h │ ├── HX8357D_Defines.h │ ├── HX8357D_Init.h │ ├── HX8357D_Rotation.h │ ├── ILI9163_Defines.h │ ├── ILI9163_Init.h │ ├── ILI9163_Rotation.h │ ├── ILI9341_Defines.h │ ├── ILI9341_Init.h │ ├── ILI9341_Rotation.h │ ├── ILI9481_Defines.h │ ├── ILI9481_Init.h │ ├── ILI9481_Rotation.h │ ├── ILI9488_Defines.h │ ├── ILI9488_Init.h │ ├── ILI9488_Rotation.h │ ├── RPI_ILI9486_Defines.h │ ├── RPI_ILI9486_Init.h │ ├── RPI_ILI9486_Rotation.h │ ├── S6D02A1_Defines.h │ ├── S6D02A1_Init.h │ ├── S6D02A1_Rotation.h │ ├── ST7735_Defines.h │ ├── ST7735_Init.h │ ├── ST7735_Rotation.h │ └── XXXXXXX_init.h ├── TFT_eSPI.cpp ├── TFT_eSPI.h ├── Tools │ ├── Create_Smooth_Font │ │ └── Create_font │ │ │ ├── Create_font.pde │ │ │ ├── FontFiles │ │ │ └── Final-Frontier28.vlw │ │ │ └── data │ │ │ └── Final-Frontier.ttf │ ├── ESP32 UNO board mod │ │ ├── ESP32 UNO board mod.jpg │ │ └── ESP32 UNO board pinout.jpg │ ├── PlatformIO │ │ └── Configuring options.txt │ ├── RPi_TFT_Connections.png │ ├── RPi_TFT_mod.png │ └── Screenshot_client │ │ └── Screenshot_client.pde ├── User_Setup.h ├── User_Setup_Select.h ├── User_Setups │ ├── Setup10_RPi_touch_ILI9486.h │ ├── Setup11_RPi_touch_ILI9486.h │ ├── Setup12_M5Stack.h │ ├── Setup13_ILI9481_Parallel.h │ ├── Setup14_ILI9341_Parallel.h │ ├── Setup15_HX8357D.h │ ├── Setup16_ILI9488_Parallel.h │ ├── Setup17_ePaper.h │ ├── Setup1_ILI9341.h │ ├── Setup2_ST7735.h │ ├── Setup3_ILI9163.h │ ├── Setup4_S6D02A1.h │ ├── Setup5_RPi_ILI9486.h │ ├── Setup6_RPi_Wr_ILI9486.h │ ├── Setup7_ST7735_128x128.h │ ├── Setup8_ILI9163_128x128.h │ ├── Setup9_ST7735_Overlap.h │ ├── SetupX_Template.h │ └── User_Custom_Fonts.h ├── keywords.txt ├── library.json ├── library.properties └── license.txt └── utility ├── Adafruit_ADS1X15 ├── Adafruit_ADS1015.cpp ├── Adafruit_ADS1015.h ├── README.md ├── examples │ ├── comparator │ │ └── comparator.pde │ ├── differential │ │ └── differential.pde │ └── singleended │ │ └── singleended.pde └── license.txt ├── ArduinoJson.h ├── ArduinoJson ├── ArduinoJson.h ├── LICENSE.md ├── README.md ├── keywords.txt ├── library.json ├── library.properties └── src │ ├── ArduinoJson.h │ ├── ArduinoJson.hpp │ └── ArduinoJson │ ├── Configuration.hpp │ ├── Data │ ├── Encoding.hpp │ ├── JsonBufferAllocated.hpp │ ├── JsonFloat.hpp │ ├── JsonInteger.hpp │ ├── JsonVariantAs.hpp │ ├── JsonVariantContent.hpp │ ├── JsonVariantDefault.hpp │ ├── JsonVariantType.hpp │ ├── List.hpp │ ├── ListConstIterator.hpp │ ├── ListIterator.hpp │ ├── ListNode.hpp │ ├── NonCopyable.hpp │ ├── ReferenceType.hpp │ └── ValueSaver.hpp │ ├── Deserialization │ ├── Comments.hpp │ ├── JsonParser.hpp │ ├── JsonParserImpl.hpp │ └── StringWriter.hpp │ ├── DynamicJsonBuffer.hpp │ ├── JsonArray.hpp │ ├── JsonArrayImpl.hpp │ ├── JsonArraySubscript.hpp │ ├── JsonBuffer.hpp │ ├── JsonBufferBase.hpp │ ├── JsonBufferImpl.hpp │ ├── JsonObject.hpp │ ├── JsonObjectImpl.hpp │ ├── JsonObjectSubscript.hpp │ ├── JsonPair.hpp │ ├── JsonVariant.hpp │ ├── JsonVariantBase.hpp │ ├── JsonVariantCasts.hpp │ ├── JsonVariantComparisons.hpp │ ├── JsonVariantImpl.hpp │ ├── JsonVariantOr.hpp │ ├── JsonVariantSubscripts.hpp │ ├── Polyfills │ ├── attributes.hpp │ ├── ctype.hpp │ ├── isFloat.hpp │ ├── isInteger.hpp │ ├── math.hpp │ ├── parseFloat.hpp │ └── parseInteger.hpp │ ├── RawJson.hpp │ ├── Serialization │ ├── DummyPrint.hpp │ ├── DynamicStringBuilder.hpp │ ├── FloatParts.hpp │ ├── IndentedPrint.hpp │ ├── JsonPrintable.hpp │ ├── JsonSerializer.hpp │ ├── JsonSerializerImpl.hpp │ ├── JsonWriter.hpp │ ├── Prettyfier.hpp │ ├── StaticStringBuilder.hpp │ └── StreamPrintAdapter.hpp │ ├── StaticJsonBuffer.hpp │ ├── StringTraits │ ├── ArduinoStream.hpp │ ├── CharPointer.hpp │ ├── FlashString.hpp │ ├── StdStream.hpp │ ├── StdString.hpp │ └── StringTraits.hpp │ ├── TypeTraits │ ├── EnableIf.hpp │ ├── FloatTraits.hpp │ ├── IsArray.hpp │ ├── IsBaseOf.hpp │ ├── IsChar.hpp │ ├── IsConst.hpp │ ├── IsFloatingPoint.hpp │ ├── IsIntegral.hpp │ ├── IsSame.hpp │ ├── IsSignedIntegral.hpp │ ├── IsUnsignedIntegral.hpp │ ├── IsVariant.hpp │ ├── RemoveConst.hpp │ └── RemoveReference.hpp │ └── version.hpp ├── Buttons ├── Buttons.cpp └── Buttons.h ├── Free_Fonts.h ├── HttpClient ├── HttpClient.cpp ├── HttpClient.h ├── README.md ├── b64.cpp ├── b64.h ├── examples │ └── SimpleHttpExample │ │ └── SimpleHttpExample.ino ├── keywords.txt └── library.properties ├── I2cExpander ├── I2cExpander.cpp └── I2cExpander.h ├── JPEGDecoder.h ├── JPEGDecoder ├── README.md ├── keywords.txt ├── library.json ├── library.properties ├── license.txt └── src │ ├── JPEGDecoder.cpp │ ├── JPEGDecoder.h │ ├── User_Config.h │ ├── picojpeg.c │ └── picojpeg.h ├── RTCLib ├── .library.json ├── RTClib.cpp ├── RTClib.h ├── keywords.txt ├── library.json └── library.properties ├── SdFat.h ├── TFT_eSPI.h ├── arduino_pdu_decoder ├── pdu_decoder.cpp └── pdu_decoder.h ├── soundLib ├── MPAudioDriver.cpp ├── MPAudioDriver.h ├── MPWavLib.cpp ├── MPWavLib.h └── Notes.h └── sprites.c /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | static/* linguist-vendored 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 CircuitMess 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /examples/Pong/Pong.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/CircuitMess-Ringo/14cbc74d1ba067830067e32cebe9189f0266dcfb/examples/Pong/Pong.bin -------------------------------------------------------------------------------- /examples/Pong/README.md: -------------------------------------------------------------------------------- 1 | # Pong 2 | 3 | A simple port of the Pong for MAKERphone. 4 | 5 | 6 | 7 | 8 | 9 | 10 | Copyright © 2020 CircuitMess 11 | 12 | Licensed under [MIT license](https://opensource.org/licenses/MIT) 13 | 14 | [MAKERphone's kickstarter page](https://www.kickstarter.com/projects/albertgajsak/makerphone-an-educational-diy-mobile-phone/updates) 15 | -------------------------------------------------------------------------------- /examples/Pong/desktop.ini: -------------------------------------------------------------------------------- 1 | [.ShellClassInfo] 2 | ConfirmFileOp=0 3 | IconResource=C:\Program Files\Google\Drive File Stream\28.1.23.2113\GoogleDriveFS.exe,21 4 | -------------------------------------------------------------------------------- /examples/Pong/icon.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/CircuitMess-Ringo/14cbc74d1ba067830067e32cebe9189f0266dcfb/examples/Pong/icon.bmp -------------------------------------------------------------------------------- /examples/Pong/title.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/CircuitMess-Ringo/14cbc74d1ba067830067e32cebe9189f0266dcfb/examples/Pong/title.bmp -------------------------------------------------------------------------------- /firmware.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/CircuitMess-Ringo/14cbc74d1ba067830067e32cebe9189f0266dcfb/firmware.bin -------------------------------------------------------------------------------- /library.properties: -------------------------------------------------------------------------------- 1 | name=Ringo by CircuitMess Library 2 | version=1.0.5 3 | author=CircuitMess 4 | maintainer=CircuitMess 5 | sentence=Ringo is an educational DIY mobile phone designed to bring electronics and programming to the crowd in a fun and interesting way. 6 | paragraph=See more on https://www.kickstarter.com/projects/albertgajsak/makerphone-an-educational-diy-mobile-phone 7 | category=Device Control 8 | url=https://github.com/CircuitMess/CircuitMess-Ringo 9 | architectures=esp32 10 | includes=MAKERphone.h 11 | -------------------------------------------------------------------------------- /prototyping/prototyping.ino.lolin32.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/CircuitMess-Ringo/14cbc74d1ba067830067e32cebe9189f0266dcfb/prototyping/prototyping.ino.lolin32.bin -------------------------------------------------------------------------------- /schematics/MAKERphone-Brain-board-schematics.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/CircuitMess-Ringo/14cbc74d1ba067830067e32cebe9189f0266dcfb/schematics/MAKERphone-Brain-board-schematics.pdf -------------------------------------------------------------------------------- /schematics/MAKERphone-Display-board-schematics.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/CircuitMess-Ringo/14cbc74d1ba067830067e32cebe9189f0266dcfb/schematics/MAKERphone-Display-board-schematics.pdf -------------------------------------------------------------------------------- /schematics/MAKERphone-Network-board-schematics-2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/CircuitMess-Ringo/14cbc74d1ba067830067e32cebe9189f0266dcfb/schematics/MAKERphone-Network-board-schematics-2.pdf -------------------------------------------------------------------------------- /schematics/MAKERphone-Sound-board-schematics-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/CircuitMess-Ringo/14cbc74d1ba067830067e32cebe9189f0266dcfb/schematics/MAKERphone-Sound-board-schematics-1.pdf -------------------------------------------------------------------------------- /schematics/MAKERphone-main-board-2G-schematics.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/CircuitMess-Ringo/14cbc74d1ba067830067e32cebe9189f0266dcfb/schematics/MAKERphone-main-board-2G-schematics.pdf -------------------------------------------------------------------------------- /schematics/MAKERphone-main-board-4G-schematics.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/CircuitMess-Ringo/14cbc74d1ba067830067e32cebe9189f0266dcfb/schematics/MAKERphone-main-board-4G-schematics.pdf -------------------------------------------------------------------------------- /src/FastLED/.gitignore: -------------------------------------------------------------------------------- 1 | html/ 2 | *.gch 3 | -------------------------------------------------------------------------------- /src/FastLED/.library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "FastLED", 3 | "description": "FastLED is a library for programming addressable rgb led strips (APA102/Dotstar, WS2812/Neopixel, LPD8806, and a dozen others) acting both as a driver and as a library for color management and fast math.", 4 | "keywords": [ 5 | "led", 6 | "noise", 7 | "rgb", 8 | "math", 9 | "fast" 10 | ], 11 | "authors": [ 12 | { 13 | "email": null, 14 | "url": "https://github.com/focalintent", 15 | "maintainer": true, 16 | "name": "Daniel Garcia" 17 | }, 18 | { 19 | "email": null, 20 | "url": "https://github.com/kriegsman", 21 | "maintainer": true, 22 | "name": "Mark Kriegsman" 23 | } 24 | ], 25 | "repository": { 26 | "type": "git", 27 | "url": "https://github.com/FastLED/FastLED.git" 28 | }, 29 | "version": "3.2.1", 30 | "license": "MIT", 31 | "homepage": "http://fastled.io", 32 | "frameworks": [ 33 | "arduino" 34 | ], 35 | "platforms": [ 36 | "atmelavr", 37 | "atmelsam", 38 | "freescalekinetis", 39 | "nordicnrf51", 40 | "nxplpc", 41 | "ststm32", 42 | "teensy", 43 | "espressif8266", 44 | "espressif32" 45 | ], 46 | "build": { 47 | "libArchive": false 48 | }, 49 | "id": 126 50 | } -------------------------------------------------------------------------------- /src/FastLED/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 FastLED 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /src/FastLED/PORTING.md: -------------------------------------------------------------------------------- 1 | =New platform porting guide= 2 | 3 | == Setting up the basic files/folders == 4 | 5 | * Create platform directory (e.g. platforms/arm/kl26) 6 | * Create configuration header led_sysdefs_arm_kl26.h: 7 | * Define platform flags (like FASTLED_ARM/FASTLED_TEENSY) 8 | * Define configuration parameters re: interrupts, or clock doubling 9 | * Include extar system header files if needed 10 | * Create main platform include, fastled_arm_kl26.h 11 | * Include the various other header files as needed 12 | * Modify led_sysdefs.h to conditionally include platform sysdefs header file 13 | * Modify platforms.h to conditionally include platform fastled header 14 | 15 | == Porting fastpin.h == 16 | 17 | The heart of the FastLED library is the fast pin accesss. This is a templated class that provides 1-2 cycle pin access, bypassing digital write and other such things. As such, this will usually be the first bit of the library that you will want to port when moving to a new platform. Once you have FastPIN up and running then you can do some basic work like testing toggles or running bit-bang'd SPI output. 18 | 19 | There's two low level FastPin classes. There's the base FastPIN template class, and then there is FastPinBB which is for bit-banded access on those MCUs that support bitbanding. Note that the bitband class is optional and primarily useful in the implementation of other functionality internal to the platform. This file is also where you would do the pin to port/bit mapping defines. 20 | 21 | Explaining how the macros work and should be used is currently beyond the scope of this document. 22 | 23 | == Porting fastspi.h == 24 | 25 | This is where you define the low level interface to the hardware SPI system (including a writePixels method that does a bunch of housekeeping for writing led data). Use the fastspi_nop.h file as a reference for the methods that need to be implemented. There are ofteh other useful methods that can help with the internals of the SPI code, I recommend taking a look at how the various platforms implement their SPI classes. 26 | 27 | == Porting clockless.h == 28 | 29 | This is where you define the code for the clockless controllers. Across ARM platforms this will usually be fairly similar - though different arm platforms will have different clock sources that you can/should use. 30 | -------------------------------------------------------------------------------- /src/FastLED/bitswap.cpp: -------------------------------------------------------------------------------- 1 | #define FASTLED_INTERNAL 2 | #include "FastLED.h" 3 | 4 | /// Simplified form of bits rotating function. Based on code found here - http://www.hackersdelight.org/hdcodetxt/transpose8.c.txt - rotating 5 | /// data into LSB for a faster write (the code using this data can happily walk the array backwards) 6 | void transpose8x1_noinline(unsigned char *A, unsigned char *B) { 7 | uint32_t x, y, t; 8 | 9 | // Load the array and pack it into x and y. 10 | y = *(unsigned int*)(A); 11 | x = *(unsigned int*)(A+4); 12 | 13 | // pre-transform x 14 | t = (x ^ (x >> 7)) & 0x00AA00AA; x = x ^ t ^ (t << 7); 15 | t = (x ^ (x >>14)) & 0x0000CCCC; x = x ^ t ^ (t <<14); 16 | 17 | // pre-transform y 18 | t = (y ^ (y >> 7)) & 0x00AA00AA; y = y ^ t ^ (t << 7); 19 | t = (y ^ (y >>14)) & 0x0000CCCC; y = y ^ t ^ (t <<14); 20 | 21 | // final transform 22 | t = (x & 0xF0F0F0F0) | ((y >> 4) & 0x0F0F0F0F); 23 | y = ((x << 4) & 0xF0F0F0F0) | (y & 0x0F0F0F0F); 24 | x = t; 25 | 26 | *((uint32_t*)B) = y; 27 | *((uint32_t*)(B+4)) = x; 28 | } 29 | -------------------------------------------------------------------------------- /src/FastLED/colorpalettes.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_COLORPALETTES_H 2 | #define __INC_COLORPALETTES_H 3 | 4 | #include "FastLED.h" 5 | #include "colorutils.h" 6 | 7 | ///@file colorpalettes.h 8 | /// contains definitions for the predefined color palettes supplied by FastLED. 9 | 10 | FASTLED_NAMESPACE_BEGIN 11 | 12 | ///@defgroup Colorpalletes Pre-defined color palletes 13 | /// These schemes are all declared as "PROGMEM", meaning 14 | /// that they won't take up SRAM on AVR chips until used. 15 | /// Furthermore, the compiler won't even include these 16 | /// in your PROGMEM (flash) storage unless you specifically 17 | /// use each one, so you only 'pay for' those you actually use. 18 | 19 | ///@{ 20 | 21 | /// Cloudy color pallete 22 | extern const TProgmemRGBPalette16 CloudColors_p FL_PROGMEM; 23 | /// Lava colors 24 | extern const TProgmemRGBPalette16 LavaColors_p FL_PROGMEM; 25 | /// Ocean colors, blues and whites 26 | extern const TProgmemRGBPalette16 OceanColors_p FL_PROGMEM; 27 | /// Forest colors, greens 28 | extern const TProgmemRGBPalette16 ForestColors_p FL_PROGMEM; 29 | 30 | /// HSV Rainbow 31 | extern const TProgmemRGBPalette16 RainbowColors_p FL_PROGMEM; 32 | 33 | #define RainbowStripesColors_p RainbowStripeColors_p 34 | /// HSV Rainbow colors with alternatating stripes of black 35 | extern const TProgmemRGBPalette16 RainbowStripeColors_p FL_PROGMEM; 36 | 37 | /// HSV color ramp: blue purple ping red orange yellow (and back) 38 | /// Basically, everything but the greens, which tend to make 39 | /// people's skin look unhealthy. This palette is good for 40 | /// lighting at a club or party, where it'll be shining on people. 41 | extern const TProgmemRGBPalette16 PartyColors_p FL_PROGMEM; 42 | 43 | /// Approximate "black body radiation" palette, akin to 44 | /// the FastLED 'HeatColor' function. 45 | /// Recommend that you use values 0-240 rather than 46 | /// the usual 0-255, as the last 15 colors will be 47 | /// 'wrapping around' from the hot end to the cold end, 48 | /// which looks wrong. 49 | extern const TProgmemRGBPalette16 HeatColors_p FL_PROGMEM; 50 | 51 | 52 | DECLARE_GRADIENT_PALETTE( Rainbow_gp); 53 | 54 | FASTLED_NAMESPACE_END 55 | 56 | ///@} 57 | #endif 58 | -------------------------------------------------------------------------------- /src/FastLED/cpp_compat.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_CPP_COMPAT_H 2 | #define __INC_CPP_COMPAT_H 3 | 4 | #include "FastLED.h" 5 | 6 | #if __cplusplus <= 199711L 7 | 8 | #define static_assert(expression, message) 9 | #define constexpr const 10 | 11 | #else 12 | 13 | // things that we can turn on if we're in a C++11 environment 14 | #endif 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /src/FastLED/dmx.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_DMX_H 2 | #define __INC_DMX_H 3 | 4 | #include "FastLED.h" 5 | 6 | #ifdef DmxSimple_h 7 | #include 8 | #define HAS_DMX_SIMPLE 9 | 10 | ///@ingroup chipsets 11 | ///@{ 12 | FASTLED_NAMESPACE_BEGIN 13 | 14 | // note - dmx simple must be included before FastSPI for this code to be enabled 15 | template class DMXSimpleController : public CPixelLEDController { 16 | public: 17 | // initialize the LED controller 18 | virtual void init() { DmxSimple.usePin(DATA_PIN); } 19 | 20 | protected: 21 | virtual void showPixels(PixelController & pixels) { 22 | int iChannel = 1; 23 | while(pixels.has(1)) { 24 | DmxSimple.write(iChannel++, pixels.loadAndScale0()); 25 | DmxSimple.write(iChannel++, pixels.loadAndScale1()); 26 | DmxSimple.write(iChannel++, pixels.loadAndScale2()); 27 | pixels.advanceData(); 28 | pixels.stepDithering(); 29 | } 30 | } 31 | }; 32 | 33 | FASTLED_NAMESPACE_END 34 | 35 | #endif 36 | 37 | #ifdef DmxSerial_h 38 | #include 39 | 40 | FASTLED_NAMESPACE_BEGIN 41 | 42 | template class DMXSerialController : public CPixelLEDController { 43 | public: 44 | // initialize the LED controller 45 | virtual void init() { DMXSerial.init(DMXController); } 46 | 47 | virtual void showPixels(PixelController & pixels) { 48 | int iChannel = 1; 49 | while(pixels.has(1)) { 50 | DMXSerial.write(iChannel++, pixels.loadAndScale0()); 51 | DMXSerial.write(iChannel++, pixels.loadAndScale1()); 52 | DMXSerial.write(iChannel++, pixels.loadAndScale2()); 53 | pixels.advanceData(); 54 | pixels.stepDithering(); 55 | } 56 | } 57 | }; 58 | 59 | FASTLED_NAMESPACE_END 60 | ///@} 61 | 62 | #define HAS_DMX_SERIAL 63 | #endif 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /src/FastLED/docs/mainpage.dox: -------------------------------------------------------------------------------- 1 | /** 2 | @brief Documentation file for FastLED 3 | @author dgarcia at fastled dot io 4 | @file 5 | */ 6 | /** @defgroup FastLED Sources */ 7 | /** 8 | @mainpage FastLED - let there be light! 9 | */ 10 | EOF 11 | -------------------------------------------------------------------------------- /src/FastLED/examples/AnalogOutput/AnalogOutput.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // Example showing how to use FastLED color functions 4 | // even when you're NOT using a "pixel-addressible" smart LED strip. 5 | // 6 | // This example is designed to control an "analog" RGB LED strip 7 | // (or a single RGB LED) being driven by Arduino PWM output pins. 8 | // So this code never calls FastLED.addLEDs() or FastLED.show(). 9 | // 10 | // This example illustrates one way you can use just the portions 11 | // of FastLED that you need. In this case, this code uses just the 12 | // fast HSV color conversion code. 13 | // 14 | // In this example, the RGB values are output on three separate 15 | // 'analog' PWM pins, one for red, one for green, and one for blue. 16 | 17 | #define REDPIN 5 18 | #define GREENPIN 6 19 | #define BLUEPIN 3 20 | 21 | // showAnalogRGB: this is like FastLED.show(), but outputs on 22 | // analog PWM output pins instead of sending data to an intelligent, 23 | // pixel-addressable LED strip. 24 | // 25 | // This function takes the incoming RGB values and outputs the values 26 | // on three analog PWM output pins to the r, g, and b values respectively. 27 | void showAnalogRGB( const CRGB& rgb) 28 | { 29 | analogWrite(REDPIN, rgb.r ); 30 | analogWrite(GREENPIN, rgb.g ); 31 | analogWrite(BLUEPIN, rgb.b ); 32 | } 33 | 34 | 35 | 36 | // colorBars: flashes Red, then Green, then Blue, then Black. 37 | // Helpful for diagnosing if you've mis-wired which is which. 38 | void colorBars() 39 | { 40 | showAnalogRGB( CRGB::Red ); delay(500); 41 | showAnalogRGB( CRGB::Green ); delay(500); 42 | showAnalogRGB( CRGB::Blue ); delay(500); 43 | showAnalogRGB( CRGB::Black ); delay(500); 44 | } 45 | 46 | void loop() 47 | { 48 | static uint8_t hue; 49 | hue = hue + 1; 50 | // Use FastLED automatic HSV->RGB conversion 51 | showAnalogRGB( CHSV( hue, 255, 255) ); 52 | 53 | delay(20); 54 | } 55 | 56 | 57 | void setup() { 58 | pinMode(REDPIN, OUTPUT); 59 | pinMode(GREENPIN, OUTPUT); 60 | pinMode(BLUEPIN, OUTPUT); 61 | 62 | // Flash the "hello" color sequence: R, G, B, black. 63 | colorBars(); 64 | } 65 | 66 | -------------------------------------------------------------------------------- /src/FastLED/examples/Blink/Blink.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // How many leds in your strip? 4 | #define NUM_LEDS 1 5 | 6 | // For led chips like Neopixels, which have a data line, ground, and power, you just 7 | // need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock, 8 | // ground, and power), like the LPD8806 define both DATA_PIN and CLOCK_PIN 9 | #define DATA_PIN 3 10 | #define CLOCK_PIN 13 11 | 12 | // Define the array of leds 13 | CRGB leds[NUM_LEDS]; 14 | 15 | void setup() { 16 | // Uncomment/edit one of the following lines for your leds arrangement. 17 | // FastLED.addLeds(leds, NUM_LEDS); 18 | // FastLED.addLeds(leds, NUM_LEDS); 19 | // FastLED.addLeds(leds, NUM_LEDS); 20 | // FastLED.addLeds(leds, NUM_LEDS); 21 | // FastLED.addLeds(leds, NUM_LEDS); 22 | // FastLED.addLeds(leds, NUM_LEDS); 23 | FastLED.addLeds(leds, NUM_LEDS); 24 | // FastLED.addLeds(leds, NUM_LEDS); 25 | // FastLED.addLeds(leds, NUM_LEDS); 26 | // FastLED.addLeds(leds, NUM_LEDS); 27 | // FastLED.addLeds(leds, NUM_LEDS); 28 | // FastLED.addLeds(leds, NUM_LEDS); 29 | 30 | // FastLED.addLeds(leds, NUM_LEDS); 31 | // FastLED.addLeds(leds, NUM_LEDS); 32 | // FastLED.addLeds(leds, NUM_LEDS); 33 | // FastLED.addLeds(leds, NUM_LEDS); 34 | // FastLED.addLeds(leds, NUM_LEDS); 35 | // FastLED.addLeds(leds, NUM_LEDS); 36 | 37 | // FastLED.addLeds(leds, NUM_LEDS); 38 | // FastLED.addLeds(leds, NUM_LEDS); 39 | // FastLED.addLeds(leds, NUM_LEDS); 40 | // FastLED.addLeds(leds, NUM_LEDS); 41 | // FastLED.addLeds(leds, NUM_LEDS); 42 | // FastLED.addLeds(leds, NUM_LEDS); 43 | } 44 | 45 | void loop() { 46 | // Turn the LED on, then pause 47 | leds[0] = CRGB::Red; 48 | FastLED.show(); 49 | delay(500); 50 | // Now turn the LED off, then pause 51 | leds[0] = CRGB::Black; 52 | FastLED.show(); 53 | delay(500); 54 | } 55 | -------------------------------------------------------------------------------- /src/FastLED/examples/Cylon/Cylon.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // How many leds in your strip? 4 | #define NUM_LEDS 64 5 | 6 | // For led chips like Neopixels, which have a data line, ground, and power, you just 7 | // need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock, 8 | // ground, and power), like the LPD8806, define both DATA_PIN and CLOCK_PIN 9 | #define DATA_PIN 7 10 | #define CLOCK_PIN 13 11 | 12 | // Define the array of leds 13 | CRGB leds[NUM_LEDS]; 14 | 15 | void setup() { 16 | Serial.begin(57600); 17 | Serial.println("resetting"); 18 | LEDS.addLeds(leds,NUM_LEDS); 19 | LEDS.setBrightness(84); 20 | } 21 | 22 | void fadeall() { for(int i = 0; i < NUM_LEDS; i++) { leds[i].nscale8(250); } } 23 | 24 | void loop() { 25 | static uint8_t hue = 0; 26 | Serial.print("x"); 27 | // First slide the led in one direction 28 | for(int i = 0; i < NUM_LEDS; i++) { 29 | // Set the i'th led to red 30 | leds[i] = CHSV(hue++, 255, 255); 31 | // Show the leds 32 | FastLED.show(); 33 | // now that we've shown the leds, reset the i'th led to black 34 | // leds[i] = CRGB::Black; 35 | fadeall(); 36 | // Wait a little bit before we loop around and do it again 37 | delay(10); 38 | } 39 | Serial.print("x"); 40 | 41 | // Now go in the other direction. 42 | for(int i = (NUM_LEDS)-1; i >= 0; i--) { 43 | // Set the i'th led to red 44 | leds[i] = CHSV(hue++, 255, 255); 45 | // Show the leds 46 | FastLED.show(); 47 | // now that we've shown the leds, reset the i'th led to black 48 | // leds[i] = CRGB::Black; 49 | fadeall(); 50 | // Wait a little bit before we loop around and do it again 51 | delay(10); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/FastLED/examples/Multiple/ArrayOfLedArrays/ArrayOfLedArrays.ino: -------------------------------------------------------------------------------- 1 | // ArrayOfLedArrays - see https://github.com/FastLED/FastLED/wiki/Multiple-Controller-Examples for more info on 2 | // using multiple controllers. In this example, we're going to set up three NEOPIXEL strips on three 3 | // different pins, each strip getting its own CRGB array to be played with, only this time they're going 4 | // to be all parts of an array of arrays. 5 | 6 | #include 7 | 8 | #define NUM_STRIPS 3 9 | #define NUM_LEDS_PER_STRIP 60 10 | CRGB leds[NUM_STRIPS][NUM_LEDS_PER_STRIP]; 11 | 12 | // For mirroring strips, all the "special" stuff happens just in setup. We 13 | // just addLeds multiple times, once for each strip 14 | void setup() { 15 | // tell FastLED there's 60 NEOPIXEL leds on pin 10 16 | FastLED.addLeds(leds[0], NUM_LEDS_PER_STRIP); 17 | 18 | // tell FastLED there's 60 NEOPIXEL leds on pin 11 19 | FastLED.addLeds(leds[1], NUM_LEDS_PER_STRIP); 20 | 21 | // tell FastLED there's 60 NEOPIXEL leds on pin 12 22 | FastLED.addLeds(leds[2], NUM_LEDS_PER_STRIP); 23 | 24 | } 25 | 26 | void loop() { 27 | // This outer loop will go over each strip, one at a time 28 | for(int x = 0; x < NUM_STRIPS; x++) { 29 | // This inner loop will go over each led in the current strip, one at a time 30 | for(int i = 0; i < NUM_LEDS_PER_STRIP; i++) { 31 | leds[x][i] = CRGB::Red; 32 | FastLED.show(); 33 | leds[x][i] = CRGB::Black; 34 | delay(100); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/FastLED/examples/Multiple/MirroringSample/MirroringSample.ino: -------------------------------------------------------------------------------- 1 | // MirroringSample - see https://github.com/FastLED/FastLED/wiki/Multiple-Controller-Examples for more info on 2 | // using multiple controllers. In this example, we're going to set up four NEOPIXEL strips on four 3 | // different pins, and show the same thing on all four of them, a simple bouncing dot/cyclon type pattern 4 | 5 | #include 6 | 7 | #define NUM_LEDS_PER_STRIP 60 8 | CRGB leds[NUM_LEDS_PER_STRIP]; 9 | 10 | // For mirroring strips, all the "special" stuff happens just in setup. We 11 | // just addLeds multiple times, once for each strip 12 | void setup() { 13 | // tell FastLED there's 60 NEOPIXEL leds on pin 4 14 | FastLED.addLeds(leds, NUM_LEDS_PER_STRIP); 15 | 16 | // tell FastLED there's 60 NEOPIXEL leds on pin 5 17 | FastLED.addLeds(leds, NUM_LEDS_PER_STRIP); 18 | 19 | // tell FastLED there's 60 NEOPIXEL leds on pin 6 20 | FastLED.addLeds(leds, NUM_LEDS_PER_STRIP); 21 | 22 | // tell FastLED there's 60 NEOPIXEL leds on pin 7 23 | FastLED.addLeds(leds, NUM_LEDS_PER_STRIP); 24 | } 25 | 26 | void loop() { 27 | for(int i = 0; i < NUM_LEDS_PER_STRIP; i++) { 28 | // set our current dot to red 29 | leds[i] = CRGB::Red; 30 | FastLED.show(); 31 | // clear our current dot before we move on 32 | leds[i] = CRGB::Black; 33 | delay(100); 34 | } 35 | 36 | for(int i = NUM_LEDS_PER_STRIP-1; i >= 0; i--) { 37 | // set our current dot to red 38 | leds[i] = CRGB::Red; 39 | FastLED.show(); 40 | // clear our current dot before we move on 41 | leds[i] = CRGB::Black; 42 | delay(100); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/FastLED/examples/Multiple/MultiArrays/MultiArrays.ino: -------------------------------------------------------------------------------- 1 | // MultiArrays - see https://github.com/FastLED/FastLED/wiki/Multiple-Controller-Examples for more info on 2 | // using multiple controllers. In this example, we're going to set up three NEOPIXEL strips on three 3 | // different pins, each strip getting its own CRGB array to be played with 4 | 5 | #include 6 | 7 | #define NUM_LEDS_PER_STRIP 60 8 | CRGB redLeds[NUM_LEDS_PER_STRIP]; 9 | CRGB greenLeds[NUM_LEDS_PER_STRIP]; 10 | CRGB blueLeds[NUM_LEDS_PER_STRIP]; 11 | 12 | // For mirroring strips, all the "special" stuff happens just in setup. We 13 | // just addLeds multiple times, once for each strip 14 | void setup() { 15 | // tell FastLED there's 60 NEOPIXEL leds on pin 10 16 | FastLED.addLeds(redLeds, NUM_LEDS_PER_STRIP); 17 | 18 | // tell FastLED there's 60 NEOPIXEL leds on pin 11 19 | FastLED.addLeds(greenLeds, NUM_LEDS_PER_STRIP); 20 | 21 | // tell FastLED there's 60 NEOPIXEL leds on pin 12 22 | FastLED.addLeds(blueLeds, NUM_LEDS_PER_STRIP); 23 | 24 | } 25 | 26 | void loop() { 27 | for(int i = 0; i < NUM_LEDS_PER_STRIP; i++) { 28 | // set our current dot to red, green, and blue 29 | redLeds[i] = CRGB::Red; 30 | greenLeds[i] = CRGB::Green; 31 | blueLeds[i] = CRGB::Blue; 32 | FastLED.show(); 33 | // clear our current dot before we move on 34 | redLeds[i] = CRGB::Black; 35 | greenLeds[i] = CRGB::Black; 36 | blueLeds[i] = CRGB::Blue; 37 | delay(100); 38 | } 39 | 40 | for(int i = NUM_LEDS_PER_STRIP-1; i >= 0; i--) { 41 | // set our current dot to red, green, and blue 42 | redLeds[i] = CRGB::Red; 43 | greenLeds[i] = CRGB::Green; 44 | blueLeds[i] = CRGB::Blue; 45 | FastLED.show(); 46 | // clear our current dot before we move on 47 | redLeds[i] = CRGB::Black; 48 | greenLeds[i] = CRGB::Black; 49 | blueLeds[i] = CRGB::Blue; 50 | delay(100); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/FastLED/examples/Multiple/MultipleStripsInOneArray/MultipleStripsInOneArray.ino: -------------------------------------------------------------------------------- 1 | // MultipleStripsInOneArray - see https://github.com/FastLED/FastLED/wiki/Multiple-Controller-Examples for more info on 2 | // using multiple controllers. In this example, we're going to set up four NEOPIXEL strips on three 3 | // different pins, each strip will be referring to a different part of the single led array 4 | 5 | #include 6 | 7 | #define NUM_STRIPS 3 8 | #define NUM_LEDS_PER_STRIP 60 9 | #define NUM_LEDS NUM_LEDS_PER_STRIP * NUM_STRIPS 10 | 11 | CRGB leds[NUM_STRIPS * NUM_LEDS_PER_STRIP]; 12 | 13 | // For mirroring strips, all the "special" stuff happens just in setup. We 14 | // just addLeds multiple times, once for each strip 15 | void setup() { 16 | // tell FastLED there's 60 NEOPIXEL leds on pin 10, starting at index 0 in the led array 17 | FastLED.addLeds(leds, 0, NUM_LEDS_PER_STRIP); 18 | 19 | // tell FastLED there's 60 NEOPIXEL leds on pin 11, starting at index 60 in the led array 20 | FastLED.addLeds(leds, NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP); 21 | 22 | // tell FastLED there's 60 NEOPIXEL leds on pin 12, starting at index 120 in the led array 23 | FastLED.addLeds(leds, 2 * NUM_LEDS_PER_STRIP, NUM_LEDS_PER_STRIP); 24 | 25 | } 26 | 27 | void loop() { 28 | for(int i = 0; i < NUM_LEDS; i++) { 29 | leds[i] = CRGB::Red; 30 | FastLED.show(); 31 | leds[i] = CRGB::Black; 32 | delay(100); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/FastLED/examples/Multiple/OctoWS2811Demo/OctoWS2811Demo.ino: -------------------------------------------------------------------------------- 1 | #define USE_OCTOWS2811 2 | #include 3 | #include 4 | 5 | #define NUM_LEDS_PER_STRIP 64 6 | #define NUM_STRIPS 8 7 | 8 | CRGB leds[NUM_STRIPS * NUM_LEDS_PER_STRIP]; 9 | 10 | // Pin layouts on the teensy 3: 11 | // OctoWS2811: 2,14,7,8,6,20,21,5 12 | 13 | void setup() { 14 | LEDS.addLeds(leds, NUM_LEDS_PER_STRIP); 15 | LEDS.setBrightness(32); 16 | } 17 | 18 | void loop() { 19 | static uint8_t hue = 0; 20 | for(int i = 0; i < NUM_STRIPS; i++) { 21 | for(int j = 0; j < NUM_LEDS_PER_STRIP; j++) { 22 | leds[(i*NUM_LEDS_PER_STRIP) + j] = CHSV((32*i) + hue+j,192,255); 23 | } 24 | } 25 | 26 | // Set the first n leds on each strip to show which strip it is 27 | for(int i = 0; i < NUM_STRIPS; i++) { 28 | for(int j = 0; j <= i; j++) { 29 | leds[(i*NUM_LEDS_PER_STRIP) + j] = CRGB::Red; 30 | } 31 | } 32 | 33 | hue++; 34 | 35 | LEDS.show(); 36 | LEDS.delay(10); 37 | } 38 | -------------------------------------------------------------------------------- /src/FastLED/examples/Multiple/ParallelOutputDemo/ParallelOutputDemo.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define NUM_LEDS_PER_STRIP 64 4 | // Note: this can be 12 if you're using a teensy 3 and don't mind soldering the pads on the back 5 | #define NUM_STRIPS 16 6 | 7 | CRGB leds[NUM_STRIPS * NUM_LEDS_PER_STRIP]; 8 | 9 | // Pin layouts on the teensy 3/3.1: 10 | // WS2811_PORTD: 2,14,7,8,6,20,21,5 11 | // WS2811_PORTC: 15,22,23,9,10,13,11,12,28,27,29,30 (these last 4 are pads on the bottom of the teensy) 12 | // WS2811_PORTDC: 2,14,7,8,6,20,21,5,15,22,23,9,10,13,11,12 - 16 way parallel 13 | // 14 | // Pin layouts on the due 15 | // WS2811_PORTA: 69,68,61,60,59,100,58,31 (note: pin 100 only available on the digix) 16 | // WS2811_PORTB: 90,91,92,93,94,95,96,97 (note: only available on the digix) 17 | // WS2811_PORTD: 25,26,27,28,14,15,29,11 18 | // 19 | 20 | void setup() { 21 | // LEDS.addLeds(leds, NUM_LEDS_PER_STRIP); 22 | // LEDS.addLeds(leds, NUM_LEDS_PER_STRIP); 23 | // LEDS.addLeds(leds, NUM_LEDS_PER_STRIP).setCorrection(TypicalLEDStrip); 24 | LEDS.addLeds(leds, NUM_LEDS_PER_STRIP); 25 | LEDS.setBrightness(32); 26 | } 27 | 28 | void loop() { 29 | static uint8_t hue = 0; 30 | for(int i = 0; i < NUM_STRIPS; i++) { 31 | for(int j = 0; j < NUM_LEDS_PER_STRIP; j++) { 32 | leds[(i*NUM_LEDS_PER_STRIP) + j] = CHSV((32*i) + hue+j,192,255); 33 | } 34 | } 35 | 36 | // Set the first n leds on each strip to show which strip it is 37 | for(int i = 0; i < NUM_STRIPS; i++) { 38 | for(int j = 0; j <= i; j++) { 39 | leds[(i*NUM_LEDS_PER_STRIP) + j] = CRGB::Red; 40 | } 41 | } 42 | 43 | hue++; 44 | 45 | LEDS.show(); 46 | LEDS.delay(10); 47 | } 48 | -------------------------------------------------------------------------------- /src/FastLED/examples/NoisePlayground/NoisePlayground.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define kMatrixWidth 16 4 | #define kMatrixHeight 16 5 | 6 | #define NUM_LEDS (kMatrixWidth * kMatrixHeight) 7 | // Param for different pixel layouts 8 | #define kMatrixSerpentineLayout true 9 | 10 | // led array 11 | CRGB leds[kMatrixWidth * kMatrixHeight]; 12 | 13 | // x,y, & time values 14 | uint32_t x,y,v_time,hue_time,hxy; 15 | 16 | // Play with the values of the variables below and see what kinds of effects they 17 | // have! More octaves will make things slower. 18 | 19 | // how many octaves to use for the brightness and hue functions 20 | uint8_t octaves=1; 21 | uint8_t hue_octaves=3; 22 | 23 | // the 'distance' between points on the x and y axis 24 | int xscale=57771; 25 | int yscale=57771; 26 | 27 | // the 'distance' between x/y points for the hue noise 28 | int hue_scale=1; 29 | 30 | // how fast we move through time & hue noise 31 | int time_speed=1111; 32 | int hue_speed=31; 33 | 34 | // adjust these values to move along the x or y axis between frames 35 | int x_speed=331; 36 | int y_speed=1111; 37 | 38 | void loop() { 39 | // fill the led array 2/16-bit noise values 40 | fill_2dnoise16(LEDS.leds(), kMatrixWidth, kMatrixHeight, kMatrixSerpentineLayout, 41 | octaves,x,xscale,y,yscale,v_time, 42 | hue_octaves,hxy,hue_scale,hxy,hue_scale,hue_time, false); 43 | 44 | LEDS.show(); 45 | 46 | // adjust the intra-frame time values 47 | x += x_speed; 48 | y += y_speed; 49 | v_time += time_speed; 50 | hue_time += hue_speed; 51 | // delay(50); 52 | } 53 | 54 | 55 | void setup() { 56 | // initialize the x/y and time values 57 | random16_set_seed(8934); 58 | random16_add_entropy(analogRead(3)); 59 | 60 | Serial.begin(57600); 61 | Serial.println("resetting!"); 62 | 63 | delay(3000); 64 | LEDS.addLeds(leds,NUM_LEDS); 65 | LEDS.setBrightness(96); 66 | 67 | hxy = (uint32_t)((uint32_t)random16() << 16) + (uint32_t)random16(); 68 | x = (uint32_t)((uint32_t)random16() << 16) + (uint32_t)random16(); 69 | y = (uint32_t)((uint32_t)random16() << 16) + (uint32_t)random16(); 70 | v_time = (uint32_t)((uint32_t)random16() << 16) + (uint32_t)random16(); 71 | hue_time = (uint32_t)((uint32_t)random16() << 16) + (uint32_t)random16(); 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/FastLED/examples/RGBSetDemo/RGBSetDemo.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #define NUM_LEDS 40 3 | 4 | CRGBArray leds; 5 | 6 | void setup() { FastLED.addLeds(leds, NUM_LEDS); } 7 | 8 | void loop(){ 9 | static uint8_t hue; 10 | for(int i = 0; i < NUM_LEDS/2; i++) { 11 | // fade everything out 12 | leds.fadeToBlackBy(40); 13 | 14 | // let's set an led value 15 | leds[i] = CHSV(hue++,255,255); 16 | 17 | // now, let's first 20 leds to the top 20 leds, 18 | leds(NUM_LEDS/2,NUM_LEDS-1) = leds(NUM_LEDS/2 - 1 ,0); 19 | FastLED.delay(33); 20 | } 21 | } 22 | 23 | -------------------------------------------------------------------------------- /src/FastLED/extras/AppleII.s65: -------------------------------------------------------------------------------- 1 | KBD = $C000 ;Read keydown 2 | KBDSTRB = $C010 ;Reset keybd 3 | 4 | SPKR = $C030 ;Toggle speaker 5 | 6 | ; TTL digital output pins on 7 | ; 16-pin DIP game connector 8 | SETAN0 = $C058 9 | CLRAN0 = $C059 10 | SETAN1 = $C05A 11 | CLRAN1 = $C05B 12 | SETAN2 = $C05C 13 | CLRAN2 = $C05D 14 | SETAN3 = $C05E 15 | CLRAN3 = $C05F 16 | 17 | PIN12ON = CLRAN3 18 | PIN12OFF= SETAN3 19 | PIN13ON = CLRAN2 20 | PIN13OFF= SETAN2 21 | PIN14ON = CLRAN1 22 | PIN14OFF= SETAN1 23 | PIN15ON = CLRAN0 24 | PIN15OFF= SETAN0 25 | 26 | ;Special for pin 5, except on //gs 27 | C040STROBE = $C040 28 | PIN5STROBE = C040STROBE 29 | 30 | SolidApple = $C062 ; read SW1 or SA 31 | OpenApple = $C061 ; read SW0 or OA 32 | 33 | VBL = $C019 ; vertical blanking 34 | 35 | WAIT = $FCA8 ; wait a little while 36 | 37 | CROUT = $FD8E ; print a CR 38 | PRBYTE = $FDDA ; print a hex byte 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/FastLED/extras/RainbowDemo.bin.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/CircuitMess-Ringo/14cbc74d1ba067830067e32cebe9189f0266dcfb/src/FastLED/extras/RainbowDemo.bin.zip -------------------------------------------------------------------------------- /src/FastLED/extras/RainbowDemo.s65: -------------------------------------------------------------------------------- 1 | ; "Rainbow with glitter" demo 2 | ; for "FastLED6502" 3 | ; 4 | ; Runs on an Apple ][, ][+, //e, or //gs 5 | ; 6 | ; Supports APA102, Adafruit DotStar, 7 | ; LPD8806, and WS2801 LED strips. 8 | ; 9 | ; LED strip connects to game port pins, 10 | ; see FastLED6502.s65 for details. 11 | ; 12 | ; Mark Kriegsman, February 2015 13 | 14 | #define NUM_LEDS 100 15 | #define BRIGHTNESS 64 16 | #define CHIPSET APA102 17 | #define DATA_PIN 14 18 | #define CLOCK_PIN 5 19 | 20 | * = $6000 21 | 22 | #include "FastLED6502.s65" 23 | #include "AppleII.s65" 24 | 25 | gHue .byt 0 26 | gHueDelta .byt 17 27 | gHueSpeed .byt 7 28 | 29 | 30 | Setup 31 | lda #0 32 | sta gHue 33 | 34 | Loop 35 | lda gHue 36 | clc 37 | adc gHueSpeed 38 | sta gHue 39 | ldx gHue 40 | ldy gHueDelta 41 | ; Fill RGB array with HSV rainbow 42 | jsr FastLED_FillRainbow_XY 43 | ; Use master brightness control 44 | lda #BRIGHTNESS 45 | sta FastLED_Brightness 46 | CheckOpenApple 47 | bit OpenApple 48 | bpl CheckSolidApple 49 | ; Add glitter if requested 50 | jsr AddGlitter 51 | CheckSolidApple 52 | bit SolidApple 53 | bpl DoDisplay 54 | ; Pulse brightness if requested 55 | jsr PulseBrightness 56 | DoDisplay 57 | ; This is where the magic happens 58 | jsr FastLED_Show 59 | jmp Loop 60 | 61 | 62 | AddGlitter 63 | ldy #3 64 | MaybeAdd1Glitter 65 | jsr FastLED_Random8 66 | cmp FastLED_NumPixels 67 | bcs SkipThis1Glitter 68 | tax 69 | lda #$FF 70 | sta ledsR,x 71 | sta ledsG,x 72 | sta ledsB,x 73 | SkipThis1Glitter 74 | dey 75 | bne MaybeAdd1Glitter 76 | rts 77 | 78 | 79 | PulseBrightness 80 | lda #13 81 | jsr FastLED_Beat8 82 | clc 83 | adc #12 84 | bcc PulseBright1 85 | lda #$FF 86 | PulseBright1 87 | sta FastLED_Brightness 88 | rts 89 | -------------------------------------------------------------------------------- /src/FastLED/fastled_progmem.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_FL_PROGMEM_H 2 | #define __INC_FL_PROGMEM_H 3 | 4 | #include "FastLED.h" 5 | 6 | ///@file fastled_progmem.h 7 | /// wrapper definitions to allow seamless use of PROGMEM in environmens that have it 8 | 9 | FASTLED_NAMESPACE_BEGIN 10 | 11 | // Compatibility layer for devices that do or don't 12 | // have "PROGMEM" and the associated pgm_ accessors. 13 | // 14 | // If a platform supports PROGMEM, it should define 15 | // "FASTLED_USE_PROGMEM" as 1, otherwise FastLED will 16 | // fall back to NOT using PROGMEM. 17 | // 18 | // Whether or not pgmspace.h is #included is separately 19 | // controllable by FASTLED_INCLUDE_PGMSPACE, if needed. 20 | 21 | 22 | // If FASTLED_USE_PROGMEM is 1, we'll map FL_PROGMEM 23 | // and the FL_PGM_* accessors to the Arduino equivalents. 24 | #if FASTLED_USE_PROGMEM == 1 25 | #ifndef FASTLED_INCLUDE_PGMSPACE 26 | #define FASTLED_INCLUDE_PGMSPACE 1 27 | #endif 28 | 29 | #if FASTLED_INCLUDE_PGMSPACE == 1 30 | #include 31 | #endif 32 | 33 | #define FL_PROGMEM PROGMEM 34 | 35 | // Note: only the 'near' memory wrappers are provided. 36 | // If you're using 'far' memory, you already have 37 | // portability issues to work through, but you could 38 | // add more support here if needed. 39 | #define FL_PGM_READ_BYTE_NEAR(x) (pgm_read_byte_near(x)) 40 | #define FL_PGM_READ_WORD_NEAR(x) (pgm_read_word_near(x)) 41 | #define FL_PGM_READ_DWORD_NEAR(x) (pgm_read_dword_near(x)) 42 | 43 | // Workaround for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34734 44 | #if __GNUC__ < 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ < 6)) 45 | #ifdef FASTLED_AVR 46 | #ifdef PROGMEM 47 | #undef PROGMEM 48 | #define PROGMEM __attribute__((section(".progmem.data"))) 49 | #endif 50 | #endif 51 | #endif 52 | 53 | #else 54 | // If FASTLED_USE_PROGMEM is 0 or undefined, 55 | // we'll use regular memory (RAM) access. 56 | 57 | //empty PROGMEM simulation 58 | #define FL_PROGMEM 59 | #define FL_PGM_READ_BYTE_NEAR(x) (*((const uint8_t*)(x))) 60 | #define FL_PGM_READ_WORD_NEAR(x) (*((const uint16_t*)(x))) 61 | #define FL_PGM_READ_DWORD_NEAR(x) (*((const uint32_t*)(x))) 62 | 63 | #endif 64 | 65 | 66 | // On some platforms, most notably ARM M0, unaligned access 67 | // to 'PROGMEM' for multibyte values (eg read dword) is 68 | // not allowed and causes a crash. This macro can help 69 | // force 4-byte alignment as needed. The FastLED gradient 70 | // palette code uses 'read dword', and now uses this macro 71 | // to make sure that gradient palettes are 4-byte aligned. 72 | #ifdef FASTLED_ARM 73 | #define FL_ALIGN_PROGMEM __attribute__ ((aligned (4))) 74 | #else 75 | #define FL_ALIGN_PROGMEM 76 | #endif 77 | 78 | 79 | FASTLED_NAMESPACE_END 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /src/FastLED/fastspi_dma.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/CircuitMess-Ringo/14cbc74d1ba067830067e32cebe9189f0266dcfb/src/FastLED/fastspi_dma.h -------------------------------------------------------------------------------- /src/FastLED/fastspi_nop.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_FASTSPI_NOP_H 2 | #define __INC_FASTSPI_NOP_H 3 | 4 | #if 0 // Guard against the arduino ide idiotically including every header file 5 | 6 | #include "FastLED.h" 7 | 8 | FASTLED_NAMESPACE_BEGIN 9 | 10 | /// A nop/stub class, mostly to show the SPI methods that are needed/used by the various SPI chipset implementations. Should 11 | /// be used as a definition for the set of methods that the spi implementation classes should use (since C++ doesn't support the 12 | /// idea of interfaces - it's possible this could be done with virtual classes, need to decide if i want that overhead) 13 | template 14 | class NOPSPIOutput { 15 | Selectable *m_pSelect; 16 | 17 | public: 18 | NOPSPIOutput() { m_pSelect = NULL; } 19 | NOPSPIOutput(Selectable *pSelect) { m_pSelect = pSelect; } 20 | 21 | /// set the object representing the selectable 22 | void setSelect(Selectable *pSelect) { m_pSelect = pSelect; } 23 | 24 | /// initialize the SPI subssytem 25 | void init() { /* TODO */ } 26 | 27 | /// latch the CS select 28 | void select() { /* TODO */ } 29 | 30 | /// release the CS select 31 | void release() { /* TODO */ } 32 | 33 | /// wait until all queued up data has been written 34 | void waitFully(); 35 | 36 | /// not the most efficient mechanism in the world - but should be enough for sm16716 and friends 37 | template inline static void writeBit(uint8_t b) { /* TODO */ } 38 | 39 | /// write a byte out via SPI (returns immediately on writing register) 40 | void writeByte(uint8_t b) { /* TODO */ } 41 | /// write a word out via SPI (returns immediately on writing register) 42 | void writeWord(uint16_t w) { /* TODO */ } 43 | 44 | /// A raw set of writing byte values, assumes setup/init/waiting done elsewhere (static for use by adjustment classes) 45 | static void writeBytesValueRaw(uint8_t value, int len) { /* TODO */ } 46 | 47 | /// A full cycle of writing a value for len bytes, including select, release, and waiting 48 | void writeBytesValue(uint8_t value, int len) { /* TODO */ } 49 | 50 | /// A full cycle of writing a raw block of data out, including select, release, and waiting 51 | void writeBytes(uint8_t *data, int len) { /* TODO */ } 52 | 53 | /// write a single bit out, which bit from the passed in byte is determined by template parameter 54 | template inline static void writeBit(uint8_t b) { /* TODO */ } 55 | 56 | /// write out pixel data from the given PixelController object 57 | template void writePixels(PixelController pixels) { /* TODO */ } 58 | 59 | }; 60 | 61 | FASTLED_NAMESPACE_END 62 | 63 | #endif 64 | #endif 65 | -------------------------------------------------------------------------------- /src/FastLED/fastspi_types.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_FASTSPI_TYPES_H 2 | #define __INC_FASTSPI_TYPES_H 3 | 4 | #include "FastLED.h" 5 | 6 | FASTLED_NAMESPACE_BEGIN 7 | 8 | // Some helper macros for getting at mis-ordered byte values 9 | #define SPI_B0 (RGB_BYTE0(RGB_ORDER) + (MASK_SKIP_BITS & SKIP)) 10 | #define SPI_B1 (RGB_BYTE1(RGB_ORDER) + (MASK_SKIP_BITS & SKIP)) 11 | #define SPI_B2 (RGB_BYTE2(RGB_ORDER) + (MASK_SKIP_BITS & SKIP)) 12 | #define SPI_ADVANCE (3 + (MASK_SKIP_BITS & SKIP)) 13 | 14 | /// Some of the SPI controllers will need to perform a transform on each byte before doing 15 | /// anyting with it. Creating a class of this form and passing it in as a template parameter to 16 | /// writeBytes/writeBytes3 below will ensure that the body of this method will get called on every 17 | /// byte worked on. Recommendation, make the adjust method aggressively inlined. 18 | /// 19 | /// TODO: Convinience macro for building these 20 | class DATA_NOP { 21 | public: 22 | static __attribute__((always_inline)) inline uint8_t adjust(register uint8_t data) { return data; } 23 | static __attribute__((always_inline)) inline uint8_t adjust(register uint8_t data, register uint8_t scale) { return scale8(data, scale); } 24 | static __attribute__((always_inline)) inline void postBlock(int /* len */) { } 25 | }; 26 | 27 | #define FLAG_START_BIT 0x80 28 | #define MASK_SKIP_BITS 0x3F 29 | 30 | // Clock speed dividers 31 | #define SPEED_DIV_2 2 32 | #define SPEED_DIV_4 4 33 | #define SPEED_DIV_8 8 34 | #define SPEED_DIV_16 16 35 | #define SPEED_DIV_32 32 36 | #define SPEED_DIV_64 64 37 | #define SPEED_DIV_128 128 38 | 39 | #define MAX_DATA_RATE 0 40 | 41 | FASTLED_NAMESPACE_END 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /src/FastLED/led_sysdefs.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_LED_SYSDEFS_H 2 | #define __INC_LED_SYSDEFS_H 3 | 4 | #include "FastLED.h" 5 | 6 | #include "fastled_config.h" 7 | 8 | #if defined(NRF51) || defined(__RFduino__) || defined (__Simblee__) 9 | #include "platforms/arm/nrf51/led_sysdefs_arm_nrf51.h" 10 | #elif defined(__MK20DX128__) || defined(__MK20DX256__) 11 | // Include k20/T3 headers 12 | #include "platforms/arm/k20/led_sysdefs_arm_k20.h" 13 | #elif defined(__MK66FX1M0__) || defined(__MK64FX512__) 14 | // Include k66/T3.6 headers 15 | #include "platforms/arm/k66/led_sysdefs_arm_k66.h" 16 | #elif defined(__MKL26Z64__) 17 | // Include kl26/T-LC headers 18 | #include "platforms/arm/kl26/led_sysdefs_arm_kl26.h" 19 | #elif defined(__SAM3X8E__) 20 | // Include sam/due headers 21 | #include "platforms/arm/sam/led_sysdefs_arm_sam.h" 22 | #elif defined(STM32F10X_MD) || defined(__STM32F1__) 23 | #include "platforms/arm/stm32/led_sysdefs_arm_stm32.h" 24 | #elif defined(__SAMD21G18A__) || defined(__SAMD21J18A__) || defined(__SAMD21E17A__) || defined(__SAMD21E18A__) 25 | #include "platforms/arm/d21/led_sysdefs_arm_d21.h" 26 | #elif defined(ESP8266) 27 | #include "platforms/esp/8266/led_sysdefs_esp8266.h" 28 | #elif defined(ESP32) 29 | #include "platforms/esp/32/led_sysdefs_esp32.h" 30 | #else 31 | // AVR platforms 32 | #include "platforms/avr/led_sysdefs_avr.h" 33 | #endif 34 | 35 | #ifndef FASTLED_NAMESPACE_BEGIN 36 | #define FASTLED_NAMESPACE_BEGIN 37 | #define FASTLED_NAMESPACE_END 38 | #define FASTLED_USING_NAMESPACE 39 | #endif 40 | 41 | // Arduino.h needed for convenience functions digitalPinToPort/BitMask/portOutputRegister and the pinMode methods. 42 | #ifdef ARDUINO 43 | #include 44 | #endif 45 | 46 | #define CLKS_PER_US (F_CPU/1000000) 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /src/FastLED/lib8tion/random8.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_LIB8TION_RANDOM_H 2 | #define __INC_LIB8TION_RANDOM_H 3 | ///@ingroup lib8tion 4 | 5 | ///@defgroup Random Fast random number generators 6 | /// Fast 8- and 16- bit unsigned random numbers. 7 | /// Significantly faster than Arduino random(), but 8 | /// also somewhat less random. You can add entropy. 9 | ///@{ 10 | 11 | // X(n+1) = (2053 * X(n)) + 13849) 12 | #define FASTLED_RAND16_2053 ((uint16_t)(2053)) 13 | #define FASTLED_RAND16_13849 ((uint16_t)(13849)) 14 | 15 | /// random number seed 16 | extern uint16_t rand16seed;// = RAND16_SEED; 17 | 18 | /// Generate an 8-bit random number 19 | LIB8STATIC uint8_t random8() 20 | { 21 | rand16seed = (rand16seed * FASTLED_RAND16_2053) + FASTLED_RAND16_13849; 22 | // return the sum of the high and low bytes, for better 23 | // mixing and non-sequential correlation 24 | return (uint8_t)(((uint8_t)(rand16seed & 0xFF)) + 25 | ((uint8_t)(rand16seed >> 8))); 26 | } 27 | 28 | /// Generate a 16 bit random number 29 | LIB8STATIC uint16_t random16() 30 | { 31 | rand16seed = (rand16seed * FASTLED_RAND16_2053) + FASTLED_RAND16_13849; 32 | return rand16seed; 33 | } 34 | 35 | /// Generate an 8-bit random number between 0 and lim 36 | /// @param lim the upper bound for the result 37 | LIB8STATIC uint8_t random8(uint8_t lim) 38 | { 39 | uint8_t r = random8(); 40 | r = (r*lim) >> 8; 41 | return r; 42 | } 43 | 44 | /// Generate an 8-bit random number in the given range 45 | /// @param min the lower bound for the random number 46 | /// @param lim the upper bound for the random number 47 | LIB8STATIC uint8_t random8(uint8_t min, uint8_t lim) 48 | { 49 | uint8_t delta = lim - min; 50 | uint8_t r = random8(delta) + min; 51 | return r; 52 | } 53 | 54 | /// Generate an 16-bit random number between 0 and lim 55 | /// @param lim the upper bound for the result 56 | LIB8STATIC uint16_t random16( uint16_t lim) 57 | { 58 | uint16_t r = random16(); 59 | uint32_t p = (uint32_t)lim * (uint32_t)r; 60 | r = p >> 16; 61 | return r; 62 | } 63 | 64 | /// Generate an 16-bit random number in the given range 65 | /// @param min the lower bound for the random number 66 | /// @param lim the upper bound for the random number 67 | LIB8STATIC uint16_t random16( uint16_t min, uint16_t lim) 68 | { 69 | uint16_t delta = lim - min; 70 | uint16_t r = random16( delta) + min; 71 | return r; 72 | } 73 | 74 | /// Set the 16-bit seed used for the random number generator 75 | LIB8STATIC void random16_set_seed( uint16_t seed) 76 | { 77 | rand16seed = seed; 78 | } 79 | 80 | /// Get the current seed value for the random number generator 81 | LIB8STATIC uint16_t random16_get_seed() 82 | { 83 | return rand16seed; 84 | } 85 | 86 | /// Add entropy into the random number generator 87 | LIB8STATIC void random16_add_entropy( uint16_t entropy) 88 | { 89 | rand16seed += entropy; 90 | } 91 | 92 | ///@} 93 | 94 | #endif 95 | -------------------------------------------------------------------------------- /src/FastLED/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "FastLED", 3 | "description": "FastLED is a library for programming addressable rgb led strips (APA102/Dotstar, WS2812/Neopixel, LPD8806, and a dozen others) acting both as a driver and as a library for color management and fast math.", 4 | "keywords": "led,noise,rgb,math,fast", 5 | "authors": [ 6 | { 7 | "name": "Daniel Garcia", 8 | "url": "https://github.com/focalintent", 9 | "maintainer": true 10 | }, 11 | { 12 | "name": "Mark Kriegsman", 13 | "url": "https://github.com/kriegsman", 14 | "maintainer": true 15 | } 16 | ], 17 | "repository": { 18 | "type": "git", 19 | "url": "https://github.com/FastLED/FastLED.git" 20 | }, 21 | "version": "3.2.1", 22 | "license": "MIT", 23 | "homepage": "http://fastled.io", 24 | "frameworks": "arduino", 25 | "platforms": "atmelavr, atmelsam, freescalekinetis, nordicnrf51, nxplpc, ststm32, teensy, espressif8266, espressif32", 26 | "build": { 27 | "libArchive": false 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/FastLED/library.properties: -------------------------------------------------------------------------------- 1 | name=FastLED 2 | version=3.2.1 3 | author=Daniel Garcia 4 | maintainer=Daniel Garcia 5 | sentence=Multi-platform library for controlling dozens of different types of LEDs along with optimized math, effect, and noise functions. 6 | paragraph=Multi-platform library for controlling dozens of different types of LEDs along with optimized math, effect, and noise functions. 7 | category=Display 8 | url=https://github.com/FastLED/FastLED 9 | architectures=* 10 | -------------------------------------------------------------------------------- /src/FastLED/platforms.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_PLATFORMS_H 2 | #define __INC_PLATFORMS_H 3 | 4 | #include "FastLED.h" 5 | 6 | #include "fastled_config.h" 7 | 8 | #if defined(NRF51) 9 | #include "platforms/arm/nrf51/fastled_arm_nrf51.h" 10 | #elif defined(__MK20DX128__) || defined(__MK20DX256__) 11 | // Include k20/T3 headers 12 | #include "platforms/arm/k20/fastled_arm_k20.h" 13 | #elif defined(__MK66FX1M0__) || defined(__MK64FX512__) 14 | // Include k66/T3.6 headers 15 | #include "platforms/arm/k66/fastled_arm_k66.h" 16 | #elif defined(__MKL26Z64__) 17 | // Include kl26/T-LC headers 18 | #include "platforms/arm/kl26/fastled_arm_kl26.h" 19 | #elif defined(__SAM3X8E__) 20 | // Include sam/due headers 21 | #include "platforms/arm/sam/fastled_arm_sam.h" 22 | #elif defined(STM32F10X_MD) || defined(__STM32F1__) 23 | #include "platforms/arm/stm32/fastled_arm_stm32.h" 24 | #elif defined(__SAMD21G18A__) || defined(__SAMD21J18A__) || defined(__SAMD21E17A__) || defined(__SAMD21E18A__) 25 | #include "platforms/arm/d21/fastled_arm_d21.h" 26 | #elif defined(ESP8266) 27 | #include "platforms/esp/8266/fastled_esp8266.h" 28 | #elif defined(ESP32) 29 | #include "platforms/esp/32/fastled_esp32.h" 30 | #else 31 | // AVR platforms 32 | #include "platforms/avr/fastled_avr.h" 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/FastLED/platforms/avr/fastled_avr.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_FASTLED_AVR_H 2 | #define __INC_FASTLED_AVR_H 3 | 4 | #include "fastpin_avr.h" 5 | #include "fastspi_avr.h" 6 | #include "clockless_trinket.h" 7 | 8 | // Default to using PROGMEM 9 | #ifndef FASTLED_USE_PROGMEM 10 | #define FASTLED_USE_PROGMEM 1 11 | #endif 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /src/FastLED/platforms/avr/led_sysdefs_avr.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_LED_SYSDEFS_AVR_H 2 | #define __INC_LED_SYSDEFS_AVR_H 3 | 4 | #define FASTLED_AVR 5 | 6 | #ifndef INTERRUPT_THRESHOLD 7 | #define INTERRUPT_THRESHOLD 2 8 | #endif 9 | 10 | #define FASTLED_SPI_BYTE_ONLY 11 | 12 | #include 13 | #include // for cli/se definitions 14 | 15 | // Define the register types 16 | typedef volatile uint8_t RoReg; /**< Read only 8-bit register (volatile const unsigned int) */ 17 | typedef volatile uint8_t RwReg; /**< Read-Write 8-bit register (volatile unsigned int) */ 18 | 19 | 20 | // Default to disallowing interrupts (may want to gate this on teensy2 vs. other arm platforms, since the 21 | // teensy2 has a good, fast millis interrupt implementation) 22 | #ifndef FASTLED_ALLOW_INTERRUPTS 23 | #define FASTLED_ALLOW_INTERRUPTS 0 24 | #endif 25 | 26 | #if FASTLED_ALLOW_INTERRUPTS == 1 27 | #define FASTLED_ACCURATE_CLOCK 28 | #endif 29 | 30 | 31 | // Default to using PROGMEM here 32 | #ifndef FASTLED_USE_PROGMEM 33 | #define FASTLED_USE_PROGMEM 1 34 | #endif 35 | 36 | #if defined(ARDUINO_AVR_DIGISPARK) || defined(ARDUINO_AVR_DIGISPARKPRO) 37 | #ifndef NO_CORRECTION 38 | #define NO_CORRECTION 1 39 | #endif 40 | #endif 41 | 42 | extern "C" { 43 | # if defined(CORE_TEENSY) || defined(TEENSYDUINO) 44 | extern volatile unsigned long timer0_millis_count; 45 | # define MS_COUNTER timer0_millis_count 46 | # elif defined(ATTINY_CORE) 47 | extern volatile unsigned long millis_timer_millis; 48 | # define MS_COUNTER millis_timer_millis 49 | # else 50 | extern volatile unsigned long timer0_millis; 51 | # define MS_COUNTER timer0_millis 52 | # endif 53 | }; 54 | 55 | // special defs for the tiny environments 56 | #if defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega8U2__) || defined(__AVR_AT90USB162__) || defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__) || defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) || defined(__AVR_ATtiny167__) || defined(__AVR_ATtiny87__) || defined(__AVR_ATtinyX41__) 57 | #define LIB8_ATTINY 1 58 | #define FASTLED_NEEDS_YIELD 59 | #endif 60 | 61 | #if defined(ARDUINO) && (ARDUINO > 150) && !defined(IS_BEAN) && !defined (ARDUINO_AVR_DIGISPARK) && !defined (LIB8_TINY) 62 | // don't need YIELD defined by the library 63 | #else 64 | #define FASTLED_NEEDS_YIELD 65 | extern "C" void yield(); 66 | #endif 67 | #endif 68 | -------------------------------------------------------------------------------- /src/FastLED/platforms/esp/32/fastled_esp32.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "fastpin_esp32.h" 4 | #include "clockless_esp32.h" 5 | // #include "clockless_block_esp32.h" 6 | -------------------------------------------------------------------------------- /src/FastLED/platforms/esp/32/led_sysdefs_esp32.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef ESP32 4 | #define ESP32 5 | #endif 6 | 7 | #define FASTLED_ESP32 8 | 9 | // Use system millis timer 10 | #define FASTLED_HAS_MILLIS 11 | 12 | typedef volatile uint32_t RoReg; 13 | typedef volatile uint32_t RwReg; 14 | typedef unsigned long prog_uint32_t; 15 | typedef bool boolean; 16 | 17 | // Default to NOT using PROGMEM here 18 | #ifndef FASTLED_USE_PROGMEM 19 | # define FASTLED_USE_PROGMEM 0 20 | #endif 21 | 22 | #ifndef FASTLED_ALLOW_INTERRUPTS 23 | # define FASTLED_ALLOW_INTERRUPTS 1 24 | # define INTERRUPT_THRESHOLD 0 25 | #endif 26 | 27 | #define NEED_CXX_BITS 28 | 29 | // These can be overridden 30 | # define FASTLED_ESP32_RAW_PIN_ORDER 31 | 32 | // #define cli() os_intr_lock(); 33 | // #define sei() os_intr_lock(); 34 | -------------------------------------------------------------------------------- /src/FastLED/platforms/esp/8266/fastled_esp8266.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "fastpin_esp8266.h" 4 | #include "clockless_esp8266.h" 5 | #include "clockless_block_esp8266.h" 6 | -------------------------------------------------------------------------------- /src/FastLED/platforms/esp/8266/led_sysdefs_esp8266.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef ESP8266 4 | #define ESP8266 5 | #endif 6 | 7 | #define FASTLED_ESP8266 8 | 9 | // Use system millis timer 10 | #define FASTLED_HAS_MILLIS 11 | 12 | typedef volatile uint32_t RoReg; 13 | typedef volatile uint32_t RwReg; 14 | typedef uint32_t prog_uint32_t; 15 | typedef uint8_t boolean; 16 | 17 | // Default to NOT using PROGMEM here 18 | #ifndef FASTLED_USE_PROGMEM 19 | # define FASTLED_USE_PROGMEM 0 20 | #endif 21 | 22 | #ifndef FASTLED_ALLOW_INTERRUPTS 23 | # define FASTLED_ALLOW_INTERRUPTS 1 24 | # define INTERRUPT_THRESHOLD 0 25 | #endif 26 | 27 | #define NEED_CXX_BITS 28 | 29 | // These can be overridden 30 | #if !defined(FASTLED_ESP8266_RAW_PIN_ORDER) && !defined(FASTLED_ESP8266_NODEMCU_PIN_ORDER) && !defined(FASTLED_ESP8266_D1_PIN_ORDER) 31 | # ifdef ARDUINO_ESP8266_NODEMCU 32 | # define FASTLED_ESP8266_NODEMCU_PIN_ORDER 33 | # else 34 | # define FASTLED_ESP8266_RAW_PIN_ORDER 35 | # endif 36 | #endif 37 | 38 | // #define cli() os_intr_lock(); 39 | // #define sei() os_intr_lock(); 40 | -------------------------------------------------------------------------------- /src/FastLED/preview_changes.txt: -------------------------------------------------------------------------------- 1 | FastLED 3.1 preview changes: 2 | * UART in SPI mode support on AVR 3 | * Support for using both hardware SPI pinsets on the Teensy 3.x - 11/13 and 7/14. 4 | * Added UCS1904 support 5 | * Better AVR cycle counting 6 | * Split WS2812/WS2811 timings 7 | * Added DOTSTAR definition for adafruit dotstar pixels (aka APA102) 8 | * 8-way parallel output on teensy 3, 3.1 (portc,portd), due/digix (porta, portb, portd) 9 | * 12-way parallel output on teensy 3, 3.1 (portc) 10 | * 16-way parallel output on teensy 3, 3.1 (portc & portd paired) 11 | * refresh rate limiting 12 | * interrupt friendly code on teensy 3/3.1 13 | * -interrupt friendly code on AVR- <-- disabled for now 14 | * interrupt friendly code on the due 15 | * code re-org for future wider platform support 16 | * Spark Core support 17 | * arduino zero support (no hardware spi yet) 18 | * greatly improved clockless output for avr 19 | * greatly improved clockless output for arm m0 boards 20 | -------------------------------------------------------------------------------- /src/TFT_eSPI/.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /src/TFT_eSPI/.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | # Windows shortcuts 18 | *.lnk 19 | 20 | # ========================= 21 | # Operating System Files 22 | # ========================= 23 | 24 | # OSX 25 | # ========================= 26 | 27 | .DS_Store 28 | .AppleDouble 29 | .LSOverride 30 | 31 | # Thumbnails 32 | ._* 33 | 34 | # Files that might appear in the root of a volume 35 | .DocumentRevisions-V100 36 | .fseventsd 37 | .Spotlight-V100 38 | .TemporaryItems 39 | .Trashes 40 | .VolumeIcon.icns 41 | 42 | # Directories potentially created on remote AFP share 43 | .AppleDB 44 | .AppleDesktop 45 | Network Trash Folder 46 | Temporary Items 47 | .apdisk 48 | -------------------------------------------------------------------------------- /src/TFT_eSPI/Fonts/Font16.h: -------------------------------------------------------------------------------- 1 | #include "Font16.c" 2 | 3 | #define nr_chrs_f16 96 4 | #define chr_hgt_f16 16 5 | #define baseline_f16 13 6 | #define data_size_f16 8 7 | #define firstchr_f16 32 8 | 9 | extern const unsigned char widtbl_f16[96]; 10 | extern const unsigned char* const chrtbl_f16[96]; 11 | -------------------------------------------------------------------------------- /src/TFT_eSPI/Fonts/Font7srle.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define nr_chrs_f7s 96 4 | #define chr_hgt_f7s 48 5 | #define baseline_f7s 47 6 | #define data_size_f7s 8 7 | #define firstchr_f7s 32 8 | 9 | extern const unsigned char widtbl_f7s[96]; 10 | extern const unsigned char* const chrtbl_f7s[96]; 11 | -------------------------------------------------------------------------------- /src/TFT_eSPI/Fonts/GFXFF/gfxfont.h: -------------------------------------------------------------------------------- 1 | // Adopted by Bodmer to support TFT_HX8357_Due library. 2 | 3 | // Font structures for newer Adafruit_GFX (1.1 and later). 4 | // Example fonts are included in 'Fonts' directory. 5 | // To use a font in your Arduino sketch, #include the corresponding .h 6 | // file and pass address of GFXfont struct to setFont(). Pass NULL to 7 | // revert to 'classic' fixed-space bitmap font. 8 | 9 | #ifndef _GFXFONT_H_ 10 | #define _GFXFONT_H_ 11 | 12 | #ifdef LOAD_GFXFF 13 | 14 | typedef struct { // Data stored PER GLYPH 15 | uint16_t bitmapOffset; // Pointer into GFXfont->bitmap 16 | uint8_t width, height; // Bitmap dimensions in pixels 17 | uint8_t xAdvance; // Distance to advance cursor (x axis) 18 | int8_t xOffset, yOffset; // Dist from cursor pos to UL corner 19 | } GFXglyph; 20 | 21 | typedef struct { // Data stored for FONT AS A WHOLE: 22 | uint8_t *bitmap; // Glyph bitmaps, concatenated 23 | GFXglyph *glyph; // Glyph array 24 | uint8_t first, last; // ASCII extents 25 | uint8_t yAdvance; // Newline distance (y axis) 26 | } GFXfont; 27 | 28 | #endif // LOAD_GFXFF 29 | 30 | #endif // _GFXFONT_H_ 31 | -------------------------------------------------------------------------------- /src/TFT_eSPI/Fonts/GFXFF/license.txt: -------------------------------------------------------------------------------- 1 | This TFT_eSPI library has been developed from the Adafruit_GFX library: 2 | 3 | https://github.com/adafruit/Adafruit-GFX-Library 4 | 5 | It has been modified extensively to improve rendering speed on 6 | ESP8266 processors. There follows the original library license text. 7 | 8 | 9 | Original text follows: 10 | 11 | Software License Agreement (BSD License) 12 | 13 | Copyright (c) 2012 Adafruit Industries. All rights reserved. 14 | 15 | Redistribution and use in source and binary forms, with or without 16 | modification, are permitted provided that the following conditions are met: 17 | 18 | - Redistributions of source code must retain the above copyright notice, 19 | this list of conditions and the following disclaimer. 20 | - Redistributions in binary form must reproduce the above copyright notice, 21 | this list of conditions and the following disclaimer in the documentation 22 | and/or other materials provided with the distribution. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 28 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 31 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 32 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 33 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 34 | POSSIBILITY OF SUCH DAMAGE. 35 | -------------------------------------------------------------------------------- /src/TFT_eSPI/Fonts/GFXFF/print.txt: -------------------------------------------------------------------------------- 1 | #define TT1 TomThumb 2 | 3 | #define FF1 FreeMono9pt7b 4 | #define FF2 FreeMono12pt7b 5 | #define FF3 FreeMono18pt7b 6 | #define FF4 FreeMono24pt7b 7 | 8 | #define FF5 FreeMonoBold9pt7b 9 | #define FF6 FreeMonoBold12pt7b 10 | #define FF7 FreeMonoBold18pt7b 11 | #define FF8 FreeMonoBold24pt7b 12 | 13 | #define FF9 FreeMonoBoldOblique9pt7b 14 | #define FF10 FreeMonoBoldOblique12pt7b 15 | #define FF11 FreeMonoBoldOblique18pt7b 16 | #define FF12 FreeMonoBoldOblique24pt7b 17 | 18 | #define FF13 FreeMonoOblique9pt7b 19 | #define FF14 FreeMonoOblique12pt7b 20 | #define FF15 FreeMonoOblique18pt7b 21 | #define FF16 FreeMonoOblique24pt7b 22 | 23 | #define FF17 FreeSans9pt7b 24 | #define FF18 FreeSans12pt7b 25 | #define FF19 FreeSans18pt7b 26 | #define FF20 FreeSans24pt7b 27 | 28 | #define FF21 FreeSansBold9pt7b 29 | #define FF22 FreeSansBold12pt7b 30 | #define FF23 FreeSansBold18pt7b 31 | #define FF24 FreeSansBold24pt7b 32 | 33 | #define FF25 FreeSansBoldOblique9pt7b 34 | #define FF26 FreeSansBoldOblique12pt7b 35 | #define FF27 FreeSansBoldOblique18pt7b 36 | #define FF28 FreeSansBoldOblique24pt7b 37 | 38 | #define FF29 FreeSansOblique9pt7b 39 | #define FF30 FreeSansOblique12pt7b 40 | #define FF31 FreeSansOblique18pt7b 41 | #define FF32 FreeSansOblique24pt7b 42 | 43 | #define FF33 FreeSerif9pt7b 44 | #define FF34 FreeSerif12pt7b 45 | #define FF35 FreeSerif18pt7b 46 | #define FF36 FreeSerif24pt7b 47 | 48 | #define FF37 FreeSerifBold9pt7b 49 | #define FF38 FreeSerifBold12pt7b 50 | #define FF39 FreeSerifBold18pt7b 51 | #define FF40 FreeSerifBold24pt7b 52 | 53 | #define FF41 FreeSerifBoldItalic9pt7b 54 | #define FF42 FreeSerifBoldItalic12pt7b 55 | #define FF43 FreeSerifBoldItalic18pt7b 56 | #define FF44 FreeSerifBoldItalic24pt7b 57 | 58 | #define FF45 FreeSerifItalic9pt7b 59 | #define FF46 FreeSerifItalic12pt7b 60 | #define FF47 FreeSerifItalic18pt7b 61 | #define FF48 FreeSerifItalic24pt7b 62 | -------------------------------------------------------------------------------- /src/TFT_eSPI/Fonts/TrueType/Not_yet_supported.txt: -------------------------------------------------------------------------------- 1 | TO DO: Add support for converted True Type fonts in an RLE format. -------------------------------------------------------------------------------- /src/TFT_eSPI/README.txt: -------------------------------------------------------------------------------- 1 | This is a standalone library that contains both graphics functions 2 | and the TFT chip driver library. 3 | 4 | This library has been derived from the Adafruit_GFX and driver library with 5 | further code from other authors. 6 | 7 | It is not compatible with legacy versions of the IDE (e.g. 1.0.6 and 8 | older. Use the latest version. 9 | 10 | New functions have been added in particular it contains proportional fonts 11 | in addition to the original Adafruit font. 12 | 13 | A sprite class has been added to aid the generation of flicker free complex 14 | graphics. 15 | 16 | Note: This version of the library might not be fully compatible with the 17 | original. 18 | 19 | -------------------------------------------------------------------------------- /src/TFT_eSPI/TFT_Drivers/EPD_Defines.h: -------------------------------------------------------------------------------- 1 | // Null set for ePaper 2 | #define TFT_WIDTH 1000 3 | #define TFT_HEIGHT 1000 4 | 5 | #define TFT_INIT_DELAY 0 6 | 7 | #define TFT_NOP 0x00 8 | #define TFT_SWRST 0x00 9 | 10 | #define TFT_CASET 0x00 11 | #define TFT_PASET 0x00 12 | #define TFT_RAMWR 0x00 13 | 14 | #define TFT_RAMRD 0x00 15 | #define TFT_IDXRD 0x00 16 | 17 | #define TFT_MADCTL 0x00 18 | #define TFT_MAD_MY 0x00 19 | #define TFT_MAD_MX 0x00 20 | #define TFT_MAD_MV 0x00 21 | #define TFT_MAD_ML 0x00 22 | #define TFT_MAD_BGR 0x00 23 | #define TFT_MAD_MH 0x00 24 | #define TFT_MAD_RGB 0x00 25 | 26 | #define TFT_INVOFF 0x00 27 | #define TFT_INVON 0x00 28 | -------------------------------------------------------------------------------- /src/TFT_eSPI/TFT_Drivers/HX8357D_Defines.h: -------------------------------------------------------------------------------- 1 | // Change the width and height if required (defined in portrait mode) 2 | // or use the constructor to over-ride defaults 3 | #define TFT_WIDTH 320 4 | #define TFT_HEIGHT 480 5 | 6 | 7 | // Delay between some initialisation commands 8 | #define TFT_INIT_DELAY 0x80 // Not used unless commandlist invoked 9 | 10 | 11 | // Generic commands used by TFT_eSPar.cpp 12 | #define TFT_NOP 0x00 13 | #define TFT_SWRST 0x01 14 | 15 | #define TFT_SLPIN 0x10 16 | #define TFT_SLPOUT 0x11 17 | 18 | #define TFT_INVOFF 0x20 19 | #define TFT_INVON 0x21 20 | 21 | #define TFT_DISPOFF 0x28 22 | #define TFT_DISPON 0x29 23 | 24 | #define TFT_CASET 0x2A 25 | #define TFT_PASET 0x2B 26 | #define TFT_RAMWR 0x2C 27 | 28 | #define TFT_RAMRD 0x2E 29 | 30 | #define TFT_MADCTL 0x36 31 | 32 | #define TFT_MAD_MY 0x80 33 | #define TFT_MAD_MX 0x40 34 | #define TFT_MAD_MV 0x20 35 | #define TFT_MAD_ML 0x10 36 | #define TFT_MAD_RGB 0x00 37 | #define TFT_MAD_BGR 0x08 38 | #define TFT_MAD_MH 0x04 39 | #define TFT_MAD_SS 0x02 40 | #define TFT_MAD_GS 0x01 41 | 42 | #define TFT_IDXRD 0x00 // ILI9341 only, indexed control register read 43 | 44 | 45 | #define HX8357_NOP 0x00 46 | #define HX8357_SWRESET 0x01 47 | #define HX8357_RDDID 0x04 48 | #define HX8357_RDDST 0x09 49 | 50 | #define HX8357_RDPOWMODE 0x0A 51 | #define HX8357_RDMADCTL 0x0B 52 | #define HX8357_RDCOLMOD 0x0C 53 | #define HX8357_RDDIM 0x0D 54 | #define HX8357_RDDSDR 0x0F 55 | 56 | #define HX8357_SLPIN 0x10 57 | #define HX8357_SLPOUT 0x11 58 | 59 | #define HX8357_INVOFF 0x20 60 | #define HX8357_INVON 0x21 61 | #define HX8357_DISPOFF 0x28 62 | #define HX8357_DISPON 0x29 63 | 64 | #define HX8357_CASET 0x2A 65 | #define HX8357_PASET 0x2B 66 | #define HX8357_RAMWR 0x2C 67 | #define HX8357_RAMRD 0x2E 68 | 69 | #define HX8357_TEON 0x35 70 | #define HX8357_TEARLINE 0x44 71 | #define HX8357_MADCTL 0x36 72 | #define HX8357_COLMOD 0x3A 73 | 74 | #define HX8357_SETOSC 0xB0 75 | #define HX8357_SETPWR1 0xB1 76 | #define HX8357_SETRGB 0xB3 77 | #define HX8357D_SETCOM 0xB6 78 | 79 | #define HX8357D_SETCYC 0xB4 80 | #define HX8357D_SETC 0xB9 81 | 82 | #define HX8357D_SETSTBA 0xC0 83 | 84 | #define HX8357_SETPANEL 0xCC 85 | 86 | #define HX8357D_SETGAMMA 0xE0 87 | -------------------------------------------------------------------------------- /src/TFT_eSPI/TFT_Drivers/HX8357D_Rotation.h: -------------------------------------------------------------------------------- 1 | // This is the command sequence that rotates the ILI9481 driver coordinate frame 2 | 3 | writecommand(TFT_MADCTL); 4 | rotation = m % 4; 5 | switch (rotation) { 6 | case 0: // Portrait 7 | writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_RGB); 8 | _width = TFT_WIDTH; 9 | _height = TFT_HEIGHT; 10 | break; 11 | case 1: // Landscape (Portrait + 90) 12 | writedata(TFT_MAD_MV | TFT_MAD_MY | TFT_MAD_RGB); 13 | _width = TFT_HEIGHT; 14 | _height = TFT_WIDTH; 15 | break; 16 | case 2: // Inverter portrait 17 | writedata(TFT_MAD_RGB); 18 | _width = TFT_WIDTH; 19 | _height = TFT_HEIGHT; 20 | break; 21 | case 3: // Inverted landscape 22 | writedata(TFT_MAD_MX | TFT_MAD_MV | TFT_MAD_RGB); 23 | _width = TFT_HEIGHT; 24 | _height = TFT_WIDTH; 25 | break; 26 | } 27 | -------------------------------------------------------------------------------- /src/TFT_eSPI/TFT_Drivers/ILI9163_Defines.h: -------------------------------------------------------------------------------- 1 | // Change the width and height if required (defined in portrait mode) 2 | // or use the constructor to over-ride defaults 3 | #ifndef TFT_WIDTH 4 | #define TFT_WIDTH 128 5 | #endif 6 | #ifndef TFT_HEIGHT 7 | #define TFT_HEIGHT 160 8 | #endif 9 | 10 | #if (TFT_HEIGHT == 128) && (TFT_WIDTH == 128) 11 | #define CGRAM_OFFSET 12 | #endif 13 | 14 | // Color definitions for backwards compatibility with old sketches 15 | // use colour definitions like TFT_BLACK to make sketches more portable 16 | #define ILI9163_BLACK 0x0000 /* 0, 0, 0 */ 17 | #define ILI9163_NAVY 0x000F /* 0, 0, 128 */ 18 | #define ILI9163_DARKGREEN 0x03E0 /* 0, 128, 0 */ 19 | #define ILI9163_DARKCYAN 0x03EF /* 0, 128, 128 */ 20 | #define ILI9163_MAROON 0x7800 /* 128, 0, 0 */ 21 | #define ILI9163_PURPLE 0x780F /* 128, 0, 128 */ 22 | #define ILI9163_OLIVE 0x7BE0 /* 128, 128, 0 */ 23 | #define ILI9163_LIGHTGREY 0xC618 /* 192, 192, 192 */ 24 | #define ILI9163_DARKGREY 0x7BEF /* 128, 128, 128 */ 25 | #define ILI9163_BLUE 0x001F /* 0, 0, 255 */ 26 | #define ILI9163_GREEN 0x07E0 /* 0, 255, 0 */ 27 | #define ILI9163_CYAN 0x07FF /* 0, 255, 255 */ 28 | #define ILI9163_RED 0xF800 /* 255, 0, 0 */ 29 | #define ILI9163_MAGENTA 0xF81F /* 255, 0, 255 */ 30 | #define ILI9163_YELLOW 0xFFE0 /* 255, 255, 0 */ 31 | #define ILI9163_WHITE 0xFFFF /* 255, 255, 255 */ 32 | #define ILI9163_ORANGE 0xFD20 /* 255, 165, 0 */ 33 | #define ILI9163_GREENYELLOW 0xAFE5 /* 173, 255, 47 */ 34 | #define ILI9163_PINK 0xF81F 35 | 36 | 37 | // Delay between some initialisation commands 38 | #define TFT_INIT_DELAY 0x80 39 | 40 | 41 | // Generic commands used by TFT_eSPI.cpp 42 | #define TFT_NOP 0x00 43 | #define TFT_SWRST 0x01 44 | 45 | #define TFT_CASET 0x2A 46 | #define TFT_PASET 0x2B 47 | #define TFT_RAMWR 0x2C 48 | 49 | #define TFT_RAMRD 0x2E 50 | #define TFT_IDXRD 0x00 //0xDD // ILI9341 only, indexed control register read 51 | 52 | #define TFT_MADCTL 0x36 53 | #define TFT_MAD_MY 0x80 54 | #define TFT_MAD_MX 0x40 55 | #define TFT_MAD_MV 0x20 56 | #define TFT_MAD_ML 0x10 57 | #define TFT_MAD_BGR 0x08 58 | #define TFT_MAD_MH 0x04 59 | #define TFT_MAD_RGB 0x00 60 | 61 | #define TFT_INVOFF 0x20 62 | #define TFT_INVON 0x21 63 | -------------------------------------------------------------------------------- /src/TFT_eSPI/TFT_Drivers/ILI9163_Init.h: -------------------------------------------------------------------------------- 1 | 2 | // This is the command sequence that initialises the ILI9163 driver 3 | // 4 | // This setup information is in a format accecpted by the commandList() function 5 | // which reduces FLASH space, but on an ESP8266 there is plenty available! 6 | // 7 | // See ILI9341_Setup.h file for an alternative simpler format 8 | 9 | { 10 | // Initialization commands for ILI9163 screens 11 | static const uint8_t ILI9163_cmds[] PROGMEM = 12 | { 13 | 17, // 17 commands follow 14 | 0x01, 0 + TFT_INIT_DELAY, 120, // Software reset 15 | 0x11, 0 + TFT_INIT_DELAY, 5, // Exit sleep mode 16 | 0x3A, 1, 0x05, // Set pixel format 17 | 0x26, 1, 0x04, // Set Gamma curve 3 18 | 0xF2, 1, 0x01, // Gamma adjustment enabled 19 | 0xE0, 15, 0x3F, 0x25, 0x1C, 0x1E, 0x20, 0x12, 0x2A, 0x90, 20 | 0x24, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, // Positive Gamma 21 | 0xE1, 15, 0x20, 0x20, 0x20, 0x20, 0x05, 0x00, 0x15,0xA7, 22 | 0x3D, 0x18, 0x25, 0x2A, 0x2B, 0x2B, 0x3A, // Negative Gamma 23 | 0xB1, 2, 0x08, 0x08, // Frame rate control 1 24 | 0xB4, 1, 0x07, // Display inversion 25 | 0xC0, 2, 0x0A, 0x02, // Power control 1 26 | 0xC1, 1, 0x02, // Power control 2 27 | 0xC5, 2, 0x50, 0x5B, // Vcom control 1 28 | 0xC7, 1, 0x40, // Vcom offset 29 | 0x2A, 4, 0x00, 0x00, 0x00, 0x7F, // Set column address 30 | 0x2B, 4 + TFT_INIT_DELAY, 0x00, 0x00, 0x00, 0x9F, 250, // Set page address 31 | 0x36, 1, 0xC8, // Set address mode 32 | 0x29, 0, // Set display on 33 | }; 34 | 35 | commandList(ILI9163_cmds); 36 | 37 | #ifdef CGRAM_OFFSET 38 | colstart = 0; 39 | rowstart = 0; 40 | #endif 41 | } -------------------------------------------------------------------------------- /src/TFT_eSPI/TFT_Drivers/ILI9163_Rotation.h: -------------------------------------------------------------------------------- 1 | 2 | // This is the command sequence that rotates the ILI9163 driver coordinate frame 3 | 4 | rotation = m % 4; 5 | 6 | writecommand(TFT_MADCTL); 7 | switch (rotation) { 8 | case 0: 9 | writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_BGR); 10 | _width = _init_width; 11 | _height = _init_height; 12 | #ifdef CGRAM_OFFSET 13 | colstart = 0; 14 | rowstart = 0; 15 | #endif 16 | break; 17 | case 1: 18 | writedata(TFT_MAD_MV | TFT_MAD_MY | TFT_MAD_BGR); 19 | _width = _init_height; 20 | _height = _init_width; 21 | #ifdef CGRAM_OFFSET 22 | colstart = 0; 23 | rowstart = 0; 24 | #endif 25 | break; 26 | case 2: 27 | writedata(TFT_MAD_BGR); 28 | _width = _init_width; 29 | _height = _init_height; 30 | #ifdef CGRAM_OFFSET 31 | colstart = 0; 32 | rowstart = 32; 33 | #endif 34 | break; 35 | case 3: 36 | writedata(TFT_MAD_MX | TFT_MAD_MV | TFT_MAD_BGR); 37 | _width = _init_height; 38 | _height = _init_width; 39 | #ifdef CGRAM_OFFSET 40 | colstart = 32; 41 | rowstart = 0; 42 | #endif 43 | break; 44 | } 45 | -------------------------------------------------------------------------------- /src/TFT_eSPI/TFT_Drivers/ILI9341_Rotation.h: -------------------------------------------------------------------------------- 1 | 2 | // This is the command sequence that rotates the ILI9341 driver coordinate frame 3 | 4 | rotation = m % 8; // Limit the range of values to 0-7 5 | 6 | writecommand(TFT_MADCTL); 7 | switch (rotation) { 8 | case 0: 9 | #ifdef M5STACK 10 | writedata(TFT_MAD_MY | TFT_MAD_MV | TFT_MAD_BGR); 11 | #else 12 | writedata(TFT_MAD_MX | TFT_MAD_BGR); 13 | #endif 14 | _width = _init_width; 15 | _height = _init_height; 16 | break; 17 | case 1: 18 | #ifdef M5STACK 19 | writedata(TFT_MAD_BGR); 20 | #else 21 | writedata(TFT_MAD_MV | TFT_MAD_BGR); 22 | #endif 23 | _width = _init_height; 24 | _height = _init_width; 25 | break; 26 | case 2: 27 | #ifdef M5STACK 28 | writedata(TFT_MAD_MV | TFT_MAD_MX | TFT_MAD_BGR); 29 | #else 30 | writedata(TFT_MAD_MY | TFT_MAD_BGR); 31 | #endif 32 | _width = _init_width; 33 | _height = _init_height; 34 | break; 35 | case 3: 36 | #ifdef M5STACK 37 | writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_BGR); 38 | #else 39 | writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_MV | TFT_MAD_BGR); 40 | #endif 41 | _width = _init_height; 42 | _height = _init_width; 43 | break; 44 | // These next rotations are for bottom up BMP drawing 45 | case 4: 46 | #ifdef M5STACK 47 | writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_MV | TFT_MAD_BGR); 48 | #else 49 | writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_BGR); 50 | #endif 51 | _width = _init_width; 52 | _height = _init_height; 53 | break; 54 | case 5: 55 | #ifdef M5STACK 56 | writedata(TFT_MAD_MY | TFT_MAD_BGR); 57 | #else 58 | writedata(TFT_MAD_MV | TFT_MAD_MX | TFT_MAD_BGR); 59 | #endif 60 | _width = _init_height; 61 | _height = _init_width; 62 | break; 63 | case 6: 64 | #ifdef M5STACK 65 | writedata(TFT_MAD_MV | TFT_MAD_BGR); 66 | #else 67 | writedata(TFT_MAD_BGR); 68 | #endif 69 | _width = _init_width; 70 | _height = _init_height; 71 | break; 72 | case 7: 73 | #ifdef M5STACK 74 | writedata(TFT_MAD_MX | TFT_MAD_BGR); 75 | #else 76 | writedata(TFT_MAD_MY | TFT_MAD_MV | TFT_MAD_BGR); 77 | #endif 78 | _width = _init_height; 79 | _height = _init_width; 80 | break; 81 | 82 | } 83 | -------------------------------------------------------------------------------- /src/TFT_eSPI/TFT_Drivers/ILI9481_Defines.h: -------------------------------------------------------------------------------- 1 | // Change the width and height if required (defined in portrait mode) 2 | // or use the constructor to over-ride defaults 3 | #define TFT_WIDTH 320 4 | #define TFT_HEIGHT 480 5 | 6 | 7 | // Delay between some initialisation commands 8 | #define TFT_INIT_DELAY 0x80 // Not used unless commandlist invoked 9 | 10 | 11 | // Generic commands used by TFT_eSPI.cpp 12 | #define TFT_NOP 0x00 13 | #define TFT_SWRST 0x01 14 | 15 | #define TFT_SLPIN 0x10 16 | #define TFT_SLPOUT 0x11 17 | 18 | #define TFT_INVOFF 0x20 19 | #define TFT_INVON 0x21 20 | 21 | #define TFT_DISPOFF 0x28 22 | #define TFT_DISPON 0x29 23 | 24 | #define TFT_CASET 0x2A 25 | #define TFT_PASET 0x2B 26 | #define TFT_RAMWR 0x2C 27 | 28 | #define TFT_RAMRD 0x2E 29 | 30 | #define TFT_MADCTL 0x36 31 | 32 | #define TFT_MAD_MY 0x80 33 | #define TFT_MAD_MX 0x40 34 | #define TFT_MAD_MV 0x20 35 | #define TFT_MAD_ML 0x10 36 | #define TFT_MAD_RGB 0x00 37 | #define TFT_MAD_BGR 0x08 38 | #define TFT_MAD_MH 0x04 39 | #define TFT_MAD_SS 0x02 40 | #define TFT_MAD_GS 0x01 41 | 42 | #define TFT_IDXRD 0x00 // ILI9341 only, indexed control register read 43 | -------------------------------------------------------------------------------- /src/TFT_eSPI/TFT_Drivers/ILI9481_Init.h: -------------------------------------------------------------------------------- 1 | 2 | // This is the command sequence that initialises the ILI9481 driver 3 | // 4 | // This setup information uses simple 8 bit SPI writecommand() and writedata() functions 5 | // 6 | // See ST7735_Setup.h file for an alternative format 7 | 8 | 9 | // Configure ILI9481 display 10 | 11 | writecommand(TFT_SLPOUT); 12 | delay(20); 13 | 14 | writecommand(0xD0); 15 | writedata(0x07); 16 | writedata(0x42); 17 | writedata(0x18); 18 | 19 | writecommand(0xD1); 20 | writedata(0x00); 21 | writedata(0x07); 22 | writedata(0x10); 23 | 24 | writecommand(0xD2); 25 | writedata(0x01); 26 | writedata(0x02); 27 | 28 | writecommand(0xC0); 29 | writedata(0x10); 30 | writedata(0x3B); 31 | writedata(0x00); 32 | writedata(0x02); 33 | writedata(0x11); 34 | 35 | writecommand(0xC5); 36 | writedata(0x03); 37 | 38 | writecommand(0xC8); 39 | writedata(0x00); 40 | writedata(0x32); 41 | writedata(0x36); 42 | writedata(0x45); 43 | writedata(0x06); 44 | writedata(0x16); 45 | writedata(0x37); 46 | writedata(0x75); 47 | writedata(0x77); 48 | writedata(0x54); 49 | writedata(0x0C); 50 | writedata(0x00); 51 | 52 | writecommand(TFT_MADCTL); 53 | writedata(0x0A); 54 | 55 | writecommand(0x3A); 56 | writedata(0x55); 57 | 58 | writecommand(TFT_CASET); 59 | writedata(0x00); 60 | writedata(0x00); 61 | writedata(0x01); 62 | writedata(0x3F); 63 | 64 | writecommand(TFT_PASET); 65 | writedata(0x00); 66 | writedata(0x00); 67 | writedata(0x01); 68 | writedata(0xDF); 69 | 70 | delay(120); 71 | writecommand(TFT_DISPON); 72 | 73 | delay(25); 74 | // End of ILI9481 display configuration 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /src/TFT_eSPI/TFT_Drivers/ILI9481_Rotation.h: -------------------------------------------------------------------------------- 1 | // This is the command sequence that rotates the ILI9481 driver coordinate frame 2 | 3 | writecommand(TFT_MADCTL); 4 | rotation = m % 4; 5 | switch (rotation) { 6 | case 0: // Portrait 7 | writedata(TFT_MAD_BGR | TFT_MAD_SS); 8 | _width = TFT_WIDTH; 9 | _height = TFT_HEIGHT; 10 | break; 11 | case 1: // Landscape (Portrait + 90) 12 | writedata(TFT_MAD_MV | TFT_MAD_BGR); 13 | _width = TFT_HEIGHT; 14 | _height = TFT_WIDTH; 15 | break; 16 | case 2: // Inverter portrait 17 | writedata(TFT_MAD_BGR | TFT_MAD_GS); 18 | _width = TFT_WIDTH; 19 | _height = TFT_HEIGHT; 20 | break; 21 | case 3: // Inverted landscape 22 | writedata(TFT_MAD_MV | TFT_MAD_BGR | TFT_MAD_SS | TFT_MAD_GS); 23 | _width = TFT_HEIGHT; 24 | _height = TFT_WIDTH; 25 | break; 26 | } 27 | -------------------------------------------------------------------------------- /src/TFT_eSPI/TFT_Drivers/ILI9488_Defines.h: -------------------------------------------------------------------------------- 1 | // Change the width and height if required (defined in portrait mode) 2 | // or use the constructor to over-ride defaults 3 | #define TFT_WIDTH 320 4 | #define TFT_HEIGHT 480 5 | 6 | 7 | // Delay between some initialisation commands 8 | #define TFT_INIT_DELAY 0x80 // Not used unless commandlist invoked 9 | 10 | 11 | // Generic commands used by TFT_eSPI.cpp 12 | #define TFT_NOP 0x00 13 | #define TFT_SWRST 0x01 14 | 15 | #define TFT_SLPIN 0x10 16 | #define TFT_SLPOUT 0x11 17 | 18 | #define TFT_INVOFF 0x20 19 | #define TFT_INVON 0x21 20 | 21 | #define TFT_DISPOFF 0x28 22 | #define TFT_DISPON 0x29 23 | 24 | #define TFT_CASET 0x2A 25 | #define TFT_PASET 0x2B 26 | #define TFT_RAMWR 0x2C 27 | 28 | #define TFT_RAMRD 0x2E 29 | 30 | #define TFT_MADCTL 0x36 31 | 32 | #define TFT_MAD_MY 0x80 33 | #define TFT_MAD_MX 0x40 34 | #define TFT_MAD_MV 0x20 35 | #define TFT_MAD_ML 0x10 36 | #define TFT_MAD_RGB 0x00 37 | #define TFT_MAD_BGR 0x08 38 | #define TFT_MAD_MH 0x04 39 | #define TFT_MAD_SS 0x02 40 | #define TFT_MAD_GS 0x01 41 | 42 | #define TFT_IDXRD 0x00 // ILI9341 only, indexed control register read 43 | -------------------------------------------------------------------------------- /src/TFT_eSPI/TFT_Drivers/ILI9488_Init.h: -------------------------------------------------------------------------------- 1 | 2 | // This is the command sequence that initialises the ILI9488 driver 3 | // 4 | // This setup information uses simple 8 bit SPI writecommand() and writedata() functions 5 | // 6 | // See ST7735_Setup.h file for an alternative format 7 | 8 | 9 | // Configure ILI9488 display 10 | 11 | writecommand(0x3A); // Pixel Interface Format (16 bit colour) 12 | writedata(0x55); 13 | 14 | writecommand(0xB0); // Interface Mode Control 15 | writedata(0x00); 16 | 17 | writecommand(0xB1); // Frame Rate Control 18 | writedata(0xB0); 19 | writedata(0x11); 20 | 21 | writecommand(0xB4); // Display Inversion Control 22 | writedata(0x02); 23 | 24 | writecommand(0xB6); // Display Function Control 25 | writedata(0x02); 26 | writedata(0x02); 27 | writedata(0x3B); 28 | 29 | writecommand(0xB7); // Entry Mode Set 30 | writedata(0xC6); 31 | 32 | writecommand(0XC0); // Power Control 1 33 | writedata(0x10); 34 | writedata(0x10); 35 | 36 | writecommand(0xC1); // Power Control 2 37 | writedata(0x41); 38 | 39 | writecommand(0xC5); // VCOM Control 40 | writedata(0x00); 41 | writedata(0x22); 42 | writedata(0x80); 43 | writedata(0x40); 44 | 45 | writecommand(0xE0); // Positive Gamma Control 46 | writedata(0x00); 47 | writedata(0x03); 48 | writedata(0x09); 49 | writedata(0x08); 50 | writedata(0x16); 51 | writedata(0x0A); 52 | writedata(0x3F); 53 | writedata(0x78); 54 | writedata(0x4C); 55 | writedata(0x09); 56 | writedata(0x0A); 57 | writedata(0x08); 58 | writedata(0x16); 59 | writedata(0x1A); 60 | writedata(0x0F); 61 | 62 | writecommand(0XE1); // Negative Gamma Control 63 | writedata(0x00); 64 | writedata(0x16); 65 | writedata(0x19); 66 | writedata(0x03); 67 | writedata(0x0F); 68 | writedata(0x05); 69 | writedata(0x32); 70 | writedata(0x45); 71 | writedata(0x46); 72 | writedata(0x04); 73 | writedata(0x0E); 74 | writedata(0x0D); 75 | writedata(0x35); 76 | writedata(0x37); 77 | writedata(0x0F); 78 | 79 | writecommand(0xF7); // Adjust Control 3 80 | writedata(0xA9); 81 | writedata(0x51); 82 | writedata(0x2C); 83 | writedata(0x02); 84 | 85 | writecommand(TFT_MADCTL); // Memory Access Control 86 | writedata(0x48); // MX, BGR 87 | 88 | writecommand(TFT_SLPOUT); //Exit Sleep 89 | delay(120); 90 | 91 | writecommand(TFT_DISPON); //Display on 92 | delay(25); 93 | 94 | // End of ILI9488 display configuration 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /src/TFT_eSPI/TFT_Drivers/ILI9488_Rotation.h: -------------------------------------------------------------------------------- 1 | // This is the command sequence that rotates the ILI9488 driver coordinate frame 2 | 3 | writecommand(TFT_MADCTL); 4 | rotation = m % 4; 5 | switch (rotation) { 6 | case 0: // Portrait 7 | writedata(TFT_MAD_MX | TFT_MAD_BGR); 8 | _width = TFT_WIDTH; 9 | _height = TFT_HEIGHT; 10 | break; 11 | case 1: // Landscape (Portrait + 90) 12 | writedata(TFT_MAD_MV | TFT_MAD_BGR); 13 | _width = TFT_HEIGHT; 14 | _height = TFT_WIDTH; 15 | break; 16 | case 2: // Inverter portrait 17 | writedata(TFT_MAD_MY | TFT_MAD_BGR); 18 | _width = TFT_WIDTH; 19 | _height = TFT_HEIGHT; 20 | break; 21 | case 3: // Inverted landscape 22 | writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_MV | TFT_MAD_BGR); 23 | _width = TFT_HEIGHT; 24 | _height = TFT_WIDTH; 25 | break; 26 | } 27 | -------------------------------------------------------------------------------- /src/TFT_eSPI/TFT_Drivers/RPI_ILI9486_Defines.h: -------------------------------------------------------------------------------- 1 | // Change the width and height if required (defined in portrait mode) 2 | // or use the constructor to over-ride defaults 3 | #define TFT_WIDTH 320 4 | #define TFT_HEIGHT 480 5 | 6 | // For Raspberry Pi ILI9486 only with a modified board to add a write strobe: 7 | #ifdef TFT_WR 8 | #define RPI_WRITE_STROBE 9 | #endif 10 | 11 | // Color definitions for backwards compatibility with old sketches 12 | // use colour definitions like TFT_BLACK to make sketches more portable 13 | #define ILI9486_BLACK 0x0000 /* 0, 0, 0 */ 14 | #define ILI9486_NAVY 0x000F /* 0, 0, 128 */ 15 | #define ILI9486_DARKGREEN 0x03E0 /* 0, 128, 0 */ 16 | #define ILI9486_DARKCYAN 0x03EF /* 0, 128, 128 */ 17 | #define ILI9486_MAROON 0x7800 /* 128, 0, 0 */ 18 | #define ILI9486_PURPLE 0x780F /* 128, 0, 128 */ 19 | #define ILI9486_OLIVE 0x7BE0 /* 128, 128, 0 */ 20 | #define ILI9486_LIGHTGREY 0xC618 /* 192, 192, 192 */ 21 | #define ILI9486_DARKGREY 0x7BEF /* 128, 128, 128 */ 22 | #define ILI9486_BLUE 0x001F /* 0, 0, 255 */ 23 | #define ILI9486_GREEN 0x07E0 /* 0, 255, 0 */ 24 | #define ILI9486_CYAN 0x07FF /* 0, 255, 255 */ 25 | #define ILI9486_RED 0xF800 /* 255, 0, 0 */ 26 | #define ILI9486_MAGENTA 0xF81F /* 255, 0, 255 */ 27 | #define ILI9486_YELLOW 0xFFE0 /* 255, 255, 0 */ 28 | #define ILI9486_WHITE 0xFFFF /* 255, 255, 255 */ 29 | #define ILI9486_ORANGE 0xFD20 /* 255, 165, 0 */ 30 | #define ILI9486_GREENYELLOW 0xAFE5 /* 173, 255, 47 */ 31 | #define ILI9486_PINK 0xF81F 32 | 33 | 34 | // Delay between some initialisation commands 35 | #define TFT_INIT_DELAY 0x80 // Not used unless commandlist invoked 36 | 37 | 38 | // Generic commands used by TFT_eSPI.cpp 39 | #define TFT_NOP 0x00 40 | #define TFT_SWRST 0x01 41 | 42 | #define TFT_CASET 0x2A 43 | #define TFT_PASET 0x2B 44 | #define TFT_RAMWR 0x2C 45 | 46 | #define TFT_RAMRD 0x2E 47 | #define TFT_IDXRD 0x00 // ILI9341 only, indexed control register read 48 | 49 | #define TFT_MADCTL 0x36 50 | #define TFT_MAD_MY 0x80 51 | #define TFT_MAD_MX 0x40 52 | #define TFT_MAD_MV 0x20 53 | #define TFT_MAD_ML 0x10 54 | #define TFT_MAD_BGR 0x08 55 | #define TFT_MAD_MH 0x04 56 | #define TFT_MAD_SS 0x02 57 | #define TFT_MAD_GS 0x01 58 | #define TFT_MAD_RGB 0x00 59 | 60 | #define TFT_INVOFF 0x20 61 | #define TFT_INVON 0x21 62 | -------------------------------------------------------------------------------- /src/TFT_eSPI/TFT_Drivers/RPI_ILI9486_Init.h: -------------------------------------------------------------------------------- 1 | 2 | // This is the command sequence that initialises the ILI9486 driver 3 | // 4 | // This setup information uses simple 8 bit SPI writecommand() and writedata() functions 5 | // 6 | // See ST7735_Setup.h file for an alternative format 7 | 8 | { 9 | // From https://github.com/notro/fbtft/blob/master/fb_ili9486.c 10 | 11 | //writecommand(0x01); // SW reset 12 | //delay(120); 13 | 14 | writecommand(0x11); // Sleep out, also SW reset 15 | delay(120); 16 | 17 | writecommand(0x3A); 18 | writedata(0x55); 19 | 20 | writecommand(0xC2); 21 | writedata(0x44); 22 | 23 | writecommand(0xC5); 24 | writedata(0x00); 25 | writedata(0x00); 26 | writedata(0x00); 27 | writedata(0x00); 28 | 29 | writecommand(0xE0); 30 | writedata(0x0F); 31 | writedata(0x1F); 32 | writedata(0x1C); 33 | writedata(0x0C); 34 | writedata(0x0F); 35 | writedata(0x08); 36 | writedata(0x48); 37 | writedata(0x98); 38 | writedata(0x37); 39 | writedata(0x0A); 40 | writedata(0x13); 41 | writedata(0x04); 42 | writedata(0x11); 43 | writedata(0x0D); 44 | writedata(0x00); 45 | 46 | writecommand(0xE1); 47 | writedata(0x0F); 48 | writedata(0x32); 49 | writedata(0x2E); 50 | writedata(0x0B); 51 | writedata(0x0D); 52 | writedata(0x05); 53 | writedata(0x47); 54 | writedata(0x75); 55 | writedata(0x37); 56 | writedata(0x06); 57 | writedata(0x10); 58 | writedata(0x03); 59 | writedata(0x24); 60 | writedata(0x20); 61 | writedata(0x00); 62 | 63 | writecommand(0x20); // display inversion OFF 64 | 65 | writecommand(0x36); 66 | writedata(0x48); 67 | 68 | writecommand(0x29); // display on 69 | delay(150); 70 | } 71 | -------------------------------------------------------------------------------- /src/TFT_eSPI/TFT_Drivers/RPI_ILI9486_Rotation.h: -------------------------------------------------------------------------------- 1 | // This is the command sequence that rotates the ILI9486 driver coordinate frame 2 | 3 | writecommand(TFT_MADCTL); 4 | rotation = m % 8; 5 | switch (rotation) { 6 | case 0: // Portrait 7 | writedata(TFT_MAD_BGR | TFT_MAD_MX); 8 | _width = _init_width; 9 | _height = _init_height; 10 | break; 11 | case 1: // Landscape (Portrait + 90) 12 | writedata(TFT_MAD_BGR | TFT_MAD_MV); 13 | _width = _init_height; 14 | _height = _init_width; 15 | break; 16 | case 2: // Inverter portrait 17 | writedata( TFT_MAD_BGR | TFT_MAD_MY); 18 | _width = _init_width; 19 | _height = _init_height; 20 | break; 21 | case 3: // Inverted landscape 22 | writedata(TFT_MAD_BGR | TFT_MAD_MV | TFT_MAD_MX | TFT_MAD_MY); 23 | _width = _init_height; 24 | _height = _init_width; 25 | break; 26 | case 4: // Portrait 27 | writedata(TFT_MAD_BGR | TFT_MAD_MX | TFT_MAD_MY); 28 | _width = _init_width; 29 | _height = _init_height; 30 | break; 31 | case 5: // Landscape (Portrait + 90) 32 | writedata(TFT_MAD_BGR | TFT_MAD_MV | TFT_MAD_MX); 33 | _width = _init_height; 34 | _height = _init_width; 35 | break; 36 | case 6: // Inverter portrait 37 | writedata( TFT_MAD_BGR); 38 | _width = _init_width; 39 | _height = _init_height; 40 | break; 41 | case 7: // Inverted landscape 42 | writedata(TFT_MAD_BGR | TFT_MAD_MV | TFT_MAD_MY); 43 | _width = _init_height; 44 | _height = _init_width; 45 | break; 46 | } 47 | 48 | -------------------------------------------------------------------------------- /src/TFT_eSPI/TFT_Drivers/S6D02A1_Defines.h: -------------------------------------------------------------------------------- 1 | // Change the width and height if required (defined in portrait mode) 2 | // or use the constructor to over-ride defaults 3 | #define TFT_WIDTH 128 4 | #define TFT_HEIGHT 160 5 | 6 | 7 | // Color definitions for backwards compatibility with old sketches 8 | // use colour definitions like TFT_BLACK to make sketches more portable 9 | #define S6D02A1_BLACK 0x0000 /* 0, 0, 0 */ 10 | #define S6D02A1_NAVY 0x000F /* 0, 0, 128 */ 11 | #define S6D02A1_DARKGREEN 0x03E0 /* 0, 128, 0 */ 12 | #define S6D02A1_DARKCYAN 0x03EF /* 0, 128, 128 */ 13 | #define S6D02A1_MAROON 0x7800 /* 128, 0, 0 */ 14 | #define S6D02A1_PURPLE 0x780F /* 128, 0, 128 */ 15 | #define S6D02A1_OLIVE 0x7BE0 /* 128, 128, 0 */ 16 | #define S6D02A1_LIGHTGREY 0xC618 /* 192, 192, 192 */ 17 | #define S6D02A1_DARKGREY 0x7BEF /* 128, 128, 128 */ 18 | #define S6D02A1_BLUE 0x001F /* 0, 0, 255 */ 19 | #define S6D02A1_GREEN 0x07E0 /* 0, 255, 0 */ 20 | #define S6D02A1_CYAN 0x07FF /* 0, 255, 255 */ 21 | #define S6D02A1_RED 0xF800 /* 255, 0, 0 */ 22 | #define S6D02A1_MAGENTA 0xF81F /* 255, 0, 255 */ 23 | #define S6D02A1_YELLOW 0xFFE0 /* 255, 255, 0 */ 24 | #define S6D02A1_WHITE 0xFFFF /* 255, 255, 255 */ 25 | #define S6D02A1_ORANGE 0xFD20 /* 255, 165, 0 */ 26 | #define S6D02A1_GREENYELLOW 0xAFE5 /* 173, 255, 47 */ 27 | #define S6D02A1_PINK 0xF81F 28 | 29 | 30 | // Delay between some initialisation commands 31 | #define TFT_INIT_DELAY 0x80 32 | 33 | 34 | // Generic commands used by TFT_eSPI.cpp 35 | #define TFT_NOP 0x00 36 | #define TFT_SWRST 0x01 37 | 38 | #define TFT_CASET 0x2A 39 | #define TFT_PASET 0x2B 40 | #define TFT_RAMWR 0x2C 41 | 42 | #define TFT_RAMRD 0x2E 43 | #define TFT_IDXRD 0x00 //0xDD // ILI9341 only, indexed control register read 44 | 45 | #define TFT_MADCTL 0x36 46 | #define TFT_MAD_MY 0x80 47 | #define TFT_MAD_MX 0x40 48 | #define TFT_MAD_MV 0x20 49 | #define TFT_MAD_ML 0x10 50 | #define TFT_MAD_BGR 0x08 51 | #define TFT_MAD_MH 0x04 52 | #define TFT_MAD_RGB 0x00 53 | 54 | #define TFT_INVOFF 0x20 55 | #define TFT_INVON 0x21 56 | -------------------------------------------------------------------------------- /src/TFT_eSPI/TFT_Drivers/S6D02A1_Init.h: -------------------------------------------------------------------------------- 1 | 2 | // This is the command sequence that initialises the S6D02A1 driver 3 | // 4 | // This setup information is in a format accecpted by the commandList() function 5 | // which reduces FLASH space, but on an ESP8266 there is plenty available! 6 | // 7 | // See ILI9341_Setup.h file for an alternative simpler format 8 | 9 | { 10 | // Initialization commands for S6D02A1 screens 11 | static const uint8_t S6D02A1_cmds[] PROGMEM = 12 | { 13 | 29, 14 | 0xf0, 2, 0x5a, 0x5a, // Excommand2 15 | 0xfc, 2, 0x5a, 0x5a, // Excommand3 16 | 0x26, 1, 0x01, // Gamma set 17 | 0xfa, 15, 0x02, 0x1f, 0x00, 0x10, 0x22, 0x30, 0x38, 0x3A, 0x3A, 0x3A, 0x3A, 0x3A, 0x3d, 0x02, 0x01, // Positive gamma control 18 | 0xfb, 15, 0x21, 0x00, 0x02, 0x04, 0x07, 0x0a, 0x0b, 0x0c, 0x0c, 0x16, 0x1e, 0x30, 0x3f, 0x01, 0x02, // Negative gamma control 19 | 0xfd, 11, 0x00, 0x00, 0x00, 0x17, 0x10, 0x00, 0x01, 0x01, 0x00, 0x1f, 0x1f, // Analog parameter control 20 | 0xf4, 15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x3f, 0x07, 0x00, 0x3C, 0x36, 0x00, 0x3C, 0x36, 0x00, // Power control 21 | 0xf5, 13, 0x00, 0x70, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0x66, 0x06, // VCOM control 22 | 0xf6, 11, 0x02, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06, 0x01, 0x00, // Source control 23 | 0xf2, 17, 0x00, 0x01, 0x03, 0x08, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x04, 0x08, 0x08, //Display control 24 | 0xf8, 1, 0x11, // Gate control 25 | 0xf7, 4, 0xc8, 0x20, 0x00, 0x00, // Interface control 26 | 0xf3, 2, 0x00, 0x00, // Power sequence control 27 | 0x11, TFT_INIT_DELAY, 50, // Wake 28 | 0xf3, 2+TFT_INIT_DELAY, 0x00, 0x01, 50, // Power sequence control 29 | 0xf3, 2+TFT_INIT_DELAY, 0x00, 0x03, 50, // Power sequence control 30 | 0xf3, 2+TFT_INIT_DELAY, 0x00, 0x07, 50, // Power sequence control 31 | 0xf3, 2+TFT_INIT_DELAY, 0x00, 0x0f, 50, // Power sequence control 32 | 0xf4, 15+TFT_INIT_DELAY, 0x00, 0x04, 0x00, 0x00, 0x00, 0x3f, 0x3f, 0x07, 0x00, 0x3C, 0x36, 0x00, 0x3C, 0x36, 0x00, 50, // Power control 33 | 0xf3, 2+TFT_INIT_DELAY, 0x00, 0x1f, 50, // Power sequence control 34 | 0xf3, 2+TFT_INIT_DELAY, 0x00, 0x7f, 50, // Power sequence control 35 | 0xf3, 2+TFT_INIT_DELAY, 0x00, 0xff, 50, // Power sequence control 36 | 0xfd, 11, 0x00, 0x00, 0x00, 0x17, 0x10, 0x00, 0x00, 0x01, 0x00, 0x16, 0x16, // Analog parameter control 37 | 0xf4, 15, 0x00, 0x09, 0x00, 0x00, 0x00, 0x3f, 0x3f, 0x07, 0x00, 0x3C, 0x36, 0x00, 0x3C, 0x36, 0x00, // Power control 38 | 0x36, 1, 0xC8, // Memory access data control 39 | 0x35, 1, 0x00, // Tearing effect line on 40 | 0x3a, 1+TFT_INIT_DELAY, 0x05, 150, // Interface pixel control 41 | 0x29, 0, // Display on 42 | 0x2c, 0 // Memory write 43 | }; 44 | 45 | commandList(S6D02A1_cmds); 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/TFT_eSPI/TFT_Drivers/S6D02A1_Rotation.h: -------------------------------------------------------------------------------- 1 | 2 | // This is the command sequence that rotates the S6D02A1 driver coordinate frame 3 | 4 | rotation = m % 4; 5 | 6 | writecommand(TFT_MADCTL); 7 | switch (rotation) { 8 | case 0: 9 | writedata(TFT_MAD_MX | TFT_MAD_MY | TFT_MAD_BGR); 10 | _width = _init_width; 11 | _height = _init_height; 12 | break; 13 | case 1: 14 | writedata(TFT_MAD_MV | TFT_MAD_MY | TFT_MAD_BGR); 15 | _width = _init_height; 16 | _height = _init_width; 17 | break; 18 | case 2: 19 | writedata(TFT_MAD_BGR); 20 | _width = _init_width; 21 | _height = _init_height; 22 | break; 23 | case 3: 24 | writedata(TFT_MAD_MX | TFT_MAD_MV | TFT_MAD_BGR); 25 | _width = _init_height; 26 | _height = _init_width; 27 | break; 28 | } 29 | -------------------------------------------------------------------------------- /src/TFT_eSPI/Tools/Create_Smooth_Font/Create_font/FontFiles/Final-Frontier28.vlw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/CircuitMess-Ringo/14cbc74d1ba067830067e32cebe9189f0266dcfb/src/TFT_eSPI/Tools/Create_Smooth_Font/Create_font/FontFiles/Final-Frontier28.vlw -------------------------------------------------------------------------------- /src/TFT_eSPI/Tools/Create_Smooth_Font/Create_font/data/Final-Frontier.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/CircuitMess-Ringo/14cbc74d1ba067830067e32cebe9189f0266dcfb/src/TFT_eSPI/Tools/Create_Smooth_Font/Create_font/data/Final-Frontier.ttf -------------------------------------------------------------------------------- /src/TFT_eSPI/Tools/ESP32 UNO board mod/ESP32 UNO board mod.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/CircuitMess-Ringo/14cbc74d1ba067830067e32cebe9189f0266dcfb/src/TFT_eSPI/Tools/ESP32 UNO board mod/ESP32 UNO board mod.jpg -------------------------------------------------------------------------------- /src/TFT_eSPI/Tools/ESP32 UNO board mod/ESP32 UNO board pinout.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/CircuitMess-Ringo/14cbc74d1ba067830067e32cebe9189f0266dcfb/src/TFT_eSPI/Tools/ESP32 UNO board mod/ESP32 UNO board pinout.jpg -------------------------------------------------------------------------------- /src/TFT_eSPI/Tools/PlatformIO/Configuring options.txt: -------------------------------------------------------------------------------- 1 | PlatformIO User notes: 2 | 3 | It is possible to load settings from the calling program rather than modifying 4 | the library for each project by modifying the "platformio.ini" file. 5 | 6 | The User_Setup_Select.h file will not load the user setting header files if 7 | USER_SETUP_LOADED is defined. 8 | 9 | Instead of using #define, use the -D prefix, for example: 10 | 11 | [env:esp32dev] 12 | platform = https://github.com/platformio/platform-espressif32.git#feature/stage 13 | board = esp32dev 14 | framework = arduino 15 | upload_port = ESP32-Test-2481CE9C.local 16 | 17 | build_flags = 18 | -Os 19 | -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG 20 | -DUSER_SETUP_LOADED=1 21 | -DILI9163_DRIVER=1 22 | -DTFT_WIDTH=128 23 | -DTFT_HEIGHT=160 24 | -DTFT_MISO=19 25 | -DTFT_MOSI=23 26 | -DTFT_SCLK=18 27 | -DTFT_CS=5 28 | -DTFT_DC=19 29 | -DTFT_RST=-1 30 | -DLOAD_GLCD=1 31 | -DSPI_FREQUENCY=27000000 32 | 33 | lib_extra_dirs = B:\Projects\ESP32\ESP32Lib 34 | -------------------------------------------------------------------------------- /src/TFT_eSPI/Tools/RPi_TFT_Connections.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/CircuitMess-Ringo/14cbc74d1ba067830067e32cebe9189f0266dcfb/src/TFT_eSPI/Tools/RPi_TFT_Connections.png -------------------------------------------------------------------------------- /src/TFT_eSPI/Tools/RPi_TFT_mod.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CircuitMess/CircuitMess-Ringo/14cbc74d1ba067830067e32cebe9189f0266dcfb/src/TFT_eSPI/Tools/RPi_TFT_mod.png -------------------------------------------------------------------------------- /src/TFT_eSPI/User_Setups/User_Custom_Fonts.h: -------------------------------------------------------------------------------- 1 | 2 | // Custom "Adafruit" compatible font files can be added to the "TFT_eSPI/Fonts/Custom" folder 3 | // Fonts in a suitable format can be created using a Squix blog web based tool here: 4 | /* 5 | https://blog.squix.org/2016/10/font-creator-now-creates-adafruit-gfx-fonts.html 6 | */ 7 | 8 | // Note: At the time of writing there is a last character code definition bug in the 9 | // Squix font file format so do NOT try and print the tilda (~) symbol (ASCII 0x7E) 10 | // Alternatively look at the end of the font header file and edit: 0x7E to read 0x7D 11 | /* e.g. vvvv 12 | (uint8_t *)Orbitron_Light_32Bitmaps,(GFXglyph *)Orbitron_Light_32Glyphs,0x20, 0x7D, 32}; 13 | ^^^^ 14 | */ 15 | 16 | // When font files are placed in the Custom folder then they must also be #included here: 17 | 18 | // The comment added is a shorthand reference but this is not essential 19 | 20 | #ifdef LOAD_GFXFF 21 | 22 | // New custom font file #includes 23 | #include // CF_OL24 24 | #include // CF_OL32 25 | #include // CF_RT24 26 | #include // CF_S24 27 | #include // CF_Y32 28 | 29 | #endif 30 | 31 | // Shorthand references - any coding scheme can be used, here CF_ = Custom Font 32 | // The #defines below MUST be added to sketches to use shorthand references, so 33 | // they are only put here for reference and copy+paste purposes! 34 | /* 35 | #define CF_OL24 &Orbitron_Light_24 36 | #define CF_OL32 &Orbitron_Light_32 37 | #define CF_RT24 &Roboto_Thin_24 38 | #define CF_S24 &Satisfy_24 39 | #define CF_Y32 &Yellowtail_32 40 | */ 41 | -------------------------------------------------------------------------------- /src/TFT_eSPI/keywords.txt: -------------------------------------------------------------------------------- 1 | TFT_eSPI KEYWORD1 2 | 3 | init KEYWORD2 4 | drawPixel KEYWORD2 5 | drawChar KEYWORD2 6 | setAddrWindow KEYWORD2 7 | setWindow KEYWORD2 8 | readAddrWindow KEYWORD2 9 | pushColor KEYWORD2 10 | pushColors KEYWORD2 11 | fillScreen KEYWORD2 12 | writeBegin KEYWORD2 13 | writeEnd KEYWORD2 14 | drawLine KEYWORD2 15 | drawFastVLine KEYWORD2 16 | drawFastHLine KEYWORD2 17 | drawRect KEYWORD2 18 | fillRect KEYWORD2 19 | drawRoundRect KEYWORD2 20 | fillRoundRect KEYWORD2 21 | setRotation KEYWORD2 22 | invertDisplay KEYWORD2 23 | drawCircle KEYWORD2 24 | drawCircleHelper KEYWORD2 25 | fillCircle KEYWORD2 26 | fillCircleHelper KEYWORD2 27 | drawEllipse KEYWORD2 28 | fillEllipse KEYWORD2 29 | drawTriangle KEYWORD2 30 | fillTriangle KEYWORD2 31 | drawBitmap KEYWORD2 32 | drawXBitmap KEYWORD2 33 | setCursor KEYWORD2 34 | getCursorX KEYWORD2 35 | getCursorY KEYWORD2 36 | setTextColor KEYWORD2 37 | setTextSize KEYWORD2 38 | setTextFont KEYWORD2 39 | setTextWrap KEYWORD2 40 | setTextDatum KEYWORD2 41 | setTextPadding KEYWORD2 42 | spiwrite KEYWORD2 43 | writecommand KEYWORD2 44 | writedata KEYWORD2 45 | commandList KEYWORD2 46 | readcommand8 KEYWORD2 47 | readcommand16 KEYWORD2 48 | readcommand32 KEYWORD2 49 | readPixel KEYWORD2 50 | readRect KEYWORD2 51 | pushRect KEYWORD2 52 | pushImage KEYWORD2 53 | setSwapBytes KEYWORD2 54 | getSwapBytes KEYWORD2 55 | readRectRGB KEYWORD2 56 | getRotation KEYWORD2 57 | getTextDatum KEYWORD2 58 | fontsLoaded KEYWORD2 59 | color565 KEYWORD2 60 | color16to8 KEYWORD2 61 | color8to16 KEYWORD2 62 | drawNumber KEYWORD2 63 | drawFloat KEYWORD2 64 | drawString KEYWORD2 65 | drawCentreString KEYWORD2 66 | drawRightString KEYWORD2 67 | height KEYWORD2 68 | width KEYWORD2 69 | textWidth KEYWORD2 70 | fontHeight KEYWORD2 71 | 72 | getTouchRaw KEYWORD2 73 | getTouchRawZ KEYWORD2 74 | getTouch KEYWORD2 75 | calibrateTouch KEYWORD2 76 | setTouch KEYWORD2 77 | validTouch KEYWORD2 78 | 79 | TFT_eSPI_Button KEYWORD1 80 | 81 | initButton KEYWORD2 82 | textcolor KEYWORD2 83 | initButtonUL KEYWORD2 84 | drawButton KEYWORD2 85 | contains KEYWORD2 86 | press KEYWORD2 87 | isPressed KEYWORD2 88 | justPressed KEYWORD2 89 | justReleased KEYWORD2 90 | 91 | 92 | TFT_eSprite KEYWORD1 93 | 94 | createSprite KEYWORD2 95 | setColorDepth KEYWORD2 96 | deleteSprite KEYWORD2 97 | fillSprite KEYWORD2 98 | pushBitmap KEYWORD2 99 | pushSprite KEYWORD2 100 | setScrollRect KEYWORD2 101 | scroll KEYWORD2 102 | printToSprite KEYWORD2 103 | frameBuffer KEYWORD2 104 | setBitmapColor KEYWORD2 105 | 106 | alphaBlend KEYWORD2 107 | showFont KEYWORD2 108 | loadFont KEYWORD2 109 | unloadFont KEYWORD2 110 | getUnicodeIndex KEYWORD2 111 | decodeUTF8 KEYWORD2 112 | drawGlyph KEYWORD2 113 | -------------------------------------------------------------------------------- /src/TFT_eSPI/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "TFT_eSPI", 3 | "version": "0.20.14", 4 | "keywords": "tft, ePaper, display, ESP8266, NodeMCU, ESP32, M5Stack, ILI9341, ST7735, ILI9163, S6D02A1, ILI9486", 5 | "description": "A TFT and ePaper SPI graphics library for ESP8266 and ESP32", 6 | "repository": 7 | { 8 | "type": "git", 9 | "url": "https://github.com/Bodmer/TFT_eSPI" 10 | }, 11 | "authors": 12 | [ 13 | { 14 | "name": "Bodmer", 15 | "email": "bodmer@anola.net", 16 | "maintainer": true 17 | } 18 | ], 19 | "frameworks": "arduino", 20 | "platforms": "espressif8266, espressif32" 21 | } 22 | -------------------------------------------------------------------------------- /src/TFT_eSPI/library.properties: -------------------------------------------------------------------------------- 1 | name=TFT_eSPI 2 | version=0.20.14 3 | author=Bodmer 4 | maintainer=Bodmer 5 | sentence=A fast TFT library for ESP8266 processors and the Arduino IDE 6 | paragraph=Supports TFT displays using drivers (ILI9341 etc) that operate with hardware SPI. 7 | category=Display 8 | url=http://www.instructables.com/id/Arduino-TFT-display-and-font-library/ 9 | architectures=esp8266,esp32 10 | includes=TFT_eSPI.h 11 | -------------------------------------------------------------------------------- /src/utility/Adafruit_ADS1X15/README.md: -------------------------------------------------------------------------------- 1 | Adafruit_ADS1015 2 | ================ 3 | 4 | Driver for TI's ADS1015: 12-bit Differential or Single-Ended ADC with PGA and Comparator 5 | 6 | 7 | ## Compatibility 8 | 9 | MCU | Tested Works | Doesn't Work | Not Tested | Notes 10 | ------------------ | :----------: | :----------: | :---------: | ----- 11 | Atmega328 @ 16MHz | X | | | 12 | Atmega328 @ 12MHz | X | | | 13 | Atmega32u4 @ 16MHz | X | | | Use SDA/SCL on pins D2 & D3 14 | Atmega32u4 @ 8MHz | X | | | Use SDA/SCL on pins D2 & D3 15 | ESP8266 | X | | | SDA/SCL default to pins 4 & 5 but any two pins can be assigned as SDA/SCL using Wire.begin(SDA,SCL) 16 | Atmega2560 @ 16MHz | X | | | Use SDA/SCL on pins 20 & 21 17 | ATSAM3X8E | X | | | Use SDA/SCL on pins 20 & 21 18 | ATSAM21D | X | | | 19 | ATtiny85 @ 16MHz | X | | | Use 0 for SDA, 2 for SCL 20 | ATtiny85 @ 8MHz | X | | | Use 0 for SDA, 2 for SCL 21 | Intel Curie @ 32MHz | | | X | 22 | STM32F2 | | | X | 23 | 24 | * ATmega328 @ 16MHz : Arduino UNO, Adafruit Pro Trinket 5V, Adafruit Metro 328, Adafruit Metro Mini 25 | * ATmega328 @ 12MHz : Adafruit Pro Trinket 3V 26 | * ATmega32u4 @ 16MHz : Arduino Leonardo, Arduino Micro, Arduino Yun, Teensy 2.0 27 | * ATmega32u4 @ 8MHz : Adafruit Flora, Bluefruit Micro 28 | * ESP8266 : Adafruit Huzzah 29 | * ATmega2560 @ 16MHz : Arduino Mega 30 | * ATSAM3X8E : Arduino Due 31 | * ATSAM21D : Arduino Zero, M0 Pro 32 | * ATtiny85 @ 16MHz : Adafruit Trinket 5V 33 | * ATtiny85 @ 8MHz : Adafruit Gemma, Arduino Gemma, Adafruit Trinket 3V 34 | 35 | 36 | -------------------------------------------------------------------------------- /src/utility/Adafruit_ADS1X15/examples/comparator/comparator.pde: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | // Adafruit_ADS1115 ads; /* Use this for the 16-bit version */ 5 | Adafruit_ADS1015 ads; /* Use thi for the 12-bit version */ 6 | 7 | void setup(void) 8 | { 9 | Serial.begin(9600); 10 | Serial.println("Hello!"); 11 | 12 | Serial.println("Single-ended readings from AIN0 with >3.0V comparator"); 13 | Serial.println("ADC Range: +/- 6.144V (1 bit = 3mV/ADS1015, 0.1875mV/ADS1115)"); 14 | Serial.println("Comparator Threshold: 1000 (3.000V)"); 15 | 16 | // The ADC input range (or gain) can be changed via the following 17 | // functions, but be careful never to exceed VDD +0.3V max, or to 18 | // exceed the upper and lower limits if you adjust the input range! 19 | // Setting these values incorrectly may destroy your ADC! 20 | // ADS1015 ADS1115 21 | // ------- ------- 22 | // ads.setGain(GAIN_TWOTHIRDS); // 2/3x gain +/- 6.144V 1 bit = 3mV 0.1875mV (default) 23 | // ads.setGain(GAIN_ONE); // 1x gain +/- 4.096V 1 bit = 2mV 0.125mV 24 | // ads.setGain(GAIN_TWO); // 2x gain +/- 2.048V 1 bit = 1mV 0.0625mV 25 | // ads.setGain(GAIN_FOUR); // 4x gain +/- 1.024V 1 bit = 0.5mV 0.03125mV 26 | // ads.setGain(GAIN_EIGHT); // 8x gain +/- 0.512V 1 bit = 0.25mV 0.015625mV 27 | // ads.setGain(GAIN_SIXTEEN); // 16x gain +/- 0.256V 1 bit = 0.125mV 0.0078125mV 28 | 29 | ads.begin(); 30 | 31 | // Setup 3V comparator on channel 0 32 | ads.startComparator_SingleEnded(0, 1000); 33 | } 34 | 35 | void loop(void) 36 | { 37 | int16_t adc0; 38 | 39 | // Comparator will only de-assert after a read 40 | adc0 = ads.getLastConversionResults(); 41 | Serial.print("AIN0: "); Serial.println(adc0); 42 | 43 | delay(100); 44 | } -------------------------------------------------------------------------------- /src/utility/Adafruit_ADS1X15/examples/differential/differential.pde: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | // Adafruit_ADS1115 ads; /* Use this for the 16-bit version */ 5 | Adafruit_ADS1015 ads; /* Use thi for the 12-bit version */ 6 | 7 | void setup(void) 8 | { 9 | Serial.begin(9600); 10 | Serial.println("Hello!"); 11 | 12 | Serial.println("Getting differential reading from AIN0 (P) and AIN1 (N)"); 13 | Serial.println("ADC Range: +/- 6.144V (1 bit = 3mV/ADS1015, 0.1875mV/ADS1115)"); 14 | 15 | // The ADC input range (or gain) can be changed via the following 16 | // functions, but be careful never to exceed VDD +0.3V max, or to 17 | // exceed the upper and lower limits if you adjust the input range! 18 | // Setting these values incorrectly may destroy your ADC! 19 | // ADS1015 ADS1115 20 | // ------- ------- 21 | // ads.setGain(GAIN_TWOTHIRDS); // 2/3x gain +/- 6.144V 1 bit = 3mV 0.1875mV (default) 22 | // ads.setGain(GAIN_ONE); // 1x gain +/- 4.096V 1 bit = 2mV 0.125mV 23 | // ads.setGain(GAIN_TWO); // 2x gain +/- 2.048V 1 bit = 1mV 0.0625mV 24 | // ads.setGain(GAIN_FOUR); // 4x gain +/- 1.024V 1 bit = 0.5mV 0.03125mV 25 | // ads.setGain(GAIN_EIGHT); // 8x gain +/- 0.512V 1 bit = 0.25mV 0.015625mV 26 | // ads.setGain(GAIN_SIXTEEN); // 16x gain +/- 0.256V 1 bit = 0.125mV 0.0078125mV 27 | 28 | ads.begin(); 29 | } 30 | 31 | void loop(void) 32 | { 33 | int16_t results; 34 | 35 | /* Be sure to update this value based on the IC and the gain settings! */ 36 | float multiplier = 3.0F; /* ADS1015 @ +/- 6.144V gain (12-bit results) */ 37 | //float multiplier = 0.1875F; /* ADS1115 @ +/- 6.144V gain (16-bit results) */ 38 | 39 | results = ads.readADC_Differential_0_1(); 40 | 41 | Serial.print("Differential: "); Serial.print(results); Serial.print("("); Serial.print(results * multiplier); Serial.println("mV)"); 42 | 43 | delay(1000); 44 | } 45 | -------------------------------------------------------------------------------- /src/utility/Adafruit_ADS1X15/examples/singleended/singleended.pde: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | // Adafruit_ADS1115 ads; /* Use this for the 16-bit version */ 5 | Adafruit_ADS1015 ads; /* Use thi for the 12-bit version */ 6 | 7 | void setup(void) 8 | { 9 | Serial.begin(9600); 10 | Serial.println("Hello!"); 11 | 12 | Serial.println("Getting single-ended readings from AIN0..3"); 13 | Serial.println("ADC Range: +/- 6.144V (1 bit = 3mV/ADS1015, 0.1875mV/ADS1115)"); 14 | 15 | // The ADC input range (or gain) can be changed via the following 16 | // functions, but be careful never to exceed VDD +0.3V max, or to 17 | // exceed the upper and lower limits if you adjust the input range! 18 | // Setting these values incorrectly may destroy your ADC! 19 | // ADS1015 ADS1115 20 | // ------- ------- 21 | // ads.setGain(GAIN_TWOTHIRDS); // 2/3x gain +/- 6.144V 1 bit = 3mV 0.1875mV (default) 22 | // ads.setGain(GAIN_ONE); // 1x gain +/- 4.096V 1 bit = 2mV 0.125mV 23 | // ads.setGain(GAIN_TWO); // 2x gain +/- 2.048V 1 bit = 1mV 0.0625mV 24 | // ads.setGain(GAIN_FOUR); // 4x gain +/- 1.024V 1 bit = 0.5mV 0.03125mV 25 | // ads.setGain(GAIN_EIGHT); // 8x gain +/- 0.512V 1 bit = 0.25mV 0.015625mV 26 | // ads.setGain(GAIN_SIXTEEN); // 16x gain +/- 0.256V 1 bit = 0.125mV 0.0078125mV 27 | 28 | ads.begin(); 29 | } 30 | 31 | void loop(void) 32 | { 33 | int16_t adc0, adc1, adc2, adc3; 34 | 35 | adc0 = ads.readADC_SingleEnded(0); 36 | adc1 = ads.readADC_SingleEnded(1); 37 | adc2 = ads.readADC_SingleEnded(2); 38 | adc3 = ads.readADC_SingleEnded(3); 39 | Serial.print("AIN0: "); Serial.println(adc0); 40 | Serial.print("AIN1: "); Serial.println(adc1); 41 | Serial.print("AIN2: "); Serial.println(adc2); 42 | Serial.print("AIN3: "); Serial.println(adc3); 43 | Serial.println(" "); 44 | 45 | delay(1000); 46 | } 47 | -------------------------------------------------------------------------------- /src/utility/Adafruit_ADS1X15/license.txt: -------------------------------------------------------------------------------- 1 | Software License Agreement (BSD License) 2 | 3 | Copyright (c) 2012, Adafruit Industries 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 1. Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 3. Neither the name of the copyright holders nor the 14 | names of its contributors may be used to endorse or promote products 15 | derived from this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY 18 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY 21 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson.h: -------------------------------------------------------------------------------- 1 | #include "ArduinoJson/src/ArduinoJson.h" 2 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/ArduinoJson.h: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #include "src/ArduinoJson.h" 6 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | --------------------- 3 | 4 | Copyright © 2014-2018 Benoit BLANCHON 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 7 | 8 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 9 | 10 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 11 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/keywords.txt: -------------------------------------------------------------------------------- 1 | JsonArray KEYWORD1 2 | JsonObject KEYWORD1 3 | JsonVariant KEYWORD1 4 | StaticJsonBuffer KEYWORD1 5 | DynamicJsonBuffer KEYWORD1 6 | add KEYWORD2 7 | createArray KEYWORD2 8 | createNestedArray KEYWORD2 9 | createNestedObject KEYWORD2 10 | createObject KEYWORD2 11 | parseArray KEYWORD2 12 | parseObject KEYWORD2 13 | prettyPrintTo KEYWORD2 14 | printTo KEYWORD2 15 | success KEYWORD2 16 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ArduinoJson", 3 | "keywords": "json, rest, http, web", 4 | "description": "An elegant and efficient JSON library for embedded systems", 5 | "homepage": "https://arduinojson.org/?utm_source=meta&utm_medium=library.json", 6 | "repository": { 7 | "type": "git", 8 | "url": "https://github.com/bblanchon/ArduinoJson.git" 9 | }, 10 | "version": "5.13.4", 11 | "authors": { 12 | "name": "Benoit Blanchon", 13 | "url": "https://blog.benoitblanchon.fr" 14 | }, 15 | "exclude": [ 16 | "fuzzing", 17 | "scripts", 18 | "test", 19 | "third-party" 20 | ], 21 | "frameworks": "arduino", 22 | "platforms": "*" 23 | } 24 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/library.properties: -------------------------------------------------------------------------------- 1 | name=ArduinoJson 2 | version=5.13.4 3 | author=Benoit Blanchon 4 | maintainer=Benoit Blanchon 5 | sentence=An efficient and elegant JSON library for Arduino. 6 | paragraph=ArduinoJson supports ✔ serialization, ✔ deserialization, ✔ fixed allocation, ✔ zero-copy, ✔ streams, and more. It is the most popular Arduino library on GitHub ❤❤❤❤❤. Check out arduinojson.org for a comprehensive documentation. 7 | category=Data Processing 8 | url=https://arduinojson.org/?utm_source=meta&utm_medium=library.properties 9 | architectures=* 10 | repository=https://github.com/bblanchon/ArduinoJson.git 11 | license=MIT 12 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson.h: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #ifdef __cplusplus 8 | 9 | #include "ArduinoJson.hpp" 10 | 11 | using namespace ArduinoJson; 12 | 13 | #else 14 | 15 | #error ArduinoJson requires a C++ compiler, please change file extension to .cc or .cpp 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "ArduinoJson/version.hpp" 8 | 9 | #include "ArduinoJson/DynamicJsonBuffer.hpp" 10 | #include "ArduinoJson/JsonArray.hpp" 11 | #include "ArduinoJson/JsonObject.hpp" 12 | #include "ArduinoJson/StaticJsonBuffer.hpp" 13 | 14 | #include "ArduinoJson/Deserialization/JsonParserImpl.hpp" 15 | #include "ArduinoJson/JsonArrayImpl.hpp" 16 | #include "ArduinoJson/JsonBufferImpl.hpp" 17 | #include "ArduinoJson/JsonObjectImpl.hpp" 18 | #include "ArduinoJson/JsonVariantImpl.hpp" 19 | #include "ArduinoJson/Serialization/JsonSerializerImpl.hpp" 20 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/Data/Encoding.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | namespace ArduinoJson { 8 | namespace Internals { 9 | 10 | class Encoding { 11 | public: 12 | // Optimized for code size on a 8-bit AVR 13 | static char escapeChar(char c) { 14 | const char *p = escapeTable(false); 15 | while (p[0] && p[1] != c) { 16 | p += 2; 17 | } 18 | return p[0]; 19 | } 20 | 21 | // Optimized for code size on a 8-bit AVR 22 | static char unescapeChar(char c) { 23 | const char *p = escapeTable(true); 24 | for (;;) { 25 | if (p[0] == '\0') return c; 26 | if (p[0] == c) return p[1]; 27 | p += 2; 28 | } 29 | } 30 | 31 | private: 32 | static const char *escapeTable(bool excludeIdenticals) { 33 | return &"\"\"\\\\b\bf\fn\nr\rt\t"[excludeIdenticals ? 4 : 0]; 34 | } 35 | }; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/Data/JsonBufferAllocated.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../JsonBuffer.hpp" 8 | 9 | namespace ArduinoJson { 10 | namespace Internals { 11 | 12 | class JsonBufferAllocated { 13 | public: 14 | void *operator new(size_t n, JsonBuffer *jsonBuffer) throw() { 15 | if (!jsonBuffer) return NULL; 16 | return jsonBuffer->alloc(n); 17 | } 18 | 19 | void operator delete(void *, JsonBuffer *)throw(); 20 | }; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/Data/JsonFloat.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Configuration.hpp" 8 | 9 | namespace ArduinoJson { 10 | namespace Internals { 11 | 12 | #if ARDUINOJSON_USE_DOUBLE 13 | typedef double JsonFloat; 14 | #else 15 | typedef float JsonFloat; 16 | #endif 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/Data/JsonInteger.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Configuration.hpp" 8 | 9 | namespace ArduinoJson { 10 | namespace Internals { 11 | 12 | #if ARDUINOJSON_USE_LONG_LONG 13 | typedef long long JsonInteger; 14 | typedef unsigned long long JsonUInt; 15 | #elif ARDUINOJSON_USE_INT64 16 | typedef __int64 JsonInteger; 17 | typedef unsigned _int64 JsonUInt; 18 | #else 19 | typedef long JsonInteger; 20 | typedef unsigned long JsonUInt; 21 | #endif 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/Data/JsonVariantAs.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | namespace ArduinoJson { 8 | namespace Internals { 9 | 10 | // A metafunction that returns the type of the value returned by 11 | // JsonVariant::as() 12 | template 13 | struct JsonVariantAs { 14 | typedef T type; 15 | }; 16 | 17 | template <> 18 | struct JsonVariantAs { 19 | typedef const char* type; 20 | }; 21 | 22 | template <> 23 | struct JsonVariantAs { 24 | typedef JsonArray& type; 25 | }; 26 | 27 | template <> 28 | struct JsonVariantAs { 29 | typedef const JsonArray& type; 30 | }; 31 | 32 | template <> 33 | struct JsonVariantAs { 34 | typedef JsonObject& type; 35 | }; 36 | 37 | template <> 38 | struct JsonVariantAs { 39 | typedef const JsonObject& type; 40 | }; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/Data/JsonVariantContent.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "JsonFloat.hpp" 8 | #include "JsonInteger.hpp" 9 | 10 | namespace ArduinoJson { 11 | 12 | // Forward declarations 13 | class JsonArray; 14 | class JsonObject; 15 | 16 | namespace Internals { 17 | // A union that defines the actual content of a JsonVariant. 18 | // The enum JsonVariantType determines which member is in use. 19 | union JsonVariantContent { 20 | JsonFloat asFloat; // used for double and float 21 | JsonUInt asInteger; // used for bool, char, short, int and longs 22 | const char* asString; // asString can be null 23 | JsonArray* asArray; // asArray cannot be null 24 | JsonObject* asObject; // asObject cannot be null 25 | }; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/Data/JsonVariantDefault.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | namespace ArduinoJson { 8 | namespace Internals { 9 | 10 | template 11 | struct JsonVariantDefault { 12 | static T get() { 13 | return T(); 14 | } 15 | }; 16 | 17 | template 18 | struct JsonVariantDefault : JsonVariantDefault {}; 19 | 20 | template 21 | struct JsonVariantDefault : JsonVariantDefault {}; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/Data/JsonVariantType.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | namespace ArduinoJson { 8 | class JsonArray; 9 | class JsonObject; 10 | 11 | namespace Internals { 12 | 13 | // Enumerated type to know the current type of a JsonVariant. 14 | // The value determines which member of JsonVariantContent is used. 15 | enum JsonVariantType { 16 | JSON_UNDEFINED, // JsonVariant has not been initialized 17 | JSON_UNPARSED, // JsonVariant contains an unparsed string 18 | JSON_STRING, // JsonVariant stores a const char* 19 | JSON_BOOLEAN, // JsonVariant stores a bool 20 | JSON_POSITIVE_INTEGER, // JsonVariant stores an JsonUInt 21 | JSON_NEGATIVE_INTEGER, // JsonVariant stores an JsonUInt that must be negated 22 | JSON_ARRAY, // JsonVariant stores a pointer to a JsonArray 23 | JSON_OBJECT, // JsonVariant stores a pointer to a JsonObject 24 | JSON_FLOAT // JsonVariant stores a JsonFloat 25 | }; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/Data/List.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../JsonBuffer.hpp" 8 | #include "ListConstIterator.hpp" 9 | #include "ListIterator.hpp" 10 | 11 | namespace ArduinoJson { 12 | namespace Internals { 13 | 14 | // A singly linked list of T. 15 | // The linked list is composed of ListNode. 16 | // It is derived by JsonArray and JsonObject 17 | template 18 | class List { 19 | public: 20 | typedef T value_type; 21 | typedef ListNode node_type; 22 | typedef ListIterator iterator; 23 | typedef ListConstIterator const_iterator; 24 | 25 | // Creates an empty List attached to a JsonBuffer. 26 | // The JsonBuffer allows to allocate new nodes. 27 | // When buffer is NULL, the List is not able to grow and success() returns 28 | // false. This is used to identify bad memory allocations and parsing 29 | // failures. 30 | explicit List(JsonBuffer *buffer) : _buffer(buffer), _firstNode(NULL) {} 31 | 32 | // Returns true if the object is valid 33 | // Would return false in the following situation: 34 | // - the memory allocation failed (StaticJsonBuffer was too small) 35 | // - the JSON parsing failed 36 | bool success() const { 37 | return _buffer != NULL; 38 | } 39 | 40 | // Returns the numbers of elements in the list. 41 | // For a JsonObject, it would return the number of key-value pairs 42 | size_t size() const { 43 | size_t nodeCount = 0; 44 | for (node_type *node = _firstNode; node; node = node->next) nodeCount++; 45 | return nodeCount; 46 | } 47 | 48 | iterator add() { 49 | node_type *newNode = new (_buffer) node_type(); 50 | 51 | if (_firstNode) { 52 | node_type *lastNode = _firstNode; 53 | while (lastNode->next) lastNode = lastNode->next; 54 | lastNode->next = newNode; 55 | } else { 56 | _firstNode = newNode; 57 | } 58 | 59 | return iterator(newNode); 60 | } 61 | 62 | iterator begin() { 63 | return iterator(_firstNode); 64 | } 65 | iterator end() { 66 | return iterator(NULL); 67 | } 68 | 69 | const_iterator begin() const { 70 | return const_iterator(_firstNode); 71 | } 72 | const_iterator end() const { 73 | return const_iterator(NULL); 74 | } 75 | 76 | void remove(iterator it) { 77 | node_type *nodeToRemove = it._node; 78 | if (!nodeToRemove) return; 79 | if (nodeToRemove == _firstNode) { 80 | _firstNode = nodeToRemove->next; 81 | } else { 82 | for (node_type *node = _firstNode; node; node = node->next) 83 | if (node->next == nodeToRemove) node->next = nodeToRemove->next; 84 | } 85 | } 86 | 87 | protected: 88 | JsonBuffer *_buffer; 89 | 90 | private: 91 | node_type *_firstNode; 92 | }; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/Data/ListConstIterator.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "ListNode.hpp" 8 | 9 | namespace ArduinoJson { 10 | namespace Internals { 11 | 12 | // A read-only forward itertor for List 13 | template 14 | class ListConstIterator { 15 | public: 16 | explicit ListConstIterator(const ListNode *node = NULL) : _node(node) {} 17 | 18 | const T &operator*() const { 19 | return _node->content; 20 | } 21 | const T *operator->() { 22 | return &_node->content; 23 | } 24 | 25 | bool operator==(const ListConstIterator &other) const { 26 | return _node == other._node; 27 | } 28 | 29 | bool operator!=(const ListConstIterator &other) const { 30 | return _node != other._node; 31 | } 32 | 33 | ListConstIterator &operator++() { 34 | if (_node) _node = _node->next; 35 | return *this; 36 | } 37 | 38 | ListConstIterator &operator+=(size_t distance) { 39 | while (_node && distance) { 40 | _node = _node->next; 41 | --distance; 42 | } 43 | return *this; 44 | } 45 | 46 | private: 47 | const ListNode *_node; 48 | }; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/Data/ListIterator.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "ListConstIterator.hpp" 8 | #include "ListNode.hpp" 9 | 10 | namespace ArduinoJson { 11 | namespace Internals { 12 | 13 | template 14 | class List; 15 | 16 | // A read-write forward iterator for List 17 | template 18 | class ListIterator { 19 | friend class List; 20 | 21 | public: 22 | explicit ListIterator(ListNode *node = NULL) : _node(node) {} 23 | 24 | T &operator*() const { 25 | return _node->content; 26 | } 27 | T *operator->() { 28 | return &_node->content; 29 | } 30 | 31 | bool operator==(const ListIterator &other) const { 32 | return _node == other._node; 33 | } 34 | 35 | bool operator!=(const ListIterator &other) const { 36 | return _node != other._node; 37 | } 38 | 39 | ListIterator &operator++() { 40 | if (_node) _node = _node->next; 41 | return *this; 42 | } 43 | 44 | ListIterator &operator+=(size_t distance) { 45 | while (_node && distance) { 46 | _node = _node->next; 47 | --distance; 48 | } 49 | return *this; 50 | } 51 | 52 | operator ListConstIterator() const { 53 | return ListConstIterator(_node); 54 | } 55 | 56 | private: 57 | ListNode *_node; 58 | }; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/Data/ListNode.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include // for NULL 8 | 9 | #include "JsonBufferAllocated.hpp" 10 | 11 | namespace ArduinoJson { 12 | namespace Internals { 13 | 14 | // A node for a singly-linked list. 15 | // Used by List and its iterators. 16 | template 17 | struct ListNode : public Internals::JsonBufferAllocated { 18 | ListNode() throw() : next(NULL) {} 19 | 20 | ListNode *next; 21 | T content; 22 | }; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/Data/NonCopyable.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | namespace ArduinoJson { 8 | namespace Internals { 9 | 10 | // A type that cannot be copied 11 | class NonCopyable { 12 | protected: 13 | NonCopyable() {} 14 | 15 | private: 16 | // copy constructor is private 17 | NonCopyable(const NonCopyable&); 18 | 19 | // copy operator is private 20 | NonCopyable& operator=(const NonCopyable&); 21 | }; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/Data/ReferenceType.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | namespace ArduinoJson { 8 | namespace Internals { 9 | 10 | // A type that is meant to be used by reference only (JsonArray and JsonObject) 11 | class ReferenceType { 12 | public: 13 | bool operator==(const ReferenceType& other) const { 14 | // two JsonArray are equal if they are the same instance 15 | // (we don't compare the content) 16 | return this == &other; 17 | } 18 | 19 | bool operator!=(const ReferenceType& other) const { 20 | return this != &other; 21 | } 22 | }; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/Data/ValueSaver.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../JsonBuffer.hpp" 8 | #include "../JsonVariant.hpp" 9 | #include "../StringTraits/StringTraits.hpp" 10 | #include "../TypeTraits/EnableIf.hpp" 11 | 12 | namespace ArduinoJson { 13 | namespace Internals { 14 | 15 | template 16 | struct ValueSaver { 17 | template 18 | static bool save(JsonBuffer*, Destination& destination, Source source) { 19 | destination = source; 20 | return true; 21 | } 22 | }; 23 | 24 | template 25 | struct ValueSaver< 26 | Source, typename EnableIf::should_duplicate>::type> { 27 | template 28 | static bool save(JsonBuffer* buffer, Destination& dest, Source source) { 29 | if (!StringTraits::is_null(source)) { 30 | typename StringTraits::duplicate_t dup = 31 | StringTraits::duplicate(source, buffer); 32 | if (!dup) return false; 33 | dest = dup; 34 | } else { 35 | dest = reinterpret_cast(0); 36 | } 37 | return true; 38 | } 39 | }; 40 | 41 | // const char*, const signed char*, const unsigned char* 42 | template 43 | struct ValueSaver< 44 | Char*, typename EnableIf::should_duplicate>::type> { 45 | template 46 | static bool save(JsonBuffer*, Destination& dest, Char* source) { 47 | dest = reinterpret_cast(source); 48 | return true; 49 | } 50 | }; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/Deserialization/Comments.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | namespace ArduinoJson { 8 | namespace Internals { 9 | template 10 | void skipSpacesAndComments(TInput& input) { 11 | for (;;) { 12 | switch (input.current()) { 13 | // spaces 14 | case ' ': 15 | case '\t': 16 | case '\r': 17 | case '\n': 18 | input.move(); 19 | continue; 20 | 21 | // comments 22 | case '/': 23 | switch (input.next()) { 24 | // C-style block comment 25 | case '*': 26 | input.move(); // skip '/' 27 | // no need to skip '*' 28 | for (;;) { 29 | input.move(); 30 | if (input.current() == '\0') return; 31 | if (input.current() == '*' && input.next() == '/') { 32 | input.move(); // skip '*' 33 | input.move(); // skip '/' 34 | break; 35 | } 36 | } 37 | break; 38 | 39 | // C++-style line comment 40 | case '/': 41 | // not need to skip "//" 42 | for (;;) { 43 | input.move(); 44 | if (input.current() == '\0') return; 45 | if (input.current() == '\n') break; 46 | } 47 | break; 48 | 49 | // not a comment, just a '/' 50 | default: 51 | return; 52 | } 53 | break; 54 | 55 | default: 56 | return; 57 | } 58 | } 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/Deserialization/StringWriter.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | namespace ArduinoJson { 8 | namespace Internals { 9 | 10 | template 11 | class StringWriter { 12 | public: 13 | class String { 14 | public: 15 | String(TChar** ptr) : _writePtr(ptr), _startPtr(*ptr) {} 16 | 17 | void append(char c) { 18 | *(*_writePtr)++ = TChar(c); 19 | } 20 | 21 | const char* c_str() const { 22 | *(*_writePtr)++ = 0; 23 | return reinterpret_cast(_startPtr); 24 | } 25 | 26 | private: 27 | TChar** _writePtr; 28 | TChar* _startPtr; 29 | }; 30 | 31 | StringWriter(TChar* buffer) : _ptr(buffer) {} 32 | 33 | String startString() { 34 | return String(&_ptr); 35 | } 36 | 37 | private: 38 | TChar* _ptr; 39 | }; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/JsonArrayImpl.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "JsonArray.hpp" 8 | #include "JsonArraySubscript.hpp" 9 | #include "JsonObject.hpp" 10 | 11 | namespace ArduinoJson { 12 | 13 | inline JsonArray &JsonArray::createNestedArray() { 14 | if (!_buffer) return JsonArray::invalid(); 15 | JsonArray &array = _buffer->createArray(); 16 | add(array); 17 | return array; 18 | } 19 | 20 | inline JsonObject &JsonArray::createNestedObject() { 21 | if (!_buffer) return JsonObject::invalid(); 22 | JsonObject &object = _buffer->createObject(); 23 | add(object); 24 | return object; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/JsonBuffer.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include // for size_t 8 | #include // for uint8_t 9 | #include 10 | 11 | #include "Data/NonCopyable.hpp" 12 | #include "JsonVariant.hpp" 13 | #include "TypeTraits/EnableIf.hpp" 14 | #include "TypeTraits/IsArray.hpp" 15 | 16 | namespace ArduinoJson { 17 | class JsonArray; 18 | class JsonObject; 19 | 20 | // Entry point for using the library. 21 | // 22 | // Handle the memory management (done in derived classes) and calls the parser. 23 | // This abstract class is implemented by StaticJsonBuffer which implements a 24 | // fixed memory allocation. 25 | class JsonBuffer : Internals::NonCopyable { 26 | public: 27 | // Allocates an empty JsonArray. 28 | // 29 | // Returns a reference to the new JsonArray or JsonArray::invalid() if the 30 | // allocation fails. 31 | JsonArray &createArray(); 32 | 33 | // Allocates an empty JsonObject. 34 | // 35 | // Returns a reference to the new JsonObject or JsonObject::invalid() if the 36 | // allocation fails. 37 | JsonObject &createObject(); 38 | 39 | // Duplicates a string 40 | // 41 | // const char* strdup(TValue); 42 | // TValue = const std::string&, const String&, 43 | template 44 | DEPRECATED("char* are duplicated, you don't need strdup() anymore") 45 | typename Internals::EnableIf::value, 46 | const char *>::type strdup(const TString &src) { 47 | return Internals::StringTraits::duplicate(src, this); 48 | } 49 | // 50 | // const char* strdup(TValue); 51 | // TValue = char*, const char*, const FlashStringHelper* 52 | template 53 | DEPRECATED("char* are duplicated, you don't need strdup() anymore") 54 | const char *strdup(TString *src) { 55 | return Internals::StringTraits::duplicate(src, this); 56 | } 57 | 58 | // Allocates n bytes in the JsonBuffer. 59 | // Return a pointer to the allocated memory or NULL if allocation fails. 60 | virtual void *alloc(size_t size) = 0; 61 | 62 | protected: 63 | // CAUTION: NO VIRTUAL DESTRUCTOR! 64 | // If we add a virtual constructor the Arduino compiler will add malloc() 65 | // and free() to the binary, adding 706 useless bytes. 66 | ~JsonBuffer() {} 67 | 68 | // Preserve aligment if necessary 69 | static FORCE_INLINE size_t round_size_up(size_t bytes) { 70 | #if ARDUINOJSON_ENABLE_ALIGNMENT 71 | const size_t x = sizeof(void *) - 1; 72 | return (bytes + x) & ~x; 73 | #else 74 | return bytes; 75 | #endif 76 | } 77 | }; 78 | } 79 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/JsonBufferImpl.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "Deserialization/JsonParser.hpp" 8 | 9 | inline ArduinoJson::JsonArray &ArduinoJson::JsonBuffer::createArray() { 10 | JsonArray *ptr = new (this) JsonArray(this); 11 | return ptr ? *ptr : JsonArray::invalid(); 12 | } 13 | 14 | inline ArduinoJson::JsonObject &ArduinoJson::JsonBuffer::createObject() { 15 | JsonObject *ptr = new (this) JsonObject(this); 16 | return ptr ? *ptr : JsonObject::invalid(); 17 | } 18 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/JsonObjectImpl.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "JsonArray.hpp" 8 | #include "JsonObject.hpp" 9 | #include "JsonObjectSubscript.hpp" 10 | 11 | namespace ArduinoJson { 12 | 13 | template 14 | inline JsonArray &JsonObject::createNestedArray_impl(TStringRef key) { 15 | if (!_buffer) return JsonArray::invalid(); 16 | JsonArray &array = _buffer->createArray(); 17 | set(key, array); 18 | return array; 19 | } 20 | 21 | template 22 | inline JsonObject &JsonObject::createNestedObject_impl(TStringRef key) { 23 | if (!_buffer) return JsonObject::invalid(); 24 | JsonObject &object = _buffer->createObject(); 25 | set(key, object); 26 | return object; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/JsonPair.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "JsonVariant.hpp" 8 | 9 | namespace ArduinoJson { 10 | 11 | // A key value pair for JsonObject. 12 | struct JsonPair { 13 | const char* key; 14 | JsonVariant value; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/JsonVariantBase.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "JsonVariantCasts.hpp" 8 | #include "JsonVariantComparisons.hpp" 9 | #include "JsonVariantOr.hpp" 10 | #include "JsonVariantSubscripts.hpp" 11 | #include "Serialization/JsonPrintable.hpp" 12 | 13 | namespace ArduinoJson { 14 | namespace Internals { 15 | 16 | template 17 | class JsonVariantBase : public JsonPrintable, 18 | public JsonVariantCasts, 19 | public JsonVariantComparisons, 20 | public JsonVariantOr, 21 | public JsonVariantSubscripts, 22 | public JsonVariantTag {}; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/JsonVariantCasts.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "Data/JsonVariantAs.hpp" 8 | #include "Polyfills/attributes.hpp" 9 | 10 | namespace ArduinoJson { 11 | namespace Internals { 12 | 13 | template 14 | class JsonVariantCasts { 15 | public: 16 | #if ARDUINOJSON_ENABLE_DEPRECATED 17 | DEPRECATED("use as() instead") 18 | FORCE_INLINE JsonArray &asArray() const { 19 | return impl()->template as(); 20 | } 21 | 22 | DEPRECATED("use as() instead") 23 | FORCE_INLINE JsonObject &asObject() const { 24 | return impl()->template as(); 25 | } 26 | 27 | DEPRECATED("use as() instead") 28 | FORCE_INLINE const char *asString() const { 29 | return impl()->template as(); 30 | } 31 | #endif 32 | 33 | // Gets the variant as an array. 34 | // Returns a reference to the JsonArray or JsonArray::invalid() if the 35 | // variant 36 | // is not an array. 37 | FORCE_INLINE operator JsonArray &() const { 38 | return impl()->template as(); 39 | } 40 | 41 | // Gets the variant as an object. 42 | // Returns a reference to the JsonObject or JsonObject::invalid() if the 43 | // variant is not an object. 44 | FORCE_INLINE operator JsonObject &() const { 45 | return impl()->template as(); 46 | } 47 | 48 | template 49 | FORCE_INLINE operator T() const { 50 | return impl()->template as(); 51 | } 52 | 53 | private: 54 | const TImpl *impl() const { 55 | return static_cast(this); 56 | } 57 | }; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/JsonVariantOr.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "Data/JsonVariantAs.hpp" 8 | #include "Polyfills/attributes.hpp" 9 | #include "TypeTraits/EnableIf.hpp" 10 | #include "TypeTraits/IsIntegral.hpp" 11 | 12 | namespace ArduinoJson { 13 | namespace Internals { 14 | 15 | template 16 | class JsonVariantOr { 17 | public: 18 | // Returns the default value if the JsonVariant is undefined of incompatible 19 | template 20 | typename EnableIf::value, T>::type operator|( 21 | const T &defaultValue) const { 22 | if (impl()->template is()) 23 | return impl()->template as(); 24 | else 25 | return defaultValue; 26 | } 27 | 28 | // Returns the default value if the JsonVariant is undefined of incompatible 29 | // Special case for string: null is treated as undefined 30 | const char *operator|(const char *defaultValue) const { 31 | const char *value = impl()->template as(); 32 | return value ? value : defaultValue; 33 | } 34 | 35 | // Returns the default value if the JsonVariant is undefined of incompatible 36 | // Special case for integers: we also accept double 37 | template 38 | typename EnableIf::value, Integer>::type operator|( 39 | const Integer &defaultValue) const { 40 | if (impl()->template is()) 41 | return impl()->template as(); 42 | else 43 | return defaultValue; 44 | } 45 | 46 | private: 47 | const TImpl *impl() const { 48 | return static_cast(this); 49 | } 50 | }; 51 | } // namespace Internals 52 | } // namespace ArduinoJson 53 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/Polyfills/attributes.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #ifdef _MSC_VER // Visual Studio 8 | 9 | #define FORCE_INLINE // __forceinline causes C4714 when returning std::string 10 | #define NO_INLINE __declspec(noinline) 11 | #define DEPRECATED(msg) __declspec(deprecated(msg)) 12 | 13 | #elif defined(__GNUC__) // GCC or Clang 14 | 15 | #define FORCE_INLINE __attribute__((always_inline)) 16 | #define NO_INLINE __attribute__((noinline)) 17 | #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) 18 | #define DEPRECATED(msg) __attribute__((deprecated(msg))) 19 | #else 20 | #define DEPRECATED(msg) __attribute__((deprecated)) 21 | #endif 22 | 23 | #else // Other compilers 24 | 25 | #define FORCE_INLINE 26 | #define NO_INLINE 27 | #define DEPRECATED(msg) 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/Polyfills/ctype.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | namespace ArduinoJson { 8 | namespace Internals { 9 | 10 | inline bool isdigit(char c) { 11 | return '0' <= c && c <= '9'; 12 | } 13 | 14 | inline bool issign(char c) { 15 | return '-' == c || c == '+'; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/Polyfills/isFloat.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include // for strcmp 8 | #include "./ctype.hpp" 9 | 10 | namespace ArduinoJson { 11 | namespace Internals { 12 | 13 | inline bool isFloat(const char* s) { 14 | if (!s) return false; 15 | 16 | if (!strcmp(s, "NaN")) return true; 17 | if (issign(*s)) s++; 18 | if (!strcmp(s, "Infinity")) return true; 19 | if (*s == '\0') return false; 20 | 21 | while (isdigit(*s)) s++; 22 | 23 | if (*s == '.') { 24 | s++; 25 | while (isdigit(*s)) s++; 26 | } 27 | 28 | if (*s == 'e' || *s == 'E') { 29 | s++; 30 | if (issign(*s)) s++; 31 | if (!isdigit(*s)) return false; 32 | while (isdigit(*s)) s++; 33 | } 34 | 35 | return *s == '\0'; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/Polyfills/isInteger.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "./ctype.hpp" 8 | 9 | namespace ArduinoJson { 10 | namespace Internals { 11 | 12 | inline bool isInteger(const char* s) { 13 | if (!s || !*s) return false; 14 | if (issign(*s)) s++; 15 | while (isdigit(*s)) s++; 16 | return *s == '\0'; 17 | } 18 | } // namespace Internals 19 | } // namespace ArduinoJson 20 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/Polyfills/math.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | namespace ArduinoJson { 8 | namespace Internals { 9 | template 10 | bool isNaN(T x) { 11 | return x != x; 12 | } 13 | 14 | template 15 | bool isInfinity(T x) { 16 | return x != 0.0 && x * 2 == x; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/Polyfills/parseFloat.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../TypeTraits/FloatTraits.hpp" 8 | #include "./ctype.hpp" 9 | #include "./math.hpp" 10 | 11 | namespace ArduinoJson { 12 | namespace Internals { 13 | 14 | template 15 | inline T parseFloat(const char* s) { 16 | typedef FloatTraits traits; 17 | typedef typename traits::mantissa_type mantissa_t; 18 | typedef typename traits::exponent_type exponent_t; 19 | 20 | if (!s) return 0; // NULL 21 | 22 | bool negative_result = false; 23 | switch (*s) { 24 | case '-': 25 | negative_result = true; 26 | s++; 27 | break; 28 | case '+': 29 | s++; 30 | break; 31 | } 32 | 33 | if (*s == 't') return 1; // true 34 | if (*s == 'n' || *s == 'N') return traits::nan(); 35 | if (*s == 'i' || *s == 'I') 36 | return negative_result ? -traits::inf() : traits::inf(); 37 | 38 | mantissa_t mantissa = 0; 39 | exponent_t exponent_offset = 0; 40 | 41 | while (isdigit(*s)) { 42 | if (mantissa < traits::mantissa_max / 10) 43 | mantissa = mantissa * 10 + (*s - '0'); 44 | else 45 | exponent_offset++; 46 | s++; 47 | } 48 | 49 | if (*s == '.') { 50 | s++; 51 | while (isdigit(*s)) { 52 | if (mantissa < traits::mantissa_max / 10) { 53 | mantissa = mantissa * 10 + (*s - '0'); 54 | exponent_offset--; 55 | } 56 | s++; 57 | } 58 | } 59 | 60 | int exponent = 0; 61 | if (*s == 'e' || *s == 'E') { 62 | s++; 63 | bool negative_exponent = false; 64 | if (*s == '-') { 65 | negative_exponent = true; 66 | s++; 67 | } else if (*s == '+') { 68 | s++; 69 | } 70 | 71 | while (isdigit(*s)) { 72 | exponent = exponent * 10 + (*s - '0'); 73 | if (exponent + exponent_offset > traits::exponent_max) { 74 | if (negative_exponent) 75 | return negative_result ? -0.0f : 0.0f; 76 | else 77 | return negative_result ? -traits::inf() : traits::inf(); 78 | } 79 | s++; 80 | } 81 | if (negative_exponent) exponent = -exponent; 82 | } 83 | exponent += exponent_offset; 84 | 85 | T result = traits::make_float(static_cast(mantissa), exponent); 86 | 87 | return negative_result ? -result : result; 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/Polyfills/parseInteger.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #include "../Configuration.hpp" 10 | #include "./ctype.hpp" 11 | 12 | namespace ArduinoJson { 13 | namespace Internals { 14 | template 15 | T parseInteger(const char *s) { 16 | if (!s) return 0; // NULL 17 | 18 | if (*s == 't') return 1; // "true" 19 | 20 | T result = 0; 21 | bool negative_result = false; 22 | 23 | switch (*s) { 24 | case '-': 25 | negative_result = true; 26 | s++; 27 | break; 28 | case '+': 29 | s++; 30 | break; 31 | } 32 | 33 | while (isdigit(*s)) { 34 | result = T(result * 10 + T(*s - '0')); 35 | s++; 36 | } 37 | 38 | return negative_result ? T(~result + 1) : result; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/RawJson.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | namespace ArduinoJson { 8 | 9 | namespace Internals { 10 | // A special type of data that can be used to insert pregenerated JSON portions. 11 | template 12 | class RawJsonString { 13 | public: 14 | explicit RawJsonString(T str) : _str(str) {} 15 | operator T() const { 16 | return _str; 17 | } 18 | 19 | private: 20 | T _str; 21 | }; 22 | 23 | template 24 | struct StringTraits, void> { 25 | static bool is_null(RawJsonString source) { 26 | return StringTraits::is_null(static_cast(source)); 27 | } 28 | 29 | typedef RawJsonString duplicate_t; 30 | 31 | template 32 | static duplicate_t duplicate(RawJsonString source, Buffer* buffer) { 33 | return duplicate_t(StringTraits::duplicate(source, buffer)); 34 | } 35 | 36 | static const bool has_append = false; 37 | static const bool has_equals = false; 38 | static const bool should_duplicate = StringTraits::should_duplicate; 39 | }; 40 | } 41 | 42 | template 43 | inline Internals::RawJsonString RawJson(T str) { 44 | return Internals::RawJsonString(str); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/Serialization/DummyPrint.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | namespace ArduinoJson { 8 | namespace Internals { 9 | 10 | // A dummy Print implementation used in JsonPrintable::measureLength() 11 | class DummyPrint { 12 | public: 13 | size_t print(char) { 14 | return 1; 15 | } 16 | 17 | size_t print(const char* s) { 18 | return strlen(s); 19 | } 20 | }; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/Serialization/DynamicStringBuilder.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../StringTraits/StringTraits.hpp" 8 | 9 | namespace ArduinoJson { 10 | namespace Internals { 11 | 12 | // A Print implementation that allows to write in a String 13 | template 14 | class DynamicStringBuilder { 15 | public: 16 | DynamicStringBuilder(TString &str) : _str(str) {} 17 | 18 | size_t print(char c) { 19 | StringTraits::append(_str, c); 20 | return 1; 21 | } 22 | 23 | size_t print(const char *s) { 24 | size_t initialLen = _str.length(); 25 | StringTraits::append(_str, s); 26 | return _str.length() - initialLen; 27 | } 28 | 29 | private: 30 | DynamicStringBuilder &operator=(const DynamicStringBuilder &); 31 | 32 | TString &_str; 33 | }; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/Serialization/FloatParts.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Configuration.hpp" 8 | #include "../Polyfills/math.hpp" 9 | #include "../TypeTraits/FloatTraits.hpp" 10 | 11 | namespace ArduinoJson { 12 | namespace Internals { 13 | 14 | template 15 | struct FloatParts { 16 | uint32_t integral; 17 | uint32_t decimal; 18 | int16_t exponent; 19 | int8_t decimalPlaces; 20 | 21 | FloatParts(TFloat value) { 22 | uint32_t maxDecimalPart = sizeof(TFloat) >= 8 ? 1000000000 : 1000000; 23 | decimalPlaces = sizeof(TFloat) >= 8 ? 9 : 6; 24 | 25 | exponent = normalize(value); 26 | 27 | integral = uint32_t(value); 28 | // reduce number of decimal places by the number of integral places 29 | for (uint32_t tmp = integral; tmp >= 10; tmp /= 10) { 30 | maxDecimalPart /= 10; 31 | decimalPlaces--; 32 | } 33 | 34 | TFloat remainder = (value - TFloat(integral)) * TFloat(maxDecimalPart); 35 | 36 | decimal = uint32_t(remainder); 37 | remainder = remainder - TFloat(decimal); 38 | 39 | // rounding: 40 | // increment by 1 if remainder >= 0.5 41 | decimal += uint32_t(remainder * 2); 42 | if (decimal >= maxDecimalPart) { 43 | decimal = 0; 44 | integral++; 45 | if (exponent && integral >= 10) { 46 | exponent++; 47 | integral = 1; 48 | } 49 | } 50 | 51 | // remove trailing zeros 52 | while (decimal % 10 == 0 && decimalPlaces > 0) { 53 | decimal /= 10; 54 | decimalPlaces--; 55 | } 56 | } 57 | 58 | static int16_t normalize(TFloat& value) { 59 | typedef FloatTraits traits; 60 | int16_t powersOf10 = 0; 61 | 62 | int8_t index = sizeof(TFloat) == 8 ? 8 : 5; 63 | int bit = 1 << index; 64 | 65 | if (value >= ARDUINOJSON_POSITIVE_EXPONENTIATION_THRESHOLD) { 66 | for (; index >= 0; index--) { 67 | if (value >= traits::positiveBinaryPowerOfTen(index)) { 68 | value *= traits::negativeBinaryPowerOfTen(index); 69 | powersOf10 = int16_t(powersOf10 + bit); 70 | } 71 | bit >>= 1; 72 | } 73 | } 74 | 75 | if (value > 0 && value <= ARDUINOJSON_NEGATIVE_EXPONENTIATION_THRESHOLD) { 76 | for (; index >= 0; index--) { 77 | if (value < traits::negativeBinaryPowerOfTenPlusOne(index)) { 78 | value *= traits::positiveBinaryPowerOfTen(index); 79 | powersOf10 = int16_t(powersOf10 - bit); 80 | } 81 | bit >>= 1; 82 | } 83 | } 84 | 85 | return powersOf10; 86 | } 87 | }; 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/Serialization/IndentedPrint.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | namespace ArduinoJson { 8 | namespace Internals { 9 | 10 | // Decorator on top of Print to allow indented output. 11 | // This class is used by JsonPrintable::prettyPrintTo() but can also be used 12 | // for your own purpose, like logging. 13 | template 14 | class IndentedPrint { 15 | public: 16 | explicit IndentedPrint(Print &p) : sink(&p) { 17 | level = 0; 18 | tabSize = 2; 19 | isNewLine = true; 20 | } 21 | 22 | size_t print(char c) { 23 | size_t n = 0; 24 | if (isNewLine) n += writeTabs(); 25 | n += sink->print(c); 26 | isNewLine = c == '\n'; 27 | return n; 28 | } 29 | 30 | size_t print(const char *s) { 31 | // TODO: optimize 32 | size_t n = 0; 33 | while (*s) n += print(*s++); 34 | return n; 35 | } 36 | 37 | // Adds one level of indentation 38 | void indent() { 39 | if (level < MAX_LEVEL) level++; 40 | } 41 | 42 | // Removes one level of indentation 43 | void unindent() { 44 | if (level > 0) level--; 45 | } 46 | 47 | // Set the number of space printed for each level of indentation 48 | void setTabSize(uint8_t n) { 49 | if (n < MAX_TAB_SIZE) tabSize = n & MAX_TAB_SIZE; 50 | } 51 | 52 | private: 53 | Print *sink; 54 | uint8_t level : 4; 55 | uint8_t tabSize : 3; 56 | bool isNewLine : 1; 57 | 58 | size_t writeTabs() { 59 | size_t n = 0; 60 | for (int i = 0; i < level * tabSize; i++) n += sink->print(' '); 61 | return n; 62 | } 63 | 64 | static const int MAX_LEVEL = 15; // because it's only 4 bits 65 | static const int MAX_TAB_SIZE = 7; // because it's only 3 bits 66 | }; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/Serialization/JsonSerializer.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "JsonWriter.hpp" 8 | 9 | namespace ArduinoJson { 10 | 11 | class JsonArray; 12 | class JsonObject; 13 | class JsonVariant; 14 | 15 | namespace Internals { 16 | 17 | class JsonArraySubscript; 18 | template 19 | class JsonObjectSubscript; 20 | 21 | template 22 | class JsonSerializer { 23 | public: 24 | static void serialize(const JsonArray &, Writer &); 25 | static void serialize(const JsonArraySubscript &, Writer &); 26 | static void serialize(const JsonObject &, Writer &); 27 | template 28 | static void serialize(const JsonObjectSubscript &, Writer &); 29 | static void serialize(const JsonVariant &, Writer &); 30 | }; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/Serialization/StaticStringBuilder.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | namespace ArduinoJson { 8 | namespace Internals { 9 | 10 | // A Print implementation that allows to write in a char[] 11 | class StaticStringBuilder { 12 | public: 13 | StaticStringBuilder(char *buf, size_t size) : end(buf + size - 1), p(buf) { 14 | *p = '\0'; 15 | } 16 | 17 | size_t print(char c) { 18 | if (p >= end) return 0; 19 | *p++ = c; 20 | *p = '\0'; 21 | return 1; 22 | } 23 | 24 | size_t print(const char *s) { 25 | char *begin = p; 26 | while (p < end && *s) *p++ = *s++; 27 | *p = '\0'; 28 | return size_t(p - begin); 29 | } 30 | 31 | private: 32 | char *end; 33 | char *p; 34 | }; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/Serialization/StreamPrintAdapter.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Configuration.hpp" 8 | 9 | #if ARDUINOJSON_ENABLE_STD_STREAM 10 | 11 | #include 12 | 13 | namespace ArduinoJson { 14 | namespace Internals { 15 | 16 | class StreamPrintAdapter { 17 | public: 18 | explicit StreamPrintAdapter(std::ostream& os) : _os(os) {} 19 | 20 | size_t print(char c) { 21 | _os << c; 22 | return 1; 23 | } 24 | 25 | size_t print(const char* s) { 26 | _os << s; 27 | return strlen(s); 28 | } 29 | 30 | private: 31 | // cannot be assigned 32 | StreamPrintAdapter& operator=(const StreamPrintAdapter&); 33 | 34 | std::ostream& _os; 35 | }; 36 | } 37 | } 38 | 39 | #endif // ARDUINOJSON_ENABLE_STD_STREAM 40 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/StringTraits/ArduinoStream.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #if ARDUINOJSON_ENABLE_ARDUINO_STREAM 8 | 9 | #include 10 | 11 | namespace ArduinoJson { 12 | namespace Internals { 13 | 14 | struct ArduinoStreamTraits { 15 | class Reader { 16 | Stream& _stream; 17 | char _current, _next; 18 | 19 | public: 20 | Reader(Stream& stream) : _stream(stream), _current(0), _next(0) {} 21 | 22 | void move() { 23 | _current = _next; 24 | _next = 0; 25 | } 26 | 27 | char current() { 28 | if (!_current) _current = read(); 29 | return _current; 30 | } 31 | 32 | char next() { 33 | // assumes that current() has been called 34 | if (!_next) _next = read(); 35 | return _next; 36 | } 37 | 38 | private: 39 | char read() { 40 | // don't use _stream.read() as it ignores the timeout 41 | char c = 0; 42 | _stream.readBytes(&c, 1); 43 | return c; 44 | } 45 | }; 46 | 47 | static const bool has_append = false; 48 | static const bool has_equals = false; 49 | }; 50 | 51 | template 52 | struct StringTraits< 53 | TStream, 54 | // match any type that is derived from Stream: 55 | typename EnableIf< 56 | IsBaseOf::type>::value>::type> 57 | : ArduinoStreamTraits {}; 58 | } 59 | } 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/StringTraits/CharPointer.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | namespace ArduinoJson { 8 | namespace Internals { 9 | 10 | template 11 | struct CharPointerTraits { 12 | class Reader { 13 | const TChar* _ptr; 14 | 15 | public: 16 | Reader(const TChar* ptr) 17 | : _ptr(ptr ? ptr : reinterpret_cast("")) {} 18 | 19 | void move() { 20 | ++_ptr; 21 | } 22 | 23 | char current() const { 24 | return char(_ptr[0]); 25 | } 26 | 27 | char next() const { 28 | return char(_ptr[1]); 29 | } 30 | }; 31 | 32 | static bool equals(const TChar* str, const char* expected) { 33 | const char* actual = reinterpret_cast(str); 34 | if (!actual || !expected) return actual == expected; 35 | return strcmp(actual, expected) == 0; 36 | } 37 | 38 | static bool is_null(const TChar* str) { 39 | return !str; 40 | } 41 | 42 | typedef const char* duplicate_t; 43 | 44 | template 45 | static duplicate_t duplicate(const TChar* str, Buffer* buffer) { 46 | if (!str) return NULL; 47 | size_t size = strlen(reinterpret_cast(str)) + 1; 48 | void* dup = buffer->alloc(size); 49 | if (dup != NULL) memcpy(dup, str, size); 50 | return static_cast(dup); 51 | } 52 | 53 | static const bool has_append = false; 54 | static const bool has_equals = true; 55 | static const bool should_duplicate = !IsConst::value; 56 | }; 57 | 58 | // char*, unsigned char*, signed char* 59 | // const char*, const unsigned char*, const signed char* 60 | template 61 | struct StringTraits::value>::type> 62 | : CharPointerTraits {}; 63 | } // namespace Internals 64 | } // namespace ArduinoJson 65 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/StringTraits/FlashString.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #if ARDUINOJSON_ENABLE_PROGMEM 8 | 9 | namespace ArduinoJson { 10 | namespace Internals { 11 | template <> 12 | struct StringTraits { 13 | class Reader { 14 | const char* _ptr; 15 | 16 | public: 17 | Reader(const __FlashStringHelper* ptr) 18 | : _ptr(reinterpret_cast(ptr)) {} 19 | 20 | void move() { 21 | _ptr++; 22 | } 23 | 24 | char current() const { 25 | return pgm_read_byte_near(_ptr); 26 | } 27 | 28 | char next() const { 29 | return pgm_read_byte_near(_ptr + 1); 30 | } 31 | }; 32 | 33 | static bool equals(const __FlashStringHelper* str, const char* expected) { 34 | const char* actual = reinterpret_cast(str); 35 | if (!actual || !expected) return actual == expected; 36 | return strcmp_P(expected, actual) == 0; 37 | } 38 | 39 | static bool is_null(const __FlashStringHelper* str) { 40 | return !str; 41 | } 42 | 43 | typedef const char* duplicate_t; 44 | 45 | template 46 | static duplicate_t duplicate(const __FlashStringHelper* str, Buffer* buffer) { 47 | if (!str) return NULL; 48 | size_t size = strlen_P((const char*)str) + 1; 49 | void* dup = buffer->alloc(size); 50 | if (dup != NULL) memcpy_P(dup, (const char*)str, size); 51 | return static_cast(dup); 52 | } 53 | 54 | static const bool has_append = false; 55 | static const bool has_equals = true; 56 | static const bool should_duplicate = true; 57 | }; 58 | } // namespace Internals 59 | } // namespace ArduinoJson 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/StringTraits/StdStream.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #if ARDUINOJSON_ENABLE_STD_STREAM 8 | 9 | #include 10 | 11 | namespace ArduinoJson { 12 | namespace Internals { 13 | 14 | struct StdStreamTraits { 15 | class Reader { 16 | std::istream& _stream; 17 | char _current, _next; 18 | 19 | public: 20 | Reader(std::istream& stream) : _stream(stream), _current(0), _next(0) {} 21 | 22 | void move() { 23 | _current = _next; 24 | _next = 0; 25 | } 26 | 27 | char current() { 28 | if (!_current) _current = read(); 29 | return _current; 30 | } 31 | 32 | char next() { 33 | // assumes that current() has been called 34 | if (!_next) _next = read(); 35 | return _next; 36 | } 37 | 38 | private: 39 | Reader& operator=(const Reader&); // Visual Studio C4512 40 | 41 | char read() { 42 | return _stream.eof() ? '\0' : static_cast(_stream.get()); 43 | } 44 | }; 45 | 46 | static const bool has_append = false; 47 | static const bool has_equals = false; 48 | }; 49 | 50 | template 51 | struct StringTraits< 52 | TStream, 53 | // match any type that is derived from std::istream: 54 | typename EnableIf::type>::value>::type> 56 | : StdStreamTraits {}; 57 | } 58 | } 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/StringTraits/StdString.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #if ARDUINOJSON_ENABLE_STD_STRING || ARDUINOJSON_ENABLE_ARDUINO_STRING 8 | 9 | #if ARDUINOJSON_ENABLE_ARDUINO_STRING 10 | #include 11 | #endif 12 | 13 | #if ARDUINOJSON_ENABLE_STD_STRING 14 | #include 15 | #endif 16 | 17 | namespace ArduinoJson { 18 | namespace Internals { 19 | 20 | template 21 | struct StdStringTraits { 22 | typedef const char* duplicate_t; 23 | 24 | template 25 | static duplicate_t duplicate(const TString& str, Buffer* buffer) { 26 | if (!str.c_str()) return NULL; // <- Arduino string can return NULL 27 | size_t size = str.length() + 1; 28 | void* dup = buffer->alloc(size); 29 | if (dup != NULL) memcpy(dup, str.c_str(), size); 30 | return static_cast(dup); 31 | } 32 | 33 | static bool is_null(const TString& str) { 34 | // Arduino's String::c_str() can return NULL 35 | return !str.c_str(); 36 | } 37 | 38 | struct Reader : CharPointerTraits::Reader { 39 | Reader(const TString& str) : CharPointerTraits::Reader(str.c_str()) {} 40 | }; 41 | 42 | static bool equals(const TString& str, const char* expected) { 43 | // Arduino's String::c_str() can return NULL 44 | const char* actual = str.c_str(); 45 | if (!actual || !expected) return actual == expected; 46 | return 0 == strcmp(actual, expected); 47 | } 48 | 49 | static void append(TString& str, char c) { 50 | str += c; 51 | } 52 | 53 | static void append(TString& str, const char* s) { 54 | str += s; 55 | } 56 | 57 | static const bool has_append = true; 58 | static const bool has_equals = true; 59 | static const bool should_duplicate = true; 60 | }; 61 | 62 | #if ARDUINOJSON_ENABLE_ARDUINO_STRING 63 | template <> 64 | struct StringTraits : StdStringTraits {}; 65 | template <> 66 | struct StringTraits : StdStringTraits { 67 | }; 68 | #endif 69 | 70 | #if ARDUINOJSON_ENABLE_STD_STRING 71 | template <> 72 | struct StringTraits : StdStringTraits {}; 73 | #endif 74 | } // namespace Internals 75 | } // namespace ArduinoJson 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/StringTraits/StringTraits.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include 8 | #include "../Configuration.hpp" 9 | #include "../TypeTraits/EnableIf.hpp" 10 | #include "../TypeTraits/IsBaseOf.hpp" 11 | #include "../TypeTraits/IsChar.hpp" 12 | #include "../TypeTraits/IsConst.hpp" 13 | #include "../TypeTraits/RemoveReference.hpp" 14 | 15 | namespace ArduinoJson { 16 | namespace Internals { 17 | 18 | template 19 | struct StringTraits { 20 | static const bool has_append = false; 21 | static const bool has_equals = false; 22 | }; 23 | 24 | template 25 | struct StringTraits : StringTraits {}; 26 | 27 | template 28 | struct StringTraits : StringTraits {}; 29 | } 30 | } 31 | 32 | #include "ArduinoStream.hpp" 33 | #include "CharPointer.hpp" 34 | #include "FlashString.hpp" 35 | #include "StdStream.hpp" 36 | #include "StdString.hpp" 37 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/TypeTraits/EnableIf.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | namespace ArduinoJson { 8 | namespace Internals { 9 | 10 | // A meta-function that return the type T if Condition is true. 11 | template 12 | struct EnableIf {}; 13 | 14 | template 15 | struct EnableIf { 16 | typedef T type; 17 | }; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/TypeTraits/IsArray.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | namespace ArduinoJson { 8 | namespace Internals { 9 | 10 | // A meta-function that return the type T without the const modifier 11 | template 12 | struct IsArray { 13 | static const bool value = false; 14 | }; 15 | template 16 | struct IsArray { 17 | static const bool value = true; 18 | }; 19 | template 20 | struct IsArray { 21 | static const bool value = true; 22 | }; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/TypeTraits/IsBaseOf.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | namespace ArduinoJson { 8 | namespace Internals { 9 | 10 | // A meta-function that returns true if Derived inherits from TBase is an 11 | // integral type. 12 | template 13 | class IsBaseOf { 14 | protected: // <- to avoid GCC's "all member functions in class are private" 15 | typedef char Yes[1]; 16 | typedef char No[2]; 17 | 18 | static Yes &probe(const TBase *); 19 | static No &probe(...); 20 | 21 | public: 22 | enum { 23 | value = sizeof(probe(reinterpret_cast(0))) == sizeof(Yes) 24 | }; 25 | }; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/TypeTraits/IsChar.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "IsSame.hpp" 8 | 9 | namespace ArduinoJson { 10 | namespace Internals { 11 | 12 | // A meta-function that returns true if T is a charater 13 | template 14 | struct IsChar { 15 | static const bool value = IsSame::value || 16 | IsSame::value || 17 | IsSame::value; 18 | }; 19 | 20 | template 21 | struct IsChar : IsChar {}; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/TypeTraits/IsConst.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | namespace ArduinoJson { 8 | namespace Internals { 9 | 10 | // A meta-function that return the type T without the const modifier 11 | template 12 | struct IsConst { 13 | static const bool value = false; 14 | }; 15 | 16 | template 17 | struct IsConst { 18 | static const bool value = true; 19 | }; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/TypeTraits/IsFloatingPoint.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "IsSame.hpp" 8 | 9 | namespace ArduinoJson { 10 | namespace Internals { 11 | 12 | // A meta-function that returns true if T is a floating point type 13 | template 14 | struct IsFloatingPoint { 15 | static const bool value = IsSame::value || IsSame::value; 16 | }; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/TypeTraits/IsIntegral.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "IsSame.hpp" 8 | #include "IsSignedIntegral.hpp" 9 | #include "IsUnsignedIntegral.hpp" 10 | 11 | namespace ArduinoJson { 12 | namespace Internals { 13 | 14 | // A meta-function that returns true if T is an integral type. 15 | template 16 | struct IsIntegral { 17 | static const bool value = IsSignedIntegral::value || 18 | IsUnsignedIntegral::value || 19 | IsSame::value; 20 | // CAUTION: differs from std::is_integral as it doesn't include bool 21 | }; 22 | 23 | template 24 | struct IsIntegral : IsIntegral {}; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/TypeTraits/IsSame.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | namespace ArduinoJson { 8 | namespace Internals { 9 | 10 | // A meta-function that returns true if types T and U are the same. 11 | template 12 | struct IsSame { 13 | static const bool value = false; 14 | }; 15 | 16 | template 17 | struct IsSame { 18 | static const bool value = true; 19 | }; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/TypeTraits/IsSignedIntegral.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Configuration.hpp" 8 | #include "IsSame.hpp" 9 | 10 | namespace ArduinoJson { 11 | namespace Internals { 12 | 13 | // A meta-function that returns true if T is an integral type. 14 | template 15 | struct IsSignedIntegral { 16 | static const bool value = 17 | IsSame::value || IsSame::value || 18 | IsSame::value || IsSame::value || 19 | #if ARDUINOJSON_USE_LONG_LONG 20 | IsSame::value || 21 | #endif 22 | #if ARDUINOJSON_USE_INT64 23 | IsSame::value || 24 | #endif 25 | false; 26 | }; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/TypeTraits/IsUnsignedIntegral.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "../Configuration.hpp" 8 | #include "IsSame.hpp" 9 | 10 | namespace ArduinoJson { 11 | namespace Internals { 12 | 13 | // A meta-function that returns true if T is an integral type. 14 | template 15 | struct IsUnsignedIntegral { 16 | static const bool value = 17 | IsSame::value || IsSame::value || 18 | IsSame::value || IsSame::value || 19 | #if ARDUINOJSON_USE_LONG_LONG 20 | IsSame::value || 21 | #endif 22 | #if ARDUINOJSON_USE_INT64 23 | IsSame::value || 24 | #endif 25 | false; 26 | }; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/TypeTraits/IsVariant.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #include "IsBaseOf.hpp" 8 | 9 | namespace ArduinoJson { 10 | namespace Internals { 11 | 12 | class JsonVariantTag {}; 13 | 14 | template 15 | struct IsVariant : IsBaseOf {}; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/TypeTraits/RemoveConst.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | namespace ArduinoJson { 8 | namespace Internals { 9 | 10 | // A meta-function that return the type T without the const modifier 11 | template 12 | struct RemoveConst { 13 | typedef T type; 14 | }; 15 | template 16 | struct RemoveConst { 17 | typedef T type; 18 | }; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/TypeTraits/RemoveReference.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | namespace ArduinoJson { 8 | namespace Internals { 9 | 10 | // A meta-function that return the type T without the reference modifier. 11 | template 12 | struct RemoveReference { 13 | typedef T type; 14 | }; 15 | template 16 | struct RemoveReference { 17 | typedef T type; 18 | }; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/utility/ArduinoJson/src/ArduinoJson/version.hpp: -------------------------------------------------------------------------------- 1 | // ArduinoJson - arduinojson.org 2 | // Copyright Benoit Blanchon 2014-2018 3 | // MIT License 4 | 5 | #pragma once 6 | 7 | #define ARDUINOJSON_VERSION "5.13.4" 8 | #define ARDUINOJSON_VERSION_MAJOR 5 9 | #define ARDUINOJSON_VERSION_MINOR 13 10 | #define ARDUINOJSON_VERSION_REVISION 4 11 | -------------------------------------------------------------------------------- /src/utility/Buttons/Buttons.h: -------------------------------------------------------------------------------- 1 | #ifndef buttons_h 2 | #define buttons_h 3 | 4 | #include 5 | #include "../I2cExpander/I2cExpander.h" 6 | #include "../Adafruit_ADS1X15/Adafruit_ADS1015.h" 7 | 8 | 9 | #define buttons_per_column 4 10 | #define buttons_per_row 4 11 | #define multi_tap_threshold 500 12 | #define ROWS 4 //four rows 13 | #define COLS 4 14 | #define NUM_BTN 22 15 | #define I2CADDRESS 0x74 16 | #define NO_KEY '\0' 17 | 18 | class Buttons 19 | { 20 | private: 21 | uint32_t buttonsData = 0; 22 | byte rowPins[ROWS] = {6, 7, 8, 9}; //connect to the row pinouts of the keypad 23 | byte colPins[COLS] = {10, 11, 12, 13}; //connect to the column pinouts of the keypad 24 | char keys[4][4] = { 25 | { '1', '2', '3', 'D' }, 26 | { '4', '5', '6', 'C' }, 27 | { '7', '8', '9', 'B' }, 28 | { '*', '0', '#', 'A' } 29 | }; 30 | int16_t joystick_x, joystick_y, button_a, button_b; 31 | 32 | public: 33 | Adafruit_ADS1015 ads; 34 | 35 | /////////////////// 36 | //Keypad variables 37 | ////////////////// 38 | I2cExpander kpd; 39 | void begin(); 40 | void update(); 41 | 42 | bool pressed(uint8_t button); 43 | bool repeat(uint8_t button, uint16_t period); 44 | bool released(uint8_t button); 45 | bool held(uint8_t button, uint16_t time); 46 | 47 | uint16_t timeHeld(uint8_t button); 48 | uint16_t states[NUM_BTN]; 49 | 50 | char currentKey = NO_KEY; 51 | char getKey(); //deprecated 52 | 53 | uint16_t getJoystickX(){ return joystick_x; } 54 | uint16_t getJoystickY(){ return joystick_y; } 55 | void activateInterrupt(); 56 | bool holdForUnlock = 0; 57 | }; 58 | #endif -------------------------------------------------------------------------------- /src/utility/HttpClient/README.md: -------------------------------------------------------------------------------- 1 | # HttpClient 2 | 3 | HttpClient is a library to make it easier to interact with web servers from Arduino. 4 | 5 | ## Dependencies 6 | 7 | - Requires the new Ethernet library API (with DHCP and DNS) which is in Arduino 1.0 and later 8 | 9 | ## Installation 10 | 11 | 1. Download the latest version of the library from https://github.com/amcewen/HttpClient/releases and save the file somewhere 12 | 1. In the Arduino IDE, go to the Sketch -> Import Library -> Add Library... menu option 13 | 1. Find the zip file that you saved in the first step, and choose that 14 | 1. Check that it has been successfully added by opening the Sketch -> Import Library menu. You should now see HttpClient listed among the available libraries. 15 | 16 | ## Usage 17 | 18 | In normal usage, handles the outgoing request and Host header. The returned status code is parsed for you, as is the Content-Length header (if present). 19 | 20 | Because it expects an object of type Client, you can use it with any of the networking classes that derive from that. Which means it will work with EthernetClient, WiFiClient and GSMClient. 21 | 22 | See the examples for more detail on how the library is used. 23 | 24 | -------------------------------------------------------------------------------- /src/utility/HttpClient/b64.cpp: -------------------------------------------------------------------------------- 1 | // Simple Base64 code 2 | // (c) Copyright 2010 MCQN Ltd. 3 | // Released under Apache License, version 2.0 4 | 5 | #include "b64.h" 6 | 7 | /* Simple test program 8 | #include 9 | void main() 10 | { 11 | char* in = "amcewen"; 12 | char out[22]; 13 | 14 | b64_encode(in, 15, out, 22); 15 | out[21] = '\0'; 16 | 17 | printf(out); 18 | } 19 | */ 20 | 21 | int b64_encode(const unsigned char* aInput, int aInputLen, unsigned char* aOutput, int aOutputLen) 22 | { 23 | // Work out if we've got enough space to encode the input 24 | // Every 6 bits of input becomes a byte of output 25 | if (aOutputLen < (aInputLen*8+5)/6) 26 | { 27 | // FIXME Should we return an error here, or just the length 28 | return (aInputLen*8+5)/6; 29 | } 30 | 31 | // If we get here we've got enough space to do the encoding 32 | 33 | const char* b64_dictionary = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 34 | if (aInputLen == 3) 35 | { 36 | aOutput[0] = b64_dictionary[aInput[0] >> 2]; 37 | aOutput[1] = b64_dictionary[(aInput[0] & 0x3)<<4|(aInput[1]>>4)]; 38 | aOutput[2] = b64_dictionary[(aInput[1]&0x0F)<<2|(aInput[2]>>6)]; 39 | aOutput[3] = b64_dictionary[aInput[2]&0x3F]; 40 | } 41 | else if (aInputLen == 2) 42 | { 43 | aOutput[0] = b64_dictionary[aInput[0] >> 2]; 44 | aOutput[1] = b64_dictionary[(aInput[0] & 0x3)<<4|(aInput[1]>>4)]; 45 | aOutput[2] = b64_dictionary[(aInput[1]&0x0F)<<2]; 46 | aOutput[3] = '='; 47 | } 48 | else if (aInputLen == 1) 49 | { 50 | aOutput[0] = b64_dictionary[aInput[0] >> 2]; 51 | aOutput[1] = b64_dictionary[(aInput[0] & 0x3)<<4]; 52 | aOutput[2] = '='; 53 | aOutput[3] = '='; 54 | } 55 | else 56 | { 57 | // Break the input into 3-byte chunks and process each of them 58 | int i; 59 | for (i = 0; i < aInputLen/3; i++) 60 | { 61 | b64_encode(&aInput[i*3], 3, &aOutput[i*4], 4); 62 | } 63 | if (aInputLen % 3 > 0) 64 | { 65 | // It doesn't fit neatly into a 3-byte chunk, so process what's left 66 | b64_encode(&aInput[i*3], aInputLen % 3, &aOutput[i*4], aOutputLen - (i*4)); 67 | } 68 | } 69 | 70 | return 0; 71 | } 72 | 73 | -------------------------------------------------------------------------------- /src/utility/HttpClient/b64.h: -------------------------------------------------------------------------------- 1 | #ifndef b64_h 2 | #define b64_h 3 | 4 | int b64_encode(const unsigned char* aInput, int aInputLen, unsigned char* aOutput, int aOutputLen); 5 | 6 | #endif 7 | -------------------------------------------------------------------------------- /src/utility/HttpClient/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For HttpClient 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | HttpClient KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | get KEYWORD2 16 | post KEYWORD2 17 | put KEYWORD2 18 | startRequest KEYWORD2 19 | beginRequest KEYWORD2 20 | sendHeader KEYWORD2 21 | sendBasicAuth KEYWORD2 22 | endRequest KEYWORD2 23 | responseStatusCode KEYWORD2 24 | readHeader KEYWORD2 25 | skipResponseHeaders KEYWORD2 26 | endOfHeadersReached KEYWORD2 27 | endOfBodyReached KEYWORD2 28 | completed KEYWORD2 29 | contentLength KEYWORD2 30 | 31 | ####################################### 32 | # Constants (LITERAL1) 33 | ####################################### 34 | HTTP_SUCCESS LITERAL1 35 | HTTP_ERROR_CONNECTION_FAILED LITERAL1 36 | HTTP_ERROR_API LITERAL1 37 | HTTP_ERROR_TIMED_OUT LITERAL1 38 | HTTP_ERROR_INVALID_RESPONSE LITERAL1 39 | 40 | -------------------------------------------------------------------------------- /src/utility/HttpClient/library.properties: -------------------------------------------------------------------------------- 1 | name=HttpClient 2 | version=2.2.0 3 | author=Adrian McEwen 4 | maintainer=Adrian McEwen 5 | sentence=Library to easily make HTTP GET, POST and PUT requests to a web server. 6 | paragraph=Works with any class derived from Client - so switching between Ethernet, WiFi and GSMClient requires minimal code changes. 7 | category=Communication 8 | url=http://github.com/amcewen/HttpClient 9 | architectures=* 10 | -------------------------------------------------------------------------------- /src/utility/I2cExpander/I2cExpander.cpp: -------------------------------------------------------------------------------- 1 | #include "I2cExpander.h" 2 | 3 | #define INPUT_REG 0x00 // input register location 4 | #define OUTPUT_REG 0x02 // output register location 5 | #define INVERT_REG 0x04 // polarity inversion register location 6 | #define CONFIG_REG 0x06 // configuration register location 7 | 8 | I2cExpander::I2cExpander() 9 | { 10 | } 11 | I2cExpander::~I2cExpander() 12 | { 13 | } 14 | void I2cExpander::begin(uint8_t _address, uint8_t _sda, uint8_t _scl) 15 | { 16 | address = _address; 17 | Wire.begin(_sda, _scl); 18 | portWrite(0xFFFF); 19 | _write(0x0000, INVERT_REG); 20 | portConfig(0xFFFF); 21 | } 22 | void I2cExpander::_write(uint16_t _portData, uint8_t reg) 23 | { 24 | Wire.beginTransmission(address); 25 | Wire.write(reg); 26 | // Wire.write(_portData); 27 | Wire.write(_portData & 0x00FF); 28 | Wire.write(_portData >> 8); 29 | Wire.endTransmission(); 30 | } 31 | uint16_t I2cExpander::portRead() 32 | { 33 | Wire.beginTransmission(address); 34 | Wire.write(INPUT_REG); 35 | Wire.endTransmission(); 36 | Wire.requestFrom(address, 2); 37 | uint16_t readValue = Wire.read(); 38 | readValue |= Wire.read() << 8; 39 | // Wire.readBytes((uint8_t*)readValue, 2); 40 | return readValue; 41 | } 42 | void I2cExpander::portConfig(uint16_t _portData) 43 | { 44 | configState = _portData; 45 | _write(configState, CONFIG_REG); 46 | } 47 | void I2cExpander::portWrite(uint16_t writeData) 48 | { 49 | outputState = writeData; 50 | _write(writeData, OUTPUT_REG); 51 | } 52 | void I2cExpander::pinMode(uint8_t pin, uint8_t mode) 53 | { 54 | uint16_t configMask = 1 << pin; 55 | if(mode == OUTPUT) 56 | configState &= ~configMask; 57 | else 58 | configState |= configMask; 59 | 60 | portConfig(configState); 61 | } 62 | bool I2cExpander::pinRead(uint8_t pin) 63 | { 64 | uint16_t _data = portRead(); 65 | return bitRead(_data, pin); 66 | } 67 | void I2cExpander::pinWrite(uint8_t pin, bool state) 68 | { 69 | uint16_t outputMask = 1 << pin; 70 | if(state) 71 | outputState |= outputMask; 72 | else 73 | outputState &= ~outputMask; 74 | portWrite(outputState); 75 | } 76 | -------------------------------------------------------------------------------- /src/utility/I2cExpander/I2cExpander.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #ifndef CIRCUITOS_I2C_EXPANDER_H 5 | #define CIRCUITOS_I2C_EXPANDER_H 6 | /* 7 | Made for Texas Instruments 16-bit GPIO expanders 8 | (e.g. PCF9539) 9 | */ 10 | 11 | class I2cExpander 12 | { 13 | public: 14 | I2cExpander(); 15 | ~I2cExpander(); 16 | void begin(uint8_t _address = 0x74, uint8_t _sda = 27, uint8_t _scl = 14); 17 | uint16_t portRead(); 18 | void pinMode(uint8_t pin, uint8_t mode); 19 | bool pinRead(uint8_t pin); 20 | void pinWrite(uint8_t pin, bool state); 21 | void portWrite(uint16_t _portData); 22 | void portConfig(uint16_t _portData); 23 | 24 | private: 25 | void _write(uint16_t port, uint8_t reg); 26 | uint8_t address = 0; 27 | uint16_t configState = 0; 28 | uint16_t outputState = 0; 29 | }; 30 | 31 | #endif -------------------------------------------------------------------------------- /src/utility/JPEGDecoder.h: -------------------------------------------------------------------------------- 1 | #include "JPEGDecoder/src/JPEGDecoder.h" -------------------------------------------------------------------------------- /src/utility/JPEGDecoder/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map 3 | ####################################### 4 | ####################################### 5 | # Datatypes (KEYWORD1) 6 | ####################################### 7 | 8 | JPEGDecoder KEYWORD1 9 | 10 | ####################################### 11 | # Methods and Functions (KEYWORD2) 12 | ####################################### 13 | 14 | JpegDec KEYWORD2 15 | pImage KEYWORD2 16 | width KEYWORD2 17 | height KEYWORD2 18 | comps KEYWORD2 19 | MCUSPerRow KEYWORD2 20 | MCUSPerCol KEYWORD2 21 | scanType KEYWORD2 22 | MCUWidth KEYWORD2 23 | MCUHeight KEYWORD2 24 | MCUx KEYWORD2 25 | MCUy KEYWORD2 26 | JPEGDecoder KEYWORD2 27 | decode KEYWORD2 28 | decodeFile KEYWORD2 29 | decodeSdFile KEYWORD2 30 | decodeFsFile KEYWORD2 31 | decodeArray KEYWORD2 32 | available KEYWORD2 33 | abort KEYWORD2 34 | read KEYWORD2 35 | readSwappedBytes KEYWORD2 36 | -------------------------------------------------------------------------------- /src/utility/JPEGDecoder/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "JPEGDecoder", 3 | "version": "1.8.0", 4 | "keywords": "jpeg, jpg, decoder, TFT", 5 | "description": "A JPEG decoder library, tested on Mega, Due and ESP8266", 6 | "repository": 7 | { 8 | "type": "git", 9 | "url": "https://github.com/Bodmer/JPEGDecoder.git" 10 | }, 11 | "authors": 12 | [ 13 | { 14 | "name": "Bodmer", 15 | "email": "bodmer@anola.net", 16 | "maintainer": true 17 | }, 18 | { 19 | "name": "Makoto Kurauchi", 20 | "url": "http://yushakobo.jp" 21 | }, 22 | { 23 | "name": "Rich Geldreich", 24 | "email": "richgel99@gmail.com" 25 | } 26 | ], 27 | "frameworks": "arduino", 28 | "platforms": ["atmelavr","atmelsam","espressif8266"] 29 | } 30 | -------------------------------------------------------------------------------- /src/utility/JPEGDecoder/library.properties: -------------------------------------------------------------------------------- 1 | name=JPEGDecoder 2 | version=1.8.0 3 | author=Bodmer , Makoto Kurauchi, Rich Geldreich 4 | maintainer=Bodmer 5 | sentence= Jpeg decoder tested with Arduino Mega, Arduino Due and ESP8266 based NodeMCU 1.0 6 | paragraph=Decodes jpeg images stored in arrays, SD card files and SPIFFS files 7 | category=Display 8 | url=https://github.com/Bodmer/JPEGDecoder 9 | architectures=* 10 | includes=JPEGDecoder.h 11 | -------------------------------------------------------------------------------- /src/utility/JPEGDecoder/license.txt: -------------------------------------------------------------------------------- 1 | 2 | Arduino JPEGDecoder library 3 | =========================== 4 | 5 | The original picojpeg.c and picojepeg.h code used in this Arduino library is hosted here: 6 | https://code.google.com/archive/p/picojpeg/ 7 | 8 | The JPEGDecoder library has been developed from the Arduino library by Makoto Kurauchi here: 9 | https://github.com/MakotoKurauchi/JPEGDecoder 10 | 11 | The library has been developed and debugged by Bodmer and is hosted here: 12 | https://github.com/Bodmer/JPEGDecoder 13 | 14 | The picojpeg code and the developed library is dual licensed as both public domain and 15 | (where public domain is not acceptable) the MIT license: 16 | 17 | 18 | picojeg code: Copyright 2013 Rich Geldreich 19 | Arduino JPEGDecoder library: Copyright 2019 Makoto Kurauchi, Bodmer 20 | 21 | MIT license: 22 | 23 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 24 | associated documentation files (the "Software"), to deal in the Software without restriction, 25 | including without limitation the rights to use, copy, modify, merge, publish, distribute, 26 | sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 27 | furnished to do so, subject to the following conditions: 28 | 29 | The above copyright notice and this permission notice shall be included in all copies or 30 | substantial portions of the Software. 31 | 32 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 33 | BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 34 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 35 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 36 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 37 | -------------------------------------------------------------------------------- /src/utility/JPEGDecoder/src/User_Config.h: -------------------------------------------------------------------------------- 1 | // Comment out the next #defines if you are not using an SD Card to store the JPEGs 2 | // Commenting out the line is NOT essential but will save some FLASH space if 3 | // SD Card access is not needed. Note: use of SdFat is currently untested! 4 | 5 | #define LOAD_SD_LIBRARY // Default SD Card library 6 | //#define LOAD_SDFAT_LIBRARY // Use SdFat library instead, so SD Card SPI can be bit bashed 7 | 8 | 9 | // Note for ESP8266 users: 10 | // If the sketch uses SPIFFS and has included FS.h without defining FS_NO_GLOBALS first 11 | // then the JPEGDecoder library will NOT load the SD or SdFat libraries. Use lines thus 12 | // in your sketch (see the examples included in the JPEGDecoder library): 13 | /* 14 | #define FS_NO_GLOBALS 15 | #include 16 | 17 | // You will then need to directly reference the SPIFFS File type thus in the sketch, e.g.: 18 | 19 | fs::File jpegFile = SPIFFS.open( filename, "r"); // Example 20 | 21 | // This will then allow the default method of using the SD library File type to be used 22 | // in the same sketch, e.g.: 23 | 24 | File jpegFile = SD.open( filename, FILE_READ); 25 | 26 | */ 27 | 28 | // This is all to avoid a redefinition of 'class fs::File' error due to a conflict between the 29 | // duplicate definitions in the SD library and the SPIFFS library. 30 | 31 | 32 | #ifdef ESP8266 33 | // Uncomment out the next #define if you want the bytes swapped in the image blocks 34 | // returned by read(). 35 | 36 | // Swapping the bytes is only needed to use the ESP8266 SPI library writePattern() 37 | // member function and it is better to use readSwappedBytes() instead of read() in 38 | // the sketch. Images will look psychedelic with wrong colours if the SPI transmit byte 39 | // order is not right for your sketch! 40 | 41 | // #define SWAP_BYTES // Deprecated, only included for backwards compatibility 42 | #endif 43 | -------------------------------------------------------------------------------- /src/utility/RTCLib/.library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "RTCLib", 3 | "version": "1.5.4", 4 | "keywords": [ 5 | "device", 6 | "control" 7 | ], 8 | "description": "A library that makes interfacing DS1302, DS1307, DS3231, PCF8583, PCF8563, RTC_Millis Real Time Clock modules easy.", 9 | "frameworks": [ 10 | "arduino" 11 | ], 12 | "platforms": [ 13 | "atmelavr", 14 | "atmelsam", 15 | "espressif32", 16 | "espressif8266", 17 | "intel_arc32", 18 | "microchippic32", 19 | "nordicnrf51", 20 | "nordicnrf52", 21 | "ststm32", 22 | "teensy", 23 | "timsp430" 24 | ], 25 | "authors": [ 26 | { 27 | "email": "neiron.nxn@gmail.com", 28 | "url": null, 29 | "maintainer": true, 30 | "name": "NeiroN" 31 | } 32 | ], 33 | "repository": { 34 | "type": "git", 35 | "url": "https://github.com/NeiroNx/RTCLib" 36 | }, 37 | "homepage": null, 38 | "export": { 39 | "include": null, 40 | "exclude": [ 41 | "extras", 42 | "docs", 43 | "tests", 44 | "test", 45 | "*.doxyfile", 46 | "*.pdf" 47 | ] 48 | }, 49 | "id": 1197 50 | } -------------------------------------------------------------------------------- /src/utility/RTCLib/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For RTC 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | DateTime KEYWORD1 10 | TimeDelta KEYWORD1 11 | DS1302 KEYWORD1 12 | DS1307 KEYWORD1 13 | DS3231 KEYWORD1 14 | RTC_Millis KEYWORD1 15 | PCF8583 KEYWORD1 16 | PCF8563 KEYWORD1 17 | 18 | 19 | ####################################### 20 | # Methods and Functions (KEYWORD2) 21 | ####################################### 22 | 23 | year KEYWORD2 24 | month KEYWORD2 25 | day KEYWORD2 26 | hour KEYWORD2 27 | minute KEYWORD2 28 | second KEYWORD2 29 | dayOfWeek KEYWORD2 30 | secondstime KEYWORD2 31 | unixtime KEYWORD2 32 | begin KEYWORD2 33 | adjust KEYWORD2 34 | isrunning KEYWORD2 35 | now KEYWORD2 36 | format KEYWORD2 37 | 38 | ####################################### 39 | # Constants (LITERAL1) 40 | ####################################### 41 | 42 | -------------------------------------------------------------------------------- /src/utility/RTCLib/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "RTCLib", 3 | "keywords": "RTC, DS1302, DS1307, DS3231, PCF8583, PCF8563, RTC_Millis, DateTime", 4 | "description": "A library that makes interfacing many Real Time Clock modules easy. With same DateTime class which supports all standart conversions.", 5 | "repository": 6 | { 7 | "type": "git", 8 | "url": "https://github.com/NeiroNx/RTCLib.git" 9 | }, 10 | "version": "1.5.4", 11 | "frameworks": "arduino", 12 | "platforms": "*" 13 | } 14 | -------------------------------------------------------------------------------- /src/utility/RTCLib/library.properties: -------------------------------------------------------------------------------- 1 | name=RTCLib 2 | version=1.5.4 3 | author=JeeLabs (http://news.jeelabs.org/code/), NeiroN (neiron.nxn@gmail.com) 4 | maintainer=NeiroN (neiron.nxn@gmail.com) 5 | sentence=A library that makes interfacing DS1302, DS1307, DS3231, PCF8583, PCF8563, RTC_Millis Real Time Clock modules easy. 6 | paragraph=Including temperature, alarms and memory storage if present. Includes DateTime class implementation and it conversion. 7 | category=Device Control 8 | url=https://github.com/NeiroNx/RTCLib 9 | architectures=* 10 | -------------------------------------------------------------------------------- /src/utility/SdFat.h: -------------------------------------------------------------------------------- 1 | #include "SdFat/src/SdFat.h" -------------------------------------------------------------------------------- /src/utility/TFT_eSPI.h: -------------------------------------------------------------------------------- 1 | #include "TFT_eSPI/TFT_eSPI.h" -------------------------------------------------------------------------------- /src/utility/arduino_pdu_decoder/pdu_decoder.h: -------------------------------------------------------------------------------- 1 | //Library to decode pdu (8 bit octets representing 7 bit data). 2 | 3 | #ifndef pdu_decoder_h 4 | #define pdu_decoder_h 5 | 6 | #include "Arduino.h" 7 | 8 | char* charReverse(char *str); 9 | void subchar(char* str, uint16_t start, uint16_t length, char* destination); 10 | void subchar(const char* str, uint16_t start, uint16_t length, char* destination); 11 | void myDecode(char* pdu_text, uint8_t len, char* destination, uint8_t zerosPadding); 12 | #endif 13 | -------------------------------------------------------------------------------- /src/utility/soundLib/MPAudioDriver.h: -------------------------------------------------------------------------------- 1 | #include "MPWavLib.h" 2 | #ifndef MPAudio 3 | #define MPAudio 4 | 5 | #define SAMPLE_RATE (44100) //SAMPLE RATE 6 | 7 | #define MAX_TRACKS 4 8 | 9 | #define PIN_I2S_BCLK 13 10 | #define PIN_I2S_LRC 15 11 | #define PIN_I2S_DOUT 22 12 | 13 | void initWavLib(); 14 | void setVolume(float vol); 15 | bool addTrack(MPTrack *track); 16 | bool removeTrack(MPTrack *track); 17 | bool addOscillator(Oscillator *osc); 18 | bool removeOscillator(Oscillator *osc); 19 | void updateWav(); 20 | 21 | 22 | extern unsigned char volume; 23 | extern MPTrack *tracks[MAX_TRACKS]; 24 | extern Oscillator *oscs[MAX_TRACKS]; 25 | extern unsigned char trackCount; 26 | extern char dout[1600]; 27 | // extern short adcbuf[1600]; 28 | extern uint8_t reloadCo; 29 | extern bool _SDinterruptError; 30 | #endif 31 | -------------------------------------------------------------------------------- /src/utility/soundLib/MPWavLib.h: -------------------------------------------------------------------------------- 1 | #ifndef wavLibDef 2 | #define wavLibDef 3 | 4 | #include 5 | #include 6 | 7 | #include "Notes.h" 8 | 9 | //#define PI 3.14159265358979323846 10 | 11 | #define SINE 0 12 | #define TRIANGLE 1 13 | #define SQUARE 2 14 | #define SAW 3 15 | #define NOISE 4 16 | 17 | 18 | class MPTrack 19 | { 20 | public: 21 | MPTrack(char path[]); 22 | MPTrack(const char path[]); 23 | ~MPTrack(); 24 | void setVolume(float vol); 25 | void play(); 26 | void resume();//Resume playing if not finished 27 | void stop(); 28 | void pause(); 29 | void rewind(); 30 | void seek(float pos); 31 | unsigned int getSamplePos(); 32 | bool isPlaying(); 33 | int loadSample(unsigned short i); 34 | int fetchSample(); 35 | bool loadSamples(); 36 | bool isFinished(); 37 | int getSize(); 38 | void setSpeed(float s); 39 | float getSpeed(); 40 | void setRepeat(bool r); 41 | bool openFile(); 42 | void closeFile(); 43 | bool reloadFile(char path[]); 44 | 45 | private: 46 | File trackFile; 47 | uint8_t reload = 0; 48 | char trackPath[32]; 49 | float volume=2; 50 | bool playing=false; 51 | bool finished=false; 52 | char data[800]; 53 | unsigned int size; 54 | float speed=1; 55 | double pos=0; 56 | unsigned int loaded=0; 57 | uint32_t readBytes = 0; 58 | bool repeat=false; 59 | }; 60 | 61 | class Oscillator 62 | { 63 | public: 64 | Oscillator(); 65 | Oscillator(byte wave); 66 | ~Oscillator(){} 67 | void setWaveform(byte wave); 68 | void setFrequency(double freq); 69 | void setVolume(float vol); 70 | void play(); 71 | void stop(); 72 | bool isPlaying(); 73 | float fetchSample(); 74 | void beep(double freq, float len); 75 | void note(byte note, float len); 76 | void setADSR(float a, float d, float s, float r); 77 | void setDutyCycle(float d); 78 | void waitFor(); 79 | void waitForNotes(bool w); 80 | 81 | private: 82 | char waveform=0; 83 | double period=0.001; 84 | float volume=2, notelen, duty=0.5; 85 | bool playing=false, wait=false; 86 | byte envStep=0; 87 | double pos=0, envpos=0; 88 | float attack=0.01, decay=0.01, sustain=0.8, release=0.1; 89 | }; 90 | 91 | 92 | #endif -------------------------------------------------------------------------------- /src/utility/soundLib/Notes.h: -------------------------------------------------------------------------------- 1 | #ifndef NotesDef 2 | #define NotesDef 3 | 4 | #define NOTE_A0 21 5 | #define NOTE_AS0 22 6 | #define NOTE_B0 23 7 | #define NOTE_C1 24 8 | #define NOTE_CS1 25 9 | #define NOTE_D1 26 10 | #define NOTE_DS1 27 11 | #define NOTE_E1 28 12 | #define NOTE_F1 29 13 | #define NOTE_FS1 30 14 | #define NOTE_G1 31 15 | #define NOTE_GS1 32 16 | #define NOTE_A1 33 17 | #define NOTE_AS1 34 18 | #define NOTE_B1 35 19 | #define NOTE_C2 36 20 | #define NOTE_CS2 37 21 | #define NOTE_D2 38 22 | #define NOTE_DS2 39 23 | #define NOTE_E2 40 24 | #define NOTE_F2 41 25 | #define NOTE_FS2 42 26 | #define NOTE_G2 43 27 | #define NOTE_GS2 44 28 | #define NOTE_A2 45 29 | #define NOTE_AS2 46 30 | #define NOTE_B2 47 31 | #define NOTE_C3 48 32 | #define NOTE_CS3 49 33 | #define NOTE_D3 50 34 | #define NOTE_DS3 51 35 | #define NOTE_E3 52 36 | #define NOTE_F3 53 37 | #define NOTE_FS3 54 38 | #define NOTE_G3 55 39 | #define NOTE_GS3 56 40 | #define NOTE_A3 57 41 | #define NOTE_AS3 58 42 | #define NOTE_B3 59 43 | #define NOTE_C4 60 44 | #define NOTE_CS4 61 45 | #define NOTE_D4 62 46 | #define NOTE_DS4 63 47 | #define NOTE_E4 64 48 | #define NOTE_F4 65 49 | #define NOTE_FS4 66 50 | #define NOTE_G4 67 51 | #define NOTE_GS4 68 52 | #define NOTE_A4 69 53 | #define NOTE_AS4 70 54 | #define NOTE_B4 71 55 | #define NOTE_C5 72 56 | #define NOTE_CS5 73 57 | #define NOTE_D5 74 58 | #define NOTE_DS5 75 59 | #define NOTE_E5 76 60 | #define NOTE_F5 77 61 | #define NOTE_FS5 78 62 | #define NOTE_G5 79 63 | #define NOTE_GS5 80 64 | #define NOTE_A5 81 65 | #define NOTE_AS5 82 66 | #define NOTE_B5 83 67 | #define NOTE_C6 84 68 | #define NOTE_CS6 85 69 | #define NOTE_D6 86 70 | #define NOTE_DS6 87 71 | #define NOTE_E6 88 72 | #define NOTE_F6 89 73 | #define NOTE_FS6 90 74 | #define NOTE_G6 91 75 | #define NOTE_GS6 92 76 | #define NOTE_A6 93 77 | #define NOTE_AS6 94 78 | #define NOTE_B6 95 79 | #define NOTE_C7 96 80 | #define NOTE_CS7 97 81 | #define NOTE_D7 98 82 | #define NOTE_DS7 99 83 | #define NOTE_E7 100 84 | #define NOTE_F7 101 85 | #define NOTE_FS7 102 86 | #define NOTE_G7 103 87 | #define NOTE_GS7 104 88 | #define NOTE_A7 105 89 | #define NOTE_AS7 106 90 | #define NOTE_B7 107 91 | #define NOTE_C8 108 92 | 93 | 94 | #endif --------------------------------------------------------------------------------