├── .buckconfig ├── .editorconfig ├── .eslintrc.js ├── .gitattributes ├── .gitignore ├── .prettierrc.js ├── .vscode └── settings.json ├── .watchmanconfig ├── App.tsx ├── Arduino ├── .gitignore ├── .vscode │ ├── extensions.json │ └── settings.json ├── include │ └── README ├── lib │ ├── FastLED-master │ │ ├── .gitignore │ │ ├── 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 │ │ ├── component.mk │ │ ├── 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 │ │ │ ├── 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 │ │ │ ├── Pacifica │ │ │ │ └── Pacifica.ino │ │ │ ├── Pintest │ │ │ │ └── Pintest.ino │ │ │ ├── Ports │ │ │ │ └── PJRCSpectrumAnalyzer │ │ │ │ │ └── PJRCSpectrumAnalyzer.ino │ │ │ ├── Pride2015 │ │ │ │ └── Pride2015.ino │ │ │ ├── RGBCalibrate │ │ │ │ └── RGBCalibrate.ino │ │ │ ├── RGBSetDemo │ │ │ │ └── RGBSetDemo.ino │ │ │ ├── SmartMatrix │ │ │ │ └── SmartMatrix.ino │ │ │ ├── TwinkleFox │ │ │ │ └── TwinkleFox.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.cpp │ │ ├── platforms.h │ │ ├── platforms │ │ │ ├── arm │ │ │ │ ├── common │ │ │ │ │ └── m0clockless.h │ │ │ │ ├── d21 │ │ │ │ │ ├── clockless_arm_d21.h │ │ │ │ │ ├── fastled_arm_d21.h │ │ │ │ │ ├── fastpin_arm_d21.h │ │ │ │ │ └── led_sysdefs_arm_d21.h │ │ │ │ ├── d51 │ │ │ │ │ ├── README.txt │ │ │ │ │ ├── clockless_arm_d51.h │ │ │ │ │ ├── fastled_arm_d51.h │ │ │ │ │ ├── fastpin_arm_d51.h │ │ │ │ │ └── led_sysdefs_arm_d51.h │ │ │ │ ├── k20 │ │ │ │ │ ├── clockless_arm_k20.h │ │ │ │ │ ├── clockless_block_arm_k20.h │ │ │ │ │ ├── fastled_arm_k20.h │ │ │ │ │ ├── fastpin_arm_k20.h │ │ │ │ │ ├── fastspi_arm_k20.h │ │ │ │ │ ├── led_sysdefs_arm_k20.h │ │ │ │ │ ├── octows2811_controller.h │ │ │ │ │ ├── smartmatrix_t3.h │ │ │ │ │ └── ws2812serial_controller.h │ │ │ │ ├── k66 │ │ │ │ │ ├── clockless_arm_k66.h │ │ │ │ │ ├── clockless_block_arm_k66.h │ │ │ │ │ ├── fastled_arm_k66.h │ │ │ │ │ ├── fastpin_arm_k66.h │ │ │ │ │ ├── fastspi_arm_k66.h │ │ │ │ │ └── led_sysdefs_arm_k66.h │ │ │ │ ├── kl26 │ │ │ │ │ ├── clockless_arm_kl26.h │ │ │ │ │ ├── fastled_arm_kl26.h │ │ │ │ │ ├── fastpin_arm_kl26.h │ │ │ │ │ ├── fastspi_arm_kl26.h │ │ │ │ │ └── led_sysdefs_arm_kl26.h │ │ │ │ ├── mxrt1062 │ │ │ │ │ ├── block_clockless_arm_mxrt1062.h │ │ │ │ │ ├── clockless_arm_mxrt1062.h │ │ │ │ │ ├── fastled_arm_mxrt1062.h │ │ │ │ │ ├── fastpin_arm_mxrt1062.h │ │ │ │ │ ├── fastspi_arm_mxrt1062.h │ │ │ │ │ └── led_sysdefs_arm_mxrt1062.h │ │ │ │ ├── nrf51 │ │ │ │ │ ├── clockless_arm_nrf51.h │ │ │ │ │ ├── fastled_arm_nrf51.h │ │ │ │ │ ├── fastpin_arm_nrf51.h │ │ │ │ │ ├── fastspi_arm_nrf51.h │ │ │ │ │ └── led_sysdefs_arm_nrf51.h │ │ │ │ ├── nrf52 │ │ │ │ │ ├── arbiter_nrf52.h │ │ │ │ │ ├── clockless_arm_nrf52.h │ │ │ │ │ ├── fastled_arm_nrf52.h │ │ │ │ │ ├── fastpin_arm_nrf52.h │ │ │ │ │ ├── fastpin_arm_nrf52_variants.h │ │ │ │ │ ├── fastspi_arm_nrf52.h │ │ │ │ │ └── led_sysdefs_arm_nrf52.h │ │ │ │ ├── sam │ │ │ │ │ ├── clockless_arm_sam.h │ │ │ │ │ ├── clockless_block_arm_sam.h │ │ │ │ │ ├── fastled_arm_sam.h │ │ │ │ │ ├── fastpin_arm_sam.h │ │ │ │ │ ├── fastspi_arm_sam.h │ │ │ │ │ └── led_sysdefs_arm_sam.h │ │ │ │ └── stm32 │ │ │ │ │ ├── clockless_arm_stm32.h │ │ │ │ │ ├── cm3_regs.h │ │ │ │ │ ├── fastled_arm_stm32.h │ │ │ │ │ ├── fastpin_arm_stm32.h │ │ │ │ │ └── led_sysdefs_arm_stm32.h │ │ │ ├── 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.orig │ │ │ │ ├── clockless_i2s_esp32.h │ │ │ │ ├── clockless_rmt_esp32.h │ │ │ │ ├── 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 │ │ ├── release_notes.md │ │ └── wiring.cpp │ ├── README │ └── RTClib-master │ │ ├── .github │ │ ├── ISSUE_TEMPLATE.md │ │ └── PULL_REQUEST_TEMPLATE.md │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── RTClib.cpp │ │ ├── RTClib.h │ │ ├── code-of-conduct.md │ │ ├── examples │ │ ├── datecalc │ │ │ └── datecalc.ino │ │ ├── ds1307 │ │ │ └── ds1307.ino │ │ ├── ds1307SqwPin │ │ │ └── ds1307SqwPin.ino │ │ ├── ds1307nvram │ │ │ └── ds1307nvram.ino │ │ ├── ds3231 │ │ │ └── ds3231.ino │ │ ├── pcf8523 │ │ │ └── pcf8523.ino │ │ ├── softrtc │ │ │ └── softrtc.ino │ │ ├── timestamp │ │ │ └── timestamp.ino │ │ └── toString │ │ ├── keywords.txt │ │ └── library.properties ├── platformio.ini ├── src │ └── main.cpp └── test │ └── README ├── README.md ├── Styles └── styles.tsx ├── __tests__ └── App-test.tsx ├── android ├── app │ ├── _BUCK │ ├── build.gradle │ ├── build_defs.bzl │ ├── debug.keystore │ ├── proguard-rules.pro │ └── src │ │ ├── debug │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── bleexample │ │ │ └── ReactNativeFlipper.java │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── bleexample │ │ │ ├── MainActivity.java │ │ │ └── MainApplication.java │ │ └── res │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── strings.xml │ │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── local.properties └── settings.gradle ├── app.json ├── babel.config.js ├── index.js ├── ios ├── BleExample.xcodeproj │ ├── project.pbxproj │ └── xcshareddata │ │ └── xcschemes │ │ └── BleExample.xcscheme ├── BleExample │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ ├── Info.plist │ ├── LaunchScreen.storyboard │ └── main.m ├── BleExampleTests │ ├── BleExampleTests.m │ └── Info.plist └── Podfile ├── metro.config.js ├── package-lock.json ├── package.json └── tsconfig.json /.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Windows files 2 | [*.bat] 3 | end_of_line = crlf 4 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | extends: '@react-native-community', 4 | parser: '@typescript-eslint/parser', 5 | plugins: ['@typescript-eslint'], 6 | rules: { 7 | 'no-shadow': 'off', 8 | '@typescript-eslint/no-shadow': ['error'], 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Windows files should use crlf line endings 2 | # https://help.github.com/articles/dealing-with-line-endings/ 3 | *.bat text eol=crlf 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | 24 | # Android/IntelliJ 25 | # 26 | build/ 27 | .idea 28 | .gradle 29 | *.iml 30 | *.hprof 31 | 32 | # node.js 33 | # 34 | node_modules/ 35 | npm-debug.log 36 | yarn-error.log 37 | 38 | # BUCK 39 | buck-out/ 40 | \.buckd/ 41 | *.keystore 42 | !debug.keystore 43 | 44 | # fastlane 45 | # 46 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 47 | # screenshots whenever they are needed. 48 | # For more information about the recommended setup visit: 49 | # https://docs.fastlane.tools/best-practices/source-control/ 50 | 51 | */fastlane/report.xml 52 | */fastlane/Preview.html 53 | */fastlane/screenshots 54 | 55 | # Bundle artifact 56 | *.jsbundle 57 | 58 | # CocoaPods 59 | /ios/Pods/ 60 | -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | bracketSpacing: false, 3 | jsxBracketSameLine: true, 4 | singleQuote: true, 5 | trailingComma: 'all', 6 | arrowParens: 'avoid', 7 | }; 8 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | "array": "cpp", 4 | "chrono": "cpp", 5 | "format": "cpp", 6 | "forward_list": "cpp", 7 | "initializer_list": "cpp", 8 | "list": "cpp", 9 | "vector": "cpp", 10 | "xhash": "cpp", 11 | "xstring": "cpp", 12 | "xtree": "cpp", 13 | "xutility": "cpp" 14 | } 15 | } -------------------------------------------------------------------------------- /.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /Arduino/.gitignore: -------------------------------------------------------------------------------- 1 | .pio 2 | .vscode/.browse.c_cpp.db* 3 | .vscode/c_cpp_properties.json 4 | .vscode/launch.json 5 | .vscode/ipch 6 | -------------------------------------------------------------------------------- /Arduino/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": [ 5 | "platformio.platformio-ide" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /Arduino/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | "array": "cpp", 4 | "*.tcc": "cpp", 5 | "cctype": "cpp", 6 | "clocale": "cpp", 7 | "cmath": "cpp", 8 | "cstdarg": "cpp", 9 | "cstddef": "cpp", 10 | "cstdint": "cpp", 11 | "cstdio": "cpp", 12 | "cstdlib": "cpp", 13 | "cstring": "cpp", 14 | "ctime": "cpp", 15 | "cwchar": "cpp", 16 | "cwctype": "cpp", 17 | "deque": "cpp", 18 | "unordered_map": "cpp", 19 | "unordered_set": "cpp", 20 | "vector": "cpp", 21 | "exception": "cpp", 22 | "algorithm": "cpp", 23 | "functional": "cpp", 24 | "system_error": "cpp", 25 | "tuple": "cpp", 26 | "type_traits": "cpp", 27 | "fstream": "cpp", 28 | "initializer_list": "cpp", 29 | "iomanip": "cpp", 30 | "iosfwd": "cpp", 31 | "istream": "cpp", 32 | "limits": "cpp", 33 | "memory": "cpp", 34 | "new": "cpp", 35 | "ostream": "cpp", 36 | "numeric": "cpp", 37 | "sstream": "cpp", 38 | "stdexcept": "cpp", 39 | "streambuf": "cpp", 40 | "cinttypes": "cpp", 41 | "utility": "cpp", 42 | "typeinfo": "cpp", 43 | "string": "cpp" 44 | } 45 | } -------------------------------------------------------------------------------- /Arduino/include/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for project header files. 3 | 4 | A header file is a file containing C declarations and macro definitions 5 | to be shared between several project source files. You request the use of a 6 | header file in your project source file (C, C++, etc) located in `src` folder 7 | by including it, with the C preprocessing directive `#include'. 8 | 9 | ```src/main.c 10 | 11 | #include "header.h" 12 | 13 | int main (void) 14 | { 15 | ... 16 | } 17 | ``` 18 | 19 | Including a header file produces the same results as copying the header file 20 | into each source file that needs it. Such copying would be time-consuming 21 | and error-prone. With a header file, the related declarations appear 22 | in only one place. If they need to be changed, they can be changed in one 23 | place, and programs that include the header file will automatically use the 24 | new version when next recompiled. The header file eliminates the labor of 25 | finding and changing all the copies as well as the risk that a failure to 26 | find one copy will result in inconsistencies within a program. 27 | 28 | In C, the usual convention is to give header files names that end with `.h'. 29 | It is most portable to use only letters, digits, dashes, and underscores in 30 | header file names, and at most one dot. 31 | 32 | Read more about using header files in official GCC documentation: 33 | 34 | * Include Syntax 35 | * Include Operation 36 | * Once-Only Headers 37 | * Computed Includes 38 | 39 | https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html 40 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/.gitignore: -------------------------------------------------------------------------------- 1 | html/ 2 | *.gch 3 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/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 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/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 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/color.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_COLOR_H 2 | #define __INC_COLOR_H 3 | 4 | #include "FastLED.h" 5 | 6 | FASTLED_NAMESPACE_BEGIN 7 | 8 | ///@file color.h 9 | /// contains definitions for color correction and temperature 10 | ///@defgroup ColorEnums Color correction/temperature 11 | /// definitions for color correction and light temperatures 12 | ///@{ 13 | typedef enum { 14 | // Color correction starting points 15 | 16 | /// typical values for SMD5050 LEDs 17 | ///@{ 18 | TypicalSMD5050=0xFFB0F0 /* 255, 176, 240 */, 19 | TypicalLEDStrip=0xFFB0F0 /* 255, 176, 240 */, 20 | ///@} 21 | 22 | /// typical values for 8mm "pixels on a string" 23 | /// also for many through-hole 'T' package LEDs 24 | ///@{ 25 | Typical8mmPixel=0xFFE08C /* 255, 224, 140 */, 26 | TypicalPixelString=0xFFE08C /* 255, 224, 140 */, 27 | ///@} 28 | 29 | /// uncorrected color 30 | UncorrectedColor=0xFFFFFF 31 | 32 | } LEDColorCorrection; 33 | 34 | 35 | typedef enum { 36 | /// @name Black-body radiation light sources 37 | /// Black-body radiation light sources emit a (relatively) continuous 38 | /// spectrum, and can be described as having a Kelvin 'temperature' 39 | ///@{ 40 | /// 1900 Kelvin 41 | Candle=0xFF9329 /* 1900 K, 255, 147, 41 */, 42 | /// 2600 Kelvin 43 | Tungsten40W=0xFFC58F /* 2600 K, 255, 197, 143 */, 44 | /// 2850 Kelvin 45 | Tungsten100W=0xFFD6AA /* 2850 K, 255, 214, 170 */, 46 | /// 3200 Kelvin 47 | Halogen=0xFFF1E0 /* 3200 K, 255, 241, 224 */, 48 | /// 5200 Kelvin 49 | CarbonArc=0xFFFAF4 /* 5200 K, 255, 250, 244 */, 50 | /// 5400 Kelvin 51 | HighNoonSun=0xFFFFFB /* 5400 K, 255, 255, 251 */, 52 | /// 6000 Kelvin 53 | DirectSunlight=0xFFFFFF /* 6000 K, 255, 255, 255 */, 54 | /// 7000 Kelvin 55 | OvercastSky=0xC9E2FF /* 7000 K, 201, 226, 255 */, 56 | /// 20000 Kelvin 57 | ClearBlueSky=0x409CFF /* 20000 K, 64, 156, 255 */, 58 | ///@} 59 | 60 | /// @name Gaseous light sources 61 | /// Gaseous light sources emit discrete spectral bands, and while we can 62 | /// approximate their aggregate hue with RGB values, they don't actually 63 | /// have a proper Kelvin temperature. 64 | ///@{ 65 | WarmFluorescent=0xFFF4E5 /* 0 K, 255, 244, 229 */, 66 | StandardFluorescent=0xF4FFFA /* 0 K, 244, 255, 250 */, 67 | CoolWhiteFluorescent=0xD4EBFF /* 0 K, 212, 235, 255 */, 68 | FullSpectrumFluorescent=0xFFF4F2 /* 0 K, 255, 244, 242 */, 69 | GrowLightFluorescent=0xFFEFF7 /* 0 K, 255, 239, 247 */, 70 | BlackLightFluorescent=0xA700FF /* 0 K, 167, 0, 255 */, 71 | MercuryVapor=0xD8F7FF /* 0 K, 216, 247, 255 */, 72 | SodiumVapor=0xFFD1B2 /* 0 K, 255, 209, 178 */, 73 | MetalHalide=0xF2FCFF /* 0 K, 242, 252, 255 */, 74 | HighPressureSodium=0xFFB74C /* 0 K, 255, 183, 76 */, 75 | ///@} 76 | 77 | /// Uncorrected temperature 0xFFFFFF 78 | UncorrectedTemperature=0xFFFFFF 79 | } ColorTemperature; 80 | 81 | FASTLED_NAMESPACE_END 82 | 83 | ///@} 84 | #endif 85 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/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 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/component.mk: -------------------------------------------------------------------------------- 1 | COMPONENT_ADD_INCLUDEDIRS := . 2 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/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 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/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 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/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 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/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 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/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 WS2812, 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 | // Clock pin only needed for SPI based chipsets when not using hardware SPI 10 | #define DATA_PIN 3 11 | #define CLOCK_PIN 13 12 | 13 | // Define the array of leds 14 | CRGB leds[NUM_LEDS]; 15 | 16 | void setup() { 17 | // Uncomment/edit one of the following lines for your leds arrangement. 18 | // ## Clockless types ## 19 | FastLED.addLeds(leds, NUM_LEDS); // GRB ordering is assumed 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 | // FastLED.addLeds(leds, NUM_LEDS); 30 | // FastLED.addLeds(leds, NUM_LEDS); // GRB ordering is typical 31 | // FastLED.addLeds(leds, NUM_LEDS); // GRB ordering is typical 32 | // FastLED.addLeds(leds, NUM_LEDS); // GRB ordering is typical 33 | // FastLED.addLeds(leds, NUM_LEDS); 34 | // FastLED.addLeds(leds, NUM_LEDS); // GRB ordering is typical 35 | // FastLED.addLeds(leds, NUM_LEDS); 36 | // FastLED.addLeds(leds, NUM_LEDS); 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 | // FastLED.addLeds(leds, NUM_LEDS); 44 | // FastLED.addLeds(leds, NUM_LEDS); 45 | // FastLED.addLeds(leds, NUM_LEDS); 46 | // FastLED.addLeds(leds, NUM_LEDS); 47 | // FastLED.addLeds(leds, NUM_LEDS); 48 | // ## Clocked (SPI) types ## 49 | // FastLED.addLeds(leds, NUM_LEDS); // GRB ordering is typical 50 | // FastLED.addLeds(leds, NUM_LEDS); // GRB ordering is typical 51 | // FastLED.addLeds(leds, NUM_LEDS); 52 | // FastLED.addLeds(leds, NUM_LEDS); 53 | // FastLED.addLeds(leds, NUM_LEDS); 54 | // FastLED.addLeds(leds, NUM_LEDS); // BGR ordering is typical 55 | // FastLED.addLeds(leds, NUM_LEDS); // BGR ordering is typical 56 | // FastLED.addLeds(leds, NUM_LEDS); // BGR ordering is typical 57 | // FastLED.addLeds(leds, NUM_LEDS); // BGR ordering is typical 58 | } 59 | 60 | void loop() { 61 | // Turn the LED on, then pause 62 | leds[0] = CRGB::Red; 63 | FastLED.show(); 64 | delay(500); 65 | // Now turn the LED off, then pause 66 | leds[0] = CRGB::Black; 67 | FastLED.show(); 68 | delay(500); 69 | } 70 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/examples/ColorTemperature/ColorTemperature.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define LED_PIN 3 4 | 5 | // Information about the LED strip itself 6 | #define NUM_LEDS 60 7 | #define CHIPSET WS2811 8 | #define COLOR_ORDER GRB 9 | CRGB leds[NUM_LEDS]; 10 | 11 | #define BRIGHTNESS 128 12 | 13 | 14 | // FastLED v2.1 provides two color-management controls: 15 | // (1) color correction settings for each LED strip, and 16 | // (2) master control of the overall output 'color temperature' 17 | // 18 | // THIS EXAMPLE demonstrates the second, "color temperature" control. 19 | // It shows a simple rainbow animation first with one temperature profile, 20 | // and a few seconds later, with a different temperature profile. 21 | // 22 | // The first pixel of the strip will show the color temperature. 23 | // 24 | // HELPFUL HINTS for "seeing" the effect in this demo: 25 | // * Don't look directly at the LED pixels. Shine the LEDs aganst 26 | // a white wall, table, or piece of paper, and look at the reflected light. 27 | // 28 | // * If you watch it for a bit, and then walk away, and then come back 29 | // to it, you'll probably be able to "see" whether it's currently using 30 | // the 'redder' or the 'bluer' temperature profile, even not counting 31 | // the lowest 'indicator' pixel. 32 | // 33 | // 34 | // FastLED provides these pre-conigured incandescent color profiles: 35 | // Candle, Tungsten40W, Tungsten100W, Halogen, CarbonArc, 36 | // HighNoonSun, DirectSunlight, OvercastSky, ClearBlueSky, 37 | // FastLED provides these pre-configured gaseous-light color profiles: 38 | // WarmFluorescent, StandardFluorescent, CoolWhiteFluorescent, 39 | // FullSpectrumFluorescent, GrowLightFluorescent, BlackLightFluorescent, 40 | // MercuryVapor, SodiumVapor, MetalHalide, HighPressureSodium, 41 | // FastLED also provides an "Uncorrected temperature" profile 42 | // UncorrectedTemperature; 43 | 44 | #define TEMPERATURE_1 Tungsten100W 45 | #define TEMPERATURE_2 OvercastSky 46 | 47 | // How many seconds to show each temperature before switching 48 | #define DISPLAYTIME 20 49 | // How many seconds to show black between switches 50 | #define BLACKTIME 3 51 | 52 | void loop() 53 | { 54 | // draw a generic, no-name rainbow 55 | static uint8_t starthue = 0; 56 | fill_rainbow( leds + 5, NUM_LEDS - 5, --starthue, 20); 57 | 58 | // Choose which 'color temperature' profile to enable. 59 | uint8_t secs = (millis() / 1000) % (DISPLAYTIME * 2); 60 | if( secs < DISPLAYTIME) { 61 | FastLED.setTemperature( TEMPERATURE_1 ); // first temperature 62 | leds[0] = TEMPERATURE_1; // show indicator pixel 63 | } else { 64 | FastLED.setTemperature( TEMPERATURE_2 ); // second temperature 65 | leds[0] = TEMPERATURE_2; // show indicator pixel 66 | } 67 | 68 | // Black out the LEDs for a few secnds between color changes 69 | // to let the eyes and brains adjust 70 | if( (secs % DISPLAYTIME) < BLACKTIME) { 71 | memset8( leds, 0, NUM_LEDS * sizeof(CRGB)); 72 | } 73 | 74 | FastLED.show(); 75 | FastLED.delay(8); 76 | } 77 | 78 | void setup() { 79 | delay( 3000 ); // power-up safety delay 80 | // It's important to set the color correction for your LED strip here, 81 | // so that colors can be more accurately rendered through the 'temperature' profiles 82 | FastLED.addLeds(leds, NUM_LEDS).setCorrection( TypicalSMD5050 ); 83 | FastLED.setBrightness( BRIGHTNESS ); 84 | } 85 | 86 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/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 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/examples/DemoReel100/DemoReel100.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | FASTLED_USING_NAMESPACE 4 | 5 | // FastLED "100-lines-of-code" demo reel, showing just a few 6 | // of the kinds of animation patterns you can quickly and easily 7 | // compose using FastLED. 8 | // 9 | // This example also shows one easy way to define multiple 10 | // animations patterns and have them automatically rotate. 11 | // 12 | // -Mark Kriegsman, December 2014 13 | 14 | #if defined(FASTLED_VERSION) && (FASTLED_VERSION < 3001000) 15 | #warning "Requires FastLED 3.1 or later; check github for latest code." 16 | #endif 17 | 18 | #define DATA_PIN 3 19 | //#define CLK_PIN 4 20 | #define LED_TYPE WS2811 21 | #define COLOR_ORDER GRB 22 | #define NUM_LEDS 64 23 | CRGB leds[NUM_LEDS]; 24 | 25 | #define BRIGHTNESS 96 26 | #define FRAMES_PER_SECOND 120 27 | 28 | void setup() { 29 | delay(3000); // 3 second delay for recovery 30 | 31 | // tell FastLED about the LED strip configuration 32 | FastLED.addLeds(leds, NUM_LEDS).setCorrection(TypicalLEDStrip); 33 | //FastLED.addLeds(leds, NUM_LEDS).setCorrection(TypicalLEDStrip); 34 | 35 | // set master brightness control 36 | FastLED.setBrightness(BRIGHTNESS); 37 | } 38 | 39 | 40 | // List of patterns to cycle through. Each is defined as a separate function below. 41 | typedef void (*SimplePatternList[])(); 42 | SimplePatternList gPatterns = { rainbow, rainbowWithGlitter, confetti, sinelon, juggle, bpm }; 43 | 44 | uint8_t gCurrentPatternNumber = 0; // Index number of which pattern is current 45 | uint8_t gHue = 0; // rotating "base color" used by many of the patterns 46 | 47 | void loop() 48 | { 49 | // Call the current pattern function once, updating the 'leds' array 50 | gPatterns[gCurrentPatternNumber](); 51 | 52 | // send the 'leds' array out to the actual LED strip 53 | FastLED.show(); 54 | // insert a delay to keep the framerate modest 55 | FastLED.delay(1000/FRAMES_PER_SECOND); 56 | 57 | // do some periodic updates 58 | EVERY_N_MILLISECONDS( 20 ) { gHue++; } // slowly cycle the "base color" through the rainbow 59 | EVERY_N_SECONDS( 10 ) { nextPattern(); } // change patterns periodically 60 | } 61 | 62 | #define ARRAY_SIZE(A) (sizeof(A) / sizeof((A)[0])) 63 | 64 | void nextPattern() 65 | { 66 | // add one to the current pattern number, and wrap around at the end 67 | gCurrentPatternNumber = (gCurrentPatternNumber + 1) % ARRAY_SIZE( gPatterns); 68 | } 69 | 70 | void rainbow() 71 | { 72 | // FastLED's built-in rainbow generator 73 | fill_rainbow( leds, NUM_LEDS, gHue, 7); 74 | } 75 | 76 | void rainbowWithGlitter() 77 | { 78 | // built-in FastLED rainbow, plus some random sparkly glitter 79 | rainbow(); 80 | addGlitter(80); 81 | } 82 | 83 | void addGlitter( fract8 chanceOfGlitter) 84 | { 85 | if( random8() < chanceOfGlitter) { 86 | leds[ random16(NUM_LEDS) ] += CRGB::White; 87 | } 88 | } 89 | 90 | void confetti() 91 | { 92 | // random colored speckles that blink in and fade smoothly 93 | fadeToBlackBy( leds, NUM_LEDS, 10); 94 | int pos = random16(NUM_LEDS); 95 | leds[pos] += CHSV( gHue + random8(64), 200, 255); 96 | } 97 | 98 | void sinelon() 99 | { 100 | // a colored dot sweeping back and forth, with fading trails 101 | fadeToBlackBy( leds, NUM_LEDS, 20); 102 | int pos = beatsin16( 13, 0, NUM_LEDS-1 ); 103 | leds[pos] += CHSV( gHue, 255, 192); 104 | } 105 | 106 | void bpm() 107 | { 108 | // colored stripes pulsing at a defined Beats-Per-Minute (BPM) 109 | uint8_t BeatsPerMinute = 62; 110 | CRGBPalette16 palette = PartyColors_p; 111 | uint8_t beat = beatsin8( BeatsPerMinute, 64, 255); 112 | for( int i = 0; i < NUM_LEDS; i++) { //9948 113 | leds[i] = ColorFromPalette(palette, gHue+(i*2), beat-gHue+(i*10)); 114 | } 115 | } 116 | 117 | void juggle() { 118 | // eight colored dots, weaving in and out of sync with each other 119 | fadeToBlackBy( leds, NUM_LEDS, 20); 120 | byte dothue = 0; 121 | for( int i = 0; i < 8; i++) { 122 | leds[beatsin16( i+7, 0, NUM_LEDS-1 )] |= CHSV(dothue, 200, 255); 123 | dothue += 32; 124 | } 125 | } 126 | 127 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/examples/Fire2012/Fire2012.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define LED_PIN 5 4 | #define COLOR_ORDER GRB 5 | #define CHIPSET WS2811 6 | #define NUM_LEDS 30 7 | 8 | #define BRIGHTNESS 200 9 | #define FRAMES_PER_SECOND 60 10 | 11 | bool gReverseDirection = false; 12 | 13 | CRGB leds[NUM_LEDS]; 14 | 15 | void setup() { 16 | delay(3000); // sanity delay 17 | FastLED.addLeds(leds, NUM_LEDS).setCorrection( TypicalLEDStrip ); 18 | FastLED.setBrightness( BRIGHTNESS ); 19 | } 20 | 21 | void loop() 22 | { 23 | // Add entropy to random number generator; we use a lot of it. 24 | // random16_add_entropy( random()); 25 | 26 | Fire2012(); // run simulation frame 27 | 28 | FastLED.show(); // display this frame 29 | FastLED.delay(1000 / FRAMES_PER_SECOND); 30 | } 31 | 32 | 33 | // Fire2012 by Mark Kriegsman, July 2012 34 | // as part of "Five Elements" shown here: http://youtu.be/knWiGsmgycY 35 | //// 36 | // This basic one-dimensional 'fire' simulation works roughly as follows: 37 | // There's a underlying array of 'heat' cells, that model the temperature 38 | // at each point along the line. Every cycle through the simulation, 39 | // four steps are performed: 40 | // 1) All cells cool down a little bit, losing heat to the air 41 | // 2) The heat from each cell drifts 'up' and diffuses a little 42 | // 3) Sometimes randomly new 'sparks' of heat are added at the bottom 43 | // 4) The heat from each cell is rendered as a color into the leds array 44 | // The heat-to-color mapping uses a black-body radiation approximation. 45 | // 46 | // Temperature is in arbitrary units from 0 (cold black) to 255 (white hot). 47 | // 48 | // This simulation scales it self a bit depending on NUM_LEDS; it should look 49 | // "OK" on anywhere from 20 to 100 LEDs without too much tweaking. 50 | // 51 | // I recommend running this simulation at anywhere from 30-100 frames per second, 52 | // meaning an interframe delay of about 10-35 milliseconds. 53 | // 54 | // Looks best on a high-density LED setup (60+ pixels/meter). 55 | // 56 | // 57 | // There are two main parameters you can play with to control the look and 58 | // feel of your fire: COOLING (used in step 1 above), and SPARKING (used 59 | // in step 3 above). 60 | // 61 | // COOLING: How much does the air cool as it rises? 62 | // Less cooling = taller flames. More cooling = shorter flames. 63 | // Default 50, suggested range 20-100 64 | #define COOLING 55 65 | 66 | // SPARKING: What chance (out of 255) is there that a new spark will be lit? 67 | // Higher chance = more roaring fire. Lower chance = more flickery fire. 68 | // Default 120, suggested range 50-200. 69 | #define SPARKING 120 70 | 71 | 72 | void Fire2012() 73 | { 74 | // Array of temperature readings at each simulation cell 75 | static byte heat[NUM_LEDS]; 76 | 77 | // Step 1. Cool down every cell a little 78 | for( int i = 0; i < NUM_LEDS; i++) { 79 | heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / NUM_LEDS) + 2)); 80 | } 81 | 82 | // Step 2. Heat from each cell drifts 'up' and diffuses a little 83 | for( int k= NUM_LEDS - 1; k >= 2; k--) { 84 | heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; 85 | } 86 | 87 | // Step 3. Randomly ignite new 'sparks' of heat near the bottom 88 | if( random8() < SPARKING ) { 89 | int y = random8(7); 90 | heat[y] = qadd8( heat[y], random8(160,255) ); 91 | } 92 | 93 | // Step 4. Map from heat cells to LED colors 94 | for( int j = 0; j < NUM_LEDS; j++) { 95 | CRGB color = HeatColor( heat[j]); 96 | int pixelnumber; 97 | if( gReverseDirection ) { 98 | pixelnumber = (NUM_LEDS-1) - j; 99 | } else { 100 | pixelnumber = j; 101 | } 102 | leds[pixelnumber] = color; 103 | } 104 | } 105 | 106 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/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 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/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 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/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::Black; 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::Black; 50 | delay(100); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/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 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/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 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/examples/Multiple/ParallelOutputDemo/ParallelOutputDemo.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define NUM_LEDS_PER_STRIP 16 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 | 21 | // IBCC outputs; 22 | 23 | void setup() { 24 | delay(5000); 25 | Serial.begin(57600); 26 | Serial.println("Starting..."); 27 | // LEDS.addLeds(leds, NUM_LEDS_PER_STRIP); 28 | // LEDS.addLeds(leds, NUM_LEDS_PER_STRIP); 29 | // LEDS.addLeds(leds, NUM_LEDS_PER_STRIP).setCorrection(TypicalLEDStrip); 30 | LEDS.addLeds(leds, NUM_LEDS_PER_STRIP); 31 | 32 | // Teensy 4 parallel output example 33 | // LEDS.addLeds(leds,NUM_LEDS_PER_STRIP); 34 | } 35 | 36 | void loop() { 37 | Serial.println("Loop...."); 38 | static uint8_t hue = 0; 39 | for(int i = 0; i < NUM_STRIPS; i++) { 40 | for(int j = 0; j < NUM_LEDS_PER_STRIP; j++) { 41 | leds[(i*NUM_LEDS_PER_STRIP) + j] = CHSV((32*i) + hue+j,192,255); 42 | } 43 | } 44 | 45 | // Set the first n leds on each strip to show which strip it is 46 | for(int i = 0; i < NUM_STRIPS; i++) { 47 | for(int j = 0; j <= i; j++) { 48 | leds[(i*NUM_LEDS_PER_STRIP) + j] = CRGB::Red; 49 | } 50 | } 51 | 52 | hue++; 53 | 54 | LEDS.show(); 55 | // LEDS.delay(100); 56 | } 57 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/examples/Noise/Noise.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // 4 | // Mark's xy coordinate mapping code. See the XYMatrix for more information on it. 5 | // 6 | 7 | // Params for width and height 8 | const uint8_t kMatrixWidth = 16; 9 | const uint8_t kMatrixHeight = 16; 10 | #define MAX_DIMENSION ((kMatrixWidth>kMatrixHeight) ? kMatrixWidth : kMatrixHeight) 11 | #define NUM_LEDS (kMatrixWidth * kMatrixHeight) 12 | // Param for different pixel layouts 13 | const bool kMatrixSerpentineLayout = true; 14 | 15 | 16 | uint16_t XY( uint8_t x, uint8_t y) 17 | { 18 | uint16_t i; 19 | 20 | if( kMatrixSerpentineLayout == false) { 21 | i = (y * kMatrixWidth) + x; 22 | } 23 | 24 | if( kMatrixSerpentineLayout == true) { 25 | if( y & 0x01) { 26 | // Odd rows run backwards 27 | uint8_t reverseX = (kMatrixWidth - 1) - x; 28 | i = (y * kMatrixWidth) + reverseX; 29 | } else { 30 | // Even rows run forwards 31 | i = (y * kMatrixWidth) + x; 32 | } 33 | } 34 | 35 | return i; 36 | } 37 | 38 | // The leds 39 | CRGB leds[kMatrixWidth * kMatrixHeight]; 40 | 41 | // The 32bit version of our coordinates 42 | static uint16_t x; 43 | static uint16_t y; 44 | static uint16_t z; 45 | 46 | // We're using the x/y dimensions to map to the x/y pixels on the matrix. We'll 47 | // use the z-axis for "time". speed determines how fast time moves forward. Try 48 | // 1 for a very slow moving effect, or 60 for something that ends up looking like 49 | // water. 50 | // uint16_t speed = 1; // almost looks like a painting, moves very slowly 51 | uint16_t speed = 20; // a nice starting speed, mixes well with a scale of 100 52 | // uint16_t speed = 33; 53 | // uint16_t speed = 100; // wicked fast! 54 | 55 | // Scale determines how far apart the pixels in our noise matrix are. Try 56 | // changing these values around to see how it affects the motion of the display. The 57 | // higher the value of scale, the more "zoomed out" the noise iwll be. A value 58 | // of 1 will be so zoomed in, you'll mostly see solid colors. 59 | 60 | // uint16_t scale = 1; // mostly just solid colors 61 | // uint16_t scale = 4011; // very zoomed out and shimmery 62 | uint16_t scale = 311; 63 | 64 | // This is the array that we keep our computed noise values in 65 | uint8_t noise[MAX_DIMENSION][MAX_DIMENSION]; 66 | 67 | void setup() { 68 | // uncomment the following lines if you want to see FPS count information 69 | // Serial.begin(38400); 70 | // Serial.println("resetting!"); 71 | delay(3000); 72 | LEDS.addLeds(leds,NUM_LEDS); 73 | LEDS.setBrightness(96); 74 | 75 | // Initialize our coordinates to some random values 76 | x = random16(); 77 | y = random16(); 78 | z = random16(); 79 | } 80 | 81 | // Fill the x/y array of 8-bit noise values using the inoise8 function. 82 | void fillnoise8() { 83 | for(int i = 0; i < MAX_DIMENSION; i++) { 84 | int ioffset = scale * i; 85 | for(int j = 0; j < MAX_DIMENSION; j++) { 86 | int joffset = scale * j; 87 | noise[i][j] = inoise8(x + ioffset,y + joffset,z); 88 | } 89 | } 90 | z += speed; 91 | } 92 | 93 | 94 | void loop() { 95 | static uint8_t ihue=0; 96 | fillnoise8(); 97 | for(int i = 0; i < kMatrixWidth; i++) { 98 | for(int j = 0; j < kMatrixHeight; j++) { 99 | // We use the value at the (i,j) coordinate in the noise 100 | // array for our brightness, and the flipped value from (j,i) 101 | // for our pixel's hue. 102 | leds[XY(i,j)] = CHSV(noise[j][i],255,noise[i][j]); 103 | 104 | // You can also explore other ways to constrain the hue used, like below 105 | // leds[XY(i,j)] = CHSV(ihue + (noise[j][i]>>2),255,noise[i][j]); 106 | } 107 | } 108 | ihue+=1; 109 | 110 | LEDS.show(); 111 | // delay(10); 112 | } 113 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/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 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/examples/Pride2015/Pride2015.ino: -------------------------------------------------------------------------------- 1 | #include "FastLED.h" 2 | 3 | // Pride2015 4 | // Animated, ever-changing rainbows. 5 | // by Mark Kriegsman 6 | 7 | #if FASTLED_VERSION < 3001000 8 | #error "Requires FastLED 3.1 or later; check github for latest code." 9 | #endif 10 | 11 | #define DATA_PIN 3 12 | //#define CLK_PIN 4 13 | #define LED_TYPE WS2811 14 | #define COLOR_ORDER GRB 15 | #define NUM_LEDS 200 16 | #define BRIGHTNESS 255 17 | 18 | CRGB leds[NUM_LEDS]; 19 | 20 | 21 | void setup() { 22 | delay(3000); // 3 second delay for recovery 23 | 24 | // tell FastLED about the LED strip configuration 25 | FastLED.addLeds(leds, NUM_LEDS) 26 | .setCorrection(TypicalLEDStrip) 27 | .setDither(BRIGHTNESS < 255); 28 | 29 | // set master brightness control 30 | FastLED.setBrightness(BRIGHTNESS); 31 | } 32 | 33 | 34 | void loop() 35 | { 36 | pride(); 37 | FastLED.show(); 38 | } 39 | 40 | 41 | // This function draws rainbows with an ever-changing, 42 | // widely-varying set of parameters. 43 | void pride() 44 | { 45 | static uint16_t sPseudotime = 0; 46 | static uint16_t sLastMillis = 0; 47 | static uint16_t sHue16 = 0; 48 | 49 | uint8_t sat8 = beatsin88( 87, 220, 250); 50 | uint8_t brightdepth = beatsin88( 341, 96, 224); 51 | uint16_t brightnessthetainc16 = beatsin88( 203, (25 * 256), (40 * 256)); 52 | uint8_t msmultiplier = beatsin88(147, 23, 60); 53 | 54 | uint16_t hue16 = sHue16;//gHue * 256; 55 | uint16_t hueinc16 = beatsin88(113, 1, 3000); 56 | 57 | uint16_t ms = millis(); 58 | uint16_t deltams = ms - sLastMillis ; 59 | sLastMillis = ms; 60 | sPseudotime += deltams * msmultiplier; 61 | sHue16 += deltams * beatsin88( 400, 5,9); 62 | uint16_t brightnesstheta16 = sPseudotime; 63 | 64 | for( uint16_t i = 0 ; i < NUM_LEDS; i++) { 65 | hue16 += hueinc16; 66 | uint8_t hue8 = hue16 / 256; 67 | 68 | brightnesstheta16 += brightnessthetainc16; 69 | uint16_t b16 = sin16( brightnesstheta16 ) + 32768; 70 | 71 | uint16_t bri16 = (uint32_t)((uint32_t)b16 * (uint32_t)b16) / 65536; 72 | uint8_t bri8 = (uint32_t)(((uint32_t)bri16) * brightdepth) / 65536; 73 | bri8 += (255 - brightdepth); 74 | 75 | CRGB newcolor = CHSV( hue8, sat8, bri8); 76 | 77 | uint16_t pixelnumber = i; 78 | pixelnumber = (NUM_LEDS-1) - pixelnumber; 79 | 80 | nblend( leds[pixelnumber], newcolor, 64); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/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 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/examples/SmartMatrix/SmartMatrix.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #define kMatrixWidth 32 5 | #define kMatrixHeight 32 6 | const bool kMatrixSerpentineLayout = false; 7 | 8 | #define NUM_LEDS (kMatrixWidth * kMatrixHeight) 9 | 10 | CRGB leds[kMatrixWidth * kMatrixHeight]; 11 | 12 | 13 | uint16_t XY( uint8_t x, uint8_t y) 14 | { 15 | uint16_t i; 16 | 17 | if( kMatrixSerpentineLayout == false) { 18 | i = (y * kMatrixWidth) + x; 19 | } 20 | 21 | if( kMatrixSerpentineLayout == true) { 22 | if( y & 0x01) { 23 | // Odd rows run backwards 24 | uint8_t reverseX = (kMatrixWidth - 1) - x; 25 | i = (y * kMatrixWidth) + reverseX; 26 | } else { 27 | // Even rows run forwards 28 | i = (y * kMatrixWidth) + x; 29 | } 30 | } 31 | 32 | return i; 33 | } 34 | 35 | // The 32bit version of our coordinates 36 | static uint16_t x; 37 | static uint16_t y; 38 | static uint16_t z; 39 | 40 | // We're using the x/y dimensions to map to the x/y pixels on the matrix. We'll 41 | // use the z-axis for "time". speed determines how fast time moves forward. Try 42 | // 1 for a very slow moving effect, or 60 for something that ends up looking like 43 | // water. 44 | // uint16_t speed = 1; // almost looks like a painting, moves very slowly 45 | uint16_t speed = 20; // a nice starting speed, mixes well with a scale of 100 46 | // uint16_t speed = 33; 47 | // uint16_t speed = 100; // wicked fast! 48 | 49 | // Scale determines how far apart the pixels in our noise matrix are. Try 50 | // changing these values around to see how it affects the motion of the display. The 51 | // higher the value of scale, the more "zoomed out" the noise iwll be. A value 52 | // of 1 will be so zoomed in, you'll mostly see solid colors. 53 | 54 | // uint16_t scale = 1; // mostly just solid colors 55 | // uint16_t scale = 4011; // very zoomed out and shimmery 56 | uint16_t scale = 31; 57 | 58 | // This is the array that we keep our computed noise values in 59 | uint8_t noise[kMatrixWidth][kMatrixHeight]; 60 | 61 | void setup() { 62 | // uncomment the following lines if you want to see FPS count information 63 | // Serial.begin(38400); 64 | // Serial.println("resetting!"); 65 | delay(3000); 66 | LEDS.addLeds(leds,NUM_LEDS); 67 | LEDS.setBrightness(96); 68 | 69 | // Initialize our coordinates to some random values 70 | x = random16(); 71 | y = random16(); 72 | z = random16(); 73 | 74 | // Show off smart matrix scrolling text 75 | pSmartMatrix->setScrollMode(wrapForward); 76 | pSmartMatrix->setScrollColor({0xff, 0xff, 0xff}); 77 | pSmartMatrix->setScrollSpeed(15); 78 | pSmartMatrix->setScrollFont(font6x10); 79 | pSmartMatrix->scrollText("Smart Matrix & FastLED", -1); 80 | pSmartMatrix->setScrollOffsetFromEdge(10); 81 | } 82 | 83 | // Fill the x/y array of 8-bit noise values using the inoise8 function. 84 | void fillnoise8() { 85 | for(int i = 0; i < kMatrixWidth; i++) { 86 | int ioffset = scale * i; 87 | for(int j = 0; j < kMatrixHeight; j++) { 88 | int joffset = scale * j; 89 | noise[i][j] = inoise8(x + ioffset,y + joffset,z); 90 | } 91 | } 92 | z += speed; 93 | } 94 | 95 | 96 | void loop() { 97 | static uint8_t circlex = 0; 98 | static uint8_t circley = 0; 99 | 100 | static uint8_t ihue=0; 101 | fillnoise8(); 102 | for(int i = 0; i < kMatrixWidth; i++) { 103 | for(int j = 0; j < kMatrixHeight; j++) { 104 | // We use the value at the (i,j) coordinate in the noise 105 | // array for our brightness, and the flipped value from (j,i) 106 | // for our pixel's hue. 107 | leds[XY(i,j)] = CHSV(noise[j][i],255,noise[i][j]); 108 | 109 | // You can also explore other ways to constrain the hue used, like below 110 | // leds[XY(i,j)] = CHSV(ihue + (noise[j][i]>>2),255,noise[i][j]); 111 | } 112 | } 113 | ihue+=1; 114 | 115 | // N.B. this requires SmartMatrix modified w/triple buffering support 116 | pSmartMatrix->fillCircle(circlex % 32,circley % 32,6,CRGB(CHSV(ihue+128,255,255))); 117 | circlex += random16(2); 118 | circley += random16(2); 119 | LEDS.show(); 120 | // delay(10); 121 | } 122 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/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 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/extras/RainbowDemo.bin.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/palmmaximilian/ReactNativeArduinoBLE/a5af089367b5f3232a040256e34c8d6a1765b3f8/Arduino/lib/FastLED-master/extras/RainbowDemo.bin.zip -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/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 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/fastled_config.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_FASTLED_CONFIG_H 2 | #define __INC_FASTLED_CONFIG_H 3 | 4 | #include "FastLED.h" 5 | 6 | ///@file fastled_config.h 7 | /// contains definitions that can be used to configure FastLED at compile time 8 | 9 | // Use this option only for debugging pin access and forcing software pin access. Note that 10 | // software pin access only works in Arduino based environments. Forces use of digitalWrite 11 | // methods for pin access vs. direct hardware port access 12 | // #define FASTLED_FORCE_SOFTWARE_PINS 13 | 14 | // Use this option only for debugging bitbang'd spi access or to work around bugs in hardware 15 | // spi access. Forces use of bit-banged spi, even on pins that has hardware SPI available. 16 | // #define FASTLED_FORCE_SOFTWARE_SPI 17 | 18 | // Use this to force FastLED to allow interrupts in the clockless chipsets (or to force it to 19 | // disallow), overriding the default on platforms that support this. Set the value to 1 to 20 | // allow interrupts or 0 to disallow them. 21 | // #define FASTLED_ALLOW_INTERRUPTS 1 22 | // #define FASTLED_ALLOW_INTERRUPTS 0 23 | 24 | // Use this to allow some integer overflows/underflows in the inoise functions. 25 | // The original implementions allowed this, and had some discontinuties in the noise 26 | // output. It's technically an implementation bug, and was fixed, but you may wish 27 | // to preserve the old look and feel of the inoise functions in your existing animations. 28 | // The default is 0: NO overflow, and 'continuous' noise output, aka the fixed way. 29 | // #define FASTLED_NOISE_ALLOW_AVERAGE_TO_OVERFLOW 0 30 | // #define FASTLED_NOISE_ALLOW_AVERAGE_TO_OVERFLOW 1 31 | 32 | // Use this toggle whether or not to use the 'fixed' FastLED scale8. The initial scale8 33 | // had a problem where scale8(255,255) would give you 254. This is now fixed, and that 34 | // fix is enabled by default. However, if for some reason you have code that is not 35 | // working right as a result of this (e.g. code that was expecting the old scale8 behavior) 36 | // you can disable it here. 37 | #define FASTLED_SCALE8_FIXED 1 38 | // #define FASTLED_SCALE8_FIXED 0 39 | 40 | // Use this toggle whether to use 'fixed' FastLED pixel blending, including ColorFromPalette. 41 | // The prior pixel blend functions had integer-rounding math errors that led to 42 | // small errors being inadvertently added to the low bits of blended colors, including colors 43 | // retrieved from color palettes using LINEAR_BLEND. This is now fixed, and the 44 | // fix is enabled by default. However, if for some reason you wish to run with the old 45 | // blending, including the integer rounding and color errors, you can disable the bugfix here. 46 | #define FASTLED_BLEND_FIXED 1 47 | // #define FASTLED_BLEND_FIXED 0 48 | 49 | // Use this toggle whether to use 'fixed' FastLED 8- and 16-bit noise functions. 50 | // The prior noise functions had some math errors that led to 'discontinuities' in the 51 | // output, which by definition should be smooth and continuous. The bug led to 52 | // noise function output that had 'edges' and glitches in it. This is now fixed, and the 53 | // fix is enabled by default. However, if for some reason you wish to run with the old 54 | // noise code, including the glitches, you can disable the bugfix here. 55 | #define FASTLED_NOISE_FIXED 1 56 | //#define FASTLED_NOISE_FIXED 0 57 | 58 | // Use this to determine how many times FastLED will attempt to re-transmit a frame if interrupted 59 | // for too long by interrupts. 60 | #ifndef FASTLED_INTERRUPT_RETRY_COUNT 61 | #define FASTLED_INTERRUPT_RETRY_COUNT 2 62 | #endif 63 | 64 | // Use this toggle to enable global brightness in contollers that support is (ADA102 and SK9822). 65 | // It changes how color scaling works and uses global brightness before scaling down color values. 66 | // This enable much more accurate color control on low brightness settings. 67 | //#define FASTLED_USE_GLOBAL_BRIGHTNESS 1 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/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 | #if defined(FASTLED_ARM) || defined(ESP32) || defined(ESP8266) 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 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/fastspi_dma.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/palmmaximilian/ReactNativeArduinoBLE/a5af089367b5f3232a040256e34c8d6a1765b3f8/Arduino/lib/FastLED-master/fastspi_dma.h -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/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 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/fastspi_ref.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_FASTSPI_ARM_SAM_H 2 | #define __INC_FASTSPI_ARM_SAM_H 3 | 4 | #if 0 // guard against the arduino ide idiotically including every header file 5 | #include "FastLED.h" 6 | 7 | FASTLED_NAMESPACE_BEGIN 8 | 9 | // A skeletal implementation of hardware SPI support. Fill in the necessary code for init, waiting, and writing. The rest of 10 | // the method implementations should provide a starting point, even if not hte most efficient to start with 11 | template 12 | class REFHardwareSPIOutput { 13 | Selectable *m_pSelect; 14 | public: 15 | SAMHardwareSPIOutput() { m_pSelect = NULL; } 16 | SAMHArdwareSPIOutput(Selectable *pSelect) { m_pSelect = pSelect; } 17 | 18 | // set the object representing the selectable 19 | void setSelect(Selectable *pSelect) { /* TODO */ } 20 | 21 | // initialize the SPI subssytem 22 | void init() { /* TODO */ } 23 | 24 | // latch the CS select 25 | void inline select() __attribute__((always_inline)) { if(m_pSelect != NULL) { m_pSelect->select(); } } 26 | 27 | // release the CS select 28 | void inline release() __attribute__((always_inline)) { if(m_pSelect != NULL) { m_pSelect->release(); } } 29 | 30 | // wait until all queued up data has been written 31 | static void waitFully() { /* TODO */ } 32 | 33 | // write a byte out via SPI (returns immediately on writing register) 34 | static void writeByte(uint8_t b) { /* TODO */ } 35 | 36 | // write a word out via SPI (returns immediately on writing register) 37 | static void writeWord(uint16_t w) { /* TODO */ } 38 | 39 | // A raw set of writing byte values, assumes setup/init/waiting done elsewhere 40 | static void writeBytesValueRaw(uint8_t value, int len) { 41 | while(len--) { writeByte(value); } 42 | } 43 | 44 | // A full cycle of writing a value for len bytes, including select, release, and waiting 45 | void writeBytesValue(uint8_t value, int len) { 46 | select(); writeBytesValueRaw(value, len); release(); 47 | } 48 | 49 | // A full cycle of writing a value for len bytes, including select, release, and waiting 50 | template void writeBytes(register uint8_t *data, int len) { 51 | uint8_t *end = data + len; 52 | select(); 53 | // could be optimized to write 16bit words out instead of 8bit bytes 54 | while(data != end) { 55 | writeByte(D::adjust(*data++)); 56 | } 57 | D::postBlock(len); 58 | waitFully(); 59 | release(); 60 | } 61 | 62 | // A full cycle of writing a value for len bytes, including select, release, and waiting 63 | void writeBytes(register uint8_t *data, int len) { writeBytes(data, len); } 64 | 65 | // write a single bit out, which bit from the passed in byte is determined by template parameter 66 | template inline static void writeBit(uint8_t b) { /* TODO */ } 67 | 68 | // write a block of uint8_ts out in groups of three. len is the total number of uint8_ts to write out. The template 69 | // parameters indicate how many uint8_ts to skip at the beginning and/or end of each grouping 70 | template void writePixels(PixelController pixels) { 71 | select(); 72 | while(data != end) { 73 | if(FLAGS & FLAG_START_BIT) { 74 | writeBit<0>(1); 75 | } 76 | writeByte(D::adjust(pixels.loadAndScale0())); 77 | writeByte(D::adjust(pixels.loadAndScale1())); 78 | writeByte(D::adjust(pixels.loadAndScale2())); 79 | 80 | pixels.advanceData(); 81 | pixels.stepDithering(); 82 | data += (3+skip); 83 | } 84 | D::postBlock(len); 85 | release(); 86 | } 87 | 88 | }; 89 | 90 | FASTLED_NAMESPACE_END 91 | 92 | #endif 93 | 94 | #endif 95 | 96 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/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 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/hsv2rgb.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_HSV2RGB_H 2 | #define __INC_HSV2RGB_H 3 | 4 | #include "FastLED.h" 5 | 6 | #include "pixeltypes.h" 7 | 8 | FASTLED_NAMESPACE_BEGIN 9 | 10 | // hsv2rgb_rainbow - convert a hue, saturation, and value to RGB 11 | // using a visually balanced rainbow (vs a straight 12 | // mathematical spectrum). 13 | // This 'rainbow' yields better yellow and orange 14 | // than a straight 'spectrum'. 15 | // 16 | // NOTE: here hue is 0-255, not just 0-191 17 | 18 | void hsv2rgb_rainbow( const struct CHSV& hsv, struct CRGB& rgb); 19 | void hsv2rgb_rainbow( const struct CHSV* phsv, struct CRGB * prgb, int numLeds); 20 | #define HUE_MAX_RAINBOW 255 21 | 22 | 23 | // hsv2rgb_spectrum - convert a hue, saturation, and value to RGB 24 | // using a mathematically straight spectrum (vs 25 | // a visually balanced rainbow). 26 | // This 'spectrum' will have more green & blue 27 | // than a 'rainbow', and less yellow and orange. 28 | // 29 | // NOTE: here hue is 0-255, not just 0-191 30 | 31 | void hsv2rgb_spectrum( const struct CHSV& hsv, struct CRGB& rgb); 32 | void hsv2rgb_spectrum( const struct CHSV* phsv, struct CRGB * prgb, int numLeds); 33 | #define HUE_MAX_SPECTRUM 255 34 | 35 | 36 | // hsv2rgb_raw - convert hue, saturation, and value to RGB. 37 | // This 'spectrum' conversion will be more green & blue 38 | // than a real 'rainbow', and the hue is specified just 39 | // in the range 0-191. Together, these result in a 40 | // slightly faster conversion speed, at the expense of 41 | // color balance. 42 | // 43 | // NOTE: Hue is 0-191 only! 44 | // Saturation & value are 0-255 each. 45 | // 46 | 47 | void hsv2rgb_raw(const struct CHSV& hsv, struct CRGB & rgb); 48 | void hsv2rgb_raw(const struct CHSV* phsv, struct CRGB * prgb, int numLeds); 49 | #define HUE_MAX 191 50 | 51 | 52 | // rgb2hsv_approximate - recover _approximate_ HSV values from RGB. 53 | // 54 | // NOTE 1: This function is a long-term work in process; expect 55 | // results to change slightly over time as this function is 56 | // refined and improved. 57 | // 58 | // NOTE 2: This function is most accurate when the input is an 59 | // RGB color that came from a fully-saturated HSV color to start 60 | // with. E.g. CHSV( hue, 255, 255) -> CRGB -> CHSV will give 61 | // best results. 62 | // 63 | // NOTE 3: This function is not nearly as fast as HSV-to-RGB. 64 | // It is provided for those situations when the need for this 65 | // function cannot be avoided, or when extremely high performance 66 | // is not needed. 67 | // 68 | // NOTE 4: Why is this 'only' an "approximation"? 69 | // Not all RGB colors have HSV equivalents! For example, there 70 | // is no HSV value that will ever convert to RGB(255,255,0) using 71 | // the code provided in this library. So if you try to 72 | // convert RGB(255,255,0) 'back' to HSV, you'll necessarily get 73 | // only an approximation. Emphasis has been placed on getting 74 | // the 'hue' as close as usefully possible, but even that's a bit 75 | // of a challenge. The 8-bit HSV and 8-bit RGB color spaces 76 | // are not a "bijection". 77 | // 78 | // Nevertheless, this function does a pretty good job, particularly 79 | // at recovering the 'hue' from fully saturated RGB colors that 80 | // originally came from HSV rainbow colors. So if you start 81 | // with CHSV(hue_in,255,255), and convert that to RGB, and then 82 | // convert it back to HSV using this function, the resulting output 83 | // hue will either exactly the same, or very close (+/-1). 84 | // The more desaturated the original RGB color is, the rougher the 85 | // approximation, and the less accurate the results. 86 | // 87 | CHSV rgb2hsv_approximate( const CRGB& rgb); 88 | 89 | FASTLED_NAMESPACE_END 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/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(NRF52_SERIES) 11 | #include "platforms/arm/nrf52/led_sysdefs_arm_nrf52.h" 12 | #elif defined(__MK20DX128__) || defined(__MK20DX256__) 13 | // Include k20/T3 headers 14 | #include "platforms/arm/k20/led_sysdefs_arm_k20.h" 15 | #elif defined(__MK66FX1M0__) || defined(__MK64FX512__) 16 | // Include k66/T3.6 headers 17 | #include "platforms/arm/k66/led_sysdefs_arm_k66.h" 18 | #elif defined(__MKL26Z64__) 19 | // Include kl26/T-LC headers 20 | #include "platforms/arm/kl26/led_sysdefs_arm_kl26.h" 21 | #elif defined(__IMXRT1062__) 22 | // teensy4 23 | #include "platforms/arm/mxrt1062/led_sysdefs_arm_mxrt1062.h" 24 | #elif defined(__SAM3X8E__) 25 | // Include sam/due headers 26 | #include "platforms/arm/sam/led_sysdefs_arm_sam.h" 27 | #elif defined(STM32F10X_MD) || defined(__STM32F1__) 28 | #include "platforms/arm/stm32/led_sysdefs_arm_stm32.h" 29 | #elif defined(__SAMD21G18A__) || defined(__SAMD21J18A__) || defined(__SAMD21E17A__) || defined(__SAMD21E18A__) || defined(__SAMD51G19A__) || defined(__SAMD51J19A__) 30 | #include "platforms/arm/d21/led_sysdefs_arm_d21.h" 31 | #elif defined(ESP8266) 32 | #include "platforms/esp/8266/led_sysdefs_esp8266.h" 33 | #elif defined(ESP32) 34 | #include "platforms/esp/32/led_sysdefs_esp32.h" 35 | #elif defined(__AVR__) 36 | // AVR platforms 37 | #include "platforms/avr/led_sysdefs_avr.h" 38 | #else 39 | // 40 | // We got here because we don't recognize the platform that you're 41 | // trying to compile for: it's not AVR, or an ESP or ARM that we recognize. 42 | // 43 | // If you're reading this because you got the error below, 44 | // and if this new platform is just a minor variant of an 45 | // existing supported ARM platform, you may be able to add 46 | // a new 'defined(XXX)' selector in the apporpriate code above. 47 | // 48 | // If this platform is a new microcontroller, see "PORTING.md". 49 | // 50 | #error "This platform isn't recognized by FastLED... yet. See comments in FastLED/led_sysdefs.h for options." 51 | #endif 52 | 53 | #ifndef FASTLED_NAMESPACE_BEGIN 54 | #define FASTLED_NAMESPACE_BEGIN 55 | #define FASTLED_NAMESPACE_END 56 | #define FASTLED_USING_NAMESPACE 57 | #endif 58 | 59 | // Arduino.h needed for convenience functions digitalPinToPort/BitMask/portOutputRegister and the pinMode methods. 60 | #ifdef ARDUINO 61 | #include 62 | #endif 63 | 64 | #define CLKS_PER_US (F_CPU/1000000) 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/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 | #if defined(LIB8_ATTINY) 16 | #define APPLY_FASTLED_RAND16_2053(x) (x << 11) + (x << 2) + x 17 | #else 18 | #define APPLY_FASTLED_RAND16_2053(x) (x * FASTLED_RAND16_2053) 19 | #endif 20 | 21 | /// random number seed 22 | extern uint16_t rand16seed;// = RAND16_SEED; 23 | 24 | /// Generate an 8-bit random number 25 | LIB8STATIC uint8_t random8() 26 | { 27 | rand16seed = APPLY_FASTLED_RAND16_2053(rand16seed) + FASTLED_RAND16_13849; 28 | // return the sum of the high and low bytes, for better 29 | // mixing and non-sequential correlation 30 | return (uint8_t)(((uint8_t)(rand16seed & 0xFF)) + 31 | ((uint8_t)(rand16seed >> 8))); 32 | } 33 | 34 | /// Generate a 16 bit random number 35 | LIB8STATIC uint16_t random16() 36 | { 37 | rand16seed = APPLY_FASTLED_RAND16_2053(rand16seed) + FASTLED_RAND16_13849; 38 | return rand16seed; 39 | } 40 | 41 | /// Generate an 8-bit random number between 0 and lim 42 | /// @param lim the upper bound for the result 43 | LIB8STATIC uint8_t random8(uint8_t lim) 44 | { 45 | uint8_t r = random8(); 46 | r = (r*lim) >> 8; 47 | return r; 48 | } 49 | 50 | /// Generate an 8-bit random number in the given range 51 | /// @param min the lower bound for the random number 52 | /// @param lim the upper bound for the random number 53 | LIB8STATIC uint8_t random8(uint8_t min, uint8_t lim) 54 | { 55 | uint8_t delta = lim - min; 56 | uint8_t r = random8(delta) + min; 57 | return r; 58 | } 59 | 60 | /// Generate an 16-bit random number between 0 and lim 61 | /// @param lim the upper bound for the result 62 | LIB8STATIC uint16_t random16( uint16_t lim) 63 | { 64 | uint16_t r = random16(); 65 | uint32_t p = (uint32_t)lim * (uint32_t)r; 66 | r = p >> 16; 67 | return r; 68 | } 69 | 70 | /// Generate an 16-bit random number in the given range 71 | /// @param min the lower bound for the random number 72 | /// @param lim the upper bound for the random number 73 | LIB8STATIC uint16_t random16( uint16_t min, uint16_t lim) 74 | { 75 | uint16_t delta = lim - min; 76 | uint16_t r = random16( delta) + min; 77 | return r; 78 | } 79 | 80 | /// Set the 16-bit seed used for the random number generator 81 | LIB8STATIC void random16_set_seed( uint16_t seed) 82 | { 83 | rand16seed = seed; 84 | } 85 | 86 | /// Get the current seed value for the random number generator 87 | LIB8STATIC uint16_t random16_get_seed() 88 | { 89 | return rand16seed; 90 | } 91 | 92 | /// Add entropy into the random number generator 93 | LIB8STATIC void random16_add_entropy( uint16_t entropy) 94 | { 95 | rand16seed += entropy; 96 | } 97 | 98 | ///@} 99 | 100 | #endif 101 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/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 | "name": "Sam Guyer", 18 | "url": "https://github.com/samguyer", 19 | "maintainer": true 20 | }, 21 | { 22 | "name": "Jason Coon", 23 | "url": "https://github.com/jasoncoon", 24 | "maintainer": true 25 | }, 26 | { 27 | "name": "Josh Huber", 28 | "url": "https://github.com/uberjay", 29 | "maintainer": true 30 | } 31 | ], 32 | "repository": { 33 | "type": "git", 34 | "url": "https://github.com/FastLED/FastLED.git" 35 | }, 36 | "version": "3.3.3", 37 | "license": "MIT", 38 | "homepage": "http://fastled.io", 39 | "frameworks": "arduino", 40 | "platforms": "atmelavr, atmelsam, freescalekinetis, nordicnrf51, nxplpc, ststm32, teensy, espressif8266, espressif32, nordicnrf52", 41 | "export": { 42 | "exclude": [ 43 | "docs", 44 | "extras" 45 | ] 46 | }, 47 | "build": { 48 | "srcFilter": [ 49 | "+<*.c>", 50 | "+<*.cpp>", 51 | "+<*.h>" 52 | ], 53 | "libArchive": false 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/library.properties: -------------------------------------------------------------------------------- 1 | name=FastLED 2 | version=3.3.3 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 | includes=FastLED.h 11 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/platforms.cpp: -------------------------------------------------------------------------------- 1 | #define FASTLED_INTERNAL 2 | 3 | 4 | // Interrupt handlers cannot be defined in the header. 5 | // They must be defined as C functions, or they won't 6 | // be found (due to name mangling), and thus won't 7 | // override any default weak definition. 8 | #if defined(NRF52_SERIES) 9 | 10 | #include "platforms/arm/nrf52/led_sysdefs_arm_nrf52.h" 11 | #include "platforms/arm/nrf52/arbiter_nrf52.h" 12 | 13 | uint32_t isrCount; 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | // NOTE: Update platforms.cpp in root of FastLED library if this changes 19 | #if defined(FASTLED_NRF52_ENABLE_PWM_INSTANCE0) 20 | void PWM0_IRQHandler(void) { isrCount++; PWM_Arbiter<0>::isr_handler(); } 21 | #endif 22 | #if defined(FASTLED_NRF52_ENABLE_PWM_INSTANCE1) 23 | void PWM1_IRQHandler(void) { isrCount++; PWM_Arbiter<1>::isr_handler(); } 24 | #endif 25 | #if defined(FASTLED_NRF52_ENABLE_PWM_INSTANCE2) 26 | void PWM2_IRQHandler(void) { isrCount++; PWM_Arbiter<2>::isr_handler(); } 27 | #endif 28 | #if defined(FASTLED_NRF52_ENABLE_PWM_INSTANCE3) 29 | void PWM3_IRQHandler(void) { isrCount++; PWM_Arbiter<3>::isr_handler(); } 30 | #endif 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | #endif // defined(NRF52_SERIES) 36 | 37 | 38 | 39 | // FASTLED_NAMESPACE_BEGIN 40 | // FASTLED_NAMESPACE_END 41 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/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(NRF52_SERIES) 11 | #include "platforms/arm/nrf52/fastled_arm_nrf52.h" 12 | #elif defined(__MK20DX128__) || defined(__MK20DX256__) 13 | // Include k20/T3 headers 14 | #include "platforms/arm/k20/fastled_arm_k20.h" 15 | #elif defined(__MK66FX1M0__) || defined(__MK64FX512__) 16 | // Include k66/T3.6 headers 17 | #include "platforms/arm/k66/fastled_arm_k66.h" 18 | #elif defined(__MKL26Z64__) 19 | // Include kl26/T-LC headers 20 | #include "platforms/arm/kl26/fastled_arm_kl26.h" 21 | #elif defined(__IMXRT1062__) 22 | // teensy4 23 | #include "platforms/arm/mxrt1062/fastled_arm_mxrt1062.h" 24 | #elif defined(__SAM3X8E__) 25 | // Include sam/due headers 26 | #include "platforms/arm/sam/fastled_arm_sam.h" 27 | #elif defined(STM32F10X_MD) || defined(__STM32F1__) 28 | #include "platforms/arm/stm32/fastled_arm_stm32.h" 29 | #elif defined(__SAMD21G18A__) || defined(__SAMD21J18A__) || defined(__SAMD21E17A__) || defined(__SAMD21E18A__) 30 | #include "platforms/arm/d21/fastled_arm_d21.h" 31 | #elif defined(__SAMD51G19A__) || defined(__SAMD51J19A__) 32 | #include "platforms/arm/d51/fastled_arm_d51.h" 33 | #elif defined(ESP8266) 34 | #include "platforms/esp/8266/fastled_esp8266.h" 35 | #elif defined(ESP32) 36 | #include "platforms/esp/32/fastled_esp32.h" 37 | #else 38 | // AVR platforms 39 | #include "platforms/avr/fastled_avr.h" 40 | #endif 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/platforms/arm/d21/clockless_arm_d21.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_CLOCKLESS_ARM_D21 2 | #define __INC_CLOCKLESS_ARM_D21 3 | 4 | #include "../common/m0clockless.h" 5 | FASTLED_NAMESPACE_BEGIN 6 | #define FASTLED_HAS_CLOCKLESS 1 7 | 8 | template 9 | class ClocklessController : public CPixelLEDController { 10 | typedef typename FastPinBB::port_ptr_t data_ptr_t; 11 | typedef typename FastPinBB::port_t data_t; 12 | 13 | data_t mPinMask; 14 | data_ptr_t mPort; 15 | CMinWait mWait; 16 | public: 17 | virtual void init() { 18 | FastPinBB::setOutput(); 19 | mPinMask = FastPinBB::mask(); 20 | mPort = FastPinBB::port(); 21 | } 22 | 23 | virtual uint16_t getMaxRefreshRate() const { return 400; } 24 | 25 | virtual void showPixels(PixelController & pixels) { 26 | mWait.wait(); 27 | cli(); 28 | if(!showRGBInternal(pixels)) { 29 | sei(); delayMicroseconds(WAIT_TIME); cli(); 30 | showRGBInternal(pixels); 31 | } 32 | sei(); 33 | mWait.mark(); 34 | } 35 | 36 | // This method is made static to force making register Y available to use for data on AVR - if the method is non-static, then 37 | // gcc will use register Y for the this pointer. 38 | static uint32_t showRGBInternal(PixelController pixels) { 39 | struct M0ClocklessData data; 40 | data.d[0] = pixels.d[0]; 41 | data.d[1] = pixels.d[1]; 42 | data.d[2] = pixels.d[2]; 43 | data.s[0] = pixels.mScale[0]; 44 | data.s[1] = pixels.mScale[1]; 45 | data.s[2] = pixels.mScale[2]; 46 | data.e[0] = pixels.e[0]; 47 | data.e[1] = pixels.e[1]; 48 | data.e[2] = pixels.e[2]; 49 | data.adj = pixels.mAdvance; 50 | 51 | typename FastPin::port_ptr_t portBase = FastPin::port(); 52 | return showLedData<8,4,T1,T2,T3,RGB_ORDER, WAIT_TIME>(portBase, FastPin::mask(), pixels.mData, pixels.mLen, &data); 53 | } 54 | 55 | 56 | }; 57 | 58 | FASTLED_NAMESPACE_END 59 | 60 | 61 | #endif // __INC_CLOCKLESS_ARM_D21 62 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/platforms/arm/d21/fastled_arm_d21.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_FASTLED_ARM_D21_H 2 | #define __INC_FASTLED_ARM_D21_H 3 | 4 | #include "fastpin_arm_d21.h" 5 | #include "clockless_arm_d21.h" 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/platforms/arm/d21/led_sysdefs_arm_d21.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_LED_SYSDEFS_ARM_D21_H 2 | #define __INC_LED_SYSDEFS_ARM_D21_H 3 | 4 | 5 | #define FASTLED_ARM 6 | #define FASTLED_ARM_M0_PLUS 7 | 8 | #ifndef INTERRUPT_THRESHOLD 9 | #define INTERRUPT_THRESHOLD 1 10 | #endif 11 | 12 | // Default to allowing interrupts 13 | #ifndef FASTLED_ALLOW_INTERRUPTS 14 | #define FASTLED_ALLOW_INTERRUPTS 1 15 | #endif 16 | 17 | #if FASTLED_ALLOW_INTERRUPTS == 1 18 | #define FASTLED_ACCURATE_CLOCK 19 | #endif 20 | 21 | // reusing/abusing cli/sei defs for due 22 | #define cli() __disable_irq(); 23 | #define sei() __enable_irq(); 24 | 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/platforms/arm/d51/README.txt: -------------------------------------------------------------------------------- 1 | FastLED updates for adafruit FEATHER M4 and fixes to ITSBITSY M4 compiles 2 | SAMD51 3 | 4 | only tested on FEATHER M4 with DOTSTAR and neopixel strips 5 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/platforms/arm/d51/fastled_arm_d51.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_FASTLED_ARM_D51_H 2 | #define __INC_FASTLED_ARM_D51_H 3 | 4 | #include "fastpin_arm_d51.h" 5 | #include "clockless_arm_d51.h" 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/platforms/arm/d51/led_sysdefs_arm_d51.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_LED_SYSDEFS_ARM_D51_H 2 | #define __INC_LED_SYSDEFS_ARM_D51_H 3 | 4 | 5 | #define FASTLED_ARM 6 | // Note this is an M4, not an M0+, but this enables the shared m0clockless.h 7 | #define FASTLED_ARM_M0_PLUS 8 | 9 | #ifndef INTERRUPT_THRESHOLD 10 | #define INTERRUPT_THRESHOLD 1 11 | #endif 12 | 13 | // Default to allowing interrupts 14 | #ifndef FASTLED_ALLOW_INTERRUPTS 15 | #define FASTLED_ALLOW_INTERRUPTS 0 16 | #endif 17 | 18 | #if FASTLED_ALLOW_INTERRUPTS == 1 19 | #define FASTLED_ACCURATE_CLOCK 20 | #endif 21 | 22 | // reusing/abusing cli/sei defs for due 23 | #define cli() __disable_irq(); 24 | #define sei() __enable_irq(); 25 | 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/platforms/arm/k20/fastled_arm_k20.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_FASTLED_ARM_K20_H 2 | #define __INC_FASTLED_ARM_K20_H 3 | 4 | // Include the k20 headers 5 | #include "fastpin_arm_k20.h" 6 | #include "fastspi_arm_k20.h" 7 | #include "octows2811_controller.h" 8 | #include "ws2812serial_controller.h" 9 | #include "smartmatrix_t3.h" 10 | #include "clockless_arm_k20.h" 11 | #include "clockless_block_arm_k20.h" 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/platforms/arm/k20/led_sysdefs_arm_k20.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_LED_SYSDEFS_ARM_K20_H 2 | #define __INC_LED_SYSDEFS_ARM_K20_H 3 | 4 | #define FASTLED_TEENSY3 5 | #define FASTLED_ARM 6 | 7 | #ifndef INTERRUPT_THRESHOLD 8 | #define INTERRUPT_THRESHOLD 1 9 | #endif 10 | 11 | // Default to allowing interrupts 12 | #ifndef FASTLED_ALLOW_INTERRUPTS 13 | #define FASTLED_ALLOW_INTERRUPTS 1 14 | #endif 15 | 16 | #if FASTLED_ALLOW_INTERRUPTS == 1 17 | #define FASTLED_ACCURATE_CLOCK 18 | #endif 19 | 20 | #if (F_CPU == 96000000) 21 | #define CLK_DBL 1 22 | #endif 23 | 24 | // Get some system include files 25 | #include 26 | #include // for cli/se definitions 27 | 28 | // Define the register types 29 | #if defined(ARDUINO) // && ARDUINO < 150 30 | typedef volatile uint8_t RoReg; /**< Read only 8-bit register (volatile const unsigned int) */ 31 | typedef volatile uint8_t RwReg; /**< Read-Write 8-bit register (volatile unsigned int) */ 32 | #endif 33 | 34 | extern volatile uint32_t systick_millis_count; 35 | # define MS_COUNTER systick_millis_count 36 | 37 | 38 | // Default to using PROGMEM, since TEENSY3 provides it 39 | // even though all it does is ignore it. Just being 40 | // conservative here in case TEENSY3 changes. 41 | #ifndef FASTLED_USE_PROGMEM 42 | #define FASTLED_USE_PROGMEM 1 43 | #endif 44 | 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/platforms/arm/k20/octows2811_controller.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_OCTOWS2811_CONTROLLER_H 2 | #define __INC_OCTOWS2811_CONTROLLER_H 3 | 4 | #ifdef USE_OCTOWS2811 5 | 6 | // #include "OctoWS2811.h" 7 | 8 | FASTLED_NAMESPACE_BEGIN 9 | 10 | template 11 | class COctoWS2811Controller : public CPixelLEDController { 12 | OctoWS2811 *pocto; 13 | uint8_t *drawbuffer,*framebuffer; 14 | 15 | void _init(int nLeds) { 16 | if(pocto == NULL) { 17 | drawbuffer = (uint8_t*)malloc(nLeds * 8 * 3); 18 | framebuffer = (uint8_t*)malloc(nLeds * 8 * 3); 19 | 20 | // byte ordering is handled in show by the pixel controller 21 | int config = WS2811_RGB; 22 | config |= CHIP; 23 | 24 | pocto = new OctoWS2811(nLeds, framebuffer, drawbuffer, config); 25 | 26 | pocto->begin(); 27 | } 28 | } 29 | public: 30 | COctoWS2811Controller() { pocto = NULL; } 31 | virtual int size() { return CLEDController::size() * 8; } 32 | 33 | virtual void init() { /* do nothing yet */ } 34 | 35 | typedef union { 36 | uint8_t bytes[8]; 37 | uint32_t raw[2]; 38 | } Lines; 39 | 40 | virtual void showPixels(PixelController & pixels) { 41 | _init(pixels.size()); 42 | 43 | uint8_t *pData = drawbuffer; 44 | while(pixels.has(1)) { 45 | Lines b; 46 | 47 | for(int i = 0; i < 8; i++) { b.bytes[i] = pixels.loadAndScale0(i); } 48 | transpose8x1_MSB(b.bytes,pData); pData += 8; 49 | for(int i = 0; i < 8; i++) { b.bytes[i] = pixels.loadAndScale1(i); } 50 | transpose8x1_MSB(b.bytes,pData); pData += 8; 51 | for(int i = 0; i < 8; i++) { b.bytes[i] = pixels.loadAndScale2(i); } 52 | transpose8x1_MSB(b.bytes,pData); pData += 8; 53 | pixels.stepDithering(); 54 | pixels.advanceData(); 55 | } 56 | 57 | pocto->show(); 58 | } 59 | 60 | }; 61 | 62 | FASTLED_NAMESPACE_END 63 | 64 | #endif 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/platforms/arm/k20/smartmatrix_t3.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_SMARTMATRIX_T3_H 2 | #define __INC_SMARTMATRIX_T3_H 3 | 4 | #ifdef SmartMatrix_h 5 | #include 6 | 7 | FASTLED_NAMESPACE_BEGIN 8 | 9 | extern SmartMatrix *pSmartMatrix; 10 | 11 | // note - dmx simple must be included before FastSPI for this code to be enabled 12 | class CSmartMatrixController : public CPixelLEDController { 13 | SmartMatrix matrix; 14 | 15 | public: 16 | // initialize the LED controller 17 | virtual void init() { 18 | // Initialize 32x32 LED Matrix 19 | matrix.begin(); 20 | matrix.setBrightness(255); 21 | matrix.setColorCorrection(ccNone); 22 | 23 | // Clear screen 24 | clearLeds(0); 25 | matrix.swapBuffers(); 26 | pSmartMatrix = &matrix; 27 | } 28 | 29 | virtual void showPixels(PixelController & pixels) { 30 | if(SMART_MATRIX_CAN_TRIPLE_BUFFER) { 31 | rgb24 *md = matrix.getRealBackBuffer(); 32 | } else { 33 | rgb24 *md = matrix.backBuffer(); 34 | } 35 | while(pixels.has(1)) { 36 | md->red = pixels.loadAndScale0(); 37 | md->green = pixels.loadAndScale1(); 38 | md->blue = pixels.loadAndScale2(); 39 | md++; 40 | pixels.advanceData(); 41 | pixels.stepDithering(); 42 | } 43 | matrix.swapBuffers(); 44 | if(SMART_MATRIX_CAN_TRIPLE_BUFFER && pixels.advanceBy() > 0) { 45 | matrix.setBackBuffer(pixels.mData); 46 | } 47 | } 48 | 49 | }; 50 | 51 | FASTLED_NAMESPACE_END 52 | 53 | #endif 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/platforms/arm/k20/ws2812serial_controller.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_WS2812SERIAL_CONTROLLER_H 2 | #define __INC_WS2812SERIAL_CONTROLLER_H 3 | 4 | #ifdef USE_WS2812SERIAL 5 | 6 | FASTLED_NAMESPACE_BEGIN 7 | 8 | template 9 | class CWS2812SerialController : public CPixelLEDController { 10 | WS2812Serial *pserial; 11 | uint8_t *drawbuffer,*framebuffer; 12 | 13 | void _init(int nLeds) { 14 | if (pserial == NULL) { 15 | drawbuffer = (uint8_t*)malloc(nLeds * 3); 16 | framebuffer = (uint8_t*)malloc(nLeds * 12); 17 | pserial = new WS2812Serial(nLeds, framebuffer, drawbuffer, DATA_PIN, WS2812_RGB); 18 | pserial->begin(); 19 | } 20 | } 21 | public: 22 | CWS2812SerialController() { pserial = NULL; } 23 | 24 | virtual void init() { /* do nothing yet */ } 25 | 26 | virtual void showPixels(PixelController & pixels) { 27 | _init(pixels.size()); 28 | 29 | uint8_t *p = drawbuffer; 30 | 31 | while(pixels.has(1)) { 32 | *p++ = pixels.loadAndScale0(); 33 | *p++ = pixels.loadAndScale1(); 34 | *p++ = pixels.loadAndScale2(); 35 | pixels.stepDithering(); 36 | pixels.advanceData(); 37 | } 38 | pserial->show(); 39 | } 40 | 41 | }; 42 | 43 | FASTLED_NAMESPACE_END 44 | 45 | #endif // USE_WS2812SERIAL 46 | #endif // __INC_WS2812SERIAL_CONTROLLER_H 47 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/platforms/arm/k66/fastled_arm_k66.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_FASTLED_ARM_K66_H 2 | #define __INC_FASTLED_ARM_K66_H 3 | 4 | // Include the k66 headers 5 | #include "fastpin_arm_k66.h" 6 | #include "fastspi_arm_k66.h" 7 | #include "../k20/octows2811_controller.h" 8 | #include "../k20/ws2812serial_controller.h" 9 | #include "../k20/smartmatrix_t3.h" 10 | #include "clockless_arm_k66.h" 11 | #include "clockless_block_arm_k66.h" 12 | 13 | #endif 14 | 15 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/platforms/arm/k66/led_sysdefs_arm_k66.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_LED_SYSDEFS_ARM_K66_H 2 | #define __INC_LED_SYSDEFS_ARM_K66_H 3 | 4 | #define FASTLED_TEENSY3 5 | #define FASTLED_ARM 6 | 7 | #ifndef INTERRUPT_THRESHOLD 8 | #define INTERRUPT_THRESHOLD 1 9 | #endif 10 | 11 | // Default to allowing interrupts 12 | #ifndef FASTLED_ALLOW_INTERRUPTS 13 | #define FASTLED_ALLOW_INTERRUPTS 1 14 | #endif 15 | 16 | #if FASTLED_ALLOW_INTERRUPTS == 1 17 | #define FASTLED_ACCURATE_CLOCK 18 | #endif 19 | 20 | #if (F_CPU == 192000000) 21 | #define CLK_DBL 1 22 | #endif 23 | 24 | // Get some system include files 25 | #include 26 | #include // for cli/se definitions 27 | 28 | // Define the register types 29 | #if defined(ARDUINO) // && ARDUINO < 150 30 | typedef volatile uint8_t RoReg; /**< Read only 8-bit register (volatile const unsigned int) */ 31 | typedef volatile uint8_t RwReg; /**< Read-Write 8-bit register (volatile unsigned int) */ 32 | #endif 33 | 34 | extern volatile uint32_t systick_millis_count; 35 | # define MS_COUNTER systick_millis_count 36 | 37 | 38 | // Default to using PROGMEM, since TEENSY3 provides it 39 | // even though all it does is ignore it. Just being 40 | // conservative here in case TEENSY3 changes. 41 | #ifndef FASTLED_USE_PROGMEM 42 | #define FASTLED_USE_PROGMEM 1 43 | #endif 44 | 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/platforms/arm/kl26/clockless_arm_kl26.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_CLOCKLESS_ARM_KL26 2 | #define __INC_CLOCKLESS_ARM_KL26 3 | 4 | #include "../common/m0clockless.h" 5 | FASTLED_NAMESPACE_BEGIN 6 | #define FASTLED_HAS_CLOCKLESS 1 7 | 8 | template 9 | class ClocklessController : public CPixelLEDController { 10 | typedef typename FastPinBB::port_ptr_t data_ptr_t; 11 | typedef typename FastPinBB::port_t data_t; 12 | 13 | data_t mPinMask; 14 | data_ptr_t mPort; 15 | CMinWait mWait; 16 | public: 17 | virtual void init() { 18 | FastPinBB::setOutput(); 19 | mPinMask = FastPinBB::mask(); 20 | mPort = FastPinBB::port(); 21 | } 22 | 23 | virtual uint16_t getMaxRefreshRate() const { return 400; } 24 | 25 | virtual void showPixels(PixelController & pixels) { 26 | mWait.wait(); 27 | cli(); 28 | uint32_t clocks = showRGBInternal(pixels); 29 | if(!clocks) { 30 | sei(); delayMicroseconds(WAIT_TIME); cli(); 31 | clocks = showRGBInternal(pixels); 32 | } 33 | long microsTaken = CLKS_TO_MICROS(clocks * ((T1 + T2 + T3) * 24)); 34 | MS_COUNTER += (microsTaken / 1000); 35 | sei(); 36 | mWait.mark(); 37 | } 38 | 39 | // This method is made static to force making register Y available to use for data on AVR - if the method is non-static, then 40 | // gcc will use register Y for the this pointer. 41 | static uint32_t showRGBInternal(PixelController pixels) { 42 | struct M0ClocklessData data; 43 | data.d[0] = pixels.d[0]; 44 | data.d[1] = pixels.d[1]; 45 | data.d[2] = pixels.d[2]; 46 | data.s[0] = pixels.mScale[0]; 47 | data.s[1] = pixels.mScale[1]; 48 | data.s[2] = pixels.mScale[2]; 49 | data.e[0] = pixels.e[0]; 50 | data.e[1] = pixels.e[1]; 51 | data.e[2] = pixels.e[2]; 52 | data.adj = pixels.mAdvance; 53 | 54 | typename FastPin::port_ptr_t portBase = FastPin::port(); 55 | return showLedData<4,8,T1,T2,T3,RGB_ORDER, WAIT_TIME>(portBase, FastPin::mask(), pixels.mData, pixels.mLen, &data); 56 | // return 0; // 0x00FFFFFF - _VAL; 57 | } 58 | 59 | 60 | }; 61 | 62 | FASTLED_NAMESPACE_END 63 | 64 | 65 | #endif // __INC_CLOCKLESS_ARM_KL26 66 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/platforms/arm/kl26/fastled_arm_kl26.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_FASTLED_ARM_KL26_H 2 | #define __INC_FASTLED_ARM_KL26_H 3 | 4 | // Include the k20 headers 5 | #include "fastpin_arm_kl26.h" 6 | #include "fastspi_arm_kl26.h" 7 | #include "clockless_arm_kl26.h" 8 | #include "../k20/ws2812serial_controller.h" 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/platforms/arm/kl26/led_sysdefs_arm_kl26.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_LED_SYSDEFS_ARM_KL26_H 2 | #define __INC_LED_SYSDEFS_ARM_KL26_H 3 | 4 | #define FASTLED_TEENSYLC 5 | #define FASTLED_ARM 6 | #define FASTLED_ARM_M0_PLUS 7 | 8 | #ifndef INTERRUPT_THRESHOLD 9 | #define INTERRUPT_THRESHOLD 1 10 | #endif 11 | 12 | #define FASTLED_SPI_BYTE_ONLY 13 | 14 | // Default to allowing interrupts 15 | #ifndef FASTLED_ALLOW_INTERRUPTS 16 | // #define FASTLED_ALLOW_INTERRUPTS 1 17 | #endif 18 | 19 | #if FASTLED_ALLOW_INTERRUPTS == 1 20 | #define FASTLED_ACCURATE_CLOCK 21 | #endif 22 | 23 | #if (F_CPU == 96000000) 24 | #define CLK_DBL 1 25 | #endif 26 | 27 | // Get some system include files 28 | #include 29 | #include // for cli/se definitions 30 | 31 | // Define the register types 32 | #if defined(ARDUINO) // && ARDUINO < 150 33 | typedef volatile uint8_t RoReg; /**< Read only 8-bit register (volatile const unsigned int) */ 34 | typedef volatile uint8_t RwReg; /**< Read-Write 8-bit register (volatile unsigned int) */ 35 | #endif 36 | 37 | extern volatile uint32_t systick_millis_count; 38 | # define MS_COUNTER systick_millis_count 39 | 40 | // Default to using PROGMEM since TEENSYLC provides it 41 | // even though all it does is ignore it. Just being 42 | // conservative here in case TEENSYLC changes. 43 | #ifndef FASTLED_USE_PROGMEM 44 | #define FASTLED_USE_PROGMEM 1 45 | #endif 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/platforms/arm/mxrt1062/fastled_arm_mxrt1062.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_FASTLED_ARM_MXRT1062_H 2 | #define __INC_FASTLED_ARM_MXRT1062_H 3 | 4 | #include "fastpin_arm_mxrt1062.h" 5 | #include "fastspi_arm_mxrt1062.h" 6 | #include "../k20/octows2811_controller.h" 7 | #include "../k20/ws2812serial_controller.h" 8 | #include "../k20/smartmatrix_t3.h" 9 | #include "clockless_arm_mxrt1062.h" 10 | #include "block_clockless_arm_mxrt1062.h" 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/platforms/arm/mxrt1062/led_sysdefs_arm_mxrt1062.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_LED_SYSDEFS_ARM_MXRT1062_H 2 | #define __INC_LED_SYSDEFS_ARM_MXRT1062_H 3 | 4 | #define FASTLED_TEENSY4 5 | #define FASTLED_ARM 6 | 7 | #ifndef INTERRUPT_THRESHOLD 8 | #define INTERRUPT_THRESHOLD 1 9 | #endif 10 | 11 | // Default to allowing interrupts 12 | #ifndef FASTLED_ALLOW_INTERRUPTS 13 | #define FASTLED_ALLOW_INTERRUPTS 1 14 | #endif 15 | 16 | #if FASTLED_ALLOW_INTERRUPTS == 1 17 | #define FASTLED_ACCURATE_CLOCK 18 | #endif 19 | 20 | #if (F_CPU == 96000000) 21 | #define CLK_DBL 1 22 | #endif 23 | 24 | // Get some system include files 25 | #include 26 | #include // for cli/se definitions 27 | 28 | // Define the register types 29 | #if defined(ARDUINO) // && ARDUINO < 150 30 | typedef volatile uint32_t RoReg; /**< Read only 8-bit register (volatile const unsigned int) */ 31 | typedef volatile uint32_t RwReg; /**< Read-Write 8-bit register (volatile unsigned int) */ 32 | #endif 33 | 34 | // extern volatile uint32_t systick_millis_count; 35 | // # define MS_COUNTER systick_millis_count 36 | 37 | // Teensy4 provides progmem 38 | #ifndef FASTLED_USE_PROGMEM 39 | #define FASTLED_USE_PROGMEM 1 40 | #endif 41 | 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/platforms/arm/nrf51/clockless_arm_nrf51.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_CLOCKLESS_ARM_NRF51 2 | #define __INC_CLOCKLESS_ARM_NRF51 3 | 4 | #if defined(NRF51) 5 | 6 | #include 7 | #define FASTLED_HAS_CLOCKLESS 1 8 | 9 | #if (FASTLED_ALLOW_INTERRUPTS==1) 10 | #define SEI_CHK LED_TIMER->CC[0] = (WAIT_TIME * (F_CPU/1000000)); LED_TIMER->TASKS_CLEAR; LED_TIMER->EVENTS_COMPARE[0] = 0; 11 | #define CLI_CHK cli(); if(LED_TIMER->EVENTS_COMPARE[0]) { LED_TIMER->TASKS_STOP = 1; return 0; } 12 | #define INNER_SEI sei(); 13 | #else 14 | #define SEI_CHK 15 | #define CLI_CHK 16 | #define INNER_SEI delaycycles<1>(); 17 | #endif 18 | 19 | 20 | #include "../common/m0clockless.h" 21 | template 22 | class ClocklessController : public CPixelLEDController { 23 | typedef typename FastPinBB::port_ptr_t data_ptr_t; 24 | typedef typename FastPinBB::port_t data_t; 25 | 26 | data_t mPinMask; 27 | data_ptr_t mPort; 28 | CMinWait mWait; 29 | public: 30 | virtual void init() { 31 | FastPinBB::setOutput(); 32 | mPinMask = FastPinBB::mask(); 33 | mPort = FastPinBB::port(); 34 | } 35 | 36 | virtual uint16_t getMaxRefreshRate() const { return 400; } 37 | 38 | virtual void showPixels(PixelController & pixels) { 39 | mWait.wait(); 40 | cli(); 41 | if(!showRGBInternal(pixels)) { 42 | sei(); delayMicroseconds(WAIT_TIME); cli(); 43 | showRGBInternal(pixels); 44 | } 45 | sei(); 46 | mWait.mark(); 47 | } 48 | 49 | // This method is made static to force making register Y available to use for data on AVR - if the method is non-static, then 50 | // gcc will use register Y for the this pointer. 51 | static uint32_t showRGBInternal(PixelController pixels) { 52 | struct M0ClocklessData data; 53 | data.d[0] = pixels.d[0]; 54 | data.d[1] = pixels.d[1]; 55 | data.d[2] = pixels.d[2]; 56 | data.s[0] = pixels.mScale[0]; 57 | data.s[1] = pixels.mScale[1]; 58 | data.s[2] = pixels.mScale[2]; 59 | data.e[0] = pixels.e[0]; 60 | data.e[1] = pixels.e[1]; 61 | data.e[2] = pixels.e[2]; 62 | data.adj = pixels.mAdvance; 63 | 64 | typename FastPin::port_ptr_t portBase = FastPin::port(); 65 | 66 | // timer mode w/prescaler of 0 67 | LED_TIMER->MODE = TIMER_MODE_MODE_Timer; 68 | LED_TIMER->PRESCALER = 0; 69 | LED_TIMER->EVENTS_COMPARE[0] = 0; 70 | LED_TIMER->BITMODE = TIMER_BITMODE_BITMODE_16Bit; 71 | LED_TIMER->SHORTS = TIMER_SHORTS_COMPARE0_CLEAR_Msk; 72 | LED_TIMER->TASKS_START = 1; 73 | 74 | int ret = showLedData<4,8,T1,T2,T3,RGB_ORDER,WAIT_TIME>(portBase, FastPin::mask(), pixels.mData, pixels.mLen, &data); 75 | 76 | LED_TIMER->TASKS_STOP = 1; 77 | return ret; // 0x00FFFFFF - _VAL; 78 | } 79 | }; 80 | 81 | 82 | #endif // NRF51 83 | #endif // __INC_CLOCKLESS_ARM_NRF51 84 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/platforms/arm/nrf51/fastled_arm_nrf51.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_FASTLED_ARM_NRF51_H 2 | #define __INC_FASTLED_ARM_NRF51_H 3 | 4 | // Include the k20 headers 5 | #include "fastpin_arm_nrf51.h" 6 | #include "fastspi_arm_nrf51.h" 7 | #include "clockless_arm_nrf51.h" 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/platforms/arm/nrf51/led_sysdefs_arm_nrf51.h: -------------------------------------------------------------------------------- 1 | #ifndef __LED_SYSDEFS_ARM_NRF51 2 | #define __LED_SYSDEFS_ARM_NRF51 3 | 4 | #ifndef NRF51 5 | #define NRF51 6 | #endif 7 | 8 | #define LED_TIMER NRF_TIMER1 9 | #define FASTLED_NO_PINMAP 10 | #define FASTLED_HAS_CLOCKLESS 11 | 12 | #define FASTLED_SPI_BYTE_ONLY 13 | 14 | #define FASTLED_ARM 15 | #define FASTLED_ARM_M0 16 | 17 | #ifndef F_CPU 18 | #define F_CPU 16000000 19 | #endif 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | typedef volatile uint32_t RoReg; 26 | typedef volatile uint32_t RwReg; 27 | typedef uint32_t prog_uint32_t; 28 | typedef uint8_t boolean; 29 | 30 | #define PROGMEM 31 | #define NO_PROGMEM 32 | #define NEED_CXX_BITS 33 | 34 | // Default to NOT using PROGMEM here 35 | #ifndef FASTLED_USE_PROGMEM 36 | #define FASTLED_USE_PROGMEM 0 37 | #endif 38 | 39 | #ifndef FASTLED_ALLOW_INTERRUPTS 40 | #define FASTLED_ALLOW_INTERRUPTS 1 41 | #endif 42 | 43 | #define cli() __disable_irq(); 44 | #define sei() __enable_irq(); 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/platforms/arm/nrf52/fastled_arm_nrf52.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_FASTLED_ARM_NRF52_H 2 | #define __INC_FASTLED_ARM_NRF52_H 3 | 4 | #include "led_sysdefs_arm_nrf52.h" 5 | #include "arbiter_nrf52.h" 6 | #include "fastpin_arm_nrf52.h" 7 | #include "fastspi_arm_nrf52.h" 8 | #include "clockless_arm_nrf52.h" 9 | 10 | #endif // #ifndef __INC_FASTLED_ARM_NRF52_H 11 | 12 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/platforms/arm/nrf52/led_sysdefs_arm_nrf52.h: -------------------------------------------------------------------------------- 1 | #ifndef __LED_SYSDEFS_ARM_NRF52 2 | #define __LED_SYSDEFS_ARM_NRF52 3 | 4 | #define FASTLED_ARM 5 | 6 | #ifndef F_CPU 7 | #define F_CPU 64000000 // the NRF52 series has a 64MHz CPU 8 | #endif 9 | 10 | // even though CPU is at 64MHz, use the 8MHz-defined timings because... 11 | // PWM module runs at 16MHz 12 | // SPI0..2 runs at 8MHz 13 | #define CLOCKLESS_FREQUENCY 16000000 // the NRF52 has EasyDMA for PWM module at 16MHz 14 | 15 | #ifndef F_TIMER 16 | #define F_TIMER 16000000 // the NRF52 timer is 16MHz, even though CPU is 64MHz 17 | #endif 18 | 19 | #if !defined(FASTLED_USE_PROGMEM) 20 | #define FASTLED_USE_PROGMEM 0 // nRF52 series have flat memory model 21 | #endif 22 | 23 | #if !defined(FASTLED_ALLOW_INTERRUPTS) 24 | #define FASTLED_ALLOW_INTERRUPTS 1 25 | #endif 26 | 27 | // Use PWM instance 0 28 | // See clockless_arm_nrf52.h and (in root of library) platforms.cpp 29 | #define FASTLED_NRF52_ENABLE_PWM_INSTANCE0 30 | 31 | #if defined(FASTLED_NRF52_NEVER_INLINE) 32 | #define FASTLED_NRF52_INLINE_ATTRIBUTE __attribute__((always_inline)) inline 33 | #else 34 | #define FASTLED_NRF52_INLINE_ATTRIBUTE __attribute__((always_inline)) inline 35 | #endif 36 | 37 | 38 | 39 | #include 40 | #include // for FastSPI 41 | #include // for Clockless 42 | #include // for Clockless / anything else using interrupts 43 | typedef __I uint32_t RoReg; 44 | typedef __IO uint32_t RwReg; 45 | 46 | #define cli() __disable_irq() 47 | #define sei() __enable_irq() 48 | 49 | #define FASTLED_NRF52_DEBUGPRINT(format, ...) 50 | //#define FASTLED_NRF52_DEBUGPRINT(format, ...)\ 51 | // do {\ 52 | // FastLED_NRF52_DebugPrint(format, ##__VA_ARGS__);\ 53 | // } while(0); 54 | 55 | 56 | 57 | 58 | #endif // __LED_SYSDEFS_ARM_NRF52 59 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/platforms/arm/sam/fastled_arm_sam.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_FASTLED_ARM_SAM_H 2 | #define __INC_FASTLED_ARM_SAM_H 3 | 4 | // Include the sam headers 5 | #include "fastpin_arm_sam.h" 6 | #include "fastspi_arm_sam.h" 7 | #include "clockless_arm_sam.h" 8 | #include "clockless_block_arm_sam.h" 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/platforms/arm/sam/led_sysdefs_arm_sam.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_LED_SYSDEFS_ARM_SAM_H 2 | #define __INC_LED_SYSDEFS_ARM_SAM_H 3 | 4 | 5 | #define FASTLED_ARM 6 | 7 | // Setup DUE timer defines/channels/etc... 8 | #ifndef DUE_TIMER_CHANNEL 9 | #define DUE_TIMER_GROUP 0 10 | #endif 11 | 12 | #ifndef DUE_TIMER_CHANNEL 13 | #define DUE_TIMER_CHANNEL 0 14 | #endif 15 | 16 | #define DUE_TIMER ((DUE_TIMER_GROUP==0) ? TC0 : ((DUE_TIMER_GROUP==1) ? TC1 : TC2)) 17 | #define DUE_TIMER_ID (ID_TC0 + (DUE_TIMER_GROUP*3) + DUE_TIMER_CHANNEL) 18 | #define DUE_TIMER_VAL (DUE_TIMER->TC_CHANNEL[DUE_TIMER_CHANNEL].TC_CV << 1) 19 | #define DUE_TIMER_RUNNING ((DUE_TIMER->TC_CHANNEL[DUE_TIMER_CHANNEL].TC_SR & TC_SR_CLKSTA) != 0) 20 | 21 | #ifndef INTERRUPT_THRESHOLD 22 | #define INTERRUPT_THRESHOLD 1 23 | #endif 24 | 25 | // Default to allowing interrupts 26 | #ifndef FASTLED_ALLOW_INTERRUPTS 27 | #define FASTLED_ALLOW_INTERRUPTS 1 28 | #endif 29 | 30 | #if FASTLED_ALLOW_INTERRUPTS == 1 31 | #define FASTLED_ACCURATE_CLOCK 32 | #endif 33 | 34 | // reusing/abusing cli/sei defs for due 35 | #define cli() __disable_irq(); __disable_fault_irq(); 36 | #define sei() __enable_irq(); __enable_fault_irq(); 37 | 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/platforms/arm/stm32/fastled_arm_stm32.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_FASTLED_ARM_SAM_H 2 | #define __INC_FASTLED_ARM_SAM_H 3 | 4 | // Include the sam headers 5 | #include "fastpin_arm_stm32.h" 6 | // #include "fastspi_arm_stm32.h" 7 | #include "clockless_arm_stm32.h" 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/platforms/arm/stm32/led_sysdefs_arm_stm32.h: -------------------------------------------------------------------------------- 1 | #ifndef __INC_LED_SYSDEFS_ARM_SAM_H 2 | #define __INC_LED_SYSDEFS_ARM_SAM_H 3 | 4 | #if defined(STM32F10X_MD) 5 | 6 | #include 7 | 8 | #define FASTLED_NAMESPACE_BEGIN namespace NSFastLED { 9 | #define FASTLED_NAMESPACE_END } 10 | #define FASTLED_USING_NAMESPACE using namespace NSFastLED; 11 | 12 | // reusing/abusing cli/sei defs for due 13 | #define cli() __disable_irq(); __disable_fault_irq(); 14 | #define sei() __enable_irq(); __enable_fault_irq(); 15 | 16 | #elif defined (__STM32F1__) 17 | 18 | #include "cm3_regs.h" 19 | 20 | #define cli() nvic_globalirq_disable() 21 | #define sei() nvic_globalirq_enable() 22 | 23 | #else 24 | #error "Platform not supported" 25 | #endif 26 | 27 | #define FASTLED_ARM 28 | 29 | #ifndef INTERRUPT_THRESHOLD 30 | #define INTERRUPT_THRESHOLD 1 31 | #endif 32 | 33 | // Default to allowing interrupts 34 | #ifndef FASTLED_ALLOW_INTERRUPTS 35 | #define FASTLED_ALLOW_INTERRUPTS 0 36 | #endif 37 | 38 | #if FASTLED_ALLOW_INTERRUPTS == 1 39 | #define FASTLED_ACCURATE_CLOCK 40 | #endif 41 | 42 | // pgmspace definitions 43 | #define PROGMEM 44 | #define pgm_read_dword(addr) (*(const unsigned long *)(addr)) 45 | #define pgm_read_dword_near(addr) pgm_read_dword(addr) 46 | 47 | // Default to NOT using PROGMEM here 48 | #ifndef FASTLED_USE_PROGMEM 49 | #define FASTLED_USE_PROGMEM 0 50 | #endif 51 | 52 | // data type defs 53 | typedef volatile uint8_t RoReg; /**< Read only 8-bit register (volatile const unsigned int) */ 54 | typedef volatile uint8_t RwReg; /**< Read-Write 8-bit register (volatile unsigned int) */ 55 | 56 | #define FASTLED_NO_PINMAP 57 | 58 | #ifndef F_CPU 59 | #define F_CPU 72000000 60 | #endif 61 | #endif 62 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/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 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/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__) || defined(__AVR_ATtiny841__) || defined(__AVR_ATtiny441__) 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) && !defined (ARDUINO_AVR_LARDU_328E) 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 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/platforms/esp/32/fastled_esp32.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "fastpin_esp32.h" 4 | 5 | #ifdef FASTLED_ESP32_I2S 6 | #include "clockless_i2s_esp32.h" 7 | #else 8 | #include "clockless_rmt_esp32.h" 9 | #endif 10 | 11 | // #include "clockless_block_esp32.h" 12 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/platforms/esp/32/fastpin_esp32.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | FASTLED_NAMESPACE_BEGIN 4 | 5 | template class _ESPPIN { 6 | 7 | public: 8 | typedef volatile uint32_t * port_ptr_t; 9 | typedef uint32_t port_t; 10 | 11 | inline static void setOutput() { pinMode(PIN, OUTPUT); } 12 | inline static void setInput() { pinMode(PIN, INPUT); } 13 | 14 | inline static void hi() __attribute__ ((always_inline)) { 15 | if (PIN < 32) GPIO.out_w1ts = MASK; 16 | else GPIO.out1_w1ts.val = MASK; 17 | } 18 | 19 | inline static void lo() __attribute__ ((always_inline)) { 20 | if (PIN < 32) GPIO.out_w1tc = MASK; 21 | else GPIO.out1_w1tc.val = MASK; 22 | } 23 | 24 | inline static void set(register port_t val) __attribute__ ((always_inline)) { 25 | if (PIN < 32) GPIO.out = val; 26 | else GPIO.out1.val = val; 27 | } 28 | 29 | inline static void strobe() __attribute__ ((always_inline)) { toggle(); toggle(); } 30 | 31 | inline static void toggle() __attribute__ ((always_inline)) { 32 | if(PIN < 32) { GPIO.out ^= MASK; } 33 | else { GPIO.out1.val ^=MASK; } 34 | } 35 | 36 | inline static void hi(register port_ptr_t port) __attribute__ ((always_inline)) { hi(); } 37 | inline static void lo(register port_ptr_t port) __attribute__ ((always_inline)) { lo(); } 38 | inline static void fastset(register port_ptr_t port, register port_t val) __attribute__ ((always_inline)) { *port = val; } 39 | 40 | inline static port_t hival() __attribute__ ((always_inline)) { 41 | if (PIN < 32) return GPIO.out | MASK; 42 | else return GPIO.out1.val | MASK; 43 | } 44 | 45 | inline static port_t loval() __attribute__ ((always_inline)) { 46 | if (PIN < 32) return GPIO.out & ~MASK; 47 | else return GPIO.out1.val & ~MASK; 48 | } 49 | 50 | inline static port_ptr_t port() __attribute__ ((always_inline)) { 51 | if (PIN < 32) return &GPIO.out; 52 | else return &GPIO.out1.val; 53 | } 54 | 55 | inline static port_ptr_t sport() __attribute__ ((always_inline)) { 56 | if (PIN < 32) return &GPIO.out_w1ts; 57 | else return &GPIO.out1_w1ts.val; 58 | } 59 | 60 | inline static port_ptr_t cport() __attribute__ ((always_inline)) { 61 | if (PIN < 32) return &GPIO.out_w1tc; 62 | else return &GPIO.out1_w1tc.val; 63 | } 64 | 65 | inline static port_t mask() __attribute__ ((always_inline)) { return MASK; } 66 | 67 | inline static bool isset() __attribute__ ((always_inline)) { 68 | if (PIN < 32) return GPIO.out & MASK; 69 | else return GPIO.out1.val & MASK; 70 | } 71 | }; 72 | 73 | #define _FL_DEFPIN(PIN) template<> class FastPin : public _ESPPIN {}; 74 | 75 | _FL_DEFPIN(0); 76 | _FL_DEFPIN(1); // WARNING: Using TX causes flashiness when uploading 77 | _FL_DEFPIN(2); 78 | _FL_DEFPIN(3); // WARNING: Using RX causes flashiness when uploading 79 | _FL_DEFPIN(4); 80 | _FL_DEFPIN(5); 81 | 82 | // -- These pins are not safe to use: 83 | // _FL_DEFPIN(6,6); _FL_DEFPIN(7,7); _FL_DEFPIN(8,8); 84 | // _FL_DEFPIN(9,9); _FL_DEFPIN(10,10); _FL_DEFPIN(11,11); 85 | 86 | _FL_DEFPIN(12); 87 | _FL_DEFPIN(13); 88 | _FL_DEFPIN(14); 89 | _FL_DEFPIN(15); 90 | _FL_DEFPIN(16); 91 | _FL_DEFPIN(17); 92 | _FL_DEFPIN(18); 93 | _FL_DEFPIN(19); 94 | 95 | // No pin 20 : _FL_DEFPIN(20,20); 96 | 97 | _FL_DEFPIN(21); // Works, but note that GPIO21 is I2C SDA 98 | _FL_DEFPIN(22); // Works, but note that GPIO22 is I2C SCL 99 | _FL_DEFPIN(23); 100 | 101 | // No pin 24 : _FL_DEFPIN(24,24); 102 | 103 | _FL_DEFPIN(25); 104 | _FL_DEFPIN(26); 105 | _FL_DEFPIN(27); 106 | 107 | // No pin 28-31: _FL_DEFPIN(28,28); _FL_DEFPIN(29,29); _FL_DEFPIN(30,30); _FL_DEFPIN(31,31); 108 | 109 | // Need special handling for pins > 31 110 | _FL_DEFPIN(32); 111 | _FL_DEFPIN(33); 112 | 113 | #define HAS_HARDWARE_PIN_SUPPORT 114 | 115 | FASTLED_NAMESPACE_END 116 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/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 | 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 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/platforms/esp/8266/clockless_esp8266.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | FASTLED_NAMESPACE_BEGIN 4 | 5 | #ifdef FASTLED_DEBUG_COUNT_FRAME_RETRIES 6 | extern uint32_t _frame_cnt; 7 | extern uint32_t _retry_cnt; 8 | #endif 9 | 10 | // Info on reading cycle counter from https://github.com/kbeckmann/nodemcu-firmware/blob/ws2812-dual/app/modules/ws2812.c 11 | __attribute__ ((always_inline)) inline static uint32_t __clock_cycles() { 12 | uint32_t cyc; 13 | __asm__ __volatile__ ("rsr %0,ccount":"=a" (cyc)); 14 | return cyc; 15 | } 16 | 17 | #define FASTLED_HAS_CLOCKLESS 1 18 | 19 | template 20 | class ClocklessController : public CPixelLEDController { 21 | typedef typename FastPin::port_ptr_t data_ptr_t; 22 | typedef typename FastPin::port_t data_t; 23 | 24 | data_t mPinMask; 25 | data_ptr_t mPort; 26 | CMinWait mWait; 27 | public: 28 | virtual void init() { 29 | FastPin::setOutput(); 30 | mPinMask = FastPin::mask(); 31 | mPort = FastPin::port(); 32 | } 33 | 34 | virtual uint16_t getMaxRefreshRate() const { return 400; } 35 | 36 | protected: 37 | 38 | virtual void showPixels(PixelController & pixels) { 39 | // mWait.wait(); 40 | int cnt = FASTLED_INTERRUPT_RETRY_COUNT; 41 | while((showRGBInternal(pixels)==0) && cnt--) { 42 | #ifdef FASTLED_DEBUG_COUNT_FRAME_RETRIES 43 | _retry_cnt++; 44 | #endif 45 | os_intr_unlock(); 46 | delayMicroseconds(WAIT_TIME); 47 | os_intr_lock(); 48 | } 49 | // mWait.mark(); 50 | } 51 | 52 | #define _ESP_ADJ (0) 53 | #define _ESP_ADJ2 (0) 54 | 55 | template __attribute__ ((always_inline)) inline static void writeBits(register uint32_t & last_mark, register uint32_t b) { 56 | b <<= 24; b = ~b; 57 | for(register uint32_t i = BITS; i > 0; i--) { 58 | while((__clock_cycles() - last_mark) < (T1+T2+T3)); 59 | last_mark = __clock_cycles(); 60 | FastPin::hi(); 61 | 62 | while((__clock_cycles() - last_mark) < T1); 63 | if(b & 0x80000000L) { FastPin::lo(); } 64 | b <<= 1; 65 | 66 | while((__clock_cycles() - last_mark) < (T1+T2)); 67 | FastPin::lo(); 68 | } 69 | } 70 | 71 | // This method is made static to force making register Y available to use for data on AVR - if the method is non-static, then 72 | // gcc will use register Y for the this pointer. 73 | static uint32_t ICACHE_RAM_ATTR showRGBInternal(PixelController pixels) { 74 | // Setup the pixel controller and load/scale the first byte 75 | pixels.preStepFirstByteDithering(); 76 | register uint32_t b = pixels.loadAndScale0(); 77 | pixels.preStepFirstByteDithering(); 78 | os_intr_lock(); 79 | uint32_t start = __clock_cycles(); 80 | uint32_t last_mark = start; 81 | while(pixels.has(1)) { 82 | // Write first byte, read next byte 83 | writeBits<8+XTRA0>(last_mark, b); 84 | b = pixels.loadAndScale1(); 85 | 86 | // Write second byte, read 3rd byte 87 | writeBits<8+XTRA0>(last_mark, b); 88 | b = pixels.loadAndScale2(); 89 | 90 | // Write third byte, read 1st byte of next pixel 91 | writeBits<8+XTRA0>(last_mark, b); 92 | b = pixels.advanceAndLoadAndScale0(); 93 | 94 | #if (FASTLED_ALLOW_INTERRUPTS == 1) 95 | os_intr_unlock(); 96 | #endif 97 | 98 | pixels.stepDithering(); 99 | 100 | #if (FASTLED_ALLOW_INTERRUPTS == 1) 101 | os_intr_lock(); 102 | // if interrupts took longer than 45µs, punt on the current frame 103 | if((int32_t)(__clock_cycles()-last_mark) > 0) { 104 | if((int32_t)(__clock_cycles()-last_mark) > (T1+T2+T3+((WAIT_TIME-INTERRUPT_THRESHOLD)*CLKS_PER_US))) { sei(); return 0; } 105 | } 106 | #endif 107 | }; 108 | 109 | os_intr_unlock(); 110 | #ifdef FASTLED_DEBUG_COUNT_FRAME_RETRIES 111 | _frame_cnt++; 112 | #endif 113 | return __clock_cycles() - start; 114 | } 115 | }; 116 | 117 | FASTLED_NAMESPACE_END 118 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/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 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/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 | 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 | -------------------------------------------------------------------------------- /Arduino/lib/FastLED-master/power_mgt.h: -------------------------------------------------------------------------------- 1 | #ifndef POWER_MGT_H 2 | #define POWER_MGT_H 3 | 4 | #include "FastLED.h" 5 | 6 | #include "pixeltypes.h" 7 | 8 | FASTLED_NAMESPACE_BEGIN 9 | 10 | ///@defgroup Power Power management functions 11 | /// functions used to limit the amount of power used by FastLED 12 | ///@{ 13 | 14 | // Power Control setup functions 15 | // 16 | // Example: 17 | // set_max_power_in_volts_and_milliamps( 5, 400); 18 | // 19 | 20 | /// Set the maximum power used in milliamps for a given voltage 21 | /// @deprecated - use FastLED.setMaxPowerInVoltsAndMilliamps() 22 | void set_max_power_in_volts_and_milliamps( uint8_t volts, uint32_t milliamps); 23 | /// Set the maximum power used in watts 24 | /// @deprecated - use FastLED.setMaxPowerInMilliWatts 25 | void set_max_power_in_milliwatts( uint32_t powerInmW); 26 | 27 | /// Select a pin with an led that will be flashed to indicate that power management 28 | /// is pulling down the brightness 29 | void set_max_power_indicator_LED( uint8_t pinNumber); // zero = no indicator LED 30 | 31 | 32 | // Power Control 'show' and 'delay' functions 33 | // 34 | // These are drop-in replacements for FastLED.show() and FastLED.delay() 35 | // In order to use these, you have to actually replace your calls to 36 | // FastLED.show() and FastLED.delay() with these two functions. 37 | // 38 | // Example: 39 | // // was: FastLED.show(); 40 | // // now is: 41 | // show_at_max_brightness_for_power(); 42 | // 43 | 44 | /// Similar to FastLED.show, but pre-adjusts brightness to keep below the power 45 | /// threshold. 46 | /// @deprecated this has now been moved to FastLED.show(); 47 | void show_at_max_brightness_for_power(); 48 | /// Similar to FastLED.delay, but pre-adjusts brightness to keep below the power 49 | /// threshold. 50 | /// @deprecated this has now been rolled into FastLED.delay(); 51 | void delay_at_max_brightness_for_power( uint16_t ms); 52 | 53 | 54 | // Power Control internal helper functions 55 | 56 | /// calculate_unscaled_power_mW tells you how many milliwatts the current 57 | /// LED data would draw at brightness = 255. 58 | /// 59 | uint32_t calculate_unscaled_power_mW( const CRGB* ledbuffer, uint16_t numLeds); 60 | 61 | /// calculate_max_brightness_for_power_mW tells you the highest brightness 62 | /// level you can use and still stay under the specified power budget for 63 | /// a given set of leds. It takes a pointer to an array of CRGB objects, a 64 | /// count, a 'target brightness' which is the brightness you'd ideally like 65 | /// to use, and the max power draw desired in milliwatts. The result from 66 | /// this function will be no higher than the target_brightess you supply, but may be lower. 67 | uint8_t calculate_max_brightness_for_power_mW(const CRGB* ledbuffer, uint16_t numLeds, uint8_t target_brightness, uint32_t max_power_mW); 68 | 69 | /// calculate_max_brightness_for_power_mW tells you the highest brightness 70 | /// level you can use and still stay under the specified power budget for 71 | /// a given set of leds. It takes a pointer to an array of CRGB objects, a 72 | /// count, a 'target brightness' which is the brightness you'd ideally like 73 | /// to use, and the max power in volts and milliamps. The result from this 74 | /// function will be no higher than the target_brightess you supply, but may be lower. 75 | uint8_t calculate_max_brightness_for_power_vmA(const CRGB* ledbuffer, uint16_t numLeds, uint8_t target_brightness, uint32_t max_power_V, uint32_t max_power_mA); 76 | 77 | /// calculate_max_brightness_for_power_mW tells you the highest brightness 78 | /// level you can use and still stay under the specified power budget. It 79 | /// takes a 'target brightness' which is the brightness you'd ideally like 80 | /// to use. The result from this function will be no higher than the 81 | /// target_brightess you supply, but may be lower. 82 | uint8_t calculate_max_brightness_for_power_mW( uint8_t target_brightness, uint32_t max_power_mW); 83 | 84 | FASTLED_NAMESPACE_END 85 | ///@} 86 | // POWER_MGT_H 87 | 88 | #endif 89 | -------------------------------------------------------------------------------- /Arduino/lib/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for project specific (private) libraries. 3 | PlatformIO will compile them to static libraries and link into executable file. 4 | 5 | The source code of each library should be placed in a an own separate directory 6 | ("lib/your_library_name/[here are source files]"). 7 | 8 | For example, see a structure of the following two libraries `Foo` and `Bar`: 9 | 10 | |--lib 11 | | | 12 | | |--Bar 13 | | | |--docs 14 | | | |--examples 15 | | | |--src 16 | | | |- Bar.c 17 | | | |- Bar.h 18 | | | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html 19 | | | 20 | | |--Foo 21 | | | |- Foo.c 22 | | | |- Foo.h 23 | | | 24 | | |- README --> THIS FILE 25 | | 26 | |- platformio.ini 27 | |--src 28 | |- main.c 29 | 30 | and a contents of `src/main.c`: 31 | ``` 32 | #include 33 | #include 34 | 35 | int main (void) 36 | { 37 | ... 38 | } 39 | 40 | ``` 41 | 42 | PlatformIO Library Dependency Finder will find automatically dependent 43 | libraries scanning project source files. 44 | 45 | More information about PlatformIO Library Dependency Finder 46 | - https://docs.platformio.org/page/librarymanager/ldf.html 47 | -------------------------------------------------------------------------------- /Arduino/lib/RTClib-master/.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Thank you for opening an issue on an Adafruit Arduino library repository. To 2 | improve the speed of resolution please review the following guidelines and 3 | common troubleshooting steps below before creating the issue: 4 | 5 | - **Do not use GitHub issues for troubleshooting projects and issues.** Instead use 6 | the forums at http://forums.adafruit.com to ask questions and troubleshoot why 7 | something isn't working as expected. In many cases the problem is a common issue 8 | that you will more quickly receive help from the forum community. GitHub issues 9 | are meant for known defects in the code. If you don't know if there is a defect 10 | in the code then start with troubleshooting on the forum first. 11 | 12 | - **If following a tutorial or guide be sure you didn't miss a step.** Carefully 13 | check all of the steps and commands to run have been followed. Consult the 14 | forum if you're unsure or have questions about steps in a guide/tutorial. 15 | 16 | - **For Arduino projects check these very common issues to ensure they don't apply**: 17 | 18 | - For uploading sketches or communicating with the board make sure you're using 19 | a **USB data cable** and **not** a **USB charge-only cable**. It is sometimes 20 | very hard to tell the difference between a data and charge cable! Try using the 21 | cable with other devices or swapping to another cable to confirm it is not 22 | the problem. 23 | 24 | - **Be sure you are supplying adequate power to the board.** Check the specs of 25 | your board and plug in an external power supply. In many cases just 26 | plugging a board into your computer is not enough to power it and other 27 | peripherals. 28 | 29 | - **Double check all soldering joints and connections.** Flakey connections 30 | cause many mysterious problems. See the [guide to excellent soldering](https://learn.adafruit.com/adafruit-guide-excellent-soldering/tools) for examples of good solder joints. 31 | 32 | - **Ensure you are using an official Arduino or Adafruit board.** We can't 33 | guarantee a clone board will have the same functionality and work as expected 34 | with this code and don't support them. 35 | 36 | If you're sure this issue is a defect in the code and checked the steps above 37 | please fill in the following fields to provide enough troubleshooting information. 38 | You may delete the guideline and text above to just leave the following details: 39 | 40 | - Arduino board: **INSERT ARDUINO BOARD NAME/TYPE HERE** 41 | 42 | - Arduino IDE version (found in Arduino -> About Arduino menu): **INSERT ARDUINO 43 | VERSION HERE** 44 | 45 | - List the steps to reproduce the problem below (if possible attach a sketch or 46 | copy the sketch code in too): **LIST REPRO STEPS BELOW** 47 | -------------------------------------------------------------------------------- /Arduino/lib/RTClib-master/.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Thank you for creating a pull request to contribute to Adafruit's GitHub code! 2 | Before you open the request please review the following guidelines and tips to 3 | help it be more easily integrated: 4 | 5 | - **Describe the scope of your change--i.e. what the change does and what parts 6 | of the code were modified.** This will help us understand any risks of integrating 7 | the code. 8 | 9 | - **Describe any known limitations with your change.** For example if the change 10 | doesn't apply to a supported platform of the library please mention it. 11 | 12 | - **Please run any tests or examples that can exercise your modified code.** We 13 | strive to not break users of the code and running tests/examples helps with this 14 | process. 15 | 16 | Thank you again for contributing! We will try to test and integrate the change 17 | as soon as we can, but be aware we have many GitHub repositories to manage and 18 | can't immediately respond to every request. There is no need to bump or check in 19 | on a pull request (it will clutter the discussion of the request). 20 | 21 | Also don't be worried if the request is closed or not integrated--sometimes the 22 | priorities of Adafruit's GitHub code (education, ease of use) might not match the 23 | priorities of the pull request. Don't fret, the open source community thrives on 24 | forks and GitHub makes it easy to keep your changes in a forked repo. 25 | 26 | After reviewing the guidelines above you can delete this text from the pull request. 27 | -------------------------------------------------------------------------------- /Arduino/lib/RTClib-master/.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | html 3 | Doxyfile* 4 | doxygen_sqlite3.db 5 | -------------------------------------------------------------------------------- /Arduino/lib/RTClib-master/.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | sudo: false 3 | # Blacklist 4 | branches: 5 | except: 6 | - gh-pages 7 | cache: 8 | directories: 9 | - ~/arduino_ide 10 | - ~/.arduino15/packages/ 11 | git: 12 | depth: false 13 | quiet: true 14 | env: 15 | global: 16 | - PRETTYNAME="Adafruit RTClib" 17 | # Optional, will default to "$TRAVIS_BUILD_DIR/Doxyfile" 18 | # - DOXYFILE: $TRAVIS_BUILD_DIR/Doxyfile 19 | 20 | before_install: 21 | - source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/install.sh) 22 | 23 | script: 24 | - build_main_platforms 25 | 26 | # Generate and deploy documentation 27 | after_success: 28 | - source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/library_check.sh) 29 | - source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/doxy_gen_and_deploy.sh) 30 | -------------------------------------------------------------------------------- /Arduino/lib/RTClib-master/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Adafruit Industries 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. 22 | -------------------------------------------------------------------------------- /Arduino/lib/RTClib-master/README.md: -------------------------------------------------------------------------------- 1 | # Adafruit RTClib [![Build Status](https://travis-ci.com/adafruit/RTClib.svg?branch=master)](https://travis-ci.com/adafruit/RTClib) 2 | 3 | This is a fork of JeeLab's fantastic real time clock library for Arduino. 4 | 5 | For a tutorial on using this library with an RTC module like the DS1307, PCF8523, or DS3231, see the guide at: https://learn.adafruit.com/ds1307-real-time-clock-breakout-board-kit/overview 6 | 7 | For the detailed API documentation, see https://adafruit.github.io/RTClib/html/index.html 8 | 9 | Works great with Adafruit RTC breakouts: 10 | 11 | - [DS3231 Precision RTC](https://www.adafruit.com/product/3013) 12 | - [PCF8523 RTC](https://www.adafruit.com/product/3295) 13 | - [DS1307 RTC](https://www.adafruit.com/product/3296) 14 | 15 | To install, use the Arduino Library Manager to search for "RTClib", find "RTClib by Adafruit" and install the library. 16 | 17 | Please note that dayOfTheWeek() ranges from 0 to 6 inclusive with 0 being 'Sunday'. 18 | 19 | 20 | 21 | ## Compatibility 22 | 23 | MCU | Tested Works | Doesn't Work | Not Tested | Notes 24 | ------------------ | :----------: | :----------: | :---------: | ----- 25 | Atmega328 @ 16MHz | X | | | 26 | Atmega328 @ 12MHz | X | | | 27 | Atmega32u4 @ 16MHz | X | | | Use SDA/SCL on pins D3 & D2 28 | Atmega32u4 @ 8MHz | X | | | Use SDA/SCL on pins D3 & D2 29 | ESP8266 | X | | | SDA/SCL default to pins 4 & 5 but any two pins can be assigned as SDA/SCL using Wire.begin(SDA,SCL) 30 | Atmega2560 @ 16MHz | X | | | Use SDA/SCL on Pins 20 & 21 31 | ATSAM3X8E | X | | | Use SDA1 and SCL1 32 | ATSAM21D | X | | | 33 | ATtiny85 @ 16MHz | X | | | 34 | ATtiny85 @ 8MHz | X | | | 35 | Intel Curie @ 32MHz | | | X | 36 | STM32F2 | | | X | 37 | 38 | * ATmega328 @ 16MHz : Arduino UNO, Adafruit Pro Trinket 5V, Adafruit Metro 328, Adafruit Metro Mini 39 | * ATmega328 @ 12MHz : Adafruit Pro Trinket 3V 40 | * ATmega32u4 @ 16MHz : Arduino Leonardo, Arduino Micro, Arduino Yun, Teensy 2.0 41 | * ATmega32u4 @ 8MHz : Adafruit Flora, Bluefruit Micro 42 | * ESP8266 : Adafruit Huzzah 43 | * ATmega2560 @ 16MHz : Arduino Mega 44 | * ATSAM3X8E : Arduino Due 45 | * ATSAM21D : Arduino Zero, M0 Pro 46 | * ATtiny85 @ 16MHz : Adafruit Trinket 5V 47 | * ATtiny85 @ 8MHz : Adafruit Gemma, Arduino Gemma, Adafruit Trinket 3V 48 | 49 | 50 | -------------------------------------------------------------------------------- /Arduino/lib/RTClib-master/examples/datecalc/datecalc.ino: -------------------------------------------------------------------------------- 1 | // Simple date conversions and calculations 2 | 3 | #include "RTClib.h" 4 | 5 | void showDate(const char* txt, const DateTime& dt) { 6 | Serial.print(txt); 7 | Serial.print(' '); 8 | Serial.print(dt.year(), DEC); 9 | Serial.print('/'); 10 | Serial.print(dt.month(), DEC); 11 | Serial.print('/'); 12 | Serial.print(dt.day(), DEC); 13 | Serial.print(' '); 14 | Serial.print(dt.hour(), DEC); 15 | Serial.print(':'); 16 | Serial.print(dt.minute(), DEC); 17 | Serial.print(':'); 18 | Serial.print(dt.second(), DEC); 19 | 20 | Serial.print(" = "); 21 | Serial.print(dt.unixtime()); 22 | Serial.print("s / "); 23 | Serial.print(dt.unixtime() / 86400L); 24 | Serial.print("d since 1970"); 25 | 26 | Serial.println(); 27 | } 28 | 29 | void showTimeSpan(const char* txt, const TimeSpan& ts) { 30 | Serial.print(txt); 31 | Serial.print(" "); 32 | Serial.print(ts.days(), DEC); 33 | Serial.print(" days "); 34 | Serial.print(ts.hours(), DEC); 35 | Serial.print(" hours "); 36 | Serial.print(ts.minutes(), DEC); 37 | Serial.print(" minutes "); 38 | Serial.print(ts.seconds(), DEC); 39 | Serial.print(" seconds ("); 40 | Serial.print(ts.totalseconds(), DEC); 41 | Serial.print(" total seconds)"); 42 | Serial.println(); 43 | } 44 | 45 | void setup () { 46 | 47 | #ifndef ESP8266 48 | while (!Serial); // for Leonardo/Micro/Zero 49 | #endif 50 | Serial.begin(57600); 51 | 52 | DateTime dt0 (0, 1, 1, 0, 0, 0); 53 | showDate("dt0", dt0); 54 | 55 | DateTime dt1 (1, 1, 1, 0, 0, 0); 56 | showDate("dt1", dt1); 57 | 58 | DateTime dt2 (2009, 1, 1, 0, 0, 0); 59 | showDate("dt2", dt2); 60 | 61 | DateTime dt3 (2009, 1, 2, 0, 0, 0); 62 | showDate("dt3", dt3); 63 | 64 | DateTime dt4 (2009, 1, 27, 0, 0, 0); 65 | showDate("dt4", dt4); 66 | 67 | DateTime dt5 (2009, 2, 27, 0, 0, 0); 68 | showDate("dt5", dt5); 69 | 70 | DateTime dt6 (2009, 12, 27, 0, 0, 0); 71 | showDate("dt6", dt6); 72 | 73 | DateTime dt7 (dt6.unixtime() + 3600); // One hour later. 74 | showDate("dt7", dt7); 75 | 76 | DateTime dt75 = dt6 + TimeSpan(0, 1, 0, 0); // One hour later with TimeSpan addition. 77 | showDate("dt7.5", dt75); 78 | 79 | DateTime dt8 (dt6.unixtime() + 86400L); // One day later. 80 | showDate("dt8", dt8); 81 | 82 | DateTime dt85 = dt6 + TimeSpan(1, 0, 0, 0); // One day later with TimeSpan addition. 83 | showDate("dt8.5", dt85); 84 | 85 | DateTime dt9 (dt6.unixtime() + 7 * 86400L); // One week later. 86 | showDate("dt9", dt9); 87 | 88 | DateTime dt95 = dt6 + TimeSpan(7, 0, 0, 0); // One week later with TimeSpan addition. 89 | showDate("dt9.5", dt95); 90 | 91 | DateTime dt10 = dt6 + TimeSpan(0, 0, 42, 42); // Fourty two minutes and fourty two seconds later. 92 | showDate("dt10", dt10); 93 | 94 | DateTime dt11 = dt6 - TimeSpan(7, 0, 0, 0); // One week ago. 95 | showDate("dt11", dt11); 96 | 97 | TimeSpan ts1 = dt6 - dt5; 98 | showTimeSpan("dt6-dt5", ts1); 99 | 100 | TimeSpan ts2 = dt10 - dt6; 101 | showTimeSpan("dt10-dt6", ts2); 102 | } 103 | 104 | void loop () { 105 | } 106 | -------------------------------------------------------------------------------- /Arduino/lib/RTClib-master/examples/ds1307/ds1307.ino: -------------------------------------------------------------------------------- 1 | // Date and time functions using a DS1307 RTC connected via I2C and Wire lib 2 | #include "RTClib.h" 3 | 4 | RTC_DS1307 rtc; 5 | 6 | char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}; 7 | 8 | void setup () { 9 | while (!Serial); // for Leonardo/Micro/Zero 10 | 11 | Serial.begin(57600); 12 | if (! rtc.begin()) { 13 | Serial.println("Couldn't find RTC"); 14 | while (1); 15 | } 16 | 17 | if (! rtc.isrunning()) { 18 | Serial.println("RTC is NOT running!"); 19 | } 20 | // following line sets the RTC to the date & time this sketch was compiled 21 | // rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); 22 | // This line sets the RTC with an explicit date & time, for example to set 23 | // January 21, 2014 at 3am you would call: 24 | // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0)); 25 | } 26 | 27 | void loop () { 28 | DateTime now = rtc.now(); 29 | 30 | Serial.print(now.year(), DEC); 31 | Serial.print('/'); 32 | Serial.print(now.month(), DEC); 33 | Serial.print('/'); 34 | Serial.print(now.day(), DEC); 35 | Serial.print(" ("); 36 | Serial.print(daysOfTheWeek[now.dayOfTheWeek()]); 37 | Serial.print(") "); 38 | Serial.print(now.hour(), DEC); 39 | Serial.print(':'); 40 | Serial.print(now.minute(), DEC); 41 | Serial.print(':'); 42 | Serial.print(now.second(), DEC); 43 | Serial.println(); 44 | 45 | Serial.print(" since midnight 1/1/1970 = "); 46 | Serial.print(now.unixtime()); 47 | Serial.print("s = "); 48 | Serial.print(now.unixtime() / 86400L); 49 | Serial.println("d"); 50 | 51 | // calculate a date which is 7 days, 12 hours, 30 minutes, and 6 seconds into the future 52 | DateTime future (now + TimeSpan(7,12,30,6)); 53 | 54 | Serial.print(" now + 7d + 12h + 30m + 6s: "); 55 | Serial.print(future.year(), DEC); 56 | Serial.print('/'); 57 | Serial.print(future.month(), DEC); 58 | Serial.print('/'); 59 | Serial.print(future.day(), DEC); 60 | Serial.print(' '); 61 | Serial.print(future.hour(), DEC); 62 | Serial.print(':'); 63 | Serial.print(future.minute(), DEC); 64 | Serial.print(':'); 65 | Serial.print(future.second(), DEC); 66 | Serial.println(); 67 | 68 | Serial.println(); 69 | delay(3000); 70 | } 71 | -------------------------------------------------------------------------------- /Arduino/lib/RTClib-master/examples/ds1307SqwPin/ds1307SqwPin.ino: -------------------------------------------------------------------------------- 1 | // SQW/OUT pin mode using a DS1307 RTC connected via I2C. 2 | // 3 | // According to the data sheet (http://datasheets.maxim-ic.com/en/ds/DS1307.pdf), the 4 | // DS1307's SQW/OUT pin can be set to low, high, 1Hz, 4.096kHz, 8.192kHz, or 32.768kHz. 5 | // 6 | // This sketch reads the state of the pin, then iterates through the possible values at 7 | // 5 second intervals. 8 | // 9 | 10 | // NOTE: 11 | // You must connect a pull up resistor (~10kohm) from the SQW pin up to VCC. Without 12 | // this pull up the wave output will not work! 13 | 14 | #include "RTClib.h" 15 | 16 | RTC_DS1307 rtc; 17 | 18 | int mode_index = 0; 19 | 20 | Ds1307SqwPinMode modes[] = { DS1307_OFF, DS1307_ON, DS1307_SquareWave1HZ, DS1307_SquareWave4kHz, DS1307_SquareWave8kHz, DS1307_SquareWave32kHz}; 21 | 22 | 23 | void print_mode() { 24 | Ds1307SqwPinMode mode = rtc.readSqwPinMode(); 25 | 26 | Serial.print("Sqw Pin Mode: "); 27 | switch(mode) { 28 | case DS1307_OFF: Serial.println("OFF"); break; 29 | case DS1307_ON: Serial.println("ON"); break; 30 | case DS1307_SquareWave1HZ: Serial.println("1Hz"); break; 31 | case DS1307_SquareWave4kHz: Serial.println("4.096kHz"); break; 32 | case DS1307_SquareWave8kHz: Serial.println("8.192kHz"); break; 33 | case DS1307_SquareWave32kHz: Serial.println("32.768kHz"); break; 34 | default: Serial.println("UNKNOWN"); break; 35 | } 36 | } 37 | 38 | void setup () { 39 | 40 | #ifndef ESP8266 41 | while (!Serial); // for Leonardo/Micro/Zero 42 | #endif 43 | 44 | Serial.begin(57600); 45 | if (! rtc.begin()) { 46 | Serial.println("Couldn't find RTC"); 47 | while (1); 48 | } 49 | 50 | print_mode(); 51 | } 52 | 53 | void loop () { 54 | rtc.writeSqwPinMode(modes[mode_index++]); 55 | print_mode(); 56 | 57 | if (mode_index > 5) { 58 | mode_index = 0; 59 | } 60 | 61 | delay(5000); 62 | } 63 | -------------------------------------------------------------------------------- /Arduino/lib/RTClib-master/examples/ds1307nvram/ds1307nvram.ino: -------------------------------------------------------------------------------- 1 | // Example of using the non-volatile RAM storage on the DS1307. 2 | // You can write up to 56 bytes from address 0 to 55. 3 | // Data will be persisted as long as the DS1307 has battery power. 4 | 5 | #include "RTClib.h" 6 | 7 | RTC_DS1307 rtc; 8 | 9 | void printnvram(uint8_t address) { 10 | Serial.print("Address 0x"); 11 | Serial.print(address, HEX); 12 | Serial.print(" = 0x"); 13 | Serial.println(rtc.readnvram(address), HEX); 14 | } 15 | 16 | void setup () { 17 | 18 | #ifndef ESP8266 19 | while (!Serial); // for Leonardo/Micro/Zero 20 | #endif 21 | Serial.begin(57600); 22 | rtc.begin(); 23 | 24 | // Print old RAM contents on startup. 25 | Serial.println("Current NVRAM values:"); 26 | for (int i = 0; i < 6; ++i) { 27 | printnvram(i); 28 | } 29 | 30 | // Write some bytes to non-volatile RAM storage. 31 | // NOTE: You can only read and write from addresses 0 to 55 (i.e. 56 byte values). 32 | Serial.println("Writing NVRAM values."); 33 | // Example writing one byte at a time: 34 | rtc.writenvram(0, 0xFE); 35 | rtc.writenvram(1, 0xED); 36 | // Example writing multiple bytes: 37 | uint8_t writeData[4] = { 0xBE, 0xEF, 0x01, 0x02 }; 38 | rtc.writenvram(2, writeData, 4); 39 | 40 | // Read bytes from non-volatile RAM storage. 41 | Serial.println("Reading NVRAM values:"); 42 | // Example reading one byte at a time. 43 | Serial.println(rtc.readnvram(0), HEX); 44 | Serial.println(rtc.readnvram(1), HEX); 45 | // Example reading multiple bytes: 46 | uint8_t readData[4] = {0}; 47 | rtc.readnvram(readData, 4, 2); 48 | Serial.println(readData[0], HEX); 49 | Serial.println(readData[1], HEX); 50 | Serial.println(readData[2], HEX); 51 | Serial.println(readData[3], HEX); 52 | 53 | } 54 | 55 | void loop () { 56 | // Do nothing in the loop. 57 | } 58 | -------------------------------------------------------------------------------- /Arduino/lib/RTClib-master/examples/ds3231/ds3231.ino: -------------------------------------------------------------------------------- 1 | // Date and time functions using a DS3231 RTC connected via I2C and Wire lib 2 | #include "RTClib.h" 3 | 4 | RTC_DS3231 rtc; 5 | 6 | char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}; 7 | 8 | void setup () { 9 | 10 | #ifndef ESP8266 11 | while (!Serial); // for Leonardo/Micro/Zero 12 | #endif 13 | 14 | Serial.begin(9600); 15 | 16 | delay(3000); // wait for console opening 17 | 18 | if (! rtc.begin()) { 19 | Serial.println("Couldn't find RTC"); 20 | while (1); 21 | } 22 | 23 | if (rtc.lostPower()) { 24 | Serial.println("RTC lost power, lets set the time!"); 25 | // If the RTC have lost power it will sets the RTC to the date & time this sketch was compiled in the following line 26 | rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); 27 | // This line sets the RTC with an explicit date & time, for example to set 28 | // January 21, 2014 at 3am you would call: 29 | // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0)); 30 | } 31 | 32 | // If you need to set the time of the uncomment line 34 or 37 33 | // following line sets the RTC to the date & time this sketch was compiled 34 | // rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); 35 | // This line sets the RTC with an explicit date & time, for example to set 36 | // January 21, 2014 at 3am you would call: 37 | // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0)); 38 | } 39 | 40 | void loop () { 41 | DateTime now = rtc.now(); 42 | 43 | Serial.print(now.year(), DEC); 44 | Serial.print('/'); 45 | Serial.print(now.month(), DEC); 46 | Serial.print('/'); 47 | Serial.print(now.day(), DEC); 48 | Serial.print(" ("); 49 | Serial.print(daysOfTheWeek[now.dayOfTheWeek()]); 50 | Serial.print(") "); 51 | Serial.print(now.hour(), DEC); 52 | Serial.print(':'); 53 | Serial.print(now.minute(), DEC); 54 | Serial.print(':'); 55 | Serial.print(now.second(), DEC); 56 | Serial.println(); 57 | 58 | Serial.print(" since midnight 1/1/1970 = "); 59 | Serial.print(now.unixtime()); 60 | Serial.print("s = "); 61 | Serial.print(now.unixtime() / 86400L); 62 | Serial.println("d"); 63 | 64 | // calculate a date which is 7 days and 30 seconds into the future 65 | DateTime future (now + TimeSpan(7,12,30,6)); 66 | 67 | Serial.print(" now + 7d + 30s: "); 68 | Serial.print(future.year(), DEC); 69 | Serial.print('/'); 70 | Serial.print(future.month(), DEC); 71 | Serial.print('/'); 72 | Serial.print(future.day(), DEC); 73 | Serial.print(' '); 74 | Serial.print(future.hour(), DEC); 75 | Serial.print(':'); 76 | Serial.print(future.minute(), DEC); 77 | Serial.print(':'); 78 | Serial.print(future.second(), DEC); 79 | Serial.println(); 80 | 81 | Serial.print("Temperature: "); 82 | Serial.print(rtc.getTemperature()); 83 | Serial.println(" C"); 84 | 85 | Serial.println(); 86 | delay(3000); 87 | } 88 | -------------------------------------------------------------------------------- /Arduino/lib/RTClib-master/examples/pcf8523/pcf8523.ino: -------------------------------------------------------------------------------- 1 | // Date and time functions using a PCF8523 RTC connected via I2C and Wire lib 2 | #include "RTClib.h" 3 | 4 | RTC_PCF8523 rtc; 5 | 6 | char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}; 7 | 8 | void setup () { 9 | 10 | while (!Serial) { 11 | delay(1); // for Leonardo/Micro/Zero 12 | } 13 | 14 | Serial.begin(57600); 15 | if (! rtc.begin()) { 16 | Serial.println("Couldn't find RTC"); 17 | while (1); 18 | } 19 | 20 | if (! rtc.initialized()) { 21 | Serial.println("RTC is NOT running!"); 22 | // following line sets the RTC to the date & time this sketch was compiled 23 | // rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); 24 | // This line sets the RTC with an explicit date & time, for example to set 25 | // January 21, 2014 at 3am you would call: 26 | // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0)); 27 | } 28 | } 29 | 30 | void loop () { 31 | DateTime now = rtc.now(); 32 | 33 | Serial.print(now.year(), DEC); 34 | Serial.print('/'); 35 | Serial.print(now.month(), DEC); 36 | Serial.print('/'); 37 | Serial.print(now.day(), DEC); 38 | Serial.print(" ("); 39 | Serial.print(daysOfTheWeek[now.dayOfTheWeek()]); 40 | Serial.print(") "); 41 | Serial.print(now.hour(), DEC); 42 | Serial.print(':'); 43 | Serial.print(now.minute(), DEC); 44 | Serial.print(':'); 45 | Serial.print(now.second(), DEC); 46 | Serial.println(); 47 | 48 | Serial.print(" since midnight 1/1/1970 = "); 49 | Serial.print(now.unixtime()); 50 | Serial.print("s = "); 51 | Serial.print(now.unixtime() / 86400L); 52 | Serial.println("d"); 53 | 54 | // calculate a date which is 7 days, 12 hours and 30 seconds into the future 55 | DateTime future (now + TimeSpan(7,12,30,6)); 56 | 57 | Serial.print(" now + 7d + 12h + 30m + 6s: "); 58 | Serial.print(future.year(), DEC); 59 | Serial.print('/'); 60 | Serial.print(future.month(), DEC); 61 | Serial.print('/'); 62 | Serial.print(future.day(), DEC); 63 | Serial.print(' '); 64 | Serial.print(future.hour(), DEC); 65 | Serial.print(':'); 66 | Serial.print(future.minute(), DEC); 67 | Serial.print(':'); 68 | Serial.print(future.second(), DEC); 69 | Serial.println(); 70 | 71 | Serial.println(); 72 | delay(3000); 73 | } 74 | -------------------------------------------------------------------------------- /Arduino/lib/RTClib-master/examples/softrtc/softrtc.ino: -------------------------------------------------------------------------------- 1 | // Date and time functions using just software, based on millis() & timer 2 | 3 | #include "RTClib.h" 4 | 5 | RTC_Millis rtc; 6 | 7 | void setup () { 8 | Serial.begin(57600); 9 | // following line sets the RTC to the date & time this sketch was compiled 10 | rtc.begin(DateTime(F(__DATE__), F(__TIME__))); 11 | // This line sets the RTC with an explicit date & time, for example to set 12 | // January 21, 2014 at 3am you would call: 13 | // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0)); 14 | } 15 | 16 | void loop () { 17 | DateTime now = rtc.now(); 18 | 19 | Serial.print(now.year(), DEC); 20 | Serial.print('/'); 21 | Serial.print(now.month(), DEC); 22 | Serial.print('/'); 23 | Serial.print(now.day(), DEC); 24 | Serial.print(' '); 25 | Serial.print(now.hour(), DEC); 26 | Serial.print(':'); 27 | Serial.print(now.minute(), DEC); 28 | Serial.print(':'); 29 | Serial.print(now.second(), DEC); 30 | Serial.println(); 31 | 32 | Serial.print(" seconds since 1970: "); 33 | Serial.println(now.unixtime()); 34 | 35 | // calculate a date which is 7 days and 30 seconds into the future 36 | DateTime future (now.unixtime() + 7 * 86400L + 30); 37 | 38 | Serial.print(" now + 7d + 30s: "); 39 | Serial.print(future.year(), DEC); 40 | Serial.print('/'); 41 | Serial.print(future.month(), DEC); 42 | Serial.print('/'); 43 | Serial.print(future.day(), DEC); 44 | Serial.print(' '); 45 | Serial.print(future.hour(), DEC); 46 | Serial.print(':'); 47 | Serial.print(future.minute(), DEC); 48 | Serial.print(':'); 49 | Serial.print(future.second(), DEC); 50 | Serial.println(); 51 | 52 | Serial.println(); 53 | delay(3000); 54 | } 55 | -------------------------------------------------------------------------------- /Arduino/lib/RTClib-master/examples/timestamp/timestamp.ino: -------------------------------------------------------------------------------- 1 | /* Timestamp functions using a DS1307 RTC connected via I2C and Wire lib 2 | ** 3 | ** Useful for file name 4 | ** ` SD.open(time.timestamp()+".log", FILE_WRITE) ` 5 | ** 6 | ** 7 | ** Created: 2015-06-01 by AxelTB 8 | ** Last Edit: 9 | */ 10 | 11 | #include "RTClib.h" 12 | 13 | RTC_DS1307 rtc; 14 | 15 | void setup() { 16 | Serial.begin(57600); 17 | rtc.begin(); 18 | 19 | if (! rtc.isrunning()) { 20 | Serial.println("RTC is NOT running!"); 21 | // following line sets the RTC to the date & time this sketch was compiled 22 | rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); 23 | // This line sets the RTC with an explicit date & time, for example to set 24 | // January 21, 2014 at 3am you would call: 25 | // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0)); 26 | } 27 | 28 | } 29 | 30 | void loop() { 31 | DateTime time = rtc.now(); 32 | 33 | //Full Timestamp 34 | Serial.println(String("DateTime::TIMESTAMP_FULL:\t")+time.timestamp(DateTime::TIMESTAMP_FULL)); 35 | 36 | //Date Only 37 | Serial.println(String("DateTime::TIMESTAMP_DATE:\t")+time.timestamp(DateTime::TIMESTAMP_DATE)); 38 | 39 | //Full Timestamp 40 | Serial.println(String("DateTime::TIMESTAMP_TIME:\t")+time.timestamp(DateTime::TIMESTAMP_TIME)); 41 | 42 | Serial.println("\n"); 43 | 44 | //Delay 5s 45 | delay(5000); 46 | } 47 | -------------------------------------------------------------------------------- /Arduino/lib/RTClib-master/examples/toString/toString.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | RTC_DS1307 rtc; 5 | 6 | 7 | void setup() { 8 | while (!Serial); // for Leonardo/Micro/Zero 9 | 10 | Serial.begin(57600); 11 | if (! rtc.begin()) { 12 | Serial.println("Couldn't find RTC"); 13 | while (1); 14 | } // end rtc.begin() 15 | 16 | if (! rtc.isrunning()) { 17 | Serial.println("RTC is NOT running!"); 18 | // following line sets the RTC to the date & time this sketch was compiled 19 | rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); 20 | // This line sets the RTC with an explicit date & time, for example to set 21 | // January 21, 2014 at 3am you would call: 22 | // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0)); 23 | } 24 | } 25 | 26 | void loop() { 27 | 28 | DateTime now = rtc.now(); 29 | 30 | //buffer can be defined using following combinations: 31 | //hh - the hour with a leading zero (00 to 23) 32 | //mm - the minute with a leading zero (00 to 59) 33 | //ss - the whole second with a leading zero where applicable (00 to 59) 34 | //YYYY - the year as four digit number 35 | //YY - the year as two digit number (00-99) 36 | //MM - the month as number with a leading zero (01-12) 37 | //MMM - the abbreviated English month name ('Jan' to 'Dec') 38 | //DD - the day as number with a leading zero (01 to 31) 39 | //DDD - the abbreviated English day name ('Mon' to 'Sun') 40 | 41 | char buf1[] = "hh:mm"; 42 | Serial.println(now.toString(buf1)); 43 | 44 | char buf2[] = "YYMMDD-hh:mm:ss"; 45 | Serial.println(now.toString(buf2)); 46 | 47 | char buf3[] = "Today is DDD, MMM DD YYYY"; 48 | Serial.println(now.toString(buf3)); 49 | 50 | char buf4[] = "MM-DD-YYYY"; 51 | Serial.println(now.toString(buf4)); 52 | 53 | delay(1000); 54 | } 55 | -------------------------------------------------------------------------------- /Arduino/lib/RTClib-master/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For RTC 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | DateTime KEYWORD1 10 | TimeSpan KEYWORD1 11 | RTC_DS1307 KEYWORD1 12 | RTC_Millis KEYWORD1 13 | RTC_Micros KEYWORD1 14 | Ds1307SqwPinMode KEYWORD1 15 | 16 | ####################################### 17 | # Methods and Functions (KEYWORD2) 18 | ####################################### 19 | 20 | year KEYWORD2 21 | month KEYWORD2 22 | day KEYWORD2 23 | hour KEYWORD2 24 | minute KEYWORD2 25 | second KEYWORD2 26 | dayOfTheWeek KEYWORD2 27 | secondstime KEYWORD2 28 | unixtime KEYWORD2 29 | begin KEYWORD2 30 | adjust KEYWORD2 31 | adjustDrift KEYWORD2 32 | isrunning KEYWORD2 33 | now KEYWORD2 34 | readSqwPinMode KEYWORD2 35 | writeSqwPinMode KEYWORD2 36 | timestamp KEYWORD2 37 | toString KEYWORD2 38 | 39 | ####################################### 40 | # Constants (LITERAL1) 41 | ####################################### 42 | TIMESTAMP_FULL LITERAL1 43 | TIMESTAMP_DATE LITERAL1 44 | TIMESTAMP_TIME LITERAL1 45 | 46 | -------------------------------------------------------------------------------- /Arduino/lib/RTClib-master/library.properties: -------------------------------------------------------------------------------- 1 | name=RTClib 2 | version=1.4.0 3 | author=Adafruit 4 | maintainer=Adafruit 5 | sentence=A fork of Jeelab's fantastic RTC library 6 | paragraph=A fork of Jeelab's fantastic RTC library 7 | category=Timing 8 | url=https://github.com/adafruit/RTClib 9 | architectures=* 10 | -------------------------------------------------------------------------------- /Arduino/platformio.ini: -------------------------------------------------------------------------------- 1 | ; PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; https://docs.platformio.org/page/projectconf.html 10 | 11 | [env:esp32dev] 12 | platform = espressif32 13 | board = esp32dev 14 | framework = arduino 15 | monitor_speed = 115200 16 | board_build.partitions = no_ota.csv -------------------------------------------------------------------------------- /Arduino/src/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | // BLE SECTION 7 | BLEServer *pServer = NULL; 8 | 9 | BLECharacteristic *message_characteristic = NULL; 10 | BLECharacteristic *box_characteristic = NULL; 11 | 12 | String boxValue = "0"; 13 | // See the following for generating UUIDs: 14 | // https://www.uuidgenerator.net/ 15 | 16 | #define SERVICE_UUID "4fafc201-1fb5-459e-8fcc-c5c9c331914b" 17 | 18 | #define MESSAGE_CHARACTERISTIC_UUID "6d68efe5-04b6-4a85-abc4-c2670b7bf7fd" 19 | #define BOX_CHARACTERISTIC_UUID "f27b53ad-c63d-49a0-8c0f-9f297e6cc520" 20 | 21 | class MyServerCallbacks : public BLEServerCallbacks 22 | { 23 | void onConnect(BLEServer *pServer) 24 | { 25 | Serial.println("Connected"); 26 | }; 27 | 28 | void onDisconnect(BLEServer *pServer) 29 | { 30 | Serial.println("Disconnected"); 31 | } 32 | }; 33 | 34 | class CharacteristicsCallbacks : public BLECharacteristicCallbacks 35 | { 36 | void onWrite(BLECharacteristic *pCharacteristic) 37 | { 38 | Serial.print("Value Written "); 39 | Serial.println(pCharacteristic->getValue().c_str()); 40 | 41 | if (pCharacteristic == box_characteristic) 42 | { 43 | boxValue = pCharacteristic->getValue().c_str(); 44 | box_characteristic->setValue(const_cast(boxValue.c_str())); 45 | box_characteristic->notify(); 46 | } 47 | } 48 | }; 49 | 50 | void setup() 51 | { 52 | Serial.begin(115200); 53 | 54 | // Create the BLE Device 55 | BLEDevice::init("BLEExample"); 56 | // Create the BLE Server 57 | pServer = BLEDevice::createServer(); 58 | pServer->setCallbacks(new MyServerCallbacks()); 59 | // Create the BLE Service 60 | BLEService *pService = pServer->createService(SERVICE_UUID); 61 | delay(100); 62 | 63 | // Create a BLE Characteristic 64 | message_characteristic = pService->createCharacteristic( 65 | MESSAGE_CHARACTERISTIC_UUID, 66 | BLECharacteristic::PROPERTY_READ | 67 | BLECharacteristic::PROPERTY_WRITE | 68 | BLECharacteristic::PROPERTY_NOTIFY | 69 | BLECharacteristic::PROPERTY_INDICATE); 70 | 71 | box_characteristic = pService->createCharacteristic( 72 | BOX_CHARACTERISTIC_UUID, 73 | BLECharacteristic::PROPERTY_READ | 74 | BLECharacteristic::PROPERTY_WRITE | 75 | BLECharacteristic::PROPERTY_NOTIFY | 76 | BLECharacteristic::PROPERTY_INDICATE); 77 | 78 | // Start the BLE service 79 | pService->start(); 80 | 81 | // Start advertising 82 | pServer->getAdvertising()->start(); 83 | 84 | message_characteristic->setValue("Message one"); 85 | message_characteristic->setCallbacks(new CharacteristicsCallbacks()); 86 | 87 | box_characteristic->setValue("0"); 88 | box_characteristic->setCallbacks(new CharacteristicsCallbacks()); 89 | 90 | Serial.println("Waiting for a client connection to notify..."); 91 | } 92 | 93 | void loop() 94 | { 95 | message_characteristic->setValue("Message one"); 96 | message_characteristic->notify(); 97 | 98 | delay(1000); 99 | 100 | message_characteristic->setValue("Message Two"); 101 | message_characteristic->notify(); 102 | 103 | delay(1000); 104 | } -------------------------------------------------------------------------------- /Arduino/test/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for PlatformIO Unit Testing and project tests. 3 | 4 | Unit Testing is a software testing method by which individual units of 5 | source code, sets of one or more MCU program modules together with associated 6 | control data, usage procedures, and operating procedures, are tested to 7 | determine whether they are fit for use. Unit testing finds problems early 8 | in the development cycle. 9 | 10 | More information about PlatformIO Unit Testing: 11 | - https://docs.platformio.org/page/plus/unit-testing.html 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # React Native Arduino BLE Example 2 | 3 | An example project on how to communicate between an esp32 and a React Native app over Bluetooth low energy 4 | A video showing the app can be found [here](https://www.youtube.com/watch?v=erWibryA_tE) 5 | 6 | ## What is the purpose of this project? 7 | 8 | This is a very simple example of how you can communicate over BLE (Bluetooth Low Energy) between an ESP32 (programmed using Arduino) and a React Native App 9 | 10 | --- 11 | 12 | ## What does this project do? 13 | 14 | It establishes a BLE connection, retrieves the initial Values of two characteristics and monitors them. 15 | Then the app has one checkbox to update a value on the ESP side. 16 | 17 | It is only compiled for Android at this point but I see no problem with it working for iOS. 18 | 19 | --- 20 | 21 | ## Prequesits 22 | 23 | 1. You need everything needed for a regular ReactNative App, so NodeJS and a JAVA SDK. Try with the most basic ReactNative Example to make sure your enviroment is working 24 | 25 | 2. I am using Visual Studio Code with PlatformIO for the Arduino Programming 26 | Android Studio to run the App on a real device since emulators dont have Bluetooth. 27 | 28 | *** 29 | 30 | ## Installation 31 | 32 | 1. Place the contents of the repository somewhere on your system (manualy or with git) and open the folder in VSCode 33 | 34 | 2. run the following command to install all needed libraries 35 | 36 | `npm install --save` 37 | 38 | 3. update the Android Studio SDK location in ./android/local.properties 39 | 40 | 4. run the following command to launch the app on your connected android phone (make sure it has debugging enabled) 41 | 42 | `npx react-native run-android` 43 | 44 | 5. In a seperate VSCode Window open the "Arduino" folder and upload the Code to an ESP32 using PlatformIO 45 | 46 | --- 47 | 48 | ## Use 49 | 50 | The App should have one button "Connect". 51 | Upon hitting that button it should connect to the ESP32 and continously update the Message. 52 | When you use the checkbox the Arduino should report that over the Serial Port. 53 | 54 | --- 55 | 56 | ## Useful Links 57 | 58 | - [BLX library documentation](https://dotintent.github.io/react-native-ble-plx/#introduction) 59 | - [Arduino BLE library documentation](https://github.com/nkolban/esp32-snippets/blob/master/Documentation/BLE%20C%2B%2B%20Guide.pdf) 60 | - [Another Example Tutorial](https://blog.bam.tech/developer-news/make-your-first-iot-react-native-application-with-the-bluetooth-low-energy) 61 | - [BLX Demo](https://github.com/priyanka-Sadh/react-native-ble-plx-demo) 62 | -------------------------------------------------------------------------------- /Styles/styles.tsx: -------------------------------------------------------------------------------- 1 | import {StyleSheet} from 'react-native'; 2 | 3 | export const styles = StyleSheet.create({ 4 | baseText: { 5 | fontSize: 15, 6 | fontFamily: 'Cochin', 7 | }, 8 | titleText: { 9 | fontSize: 20, 10 | fontWeight: 'bold', 11 | }, 12 | rowView: { 13 | justifyContent: 'space-around', 14 | alignItems: 'flex-start', 15 | flexDirection: 'row', 16 | }, 17 | }); 18 | -------------------------------------------------------------------------------- /__tests__/App-test.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import 'react-native'; 6 | import React from 'react'; 7 | import App from '../App'; 8 | 9 | // Note: test renderer must be required after react-native. 10 | import renderer from 'react-test-renderer'; 11 | 12 | it('renders correctly', () => { 13 | renderer.create(); 14 | }); 15 | -------------------------------------------------------------------------------- /android/app/_BUCK: -------------------------------------------------------------------------------- 1 | # To learn about Buck see [Docs](https://buckbuild.com/). 2 | # To run your application with Buck: 3 | # - install Buck 4 | # - `npm start` - to start the packager 5 | # - `cd android` 6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` 7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck 8 | # - `buck install -r android/app` - compile, install and run application 9 | # 10 | 11 | load(":build_defs.bzl", "create_aar_targets", "create_jar_targets") 12 | 13 | lib_deps = [] 14 | 15 | create_aar_targets(glob(["libs/*.aar"])) 16 | 17 | create_jar_targets(glob(["libs/*.jar"])) 18 | 19 | android_library( 20 | name = "all-libs", 21 | exported_deps = lib_deps, 22 | ) 23 | 24 | android_library( 25 | name = "app-code", 26 | srcs = glob([ 27 | "src/main/java/**/*.java", 28 | ]), 29 | deps = [ 30 | ":all-libs", 31 | ":build_config", 32 | ":res", 33 | ], 34 | ) 35 | 36 | android_build_config( 37 | name = "build_config", 38 | package = "com.bleexample", 39 | ) 40 | 41 | android_resource( 42 | name = "res", 43 | package = "com.bleexample", 44 | res = "src/main/res", 45 | ) 46 | 47 | android_binary( 48 | name = "app", 49 | keystore = "//android/keystores:debug", 50 | manifest = "src/main/AndroidManifest.xml", 51 | package_type = "debug", 52 | deps = [ 53 | ":app-code", 54 | ], 55 | ) 56 | -------------------------------------------------------------------------------- /android/app/build_defs.bzl: -------------------------------------------------------------------------------- 1 | """Helper definitions to glob .aar and .jar targets""" 2 | 3 | def create_aar_targets(aarfiles): 4 | for aarfile in aarfiles: 5 | name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")] 6 | lib_deps.append(":" + name) 7 | android_prebuilt_aar( 8 | name = name, 9 | aar = aarfile, 10 | ) 11 | 12 | def create_jar_targets(jarfiles): 13 | for jarfile in jarfiles: 14 | name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")] 15 | lib_deps.append(":" + name) 16 | prebuilt_jar( 17 | name = name, 18 | binary_jar = jarfile, 19 | ) 20 | -------------------------------------------------------------------------------- /android/app/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/palmmaximilian/ReactNativeArduinoBLE/a5af089367b5f3232a040256e34c8d6a1765b3f8/android/app/debug.keystore -------------------------------------------------------------------------------- /android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /android/app/src/debug/java/com/bleexample/ReactNativeFlipper.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | *

This source code is licensed under the MIT license found in the LICENSE file in the root 5 | * directory of this source tree. 6 | */ 7 | package com.bleexample; 8 | 9 | import android.content.Context; 10 | import com.facebook.flipper.android.AndroidFlipperClient; 11 | import com.facebook.flipper.android.utils.FlipperUtils; 12 | import com.facebook.flipper.core.FlipperClient; 13 | import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin; 14 | import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin; 15 | import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin; 16 | import com.facebook.flipper.plugins.inspector.DescriptorMapping; 17 | import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin; 18 | import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor; 19 | import com.facebook.flipper.plugins.network.NetworkFlipperPlugin; 20 | import com.facebook.flipper.plugins.react.ReactFlipperPlugin; 21 | import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin; 22 | import com.facebook.react.ReactInstanceManager; 23 | import com.facebook.react.bridge.ReactContext; 24 | import com.facebook.react.modules.network.NetworkingModule; 25 | import okhttp3.OkHttpClient; 26 | 27 | public class ReactNativeFlipper { 28 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { 29 | if (FlipperUtils.shouldEnableFlipper(context)) { 30 | final FlipperClient client = AndroidFlipperClient.getInstance(context); 31 | 32 | client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults())); 33 | client.addPlugin(new ReactFlipperPlugin()); 34 | client.addPlugin(new DatabasesFlipperPlugin(context)); 35 | client.addPlugin(new SharedPreferencesFlipperPlugin(context)); 36 | client.addPlugin(CrashReporterPlugin.getInstance()); 37 | 38 | NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin(); 39 | NetworkingModule.setCustomClientBuilder( 40 | new NetworkingModule.CustomClientBuilder() { 41 | @Override 42 | public void apply(OkHttpClient.Builder builder) { 43 | builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin)); 44 | } 45 | }); 46 | client.addPlugin(networkFlipperPlugin); 47 | client.start(); 48 | 49 | // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized 50 | // Hence we run if after all native modules have been initialized 51 | ReactContext reactContext = reactInstanceManager.getCurrentReactContext(); 52 | if (reactContext == null) { 53 | reactInstanceManager.addReactInstanceEventListener( 54 | new ReactInstanceManager.ReactInstanceEventListener() { 55 | @Override 56 | public void onReactContextInitialized(ReactContext reactContext) { 57 | reactInstanceManager.removeReactInstanceEventListener(this); 58 | reactContext.runOnNativeModulesQueueThread( 59 | new Runnable() { 60 | @Override 61 | public void run() { 62 | client.addPlugin(new FrescoFlipperPlugin()); 63 | } 64 | }); 65 | } 66 | }); 67 | } else { 68 | client.addPlugin(new FrescoFlipperPlugin()); 69 | } 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 18 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/bleexample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.bleexample; 2 | 3 | import com.facebook.react.ReactActivity; 4 | 5 | public class MainActivity extends ReactActivity { 6 | 7 | /** 8 | * Returns the name of the main component registered from JavaScript. This is used to schedule 9 | * rendering of the component. 10 | */ 11 | @Override 12 | protected String getMainComponentName() { 13 | return "BleExample"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/bleexample/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.bleexample; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | import com.facebook.react.PackageList; 6 | import com.facebook.react.ReactApplication; 7 | import com.facebook.react.ReactInstanceManager; 8 | import com.facebook.react.ReactNativeHost; 9 | import com.facebook.react.ReactPackage; 10 | import com.facebook.soloader.SoLoader; 11 | import java.lang.reflect.InvocationTargetException; 12 | import java.util.List; 13 | 14 | public class MainApplication extends Application implements ReactApplication { 15 | 16 | private final ReactNativeHost mReactNativeHost = 17 | new ReactNativeHost(this) { 18 | @Override 19 | public boolean getUseDeveloperSupport() { 20 | return BuildConfig.DEBUG; 21 | } 22 | 23 | @Override 24 | protected List getPackages() { 25 | @SuppressWarnings("UnnecessaryLocalVariable") 26 | List packages = new PackageList(this).getPackages(); 27 | // Packages that cannot be autolinked yet can be added manually here, for example: 28 | // packages.add(new MyReactNativePackage()); 29 | return packages; 30 | } 31 | 32 | @Override 33 | protected String getJSMainModuleName() { 34 | return "index"; 35 | } 36 | }; 37 | 38 | @Override 39 | public ReactNativeHost getReactNativeHost() { 40 | return mReactNativeHost; 41 | } 42 | 43 | @Override 44 | public void onCreate() { 45 | super.onCreate(); 46 | SoLoader.init(this, /* native exopackage */ false); 47 | initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); 48 | } 49 | 50 | /** 51 | * Loads Flipper in React Native templates. Call this in the onCreate method with something like 52 | * initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); 53 | * 54 | * @param context 55 | * @param reactInstanceManager 56 | */ 57 | private static void initializeFlipper( 58 | Context context, ReactInstanceManager reactInstanceManager) { 59 | if (BuildConfig.DEBUG) { 60 | try { 61 | /* 62 | We use reflection here to pick up the class that initializes Flipper, 63 | since Flipper library is not available in release mode 64 | */ 65 | Class aClass = Class.forName("com.bleexample.ReactNativeFlipper"); 66 | aClass 67 | .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) 68 | .invoke(null, context, reactInstanceManager); 69 | } catch (ClassNotFoundException e) { 70 | e.printStackTrace(); 71 | } catch (NoSuchMethodException e) { 72 | e.printStackTrace(); 73 | } catch (IllegalAccessException e) { 74 | e.printStackTrace(); 75 | } catch (InvocationTargetException e) { 76 | e.printStackTrace(); 77 | } 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/palmmaximilian/ReactNativeArduinoBLE/a5af089367b5f3232a040256e34c8d6a1765b3f8/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/palmmaximilian/ReactNativeArduinoBLE/a5af089367b5f3232a040256e34c8d6a1765b3f8/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/palmmaximilian/ReactNativeArduinoBLE/a5af089367b5f3232a040256e34c8d6a1765b3f8/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/palmmaximilian/ReactNativeArduinoBLE/a5af089367b5f3232a040256e34c8d6a1765b3f8/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/palmmaximilian/ReactNativeArduinoBLE/a5af089367b5f3232a040256e34c8d6a1765b3f8/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/palmmaximilian/ReactNativeArduinoBLE/a5af089367b5f3232a040256e34c8d6a1765b3f8/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/palmmaximilian/ReactNativeArduinoBLE/a5af089367b5f3232a040256e34c8d6a1765b3f8/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/palmmaximilian/ReactNativeArduinoBLE/a5af089367b5f3232a040256e34c8d6a1765b3f8/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/palmmaximilian/ReactNativeArduinoBLE/a5af089367b5f3232a040256e34c8d6a1765b3f8/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/palmmaximilian/ReactNativeArduinoBLE/a5af089367b5f3232a040256e34c8d6a1765b3f8/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | BleExample 3 | 4 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext { 5 | buildToolsVersion = "30.0.2" 6 | minSdkVersion = 21 7 | compileSdkVersion = 30 8 | targetSdkVersion = 30 9 | ndkVersion = "21.4.7075529" 10 | } 11 | repositories { 12 | google() 13 | mavenCentral() 14 | } 15 | dependencies { 16 | classpath("com.android.tools.build:gradle:4.2.2") 17 | // NOTE: Do not place your application dependencies here; they belong 18 | // in the individual module build.gradle files 19 | } 20 | } 21 | 22 | allprojects { 23 | repositories { 24 | mavenCentral() 25 | mavenLocal() 26 | maven { 27 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 28 | url("$rootDir/../node_modules/react-native/android") 29 | } 30 | maven { 31 | // Android JSC is installed from npm 32 | url("$rootDir/../node_modules/jsc-android/dist") 33 | } 34 | maven { url 'https://www.jitpack.io' } 35 | google() 36 | maven { url 'https://www.jitpack.io' } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | # AndroidX package structure to make it clearer which packages are bundled with the 21 | # Android operating system, and which are packaged with your app's APK 22 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 23 | android.useAndroidX=true 24 | # Automatically convert third-party libraries to use AndroidX 25 | android.enableJetifier=true 26 | 27 | # Version of flipper SDK to use with React Native 28 | FLIPPER_VERSION=0.99.0 29 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/palmmaximilian/ReactNativeArduinoBLE/a5af089367b5f3232a040256e34c8d6a1765b3f8/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /android/local.properties: -------------------------------------------------------------------------------- 1 | #replace User and make sure that Sdk is spelled correctly, sometimes it has a lower case s 2 | sdk.dir=C:\\Users\\User\\AppData\\Local\\Android\\Sdk -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'BleExample' 2 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) 3 | include ':app' 4 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "BleExample", 3 | "displayName": "BleExample" 4 | } -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:metro-react-native-babel-preset'], 3 | }; 4 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import {AppRegistry} from 'react-native'; 6 | import App from './App'; 7 | import {name as appName} from './app.json'; 8 | 9 | AppRegistry.registerComponent(appName, () => App); 10 | -------------------------------------------------------------------------------- /ios/BleExample.xcodeproj/xcshareddata/xcschemes/BleExample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 53 | 55 | 61 | 62 | 63 | 64 | 70 | 72 | 78 | 79 | 80 | 81 | 83 | 84 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /ios/BleExample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : UIResponder 5 | 6 | @property (nonatomic, strong) UIWindow *window; 7 | 8 | @end 9 | -------------------------------------------------------------------------------- /ios/BleExample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | 3 | #import 4 | #import 5 | #import 6 | 7 | #ifdef FB_SONARKIT_ENABLED 8 | #import 9 | #import 10 | #import 11 | #import 12 | #import 13 | #import 14 | 15 | static void InitializeFlipper(UIApplication *application) { 16 | FlipperClient *client = [FlipperClient sharedClient]; 17 | SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults]; 18 | [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]]; 19 | [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]]; 20 | [client addPlugin:[FlipperKitReactPlugin new]]; 21 | [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]]; 22 | [client start]; 23 | } 24 | #endif 25 | 26 | @implementation AppDelegate 27 | 28 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 29 | { 30 | #ifdef FB_SONARKIT_ENABLED 31 | InitializeFlipper(application); 32 | #endif 33 | 34 | RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; 35 | RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge 36 | moduleName:@"BleExample" 37 | initialProperties:nil]; 38 | 39 | if (@available(iOS 13.0, *)) { 40 | rootView.backgroundColor = [UIColor systemBackgroundColor]; 41 | } else { 42 | rootView.backgroundColor = [UIColor whiteColor]; 43 | } 44 | 45 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 46 | UIViewController *rootViewController = [UIViewController new]; 47 | rootViewController.view = rootView; 48 | self.window.rootViewController = rootViewController; 49 | [self.window makeKeyAndVisible]; 50 | return YES; 51 | } 52 | 53 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge 54 | { 55 | #if DEBUG 56 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; 57 | #else 58 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 59 | #endif 60 | } 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /ios/BleExample/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /ios/BleExample/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /ios/BleExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | BleExample 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSRequiresIPhoneOS 26 | 27 | NSAppTransportSecurity 28 | 29 | NSExceptionDomains 30 | 31 | localhost 32 | 33 | NSExceptionAllowsInsecureHTTPLoads 34 | 35 | 36 | 37 | 38 | NSLocationWhenInUseUsageDescription 39 | 40 | UILaunchStoryboardName 41 | LaunchScreen 42 | UIRequiredDeviceCapabilities 43 | 44 | armv7 45 | 46 | UISupportedInterfaceOrientations 47 | 48 | UIInterfaceOrientationPortrait 49 | UIInterfaceOrientationLandscapeLeft 50 | UIInterfaceOrientationLandscapeRight 51 | 52 | UIViewControllerBasedStatusBarAppearance 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /ios/BleExample/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char * argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /ios/BleExampleTests/BleExampleTests.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | #import 5 | #import 6 | 7 | #define TIMEOUT_SECONDS 600 8 | #define TEXT_TO_LOOK_FOR @"Welcome to React" 9 | 10 | @interface BleExampleTests : XCTestCase 11 | 12 | @end 13 | 14 | @implementation BleExampleTests 15 | 16 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 17 | { 18 | if (test(view)) { 19 | return YES; 20 | } 21 | for (UIView *subview in [view subviews]) { 22 | if ([self findSubviewInView:subview matching:test]) { 23 | return YES; 24 | } 25 | } 26 | return NO; 27 | } 28 | 29 | - (void)testRendersWelcomeScreen 30 | { 31 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController]; 32 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 33 | BOOL foundElement = NO; 34 | 35 | __block NSString *redboxError = nil; 36 | #ifdef DEBUG 37 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 38 | if (level >= RCTLogLevelError) { 39 | redboxError = message; 40 | } 41 | }); 42 | #endif 43 | 44 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 45 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 46 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 47 | 48 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 49 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 50 | return YES; 51 | } 52 | return NO; 53 | }]; 54 | } 55 | 56 | #ifdef DEBUG 57 | RCTSetLogFunction(RCTDefaultLogFunction); 58 | #endif 59 | 60 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 61 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 62 | } 63 | 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /ios/BleExampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /ios/Podfile: -------------------------------------------------------------------------------- 1 | require_relative '../node_modules/react-native/scripts/react_native_pods' 2 | require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' 3 | 4 | platform :ios, '11.0' 5 | 6 | target 'BleExample' do 7 | config = use_native_modules! 8 | 9 | use_react_native!( 10 | :path => config[:reactNativePath], 11 | # to enable hermes on iOS, change `false` to `true` and then install pods 12 | :hermes_enabled => false 13 | ) 14 | 15 | target 'BleExampleTests' do 16 | inherit! :complete 17 | # Pods for testing 18 | end 19 | 20 | # Enables Flipper. 21 | # 22 | # Note that if you have use_frameworks! enabled, Flipper will not work and 23 | # you should disable the next line. 24 | use_flipper!() 25 | 26 | post_install do |installer| 27 | react_native_post_install(installer) 28 | __apply_Xcode_12_5_M1_post_install_workaround(installer) 29 | end 30 | end -------------------------------------------------------------------------------- /metro.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Metro configuration for React Native 3 | * https://github.com/facebook/react-native 4 | * 5 | * @format 6 | */ 7 | 8 | module.exports = { 9 | transformer: { 10 | getTransformOptions: async () => ({ 11 | transform: { 12 | experimentalImportSupport: false, 13 | inlineRequires: true, 14 | }, 15 | }), 16 | }, 17 | }; 18 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bleexample", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "android": "react-native run-android", 7 | "ios": "react-native run-ios", 8 | "start": "react-native start", 9 | "test": "jest", 10 | "lint": "eslint . --ext .js,.jsx,.ts,.tsx" 11 | }, 12 | "dependencies": { 13 | "@react-native-community/checkbox": "^0.5.9", 14 | "react": "17.0.2", 15 | "react-native": "0.66.4", 16 | "react-native-base64": "^0.2.1", 17 | "react-native-ble-plx": "^2.0.3" 18 | }, 19 | "devDependencies": { 20 | "@babel/core": "^7.12.9", 21 | "@babel/runtime": "^7.12.5", 22 | "@react-native-community/eslint-config": "^2.0.0", 23 | "@types/jest": "^26.0.23", 24 | "@types/react-native": "^0.66.4", 25 | "@types/react-native-base64": "^0.2.0", 26 | "@types/react-test-renderer": "^17.0.1", 27 | "@typescript-eslint/eslint-plugin": "^5.7.0", 28 | "@typescript-eslint/parser": "^5.7.0", 29 | "babel-jest": "^26.6.3", 30 | "eslint": "^7.14.0", 31 | "jest": "^26.6.3", 32 | "metro-react-native-babel-preset": "^0.66.2", 33 | "react-test-renderer": "17.0.2", 34 | "typescript": "^4.4.4" 35 | }, 36 | "resolutions": { 37 | "@types/react": "^17" 38 | }, 39 | "jest": { 40 | "preset": "react-native", 41 | "moduleFileExtensions": [ 42 | "ts", 43 | "tsx", 44 | "js", 45 | "jsx", 46 | "json", 47 | "node" 48 | ] 49 | } 50 | } 51 | --------------------------------------------------------------------------------