├── .github ├── actions │ └── arduino-cli │ │ └── action.yml ├── dependabot.yml └── workflows │ └── unittest.yml ├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── LICENSE ├── README.md ├── SIGNALDuino.code-workspace ├── __vm └── .SIGNALDuino.vsarduino.h ├── custom_hwids.py ├── extra_script.py ├── platformio.ini ├── src ├── _micro-api │ └── libraries │ │ ├── SimpleFIFO │ │ ├── examples │ │ │ └── HelloSimpleFIFO │ │ │ │ └── HelloSimpleFIFO.ino │ │ ├── library.properties │ │ └── src │ │ │ ├── README │ │ │ ├── SimpleFIFO.cpp │ │ │ ├── SimpleFIFO.h │ │ │ └── keywords.txt │ │ ├── TimerOne │ │ ├── README.md │ │ ├── examples │ │ │ ├── FanSpeed │ │ │ │ └── FanSpeed.pde │ │ │ └── Interrupt │ │ │ │ └── Interrupt.pde │ │ ├── keywords.txt │ │ ├── library.properties │ │ └── src │ │ │ ├── TimerOne.cpp │ │ │ ├── TimerOne.h │ │ │ └── config │ │ │ └── known_16bit_timers.h │ │ ├── bitstore │ │ ├── library.properties │ │ └── src │ │ │ ├── bitstore.cpp │ │ │ └── bitstore.h │ │ ├── fastdelegate │ │ ├── examples │ │ │ └── Demo.cpp │ │ ├── library.properties │ │ └── src │ │ │ ├── FastDelegate.h │ │ │ └── FastDelegateBind.h │ │ ├── output │ │ ├── library.properties │ │ └── src │ │ │ └── output.h │ │ └── signalDecoder │ │ ├── library.properties │ │ └── src │ │ ├── signalDecoder.cpp │ │ └── signalDecoder.h ├── arduino-ide │ └── SIGNALDuino │ │ ├── ArduinoJson.h │ │ ├── ArduinoJson.hpp │ │ ├── ArduinoJson │ │ ├── Configuration.hpp │ │ ├── Data │ │ │ ├── Encoding.hpp │ │ │ ├── JsonBufferAllocated.hpp │ │ │ ├── JsonFloat.hpp │ │ │ ├── JsonInteger.hpp │ │ │ ├── JsonVariantAs.hpp │ │ │ ├── JsonVariantContent.hpp │ │ │ ├── JsonVariantDefault.hpp │ │ │ ├── JsonVariantType.hpp │ │ │ ├── List.hpp │ │ │ ├── ListConstIterator.hpp │ │ │ ├── ListIterator.hpp │ │ │ ├── ListNode.hpp │ │ │ ├── NonCopyable.hpp │ │ │ ├── ReferenceType.hpp │ │ │ └── ValueSaver.hpp │ │ ├── Deserialization │ │ │ ├── Comments.hpp │ │ │ ├── JsonParser.hpp │ │ │ ├── JsonParserImpl.hpp │ │ │ └── StringWriter.hpp │ │ ├── DynamicJsonBuffer.hpp │ │ ├── JsonArray.hpp │ │ ├── JsonArrayImpl.hpp │ │ ├── JsonArraySubscript.hpp │ │ ├── JsonBuffer.hpp │ │ ├── JsonBufferBase.hpp │ │ ├── JsonBufferImpl.hpp │ │ ├── JsonObject.hpp │ │ ├── JsonObjectImpl.hpp │ │ ├── JsonObjectSubscript.hpp │ │ ├── JsonPair.hpp │ │ ├── JsonVariant.hpp │ │ ├── JsonVariantBase.hpp │ │ ├── JsonVariantCasts.hpp │ │ ├── JsonVariantComparisons.hpp │ │ ├── JsonVariantImpl.hpp │ │ ├── JsonVariantOr.hpp │ │ ├── JsonVariantSubscripts.hpp │ │ ├── Polyfills │ │ │ ├── attributes.hpp │ │ │ ├── ctype.hpp │ │ │ ├── isFloat.hpp │ │ │ ├── isInteger.hpp │ │ │ ├── math.hpp │ │ │ ├── parseFloat.hpp │ │ │ └── parseInteger.hpp │ │ ├── RawJson.hpp │ │ ├── Serialization │ │ │ ├── DummyPrint.hpp │ │ │ ├── DynamicStringBuilder.hpp │ │ │ ├── FloatParts.hpp │ │ │ ├── IndentedPrint.hpp │ │ │ ├── JsonPrintable.hpp │ │ │ ├── JsonSerializer.hpp │ │ │ ├── JsonSerializerImpl.hpp │ │ │ ├── JsonWriter.hpp │ │ │ ├── Prettyfier.hpp │ │ │ ├── StaticStringBuilder.hpp │ │ │ └── StreamPrintAdapter.hpp │ │ ├── StaticJsonBuffer.hpp │ │ ├── StringTraits │ │ │ ├── ArduinoStream.hpp │ │ │ ├── CharPointer.hpp │ │ │ ├── FlashString.hpp │ │ │ ├── StdStream.hpp │ │ │ ├── StdString.hpp │ │ │ └── StringTraits.hpp │ │ ├── TypeTraits │ │ │ ├── EnableIf.hpp │ │ │ ├── FloatTraits.hpp │ │ │ ├── IsArray.hpp │ │ │ ├── IsBaseOf.hpp │ │ │ ├── IsChar.hpp │ │ │ ├── IsConst.hpp │ │ │ ├── IsFloatingPoint.hpp │ │ │ ├── IsIntegral.hpp │ │ │ ├── IsSame.hpp │ │ │ ├── IsSignedIntegral.hpp │ │ │ ├── IsUnsignedIntegral.hpp │ │ │ ├── IsVariant.hpp │ │ │ ├── RemoveConst.hpp │ │ │ └── RemoveReference.hpp │ │ └── version.hpp │ │ ├── FastDelegate.h │ │ ├── FastDelegateBind.h │ │ ├── SIGNALDuino.ino │ │ ├── SimpleFIFO.cpp │ │ ├── SimpleFIFO.h │ │ ├── TimerOne.cpp │ │ ├── TimerOne.h │ │ ├── WiFiManager.cpp │ │ ├── WiFiManager.h │ │ ├── bitstore.cpp │ │ ├── bitstore.h │ │ ├── cc1101.cpp │ │ ├── cc1101.h │ │ ├── commands.h │ │ ├── compile_config.h │ │ ├── config │ │ └── known_16bit_timers.h │ │ ├── functions.h │ │ ├── main.h │ │ ├── mbus.cpp │ │ ├── mbus.h │ │ ├── output.h │ │ ├── send.h │ │ ├── signalDecoder.cpp │ │ ├── signalDecoder.h │ │ ├── signalSTM.h │ │ ├── signalduino.h │ │ ├── signalesp.h │ │ ├── strings_en.h │ │ ├── wifi-config.h │ │ ├── wm_consts_en.h │ │ └── wm_strings_en.h ├── cc1101.cpp ├── cc1101.h ├── commands.h ├── compile_config.h ├── functions.h ├── main.cpp ├── main.h ├── mbus.cpp ├── mbus.h ├── send.h ├── signalSTM.h ├── signalduino.h ├── signalesp.h └── wifi-config.h └── tests ├── .gitignore ├── .vscode └── launch.json ├── CMakeLists.txt ├── main.cpp ├── test_serialCommand.cpp ├── tests.cpp └── tests.h /.github/actions/arduino-cli/action.yml: -------------------------------------------------------------------------------- 1 | name: 'setup arduino-cli and plattform' 2 | description: 'install plattform into arduino-cli to be ready to compile' 3 | inputs: 4 | boardurl: 5 | description: 'URL of arduino compatible package.json' 6 | required: false 7 | default: '' 8 | plattform: 9 | description: 'plattform name(s), which shoud be installed' 10 | required: true 11 | default: 'arduino:avr' 12 | 13 | runs: 14 | using: "composite" 15 | steps: 16 | - name: Prepare plattform installation 17 | run: arduino-cli core update-index ${{ inputs.boardurl }} 18 | shell: bash 19 | - name: Install plattform 20 | run: arduino-cli core install ${{ inputs.plattform }} ${{ inputs.boardurl }} 21 | shell: bash 22 | - name: install pyserial 23 | run: | 24 | if [[ "${{ inputs.plattform }}" == "esp32:esp32"* ]] 25 | then 26 | pip install pyserial 27 | fi; 28 | shell: bash 29 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: gitsubmodule 4 | directory: "/" 5 | schedule: 6 | interval: daily 7 | open-pull-requests-limit: 10 8 | - package-ecosystem: github-actions 9 | directory: "/" 10 | schedule: 11 | interval: daily 12 | open-pull-requests-limit: 10 13 | -------------------------------------------------------------------------------- /.github/workflows/unittest.yml: -------------------------------------------------------------------------------- 1 | name: unittest 2 | on: 3 | workflow_dispatch: null 4 | pull_request: 5 | push: 6 | tags: 7 | - '**' 8 | jobs: 9 | unittest: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v4 13 | with: 14 | submodules: true 15 | 16 | - uses: lukka/get-cmake@v4.0.2 17 | with: 18 | cmakeVersion: "~3.25.0" # <--= optional, use most recent 3.25.x version 19 | 20 | - name: prepare directory 21 | working-directory: ./tests 22 | run: mkdir -p build 23 | 24 | - uses: actions/cache@v4 25 | with: 26 | path: | 27 | ./tests/build/_deps/ 28 | key: cmake-deps 29 | 30 | - name: cmake prepareBuild 31 | working-directory: ./tests/build 32 | run: cmake -DCMAKE_BUILD_TYPE=Release .. 33 | 34 | - name: cmake build (compile) project 35 | working-directory: ./tests/build 36 | run: cmake --build . 37 | 38 | - name: run ctest 39 | working-directory: ./tests/build 40 | run: ctest -V 41 | 42 | 43 | build: 44 | needs: unittest 45 | strategy: 46 | fail-fast: false 47 | matrix: 48 | include: 49 | - envName: esp32s 50 | - envName: esp32cc1101 51 | - envName: esp8266s 52 | - envName: esp8266cc1101 53 | - envName: MAPLEMINI_F103CBs 54 | - envName: MAPLEMINI_F103CBcc1101 55 | - envName: nano328 56 | - envName: nanoCC1101 57 | - envName: miniculCC1101 58 | - envName: promini8cc1101 59 | - envName: promini16cc1101 60 | - envName: promini8s 61 | - envName: promini16s 62 | - envName: radinoCC1101 63 | - envName: wemos_d1_mini_proCC1101 64 | 65 | runs-on: ubuntu-latest 66 | steps: 67 | - name: Checkout 68 | uses: actions/checkout@v4 69 | with: 70 | submodules: true 71 | fetch-depth: 0 72 | 73 | - uses: actions/cache@v4 74 | with: 75 | path: | 76 | ~/.cache/pip 77 | ~/.platformio/.cache 78 | key: ${{ matrix.envName }}-pio 79 | 80 | - name: Initialize CodeQL 81 | uses: github/codeql-action/init@v3 82 | with: 83 | languages: cpp 84 | 85 | - uses: actions/setup-python@v5 86 | with: 87 | python-version: '3.10' 88 | - name: Install PlatformIO Core 89 | run: pip install --upgrade platformio 90 | 91 | - name: Inject slug/short variables 92 | uses: rlespinasse/github-slug-action@v5 93 | 94 | - name: Run PlatformIO and compile sketch 95 | id: compile_sketch 96 | run: | 97 | export COMPILE_OUTPUT=$(pio run -e ${{ matrix.envName }} ) 98 | echo "$COMPILE_OUTPUT" 99 | FILEEXT=$(find .pio/build/${{ matrix.envName }} -maxdepth 1 \( -name 'SIGNALDuino*.bin' -o -name 'SIGNALDuino*.hex' \) | while read file; do echo "${file##*.}"; done) 100 | FILENAME=$(find .pio/build/${{ matrix.envName }}/ -maxdepth 1 \( -name 'SIGNALDuino*.bin' -o -name 'SIGNALDuino*.hex' \) -printf "%f" ) 101 | echo "Extension: $FILEEXT" 102 | echo "FILENAME=$(echo $FILENAME | tr -d '\n')" >> $GITHUB_OUTPUT 103 | echo "FILEEXT=$(echo $FILEEXT | tr -d '\n')" >> $GITHUB_OUTPUT 104 | echo "SKETCHSIZE=$(echo "$COMPILE_OUTPUT" | grep -Po "(^Flash: ).*")" >> $GITHUB_OUTPUT 105 | echo "GLOBALRAMUSAGE=$(echo "$COMPILE_OUTPUT" | grep -Po "(^RAM: ).*")" >> $GITHUB_OUTPUT 106 | 107 | - name: Create Job Summary 108 | run: | 109 | echo "### Size report for commit: ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY 110 | echo "| ENV | Flash | Ram |" >> $GITHUB_STEP_SUMMARY 111 | echo "|-------|-------|-----|" >> $GITHUB_STEP_SUMMARY 112 | echo "| ${{ matrix.envName }} | ${{ steps.compile_sketch.outputs.SKETCHSIZE }} | ${{ steps.compile_sketch.outputs.GLOBALRAMUSAGE }} |" >> $GITHUB_STEP_SUMMARY 113 | 114 | - name: Perform CodeQL Analysis 115 | uses: github/codeql-action/analyze@v3 116 | with: 117 | category: "/board:${{matrix.envName}}" 118 | 119 | - name: Upload artifact 120 | uses: actions/upload-artifact@v4 121 | with: 122 | name: ${{ steps.compile_sketch.outputs.FILENAME }} 123 | path: | 124 | .pio/build/${{ matrix.envName }}/${{ steps.compile_sketch.outputs.FILENAME }} 125 | if-no-files-found: warn 126 | 127 | release: 128 | needs: build 129 | permissions: 130 | contents: write 131 | runs-on: ubuntu-latest 132 | 133 | steps: 134 | - name: Download artifact 135 | id: download 136 | uses: actions/download-artifact@v4 137 | 138 | - name: 'Echo download path' 139 | run: ls -R ${{steps.download.outputs.download-path}} 140 | 141 | - name: Upload Release Asset 142 | id: upload-release-asset 143 | if: startsWith(github.ref, 'refs/tags/') 144 | uses: softprops/action-gh-release@v2 145 | with: 146 | generate_release_notes: true 147 | draft: true 148 | files: | 149 | ${{steps.download.outputs.download-path}}/SIGNALDuino*/SIGNALDuino* -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | build/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | 28 | # MSTest test Results 29 | [Tt]est[Rr]esult*/ 30 | [Bb]uild[Ll]og.* 31 | 32 | # NUNIT 33 | *.VisualState.xml 34 | TestResult.xml 35 | 36 | # Build Results of an ATL Project 37 | [Dd]ebugPS/ 38 | [Rr]eleasePS/ 39 | dlldata.c 40 | 41 | # DNX 42 | project.lock.json 43 | artifacts/ 44 | 45 | *_i.c 46 | *_p.c 47 | *_i.h 48 | *.ilk 49 | *.meta 50 | *.obj 51 | *.pch 52 | *.pdb 53 | *.pgc 54 | *.pgd 55 | *.rsp 56 | *.sbr 57 | *.tlb 58 | *.tli 59 | *.tlh 60 | *.tmp 61 | *.tmp_proj 62 | *.log 63 | *.vspscc 64 | *.vssscc 65 | .builds 66 | *.pidb 67 | *.svclog 68 | *.scc 69 | 70 | # Chutzpah Test files 71 | _Chutzpah* 72 | 73 | # Visual C++ cache files 74 | ipch/ 75 | *.aps 76 | *.ncb 77 | *.opensdf 78 | *.sdf 79 | *.cachefile 80 | 81 | # Visual Studio profiler 82 | *.psess 83 | *.vsp 84 | *.vspx 85 | 86 | # TFS 2012 Local Workspace 87 | $tf/ 88 | 89 | # Guidance Automation Toolkit 90 | *.gpState 91 | 92 | # ReSharper is a .NET coding add-in 93 | _ReSharper*/ 94 | *.[Rr]e[Ss]harper 95 | *.DotSettings.user 96 | 97 | # JustCode is a .NET coding add-in 98 | .JustCode 99 | 100 | # TeamCity is a build add-in 101 | _TeamCity* 102 | 103 | # DotCover is a Code Coverage Tool 104 | *.dotCover 105 | 106 | # NCrunch 107 | _NCrunch_* 108 | .*crunch*.local.xml 109 | 110 | # MightyMoose 111 | *.mm.* 112 | AutoTest.Net/ 113 | 114 | # Web workbench (sass) 115 | .sass-cache/ 116 | 117 | # Installshield output folder 118 | [Ee]xpress/ 119 | 120 | # DocProject is a documentation generator add-in 121 | DocProject/buildhelp/ 122 | DocProject/Help/*.HxT 123 | DocProject/Help/*.HxC 124 | DocProject/Help/*.hhc 125 | DocProject/Help/*.hhk 126 | DocProject/Help/*.hhp 127 | DocProject/Help/Html2 128 | DocProject/Help/html 129 | 130 | # Click-Once directory 131 | publish/ 132 | 133 | # Publish Web Output 134 | *.[Pp]ublish.xml 135 | *.azurePubxml 136 | ## TODO: Comment the next line if you want to checkin your 137 | ## web deploy settings but do note that will include unencrypted 138 | ## passwords 139 | #*.pubxml 140 | 141 | *.publishproj 142 | 143 | # NuGet Packages 144 | *.nupkg 145 | # The packages folder can be ignored because of Package Restore 146 | **/packages/* 147 | # except build/, which is used as an MSBuild target. 148 | !**/packages/build/ 149 | # Uncomment if necessary however generally it will be regenerated when needed 150 | #!**/packages/repositories.config 151 | 152 | # Windows Azure Build Output 153 | csx/ 154 | *.build.csdef 155 | 156 | # Windows Store app package directory 157 | AppPackages/ 158 | 159 | # Visual Studio cache files 160 | # files ending in .cache can be ignored 161 | *.[Cc]ache 162 | # but keep track of directories ending in .cache 163 | !*.[Cc]ache/ 164 | 165 | # Others 166 | ClientBin/ 167 | [Ss]tyle[Cc]op.* 168 | ~$* 169 | *~ 170 | *.dbmdl 171 | *.dbproj.schemaview 172 | *.pfx 173 | *.publishsettings 174 | node_modules/ 175 | orleans.codegen.cs 176 | 177 | # RIA/Silverlight projects 178 | Generated_Code/ 179 | 180 | # Backup & report files from converting an old project file 181 | # to a newer Visual Studio version. Backup files are not needed, 182 | # because we have git ;-) 183 | _UpgradeReport_Files/ 184 | Backup*/ 185 | UpgradeLog*.XML 186 | UpgradeLog*.htm 187 | 188 | # SQL Server files 189 | *.mdf 190 | *.ldf 191 | 192 | # Business Intelligence projects 193 | *.rdl.data 194 | *.bim.layout 195 | *.bim_*.settings 196 | 197 | # Microsoft Fakes 198 | FakesAssemblies/ 199 | 200 | # Node.js Tools for Visual Studio 201 | .ntvs_analysis.dat 202 | 203 | # Visual Studio 6 build log 204 | *.plg 205 | 206 | # Visual Studio 6 workspace options file 207 | *.opt 208 | 209 | # LightSwitch generated files 210 | GeneratedArtifacts/ 211 | _Pvt_Extensions/ 212 | ModelManifest.xml 213 | __vm/ 214 | ./.vscode/ 215 | .pio/ 216 | *.sln 217 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "src/_micro-api/libraries/WIFIManager"] 2 | path = src/_micro-api/libraries/WIFIManager 3 | url = https://github.com/tzapu/WiFiManager.git 4 | branch = v2.0.17 5 | [submodule "src/_micro-api/libraries/ArduinoJson"] 6 | path = src/_micro-api/libraries/ArduinoJson 7 | url = https://github.com/bblanchon/ArduinoJson.git 8 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.24) 2 | 3 | project(SIGNALduino_project) 4 | add_subdirectory ("tests") -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SIGNALDuino uC v3.5.0 with cc1101 support 2 | Development: ![unittest](https://github.com/RFD-FHEM/SIGNALDuino/workflows/unittest/badge.svg?branch=dev-r3.5_xFSK) 3 | 4 | Master: ![unittest](https://github.com/RFD-FHEM/SIGNALDuino/workflows/unittest/badge.svg?branch=master) 5 | ### Getting started 6 | 7 | 8 | System to receive digital signals and provide them to other systems for demodulation. Currently tested with 433 MHz, but not limited to that frequency or media. 9 | 10 | 11 | Just clone the repo and open the project file with Visual Studio (only available for windows) or VSCode. 12 | You can also open it with the Arduino IDE. 13 | Compile it and have fun. 14 | If you are using the Arduino IDE, you have to copy all the libs into your sketch folder and modify some includes. 15 | 16 | ### Using SIGNALDuino in FHEM 17 | 18 | If you want to use the SIGNALDuino with FHEM, you can use it directly from FHEM. No need to compile any sourcode. 19 | You find more information here: 20 | http://www.fhemwiki.de/wiki/SIGNALDuino 21 | 22 | 23 | 24 | ### Tested microcontrollers 25 | 26 | * Arduino Nano 27 | * Arduino Pro Mini 28 | * ESP32 (ESP32-WROOM-32 / ESP32-WROOM-32D) 29 | * ESP8266 30 | * RadinoCC1101 31 | * STM32 F103CBT6 (Maple Mini) 32 | 33 | ### ESP32 Notes 34 | 35 | If you encounter problems compiling for ESP32, sorry the code for this microcontroller is currently not finished tested with all variants from ESP32. Contributors are welcome. If you have mane errors from fastDelegate.h try adding this compiler flag: 36 | -Wno-unused-local-typedef 37 | 38 | ### Signal from my device ist not detected 39 | 40 | Implemented is a pattern detection engine, that can detect serval signal types. May not all, but most of them. 41 | 42 | Uncomment #define debugdetect in libs/remotesensor/patterdecoder.h 43 | Search for some output which describes a pattern with serval bits received. 44 | If you find something, open an issue and provide as much as possible informations with it. 45 | 46 | 47 | ### You found a bug 48 | 49 | First, sorry. This software is not perfect. 50 | 1. Open a issue 51 | -With helpful title - use descriptive keywords in the title and body so others can find your bug (avoiding duplicates). 52 | - Which branch, what microcontroller, what setup 53 | - Steps to reproduce the problem, with actual vs. expected results 54 | - If you find a bug in our code, post the files and the lines. 55 | 56 | ### Contributing 57 | 58 | 1. Open one ore more issue for your development. 59 | 2. Ask to be added to our repository or just fork it. 60 | 3. Make your modifications and test them. 61 | 4. Create a branch (git checkout -b my_branch) 62 | 5. Commit your changes (git commit -am "") 63 | 6 .Push to a developer branch (git push dev-my_branch) 64 | 7. Open a Pull Request, put some useful informations there, what your extension does and why we should add it, reference to the open issues which are fixed whith this pull requet. 65 | -------------------------------------------------------------------------------- /SIGNALDuino.code-workspace: -------------------------------------------------------------------------------- 1 | { 2 | "folders": [ 3 | { 4 | "path": "." 5 | }, 6 | { 7 | "path": "tests" 8 | } 9 | ], 10 | "settings": { 11 | "editor.tokenColorCustomizations": { 12 | "textMateRules": [ 13 | { 14 | "scope": "googletest.failed", 15 | "settings": { 16 | "foreground": "#f00" 17 | } 18 | }, 19 | { 20 | "scope": "googletest.passed", 21 | "settings": { 22 | "foreground": "#0f0" 23 | } 24 | }, 25 | { 26 | "scope": "googletest.run", 27 | "settings": { 28 | "foreground": "#0f0" 29 | } 30 | } 31 | ] 32 | }, 33 | "gtest-adapter.debugConfig": [ 34 | "PIO Debug" 35 | ] 36 | } 37 | } -------------------------------------------------------------------------------- /__vm/.SIGNALDuino.vsarduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Editor: https://www.visualmicro.com/ 3 | This file is for intellisense purpose only. 4 | Visual micro (and the arduino ide) ignore this code during compilation. This code is automatically maintained by visualmicro, manual changes to this file will be overwritten 5 | The contents of the _vm sub folder can be deleted prior to publishing a project 6 | All non-arduino files created by visual micro and all visual studio project or solution files can be freely deleted and are not required to compile a sketch (do not delete your own code!). 7 | Note: debugger breakpoints are stored in '.sln' or '.asln' files, knowledge of last uploaded breakpoints is stored in the upload.vmps.xml file. Both files are required to continue a previous debug session without needing to compile and upload again 8 | 9 | Hardware: NodeMCU 1.0 (ESP-12E Module), Platform=esp8266, Package=esp8266 10 | */ 11 | 12 | #if defined(_VMICRO_INTELLISENSE) 13 | 14 | #ifndef _VSARDUINO_H_ 15 | #define _VSARDUINO_H_ 16 | #define __ESP8266_esp8266__ 17 | #define __ESP8266_ESP8266__ 18 | #define __ets__ 19 | #define ICACHE_FLASH 20 | #define F_CPU 80000000L 21 | #define LWIP_OPEN_SRC 22 | #define ARDUINO 108010 23 | #define ARDUINO_ESP8266_NODEMCU 24 | #define ARDUINO_ARCH_ESP8266 25 | #define ESP8266 26 | #define __cplusplus 201103L 27 | #undef __cplusplus 28 | #define __cplusplus 201103L 29 | #define __STDC__ 30 | #define __ARM__ 31 | #define __arm__ 32 | #define __inline__ 33 | #define __asm__(x) 34 | #define __asm__ 35 | #define __extension__ 36 | #define __ATTR_PURE__ 37 | #define __ATTR_CONST__ 38 | #define __volatile__ 39 | 40 | 41 | #define __ASM 42 | #define __INLINE 43 | #define __attribute__(noinline) 44 | 45 | //#define _STD_BEGIN 46 | //#define EMIT 47 | #define WARNING 48 | #define _Lockit 49 | #define __CLR_OR_THIS_CALL 50 | #define C4005 51 | #define _NEW 52 | 53 | //typedef int uint8_t; 54 | //#define __ARMCC_VERSION 400678 55 | //#define PROGMEM 56 | //#define string_literal 57 | // 58 | //#define prog_void 59 | //#define PGM_VOID_P int 60 | // 61 | 62 | typedef int _read; 63 | typedef int _seek; 64 | typedef int _write; 65 | typedef int _close; 66 | typedef int __cleanup; 67 | 68 | //#define inline 69 | 70 | #define __builtin_clz 71 | #define __builtin_clzl 72 | #define __builtin_clzll 73 | #define __builtin_labs 74 | #define __builtin_va_list 75 | typedef int __gnuc_va_list; 76 | 77 | #define __ATOMIC_ACQ_REL 78 | 79 | #define __CHAR_BIT__ 80 | #define _EXFUN() 81 | 82 | typedef unsigned char byte; 83 | extern "C" void __cxa_pure_virtual() {;} 84 | 85 | 86 | typedef long __INTPTR_TYPE__ ; 87 | typedef long __UINTPTR_TYPE__ ; 88 | typedef long __SIZE_TYPE__ ; 89 | typedef long __PTRDIFF_TYPE__; 90 | 91 | 92 | #include "new" 93 | #include "Esp.h" 94 | 95 | 96 | #include "arduino.h" 97 | #include 98 | 99 | #include "..\generic\Common.h" 100 | #include "..\generic\pins_arduino.h" 101 | 102 | #undef F 103 | #define F(string_literal) ((const PROGMEM char *)(string_literal)) 104 | #undef PSTR 105 | #define PSTR(string_literal) ((const PROGMEM char *)(string_literal)) 106 | //current vc++ does not understand this syntax so use older arduino example for intellisense 107 | //todo:move to the new clang/gcc project types. 108 | #define interrupts() sei() 109 | #define noInterrupts() cli() 110 | 111 | #include "SIGNALDuino.ino" 112 | #include "SIGNALESP.ino" 113 | #endif 114 | #endif 115 | -------------------------------------------------------------------------------- /custom_hwids.py: -------------------------------------------------------------------------------- 1 | Import("env") 2 | 3 | board_config = env.BoardConfig() 4 | # should be array of VID:PID pairs 5 | # https://docs.platformio.org/en/latest/projectconf/advanced_scripting.html#override-board-configuration 6 | # https://docs.platformio.org/en/latest/projectconf/advanced_scripting.html 7 | board_config.update("build.hwids", [ 8 | ["0x0483", "0x0003"], # 1st pair 9 | ["0x0483", "0x0004"] # 2nd pair, etc. 10 | ]) -------------------------------------------------------------------------------- /extra_script.py: -------------------------------------------------------------------------------- 1 | try: 2 | import configparser 3 | except ImportError: 4 | import ConfigParser as configparser 5 | 6 | Import("env") 7 | 8 | ### access to global build environment 9 | #print(env) 10 | 11 | ### view all build environment 12 | #print(env.Dump()) 13 | 14 | ### to build date str and buildname 15 | import datetime 16 | import subprocess 17 | import os 18 | import platform 19 | date = datetime.datetime.now().strftime("%y%m%d") 20 | 21 | # for config.get 22 | # config = configparser.ConfigParser() 23 | # config.read("platformio.ini") 24 | # build_version = config.get("env", "BUILD_FLAGS") 25 | 26 | # name from env:project | example: [env:nano_bootl_old_CC1101] 27 | build_name = "SIGNALDuino_" + env['PIOENV'] 28 | 29 | # Build versions with a point are difficult to process 30 | # System uses dot for file extension 31 | 32 | reftype = os.environ.get('GITHUB_REF_TYPE','local') 33 | basetag = ( 34 | subprocess.check_output(["git", "describe", "--tags", "--first-parent", "--abbrev=1"]) 35 | .strip() 36 | .decode("utf-8") 37 | ) 38 | 39 | if (reftype == 'branch') : 40 | build_version = basetag+os.environ.get('GITHUB_REF_SLUG')+"+"+date 41 | elif (reftype == 'tag') : 42 | build_version = os.environ.get('GITHUB_REF_SLUG',basetag+"+"+date) 43 | else: 44 | build_version = basetag+"+"+date 45 | 46 | # write project hex, bin, elf to nano_bootl_old_CC1101_v350_dev_20200811.hex 47 | env.Replace(PROGNAME="%s" % build_name + "_" + "%s" % build_version) 48 | 49 | env.Append(CPPDEFINES=[ 50 | ("PROGVERS",env.StringifyMacro(build_version)), 51 | ]) 52 | 53 | 54 | #Copy functions has to be finished, it does currently not work 55 | def copy_firmware(source, target, env): 56 | 57 | from pathlib import Path 58 | import shutil 59 | filename= source 60 | if env["PIOPLATFORM"] == "espressif32" or env["PIOPLATFORM"] == "espressif8266": 61 | filename = source + ".bin" 62 | else: 63 | filename = source + ".hex" 64 | 65 | print (filename) 66 | ## if bin file exists, copy to subfolder 67 | # shutil.copyfile(str(filename), str(BUILD_DIR)) 68 | 69 | 70 | #if platform.system() == "Windows": 71 | # env.AddPostAction("$BUILD_DIR\\${PROGNAME}", copy_firmware) 72 | 73 | #if platform.system() == "Linux": 74 | # env.AddPostAction("$BUILD_DIR/${PROGNAME}", copy_firmware) 75 | -------------------------------------------------------------------------------- /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 | [platformio] 12 | ; https://docs.platformio.org/en/latest/projectconf/section_env.html 13 | 14 | ; only SIGNALDECODER DEBUG firmware versions based on ESP8266 15 | ; default_envs = SDC_DEBUG_1, SDC_DEBUGDECODE_1, SDC_DEBUGDECODE_255, SDC_DEBUGDETECT_0, SDC_DEBUGDETECT_1, SDC_DEBUGDETECT_2, SDC_DEBUGDETECT_3, SDC_DEBUGDETECT_3_DEBUGDECODE_1, SDC_DEBUGDETECT_255, SDC_DEBUGDETECT_255_DEBUGDECODE_1 16 | 17 | test_dir = tests/ 18 | 19 | [env] 20 | build_src_filter = +<*> -<.git/> -<.svn/> - - - -<_micro-api/libraries/ArduinoJson/test/> -<_micro-api/libraries/ArduinoJson/third-party/> -<_micro-api/libraries/fastdelegate/examples/>- - -<_micro-api/libraries/ArduinoJson/fuzzing/> 21 | lib_extra_dirs = src/_micro-api/libraries/ 22 | #debug_port = COM6 23 | #monitor_port = COM6f 24 | #upload_port = COM6 25 | upload_speed = 921600 26 | 27 | ; file for Advanced Scripting 28 | ; https://docs.platformio.org/en/latest/projectconf/advanced_scripting.html 29 | extra_scripts = pre:extra_script.py ; to rename projectfile 30 | 31 | [env_esp] 32 | ; all options for ESP 33 | monitor_port = socket://192.168.0.30:23 34 | ;monitor_port = COM6 35 | 36 | [env_maple_mini] 37 | ; all options for MAPLE_Mini 38 | ; extra_scripts = pre:custom_hwids.py ; to write USB PID for device | needed to right reconnected 39 | ; platform = ststm32 ; Stable version 40 | platform = https://github.com/platformio/platform-ststm32.git ; Development version 41 | board = maple_mini_origin 42 | board_build.mcu = stm32f103cbt6 ; https://docs.platformio.org/en/latest/projectconf/section_env_platform.html#board-build-mcu 43 | board_build.core = STM32Duino ; https://docs.platformio.org/en/latest/platforms/ststm32.html#configuration 44 | framework = arduino 45 | build_flags= 46 | -D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC ; CDC (generic Serial supersede U(S)ART) 47 | -D USBCON ; !! work only with maple_mini bootloader v1.0 !! 48 | ;-D USBD_VID=0x1eaf ; Maple Serial (COMxx) 49 | ;-D USBD_PID=0x0003 ; Bootloader 50 | -D USBD_PID=0x0004 ; Device 51 | -D USBD_VID=0x0483 ; Serielles USB-Geraet (COMxx) 52 | -D USB_MANUFACTURER="STMicroelectronics" 53 | -D USB_PRODUCT="\"Maple\"" 54 | 55 | ; * * * * * * * * * * * * * * * * * * * * * 56 | ; behind this lines, all hardware projects 57 | ; * * * * * * * * * * * * * * * * * * * * * 58 | 59 | [env:esp32s] 60 | ; Espressif ESP32 / NodeMCU - single core, max 240 MHz, power consumption 80 mA 61 | ; RAM: [= ] 14.4% (used 47316 bytes from 327680 bytes) 62 | ; Flash: [======= ] 67.4% (used 882793 bytes from 1310720 bytes) 63 | platform = espressif32@6.6 ; version 6.6 set 64 | #platform = espressif32 ; always stable version | not work 241014 65 | board = nodemcu-32s 66 | framework = arduino 67 | debug_tool = olimex-arm-usb-ocd-h 68 | monitor_speed = 115200 69 | monitor_port = ${env_esp.monitor_port} 70 | upload_port = ${env.upload_port} 71 | build_flags= 72 | 73 | [env:esp32cc1101] 74 | ; Espressif ESP32 / NodeMCU - single core, max 240 MHz, power consumption 80 mA 75 | ; RAM: [= ] 14.5% (used 47436 bytes from 327680 bytes) 76 | ; Flash: [======= ] 67.9% (used 889529 bytes from 1310720 bytes) 77 | platform = espressif32@6.6 ; version 6.6 set 78 | #platform = espressif32 ; always stable version | not work 241014 79 | board = nodemcu-32s 80 | framework = arduino 81 | monitor_speed = 115200 82 | monitor_port = ${env_esp.monitor_port} 83 | upload_port = ${env.upload_port} 84 | build_flags=-D OTHER_BOARD_WITH_CC1101=1 85 | 86 | [env:esp8266s] 87 | ; Espressif ESP8266 - single core, max 160 MHz, GPIO 17, power consumption 80 mA 88 | ; RAM: [==== ] 40.1% (used 32828 bytes from 81920 bytes) 89 | ; Flash: [==== ] 35.5% (used 370599 bytes from 1044464 bytes) 90 | platform = espressif8266@4.2.1 ; version 4.2.1 set 91 | board = nodemcuv2 92 | framework = arduino 93 | ;upload_speed = 115200 94 | monitor_port = ${env_esp.monitor_port} 95 | upload_port = ${env.upload_port} 96 | monitor_speed = 115200 97 | lib_deps= 98 | build_flags= 99 | 100 | [env:esp8266cc1101] 101 | ; Espressif ESP8266 - single core, max 160 MHz, GPIO 17, power consumption 80 mA 102 | ; RAM: [==== ] 40.1% (used 32880 bytes from 81920 bytes) 103 | ; Flash: [==== ] 36.0% (used 376343 bytes from 1044464 bytes) 104 | platform = espressif8266@4.2.1 ; version 4.2.1 set 105 | board = nodemcuv2 106 | framework = arduino 107 | ;upload_speed = 115200 108 | monitor_port = ${env_esp.monitor_port} 109 | upload_port = ${env.upload_port} 110 | monitor_speed = 115200 111 | lib_deps = 112 | build_flags=-D OTHER_BOARD_WITH_CC1101=1 113 | 114 | [env:MAPLEMINI_F103CBs] 115 | ; ST-Microelectronics STM32F103C8T6 bootloader v1.0 116 | ; RAM: [=== ] 29.1% (used 5968 bytes from 20480 bytes) 117 | ; Flash: [==== ] 41.7% (used 46144 bytes from 110592 bytes) 118 | platform = ${env_maple_mini.platform} 119 | board = ${env_maple_mini.board} 120 | board_build.mcu = ${env_maple_mini.board_build.mcu} 121 | board_build.core = ${env_maple_mini.board_build.core} 122 | framework = ${env_maple_mini.framework} 123 | monitor_port = ${env.monitor_port} 124 | upload_port = ${env.upload_port} 125 | build_flags = ${env_maple_mini.build_flags} 126 | -D ARDUINO_MAPLEMINI_F103CB=1 127 | 128 | [env:MAPLEMINI_F103CBcc1101] 129 | ; ST-Microelectronics STM32F103C8T6 bootloader v1.0 130 | ; RAM: [=== ] 29.5% (used 6032 bytes from 20480 bytes) 131 | ; Flash: [===== ] 46.6% (used 51568 bytes from 110592 bytes) 132 | platform = ${env_maple_mini.platform} 133 | board = ${env_maple_mini.board} 134 | board_build.mcu = ${env_maple_mini.board_build.mcu} 135 | board_build.core = ${env_maple_mini.board_build.core} 136 | framework = ${env_maple_mini.framework} 137 | monitor_port = ${env.monitor_port} 138 | upload_port = ${env.upload_port} 139 | build_flags = ${env_maple_mini.build_flags} 140 | -D ARDUINO_MAPLEMINI_F103CB=1 141 | -D OTHER_BOARD_WITH_CC1101=1 142 | 143 | [env:nano328] 144 | ; RAM: [==== ] 41.9% (used 858 bytes from 2048 bytes) 145 | ; Flash: [======= ] 69.7% (used 21426 bytes from 30720 bytes) 146 | platform = atmelavr 147 | board = nanoatmega328 148 | build_flags= 149 | framework = arduino 150 | build_src_filter = -cc1101.h -cc1101.cpp +<*> -<.git/> -<.svn/> - - - -<_micro-api/libraries/ArduinoJson/test/> -<_micro-api/libraries/ArduinoJson/third-party/> -<_micro-api/libraries/fastdelegate/examples/>- - -<_micro-api/libraries/ArduinoJson/fuzzing/> 151 | 152 | [env:nano328_bootl_new] 153 | ; Arduino Nano ATmega328 - bootloader Optiboot 154 | ; RAM: [==== ] 41.9% (used 858 bytes from 2048 bytes) 155 | ; Flash: [======= ] 69.7% (used 21426 bytes from 30720 bytes) 156 | platform = atmelavr 157 | board = nanoatmega328new 158 | monitor_speed = 57600 159 | framework = arduino 160 | monitor_port = ${env.monitor_port} 161 | upload_port = ${env.upload_port} 162 | build_flags= 163 | 164 | [env:nanoCC1101] 165 | ; RAM: [==== ] 44.6% (used 914 bytes from 2048 bytes) 166 | ; Flash: [======== ] 81.0% (used 24888 bytes from 30720 bytes) 167 | platform = atmelavr 168 | board = nanoatmega328 169 | framework = arduino 170 | build_flags=-D OTHER_BOARD_WITH_CC1101=1 171 | build_src_filter = -cc1101.h -cc1101.cpp +<*> -<.git/> -<.svn/> - - - -<_micro-api/libraries/ArduinoJson/test/> -<_micro-api/libraries/ArduinoJson/third-party/> -<_micro-api/libraries/fastdelegate/examples/>- - -<_micro-api/libraries/ArduinoJson/fuzzing/> 172 | 173 | [env:nanoCC1101_bootl_new] 174 | ; Arduino Nano ATmega328 - bootloader Optiboot 175 | ; RAM: [==== ] 44.6% (used 914 bytes from 2048 bytes) 176 | ; Flash: [======== ] 81.0% (used 24888 bytes from 30720 bytes) 177 | platform = atmelavr 178 | board = nanoatmega328new 179 | monitor_speed = 57600 180 | framework = arduino 181 | monitor_port = ${env.monitor_port} 182 | upload_port = ${env.upload_port} 183 | build_flags=-D OTHER_BOARD_WITH_CC1101=1 184 | 185 | [env:miniculCC1101] 186 | ; Minicul with cc1101 running at 8 mhz 187 | ; RAM: [==== ] 42.1% (used 862 bytes from 2048 bytes) 188 | ; Flash: [======= ] 69.7% (used 21406 bytes from 30720 bytes) 189 | platform = atmelavr 190 | board = pro8MHzatmega328 191 | framework = arduino 192 | monitor_speed = 57600 193 | monitor_port = ${env.monitor_port} 194 | upload_port = ${env.upload_port} 195 | build_flags = -D ARDUINO_ATMEGA328P_MINICUL=1 196 | 197 | [env:promini8cc1101] 198 | ; Arduino Pro or Pro Mini - Atmel ATmega328 running at 8MHz 199 | ; RAM: [==== ] 44.6% (used 913 bytes from 2048 bytes) 200 | ; Flash: [======== ] 80.9% (used 24866 bytes from 30720 bytes) 201 | platform = atmelavr 202 | board = pro8MHzatmega328 203 | monitor_speed = 57600 204 | framework = arduino 205 | monitor_port = ${env.monitor_port} 206 | upload_port = ${env.upload_port} 207 | build_flags=-D OTHER_BOARD_WITH_CC1101=1 208 | 209 | [env:promini16cc1101] 210 | ; Arduino Pro or Pro Mini - Atmel ATmega328 running at 16MHz 211 | ; RAM: [==== ] 45.0% (used 921 bytes from 2048 bytes) 212 | ; Flash: [======== ] 80.8% (used 24820 bytes from 30720 bytes) 213 | platform = atmelavr 214 | board = pro16MHzatmega328 215 | monitor_speed = 57600 216 | framework = arduino 217 | monitor_port = ${env.monitor_port} 218 | upload_port = ${env.upload_port} 219 | build_flags=-D OTHER_BOARD_WITH_CC1101=1 220 | 221 | [env:promini8s] 222 | ; Arduino Pro or Pro Mini - Atmel ATmega328 running at 8MHz 223 | ; RAM: [==== ] 41.7% (used 854 bytes from 2048 bytes) 224 | ; Flash: [======= ] 70.3% (used 21610 bytes from 30720 bytes) 225 | platform = atmelavr 226 | board = pro8MHzatmega328 227 | monitor_speed = 57600 228 | framework = arduino 229 | monitor_port = ${env.monitor_port} 230 | upload_port = ${env.upload_port} 231 | build_flags= 232 | 233 | [env:promini16s] 234 | ; Arduino Pro or Pro Mini - Atmel ATmega328 running at 16MHz 235 | ; RAM: [==== ] 42.1% (used 862 bytes from 2048 bytes) 236 | ; Flash: [======= ] 70.2% (used 21554 bytes from 30720 bytes) 237 | platform = atmelavr 238 | board = pro8MHzatmega328 239 | monitor_speed = 57600 240 | framework = arduino 241 | monitor_port = ${env.monitor_port} 242 | upload_port = ${env.upload_port} 243 | build_flags= 244 | 245 | [env:radinoCC1101] 246 | ; Arduino compatible (Arduino Micro / Leonardo) - Atmel ATmega32U4 247 | ; RAM: [=== ] 34.5% (used 882 bytes from 2560 bytes) 248 | ; Flash: [========= ] 94.6% (used 27114 bytes from 28672 bytes) 249 | ; 250 | ; Radino board from in-circuit is not in POI 251 | ; these are compatible with all PIN´s 252 | ; working correctly; send & receive function works 253 | platform = atmelavr 254 | board = micro 255 | framework = arduino 256 | board_build.mcu = atmega32u4 ; change microcontroller 257 | board_build.f_cpu = 8000000L ; change MCU frequency 258 | monitor_port = ${env.monitor_port} 259 | upload_port = ${env.upload_port} 260 | build_flags=-D ARDUINO_RADINOCC1101=1 261 | 262 | [env:wemos_d1_mini_proCC1101] 263 | ; Espressif ESP8266 WeMos D1 mini pro - single core, max 160MHz, GPIO 11, power consumption 70 mA 264 | ; RAM: [==== ] 40.1% (used 32880 bytes from 81920 bytes) 265 | ; Flash: [==== ] 36.0% (used 376331 bytes from 1044464 bytes) 266 | platform = espressif8266 267 | board = d1_mini_pro 268 | framework = arduino 269 | monitor_speed = 115200 270 | monitor_port = ${env.monitor_port} 271 | upload_port = ${env.upload_port} 272 | build_flags=-D PIN_LED_INVERSE=1 -D OTHER_BOARD_WITH_CC1101=1 273 | 274 | [env:wemos_d1_mini_pro] 275 | ; Espressif ESP8266 WeMos D1 mini pro - single core, max 160MHz, GPIO 11, power consumption 70 mA 276 | ; RAM: [==== ] 38.9% (used 31876 bytes from 81920 bytes) 277 | ; Flash: [=== ] 34.9% (used 364828 bytes from 1044464 bytes) 278 | platform = espressif8266 279 | board = d1_mini_pro 280 | framework = arduino 281 | monitor_speed = 115200 282 | monitor_port = ${env.monitor_port} 283 | upload_port = ${env.upload_port} 284 | build_flags=-D PIN_LED_INVERSE=1 285 | 286 | 287 | ; only SIGNALDECODER DEBUG firmware versions based on ESP8266 288 | ; ----------------------------------------------------------- 289 | 290 | [env:SDC_DEBUG_1] 291 | ; 80KB RAM, 4MB Flash 292 | ; RAM: [==== ] 40.6% (used 33252 bytes from 81920 bytes) 293 | ; Flash: [==== ] 36.1% (used 376661 bytes from 1044464 bytes) 294 | platform = espressif8266 295 | board = nodemcuv2 296 | framework = arduino 297 | ;upload_speed = 115200 298 | monitor_port = ${env_esp.monitor_port} 299 | upload_port = ${env.upload_port} 300 | monitor_speed = 115200 301 | lib_deps = 302 | build_flags=-D OTHER_BOARD_WITH_CC1101=1 -D DEBUG=1 303 | 304 | [env:SDC_DEBUGDECODE_1] 305 | ; 80KB RAM, 4MB Flash 306 | ; RAM: [==== ] 40.9% (used 33508 bytes from 81920 bytes) 307 | ; Flash: [==== ] 36.2% (used 378285 bytes from 1044464 bytes) 308 | platform = espressif8266 309 | board = nodemcuv2 310 | framework = arduino 311 | ;upload_speed = 115200 312 | monitor_port = ${env_esp.monitor_port} 313 | upload_port = ${env.upload_port} 314 | monitor_speed = 115200 315 | lib_deps = 316 | build_flags=-D OTHER_BOARD_WITH_CC1101=1 -D DEBUG -D DEBUGDECODE=1 317 | 318 | [env:SDC_DEBUGDECODE_255] 319 | ; 80KB RAM, 4MB Flash 320 | ; RAM: [==== ] 41.0% (used 33572 bytes from 81920 bytes) 321 | ; Flash: [==== ] 36.2% (used 378317 bytes from 1044464 bytes) 322 | platform = espressif8266 323 | board = nodemcuv2 324 | framework = arduino 325 | ;upload_speed = 115200 326 | monitor_port = ${env_esp.monitor_port} 327 | upload_port = ${env.upload_port} 328 | monitor_speed = 115200 329 | lib_deps = 330 | build_flags=-D OTHER_BOARD_WITH_CC1101=1 -D DEBUG=1 -D DEBUGDECODE=255 331 | 332 | [env:SDC_DEBUGDETECT_0] 333 | ; 80KB RAM, 4MB Flash 334 | ; RAM: [==== ] 40.6% (used 33284 bytes from 81920 bytes) 335 | ; Flash: [==== ] 36.1% (used 376789 bytes from 1044464 bytes) 336 | platform = espressif8266 337 | board = nodemcuv2 338 | framework = arduino 339 | ;upload_speed = 115200 340 | monitor_port = ${env_esp.monitor_port} 341 | upload_port = ${env.upload_port} 342 | monitor_speed = 115200 343 | lib_deps = 344 | build_flags=-D OTHER_BOARD_WITH_CC1101=1 -D DEBUG=1 -D DEBUGDETECT=0 345 | 346 | [env:SDC_DEBUGDETECT_1] 347 | ; 80KB RAM, 4MB Flash 348 | ; RAM: [==== ] 41.0% (used 33576 bytes from 81920 bytes) 349 | ; Flash: [==== ] 36.2% (used 377657 bytes from 1044464 bytes) 350 | platform = espressif8266 351 | board = nodemcuv2 352 | framework = arduino 353 | ;upload_speed = 115200 354 | monitor_port = ${env_esp.monitor_port} 355 | upload_port = ${env.upload_port} 356 | monitor_speed = 115200 357 | lib_deps = 358 | build_flags=-D OTHER_BOARD_WITH_CC1101=1 -D DEBUG=1 -D DEBUGDETECT=1 359 | 360 | [env:SDC_DEBUGDETECT_2] 361 | ; 80KB RAM, 4MB Flash 362 | ; RAM: [==== ] 41.0% (used 33572 bytes from 81920 bytes) 363 | ; Flash: [==== ] 36.2% (used 377709 bytes from 1044464 bytes) 364 | platform = espressif8266 365 | board = nodemcuv2 366 | framework = arduino 367 | ;upload_speed = 115200 368 | monitor_port = ${env_esp.monitor_port} 369 | upload_port = ${env.upload_port} 370 | monitor_speed = 115200 371 | lib_deps = 372 | build_flags=-D OTHER_BOARD_WITH_CC1101=1 -D DEBUG=1 -D DEBUGDETECT=2 373 | 374 | [env:SDC_DEBUGDETECT_3] 375 | ; 80KB RAM, 4MB Flash 376 | ; RAM: [==== ] 41.1% (used 33640 bytes from 81920 bytes) 377 | ; Flash: [==== ] 36.2% (used 378153 bytes from 1044464 bytes) 378 | platform = espressif8266 379 | board = nodemcuv2 380 | framework = arduino 381 | ;upload_speed = 115200 382 | monitor_port = ${env_esp.monitor_port} 383 | upload_port = ${env.upload_port} 384 | monitor_speed = 115200 385 | lib_deps = 386 | build_flags=-D OTHER_BOARD_WITH_CC1101=1 -D DEBUG=1 -D DEBUGDETECT=3 387 | 388 | [env:SDC_DEBUGDETECT_3_DEBUGDECODE_1] 389 | ; 80KB RAM, 4MB Flash 390 | ; RAM: [==== ] 41.4% (used 33896 bytes from 81920 bytes) 391 | ; Flash: [==== ] 36.4% (used 379809 bytes from 1044464 bytes) 392 | platform = espressif8266 393 | board = nodemcuv2 394 | framework = arduino 395 | ;upload_speed = 115200 396 | monitor_port = ${env_esp.monitor_port} 397 | upload_port = ${env.upload_port} 398 | monitor_speed = 115200 399 | lib_deps = 400 | build_flags=-D OTHER_BOARD_WITH_CC1101=1 -D DEBUG=1 -D DEBUGDETECT=3 -D DEBUGDECODE=1 401 | 402 | [env:SDC_DEBUGDETECT_255] 403 | ; 80KB RAM, 4MB Flash 404 | ; RAM: [==== ] 41.2% (used 33768 bytes from 81920 bytes) 405 | ; Flash: [==== ] 36.2% (used 378553 bytes from 1044464 bytes) 406 | platform = espressif8266 407 | board = nodemcuv2 408 | framework = arduino 409 | ;upload_speed = 115200 410 | monitor_port = ${env_esp.monitor_port} 411 | upload_port = ${env.upload_port} 412 | monitor_speed = 115200 413 | lib_deps = 414 | build_flags=-D OTHER_BOARD_WITH_CC1101=1 -D DEBUG=1 -D DEBUGDETECT=255 415 | 416 | [env:SDC_DEBUGDETECT_255_DEBUGDECODE_1] 417 | ; 80KB RAM, 4MB Flash 418 | ; RAM: [==== ] 41.5% (used 34020 bytes from 81920 bytes) 419 | ; Flash: [==== ] 36.4% (used 380213 bytes from 1044464 bytes) 420 | platform = espressif8266 421 | board = nodemcuv2 422 | framework = arduino 423 | ;upload_speed = 115200 424 | monitor_port = ${env_esp.monitor_port} 425 | upload_port = ${env.upload_port} 426 | monitor_speed = 115200 427 | lib_deps = 428 | build_flags=-D OTHER_BOARD_WITH_CC1101=1 -D DEBUG=1 -D DEBUGDETECT=255 -D DEBUGDECODE=1 429 | 430 | 431 | ; only tests native 432 | ; ----------------- 433 | 434 | 435 | [env:native] 436 | platform = native 437 | lib_deps = 438 | googletest@1.8.1 439 | build_flags = 440 | -std=c++11 441 | lib_archive = false 442 | test_ignore = embedded* 443 | ;src_dir = tests/testSignalDecoder 444 | lib_compat_mode = off 445 | -------------------------------------------------------------------------------- /src/_micro-api/libraries/SimpleFIFO/examples/HelloSimpleFIFO/HelloSimpleFIFO.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void setup() { 4 | Serial.begin(9600); 5 | 6 | SimpleFIFO sFIFO; //store 10 ints 7 | 8 | sFIFO.enqueue(1); 9 | sFIFO.enqueue(2); 10 | sFIFO.enqueue(3); 11 | sFIFO.enqueue(4); 12 | sFIFO.enqueue(5); 13 | 14 | Serial.print(F("Peek: ")); 15 | Serial.println(sFIFO.peek()); 16 | 17 | for (int i=0; i 6 | #ifndef SIMPLEFIFO_SIZE_TYPE 7 | #ifndef SIMPLEFIFO_LARGE 8 | #define SIMPLEFIFO_SIZE_TYPE uint8_t 9 | #else 10 | #define SIMPLEFIFO_SIZE_TYPE uint16_t 11 | #endif 12 | #endif 13 | /* 14 | || 15 | || @file SimpleFIFO.h 16 | || @version 1.2 17 | || @author Alexander Brevig 18 | || @contact alexanderbrevig@gmail.com 19 | || 20 | || @description 21 | || | A simple FIFO class, mostly for primitive types but can be used with classes if assignment to int is allowed 22 | || | This FIFO is not dynamic, so be sure to choose an appropriate size for it 23 | || # 24 | || 25 | || @license 26 | || | Copyright (c) 2010 Alexander Brevig 27 | || | This library is free software; you can redistribute it and/or 28 | || | modify it under the terms of the GNU Lesser General Public 29 | || | License as published by the Free Software Foundation; version 30 | || | 2.1 of the License. 31 | || | 32 | || | This library is distributed in the hope that it will be useful, 33 | || | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | || | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 35 | || | Lesser General Public License for more details. 36 | || | 37 | || | You should have received a copy of the GNU Lesser General Public 38 | || | License along with this library; if not, write to the Free Software 39 | || | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 40 | || # 41 | || 42 | */ 43 | template 44 | class SimpleFIFO { 45 | public: 46 | const SIMPLEFIFO_SIZE_TYPE size; //speculative feature, in case it's needed 47 | 48 | SimpleFIFO(); 49 | 50 | T dequeue(); //get next element 51 | bool enqueue( T element ); //add an element 52 | T peek() const; //get the next element without releasing it from the FIFO 53 | void flush(); //[1.1] reset to default state 54 | 55 | //how many elements are currently in the FIFO? 56 | SIMPLEFIFO_SIZE_TYPE count() { return numberOfElements; } 57 | 58 | private: 59 | #ifndef SimpleFIFO_NONVOLATILE 60 | volatile SIMPLEFIFO_SIZE_TYPE numberOfElements; 61 | volatile SIMPLEFIFO_SIZE_TYPE nextIn; 62 | volatile SIMPLEFIFO_SIZE_TYPE nextOut; 63 | volatile T raw[rawSize]; 64 | #else 65 | SIMPLEFIFO_SIZE_TYPE numberOfElements; 66 | SIMPLEFIFO_SIZE_TYPE nextIn; 67 | SIMPLEFIFO_SIZE_TYPE nextOut; 68 | T raw[rawSize]; 69 | #endif 70 | }; 71 | 72 | template 73 | SimpleFIFO::SimpleFIFO() : size(rawSize) { 74 | flush(); 75 | } 76 | template 77 | #if defined(ESP32) || defined(ESP8266) 78 | bool IRAM_ATTR SimpleFIFO::enqueue( T element ) { 79 | #else 80 | bool SimpleFIFO::enqueue( T element ) { 81 | #endif 82 | if ( count() >= rawSize ) { return false; } 83 | numberOfElements++; 84 | nextIn %= size; 85 | raw[nextIn] = element; 86 | nextIn++; //advance to next index 87 | return true; 88 | } 89 | template 90 | T SimpleFIFO::dequeue() { 91 | numberOfElements--; 92 | nextOut %= size; 93 | return raw[ nextOut++]; 94 | } 95 | template 96 | T SimpleFIFO::peek() const { 97 | return raw[ nextOut % size]; 98 | } 99 | template 100 | void SimpleFIFO::flush() { 101 | nextIn = nextOut = numberOfElements = 0; 102 | } 103 | #endif 104 | -------------------------------------------------------------------------------- /src/_micro-api/libraries/SimpleFIFO/src/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For SimpleFIFO 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | SimpleFIFO KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | peek KEYWORD2 16 | enqueue KEYWORD2 17 | dequeue KEYWORD2 18 | flush KEYWORD2 19 | count KEYWORD2 20 | 21 | ####################################### 22 | # Constants (LITERAL1) 23 | ####################################### 24 | 25 | size LITERAL1 -------------------------------------------------------------------------------- /src/_micro-api/libraries/TimerOne/README.md: -------------------------------------------------------------------------------- 1 | #TimerOne Library# 2 | 3 | Paul Stoffregen's modified TimerOne. This version provides 2 main benefits: 4 | 5 | 1: Optimized inline functions - much faster for the most common usage 6 | 2: Support for more boards 7 | 8 | http://www.pjrc.com/teensy/td_libs_TimerOne.html 9 | 10 | https://github.com/PaulStoffregen/TimerOne 11 | 12 | Original code 13 | 14 | http://playground.arduino.cc/Code/Timer1 15 | 16 | Open Source License 17 | 18 | TimerOne is free software. You can redistribute it and/or modify it under 19 | the terms of Creative Commons Attribution 3.0 United States License. 20 | To view a copy of this license, visit 21 | 22 | http://creativecommons.org/licenses/by/3.0/us/ 23 | 24 | Paul Stoffregen forked this version from an early copy of TimerOne/TimerThree 25 | which was licensed "Creative Commons Attribution 3.0" and has maintained 26 | the original "CC BY 3.0 US" license terms. 27 | 28 | Other, separately developed updates to TimerOne have been released by other 29 | authors under the GNU GPLv2 license. Multiple copies of this library, bearing 30 | the same name but distributed under different license terms, is unfortunately 31 | confusing. This copy, with nearly all the code redesigned as inline functions, 32 | is provided under the "CC BY 3.0 US" license terms. 33 | 34 | -------------------------------------------------------------------------------- /src/_micro-api/libraries/TimerOne/examples/FanSpeed/FanSpeed.pde: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // This example creates a PWM signal with 25 kHz carrier. 4 | // 5 | // Arduino's analogWrite() gives you PWM output, but no control over the 6 | // carrier frequency. The default frequency is low, typically 490 or 7 | // 3920 Hz. Sometimes you may need a faster carrier frequency. 8 | // 9 | // The specification for 4-wire PWM fans recommends a 25 kHz frequency 10 | // and allows 21 to 28 kHz. The default from analogWrite() might work 11 | // with some fans, but to follow the specification we need 25 kHz. 12 | // 13 | // http://www.formfactors.org/developer/specs/REV1_2_Public.pdf 14 | // 15 | // Connect the PWM pin to the fan's control wire (usually blue). The 16 | // board's ground must be connected to the fan's ground, and the fan 17 | // needs +12 volt power from the computer or a separate power supply. 18 | 19 | const int fanPin = 4; 20 | 21 | void setup(void) 22 | { 23 | Timer1.initialize(40); // 40 us = 25 kHz 24 | Serial.begin(9600); 25 | } 26 | 27 | void loop(void) 28 | { 29 | // slowly increase the PWM fan speed 30 | // 31 | for (float dutyCycle = 30.0; dutyCycle < 100.0; dutyCycle++) { 32 | Serial.print("PWM Fan, Duty Cycle = "); 33 | Serial.println(dutyCycle); 34 | Timer1.pwm(fanPin, (dutyCycle / 100) * 1023); 35 | delay(500); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/_micro-api/libraries/TimerOne/examples/Interrupt/Interrupt.pde: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // This example uses the timer interrupt to blink an LED 4 | // and also demonstrates how to share a variable between 5 | // the interrupt and the main program. 6 | 7 | 8 | const int led = LED_BUILTIN; // the pin with a LED 9 | 10 | void setup(void) 11 | { 12 | pinMode(led, OUTPUT); 13 | Timer1.initialize(150000); 14 | Timer1.attachInterrupt(blinkLED); // blinkLED to run every 0.15 seconds 15 | Serial.begin(9600); 16 | } 17 | 18 | 19 | // The interrupt will blink the LED, and keep 20 | // track of how many times it has blinked. 21 | int ledState = LOW; 22 | volatile unsigned long blinkCount = 0; // use volatile for shared variables 23 | 24 | void blinkLED(void) 25 | { 26 | if (ledState == LOW) { 27 | ledState = HIGH; 28 | blinkCount = blinkCount + 1; // increase when LED turns on 29 | } else { 30 | ledState = LOW; 31 | } 32 | digitalWrite(led, ledState); 33 | } 34 | 35 | 36 | // The main program will print the blink count 37 | // to the Arduino Serial Monitor 38 | void loop(void) 39 | { 40 | unsigned long blinkCopy; // holds a copy of the blinkCount 41 | 42 | // to read a variable which the interrupt code writes, we 43 | // must temporarily disable interrupts, to be sure it will 44 | // not change while we are reading. To minimize the time 45 | // with interrupts off, just quickly make a copy, and then 46 | // use the copy while allowing the interrupt to keep working. 47 | noInterrupts(); 48 | blinkCopy = blinkCount; 49 | interrupts(); 50 | 51 | Serial.print("blinkCount = "); 52 | Serial.println(blinkCopy); 53 | delay(100); 54 | } 55 | -------------------------------------------------------------------------------- /src/_micro-api/libraries/TimerOne/keywords.txt: -------------------------------------------------------------------------------- 1 | Timer1 KEYWORD2 2 | TimerOne KEYWORD1 3 | initialize KEYWORD2 4 | start KEYWORD2 5 | stop KEYWORD2 6 | restart KEYWORD2 7 | resume KEYWORD2 8 | pwm KEYWORD2 9 | disablePwm KEYWORD2 10 | attachInterrupt KEYWORD2 11 | detachInterrupt KEYWORD2 12 | setPeriod KEYWORD2 13 | setPwmDuty KEYWORD2 14 | isrCallback KEYWORD2 15 | -------------------------------------------------------------------------------- /src/_micro-api/libraries/TimerOne/library.properties: -------------------------------------------------------------------------------- 1 | name=TimerOne 2 | version=1.0.0 3 | author=Arduino 4 | maintainer=Arduino 5 | sentence=TimerOne library code 6 | paragraph= 7 | category=Uncategorized 8 | url=http://www.arduino.com 9 | architectures=* -------------------------------------------------------------------------------- /src/_micro-api/libraries/TimerOne/src/TimerOne.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Interrupt and PWM utilities for 16 bit Timer1 on ATmega168/328 3 | * Original code by Jesse Tane for http://labs.ideo.com August 2008 4 | * Modified March 2009 by Jérôme Despatis and Jesse Tane for ATmega328 support 5 | * Modified June 2009 by Michael Polli and Jesse Tane to fix a bug in setPeriod() which caused the timer to stop 6 | * Modified Oct 2009 by Dan Clemens to work with timer1 of the ATMega1280 or Arduino Mega 7 | * Modified April 2012 by Paul Stoffregen 8 | * Modified again, June 2014 by Paul Stoffregen 9 | * 10 | * This is free software. You can redistribute it and/or modify it under 11 | * the terms of Creative Commons Attribution 3.0 United States License. 12 | * To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/us/ 13 | * or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. 14 | * 15 | */ 16 | #if defined(__AVR__) || (defined(__arm__) && defined(CORE_TEENSY)) 17 | 18 | #include "TimerOne.h" 19 | 20 | TimerOne Timer1; // preinstatiate 21 | 22 | unsigned short TimerOne::pwmPeriod = 0; 23 | unsigned char TimerOne::clockSelectBits = 0; 24 | void (*TimerOne::isrCallback)() = NULL; 25 | #endif 26 | 27 | // interrupt service routine that wraps a user defined function supplied by attachInterrupt 28 | #if defined(__AVR__) 29 | ISR(TIMER1_OVF_vect) 30 | { 31 | Timer1.isrCallback(); 32 | } 33 | 34 | #elif defined(__arm__) && defined(CORE_TEENSY) 35 | void ftm1_isr(void) 36 | { 37 | uint32_t sc = FTM1_SC; 38 | if (sc & 0x80) FTM1_SC = sc & 0x7F; 39 | Timer1.isrCallback(); 40 | } 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /src/_micro-api/libraries/TimerOne/src/TimerOne.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Interrupt and PWM utilities for 16 bit Timer1 on ATmega168/328 3 | * Original code by Jesse Tane for http://labs.ideo.com August 2008 4 | * Modified March 2009 by Jérôme Despatis and Jesse Tane for ATmega328 support 5 | * Modified June 2009 by Michael Polli and Jesse Tane to fix a bug in setPeriod() which caused the timer to stop 6 | * Modified April 2012 by Paul Stoffregen - portable to other AVR chips, use inline functions 7 | * Modified again, June 2014 by Paul Stoffregen - support Teensy 3.x & even more AVR chips 8 | * 9 | * 10 | * This is free software. You can redistribute it and/or modify it under 11 | * the terms of Creative Commons Attribution 3.0 United States License. 12 | * To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/us/ 13 | * or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. 14 | * 15 | */ 16 | 17 | #ifndef TimerOne_h_ 18 | #define TimerOne_h_ 19 | 20 | #if defined(ARDUINO) && ARDUINO >= 100 21 | #include "Arduino.h" 22 | #else 23 | #include "WProgram.h" 24 | #endif 25 | 26 | #include "config/known_16bit_timers.h" 27 | 28 | #define TIMER1_RESOLUTION 65536UL // Timer1 is 16 bit 29 | 30 | 31 | // Placing nearly all the code in this .h file allows the functions to be 32 | // inlined by the compiler. In the very common case with constant values 33 | // the compiler will perform all calculations and simply write constants 34 | // to the hardware registers (for example, setPeriod). 35 | 36 | 37 | class TimerOne 38 | { 39 | 40 | 41 | #if defined(__AVR__) 42 | public: 43 | //**************************** 44 | // Configuration 45 | //**************************** 46 | void initialize(unsigned long microseconds=1000000) __attribute__((always_inline)) { 47 | TCCR1B = _BV(WGM13); // set mode as phase and frequency correct pwm, stop the timer 48 | TCCR1A = 0; // clear control register A 49 | setPeriod(microseconds); 50 | } 51 | void setPeriod(unsigned long microseconds) __attribute__((always_inline)) { 52 | const unsigned long cycles = (F_CPU / 2000000) * microseconds; 53 | if (cycles < TIMER1_RESOLUTION) { 54 | clockSelectBits = _BV(CS10); 55 | pwmPeriod = cycles; 56 | } else 57 | if (cycles < TIMER1_RESOLUTION * 8) { 58 | clockSelectBits = _BV(CS11); 59 | pwmPeriod = cycles / 8; 60 | } else 61 | if (cycles < TIMER1_RESOLUTION * 64) { 62 | clockSelectBits = _BV(CS11) | _BV(CS10); 63 | pwmPeriod = cycles / 64; 64 | } else 65 | if (cycles < TIMER1_RESOLUTION * 256) { 66 | clockSelectBits = _BV(CS12); 67 | pwmPeriod = cycles / 256; 68 | } else 69 | if (cycles < TIMER1_RESOLUTION * 1024) { 70 | clockSelectBits = _BV(CS12) | _BV(CS10); 71 | pwmPeriod = cycles / 1024; 72 | } else { 73 | clockSelectBits = _BV(CS12) | _BV(CS10); 74 | pwmPeriod = TIMER1_RESOLUTION - 1; 75 | } 76 | ICR1 = pwmPeriod; 77 | TCCR1B = _BV(WGM13) | clockSelectBits; 78 | } 79 | 80 | //**************************** 81 | // Run Control 82 | //**************************** 83 | void start() __attribute__((always_inline)) { 84 | TCCR1B = 0; 85 | TCNT1 = 0; // TODO: does this cause an undesired interrupt? 86 | resume(); 87 | } 88 | void stop() __attribute__((always_inline)) { 89 | TCCR1B = _BV(WGM13); 90 | } 91 | void restart() __attribute__((always_inline)) { 92 | start(); 93 | } 94 | void resume() __attribute__((always_inline)) { 95 | TCCR1B = _BV(WGM13) | clockSelectBits; 96 | } 97 | 98 | //**************************** 99 | // PWM outputs 100 | //**************************** 101 | void setPwmDuty(char pin, unsigned int duty) __attribute__((always_inline)) { 102 | unsigned long dutyCycle = pwmPeriod; 103 | dutyCycle *= duty; 104 | dutyCycle >>= 10; 105 | if (pin == TIMER1_A_PIN) OCR1A = dutyCycle; 106 | #ifdef TIMER1_B_PIN 107 | else if (pin == TIMER1_B_PIN) OCR1B = dutyCycle; 108 | #endif 109 | #ifdef TIMER1_C_PIN 110 | else if (pin == TIMER1_C_PIN) OCR1C = dutyCycle; 111 | #endif 112 | } 113 | void pwm(char pin, unsigned int duty) __attribute__((always_inline)) { 114 | if (pin == TIMER1_A_PIN) { pinMode(TIMER1_A_PIN, OUTPUT); TCCR1A |= _BV(COM1A1); } 115 | #ifdef TIMER1_B_PIN 116 | else if (pin == TIMER1_B_PIN) { pinMode(TIMER1_B_PIN, OUTPUT); TCCR1A |= _BV(COM1B1); } 117 | #endif 118 | #ifdef TIMER1_C_PIN 119 | else if (pin == TIMER1_C_PIN) { pinMode(TIMER1_C_PIN, OUTPUT); TCCR1A |= _BV(COM1C1); } 120 | #endif 121 | setPwmDuty(pin, duty); 122 | TCCR1B = _BV(WGM13) | clockSelectBits; 123 | } 124 | void pwm(char pin, unsigned int duty, unsigned long microseconds) __attribute__((always_inline)) { 125 | if (microseconds > 0) setPeriod(microseconds); 126 | pwm(pin, duty); 127 | } 128 | void disablePwm(char pin) __attribute__((always_inline)) { 129 | if (pin == TIMER1_A_PIN) TCCR1A &= ~_BV(COM1A1); 130 | #ifdef TIMER1_B_PIN 131 | else if (pin == TIMER1_B_PIN) TCCR1A &= ~_BV(COM1B1); 132 | #endif 133 | #ifdef TIMER1_C_PIN 134 | else if (pin == TIMER1_C_PIN) TCCR1A &= ~_BV(COM1C1); 135 | #endif 136 | } 137 | 138 | //**************************** 139 | // Interrupt Function 140 | //**************************** 141 | void attachInterrupt(void (*isr)()) __attribute__((always_inline)) { 142 | isrCallback = isr; 143 | TIMSK1 = _BV(TOIE1); 144 | } 145 | void attachInterrupt(void (*isr)(), unsigned long microseconds) __attribute__((always_inline)) { 146 | if(microseconds > 0) setPeriod(microseconds); 147 | attachInterrupt(isr); 148 | } 149 | void detachInterrupt() __attribute__((always_inline)) { 150 | TIMSK1 = 0; 151 | } 152 | static void (*isrCallback)(); 153 | 154 | private: 155 | // properties 156 | static unsigned short pwmPeriod; 157 | static unsigned char clockSelectBits; 158 | 159 | 160 | 161 | 162 | 163 | 164 | #elif defined(__arm__) && defined(CORE_TEENSY) 165 | 166 | public: 167 | //**************************** 168 | // Configuration 169 | //**************************** 170 | void initialize(unsigned long microseconds=1000000) __attribute__((always_inline)) { 171 | setPeriod(microseconds); 172 | } 173 | void setPeriod(unsigned long microseconds) __attribute__((always_inline)) { 174 | const unsigned long cycles = (F_BUS / 2000000) * microseconds; 175 | if (cycles < TIMER1_RESOLUTION) { 176 | clockSelectBits = 0; 177 | pwmPeriod = cycles; 178 | } else 179 | if (cycles < TIMER1_RESOLUTION * 2) { 180 | clockSelectBits = 1; 181 | pwmPeriod = cycles >> 1; 182 | } else 183 | if (cycles < TIMER1_RESOLUTION * 4) { 184 | clockSelectBits = 2; 185 | pwmPeriod = cycles >> 2; 186 | } else 187 | if (cycles < TIMER1_RESOLUTION * 8) { 188 | clockSelectBits = 3; 189 | pwmPeriod = cycles >> 3; 190 | } else 191 | if (cycles < TIMER1_RESOLUTION * 16) { 192 | clockSelectBits = 4; 193 | pwmPeriod = cycles >> 4; 194 | } else 195 | if (cycles < TIMER1_RESOLUTION * 32) { 196 | clockSelectBits = 5; 197 | pwmPeriod = cycles >> 5; 198 | } else 199 | if (cycles < TIMER1_RESOLUTION * 64) { 200 | clockSelectBits = 6; 201 | pwmPeriod = cycles >> 6; 202 | } else 203 | if (cycles < TIMER1_RESOLUTION * 128) { 204 | clockSelectBits = 7; 205 | pwmPeriod = cycles >> 7; 206 | } else { 207 | clockSelectBits = 7; 208 | pwmPeriod = TIMER1_RESOLUTION - 1; 209 | } 210 | uint32_t sc = FTM1_SC; 211 | FTM1_SC = 0; 212 | FTM1_MOD = pwmPeriod; 213 | FTM1_SC = FTM_SC_CLKS(1) | FTM_SC_CPWMS | clockSelectBits | (sc & FTM_SC_TOIE); 214 | } 215 | 216 | //**************************** 217 | // Run Control 218 | //**************************** 219 | void start() __attribute__((always_inline)) { 220 | stop(); 221 | FTM1_CNT = 0; 222 | resume(); 223 | } 224 | void stop() __attribute__((always_inline)) { 225 | FTM1_SC = FTM1_SC & (FTM_SC_TOIE | FTM_SC_CPWMS | FTM_SC_PS(7)); 226 | } 227 | void restart() __attribute__((always_inline)) { 228 | start(); 229 | } 230 | void resume() __attribute__((always_inline)) { 231 | FTM1_SC = (FTM1_SC & (FTM_SC_TOIE | FTM_SC_PS(7))) | FTM_SC_CPWMS | FTM_SC_CLKS(1); 232 | } 233 | 234 | //**************************** 235 | // PWM outputs 236 | //**************************** 237 | void setPwmDuty(char pin, unsigned int duty) __attribute__((always_inline)) { 238 | unsigned long dutyCycle = pwmPeriod; 239 | dutyCycle *= duty; 240 | dutyCycle >>= 10; 241 | if (pin == TIMER1_A_PIN) { 242 | FTM1_C0V = dutyCycle; 243 | } else if (pin == TIMER1_B_PIN) { 244 | FTM1_C1V = dutyCycle; 245 | } 246 | } 247 | void pwm(char pin, unsigned int duty) __attribute__((always_inline)) { 248 | setPwmDuty(pin, duty); 249 | if (pin == TIMER1_A_PIN) { 250 | CORE_PIN3_CONFIG = PORT_PCR_MUX(3) | PORT_PCR_DSE | PORT_PCR_SRE; 251 | } else if (pin == TIMER1_B_PIN) { 252 | CORE_PIN4_CONFIG = PORT_PCR_MUX(3) | PORT_PCR_DSE | PORT_PCR_SRE; 253 | } 254 | } 255 | void pwm(char pin, unsigned int duty, unsigned long microseconds) __attribute__((always_inline)) { 256 | if (microseconds > 0) setPeriod(microseconds); 257 | pwm(pin, duty); 258 | } 259 | void disablePwm(char pin) __attribute__((always_inline)) { 260 | if (pin == TIMER1_A_PIN) { 261 | CORE_PIN3_CONFIG = 0; 262 | } else if (pin == TIMER1_B_PIN) { 263 | CORE_PIN4_CONFIG = 0; 264 | } 265 | } 266 | 267 | //**************************** 268 | // Interrupt Function 269 | //**************************** 270 | void attachInterrupt(void (*isr)()) __attribute__((always_inline)) { 271 | isrCallback = isr; 272 | FTM1_SC |= FTM_SC_TOIE; 273 | NVIC_ENABLE_IRQ(IRQ_FTM1); 274 | } 275 | void attachInterrupt(void (*isr)(), unsigned long microseconds) __attribute__((always_inline)) { 276 | if(microseconds > 0) setPeriod(microseconds); 277 | attachInterrupt(isr); 278 | } 279 | void detachInterrupt() __attribute__((always_inline)) { 280 | FTM1_SC &= ~FTM_SC_TOIE; 281 | NVIC_DISABLE_IRQ(IRQ_FTM1); 282 | } 283 | static void (*isrCallback)(); 284 | 285 | private: 286 | // properties 287 | static unsigned short pwmPeriod; 288 | static unsigned char clockSelectBits; 289 | 290 | #endif 291 | }; 292 | 293 | extern TimerOne Timer1; 294 | 295 | #endif 296 | 297 | -------------------------------------------------------------------------------- /src/_micro-api/libraries/TimerOne/src/config/known_16bit_timers.h: -------------------------------------------------------------------------------- 1 | #ifndef known_16bit_timers_header_ 2 | #define known_16bit_timers_header_ 3 | 4 | // Wiring-S 5 | // 6 | #if defined(__AVR_ATmega644P__) && defined(WIRING) 7 | #define TIMER1_A_PIN 5 8 | #define TIMER1_B_PIN 4 9 | #define TIMER1_ICP_PIN 6 10 | 11 | // Teensy 2.0 12 | // 13 | #elif defined(__AVR_ATmega32U4__) && defined(CORE_TEENSY) 14 | #define TIMER1_A_PIN 14 15 | #define TIMER1_B_PIN 15 16 | #define TIMER1_C_PIN 4 17 | #define TIMER1_ICP_PIN 22 18 | #define TIMER1_CLK_PIN 11 19 | #define TIMER3_A_PIN 9 20 | #define TIMER3_ICP_PIN 10 21 | 22 | // Teensy++ 2.0 23 | #elif defined(__AVR_AT90USB1286__) && defined(CORE_TEENSY) 24 | #define TIMER1_A_PIN 25 25 | #define TIMER1_B_PIN 26 26 | #define TIMER1_C_PIN 27 27 | #define TIMER1_ICP_PIN 4 28 | #define TIMER1_CLK_PIN 6 29 | #define TIMER3_A_PIN 16 30 | #define TIMER3_B_PIN 15 31 | #define TIMER3_C_PIN 14 32 | #define TIMER3_ICP_PIN 17 33 | #define TIMER3_CLK_PIN 13 34 | 35 | // Teensy 3.0 36 | // 37 | #elif defined(__MK20DX128__) 38 | #define TIMER1_A_PIN 3 39 | #define TIMER1_B_PIN 4 40 | #define TIMER1_ICP_PIN 4 41 | 42 | // Teensy 3.1 43 | // 44 | #elif defined(__MK20DX256__) 45 | #define TIMER1_A_PIN 3 46 | #define TIMER1_B_PIN 4 47 | #define TIMER1_ICP_PIN 4 48 | #define TIMER3_A_PIN 32 49 | #define TIMER3_B_PIN 25 50 | #define TIMER3_ICP_PIN 32 51 | 52 | // Arduino Mega 53 | // 54 | #elif defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) 55 | #define TIMER1_A_PIN 11 56 | #define TIMER1_B_PIN 12 57 | #define TIMER1_C_PIN 13 58 | #define TIMER3_A_PIN 5 59 | #define TIMER3_B_PIN 2 60 | #define TIMER3_C_PIN 3 61 | #define TIMER4_A_PIN 6 62 | #define TIMER4_B_PIN 7 63 | #define TIMER4_C_PIN 8 64 | #define TIMER4_ICP_PIN 49 65 | #define TIMER5_A_PIN 46 66 | #define TIMER5_B_PIN 45 67 | #define TIMER5_C_PIN 44 68 | #define TIMER3_ICP_PIN 48 69 | #define TIMER3_CLK_PIN 47 70 | 71 | // Arduino Leonardo, Yun, etc 72 | // 73 | #elif defined(__AVR_ATmega32U4__) 74 | #define TIMER1_A_PIN 9 75 | #define TIMER1_B_PIN 10 76 | #define TIMER1_C_PIN 11 77 | #define TIMER1_ICP_PIN 4 78 | #define TIMER1_CLK_PIN 12 79 | #define TIMER3_A_PIN 5 80 | #define TIMER3_ICP_PIN 13 81 | 82 | // Uno, Duemilanove, LilyPad, etc 83 | // 84 | #elif defined (__AVR_ATmega168__) || defined (__AVR_ATmega328P__) 85 | #define TIMER1_A_PIN 9 86 | #define TIMER1_B_PIN 10 87 | #define TIMER1_ICP_PIN 8 88 | #define TIMER1_CLK_PIN 5 89 | 90 | // Sanguino 91 | // 92 | #elif defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644__) 93 | #define TIMER1_A_PIN 13 94 | #define TIMER1_B_PIN 12 95 | #define TIMER1_ICP_PIN 14 96 | #define TIMER1_CLK_PIN 1 97 | 98 | // Wildfire - Wicked Devices 99 | /* TODO: need Wildfire's pins_arduino.h to define a symbol 100 | so we can tell the difference between Wildfile & Mighty-1284 101 | #elif defined(__AVR_ATmega1284P__) 102 | #define TIMER1_A_PIN 5 // PD5 103 | #define TIMER1_B_PIN 4 // PD4 104 | #define TIMER1_ICP_PIN 6 // PD6 105 | #define TIMER1_CLK_PIN 15 // PB1 106 | #define TIMER3_A_PIN 12 // PB6 107 | #define TIMER3_B_PIN 13 // PB7 108 | #define TIMER3_ICP_PIN 11 // PB5 109 | #define TIMER3_CLK_PIN 0 // PD0 110 | */ 111 | 112 | // Mighty-1284 - Maniacbug 113 | #elif defined(__AVR_ATmega1284P__) 114 | #define TIMER1_A_PIN 12 // PD5 115 | #define TIMER1_B_PIN 13 // PD4 116 | #define TIMER1_ICP_PIN 14 // PD6 117 | #define TIMER1_CLK_PIN 1 // PB1 118 | #define TIMER3_A_PIN 6 // PB6 119 | #define TIMER3_B_PIN 7 // PB7 120 | #define TIMER3_ICP_PIN 5 // PB5 121 | #define TIMER3_CLK_PIN 8 // PD0 122 | 123 | #endif 124 | 125 | #endif 126 | -------------------------------------------------------------------------------- /src/_micro-api/libraries/bitstore/library.properties: -------------------------------------------------------------------------------- 1 | name=bitstore 2 | version=1.1.0 3 | author=Visual Micro 4 | maintainer=Visual Micro 5 | sentence=bitstore library code 6 | paragraph= 7 | category=Uncategorized 8 | url=http://www.visualmicro.com 9 | architectures=* -------------------------------------------------------------------------------- /src/_micro-api/libraries/bitstore/src/bitstore.cpp: -------------------------------------------------------------------------------- 1 | #include "bitstore.h" 2 | 3 | -------------------------------------------------------------------------------- /src/_micro-api/libraries/bitstore/src/bitstore.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Library for storing and retrieving multibple bits in one byte 3 | * Copyright (C) 2014-2017 S.Butzek 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | #ifndef BITSTORE_H 20 | #define BITSTORE_H 21 | 22 | #include "Arduino.h" 23 | 24 | 25 | 26 | template 27 | class BitStore 28 | { 29 | public: 30 | /** Default constructor */ 31 | BitStore(uint8_t bitlength); 32 | //~BitStore(); 33 | bool addValue(byte value); 34 | int8_t getValue(const uint16_t pos); 35 | bool moveLeft(const uint16_t begin); 36 | bool changeValue(const uint16_t pos, byte value); 37 | 38 | const uint16_t getSize(); 39 | //unsigned char *datastore; // Reserve 40 Bytes for our store. Should be edited to aa dynamic way 40 | unsigned char datastore[bufSize]; 41 | void reset(); 42 | bool getByte(const uint8_t idx, uint8_t *retvalue); 43 | uint8_t bytecount; // Number of stored bytes 44 | int16_t valcount; // Number of total values stored 45 | 46 | int8_t operator[](const uint16_t pos) { 47 | getValue(pos); 48 | return _rval; 49 | } 50 | BitStore &operator+=(const byte value) { 51 | addValue(value); 52 | return *this; 53 | } 54 | 55 | 56 | 57 | #ifndef UNITTEST 58 | protected: 59 | 60 | private: 61 | #endif 62 | uint8_t valuelen; // Number of bits for every value 63 | uint8_t bmask; 64 | uint8_t bcnt; 65 | const uint8_t buffsize; 66 | byte _rval; 67 | }; 68 | 69 | 70 | /* 71 | * Library for storing and retrieving multibple bits in one byte 72 | * Copyright (C) 2014 S.Butzek 73 | * 74 | * This program is free software: you can redistribute it and/or modify 75 | * it under the terms of the GNU General Public License as published by 76 | * the Free Software Foundation, either version 3 of the License, or 77 | * (at your option) any later version. 78 | * 79 | * This program is distributed in the hope that it will be useful, 80 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 81 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 82 | * GNU General Public License for more details. 83 | * 84 | * You should have received a copy of the GNU General Public License 85 | * along with this program. If not, see . 86 | */ 87 | 88 | template 89 | BitStore::BitStore(uint8_t bitlength) :buffsize(bufSize) 90 | { 91 | valuelen = bitlength; // How many bits shoudl be reserved for one value added ? 92 | bmask = 0; 93 | //buffsize = bufsize; 94 | //datastore= (unsigned char*) calloc(bufsize,sizeof(char)); // Speicher allokieren und 0 zuweisen 95 | //bytecount = bufSize; 96 | reset(); 97 | for (uint8_t x = 7; x>(7 - valuelen); x--) 98 | { 99 | bmask = bmask | (1 << x); 100 | } 101 | } 102 | 103 | /** @brief (one liner) 104 | * 105 | * (documentation goes here) 106 | */ 107 | /*template 108 | BitStore::~BitStore() 109 | { 110 | //free(datastore); 111 | } 112 | */ 113 | template 114 | bool BitStore::addValue(byte value) 115 | { 116 | //byte crcval = value; 117 | 118 | 119 | if (bcnt == 7 && valcount > 0) 120 | { 121 | if (bytecount >= buffsize - 1) { 122 | //Serial.println("OOB"); 123 | //MSG_PRINT(F("bcnt=")); MSG_PRINT(bcnt); 124 | 125 | return false; // Out of Buffer 126 | } 127 | bytecount++; 128 | datastore[bytecount] = 0; 129 | } 130 | 131 | //Serial.print(" av c: "); Serial.print(valcount, DEC); 132 | //Serial.print(" av b: "); Serial.println(bytecount, DEC); 133 | 134 | //Serial.print("Adding value:"); Serial.print(value, DEC); 135 | //Serial.print(" ("); Serial.print(value, BIN); Serial.print(") "); 136 | //store[bytecount]=datastore[bytecount] | (value<0 ) 138 | value <<= (bcnt + 1 - valuelen); 139 | 140 | datastore[bytecount] = datastore[bytecount] | value; // (valcount*valuelen%8) 141 | /* 142 | Serial.print(" at byte: "); Serial.print(bytecount, DEC); 143 | Serial.print(" at bitpos: "); Serial.print(bcnt, DEC); 144 | Serial.print(" datastore is (bin)"); Serial.print(datastore[bytecount], BIN); 145 | Serial.print(" (dec)"); Serial.print(datastore[bytecount], DEC); 146 | Serial.print(" : "); 147 | Serial.print(" (valuelen)"); Serial.print(valuelen, DEC); 148 | */ 149 | 150 | 151 | 152 | valcount++; 153 | if (int8_t(bcnt) - valuelen >= 0) // Soalnge nicht 8 Bit gepeichert wurden, erhoehen wir den counter zum verschieben 154 | { 155 | bcnt = bcnt - valuelen; //+valuelen 156 | } 157 | else { 158 | bcnt = 7; 159 | } 160 | return true; 161 | //Serial.println(""); 162 | } 163 | 164 | 165 | template 166 | bool BitStore::changeValue(const uint16_t pos, byte value) 167 | { 168 | 169 | uint8_t bytepos = pos*valuelen / 8; 170 | /* 171 | Serial.print("Changing value:"); Serial.print(value, DEC); 172 | Serial.print(" ("); Serial.print(value, BIN); Serial.print(")@valpos:"); 173 | Serial.print(pos, DEC); 174 | Serial.print(" @byte: "); Serial.print(bytepos, DEC); 175 | Serial.print(" datastore is (bin)"); Serial.print(datastore[bytepos], BIN); 176 | Serial.print(" (dec)"); Serial.print(datastore[bytepos], DEC); 177 | */ 178 | if ((bytepos) >= buffsize ) return false; // Out of Buffer 179 | // Serial.print("Pos:"); Serial.print(pos, DEC); 180 | // 01 11 11 00 10 181 | 182 | value <<= (8 - (pos*valuelen % 8) - valuelen); // shift bits in value to new positon 183 | //Serial.print(" new_value(bin)"); Serial.print(value, BIN); 184 | 185 | datastore[bytepos] = datastore[bytepos] & ~(bmask >> (pos*valuelen % 8)); // Clear bits to be changed 186 | datastore[bytepos] = datastore[bytepos] | value; // Apply new bits 187 | 188 | /* 189 | Serial.print(" -> "); 190 | Serial.print(" datastore to (bin)"); Serial.print(datastore[bytepos], BIN); 191 | Serial.print(" (valuelen)"); Serial.println(valuelen, DEC); 192 | */ 193 | 194 | return true; 195 | } 196 | 197 | /** @brief (return the last position with a value) 198 | * 199 | * (returns the variable valcount. This represents the number of values ) 200 | */ 201 | 202 | template 203 | const uint16_t BitStore::getSize() 204 | { 205 | return valcount; 206 | } 207 | 208 | template 209 | bool BitStore::moveLeft(const uint16_t begin) 210 | { 211 | if (begin == 0 || begin >= valcount) return false; 212 | if (begin == valcount - 1) 213 | { 214 | reset(); 215 | return true; 216 | } 217 | uint8_t startbyte = begin*valuelen / 8; 218 | //byte crcval = this->getValue(begin); 219 | 220 | //uint8_t offset = 0; 221 | 222 | /* 223 | Serial.print("moveleft startbyte:"); Serial.print(startbyte, DEC); Serial.print("@valpos"); Serial.print(begin, DEC); 224 | Serial.print(" bytecount:"); Serial.print(bytecount, DEC); 225 | Serial.print(" valcount:"); Serial.print(valcount, DEC); 226 | Serial.print(" vlen:"); Serial.print(valuelen, DEC); 227 | */ 228 | 229 | if (begin % (8 / valuelen) != 0) { 230 | uint8_t shift_left = (begin % (8 / valuelen))*valuelen; 231 | uint8_t shift_right = 8 - shift_left; 232 | //Serial.print(" sleft "); Serial.print(shift_left, DEC); Serial.print(" sright"); Serial.print(shift_right, DEC); 233 | 234 | uint8_t i = startbyte; 235 | uint8_t z = 0; 236 | for (; i < bytecount; ++i, ++z) 237 | { 238 | /* 239 | Serial.println(""); 240 | Serial.print("@["); Serial.print(i, DEC); Serial.print("]"); 241 | Serial.print("->["); Serial.print(z, DEC); Serial.print("] "); 242 | 243 | Serial.print("z="); Serial.print(datastore[z], BIN); 244 | Serial.print(" ileft="); Serial.print(char(datastore[i] << shift_left), BIN); 245 | Serial.print(" iright="); Serial.print(char(datastore[i + 1] >> shift_right), BIN); 246 | */ 247 | datastore[z] = char(datastore[i] << shift_left) | char(datastore[i + 1] >> shift_right);; 248 | 249 | } 250 | 251 | /* 252 | * if (valcount % 2 == 0) //Wenn valcount auf eine gerade Zahl faellt, brauchen wir noch eine Zuweisung 253 | * is 48 bytes bigger 254 | */ 255 | 256 | if ( (valcount & 1) == 0) //Wenn valcount auf eine gerade Zahl fällt, brauchen wir noch eine Zuweisung 257 | { 258 | datastore[z] = datastore[i] << shift_left; 259 | /* 260 | Serial.println(""); 261 | Serial.print("@["); Serial.print(i, DEC); Serial.print("]"); 262 | Serial.print("->["); Serial.print(z, DEC); Serial.print("] "); 263 | Serial.print("z="); Serial.print(datastore[z], BIN); 264 | */ 265 | } 266 | valcount = valcount - begin; 267 | uint8_t val_bcnt = (valcount*valuelen) % 8; 268 | if (val_bcnt > 0) 269 | bcnt = 7 - val_bcnt; 270 | else 271 | bcnt = 7; 272 | bytecount = (valcount - 1)*valuelen / 8; 273 | 274 | //bcnt = 7-shift_left; 275 | 276 | //bcnt = bcnt - valuelen; // Todo: Klären ob dies benötigt wird 277 | //offset = 1; 278 | } 279 | else { 280 | /* 281 | Serial.println(" memmove: "); 282 | Serial.print(" begin="); Serial.print(begin, DEC); 283 | Serial.print(" bc="); Serial.print(bytecount, DEC); 284 | Serial.print(" vc="); Serial.print(valcount, DEC); 285 | */ 286 | bytecount = bytecount - startbyte; 287 | memmove(datastore, datastore + startbyte, sizeof(datastore[0]) * (bytecount + 1)); 288 | //bcnt = 7; 289 | valcount = valcount - (8 / valuelen*startbyte); 290 | /* 291 | Serial.print(" after: bc="); Serial.print(bytecount, DEC); 292 | Serial.print(" vc="); Serial.print(valcount, DEC); 293 | */ 294 | 295 | } 296 | /* 297 | Serial.print(" after moveLeft "); Serial.print(" vc: "); Serial.print(valcount, DEC); 298 | Serial.print(" bytec: "); Serial.print(bytecount, DEC); 299 | Serial.print(" bitpos: "); Serial.print(bcnt, DEC); 300 | Serial.print(" datastore is (bin)"); Serial.print(datastore[bytecount], BIN); 301 | Serial.print(" (dec)"); Serial.print(datastore[bytecount], DEC); 302 | */ 303 | /* 304 | if (crcval != this->getValue(0)) { 305 | Serial.print(" "); Serial.print(crcval, DEC); Serial.print(" <> "); Serial.print(this->getValue(0), DEC); 306 | } 307 | */ 308 | /* 309 | Serial.print(" bcnt: "); Serial.print(bcnt, DEC); 310 | Serial.print(" valcount: "); Serial.print(valcount, DEC); 311 | Serial.print(" bytecount: "); Serial.print(bytecount, DEC); 312 | Serial.println(" "); 313 | */ 314 | 315 | return true; 316 | } 317 | 318 | template 319 | int8_t BitStore::getValue(const uint16_t pos) 320 | { 321 | int16_t bytepos = pos*valuelen / 8; 322 | if ((bytepos) >= buffsize ) return -1; // Out of Buffer 323 | //Serial.print("getValue Pos:"); Serial.print(pos, DEC); 324 | 325 | uint8_t mask; // Local modified bitmask 326 | //ret= (datastore[pos*valuelen/8]>>(pos*valuelen%8))&bmask; 327 | mask = bmask >> (pos*valuelen % 8); //Mask the position we want to retrieve 328 | //Serial.print(" Bitmask:"); Serial.print(mask, BIN); 329 | 330 | _rval = datastore[bytepos] & mask; // Combine the mask with our store to extract the bit 331 | 332 | byte scnt = 8 - (valuelen*(pos) % 8) - valuelen;// ((pos + 1)*valuelen % 8); // pos*valuelen 0*1/1*1/2*1/../7*1 7/6/5/0 8-1 8-2 8-3 8-8 333 | //byte scnt = ((pos+1)*valuelen % 8); // 0*4/1*4 334 | //Serial.print(" datastore[bytepos]: ("); Serial.print(_rval, DEC); Serial.print(") "); Serial.println(_rval, BIN); 335 | //Serial.print(" shift:"); Serial.print(scnt, DEC); 336 | 337 | //_rval = _rval >> abs(8 - (pos + 1)*valuelen) % 8;//(pos + 1)*valuelen % 8; 338 | _rval = _rval >> scnt; 339 | //Serial.print(" return: ("); Serial.print(_rval, DEC); Serial.print(") "); Serial.println(_rval, BIN); 340 | 341 | return _rval; 342 | } 343 | 344 | template 345 | bool BitStore::getByte(const uint8_t idx,uint8_t *retvalue) 346 | { 347 | if (idx >= buffsize ) return false; // Out of buffer range 348 | *retvalue =datastore[idx]; 349 | return true; 350 | } 351 | 352 | template 353 | void BitStore::reset() 354 | { 355 | /*for (uint8_t i = 0; i < bytecount; i++) 356 | { 357 | datastore[i] = 0; 358 | }*/ 359 | datastore[0] = 0; 360 | bytecount = 0; 361 | valcount = 0; 362 | bcnt = 7; 363 | 364 | //Serial.print("_bsres:"); Serial.print(valuelen); Serial.print("_"); 365 | } 366 | #endif // BITSTORE_H 367 | -------------------------------------------------------------------------------- /src/_micro-api/libraries/fastdelegate/examples/Demo.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "FastDelegate.h" 3 | // Demonstrate the syntax for FastDelegates. 4 | // -Don Clugston, May 2004. 5 | // It's a really boring example, but it shows the most important cases. 6 | 7 | // Declare some functions of varying complexity... 8 | void SimpleStaticFunction(int num, char *str) { 9 | printf("In SimpleStaticFunction. Num=%d, str = %s\n", num, str); 10 | } 11 | 12 | void SimpleVoidFunction() { 13 | printf("In SimpleVoidFunction with no parameters.\n"); 14 | } 15 | 16 | class CBaseClass { 17 | protected: 18 | char *m_name; 19 | public: 20 | CBaseClass(char *name) : m_name(name) {}; 21 | void SimpleMemberFunction(int num, char *str) { 22 | printf("In SimpleMemberFunction in %s. Num=%d, str = %s\n", m_name, num, str); } 23 | int SimpleMemberFunctionReturnsInt(int num, char *str) { 24 | printf("In SimpleMemberFunction in %s. Num=%d, str = %s\n", m_name, num, str); return -1; } 25 | void ConstMemberFunction(int num, char *str) const { 26 | printf("In ConstMemberFunction in %s. Num=%d, str = %s\n", m_name, num, str); } 27 | virtual void SimpleVirtualFunction(int num, char *str) { 28 | printf("In SimpleVirtualFunction in %s. Num=%d, str = %s\n", m_name, num, str); } 29 | static void StaticMemberFunction(int num, char *str) { 30 | printf("In StaticMemberFunction. Num=%d, str =%s\n", num, str); } 31 | }; 32 | 33 | class COtherClass { 34 | double rubbish; // to ensure this class has non-zero size. 35 | public: 36 | virtual void UnusedVirtualFunction(void) { } 37 | virtual void TrickyVirtualFunction(int num, char *str)=0; 38 | }; 39 | 40 | class VeryBigClass { 41 | int letsMakeThingsComplicated[400]; 42 | }; 43 | 44 | // This declaration ensures that we get a convoluted class heirarchy. 45 | class CDerivedClass : public VeryBigClass, virtual public COtherClass, virtual public CBaseClass 46 | { 47 | double m_somemember[8]; 48 | public: 49 | CDerivedClass() : CBaseClass("Base of Derived") { m_somemember[0]=1.2345; } 50 | void SimpleDerivedFunction(int num, char *str) { printf("In SimpleDerived. num=%d\n", num); } 51 | virtual void AnotherUnusedVirtualFunction(int num, char *str) {} 52 | virtual void TrickyVirtualFunction(int num, char *str) { 53 | printf("In Derived TrickyMemberFunction. Num=%d, str = %s\n", num, str); 54 | } 55 | }; 56 | 57 | using namespace fastdelegate; 58 | 59 | int main(void) 60 | { 61 | // Delegates with up to 8 parameters are supported. 62 | // Here's the case for a void function. 63 | // We declare a delegate and attach it to SimpleVoidFunction() 64 | printf("-- FastDelegate demo --\nA no-parameter delegate is declared using FastDelegate0\n\n"); 65 | 66 | FastDelegate0<> noparameterdelegate(&SimpleVoidFunction); 67 | 68 | noparameterdelegate(); // invoke the delegate - this calls SimpleVoidFunction() 69 | 70 | printf("\n-- Examples using two-parameter delegates (int, char *) --\n\n"); 71 | 72 | // By default, the return value is void. 73 | typedef FastDelegate2 MyDelegate; 74 | 75 | // If you want to have a non-void return value, put it at the end. 76 | typedef FastDelegate2 IntMyDelegate; 77 | 78 | 79 | MyDelegate funclist[12]; // delegates are initialized to empty 80 | CBaseClass a("Base A"); 81 | CBaseClass b("Base B"); 82 | CDerivedClass d; 83 | CDerivedClass c; 84 | 85 | IntMyDelegate newdeleg; 86 | newdeleg = MakeDelegate(&a, &CBaseClass::SimpleMemberFunctionReturnsInt); 87 | 88 | // Binding a simple member function 89 | funclist[0].bind(&a, &CBaseClass::SimpleMemberFunction); 90 | 91 | // You can also bind static (free) functions 92 | funclist[1].bind(&SimpleStaticFunction); 93 | // and static member functions 94 | funclist[2].bind(&CBaseClass::StaticMemberFunction); 95 | // and const member functions (these only need a const class pointer). 96 | funclist[11].bind( (const CBaseClass *)&a, &CBaseClass::ConstMemberFunction); 97 | funclist[3].bind( &a, &CBaseClass::ConstMemberFunction); 98 | // and virtual member functions 99 | funclist[4].bind(&b, &CBaseClass::SimpleVirtualFunction); 100 | 101 | // You can also use the = operator. For static functions, a fastdelegate 102 | // looks identical to a simple function pointer. 103 | funclist[5] = &CBaseClass::StaticMemberFunction; 104 | 105 | // The weird rule about the class of derived member function pointers is avoided. 106 | // For MSVC, you can use &CDerivedClass::SimpleVirtualFunction here, but DMC will complain. 107 | // Note that as well as .bind(), you can also use the MakeDelegate() 108 | // global function. 109 | funclist[6] = MakeDelegate(&d, &CBaseClass::SimpleVirtualFunction); 110 | 111 | // The worst case is an abstract virtual function of a virtually-derived class 112 | // with at least one non-virtual base class. This is a VERY obscure situation, 113 | // which you're unlikely to encounter in the real world. 114 | // FastDelegate versions prior to 1.3 had problems with this case on VC6. 115 | // Now, it works without problems on all compilers. 116 | funclist[7].bind(&c, &CDerivedClass::TrickyVirtualFunction); 117 | // BUT... in such cases you should be using the base class as an 118 | // interface, anyway. 119 | funclist[8].bind(&c, &COtherClass::TrickyVirtualFunction); 120 | // Calling a function that was first declared in the derived class is straightforward 121 | funclist[9] = MakeDelegate(&c, &CDerivedClass::SimpleDerivedFunction); 122 | 123 | // You can also bind directly using the constructor 124 | MyDelegate dg(&b, &CBaseClass::SimpleVirtualFunction); 125 | 126 | char *msg = "Looking for equal delegate"; 127 | for (int i=0; i<12; i++) { 128 | printf("%d :", i); 129 | // The == and != operators are provided 130 | // Note that they work even for inline functions. 131 | if (funclist[i]==dg) { msg = "Found equal delegate"; }; 132 | // operator ! can be used to test for an empty delegate 133 | // You can also use the .empty() member function. 134 | if (!funclist[i]) { 135 | printf("Delegate is empty\n"); 136 | } else { 137 | // Invocation generates optimal assembly code. 138 | funclist[i](i, msg); 139 | }; 140 | } 141 | return 0; 142 | } 143 | 144 | -------------------------------------------------------------------------------- /src/_micro-api/libraries/fastdelegate/library.properties: -------------------------------------------------------------------------------- 1 | name=fastdelegate 2 | version=1.0.0 3 | author=Don Clugston, 4 | maintainer=Don Clugston 5 | sentence=fastdelegate 6 | paragraph= 7 | category=Uncategorized 8 | url=https://www.codeproject.com/articles/7150/member-function-pointers-and-the-fastest-possible 9 | architectures=* -------------------------------------------------------------------------------- /src/_micro-api/libraries/fastdelegate/src/FastDelegateBind.h: -------------------------------------------------------------------------------- 1 | // FastDelegateBind.h 2 | // Helper file for FastDelegates. Provides bind() function, enabling 3 | // FastDelegates to be rapidly compared to programs using boost::function and boost::bind. 4 | // 5 | // Documentation is found at http://www.codeproject.com/cpp/FastDelegate.asp 6 | // 7 | // Original author: Jody Hagins. 8 | // Minor changes by Don Clugston. 9 | // 10 | // Warning: The arguments to 'bind' are ignored! No actual binding is performed. 11 | // The behaviour is equivalent to boost::bind only when the basic placeholder 12 | // arguments _1, _2, _3, etc are used in order. 13 | // 14 | // HISTORY: 15 | // 1.4 Dec 2004. Initial release as part of FastDelegate 1.4. 16 | 17 | 18 | #ifndef FASTDELEGATEBIND_H 19 | #define FASTDELEGATEBIND_H 20 | #if _MSC_VER > 1000 21 | #pragma once 22 | #endif // _MSC_VER > 1000 23 | 24 | //////////////////////////////////////////////////////////////////////////////// 25 | // FastDelegate bind() 26 | // 27 | // bind() helper function for boost compatibility. 28 | // (Original author: Jody Hagins). 29 | // 30 | // Add another helper, so FastDelegate can be a dropin replacement 31 | // for boost::bind (in a fair number of cases). 32 | // Note the elipses, because boost::bind() takes place holders 33 | // but FastDelegate does not care about them. Getting the place holder 34 | // mechanism to work, and play well with boost is a bit tricky, so 35 | // we do the "easy" thing... 36 | // Assume we have the following code... 37 | // using boost::bind; 38 | // bind(&Foo:func, &foo, _1, _2); 39 | // we should be able to replace the "using" with... 40 | // using fastdelegate::bind; 41 | // and everything should work fine... 42 | //////////////////////////////////////////////////////////////////////////////// 43 | 44 | #ifdef FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX 45 | 46 | namespace fastdelegate { 47 | 48 | //N=0 49 | template 50 | FastDelegate< RetType ( ) > 51 | bind( 52 | RetType (X::*func)( ), 53 | Y * y, 54 | ...) 55 | { 56 | return FastDelegate< RetType ( ) >(y, func); 57 | } 58 | 59 | template 60 | FastDelegate< RetType ( ) > 61 | bind( 62 | RetType (X::*func)( ) const, 63 | Y * y, 64 | ...) 65 | { 66 | return FastDelegate< RetType ( ) >(y, func); 67 | } 68 | 69 | //N=1 70 | template 71 | FastDelegate< RetType ( Param1 p1 ) > 72 | bind( 73 | RetType (X::*func)( Param1 p1 ), 74 | Y * y, 75 | ...) 76 | { 77 | return FastDelegate< RetType ( Param1 p1 ) >(y, func); 78 | } 79 | 80 | template 81 | FastDelegate< RetType ( Param1 p1 ) > 82 | bind( 83 | RetType (X::*func)( Param1 p1 ) const, 84 | Y * y, 85 | ...) 86 | { 87 | return FastDelegate< RetType ( Param1 p1 ) >(y, func); 88 | } 89 | 90 | //N=2 91 | template 92 | FastDelegate< RetType ( Param1 p1, Param2 p2 ) > 93 | bind( 94 | RetType (X::*func)( Param1 p1, Param2 p2 ), 95 | Y * y, 96 | ...) 97 | { 98 | return FastDelegate< RetType ( Param1 p1, Param2 p2 ) >(y, func); 99 | } 100 | 101 | template 102 | FastDelegate< RetType ( Param1 p1, Param2 p2 ) > 103 | bind( 104 | RetType (X::*func)( Param1 p1, Param2 p2 ) const, 105 | Y * y, 106 | ...) 107 | { 108 | return FastDelegate< RetType ( Param1 p1, Param2 p2 ) >(y, func); 109 | } 110 | 111 | //N=3 112 | template 113 | FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3 ) > 114 | bind( 115 | RetType (X::*func)( Param1 p1, Param2 p2, Param3 p3 ), 116 | Y * y, 117 | ...) 118 | { 119 | return FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3 ) >(y, func); 120 | } 121 | 122 | template 123 | FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3 ) > 124 | bind( 125 | RetType (X::*func)( Param1 p1, Param2 p2, Param3 p3 ) const, 126 | Y * y, 127 | ...) 128 | { 129 | return FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3 ) >(y, func); 130 | } 131 | 132 | //N=4 133 | template 134 | FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ) > 135 | bind( 136 | RetType (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ), 137 | Y * y, 138 | ...) 139 | { 140 | return FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ) >(y, func); 141 | } 142 | 143 | template 144 | FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ) > 145 | bind( 146 | RetType (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ) const, 147 | Y * y, 148 | ...) 149 | { 150 | return FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ) >(y, func); 151 | } 152 | 153 | //N=5 154 | template 155 | FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ) > 156 | bind( 157 | RetType (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ), 158 | Y * y, 159 | ...) 160 | { 161 | return FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ) >(y, func); 162 | } 163 | 164 | template 165 | FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ) > 166 | bind( 167 | RetType (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ) const, 168 | Y * y, 169 | ...) 170 | { 171 | return FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ) >(y, func); 172 | } 173 | 174 | //N=6 175 | template 176 | FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ) > 177 | bind( 178 | RetType (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ), 179 | Y * y, 180 | ...) 181 | { 182 | return FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ) >(y, func); 183 | } 184 | 185 | template 186 | FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ) > 187 | bind( 188 | RetType (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ) const, 189 | Y * y, 190 | ...) 191 | { 192 | return FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ) >(y, func); 193 | } 194 | 195 | //N=7 196 | template 197 | FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ) > 198 | bind( 199 | RetType (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ), 200 | Y * y, 201 | ...) 202 | { 203 | return FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ) >(y, func); 204 | } 205 | 206 | template 207 | FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ) > 208 | bind( 209 | RetType (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ) const, 210 | Y * y, 211 | ...) 212 | { 213 | return FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ) >(y, func); 214 | } 215 | 216 | //N=8 217 | template 218 | FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ) > 219 | bind( 220 | RetType (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ), 221 | Y * y, 222 | ...) 223 | { 224 | return FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ) >(y, func); 225 | } 226 | 227 | template 228 | FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ) > 229 | bind( 230 | RetType (X::*func)( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ) const, 231 | Y * y, 232 | ...) 233 | { 234 | return FastDelegate< RetType ( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7, Param8 p8 ) >(y, func); 235 | } 236 | 237 | 238 | #endif //FASTDELEGATE_ALLOW_FUNCTION_TYPE_SYNTAX 239 | 240 | } // namespace fastdelegate 241 | 242 | #endif // !defined(FASTDELEGATEBIND_H) 243 | 244 | -------------------------------------------------------------------------------- /src/_micro-api/libraries/output/library.properties: -------------------------------------------------------------------------------- 1 | name=output 2 | version=1.0.1 3 | author=Visual Micro 4 | maintainer=Visual Micro 5 | sentence=output library code 6 | paragraph= 7 | category=Uncategorized 8 | url=http://www.visualmicro.com 9 | architectures=* -------------------------------------------------------------------------------- /src/_micro-api/libraries/output/src/output.h: -------------------------------------------------------------------------------- 1 | // output.h 2 | #ifndef _OUTPUT_h 3 | #define _OUTPUT_h 4 | 5 | /* 6 | * different debug options 7 | * DEBUG variable must be set separately if the library is used alone without SIGNALduino project 8 | * file output.h worked with DEBUG variable 9 | */ 10 | 11 | //#define DEBUG 0 12 | 13 | /* 14 | * END debug options selection 15 | */ 16 | 17 | #ifdef CMP_CC1101 18 | static const char TXT_CC1101[] PROGMEM = "cc1101 "; 19 | static const char TXT_CC110[] PROGMEM = "CC110"; 20 | static const char TXT_CCFACTORYRESET[] PROGMEM = "ccFactoryReset done"; 21 | static const char TXT_CCINIT[] PROGMEM = "CCInit "; 22 | static const char TXT_CCmode[] PROGMEM = "ccmode"; 23 | static const char TXT_CHIP[] PROGMEM = "chip"; 24 | static const char TXT_csPin[] PROGMEM = "csPin"; 25 | static const char TXT_misoPin[] PROGMEM = "misoPin"; 26 | static const char TXT_mosiPin[] PROGMEM = "mosiPin"; 27 | static const char TXT_sckPin[] PROGMEM = "sckPin"; 28 | #endif 29 | 30 | #ifdef DEBUG 31 | static const char TXT_CCPARTNUM[] PROGMEM = "CCPartnum ="; 32 | static const char TXT_CCREVISION[] PROGMEM = "CCVersion = "; 33 | static const char TXT_VALUEFROM[] PROGMEM = "Reading values from "; 34 | #endif 35 | 36 | static const char TXT_433[] PROGMEM = "433 "; 37 | static const char TXT_868[] PROGMEM = "868 "; 38 | static const char TXT_BLANK[] PROGMEM = " "; 39 | static const char TXT_COMMAND[] PROGMEM = "command e"; 40 | static const char TXT_CORRUPT[] PROGMEM = "corrupt"; 41 | static const char TXT_DOFRESET[] PROGMEM = "is not correctly set for ASK/OOK. Please do a factory reset via "; 42 | static const char TXT_DOT[] PROGMEM = "."; 43 | static const char TXT_EEPROM[] PROGMEM = "EEPROM"; 44 | static const char TXT_EEPROMINIT[] PROGMEM = "Init EEPROM to defaults after flash"; 45 | static const char TXT_EQ[] PROGMEM = "="; 46 | static const char TXT_FOUND[] PROGMEM = "found "; 47 | static const char TXT_FSEP[] PROGMEM = ";"; 48 | static const char TXT_MC[] PROGMEM = "MC"; 49 | static const char TXT_MHZ[] PROGMEM = "Mhz"; 50 | static const char TXT_MS[] PROGMEM = "MS"; 51 | static const char TXT_MU[] PROGMEM = "MU"; 52 | static const char TXT_READ[] PROGMEM = "read "; 53 | static const char TXT_RECENA[] PROGMEM = "receiver enabled" ; 54 | static const char TXT_SENDCMD[] PROGMEM = "send cmd "; 55 | static const char TXT_TOLONG[] PROGMEM = "to long "; 56 | static const char TXT_TPATAB[] PROGMEM = " to PATABLE done"; 57 | static const char TXT_UNSUPPORTED1[] PROGMEM = "Unsupported short command"; 58 | static const char TXT_WRITE[] PROGMEM = "write "; 59 | 60 | 61 | #if !defined(ESP8266) && !defined(ESP32) 62 | 63 | #define FPSTR(s) ((__FlashStringHelper*)(s)) 64 | 65 | #ifdef ARDUINO_RADINOCC1101 66 | #define portOfPin(P) \ 67 | ((((P) >= 0 && (P) <= 4) || (P) == 6 || (P) == 12 || (P) == 24 || (P) == 25 || (P) == 29) ? &PORTD : (((P) == 5 || (P) == 13) ? &PORTC : (((P) >= 18 && (P) <= 23)) ? &PORTF : (((P) == 7) ? &PORTE : &PORTB))) 68 | #define ddrOfPin(P) \ 69 | ((((P) >= 0 && (P) <= 4) || (P) == 6 || (P) == 12 || (P) == 24 || (P) == 25 || (P) == 29) ? &DDRD : (((P) == 5 || (P) == 13) ? &DDRC : (((P) >= 18 && (P) <= 23)) ? &DDRF : (((P) == 7) ? &DDRE : &DDRB))) 70 | #define pinOfPin(P) \ 71 | ((((P) >= 0 && (P) <= 4) || (P) == 6 || (P) == 12 || (P) == 24 || (P) == 25 || (P) == 29) ? &PIND : (((P) == 5 || (P) == 13) ? &PINC : (((P) >= 18 && (P) <= 23)) ? &PINF : (((P) == 7) ? &PINE : &PINB))) 72 | #define pinIndex(P) \ 73 | (((P) >= 8 && (P) <= 11) ? (P) - 4 : (((P) >= 18 && (P) <= 21) ? 25 - (P) : (((P) == 0) ? 2 : (((P) == 1) ? 3 : (((P) == 2) ? 1 : (((P) == 3) ? 0 : (((P) == 4) ? 4 : (((P) == 6) ? 7 : (((P) == 13) ? 7 : (((P) == 14) ? 3 : (((P) == 15) ? 1 : (((P) == 16) ? 2 : (((P) == 17) ? 0 : (((P) == 22) ? 1 : (((P) == 23) ? 0 : (((P) == 24) ? 4 : (((P) == 25) ? 7 : (((P) == 26) ? 4 : (((P) == 27) ? 5 : 6 ))))))))))))))))))) 74 | #else 75 | #ifndef ARDUINO_MAPLEMINI_F103CB 76 | #define portOfPin(P)\ 77 | (((P)>=0&&(P)<8)?&PORTD:(((P)>7&&(P)<14)?&PORTB:&PORTC)) 78 | #define ddrOfPin(P)\ 79 | (((P)>=0&&(P)<8)?&DDRD:(((P)>7&&(P)<14)?&DDRB:&DDRC)) 80 | #define pinOfPin(P)\ 81 | (((P)>=0&&(P)<8)?&PIND:(((P)>7&&(P)<14)?&PINB:&PINC)) 82 | #define pinIndex(P)((uint8_t)(P>13?P-14:P&7)) 83 | #else 84 | #define pinAsInput(pin) pinMode(pin, INPUT) 85 | #define pinAsOutput(pin) pinMode(pin, OUTPUT) 86 | #define pinAsInputPullUp(pin) pinMode(pin, INPUT_PULLUP) 87 | #define digitalLow(pin) digitalWrite(pin, LOW) 88 | #define digitalHigh(pin) digitalWrite(pin, HIGH) 89 | #define isHigh(pin) (digitalRead(pin) == HIGH) 90 | #define isLow(pin) (digitalRead(pin) == LOW) 91 | #endif 92 | #endif 93 | 94 | #if defined(WIN32) || defined(__linux__) 95 | #define digitalLow(P) pinMode(P,LOW) 96 | #define digitalHigh(P) pinMode(P,HIGH) 97 | #else 98 | #ifndef ARDUINO_MAPLEMINI_F103CB 99 | #define pinMask(P)((uint8_t)(1<0) 106 | #define isLow(P)((*(pinOfPin(P))& pinMask(P))==0) 107 | #define digitalState(P)((uint8_t)isHigh(P)) 108 | #endif 109 | #endif 110 | #else 111 | #define pinAsInput(pin) pinMode(pin, INPUT) 112 | #define pinAsOutput(pin) pinMode(pin, OUTPUT) 113 | #define pinAsInputPullUp(pin) pinMode(pin, INPUT_PULLUP) 114 | 115 | #ifndef digitalLow 116 | #define digitalLow(pin) digitalWrite(pin, LOW) 117 | #endif 118 | #ifndef digitalHigh 119 | #define digitalHigh(pin) digitalWrite(pin, HIGH) 120 | #endif 121 | #ifndef isHigh 122 | #define isHigh(pin) (digitalRead(pin) == HIGH) 123 | #endif 124 | #ifndef isLow 125 | #define isLow(pin) (digitalRead(pin) == LOW) 126 | #endif 127 | 128 | #endif 129 | 130 | 131 | 132 | #if defined(ARDUINO) && ARDUINO >= 100 133 | #include "Arduino.h" 134 | #else 135 | // #include "WProgram.h" 136 | #endif 137 | 138 | #ifdef ETHERNET_PRINT 139 | #include 140 | extern WiFiClient serverClient; 141 | #define MSG_PRINTER serverClient 142 | #else 143 | #define MSG_PRINTER Serial 144 | #endif 145 | 146 | 147 | #ifdef ETHERNET_DEBUG // variable is not defined 148 | #define DBG_PRINTER Client // now used ??? 149 | #else 150 | #define DBG_PRINTER Serial 151 | #endif 152 | 153 | 154 | #define MSG_PRINT(...) { MSG_PRINTER.print(__VA_ARGS__); } 155 | #define MSG_PRINTLN(...) { MSG_PRINTER.println(__VA_ARGS__); } 156 | #define MSG_WRITE(...) { MSG_PRINTER.write(__VA_ARGS__); } 157 | 158 | #ifdef DEBUG 159 | #define DBG_PRINT(...) { DBG_PRINTER.print(__VA_ARGS__); } 160 | #define DBG_PRINTLN(...) { DBG_PRINTER.println(__VA_ARGS__); } 161 | #else 162 | #define DBG_PRINT(...) 163 | #define DBG_PRINTLN(...) 164 | #endif 165 | 166 | 167 | 168 | #endif 169 | -------------------------------------------------------------------------------- /src/_micro-api/libraries/signalDecoder/library.properties: -------------------------------------------------------------------------------- 1 | name=signaldecoder 2 | version=1.1.0 3 | author=Visual Micro 4 | maintainer=Visual Micro 5 | sentence=signaldecoder library code 6 | paragraph= 7 | category=Uncategorized 8 | url=http://www.visualmicro.com 9 | architectures=* -------------------------------------------------------------------------------- /src/_micro-api/libraries/signalDecoder/src/signalDecoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Pattern Decoder Library V3 3 | * Library to decode radio signals based on patternd detection 4 | * 2014-2015 N.Butzek, S.Butzek 5 | * 2015-2018 S.Butzek 6 | * 2018-2020 S.Butzek, HomeAutoUser 7 | 8 | * This library contains different classes to perform detecting of digital signals 9 | * typical for home automation. The focus for the moment is on different sensors 10 | * like weather sensors (temperature, humidity Logilink, TCM, Oregon Scientific, ...), 11 | * remote controlled power switches (Intertechno, TCM, ARCtech, ...) which use 12 | * encoder chips like PT2262 and EV1527-type and manchester encoder to send 13 | * information in the 433MHz or 868 Mhz Band. 14 | * 15 | * The classes in this library follow the approach to detect a recurring pattern in the 16 | * recived signal. For Manchester there is a class which decodes the signal. 17 | * 18 | * This program is free software: you can redistribute it and/or modify 19 | * it under the terms of the GNU General Public License as published by 20 | * the Free Software Foundation, either version 3 of the License, or 21 | * (at your option) any later version. 22 | * 23 | * This program is distributed in the hope that it will be useful, 24 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | * GNU General Public License for more details. 27 | * 28 | * You should have received a copy of the GNU General Public License 29 | * along with this program. If not, see . 30 | 31 | */ 32 | 33 | 34 | #ifndef _SIGNALDECODER_h 35 | #define _SIGNALDECODER_h 36 | 37 | 38 | #if defined(WIN32) || defined(__linux__) /* ** for which variant or system is this required? ** */ 39 | #define ARDUINO 101 40 | #define NOSTRING 41 | #endif 42 | 43 | #if defined(__linux__) 44 | #include 45 | #endif 46 | 47 | #ifndef DEC 48 | #define DEC 10 49 | #endif 50 | 51 | #if defined(ARDUINO) && ARDUINO >= 100 52 | #include "Arduino.h" 53 | #else 54 | //#include "WProgram.h" 55 | #endif 56 | 57 | 58 | /* 59 | * different debug options 60 | * DEBUG variable must be set separately if the library is used alone without SIGNALduino project 61 | * file signalDecoder.h worked with DEBUG, DEBUGDETECT, DEBUGDECODE variable 62 | */ 63 | 64 | //#define DEBUG 0 65 | 66 | /* all variations DEBUGDETECT | output serial */ 67 | //#define DEBUGDETECT 0 68 | //#define DEBUGDETECT 1 69 | //#define DEBUGDETECT 2 70 | //#define DEBUGDETECT 3 71 | //#define DEBUGDETECT 255 /* very verbose output */ // ->> ESP8266, >>>stack>>> error 72 | 73 | /* all variations DEBUGDECODE | output serial */ 74 | //#define DEBUGDECODE 1 75 | //#define DEBUGDECODE 255 /* very verbose output */ 76 | 77 | /* 78 | * END debug options selection 79 | */ 80 | 81 | #if defined(DEBUGDETECT) || defined(DEBUGDECODE) 82 | #define DEBUG 1 83 | #endif 84 | 85 | #ifdef _COMPILE_CONFIG_h /* to break Dependency, _COMPILE_CONFIG_h is only available in the SIGNALduino project */ 86 | #ifdef PLATFORMIO /* intern variable only in software PlatformIO (example 40304), in Arduino IDE undef */ 87 | #include "../../../../compile_config.h" /* PlatformIO - need for right options in output.h */ 88 | #else 89 | #include "compile_config.h" /* Arduino IDE - need for right options in output.h */ 90 | #endif 91 | #endif 92 | 93 | #ifndef WIFI_ESP /* variable is not defined, where is this used ??? */ 94 | #include "output.h" /* Dependency is needed */ 95 | #else 96 | /* 97 | * this code no needed, variable WIFI_ESP not defined 98 | * 99 | * #include 100 | * extern WiFiClient serverClient; 101 | * #define DBG_PRINTER Serial 102 | * #define DBG_PRINT(...) { DBG_PRINTER.print(__VA_ARGS__); } 103 | * #define DBG_PRINTLN(...) { DBG_PRINTER.println(__VA_ARGS__); } 104 | */ 105 | #endif 106 | 107 | /* for Unittest - output object over callback */ 108 | #define SDC_PRINT(...) write(__VA_ARGS__) 109 | #define SDC_WRITE(b) write((const uint8_t*)b,(uint8_t) 1) 110 | #define SDC_PRINTLN(...) write(__VA_ARGS__); write(char(0xA)); 111 | 112 | #ifndef F 113 | #define F(V1) V1 114 | #endif 115 | 116 | #include "bitstore.h" /* Dependency is needed */ 117 | #include "FastDelegate.h" /* Dependency is needed */ 118 | 119 | #define maxNumPattern 8 120 | #define maxMsgSize 254 121 | #define minMessageLen 40 122 | #define syncMinFact 6 123 | #define syncMaxFact 44 124 | #define syncMaxMicros 17000 125 | #define maxPulse 32001 // Magic Pulse Length 126 | 127 | constexpr const uint8_t SERIAL_DELIMITER = 59; 128 | constexpr const uint8_t MSG_START = 2; 129 | constexpr const uint8_t MSG_END = 3; 130 | 131 | //#define SERIAL_DELIMITER 59 //char(';') 132 | //#define MSG_START char(0x2) // this is a non printable Char 133 | //#define MSG_END char(0x3) // this is a non printable Char 134 | 135 | enum status { searching, clockfound, syncfound, detecting, mcdecoding }; 136 | 137 | char* myitoa(int num, char* str); // selfmade myitoa function 138 | 139 | class ManchesterpatternDecoder; 140 | class SignalDetectorClass; 141 | 142 | class SignalDetectorClass 143 | { 144 | friend class ManchesterpatternDecoder; 145 | 146 | public: 147 | SignalDetectorClass() : first(buffer), last(nullptr), message(4) { 148 | buffer[0] = 0; reset(); mcMinBitLen = 17; 149 | MsMoveCount = 0; 150 | MredEnabled = 1; // 1 = compress printmsg 151 | mcdecoder = nullptr; 152 | }; 153 | 154 | void reset(); 155 | bool decode(const int* pulse); 156 | const status getState(); 157 | typedef fastdelegate::FastDelegate0 FuncRetuint8t; 158 | typedef fastdelegate::FastDelegate2 Func2pRetuint8t; 159 | 160 | void setRSSICallback(FuncRetuint8t callbackfunction) { _rssiCallback = callbackfunction; } 161 | void setStreamCallback(Func2pRetuint8t callbackfunction) { _streamCallback = callbackfunction; } 162 | 163 | //private: 164 | void SDC_PRINT_intToHex(unsigned int numberToPrint); 165 | 166 | int8_t clock; // index to clock in pattern 167 | bool MUenabled; 168 | bool MCenabled; 169 | bool MSenabled; 170 | bool MredEnabled; // 1 = compress printMsgRaw 171 | uint8_t MsMoveCount; 172 | 173 | uint8_t histo[maxNumPattern]; 174 | //uint8_t message[maxMsgSize]; 175 | ManchesterpatternDecoder *mcdecoder; // Pointer to mcdecoder object 176 | 177 | uint8_t messageLen; // Todo, kann durch message.valcount ersetzt werden 178 | uint8_t mstart; // Holds starting point for message 179 | uint8_t mend; // Holds end point for message if detected 180 | bool success; // True if a valid coding was found 181 | bool m_truncated; // Identify if message has been truncated 182 | bool m_overflow; 183 | void bufferMove(const uint8_t start); 184 | 185 | uint16_t tol; // calculated tolerance for signal 186 | //uint8_t bitcnt; 187 | status state; // holds the status of the detector 188 | int buffer[2]; // Internal buffer to store two pules length 189 | int* first; // Pointer to first buffer entry 190 | int* last; // Pointer to last buffer entry 191 | BitStore message; // A store using 4 bit for every value stored. 192 | float tolFact; // 193 | int pattern[maxNumPattern]; // 1d array to store the pattern 194 | uint8_t patternLen; // counter for length of pattern 195 | uint8_t pattern_pos; 196 | int8_t sync; // index to sync in pattern if it exists 197 | //String preamble; 198 | //String postamble; 199 | bool mcDetected; // MC Signal alread detected flag 200 | uint8_t mcMinBitLen; // min bit Length 201 | uint8_t rssiValue=0; // Holds the RSSI value retrieved via a rssi callback 202 | FuncRetuint8t _rssiCallback= nullptr; // Holds the pointer to a callback Function 203 | Func2pRetuint8t _streamCallback=nullptr;// Holds the pointer to a callback Function 204 | //Stream * msgPort; // Holds a pointer to a stream object for outputting 205 | 206 | 207 | void addData(const int8_t value); 208 | void addPattern(); 209 | inline void updPattern(const uint8_t ppos); 210 | 211 | void doDetect(); 212 | void processMessage(); 213 | void compress_pattern(); 214 | void calcHisto(const uint8_t startpos = 0, uint8_t endpos = 0); 215 | bool getClock(); // Searches a clock in a given signal 216 | bool getSync(); // Searches clock and sync in given Signal 217 | //int8_t printMsgRaw(uint8_t m_start, const uint8_t m_end, const String *preamble = NULL, const String *postamble = NULL); 218 | //void printMsgStr(const String *first, const String *second, const String *third); 219 | const bool inTol(const int val, const int set, const int tolerance); // checks if a value is in tolerance range 220 | 221 | void printOut(); 222 | const size_t write(const uint8_t *buffer, size_t size); // for the return value 223 | const size_t write(const char *str); // for the return value 224 | const size_t write(uint8_t b); // for the return value 225 | 226 | int8_t findpatt(const int val); // Finds a pattern in our pattern store. returns -1 if te pattern is not found 227 | //bool validSequence(const int *a, const int *b); // checks if two pulses are basically valid in terms of on-off signals 228 | const bool checkMBuffer(const uint8_t begin = 0); 229 | }; 230 | 231 | 232 | class ManchesterpatternDecoder 233 | { 234 | public: 235 | ManchesterpatternDecoder(SignalDetectorClass *ref_dec) : ManchesterBits(1), longlow(-1), longhigh(-1), shorthigh(-1), shortlow(-1) { pdec = ref_dec; reset(); }; 236 | ~ManchesterpatternDecoder(); 237 | const bool doDecode(); 238 | void setMinBitLen(const uint8_t len); 239 | #ifdef NOSTRING 240 | const char* getMessageHexStr(); 241 | const char* getMessagePulseStr(); 242 | const char* getMessageClockStr(); 243 | const char* getMessageLenStr(); 244 | #else 245 | void getMessageHexStr(String *message); 246 | void getMessagePulseStr(String *str); 247 | void getMessageClockStr(String* str); 248 | void getMessageLenStr(String* str); 249 | #endif 250 | void printMessageHexStr(); 251 | char nibble_to_HEX(uint8_t nibble); 252 | void HEX_twoDigits(char* cbuffer, uint8_t val); 253 | 254 | const bool isManchester(); 255 | void reset(); 256 | #ifndef UNITTEST 257 | //private: 258 | #endif 259 | BitStore<50> ManchesterBits; // A store using 1 bit for every value stored. It's used for storing the Manchester bit data in a efficent way 260 | SignalDetectorClass *pdec; 261 | int8_t longlow; 262 | int8_t longhigh; 263 | int8_t shorthigh; 264 | int8_t shortlow; 265 | int clock; // Manchester calculated clock 266 | int8_t minbitlen; 267 | 268 | bool mc_start_found = false; 269 | bool mc_sync = false; 270 | 271 | const bool isLong(const uint8_t pulse_idx); 272 | const bool isShort(const uint8_t pulse_idx); 273 | unsigned char getMCByte(const uint8_t idx); // Returns one Manchester byte in correct order. This is a helper function to retrieve information out of the buffer 274 | }; 275 | 276 | #endif 277 | -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson.h: -------------------------------------------------------------------------------- 1 | ../../_micro-api/libraries/ArduinoJson/src/ArduinoJson.h -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson.hpp: -------------------------------------------------------------------------------- 1 | ../../_micro-api/libraries/ArduinoJson/src/ArduinoJson.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Configuration.hpp: -------------------------------------------------------------------------------- 1 | ../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Configuration.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Data/Encoding.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Data/Encoding.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Data/JsonBufferAllocated.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Data/JsonBufferAllocated.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Data/JsonFloat.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Data/JsonFloat.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Data/JsonInteger.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Data/JsonInteger.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Data/JsonVariantAs.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Data/JsonVariantAs.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Data/JsonVariantContent.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Data/JsonVariantContent.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Data/JsonVariantDefault.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Data/JsonVariantDefault.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Data/JsonVariantType.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Data/JsonVariantType.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Data/List.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Data/List.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Data/ListConstIterator.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Data/ListConstIterator.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Data/ListIterator.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Data/ListIterator.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Data/ListNode.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Data/ListNode.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Data/NonCopyable.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Data/NonCopyable.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Data/ReferenceType.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Data/ReferenceType.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Data/ValueSaver.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Data/ValueSaver.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Deserialization/Comments.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Deserialization/Comments.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Deserialization/JsonParser.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Deserialization/JsonParser.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Deserialization/JsonParserImpl.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Deserialization/JsonParserImpl.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Deserialization/StringWriter.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Deserialization/StringWriter.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/DynamicJsonBuffer.hpp: -------------------------------------------------------------------------------- 1 | ../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/DynamicJsonBuffer.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/JsonArray.hpp: -------------------------------------------------------------------------------- 1 | ../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/JsonArray.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/JsonArrayImpl.hpp: -------------------------------------------------------------------------------- 1 | ../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/JsonArrayImpl.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/JsonArraySubscript.hpp: -------------------------------------------------------------------------------- 1 | ../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/JsonArraySubscript.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/JsonBuffer.hpp: -------------------------------------------------------------------------------- 1 | ../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/JsonBuffer.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/JsonBufferBase.hpp: -------------------------------------------------------------------------------- 1 | ../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/JsonBufferBase.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/JsonBufferImpl.hpp: -------------------------------------------------------------------------------- 1 | ../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/JsonBufferImpl.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/JsonObject.hpp: -------------------------------------------------------------------------------- 1 | ../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/JsonObject.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/JsonObjectImpl.hpp: -------------------------------------------------------------------------------- 1 | ../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/JsonObjectImpl.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/JsonObjectSubscript.hpp: -------------------------------------------------------------------------------- 1 | ../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/JsonObjectSubscript.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/JsonPair.hpp: -------------------------------------------------------------------------------- 1 | ../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/JsonPair.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/JsonVariant.hpp: -------------------------------------------------------------------------------- 1 | ../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/JsonVariant.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/JsonVariantBase.hpp: -------------------------------------------------------------------------------- 1 | ../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/JsonVariantBase.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/JsonVariantCasts.hpp: -------------------------------------------------------------------------------- 1 | ../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/JsonVariantCasts.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/JsonVariantComparisons.hpp: -------------------------------------------------------------------------------- 1 | ../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/JsonVariantComparisons.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/JsonVariantImpl.hpp: -------------------------------------------------------------------------------- 1 | ../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/JsonVariantImpl.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/JsonVariantOr.hpp: -------------------------------------------------------------------------------- 1 | ../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/JsonVariantOr.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/JsonVariantSubscripts.hpp: -------------------------------------------------------------------------------- 1 | ../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/JsonVariantSubscripts.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Polyfills/attributes.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Polyfills/attributes.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Polyfills/ctype.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Polyfills/ctype.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Polyfills/isFloat.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Polyfills/isFloat.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Polyfills/isInteger.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Polyfills/isInteger.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Polyfills/math.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Polyfills/math.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Polyfills/parseFloat.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Polyfills/parseFloat.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Polyfills/parseInteger.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Polyfills/parseInteger.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/RawJson.hpp: -------------------------------------------------------------------------------- 1 | ../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/RawJson.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Serialization/DummyPrint.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Serialization/DummyPrint.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Serialization/DynamicStringBuilder.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Serialization/DynamicStringBuilder.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Serialization/FloatParts.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Serialization/FloatParts.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Serialization/IndentedPrint.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Serialization/IndentedPrint.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Serialization/JsonPrintable.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Serialization/JsonPrintable.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Serialization/JsonSerializer.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Serialization/JsonSerializer.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Serialization/JsonSerializerImpl.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Serialization/JsonSerializerImpl.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Serialization/JsonWriter.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Serialization/JsonWriter.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Serialization/Prettyfier.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Serialization/Prettyfier.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Serialization/StaticStringBuilder.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Serialization/StaticStringBuilder.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/Serialization/StreamPrintAdapter.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/Serialization/StreamPrintAdapter.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/StaticJsonBuffer.hpp: -------------------------------------------------------------------------------- 1 | ../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/StaticJsonBuffer.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/StringTraits/ArduinoStream.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/StringTraits/ArduinoStream.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/StringTraits/CharPointer.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/StringTraits/CharPointer.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/StringTraits/FlashString.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/StringTraits/FlashString.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/StringTraits/StdStream.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/StringTraits/StdStream.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/StringTraits/StdString.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/StringTraits/StdString.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/StringTraits/StringTraits.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/StringTraits/StringTraits.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/TypeTraits/EnableIf.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/TypeTraits/EnableIf.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/TypeTraits/FloatTraits.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/TypeTraits/FloatTraits.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/TypeTraits/IsArray.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/TypeTraits/IsArray.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/TypeTraits/IsBaseOf.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/TypeTraits/IsBaseOf.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/TypeTraits/IsChar.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/TypeTraits/IsChar.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/TypeTraits/IsConst.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/TypeTraits/IsConst.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/TypeTraits/IsFloatingPoint.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/TypeTraits/IsFloatingPoint.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/TypeTraits/IsIntegral.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/TypeTraits/IsIntegral.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/TypeTraits/IsSame.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/TypeTraits/IsSame.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/TypeTraits/IsSignedIntegral.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/TypeTraits/IsSignedIntegral.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/TypeTraits/IsUnsignedIntegral.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/TypeTraits/IsUnsignedIntegral.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/TypeTraits/IsVariant.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/TypeTraits/IsVariant.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/TypeTraits/RemoveConst.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/TypeTraits/RemoveConst.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/TypeTraits/RemoveReference.hpp: -------------------------------------------------------------------------------- 1 | ../../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/TypeTraits/RemoveReference.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/ArduinoJson/version.hpp: -------------------------------------------------------------------------------- 1 | ../../../_micro-api/libraries/ArduinoJson/src/ArduinoJson/version.hpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/FastDelegate.h: -------------------------------------------------------------------------------- 1 | ../../_micro-api/libraries/fastdelegate/src/FastDelegate.h -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/FastDelegateBind.h: -------------------------------------------------------------------------------- 1 | ../../_micro-api/libraries/fastdelegate/src/FastDelegateBind.h -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/SIGNALDuino.ino: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/SimpleFIFO.cpp: -------------------------------------------------------------------------------- 1 | ../../_micro-api/libraries/SimpleFIFO/src/SimpleFIFO.cpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/SimpleFIFO.h: -------------------------------------------------------------------------------- 1 | ../../_micro-api/libraries/SimpleFIFO/src/SimpleFIFO.h -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/TimerOne.cpp: -------------------------------------------------------------------------------- 1 | ../../_micro-api/libraries/TimerOne/src/TimerOne.cpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/TimerOne.h: -------------------------------------------------------------------------------- 1 | ../../_micro-api/libraries/TimerOne/src/TimerOne.h -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/WiFiManager.cpp: -------------------------------------------------------------------------------- 1 | ../../_micro-api/libraries/WIFIManager/WiFiManager.cpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/WiFiManager.h: -------------------------------------------------------------------------------- 1 | ../../_micro-api/libraries/WIFIManager/WiFiManager.h -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/bitstore.cpp: -------------------------------------------------------------------------------- 1 | ../../_micro-api/libraries/bitstore/src/bitstore.cpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/bitstore.h: -------------------------------------------------------------------------------- 1 | ../../_micro-api/libraries/bitstore/src/bitstore.h -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/cc1101.cpp: -------------------------------------------------------------------------------- 1 | ../../cc1101.cpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/cc1101.h: -------------------------------------------------------------------------------- 1 | ../../cc1101.h -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/commands.h: -------------------------------------------------------------------------------- 1 | ../../commands.h -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/compile_config.h: -------------------------------------------------------------------------------- 1 | ../../compile_config.h -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/config/known_16bit_timers.h: -------------------------------------------------------------------------------- 1 | ../../../_micro-api/libraries/TimerOne/src/config/known_16bit_timers.h -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/functions.h: -------------------------------------------------------------------------------- 1 | ../../functions.h -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/main.h: -------------------------------------------------------------------------------- 1 | ../../main.h -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/mbus.cpp: -------------------------------------------------------------------------------- 1 | ../../mbus.cpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/mbus.h: -------------------------------------------------------------------------------- 1 | ../../mbus.h -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/output.h: -------------------------------------------------------------------------------- 1 | ../../_micro-api/libraries/output/src/output.h -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/send.h: -------------------------------------------------------------------------------- 1 | ../../send.h -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/signalDecoder.cpp: -------------------------------------------------------------------------------- 1 | ../../_micro-api/libraries/signalDecoder/src/signalDecoder.cpp -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/signalDecoder.h: -------------------------------------------------------------------------------- 1 | ../../_micro-api/libraries/signalDecoder/src/signalDecoder.h -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/signalSTM.h: -------------------------------------------------------------------------------- 1 | ../../signalSTM.h -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/signalduino.h: -------------------------------------------------------------------------------- 1 | ../../signalduino.h -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/signalesp.h: -------------------------------------------------------------------------------- 1 | ../../signalesp.h -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/strings_en.h: -------------------------------------------------------------------------------- 1 | ../../_micro-api/libraries/WIFIManager/strings_en.h -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/wifi-config.h: -------------------------------------------------------------------------------- 1 | ../../wifi-config.h -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/wm_consts_en.h: -------------------------------------------------------------------------------- 1 | ../../_micro-api/libraries/WIFIManager/wm_consts_en.h -------------------------------------------------------------------------------- /src/arduino-ide/SIGNALDuino/wm_strings_en.h: -------------------------------------------------------------------------------- 1 | ../../_micro-api/libraries/WIFIManager/wm_strings_en.h -------------------------------------------------------------------------------- /src/cc1101.h: -------------------------------------------------------------------------------- 1 | // cc1101.h esp 2 | #pragma once 3 | #ifndef _CC1101_h 4 | #define _CC1101_h 5 | 6 | #if defined(ARDUINO) && ARDUINO >= 100 7 | #include "Arduino.h" 8 | #else 9 | // #include "WProgram.h" 10 | #endif 11 | #include "compile_config.h" 12 | 13 | #include 14 | #include "output.h" 15 | #include "signalDecoder.h" // xFSK 16 | 17 | extern char IB_1[14]; 18 | 19 | 20 | #ifdef ARDUINO_MAPLEMINI_F103CB // only ARDUINO_MAPLEMINI_F103CB / MAPLE_Mini 21 | extern uint8_t radionr; // xFSK - variant -> Circuit board for four connected cc110x devices 22 | #endif 23 | 24 | 25 | #if defined(ESP8266) || defined(ESP32) || defined(ARDUINO_MAPLEMINI_F103CB) 26 | #include 27 | #endif 28 | 29 | namespace cc1101 { 30 | 31 | extern int8_t freqOffAcc; 32 | extern float freqErrAvg; 33 | 34 | 35 | /* 36 | #ifdef ARDUINO_AVR_ICT_BOARDS_ICT_BOARDS_AVR_RADINOCC1101 37 | #define SS 8 38 | #define PIN_MARK433 4 // LOW -> 433Mhz | HIGH -> 868Mhz 39 | 40 | #elif ARDUINO_ATMEGA328P_MINICUL // 8Mhz 41 | #define PIN_MARK433 0 42 | #endif 43 | */ 44 | 45 | #ifdef ARDUINO_MAPLEMINI_F103CB 46 | /* 47 | https://forum.fhem.de/index.php/topic,106278.0.html | https://forum.fhem.de/index.php/topic,109220.0.html 48 | */ 49 | const uint8_t radioCsPin[] = {31, 12, 15, 3}; // PINs from Circuit board for 4 cc110x 50 | #define csPin 12 // CSN out - SPI2 , default PIN radionbank 1 -> compatible with other project 51 | #define mosiPin 28 // MOSI out - SPI2 52 | #define misoPin 29 // MISO in - SPI2 53 | #define sckPin 30 // SCLK out - SPI2 54 | #else 55 | #define csPin SS // CSN out 56 | #define mosiPin MOSI // MOSI out 57 | #define misoPin MISO // MISO in 58 | #define sckPin SCK // SCLK out 59 | #endif 60 | 61 | #define CC1101_WRITE_BURST 0x40 62 | #define CC1101_WRITE_SINGLE 0x00 63 | #define CC1101_READ_BURST 0xC0 64 | #define CC1101_READ_SINGLE 0x80 65 | #define CC1101_CONFIG CC1101_READ_SINGLE 66 | #define CC1101_STATUS CC1101_READ_BURST 67 | 68 | #define CC1101_FREQ2 0x0D // Frequency control word, high byte 69 | #define CC1101_FREQ1 0x0E // Frequency control word, middle byte 70 | #define CC1101_FREQ0 0x0F // Frequency control word, low byte 71 | #define CC1101_PATABLE 0x3E // 8 byte memory 72 | #define CC1101_IOCFG2 0x00 // GDO2 output configuration 73 | #define CC1101_PKTCTRL0 0x08 // Packet config register 74 | 75 | extern uint8_t revision; // xFSK 76 | extern uint8_t ccmode;; // xFSK 77 | extern const uint8_t initVal[]; // xFSK 78 | 79 | // Status registers - newer version base on 0xF0 80 | #define CC1101_PARTNUM_REV01 0xF0 // Chip ID 81 | #define CC1101_VERSION_REV01 0xF1 // Chip ID 82 | #define CC1101_RSSI_REV01 0xF4 // Received signal strength indication 83 | #define CC1101_MARCSTATE_REV01 0xF5 // Control state machine state 84 | 85 | // Status registers - older version base on 0x30 86 | #define CC1101_PARTNUM_REV00 0x30 // Chip ID 87 | #define CC1101_VERSION_REV00 0x31 // Chip ID 88 | #define CC1101_RSSI_REV00 0x34 // Received signal strength indication 89 | #define CC1101_MARCSTATE_REV00 0x35 // Control state machine state 90 | 91 | // Strobe commands 92 | #define CC1101_SRES 0x30 // reset 93 | #define CC1101_SFSTXON 0x31 // Enable and calibrate frequency synthesizer (if MCSM0.FS_AUTOCAL=1). 94 | #define CC1101_SCAL 0x33 // Calibrate frequency synthesizer and turn it off 95 | #define CC1101_SRX 0x34 // Enable RX. Perform calibration first if coming from IDLE and MCSM0.FS_AUTOCAL=1 96 | #define CC1101_STX 0x35 // In IDLE state: Enable TX. Perform calibration first if MCSM0.FS_AUTOCAL=1 97 | #define CC1101_SIDLE 0x36 // Exit RX / TX, turn off frequency synthesizer 98 | #define CC1101_SAFC 0x37 // Perform AFC adjustment of the frequency synthesizer 99 | 100 | #define CC1101_SFRX 0x3A // Flush the RX FIFO buffer | Underflow and # of bytes in TXFIFO / CC1101_TXBYTES 101 | #define CC1101_SFTX 0x3B // Flush the TX FIFO buffer | Overflow and # of bytes in RXFIFO / CC1101_RXBYTES 102 | #define CC1101_SNOP 0x3D // No operation. May be used to get access to the chip status byte. 103 | #define CC1101_TXFIFO 0x3F 104 | #define CC1101_RXFIFO 0x3F 105 | 106 | enum CC1101_MarcState { 107 | MarcStateSleep = 0x00u 108 | , MarcStateIdle = 0x01u 109 | , MarcStateXOff = 0x02u 110 | , MarcStateVConnManCal = 0x03u 111 | , MarcStateRegOnManCal = 0x04u 112 | , MarcStateManCal = 0x05u 113 | , MarcStateVConnFSWakeUp = 0x06u 114 | , MarcStateRegOnFSWakeUp = 0x07u 115 | , MarcStateStartCalibrate = 0x08u 116 | , MarcStateBWBoost = 0x09u 117 | , MarcStateFSLock = 0x0Au 118 | , MarcStateIfadCon = 0x0Bu 119 | , MarcStateEndCalibrate = 0x0Cu 120 | , MarcStateRx = 0x0Du 121 | , MarcStateRxEnd = 0x0Eu 122 | , MarcStateRxRst = 0x0Fu 123 | , MarcStateTxRxSwitch = 0x10u 124 | , MarcStateRxFifoOverflow = 0x11u 125 | , MarcStateFsTxOn = 0x12u 126 | , MarcStateTx = 0x13u 127 | , MarcStateTxEnd = 0x14u 128 | , MarcStateRxTxSwitch = 0x15u 129 | , MarcStateTxFifoUnerflow = 0x16u 130 | }; 131 | #if defined(ESP8266) || defined(ESP32) 132 | #define pinAsInput(pin) pinMode(pin, INPUT) 133 | #define pinAsOutput(pin) pinMode(pin, OUTPUT) 134 | #define pinAsInputPullUp(pin) pinMode(pin, INPUT_PULLUP) 135 | 136 | #ifndef digitalLow 137 | #define digitalLow(pin) digitalWrite(pin, LOW) 138 | #endif 139 | #ifndef digitalHigh 140 | #define digitalHigh(pin) digitalWrite(pin, HIGH) 141 | #endif 142 | #ifndef isHigh 143 | #define isHigh(pin) (digitalRead(pin) == HIGH) 144 | #endif 145 | #endif 146 | 147 | #define wait_Miso() { uint8_t miso_count = 255; while(isHigh(misoPin)) { delay(1); if(miso_count == 0) return ; miso_count--; } } // wait until SPI MISO line goes low 148 | #define wait_Miso_rf() { uint8_t miso_count = 255; while(isHigh(misoPin)) { delay(1); if(miso_count == 0) return false; miso_count--; } } // wait until SPI MISO line goes low 149 | 150 | #ifdef ARDUINO_MAPLEMINI_F103CB 151 | #define cc1101_Select() digitalLow(cc1101::radioCsPin[radionr]) // select (SPI) CC1101 | variant from array, Circuit board for 4 cc110x 152 | #define cc1101_Deselect() digitalHigh(cc1101::radioCsPin[radionr]) 153 | #else 154 | #define cc1101_Select() digitalLow(csPin) // select (SPI) CC1101 155 | #define cc1101_Deselect() digitalHigh(csPin) 156 | #endif 157 | 158 | #define EE_CC1101_CFG 2 159 | #define EE_CC1101_CFG_SIZE 0x29 160 | #define EE_CC1101_PA 0x30 // (EE_CC1101_CFG+EE_CC1101_CFG_SIZE) // 2C 161 | #define EE_CC1101_PA_SIZE 8 162 | 163 | #define PATABLE_DEFAULT 0x84 // 5 dB default value for factory reset 164 | 165 | //--------------------------------------------------- 166 | // Chip Status Byte 167 | //--------------------------------------------------- 168 | 169 | // Bit fields in the chip status byte 170 | #define CC1101_STATUS_CHIP_RDYn_BM 0x80 171 | #define CC1101_STATUS_STATE_BM 0x70 172 | #define CC1101_STATUS_FIFO_BYTES_AVAILABLE_BM 0x0F 173 | 174 | // Chip states 175 | #define CC1101_STATE_IDLE 0x00 176 | #define CC1101_STATE_RX 0x10 177 | #define CC1101_STATE_TX 0x20 178 | #define CC1101_STATE_FSTXON 0x30 179 | #define CC1101_STATE_CALIBRATE 0x40 180 | #define CC1101_STATE_SETTLING 0x50 181 | #define CC1101_STATE_RX_OVERFLOW 0x60 182 | #define CC1101_STATE_TX_UNDERFLOW 0x70 183 | 184 | 185 | #ifdef ARDUINO_AVR_ICT_BOARDS_ICT_BOARDS_AVR_RADINOCC1101 186 | //uint8_t RADINOVARIANT = 0; // Standardwert welcher je radinoVarinat geaendert wird 187 | #endif 188 | 189 | 190 | 191 | byte hex2int(byte hex); // convert a hexdigit to int // Todo: printf oder scanf nutzen 192 | uint8_t chipVersion(); 193 | uint8_t chipVersionRev(); 194 | uint8_t cmdStrobe(const uint8_t cmd); 195 | uint8_t cmdStrobeTo(const uint8_t cmd); 196 | uint8_t currentMode(); 197 | uint8_t flushrx(); // xFSK 198 | uint8_t getMARCSTATE(); // xFSK 199 | uint8_t getRSSI(); 200 | uint8_t getRXBYTES(); // xFSK 201 | uint8_t getRevision(); 202 | uint8_t readReg(const uint8_t regAddr, const uint8_t regType); // read CC1101 register via SPI 203 | uint8_t sendSPI(const uint8_t val); // send byte via SPI 204 | uint8_t waitTo_Miso(); 205 | 206 | void CCinit(void); // initialize CC1101 207 | void ccFactoryReset(); 208 | void commandStrobes(void); 209 | void getRxFifo(uint16_t Boffs); // xFSK 210 | void sendFIFO(char*, char*); // xFSK 211 | void readCCreg(const uint8_t reg); // read CC1101 register 212 | void readPatable(void); 213 | void setIdleMode(); 214 | void setReceiveMode(); 215 | void setTransmitMode(); 216 | void setup(); 217 | void writeCCpatable(uint8_t var); // write 8 byte to patable (kein pa ramping) 218 | void writeCCreg(uint8_t reg, uint8_t var); // write CC1101 register 219 | void writePatable(void); 220 | void writeReg(const uint8_t regAddr, const uint8_t val); // write single register into the CC1101 IC via SPI 221 | 222 | bool checkCC1101(); 223 | bool regCheck(); 224 | 225 | } 226 | 227 | #endif 228 | -------------------------------------------------------------------------------- /src/commands.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _COMMANDS_h 4 | #define _COMMANDS_h 5 | 6 | #if defined(ARDUINO) && ARDUINO >= 100 7 | #include "Arduino.h" 8 | #else 9 | // #include "WProgram.h" 10 | #endif 11 | 12 | #include "compile_config.h" // MSG_PRINTtoHEX / DBG_PRINTtoHEX - need for right options | ETHERNET_PRINT -> MSG_PRINTER Serial or serverClient 13 | 14 | /* Help functions MSG_PRINTtoHEX & DBG_PRINTtoHEX 15 | * This position is the only one where you can compile and 16 | * no dependencies on libraries. 17 | * ( functions for less memory sketch consumption ) 18 | */ 19 | 20 | void MSG_PRINTtoHEX(uint8_t a) { // this function is the alternative to sprintf(b, "%02x", xxx(i)) 21 | if(a < 16) { 22 | MSG_PRINT(0); 23 | } 24 | MSG_PRINT(a , HEX); 25 | } 26 | 27 | void DBG_PRINTtoHEX(uint8_t b) { // this function is the alternative to sprintf(b, "%02x", yyy(i)); 28 | #ifdef DEBUG 29 | if(b < 16) { 30 | DBG_PRINT(0); 31 | } 32 | DBG_PRINT(b , HEX); 33 | #endif 34 | } 35 | 36 | /* Help functions END */ 37 | 38 | #include 39 | #include "output.h" 40 | #include "cc1101.h" 41 | #include "functions.h" 42 | #include "signalDecoder.h" 43 | 44 | extern char IB_1[14]; 45 | extern bool hasCC1101; 46 | extern SignalDetectorClass musterDec; 47 | extern volatile bool blinkLED; 48 | extern uint8_t ccmode;; // xFSK 49 | #ifdef CMP_CC1101 50 | extern bool AfcEnabled; 51 | #if defined (ESP8266) || defined (ESP32) 52 | extern bool wmbus; 53 | extern bool wmbus_t; 54 | #endif 55 | #endif 56 | 57 | namespace commands { 58 | 59 | inline void getPing() 60 | { 61 | MSG_PRINTLN("OK"); 62 | delayMicroseconds(500); 63 | } 64 | 65 | inline void changeReceiver() { 66 | if (IB_1[1] == 'Q') 67 | { 68 | disableReceive(); 69 | } 70 | else if (IB_1[1] == 'E') 71 | { 72 | enableReceive(); 73 | } 74 | } 75 | 76 | inline void getConfig() 77 | { 78 | #ifdef CMP_CC1101 79 | if (cc1101::ccmode == 3) { // ASK/OOK = 3 (default) 80 | MSG_PRINT(F("MS=")); 81 | MSG_PRINT(musterDec.MSenabled, DEC); 82 | MSG_PRINT(F(";MU=")); 83 | MSG_PRINT(musterDec.MUenabled, DEC); 84 | MSG_PRINT(F(";MC=")); 85 | MSG_PRINT(musterDec.MCenabled, DEC); 86 | MSG_PRINT(F(";Mred=")); 87 | MSG_PRINTLN(musterDec.MredEnabled, DEC); 88 | } else { // FSK 89 | MSG_PRINT(F("MN=1")); 90 | #if defined (ESP8266) || defined (ESP32) 91 | MSG_PRINT(F(";WMBus=")); 92 | MSG_PRINT(wmbus, DEC); 93 | MSG_PRINT(F(";WMBus_T=")); 94 | MSG_PRINT(wmbus_t, DEC); 95 | #endif 96 | MSG_PRINT(F(";AFC=")); 97 | MSG_PRINTLN(AfcEnabled, DEC); 98 | } 99 | #else 100 | MSG_PRINT(F("MS=")); 101 | MSG_PRINT(musterDec.MSenabled, DEC); 102 | MSG_PRINT(F(";MU=")); 103 | MSG_PRINT(musterDec.MUenabled, DEC); 104 | MSG_PRINT(F(";MC=")); 105 | MSG_PRINT(musterDec.MCenabled, DEC); 106 | MSG_PRINT(F(";Mred=")); 107 | MSG_PRINTLN(musterDec.MredEnabled, DEC); 108 | #endif 109 | } 110 | 111 | inline void configCMD() 112 | { 113 | bool *bptr; 114 | 115 | switch (IB_1[2]) 116 | { 117 | case 'S' : //MS 118 | bptr = &musterDec.MSenabled; 119 | break; 120 | case 'U' : //MU 121 | bptr = &musterDec.MUenabled; 122 | break; 123 | case 'C' : //MC 124 | bptr = &musterDec.MCenabled; 125 | break; 126 | case 'R' : //Mreduce 127 | bptr = &musterDec.MredEnabled; 128 | break; 129 | #ifdef CMP_CC1101 130 | case 'A' : //Afc 131 | bptr = &AfcEnabled; 132 | break; 133 | #if defined (ESP8266) || defined (ESP32) 134 | case 'W' : //WMBus 135 | bptr = &wmbus; 136 | break; 137 | case 'T' : //WMBus_T 138 | bptr = &wmbus_t; 139 | break; 140 | #endif 141 | #endif 142 | default: 143 | return; 144 | } 145 | 146 | switch (IB_1[1]) 147 | { 148 | case 'E': 149 | *bptr = true; 150 | break; 151 | case 'D': 152 | *bptr = false; 153 | break; 154 | default: 155 | return; 156 | } 157 | #if defined (CMP_CC1101) && (defined (ESP8266) || defined (ESP32)) 158 | storeFunctions(musterDec.MSenabled, musterDec.MUenabled, musterDec.MCenabled, musterDec.MredEnabled, AfcEnabled, wmbus, wmbus_t); 159 | #else 160 | storeFunctions(musterDec.MSenabled, musterDec.MUenabled, musterDec.MCenabled, musterDec.MredEnabled, AfcEnabled); 161 | #endif 162 | } 163 | 164 | inline void configSET() 165 | { 166 | //MSG_PRINT(cmdstring.substring(2, 8)); 167 | if (strstr(&IB_1[2],"mcmbl=") != NULL) // mc min bit len 168 | { 169 | musterDec.mcMinBitLen = strtol(&IB_1[8], NULL,10); 170 | MSG_PRINT(musterDec.mcMinBitLen); MSG_PRINT(F(" bits set")); 171 | } 172 | } 173 | 174 | 175 | void HandleShortCommand() 176 | { 177 | #define cmd_Version 'V' 178 | #define cmd_freeRam 'R' 179 | #define cmd_uptime 't' 180 | #define cmd_changeReceiver 'X' 181 | #define cmd_help '?' 182 | #define cmd_ping 'P' 183 | #define cmd_ccFactoryReset 'e' // EEPROM / factory reset 184 | #define cmd_config 'C' // CG get config, set config, C get CC1101 register 185 | #define cmd_patable 'x' 186 | #define cmd_write 'W' // write EEPROM und write CC1101 register 187 | #define cmd_read 'r' // read EEPROM 188 | #define cmd_space ' ' 189 | #define cmd_send 'S' 190 | #define cmd_status 's' 191 | 192 | switch (IB_1[0]) 193 | { 194 | case cmd_help: 195 | MSG_PRINT(cmd_help); MSG_PRINT(F(" Use one of ")); 196 | MSG_PRINT(cmd_Version); MSG_PRINT(FPSTR(TXT_BLANK)); 197 | MSG_PRINT(cmd_freeRam); MSG_PRINT(FPSTR(TXT_BLANK)); 198 | MSG_PRINT(cmd_uptime); MSG_PRINT(FPSTR(TXT_BLANK)); 199 | MSG_PRINT(cmd_changeReceiver); MSG_PRINT(FPSTR(TXT_BLANK)); 200 | MSG_PRINT(cmd_send); MSG_PRINT(FPSTR(TXT_BLANK)); 201 | MSG_PRINT(cmd_ping); MSG_PRINT(FPSTR(TXT_BLANK)); 202 | MSG_PRINT(cmd_config); MSG_PRINT(FPSTR(TXT_BLANK)); 203 | MSG_PRINT(cmd_read); MSG_PRINT(FPSTR(TXT_BLANK)); 204 | MSG_PRINT(cmd_write); MSG_PRINT(FPSTR(TXT_BLANK)); 205 | MSG_PRINT(cmd_status); MSG_PRINT(FPSTR(TXT_BLANK)); 206 | #ifdef CMP_CC1101 207 | if (hasCC1101) { 208 | MSG_PRINT(cmd_patable); MSG_PRINT(FPSTR(TXT_BLANK)); 209 | MSG_PRINT(cmd_ccFactoryReset); MSG_PRINT(FPSTR(TXT_BLANK)); 210 | } 211 | #endif 212 | MSG_PRINTLN(""); 213 | break; 214 | case cmd_ping: 215 | getPing(); 216 | break; 217 | case cmd_Version: 218 | MSG_PRINT(F("V " PROGVERS PROGNAME)); 219 | #ifdef CMP_CC1101 220 | if (hasCC1101) { 221 | MSG_PRINT(FPSTR(TXT_CC1101)); 222 | MSG_PRINT('('); 223 | 224 | #endif 225 | #ifdef PIN_MARK433 226 | MSG_PRINT(FPSTR(isLow(PIN_MARK433) ? TXT_433 : TXT_868)); 227 | MSG_PRINT(FPSTR(TXT_MHZ)); 228 | MSG_PRINT(')'); 229 | #else 230 | #ifdef CMP_CC1101 231 | MSG_PRINT(FPSTR(TXT_CHIP)); MSG_PRINT(FPSTR(TXT_BLANK)); MSG_PRINT(FPSTR(TXT_CC110)); 232 | switch (cc1101::chipVersion()) { 233 | case 0x03: 234 | MSG_PRINT("0"); 235 | break; 236 | case 0x14: 237 | case 0x04: 238 | MSG_PRINT("1"); 239 | break; 240 | case 0x05: 241 | MSG_PRINT("0E"); 242 | break; 243 | case 0x07: 244 | case 0x17: 245 | MSG_PRINT("L"); 246 | break; 247 | default: 248 | MSG_PRINT(F(" unknown")); 249 | break; 250 | } 251 | MSG_PRINT(')'); 252 | #endif 253 | #endif 254 | #ifdef CMP_CC1101 255 | } 256 | #endif 257 | #ifdef DEBUG 258 | MSG_PRINT(F(" DBG")); 259 | #endif 260 | #ifdef WATCHDOG_STM32 261 | if (watchRes) { 262 | MSG_PRINT(F(" wr")); 263 | } 264 | #endif 265 | MSG_PRINTLN(F(" - compiled at " __DATE__ " " __TIME__)); 266 | break; 267 | case cmd_freeRam: 268 | MSG_PRINTLN(freeRam()); 269 | break; 270 | case cmd_uptime: 271 | MSG_PRINTLN(getUptime()); 272 | break; 273 | case cmd_changeReceiver: 274 | changeReceiver(); 275 | break; 276 | case cmd_config: 277 | switch (IB_1[1]) 278 | { 279 | case 'G': 280 | getConfig(); 281 | break; 282 | case 'E': 283 | case 'D': 284 | configCMD(); 285 | break; 286 | case 'S': 287 | configSET(); 288 | break; 289 | #ifdef CMP_CC1101 290 | default: 291 | if (isxdigit(IB_1[1]) && isxdigit(IB_1[2]) && hasCC1101) { 292 | uint8_t val = (uint8_t)strtol(IB_1+1, nullptr, 16); 293 | cc1101::readCCreg(val); 294 | } 295 | #endif 296 | } 297 | break; 298 | #ifdef CMP_CC1101 299 | case cmd_ccFactoryReset: 300 | if (hasCC1101) { 301 | cc1101::ccFactoryReset(); 302 | cc1101::CCinit(); 303 | dumpEEPROM(); 304 | } 305 | break; 306 | case cmd_patable: // example: x12 307 | if (isHexadecimalDigit(IB_1[1]) && isHexadecimalDigit(IB_1[2]) && hasCC1101) { 308 | uint8_t val = (uint8_t)strtol(IB_1+1, nullptr, 16); 309 | cc1101::writeCCpatable(val); 310 | MSG_PRINT(FPSTR(TXT_WRITE)); 311 | MSG_PRINTtoHEX(val); 312 | MSG_PRINTLN(FPSTR(TXT_TPATAB)); 313 | } 314 | break; 315 | 316 | #endif 317 | case cmd_read: // r read EEPROM, example: r0a, r03n 318 | if (isHexadecimalDigit(IB_1[1]) && isHexadecimalDigit(IB_1[2]) && hasCC1101) { 319 | const uint8_t reg = (uint8_t)strtol(IB_1+1, nullptr, 16); 320 | MSG_PRINT(FPSTR(TXT_EEPROM)); 321 | MSG_PRINT(FPSTR(TXT_BLANK)); 322 | 323 | MSG_PRINTtoHEX(reg); 324 | 325 | if (IB_1[3] == 'n') { 326 | MSG_PRINT(F(" :")); 327 | for (uint8_t i = 0; i < 16; i++) { 328 | const uint8_t val = EEPROM.read(reg + i); 329 | MSG_PRINTtoHEX(val); 330 | } 331 | } 332 | else { 333 | MSG_PRINT(F(" = ")); 334 | const uint8_t val = EEPROM.read(reg); 335 | MSG_PRINTtoHEX(val); 336 | } 337 | MSG_PRINTLN(""); 338 | } 339 | break; 340 | case cmd_write: 341 | if (IB_1[1] == 'S' && IB_1[2] == '3') 342 | { 343 | #ifdef CMP_CC1101 344 | cc1101::commandStrobes(); 345 | #endif 346 | } else if (isHexadecimalDigit(IB_1[1]) && isHexadecimalDigit(IB_1[2]) && isHexadecimalDigit(IB_1[3]) && isHexadecimalDigit(IB_1[4])) { 347 | char b[3]; 348 | b[2] = '\0'; 349 | 350 | memcpy(b, &IB_1[1], 2); 351 | uint8_t reg = strtol(b, nullptr, 16); 352 | memcpy(b, &IB_1[3], 2); 353 | uint8_t val = strtol(b, nullptr, 16); 354 | 355 | EEPROM.write(reg, val); //Todo pruefen ob reg hier um 1 erhoeht werden muss 356 | DBG_PRINT(reg); 357 | DBG_PRINT('='); 358 | 359 | DBG_PRINTLN(val); 360 | 361 | #ifdef CMP_CC1101 362 | if (hasCC1101) { 363 | cc1101::writeCCreg(reg, val); 364 | } 365 | 366 | if (reg == 0x10 + 2) { // 0x10 MDMCFG4 bwidth 325 kHz (EEPROM-Addresse + 2) 367 | 368 | if (EEPROM.read(2) == 13) { // adr 0x00 is only on OOK/ASK 0D (GD0) | DN022 -- CC110x CC111x OOK ASK Register Settings (Rev. E) "... optimum register settings for OOK/ASK operation." 369 | DBG_PRINTLN(F("optimum register settings for OOK/ASK operation")); 370 | 371 | reg = 0x21 + 2; // 0x21 FREND1 (EEPROM-Addresse + 2) 372 | // RX filter bandwidth > 101 kHz, FREND1 = 0xB6 373 | // RX filter bandwidth <= 101 kHz, FREND1 = 0x56 374 | if (val >= 0xC7) { // 199 = 0xC7 = 101 kHz 375 | val = 0x56; // FREND1 = 0x56 376 | } 377 | else { 378 | val = 0xB6; // FREND1 = 0xB6 379 | } 380 | EEPROM.write(reg, val); 381 | if (hasCC1101) { 382 | cc1101::writeCCreg(reg, val); 383 | } 384 | reg = 0x03 + 2; // 0x03 FIFOTHR (EEPROM-Addresse + 2) 385 | memcpy(b, &IB_1[3], 2); 386 | val = strtol(b, nullptr, 16); 387 | // RX filter bandwidth > 325 kHz, FIFOTHR = 0x07 388 | // RX filter bandwidth <= 325 kHz, FIFOTHR = 0x47 389 | if (val >= 0x57) { // 87 = 0x57 = 325 kHz 390 | val = 0x47; // FIFOTHR = 0x47 391 | } 392 | else { 393 | val = 0x07; // FIFOTHR = 0x07 394 | } 395 | EEPROM.write(reg, val); 396 | if (hasCC1101) { 397 | cc1101::writeCCreg(reg, val); 398 | } 399 | } 400 | } 401 | #endif 402 | #if defined(ESP32) || defined(ESP8266) 403 | EEPROM.commit(); 404 | #endif 405 | } 406 | break; 407 | case cmd_status: 408 | #ifdef CMP_CC1101 409 | if (hasCC1101 && !cc1101::regCheck()) 410 | { 411 | MSG_PRINT(FPSTR(TXT_CC1101)); 412 | MSG_PRINT(FPSTR(TXT_DOFRESET)); 413 | MSG_PRINTLN(FPSTR(TXT_COMMAND)); 414 | } 415 | else 416 | { 417 | MSG_PRINTLN("OK"); 418 | } 419 | #endif 420 | break; 421 | default: 422 | MSG_PRINTLN(FPSTR(TXT_UNSUPPORTED1)); 423 | return; 424 | } 425 | blinkLED = true; 426 | } 427 | 428 | 429 | } 430 | 431 | 432 | #endif 433 | -------------------------------------------------------------------------------- /src/compile_config.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _COMPILE_CONFIG_h 4 | #define _COMPILE_CONFIG_h 5 | 6 | /* 7 | * Config flags for compiling correct options / boards Define only one! 8 | * ******************************************************************** 9 | * nothing to define // boards without CC1101 (example, ESP8266, ESP32, nano, ...) 10 | */ 11 | //#define CMP_CC1101 12 | //#define ARDUINO_ATMEGA328P_MINICUL 1 // minicul with CC1101 13 | //#define ARDUINO_AVR_ICT_BOARDS_ICT_BOARDS_AVR_RADINOCC1101 1; // radino with CC1101 14 | //#define OTHER_BOARD_WITH_CC1101 1 // boards with CC1101 (example: ESP8266, ESP32, Maple Mini ...) 15 | 16 | 17 | /* 18 | * compiling notes 19 | * *************** 20 | 21 | Platform IO 22 | radino_CC1101@debug - size (29942 bytes) is greater than maximum allowed (28672 bytes) 23 | */ 24 | 25 | 26 | /* 27 | * enable debug option here 28 | * ************************ 29 | */ 30 | //#define DEBUG 31 | 32 | 33 | /* 34 | * ONLY for STM32F103CBT6 - MAPLE MINI 35 | * enabled ARDUINO_MAPLEMINI_F103CB Watchdog option 36 | */ 37 | #ifdef ARDUINO_MAPLEMINI_F103CB 38 | //#define WATCHDOG_STM32 1 39 | #endif 40 | 41 | 42 | /* 43 | * do NOT change anything below this line ! 44 | * **************************************** 45 | */ 46 | 47 | #ifndef PROGVERS 48 | #define PROGVERS "4.0.0+20230814" // platformio will set this to the correct value (lateste tag with commits since latest tag) 49 | #endif 50 | 51 | #ifdef OTHER_BOARD_WITH_CC1101 52 | #define CMP_CC1101 53 | #endif 54 | 55 | #ifdef ARDUINO_ATMEGA328P_MINICUL 56 | #define CMP_CC1101 57 | #endif 58 | 59 | #ifdef ARDUINO_RADINOCC1101 60 | #define CMP_CC1101 61 | #endif 62 | 63 | #ifdef CMP_CC1101 64 | #ifdef ARDUINO_RADINOCC1101 65 | #define PIN_LED 13 66 | #define PIN_SEND 9 // GDO0 Pin TX out 67 | #define PIN_RECEIVE 7 68 | #define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT))))) 69 | #define PIN_MARK433 4 70 | #define SS 8 71 | #elif ARDUINO_ATMEGA328P_MINICUL // 8Mhz 72 | #define PIN_LED 4 73 | #define PIN_SEND 2 // GDO0 Pin TX out 74 | #define PIN_RECEIVE 3 75 | #define PIN_MARK433 A0 76 | #elif ARDUINO_MAPLEMINI_F103CB 77 | // https://wiki.fhem.de/wiki/Maple-SignalDuino - CC1101_1 (B) - 433 MHz für OOK/ASK 78 | #define PIN_LED 33 79 | #define PIN_SEND 17 // GD00 (send) 80 | #define PIN_RECEIVE 18 // GD02 (Receive) 81 | #define PIN_WIZ_RST 27 // for LAN 82 | #elif defined(ESP8266) 83 | #define PIN_RECEIVE 5 // D1 84 | #define PIN_LED 16 // some boards have no LED or this LED has a different PIN defined 85 | #define PIN_SEND 4 // D2 // gdo0Pin TX out 86 | #define ETHERNET_PRINT 87 | //#define PIN_LED_INVERSE // use this setting for the LED_BUILTIN on WEMOS boards 88 | #elif defined(ESP32) 89 | #define PIN_RECEIVE 13 // D13 | G13 (depending on type / clone / seller) --> old 16, not good (serial) and not all boards n.c. 90 | #define PIN_LED 2 // D2 | G2 (depending on type / clone / seller) 91 | #define PIN_SEND 4 // D4 | G4 (depending on type / clone / seller) // GDO0 Pin TX out 92 | #define ETHERNET_PRINT 93 | #else 94 | #define PIN_LED 9 95 | #define PIN_SEND 3 // gdo0Pin TX out 96 | #define PIN_RECEIVE 2 97 | #endif 98 | #else 99 | #ifdef ESP8266 100 | #define PIN_RECEIVE 5 // D1 101 | #define PIN_LED 16 // some boards have no LED or this LED has a different PIN defined 102 | #define PIN_SEND 4 // D2 // gdo0Pin TX out 103 | #define ETHERNET_PRINT 104 | //#define PIN_LED_INVERSE // use this setting for the LED_BUILTIN on WEMOS boards 105 | #elif defined(ESP32) 106 | #define PIN_RECEIVE 16 // D16 | G16 (depending on type / clone / seller) 107 | #define PIN_LED 2 // D2 | G2 (depending on type / clone / seller) 108 | #define PIN_SEND 4 // D4 | G4 (depending on type / clone / seller) // GDO0 Pin TX out 109 | #define ETHERNET_PRINT 110 | #elif ARDUINO_MAPLEMINI_F103CB 111 | #define PIN_LED 33 112 | #define PIN_SEND 17 // gdo0 Pin TX out 113 | #define PIN_RECEIVE 18 // gdo2 114 | #define PIN_WIZ_RST 27 // for LAN 115 | #else 116 | #define PIN_RECEIVE 2 117 | #define PIN_LED 13 // Message-LED 118 | #define PIN_SEND 11 119 | #endif 120 | #endif 121 | 122 | 123 | #endif /* END _COMPILE_CONFIG_h */ 124 | -------------------------------------------------------------------------------- /src/functions.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | #ifndef _FUNCTIONS_h 5 | #define _FUNCTIONS_h 6 | 7 | #if defined(ARDUINO) && ARDUINO >= 100 8 | #include "Arduino.h" 9 | #else 10 | // #include "WProgram.h" 11 | #endif 12 | 13 | #include "compile_config.h" 14 | #include 15 | #include "output.h" 16 | #include "SimpleFIFO.h" 17 | #include "cc1101.h" 18 | 19 | extern volatile unsigned long lastTime; 20 | extern SimpleFIFO FiFo; //store FIFO_LENGTH # ints 21 | extern SignalDetectorClass musterDec; 22 | extern bool hasCC1101; 23 | extern void DBG_PRINTtoHEX(uint8_t b); 24 | extern bool AfcEnabled; 25 | #ifdef CMP_CC1101 26 | #if defined (ESP8266) || defined (ESP32) 27 | extern bool wmbus; 28 | extern bool wmbus_t; 29 | #endif 30 | extern int8_t cc1101::freqOffAcc; 31 | extern float cc1101::freqErrAvg; 32 | #endif 33 | 34 | #define pulseMin 90 35 | 36 | 37 | #if !defined(ESP8266) && !defined(ESP32) 38 | #define IRAM_ATTR 39 | #else 40 | #ifdef ESP8266 41 | extern os_timer_t cronTimer; 42 | #endif 43 | #ifdef ESP32 44 | extern esp_timer_handle_t cronTimer; 45 | #endif 46 | #endif 47 | 48 | 49 | 50 | //========================= Pulseauswertung ================================================ 51 | void IRAM_ATTR handleInterrupt() { 52 | #ifdef ARDUINO_MAPLEMINI_F103CB 53 | noInterrupts(); 54 | #elif ESP32 55 | portMUX_TYPE mutex = portMUX_INITIALIZER_UNLOCKED; 56 | portENTER_CRITICAL(&mutex); 57 | #else 58 | cli(); 59 | #endif 60 | const unsigned long Time = micros(); 61 | const unsigned long duration = Time - lastTime; 62 | lastTime = Time; 63 | if (duration >= pulseMin) {//kleinste zulaessige Pulslaenge 64 | int sDuration; 65 | if (duration < maxPulse) {//groesste zulaessige Pulslaenge, max = 32000 66 | sDuration = int(duration); //das wirft bereits hier unnoetige Nullen raus und vergroessert den Wertebereich 67 | } 68 | else { 69 | sDuration = maxPulse; // Maximalwert set to maxPulse defined in lib. 70 | } 71 | if (isHigh(PIN_RECEIVE)) { // Wenn jetzt high ist, dann muss vorher low gewesen sein, und dafuer gilt die gemessene Dauer. 72 | sDuration = -sDuration; 73 | } 74 | FiFo.enqueue(sDuration); 75 | } // else => trash 76 | #ifdef ARDUINO_MAPLEMINI_F103CB 77 | interrupts(); 78 | #elif ESP32 79 | portEXIT_CRITICAL(&mutex); 80 | #else 81 | sei(); 82 | #endif 83 | } 84 | 85 | 86 | void enableReceive() { 87 | // ToDo MR if(cc1101::ccmode == 0) ??? 88 | attachInterrupt(digitalPinToInterrupt(PIN_RECEIVE), handleInterrupt, CHANGE); 89 | #ifdef CMP_CC1101 90 | if (hasCC1101) cc1101::setReceiveMode(); 91 | #endif 92 | } 93 | 94 | 95 | void disableReceive() { 96 | // ToDo MR if(cc1101::ccmode == 0) ??? 97 | detachInterrupt(digitalPinToInterrupt(PIN_RECEIVE)); 98 | 99 | #ifdef CMP_CC1101 100 | if (hasCC1101) cc1101::setIdleMode(); 101 | #endif 102 | FiFo.flush(); 103 | } 104 | 105 | 106 | //================================= EEProm commands ====================================== 107 | #if defined (CMP_CC1101) && (defined (ESP8266) || defined (ESP32)) 108 | void storeFunctions(const int8_t ms, int8_t mu, int8_t mc, int8_t red, int8_t afc, int8_t wmbus, int8_t wmbus_t) { 109 | #else 110 | void storeFunctions(const int8_t ms, int8_t mu, int8_t mc, int8_t red, int8_t afc) { 111 | #endif 112 | #ifdef CMP_CC1101 113 | if (afc == 0) { // reset AFC 114 | cc1101::freqOffAcc = 0; 115 | cc1101::freqErrAvg = 0; 116 | cc1101::writeReg(static_cast(0x0C), static_cast(afc) ); // reset 0x0C: FSCTRL0 – Frequency Synthesizer Control 117 | } 118 | #if defined (ESP8266) || defined (ESP32) 119 | if (wmbus == 1) { // WMBus 120 | mbus_init(wmbus_t + 1); // WMBus mode S or T 121 | } 122 | #endif 123 | #endif 124 | mu = mu << 1; 125 | mc = mc << 2; 126 | red = red << 3; 127 | afc = afc << 4; 128 | #if defined (CMP_CC1101) && (defined (ESP8266) || defined (ESP32)) 129 | wmbus = wmbus << 5; 130 | wmbus_t = wmbus_t << 6; 131 | int8_t dat = ms | mu | mc | red | afc | wmbus | wmbus_t; 132 | #else 133 | int8_t dat = ms | mu | mc | red | afc; 134 | #endif 135 | EEPROM.write(addr_features, dat); 136 | #if defined(ESP8266) || defined(ESP32) 137 | EEPROM.commit(); 138 | #endif 139 | } 140 | 141 | #if defined (CMP_CC1101) && (defined (ESP8266) || defined (ESP32)) 142 | void getFunctions(bool *ms, bool *mu, bool *mc, bool *red, bool *afc, bool *wmbus, bool *wmbus_t) { 143 | #else 144 | void getFunctions(bool *ms, bool *mu, bool *mc, bool *red, bool *afc) { 145 | #endif 146 | int8_t dat = EEPROM.read(addr_features); 147 | 148 | *ms = bool(dat &(1 << 0)); 149 | *mu = bool(dat &(1 << 1)); 150 | *mc = bool(dat &(1 << 2)); 151 | *red = bool(dat &(1 << 3)); 152 | *afc = bool(dat &(1 << 4)); 153 | #if defined (CMP_CC1101) && (defined (ESP8266) || defined (ESP32)) 154 | *wmbus = bool(dat &(1 << 5)); 155 | *wmbus_t = bool(dat &(1 << 6)); 156 | #endif 157 | } 158 | 159 | void dumpEEPROM() { 160 | #ifdef DEBUG 161 | DBG_PRINT(F("dump, ")); DBG_PRINT(FPSTR(TXT_EEPROM)); DBG_PRINTLN(F(":")); 162 | for (uint8_t i = EE_MAGIC_OFFSET; i < 56+ EE_MAGIC_OFFSET; i++) { 163 | DBG_PRINTtoHEX(EEPROM.read(i)); 164 | DBG_PRINT(FPSTR(TXT_BLANK)); 165 | if ((i & 0x0F) == 0x0F) 166 | DBG_PRINTLN(""); 167 | } 168 | DBG_PRINTLN(""); 169 | #endif 170 | } 171 | 172 | void initEEPROM(void) { 173 | #if defined(ESP8266) || defined(ESP32) 174 | EEPROM.begin(512); //Max bytes of eeprom to use 175 | #endif 176 | if (EEPROM.read(EE_MAGIC_OFFSET) == VERSION_1 && EEPROM.read(EE_MAGIC_OFFSET + 1) == VERSION_2) { 177 | DBG_PRINT(F("Reading values from ")); DBG_PRINT(FPSTR(TXT_EEPROM)); DBG_PRINT(FPSTR(TXT_DOT)); DBG_PRINT(FPSTR(TXT_DOT)); 178 | } else { 179 | #if defined (CMP_CC1101) && (defined (ESP8266) || defined (ESP32)) 180 | storeFunctions(1, 1, 1, 1, 0, 0, 0); // Init EEPROM with all flags enabled, AFC, WMBus and WMBus_T disabled 181 | #else 182 | storeFunctions(1, 1, 1, 1, 0); // Init EEPROM with all flags enabled, AFC disabled 183 | #endif 184 | //hier fehlt evtl ein getFunctions() 185 | MSG_PRINTLN(F("Init eeprom to defaults after flash")); 186 | EEPROM.write(EE_MAGIC_OFFSET, VERSION_1); 187 | EEPROM.write(EE_MAGIC_OFFSET + 1, VERSION_2); 188 | #ifdef CMP_CC1101 189 | cc1101::ccFactoryReset(); 190 | #endif 191 | 192 | #if defined(ESP8266) || defined(ESP32) 193 | EEPROM.commit(); 194 | #endif 195 | } 196 | #if defined (CMP_CC1101) && (defined (ESP8266) || defined (ESP32)) 197 | getFunctions(&musterDec.MSenabled, &musterDec.MUenabled, &musterDec.MCenabled, &musterDec.MredEnabled, &AfcEnabled, &wmbus, &wmbus_t); 198 | #else 199 | getFunctions(&musterDec.MSenabled, &musterDec.MUenabled, &musterDec.MCenabled, &musterDec.MredEnabled, &AfcEnabled); 200 | #endif 201 | DBG_PRINTLN(F("done")); 202 | dumpEEPROM(); 203 | } 204 | 205 | 206 | //================================= getUptime command Receiver ====================================== 207 | inline unsigned long getUptime() { 208 | unsigned long now = millis(); 209 | static uint16_t times_rolled = 0; 210 | static unsigned long last = 0; 211 | // If this run is less than the last the counter rolled 212 | //unsigned long seconds = now / 1000; 213 | if (now < last) { 214 | times_rolled++; 215 | } 216 | last = now; 217 | return (0xFFFFFFFF / 1000) * times_rolled + (now / 1000); 218 | } 219 | 220 | 221 | #endif // endif _FUNCTIONS_h 222 | -------------------------------------------------------------------------------- /src/main.cpp: -------------------------------------------------------------------------------- 1 | #include "main.h" -------------------------------------------------------------------------------- /src/main.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "signalduino.h" 4 | #include "signalesp.h" 5 | #include "signalSTM.h" 6 | -------------------------------------------------------------------------------- /src/send.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _SEND_h 4 | #define _SEND_h 5 | 6 | #if defined(ARDUINO) && ARDUINO >= 100 7 | #include "Arduino.h" 8 | #else 9 | // #include "WProgram.h" 10 | #endif 11 | #include "compile_config.h" 12 | 13 | extern bool hasCC1101; 14 | extern char IB_1[14]; 15 | 16 | //================================= RAW Send ====================================== 17 | void send_raw(char *startpos, char *endpos, const int16_t *buckets) 18 | { 19 | uint8_t index = 0; 20 | unsigned long stoptime = micros(); 21 | bool isLow; 22 | uint16_t dur; 23 | 24 | for (char *i = startpos; i < endpos; i++) 25 | { 26 | //DBG_PRINT(cmdstring.substring(i,i+1)); 27 | index = *i - '0'; 28 | //DBG_PRINT(index); 29 | isLow = buckets[index] >> 15; 30 | dur = abs(buckets[index]); //isLow ? dur = abs(buckets[index]) : dur = abs(buckets[index]); 31 | #ifdef ESP8266 32 | yield(); 33 | #endif 34 | while (stoptime > micros()) { 35 | ; 36 | } 37 | isLow ? digitalLow(PIN_SEND) : digitalHigh(PIN_SEND); 38 | stoptime += dur; 39 | } 40 | while (stoptime > micros()) { 41 | ; 42 | } 43 | } 44 | 45 | 46 | 47 | // SM;R=2;C=400;D=AFAFAF; 48 | 49 | void send_mc(const char *startpos, const char *endpos, const int16_t clock) 50 | { 51 | int8_t b; 52 | uint8_t bit; 53 | 54 | unsigned long stoptime = micros(); 55 | for (char *i = (char*)startpos; i < endpos; i++) { 56 | b = ((byte)*i) - (*i <= '9' ? 0x30 : 0x37); 57 | 58 | for (bit = 0x8; bit > 0; bit >>= 1) { 59 | for (byte i = 0; i <= 1; i++) { 60 | if ((i == 0 ? (b & bit) : !(b & bit))) 61 | digitalLow(PIN_SEND); 62 | else 63 | digitalHigh(PIN_SEND); 64 | 65 | stoptime += clock; 66 | while (stoptime > micros()) 67 | { 68 | #ifdef ESP8266 69 | yield(); 70 | #endif 71 | } 72 | } 73 | 74 | } 75 | 76 | } 77 | // MSG_PRINTLN(""); 78 | } 79 | 80 | 81 | 82 | // SC;R=4;SM;C=400;D=AFFFFFFFFE;SR;P0=-2500;P1=400;D=010;SM;D=AB6180;SR;D=101; 83 | // SC;R=4;SM;C=400;D=FFFFFFFF;SR;P0=-400;P1=400;D=101;SM;D=AB6180;SR;D=101; 84 | // SR;R=3;P0=1230;P1=-3120;P2=-400;P3=-900;D=030301010101010202020202020101010102020202010101010202010120202; 85 | // SM;C=400;D=AAAAFFFF; 86 | // SR;R=10;P0=-2000;P1=-1000;P2=500;P3=-6000;D=2020202021212020202121212021202021202121212023; 87 | 88 | // SC;R=6;SR;P0=-2560;P1=2560;P3=-640;D=10101010101010113;SM;C=645;D=A1E7E7D6F88D88;F=10AB85550A; # SOMFY 89 | // SN;R=13;N=2;D=91C6496AFAAC7070151E465B; # xFSK Lacrosse 90 | 91 | #define maxNumPattern 8 92 | struct s_sendcmd { 93 | int16_t sendclock = 0; 94 | uint8_t type; 95 | char *datastart; 96 | char *dataend; 97 | int16_t buckets[maxNumPattern]; 98 | uint8_t repeats = 1; 99 | }; 100 | 101 | void send_cmd() 102 | { 103 | #define SD_combined 0 104 | #define SD_manchester 1 105 | #define SD_raw 2 106 | #define SD_xFSK 3 107 | disableReceive(); 108 | 109 | uint8_t repeats = 1; // Default is always one iteration so repeat is 1 if not set 110 | //int16_t start_pos = 0; 111 | uint8_t counter = 0; 112 | bool extraDelay = true; 113 | 114 | s_sendcmd command[5]; 115 | 116 | #ifdef CMP_CC1101 117 | uint8_t ccParamAnz = 0; // Anzahl der per F= uebergebenen cc1101 Register 118 | uint8_t ccReg[6]; 119 | uint8_t val; 120 | #endif 121 | 122 | uint8_t cmdNo = 255; 123 | 124 | char buf[256] = {}; // Second Buffer 256 Bytes 0-255 125 | char *msg_beginptr = IB_1; 126 | char *msg_endptr = buf; 127 | uint8_t buffer_left = 255; 128 | do 129 | { 130 | 131 | //if (cmdNo == 255) msg_part = IB_1; 132 | 133 | 134 | //DBG_PRINT(msg_beginptr); 135 | if (msg_beginptr[0] == 'S') 136 | { 137 | if (msg_beginptr[1] == 'C') // send combined information flag 138 | { 139 | cmdNo++; 140 | command[cmdNo].type = SD_combined; 141 | extraDelay = false; 142 | } 143 | else if (msg_beginptr[1] == 'M') // send manchester 144 | { 145 | cmdNo++; 146 | command[cmdNo].type = SD_manchester; 147 | DBG_PRINTLN(F("Adding manchester")); 148 | 149 | } 150 | else if (msg_beginptr[1] == 'R') // send raw 151 | { 152 | cmdNo++; 153 | command[cmdNo].type = SD_raw; 154 | DBG_PRINTLN(F("Adding raw")); 155 | extraDelay = false; 156 | } 157 | else if (msg_beginptr[1] == 'N') // send xFSK 158 | { 159 | cmdNo++; 160 | command[cmdNo].type = SD_xFSK; 161 | DBG_PRINTLN(F("Adding xFSK message")); 162 | } 163 | if (cmdNo == 0) { 164 | DBG_PRINTLN(F("rearrange beginptr")); 165 | MSG_WRITE(IB_1,3); // ccho command, only 3 chars string is not null terminated! 166 | msg_endptr = buf; // rearrange to beginning of buf 167 | msg_beginptr = nullptr; 168 | } 169 | } 170 | else if (msg_beginptr[0] == 'P' && msg_beginptr[2] == '=') // Do some basic detection if data matches what we expect 171 | { 172 | counter = msg_beginptr[1] - '0'; // Convert to dec value 173 | if (counter < maxNumPattern) { 174 | command[cmdNo].buckets[counter] = strtol(&msg_beginptr[3], &msg_endptr, 10); 175 | //*(msg_endptr + 1) = '\0'; 176 | DBG_PRINTLN(F("Adding bucket")); 177 | if (cmdNo == 0) { 178 | MSG_PRINT(msg_beginptr); 179 | msg_endptr = buf; // rearrange to beginning of buf 180 | msg_beginptr = nullptr; 181 | } 182 | } 183 | } 184 | else if (msg_beginptr[0] == 'R' && msg_beginptr[1] == '=') { 185 | command[cmdNo].repeats = strtoul(&msg_beginptr[2], &msg_endptr, 10); 186 | //*(msg_endptr + 1) = '\0'; 187 | DBG_PRINT(F("Adding repeats: ")); DBG_PRINTLN(command[cmdNo].repeats); 188 | if (cmdNo == 0) { 189 | MSG_PRINT(msg_beginptr); 190 | msg_endptr = buf; // rearrange to beginning of buf 191 | msg_beginptr = nullptr; 192 | } 193 | } 194 | else if (msg_beginptr[0] == 'D' && msg_beginptr[1] == '=') { 195 | command[cmdNo].datastart = msg_beginptr + 2; 196 | command[cmdNo].dataend = msg_endptr = (char*)memchr(msg_beginptr + 3, ';', buf + 255 - msg_beginptr + 3); 197 | //if (command[cmdNo].dataend != NULL) command[cmdNo].dataend= command[cmdNo].dataend-1; 198 | DBG_PRINT(F("locating data start:")); 199 | DBG_PRINT(command[cmdNo].datastart); 200 | DBG_PRINT(F(" end:")); 201 | DBG_PRINTLN(command[cmdNo].dataend); 202 | } 203 | else if (msg_beginptr[0] == 'C' && msg_beginptr[1] == '=') 204 | { 205 | //sendclock = msg_part.substring(2).toInt(); 206 | command[cmdNo].sendclock = strtoul(&msg_beginptr[2], &msg_endptr, 10); 207 | DBG_PRINTLN(F("adding sendclock")); 208 | } 209 | #ifdef CMP_CC1101 210 | else if (msg_beginptr[0] == 'F' && msg_beginptr[1] == '=') 211 | { 212 | ccParamAnz = (msg_endptr - msg_beginptr - 1) / 2; 213 | if (ccParamAnz > 0 && ccParamAnz <= 5 && hasCC1101) { 214 | //uint8_t hex; 215 | DBG_PRINT(F("write new ccregs #")); DBG_PRINTLN(ccParamAnz); 216 | char b[3]; 217 | b[2] = '\0'; 218 | for (uint8_t i = 0; i < ccParamAnz; i++) 219 | { 220 | ccReg[i] = cc1101::readReg(0x0d + i, 0x80); // alte Registerwerte merken 221 | memcpy(b, msg_beginptr + 2 + (i * 2), 2); 222 | val = strtol(b, nullptr, 16); 223 | cc1101::writeReg(0x0d + i, val); // neue Registerwerte schreiben 224 | DBG_PRINT(b); 225 | } 226 | DBG_PRINTLN(""); 227 | } 228 | } 229 | #endif 230 | if (msg_endptr == msg_beginptr) 231 | { 232 | DBG_PRINTLN(F("break loop")); 233 | break; // break the loop now 234 | 235 | } 236 | else { 237 | if (msg_endptr != buf) 238 | msg_endptr++; 239 | msg_beginptr = msg_endptr; 240 | //MSG_PRINTER.setTimeout(1000); 241 | //msg_endptr = MSG_PRINTER.readBytesUntil(';', msg_endptr, 128) + msg_beginptr ; 242 | uint8_t l = 0; 243 | do { 244 | msg_endptr += l; 245 | buffer_left -= l; 246 | l = MSG_PRINTER.readBytes(msg_endptr, 1); 247 | if (l == 0) { 248 | DBG_PRINTLN(F("TOUT")); break; 249 | } 250 | } while (msg_endptr[0] != ';' && msg_endptr[0] != '\n' && buffer_left > 0); 251 | if (l == 0) 252 | { 253 | MSG_PRINT(FPSTR(TXT_SENDCMD)); 254 | MSG_PRINTLN(FPSTR(TXT_CORRUPT)); 255 | return; 256 | } 257 | if (buffer_left == 0) 258 | { 259 | delayMicroseconds(300); 260 | MSG_PRINTER.readBytesUntil('\n', buf, 255); 261 | MSG_PRINT(FPSTR(TXT_SENDCMD)); 262 | MSG_PRINTLN(FPSTR(TXT_TOLONG)); 263 | return; 264 | } 265 | if (msg_endptr[0] == '\n') { // End of command 266 | break; 267 | } 268 | 269 | *(msg_endptr + 1) = '\0'; // Nullterminate the string 270 | 271 | } 272 | } while (msg_beginptr != NULL); 273 | 274 | #ifdef CMP_CC1101 275 | if (hasCC1101) { 276 | cc1101::setTransmitMode(); 277 | } 278 | #endif 279 | 280 | if (command[0].type == SD_combined && command[0].repeats > 0) { 281 | /* only on combined message typ (MC) / ARDUINO IDE - LineEnd = NEW Line 282 | 283 | repeats 3 --> SC;R=4;SM;C=400;D=AFFFFFFFFE;SR;P0=-2500;P1=400;D=010;SM;D=AB6180;SR;D=101; type MC - ASK/OOK 284 | repeats 1 --> SR;R=3;P0=500;P1=-9000;P2=-4000;P3=-2000;D=0302030; type MU - ASK/OOK 285 | repeats 1 --> SN;R=5;D=9A46036AC8D3923EAEB470AB; type MN - xFSK 286 | repeats 1 --> SM;R=3;P0=500;C=250;D=A4F7FDDE; type MS - ASK/OOK 287 | */ 288 | repeats = command[0].repeats; 289 | } 290 | for (uint8_t i = 0; i < repeats; i++) 291 | { 292 | DBG_PRINT(F("msg ")); DBG_PRINT(i + 1); DBG_PRINT('/'); DBG_PRINT(repeats); 293 | 294 | for (uint8_t c = 0; c <= cmdNo; c++) 295 | { 296 | DBG_PRINT(F(" part ")); DBG_PRINT(c); DBG_PRINT('/'); DBG_PRINT(cmdNo); 297 | DBG_PRINT(F(" repeats ")); DBG_PRINTLN(command[c].repeats); 298 | 299 | if (command[c].type == SD_raw) { for (uint8_t rep = 0; rep < command[c].repeats; rep++) send_raw(command[c].datastart, command[c].dataend, command[c].buckets); } 300 | else if (command[c].type == SD_manchester) { for (uint8_t rep = 0; rep < command[c].repeats; rep++)send_mc(command[c].datastart, command[c].dataend, command[c].sendclock); } 301 | 302 | #if defined CMP_CC1101 303 | else if (command[c].type == SD_xFSK) { 304 | for (uint8_t rep = 0; rep < command[c].repeats; rep++) { 305 | if (rep > 0) { cc1101::setTransmitMode(); } 306 | cc1101::sendFIFO(command[cmdNo].datastart, command[c].dataend); 307 | } 308 | } 309 | #endif 310 | 311 | if (command[cmdNo].type != 3) { digitalLow(PIN_SEND); } /* only not xFSK */ 312 | } 313 | 314 | if (extraDelay) delay(1); 315 | } 316 | 317 | #ifdef CMP_CC1101 318 | if (ccParamAnz > 0) { 319 | DBG_PRINT(F("ccreg write back ")); 320 | //char b[3]; 321 | for (uint8_t i = 0; i < ccParamAnz; i++) 322 | { 323 | //val = ccReg[i]; 324 | //sprintf_P(b,PSTR("%02X"), val); 325 | cc1101::writeReg(0x0d + i, ccReg[i]); // gemerkte Registerwerte zurueckschreiben 326 | //MSG_PRINT(b); 327 | } 328 | DBG_PRINTLN(""); 329 | } 330 | #endif 331 | DBG_PRINT(IB_1); 332 | MSG_PRINT(buf); // echo data of command 333 | 334 | if (command[cmdNo].type != 3) // not xFSK 335 | { 336 | musterDec.reset(); 337 | FiFo.flush(); 338 | } else { 339 | #ifdef CMP_CC1101 340 | //MSG_PRINT(F("Marcs=")); 341 | //MSG_PRINTLN(cc1101::getMARCSTATE()); // 0x35 (0xF5): MARCSTATE –Main Radio Control State Machine State 342 | #else 343 | MSG_PRINTLN("no supported device to send"); 344 | #endif 345 | } 346 | enableReceive(); // enable the receiver 347 | } 348 | 349 | 350 | 351 | #endif 352 | -------------------------------------------------------------------------------- /src/signalSTM.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef ARDUINO_ARCH_STM32 4 | /* 5 | 6 | * notes different boards: 7 | * https://github.com/firmata/arduino/blob/master/Boards.h 8 | * https://danieleff.github.io/STM32GENERIC/build_macros/ 9 | 10 | */ 11 | 12 | #include "compile_config.h" 13 | 14 | /* 15 | 16 | * developer: 17 | * 2020 S.Butzek, HomeAutoUser, elektron-bbs 18 | 19 | * Integration for compatibility with a similar project by Ralf9 20 | 21 | * tested hardware: 22 | * - Maple Mini STM32F103CBT6 23 | 24 | */ 25 | 26 | #define PROGNAME " SIGNALSTM32 " 27 | #define VERSION_1 0x33 28 | #define VERSION_2 0x1d 29 | 30 | #define BAUDRATE 115200 31 | #define FIFO_LENGTH 170 32 | 33 | #ifdef ARDUINO_MAPLEMINI_F103CB 34 | uint8_t radionr = 1; // variant -> Circuit board for four connected cc110x devices - standard value 1 = B (defSelRadio) 35 | uint8_t radio_bank[4]; // variant -> Circuit board for four connected cc110x devices 36 | #endif 37 | 38 | 39 | // EEProm Address 40 | #define EE_MAGIC_OFFSET 0 41 | #define addr_features 0xff 42 | 43 | 44 | // Predeclation 45 | void serialEvent(); 46 | void cronjob(); 47 | int freeRam(); 48 | void configSET(); 49 | uint8_t rssiCallback() { return 0; }; // Dummy return if no rssi value can be retrieved from receiver 50 | size_t writeCallback(const uint8_t *buf, uint8_t len = 1); 51 | 52 | extern char _estack; 53 | extern char _Min_Stack_Size; 54 | static char *ramend = &_estack; 55 | static char *minSP = (char*)(ramend - &_Min_Stack_Size); 56 | extern "C" char *sbrk(int i); 57 | 58 | //Includes 59 | #ifdef WATCHDOG_STM32 60 | #include 61 | bool watchRes = false; 62 | #endif 63 | 64 | #include "FastDelegate.h" 65 | #include "output.h" 66 | #include "bitstore.h" 67 | #include "signalDecoder.h" 68 | #include 69 | #include "commands.h" 70 | #include "functions.h" 71 | #include "send.h" 72 | #include "SimpleFIFO.h" 73 | SimpleFIFO FiFo; //store FIFO_LENGTH # ints 74 | SignalDetectorClass musterDec; 75 | #include 76 | #include "cc1101.h" 77 | 78 | volatile bool blinkLED = false; 79 | volatile unsigned long lastTime = micros(); 80 | bool hasCC1101 = false; 81 | bool AfcEnabled = true; 82 | char IB_1[14]; // Input Buffer one - capture commands 83 | 84 | HardwareTimer *Timer1 = new HardwareTimer(TIM1); 85 | 86 | 87 | 88 | void setup() { 89 | pinAsOutput(PIN_WIZ_RST); 90 | 91 | Serial.begin(BAUDRATE); 92 | while (!Serial) { 93 | ; // wait for serial port to connect. Needed for native USB 94 | } 95 | 96 | #ifdef WATCHDOG_STM32 97 | if (IWatchdog.isReset(true)) { 98 | MSG_PRINTLN(F("Watchdog caused a reset")); 99 | watchRes = true; 100 | } else { 101 | watchRes = false; 102 | } 103 | IWatchdog.begin(20000000); // Init the watchdog timer with 20 seconds timeout 104 | if (IWatchdog.isEnabled()) { 105 | MSG_PRINTLN(F("Watchdog enabled")); 106 | } 107 | #endif 108 | 109 | pinAsInput(PIN_RECEIVE); 110 | pinAsOutput(PIN_LED); 111 | // CC1101 112 | 113 | #ifdef CMP_CC1101 114 | cc1101::setup(); 115 | #endif 116 | 117 | initEEPROM(); 118 | 119 | #ifdef CMP_CC1101 120 | cc1101::CCinit(); // CC1101 init 121 | hasCC1101 = cc1101::checkCC1101(); // Check for cc1101 122 | 123 | if (hasCC1101) 124 | { 125 | DBG_PRINT(FPSTR(TXT_CC1101)); DBG_PRINTLN(FPSTR(TXT_FOUND)); 126 | musterDec.setRSSICallback(&cc1101::getRSSI); // Provide the RSSI Callback 127 | } else { 128 | musterDec.setRSSICallback(&rssiCallback); // Provide the RSSI Callback 129 | } 130 | #endif 131 | 132 | pinAsOutput(PIN_SEND); 133 | DBG_PRINTLN(F("Starting timerjob")); 134 | delay(50); 135 | 136 | // https://github.com/stm32duino/wiki/wiki/HardwareTimer-library 137 | Timer1->setMode(2, TIMER_OUTPUT_COMPARE); 138 | Timer1->setOverflow(32001, MICROSEC_FORMAT); 139 | Timer1->attachInterrupt(cronjob); 140 | Timer1->resume(); 141 | 142 | /*MSG_PRINT("MS:"); MSG_PRINTLN(musterDec.MSenabled); 143 | MSG_PRINT("MU:"); MSG_PRINTLN(musterDec.MUenabled); 144 | MSG_PRINT("MC:"); MSG_PRINTLN(musterDec.MCenabled);*/ 145 | //cmdstring.reserve(40); 146 | 147 | musterDec.setStreamCallback(&writeCallback); 148 | 149 | #ifdef CMP_CC1101 150 | if (!hasCC1101 || cc1101::regCheck()) { 151 | #endif 152 | enableReceive(); 153 | DBG_PRINTLN(FPSTR(TXT_RECENA)); 154 | #ifdef CMP_CC1101 155 | } else { 156 | DBG_PRINT(FPSTR(TXT_CC1101)); 157 | DBG_PRINT(FPSTR(TXT_DOFRESET)); 158 | DBG_PRINTLN(FPSTR(TXT_COMMAND)); 159 | } 160 | #endif 161 | MSG_PRINTER.setTimeout(400); 162 | } 163 | 164 | 165 | 166 | void cronjob() { 167 | noInterrupts(); 168 | static uint8_t cnt = 0; 169 | const unsigned long duration = micros() - lastTime; 170 | long timerTime = maxPulse - duration; 171 | 172 | if (timerTime < 1000) 173 | timerTime=1000; 174 | 175 | // Timer1->pause(); // ToDo: Timer stopt, why ??? -> no blinkLED action 176 | Timer1->setOverflow(timerTime, MICROSEC_FORMAT); 177 | if (duration > maxPulse) { // Auf Maximalwert pruefen. 178 | int sDuration = maxPulse; 179 | if (isLow(PIN_RECEIVE)) { // Wenn jetzt low ist, ist auch weiterhin low 180 | sDuration = -sDuration; 181 | } 182 | FiFo.enqueue(sDuration); 183 | lastTime = micros(); 184 | } 185 | 186 | #ifdef PIN_LED_INVERSE 187 | digitalWrite(PIN_LED, !blinkLED); 188 | #else 189 | digitalWrite(PIN_LED, blinkLED); 190 | #endif 191 | 192 | blinkLED = false; 193 | interrupts(); 194 | 195 | // Infrequent time uncritical jobs (~ every 2 hours) 196 | if (cnt++ == 0) // if cnt is 0 at start or during rollover 197 | getUptime(); 198 | } 199 | 200 | 201 | 202 | /* 203 | * not used now ! 204 | * these are preparations if the project can be expanded to 4 cc110x 205 | 206 | uint16_t getBankOffset(uint8_t tmpBank) { 207 | uint16_t bankOffs; 208 | if (tmpBank == 0) { 209 | bankOffs = 0; 210 | } 211 | else { 212 | bankOffs = 0x100 + ((tmpBank - 1) * 0x40); 213 | } 214 | return bankOffs; 215 | } 216 | 217 | */ 218 | 219 | 220 | 221 | void loop() { 222 | static int aktVal=0; 223 | bool state; 224 | 225 | #ifdef WATCHDOG_STM32 226 | IWatchdog.reload(); 227 | #endif 228 | 229 | #ifdef CMP_CC1101 230 | if (cc1101::ccmode == 3) { // ASK/OOK = 3 (default) 231 | #endif 232 | while (FiFo.count()>0 ) { // Puffer auslesen und an Dekoder uebergeben 233 | aktVal=FiFo.dequeue(); 234 | state = musterDec.decode(&aktVal); 235 | if (state) blinkLED=true; // LED blinken, wenn Meldung dekodiert 236 | } 237 | #ifdef CMP_CC1101 238 | } else { 239 | cc1101::getRxFifo(0); // xFSK = 0 240 | } 241 | #endif 242 | } 243 | 244 | 245 | 246 | //============================== Write callback ========================================= 247 | size_t writeCallback(const uint8_t *buf, uint8_t len) 248 | { 249 | while (!MSG_PRINTER.availableForWrite() ) 250 | yield(); 251 | //DBG_PRINTLN("Called writeCallback"); 252 | 253 | //MSG_PRINT(*buf); 254 | //MSG_WRITE(buf, len); 255 | return MSG_PRINTER.write(buf,len); 256 | 257 | //serverClient.write("test"); 258 | } 259 | 260 | 261 | 262 | //================================= Serielle verarbeitung ====================================== 263 | void serialEvent() 264 | { 265 | static uint8_t idx = 0; 266 | while (MSG_PRINTER.available()) 267 | { 268 | if (idx == 14) { 269 | // Short buffer is now full 270 | MSG_PRINT(F("Command to long: ")); 271 | MSG_PRINTLN(IB_1); 272 | idx = 0; 273 | return; 274 | } else { 275 | IB_1[idx] = (char)MSG_PRINTER.read(); 276 | switch (IB_1[idx]) 277 | { 278 | case '\n': 279 | case '\r': 280 | case '\0': 281 | case '#': 282 | //wdt_reset(); 283 | commands::HandleShortCommand(); // Short command received and can be processed now 284 | idx = 0; 285 | return; //Exit function 286 | case ';': 287 | DBG_PRINT("send cmd detected "); 288 | DBG_PRINTLN(idx); 289 | send_cmd(); 290 | idx = 0; // increments to 1 291 | return; //Exit function 292 | } 293 | idx++; 294 | } 295 | } 296 | } 297 | 298 | 299 | 300 | int freeRam () { 301 | char *heapend = (char*)sbrk(0); 302 | char * stack_ptr = (char*)__get_MSP(); 303 | struct mallinfo mi = mallinfo(); 304 | return (((stack_ptr < minSP) ? stack_ptr : minSP) - heapend + mi.fordblks); 305 | } 306 | 307 | 308 | 309 | #endif // END, ARDUINO_ARCH_STM32 310 | -------------------------------------------------------------------------------- /src/signalduino.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | /* 4 | * RF_RECEIVER v3.5.0 for Arduino 5 | * Sketch to use an arduino as a receiver/sending device for digital signals 6 | * 7 | * The Sketch can also encode and send data via a transmitter, 8 | * while only PT2262 type-signals for Intertechno devices are implemented in the sketch, 9 | * there is an option to send almost any data over a send raw interface 10 | * 2014-2015 N.Butzek, S.Butzek 11 | * 2016-2018 S.Butzek 12 | 13 | * This software focuses on remote sensors like weather sensors (temperature, 14 | * humidity Logilink, TCM, Oregon Scientific, ...), remote controlled power switches 15 | * (Intertechno, TCM, ARCtech, ...) which use encoder chips like PT2262 and 16 | * EV1527-type and manchester encoder to send information in the 433MHz Band. 17 | * But the sketch will also work for infrared or other medias. Even other frequencys 18 | * can be used 19 | * 20 | * This program is free software: you can redistribute it and/or modify 21 | * it under the terms of the GNU General Public License as published by 22 | * the Free Software Foundation, either version 3 of the License, or 23 | * (at your option) any later version. 24 | * 25 | * This program is distributed in the hope that it will be useful, 26 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 27 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 28 | * GNU General Public License for more details. 29 | * 30 | * You should have received a copy of the GNU General Public License 31 | * along with this program. If not, see . 32 | 33 | */ 34 | 35 | 36 | // See config flags in compile_config.h: 37 | #include "compile_config.h" 38 | 39 | 40 | #define VERSION_1 0x33 41 | #define VERSION_2 0x1d 42 | 43 | #if defined(__AVR__) 44 | #define PROGNAME " SIGNALduino " 45 | 46 | #define BAUDRATE 57600 // 500000 //57600 47 | #define FIFO_LENGTH 90 // 150 48 | 49 | // EEProm Address 50 | #define EE_MAGIC_OFFSET 0 51 | #define addr_features 0xff 52 | 53 | 54 | // Predeclation 55 | void serialEvent(); 56 | void cronjob(); 57 | int freeRam(); 58 | void configSET(); 59 | uint8_t rssiCallback() { return 0; }; // Dummy return if no rssi value can be retrieved from receiver 60 | size_t writeCallback(const uint8_t *buf, uint8_t len = 1); 61 | 62 | 63 | 64 | //Includes 65 | //#include 66 | #include "FastDelegate.h" 67 | #include "output.h" 68 | #include "bitstore.h" 69 | #include "signalDecoder.h" 70 | #include "TimerOne.h" // Timer for LED Blinking 71 | #include "commands.h" 72 | #include "functions.h" 73 | #include "send.h" 74 | #include "SimpleFIFO.h" 75 | SimpleFIFO FiFo; //store FIFO_LENGTH # ints 76 | SignalDetectorClass musterDec; 77 | 78 | 79 | #include 80 | #include "cc1101.h" 81 | 82 | volatile bool blinkLED = false; 83 | //String cmdstring = ""; 84 | volatile unsigned long lastTime = micros(); 85 | bool hasCC1101 = false; 86 | bool AfcEnabled = true; 87 | char IB_1[14]; // Input Buffer one - capture commands 88 | 89 | 90 | 91 | 92 | 93 | void setup() { 94 | Serial.begin(BAUDRATE); 95 | while (!Serial) { 96 | ; // wait for serial port to connect. Needed for native USB 97 | } 98 | 99 | // defined states - pullup on for unused pins 100 | // start behind RX / TX Pin´s --> all hardware used for system serial 0 & 1 101 | // not radino (other boards) --> end on Pin 23 102 | // radino --> end on Pin 29 (CCM_radino_CC1101.pdf | sources In-Circuit -> pins_arduino.h) 103 | for (uint8_t i=2 ; i<=29;i++) { 104 | #ifndef ARDUINO_RADINOCC1101 105 | if (i>23) break; 106 | #endif 107 | 108 | if (i==LED_BUILTIN) continue; 109 | if (i==PIN_LED) continue; 110 | if (i==PIN_RECEIVE) continue; 111 | if (i==PIN_SEND) continue; 112 | 113 | #ifdef CMP_CC1101 114 | if (i==MOSI || i==MISO || i==SCK || i==SS) continue; 115 | #endif 116 | 117 | #if defined(ARDUINO_RADINOCC1101) || defined(ARDUINO_ATMEGA328P_MINICUL) 118 | if (i==PIN_MARK433) continue; 119 | 120 | #ifdef ARDUINO_RADINOCC1101 121 | if (i==8 || i==LED_BUILTIN_RX || i==LED_BUILTIN_TX) continue; // special pin ´s --> ...\packages\In-Circuit\hardware\avr\1.0.0\variants\ictmicro --> pins_arduino.h 122 | #endif 123 | #endif 124 | pinAsInputPullUp(i); 125 | } 126 | 127 | //delay(2000); 128 | pinAsInput(PIN_RECEIVE); 129 | pinAsOutput(PIN_LED); 130 | // CC1101 131 | 132 | //wdt_reset(); 133 | 134 | #ifdef CMP_CC1101 135 | cc1101::setup(); 136 | #endif 137 | initEEPROM(); 138 | 139 | #ifdef CMP_CC1101 140 | cc1101::CCinit(); // CC1101 init 141 | hasCC1101 = cc1101::checkCC1101(); // Check for cc1101 142 | 143 | 144 | if (hasCC1101) 145 | { 146 | DBG_PRINT(FPSTR(TXT_CC1101)); DBG_PRINTLN(FPSTR(TXT_FOUND)); 147 | musterDec.setRSSICallback(&cc1101::getRSSI); // Provide the RSSI Callback 148 | } else { 149 | musterDec.setRSSICallback(&rssiCallback); // Provide the RSSI Callback 150 | } 151 | #endif 152 | 153 | pinAsOutput(PIN_SEND); 154 | DBG_PRINTLN(F("Starting timerjob")); 155 | delay(50); 156 | 157 | Timer1.initialize(32001); //Interrupt wird jede 32001 Millisekunden ausgeloest 158 | Timer1.attachInterrupt(cronjob); 159 | 160 | /*MSG_PRINT("MS:"); MSG_PRINTLN(musterDec.MSenabled); 161 | MSG_PRINT("MU:"); MSG_PRINTLN(musterDec.MUenabled); 162 | MSG_PRINT("MC:"); MSG_PRINTLN(musterDec.MCenabled);*/ 163 | //cmdstring.reserve(40); 164 | 165 | musterDec.setStreamCallback(&writeCallback); 166 | 167 | #ifdef CMP_CC1101 168 | if (!hasCC1101 || cc1101::regCheck()) { 169 | #endif 170 | 171 | enableReceive(); 172 | DBG_PRINTLN(FPSTR(TXT_RECENA)); 173 | 174 | #ifdef CMP_CC1101 175 | } else { 176 | DBG_PRINT(FPSTR(TXT_CC1101)); 177 | DBG_PRINT(FPSTR(TXT_DOFRESET)); 178 | DBG_PRINTLN(FPSTR(TXT_COMMAND)); 179 | } 180 | #endif 181 | 182 | MSG_PRINTER.setTimeout(400); 183 | } 184 | 185 | 186 | void cronjob() { 187 | static uint8_t cnt = 0; 188 | cli(); 189 | const unsigned long duration = micros() - lastTime; 190 | 191 | Timer1.setPeriod(32001); 192 | 193 | if (duration >= maxPulse) { //Auf Maximalwert pruefen. 194 | int sDuration = maxPulse; 195 | if (isLow(PIN_RECEIVE)) { // Wenn jetzt low ist, ist auch weiterhin low 196 | sDuration = -sDuration; 197 | } 198 | FiFo.enqueue(sDuration); 199 | lastTime = micros(); 200 | } else if (duration > 10000) { 201 | Timer1.setPeriod(maxPulse-duration+16); 202 | } 203 | 204 | #ifdef PIN_LED_INVERSE 205 | digitalWrite(PIN_LED, !blinkLED); 206 | #else 207 | digitalWrite(PIN_LED, blinkLED); 208 | #endif 209 | 210 | blinkLED = false; 211 | sei(); 212 | 213 | // Infrequent time uncritical jobs (~ every 2 hours) 214 | if (cnt++ == 0) // if cnt is 0 at start or during rollover 215 | getUptime(); 216 | } 217 | 218 | 219 | void loop() { 220 | static int aktVal=0; 221 | bool state; 222 | 223 | #ifdef __AVR_ATmega32U4__ 224 | serialEvent(); 225 | #endif 226 | //wdt_reset(); 227 | 228 | #ifdef CMP_CC1101 229 | if (cc1101::ccmode == 3) { // ASK/OOK = 3 (default) 230 | #endif 231 | while (FiFo.count()>0 ) { // Puffer auslesen und an Dekoder uebergeben 232 | aktVal=FiFo.dequeue(); 233 | state = musterDec.decode(&aktVal); 234 | if (state) blinkLED=true; // LED blinken, wenn Meldung dekodiert 235 | } 236 | #ifdef CMP_CC1101 237 | } else { 238 | cc1101::getRxFifo(0); // xFSK = 0 239 | } 240 | #endif 241 | } 242 | 243 | 244 | 245 | //============================== Write callback ========================================= 246 | size_t writeCallback(const uint8_t *buf, uint8_t len) 247 | { 248 | while (!MSG_PRINTER.availableForWrite() ) 249 | yield(); 250 | //DBG_PRINTLN("Called writeCallback"); 251 | 252 | //MSG_PRINT(*buf); 253 | //MSG_WRITE(buf, len); 254 | return MSG_PRINTER.write(buf,len); 255 | 256 | //serverClient.write("test"); 257 | } 258 | 259 | 260 | 261 | //================================= Serielle verarbeitung ====================================== 262 | void serialEvent() 263 | { 264 | static uint8_t idx = 0; 265 | while (MSG_PRINTER.available()) 266 | { 267 | if (idx == 14) { 268 | // Short buffer is now full 269 | MSG_PRINT(F("Command to long: ")); 270 | MSG_PRINTLN(IB_1); 271 | idx = 0; 272 | return; 273 | } else { 274 | IB_1[idx] = (char)MSG_PRINTER.read(); 275 | switch (IB_1[idx]) 276 | { 277 | case '\n': 278 | case '\r': 279 | case '\0': 280 | case '#': 281 | //wdt_reset(); 282 | commands::HandleShortCommand(); // Short command received and can be processed now 283 | idx = 0; 284 | return; //Exit function 285 | case ';': 286 | DBG_PRINT("send cmd detected "); 287 | DBG_PRINTLN(idx); 288 | send_cmd(); 289 | idx = 0; // increments to 1 290 | return; //Exit function 291 | } 292 | idx++; 293 | } 294 | } 295 | } 296 | 297 | 298 | 299 | int freeRam () { 300 | extern int __heap_start, *__brkval; 301 | int v; 302 | return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval); 303 | } 304 | 305 | 306 | 307 | #endif // END defined(__AVR__) 308 | -------------------------------------------------------------------------------- /src/wifi-config.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #if defined (ESP32) || defined(ESP8266) 4 | 5 | #ifdef ESP8266 6 | #include 7 | #include //Local WebServer used to serve the configuration portal 8 | #elif defined(ESP32) 9 | #include 10 | #include 11 | #endif 12 | 13 | #include "ArduinoJson.h" 14 | #include "WiFiManager.h" //https://github.com/tzapu/WiFiManager 15 | 16 | extern WiFiManager wifiManager; 17 | 18 | 19 | //default custom static IP 20 | char static_ip[16] = "0.0.0.0"; 21 | char static_gw[16] = "0.0.0.0"; 22 | char static_sn[16] = "0.0.0.0"; 23 | 24 | //flag for saving data 25 | bool shouldSaveConfig = false; 26 | 27 | 28 | void configModeCallback(WiFiManager *myWiFiManager) { 29 | Serial.println("Entered config mode"); 30 | Serial.println(WiFi.softAPIP()); 31 | //if you used auto generated SSID, print it 32 | Serial.println(myWiFiManager->getConfigPortalSSID()); 33 | } 34 | 35 | 36 | 37 | void saveConfigCallback() { 38 | DBG_PRINTLN("Should save config"); 39 | shouldSaveConfig = true; 40 | } 41 | 42 | 43 | 44 | void resetwifi() { 45 | wifiManager.resetSettings(); 46 | #ifdef esp8266 47 | ESP.reset(); 48 | #elif defined(ESP32) 49 | ESP.restart(); 50 | #endif 51 | 52 | 53 | } 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /tests/.gitignore: -------------------------------------------------------------------------------- 1 | /tests/build -------------------------------------------------------------------------------- /tests/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Verwendet IntelliSense zum Ermitteln möglicher Attribute. 3 | // Zeigen Sie auf vorhandene Attribute, um die zugehörigen Beschreibungen anzuzeigen. 4 | // Weitere Informationen finden Sie unter https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "Debugger (Windows)", 9 | "type": "cppvsdbg", 10 | "request": "launch", 11 | "program": "${workspaceFolder}/build/Debug/TestProject.exe", 12 | "args": [], 13 | "stopAtEntry": false, 14 | "cwd": "${fileDirname}", 15 | "environment": [], 16 | "console": "externalTerminal" 17 | }, 18 | ] 19 | } -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.24) 2 | 3 | project(TestProject) 4 | 5 | message("PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}") 6 | # Set the output folder where your program will be created 7 | #set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin) 8 | #set( LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin) 9 | set(CMAKE_CXX_STANDARD 11) 10 | 11 | 12 | if (POLICY CMP0074) 13 | cmake_policy(SET CMP0074 NEW) 14 | endif() 15 | 16 | set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR}/install) 17 | set(CMAKE_PREFIX_PATH ${PROJECT_SOURCE_DIR}/install/include/rapidassst-0.10.2;${PROJECT_SOURCE_DIR}/install/include/win32arduino-2.4.0) 18 | ############################################################################################################################################## 19 | # Add Library 20 | ############################################################################################################################################## 21 | if (CMAKE_VERSION VERSION_LESS 3.2) 22 | set(UPDATE_DISCONNECTED_IF_AVAILABLE "") 23 | else() 24 | set(UPDATE_DISCONNECTED_IF_AVAILABLE "UPDATE_DISCONNECTED 1") 25 | set(FETCHCONTENT_UPDATES_DISCONNECTED "ON") 26 | endif() 27 | 28 | # Required include 29 | include(FetchContent) 30 | 31 | # Fetching all the required repositories and making them available 32 | FetchContent_Declare(googletest 33 | GIT_REPOSITORY https://github.com/google/googletest.git 34 | GIT_TAG release-1.10.0 35 | FIND_PACKAGE_ARGS NAMES GTest 36 | ) 37 | 38 | FetchContent_Declare(arduino_mock 39 | GIT_REPOSITORY https://github.com/sidey79/arduino-mock.git 40 | GIT_TAG sidey79-patch-3 41 | ) 42 | set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) 43 | 44 | FetchContent_MakeAvailable(arduino_mock googletest) 45 | 46 | file( GLOB ARDUINO_LIBRARY_SOURCE_FILES 47 | ${PROJECT_SOURCE_DIR}/../src/_micro-api/libraries/*/src/*.h 48 | ${PROJECT_SOURCE_DIR}/../src/_micro-api/libraries/*/src/*.cpp 49 | ) 50 | 51 | 52 | message("ARDUINO_LIBRARY_SOURCE_FILES: ${ARDUINO_LIBRARY_SOURCE_FILES}") 53 | message("ARDUINO_LIBRARY_SOURCE_DIRS: ${ARDUINO_LIBRARY_SOURCE_DIRS}") 54 | message("ARDUINO_MOCK_SOURCE_DIR: ${arduino_mock_SOURCE_DIR}") 55 | 56 | 57 | 58 | # Adding the software and main test file as an executable 59 | add_executable(TestProject 60 | ${ARDUINO_LIBRARY_SOURCE_FILES} 61 | ${PROJECT_SOURCE_DIR}/main.cpp 62 | ) 63 | # Link all libraries 64 | target_link_libraries(TestProject 65 | gtest_main 66 | arduino_mock 67 | ${CMAKE_THREAD_LIBS_INIT} 68 | ) 69 | 70 | target_include_directories(TestProject PUBLIC 71 | ${arduino_mock_SOURCE_DIR}/include 72 | ${googletest_SOURCE_DIR}/googletest/include 73 | ${googletest_SOURCE_DIR}/googlemock/include 74 | ) 75 | 76 | include(GoogleTest) 77 | 78 | # (Optional) Setting up the compiler 79 | #target_compile_features(TestProject PUBLIC cxx_std_11) 80 | #set_target_properties(TestProject PROPERTIES CXX_EXTENSIONS OFF) 81 | 82 | 83 | include_directories( 84 | ${googletest_SOURCE_DIR}/googletest/include 85 | ${googletest_SOURCE_DIR}/googlemock/include 86 | ${arduino_mock_SOURCE_DIR}/include 87 | ../src/ 88 | ../src/_micro-api/libraries/output/src/ 89 | ../src/_micro-api/libraries/output/src/ 90 | ../src/_micro-api/libraries/bitstore/ 91 | ../src/_micro-api/libraries/fastdelegate/src/ 92 | ../src/_micro-api/libraries/signalDecoder/src/ 93 | ../src/_micro-api/libraries/bitstore/src/ 94 | ../src/_micro-api/libraries/fastdelegate/src/ 95 | ../src/_micro-api/libraries/signalDecoder/src/ 96 | ../src/_micro-api/libraries/SimpleFIFO/src/ 97 | ) 98 | 99 | enable_testing() 100 | gtest_discover_tests(TestProject) 101 | #add_test(testSamesign TestProject) -------------------------------------------------------------------------------- /tests/main.cpp: -------------------------------------------------------------------------------- 1 | // main.cpp : Defines the entry point for the console application. 2 | // 3 | 4 | #include 5 | 6 | #include 7 | #include "arduino-mock/Serial.h" 8 | 9 | 10 | #include 11 | #include 12 | // #include 13 | 14 | char IB_1[14]; // Input Buffer one - capture commands 15 | void disableReceive(); 16 | void enableReceive(); 17 | int freeRam() { return 100; }; 18 | void cli() {}; 19 | void sei() {}; 20 | 21 | bool hasCC1101=true; 22 | bool AfcEnabled=true; // AFC on or off 23 | 24 | volatile unsigned long lastTime=0; 25 | volatile bool blinkLED=false; 26 | 27 | bool isDigit(int8_t value) 28 | { 29 | bool digit = value >= '0' && value <= '9'; 30 | return digit; 31 | } 32 | 33 | bool isHexadecimalDigit(int8_t value) 34 | { 35 | return isdigit(value) || 36 | (value >= 'a' && value <= 'f') || 37 | (value >= 'A' && value <= 'F') ; 38 | } 39 | 40 | #include "tests.cpp" 41 | #include "test_serialCommand.cpp" 42 | 43 | int main(int argc, char **argv) 44 | { 45 | 46 | 47 | ::testing::GTEST_FLAG(output) = "xml:testArduino.testResults.xml"; 48 | ::testing::GTEST_FLAG(print_time) = true; 49 | 50 | ::testing::InitGoogleTest(&argc, argv); 51 | // ::testing::GTEST_FLAG(filter) = "*mcHideki2"; 52 | 53 | int wResult = RUN_ALL_TESTS(); //Find and run all tests 54 | 55 | //system("pause"); 56 | 57 | return wResult; // returns 0 if all the tests are successful, or 1 otherwise 58 | } 59 | -------------------------------------------------------------------------------- /tests/test_serialCommand.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "SimpleFIFO.h" 4 | 5 | #define PROGNAME " SIGNALESP " 6 | #define VERSION_1 0x33 7 | #define VERSION_2 0x1d 8 | #define BAUDRATE 115200 9 | #define FIFO_LENGTH 200 10 | #define isHigh(pin) (digitalRead(pin) == HIGH) 11 | #define isLow(pin) (digitalRead(pin) == LOW) 12 | #define EE_MAGIC_OFFSET 0 13 | #define addr_features 0xff 14 | #define MAX_SRV_CLIENTS 2 15 | 16 | 17 | 18 | #if defined(GTEST_OS_WINDOWS) 19 | #define ARDUINO 101 20 | #define NOSTRING 21 | #endif 22 | 23 | using ::testing::_; 24 | using ::testing::Return; 25 | using ::testing::Matcher; 26 | using ::testing::AtLeast; 27 | using ::testing::Invoke; 28 | 29 | 30 | 31 | //SimpleFIFO FiFo; //store FIFO_LENGTH # ints 32 | SimpleFIFO FiFo; //store FIFO_LENGTH # ints 33 | 34 | SignalDetectorClass musterDec; 35 | 36 | #include 37 | #include 38 | 39 | // static size_t println(int, int = DEC); 40 | TEST(serial, println1) { 41 | SerialMock* serialMock = serialMockInstance(); 42 | int num = 1; 43 | EXPECT_CALL(*serialMock, print(Matcher(num), Matcher(DEC))) 44 | .WillRepeatedly(Return(1)); 45 | EXPECT_EQ(1, Serial.print((int)num, DEC)); 46 | releaseSerialMock(); 47 | } 48 | 49 | TEST(serial, read) { 50 | SerialMock* serialMock = serialMockInstance(); 51 | 52 | std::string serialString = "SR;"; 53 | const int length = serialString.length()+1; 54 | 55 | // declaring character array (+1 for null terminator) 56 | char* char_array = new char[length]; 57 | 58 | // copying the contents of the string to char array 59 | strcpy(char_array, serialString.c_str()); 60 | 61 | serialMock->DelegateToSerialFake(); 62 | serialMock->mock_buffer_load(char_array,length,true); 63 | 64 | EXPECT_EQ(length,Serial.available()); 65 | EXPECT_EQ('S',Serial.read()); 66 | EXPECT_EQ('R',Serial.read()); 67 | EXPECT_EQ(';',Serial.read()); 68 | EXPECT_EQ('\0',Serial.read()); 69 | EXPECT_EQ(0,Serial.available()); 70 | 71 | releaseSerialMock(); 72 | } 73 | 74 | TEST(serial, command_sendCorrupt) { 75 | SerialMock* serialMock = serialMockInstance(); 76 | 77 | std::string serialString = "SR;"; 78 | const int length = serialString.length()+1; 79 | 80 | // declaring character array (+1 for null terminator) 81 | char* char_array = new char[length]; 82 | 83 | // copying the contents of the string to char array 84 | // strcpy(char_array, serialString.c_str()); 85 | strcpy(IB_1, serialString.c_str()); 86 | 87 | serialMock->DelegateToSerialFake(); 88 | serialMock->mock_buffer_load(char_array,length,false); 89 | 90 | // call send_cmd processing 91 | send_cmd(); 92 | releaseSerialMock(); 93 | } 94 | 95 | TEST(serial, command_sendCorrupt2) { 96 | using ::testing::SetArrayArgument; 97 | using ::testing::StrEq; 98 | using ::testing::TypedEq; 99 | using ::testing::Matcher; 100 | 101 | SerialMock* serialMock = serialMockInstance(); 102 | 103 | std::string serialString = "R=2;"; 104 | 105 | const int length = serialString.length()+1; 106 | 107 | // declaring character array (+1 for null terminator) 108 | char* char_array = new char[length]; 109 | 110 | // copying the contents of the string to char array 111 | // strcpy(char_array, serialString.c_str()); 112 | strcpy(IB_1, "SR;"); 113 | strcpy(char_array, serialString.c_str()); 114 | 115 | serialMock->DelegateToSerialFake(); 116 | serialMock->mock_buffer_load(char_array,length,false); 117 | 118 | // We have more in our buffer 119 | EXPECT_CALL(*serialMock,available()) 120 | .WillRepeatedly(Return(1)); 121 | 122 | // Check for abswer 123 | EXPECT_CALL(*serialMock,write(IB_1,3)) 124 | .WillOnce(Return(1)); 125 | EXPECT_CALL(*serialMock,readBytes) 126 | .Times(6); 127 | EXPECT_CALL(*serialMock, print(Matcher(StrEq("R=2;")))); 128 | //EXPECT_CALL(*serialMock,readBytes) 129 | // .Times(1).WillOnce(Return(0)); 130 | 131 | //EXPECT_CALL(*serialMock, print(Matcher<__FlashStringHelper*>))); 132 | //EXPECT_CALL(*serialMock, println(Matcher<__FlashStringHelper*>))); 133 | 134 | // call send_cmd processing 135 | send_cmd(); 136 | 137 | releaseSerialMock(); 138 | } 139 | 140 | 141 | 142 | TEST(serial, registerWrite1) { 143 | using ::testing::SetArrayArgument; 144 | using ::testing::StrEq; 145 | using ::testing::TypedEq; 146 | using ::testing::Matcher; 147 | 148 | EEPROMMock* eepromMock = EEPROMMockInstance(); 149 | strcpy(IB_1, "W1400"); 150 | 151 | EXPECT_CALL(*eepromMock,write) 152 | .Times(1); 153 | 154 | // call processing 155 | commands::HandleShortCommand(); 156 | 157 | //releaseSerialMock(); 158 | releaseEEPROMMock(); 159 | } 160 | -------------------------------------------------------------------------------- /tests/tests.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | 7 | 8 | 9 | namespace arduino { 10 | namespace test 11 | { 12 | int duration; 13 | 14 | class Tests : public ::testing::Test 15 | { 16 | public: 17 | Tests() : mcdecoder(&ooDecode) { } ; 18 | 19 | SignalDetectorClass ooDecode; 20 | ManchesterpatternDecoder mcdecoder; 21 | 22 | #define MSG_START char(0x2) // this is a non printable Char 23 | #define MSG_END char(0x3) // this is a non printable Char 24 | 25 | bool state; 26 | 27 | bool DigitalSimulate(const int pulse); 28 | bool import_sigdata(std::string *cmdstring, const bool raw_mode = false); 29 | bool import_mcdata(std::string *cmdstring, const uint8_t startpos, const uint8_t endpos, const int16_t clock); 30 | std::string geFullMCString(); 31 | 32 | 33 | virtual void SetUp(); 34 | virtual void TearDown(); 35 | 36 | static void SetUpTestCase() { 37 | 38 | }; 39 | }; 40 | 41 | }; // End namespace test 42 | }; // End namespace arduino 43 | --------------------------------------------------------------------------------