├── .codespellrc ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── dependabot.yml ├── stale.yml └── workflows │ ├── auto-github-actions.yml │ ├── check-arduino.yml │ ├── report-size-deltas.yml │ └── spell-check.yml ├── .gitignore ├── CONTRIBUTING.md ├── LICENSE ├── LibraryPatches ├── Ethernet │ └── src │ │ ├── Ethernet.cpp │ │ ├── Ethernet.h │ │ ├── EthernetServer.cpp │ │ └── utility │ │ ├── w5100.cpp │ │ └── w5100.h ├── Ethernet2 │ └── src │ │ ├── Ethernet2.cpp │ │ ├── Ethernet2.h │ │ ├── EthernetUdp2.cpp │ │ └── EthernetUdp2.h ├── Ethernet3 │ └── src │ │ ├── Ethernet3.cpp │ │ └── Ethernet3.h ├── EthernetLarge │ └── src │ │ ├── EthernetLarge.cpp │ │ ├── EthernetLarge.h │ │ ├── EthernetServer.cpp │ │ └── utility │ │ ├── w5100.cpp │ │ └── w5100.h ├── UIPEthernet-2.0.9 │ ├── UIPEthernet.cpp │ ├── UIPEthernet.h │ └── utility │ │ ├── Enc28J60Network.cpp │ │ └── Enc28J60Network.h ├── UIPEthernet │ ├── UIPEthernet.cpp │ ├── UIPEthernet.h │ └── utility │ │ ├── Enc28J60Network.cpp │ │ └── Enc28J60Network.h └── esp32 │ └── cores │ └── esp32 │ └── Server.h ├── Packages_Patches ├── Fab_SAM_Arduino │ └── hardware │ │ └── samd │ │ ├── 1.6.18-alpha2 │ │ └── boards.txt │ │ ├── 1.7.0 │ │ └── boards.txt │ │ ├── 1.8.0 │ │ └── boards.txt │ │ └── 1.9.0 │ │ └── boards.txt ├── Seeeduino │ └── hardware │ │ └── samd │ │ ├── 1.7.7 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Arduino.h │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.7.8 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Arduino.h │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.7.9 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Arduino.h │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.8.1 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Arduino.h │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.8.2 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Arduino.h │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ └── 1.8.3 │ │ ├── cores │ │ └── arduino │ │ │ ├── Arduino.h │ │ │ ├── Print.cpp │ │ │ └── Print.h │ │ └── platform.txt ├── SparkFun │ └── hardware │ │ └── samd │ │ └── 1.8.3 │ │ └── cores │ │ ├── arduino │ │ ├── Print.cpp │ │ └── Print.h │ │ └── arduino51 │ │ ├── Print.cpp │ │ └── Print.h ├── adafruit │ └── hardware │ │ └── samd │ │ ├── 1.5.14 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.6.0 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.6.3 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.6.4 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.6.5 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.6.6 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.6.7 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.6.8 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.7.0 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.7.1 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.7.10 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.7.11 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.7.2 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.7.3 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.7.4 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.7.5 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.7.6 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.7.7 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ ├── 1.7.8 │ │ ├── cores │ │ │ └── arduino │ │ │ │ ├── Print.cpp │ │ │ │ └── Print.h │ │ └── platform.txt │ │ └── 1.7.9 │ │ ├── cores │ │ └── arduino │ │ │ ├── Print.cpp │ │ │ └── Print.h │ │ └── platform.txt ├── arduino │ └── hardware │ │ └── samd │ │ ├── 1.8.10 │ │ └── platform.txt │ │ ├── 1.8.11 │ │ └── platform.txt │ │ ├── 1.8.12 │ │ └── platform.txt │ │ ├── 1.8.13 │ │ └── platform.txt │ │ ├── 1.8.6 │ │ ├── cores │ │ │ └── arduino │ │ │ │ └── Arduino.h │ │ └── platform.txt │ │ ├── 1.8.7 │ │ ├── cores │ │ │ └── arduino │ │ │ │ └── Arduino.h │ │ └── platform.txt │ │ ├── 1.8.8 │ │ ├── cores │ │ │ ├── Arduino.h │ │ │ └── arduino │ │ │ │ └── Arduino.h │ │ └── platform.txt │ │ └── 1.8.9 │ │ ├── cores │ │ └── arduino │ │ │ └── Arduino.h │ │ └── platform.txt └── industrialshields │ └── hardware │ └── avr │ ├── 1.1.36 │ └── cores │ │ └── industrialshields │ │ └── Udp.h │ └── 1.1.37 │ └── cores │ └── industrialshields │ └── Udp.h ├── README.md ├── changelog.md ├── examples ├── Argument_None │ └── Argument_None.ino ├── Argument_None_uS │ └── Argument_None_uS.ino ├── Change_Interval │ └── Change_Interval.ino ├── ISR_16_Timers_Array │ └── ISR_16_Timers_Array.ino ├── ISR_16_Timers_Array_Complex │ └── ISR_16_Timers_Array_Complex.ino ├── ISR_RPM_Measure │ └── ISR_RPM_Measure.ino ├── ISR_Timer_Complex_Ethernet │ └── ISR_Timer_Complex_Ethernet.ino ├── ISR_Timer_Complex_WiFiNINA │ └── ISR_Timer_Complex_WiFiNINA.ino ├── RPM_Measure │ └── RPM_Measure.ino ├── RepeatedAttachInterrupt_uS │ └── RepeatedAttachInterrupt_uS.ino ├── SAMD21_MultiTimers │ └── SAMD21_MultiTimers.ino ├── SwitchDebounce │ └── SwitchDebounce.ino ├── TimerInterruptLEDDemo │ └── TimerInterruptLEDDemo.ino ├── TimerInterruptTest │ └── TimerInterruptTest.ino └── multiFileProject │ ├── multiFileProject.cpp │ ├── multiFileProject.h │ └── multiFileProject.ino ├── keywords.txt ├── library.json ├── library.properties ├── platformio └── platformio.ini ├── src ├── SAMDTimerInterrupt.h ├── SAMDTimerInterrupt.hpp ├── SAMDTimerInterrupt_Impl.h ├── SAMD_ISR_Timer-Impl.h ├── SAMD_ISR_Timer.h ├── SAMD_ISR_Timer.hpp └── TimerInterrupt_Generic_Debug.h └── utils ├── astyle_library.conf └── restyle.sh /.codespellrc: -------------------------------------------------------------------------------- 1 | # See: https://github.com/codespell-project/codespell#using-a-config-file 2 | [codespell] 3 | # In the event of a false positive, add the problematic word, in all lowercase, to a comma-separated list here: 4 | ignore-words-list = , 5 | check-filenames = 6 | check-hidden = 7 | skip = ./.git,./src,./examples,./Packages_Patches,./LibraryPatches 8 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | ### Describe the bug 11 | 12 | A clear and concise description of what the bug is. 13 | 14 | ### Steps to Reproduce 15 | 16 | Steps to reproduce the behavior. Including the [MRE](https://stackoverflow.com/help/minimal-reproducible-example) sketches 17 | 18 | ### Expected behavior 19 | 20 | A clear and concise description of what you expected to happen. 21 | 22 | ### Actual behavior 23 | 24 | A clear and concise description of what you expected to happen. 25 | 26 | ### Debug and AT-command log (if applicable) 27 | 28 | A clear and concise description of what you expected to happen. 29 | 30 | ### Screenshots 31 | 32 | If applicable, add screenshots to help explain your problem. 33 | 34 | ### Information 35 | 36 | Please ensure to specify the following: 37 | 38 | * Arduino IDE version (e.g. 1.8.19) or Platform.io version 39 | * `SAMD` Core Version (e.g. Arduino SAMD core v1.8.13, Adafruit SAMD core v1.7.11, Seeed Studio SAMD v1.8.3, Sparkfun SAMD v1.8.7) 40 | * Contextual information (e.g. what you were trying to achieve) 41 | * Simplest possible steps to reproduce 42 | * Anything that might be relevant in your opinion, such as: 43 | * Operating system (Windows, Ubuntu, etc.) and the output of `uname -a` 44 | * Network configuration 45 | 46 | 47 | ### Example 48 | 49 | ``` 50 | Arduino IDE version: 1.8.19 51 | Arduino SAMD Core Version 1.8.13 52 | OS: Ubuntu 20.04 LTS 53 | Linux xy-Inspiron-3593 5.15.0-53-generic #59~20.04.1-Ubuntu SMP Thu Oct 20 15:10:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux 54 | 55 | Context: 56 | I encountered a crash while using this library 57 | Steps to reproduce: 58 | 1. ... 59 | 2. ... 60 | 3. ... 61 | 4. ... 62 | ``` 63 | 64 | ### Additional context 65 | 66 | Add any other context about the problem here. 67 | 68 | --- 69 | 70 | ### Sending Feature Requests 71 | 72 | Feel free to post feature requests. It's helpful if you can explain exactly why the feature would be useful. 73 | 74 | There are usually some outstanding feature requests in the [existing issues list](https://github.com/khoih-prog/SAMD_TimerInterrupt/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement), feel free to add comments to them. 75 | 76 | --- 77 | 78 | ### Sending Pull Requests 79 | 80 | Pull Requests with changes and fixes are also welcome! 81 | 82 | Please use the `astyle` to reformat the updated library code as follows (demo for Ubuntu Linux) 83 | 84 | 1. Change directory to the library GitHub 85 | 86 | ``` 87 | xy@xy-Inspiron-3593:~$ cd Arduino/xy/SAMD_TimerInterrupt_GitHub/ 88 | xy@xy-Inspiron-3593:~/Arduino/xy/SAMD_TimerInterrupt_GitHub$ 89 | ``` 90 | 91 | 2. Issue astyle command 92 | 93 | ``` 94 | xy@xy-Inspiron-3593:~/Arduino/xy/SAMD_TimerInterrupt_GitHub$ bash utils/restyle.sh 95 | ``` 96 | 97 | 98 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | ### Is your feature request related to a problem? Please describe. 11 | 12 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 13 | 14 | ### Describe the solution you'd like 15 | 16 | A clear and concise description of what you want to happen. 17 | 18 | ### Describe alternatives you've considered 19 | A clear and concise description of any alternative solutions or features you've considered. 20 | 21 | ### Additional context 22 | 23 | Add any other context or screenshots about the feature request here. 24 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # See: https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#about-the-dependabotyml-file 2 | version: 2 3 | 4 | updates: 5 | # Configure check for outdated GitHub Actions actions in workflows. 6 | # See: https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-dependabot 7 | - package-ecosystem: github-actions 8 | directory: / # Check the repository's workflows under /.github/workflows/ 9 | schedule: 10 | interval: daily 11 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Configuration for probot-stale - https://github.com/probot/stale 2 | 3 | daysUntilStale: 60 4 | daysUntilClose: 14 5 | limitPerRun: 30 6 | staleLabel: stale 7 | exemptLabels: 8 | - pinned 9 | - security 10 | - "to be implemented" 11 | - "for reference" 12 | - "move to PR" 13 | - "enhancement" 14 | 15 | only: issues 16 | onlyLabels: [] 17 | exemptProjects: false 18 | exemptMilestones: false 19 | exemptAssignees: false 20 | 21 | markComment: > 22 | [STALE_SET] This issue has been automatically marked as stale because it has not had 23 | recent activity. It will be closed in 14 days if no further activity occurs. Thank you 24 | for your contributions. 25 | 26 | unmarkComment: > 27 | [STALE_CLR] This issue has been removed from the stale queue. Please ensure activity to keep it opening the future. 28 | 29 | closeComment: > 30 | [STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions. 31 | 32 | -------------------------------------------------------------------------------- /.github/workflows/auto-github-actions.yml: -------------------------------------------------------------------------------- 1 | name: auto-github-actions 2 | on: [push] 3 | jobs: 4 | check-bats-version: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - uses: actions/checkout@v3 8 | - uses: actions/setup-node@v3 9 | with: 10 | node-version: '14' 11 | - run: npm install -g bats 12 | - run: bats -v 13 | -------------------------------------------------------------------------------- /.github/workflows/check-arduino.yml: -------------------------------------------------------------------------------- 1 | name: Check Arduino 2 | 3 | # See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows 4 | on: 5 | push: 6 | pull_request: 7 | schedule: 8 | # Run every Tuesday at 8 AM UTC to catch breakage caused by new rules added to Arduino Lint. 9 | - cron: "0 8 * * TUE" 10 | workflow_dispatch: 11 | repository_dispatch: 12 | 13 | jobs: 14 | lint: 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | - name: Checkout repository 19 | uses: actions/checkout@v3 20 | 21 | - name: Arduino Lint 22 | uses: arduino/arduino-lint-action@v1 23 | with: 24 | compliance: specification 25 | library-manager: update 26 | # Always use this setting for official repositories. Remove for 3rd party projects. 27 | official: true 28 | project-type: library 29 | -------------------------------------------------------------------------------- /.github/workflows/report-size-deltas.yml: -------------------------------------------------------------------------------- 1 | name: Report Size Deltas 2 | 3 | on: 4 | schedule: 5 | - cron: '*/5 * * * *' 6 | 7 | jobs: 8 | report: 9 | runs-on: ubuntu-latest 10 | 11 | steps: 12 | - name: Comment size deltas reports to PRs 13 | uses: arduino/report-size-deltas@v1 14 | with: 15 | # The name of the workflow artifact created by the "Compile Examples" workflow 16 | sketches-reports-source: sketches-reports 17 | -------------------------------------------------------------------------------- /.github/workflows/spell-check.yml: -------------------------------------------------------------------------------- 1 | name: Spell Check 2 | 3 | on: 4 | pull_request: 5 | push: 6 | schedule: 7 | # run every Tuesday at 3 AM UTC 8 | - cron: "0 3 * * 2" 9 | workflow_dispatch: 10 | repository_dispatch: 11 | 12 | jobs: 13 | spellcheck: 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - name: Checkout 18 | uses: actions/checkout@v3 19 | 20 | # See: https://github.com/codespell-project/actions-codespell/blob/master/README.md 21 | - name: Spell check 22 | uses: codespell-project/actions-codespell@master 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | *.smod 22 | 23 | # Compiled Static libraries 24 | *.lai 25 | *.la 26 | *.a 27 | *.lib 28 | 29 | # Executables 30 | *.exe 31 | *.out 32 | *.app 33 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Contributing to SAMD_TimerInterrupt 2 | 3 | ### Reporting Bugs 4 | 5 | Please report bugs in SAMD_TimerInterrupt if you find them. 6 | 7 | However, before reporting a bug please check through the following: 8 | 9 | * [Existing Open Issues](https://github.com/khoih-prog/SAMD_TimerInterrupt/issues) - someone might have already encountered this. 10 | 11 | If you don't find anything, please [open a new issue](https://github.com/khoih-prog/SAMD_TimerInterrupt/issues/new). 12 | 13 | ### How to submit a bug report 14 | 15 | Please ensure to specify the following: 16 | 17 | * Arduino IDE version (e.g. 1.8.19) or Platform.io version 18 | * `SAMD` Core Version (e.g. Arduino SAMD core v1.8.13, Adafruit SAMD core v1.7.11, Seeed Studio SAMD v1.8.3, Sparkfun SAMD v1.8.7) 19 | * Contextual information (e.g. what you were trying to achieve) 20 | * Simplest possible steps to reproduce 21 | * Anything that might be relevant in your opinion, such as: 22 | * Operating system (Windows, Ubuntu, etc.) and the output of `uname -a` 23 | * Network configuration 24 | 25 | 26 | ### Example 27 | 28 | ``` 29 | Arduino IDE version: 1.8.19 30 | Arduino SAMD Core Version 1.8.13 31 | OS: Ubuntu 20.04 LTS 32 | Linux xy-Inspiron-3593 5.15.0-53-generic #59~20.04.1-Ubuntu SMP Thu Oct 20 15:10:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux 33 | 34 | Context: 35 | I encountered a crash while using this library 36 | Steps to reproduce: 37 | 1. ... 38 | 2. ... 39 | 3. ... 40 | 4. ... 41 | ``` 42 | 43 | ### Additional context 44 | 45 | Add any other context about the problem here. 46 | 47 | --- 48 | 49 | ### Sending Feature Requests 50 | 51 | Feel free to post feature requests. It's helpful if you can explain exactly why the feature would be useful. 52 | 53 | There are usually some outstanding feature requests in the [existing issues list](https://github.com/khoih-prog/SAMD_TimerInterrupt/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement), feel free to add comments to them. 54 | 55 | --- 56 | 57 | ### Sending Pull Requests 58 | 59 | Pull Requests with changes and fixes are also welcome! 60 | 61 | Please use the `astyle` to reformat the updated library code as follows (demo for Ubuntu Linux) 62 | 63 | 1. Change directory to the library GitHub 64 | 65 | ``` 66 | xy@xy-Inspiron-3593:~$ cd Arduino/xy/SAMD_TimerInterrupt_GitHub/ 67 | xy@xy-Inspiron-3593:~/Arduino/xy/SAMD_TimerInterrupt_GitHub$ 68 | ``` 69 | 70 | 2. Issue astyle command 71 | 72 | ``` 73 | xy@xy-Inspiron-3593:~/Arduino/xy/SAMD_TimerInterrupt_GitHub$ bash utils/restyle.sh 74 | ``` 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Khoi Hoang 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /LibraryPatches/Ethernet2/src/Ethernet2.h: -------------------------------------------------------------------------------- 1 | /* 2 | modified 12 Aug 2013 3 | by Soohwan Kim (suhwan@wiznet.co.kr) 4 | 5 | - 10 Apr. 2015 6 | Added support for Arduino Ethernet Shield 2 7 | by Arduino.org team 8 | 9 | */ 10 | #ifndef ethernet_h 11 | #define ethernet_h 12 | 13 | #include 14 | #include "utility/w5500.h" 15 | #include "IPAddress.h" 16 | #include "EthernetClient.h" 17 | #include "EthernetServer.h" 18 | #include "Dhcp.h" 19 | 20 | 21 | 22 | class EthernetClass { 23 | private: 24 | IPAddress _dnsServerAddress; 25 | char* _dnsDomainName; 26 | char* _hostName; 27 | DhcpClass* _dhcp; 28 | 29 | // KH add to work with new func void MACAddress(uint8_t *mac_address); and SinricPro v2.5.1+ 30 | uint8_t _mac_address[6] ={0,}; 31 | ////// 32 | 33 | public: 34 | uint8_t w5500_cspin; 35 | 36 | static uint8_t _state[MAX_SOCK_NUM]; 37 | static uint16_t _server_port[MAX_SOCK_NUM]; 38 | 39 | EthernetClass() { _dhcp = NULL; w5500_cspin = 10; } 40 | void init(uint8_t _cspin = 10) { w5500_cspin = _cspin; } 41 | 42 | #if defined(WIZ550io_WITH_MACADDRESS) 43 | // Initialize function when use the ioShield serise (included WIZ550io) 44 | // WIZ550io has a MAC address which is written after reset. 45 | // Default IP, Gateway and subnet address are also writen. 46 | // so, It needs some initial time. please refer WIZ550io Datasheet in details. 47 | int begin(void); 48 | void begin(IPAddress local_ip); 49 | void begin(IPAddress local_ip, IPAddress dns_server); 50 | void begin(IPAddress local_ip, IPAddress dns_server, IPAddress gateway); 51 | void begin(IPAddress local_ip, IPAddress dns_server, IPAddress gateway, IPAddress subnet); 52 | #else 53 | // Initialize the Ethernet shield to use the provided MAC address and gain the rest of the 54 | // configuration through DHCP. 55 | // Returns 0 if the DHCP configuration failed, and 1 if it succeeded 56 | int begin(uint8_t *mac_address); 57 | void begin(uint8_t *mac_address, IPAddress local_ip); 58 | void begin(uint8_t *mac_address, IPAddress local_ip, IPAddress dns_server); 59 | void begin(uint8_t *mac_address, IPAddress local_ip, IPAddress dns_server, IPAddress gateway); 60 | void begin(uint8_t *mac_address, IPAddress local_ip, IPAddress dns_server, IPAddress gateway, IPAddress subnet); 61 | 62 | #endif 63 | 64 | int maintain(); 65 | 66 | // KH add to report link status 67 | uint8_t link(); // returns the linkstate, 1 = linked, 0 = no link 68 | const char* linkReport(); // returns the linkstate as a string 69 | ////// 70 | 71 | // KH add to have similar function to Ethernet lib 72 | // Certainly we can use void macAddress(uint8_t mac[]) to read from W5x00. 73 | void MACAddress(uint8_t *mac_address) 74 | { 75 | memcpy(mac_address, _mac_address, sizeof(_mac_address)); 76 | } 77 | ////// 78 | 79 | IPAddress localIP(); 80 | IPAddress subnetMask(); 81 | IPAddress gatewayIP(); 82 | IPAddress dnsServerIP(); 83 | char* dnsDomainName(); 84 | char* hostName(); 85 | 86 | friend class EthernetClient; 87 | friend class EthernetServer; 88 | }; 89 | 90 | extern EthernetClass Ethernet; 91 | 92 | #endif 93 | -------------------------------------------------------------------------------- /LibraryPatches/Ethernet3/src/Ethernet3.h: -------------------------------------------------------------------------------- 1 | /* 2 | modified 12 Aug 2013 3 | by Soohwan Kim (suhwan@wiznet.co.kr) 4 | 5 | - 10 Apr. 2015 6 | Added support for Arduino Ethernet Shield 2 7 | by Arduino.org team 8 | 9 | */ 10 | #ifndef ethernet3_h 11 | #define ethernet3_h 12 | 13 | #include 14 | #include "utility/w5500.h" 15 | #include "IPAddress.h" 16 | #include "EthernetClient.h" 17 | #include "EthernetServer.h" 18 | #include "Dhcp.h" 19 | 20 | enum phyMode_t { 21 | HALF_DUPLEX_10, 22 | FULL_DUPLEX_10, 23 | HALF_DUPLEX_100, 24 | FULL_DUPLEX_100, 25 | FULL_DUPLEX_100_AUTONEG, 26 | POWER_DOWN, 27 | ALL_AUTONEG 28 | }; 29 | 30 | class EthernetClass { 31 | private: 32 | IPAddress _dnsServerAddress; 33 | DhcpClass* _dhcp; 34 | char _customHostname[32]; 35 | 36 | // KH add to work with new func void MACAddress(uint8_t *mac_address); and SinricPro v2.5.1+ 37 | uint8_t _mac_address[6] ={0,}; 38 | ////// 39 | 40 | public: 41 | uint8_t _maxSockNum; 42 | uint8_t _pinCS; 43 | uint8_t _pinRST; 44 | 45 | static uint8_t _state[MAX_SOCK_NUM]; 46 | static uint16_t _server_port[MAX_SOCK_NUM]; 47 | 48 | EthernetClass() { _dhcp = NULL; _pinCS = 10; _maxSockNum = 8; } 49 | 50 | void setRstPin(uint8_t pinRST = 9); // for WIZ550io or USR-ES1, must set befor Ethernet.begin 51 | void setCsPin(uint8_t pinCS = 10); // must set befor Ethernet.begin 52 | 53 | // Initialize with less sockets but more RX/TX Buffer 54 | // maxSockNum = 1 Socket 0 -> RX/TX Buffer 16k 55 | // maxSockNum = 2 Socket 0, 1 -> RX/TX Buffer 8k 56 | // maxSockNum = 4 Socket 0...3 -> RX/TX Buffer 4k 57 | // maxSockNum = 8 (Standard) all sockets -> RX/TX Buffer 2k 58 | // be carefull of the MAX_SOCK_NUM, because in the moment it can't dynamicly changed 59 | void init(uint8_t maxSockNum = 8); 60 | 61 | uint8_t softreset(); // can set only after Ethernet.begin 62 | void hardreset(); // You need to set the Rst pin 63 | 64 | #if defined(WIZ550io_WITH_MACADDRESS) 65 | 66 | // Initialize function when use the ioShield serise (included WIZ550io) 67 | // WIZ550io has a MAC address which is written after reset. 68 | // Default IP, Gateway and subnet address are also writen. 69 | // so, It needs some initial time. please refer WIZ550io Datasheet in details. 70 | int begin(void); 71 | void begin(IPAddress local_ip); 72 | void begin(IPAddress local_ip, IPAddress subnet); 73 | void begin(IPAddress local_ip, IPAddress subnet, IPAddress gateway); 74 | void begin(IPAddress local_ip, IPAddress subnet, IPAddress gateway, IPAddress dns_server); 75 | #else 76 | // Initialize the Ethernet shield to use the provided MAC address and gain the rest of the 77 | // configuration through DHCP. 78 | // Returns 0 if the DHCP configuration failed, and 1 if it succeeded 79 | int begin(uint8_t *mac_address); 80 | void begin(uint8_t *mac_address, IPAddress local_ip); 81 | void begin(uint8_t *mac_address, IPAddress local_ip, IPAddress subnet); 82 | void begin(uint8_t *mac_address, IPAddress local_ip, IPAddress subnet, IPAddress gateway); 83 | void begin(uint8_t *mac_address, IPAddress local_ip, IPAddress subnet, IPAddress gateway, IPAddress dns_server); 84 | #endif 85 | 86 | int maintain(); 87 | void WoL(bool wol); // set Wake on LAN 88 | bool WoL(); // get the WoL state 89 | void phyMode(phyMode_t mode); // set PHYCFGR 90 | uint8_t phyState(); // returns the PHYCFGR 91 | uint8_t link(); // returns the linkstate, 1 = linked, 0 = no link 92 | const char* linkReport(); // returns the linkstate as a string 93 | uint8_t speed(); // returns speed in MB/s 94 | const char* speedReport(); // returns speed as a string 95 | uint8_t duplex(); // returns duplex mode 0 = no link, 1 = Half Duplex, 2 = Full Duplex 96 | const char* duplexReport(); // returns duplex mode as a string 97 | 98 | void setRtTimeOut(uint16_t timeout = 2000); // set the retransmission timout *100us 99 | uint16_t getRtTimeOut(); // get the retransmission timout 100 | void setRtCount(uint8_t count = 8); // set the retransmission count 101 | uint8_t getRtCount(); // get the retransmission count 102 | 103 | void macAddress(uint8_t mac[]); // get the MAC Address 104 | const char* macAddressReport(); // returns the the MAC Address as a string 105 | 106 | void setHostname(const char* hostname); 107 | 108 | // KH add to have similar function to Ethernet lib 109 | // Certainly we can use void macAddress(uint8_t mac[]) to read from W5x00. 110 | void MACAddress(uint8_t *mac_address) 111 | { 112 | memcpy(mac_address, _mac_address, sizeof(_mac_address)); 113 | } 114 | ////// 115 | 116 | IPAddress localIP(); 117 | IPAddress subnetMask(); 118 | IPAddress gatewayIP(); 119 | IPAddress dnsServerIP(); 120 | 121 | friend class EthernetClient; 122 | friend class EthernetServer; 123 | }; 124 | 125 | extern EthernetClass Ethernet; 126 | 127 | #endif 128 | -------------------------------------------------------------------------------- /LibraryPatches/UIPEthernet/UIPEthernet.h: -------------------------------------------------------------------------------- 1 | /* 2 | UIPEthernet.h - Arduino implementation of a uIP wrapper class. 3 | Copyright (c) 2013 Norbert Truchsess 4 | All rights reserved. 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . 18 | */ 19 | 20 | #ifndef UIPETHERNET_H 21 | #define UIPETHERNET_H 22 | 23 | #include "ethernet_comp.h" 24 | #if defined(__MBED__) 25 | #include 26 | #endif 27 | #if defined(ARDUINO) 28 | #include 29 | #if defined(__STM32F3__) || defined(STM32F3) || defined(__RFduino__) 30 | #include "mbed/IPAddress.h" 31 | #else 32 | #include "IPAddress.h" 33 | #endif 34 | #endif 35 | #include "utility/Enc28J60Network.h" 36 | #include "utility/uipopt.h" 37 | #include "Dhcp.h" 38 | #if UIP_UDP 39 | #include "UIPUdp.h" 40 | #endif 41 | #include "UIPClient.h" 42 | #include "UIPServer.h" 43 | 44 | extern "C" 45 | { 46 | #include "utility/uip_timer.h" 47 | #include "utility/uip.h" 48 | } 49 | 50 | #define UIPETHERNET_FREEPACKET 1 51 | #define UIPETHERNET_SENDPACKET 2 52 | #define UIPETHERNET_BUFFERREAD 4 53 | 54 | #define uip_ip_addr(addr, ip) do { \ 55 | ((u16_t *)(addr))[0] = HTONS(((ip[0]) << 8) | (ip[1])); \ 56 | ((u16_t *)(addr))[1] = HTONS(((ip[2]) << 8) | (ip[3])); \ 57 | } while(0) 58 | 59 | #define ip_addr_uip(a) IPAddress(a[0] & 0xFF, a[0] >> 8 , a[1] & 0xFF, a[1] >> 8) //TODO this is not IPV6 capable 60 | 61 | #define uip_seteth_addr(eaddr) do {uip_ethaddr.addr[0] = eaddr[0]; \ 62 | uip_ethaddr.addr[1] = eaddr[1];\ 63 | uip_ethaddr.addr[2] = eaddr[2];\ 64 | uip_ethaddr.addr[3] = eaddr[3];\ 65 | uip_ethaddr.addr[4] = eaddr[4];\ 66 | uip_ethaddr.addr[5] = eaddr[5];} while(0) 67 | 68 | #define BUF ((struct uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN]) 69 | 70 | enum EthernetLinkStatus { 71 | Unknown, 72 | LinkON, 73 | LinkOFF 74 | }; 75 | 76 | class UIPEthernetClass 77 | { 78 | public: 79 | UIPEthernetClass(); 80 | 81 | void init(const uint8_t pin); 82 | 83 | int begin(const uint8_t* mac); 84 | void begin(const uint8_t* mac, IPAddress ip); 85 | void begin(const uint8_t* mac, IPAddress ip, IPAddress dns); 86 | void begin(const uint8_t* mac, IPAddress ip, IPAddress dns, IPAddress gateway); 87 | void begin(const uint8_t* mac, IPAddress ip, IPAddress dns, IPAddress gateway, IPAddress subnet); 88 | 89 | // maintain() must be called at regular intervals to process the incoming serial 90 | // data and issue IP events to the sketch. It does not return until all IP 91 | // events have been processed. Renews dhcp-lease if required. 92 | int maintain(); 93 | 94 | EthernetLinkStatus linkStatus(); 95 | 96 | // KH add to have similar function to Ethernet lib 97 | // Certainly we can use void macAddress(uint8_t mac[]) to read from W5x00. 98 | void MACAddress(uint8_t *mac_address) 99 | { 100 | memcpy(mac_address, _mac_address, sizeof(_mac_address)); 101 | } 102 | ////// 103 | 104 | IPAddress localIP(); 105 | IPAddress subnetMask(); 106 | IPAddress gatewayIP(); 107 | IPAddress dnsServerIP(); 108 | 109 | private: 110 | 111 | // KH add to work with new func void MACAddress(uint8_t *mac_address); and SinricPro v2.5.1+ 112 | uint8_t _mac_address[6] ={0,}; 113 | ////// 114 | 115 | static memhandle in_packet; 116 | static memhandle uip_packet; 117 | static uint8_t uip_hdrlen; 118 | static uint8_t packetstate; 119 | 120 | static IPAddress _dnsServerAddress; 121 | #if UIP_UDP 122 | static DhcpClass* _dhcp; 123 | #endif 124 | static unsigned long periodic_timer; 125 | 126 | static void netInit(const uint8_t* mac); 127 | static void configure(IPAddress ip, IPAddress dns, IPAddress gateway, IPAddress subnet); 128 | 129 | static void tick(); 130 | 131 | static bool network_send(); 132 | 133 | friend class UIPServer; 134 | 135 | friend class UIPClient; 136 | 137 | friend class UIPUDP; 138 | 139 | static uint16_t chksum(uint16_t sum, const uint8_t* data, uint16_t len); 140 | static uint16_t ipchksum(void); 141 | #if UIP_UDP 142 | static uint16_t upper_layer_chksum(uint8_t proto); 143 | #endif 144 | friend uint16_t uip_ipchksum(void); 145 | friend uint16_t uip_tcpchksum(void); 146 | friend uint16_t uip_udpchksum(void); 147 | 148 | friend void uipclient_appcall(void); 149 | friend void uipudp_appcall(void); 150 | 151 | #if UIP_CONF_IPV6 152 | uint16_t uip_icmp6chksum(void); 153 | #endif /* UIP_CONF_IPV6 */ 154 | }; 155 | 156 | extern UIPEthernetClass UIPEthernet; 157 | 158 | #endif 159 | -------------------------------------------------------------------------------- /LibraryPatches/esp32/cores/esp32/Server.h: -------------------------------------------------------------------------------- 1 | /* 2 | Server.h - Base class that provides Server 3 | Copyright (c) 2011 Adrian McEwen. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library 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 GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef server_h 21 | #define server_h 22 | 23 | #include "Print.h" 24 | 25 | class Server: public Print 26 | { 27 | public: 28 | // KH, change to fix compiler error for EthernetWebServer 29 | // error: cannot declare field 'EthernetWebServer::_server' to be of abstract type 'EthernetServer' 30 | // virtual void begin(uint16_t port=0) =0; 31 | //virtual void begin() = 0; 32 | void begin() {}; 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /Packages_Patches/Seeeduino/hardware/samd/1.7.7/cores/arduino/Arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Arduino.h - Main include file for the Arduino SDK 3 | Copyright (c) 2014 Arduino LLC. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library 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 GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef Arduino_h 21 | #define Arduino_h 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #define CORE_HAS_LIBB64 30 | 31 | typedef bool boolean; 32 | typedef uint8_t byte; 33 | typedef uint16_t word; 34 | 35 | // some libraries and sketches depend on this AVR stuff, 36 | // assuming Arduino.h or WProgram.h automatically includes it... 37 | // 38 | #include "avr/pgmspace.h" 39 | #include "avr/interrupt.h" 40 | #include "avr/dtostrf.h" 41 | #include "avr/io.h" 42 | 43 | #include "binary.h" 44 | #include "itoa.h" 45 | 46 | #ifdef __cplusplus 47 | extern "C"{ 48 | #endif // __cplusplus 49 | 50 | // Include Atmel headers 51 | #include "sam.h" 52 | 53 | #include "wiring_constants.h" 54 | 55 | #define clockCyclesPerMicrosecond() ( SystemCoreClock / 1000000L ) 56 | #define clockCyclesToMicroseconds(a) ( ((a) * 1000L) / (SystemCoreClock / 1000L) ) 57 | #define microsecondsToClockCycles(a) ( (a) * (SystemCoreClock / 1000000L) ) 58 | 59 | void yield( void ) ; 60 | 61 | /* system functions */ 62 | int main( void ); 63 | void init( void ); 64 | 65 | /* sketch */ 66 | void setup( void ) ; 67 | void loop( void ) ; 68 | 69 | int __debug_buf(const char* head, char* buf, int len); 70 | 71 | #include "WVariant.h" 72 | 73 | #ifdef __cplusplus 74 | } // extern "C" 75 | #endif 76 | 77 | // The following headers are for C++ only compilation 78 | #ifdef __cplusplus 79 | #include "WCharacter.h" 80 | #include "WString.h" 81 | #include "Tone.h" 82 | #include "WMath.h" 83 | #include "HardwareSerial.h" 84 | #include "pulse.h" 85 | #endif 86 | #include "delay.h" 87 | #ifdef __cplusplus 88 | #include "Uart.h" 89 | #endif 90 | 91 | // Include board variant 92 | #include "variant.h" 93 | 94 | #include "wiring.h" 95 | #include "wiring_digital.h" 96 | #include "wiring_analog.h" 97 | #include "wiring_shift.h" 98 | #include "wiring_pwm.h" 99 | #include "WInterrupts.h" 100 | 101 | // undefine stdlib's abs if encountered 102 | #ifdef abs 103 | #undef abs 104 | #endif // abs 105 | // undefine stdlib's abs if encountered 106 | #ifdef abs 107 | #undef abs 108 | #endif // abs 109 | 110 | #ifdef __cplusplus 111 | template 112 | auto min(const T& a, const L& b) -> decltype((b < a) ? b : a) 113 | { 114 | return (b < a) ? b : a; 115 | } 116 | 117 | template 118 | auto max(const T& a, const L& b) -> decltype((b < a) ? b : a) 119 | { 120 | return (a < b) ? b : a; 121 | } 122 | #else 123 | #ifndef min 124 | #define min(a,b) \ 125 | ({ __typeof__ (a) _a = (a); \ 126 | __typeof__ (b) _b = (b); \ 127 | _a < _b ? _a : _b; }) 128 | #endif 129 | #ifndef max 130 | #define max(a,b) \ 131 | ({ __typeof__ (a) _a = (a); \ 132 | __typeof__ (b) _b = (b); \ 133 | _a > _b ? _a : _b; }) 134 | #endif 135 | #endif 136 | 137 | #define abs(x) ((x)>0?(x):-(x)) 138 | #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) 139 | #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) 140 | #define radians(deg) ((deg)*DEG_TO_RAD) 141 | #define degrees(rad) ((rad)*RAD_TO_DEG) 142 | #define sq(x) ((x)*(x)) 143 | 144 | #define interrupts() __enable_irq() 145 | #define noInterrupts() __disable_irq() 146 | #ifndef interruptsStatus 147 | static inline unsigned char __interruptsStatus(void) __attribute__((always_inline, unused)); 148 | static inline unsigned char __interruptsStatus(void) 149 | { 150 | // See http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0497a/CHDBIBGJ.html 151 | return (__get_PRIMASK() ? 0 : 1); 152 | } 153 | #define interruptsStatus() __interruptsStatus() 154 | #endif 155 | 156 | #define lowByte(w) ((uint8_t) ((w) & 0xff)) 157 | #define highByte(w) ((uint8_t) ((w) >> 8)) 158 | 159 | #define bitRead(value, bit) (((value) >> (bit)) & 0x01) 160 | #define bitSet(value, bit) ((value) |= (1UL << (bit))) 161 | #define bitClear(value, bit) ((value) &= ~(1UL << (bit))) 162 | #define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit)) 163 | 164 | #define bit(b) (1UL << (b)) 165 | 166 | #if (ARDUINO_SAMD_VARIANT_COMPLIANCE >= 10606) 167 | // Interrupts 168 | #define digitalPinToInterrupt(P) ( P ) 169 | #endif 170 | 171 | // USB 172 | #ifdef USE_TINYUSB 173 | #include "Adafruit_TinyUSB_Core.h" 174 | #else 175 | #include "USB/USBDesc.h" 176 | #include "USB/USBCore.h" 177 | #include "USB/USBAPI.h" 178 | #include "USB/USB_host.h" 179 | #endif 180 | 181 | #endif // Arduino_h 182 | -------------------------------------------------------------------------------- /Packages_Patches/Seeeduino/hardware/samd/1.7.7/cores/arduino/Print.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino LLC. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include // for size_t 23 | #include // for printf 24 | 25 | #include "WString.h" 26 | #include "Printable.h" 27 | 28 | #define DEC 10 29 | #define HEX 16 30 | #define OCT 8 31 | #define BIN 2 32 | 33 | class Print 34 | { 35 | private: 36 | int write_error; 37 | size_t printNumber(unsigned long, uint8_t); 38 | size_t printULLNumber(unsigned long long, uint8_t); 39 | size_t printFloat(double, int); 40 | protected: 41 | void setWriteError(int err = 1) { write_error = err; } 42 | public: 43 | Print() : write_error(0) {} 44 | 45 | int getWriteError() { return write_error; } 46 | void clearWriteError() { setWriteError(0); } 47 | 48 | virtual size_t write(uint8_t) = 0; 49 | size_t write(const char *str) { 50 | if (str == NULL) return 0; 51 | return write((const uint8_t *)str, strlen(str)); 52 | } 53 | virtual size_t write(const uint8_t *buffer, size_t size); 54 | size_t write(const char *buffer, size_t size) { 55 | return write((const uint8_t *)buffer, size); 56 | } 57 | 58 | // default to zero, meaning "a single write may block" 59 | // should be overridden by subclasses with buffering 60 | virtual int availableForWrite() { return 0; } 61 | 62 | size_t print(const __FlashStringHelper *); 63 | size_t print(const String &); 64 | size_t print(const char[]); 65 | size_t print(char); 66 | size_t print(unsigned char, int = DEC); 67 | size_t print(int, int = DEC); 68 | size_t print(unsigned int, int = DEC); 69 | size_t print(long, int = DEC); 70 | size_t print(unsigned long, int = DEC); 71 | size_t print(long long, int = DEC); 72 | size_t print(unsigned long long, int = DEC); 73 | size_t print(double, int = 2); 74 | size_t print(const Printable&); 75 | 76 | size_t println(const __FlashStringHelper *); 77 | size_t println(const String &s); 78 | size_t println(const char[]); 79 | size_t println(char); 80 | size_t println(unsigned char, int = DEC); 81 | size_t println(int, int = DEC); 82 | size_t println(unsigned int, int = DEC); 83 | size_t println(long, int = DEC); 84 | size_t println(unsigned long, int = DEC); 85 | size_t println(long long, int = DEC); 86 | size_t println(unsigned long long, int = DEC); 87 | size_t println(double, int = 2); 88 | size_t println(const Printable&); 89 | size_t println(void); 90 | 91 | size_t printf(const char * format, ...); 92 | 93 | size_t printBuffer(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 94 | size_t printBuffer(char const buffer[], int size, char delim=' ', int byteline = 0) 95 | { 96 | return printBuffer((uint8_t const*) buffer, size, delim, byteline); 97 | } 98 | 99 | size_t printBufferReverse(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 100 | size_t printBufferReverse(char const buffer[], int size, char delim=' ', int byteline = 0) 101 | { 102 | return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); 103 | } 104 | 105 | virtual void flush() { /* Empty implementation for backward compatibility */ } 106 | }; 107 | 108 | 109 | -------------------------------------------------------------------------------- /Packages_Patches/Seeeduino/hardware/samd/1.7.8/cores/arduino/Arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Arduino.h - Main include file for the Arduino SDK 3 | Copyright (c) 2014 Arduino LLC. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library 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 GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef Arduino_h 21 | #define Arduino_h 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #define CORE_HAS_LIBB64 30 | 31 | typedef bool boolean; 32 | typedef uint8_t byte; 33 | typedef uint16_t word; 34 | 35 | // some libraries and sketches depend on this AVR stuff, 36 | // assuming Arduino.h or WProgram.h automatically includes it... 37 | // 38 | #include "avr/pgmspace.h" 39 | #include "avr/interrupt.h" 40 | #include "avr/dtostrf.h" 41 | #include "avr/io.h" 42 | 43 | #include "binary.h" 44 | #include "itoa.h" 45 | 46 | #ifdef __cplusplus 47 | extern "C"{ 48 | #endif // __cplusplus 49 | 50 | // Include Atmel headers 51 | #include "sam.h" 52 | 53 | #include "wiring_constants.h" 54 | 55 | #define clockCyclesPerMicrosecond() ( SystemCoreClock / 1000000L ) 56 | #define clockCyclesToMicroseconds(a) ( ((a) * 1000L) / (SystemCoreClock / 1000L) ) 57 | #define microsecondsToClockCycles(a) ( (a) * (SystemCoreClock / 1000000L) ) 58 | 59 | void yield( void ) ; 60 | 61 | /* system functions */ 62 | int main( void ); 63 | void init( void ); 64 | 65 | /* sketch */ 66 | void setup( void ) ; 67 | void loop( void ) ; 68 | 69 | int __debug_buf(const char* head, char* buf, int len); 70 | 71 | #include "WVariant.h" 72 | 73 | #ifdef __cplusplus 74 | } // extern "C" 75 | #endif 76 | 77 | // The following headers are for C++ only compilation 78 | #ifdef __cplusplus 79 | #include "WCharacter.h" 80 | #include "WString.h" 81 | #include "Tone.h" 82 | #include "WMath.h" 83 | #include "HardwareSerial.h" 84 | #include "pulse.h" 85 | #endif 86 | #include "delay.h" 87 | #ifdef __cplusplus 88 | #include "Uart.h" 89 | #endif 90 | 91 | // Include board variant 92 | #include "variant.h" 93 | 94 | #include "wiring.h" 95 | #include "wiring_digital.h" 96 | #include "wiring_analog.h" 97 | #include "wiring_shift.h" 98 | #include "wiring_pwm.h" 99 | #include "WInterrupts.h" 100 | 101 | // undefine stdlib's abs if encountered 102 | #ifdef abs 103 | #undef abs 104 | #endif // abs 105 | // undefine stdlib's abs if encountered 106 | #ifdef abs 107 | #undef abs 108 | #endif // abs 109 | 110 | #ifdef __cplusplus 111 | template 112 | auto min(const T& a, const L& b) -> decltype((b < a) ? b : a) 113 | { 114 | return (b < a) ? b : a; 115 | } 116 | 117 | template 118 | auto max(const T& a, const L& b) -> decltype((b < a) ? b : a) 119 | { 120 | return (a < b) ? b : a; 121 | } 122 | #else 123 | #ifndef min 124 | #define min(a,b) \ 125 | ({ __typeof__ (a) _a = (a); \ 126 | __typeof__ (b) _b = (b); \ 127 | _a < _b ? _a : _b; }) 128 | #endif 129 | #ifndef max 130 | #define max(a,b) \ 131 | ({ __typeof__ (a) _a = (a); \ 132 | __typeof__ (b) _b = (b); \ 133 | _a > _b ? _a : _b; }) 134 | #endif 135 | #endif 136 | 137 | #define abs(x) ((x)>0?(x):-(x)) 138 | #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) 139 | #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) 140 | #define radians(deg) ((deg)*DEG_TO_RAD) 141 | #define degrees(rad) ((rad)*RAD_TO_DEG) 142 | #define sq(x) ((x)*(x)) 143 | 144 | #define interrupts() __enable_irq() 145 | #define noInterrupts() __disable_irq() 146 | #ifndef interruptsStatus 147 | static inline unsigned char __interruptsStatus(void) __attribute__((always_inline, unused)); 148 | static inline unsigned char __interruptsStatus(void) 149 | { 150 | // See http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0497a/CHDBIBGJ.html 151 | return (__get_PRIMASK() ? 0 : 1); 152 | } 153 | #define interruptsStatus() __interruptsStatus() 154 | #endif 155 | 156 | #define lowByte(w) ((uint8_t) ((w) & 0xff)) 157 | #define highByte(w) ((uint8_t) ((w) >> 8)) 158 | 159 | #define bitRead(value, bit) (((value) >> (bit)) & 0x01) 160 | #define bitSet(value, bit) ((value) |= (1UL << (bit))) 161 | #define bitClear(value, bit) ((value) &= ~(1UL << (bit))) 162 | #define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit)) 163 | 164 | #define bit(b) (1UL << (b)) 165 | 166 | #if (ARDUINO_SAMD_VARIANT_COMPLIANCE >= 10606) 167 | // Interrupts 168 | #define digitalPinToInterrupt(P) ( P ) 169 | #endif 170 | 171 | // USB 172 | #ifdef USE_TINYUSB 173 | #include "Adafruit_TinyUSB_Core.h" 174 | #else 175 | #include "USB/USBDesc.h" 176 | #include "USB/USBCore.h" 177 | #include "USB/USBAPI.h" 178 | #include "USB/USB_host.h" 179 | #endif 180 | 181 | #endif // Arduino_h 182 | -------------------------------------------------------------------------------- /Packages_Patches/Seeeduino/hardware/samd/1.7.8/cores/arduino/Print.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino LLC. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include // for size_t 23 | #include // for printf 24 | 25 | #include "WString.h" 26 | #include "Printable.h" 27 | 28 | #define DEC 10 29 | #define HEX 16 30 | #define OCT 8 31 | #define BIN 2 32 | 33 | class Print 34 | { 35 | private: 36 | int write_error; 37 | size_t printNumber(unsigned long, uint8_t); 38 | size_t printULLNumber(unsigned long long, uint8_t); 39 | size_t printFloat(double, int); 40 | protected: 41 | void setWriteError(int err = 1) { write_error = err; } 42 | public: 43 | Print() : write_error(0) {} 44 | 45 | int getWriteError() { return write_error; } 46 | void clearWriteError() { setWriteError(0); } 47 | 48 | virtual size_t write(uint8_t) = 0; 49 | size_t write(const char *str) { 50 | if (str == NULL) return 0; 51 | return write((const uint8_t *)str, strlen(str)); 52 | } 53 | virtual size_t write(const uint8_t *buffer, size_t size); 54 | size_t write(const char *buffer, size_t size) { 55 | return write((const uint8_t *)buffer, size); 56 | } 57 | 58 | // default to zero, meaning "a single write may block" 59 | // should be overridden by subclasses with buffering 60 | virtual int availableForWrite() { return 0; } 61 | 62 | size_t print(const __FlashStringHelper *); 63 | size_t print(const String &); 64 | size_t print(const char[]); 65 | size_t print(char); 66 | size_t print(unsigned char, int = DEC); 67 | size_t print(int, int = DEC); 68 | size_t print(unsigned int, int = DEC); 69 | size_t print(long, int = DEC); 70 | size_t print(unsigned long, int = DEC); 71 | size_t print(long long, int = DEC); 72 | size_t print(unsigned long long, int = DEC); 73 | size_t print(double, int = 2); 74 | size_t print(const Printable&); 75 | 76 | size_t println(const __FlashStringHelper *); 77 | size_t println(const String &s); 78 | size_t println(const char[]); 79 | size_t println(char); 80 | size_t println(unsigned char, int = DEC); 81 | size_t println(int, int = DEC); 82 | size_t println(unsigned int, int = DEC); 83 | size_t println(long, int = DEC); 84 | size_t println(unsigned long, int = DEC); 85 | size_t println(long long, int = DEC); 86 | size_t println(unsigned long long, int = DEC); 87 | size_t println(double, int = 2); 88 | size_t println(const Printable&); 89 | size_t println(void); 90 | 91 | size_t printf(const char * format, ...); 92 | 93 | size_t printBuffer(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 94 | size_t printBuffer(char const buffer[], int size, char delim=' ', int byteline = 0) 95 | { 96 | return printBuffer((uint8_t const*) buffer, size, delim, byteline); 97 | } 98 | 99 | size_t printBufferReverse(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 100 | size_t printBufferReverse(char const buffer[], int size, char delim=' ', int byteline = 0) 101 | { 102 | return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); 103 | } 104 | 105 | virtual void flush() { /* Empty implementation for backward compatibility */ } 106 | }; 107 | 108 | 109 | -------------------------------------------------------------------------------- /Packages_Patches/Seeeduino/hardware/samd/1.7.9/cores/arduino/Arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Arduino.h - Main include file for the Arduino SDK 3 | Copyright (c) 2014 Arduino LLC. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library 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 GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef Arduino_h 21 | #define Arduino_h 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #define CORE_HAS_LIBB64 30 | 31 | typedef bool boolean; 32 | typedef uint8_t byte; 33 | typedef uint16_t word; 34 | 35 | // some libraries and sketches depend on this AVR stuff, 36 | // assuming Arduino.h or WProgram.h automatically includes it... 37 | // 38 | #include "avr/pgmspace.h" 39 | #include "avr/interrupt.h" 40 | #include "avr/dtostrf.h" 41 | #include "avr/io.h" 42 | 43 | #include "binary.h" 44 | #include "itoa.h" 45 | 46 | #ifdef __cplusplus 47 | extern "C"{ 48 | #endif // __cplusplus 49 | 50 | // Include Atmel headers 51 | #include "sam.h" 52 | 53 | #include "wiring_constants.h" 54 | 55 | #define clockCyclesPerMicrosecond() ( SystemCoreClock / 1000000L ) 56 | #define clockCyclesToMicroseconds(a) ( ((a) * 1000L) / (SystemCoreClock / 1000L) ) 57 | #define microsecondsToClockCycles(a) ( (a) * (SystemCoreClock / 1000000L) ) 58 | 59 | void yield( void ) ; 60 | 61 | /* system functions */ 62 | int main( void ); 63 | void init( void ); 64 | 65 | /* sketch */ 66 | void setup( void ) ; 67 | void loop( void ) ; 68 | 69 | int __debug_buf(const char* head, char* buf, int len); 70 | 71 | #include "WVariant.h" 72 | 73 | #ifdef __cplusplus 74 | } // extern "C" 75 | #endif 76 | 77 | // The following headers are for C++ only compilation 78 | #ifdef __cplusplus 79 | #include "WCharacter.h" 80 | #include "WString.h" 81 | #include "Tone.h" 82 | #include "WMath.h" 83 | #include "HardwareSerial.h" 84 | #include "pulse.h" 85 | #endif 86 | #include "delay.h" 87 | #ifdef __cplusplus 88 | #include "Uart.h" 89 | #endif 90 | 91 | // Include board variant 92 | #include "variant.h" 93 | 94 | #include "wiring.h" 95 | #include "wiring_digital.h" 96 | #include "wiring_analog.h" 97 | #include "wiring_shift.h" 98 | #include "wiring_pwm.h" 99 | #include "WInterrupts.h" 100 | 101 | // undefine stdlib's abs if encountered 102 | #ifdef abs 103 | #undef abs 104 | #endif // abs 105 | // undefine stdlib's abs if encountered 106 | #ifdef abs 107 | #undef abs 108 | #endif // abs 109 | 110 | #ifdef __cplusplus 111 | template 112 | auto min(const T& a, const L& b) -> decltype((b < a) ? b : a) 113 | { 114 | return (b < a) ? b : a; 115 | } 116 | 117 | template 118 | auto max(const T& a, const L& b) -> decltype((b < a) ? b : a) 119 | { 120 | return (a < b) ? b : a; 121 | } 122 | #else 123 | #ifndef min 124 | #define min(a,b) \ 125 | ({ __typeof__ (a) _a = (a); \ 126 | __typeof__ (b) _b = (b); \ 127 | _a < _b ? _a : _b; }) 128 | #endif 129 | #ifndef max 130 | #define max(a,b) \ 131 | ({ __typeof__ (a) _a = (a); \ 132 | __typeof__ (b) _b = (b); \ 133 | _a > _b ? _a : _b; }) 134 | #endif 135 | #endif 136 | 137 | #define abs(x) ((x)>0?(x):-(x)) 138 | #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) 139 | #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) 140 | #define radians(deg) ((deg)*DEG_TO_RAD) 141 | #define degrees(rad) ((rad)*RAD_TO_DEG) 142 | #define sq(x) ((x)*(x)) 143 | 144 | #define interrupts() __enable_irq() 145 | #define noInterrupts() __disable_irq() 146 | #ifndef interruptsStatus 147 | static inline unsigned char __interruptsStatus(void) __attribute__((always_inline, unused)); 148 | static inline unsigned char __interruptsStatus(void) 149 | { 150 | // See http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0497a/CHDBIBGJ.html 151 | return (__get_PRIMASK() ? 0 : 1); 152 | } 153 | #define interruptsStatus() __interruptsStatus() 154 | #endif 155 | 156 | #define lowByte(w) ((uint8_t) ((w) & 0xff)) 157 | #define highByte(w) ((uint8_t) ((w) >> 8)) 158 | 159 | #define bitRead(value, bit) (((value) >> (bit)) & 0x01) 160 | #define bitSet(value, bit) ((value) |= (1UL << (bit))) 161 | #define bitClear(value, bit) ((value) &= ~(1UL << (bit))) 162 | #define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit)) 163 | 164 | #define bit(b) (1UL << (b)) 165 | 166 | #if (ARDUINO_SAMD_VARIANT_COMPLIANCE >= 10606) 167 | // Interrupts 168 | #define digitalPinToInterrupt(P) ( P ) 169 | #endif 170 | 171 | // USB 172 | #ifdef USE_TINYUSB 173 | #include "Adafruit_TinyUSB_Core.h" 174 | #else 175 | #include "USB/USBDesc.h" 176 | #include "USB/USBCore.h" 177 | #include "USB/USBAPI.h" 178 | #include "USB/USB_host.h" 179 | #endif 180 | 181 | #endif // Arduino_h 182 | -------------------------------------------------------------------------------- /Packages_Patches/Seeeduino/hardware/samd/1.7.9/cores/arduino/Print.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino LLC. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include // for size_t 23 | #include // for printf 24 | 25 | #include "WString.h" 26 | #include "Printable.h" 27 | 28 | #define DEC 10 29 | #define HEX 16 30 | #define OCT 8 31 | #define BIN 2 32 | 33 | class Print 34 | { 35 | private: 36 | int write_error; 37 | size_t printNumber(unsigned long, uint8_t); 38 | size_t printULLNumber(unsigned long long, uint8_t); 39 | size_t printFloat(double, int); 40 | protected: 41 | void setWriteError(int err = 1) { write_error = err; } 42 | public: 43 | Print() : write_error(0) {} 44 | 45 | int getWriteError() { return write_error; } 46 | void clearWriteError() { setWriteError(0); } 47 | 48 | virtual size_t write(uint8_t) = 0; 49 | size_t write(const char *str) { 50 | if (str == NULL) return 0; 51 | return write((const uint8_t *)str, strlen(str)); 52 | } 53 | virtual size_t write(const uint8_t *buffer, size_t size); 54 | size_t write(const char *buffer, size_t size) { 55 | return write((const uint8_t *)buffer, size); 56 | } 57 | 58 | // default to zero, meaning "a single write may block" 59 | // should be overridden by subclasses with buffering 60 | virtual int availableForWrite() { return 0; } 61 | 62 | size_t print(const __FlashStringHelper *); 63 | size_t print(const String &); 64 | size_t print(const char[]); 65 | size_t print(char); 66 | size_t print(unsigned char, int = DEC); 67 | size_t print(int, int = DEC); 68 | size_t print(unsigned int, int = DEC); 69 | size_t print(long, int = DEC); 70 | size_t print(unsigned long, int = DEC); 71 | size_t print(long long, int = DEC); 72 | size_t print(unsigned long long, int = DEC); 73 | size_t print(double, int = 2); 74 | size_t print(const Printable&); 75 | 76 | size_t println(const __FlashStringHelper *); 77 | size_t println(const String &s); 78 | size_t println(const char[]); 79 | size_t println(char); 80 | size_t println(unsigned char, int = DEC); 81 | size_t println(int, int = DEC); 82 | size_t println(unsigned int, int = DEC); 83 | size_t println(long, int = DEC); 84 | size_t println(unsigned long, int = DEC); 85 | size_t println(long long, int = DEC); 86 | size_t println(unsigned long long, int = DEC); 87 | size_t println(double, int = 2); 88 | size_t println(const Printable&); 89 | size_t println(void); 90 | 91 | size_t printf(const char * format, ...); 92 | 93 | size_t printBuffer(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 94 | size_t printBuffer(char const buffer[], int size, char delim=' ', int byteline = 0) 95 | { 96 | return printBuffer((uint8_t const*) buffer, size, delim, byteline); 97 | } 98 | 99 | size_t printBufferReverse(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 100 | size_t printBufferReverse(char const buffer[], int size, char delim=' ', int byteline = 0) 101 | { 102 | return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); 103 | } 104 | 105 | virtual void flush() { /* Empty implementation for backward compatibility */ } 106 | }; 107 | 108 | 109 | -------------------------------------------------------------------------------- /Packages_Patches/Seeeduino/hardware/samd/1.8.1/cores/arduino/Arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Arduino.h - Main include file for the Arduino SDK 3 | Copyright (c) 2014 Arduino LLC. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library 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 GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef Arduino_h 21 | #define Arduino_h 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #define CORE_HAS_LIBB64 30 | 31 | typedef bool boolean; 32 | typedef uint8_t byte; 33 | typedef uint16_t word; 34 | 35 | // some libraries and sketches depend on this AVR stuff, 36 | // assuming Arduino.h or WProgram.h automatically includes it... 37 | // 38 | #include "avr/pgmspace.h" 39 | #include "avr/interrupt.h" 40 | #include "avr/dtostrf.h" 41 | #include "avr/io.h" 42 | 43 | #include "binary.h" 44 | #include "itoa.h" 45 | 46 | #ifdef __cplusplus 47 | extern "C"{ 48 | #endif // __cplusplus 49 | 50 | // Include Atmel headers 51 | #include "sam.h" 52 | 53 | #include "wiring_constants.h" 54 | 55 | #define clockCyclesPerMicrosecond() ( SystemCoreClock / 1000000L ) 56 | #define clockCyclesToMicroseconds(a) ( ((a) * 1000L) / (SystemCoreClock / 1000L) ) 57 | #define microsecondsToClockCycles(a) ( (a) * (SystemCoreClock / 1000000L) ) 58 | 59 | void yield( void ) ; 60 | 61 | /* system functions */ 62 | int main( void ); 63 | void init( void ); 64 | 65 | /* sketch */ 66 | void setup( void ) ; 67 | void loop( void ) ; 68 | 69 | int __debug_buf(const char* head, char* buf, int len); 70 | 71 | #include "WVariant.h" 72 | 73 | #ifdef __cplusplus 74 | } // extern "C" 75 | #endif 76 | 77 | // The following headers are for C++ only compilation 78 | #ifdef __cplusplus 79 | #include "WCharacter.h" 80 | #include "WString.h" 81 | #include "Tone.h" 82 | #include "WMath.h" 83 | #include "HardwareSerial.h" 84 | #include "pulse.h" 85 | #endif 86 | #include "delay.h" 87 | #ifdef __cplusplus 88 | #include "Uart.h" 89 | #endif 90 | 91 | // Include board variant 92 | #include "variant.h" 93 | 94 | #include "wiring.h" 95 | #include "wiring_digital.h" 96 | #include "wiring_analog.h" 97 | #include "wiring_shift.h" 98 | #include "wiring_pwm.h" 99 | #include "WInterrupts.h" 100 | 101 | // undefine stdlib's abs if encountered 102 | #ifdef abs 103 | #undef abs 104 | #endif // abs 105 | // undefine stdlib's abs if encountered 106 | #ifdef abs 107 | #undef abs 108 | #endif // abs 109 | 110 | #ifdef __cplusplus 111 | template 112 | auto min(const T& a, const L& b) -> decltype((b < a) ? b : a) 113 | { 114 | return (b < a) ? b : a; 115 | } 116 | 117 | template 118 | auto max(const T& a, const L& b) -> decltype((b < a) ? b : a) 119 | { 120 | return (a < b) ? b : a; 121 | } 122 | #else 123 | #ifndef min 124 | #define min(a,b) \ 125 | ({ __typeof__ (a) _a = (a); \ 126 | __typeof__ (b) _b = (b); \ 127 | _a < _b ? _a : _b; }) 128 | #endif 129 | #ifndef max 130 | #define max(a,b) \ 131 | ({ __typeof__ (a) _a = (a); \ 132 | __typeof__ (b) _b = (b); \ 133 | _a > _b ? _a : _b; }) 134 | #endif 135 | #endif 136 | 137 | #define abs(x) ((x)>0?(x):-(x)) 138 | #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) 139 | #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) 140 | #define radians(deg) ((deg)*DEG_TO_RAD) 141 | #define degrees(rad) ((rad)*RAD_TO_DEG) 142 | #define sq(x) ((x)*(x)) 143 | 144 | #define interrupts() __enable_irq() 145 | #define noInterrupts() __disable_irq() 146 | #ifndef interruptsStatus 147 | static inline unsigned char __interruptsStatus(void) __attribute__((always_inline, unused)); 148 | static inline unsigned char __interruptsStatus(void) 149 | { 150 | // See http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0497a/CHDBIBGJ.html 151 | return (__get_PRIMASK() ? 0 : 1); 152 | } 153 | #define interruptsStatus() __interruptsStatus() 154 | #endif 155 | 156 | #define lowByte(w) ((uint8_t) ((w) & 0xff)) 157 | #define highByte(w) ((uint8_t) ((w) >> 8)) 158 | 159 | #define bitRead(value, bit) (((value) >> (bit)) & 0x01) 160 | #define bitSet(value, bit) ((value) |= (1UL << (bit))) 161 | #define bitClear(value, bit) ((value) &= ~(1UL << (bit))) 162 | #define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit)) 163 | 164 | #define bit(b) (1UL << (b)) 165 | 166 | #if (ARDUINO_SAMD_VARIANT_COMPLIANCE >= 10606) 167 | // Interrupts 168 | #define digitalPinToInterrupt(P) ( P ) 169 | #endif 170 | 171 | // USB 172 | #ifdef USE_TINYUSB 173 | #include "Adafruit_TinyUSB_Core.h" 174 | #else 175 | #include "USB/USBDesc.h" 176 | #include "USB/USBCore.h" 177 | #include "USB/USBAPI.h" 178 | #include "USB/USB_host.h" 179 | #endif 180 | 181 | #endif // Arduino_h 182 | -------------------------------------------------------------------------------- /Packages_Patches/Seeeduino/hardware/samd/1.8.1/cores/arduino/Print.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino LLC. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include // for size_t 23 | #include // for printf 24 | 25 | #include "WString.h" 26 | #include "Printable.h" 27 | 28 | #define DEC 10 29 | #define HEX 16 30 | #define OCT 8 31 | #define BIN 2 32 | 33 | class Print 34 | { 35 | private: 36 | int write_error; 37 | size_t printNumber(unsigned long, uint8_t); 38 | size_t printULLNumber(unsigned long long, uint8_t); 39 | size_t printFloat(double, int); 40 | protected: 41 | void setWriteError(int err = 1) { write_error = err; } 42 | public: 43 | Print() : write_error(0) {} 44 | 45 | int getWriteError() { return write_error; } 46 | void clearWriteError() { setWriteError(0); } 47 | 48 | virtual size_t write(uint8_t) = 0; 49 | size_t write(const char *str) { 50 | if (str == NULL) return 0; 51 | return write((const uint8_t *)str, strlen(str)); 52 | } 53 | virtual size_t write(const uint8_t *buffer, size_t size); 54 | size_t write(const char *buffer, size_t size) { 55 | return write((const uint8_t *)buffer, size); 56 | } 57 | 58 | // default to zero, meaning "a single write may block" 59 | // should be overridden by subclasses with buffering 60 | virtual int availableForWrite() { return 0; } 61 | 62 | size_t print(const __FlashStringHelper *); 63 | size_t print(const String &); 64 | size_t print(const char[]); 65 | size_t print(char); 66 | size_t print(unsigned char, int = DEC); 67 | size_t print(int, int = DEC); 68 | size_t print(unsigned int, int = DEC); 69 | size_t print(long, int = DEC); 70 | size_t print(unsigned long, int = DEC); 71 | size_t print(long long, int = DEC); 72 | size_t print(unsigned long long, int = DEC); 73 | size_t print(double, int = 2); 74 | size_t print(const Printable&); 75 | 76 | size_t println(const __FlashStringHelper *); 77 | size_t println(const String &s); 78 | size_t println(const char[]); 79 | size_t println(char); 80 | size_t println(unsigned char, int = DEC); 81 | size_t println(int, int = DEC); 82 | size_t println(unsigned int, int = DEC); 83 | size_t println(long, int = DEC); 84 | size_t println(unsigned long, int = DEC); 85 | size_t println(long long, int = DEC); 86 | size_t println(unsigned long long, int = DEC); 87 | size_t println(double, int = 2); 88 | size_t println(const Printable&); 89 | size_t println(void); 90 | 91 | size_t printf(const char * format, ...); 92 | 93 | size_t printBuffer(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 94 | size_t printBuffer(char const buffer[], int size, char delim=' ', int byteline = 0) 95 | { 96 | return printBuffer((uint8_t const*) buffer, size, delim, byteline); 97 | } 98 | 99 | size_t printBufferReverse(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 100 | size_t printBufferReverse(char const buffer[], int size, char delim=' ', int byteline = 0) 101 | { 102 | return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); 103 | } 104 | 105 | virtual void flush() { /* Empty implementation for backward compatibility */ } 106 | }; 107 | 108 | 109 | -------------------------------------------------------------------------------- /Packages_Patches/Seeeduino/hardware/samd/1.8.2/cores/arduino/Arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Arduino.h - Main include file for the Arduino SDK 3 | Copyright (c) 2014 Arduino LLC. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library 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 GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | #ifndef Arduino_h 21 | #define Arduino_h 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #define CORE_HAS_LIBB64 30 | 31 | typedef bool boolean; 32 | typedef uint8_t byte; 33 | typedef uint16_t word; 34 | 35 | // some libraries and sketches depend on this AVR stuff, 36 | // assuming Arduino.h or WProgram.h automatically includes it... 37 | // 38 | #include "avr/pgmspace.h" 39 | #include "avr/interrupt.h" 40 | #include "avr/dtostrf.h" 41 | #include "avr/io.h" 42 | 43 | #include "binary.h" 44 | #include "itoa.h" 45 | 46 | #ifdef __cplusplus 47 | extern "C" { 48 | #endif // __cplusplus 49 | 50 | // Include Atmel headers 51 | #include "sam.h" 52 | 53 | #include "wiring_constants.h" 54 | 55 | #define clockCyclesPerMicrosecond() ( SystemCoreClock / 1000000L ) 56 | #define clockCyclesToMicroseconds(a) ( ((a) * 1000L) / (SystemCoreClock / 1000L) ) 57 | #define microsecondsToClockCycles(a) ( (a) * (SystemCoreClock / 1000000L) ) 58 | 59 | void yield( void ) ; 60 | 61 | /* system functions */ 62 | int main( void ); 63 | void init( void ); 64 | 65 | /* sketch */ 66 | void setup( void ) ; 67 | void loop( void ) ; 68 | 69 | int __debug_buf(const char* head, char* buf, int len); 70 | 71 | #include "WVariant.h" 72 | 73 | #ifdef __cplusplus 74 | } // extern "C" 75 | #endif 76 | 77 | // The following headers are for C++ only compilation 78 | #ifdef __cplusplus 79 | #include "WCharacter.h" 80 | #include "WString.h" 81 | #include "Tone.h" 82 | #include "WMath.h" 83 | #include "HardwareSerial.h" 84 | #include "pulse.h" 85 | #endif 86 | #include "delay.h" 87 | #ifdef __cplusplus 88 | #include "Uart.h" 89 | #endif 90 | 91 | // Include board variant 92 | #include "variant.h" 93 | 94 | #include "wiring.h" 95 | #include "wiring_digital.h" 96 | #include "wiring_analog.h" 97 | #include "wiring_shift.h" 98 | #include "wiring_pwm.h" 99 | #include "WInterrupts.h" 100 | 101 | // undefine stdlib's abs if encountered 102 | #ifdef abs 103 | #undef abs 104 | #endif // abs 105 | // undefine stdlib's abs if encountered 106 | #ifdef abs 107 | #undef abs 108 | #endif // abs 109 | 110 | #ifdef __cplusplus 111 | template 112 | auto min(const T& a, const L& b) -> decltype((b < a) ? b : a) 113 | { 114 | return (b < a) ? b : a; 115 | } 116 | 117 | template 118 | auto max(const T& a, const L& b) -> decltype((b < a) ? b : a) 119 | { 120 | return (a < b) ? b : a; 121 | } 122 | #else 123 | #ifndef min 124 | #define min(a,b) \ 125 | ({ __typeof__ (a) _a = (a); \ 126 | __typeof__ (b) _b = (b); \ 127 | _a < _b ? _a : _b; }) 128 | #endif 129 | #ifndef max 130 | #define max(a,b) \ 131 | ({ __typeof__ (a) _a = (a); \ 132 | __typeof__ (b) _b = (b); \ 133 | _a > _b ? _a : _b; }) 134 | #endif 135 | #endif 136 | 137 | #define abs(x) ((x)>0?(x):-(x)) 138 | #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) 139 | #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) 140 | #define radians(deg) ((deg)*DEG_TO_RAD) 141 | #define degrees(rad) ((rad)*RAD_TO_DEG) 142 | #define sq(x) ((x)*(x)) 143 | 144 | #define interrupts() __enable_irq() 145 | #define noInterrupts() __disable_irq() 146 | #ifndef interruptsStatus 147 | static inline unsigned char __interruptsStatus(void) __attribute__((always_inline, unused)); 148 | static inline unsigned char __interruptsStatus(void) 149 | { 150 | // See http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0497a/CHDBIBGJ.html 151 | return (__get_PRIMASK() ? 0 : 1); 152 | } 153 | #define interruptsStatus() __interruptsStatus() 154 | #endif 155 | 156 | #define lowByte(w) ((uint8_t) ((w) & 0xff)) 157 | #define highByte(w) ((uint8_t) ((w) >> 8)) 158 | 159 | #define bitRead(value, bit) (((value) >> (bit)) & 0x01) 160 | #define bitSet(value, bit) ((value) |= (1UL << (bit))) 161 | #define bitClear(value, bit) ((value) &= ~(1UL << (bit))) 162 | #define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit)) 163 | 164 | #define bit(b) (1UL << (b)) 165 | 166 | #if (ARDUINO_SAMD_VARIANT_COMPLIANCE >= 10606) 167 | // Interrupts 168 | #define digitalPinToInterrupt(P) ( P ) 169 | #endif 170 | 171 | // USB 172 | #ifdef USE_TINYUSB 173 | #include "Adafruit_TinyUSB_Core.h" 174 | #else 175 | #include "USB/USBDesc.h" 176 | #include "USB/USBCore.h" 177 | #include "USB/USBAPI.h" 178 | #include "USB/USB_host.h" 179 | #endif 180 | 181 | #endif // Arduino_h 182 | -------------------------------------------------------------------------------- /Packages_Patches/Seeeduino/hardware/samd/1.8.2/cores/arduino/Print.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino LLC. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include // for size_t 23 | #include // for printf 24 | 25 | #include "WString.h" 26 | #include "Printable.h" 27 | 28 | #define DEC 10 29 | #define HEX 16 30 | #define OCT 8 31 | #define BIN 2 32 | 33 | class Print 34 | { 35 | private: 36 | int write_error; 37 | size_t printNumber(unsigned long, uint8_t); 38 | size_t printULLNumber(unsigned long long, uint8_t); 39 | size_t printFloat(double, int); 40 | protected: 41 | void setWriteError(int err = 1) 42 | { 43 | write_error = err; 44 | } 45 | public: 46 | Print() : write_error(0) {} 47 | 48 | int getWriteError() 49 | { 50 | return write_error; 51 | } 52 | void clearWriteError() 53 | { 54 | setWriteError(0); 55 | } 56 | 57 | virtual size_t write(uint8_t) = 0; 58 | size_t write(const char *str) 59 | { 60 | if (str == NULL) 61 | return 0; 62 | 63 | return write((const uint8_t *)str, strlen(str)); 64 | } 65 | virtual size_t write(const uint8_t *buffer, size_t size); 66 | size_t write(const char *buffer, size_t size) 67 | { 68 | return write((const uint8_t *)buffer, size); 69 | } 70 | 71 | // default to zero, meaning "a single write may block" 72 | // should be overridden by subclasses with buffering 73 | virtual int availableForWrite() 74 | { 75 | return 0; 76 | } 77 | 78 | size_t print(const __FlashStringHelper *); 79 | size_t print(const String &); 80 | size_t print(const char[]); 81 | size_t print(char); 82 | size_t print(unsigned char, int = DEC); 83 | size_t print(int, int = DEC); 84 | size_t print(unsigned int, int = DEC); 85 | size_t print(long, int = DEC); 86 | size_t print(unsigned long, int = DEC); 87 | size_t print(long long, int = DEC); 88 | size_t print(unsigned long long, int = DEC); 89 | size_t print(double, int = 2); 90 | size_t print(const Printable&); 91 | 92 | size_t println(const __FlashStringHelper *); 93 | size_t println(const String &s); 94 | size_t println(const char[]); 95 | size_t println(char); 96 | size_t println(unsigned char, int = DEC); 97 | size_t println(int, int = DEC); 98 | size_t println(unsigned int, int = DEC); 99 | size_t println(long, int = DEC); 100 | size_t println(unsigned long, int = DEC); 101 | size_t println(long long, int = DEC); 102 | size_t println(unsigned long long, int = DEC); 103 | size_t println(double, int = 2); 104 | size_t println(const Printable&); 105 | size_t println(void); 106 | 107 | size_t printf(const char * format, ...); 108 | 109 | size_t printBuffer(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); 110 | size_t printBuffer(char const buffer[], int size, char delim = ' ', int byteline = 0) 111 | { 112 | return printBuffer((uint8_t const*) buffer, size, delim, byteline); 113 | } 114 | 115 | size_t printBufferReverse(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); 116 | size_t printBufferReverse(char const buffer[], int size, char delim = ' ', int byteline = 0) 117 | { 118 | return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); 119 | } 120 | 121 | virtual void flush() { /* Empty implementation for backward compatibility */ } 122 | }; 123 | 124 | 125 | -------------------------------------------------------------------------------- /Packages_Patches/Seeeduino/hardware/samd/1.8.3/cores/arduino/Print.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino LLC. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include // for size_t 23 | #include // for printf 24 | 25 | #include "WString.h" 26 | #include "Printable.h" 27 | 28 | #define DEC 10 29 | #define HEX 16 30 | #define OCT 8 31 | #define BIN 2 32 | 33 | class Print 34 | { 35 | private: 36 | int write_error; 37 | size_t printNumber(unsigned long, uint8_t); 38 | size_t printULLNumber(unsigned long long, uint8_t); 39 | size_t printFloat(double, int); 40 | protected: 41 | void setWriteError(int err = 1) 42 | { 43 | write_error = err; 44 | } 45 | public: 46 | Print() : write_error(0) {} 47 | 48 | int getWriteError() 49 | { 50 | return write_error; 51 | } 52 | void clearWriteError() 53 | { 54 | setWriteError(0); 55 | } 56 | 57 | virtual size_t write(uint8_t) = 0; 58 | size_t write(const char *str) 59 | { 60 | if (str == NULL) 61 | return 0; 62 | 63 | return write((const uint8_t *)str, strlen(str)); 64 | } 65 | virtual size_t write(const uint8_t *buffer, size_t size); 66 | size_t write(const char *buffer, size_t size) 67 | { 68 | return write((const uint8_t *)buffer, size); 69 | } 70 | 71 | // default to zero, meaning "a single write may block" 72 | // should be overridden by subclasses with buffering 73 | virtual int availableForWrite() 74 | { 75 | return 0; 76 | } 77 | 78 | size_t print(const __FlashStringHelper *); 79 | size_t print(const String &); 80 | size_t print(const char[]); 81 | size_t print(char); 82 | size_t print(unsigned char, int = DEC); 83 | size_t print(int, int = DEC); 84 | size_t print(unsigned int, int = DEC); 85 | size_t print(long, int = DEC); 86 | size_t print(unsigned long, int = DEC); 87 | size_t print(long long, int = DEC); 88 | size_t print(unsigned long long, int = DEC); 89 | size_t print(double, int = 2); 90 | size_t print(const Printable&); 91 | 92 | size_t println(const __FlashStringHelper *); 93 | size_t println(const String &s); 94 | size_t println(const char[]); 95 | size_t println(char); 96 | size_t println(unsigned char, int = DEC); 97 | size_t println(int, int = DEC); 98 | size_t println(unsigned int, int = DEC); 99 | size_t println(long, int = DEC); 100 | size_t println(unsigned long, int = DEC); 101 | size_t println(long long, int = DEC); 102 | size_t println(unsigned long long, int = DEC); 103 | size_t println(double, int = 2); 104 | size_t println(const Printable&); 105 | size_t println(void); 106 | 107 | size_t printf(const char * format, ...); 108 | 109 | size_t printBuffer(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); 110 | size_t printBuffer(char const buffer[], int size, char delim = ' ', int byteline = 0) 111 | { 112 | return printBuffer((uint8_t const*) buffer, size, delim, byteline); 113 | } 114 | 115 | size_t printBufferReverse(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); 116 | size_t printBufferReverse(char const buffer[], int size, char delim = ' ', int byteline = 0) 117 | { 118 | return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); 119 | } 120 | 121 | virtual void flush() { /* Empty implementation for backward compatibility */ } 122 | }; 123 | 124 | 125 | -------------------------------------------------------------------------------- /Packages_Patches/SparkFun/hardware/samd/1.8.3/cores/arduino/Print.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino LLC. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include // for size_t 23 | 24 | #include "WString.h" 25 | #include "Printable.h" 26 | 27 | #define DEC 10 28 | #define HEX 16 29 | #define OCT 8 30 | #define BIN 2 31 | 32 | class Print 33 | { 34 | private: 35 | int write_error; 36 | size_t printNumber(unsigned long, uint8_t); 37 | size_t printULLNumber(unsigned long long, uint8_t); 38 | size_t printFloat(double, int); 39 | protected: 40 | void setWriteError(int err = 1) 41 | { 42 | write_error = err; 43 | } 44 | public: 45 | Print() : write_error(0) {} 46 | 47 | int getWriteError() 48 | { 49 | return write_error; 50 | } 51 | void clearWriteError() 52 | { 53 | setWriteError(0); 54 | } 55 | 56 | virtual size_t write(uint8_t) = 0; 57 | size_t write(const char *str) 58 | { 59 | if (str == NULL) 60 | return 0; 61 | 62 | return write((const uint8_t *)str, strlen(str)); 63 | } 64 | virtual size_t write(const uint8_t *buffer, size_t size); 65 | size_t write(const char *buffer, size_t size) 66 | { 67 | return write((const uint8_t *)buffer, size); 68 | } 69 | 70 | // default to zero, meaning "a single write may block" 71 | // should be overridden by subclasses with buffering 72 | virtual int availableForWrite() 73 | { 74 | return 0; 75 | } 76 | 77 | size_t print(const __FlashStringHelper *); 78 | size_t print(const String &); 79 | size_t print(const char[]); 80 | size_t print(char); 81 | size_t print(unsigned char, int = DEC); 82 | size_t print(int, int = DEC); 83 | size_t print(unsigned int, int = DEC); 84 | size_t print(long, int = DEC); 85 | size_t print(unsigned long, int = DEC); 86 | size_t print(long long, int = DEC); 87 | size_t print(unsigned long long, int = DEC); 88 | size_t print(double, int = 2); 89 | size_t print(const Printable&); 90 | 91 | size_t println(const __FlashStringHelper *); 92 | size_t println(const String &s); 93 | size_t println(const char[]); 94 | size_t println(char); 95 | size_t println(unsigned char, int = DEC); 96 | size_t println(int, int = DEC); 97 | size_t println(unsigned int, int = DEC); 98 | size_t println(long, int = DEC); 99 | size_t println(unsigned long, int = DEC); 100 | size_t println(long long, int = DEC); 101 | size_t println(unsigned long long, int = DEC); 102 | size_t println(double, int = 2); 103 | size_t println(const Printable&); 104 | size_t println(void); 105 | 106 | size_t printf(const char * format, ...); 107 | 108 | size_t printBuffer(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); 109 | size_t printBuffer(char const buffer[], int size, char delim = ' ', int byteline = 0) 110 | { 111 | return printBuffer((uint8_t const*) buffer, size, delim, byteline); 112 | } 113 | 114 | size_t printBufferReverse(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); 115 | size_t printBufferReverse(char const buffer[], int size, char delim = ' ', int byteline = 0) 116 | { 117 | return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); 118 | } 119 | 120 | virtual void flush() { /* Empty implementation for backward compatibility */ } 121 | }; 122 | 123 | 124 | -------------------------------------------------------------------------------- /Packages_Patches/SparkFun/hardware/samd/1.8.3/cores/arduino51/Print.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino LLC. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include // for size_t 23 | 24 | #include "WString.h" 25 | #include "Printable.h" 26 | 27 | #define DEC 10 28 | #define HEX 16 29 | #define OCT 8 30 | #define BIN 2 31 | 32 | class Print 33 | { 34 | private: 35 | int write_error; 36 | size_t printNumber(unsigned long, uint8_t); 37 | size_t printULLNumber(unsigned long long, uint8_t); 38 | size_t printFloat(double, int); 39 | protected: 40 | void setWriteError(int err = 1) 41 | { 42 | write_error = err; 43 | } 44 | public: 45 | Print() : write_error(0) {} 46 | 47 | int getWriteError() 48 | { 49 | return write_error; 50 | } 51 | void clearWriteError() 52 | { 53 | setWriteError(0); 54 | } 55 | 56 | virtual size_t write(uint8_t) = 0; 57 | size_t write(const char *str) 58 | { 59 | if (str == NULL) 60 | return 0; 61 | 62 | return write((const uint8_t *)str, strlen(str)); 63 | } 64 | virtual size_t write(const uint8_t *buffer, size_t size); 65 | size_t write(const char *buffer, size_t size) 66 | { 67 | return write((const uint8_t *)buffer, size); 68 | } 69 | 70 | // default to zero, meaning "a single write may block" 71 | // should be overridden by subclasses with buffering 72 | virtual int availableForWrite() 73 | { 74 | return 0; 75 | } 76 | 77 | size_t print(const __FlashStringHelper *); 78 | size_t print(const String &); 79 | size_t print(const char[]); 80 | size_t print(char); 81 | size_t print(unsigned char, int = DEC); 82 | size_t print(int, int = DEC); 83 | size_t print(unsigned int, int = DEC); 84 | size_t print(long, int = DEC); 85 | size_t print(unsigned long, int = DEC); 86 | size_t print(long long, int = DEC); 87 | size_t print(unsigned long long, int = DEC); 88 | size_t print(double, int = 2); 89 | size_t print(const Printable&); 90 | 91 | size_t println(const __FlashStringHelper *); 92 | size_t println(const String &s); 93 | size_t println(const char[]); 94 | size_t println(char); 95 | size_t println(unsigned char, int = DEC); 96 | size_t println(int, int = DEC); 97 | size_t println(unsigned int, int = DEC); 98 | size_t println(long, int = DEC); 99 | size_t println(unsigned long, int = DEC); 100 | size_t println(long long, int = DEC); 101 | size_t println(unsigned long long, int = DEC); 102 | size_t println(double, int = 2); 103 | size_t println(const Printable&); 104 | size_t println(void); 105 | 106 | size_t printf(const char * format, ...); 107 | 108 | size_t printBuffer(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); 109 | size_t printBuffer(char const buffer[], int size, char delim = ' ', int byteline = 0) 110 | { 111 | return printBuffer((uint8_t const*) buffer, size, delim, byteline); 112 | } 113 | 114 | size_t printBufferReverse(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); 115 | size_t printBufferReverse(char const buffer[], int size, char delim = ' ', int byteline = 0) 116 | { 117 | return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); 118 | } 119 | 120 | virtual void flush() { /* Empty implementation for backward compatibility */ } 121 | }; 122 | 123 | 124 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/samd/1.5.14/cores/arduino/Print.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino LLC. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include // for size_t 23 | 24 | #include "WString.h" 25 | #include "Printable.h" 26 | 27 | #define DEC 10 28 | #define HEX 16 29 | #define OCT 8 30 | #define BIN 2 31 | 32 | class Print 33 | { 34 | private: 35 | int write_error; 36 | size_t printNumber(unsigned long, uint8_t); 37 | size_t printULLNumber(unsigned long long, uint8_t); 38 | size_t printFloat(double, int); 39 | protected: 40 | void setWriteError(int err = 1) { write_error = err; } 41 | public: 42 | Print() : write_error(0) {} 43 | 44 | int getWriteError() { return write_error; } 45 | void clearWriteError() { setWriteError(0); } 46 | 47 | virtual size_t write(uint8_t) = 0; 48 | size_t write(const char *str) { 49 | if (str == NULL) return 0; 50 | return write((const uint8_t *)str, strlen(str)); 51 | } 52 | virtual size_t write(const uint8_t *buffer, size_t size); 53 | size_t write(const char *buffer, size_t size) { 54 | return write((const uint8_t *)buffer, size); 55 | } 56 | 57 | // default to zero, meaning "a single write may block" 58 | // should be overridden by subclasses with buffering 59 | virtual int availableForWrite() { return 0; } 60 | 61 | size_t print(const __FlashStringHelper *); 62 | size_t print(const String &); 63 | size_t print(const char[]); 64 | size_t print(char); 65 | size_t print(unsigned char, int = DEC); 66 | size_t print(int, int = DEC); 67 | size_t print(unsigned int, int = DEC); 68 | size_t print(long, int = DEC); 69 | size_t print(unsigned long, int = DEC); 70 | size_t print(long long, int = DEC); 71 | size_t print(unsigned long long, int = DEC); 72 | size_t print(double, int = 2); 73 | size_t print(const Printable&); 74 | 75 | size_t println(const __FlashStringHelper *); 76 | size_t println(const String &s); 77 | size_t println(const char[]); 78 | size_t println(char); 79 | size_t println(unsigned char, int = DEC); 80 | size_t println(int, int = DEC); 81 | size_t println(unsigned int, int = DEC); 82 | size_t println(long, int = DEC); 83 | size_t println(unsigned long, int = DEC); 84 | size_t println(long long, int = DEC); 85 | size_t println(unsigned long long, int = DEC); 86 | size_t println(double, int = 2); 87 | size_t println(const Printable&); 88 | size_t println(void); 89 | 90 | size_t printf(const char * format, ...); 91 | 92 | size_t printBuffer(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 93 | size_t printBuffer(char const buffer[], int size, char delim=' ', int byteline = 0) 94 | { 95 | return printBuffer((uint8_t const*) buffer, size, delim, byteline); 96 | } 97 | 98 | size_t printBufferReverse(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 99 | size_t printBufferReverse(char const buffer[], int size, char delim=' ', int byteline = 0) 100 | { 101 | return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); 102 | } 103 | 104 | virtual void flush() { /* Empty implementation for backward compatibility */ } 105 | }; 106 | 107 | 108 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/samd/1.6.0/cores/arduino/Print.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino LLC. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include // for size_t 23 | 24 | #include "WString.h" 25 | #include "Printable.h" 26 | 27 | #define DEC 10 28 | #define HEX 16 29 | #define OCT 8 30 | #define BIN 2 31 | 32 | class Print 33 | { 34 | private: 35 | int write_error; 36 | size_t printNumber(unsigned long, uint8_t); 37 | size_t printULLNumber(unsigned long long, uint8_t); 38 | size_t printFloat(double, int); 39 | protected: 40 | void setWriteError(int err = 1) { write_error = err; } 41 | public: 42 | Print() : write_error(0) {} 43 | 44 | int getWriteError() { return write_error; } 45 | void clearWriteError() { setWriteError(0); } 46 | 47 | virtual size_t write(uint8_t) = 0; 48 | size_t write(const char *str) { 49 | if (str == NULL) return 0; 50 | return write((const uint8_t *)str, strlen(str)); 51 | } 52 | virtual size_t write(const uint8_t *buffer, size_t size); 53 | size_t write(const char *buffer, size_t size) { 54 | return write((const uint8_t *)buffer, size); 55 | } 56 | 57 | // default to zero, meaning "a single write may block" 58 | // should be overridden by subclasses with buffering 59 | virtual int availableForWrite() { return 0; } 60 | 61 | size_t print(const __FlashStringHelper *); 62 | size_t print(const String &); 63 | size_t print(const char[]); 64 | size_t print(char); 65 | size_t print(unsigned char, int = DEC); 66 | size_t print(int, int = DEC); 67 | size_t print(unsigned int, int = DEC); 68 | size_t print(long, int = DEC); 69 | size_t print(unsigned long, int = DEC); 70 | size_t print(long long, int = DEC); 71 | size_t print(unsigned long long, int = DEC); 72 | size_t print(double, int = 2); 73 | size_t print(const Printable&); 74 | 75 | size_t println(const __FlashStringHelper *); 76 | size_t println(const String &s); 77 | size_t println(const char[]); 78 | size_t println(char); 79 | size_t println(unsigned char, int = DEC); 80 | size_t println(int, int = DEC); 81 | size_t println(unsigned int, int = DEC); 82 | size_t println(long, int = DEC); 83 | size_t println(unsigned long, int = DEC); 84 | size_t println(long long, int = DEC); 85 | size_t println(unsigned long long, int = DEC); 86 | size_t println(double, int = 2); 87 | size_t println(const Printable&); 88 | size_t println(void); 89 | 90 | size_t printf(const char * format, ...); 91 | 92 | size_t printBuffer(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 93 | size_t printBuffer(char const buffer[], int size, char delim=' ', int byteline = 0) 94 | { 95 | return printBuffer((uint8_t const*) buffer, size, delim, byteline); 96 | } 97 | 98 | size_t printBufferReverse(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 99 | size_t printBufferReverse(char const buffer[], int size, char delim=' ', int byteline = 0) 100 | { 101 | return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); 102 | } 103 | 104 | virtual void flush() { /* Empty implementation for backward compatibility */ } 105 | }; 106 | 107 | 108 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/samd/1.6.3/cores/arduino/Print.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino LLC. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include // for size_t 23 | 24 | #include "WString.h" 25 | #include "Printable.h" 26 | 27 | #define DEC 10 28 | #define HEX 16 29 | #define OCT 8 30 | #define BIN 2 31 | 32 | class Print 33 | { 34 | private: 35 | int write_error; 36 | size_t printNumber(unsigned long, uint8_t); 37 | size_t printULLNumber(unsigned long long, uint8_t); 38 | size_t printFloat(double, int); 39 | protected: 40 | void setWriteError(int err = 1) { write_error = err; } 41 | public: 42 | Print() : write_error(0) {} 43 | 44 | int getWriteError() { return write_error; } 45 | void clearWriteError() { setWriteError(0); } 46 | 47 | virtual size_t write(uint8_t) = 0; 48 | size_t write(const char *str) { 49 | if (str == NULL) return 0; 50 | return write((const uint8_t *)str, strlen(str)); 51 | } 52 | virtual size_t write(const uint8_t *buffer, size_t size); 53 | size_t write(const char *buffer, size_t size) { 54 | return write((const uint8_t *)buffer, size); 55 | } 56 | 57 | // default to zero, meaning "a single write may block" 58 | // should be overridden by subclasses with buffering 59 | virtual int availableForWrite() { return 0; } 60 | 61 | size_t print(const __FlashStringHelper *); 62 | size_t print(const String &); 63 | size_t print(const char[]); 64 | size_t print(char); 65 | size_t print(unsigned char, int = DEC); 66 | size_t print(int, int = DEC); 67 | size_t print(unsigned int, int = DEC); 68 | size_t print(long, int = DEC); 69 | size_t print(unsigned long, int = DEC); 70 | size_t print(long long, int = DEC); 71 | size_t print(unsigned long long, int = DEC); 72 | size_t print(double, int = 2); 73 | size_t print(const Printable&); 74 | 75 | size_t println(const __FlashStringHelper *); 76 | size_t println(const String &s); 77 | size_t println(const char[]); 78 | size_t println(char); 79 | size_t println(unsigned char, int = DEC); 80 | size_t println(int, int = DEC); 81 | size_t println(unsigned int, int = DEC); 82 | size_t println(long, int = DEC); 83 | size_t println(unsigned long, int = DEC); 84 | size_t println(long long, int = DEC); 85 | size_t println(unsigned long long, int = DEC); 86 | size_t println(double, int = 2); 87 | size_t println(const Printable&); 88 | size_t println(void); 89 | 90 | size_t printf(const char * format, ...); 91 | 92 | size_t printBuffer(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 93 | size_t printBuffer(char const buffer[], int size, char delim=' ', int byteline = 0) 94 | { 95 | return printBuffer((uint8_t const*) buffer, size, delim, byteline); 96 | } 97 | 98 | size_t printBufferReverse(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 99 | size_t printBufferReverse(char const buffer[], int size, char delim=' ', int byteline = 0) 100 | { 101 | return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); 102 | } 103 | 104 | virtual void flush() { /* Empty implementation for backward compatibility */ } 105 | }; 106 | 107 | 108 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/samd/1.6.4/cores/arduino/Print.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino LLC. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include // for size_t 23 | 24 | #include "WString.h" 25 | #include "Printable.h" 26 | 27 | #define DEC 10 28 | #define HEX 16 29 | #define OCT 8 30 | #define BIN 2 31 | 32 | class Print 33 | { 34 | private: 35 | int write_error; 36 | size_t printNumber(unsigned long, uint8_t); 37 | size_t printULLNumber(unsigned long long, uint8_t); 38 | size_t printFloat(double, int); 39 | protected: 40 | void setWriteError(int err = 1) { write_error = err; } 41 | public: 42 | Print() : write_error(0) {} 43 | 44 | int getWriteError() { return write_error; } 45 | void clearWriteError() { setWriteError(0); } 46 | 47 | virtual size_t write(uint8_t) = 0; 48 | size_t write(const char *str) { 49 | if (str == NULL) return 0; 50 | return write((const uint8_t *)str, strlen(str)); 51 | } 52 | virtual size_t write(const uint8_t *buffer, size_t size); 53 | size_t write(const char *buffer, size_t size) { 54 | return write((const uint8_t *)buffer, size); 55 | } 56 | 57 | // default to zero, meaning "a single write may block" 58 | // should be overridden by subclasses with buffering 59 | virtual int availableForWrite() { return 0; } 60 | 61 | size_t print(const __FlashStringHelper *); 62 | size_t print(const String &); 63 | size_t print(const char[]); 64 | size_t print(char); 65 | size_t print(unsigned char, int = DEC); 66 | size_t print(int, int = DEC); 67 | size_t print(unsigned int, int = DEC); 68 | size_t print(long, int = DEC); 69 | size_t print(unsigned long, int = DEC); 70 | size_t print(long long, int = DEC); 71 | size_t print(unsigned long long, int = DEC); 72 | size_t print(double, int = 2); 73 | size_t print(const Printable&); 74 | 75 | size_t println(const __FlashStringHelper *); 76 | size_t println(const String &s); 77 | size_t println(const char[]); 78 | size_t println(char); 79 | size_t println(unsigned char, int = DEC); 80 | size_t println(int, int = DEC); 81 | size_t println(unsigned int, int = DEC); 82 | size_t println(long, int = DEC); 83 | size_t println(unsigned long, int = DEC); 84 | size_t println(long long, int = DEC); 85 | size_t println(unsigned long long, int = DEC); 86 | size_t println(double, int = 2); 87 | size_t println(const Printable&); 88 | size_t println(void); 89 | 90 | size_t printf(const char * format, ...); 91 | 92 | size_t printBuffer(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 93 | size_t printBuffer(char const buffer[], int size, char delim=' ', int byteline = 0) 94 | { 95 | return printBuffer((uint8_t const*) buffer, size, delim, byteline); 96 | } 97 | 98 | size_t printBufferReverse(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 99 | size_t printBufferReverse(char const buffer[], int size, char delim=' ', int byteline = 0) 100 | { 101 | return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); 102 | } 103 | 104 | virtual void flush() { /* Empty implementation for backward compatibility */ } 105 | }; 106 | 107 | 108 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/samd/1.6.5/cores/arduino/Print.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino LLC. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include // for size_t 23 | 24 | #include "WString.h" 25 | #include "Printable.h" 26 | 27 | #define DEC 10 28 | #define HEX 16 29 | #define OCT 8 30 | #define BIN 2 31 | 32 | class Print 33 | { 34 | private: 35 | int write_error; 36 | size_t printNumber(unsigned long, uint8_t); 37 | size_t printULLNumber(unsigned long long, uint8_t); 38 | size_t printFloat(double, int); 39 | protected: 40 | void setWriteError(int err = 1) { write_error = err; } 41 | public: 42 | Print() : write_error(0) {} 43 | 44 | int getWriteError() { return write_error; } 45 | void clearWriteError() { setWriteError(0); } 46 | 47 | virtual size_t write(uint8_t) = 0; 48 | size_t write(const char *str) { 49 | if (str == NULL) return 0; 50 | return write((const uint8_t *)str, strlen(str)); 51 | } 52 | virtual size_t write(const uint8_t *buffer, size_t size); 53 | size_t write(const char *buffer, size_t size) { 54 | return write((const uint8_t *)buffer, size); 55 | } 56 | 57 | // default to zero, meaning "a single write may block" 58 | // should be overridden by subclasses with buffering 59 | virtual int availableForWrite() { return 0; } 60 | 61 | size_t print(const __FlashStringHelper *); 62 | size_t print(const String &); 63 | size_t print(const char[]); 64 | size_t print(char); 65 | size_t print(unsigned char, int = DEC); 66 | size_t print(int, int = DEC); 67 | size_t print(unsigned int, int = DEC); 68 | size_t print(long, int = DEC); 69 | size_t print(unsigned long, int = DEC); 70 | size_t print(long long, int = DEC); 71 | size_t print(unsigned long long, int = DEC); 72 | size_t print(double, int = 2); 73 | size_t print(const Printable&); 74 | 75 | size_t println(const __FlashStringHelper *); 76 | size_t println(const String &s); 77 | size_t println(const char[]); 78 | size_t println(char); 79 | size_t println(unsigned char, int = DEC); 80 | size_t println(int, int = DEC); 81 | size_t println(unsigned int, int = DEC); 82 | size_t println(long, int = DEC); 83 | size_t println(unsigned long, int = DEC); 84 | size_t println(long long, int = DEC); 85 | size_t println(unsigned long long, int = DEC); 86 | size_t println(double, int = 2); 87 | size_t println(const Printable&); 88 | size_t println(void); 89 | 90 | size_t printf(const char * format, ...); 91 | 92 | size_t printBuffer(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 93 | size_t printBuffer(char const buffer[], int size, char delim=' ', int byteline = 0) 94 | { 95 | return printBuffer((uint8_t const*) buffer, size, delim, byteline); 96 | } 97 | 98 | size_t printBufferReverse(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 99 | size_t printBufferReverse(char const buffer[], int size, char delim=' ', int byteline = 0) 100 | { 101 | return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); 102 | } 103 | 104 | virtual void flush() { /* Empty implementation for backward compatibility */ } 105 | }; 106 | 107 | 108 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/samd/1.6.6/cores/arduino/Print.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino LLC. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include // for size_t 23 | 24 | #include "WString.h" 25 | #include "Printable.h" 26 | 27 | #define DEC 10 28 | #define HEX 16 29 | #define OCT 8 30 | #define BIN 2 31 | 32 | class Print 33 | { 34 | private: 35 | int write_error; 36 | size_t printNumber(unsigned long, uint8_t); 37 | size_t printULLNumber(unsigned long long, uint8_t); 38 | size_t printFloat(double, int); 39 | protected: 40 | void setWriteError(int err = 1) { write_error = err; } 41 | public: 42 | Print() : write_error(0) {} 43 | 44 | int getWriteError() { return write_error; } 45 | void clearWriteError() { setWriteError(0); } 46 | 47 | virtual size_t write(uint8_t) = 0; 48 | size_t write(const char *str) { 49 | if (str == NULL) return 0; 50 | return write((const uint8_t *)str, strlen(str)); 51 | } 52 | virtual size_t write(const uint8_t *buffer, size_t size); 53 | size_t write(const char *buffer, size_t size) { 54 | return write((const uint8_t *)buffer, size); 55 | } 56 | 57 | // default to zero, meaning "a single write may block" 58 | // should be overridden by subclasses with buffering 59 | virtual int availableForWrite() { return 0; } 60 | 61 | size_t print(const __FlashStringHelper *); 62 | size_t print(const String &); 63 | size_t print(const char[]); 64 | size_t print(char); 65 | size_t print(unsigned char, int = DEC); 66 | size_t print(int, int = DEC); 67 | size_t print(unsigned int, int = DEC); 68 | size_t print(long, int = DEC); 69 | size_t print(unsigned long, int = DEC); 70 | size_t print(long long, int = DEC); 71 | size_t print(unsigned long long, int = DEC); 72 | size_t print(double, int = 2); 73 | size_t print(const Printable&); 74 | 75 | size_t println(const __FlashStringHelper *); 76 | size_t println(const String &s); 77 | size_t println(const char[]); 78 | size_t println(char); 79 | size_t println(unsigned char, int = DEC); 80 | size_t println(int, int = DEC); 81 | size_t println(unsigned int, int = DEC); 82 | size_t println(long, int = DEC); 83 | size_t println(unsigned long, int = DEC); 84 | size_t println(long long, int = DEC); 85 | size_t println(unsigned long long, int = DEC); 86 | size_t println(double, int = 2); 87 | size_t println(const Printable&); 88 | size_t println(void); 89 | 90 | size_t printf(const char * format, ...); 91 | 92 | size_t printBuffer(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 93 | size_t printBuffer(char const buffer[], int size, char delim=' ', int byteline = 0) 94 | { 95 | return printBuffer((uint8_t const*) buffer, size, delim, byteline); 96 | } 97 | 98 | size_t printBufferReverse(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 99 | size_t printBufferReverse(char const buffer[], int size, char delim=' ', int byteline = 0) 100 | { 101 | return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); 102 | } 103 | 104 | virtual void flush() { /* Empty implementation for backward compatibility */ } 105 | }; 106 | 107 | 108 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/samd/1.6.7/cores/arduino/Print.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino LLC. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include // for size_t 23 | 24 | #include "WString.h" 25 | #include "Printable.h" 26 | 27 | #define DEC 10 28 | #define HEX 16 29 | #define OCT 8 30 | #define BIN 2 31 | 32 | class Print 33 | { 34 | private: 35 | int write_error; 36 | size_t printNumber(unsigned long, uint8_t); 37 | size_t printULLNumber(unsigned long long, uint8_t); 38 | size_t printFloat(double, int); 39 | protected: 40 | void setWriteError(int err = 1) { write_error = err; } 41 | public: 42 | Print() : write_error(0) {} 43 | 44 | int getWriteError() { return write_error; } 45 | void clearWriteError() { setWriteError(0); } 46 | 47 | virtual size_t write(uint8_t) = 0; 48 | size_t write(const char *str) { 49 | if (str == NULL) return 0; 50 | return write((const uint8_t *)str, strlen(str)); 51 | } 52 | virtual size_t write(const uint8_t *buffer, size_t size); 53 | size_t write(const char *buffer, size_t size) { 54 | return write((const uint8_t *)buffer, size); 55 | } 56 | 57 | // default to zero, meaning "a single write may block" 58 | // should be overridden by subclasses with buffering 59 | virtual int availableForWrite() { return 0; } 60 | 61 | size_t print(const __FlashStringHelper *); 62 | size_t print(const String &); 63 | size_t print(const char[]); 64 | size_t print(char); 65 | size_t print(unsigned char, int = DEC); 66 | size_t print(int, int = DEC); 67 | size_t print(unsigned int, int = DEC); 68 | size_t print(long, int = DEC); 69 | size_t print(unsigned long, int = DEC); 70 | size_t print(long long, int = DEC); 71 | size_t print(unsigned long long, int = DEC); 72 | size_t print(double, int = 2); 73 | size_t print(const Printable&); 74 | 75 | size_t println(const __FlashStringHelper *); 76 | size_t println(const String &s); 77 | size_t println(const char[]); 78 | size_t println(char); 79 | size_t println(unsigned char, int = DEC); 80 | size_t println(int, int = DEC); 81 | size_t println(unsigned int, int = DEC); 82 | size_t println(long, int = DEC); 83 | size_t println(unsigned long, int = DEC); 84 | size_t println(long long, int = DEC); 85 | size_t println(unsigned long long, int = DEC); 86 | size_t println(double, int = 2); 87 | size_t println(const Printable&); 88 | size_t println(void); 89 | 90 | size_t printf(const char * format, ...); 91 | 92 | size_t printBuffer(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 93 | size_t printBuffer(char const buffer[], int size, char delim=' ', int byteline = 0) 94 | { 95 | return printBuffer((uint8_t const*) buffer, size, delim, byteline); 96 | } 97 | 98 | size_t printBufferReverse(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 99 | size_t printBufferReverse(char const buffer[], int size, char delim=' ', int byteline = 0) 100 | { 101 | return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); 102 | } 103 | 104 | virtual void flush() { /* Empty implementation for backward compatibility */ } 105 | }; 106 | 107 | 108 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/samd/1.6.8/cores/arduino/Print.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino LLC. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include // for size_t 23 | 24 | #include "WString.h" 25 | #include "Printable.h" 26 | 27 | #define DEC 10 28 | #define HEX 16 29 | #define OCT 8 30 | #define BIN 2 31 | 32 | class Print 33 | { 34 | private: 35 | int write_error; 36 | size_t printNumber(unsigned long, uint8_t); 37 | size_t printULLNumber(unsigned long long, uint8_t); 38 | size_t printFloat(double, int); 39 | protected: 40 | void setWriteError(int err = 1) { write_error = err; } 41 | public: 42 | Print() : write_error(0) {} 43 | 44 | int getWriteError() { return write_error; } 45 | void clearWriteError() { setWriteError(0); } 46 | 47 | virtual size_t write(uint8_t) = 0; 48 | size_t write(const char *str) { 49 | if (str == NULL) return 0; 50 | return write((const uint8_t *)str, strlen(str)); 51 | } 52 | virtual size_t write(const uint8_t *buffer, size_t size); 53 | size_t write(const char *buffer, size_t size) { 54 | return write((const uint8_t *)buffer, size); 55 | } 56 | 57 | // default to zero, meaning "a single write may block" 58 | // should be overridden by subclasses with buffering 59 | virtual int availableForWrite() { return 0; } 60 | 61 | size_t print(const __FlashStringHelper *); 62 | size_t print(const String &); 63 | size_t print(const char[]); 64 | size_t print(char); 65 | size_t print(unsigned char, int = DEC); 66 | size_t print(int, int = DEC); 67 | size_t print(unsigned int, int = DEC); 68 | size_t print(long, int = DEC); 69 | size_t print(unsigned long, int = DEC); 70 | size_t print(long long, int = DEC); 71 | size_t print(unsigned long long, int = DEC); 72 | size_t print(double, int = 2); 73 | size_t print(const Printable&); 74 | 75 | size_t println(const __FlashStringHelper *); 76 | size_t println(const String &s); 77 | size_t println(const char[]); 78 | size_t println(char); 79 | size_t println(unsigned char, int = DEC); 80 | size_t println(int, int = DEC); 81 | size_t println(unsigned int, int = DEC); 82 | size_t println(long, int = DEC); 83 | size_t println(unsigned long, int = DEC); 84 | size_t println(long long, int = DEC); 85 | size_t println(unsigned long long, int = DEC); 86 | size_t println(double, int = 2); 87 | size_t println(const Printable&); 88 | size_t println(void); 89 | 90 | size_t printf(const char * format, ...); 91 | 92 | size_t printBuffer(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 93 | size_t printBuffer(char const buffer[], int size, char delim=' ', int byteline = 0) 94 | { 95 | return printBuffer((uint8_t const*) buffer, size, delim, byteline); 96 | } 97 | 98 | size_t printBufferReverse(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 99 | size_t printBufferReverse(char const buffer[], int size, char delim=' ', int byteline = 0) 100 | { 101 | return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); 102 | } 103 | 104 | virtual void flush() { /* Empty implementation for backward compatibility */ } 105 | }; 106 | 107 | 108 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/samd/1.7.0/cores/arduino/Print.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino LLC. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include // for size_t 23 | 24 | #include "WString.h" 25 | #include "Printable.h" 26 | 27 | #define DEC 10 28 | #define HEX 16 29 | #define OCT 8 30 | #define BIN 2 31 | 32 | class Print 33 | { 34 | private: 35 | int write_error; 36 | size_t printNumber(unsigned long, uint8_t); 37 | size_t printULLNumber(unsigned long long, uint8_t); 38 | size_t printFloat(double, int); 39 | protected: 40 | void setWriteError(int err = 1) { write_error = err; } 41 | public: 42 | Print() : write_error(0) {} 43 | 44 | int getWriteError() { return write_error; } 45 | void clearWriteError() { setWriteError(0); } 46 | 47 | virtual size_t write(uint8_t) = 0; 48 | size_t write(const char *str) { 49 | if (str == NULL) return 0; 50 | return write((const uint8_t *)str, strlen(str)); 51 | } 52 | virtual size_t write(const uint8_t *buffer, size_t size); 53 | size_t write(const char *buffer, size_t size) { 54 | return write((const uint8_t *)buffer, size); 55 | } 56 | 57 | // default to zero, meaning "a single write may block" 58 | // should be overridden by subclasses with buffering 59 | virtual int availableForWrite() { return 0; } 60 | 61 | size_t print(const __FlashStringHelper *); 62 | size_t print(const String &); 63 | size_t print(const char[]); 64 | size_t print(char); 65 | size_t print(unsigned char, int = DEC); 66 | size_t print(int, int = DEC); 67 | size_t print(unsigned int, int = DEC); 68 | size_t print(long, int = DEC); 69 | size_t print(unsigned long, int = DEC); 70 | size_t print(long long, int = DEC); 71 | size_t print(unsigned long long, int = DEC); 72 | size_t print(double, int = 2); 73 | size_t print(const Printable&); 74 | 75 | size_t println(const __FlashStringHelper *); 76 | size_t println(const String &s); 77 | size_t println(const char[]); 78 | size_t println(char); 79 | size_t println(unsigned char, int = DEC); 80 | size_t println(int, int = DEC); 81 | size_t println(unsigned int, int = DEC); 82 | size_t println(long, int = DEC); 83 | size_t println(unsigned long, int = DEC); 84 | size_t println(long long, int = DEC); 85 | size_t println(unsigned long long, int = DEC); 86 | size_t println(double, int = 2); 87 | size_t println(const Printable&); 88 | size_t println(void); 89 | 90 | size_t printf(const char * format, ...); 91 | 92 | size_t printBuffer(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 93 | size_t printBuffer(char const buffer[], int size, char delim=' ', int byteline = 0) 94 | { 95 | return printBuffer((uint8_t const*) buffer, size, delim, byteline); 96 | } 97 | 98 | size_t printBufferReverse(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 99 | size_t printBufferReverse(char const buffer[], int size, char delim=' ', int byteline = 0) 100 | { 101 | return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); 102 | } 103 | 104 | virtual void flush() { /* Empty implementation for backward compatibility */ } 105 | }; 106 | 107 | 108 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/samd/1.7.1/cores/arduino/Print.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino LLC. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include // for size_t 23 | 24 | #include "WString.h" 25 | #include "Printable.h" 26 | 27 | #define DEC 10 28 | #define HEX 16 29 | #define OCT 8 30 | #define BIN 2 31 | 32 | class Print 33 | { 34 | private: 35 | int write_error; 36 | size_t printNumber(unsigned long, uint8_t); 37 | size_t printULLNumber(unsigned long long, uint8_t); 38 | size_t printFloat(double, int); 39 | protected: 40 | void setWriteError(int err = 1) { write_error = err; } 41 | public: 42 | Print() : write_error(0) {} 43 | 44 | int getWriteError() { return write_error; } 45 | void clearWriteError() { setWriteError(0); } 46 | 47 | virtual size_t write(uint8_t) = 0; 48 | size_t write(const char *str) { 49 | if (str == NULL) return 0; 50 | return write((const uint8_t *)str, strlen(str)); 51 | } 52 | virtual size_t write(const uint8_t *buffer, size_t size); 53 | size_t write(const char *buffer, size_t size) { 54 | return write((const uint8_t *)buffer, size); 55 | } 56 | 57 | // default to zero, meaning "a single write may block" 58 | // should be overridden by subclasses with buffering 59 | virtual int availableForWrite() { return 0; } 60 | 61 | size_t print(const __FlashStringHelper *); 62 | size_t print(const String &); 63 | size_t print(const char[]); 64 | size_t print(char); 65 | size_t print(unsigned char, int = DEC); 66 | size_t print(int, int = DEC); 67 | size_t print(unsigned int, int = DEC); 68 | size_t print(long, int = DEC); 69 | size_t print(unsigned long, int = DEC); 70 | size_t print(long long, int = DEC); 71 | size_t print(unsigned long long, int = DEC); 72 | size_t print(double, int = 2); 73 | size_t print(const Printable&); 74 | 75 | size_t println(const __FlashStringHelper *); 76 | size_t println(const String &s); 77 | size_t println(const char[]); 78 | size_t println(char); 79 | size_t println(unsigned char, int = DEC); 80 | size_t println(int, int = DEC); 81 | size_t println(unsigned int, int = DEC); 82 | size_t println(long, int = DEC); 83 | size_t println(unsigned long, int = DEC); 84 | size_t println(long long, int = DEC); 85 | size_t println(unsigned long long, int = DEC); 86 | size_t println(double, int = 2); 87 | size_t println(const Printable&); 88 | size_t println(void); 89 | 90 | size_t printf(const char * format, ...); 91 | 92 | size_t printBuffer(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 93 | size_t printBuffer(char const buffer[], int size, char delim=' ', int byteline = 0) 94 | { 95 | return printBuffer((uint8_t const*) buffer, size, delim, byteline); 96 | } 97 | 98 | size_t printBufferReverse(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 99 | size_t printBufferReverse(char const buffer[], int size, char delim=' ', int byteline = 0) 100 | { 101 | return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); 102 | } 103 | 104 | virtual void flush() { /* Empty implementation for backward compatibility */ } 105 | }; 106 | 107 | 108 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/samd/1.7.10/cores/arduino/Print.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino LLC. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include // for size_t 23 | 24 | #include "WString.h" 25 | #include "Printable.h" 26 | 27 | #define DEC 10 28 | #define HEX 16 29 | #define OCT 8 30 | #define BIN 2 31 | 32 | class Print 33 | { 34 | private: 35 | int write_error; 36 | size_t printNumber(unsigned long, uint8_t); 37 | size_t printULLNumber(unsigned long long, uint8_t); 38 | size_t printFloat(double, int); 39 | protected: 40 | void setWriteError(int err = 1) 41 | { 42 | write_error = err; 43 | } 44 | public: 45 | Print() : write_error(0) {} 46 | 47 | int getWriteError() 48 | { 49 | return write_error; 50 | } 51 | void clearWriteError() 52 | { 53 | setWriteError(0); 54 | } 55 | 56 | virtual size_t write(uint8_t) = 0; 57 | size_t write(const char *str) 58 | { 59 | if (str == NULL) 60 | return 0; 61 | 62 | return write((const uint8_t *)str, strlen(str)); 63 | } 64 | virtual size_t write(const uint8_t *buffer, size_t size); 65 | size_t write(const char *buffer, size_t size) 66 | { 67 | return write((const uint8_t *)buffer, size); 68 | } 69 | 70 | // default to zero, meaning "a single write may block" 71 | // should be overridden by subclasses with buffering 72 | virtual int availableForWrite() 73 | { 74 | return 0; 75 | } 76 | 77 | size_t print(const __FlashStringHelper *); 78 | size_t print(const String &); 79 | size_t print(const char[]); 80 | size_t print(char); 81 | size_t print(unsigned char, int = DEC); 82 | size_t print(int, int = DEC); 83 | size_t print(unsigned int, int = DEC); 84 | size_t print(long, int = DEC); 85 | size_t print(unsigned long, int = DEC); 86 | size_t print(long long, int = DEC); 87 | size_t print(unsigned long long, int = DEC); 88 | size_t print(double, int = 2); 89 | size_t print(const Printable&); 90 | 91 | size_t println(const __FlashStringHelper *); 92 | size_t println(const String &s); 93 | size_t println(const char[]); 94 | size_t println(char); 95 | size_t println(unsigned char, int = DEC); 96 | size_t println(int, int = DEC); 97 | size_t println(unsigned int, int = DEC); 98 | size_t println(long, int = DEC); 99 | size_t println(unsigned long, int = DEC); 100 | size_t println(long long, int = DEC); 101 | size_t println(unsigned long long, int = DEC); 102 | size_t println(double, int = 2); 103 | size_t println(const Printable&); 104 | size_t println(void); 105 | 106 | size_t printf(const char * format, ...); 107 | 108 | size_t printBuffer(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); 109 | size_t printBuffer(char const buffer[], int size, char delim = ' ', int byteline = 0) 110 | { 111 | return printBuffer((uint8_t const*) buffer, size, delim, byteline); 112 | } 113 | 114 | size_t printBufferReverse(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); 115 | size_t printBufferReverse(char const buffer[], int size, char delim = ' ', int byteline = 0) 116 | { 117 | return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); 118 | } 119 | 120 | virtual void flush() { /* Empty implementation for backward compatibility */ } 121 | }; 122 | 123 | 124 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/samd/1.7.11/cores/arduino/Print.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino LLC. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include // for size_t 23 | 24 | #include "WString.h" 25 | #include "Printable.h" 26 | 27 | #define DEC 10 28 | #define HEX 16 29 | #define OCT 8 30 | #define BIN 2 31 | 32 | class Print 33 | { 34 | private: 35 | int write_error; 36 | size_t printNumber(unsigned long, uint8_t); 37 | size_t printULLNumber(unsigned long long, uint8_t); 38 | size_t printFloat(double, int); 39 | protected: 40 | void setWriteError(int err = 1) 41 | { 42 | write_error = err; 43 | } 44 | public: 45 | Print() : write_error(0) {} 46 | 47 | int getWriteError() 48 | { 49 | return write_error; 50 | } 51 | void clearWriteError() 52 | { 53 | setWriteError(0); 54 | } 55 | 56 | virtual size_t write(uint8_t) = 0; 57 | size_t write(const char *str) 58 | { 59 | if (str == NULL) 60 | return 0; 61 | 62 | return write((const uint8_t *)str, strlen(str)); 63 | } 64 | virtual size_t write(const uint8_t *buffer, size_t size); 65 | size_t write(const char *buffer, size_t size) 66 | { 67 | return write((const uint8_t *)buffer, size); 68 | } 69 | 70 | // default to zero, meaning "a single write may block" 71 | // should be overridden by subclasses with buffering 72 | virtual int availableForWrite() 73 | { 74 | return 0; 75 | } 76 | 77 | size_t print(const __FlashStringHelper *); 78 | size_t print(const String &); 79 | size_t print(const char[]); 80 | size_t print(char); 81 | size_t print(unsigned char, int = DEC); 82 | size_t print(int, int = DEC); 83 | size_t print(unsigned int, int = DEC); 84 | size_t print(long, int = DEC); 85 | size_t print(unsigned long, int = DEC); 86 | size_t print(long long, int = DEC); 87 | size_t print(unsigned long long, int = DEC); 88 | size_t print(double, int = 2); 89 | size_t print(const Printable&); 90 | 91 | size_t println(const __FlashStringHelper *); 92 | size_t println(const String &s); 93 | size_t println(const char[]); 94 | size_t println(char); 95 | size_t println(unsigned char, int = DEC); 96 | size_t println(int, int = DEC); 97 | size_t println(unsigned int, int = DEC); 98 | size_t println(long, int = DEC); 99 | size_t println(unsigned long, int = DEC); 100 | size_t println(long long, int = DEC); 101 | size_t println(unsigned long long, int = DEC); 102 | size_t println(double, int = 2); 103 | size_t println(const Printable&); 104 | size_t println(void); 105 | 106 | size_t printf(const char * format, ...); 107 | 108 | size_t printBuffer(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); 109 | size_t printBuffer(char const buffer[], int size, char delim = ' ', int byteline = 0) 110 | { 111 | return printBuffer((uint8_t const*) buffer, size, delim, byteline); 112 | } 113 | 114 | size_t printBufferReverse(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); 115 | size_t printBufferReverse(char const buffer[], int size, char delim = ' ', int byteline = 0) 116 | { 117 | return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); 118 | } 119 | 120 | virtual void flush() { /* Empty implementation for backward compatibility */ } 121 | }; 122 | 123 | 124 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/samd/1.7.2/cores/arduino/Print.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino LLC. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include // for size_t 23 | 24 | #include "WString.h" 25 | #include "Printable.h" 26 | 27 | #define DEC 10 28 | #define HEX 16 29 | #define OCT 8 30 | #define BIN 2 31 | 32 | class Print 33 | { 34 | private: 35 | int write_error; 36 | size_t printNumber(unsigned long, uint8_t); 37 | size_t printULLNumber(unsigned long long, uint8_t); 38 | size_t printFloat(double, int); 39 | protected: 40 | void setWriteError(int err = 1) { write_error = err; } 41 | public: 42 | Print() : write_error(0) {} 43 | 44 | int getWriteError() { return write_error; } 45 | void clearWriteError() { setWriteError(0); } 46 | 47 | virtual size_t write(uint8_t) = 0; 48 | size_t write(const char *str) { 49 | if (str == NULL) return 0; 50 | return write((const uint8_t *)str, strlen(str)); 51 | } 52 | virtual size_t write(const uint8_t *buffer, size_t size); 53 | size_t write(const char *buffer, size_t size) { 54 | return write((const uint8_t *)buffer, size); 55 | } 56 | 57 | // default to zero, meaning "a single write may block" 58 | // should be overridden by subclasses with buffering 59 | virtual int availableForWrite() { return 0; } 60 | 61 | size_t print(const __FlashStringHelper *); 62 | size_t print(const String &); 63 | size_t print(const char[]); 64 | size_t print(char); 65 | size_t print(unsigned char, int = DEC); 66 | size_t print(int, int = DEC); 67 | size_t print(unsigned int, int = DEC); 68 | size_t print(long, int = DEC); 69 | size_t print(unsigned long, int = DEC); 70 | size_t print(long long, int = DEC); 71 | size_t print(unsigned long long, int = DEC); 72 | size_t print(double, int = 2); 73 | size_t print(const Printable&); 74 | 75 | size_t println(const __FlashStringHelper *); 76 | size_t println(const String &s); 77 | size_t println(const char[]); 78 | size_t println(char); 79 | size_t println(unsigned char, int = DEC); 80 | size_t println(int, int = DEC); 81 | size_t println(unsigned int, int = DEC); 82 | size_t println(long, int = DEC); 83 | size_t println(unsigned long, int = DEC); 84 | size_t println(long long, int = DEC); 85 | size_t println(unsigned long long, int = DEC); 86 | size_t println(double, int = 2); 87 | size_t println(const Printable&); 88 | size_t println(void); 89 | 90 | size_t printf(const char * format, ...); 91 | 92 | size_t printBuffer(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 93 | size_t printBuffer(char const buffer[], int size, char delim=' ', int byteline = 0) 94 | { 95 | return printBuffer((uint8_t const*) buffer, size, delim, byteline); 96 | } 97 | 98 | size_t printBufferReverse(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 99 | size_t printBufferReverse(char const buffer[], int size, char delim=' ', int byteline = 0) 100 | { 101 | return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); 102 | } 103 | 104 | virtual void flush() { /* Empty implementation for backward compatibility */ } 105 | }; 106 | 107 | 108 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/samd/1.7.3/cores/arduino/Print.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino LLC. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include // for size_t 23 | 24 | #include "WString.h" 25 | #include "Printable.h" 26 | 27 | #define DEC 10 28 | #define HEX 16 29 | #define OCT 8 30 | #define BIN 2 31 | 32 | class Print 33 | { 34 | private: 35 | int write_error; 36 | size_t printNumber(unsigned long, uint8_t); 37 | size_t printULLNumber(unsigned long long, uint8_t); 38 | size_t printFloat(double, int); 39 | protected: 40 | void setWriteError(int err = 1) { write_error = err; } 41 | public: 42 | Print() : write_error(0) {} 43 | 44 | int getWriteError() { return write_error; } 45 | void clearWriteError() { setWriteError(0); } 46 | 47 | virtual size_t write(uint8_t) = 0; 48 | size_t write(const char *str) { 49 | if (str == NULL) return 0; 50 | return write((const uint8_t *)str, strlen(str)); 51 | } 52 | virtual size_t write(const uint8_t *buffer, size_t size); 53 | size_t write(const char *buffer, size_t size) { 54 | return write((const uint8_t *)buffer, size); 55 | } 56 | 57 | // default to zero, meaning "a single write may block" 58 | // should be overridden by subclasses with buffering 59 | virtual int availableForWrite() { return 0; } 60 | 61 | size_t print(const __FlashStringHelper *); 62 | size_t print(const String &); 63 | size_t print(const char[]); 64 | size_t print(char); 65 | size_t print(unsigned char, int = DEC); 66 | size_t print(int, int = DEC); 67 | size_t print(unsigned int, int = DEC); 68 | size_t print(long, int = DEC); 69 | size_t print(unsigned long, int = DEC); 70 | size_t print(long long, int = DEC); 71 | size_t print(unsigned long long, int = DEC); 72 | size_t print(double, int = 2); 73 | size_t print(const Printable&); 74 | 75 | size_t println(const __FlashStringHelper *); 76 | size_t println(const String &s); 77 | size_t println(const char[]); 78 | size_t println(char); 79 | size_t println(unsigned char, int = DEC); 80 | size_t println(int, int = DEC); 81 | size_t println(unsigned int, int = DEC); 82 | size_t println(long, int = DEC); 83 | size_t println(unsigned long, int = DEC); 84 | size_t println(long long, int = DEC); 85 | size_t println(unsigned long long, int = DEC); 86 | size_t println(double, int = 2); 87 | size_t println(const Printable&); 88 | size_t println(void); 89 | 90 | size_t printf(const char * format, ...); 91 | 92 | size_t printBuffer(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 93 | size_t printBuffer(char const buffer[], int size, char delim=' ', int byteline = 0) 94 | { 95 | return printBuffer((uint8_t const*) buffer, size, delim, byteline); 96 | } 97 | 98 | size_t printBufferReverse(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 99 | size_t printBufferReverse(char const buffer[], int size, char delim=' ', int byteline = 0) 100 | { 101 | return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); 102 | } 103 | 104 | virtual void flush() { /* Empty implementation for backward compatibility */ } 105 | }; 106 | 107 | 108 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/samd/1.7.4/cores/arduino/Print.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino LLC. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include // for size_t 23 | 24 | #include "WString.h" 25 | #include "Printable.h" 26 | 27 | #define DEC 10 28 | #define HEX 16 29 | #define OCT 8 30 | #define BIN 2 31 | 32 | class Print 33 | { 34 | private: 35 | int write_error; 36 | size_t printNumber(unsigned long, uint8_t); 37 | size_t printULLNumber(unsigned long long, uint8_t); 38 | size_t printFloat(double, int); 39 | protected: 40 | void setWriteError(int err = 1) { write_error = err; } 41 | public: 42 | Print() : write_error(0) {} 43 | 44 | int getWriteError() { return write_error; } 45 | void clearWriteError() { setWriteError(0); } 46 | 47 | virtual size_t write(uint8_t) = 0; 48 | size_t write(const char *str) { 49 | if (str == NULL) return 0; 50 | return write((const uint8_t *)str, strlen(str)); 51 | } 52 | virtual size_t write(const uint8_t *buffer, size_t size); 53 | size_t write(const char *buffer, size_t size) { 54 | return write((const uint8_t *)buffer, size); 55 | } 56 | 57 | // default to zero, meaning "a single write may block" 58 | // should be overridden by subclasses with buffering 59 | virtual int availableForWrite() { return 0; } 60 | 61 | size_t print(const __FlashStringHelper *); 62 | size_t print(const String &); 63 | size_t print(const char[]); 64 | size_t print(char); 65 | size_t print(unsigned char, int = DEC); 66 | size_t print(int, int = DEC); 67 | size_t print(unsigned int, int = DEC); 68 | size_t print(long, int = DEC); 69 | size_t print(unsigned long, int = DEC); 70 | size_t print(long long, int = DEC); 71 | size_t print(unsigned long long, int = DEC); 72 | size_t print(double, int = 2); 73 | size_t print(const Printable&); 74 | 75 | size_t println(const __FlashStringHelper *); 76 | size_t println(const String &s); 77 | size_t println(const char[]); 78 | size_t println(char); 79 | size_t println(unsigned char, int = DEC); 80 | size_t println(int, int = DEC); 81 | size_t println(unsigned int, int = DEC); 82 | size_t println(long, int = DEC); 83 | size_t println(unsigned long, int = DEC); 84 | size_t println(long long, int = DEC); 85 | size_t println(unsigned long long, int = DEC); 86 | size_t println(double, int = 2); 87 | size_t println(const Printable&); 88 | size_t println(void); 89 | 90 | size_t printf(const char * format, ...); 91 | 92 | size_t printBuffer(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 93 | size_t printBuffer(char const buffer[], int size, char delim=' ', int byteline = 0) 94 | { 95 | return printBuffer((uint8_t const*) buffer, size, delim, byteline); 96 | } 97 | 98 | size_t printBufferReverse(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 99 | size_t printBufferReverse(char const buffer[], int size, char delim=' ', int byteline = 0) 100 | { 101 | return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); 102 | } 103 | 104 | virtual void flush() { /* Empty implementation for backward compatibility */ } 105 | }; 106 | 107 | 108 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/samd/1.7.5/cores/arduino/Print.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino LLC. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include // for size_t 23 | 24 | #include "WString.h" 25 | #include "Printable.h" 26 | 27 | #define DEC 10 28 | #define HEX 16 29 | #define OCT 8 30 | #define BIN 2 31 | 32 | class Print 33 | { 34 | private: 35 | int write_error; 36 | size_t printNumber(unsigned long, uint8_t); 37 | size_t printULLNumber(unsigned long long, uint8_t); 38 | size_t printFloat(double, int); 39 | protected: 40 | void setWriteError(int err = 1) { write_error = err; } 41 | public: 42 | Print() : write_error(0) {} 43 | 44 | int getWriteError() { return write_error; } 45 | void clearWriteError() { setWriteError(0); } 46 | 47 | virtual size_t write(uint8_t) = 0; 48 | size_t write(const char *str) { 49 | if (str == NULL) return 0; 50 | return write((const uint8_t *)str, strlen(str)); 51 | } 52 | virtual size_t write(const uint8_t *buffer, size_t size); 53 | size_t write(const char *buffer, size_t size) { 54 | return write((const uint8_t *)buffer, size); 55 | } 56 | 57 | // default to zero, meaning "a single write may block" 58 | // should be overridden by subclasses with buffering 59 | virtual int availableForWrite() { return 0; } 60 | 61 | size_t print(const __FlashStringHelper *); 62 | size_t print(const String &); 63 | size_t print(const char[]); 64 | size_t print(char); 65 | size_t print(unsigned char, int = DEC); 66 | size_t print(int, int = DEC); 67 | size_t print(unsigned int, int = DEC); 68 | size_t print(long, int = DEC); 69 | size_t print(unsigned long, int = DEC); 70 | size_t print(long long, int = DEC); 71 | size_t print(unsigned long long, int = DEC); 72 | size_t print(double, int = 2); 73 | size_t print(const Printable&); 74 | 75 | size_t println(const __FlashStringHelper *); 76 | size_t println(const String &s); 77 | size_t println(const char[]); 78 | size_t println(char); 79 | size_t println(unsigned char, int = DEC); 80 | size_t println(int, int = DEC); 81 | size_t println(unsigned int, int = DEC); 82 | size_t println(long, int = DEC); 83 | size_t println(unsigned long, int = DEC); 84 | size_t println(long long, int = DEC); 85 | size_t println(unsigned long long, int = DEC); 86 | size_t println(double, int = 2); 87 | size_t println(const Printable&); 88 | size_t println(void); 89 | 90 | size_t printf(const char * format, ...); 91 | 92 | size_t printBuffer(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 93 | size_t printBuffer(char const buffer[], int size, char delim=' ', int byteline = 0) 94 | { 95 | return printBuffer((uint8_t const*) buffer, size, delim, byteline); 96 | } 97 | 98 | size_t printBufferReverse(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 99 | size_t printBufferReverse(char const buffer[], int size, char delim=' ', int byteline = 0) 100 | { 101 | return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); 102 | } 103 | 104 | virtual void flush() { /* Empty implementation for backward compatibility */ } 105 | }; 106 | 107 | 108 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/samd/1.7.6/cores/arduino/Print.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino LLC. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include // for size_t 23 | 24 | #include "WString.h" 25 | #include "Printable.h" 26 | 27 | #define DEC 10 28 | #define HEX 16 29 | #define OCT 8 30 | #define BIN 2 31 | 32 | class Print 33 | { 34 | private: 35 | int write_error; 36 | size_t printNumber(unsigned long, uint8_t); 37 | size_t printULLNumber(unsigned long long, uint8_t); 38 | size_t printFloat(double, int); 39 | protected: 40 | void setWriteError(int err = 1) { write_error = err; } 41 | public: 42 | Print() : write_error(0) {} 43 | 44 | int getWriteError() { return write_error; } 45 | void clearWriteError() { setWriteError(0); } 46 | 47 | virtual size_t write(uint8_t) = 0; 48 | size_t write(const char *str) { 49 | if (str == NULL) return 0; 50 | return write((const uint8_t *)str, strlen(str)); 51 | } 52 | virtual size_t write(const uint8_t *buffer, size_t size); 53 | size_t write(const char *buffer, size_t size) { 54 | return write((const uint8_t *)buffer, size); 55 | } 56 | 57 | // default to zero, meaning "a single write may block" 58 | // should be overridden by subclasses with buffering 59 | virtual int availableForWrite() { return 0; } 60 | 61 | size_t print(const __FlashStringHelper *); 62 | size_t print(const String &); 63 | size_t print(const char[]); 64 | size_t print(char); 65 | size_t print(unsigned char, int = DEC); 66 | size_t print(int, int = DEC); 67 | size_t print(unsigned int, int = DEC); 68 | size_t print(long, int = DEC); 69 | size_t print(unsigned long, int = DEC); 70 | size_t print(long long, int = DEC); 71 | size_t print(unsigned long long, int = DEC); 72 | size_t print(double, int = 2); 73 | size_t print(const Printable&); 74 | 75 | size_t println(const __FlashStringHelper *); 76 | size_t println(const String &s); 77 | size_t println(const char[]); 78 | size_t println(char); 79 | size_t println(unsigned char, int = DEC); 80 | size_t println(int, int = DEC); 81 | size_t println(unsigned int, int = DEC); 82 | size_t println(long, int = DEC); 83 | size_t println(unsigned long, int = DEC); 84 | size_t println(long long, int = DEC); 85 | size_t println(unsigned long long, int = DEC); 86 | size_t println(double, int = 2); 87 | size_t println(const Printable&); 88 | size_t println(void); 89 | 90 | size_t printf(const char * format, ...); 91 | 92 | size_t printBuffer(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 93 | size_t printBuffer(char const buffer[], int size, char delim=' ', int byteline = 0) 94 | { 95 | return printBuffer((uint8_t const*) buffer, size, delim, byteline); 96 | } 97 | 98 | size_t printBufferReverse(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 99 | size_t printBufferReverse(char const buffer[], int size, char delim=' ', int byteline = 0) 100 | { 101 | return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); 102 | } 103 | 104 | virtual void flush() { /* Empty implementation for backward compatibility */ } 105 | }; 106 | 107 | 108 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/samd/1.7.7/cores/arduino/Print.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino LLC. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include // for size_t 23 | 24 | #include "WString.h" 25 | #include "Printable.h" 26 | 27 | #define DEC 10 28 | #define HEX 16 29 | #define OCT 8 30 | #define BIN 2 31 | 32 | class Print 33 | { 34 | private: 35 | int write_error; 36 | size_t printNumber(unsigned long, uint8_t); 37 | size_t printULLNumber(unsigned long long, uint8_t); 38 | size_t printFloat(double, int); 39 | protected: 40 | void setWriteError(int err = 1) { write_error = err; } 41 | public: 42 | Print() : write_error(0) {} 43 | 44 | int getWriteError() { return write_error; } 45 | void clearWriteError() { setWriteError(0); } 46 | 47 | virtual size_t write(uint8_t) = 0; 48 | size_t write(const char *str) { 49 | if (str == NULL) return 0; 50 | return write((const uint8_t *)str, strlen(str)); 51 | } 52 | virtual size_t write(const uint8_t *buffer, size_t size); 53 | size_t write(const char *buffer, size_t size) { 54 | return write((const uint8_t *)buffer, size); 55 | } 56 | 57 | // default to zero, meaning "a single write may block" 58 | // should be overridden by subclasses with buffering 59 | virtual int availableForWrite() { return 0; } 60 | 61 | size_t print(const __FlashStringHelper *); 62 | size_t print(const String &); 63 | size_t print(const char[]); 64 | size_t print(char); 65 | size_t print(unsigned char, int = DEC); 66 | size_t print(int, int = DEC); 67 | size_t print(unsigned int, int = DEC); 68 | size_t print(long, int = DEC); 69 | size_t print(unsigned long, int = DEC); 70 | size_t print(long long, int = DEC); 71 | size_t print(unsigned long long, int = DEC); 72 | size_t print(double, int = 2); 73 | size_t print(const Printable&); 74 | 75 | size_t println(const __FlashStringHelper *); 76 | size_t println(const String &s); 77 | size_t println(const char[]); 78 | size_t println(char); 79 | size_t println(unsigned char, int = DEC); 80 | size_t println(int, int = DEC); 81 | size_t println(unsigned int, int = DEC); 82 | size_t println(long, int = DEC); 83 | size_t println(unsigned long, int = DEC); 84 | size_t println(long long, int = DEC); 85 | size_t println(unsigned long long, int = DEC); 86 | size_t println(double, int = 2); 87 | size_t println(const Printable&); 88 | size_t println(void); 89 | 90 | size_t printf(const char * format, ...); 91 | 92 | size_t printBuffer(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 93 | size_t printBuffer(char const buffer[], int size, char delim=' ', int byteline = 0) 94 | { 95 | return printBuffer((uint8_t const*) buffer, size, delim, byteline); 96 | } 97 | 98 | size_t printBufferReverse(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 99 | size_t printBufferReverse(char const buffer[], int size, char delim=' ', int byteline = 0) 100 | { 101 | return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); 102 | } 103 | 104 | virtual void flush() { /* Empty implementation for backward compatibility */ } 105 | }; 106 | 107 | 108 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/samd/1.7.8/cores/arduino/Print.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino LLC. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include // for size_t 23 | 24 | #include "WString.h" 25 | #include "Printable.h" 26 | 27 | #define DEC 10 28 | #define HEX 16 29 | #define OCT 8 30 | #define BIN 2 31 | 32 | class Print 33 | { 34 | private: 35 | int write_error; 36 | size_t printNumber(unsigned long, uint8_t); 37 | size_t printULLNumber(unsigned long long, uint8_t); 38 | size_t printFloat(double, int); 39 | protected: 40 | void setWriteError(int err = 1) { write_error = err; } 41 | public: 42 | Print() : write_error(0) {} 43 | 44 | int getWriteError() { return write_error; } 45 | void clearWriteError() { setWriteError(0); } 46 | 47 | virtual size_t write(uint8_t) = 0; 48 | size_t write(const char *str) { 49 | if (str == NULL) return 0; 50 | return write((const uint8_t *)str, strlen(str)); 51 | } 52 | virtual size_t write(const uint8_t *buffer, size_t size); 53 | size_t write(const char *buffer, size_t size) { 54 | return write((const uint8_t *)buffer, size); 55 | } 56 | 57 | // default to zero, meaning "a single write may block" 58 | // should be overridden by subclasses with buffering 59 | virtual int availableForWrite() { return 0; } 60 | 61 | size_t print(const __FlashStringHelper *); 62 | size_t print(const String &); 63 | size_t print(const char[]); 64 | size_t print(char); 65 | size_t print(unsigned char, int = DEC); 66 | size_t print(int, int = DEC); 67 | size_t print(unsigned int, int = DEC); 68 | size_t print(long, int = DEC); 69 | size_t print(unsigned long, int = DEC); 70 | size_t print(long long, int = DEC); 71 | size_t print(unsigned long long, int = DEC); 72 | size_t print(double, int = 2); 73 | size_t print(const Printable&); 74 | 75 | size_t println(const __FlashStringHelper *); 76 | size_t println(const String &s); 77 | size_t println(const char[]); 78 | size_t println(char); 79 | size_t println(unsigned char, int = DEC); 80 | size_t println(int, int = DEC); 81 | size_t println(unsigned int, int = DEC); 82 | size_t println(long, int = DEC); 83 | size_t println(unsigned long, int = DEC); 84 | size_t println(long long, int = DEC); 85 | size_t println(unsigned long long, int = DEC); 86 | size_t println(double, int = 2); 87 | size_t println(const Printable&); 88 | size_t println(void); 89 | 90 | size_t printf(const char * format, ...); 91 | 92 | size_t printBuffer(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 93 | size_t printBuffer(char const buffer[], int size, char delim=' ', int byteline = 0) 94 | { 95 | return printBuffer((uint8_t const*) buffer, size, delim, byteline); 96 | } 97 | 98 | size_t printBufferReverse(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); 99 | size_t printBufferReverse(char const buffer[], int size, char delim=' ', int byteline = 0) 100 | { 101 | return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); 102 | } 103 | 104 | virtual void flush() { /* Empty implementation for backward compatibility */ } 105 | }; 106 | 107 | 108 | -------------------------------------------------------------------------------- /Packages_Patches/adafruit/hardware/samd/1.7.9/cores/arduino/Print.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2016 Arduino LLC. All right reserved. 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Lesser General Public 6 | License as published by the Free Software Foundation; either 7 | version 2.1 of the License, or (at your option) any later version. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 | See the GNU Lesser General Public License for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public 15 | License along with this library; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17 | */ 18 | 19 | #pragma once 20 | 21 | #include 22 | #include // for size_t 23 | 24 | #include "WString.h" 25 | #include "Printable.h" 26 | 27 | #define DEC 10 28 | #define HEX 16 29 | #define OCT 8 30 | #define BIN 2 31 | 32 | class Print 33 | { 34 | private: 35 | int write_error; 36 | size_t printNumber(unsigned long, uint8_t); 37 | size_t printULLNumber(unsigned long long, uint8_t); 38 | size_t printFloat(double, int); 39 | protected: 40 | void setWriteError(int err = 1) 41 | { 42 | write_error = err; 43 | } 44 | public: 45 | Print() : write_error(0) {} 46 | 47 | int getWriteError() 48 | { 49 | return write_error; 50 | } 51 | void clearWriteError() 52 | { 53 | setWriteError(0); 54 | } 55 | 56 | virtual size_t write(uint8_t) = 0; 57 | size_t write(const char *str) 58 | { 59 | if (str == NULL) 60 | return 0; 61 | 62 | return write((const uint8_t *)str, strlen(str)); 63 | } 64 | virtual size_t write(const uint8_t *buffer, size_t size); 65 | size_t write(const char *buffer, size_t size) 66 | { 67 | return write((const uint8_t *)buffer, size); 68 | } 69 | 70 | // default to zero, meaning "a single write may block" 71 | // should be overridden by subclasses with buffering 72 | virtual int availableForWrite() 73 | { 74 | return 0; 75 | } 76 | 77 | size_t print(const __FlashStringHelper *); 78 | size_t print(const String &); 79 | size_t print(const char[]); 80 | size_t print(char); 81 | size_t print(unsigned char, int = DEC); 82 | size_t print(int, int = DEC); 83 | size_t print(unsigned int, int = DEC); 84 | size_t print(long, int = DEC); 85 | size_t print(unsigned long, int = DEC); 86 | size_t print(long long, int = DEC); 87 | size_t print(unsigned long long, int = DEC); 88 | size_t print(double, int = 2); 89 | size_t print(const Printable&); 90 | 91 | size_t println(const __FlashStringHelper *); 92 | size_t println(const String &s); 93 | size_t println(const char[]); 94 | size_t println(char); 95 | size_t println(unsigned char, int = DEC); 96 | size_t println(int, int = DEC); 97 | size_t println(unsigned int, int = DEC); 98 | size_t println(long, int = DEC); 99 | size_t println(unsigned long, int = DEC); 100 | size_t println(long long, int = DEC); 101 | size_t println(unsigned long long, int = DEC); 102 | size_t println(double, int = 2); 103 | size_t println(const Printable&); 104 | size_t println(void); 105 | 106 | size_t printf(const char * format, ...); 107 | 108 | size_t printBuffer(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); 109 | size_t printBuffer(char const buffer[], int size, char delim = ' ', int byteline = 0) 110 | { 111 | return printBuffer((uint8_t const*) buffer, size, delim, byteline); 112 | } 113 | 114 | size_t printBufferReverse(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); 115 | size_t printBufferReverse(char const buffer[], int size, char delim = ' ', int byteline = 0) 116 | { 117 | return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); 118 | } 119 | 120 | virtual void flush() { /* Empty implementation for backward compatibility */ } 121 | }; 122 | 123 | 124 | -------------------------------------------------------------------------------- /Packages_Patches/arduino/hardware/samd/1.8.6/cores/arduino/Arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Arduino.h - Main include file for the Arduino SDK 3 | Copyright (c) 2014 Arduino LLC. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library 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 GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | // KH, This is the fix according to https://github.com/arduino/ArduinoCore-samd/pull/399 21 | // to avoid notorious compiler error while uing STL (min and max macro error) 22 | // It's terrible Arduino has just released new core and still don't merge the PR 23 | 24 | #ifndef Arduino_h 25 | #define Arduino_h 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | typedef bool boolean; 34 | typedef uint8_t byte; 35 | typedef uint16_t word; 36 | 37 | // some libraries and sketches depend on this AVR stuff, 38 | // assuming Arduino.h or WProgram.h automatically includes it... 39 | // 40 | #include "avr/pgmspace.h" 41 | #include "avr/interrupt.h" 42 | #include "avr/io.h" 43 | #include "binary.h" 44 | #include "itoa.h" 45 | 46 | #ifdef __cplusplus 47 | extern "C" { 48 | #endif // __cplusplus 49 | 50 | // Include Atmel headers 51 | #include "sam.h" 52 | #include "wiring_constants.h" 53 | 54 | #define clockCyclesPerMicrosecond() ( SystemCoreClock / 1000000L ) 55 | #define clockCyclesToMicroseconds(a) ( ((a) * 1000L) / (SystemCoreClock / 1000L) ) 56 | #define microsecondsToClockCycles(a) ( (a) * (SystemCoreClock / 1000000L) ) 57 | void yield( void ) ; 58 | /* system functions */ 59 | int main( void ); 60 | void init( void ); 61 | /* sketch */ 62 | void setup( void ) ; 63 | void loop( void ) ; 64 | #include "WVariant.h" 65 | 66 | #ifdef __cplusplus 67 | } // extern "C" 68 | #endif 69 | 70 | 71 | // The following headers are for C++ only compilation 72 | #ifdef __cplusplus 73 | #include "WCharacter.h" 74 | #include "WString.h" 75 | #include "Tone.h" 76 | #include "WMath.h" 77 | #include "HardwareSerial.h" 78 | #include "pulse.h" 79 | #include 80 | #endif 81 | 82 | #include "delay.h" 83 | 84 | #ifdef __cplusplus 85 | #include "Uart.h" 86 | #endif 87 | 88 | // Include board variant 89 | #include "variant.h" 90 | #include "wiring.h" 91 | #include "wiring_digital.h" 92 | #include "wiring_analog.h" 93 | #include "wiring_shift.h" 94 | #include "WInterrupts.h" 95 | 96 | #ifndef __cplusplus 97 | // undefine stdlib's abs if encountered 98 | #ifdef abs 99 | #undef abs 100 | #endif // abs 101 | 102 | #define min(a,b) ((a)<(b)?(a):(b)) 103 | #define max(a,b) ((a)>(b)?(a):(b)) 104 | #define abs(x) ((x)>0?(x):-(x)) 105 | #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) 106 | 107 | #else 108 | //using std::min; 109 | //using std::max; 110 | template 111 | auto min(const T& a, const L& b) -> decltype((b < a) ? b : a) 112 | { 113 | return (b < a) ? b : a; 114 | } 115 | 116 | template 117 | auto max(const T& a, const L& b) -> decltype((b < a) ? b : a) 118 | { 119 | return (a < b) ? b : a; 120 | } 121 | #endif 122 | 123 | #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) 124 | #define radians(deg) ((deg)*DEG_TO_RAD) 125 | #define degrees(rad) ((rad)*RAD_TO_DEG) 126 | #define sq(x) ((x)*(x)) 127 | 128 | #define interrupts() __enable_irq() 129 | #define noInterrupts() __disable_irq() 130 | 131 | #define lowByte(w) ((uint8_t) ((w) & 0xff)) 132 | #define highByte(w) ((uint8_t) ((w) >> 8)) 133 | 134 | #define bitRead(value, bit) (((value) >> (bit)) & 0x01) 135 | #define bitSet(value, bit) ((value) |= (1UL << (bit))) 136 | #define bitClear(value, bit) ((value) &= ~(1UL << (bit))) 137 | #define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit)) 138 | #define bit(b) (1UL << (b)) 139 | 140 | #if (ARDUINO_SAMD_VARIANT_COMPLIANCE >= 10606) 141 | // Interrupts 142 | #define digitalPinToInterrupt(P) ( P ) 143 | #endif 144 | 145 | // Allows publishing the Beta core under samd-beta / arduino organization 146 | #ifndef ARDUINO_ARCH_SAMD 147 | #define ARDUINO_ARCH_SAMD 148 | #endif 149 | 150 | // USB Device 151 | #include "USB/USBDesc.h" 152 | #include "USB/USBCore.h" 153 | #include "USB/USBAPI.h" 154 | #include "USB/USB_host.h" 155 | 156 | #ifdef __cplusplus 157 | #include "USB/CDC.h" 158 | #endif 159 | 160 | #endif // Arduino_h 161 | -------------------------------------------------------------------------------- /Packages_Patches/arduino/hardware/samd/1.8.7/cores/arduino/Arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Arduino.h - Main include file for the Arduino SDK 3 | Copyright (c) 2014 Arduino LLC. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library 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 GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | // KH, This is the fix according to https://github.com/arduino/ArduinoCore-samd/pull/399 21 | // to avoid notorious compiler error while uing STL (min and max macro error) 22 | // It's terrible Arduino has just released new core and still don't merge the PR 23 | 24 | #ifndef Arduino_h 25 | #define Arduino_h 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | typedef bool boolean; 34 | typedef uint8_t byte; 35 | typedef uint16_t word; 36 | 37 | // some libraries and sketches depend on this AVR stuff, 38 | // assuming Arduino.h or WProgram.h automatically includes it... 39 | // 40 | #include "avr/pgmspace.h" 41 | #include "avr/interrupt.h" 42 | #include "avr/io.h" 43 | #include "binary.h" 44 | #include "itoa.h" 45 | 46 | #ifdef __cplusplus 47 | extern "C" { 48 | #endif // __cplusplus 49 | 50 | // Include Atmel headers 51 | #include "sam.h" 52 | #include "wiring_constants.h" 53 | 54 | #define clockCyclesPerMicrosecond() ( SystemCoreClock / 1000000L ) 55 | #define clockCyclesToMicroseconds(a) ( ((a) * 1000L) / (SystemCoreClock / 1000L) ) 56 | #define microsecondsToClockCycles(a) ( (a) * (SystemCoreClock / 1000000L) ) 57 | void yield( void ) ; 58 | /* system functions */ 59 | int main( void ); 60 | void init( void ); 61 | /* sketch */ 62 | void setup( void ) ; 63 | void loop( void ) ; 64 | #include "WVariant.h" 65 | 66 | #ifdef __cplusplus 67 | } // extern "C" 68 | #endif 69 | 70 | 71 | // The following headers are for C++ only compilation 72 | #ifdef __cplusplus 73 | #include "WCharacter.h" 74 | #include "WString.h" 75 | #include "Tone.h" 76 | #include "WMath.h" 77 | #include "HardwareSerial.h" 78 | #include "pulse.h" 79 | #include 80 | #endif 81 | 82 | #include "delay.h" 83 | 84 | #ifdef __cplusplus 85 | #include "Uart.h" 86 | #endif 87 | 88 | // Include board variant 89 | #include "variant.h" 90 | #include "wiring.h" 91 | #include "wiring_digital.h" 92 | #include "wiring_analog.h" 93 | #include "wiring_shift.h" 94 | #include "WInterrupts.h" 95 | 96 | #ifndef __cplusplus 97 | // undefine stdlib's abs if encountered 98 | #ifdef abs 99 | #undef abs 100 | #endif // abs 101 | 102 | #define min(a,b) ((a)<(b)?(a):(b)) 103 | #define max(a,b) ((a)>(b)?(a):(b)) 104 | #define abs(x) ((x)>0?(x):-(x)) 105 | #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) 106 | 107 | #else 108 | //using std::min; 109 | //using std::max; 110 | template 111 | auto min(const T& a, const L& b) -> decltype((b < a) ? b : a) 112 | { 113 | return (b < a) ? b : a; 114 | } 115 | 116 | template 117 | auto max(const T& a, const L& b) -> decltype((b < a) ? b : a) 118 | { 119 | return (a < b) ? b : a; 120 | } 121 | #endif 122 | 123 | #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) 124 | #define radians(deg) ((deg)*DEG_TO_RAD) 125 | #define degrees(rad) ((rad)*RAD_TO_DEG) 126 | #define sq(x) ((x)*(x)) 127 | 128 | #define interrupts() __enable_irq() 129 | #define noInterrupts() __disable_irq() 130 | 131 | #define lowByte(w) ((uint8_t) ((w) & 0xff)) 132 | #define highByte(w) ((uint8_t) ((w) >> 8)) 133 | 134 | #define bitRead(value, bit) (((value) >> (bit)) & 0x01) 135 | #define bitSet(value, bit) ((value) |= (1UL << (bit))) 136 | #define bitClear(value, bit) ((value) &= ~(1UL << (bit))) 137 | #define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit)) 138 | #define bit(b) (1UL << (b)) 139 | 140 | #if (ARDUINO_SAMD_VARIANT_COMPLIANCE >= 10606) 141 | // Interrupts 142 | #define digitalPinToInterrupt(P) ( P ) 143 | #endif 144 | 145 | // Allows publishing the Beta core under samd-beta / arduino organization 146 | #ifndef ARDUINO_ARCH_SAMD 147 | #define ARDUINO_ARCH_SAMD 148 | #endif 149 | 150 | // USB Device 151 | #include "USB/USBDesc.h" 152 | #include "USB/USBCore.h" 153 | #include "USB/USBAPI.h" 154 | #include "USB/USB_host.h" 155 | 156 | #ifdef __cplusplus 157 | #include "USB/CDC.h" 158 | #endif 159 | 160 | #endif // Arduino_h 161 | -------------------------------------------------------------------------------- /Packages_Patches/arduino/hardware/samd/1.8.8/cores/Arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Arduino.h - Main include file for the Arduino SDK 3 | Copyright (c) 2014 Arduino LLC. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library 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 GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | // KH, This is the fix according to https://github.com/arduino/ArduinoCore-samd/pull/399 21 | // to avoid notorious compiler error while uing STL (min and max macro error) 22 | // It's terrible Arduino has just released new core and still don't merge the PR 23 | 24 | #ifndef Arduino_h 25 | #define Arduino_h 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | typedef bool boolean; 34 | typedef uint8_t byte; 35 | typedef uint16_t word; 36 | 37 | // some libraries and sketches depend on this AVR stuff, 38 | // assuming Arduino.h or WProgram.h automatically includes it... 39 | // 40 | #include "avr/pgmspace.h" 41 | #include "avr/interrupt.h" 42 | #include "avr/io.h" 43 | 44 | #include "binary.h" 45 | #include "itoa.h" 46 | 47 | #ifdef __cplusplus 48 | extern "C" { 49 | #endif // __cplusplus 50 | 51 | // Include Atmel headers 52 | #include "sam.h" 53 | 54 | #include "wiring_constants.h" 55 | 56 | #define clockCyclesPerMicrosecond() ( SystemCoreClock / 1000000L ) 57 | #define clockCyclesToMicroseconds(a) ( ((a) * 1000L) / (SystemCoreClock / 1000L) ) 58 | #define microsecondsToClockCycles(a) ( (a) * (SystemCoreClock / 1000000L) ) 59 | 60 | void yield( void ) ; 61 | 62 | /* system functions */ 63 | int main( void ); 64 | void init( void ); 65 | 66 | /* sketch */ 67 | void setup( void ) ; 68 | void loop( void ) ; 69 | 70 | #include "WVariant.h" 71 | 72 | #ifdef __cplusplus 73 | } // extern "C" 74 | #endif 75 | 76 | // The following headers are for C++ only compilation 77 | #ifdef __cplusplus 78 | #include "WCharacter.h" 79 | #include "WString.h" 80 | #include "Tone.h" 81 | #include "WMath.h" 82 | #include "HardwareSerial.h" 83 | #include "pulse.h" 84 | #include 85 | #endif 86 | 87 | #include "delay.h" 88 | 89 | #ifdef __cplusplus 90 | #include "Uart.h" 91 | #endif 92 | 93 | // Include board variant 94 | #include "variant.h" 95 | #include "wiring.h" 96 | #include "wiring_digital.h" 97 | #include "wiring_analog.h" 98 | #include "wiring_shift.h" 99 | #include "WInterrupts.h" 100 | 101 | #ifndef __cplusplus 102 | // undefine stdlib's abs if encountered 103 | #ifdef abs 104 | #undef abs 105 | #endif // abs 106 | 107 | #define min(a,b) ((a)<(b)?(a):(b)) 108 | #define max(a,b) ((a)>(b)?(a):(b)) 109 | #define abs(x) ((x)>0?(x):-(x)) 110 | #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) 111 | 112 | #else 113 | //using std::min; 114 | //using std::max; 115 | template 116 | auto min(const T& a, const L& b) -> decltype((b < a) ? b : a) 117 | { 118 | return (b < a) ? b : a; 119 | } 120 | 121 | template 122 | auto max(const T& a, const L& b) -> decltype((b < a) ? b : a) 123 | { 124 | return (a < b) ? b : a; 125 | } 126 | #endif 127 | 128 | #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) 129 | #define radians(deg) ((deg)*DEG_TO_RAD) 130 | #define degrees(rad) ((rad)*RAD_TO_DEG) 131 | #define sq(x) ((x)*(x)) 132 | 133 | #define interrupts() __enable_irq() 134 | #define noInterrupts() __disable_irq() 135 | 136 | #define lowByte(w) ((uint8_t) ((w) & 0xff)) 137 | #define highByte(w) ((uint8_t) ((w) >> 8)) 138 | 139 | #define bitRead(value, bit) (((value) >> (bit)) & 0x01) 140 | #define bitSet(value, bit) ((value) |= (1UL << (bit))) 141 | #define bitClear(value, bit) ((value) &= ~(1UL << (bit))) 142 | #define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit)) 143 | #define bit(b) (1UL << (b)) 144 | 145 | #if (ARDUINO_SAMD_VARIANT_COMPLIANCE >= 10606) 146 | // Interrupts 147 | #define digitalPinToInterrupt(P) ( P ) 148 | #endif 149 | 150 | // Allows publishing the Beta core under samd-beta / arduino organization 151 | #ifndef ARDUINO_ARCH_SAMD 152 | #define ARDUINO_ARCH_SAMD 153 | #endif 154 | 155 | // USB Device 156 | #include "USB/USBDesc.h" 157 | #include "USB/USBCore.h" 158 | #include "USB/USBAPI.h" 159 | #include "USB/USB_host.h" 160 | 161 | #ifdef __cplusplus 162 | #include "USB/CDC.h" 163 | #endif 164 | 165 | #endif // Arduino_h 166 | -------------------------------------------------------------------------------- /Packages_Patches/arduino/hardware/samd/1.8.8/cores/arduino/Arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Arduino.h - Main include file for the Arduino SDK 3 | Copyright (c) 2014 Arduino LLC. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library 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 GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | // KH, This is the fix according to https://github.com/arduino/ArduinoCore-samd/pull/399 21 | // to avoid notorious compiler error while uing STL (min and max macro error) 22 | // It's terrible Arduino has just released new core and still don't merge the PR 23 | 24 | #ifndef Arduino_h 25 | #define Arduino_h 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | typedef bool boolean; 34 | typedef uint8_t byte; 35 | typedef uint16_t word; 36 | 37 | // some libraries and sketches depend on this AVR stuff, 38 | // assuming Arduino.h or WProgram.h automatically includes it... 39 | // 40 | #include "avr/pgmspace.h" 41 | #include "avr/interrupt.h" 42 | #include "avr/io.h" 43 | 44 | #include "binary.h" 45 | #include "itoa.h" 46 | 47 | #ifdef __cplusplus 48 | extern "C" { 49 | #endif // __cplusplus 50 | 51 | // Include Atmel headers 52 | #include "sam.h" 53 | 54 | #include "wiring_constants.h" 55 | 56 | #define clockCyclesPerMicrosecond() ( SystemCoreClock / 1000000L ) 57 | #define clockCyclesToMicroseconds(a) ( ((a) * 1000L) / (SystemCoreClock / 1000L) ) 58 | #define microsecondsToClockCycles(a) ( (a) * (SystemCoreClock / 1000000L) ) 59 | 60 | void yield( void ) ; 61 | 62 | /* system functions */ 63 | int main( void ); 64 | void init( void ); 65 | 66 | /* sketch */ 67 | void setup( void ) ; 68 | void loop( void ) ; 69 | 70 | #include "WVariant.h" 71 | 72 | #ifdef __cplusplus 73 | } // extern "C" 74 | #endif 75 | 76 | // The following headers are for C++ only compilation 77 | #ifdef __cplusplus 78 | #include "WCharacter.h" 79 | #include "WString.h" 80 | #include "Tone.h" 81 | #include "WMath.h" 82 | #include "HardwareSerial.h" 83 | #include "pulse.h" 84 | #include 85 | #endif 86 | 87 | #include "delay.h" 88 | 89 | #ifdef __cplusplus 90 | #include "Uart.h" 91 | #endif 92 | 93 | // Include board variant 94 | #include "variant.h" 95 | #include "wiring.h" 96 | #include "wiring_digital.h" 97 | #include "wiring_analog.h" 98 | #include "wiring_shift.h" 99 | #include "WInterrupts.h" 100 | 101 | #ifndef __cplusplus 102 | // undefine stdlib's abs if encountered 103 | #ifdef abs 104 | #undef abs 105 | #endif // abs 106 | 107 | #define min(a,b) ((a)<(b)?(a):(b)) 108 | #define max(a,b) ((a)>(b)?(a):(b)) 109 | #define abs(x) ((x)>0?(x):-(x)) 110 | #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) 111 | 112 | #else 113 | //using std::min; 114 | //using std::max; 115 | template 116 | auto min(const T& a, const L& b) -> decltype((b < a) ? b : a) 117 | { 118 | return (b < a) ? b : a; 119 | } 120 | 121 | template 122 | auto max(const T& a, const L& b) -> decltype((b < a) ? b : a) 123 | { 124 | return (a < b) ? b : a; 125 | } 126 | #endif 127 | 128 | #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) 129 | #define radians(deg) ((deg)*DEG_TO_RAD) 130 | #define degrees(rad) ((rad)*RAD_TO_DEG) 131 | #define sq(x) ((x)*(x)) 132 | 133 | #define interrupts() __enable_irq() 134 | #define noInterrupts() __disable_irq() 135 | 136 | #define lowByte(w) ((uint8_t) ((w) & 0xff)) 137 | #define highByte(w) ((uint8_t) ((w) >> 8)) 138 | 139 | #define bitRead(value, bit) (((value) >> (bit)) & 0x01) 140 | #define bitSet(value, bit) ((value) |= (1UL << (bit))) 141 | #define bitClear(value, bit) ((value) &= ~(1UL << (bit))) 142 | #define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit)) 143 | #define bit(b) (1UL << (b)) 144 | 145 | #if (ARDUINO_SAMD_VARIANT_COMPLIANCE >= 10606) 146 | // Interrupts 147 | #define digitalPinToInterrupt(P) ( P ) 148 | #endif 149 | 150 | // Allows publishing the Beta core under samd-beta / arduino organization 151 | #ifndef ARDUINO_ARCH_SAMD 152 | #define ARDUINO_ARCH_SAMD 153 | #endif 154 | 155 | // USB Device 156 | #include "USB/USBDesc.h" 157 | #include "USB/USBCore.h" 158 | #include "USB/USBAPI.h" 159 | #include "USB/USB_host.h" 160 | 161 | #ifdef __cplusplus 162 | #include "USB/CDC.h" 163 | #endif 164 | 165 | #endif // Arduino_h 166 | -------------------------------------------------------------------------------- /Packages_Patches/arduino/hardware/samd/1.8.9/cores/arduino/Arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Arduino.h - Main include file for the Arduino SDK 3 | Copyright (c) 2014 Arduino LLC. All right reserved. 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library 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 GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 | */ 19 | 20 | // KH, This is the fix according to https://github.com/arduino/ArduinoCore-samd/pull/399 21 | // to avoid notorious compiler error while uing STL (min and max macro error) 22 | // It's terrible Arduino has just released new core and still don't merge the PR 23 | 24 | #ifndef Arduino_h 25 | #define Arduino_h 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | typedef bool boolean; 34 | typedef uint8_t byte; 35 | typedef uint16_t word; 36 | 37 | // some libraries and sketches depend on this AVR stuff, 38 | // assuming Arduino.h or WProgram.h automatically includes it... 39 | // 40 | #include "avr/pgmspace.h" 41 | #include "avr/interrupt.h" 42 | #include "avr/io.h" 43 | 44 | #include "binary.h" 45 | #include "itoa.h" 46 | 47 | #ifdef __cplusplus 48 | extern "C" { 49 | #endif // __cplusplus 50 | 51 | // Include Atmel headers 52 | #include "sam.h" 53 | 54 | #include "wiring_constants.h" 55 | 56 | #define clockCyclesPerMicrosecond() ( SystemCoreClock / 1000000L ) 57 | #define clockCyclesToMicroseconds(a) ( ((a) * 1000L) / (SystemCoreClock / 1000L) ) 58 | #define microsecondsToClockCycles(a) ( (a) * (SystemCoreClock / 1000000L) ) 59 | 60 | void yield( void ) ; 61 | 62 | /* system functions */ 63 | int main( void ); 64 | void init( void ); 65 | 66 | /* sketch */ 67 | void setup( void ) ; 68 | void loop( void ) ; 69 | 70 | #include "WVariant.h" 71 | 72 | #ifdef __cplusplus 73 | } // extern "C" 74 | #endif 75 | 76 | // The following headers are for C++ only compilation 77 | #ifdef __cplusplus 78 | #include "WCharacter.h" 79 | #include "WString.h" 80 | #include "Tone.h" 81 | #include "WMath.h" 82 | #include "HardwareSerial.h" 83 | #include "pulse.h" 84 | #include 85 | #endif 86 | 87 | #include "delay.h" 88 | 89 | #ifdef __cplusplus 90 | #include "Uart.h" 91 | #endif 92 | 93 | // Include board variant 94 | #include "variant.h" 95 | #include "wiring.h" 96 | #include "wiring_digital.h" 97 | #include "wiring_analog.h" 98 | #include "wiring_shift.h" 99 | #include "WInterrupts.h" 100 | 101 | #ifndef __cplusplus 102 | // undefine stdlib's abs if encountered 103 | #ifdef abs 104 | #undef abs 105 | #endif // abs 106 | 107 | #define min(a,b) ((a)<(b)?(a):(b)) 108 | #define max(a,b) ((a)>(b)?(a):(b)) 109 | #define abs(x) ((x)>0?(x):-(x)) 110 | #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) 111 | 112 | #else 113 | //using std::min; 114 | //using std::max; 115 | template 116 | auto min(const T& a, const L& b) -> decltype((b < a) ? b : a) 117 | { 118 | return (b < a) ? b : a; 119 | } 120 | 121 | template 122 | auto max(const T& a, const L& b) -> decltype((b < a) ? b : a) 123 | { 124 | return (a < b) ? b : a; 125 | } 126 | #endif 127 | 128 | #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) 129 | #define radians(deg) ((deg)*DEG_TO_RAD) 130 | #define degrees(rad) ((rad)*RAD_TO_DEG) 131 | #define sq(x) ((x)*(x)) 132 | 133 | #define interrupts() __enable_irq() 134 | #define noInterrupts() __disable_irq() 135 | 136 | #define lowByte(w) ((uint8_t) ((w) & 0xff)) 137 | #define highByte(w) ((uint8_t) ((w) >> 8)) 138 | 139 | #define bitRead(value, bit) (((value) >> (bit)) & 0x01) 140 | #define bitSet(value, bit) ((value) |= (1UL << (bit))) 141 | #define bitClear(value, bit) ((value) &= ~(1UL << (bit))) 142 | #define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit)) 143 | #define bit(b) (1UL << (b)) 144 | 145 | #if (ARDUINO_SAMD_VARIANT_COMPLIANCE >= 10606) 146 | // Interrupts 147 | #define digitalPinToInterrupt(P) ( P ) 148 | #endif 149 | 150 | // Allows publishing the Beta core under samd-beta / arduino organization 151 | #ifndef ARDUINO_ARCH_SAMD 152 | #define ARDUINO_ARCH_SAMD 153 | #endif 154 | 155 | // USB Device 156 | #include "USB/USBDesc.h" 157 | #include "USB/USBCore.h" 158 | #include "USB/USBAPI.h" 159 | #include "USB/USB_host.h" 160 | 161 | #ifdef __cplusplus 162 | #include "USB/CDC.h" 163 | #endif 164 | 165 | #endif // Arduino_h 166 | -------------------------------------------------------------------------------- /Packages_Patches/industrialshields/hardware/avr/1.1.36/cores/industrialshields/Udp.h: -------------------------------------------------------------------------------- 1 | /* 2 | Udp.cpp: Library to send/receive UDP packets. 3 | 4 | NOTE: UDP is fast, but has some important limitations (thanks to Warren Gray for mentioning these) 5 | 1) UDP does not guarantee the order in which assembled UDP packets are received. This 6 | might not happen often in practice, but in larger network topologies, a UDP 7 | packet can be received out of sequence. 8 | 2) UDP does not guard against lost packets - so packets *can* disappear without the sender being 9 | aware of it. Again, this may not be a concern in practice on small local networks. 10 | For more information, see http://www.cafeaulait.org/course/week12/35.html 11 | 12 | MIT License: 13 | Copyright (c) 2008 Bjoern Hartmann 14 | Permission is hereby granted, free of charge, to any person obtaining a copy 15 | of this software and associated documentation files (the "Software"), to deal 16 | in the Software without restriction, including without limitation the rights 17 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18 | copies of the Software, and to permit persons to whom the Software is 19 | furnished to do so, subject to the following conditions: 20 | 21 | The above copyright notice and this permission notice shall be included in 22 | all copies or substantial portions of the Software. 23 | 24 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 29 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 30 | THE SOFTWARE. 31 | 32 | bjoern@cs.stanford.edu 12/30/2008 33 | */ 34 | 35 | #ifndef udp_h 36 | #define udp_h 37 | 38 | #include 39 | #include 40 | 41 | class UDP : public Stream 42 | { 43 | 44 | public: 45 | virtual uint8_t begin(uint16_t) = 46 | 0; // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use 47 | virtual uint8_t beginMulticast(IPAddress, uint16_t) 48 | { 49 | return 0; // initialize, start listening on specified multicast IP address and port. Returns 1 if successful, 0 on failure 50 | } 51 | virtual void stop() = 0; // Finish with the UDP socket 52 | 53 | // Sending UDP packets 54 | 55 | // Start building up a packet to send to the remote host specific in ip and port 56 | // Returns 1 if successful, 0 if there was a problem with the supplied IP address or port 57 | virtual int beginPacket(IPAddress ip, uint16_t port) = 0; 58 | // Start building up a packet to send to the remote host specific in host and port 59 | // Returns 1 if successful, 0 if there was a problem resolving the hostname or port 60 | virtual int beginPacket(const char *host, uint16_t port) = 0; 61 | // Finish off this packet and send it 62 | // Returns 1 if the packet was sent successfully, 0 if there was an error 63 | virtual int endPacket() = 0; 64 | // Write a single byte into the packet 65 | virtual size_t write(uint8_t) = 0; 66 | // Write size bytes from buffer into the packet 67 | virtual size_t write(const uint8_t *buffer, size_t size) = 0; 68 | 69 | // Start processing the next available incoming packet 70 | // Returns the size of the packet in bytes, or 0 if no packets are available 71 | virtual int parsePacket() = 0; 72 | // Number of bytes remaining in the current packet 73 | virtual int available() = 0; 74 | // Read a single byte from the current packet 75 | virtual int read() = 0; 76 | // Read up to len bytes from the current packet and place them into buffer 77 | // Returns the number of bytes read, or 0 if none are available 78 | virtual int read(unsigned char* buffer, size_t len) = 0; 79 | // Read up to len characters from the current packet and place them into buffer 80 | // Returns the number of characters read, or 0 if none are available 81 | virtual int read(char* buffer, size_t len) = 0; 82 | // Return the next byte from the current packet without moving on to the next byte 83 | virtual int peek() = 0; 84 | virtual void flush() = 0; // Finish reading the current packet 85 | 86 | // Return the IP address of the host who sent the current incoming packet 87 | virtual IPAddress remoteIP() = 0; 88 | // Return the port of the host who sent the current incoming packet 89 | virtual uint16_t remotePort() = 0; 90 | protected: 91 | uint8_t* rawIPAddress(IPAddress& addr) 92 | { 93 | return addr.raw_address(); 94 | }; 95 | }; 96 | 97 | #endif 98 | -------------------------------------------------------------------------------- /Packages_Patches/industrialshields/hardware/avr/1.1.37/cores/industrialshields/Udp.h: -------------------------------------------------------------------------------- 1 | /* 2 | Udp.cpp: Library to send/receive UDP packets. 3 | 4 | NOTE: UDP is fast, but has some important limitations (thanks to Warren Gray for mentioning these) 5 | 1) UDP does not guarantee the order in which assembled UDP packets are received. This 6 | might not happen often in practice, but in larger network topologies, a UDP 7 | packet can be received out of sequence. 8 | 2) UDP does not guard against lost packets - so packets *can* disappear without the sender being 9 | aware of it. Again, this may not be a concern in practice on small local networks. 10 | For more information, see http://www.cafeaulait.org/course/week12/35.html 11 | 12 | MIT License: 13 | Copyright (c) 2008 Bjoern Hartmann 14 | Permission is hereby granted, free of charge, to any person obtaining a copy 15 | of this software and associated documentation files (the "Software"), to deal 16 | in the Software without restriction, including without limitation the rights 17 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18 | copies of the Software, and to permit persons to whom the Software is 19 | furnished to do so, subject to the following conditions: 20 | 21 | The above copyright notice and this permission notice shall be included in 22 | all copies or substantial portions of the Software. 23 | 24 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 25 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 26 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 27 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 29 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 30 | THE SOFTWARE. 31 | 32 | bjoern@cs.stanford.edu 12/30/2008 33 | */ 34 | 35 | #ifndef udp_h 36 | #define udp_h 37 | 38 | #include 39 | #include 40 | 41 | class UDP : public Stream 42 | { 43 | 44 | public: 45 | virtual uint8_t begin(uint16_t) = 46 | 0; // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use 47 | virtual uint8_t beginMulticast(IPAddress, uint16_t) 48 | { 49 | return 0; // initialize, start listening on specified multicast IP address and port. Returns 1 if successful, 0 on failure 50 | } 51 | virtual void stop() = 0; // Finish with the UDP socket 52 | 53 | // Sending UDP packets 54 | 55 | // Start building up a packet to send to the remote host specific in ip and port 56 | // Returns 1 if successful, 0 if there was a problem with the supplied IP address or port 57 | virtual int beginPacket(IPAddress ip, uint16_t port) = 0; 58 | // Start building up a packet to send to the remote host specific in host and port 59 | // Returns 1 if successful, 0 if there was a problem resolving the hostname or port 60 | virtual int beginPacket(const char *host, uint16_t port) = 0; 61 | // Finish off this packet and send it 62 | // Returns 1 if the packet was sent successfully, 0 if there was an error 63 | virtual int endPacket() = 0; 64 | // Write a single byte into the packet 65 | virtual size_t write(uint8_t) = 0; 66 | // Write size bytes from buffer into the packet 67 | virtual size_t write(const uint8_t *buffer, size_t size) = 0; 68 | 69 | // Start processing the next available incoming packet 70 | // Returns the size of the packet in bytes, or 0 if no packets are available 71 | virtual int parsePacket() = 0; 72 | // Number of bytes remaining in the current packet 73 | virtual int available() = 0; 74 | // Read a single byte from the current packet 75 | virtual int read() = 0; 76 | // Read up to len bytes from the current packet and place them into buffer 77 | // Returns the number of bytes read, or 0 if none are available 78 | virtual int read(unsigned char* buffer, size_t len) = 0; 79 | // Read up to len characters from the current packet and place them into buffer 80 | // Returns the number of characters read, or 0 if none are available 81 | virtual int read(char* buffer, size_t len) = 0; 82 | // Return the next byte from the current packet without moving on to the next byte 83 | virtual int peek() = 0; 84 | virtual void flush() = 0; // Finish reading the current packet 85 | 86 | // Return the IP address of the host who sent the current incoming packet 87 | virtual IPAddress remoteIP() = 0; 88 | // Return the port of the host who sent the current incoming packet 89 | virtual uint16_t remotePort() = 0; 90 | protected: 91 | uint8_t* rawIPAddress(IPAddress& addr) 92 | { 93 | return addr.raw_address(); 94 | }; 95 | }; 96 | 97 | #endif 98 | -------------------------------------------------------------------------------- /examples/multiFileProject/multiFileProject.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | multiFileProject.cpp 3 | For SAMD boards 4 | Written by Khoi Hoang 5 | 6 | Built by Khoi Hoang https://github.com/khoih-prog/SAMD_TimerInterrupt 7 | Licensed under MIT license 8 | 9 | Now even you use all these new 16 ISR-based timers,with their maximum interval practically unlimited (limited only by 10 | unsigned long miliseconds), you just consume only one SAMD timer and avoid conflicting with other cores' tasks. 11 | The accuracy is nearly perfect compared to software timers. The most important feature is they're ISR-based timers 12 | Therefore, their executions are not blocked by bad-behaving functions / tasks. 13 | This important feature is absolutely necessary for mission-critical tasks. 14 | *****************************************************************************************************************************/ 15 | 16 | // To demo how to include files in multi-file Projects 17 | 18 | #include "multiFileProject.h" 19 | -------------------------------------------------------------------------------- /examples/multiFileProject/multiFileProject.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | multiFileProject.h 3 | For SAMD boards 4 | Written by Khoi Hoang 5 | 6 | Built by Khoi Hoang https://github.com/khoih-prog/SAMD_TimerInterrupt 7 | Licensed under MIT license 8 | 9 | Now even you use all these new 16 ISR-based timers,with their maximum interval practically unlimited (limited only by 10 | unsigned long miliseconds), you just consume only one SAMD timer and avoid conflicting with other cores' tasks. 11 | The accuracy is nearly perfect compared to software timers. The most important feature is they're ISR-based timers 12 | Therefore, their executions are not blocked by bad-behaving functions / tasks. 13 | This important feature is absolutely necessary for mission-critical tasks. 14 | *****************************************************************************************************************************/ 15 | 16 | // To demo how to include files in multi-file Projects 17 | 18 | #pragma once 19 | 20 | ///////////////////////////////////////////////////////////////// 21 | 22 | // These define's must be placed at the beginning before #include "SAMDTimerInterrupt.h" 23 | // _TIMERINTERRUPT_LOGLEVEL_ from 0 to 4 24 | // Don't define _TIMERINTERRUPT_LOGLEVEL_ > 0. Only for special ISR debugging only. Can hang the system. 25 | // Don't define TIMER_INTERRUPT_DEBUG > 2. Only for special ISR debugging only. Can hang the system. 26 | #define TIMER_INTERRUPT_DEBUG 0 27 | #define _TIMERINTERRUPT_LOGLEVEL_ 0 28 | 29 | // Select only one to be true for SAMD21. Must must be placed at the beginning before #include "SAMDTimerInterrupt.h" 30 | #define USING_TIMER_TC3 true // Only TC3 can be used for SAMD51 31 | #define USING_TIMER_TC4 false // Not to use with Servo library 32 | #define USING_TIMER_TC5 false 33 | #define USING_TIMER_TCC false 34 | #define USING_TIMER_TCC1 false 35 | #define USING_TIMER_TCC2 false // Don't use this, can crash on some boards 36 | 37 | // Uncomment To test if conflict with Servo library 38 | //#include "Servo.h" 39 | 40 | ///////////////////////////////////////////////////////////////// 41 | 42 | // Can be included as many times as necessary, without `Multiple Definitions` Linker Error 43 | #include "SAMDTimerInterrupt.hpp" 44 | 45 | // Can be included as many times as necessary, without `Multiple Definitions` Linker Error 46 | #include "SAMD_ISR_Timer.hpp" 47 | -------------------------------------------------------------------------------- /examples/multiFileProject/multiFileProject.ino: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | multiFileProject.ino 3 | For SAMD boards 4 | Written by Khoi Hoang 5 | 6 | Built by Khoi Hoang https://github.com/khoih-prog/SAMD_TimerInterrupt 7 | Licensed under MIT license 8 | 9 | Now even you use all these new 16 ISR-based timers,with their maximum interval practically unlimited (limited only by 10 | unsigned long miliseconds), you just consume only one SAMD timer and avoid conflicting with other cores' tasks. 11 | The accuracy is nearly perfect compared to software timers. The most important feature is they're ISR-based timers 12 | Therefore, their executions are not blocked by bad-behaving functions / tasks. 13 | This important feature is absolutely necessary for mission-critical tasks. 14 | *****************************************************************************************************************************/ 15 | 16 | // To demo how to include files in multi-file Projects 17 | 18 | #include "multiFileProject.h" 19 | 20 | // To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error 21 | #include "SAMDTimerInterrupt.h" 22 | 23 | // To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error 24 | #include "SAMD_ISR_Timer.h" 25 | 26 | /////////////////////////////////////////////// 27 | 28 | #if (TIMER_INTERRUPT_USING_SAMD21) 29 | 30 | #if USING_TIMER_TC3 31 | #define SELECTED_TIMER TIMER_TC3 32 | #elif USING_TIMER_TC4 33 | #define SELECTED_TIMER TIMER_TC4 34 | #elif USING_TIMER_TC5 35 | #define SELECTED_TIMER TIMER_TC5 36 | #elif USING_TIMER_TCC 37 | #define SELECTED_TIMER TIMER_TCC 38 | #elif USING_TIMER_TCC1 39 | #define SELECTED_TIMER TIMER_TCC1 40 | #elif USING_TIMER_TCC2 41 | #define SELECTED_TIMER TIMER_TCC 42 | #else 43 | #error You have to select 1 Timer 44 | #endif 45 | 46 | #else 47 | 48 | #if !(USING_TIMER_TC3) 49 | #error You must select TC3 for SAMD51 50 | #endif 51 | 52 | #define SELECTED_TIMER TIMER_TC3 53 | 54 | #endif 55 | 56 | // Init selected SAMD timer 57 | SAMDTimer ITimer(SELECTED_TIMER); 58 | 59 | //////////////////////////////////////////////// 60 | 61 | void setup() 62 | { 63 | // put your setup code here, to run once: 64 | } 65 | 66 | void loop() 67 | { 68 | // put your main code here, to run repeatedly: 69 | } 70 | -------------------------------------------------------------------------------- /keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Datatypes (KEYWORD1) 3 | ####################################### 4 | 5 | SAMDTimerInterrupt KEYWORD1 6 | SAMDTimer KEYWORD1 7 | SAMD_ISRTimer KEYWORD1 8 | SAMD_ISR_Timer KEYWORD1 9 | SAMDTimerNumber KEYWORD1 10 | timerCallback KEYWORD1 11 | timerCallback_p KEYWORD1 12 | 13 | ####################################### 14 | # Methods and Functions (KEYWORD2) 15 | ####################################### 16 | 17 | ############################## 18 | # Class SAMDTimerInterrupt 19 | ############################## 20 | 21 | setFrequency KEYWORD2 22 | setInterval KEYWORD2 23 | setInterval_MS KEYWORD2 24 | attachInterrupt KEYWORD2 25 | attachInterruptInterval KEYWORD2 26 | attachInterruptInterval_MS KEYWORD2 27 | detachInterrupt KEYWORD2 28 | disableTimer KEYWORD2 29 | reattachInterrupt KEYWORD2 30 | enableTimer KEYWORD2 31 | stopTimer KEYWORD2 32 | restartTimer KEYWORD2 33 | 34 | ############################## 35 | # Class SAMD_ISR_Timer 36 | ############################## 37 | 38 | run KEYWORD2 39 | setTimeout KEYWORD2 40 | setTimer KEYWORD2 41 | changeInterval KEYWORD2 42 | deleteTimer KEYWORD2 43 | restartTimer KEYWORD2 44 | isEnabled KEYWORD2 45 | enable KEYWORD2 46 | disable KEYWORD2 47 | enableAll KEYWORD2 48 | disableAll KEYWORD2 49 | toggle KEYWORD2 50 | getNumTimers KEYWORD2 51 | getNumAvailableTimers KEYWORD2 52 | 53 | ####################################### 54 | # Constants (LITERAL1) 55 | ####################################### 56 | 57 | SAMD_TIMER_INTERRUPT_VERSION LITERAL1 58 | SAMD_TIMER_INTERRUPT_VERSION_MAJOR LITERAL1 59 | SAMD_TIMER_INTERRUPT_VERSION_MINOR LITERAL1 60 | SAMD_TIMER_INTERRUPT_VERSION_PATCH LITERAL1 61 | SAMD_TIMER_INTERRUPT_VERSION_INT LITERAL1 62 | 63 | 64 | -------------------------------------------------------------------------------- /library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "SAMD_TimerInterrupt", 3 | "version": "1.10.1", 4 | "keywords": "timing, device, control, timer, interrupt, hardware, isr, isr-based, hardware-timer, isr-timer, isr-based-timer, mission-critical, accuracy, precise, non-blocking, samd, samd21, samd51, nano-33-iot", 5 | "description": "This library enables you to use Interrupt from Hardware Timers on SAMD-based boards. It now supports 16 ISR-based timers, while consuming only 1 Hardware Timer. Timers' interval is very long (ulong millisecs). The most important feature is they're ISR-based timers. Therefore, their executions are not blocked by bad-behaving functions or tasks. This important feature is absolutely necessary for mission-critical tasks. These hardware timers, using interrupt, still work even if other functions are blocking. Moreover, they are much more precise (certainly depending on clock frequency accuracy) than other software timers using millis() or micros(). That's necessary if you need to measure some data requiring better accuracy. SAMD21 now can use 6 Timers", 6 | "authors": 7 | { 8 | "name": "Khoi Hoang", 9 | "url": "https://github.com/khoih-prog", 10 | "maintainer": true 11 | }, 12 | "repository": 13 | { 14 | "type": "git", 15 | "url": "https://github.com/khoih-prog/SAMD_TimerInterrupt" 16 | }, 17 | "homepage": "https://github.com/khoih-prog/SAMD_TimerInterrupt", 18 | "export": { 19 | "exclude": [ 20 | "linux", 21 | "extras", 22 | "tests" 23 | ] 24 | }, 25 | "license": "MIT", 26 | "frameworks": "*", 27 | "platforms": "samd", 28 | "examples": "examples/*/*/*.ino", 29 | "headers": ["SAMDTimerInterrupt.h", "SAMDTimerInterrupt.hpp", "SAMD_ISR_Timer.h", "SAMD_ISR_Timer.hpp"] 30 | } 31 | -------------------------------------------------------------------------------- /library.properties: -------------------------------------------------------------------------------- 1 | name=SAMD_TimerInterrupt 2 | version=1.10.1 3 | author=Khoi Hoang 4 | maintainer=Khoi Hoang 5 | sentence=This library enables you to use Interrupt from Hardware Timers on SAMD-based boards such as SAMD21 Nano-33-IoT, Adafruit SAMD51 Itsy-Bitsy M4, SeeedStudio XIAO, Sparkfun SAMD51_MICROMOD, etc. 6 | paragraph=These SAMD Hardware Timers, using Interrupt, still work even if other functions are blocking. Moreover, they are much more precise (certainly depending on clock frequency accuracy) than other software timers using millis() or micros(). That's mandatory if you need to measure some data requiring better accuracy. It now supports 16 ISR-based Timers, while consuming only 1 Hardware Timer. Timers interval is very long (ulong millisecs). The most important feature is they're ISR-based Timers. Therefore, their executions are not blocked by bad-behaving functions or tasks. This important feature is absolutely necessary for mission-critical tasks. SAMD21 now can use 6 Timers 7 | category=Device Control 8 | url=https://github.com/khoih-prog/SAMD_TimerInterrupt 9 | architectures=samd 10 | repository=https://github.com/khoih-prog/SAMD_TimerInterrupt 11 | license=MIT 12 | includes=SAMDTimerInterrupt.h, SAMDTimerInterrupt.hpp, SAMD_ISR_Timer.h, SAMD_ISR_Timer.hpp 13 | -------------------------------------------------------------------------------- /src/SAMDTimerInterrupt.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | SAMDTimerInterrupt.h 3 | For SAMD boards 4 | Written by Khoi Hoang 5 | Built by Khoi Hoang https://github.com/khoih-prog/SAMD_TimerInterrupt 6 | Licensed under MIT license 7 | Now even you use all these new 16 ISR-based timers,with their maximum interval practically unlimited (limited only by 8 | unsigned long miliseconds), you just consume only one SAMD timer and avoid conflicting with other cores' tasks. 9 | The accuracy is nearly perfect compared to software timers. The most important feature is they're ISR-based timers 10 | Therefore, their executions are not blocked by bad-behaving functions / tasks. 11 | This important feature is absolutely necessary for mission-critical tasks. 12 | 13 | Based on SimpleTimer - A timer library for Arduino. 14 | Author: mromani@ottotecnica.com 15 | Copyright (c) 2010 OTTOTECNICA Italy 16 | Based on BlynkTimer.h 17 | Author: Volodymyr Shymanskyy 18 | 19 | Version: 1.10.1 20 | 21 | Version Modified By Date Comments 22 | ------- ----------- ---------- ----------- 23 | 1.0.0 K Hoang 30/10/2020 Initial coding 24 | 1.0.1 K Hoang 06/11/2020 Add complicated example ISR_16_Timers_Array using all 16 independent ISR Timers. 25 | 1.1.1 K.Hoang 06/12/2020 Add Change_Interval example. Bump up version to sync with other TimerInterrupt Libraries 26 | 1.2.0 K.Hoang 08/01/2021 Add better debug feature. Optimize code and examples to reduce RAM usage 27 | 1.3.0 K.Hoang 02/04/2021 Add support to Sparkfun SAMD21 and SAMD51 boards 28 | 1.3.1 K.Hoang 09/05/2021 Fix compile error to some SAMD21-based boards 29 | 1.4.0 K.Hoang 02/06/2021 Fix SAMD21 rare bug caused by not fully init Prescaler 30 | 1.5.0 K.Hoang 08/10/2021 Improve frequency precision by using float instead of ulong 31 | 1.6.0 K.Hoang 20/01/2022 Fix `multiple-definitions` linker error. Add support to many more boards 32 | 1.7.0 K.Hoang 25/04/2022 Optimize code for setInterval() of SAMD21 TC3 33 | 1.8.0 K.Hoang 07/05/2022 Scrap the buggy code in v1.7.0 for TC3 34 | 1.9.0 K.Hoang 08/05/2022 Add TC4, TC5, TCC1 and TCC2 Timers to SAMD21 35 | 1.10.0 K.Hoang 29/09/2022 Avoid conflict with Servo library. Modify all examples. Prevent overflow of TCx 36 | 1.10.1 K.Hoang 30/09/2022 Using float instead of ulong for interval. Prevent overflow of SAMD51 TCx 37 | *****************************************************************************************************************************/ 38 | /* 39 | SAMD21 40 | 41 | The Timer/Counter for Control Applications (TCC) module provides a set of timing and counting related functionality, such as the 42 | generation of periodic waveforms, the capturing of a periodic waveform's frequency/duty cycle, software timekeeping for periodic 43 | operations, waveform extension control, fault detection etc. 44 | The counter size of the TCC modules can be 16- or 24-bit depending on the TCC instance 45 | 46 | 1) Nano-33-IoT SAMD21G18A 47 | .arduino15/packages/arduino/tools/CMSIS-Atmel/1.2.0/CMSIS/Device/ATMEL/samd21/include/samd21g18a.h 48 | #define TC3 ((Tc *)0x42002C00UL) 49 | 50 | */ 51 | #pragma once 52 | 53 | #ifndef SAMD_TIMERINTERRUPT_H 54 | #define SAMD_TIMERINTERRUPT_H 55 | 56 | #include "SAMDTimerInterrupt.hpp" 57 | #include "SAMDTimerInterrupt_Impl.h" 58 | 59 | 60 | #endif // SAMD_TIMERINTERRUPT_H 61 | -------------------------------------------------------------------------------- /src/SAMD_ISR_Timer.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************************************************** 2 | SAMD_ISR_Timer.h 3 | For SAMD boards 4 | Written by Khoi Hoang 5 | 6 | Built by Khoi Hoang https://github.com/khoih-prog/SAMD_TimerInterrupt 7 | Licensed under MIT license 8 | 9 | Now even you use all these new 16 ISR-based timers,with their maximum interval practically unlimited (limited only by 10 | unsigned long miliseconds), you just consume only one SAMD timer and avoid conflicting with other cores' tasks. 11 | The accuracy is nearly perfect compared to software timers. The most important feature is they're ISR-based timers 12 | Therefore, their executions are not blocked by bad-behaving functions / tasks. 13 | This important feature is absolutely necessary for mission-critical tasks. 14 | 15 | Based on SimpleTimer - A timer library for Arduino. 16 | Author: mromani@ottotecnica.com 17 | Copyright (c) 2010 OTTOTECNICA Italy 18 | 19 | Based on BlynkTimer.h 20 | Author: Volodymyr Shymanskyy 21 | 22 | Version: 1.10.1 23 | 24 | Version Modified By Date Comments 25 | ------- ----------- ---------- ----------- 26 | 1.0.0 K Hoang 30/10/2020 Initial coding 27 | 1.0.1 K Hoang 06/11/2020 Add complicated example ISR_16_Timers_Array using all 16 independent ISR Timers. 28 | 1.1.1 K.Hoang 06/12/2020 Add Change_Interval example. Bump up version to sync with other TimerInterrupt Libraries 29 | 1.2.0 K.Hoang 08/01/2021 Add better debug feature. Optimize code and examples to reduce RAM usage 30 | 1.3.0 K.Hoang 02/04/2021 Add support to Sparkfun SAMD21 and SAMD51 boards 31 | 1.3.1 K.Hoang 09/05/2021 Fix compile error to some SAMD21-based boards 32 | 1.4.0 K.Hoang 02/06/2021 Fix SAMD21 rare bug caused by not fully init Prescaler 33 | 1.5.0 K.Hoang 08/10/2021 Improve frequency precision by using float instead of ulong 34 | 1.6.0 K.Hoang 20/01/2022 Fix `multiple-definitions` linker error. Add support to many more boards 35 | 1.7.0 K.Hoang 25/04/2022 Optimize code for setInterval() of SAMD21 TC3 36 | 1.8.0 K.Hoang 07/05/2022 Scrap the buggy code in v1.7.0 for TC3 37 | 1.9.0 K.Hoang 08/05/2022 Add TC4, TC5, TCC1 and TCC2 Timers to SAMD21 38 | 1.10.0 K.Hoang 29/09/2022 Avoid conflict with Servo library. Modify all examples. Prevent overflow of TCx 39 | 1.10.1 K.Hoang 30/09/2022 Using float instead of ulong for interval. Prevent overflow of SAMD51 TCx 40 | *****************************************************************************************************************************/ 41 | 42 | #pragma once 43 | 44 | #ifndef ISR_TIMER_GENERIC_H 45 | #define ISR_TIMER_GENERIC_H 46 | 47 | #include "SAMD_ISR_Timer.hpp" 48 | #include "SAMD_ISR_Timer-Impl.h" 49 | 50 | #endif // ISR_TIMER_GENERIC_H 51 | -------------------------------------------------------------------------------- /utils/astyle_library.conf: -------------------------------------------------------------------------------- 1 | # Code formatting rules for Arduino libraries, modified from for KH libraries: 2 | # 3 | # https://github.com/arduino/Arduino/blob/master/build/shared/examples_formatter.conf 4 | # 5 | 6 | # astyle --style=allman -s2 -t2 -C -S -xW -Y -M120 -f -p -xg -H -xb -c --xC120 -xL *.h *.cpp *.ino 7 | 8 | --mode=c 9 | --lineend=linux 10 | --style=allman 11 | 12 | # -r or -R 13 | #--recursive 14 | 15 | # -c => Converts tabs into spaces 16 | convert-tabs 17 | 18 | # -s2 => 2 spaces indentation 19 | --indent=spaces=2 20 | 21 | # -t2 => tab =2 spaces 22 | #--indent=tab=2 23 | 24 | # -C 25 | --indent-classes 26 | 27 | # -S 28 | --indent-switches 29 | 30 | # -xW 31 | --indent-preproc-block 32 | 33 | # -Y => indent classes, switches (and cases), comments starting at column 1 34 | --indent-col1-comments 35 | 36 | # -M120 => maximum of 120 spaces to indent a continuation line 37 | --max-continuation-indent=120 38 | 39 | # -xC120 => max‑code‑length will break a line if the code exceeds # characters 40 | --max-code-length=120 41 | 42 | # -f => 43 | --break-blocks 44 | 45 | # -p => put a space around operators 46 | --pad-oper 47 | 48 | # -xg => Insert space padding after commas 49 | --pad-comma 50 | 51 | # -H => put a space after if/for/while 52 | pad-header 53 | 54 | # -xb => Break one line headers (e.g. if/for/while) 55 | --break-one-line-headers 56 | 57 | # -c => Converts tabs into spaces 58 | #--convert-tabs 59 | 60 | # if you like one-liners, keep them 61 | #keep-one-line-statements 62 | 63 | # -xV 64 | --attach-closing-while 65 | 66 | #unpad-paren 67 | 68 | # -xp 69 | remove-comment-prefix 70 | 71 | -------------------------------------------------------------------------------- /utils/restyle.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for dir in . ; do 4 | find $dir -type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.ino" \) -exec astyle --suffix=none --options=./utils/astyle_library.conf \{\} \; 5 | done 6 | 7 | --------------------------------------------------------------------------------