├── .github └── workflows │ ├── stale.yml │ └── sync_issues.yml ├── .gitignore ├── .gitmodules ├── README.md ├── boards.txt ├── bootloaders ├── Wio_Lite_MG126 │ └── Bootloader_D21.hex ├── XIAOM0 │ ├── bootloader-XIAO_m0-v3.7.0-33-g90ff611-dirty.bin │ ├── update-bootloader-XIAO_m0-v3.7.0-33-g90ff611-dirty.bin │ ├── update-bootloader-XIAO_m0-v3.7.0-33-g90ff611-dirty.ino │ └── update-bootloader-XIAO_m0-v3.7.0-33-g90ff611-dirty.uf2 ├── femtoM0 │ ├── bootloader-femto_m0-v3.7.0-31-seeeduino.bin │ ├── update-bootloader-femto_m0-v3.7.0-31-seeeduino.ino │ └── update-bootloader-femto_m0-v3.7.0-31-seeeduino.uf2 ├── grove_ui_wireless │ ├── update-bootloader-grove_ui_wireless-v3.7.0-34-g65ab8cc-dirty.bin │ ├── update-bootloader-grove_ui_wireless-v3.7.0-34-g65ab8cc-dirty.ino │ └── update-bootloader-grove_ui_wireless-v3.7.0-34-g65ab8cc-dirty.uf2 ├── lorawan │ ├── samd21_sam_ba.bin │ ├── samd21_sam_ba.elf │ └── samd21_sam_ba.hex ├── seeed_zero │ ├── samd21_sam_ba.bin │ ├── samd21_sam_ba.elf │ └── samd21_sam_ba.hex ├── wioGPS │ ├── samd21_sam_ba.bin │ ├── samd21_sam_ba.elf │ └── samd21_sam_ba.hex ├── wio_lte_cat.1 │ └── bootloader-wio_lte_cat.1.bin ├── wio_terminal │ └── bootloader-wio-terminal.bin └── zero │ ├── Makefile │ ├── README.md │ ├── board_definitions.h │ ├── board_definitions_arduino_mkr1000.h │ ├── board_definitions_arduino_mkrfox1200.h │ ├── board_definitions_arduino_mkrgsm1400.h │ ├── board_definitions_arduino_mkrnb1500.h │ ├── board_definitions_arduino_mkrwan1300.h │ ├── board_definitions_arduino_mkrwifi1010.h │ ├── board_definitions_arduino_mkrzero.h │ ├── board_definitions_arduino_zero.h │ ├── board_definitions_genuino_mkr1000.h │ ├── board_definitions_genuino_zero.h │ ├── board_driver_i2c.c │ ├── board_driver_i2c.h │ ├── board_driver_led.c │ ├── board_driver_led.h │ ├── board_driver_pmic.c │ ├── board_driver_pmic.h │ ├── board_driver_serial.c │ ├── board_driver_serial.h │ ├── board_driver_usb.c │ ├── board_driver_usb.h │ ├── board_init.c │ ├── board_startup.c │ ├── bootloader_samd21x18.ld │ ├── build_all_bootloaders.sh │ ├── main.c │ ├── main.h │ ├── sam_ba_cdc.c │ ├── sam_ba_cdc.h │ ├── sam_ba_monitor.c │ ├── sam_ba_monitor.h │ ├── sam_ba_serial.c │ ├── sam_ba_serial.h │ ├── sam_ba_usb.c │ ├── sam_ba_usb.h │ ├── samd21_sam_ba.atsln │ ├── samd21_sam_ba.bin │ ├── samd21_sam_ba.cproj │ ├── samd21_sam_ba.elf │ ├── samd21_sam_ba.hex │ ├── samd21_sam_ba_genuino.bin │ └── samd21_sam_ba_genuino.hex ├── cores └── arduino │ ├── Arduino.h │ ├── Client.h │ ├── HardwareSerial.h │ ├── IPAddress.cpp │ ├── IPAddress.h │ ├── IPv6Address.cpp │ ├── IPv6Address.h │ ├── Print.cpp │ ├── Print.h │ ├── Printable.h │ ├── Reset.cpp │ ├── Reset.h │ ├── Retarget.cpp │ ├── RingBuffer.h │ ├── SERCOM.cpp │ ├── SERCOM.h │ ├── Server.h │ ├── Stream.cpp │ ├── Stream.h │ ├── StreamString.cpp │ ├── StreamString.h │ ├── Tone.cpp │ ├── Tone.h │ ├── USB │ ├── CDC.cpp │ ├── PluggableUSB.cpp │ ├── PluggableUSB.h │ ├── SAMD21_USBDevice.cpp │ ├── SAMD21_USBDevice.h │ ├── SAMR21_USBDevice.h │ ├── USBAPI.h │ ├── USBCore.cpp │ ├── USBCore.h │ ├── USBDesc.h │ ├── USB_host.h │ ├── samd21_host.c │ └── samd21_host.h │ ├── Uart.cpp │ ├── Uart.h │ ├── Udp.h │ ├── WCharacter.h │ ├── WInterrupts.c │ ├── WInterrupts.h │ ├── WMath.cpp │ ├── WMath.h │ ├── WString.cpp │ ├── WString.h │ ├── WVariant.h │ ├── abi.cpp │ ├── avr │ ├── dtostrf.c │ ├── dtostrf.h │ ├── interrupt.h │ ├── io.h │ └── pgmspace.h │ ├── base64.cpp │ ├── base64.h │ ├── binary.h │ ├── cbuf.cpp │ ├── cbuf.h │ ├── cortex_handlers.c │ ├── delay.c │ ├── delay.h │ ├── hooks.c │ ├── itoa.c │ ├── itoa.h │ ├── libb64 │ ├── AUTHORS │ ├── LICENSE │ ├── cdecode.c │ ├── cdecode.h │ ├── cencode.c │ └── cencode.h │ ├── main.cpp │ ├── math_helper.c │ ├── math_helper.h │ ├── new.cpp │ ├── pulse.c │ ├── pulse.h │ ├── pulse_asm.S │ ├── startup.c │ ├── wiring.c │ ├── wiring.h │ ├── wiring_analog.c │ ├── wiring_analog.h │ ├── wiring_constants.h │ ├── wiring_digital.c │ ├── wiring_digital.h │ ├── wiring_private.c │ ├── wiring_private.h │ ├── wiring_pwm.cpp │ ├── wiring_pwm.h │ ├── wiring_shift.c │ └── wiring_shift.h ├── drivers ├── arduino-samd.cat ├── arduino-samd.inf ├── dpinst-amd64.exe ├── dpinst-x86.exe ├── genuino-samd.cat ├── genuino-samd.inf └── prewin10 │ ├── adafruit_circuit_playground_express.cat │ └── adafruit_circuit_playground_express.inf ├── extras ├── pack.hourlybuild.bash ├── pack.pullrequest.bash ├── pack.release.bash ├── package_index.json.Hourly.template ├── package_index.json.PR.template └── post_install.bat ├── keywords.txt ├── libraries ├── Adafruit_ZeroDMA │ ├── Adafruit_ZeroDMA.cpp │ ├── Adafruit_ZeroDMA.h │ ├── LICENSE │ ├── README.md │ ├── examples │ │ ├── zerodma_memcpy │ │ │ └── zerodma_memcpy.ino │ │ ├── zerodma_spi1 │ │ │ └── zerodma_spi1.ino │ │ └── zerodma_spi2 │ │ │ └── zerodma_spi2.ino │ ├── library.properties │ └── utility │ │ └── dma.h ├── EnergySaving │ ├── examples │ │ ├── WakeUpOnExternalInterrupt │ │ │ └── WakeUpOnExternalInterrupt.ino │ │ └── WakeUpOnRTCInterrupt │ │ │ └── WakeUpOnRTCInterrupt.ino │ ├── keywords.txt │ ├── library.properties │ └── src │ │ ├── EnergySaving.cpp │ │ └── EnergySaving.h ├── FlashStorage │ ├── examples │ │ ├── FlashStoreAndRetrieve │ │ │ └── FlashStoreAndRetrieve.ino │ │ └── StoreNameAndSurname │ │ │ └── StoreNameAndSurname.ino │ ├── library.properties │ └── src │ │ ├── FlashStorage.cpp │ │ └── FlashStorage.h ├── HID │ ├── HID.cpp │ ├── HID.h │ ├── keywords.txt │ └── library.properties ├── I2S │ ├── examples │ │ ├── InputSerialPlotter │ │ │ └── InputSerialPlotter.ino │ │ └── SimpleTone │ │ │ └── SimpleTone.ino │ ├── keywords.txt │ ├── library.properties │ └── src │ │ ├── I2S.cpp │ │ ├── I2S.h │ │ └── utility │ │ ├── DMA.cpp │ │ ├── DMA.h │ │ ├── I2SDoubleBuffer.cpp │ │ ├── I2SDoubleBuffer.h │ │ ├── SAMD21_I2SDevice.h │ │ └── SAMD51_I2SDevice.h ├── LoRaWan │ ├── License.txt │ ├── LoRaWan.cpp │ ├── LoRaWan.h │ └── examples │ │ ├── ABP │ │ └── ABP.ino │ │ ├── OTAA │ │ └── OTAA.ino │ │ ├── p2p_rx │ │ └── p2p_rx.ino │ │ └── p2p_tx │ │ └── p2p_tx.ino ├── SPI │ ├── SPI.cpp │ ├── SPI.h │ ├── examples │ │ ├── BarometricPressureSensor │ │ │ └── BarometricPressureSensor.ino │ │ └── DigitalPotControl │ │ │ └── DigitalPotControl.ino │ ├── keywords.txt │ └── library.properties ├── SoftwareSerial │ ├── SoftwareSerial.cpp │ ├── SoftwareSerial.h │ └── examples │ │ ├── SoftwareSerialExample │ │ └── SoftwareSerialExample.ino │ │ └── TwoPortReceive │ │ └── TwoPortReceive.ino ├── TimerTC3 │ ├── TimerTC3.cpp │ ├── TimerTC3.h │ └── examples │ │ └── ISRBlink │ │ └── ISRBlink.ino ├── TimerTCC0 │ ├── TimerTCC0.cpp │ ├── TimerTCC0.h │ └── examples │ │ └── ISRBlink │ │ └── ISRBlink.ino ├── USBHost │ ├── examples │ │ ├── ADKTerminalTest │ │ │ └── ADKTerminalTest.ino │ │ ├── KeyboardController │ │ │ └── KeyboardController.ino │ │ ├── MouseController │ │ │ └── MouseController.ino │ │ └── USB_desc │ │ │ ├── USB_desc.ino │ │ │ └── pgmstrings.h │ ├── keywords.txt │ ├── library.properties │ └── src │ │ ├── KeyboardController.cpp │ │ ├── KeyboardController.h │ │ ├── MouseController.cpp │ │ ├── MouseController.h │ │ ├── Usb.cpp │ │ ├── Usb.h │ │ ├── UsbCore.h │ │ ├── address.h │ │ ├── adk.cpp │ │ ├── adk.h │ │ ├── confdescparser.h │ │ ├── hexdump.h │ │ ├── hid.cpp │ │ ├── hid.h │ │ ├── hidboot.cpp │ │ ├── hidboot.h │ │ ├── hidescriptorparser.cpp │ │ ├── hidescriptorparser.h │ │ ├── hiduniversal.cpp │ │ ├── hiduniversal.h │ │ ├── hidusagestr.h │ │ ├── macros.h │ │ ├── message.cpp │ │ ├── message.h │ │ ├── parsetools.cpp │ │ ├── parsetools.h │ │ ├── printhex.h │ │ ├── sink_parser.h │ │ ├── usb_ch9.h │ │ ├── usbhub.cpp │ │ └── usbhub.h └── Wire │ ├── Wire.cpp │ ├── Wire.h │ ├── examples │ ├── SFRRanger_reader │ │ └── SFRRanger_reader.ino │ ├── digital_potentiometer │ │ └── digital_potentiometer.ino │ ├── master_reader │ │ └── master_reader.ino │ ├── master_writer │ │ └── master_writer.ino │ ├── slave_receiver │ │ └── slave_receiver.ino │ └── slave_sender │ │ └── slave_sender.ino │ ├── keywords.txt │ └── library.properties ├── package.json ├── platform.txt ├── programmers.txt └── variants ├── Wio_LTE_Cat.1 ├── debug_scripts │ └── variant.gdb ├── linker_scripts │ └── gcc │ │ ├── flash_with_bootloader.ld │ │ └── flash_without_bootloader.ld ├── openocd_scripts │ └── Wio_LTE_Cat.cfg ├── pins_arduino.h ├── variant.cpp └── variant.h ├── Wio_Lite_MG126 ├── debug_scripts │ └── variant.gdb ├── linker_scripts │ └── gcc │ │ ├── flash_with_bootloader.ld │ │ └── flash_without_bootloader.ld ├── openocd_scripts │ └── Wio_Lite_MG126.cfg ├── pins_arduino.h ├── variant.cpp └── variant.h ├── XIAO_m0 ├── debug_scripts │ └── variant.gdb ├── linker_scripts │ └── gcc │ │ ├── flash_with_bootloader.ld │ │ └── flash_without_bootloader.ld ├── openocd_scripts │ └── XIAO_m0.cfg ├── pins_arduino.h ├── variant.cpp └── variant.h ├── arduino_zero ├── debug_scripts │ └── variant.gdb ├── linker_scripts │ └── gcc │ │ ├── flash_with_bootloader.ld │ │ └── flash_without_bootloader.ld ├── openocd_scripts │ └── arduino_zero.cfg ├── pins_arduino.h ├── variant.cpp └── variant.h ├── femto_m0 ├── debug_scripts │ └── variant.gdb ├── linker_scripts │ └── gcc │ │ ├── flash_with_bootloader.ld │ │ └── flash_without_bootloader.ld ├── openocd_scripts │ └── femto_m0.cfg ├── pins_arduino.h ├── variant.cpp └── variant.h ├── grove_ui_wireless ├── linker_scripts │ └── gcc │ │ ├── flash_with_bootloader.ld │ │ └── flash_without_bootloader.ld ├── pins_arduino.h ├── variant.cpp └── variant.h ├── wio_terminal ├── linker_scripts │ └── gcc │ │ ├── flash_with_bootloader.ld │ │ └── flash_without_bootloader.ld ├── pins_arduino.h ├── variant.cpp └── variant.h └── zero_radio ├── debug_scripts └── variant.gdb ├── linker_scripts └── gcc │ ├── flash_with_bootloader.ld │ └── flash_without_bootloader.ld ├── openocd_scripts └── zero_radio.cfg ├── pins_arduino.h ├── variant.cpp └── variant.h /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | name: 'Close stale issues and PRs' 2 | 3 | on: 4 | workflow_dispatch: 5 | schedule: 6 | - cron: '0 4 * * *' 7 | 8 | jobs: 9 | stale: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - name: Checkout repository 14 | uses: actions/checkout@v4 15 | 16 | - name: Checkout script repository 17 | uses: actions/checkout@v4 18 | with: 19 | repository: Seeed-Studio/sync-github-all-issues 20 | path: ci 21 | 22 | - name: Run script 23 | run: ./ci/tools/stale.sh 24 | env: 25 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 26 | -------------------------------------------------------------------------------- /.github/workflows/sync_issues.yml: -------------------------------------------------------------------------------- 1 | name: Automate Issue Management 2 | 3 | on: 4 | issues: 5 | types: 6 | - opened 7 | - edited 8 | - assigned 9 | - unassigned 10 | - labeled 11 | - unlabeled 12 | - reopened 13 | 14 | jobs: 15 | add_issue_to_project: 16 | runs-on: ubuntu-latest 17 | steps: 18 | - name: Add issue to GitHub Project 19 | uses: actions/add-to-project@v1.0.2 20 | with: 21 | project-url: https://github.com/orgs/Seeed-Studio/projects/17 22 | github-token: ${{ secrets.ISSUE_ASSEMBLE }} 23 | labeled: bug 24 | label-operator: NOT -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.bz2 2 | *.atsuo 3 | .vscode/ 4 | bootloaders/*/build/ 5 | *~ 6 | git-archive-full.sh -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "drivers/Signed_USB_Serial_Driver"] 2 | path = drivers/Signed_USB_Serial_Driver 3 | url = https://github.com/Seeed-Studio/Signed_USB_Serial_Driver.git 4 | [submodule "libraries/Seeed_Arduino_LCD"] 5 | path = libraries/Seeed_Arduino_LCD 6 | url = https://github.com/Seeed-Studio/Seeed_Arduino_LCD.git 7 | 8 | [submodule "libraries/Seeed_Arduino_FreeRTOS"] 9 | path = libraries/Seeed_Arduino_FreeRTOS 10 | url = https://github.com/Seeed-Studio/Seeed_Arduino_FreeRTOS 11 | [submodule "libraries/Adafruit_TinyUSB_Arduino"] 12 | path = libraries/Adafruit_TinyUSB_Arduino 13 | url = https://github.com/adafruit/Adafruit_TinyUSB_Arduino.git 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Arduino Core for SAMD21 and SAMD51 CPU 2 | 3 | This repository contains the source code and configuration files of the Arduino Core 4 | for Atmel's SAMD21 and SAMD51 processor (used on the Arduino/Genuino Zero, MKR1000 and MKRZero boards). 5 | 6 | In particular, this adds support for the Seeed SAMD Boards such as the Seeeduino XIAO 7 | 8 | ## Bugs or Issues 9 | 10 | 11 | If you find a bug you can submit an issue here on github: 12 | 13 | https://github.com/Seeed-Studio/ArduinoCore-samd 14 | 15 | or if it is an issue with the upstream: 16 | 17 | https://github.com/arduino/ArduinoCore-samd/issues 18 | 19 | Before posting a new issue, please check if the same problem has been already reported by someone else 20 | to avoid duplicates. 21 | 22 | ## License and credits 23 | 24 | This core has been developed by Arduino LLC in collaboration with Atmel. 25 | 26 | ``` 27 | Copyright (c) 2015 Arduino LLC. All right reserved. 28 | 29 | This library is free software; you can redistribute it and/or 30 | modify it under the terms of the GNU Lesser General Public 31 | License as published by the Free Software Foundation; either 32 | version 2.1 of the License, or (at your option) any later version. 33 | 34 | This library is distributed in the hope that it will be useful, 35 | but WITHOUT ANY WARRANTY; without even the implied warranty of 36 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 37 | See the GNU Lesser General Public License for more details. 38 | 39 | You should have received a copy of the GNU Lesser General Public 40 | License along with this library; if not, write to the Free Software 41 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 42 | ``` 43 | -------------------------------------------------------------------------------- /bootloaders/XIAOM0/bootloader-XIAO_m0-v3.7.0-33-g90ff611-dirty.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seeed-Studio/ArduinoCore-samd/d900ef7e959df763a4f56338183964739790f035/bootloaders/XIAOM0/bootloader-XIAO_m0-v3.7.0-33-g90ff611-dirty.bin -------------------------------------------------------------------------------- /bootloaders/XIAOM0/update-bootloader-XIAO_m0-v3.7.0-33-g90ff611-dirty.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seeed-Studio/ArduinoCore-samd/d900ef7e959df763a4f56338183964739790f035/bootloaders/XIAOM0/update-bootloader-XIAO_m0-v3.7.0-33-g90ff611-dirty.bin -------------------------------------------------------------------------------- /bootloaders/XIAOM0/update-bootloader-XIAO_m0-v3.7.0-33-g90ff611-dirty.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seeed-Studio/ArduinoCore-samd/d900ef7e959df763a4f56338183964739790f035/bootloaders/XIAOM0/update-bootloader-XIAO_m0-v3.7.0-33-g90ff611-dirty.uf2 -------------------------------------------------------------------------------- /bootloaders/femtoM0/bootloader-femto_m0-v3.7.0-31-seeeduino.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seeed-Studio/ArduinoCore-samd/d900ef7e959df763a4f56338183964739790f035/bootloaders/femtoM0/bootloader-femto_m0-v3.7.0-31-seeeduino.bin -------------------------------------------------------------------------------- /bootloaders/femtoM0/update-bootloader-femto_m0-v3.7.0-31-seeeduino.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seeed-Studio/ArduinoCore-samd/d900ef7e959df763a4f56338183964739790f035/bootloaders/femtoM0/update-bootloader-femto_m0-v3.7.0-31-seeeduino.uf2 -------------------------------------------------------------------------------- /bootloaders/grove_ui_wireless/update-bootloader-grove_ui_wireless-v3.7.0-34-g65ab8cc-dirty.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seeed-Studio/ArduinoCore-samd/d900ef7e959df763a4f56338183964739790f035/bootloaders/grove_ui_wireless/update-bootloader-grove_ui_wireless-v3.7.0-34-g65ab8cc-dirty.bin -------------------------------------------------------------------------------- /bootloaders/grove_ui_wireless/update-bootloader-grove_ui_wireless-v3.7.0-34-g65ab8cc-dirty.uf2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seeed-Studio/ArduinoCore-samd/d900ef7e959df763a4f56338183964739790f035/bootloaders/grove_ui_wireless/update-bootloader-grove_ui_wireless-v3.7.0-34-g65ab8cc-dirty.uf2 -------------------------------------------------------------------------------- /bootloaders/lorawan/samd21_sam_ba.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seeed-Studio/ArduinoCore-samd/d900ef7e959df763a4f56338183964739790f035/bootloaders/lorawan/samd21_sam_ba.bin -------------------------------------------------------------------------------- /bootloaders/lorawan/samd21_sam_ba.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seeed-Studio/ArduinoCore-samd/d900ef7e959df763a4f56338183964739790f035/bootloaders/lorawan/samd21_sam_ba.elf -------------------------------------------------------------------------------- /bootloaders/seeed_zero/samd21_sam_ba.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seeed-Studio/ArduinoCore-samd/d900ef7e959df763a4f56338183964739790f035/bootloaders/seeed_zero/samd21_sam_ba.bin -------------------------------------------------------------------------------- /bootloaders/seeed_zero/samd21_sam_ba.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seeed-Studio/ArduinoCore-samd/d900ef7e959df763a4f56338183964739790f035/bootloaders/seeed_zero/samd21_sam_ba.elf -------------------------------------------------------------------------------- /bootloaders/wioGPS/samd21_sam_ba.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seeed-Studio/ArduinoCore-samd/d900ef7e959df763a4f56338183964739790f035/bootloaders/wioGPS/samd21_sam_ba.bin -------------------------------------------------------------------------------- /bootloaders/wioGPS/samd21_sam_ba.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seeed-Studio/ArduinoCore-samd/d900ef7e959df763a4f56338183964739790f035/bootloaders/wioGPS/samd21_sam_ba.elf -------------------------------------------------------------------------------- /bootloaders/wio_lte_cat.1/bootloader-wio_lte_cat.1.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seeed-Studio/ArduinoCore-samd/d900ef7e959df763a4f56338183964739790f035/bootloaders/wio_lte_cat.1/bootloader-wio_lte_cat.1.bin -------------------------------------------------------------------------------- /bootloaders/wio_terminal/bootloader-wio-terminal.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seeed-Studio/ArduinoCore-samd/d900ef7e959df763a4f56338183964739790f035/bootloaders/wio_terminal/bootloader-wio-terminal.bin -------------------------------------------------------------------------------- /bootloaders/zero/README.md: -------------------------------------------------------------------------------- 1 | # Arduino Zero Bootloader 2 | 3 | ## 1- Prerequisites 4 | 5 | The project build is based on Makefile system. 6 | Makefile is present at project root and try to handle multi-platform cases. 7 | 8 | Multi-plaform GCC is provided by ARM here: https://launchpad.net/gcc-arm-embedded/+download 9 | 10 | Atmel Studio contains both make and ARM GCC toolchain. You don't need to install them in this specific use case. 11 | 12 | ### Windows 13 | 14 | * Native command line 15 | Make binary can be obtained here: http://gnuwin32.sourceforge.net/packages/make.htm 16 | 17 | * Cygwin/MSys/MSys2/Babun/etc... 18 | It is available natively in all distributions. 19 | 20 | * Atmel Studio 21 | An Atmel Studio **7** Makefile-based project is present at project root, just open samd21_sam_ba.atsln file in AS7. 22 | 23 | ### Linux 24 | 25 | Make is usually available by default. 26 | 27 | ### OS X 28 | 29 | Make is available through XCode package. 30 | 31 | 32 | ## 2- Selecting available SAM-BA interfaces 33 | 34 | By default both USB and UART are made available, but this parameter can be modified in sam_ba_monitor.h, line 31: 35 | 36 | Set the define SAM_BA_INTERFACE to 37 | * SAM_BA_UART_ONLY for only UART interface 38 | * SAM_BA_USBCDC_ONLY for only USB CDC interface 39 | * SAM_BA_BOTH_INTERFACES for enabling both the interfaces 40 | 41 | ## 3- Behaviour 42 | 43 | This bootloader implements the double-tap on Reset button. 44 | By quickly pressing this button two times, the board will reset and stay in bootloader, waiting for communication on either USB or USART. 45 | 46 | The USB port in use is the USB Native port, close to the Reset button. 47 | The USART in use is the one available on pins D0/D1, labelled respectively RX/TX. Communication parameters are a baudrate at 115200, 8bits of data, no parity and 1 stop bit (8N1). 48 | 49 | ## 4- Description 50 | 51 | **Pinmap** 52 | 53 | The following pins are used by the program : 54 | PA25 : input/output (USB DP) 55 | PA24 : input/output (USB DM) 56 | PA11 : input (USART RX) 57 | PA10 : output (USART TX) 58 | 59 | The application board shall avoid driving the PA25, PA24, PB23 and PB22 signals while the boot program is running (after a POR for example). 60 | 61 | **Clock system** 62 | 63 | CPU runs at 48MHz from Generic Clock Generator 0 on DFLL48M. 64 | 65 | Generic Clock Generator 1 is using external 32kHz oscillator and is the source of DFLL48M. 66 | 67 | USB and USART are using Generic Clock Generator 0 also. 68 | 69 | **Memory Mapping** 70 | 71 | Bootloader code will be located at 0x0 and executed before any applicative code. 72 | 73 | Applications compiled to be executed along with the bootloader will start at 0x2000 (see linker script bootloader_samd21x18.ld). 74 | 75 | Before jumping to the application, the bootloader changes the VTOR register to use the interrupt vectors of the application @0x2000.<- not required as application code is taking care of this. 76 | -------------------------------------------------------------------------------- /bootloaders/zero/board_driver_i2c.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 Arduino LLC. All right reserved. 3 | Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. 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. 13 | See the GNU 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 _BOARD_DRIVER_I2C_ 21 | #define _BOARD_DRIVER_I2C_ 22 | 23 | #include 24 | #include 25 | #include "board_definitions.h" 26 | 27 | void i2c_init(uint32_t baud); 28 | void i2c_end(); 29 | uint8_t i2c_requestFrom(uint8_t address, uint8_t quantity, bool stopBit); 30 | void i2c_beginTransmission(uint8_t address); 31 | uint8_t i2c_endTransmission(bool stopBit); 32 | uint8_t i2c_write(uint8_t ucData); 33 | 34 | 35 | #endif // _BOARD_DRIVER_I2C_ 36 | -------------------------------------------------------------------------------- /bootloaders/zero/board_driver_led.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 Arduino LLC. All right reserved. 3 | Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. 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. 13 | See the GNU 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 | #include "board_driver_led.h" 21 | 22 | 23 | -------------------------------------------------------------------------------- /bootloaders/zero/board_driver_led.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 Arduino LLC. All right reserved. 3 | Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. 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. 13 | See the GNU 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 _BOARD_DRIVER_LED_ 21 | #define _BOARD_DRIVER_LED_ 22 | 23 | #include 24 | #include "board_definitions.h" 25 | 26 | inline void LED_init(void) { PORT->Group[BOARD_LED_PORT].DIRSET.reg = (1<Group[BOARD_LED_PORT].OUTSET.reg = (1<Group[BOARD_LED_PORT].OUTCLR.reg = (1<Group[BOARD_LED_PORT].OUTTGL.reg = (1<Group[BOARD_LEDRX_PORT].DIRSET.reg = (1<Group[BOARD_LEDRX_PORT].OUTSET.reg = (1<Group[BOARD_LEDRX_PORT].OUTCLR.reg = (1<Group[BOARD_LEDRX_PORT].OUTTGL.reg = (1<Group[BOARD_LEDTX_PORT].DIRSET.reg = (1<Group[BOARD_LEDTX_PORT].OUTSET.reg = (1<Group[BOARD_LEDTX_PORT].OUTCLR.reg = (1<Group[BOARD_LEDTX_PORT].OUTTGL.reg = (1< 24 | #include 25 | #include "board_definitions.h" 26 | 27 | //Default PMIC (BQ24195) I2C address 28 | #define PMIC_ADDRESS 0x6B 29 | 30 | // Register address definitions 31 | #define INPUT_SOURCE_REGISTER 0x00 32 | #define POWERON_CONFIG_REGISTER 0x01 33 | #define CHARGE_CURRENT_CONTROL_REGISTER 0x02 34 | #define PRECHARGE_CURRENT_CONTROL_REGISTER 0x03 35 | #define CHARGE_VOLTAGE_CONTROL_REGISTER 0x04 36 | #define CHARGE_TIMER_CONTROL_REGISTER 0x05 37 | #define THERMAL_REG_CONTROL_REGISTER 0x06 38 | #define MISC_CONTROL_REGISTER 0x07 39 | #define SYSTEM_STATUS_REGISTER 0x08 40 | #define FAULT_REGISTER 0x09 41 | #define PMIC_VERSION_REGISTER 0x0A 42 | 43 | void configure_pmic(); 44 | 45 | #endif // _BOARD_DRIVER_PMIC_ 46 | -------------------------------------------------------------------------------- /bootloaders/zero/board_driver_serial.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 Arduino LLC. All right reserved. 3 | Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. 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. 13 | See the GNU 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 UART_DRIVER_H 21 | #define UART_DRIVER_H 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | #define PINMUX_UNUSED 0xFFFFFFFF 28 | #define GCLK_ID_SERCOM0_CORE 0x14 29 | 30 | /* SERCOM UART available pad settings */ 31 | enum uart_pad_settings { 32 | UART_RX_PAD0_TX_PAD2 = SERCOM_USART_CTRLA_RXPO(0) | SERCOM_USART_CTRLA_TXPO(1), 33 | UART_RX_PAD1_TX_PAD2 = SERCOM_USART_CTRLA_RXPO(1) | SERCOM_USART_CTRLA_TXPO(1), 34 | UART_RX_PAD2_TX_PAD0 = SERCOM_USART_CTRLA_RXPO(2), 35 | UART_RX_PAD3_TX_PAD0 = SERCOM_USART_CTRLA_RXPO(3), 36 | UART_RX_PAD1_TX_PAD0 = SERCOM_USART_CTRLA_RXPO(1), 37 | UART_RX_PAD3_TX_PAD2 = SERCOM_USART_CTRLA_RXPO(3) | SERCOM_USART_CTRLA_TXPO(1), 38 | }; 39 | 40 | /** 41 | * \brief Initializes the UART 42 | * 43 | * \param Pointer to SERCOM instance 44 | * \param Baud value corresponding to the desired baudrate 45 | * \param SERCOM pad settings 46 | */ 47 | void uart_basic_init(Sercom *sercom, uint16_t baud_val, enum uart_pad_settings pad_conf); 48 | 49 | /** 50 | * \brief Disables UART interface 51 | * 52 | * \param Pointer to SERCOM instance 53 | */ 54 | void uart_disable(Sercom *sercom); 55 | 56 | /** 57 | * \brief Sends a single byte through UART interface 58 | * 59 | * \param Pointer to SERCOM instance 60 | * \param Data to send 61 | */ 62 | void uart_write_byte(Sercom *sercom, uint8_t data); 63 | 64 | /** 65 | * \brief Reads a single character from UART interface 66 | * 67 | * \param Pointer to SERCOM instance 68 | * \return Data byte read 69 | */ 70 | uint8_t uart_read_byte(Sercom *sercom); 71 | 72 | /** 73 | * \brief Sends buffer on UART interface 74 | * 75 | * \param Pointer to SERCOM instance 76 | * \param Pointer to data to send 77 | * \param Number of bytes to send 78 | */ 79 | void uart_write_buffer_polled(Sercom *sercom, uint8_t *ptr, uint16_t length); 80 | 81 | /** 82 | * \brief Reads data on UART interface 83 | * 84 | * \param Pointer to SERCOM instance 85 | * \param Pointer to store read data 86 | * \param Number of bytes to read 87 | */ 88 | void uart_read_buffer_polled(Sercom *sercom, uint8_t *ptr, uint16_t length); 89 | 90 | #endif 91 | -------------------------------------------------------------------------------- /bootloaders/zero/board_driver_usb.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 Arduino LLC. All right reserved. 3 | Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. 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. 13 | See the GNU 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 _BOARD_DRIVER_USB_H_ 21 | #define _BOARD_DRIVER_USB_H_ 22 | 23 | #include "sam_ba_cdc.h" 24 | 25 | extern UsbDeviceDescriptor usb_endpoint_table[MAX_EP]; 26 | extern uint8_t udd_ep_out_cache_buffer[2][64]; //1 for CTRL, 1 for BULK 27 | extern uint8_t udd_ep_in_cache_buffer[2][64]; //1 for CTRL, 1 for BULK 28 | 29 | P_USB_CDC USB_Open(P_USB_CDC pCdc, Usb *pUsb); 30 | 31 | void USB_Init(void); 32 | 33 | uint32_t USB_Write(Usb *pUsb, const char *pData, uint32_t length, uint8_t ep_num); 34 | uint32_t USB_Read(Usb *pUsb, char *pData, uint32_t length); 35 | uint32_t USB_Read_blocking(Usb *pUsb, char *pData, uint32_t length); 36 | 37 | uint8_t USB_IsConfigured(P_USB_CDC pCdc); 38 | 39 | void USB_SendStall(Usb *pUsb, bool direction_in); 40 | void USB_SendZlp(Usb *pUsb); 41 | 42 | void USB_SetAddress(Usb *pUsb, uint16_t wValue); 43 | void USB_Configure(Usb *pUsb); 44 | 45 | #endif // _BOARD_DRIVER_USB_H_ 46 | -------------------------------------------------------------------------------- /bootloaders/zero/build_all_bootloaders.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | 3 | BOARD_ID=arduino_zero NAME=samd21_sam_ba make clean all 4 | 5 | BOARD_ID=genuino_zero NAME=samd21_sam_ba_genuino make clean all 6 | 7 | BOARD_ID=arduino_mkr1000 NAME=samd21_sam_ba_arduino_mkr1000 make clean all 8 | mv -v samd21_sam_ba_arduino_mkr1000.* ../mkr1000/ 9 | 10 | BOARD_ID=genuino_mkr1000 NAME=samd21_sam_ba_genuino_mkr1000 make clean all 11 | mv -v samd21_sam_ba_genuino_mkr1000.* ../mkr1000/ 12 | 13 | BOARD_ID=arduino_mkrzero NAME=samd21_sam_ba_arduino_mkrzero make clean all 14 | mv -v samd21_sam_ba_arduino_mkrzero.* ../mkrzero/ 15 | 16 | BOARD_ID=arduino_mkrfox1200 NAME=samd21_sam_ba_arduino_mkrfox1200 make clean all 17 | mv -v samd21_sam_ba_arduino_mkrfox1200.* ../mkrfox1200/ 18 | 19 | BOARD_ID=arduino_mkrgsm1400 NAME=samd21_sam_ba_arduino_mkrgsm1400 make clean all 20 | mv -v samd21_sam_ba_arduino_mkrgsm1400.* ../mkrgsm1400/ 21 | 22 | BOARD_ID=arduino_mkrwan1300 NAME=samd21_sam_ba_arduino_mkrwan1300 make clean all 23 | mv -v samd21_sam_ba_arduino_mkrwan1300.* ../mkrwan1300/ 24 | 25 | BOARD_ID=arduino_mkrwifi1010 NAME=samd21_sam_ba_arduino_mkrwifi1010 make clean all 26 | mv -v samd21_sam_ba_arduino_mkrwifi1010.* ../mkrwifi1010/ 27 | 28 | BOARD_ID=arduino_mkrnb1500 NAME=samd21_sam_ba_arduino_mkrnb1500 make clean all 29 | mv -v samd21_sam_ba_arduino_mkrnb1500.* ../mkrnb1500/ 30 | 31 | echo Done building bootloaders! 32 | 33 | -------------------------------------------------------------------------------- /bootloaders/zero/sam_ba_cdc.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 Arduino LLC. All right reserved. 3 | Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. 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. 13 | See the GNU 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 _SAM_BA_USB_CDC_H_ 21 | #define _SAM_BA_USB_CDC_H_ 22 | 23 | #include 24 | #include "sam_ba_usb.h" 25 | 26 | typedef struct 27 | { 28 | uint32_t dwDTERate; 29 | uint8_t bCharFormat; 30 | uint8_t bParityType; 31 | uint8_t bDataBits; 32 | } usb_cdc_line_coding_t; 33 | 34 | /* CDC Class Specific Request Code */ 35 | #define GET_LINE_CODING 0x21A1 36 | #define SET_LINE_CODING 0x2021 37 | #define SET_CONTROL_LINE_STATE 0x2221 38 | 39 | extern usb_cdc_line_coding_t line_coding; 40 | 41 | 42 | /** 43 | * \brief Sends a single byte through USB CDC 44 | * 45 | * \param Data to send 46 | * \return number of data sent 47 | */ 48 | int cdc_putc(/*P_USB_CDC pCdc,*/ int value); 49 | 50 | /** 51 | * \brief Reads a single byte through USB CDC 52 | * 53 | * \return Data read through USB 54 | */ 55 | int cdc_getc(/*P_USB_CDC pCdc*/); 56 | 57 | /** 58 | * \brief Checks if a character has been received on USB CDC 59 | * 60 | * \return \c 1 if a byte is ready to be read. 61 | */ 62 | bool cdc_is_rx_ready(/*P_USB_CDC pCdc*/); 63 | 64 | /** 65 | * \brief Sends buffer on USB CDC 66 | * 67 | * \param data pointer 68 | * \param number of data to send 69 | * \return number of data sent 70 | */ 71 | uint32_t cdc_write_buf(/*P_USB_CDC pCdc,*/ void const* data, uint32_t length); 72 | 73 | /** 74 | * \brief Gets data on USB CDC 75 | * 76 | * \param data pointer 77 | * \param number of data to read 78 | * \return number of data read 79 | */ 80 | uint32_t cdc_read_buf(/*P_USB_CDC pCdc,*/ void* data, uint32_t length); 81 | 82 | /** 83 | * \brief Gets specified number of bytes on USB CDC 84 | * 85 | * \param data pointer 86 | * \param number of data to read 87 | * \return number of data read 88 | */ 89 | uint32_t cdc_read_buf_xmd(/*P_USB_CDC pCdc,*/ void* data, uint32_t length); 90 | 91 | #endif // _SAM_BA_USB_CDC_H_ 92 | -------------------------------------------------------------------------------- /bootloaders/zero/sam_ba_monitor.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 Arduino LLC. All right reserved. 3 | Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. 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. 13 | See the GNU 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 _MONITOR_SAM_BA_H_ 21 | #define _MONITOR_SAM_BA_H_ 22 | 23 | #define SAM_BA_VERSION "2.0" 24 | 25 | /* Enable the interfaces to save code size */ 26 | #define SAM_BA_BOTH_INTERFACES 0 27 | #define SAM_BA_UART_ONLY 1 28 | #define SAM_BA_USBCDC_ONLY 2 29 | 30 | #ifndef SAM_BA_INTERFACE 31 | #define SAM_BA_INTERFACE SAM_BA_BOTH_INTERFACES 32 | #endif 33 | 34 | /* Selects USB as the communication interface of the monitor */ 35 | #define SAM_BA_INTERFACE_USBCDC 0 36 | /* Selects USART as the communication interface of the monitor */ 37 | #define SAM_BA_INTERFACE_USART 1 38 | 39 | /* Selects USB as the communication interface of the monitor */ 40 | #define SIZEBUFMAX 64 41 | 42 | /** 43 | * \brief Initialize the monitor 44 | * 45 | */ 46 | void sam_ba_monitor_init(uint8_t com_interface); 47 | 48 | /** 49 | * \brief System tick function of the SAM-BA Monitor 50 | * 51 | */ 52 | void sam_ba_monitor_sys_tick(void); 53 | 54 | /** 55 | * \brief Main function of the SAM-BA Monitor 56 | * 57 | */ 58 | void sam_ba_monitor_run(void); 59 | 60 | /** 61 | * \brief 62 | * 63 | */ 64 | void sam_ba_putdata_term(uint8_t* data, uint32_t length); 65 | 66 | /** 67 | * \brief 68 | * 69 | */ 70 | void call_applet(uint32_t address); 71 | 72 | #endif // _MONITOR_SAM_BA_H_ 73 | -------------------------------------------------------------------------------- /bootloaders/zero/samd21_sam_ba.atsln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Atmel Studio Solution File, Format Version 11.00 4 | VisualStudioVersion = 14.0.23107.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "samd21_sam_ba", "samd21_sam_ba.cproj", "{DCE6C7E3-EE26-4D79-826B-08594B9AD897}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|ARM = Debug|ARM 11 | Release|ARM = Release|ARM 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|ARM.ActiveCfg = Debug|ARM 15 | {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|ARM.Build.0 = Debug|ARM 16 | {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|ARM.ActiveCfg = Release|ARM 17 | {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|ARM.Build.0 = Release|ARM 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /bootloaders/zero/samd21_sam_ba.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seeed-Studio/ArduinoCore-samd/d900ef7e959df763a4f56338183964739790f035/bootloaders/zero/samd21_sam_ba.bin -------------------------------------------------------------------------------- /bootloaders/zero/samd21_sam_ba.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seeed-Studio/ArduinoCore-samd/d900ef7e959df763a4f56338183964739790f035/bootloaders/zero/samd21_sam_ba.elf -------------------------------------------------------------------------------- /bootloaders/zero/samd21_sam_ba_genuino.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seeed-Studio/ArduinoCore-samd/d900ef7e959df763a4f56338183964739790f035/bootloaders/zero/samd21_sam_ba_genuino.bin -------------------------------------------------------------------------------- /cores/arduino/Client.h: -------------------------------------------------------------------------------- 1 | /* 2 | Client.h - Base class that provides Client 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 client_h 21 | #define client_h 22 | #include "Print.h" 23 | #include "Stream.h" 24 | #include "IPAddress.h" 25 | 26 | class Client : public Stream { 27 | 28 | public: 29 | virtual int connect(IPAddress ip, uint16_t port) =0; 30 | virtual int connect(const char *host, uint16_t port) =0; 31 | virtual size_t write(uint8_t) =0; 32 | virtual size_t write(const uint8_t *buf, size_t size) =0; 33 | virtual int available() = 0; 34 | virtual int read() = 0; 35 | virtual int read(uint8_t *buf, size_t size) = 0; 36 | virtual int peek() = 0; 37 | virtual void flush() = 0; 38 | virtual void stop() = 0; 39 | virtual uint8_t connected() = 0; 40 | virtual operator bool() = 0; 41 | protected: 42 | uint8_t* rawIPAddress(IPAddress& addr) { return addr.raw_address(); }; 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /cores/arduino/Printable.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 Arduino. 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 | #ifndef Printable_h 20 | #define Printable_h 21 | 22 | #include 23 | 24 | class Print; 25 | 26 | /** The Printable class provides a way for new classes to allow themselves to be printed. 27 | By deriving from Printable and implementing the printTo method, it will then be possible 28 | for users to print out instances of this class by passing them into the usual 29 | Print::print and Print::println methods. 30 | */ 31 | 32 | class Printable 33 | { 34 | public: 35 | virtual size_t printTo(Print& p) const = 0; 36 | }; 37 | 38 | #endif 39 | 40 | -------------------------------------------------------------------------------- /cores/arduino/Reset.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 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 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | void initiateReset(int ms); 26 | void tickReset(); 27 | void cancelReset(); 28 | 29 | #ifdef __cplusplus 30 | } 31 | #endif 32 | -------------------------------------------------------------------------------- /cores/arduino/Retarget.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License (MIT) 3 | * Copyright (C) 2019-2020 Seeed Technology Co.,Ltd. 4 | */ 5 | #include "Arduino.h" 6 | #include 7 | #include 8 | 9 | #ifdef __cplusplus 10 | extern "C" { 11 | #endif 12 | 13 | // libnosys.a provide all the symbols except _write 14 | // with gcc linker option "--specs=nosys.specs --wrap,_write" 15 | 16 | #if 0 17 | int _close (int fd) { 18 | return 0; 19 | } 20 | 21 | void _exit (int status) { 22 | return; 23 | } 24 | 25 | int _fstat (int fd, struct stat *st) { 26 | return 0; 27 | } 28 | 29 | int _isatty(int fd) { 30 | return 1; 31 | } 32 | 33 | int _lseek (int file, int ptr, int dir) { 34 | return 0; 35 | } 36 | 37 | int _read (int fd, char *ptr, int len) { 38 | return len; 39 | } 40 | 41 | /* 42 | void _ttywrch(int ch) { 43 | Serial.write((char)ch); 44 | return; 45 | } 46 | */ 47 | 48 | int _kill(void) {} 49 | 50 | int _getpid(void) {} 51 | #endif 52 | 53 | extern int __real__write (int fd, const char *ptr, int len); 54 | 55 | int __wrap__write (int fd, const char *ptr, int len) { 56 | (void)fd; // UNUSED 57 | 58 | #if defined(DEBUG) && DEBUG 59 | static int serial_init = 0; 60 | if (!serial_init) { 61 | SERIAL_PORT_HARDWARE.begin(115200); 62 | serial_init = 1; 63 | } 64 | 65 | if (!SERIAL_PORT_HARDWARE) { 66 | return len; 67 | } 68 | 69 | for (int i = 0; i < len; i++) { 70 | SERIAL_PORT_HARDWARE.write(ptr[i]); 71 | } 72 | #endif 73 | return len; 74 | } 75 | 76 | int __debug_buf(const char* head, char* buf, int len) { 77 | int i; 78 | 79 | printf("\nDBG:%s[%d] = \r\n\t", head, len); 80 | for (i = 0; i < len; i++) { 81 | printf("%.2X ", buf[i]); 82 | if ((i & 0xFUL) == 0xFUL && i != len - 1) { 83 | printf("\r\n\t"); 84 | } 85 | } 86 | printf("\r\n"); 87 | return len; 88 | } 89 | 90 | #ifdef __cplusplus 91 | } 92 | #endif 93 | -------------------------------------------------------------------------------- /cores/arduino/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 | public: 27 | virtual void begin() =0; 28 | }; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /cores/arduino/StreamString.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | StreamString.cpp 3 | 4 | Copyright (c) 2015 Markus Sattler. All rights reserved. 5 | This file is part of the esp8266 core for Arduino environment. 6 | 7 | This library is free software; you can redistribute it and/or 8 | modify it under the terms of the GNU Lesser General Public 9 | License as published by the Free Software Foundation; either 10 | version 2.1 of the License, or (at your option) any later version. 11 | 12 | This library is distributed in the hope that it will be useful, 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | Lesser General Public License for more details. 16 | 17 | You should have received a copy of the GNU Lesser General Public 18 | License along with this library; if not, write to the Free Software 19 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 | 21 | */ 22 | 23 | #include 24 | #include "StreamString.h" 25 | 26 | size_t StreamString::write(const uint8_t *data, size_t size) { 27 | if(size && data) { 28 | const unsigned int newlen = length() + size; 29 | if(reserve(newlen + 1)) { 30 | memcpy((void *) (buffer + len), (const void *) data, size); 31 | len = newlen; 32 | *(buffer + newlen) = 0x00; // add null for string end 33 | return size; 34 | } 35 | } 36 | return 0; 37 | } 38 | 39 | size_t StreamString::write(uint8_t data) { 40 | return concat((char) data); 41 | } 42 | 43 | int StreamString::available() { 44 | return length(); 45 | } 46 | 47 | int StreamString::read() { 48 | if(length()) { 49 | char c = charAt(0); 50 | remove(0, 1); 51 | return c; 52 | 53 | } 54 | return -1; 55 | } 56 | 57 | int StreamString::peek() { 58 | if(length()) { 59 | char c = charAt(0); 60 | return c; 61 | } 62 | return -1; 63 | } 64 | 65 | void StreamString::flush() { 66 | } 67 | 68 | -------------------------------------------------------------------------------- /cores/arduino/StreamString.h: -------------------------------------------------------------------------------- 1 | /** 2 | StreamString.h 3 | 4 | Copyright (c) 2015 Markus Sattler. All rights reserved. 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library 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 GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this library; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | 20 | */ 21 | 22 | #ifndef STREAMSTRING_H_ 23 | #define STREAMSTRING_H_ 24 | 25 | 26 | class StreamString: public Stream, public String 27 | { 28 | public: 29 | size_t write(const uint8_t *buffer, size_t size) override; 30 | size_t write(uint8_t data) override; 31 | 32 | int available() override; 33 | int read() override; 34 | int peek() override; 35 | void flush() override; 36 | }; 37 | 38 | 39 | #endif /* STREAMSTRING_H_ */ 40 | -------------------------------------------------------------------------------- /cores/arduino/Tone.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 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 | #ifdef __cplusplus 22 | 23 | #include "Arduino.h" 24 | 25 | void tone(uint32_t _pin, uint32_t frequency, uint32_t duration = 0); 26 | void noTone(uint32_t _pin); 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /cores/arduino/USB/PluggableUSB.h: -------------------------------------------------------------------------------- 1 | /* 2 | PluggableUSB.h 3 | Copyright (c) 2015 Arduino LLC 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 PUSB_h 21 | #define PUSB_h 22 | 23 | #include "USBAPI.h" 24 | #include 25 | 26 | #if defined(USBCON) 27 | 28 | class PluggableUSBModule { 29 | public: 30 | PluggableUSBModule(uint8_t numEps, uint8_t numIfs, uint32_t *epType) : 31 | numEndpoints(numEps), numInterfaces(numIfs), endpointType(epType) 32 | { } 33 | 34 | protected: 35 | virtual bool setup(USBSetup& setup) = 0; 36 | virtual int getInterface(uint8_t* interfaceCount) = 0; 37 | virtual int getDescriptor(USBSetup& setup) = 0; 38 | virtual int handleEndpoint(int ep) { (void)ep;/* Do nothing */; return 0; } 39 | virtual uint8_t getShortName(char *name) { name[0] = 'A'+pluggedInterface; return 1; } 40 | 41 | uint8_t pluggedInterface; 42 | uint8_t pluggedEndpoint; 43 | 44 | const uint8_t numEndpoints; 45 | const uint8_t numInterfaces; 46 | const uint32_t *endpointType; 47 | 48 | PluggableUSBModule *next = NULL; 49 | 50 | friend class PluggableUSB_; 51 | }; 52 | 53 | class PluggableUSB_ { 54 | public: 55 | PluggableUSB_(); 56 | bool plug(PluggableUSBModule *node); 57 | int getInterface(uint8_t* interfaceCount); 58 | int getDescriptor(USBSetup& setup); 59 | bool setup(USBSetup& setup); 60 | int handleEndpoint(int ep); 61 | uint8_t getShortName(char *iSerialNum); 62 | 63 | private: 64 | uint8_t lastIf; 65 | uint8_t lastEp; 66 | PluggableUSBModule* rootNode; 67 | }; 68 | 69 | // Replacement for global singleton. 70 | // This function prevents static-initialization-order-fiasco 71 | // https://isocpp.org/wiki/faq/ctors#static-init-order-on-first-use 72 | PluggableUSB_& PluggableUSB(); 73 | 74 | #endif 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /cores/arduino/USB/SAMD21_USBDevice.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * SAMD21_USBDevice.cpp 3 | * 4 | * Created on: Feb 21, 2018 5 | * Author: deanm 6 | */ 7 | 8 | #ifndef USE_TINYUSB 9 | 10 | #include "SAMD21_USBDevice.h" 11 | 12 | void USBDevice_SAMD21G18x::reset() { 13 | usb.CTRLA.bit.SWRST = 1; 14 | memset(EP, 0, sizeof(EP)); 15 | while (usb.SYNCBUSY.bit.SWRST || usb.SYNCBUSY.bit.ENABLE) {} 16 | usb.DESCADD.reg = (uint32_t)(&EP); 17 | } 18 | 19 | void USBDevice_SAMD21G18x::calibrate() { 20 | // Load Pad Calibration data from non-volatile memory 21 | uint32_t *pad_transn_p = (uint32_t *) USB_FUSES_TRANSN_ADDR; 22 | uint32_t *pad_transp_p = (uint32_t *) USB_FUSES_TRANSP_ADDR; 23 | uint32_t *pad_trim_p = (uint32_t *) USB_FUSES_TRIM_ADDR; 24 | 25 | uint32_t pad_transn = (*pad_transn_p & USB_FUSES_TRANSN_Msk) >> USB_FUSES_TRANSN_Pos; 26 | uint32_t pad_transp = (*pad_transp_p & USB_FUSES_TRANSP_Msk) >> USB_FUSES_TRANSP_Pos; 27 | uint32_t pad_trim = (*pad_trim_p & USB_FUSES_TRIM_Msk ) >> USB_FUSES_TRIM_Pos; 28 | 29 | if (pad_transn == 0x1F) // maximum value (31) 30 | pad_transn = 5; 31 | if (pad_transp == 0x1F) // maximum value (31) 32 | pad_transp = 29; 33 | if (pad_trim == 0x7) // maximum value (7) 34 | pad_trim = 3; 35 | 36 | usb.PADCAL.bit.TRANSN = pad_transn; 37 | usb.PADCAL.bit.TRANSP = pad_transp; 38 | usb.PADCAL.bit.TRIM = pad_trim; 39 | } 40 | 41 | #endif // USE_TINYUSB 42 | -------------------------------------------------------------------------------- /cores/arduino/USB/USBDesc.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 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 | #ifndef __USBDESC_H__ 20 | #define __USBDESC_H__ 21 | 22 | // CDC or HID can be enabled together. 23 | #define CDC_ENABLED 24 | #define PLUGGABLE_USB_ENABLED 25 | 26 | #ifdef CDC_ENABLED 27 | #define CDC_INTERFACE_COUNT 2 28 | #define CDC_ENPOINT_COUNT 3 29 | #else 30 | #define CDC_INTERFACE_COUNT 0 31 | #define CDC_ENPOINT_COUNT 0 32 | #endif 33 | 34 | // CDC 35 | #define CDC_ACM_INTERFACE 0 // CDC ACM 36 | #define CDC_DATA_INTERFACE 1 // CDC Data 37 | #define CDC_FIRST_ENDPOINT 1 38 | #define CDC_ENDPOINT_ACM 1 39 | #define CDC_ENDPOINT_OUT 2 40 | #define CDC_ENDPOINT_IN 3 41 | 42 | #ifdef CDC_ENABLED 43 | #define CDC_RX CDC_ENDPOINT_OUT 44 | #define CDC_TX CDC_ENDPOINT_IN 45 | #endif 46 | 47 | #define ISERIAL_MAX_LEN 65 48 | 49 | // Defined string description 50 | #define IMANUFACTURER 1 51 | #define IPRODUCT 2 52 | #define ISERIAL 3 53 | 54 | #endif /* __USBDESC_H__ */ 55 | -------------------------------------------------------------------------------- /cores/arduino/USB/USB_host.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 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 | #ifndef USB_HOST_H_INCLUDED 20 | #define USB_HOST_H_INCLUDED 21 | 22 | #include 23 | #include "samd21_host.h" 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | #define tokSETUP USB_HOST_PCFG_PTOKEN_SETUP 29 | #define tokIN USB_HOST_PCFG_PTOKEN_IN 30 | #define tokOUT USB_HOST_PCFG_PTOKEN_OUT 31 | #define tokINHS USB_HOST_PCFG_PTOKEN_IN 32 | #define tokOUTHS USB_HOST_PCFG_PTOKEN_OUT 33 | 34 | //! \brief Device speed 35 | /*typedef enum { 36 | UHD_SPEED_LOW = 0, 37 | UHD_SPEED_FULL = 1, 38 | UHD_SPEED_HIGH = 2, 39 | } uhd_speed_t;*/ 40 | 41 | //! States of USBB interface 42 | typedef enum { 43 | UHD_STATE_NO_VBUS = 0, 44 | UHD_STATE_DISCONNECTED = 1, 45 | UHD_STATE_CONNECTED = 2, 46 | UHD_STATE_ERROR = 3, 47 | } uhd_vbus_state_t; 48 | 49 | extern void UHD_Init(void); 50 | extern void UHD_Handler(void); 51 | extern void USB_SetHandler(void (*pf_isr)(void)); 52 | extern uhd_vbus_state_t UHD_GetVBUSState(void); 53 | extern uint32_t UHD_Pipe0_Alloc(uint32_t ul_add, uint32_t ul_ep_size); 54 | extern uint32_t UHD_Pipe_Alloc(uint32_t ul_dev_addr, uint32_t ul_dev_ep, uint32_t ul_type, uint32_t ul_dir, uint32_t ul_maxsize, uint32_t ul_interval, uint32_t ul_nb_bank); 55 | extern void UHD_Pipe_CountZero(uint32_t ul_pipe); 56 | extern void UHD_Pipe_Free(uint32_t ul_pipe); 57 | extern uint32_t UHD_Pipe_Read(uint32_t ul_pipe, uint32_t ul_size, uint8_t* data); 58 | extern void UHD_Pipe_Write(uint32_t ul_pipe, uint32_t ul_size, uint8_t* data); 59 | extern void UHD_Pipe_Send(uint32_t ul_pipe, uint32_t ul_token_type); 60 | extern uint32_t UHD_Pipe_Is_Transfer_Complete(uint32_t ul_pipe, uint32_t ul_token_type); 61 | 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | 66 | #endif /* USB_HOST_H_INCLUDED */ 67 | -------------------------------------------------------------------------------- /cores/arduino/Uart.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 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 "HardwareSerial.h" 22 | #include "SERCOM.h" 23 | #include "RingBuffer.h" 24 | 25 | #include 26 | 27 | class Uart : public HardwareSerial 28 | { 29 | public: 30 | Uart(SERCOM *_s, uint8_t _pinRX, uint8_t _pinTX, SercomRXPad _padRX, SercomUartTXPad _padTX); 31 | Uart(SERCOM *_s, uint8_t _pinRX, uint8_t _pinTX, SercomRXPad _padRX, SercomUartTXPad _padTX, uint8_t _pinRTS, uint8_t _pinCTS); 32 | void begin(unsigned long baudRate); 33 | void begin(unsigned long baudrate, uint16_t config); 34 | void end(); 35 | int available(); 36 | int availableForWrite(); 37 | int peek(); 38 | int read(); 39 | void flush(); 40 | size_t write(const uint8_t data); 41 | using Print::write; // pull in write(str) and write(buf, size) from Print 42 | 43 | void IrqHandler(); 44 | 45 | operator bool() { return true; } 46 | 47 | private: 48 | SERCOM *sercom; 49 | RingBuffer rxBuffer; 50 | RingBuffer txBuffer; 51 | 52 | uint8_t uc_pinRX; 53 | uint8_t uc_pinTX; 54 | SercomRXPad uc_padRX; 55 | SercomUartTXPad uc_padTX; 56 | uint8_t uc_pinRTS; 57 | volatile uint32_t* pul_outsetRTS; 58 | volatile uint32_t* pul_outclrRTS; 59 | uint32_t ul_pinMaskRTS; 60 | uint8_t uc_pinCTS; 61 | 62 | SercomNumberStopBit extractNbStopBit(uint16_t config); 63 | SercomUartCharSize extractCharSize(uint16_t config); 64 | SercomParityMode extractParity(uint16_t config); 65 | }; 66 | -------------------------------------------------------------------------------- /cores/arduino/WInterrupts.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 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 | #ifndef _WIRING_INTERRUPTS_ 20 | #define _WIRING_INTERRUPTS_ 21 | 22 | #include 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | // LOW 0 29 | // HIGH 1 30 | #define CHANGE 2 31 | #define FALLING 3 32 | #define RISING 4 33 | 34 | //#define DEFAULT 1 35 | //#define EXTERNAL 0 36 | 37 | typedef void (*voidFuncPtr)(void); 38 | 39 | /* 40 | * \brief Specifies a named Interrupt Service Routine (ISR) to call when an interrupt occurs. 41 | * Replaces any previous function that was attached to the interrupt. 42 | */ 43 | void attachInterrupt(uint32_t pin, voidFuncPtr callback, uint32_t mode); 44 | 45 | /* 46 | * \brief Turns off the given interrupt. 47 | */ 48 | void detachInterrupt(uint32_t pin); 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /cores/arduino/WMath.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 Arduino. 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 | extern "C" { 20 | #include "stdlib.h" 21 | #include "stdint.h" 22 | } 23 | #include "WMath.h" 24 | 25 | extern void randomSeed( uint32_t dwSeed ) 26 | { 27 | if ( dwSeed != 0 ) 28 | { 29 | srand( dwSeed ) ; 30 | } 31 | } 32 | 33 | extern long random( long howbig ) 34 | { 35 | if ( howbig == 0 ) 36 | { 37 | return 0 ; 38 | } 39 | 40 | return rand() % howbig; 41 | } 42 | 43 | extern long random( long howsmall, long howbig ) 44 | { 45 | if (howsmall >= howbig) 46 | { 47 | return howsmall; 48 | } 49 | 50 | long diff = howbig - howsmall; 51 | 52 | return random(diff) + howsmall; 53 | } 54 | 55 | extern long map(long x, long in_min, long in_max, long out_min, long out_max) 56 | { 57 | return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; 58 | } 59 | 60 | extern uint16_t makeWord( uint16_t w ) 61 | { 62 | return w ; 63 | } 64 | 65 | extern uint16_t makeWord( uint8_t h, uint8_t l ) 66 | { 67 | return (h << 8) | l ; 68 | } 69 | -------------------------------------------------------------------------------- /cores/arduino/WMath.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 Arduino. 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 | #ifndef _WIRING_MATH_ 20 | #define _WIRING_MATH_ 21 | 22 | extern long random( long ) ; 23 | extern long random( long, long ) ; 24 | extern void randomSeed( uint32_t dwSeed ) ; 25 | extern long map( long, long, long, long, long ) ; 26 | 27 | extern uint16_t makeWord( uint16_t w ) ; 28 | extern uint16_t makeWord( uint8_t h, uint8_t l ) ; 29 | 30 | #define word(...) makeWord(__VA_ARGS__) 31 | 32 | 33 | #endif /* _WIRING_MATH_ */ 34 | -------------------------------------------------------------------------------- /cores/arduino/abi.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 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 | #include 20 | 21 | extern "C" void __cxa_pure_virtual(void) __attribute__ ((__noreturn__)); 22 | extern "C" void __cxa_deleted_virtual(void) __attribute__ ((__noreturn__)); 23 | 24 | void __cxa_pure_virtual(void) { 25 | // We might want to write some diagnostics to uart in this case 26 | //std::terminate(); 27 | while (1) 28 | ; 29 | } 30 | 31 | void __cxa_deleted_virtual(void) { 32 | // We might want to write some diagnostics to uart in this case 33 | //std::terminate(); 34 | while (1) 35 | ; 36 | } 37 | 38 | -------------------------------------------------------------------------------- /cores/arduino/avr/dtostrf.c: -------------------------------------------------------------------------------- 1 | /* 2 | dtostrf - Emulation for dtostrf function from avr-libc 3 | Copyright (c) 2015 Arduino LLC. All rights 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 | #include 21 | 22 | char *dtostrf (double val, signed char width, unsigned char prec, char *sout) { 23 | asm(".global _printf_float"); 24 | 25 | char fmt[20]; 26 | sprintf(fmt, "%%%d.%df", width, prec); 27 | sprintf(sout, fmt, val); 28 | return sout; 29 | } 30 | 31 | -------------------------------------------------------------------------------- /cores/arduino/avr/dtostrf.h: -------------------------------------------------------------------------------- 1 | /* 2 | dtostrf - Emulation for dtostrf function from avr-libc 3 | Copyright (c) 2015 Arduino LLC. All rights 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 | #pragma once 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | char *dtostrf(double val, signed char width, unsigned char prec, char *sout); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | -------------------------------------------------------------------------------- /cores/arduino/avr/interrupt.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 Arduino LCC. 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 | /* 20 | Empty file. 21 | This file is here to allow compatibility with sketches (made for AVR) 22 | that includes 23 | */ 24 | -------------------------------------------------------------------------------- /cores/arduino/avr/io.h: -------------------------------------------------------------------------------- 1 | /* 2 | io.h - Definitions for compatibility with AVR io macros 3 | 4 | Copyright (c) 2016 Arduino LLC 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE 23 | */ 24 | 25 | #ifndef _IO_H_ 26 | #define _IO_H_ 27 | 28 | #ifdef __SAMD51__ 29 | #define RAMSTART (HSRAM_ADDR) 30 | #define RAMSIZE (HSRAM_SIZE) 31 | #else 32 | #define RAMSTART (HMCRAMC0_ADDR) 33 | #define RAMSIZE (HMCRAMC0_SIZE) 34 | #endif 35 | 36 | #define RAMEND (RAMSTART + RAMSIZE - 1) 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /cores/arduino/base64.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * base64.cpp 3 | * 4 | * Created on: 09.12.2015 5 | * 6 | * Copyright (c) 2015 Markus Sattler. All rights reserved. 7 | * This file is part of the ESP31B core for Arduino. 8 | * 9 | * This library is free software; you can redistribute it and/or 10 | * modify it under the terms of the GNU Lesser General Public 11 | * License as published by the Free Software Foundation; either 12 | * version 2.1 of the License, or (at your option) any later version. 13 | * 14 | * This library is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | * Lesser General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public 20 | * License along with this library; if not, write to the Free Software 21 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 22 | * 23 | */ 24 | 25 | #include "Arduino.h" 26 | extern "C" { 27 | #include "libb64/cdecode.h" 28 | #include "libb64/cencode.h" 29 | } 30 | #include "base64.h" 31 | 32 | /** 33 | * convert input data to base64 34 | * @param data const uint8_t * 35 | * @param length size_t 36 | * @return String 37 | */ 38 | String base64::encode(const uint8_t * data, size_t length) 39 | { 40 | size_t size = base64_encode_expected_len(length) + 1; 41 | char * buffer = (char *) malloc(size); 42 | if(buffer) { 43 | base64_encodestate _state; 44 | base64_init_encodestate(&_state); 45 | int len = base64_encode_block((const char *) &data[0], length, &buffer[0], &_state); 46 | len = base64_encode_blockend((buffer + len), &_state); 47 | 48 | String base64 = String(buffer); 49 | free(buffer); 50 | return base64; 51 | } 52 | return String("-FAIL-"); 53 | } 54 | 55 | /** 56 | * convert input data to base64 57 | * @param text const String& 58 | * @return String 59 | */ 60 | String base64::encode(const String& text) 61 | { 62 | return base64::encode((uint8_t *) text.c_str(), text.length()); 63 | } 64 | 65 | -------------------------------------------------------------------------------- /cores/arduino/base64.h: -------------------------------------------------------------------------------- 1 | #ifndef CORE_BASE64_H_ 2 | #define CORE_BASE64_H_ 3 | 4 | class base64 5 | { 6 | public: 7 | static String encode(const uint8_t * data, size_t length); 8 | static String encode(const String& text); 9 | private: 10 | }; 11 | 12 | 13 | #endif /* CORE_BASE64_H_ */ 14 | -------------------------------------------------------------------------------- /cores/arduino/cbuf.h: -------------------------------------------------------------------------------- 1 | /* 2 | cbuf.h - Circular buffer implementation 3 | Copyright (c) 2014 Ivan Grokhotkov. All rights reserved. 4 | This file is part of the esp8266 core for Arduino environment. 5 | 6 | This library is free software; you can redistribute it and/or 7 | modify it under the terms of the GNU Lesser General Public 8 | License as published by the Free Software Foundation; either 9 | version 2.1 of the License, or (at your option) any later version. 10 | 11 | This library 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 GNU 14 | Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public 17 | License along with this library; if not, write to the Free Software 18 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef __cbuf_h 22 | #define __cbuf_h 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | class cbuf 29 | { 30 | public: 31 | cbuf(size_t size); 32 | ~cbuf(); 33 | 34 | size_t resizeAdd(size_t addSize); 35 | size_t resize(size_t newSize); 36 | size_t available() const; 37 | size_t size(); 38 | 39 | size_t room() const; 40 | 41 | inline bool empty() const 42 | { 43 | return _begin == _end; 44 | } 45 | 46 | inline bool full() const 47 | { 48 | return wrap_if_bufend(_end + 1) == _begin; 49 | } 50 | 51 | int peek(); 52 | size_t peek(char *dst, size_t size); 53 | 54 | int read(); 55 | size_t read(char* dst, size_t size); 56 | 57 | size_t write(char c); 58 | size_t write(const char* src, size_t size); 59 | 60 | void flush(); 61 | size_t remove(size_t size); 62 | 63 | cbuf *next; 64 | 65 | private: 66 | inline char* wrap_if_bufend(char* ptr) const 67 | { 68 | return (ptr == _bufend) ? _buf : ptr; 69 | } 70 | 71 | size_t _size; 72 | char* _buf; 73 | const char* _bufend; 74 | char* _begin; 75 | char* _end; 76 | 77 | }; 78 | 79 | #endif//__cbuf_h 80 | -------------------------------------------------------------------------------- /cores/arduino/hooks.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 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 | #include 20 | /** 21 | * Empty yield() hook. 22 | * 23 | * This function is intended to be used by library writers to build 24 | * libraries or sketches that supports cooperative threads. 25 | * 26 | * Its defined as a weak symbol and it can be redefined to implement a 27 | * real cooperative scheduler. 28 | */ 29 | extern void tud_task(void); 30 | extern uint32_t tud_cdc_n_write_flush (uint8_t itf); 31 | static void __empty() 32 | { 33 | // Empty 34 | } 35 | void yield(void) __attribute__((weak, alias("__empty"))); 36 | 37 | /** 38 | * SysTick hook 39 | * 40 | * This function is called from SysTick handler, before the default 41 | * handler provided by Arduino. 42 | */ 43 | static int __false() 44 | { 45 | // Return false 46 | return 0; 47 | } 48 | int sysTickHook(void) __attribute__((weak, alias("__false"))); 49 | 50 | /** 51 | * SVC hook 52 | * PendSV hook 53 | * 54 | * These functions are called from SVC handler, and PensSV handler. 55 | * Default action is halting. 56 | */ 57 | static void __halt() 58 | { 59 | // Halts 60 | while (1) 61 | ; 62 | } 63 | void svcHook(void) __attribute__((weak, alias("__halt"))); 64 | void pendSVHook(void) __attribute__((weak, alias("__halt"))); 65 | -------------------------------------------------------------------------------- /cores/arduino/itoa.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 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 | #ifdef __cplusplus 22 | extern "C"{ 23 | #endif 24 | 25 | //extern void itoa( int n, char s[] ) ; 26 | 27 | extern char* itoa( int value, char *string, int radix ) ; 28 | extern char* ltoa( long value, char *string, int radix ) ; 29 | extern char* utoa( unsigned int value, char *string, int radix ) ; 30 | extern char* ultoa( unsigned long value, char *string, int radix ) ; 31 | 32 | #ifdef __cplusplus 33 | } // extern "C" 34 | #endif 35 | 36 | -------------------------------------------------------------------------------- /cores/arduino/libb64/AUTHORS: -------------------------------------------------------------------------------- 1 | libb64: Base64 Encoding/Decoding Routines 2 | ====================================== 3 | 4 | Authors: 5 | ------- 6 | 7 | Chris Venter chris.venter@gmail.com http://rocketpod.blogspot.com 8 | -------------------------------------------------------------------------------- /cores/arduino/libb64/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright-Only Dedication (based on United States law) 2 | or Public Domain Certification 3 | 4 | The person or persons who have associated work with this document (the 5 | "Dedicator" or "Certifier") hereby either (a) certifies that, to the best of 6 | his knowledge, the work of authorship identified is in the public domain of the 7 | country from which the work is published, or (b) hereby dedicates whatever 8 | copyright the dedicators holds in the work of authorship identified below (the 9 | "Work") to the public domain. A certifier, moreover, dedicates any copyright 10 | interest he may have in the associated work, and for these purposes, is 11 | described as a "dedicator" below. 12 | 13 | A certifier has taken reasonable steps to verify the copyright status of this 14 | work. Certifier recognizes that his good faith efforts may not shield him from 15 | liability if in fact the work certified is not in the public domain. 16 | 17 | Dedicator makes this dedication for the benefit of the public at large and to 18 | the detriment of the Dedicator's heirs and successors. Dedicator intends this 19 | dedication to be an overt act of relinquishment in perpetuity of all present 20 | and future rights under copyright law, whether vested or contingent, in the 21 | Work. Dedicator understands that such relinquishment of all rights includes 22 | the relinquishment of all rights to enforce (by lawsuit or otherwise) those 23 | copyrights in the Work. 24 | 25 | Dedicator recognizes that, once placed in the public domain, the Work may be 26 | freely reproduced, distributed, transmitted, used, modified, built upon, or 27 | otherwise exploited by anyone for any purpose, commercial or non-commercial, 28 | and in any way, including by methods that have not yet been invented or 29 | conceived. -------------------------------------------------------------------------------- /cores/arduino/libb64/cdecode.h: -------------------------------------------------------------------------------- 1 | /* 2 | cdecode.h - c header for a base64 decoding algorithm 3 | 4 | This is part of the libb64 project, and has been placed in the public domain. 5 | For details, see http://sourceforge.net/projects/libb64 6 | */ 7 | 8 | #ifndef BASE64_CDECODE_H 9 | #define BASE64_CDECODE_H 10 | 11 | #define base64_decode_expected_len(n) ((n * 3) / 4) 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | typedef enum { 18 | step_a, step_b, step_c, step_d 19 | } base64_decodestep; 20 | 21 | typedef struct { 22 | base64_decodestep step; 23 | char plainchar; 24 | } base64_decodestate; 25 | 26 | void base64_init_decodestate(base64_decodestate* state_in); 27 | 28 | int base64_decode_value(char value_in); 29 | 30 | int base64_decode_block(const char* code_in, const int length_in, char* plaintext_out, base64_decodestate* state_in); 31 | 32 | int base64_decode_chars(const char* code_in, const int length_in, char* plaintext_out); 33 | 34 | #ifdef __cplusplus 35 | } // extern "C" 36 | #endif 37 | 38 | #endif /* BASE64_CDECODE_H */ 39 | -------------------------------------------------------------------------------- /cores/arduino/libb64/cencode.h: -------------------------------------------------------------------------------- 1 | /* 2 | cencode.h - c header for a base64 encoding algorithm 3 | 4 | This is part of the libb64 project, and has been placed in the public domain. 5 | For details, see http://sourceforge.net/projects/libb64 6 | */ 7 | 8 | #ifndef BASE64_CENCODE_H 9 | #define BASE64_CENCODE_H 10 | 11 | #define base64_encode_expected_len(n) ((((4 * n) / 3) + 3) & ~3) 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | typedef enum { 18 | step_A, step_B, step_C 19 | } base64_encodestep; 20 | 21 | typedef struct { 22 | base64_encodestep step; 23 | char result; 24 | int stepcount; 25 | } base64_encodestate; 26 | 27 | void base64_init_encodestate(base64_encodestate* state_in); 28 | 29 | char base64_encode_value(char value_in); 30 | 31 | int base64_encode_block(const char* plaintext_in, int length_in, char* code_out, base64_encodestate* state_in); 32 | 33 | int base64_encode_blockend(char* code_out, base64_encodestate* state_in); 34 | 35 | int base64_encode_chars(const char* plaintext_in, int length_in, char* code_out); 36 | 37 | #ifdef __cplusplus 38 | } // extern "C" 39 | #endif 40 | 41 | #endif /* BASE64_CENCODE_H */ 42 | -------------------------------------------------------------------------------- /cores/arduino/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 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 | #define ARDUINO_MAIN 20 | #include "Arduino.h" 21 | 22 | // Weak empty variant initialization function. 23 | // May be redefined by variant files. 24 | void initVariant() __attribute__((weak)); 25 | void initVariant() {} 26 | #if defined(USE_TINYUSB) 27 | // run TinyUSB background task auto This method will be overridden when running in FreeRTOS 28 | void __attribute__((weak)) tinyusb_task(void) 29 | { 30 | } 31 | #endif 32 | 33 | /* 34 | * _real_body(),_wrap_body() is a compiler trick, 35 | * user could overwrite the arduino setup/loop function by re-implement _wrap_body(), 36 | * calling of _real_body() in _wrap_body() is optional. 37 | */ 38 | void _real_body() 39 | { 40 | setup(); 41 | for (;;) 42 | { 43 | loop(); 44 | yield(); // yield run usb background task 45 | if (serialEventRun) 46 | serialEventRun(); 47 | } 48 | } 49 | 50 | void __attribute__((weak)) _wrap_body() 51 | { 52 | _real_body(); 53 | } 54 | 55 | // Initialize C library 56 | extern "C" void __libc_init_array(void); 57 | 58 | /* 59 | * \brief Main entry point of Arduino application 60 | */ 61 | int main(void) 62 | { 63 | init(); 64 | 65 | __libc_init_array(); 66 | 67 | initVariant(); 68 | 69 | delay(1); 70 | 71 | #if defined(USE_TINYUSB) 72 | TinyUSB_Device_Init(0); 73 | #elif defined(USBCON) 74 | USBDevice.init(); 75 | USBDevice.attach(); 76 | #endif 77 | _wrap_body(); 78 | return 0; 79 | } 80 | -------------------------------------------------------------------------------- /cores/arduino/new.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 Arduino. 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 | #include 20 | #include 21 | 22 | void __attribute__((weak)) *operator new(size_t size) { 23 | return malloc(size); 24 | } 25 | 26 | void __attribute__((weak)) *operator new[](size_t size) { 27 | return malloc(size); 28 | } 29 | 30 | void __attribute__((weak)) operator delete(void * ptr) { 31 | free(ptr); 32 | } 33 | 34 | void __attribute__((weak)) operator delete[](void * ptr) { 35 | free(ptr); 36 | } 37 | 38 | extern "C" { 39 | extern char __HeapLimit; 40 | extern char __end__; 41 | 42 | /* 43 | * a library function _sbrk() reimplement. 44 | * 45 | * The arm-none-eabi-gcc-4.8.3-2014q1 's _sbrk() check heap_end & current stack(), 46 | * not applied for RTOS environment in which malloc() will failed. 47 | */ 48 | void *_sbrk(size_t incr) { 49 | static char* heap_end; 50 | char* old_end; 51 | 52 | uint8_t irqsave = interruptsStatus(); 53 | noInterrupts(); 54 | 55 | if (!heap_end) { 56 | heap_end = &__end__; 57 | } 58 | 59 | old_end = heap_end; 60 | if (old_end + incr >= (char*)__get_MSP()) { 61 | old_end = (char*)-1; 62 | } else { 63 | heap_end += incr; 64 | } 65 | 66 | if (irqsave) 67 | interrupts(); 68 | 69 | return old_end; 70 | } 71 | 72 | }//extern "C" 73 | -------------------------------------------------------------------------------- /cores/arduino/pulse.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 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 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | /* 26 | * \brief Measures the length (in microseconds) of a pulse on the pin; state is HIGH 27 | * or LOW, the type of pulse to measure. Works on pulses from 2-3 microseconds 28 | * to 3 minutes in length, but must be called at least a few dozen microseconds 29 | * before the start of the pulse. 30 | */ 31 | uint32_t pulseIn(uint32_t pin, uint32_t state, uint32_t timeout); 32 | 33 | #ifdef __cplusplus 34 | // Provides a version of pulseIn with a default argument (C++ only) 35 | uint32_t pulseIn(uint32_t pin, uint32_t state, uint32_t timeout = 1000000L); 36 | 37 | } // extern "C" 38 | #endif 39 | 40 | -------------------------------------------------------------------------------- /cores/arduino/wiring.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 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 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | extern void init(void); 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | -------------------------------------------------------------------------------- /cores/arduino/wiring_analog.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 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 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | /* 28 | * \brief SAMD products have only one reference for ADC 29 | */ 30 | // add internal voltages for ATSAMD51 SUPC VREF register 31 | typedef enum _eAnalogReference 32 | { 33 | AR_DEFAULT, 34 | AR_INTERNAL1V0, 35 | AR_INTERNAL1V1, 36 | AR_INTERNAL1V2, 37 | AR_INTERNAL1V25, 38 | AR_INTERNAL2V0, 39 | AR_INTERNAL2V2, 40 | AR_INTERNAL2V23, 41 | AR_INTERNAL2V4, 42 | AR_INTERNAL2V5, 43 | AR_INTERNAL1V65, 44 | AR_EXTERNAL 45 | } eAnalogReference ; 46 | 47 | 48 | /* 49 | * \brief Configures the reference voltage used for analog input (i.e. the value used as the top of the input range). 50 | * This function is kept only for compatibility with existing AVR based API. 51 | * 52 | * \param ulMmode Should be set to AR_DEFAULT. 53 | */ 54 | extern void analogReference( eAnalogReference ulMode ) ; 55 | 56 | /* 57 | * \brief Writes an analog value (PWM wave) to a pin. 58 | * 59 | * \param ulPin 60 | * \param ulValue 61 | */ 62 | extern void analogWrite( uint32_t ulPin, uint32_t ulValue ) ; 63 | 64 | /* 65 | * \brief Reads the value from the specified analog pin. 66 | * 67 | * \param ulPin 68 | * 69 | * \return Read value from selected pin, if no error. 70 | */ 71 | extern uint32_t analogRead( uint32_t ulPin ) ; 72 | 73 | /* 74 | * \brief Set the resolution of analogRead return values. Default is 10 bits (range from 0 to 1023). 75 | * 76 | * \param res 77 | */ 78 | extern void analogReadResolution(int res); 79 | 80 | /* 81 | * \brief Set the resolution of analogWrite parameters. Default is 8 bits (range from 0 to 255). 82 | * 83 | * \param res 84 | */ 85 | extern void analogWriteResolution(int res); 86 | 87 | extern void analogOutputInit( void ) ; 88 | 89 | #ifdef __cplusplus 90 | } 91 | #endif 92 | -------------------------------------------------------------------------------- /cores/arduino/wiring_constants.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 Arduino. 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 | #ifndef _WIRING_CONSTANTS_ 20 | #define _WIRING_CONSTANTS_ 21 | 22 | #ifdef __cplusplus 23 | extern "C"{ 24 | #endif // __cplusplus 25 | 26 | #define LOW (0x0) 27 | #define HIGH (0x1) 28 | 29 | #define INPUT (0x0) 30 | #define OUTPUT (0x1) 31 | #define INPUT_PULLUP (0x2) 32 | #define INPUT_PULLDOWN (0x3) 33 | 34 | #define PI 3.1415926535897932384626433832795 35 | #define HALF_PI 1.5707963267948966192313216916398 36 | #define TWO_PI 6.283185307179586476925286766559 37 | #define DEG_TO_RAD 0.017453292519943295769236907684886 38 | #define RAD_TO_DEG 57.295779513082320876798154814105 39 | #define EULER 2.718281828459045235360287471352 40 | 41 | #define SERIAL 0x0 42 | #define DISPLAY 0x1 43 | 44 | enum BitOrder { 45 | LSBFIRST = 0, 46 | MSBFIRST = 1 47 | }; 48 | 49 | // moved to WInterrupts.h 50 | //// LOW 0 51 | //// HIGH 1 52 | //#define CHANGE 2 53 | //#define FALLING 3 54 | //#define RISING 4 55 | // 56 | //#define DEFAULT 1 57 | //#define EXTERNAL 0 58 | 59 | #ifdef __cplusplus 60 | } // extern "C" 61 | #endif // __cplusplus 62 | 63 | #endif /* _WIRING_CONSTANTS_ */ 64 | -------------------------------------------------------------------------------- /cores/arduino/wiring_digital.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 Arduino. 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 | #ifndef _WIRING_DIGITAL_ 20 | #define _WIRING_DIGITAL_ 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | #include "WVariant.h" 27 | 28 | /** 29 | * \brief Configures the specified pin to behave either as an input or an output. See the description of digital pins for details. 30 | * 31 | * \param ulPin The number of the pin whose mode you wish to set 32 | * \param ulMode Can be INPUT, OUTPUT, INPUT_PULLUP or INPUT_PULLDOWN 33 | */ 34 | extern void pinMode( uint32_t dwPin, uint32_t dwMode ) ; 35 | 36 | /** 37 | * \brief Write a HIGH or a LOW value to a digital pin. 38 | * 39 | * If the pin has been configured as an OUTPUT with pinMode(), its voltage will be set to the 40 | * corresponding value: 5V (or 3.3V on 3.3V boards) for HIGH, 0V (ground) for LOW. 41 | * 42 | * If the pin is configured as an INPUT, writing a HIGH value with digitalWrite() will enable an internal 43 | * 20K pullup resistor (see the tutorial on digital pins). Writing LOW will disable the pullup. The pullup 44 | * resistor is enough to light an LED dimly, so if LEDs appear to work, but very dimly, this is a likely 45 | * cause. The remedy is to set the pin to an output with the pinMode() function. 46 | * 47 | * \note Digital pin PIN_LED is harder to use as a digital input than the other digital pins because it has an LED 48 | * and resistor attached to it that's soldered to the board on most boards. If you enable its internal 20k pull-up 49 | * resistor, it will hang at around 1.7 V instead of the expected 5V because the onboard LED and series resistor 50 | * pull the voltage level down, meaning it always returns LOW. If you must use pin PIN_LED as a digital input, use an 51 | * external pull down resistor. 52 | * 53 | * \param dwPin the pin number 54 | * \param dwVal HIGH or LOW 55 | */ 56 | extern void digitalWrite( uint32_t dwPin, uint32_t dwVal ) ; 57 | 58 | /** 59 | * \brief Reads the value from a specified digital pin, either HIGH or LOW. 60 | * 61 | * \param ulPin The number of the digital pin you want to read (int) 62 | * 63 | * \return HIGH or LOW 64 | */ 65 | extern int digitalRead( uint32_t ulPin ) ; 66 | 67 | #ifdef __cplusplus 68 | } 69 | #endif 70 | 71 | #endif /* _WIRING_DIGITAL_ */ 72 | -------------------------------------------------------------------------------- /cores/arduino/wiring_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 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 23 | #include 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | // Includes Atmel CMSIS 30 | #include "sam.h" 31 | 32 | #include "wiring_constants.h" 33 | 34 | int pinPeripheral( uint32_t ulPin, EPioType ulPeripheral ); 35 | 36 | uint32_t mapResolution(uint32_t value, uint32_t from, uint32_t to); 37 | 38 | #ifdef __cplusplus 39 | } // extern "C" 40 | 41 | #include "HardwareSerial.h" 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /cores/arduino/wiring_pwm.h: -------------------------------------------------------------------------------- 1 | /** 2 | * The MIT License (MIT) 3 | * 4 | * Author: Hongtai Liu (lht856@foxmail.com) 5 | * 6 | * Copyright (C) 2020 Seeed Technology Co.,Ltd. 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | */ 26 | 27 | #pragma once 28 | 29 | #ifdef __cplusplus 30 | 31 | #include "Arduino.h" 32 | 33 | void pwm(uint32_t _pin, uint32_t frequency, uint32_t duty = 500); 34 | void noPwm(uint32_t _pin); 35 | #endif 36 | -------------------------------------------------------------------------------- /cores/arduino/wiring_shift.c: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 Arduino. 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 | #include 20 | #include "wiring_shift.h" 21 | #include "wiring_digital.h" 22 | #include "wiring_private.h" 23 | 24 | #ifdef __cplusplus 25 | extern "C"{ 26 | #endif 27 | 28 | uint32_t shiftIn( uint32_t ulDataPin, uint32_t ulClockPin, uint32_t ulBitOrder ) 29 | { 30 | uint8_t value = 0 ; 31 | uint8_t i ; 32 | 33 | for ( i=0 ; i < 8 ; ++i ) 34 | { 35 | digitalWrite( ulClockPin, HIGH ) ; 36 | 37 | if ( ulBitOrder == LSBFIRST ) 38 | { 39 | value |= digitalRead( ulDataPin ) << i ; 40 | } 41 | else 42 | { 43 | value |= digitalRead( ulDataPin ) << (7 - i) ; 44 | } 45 | 46 | digitalWrite( ulClockPin, LOW ) ; 47 | } 48 | 49 | return value ; 50 | } 51 | 52 | void shiftOut( uint32_t ulDataPin, uint32_t ulClockPin, uint32_t ulBitOrder, uint32_t ulVal ) 53 | { 54 | uint8_t i ; 55 | 56 | for ( i=0 ; i < 8 ; i++ ) 57 | { 58 | if ( ulBitOrder == LSBFIRST ) 59 | { 60 | digitalWrite( ulDataPin, !!(ulVal & (1 << i)) ) ; 61 | } 62 | else 63 | { 64 | digitalWrite( ulDataPin, !!(ulVal & (1 << (7 - i))) ) ; 65 | } 66 | 67 | digitalWrite( ulClockPin, HIGH ) ; 68 | digitalWrite( ulClockPin, LOW ) ; 69 | } 70 | } 71 | 72 | #ifdef __cplusplus 73 | } // extern "C" 74 | #endif 75 | -------------------------------------------------------------------------------- /cores/arduino/wiring_shift.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014 Arduino. 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 | #ifndef _WIRING_SHIFT_ 20 | #define _WIRING_SHIFT_ 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | /* 27 | * \brief 28 | */ 29 | extern uint32_t shiftIn( uint32_t ulDataPin, uint32_t ulClockPin, uint32_t ulBitOrder ) ; 30 | 31 | 32 | /* 33 | * \brief 34 | */ 35 | extern void shiftOut( uint32_t ulDataPin, uint32_t ulClockPin, uint32_t ulBitOrder, uint32_t ulVal ) ; 36 | 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif /* _WIRING_SHIFT_ */ 43 | -------------------------------------------------------------------------------- /drivers/arduino-samd.cat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seeed-Studio/ArduinoCore-samd/d900ef7e959df763a4f56338183964739790f035/drivers/arduino-samd.cat -------------------------------------------------------------------------------- /drivers/dpinst-amd64.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seeed-Studio/ArduinoCore-samd/d900ef7e959df763a4f56338183964739790f035/drivers/dpinst-amd64.exe -------------------------------------------------------------------------------- /drivers/dpinst-x86.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seeed-Studio/ArduinoCore-samd/d900ef7e959df763a4f56338183964739790f035/drivers/dpinst-x86.exe -------------------------------------------------------------------------------- /drivers/genuino-samd.cat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seeed-Studio/ArduinoCore-samd/d900ef7e959df763a4f56338183964739790f035/drivers/genuino-samd.cat -------------------------------------------------------------------------------- /drivers/prewin10/adafruit_circuit_playground_express.cat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Seeed-Studio/ArduinoCore-samd/d900ef7e959df763a4f56338183964739790f035/drivers/prewin10/adafruit_circuit_playground_express.cat -------------------------------------------------------------------------------- /extras/pack.hourlybuild.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | 3 | # pack.*.bash - Bash script to help packaging samd core releases. 4 | # Copyright (c) 2015 Arduino LLC. All right reserved. 5 | # 6 | # This library is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU Lesser General Public 8 | # License as published by the Free Software Foundation; either 9 | # version 2.1 of the License, or (at your option) any later version. 10 | # 11 | # This library 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 GNU 14 | # Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this library; if not, write to the Free Software 18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | 20 | BUILD_NUMBER=$1 21 | CURR_TIME=`date "+%Y-%m-%d %H:%M"` 22 | CURR_TIME_SED=`date "+%Y\\-%m\\-%d %H:%M"` 23 | VERSION=9.9.9-Hourly 24 | 25 | PWD=`pwd` 26 | FOLDERNAME=`basename $PWD` 27 | THIS_SCRIPT_NAME=`basename $0` 28 | FILENAME=package_samd-hourly-b${BUILD_NUMBER}.tar.bz2 29 | 30 | rm -f $FILENAME 31 | 32 | # Change name in platform.txt 33 | sed -i "s/name=.*/name=SAMD Hourly Build ${BUILD_NUMBER} (${CURR_TIME})/" platform.txt 34 | 35 | cd .. 36 | tar --transform "s|$FOLDERNAME|samd-hourly_b${BUILD_NUMBER}|g" --exclude=extras/** --exclude=.git* --exclude=.idea -cjf $FILENAME $FOLDERNAME 37 | cd - 38 | 39 | mv ../$FILENAME . 40 | 41 | CHKSUM=`sha256sum $FILENAME | awk '{ print $1 }'` 42 | SIZE=`wc -c $FILENAME | awk '{ print $1 }'` 43 | 44 | cat extras/package_index.json.Hourly.template | 45 | sed "s/%%BUILD_NUMBER%%/${BUILD_NUMBER}/" | 46 | sed "s/%%CURR_TIME%%/${CURR_TIME_SED}/" | 47 | sed "s/%%VERSION%%/${VERSION}/" | 48 | sed "s/%%FILENAME%%/${FILENAME}/" | 49 | sed "s/%%CHECKSUM%%/${CHKSUM}/" | 50 | sed "s/%%SIZE%%/${SIZE}/" > package_samd-hourly-build_index.json 51 | 52 | -------------------------------------------------------------------------------- /extras/pack.pullrequest.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | 3 | # pack.*.bash - Bash script to help packaging samd core releases. 4 | # Copyright (c) 2015 Arduino LLC. All right reserved. 5 | # 6 | # This library is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU Lesser General Public 8 | # License as published by the Free Software Foundation; either 9 | # version 2.1 of the License, or (at your option) any later version. 10 | # 11 | # This library 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 GNU 14 | # Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this library; if not, write to the Free Software 18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | 20 | PR_NUMBER=$1 21 | BUILD_NUMBER=$2 22 | VERSION=`grep version= platform.txt | sed 's/version=//g'` 23 | 24 | PWD=`pwd` 25 | FOLDERNAME=`basename $PWD` 26 | THIS_SCRIPT_NAME=`basename $0` 27 | FILENAME=package_samd-b${BUILD_NUMBER}.tar.bz2 28 | 29 | rm -f $FILENAME 30 | 31 | # Change name in platform.txt 32 | sed -i "s/name=.*/name=SAMD Pull request #${PR_NUMBER} (Build ${BUILD_NUMBER})/" platform.txt 33 | 34 | cd .. 35 | tar --transform "s|$FOLDERNAME|samd-PR${PR_NUMBER}_b${BUILD_NUMBER}|g" --exclude=extras/** --exclude=.git* --exclude=.idea -cjf $FILENAME $FOLDERNAME 36 | cd - 37 | 38 | mv ../$FILENAME . 39 | 40 | CHKSUM=`sha256sum $FILENAME | awk '{ print $1 }'` 41 | SIZE=`wc -c $FILENAME | awk '{ print $1 }'` 42 | 43 | cat extras/package_index.json.PR.template | 44 | sed s/%%PR_NUMBER%%/${PR_NUMBER}/ | 45 | sed s/%%BUILD_NUMBER%%/${BUILD_NUMBER}/ | 46 | sed s/%%VERSION%%/${VERSION}-build-${BUILD_NUMBER}/ | 47 | sed s/%%FILENAME%%/${FILENAME}/ | 48 | sed s/%%CHECKSUM%%/${CHKSUM}/ | 49 | sed s/%%SIZE%%/${SIZE}/ > package_samd-b${BUILD_NUMBER}_index.json 50 | 51 | -------------------------------------------------------------------------------- /extras/pack.release.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | 3 | # pack.*.bash - Bash script to help packaging samd core releases. 4 | # Copyright (c) 2015 Arduino LLC. All right reserved. 5 | # 6 | # This library is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU Lesser General Public 8 | # License as published by the Free Software Foundation; either 9 | # version 2.1 of the License, or (at your option) any later version. 10 | # 11 | # This library 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 GNU 14 | # Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this library; if not, write to the Free Software 18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | 20 | VERSION=`grep version= platform.txt | sed 's/version=//g'` 21 | 22 | PWD=`pwd` 23 | FOLDERNAME=`basename $PWD` 24 | THIS_SCRIPT_NAME=`basename $0` 25 | 26 | rm -f samd-$VERSION.tar.bz2 27 | 28 | cd .. 29 | tar --transform "s|$FOLDERNAME|$FOLDERNAME-$VERSION|g" --exclude=extras/** --exclude=.git* --exclude=.idea -cjf samd-$VERSION.tar.bz2 $FOLDERNAME 30 | cd - 31 | 32 | mv ../samd-$VERSION.tar.bz2 . 33 | 34 | -------------------------------------------------------------------------------- /extras/package_index.json.Hourly.template: -------------------------------------------------------------------------------- 1 | { 2 | "packages": [ 3 | { 4 | "name": "arduino-beta", 5 | "maintainer": "Arduino Betatesting", 6 | "websiteURL": "http://www.arduino.cc/", 7 | "email": "packages@arduino.cc", 8 | "help": { 9 | "online": "http://www.arduino.cc/en/Reference/HomePage" 10 | }, 11 | "platforms": [ 12 | { 13 | "name": "Arduino SAMD core - Hourly build", 14 | "architecture": "samd", 15 | "version": "%%VERSION%%", 16 | "category": "Arduino", 17 | "url": "http://downloads.arduino.cc/Hourly/samd/%%FILENAME%%", 18 | "archiveFileName": "%%FILENAME%%", 19 | "checksum": "SHA-256:%%CHECKSUM%%", 20 | "size": "%%SIZE%%", 21 | "boards": [ 22 | { 23 | "name": "Arduino Zero" 24 | } 25 | ], 26 | "toolsDependencies": [ 27 | { 28 | "packager": "arduino", 29 | "name": "arm-none-eabi-gcc", 30 | "version": "4.8.3-2014q1" 31 | }, 32 | { 33 | "packager": "arduino", 34 | "name": "bossac", 35 | "version": "1.7.0" 36 | }, 37 | { 38 | "packager": "arduino", 39 | "name": "openocd", 40 | "version": "0.9.0-arduino6-static" 41 | }, 42 | { 43 | "packager": "arduino", 44 | "name": "CMSIS", 45 | "version": "4.5.0" 46 | }, 47 | { 48 | "packager": "arduino", 49 | "name": "CMSIS-Atmel", 50 | "version": "1.1.0" 51 | }, 52 | { 53 | "packager": "arduino", 54 | "name": "arduinoOTA", 55 | "version": "1.2.0" 56 | } 57 | ] 58 | } 59 | ], 60 | "tools": [ 61 | ] 62 | } 63 | ] 64 | } 65 | -------------------------------------------------------------------------------- /extras/package_index.json.PR.template: -------------------------------------------------------------------------------- 1 | { 2 | "packages": [ 3 | { 4 | "name": "arduino-beta", 5 | "maintainer": "Arduino Betatesting", 6 | "websiteURL": "http://www.arduino.cc/", 7 | "email": "packages@arduino.cc", 8 | "help": { 9 | "online": "http://www.arduino.cc/en/Reference/HomePage" 10 | }, 11 | "platforms": [ 12 | { 13 | "name": "Arduino SAMD core - Pull request #%%PR_NUMBER%% (build %%BUILD_NUMBER%%)", 14 | "architecture": "samd", 15 | "version": "%%VERSION%%", 16 | "category": "Arduino", 17 | "url": "http://downloads.arduino.cc/PR/samd/%%FILENAME%%", 18 | "archiveFileName": "%%FILENAME%%", 19 | "checksum": "SHA-256:%%CHECKSUM%%", 20 | "size": "%%SIZE%%", 21 | "boards": [ 22 | { 23 | "name": "Arduino Zero" 24 | } 25 | ], 26 | "toolsDependencies": [ 27 | { 28 | "packager": "arduino", 29 | "name": "arm-none-eabi-gcc", 30 | "version": "4.8.3-2014q1" 31 | }, 32 | { 33 | "packager": "arduino", 34 | "name": "bossac", 35 | "version": "1.7.0" 36 | }, 37 | { 38 | "packager": "arduino", 39 | "name": "openocd", 40 | "version": "0.9.0-arduino6-static" 41 | }, 42 | { 43 | "packager": "arduino", 44 | "name": "CMSIS", 45 | "version": "4.5.0" 46 | }, 47 | { 48 | "packager": "arduino", 49 | "name": "CMSIS-Atmel", 50 | "version": "1.1.0" 51 | }, 52 | { 53 | "packager": "arduino", 54 | "name": "arduinoOTA", 55 | "version": "1.2.0" 56 | } 57 | ] 58 | } 59 | ], 60 | "tools": [ 61 | ] 62 | } 63 | ] 64 | } 65 | -------------------------------------------------------------------------------- /extras/post_install.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set ARGS=/SE /SW /SA 3 | if "%PROCESSOR_ARCHITECTURE%" == "AMD64" ( 4 | drivers\dpinst-amd64.exe %ARGS% 5 | ) ELSE IF "%PROCESSOR_ARCHITEW6432%" == "AMD64" ( 6 | drivers\dpinst-amd64.exe %ARGS% 7 | ) ELSE ( 8 | drivers\dpinst-x86.exe %ARGS% 9 | ) 10 | 11 | @echo off 12 | setlocal 13 | for /f "tokens=4-5 delims=[.] " %%i in ('ver') do @(if %%i==Version (set VERSION=%%j) else (set VERSION=%%i)) 14 | if %VERSION% GEQ 10 ( 15 | exit /b 0 16 | ) 17 | endlocal 18 | 19 | REM dpinst /PATH has problems with relative paths, so use absolute path. 20 | if "%PROCESSOR_ARCHITECTURE%" == "AMD64" ( 21 | drivers\dpinst-amd64.exe /PATH %cd%\drivers\prewin10 %ARGS% 22 | ) ELSE IF "%PROCESSOR_ARCHITEW6432%" == "AMD64" ( 23 | drivers\dpinst-amd64.exe /PATH %cd%\drivers\prewin10 %ARGS% 24 | ) ELSE ( 25 | drivers/dpinst-x86.exe /PATH %cd%\drivers\prewin10 %ARGS% 26 | ) 27 | 28 | exit /b 0 29 | -------------------------------------------------------------------------------- /keywords.txt: -------------------------------------------------------------------------------- 1 | SerialGSM KEYWORD1 2 | SerialSARA KEYWORD1 3 | INPUT_PULLDOWN LITERAL1 Constants RESERVED_WORD_2 4 | -------------------------------------------------------------------------------- /libraries/Adafruit_ZeroDMA/Adafruit_ZeroDMA.h: -------------------------------------------------------------------------------- 1 | #ifndef _ADAFRUIT_ZERODMA_H_ 2 | #define _ADAFRUIT_ZERODMA_H_ 3 | 4 | #include "Arduino.h" 5 | #include "utility/dma.h" 6 | 7 | // Status codes returned by some DMA functions and/or held in 8 | // a channel's jobStatus variable. 9 | enum ZeroDMAstatus { 10 | DMA_STATUS_OK = 0, 11 | DMA_STATUS_ERR_NOT_FOUND, 12 | DMA_STATUS_ERR_NOT_INITIALIZED, 13 | DMA_STATUS_ERR_INVALID_ARG, 14 | DMA_STATUS_ERR_IO, 15 | DMA_STATUS_ERR_TIMEOUT, 16 | DMA_STATUS_BUSY, 17 | DMA_STATUS_SUSPEND, 18 | DMA_STATUS_ABORTED, 19 | DMA_STATUS_JOBSTATUS = -1 // For printStatus() function 20 | }; 21 | 22 | class Adafruit_ZeroDMA { 23 | public: 24 | Adafruit_ZeroDMA(void); 25 | 26 | // DMA channel functions 27 | ZeroDMAstatus allocate(void), // Allocates DMA channel 28 | startJob(void), 29 | free(void); // Deallocates DMA channel 30 | void trigger(void) const, 31 | setTrigger(uint8_t trigger), 32 | setAction(dma_transfer_trigger_action action), 33 | setCallback(void (*callback)(Adafruit_ZeroDMA *) = NULL, 34 | dma_callback_type type = DMA_CALLBACK_TRANSFER_DONE), 35 | loop(boolean flag), 36 | suspend(void) const, 37 | resume(void), 38 | abort(void), 39 | setPriority(dma_priority pri) const, 40 | printStatus(ZeroDMAstatus s = DMA_STATUS_JOBSTATUS) const; 41 | uint8_t getChannel(void) const { return channel; } 42 | 43 | // DMA descriptor functions 44 | DmacDescriptor *addDescriptor(void *src, void *dst, uint32_t count = 0, 45 | dma_beat_size size = DMA_BEAT_SIZE_BYTE, 46 | bool srcInc = true, bool dstInc = true, 47 | uint32_t stepSize = DMA_ADDRESS_INCREMENT_STEP_SIZE_1, 48 | bool stepSel = DMA_STEPSEL_DST); 49 | void changeDescriptor(DmacDescriptor *d, void *src = NULL, 50 | void *dst = NULL, uint32_t count = 0); 51 | bool isActive(void) const; 52 | 53 | void _IRQhandler(uint8_t flags); // DO NOT TOUCH 54 | 55 | 56 | protected: 57 | uint8_t channel; 58 | volatile enum ZeroDMAstatus jobStatus; 59 | bool hasDescriptors; 60 | bool loopFlag; 61 | uint8_t peripheralTrigger; 62 | dma_transfer_trigger_action triggerAction; 63 | void (*callback[DMA_CALLBACK_N])(Adafruit_ZeroDMA *); 64 | }; 65 | 66 | #endif // _ADAFRUIT_ZERODMA_H_ 67 | -------------------------------------------------------------------------------- /libraries/Adafruit_ZeroDMA/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Adafruit Industries 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /libraries/Adafruit_ZeroDMA/README.md: -------------------------------------------------------------------------------- 1 | # Adafruit_ZeroDMA 2 | DMA helper/wrapped for ATSAMD21 such as Arduino Zero & Feather M0 3 | 4 | Current version of this library no longer requires Adafruit_ASFcore as a prerequisite. However...IT BREAKS COMPATIBILITY WITH PRIOR VERSIONS. Function names, calling sequence and return types/values have changed. See examples! 5 | 6 | Item(s) in 'utility' directory are much pared-down derivatives of Atmel ASFcore 3 files. Please keep their original copyright and license intact when editing. 7 | -------------------------------------------------------------------------------- /libraries/Adafruit_ZeroDMA/library.properties: -------------------------------------------------------------------------------- 1 | name=Adafruit Zero DMA Library 2 | version=1.0.4 3 | author=Adafruit 4 | maintainer=Adafruit 5 | sentence=DMA helper/wrapped for ATSAMD21 such as Arduino Zero & Feather M0 6 | paragraph=DMA helper/wrapped for ATSAMD21 such as Arduino Zero & Feather M0 7 | category=Signal Input/Output 8 | url=https://github.com/adafruit/Adafruit_ZeroDMA 9 | architectures=samd 10 | -------------------------------------------------------------------------------- /libraries/EnergySaving/examples/WakeUpOnExternalInterrupt/WakeUpOnExternalInterrupt.ino: -------------------------------------------------------------------------------- 1 | /******************************************************************************************** 2 | This sketch demonstrates how sleep function using external interrupt to wake up the MCU. 3 | This sketch work only cortex-m0+ boards. 4 | *********************************************************************************************/ 5 | 6 | 7 | 8 | #include 9 | 10 | EnergySaving nrgSave; 11 | 12 | unsigned int i=0; 13 | 14 | void setup() 15 | { 16 | nrgSave.begin(WAKE_EXT_INTERRUPT, 8, dummy); //standby setup for external interrupts 17 | } 18 | 19 | void loop() 20 | { 21 | for(i=0; i<20; i++) 22 | { 23 | digitalWrite(13,HIGH); 24 | delay(500); 25 | digitalWrite(13,LOW); 26 | delay(500); 27 | } 28 | 29 | nrgSave.standby(); //now mcu goes in standby mode 30 | } 31 | 32 | 33 | void dummy(void) //interrupt routine (isn't necessary to execute any tasks in this routine 34 | { 35 | 36 | } 37 | -------------------------------------------------------------------------------- /libraries/EnergySaving/examples/WakeUpOnRTCInterrupt/WakeUpOnRTCInterrupt.ino: -------------------------------------------------------------------------------- 1 | /*********************************************************************************************** 2 | This sketch demonstrates how to use sleep features and wake-up MCU with RTC alarm interrupt. 3 | This sketch works only on cortex-m0+ based boards. 4 | ************************************************************************************************/ 5 | 6 | #include 7 | #include 8 | 9 | EnergySaving nrgSave; 10 | RTCInt rtc; 11 | 12 | unsigned int i=0; 13 | 14 | void setup() 15 | { 16 | SerialUSB.begin(9600); //serial settings 17 | 18 | pinMode(13,OUTPUT); //led RX 19 | 20 | rtc.begin(TIME_H24); 21 | rtc.setTime(12,48,0,0); 22 | rtc.setDate(22,10,15); 23 | rtc.enableAlarm(SEC,ALARM_INTERRUPT,rest_alarm_int); 24 | rtc.time.hour=12; 25 | rtc.time.minute=48; 26 | rtc.time.second=30; 27 | nrgSave.begin(WAKE_RTC_ALARM); //standby setup for external interrupts 28 | rtc.setAlarm(); 29 | SerialUSB.println("START"); 30 | } 31 | 32 | void loop() 33 | { 34 | for(i=0; i<20; i++) 35 | { 36 | digitalWrite(13,HIGH); 37 | delay(500); 38 | digitalWrite(13,LOW); 39 | delay(500); 40 | } 41 | 42 | digitalWrite(13,LOW); 43 | nrgSave.standby(); //now mcu go to standby 44 | } 45 | 46 | void rest_alarm_int(void) //interrupt routine 47 | { 48 | //PORT->Group[1].OUTSET.reg = 0x1u<<3; 49 | digitalWrite(13,HIGH); 50 | 51 | //SerialUSB.println("HELLO"); 52 | } 53 | -------------------------------------------------------------------------------- /libraries/EnergySaving/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For Energy Saving 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | EnergySaving KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | begin KEYWORD2 16 | standby KEYWORD2 17 | 18 | 19 | 20 | ####################################### 21 | # Constants (LITERAL1) 22 | ####################################### 23 | WAKE_EXT_INTERRUPT LITERAL1 24 | WAKE_RTC_ALARM LITERAL1 25 | -------------------------------------------------------------------------------- /libraries/EnergySaving/library.properties: -------------------------------------------------------------------------------- 1 | name=Energy Saving 2 | version=1.0.0 3 | author=Arduino Srl 4 | maintainer=Arduino Srl 5 | sentence=Energy Saving features for corte-m0+ Arduino Boards, using sleep features. 6 | paragraph=With this library you can manage the power of Arduino boards based on cortex-m0+ (like Tian and M0) 7 | category=Device Control 8 | url=http://labs.arduino.org/EnergySaving 9 | architectures=samd 10 | -------------------------------------------------------------------------------- /libraries/EnergySaving/src/EnergySaving.cpp: -------------------------------------------------------------------------------- 1 | #include "EnergySaving.h" 2 | 3 | void EnergySaving::begin(unsigned int mode, unsigned int inter_pin, voidFuncPtr callback) 4 | { 5 | if((mode == WAKE_EXT_INTERRUPT) && (inter_pin !=2) && (inter_pin!=0) && (inter_pin!=1)) 6 | { 7 | NVMCTRL->CTRLB.bit.SLEEPPRM = 3; 8 | 9 | SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; 10 | pinMode(inter_pin,INPUT_PULLUP); 11 | 12 | attachInterrupt(inter_pin,callback, CHANGE); 13 | enable_eic_wake(inter_pin); 14 | set_clk(); 15 | 16 | } 17 | else return; 18 | } 19 | 20 | 21 | void EnergySaving::begin(unsigned int mode) 22 | { 23 | if(mode == WAKE_RTC_ALARM) 24 | { 25 | //RTCInt.begin(TIME_H24); 26 | 27 | GCLK->CLKCTRL.bit.CLKEN = 0; //disable GCLK module 28 | while (GCLK->STATUS.bit.SYNCBUSY); 29 | 30 | GCLK->GENCTRL.bit.RUNSTDBY = 1; //GCLK6 run standby 31 | while (GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY); 32 | 33 | GCLK->CLKCTRL.bit.CLKEN = 1; //disable GCLK module 34 | while (GCLK->STATUS.bit.SYNCBUSY); 35 | 36 | NVMCTRL->CTRLB.bit.SLEEPPRM = 3; 37 | 38 | SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; 39 | 40 | } 41 | else return; 42 | 43 | } 44 | 45 | 46 | void EnergySaving::standby(void) 47 | { 48 | __DSB(); 49 | __WFI(); 50 | 51 | } 52 | 53 | 54 | void EnergySaving::set_clk(void) 55 | { 56 | GCLK->CLKCTRL.bit.CLKEN = 0; //disable GCLK module 57 | while (GCLK->STATUS.bit.SYNCBUSY); 58 | 59 | GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK6 | GCLK_CLKCTRL_ID( GCM_EIC )) ; //EIC clock switched on GCLK6 60 | while (GCLK->STATUS.bit.SYNCBUSY); 61 | 62 | GCLK->GENCTRL.reg = (GCLK_GENCTRL_GENEN | GCLK_GENCTRL_SRC_OSCULP32K | GCLK_GENCTRL_ID(6)); //source for GCLK6 is OSCULP32K 63 | while (GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY); 64 | 65 | GCLK->GENCTRL.bit.RUNSTDBY = 1; //GCLK6 run standby 66 | while (GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY); 67 | 68 | } 69 | 70 | 71 | void EnergySaving::enable_eic_wake(unsigned int inter_pin) 72 | { 73 | switch(inter_pin) 74 | { 75 | case 3: 76 | EIC->WAKEUP.bit.WAKEUPEN9 = 1; 77 | break; 78 | case 4: 79 | EIC->WAKEUP.bit.WAKEUPEN14 = 1; 80 | break; 81 | case 5: 82 | EIC->WAKEUP.bit.WAKEUPEN15 = 1; 83 | break; 84 | case 6: 85 | //EIC->WAKEUP.bit.WAKEUPEN20 = 1; //non si può usare 86 | break; 87 | case 7: 88 | //EIC->WAKEUP.bit.WAKEUPEN21 = 1; //non si può usare 89 | break; 90 | case 8: 91 | EIC->WAKEUP.bit.WAKEUPEN6 = 1; 92 | break; 93 | case 9: 94 | EIC->WAKEUP.bit.WAKEUPEN7 = 1; 95 | break; 96 | case 10: 97 | //EIC->WAKEUP.bit.WAKEUPEN18 = 1; //non si può usare 98 | break; 99 | case 11: 100 | //EIC->WAKEUP.bit.WAKEUPEN16 = 1; //non c'è 101 | break; 102 | case 12: 103 | //EIC->WAKEUP.bit.WAKEUPEN19 = 1; //non si può usare 104 | break; 105 | case 13: 106 | //EIC->WAKEUP.bit.WAKEUPEN17 = 1; //non c'è 107 | break; 108 | default: 109 | break; 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /libraries/EnergySaving/src/EnergySaving.h: -------------------------------------------------------------------------------- 1 | #ifndef energy_saving_h 2 | #define energy_saving_h 3 | 4 | 5 | #include 6 | #include 7 | 8 | #define WAKE_EXT_INTERRUPT 1 9 | #define WAKE_RTC_ALARM 2 10 | 11 | typedef void (*voidFuncPtr)( void ) ; 12 | 13 | class EnergySaving { 14 | public: 15 | //sleep(); 16 | void begin(unsigned int mode, unsigned int inter_pin, voidFuncPtr callback); 17 | void begin(unsigned int mode); 18 | void standby(void); 19 | 20 | private: 21 | void set_clk(void); 22 | void enable_eic_wake(unsigned int inter_pin); 23 | 24 | }; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /libraries/FlashStorage/examples/FlashStoreAndRetrieve/FlashStoreAndRetrieve.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Store and retrieve an integer value in Flash memory. 3 | The value is increased each time the board is restarted. 4 | 5 | This example code is in the public domain. 6 | 7 | Written 30 Apr 2015 by Cristian Maglie 8 | */ 9 | 10 | #include 11 | 12 | // Reserve a portion of flash memory to store an "int" variable 13 | // and call it "my_flash_store". 14 | FlashStorage(my_flash_store, int); 15 | 16 | // Note: the area of flash memory reserved for the variable is 17 | // lost every time the sketch is uploaded on the board. 18 | 19 | void setup() { 20 | SerialUSB.begin(9600); 21 | while(!SerialUSB); 22 | 23 | int number; 24 | 25 | // Read the content of "my_flash_store" and assign it to "number" 26 | number = my_flash_store.read(); 27 | 28 | // Print the current number on the serial monitor 29 | SerialUSB.println(number); 30 | 31 | // Save into "my_flash_store" the number increased by 1 for the 32 | // next run of the sketch 33 | my_flash_store.write(number + 1); 34 | } 35 | 36 | void loop() { 37 | // Do nothing... 38 | } 39 | 40 | -------------------------------------------------------------------------------- /libraries/FlashStorage/examples/StoreNameAndSurname/StoreNameAndSurname.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Store and retrieve structured data in Flash memory. 3 | 4 | This example code is in the public domain. 5 | 6 | Written 30 Apr 2015 by Cristian Maglie 7 | */ 8 | 9 | #include 10 | 11 | // Create a structure that is big enough to contain a name 12 | // and a surname. The "valid" variable is set to "true" once 13 | // the structure is filled with actual data for the first time. 14 | typedef struct { 15 | boolean valid; 16 | char name[100]; 17 | char surname[100]; 18 | } Person; 19 | 20 | // Reserve a portion of flash memory to store a "Person" and 21 | // call it "my_flash_store". 22 | FlashStorage(my_flash_store, Person); 23 | 24 | // Note: the area of flash memory reserved lost every time 25 | // the sketch is uploaded on the board. 26 | 27 | void setup() { 28 | SerialUSB.begin(9600); 29 | while (!SerialUSB) { } 30 | 31 | // Create a "Person" variable and call it "owner" 32 | Person owner; 33 | 34 | // Read the content of "my_flash_store" into the "owner" variable 35 | owner = my_flash_store.read(); 36 | 37 | // If this is the first run the "valid" value should be "false"... 38 | if (owner.valid == false) { 39 | 40 | // ...in this case we ask for user data. 41 | SerialUSB.setTimeout(30000); 42 | SerialUSB.println("Insert your name:"); 43 | String name = SerialUSB.readStringUntil('\n'); 44 | SerialUSB.println("Insert your surname:"); 45 | String surname = SerialUSB.readStringUntil('\n'); 46 | 47 | // Fill the "owner" structure with the data entered by the user... 48 | name.toCharArray(owner.name, 100); 49 | surname.toCharArray(owner.surname, 100); 50 | // set "valid" to true, so the next time we know that we 51 | // have valid data inside 52 | owner.valid = true; 53 | 54 | // ...and finally save everything into "my_flash_store" 55 | my_flash_store.write(owner); 56 | 57 | // Print a confirmation of the data inserted. 58 | SerialUSB.println(); 59 | SerialUSB.print("Your name: "); 60 | SerialUSB.println(owner.name); 61 | SerialUSB.print("and your surname: "); 62 | SerialUSB.println(owner.surname); 63 | SerialUSB.println("have been saved. Thank you!"); 64 | 65 | } else { 66 | 67 | // Say hello to the returning user! 68 | SerialUSB.println(); 69 | SerialUSB.print("Hi "); 70 | SerialUSB.print(owner.name); 71 | SerialUSB.print(" "); 72 | SerialUSB.print(owner.surname); 73 | SerialUSB.println(", nice to see you again :-)"); 74 | } 75 | } 76 | 77 | void loop() { 78 | // Do nothing... 79 | } 80 | 81 | -------------------------------------------------------------------------------- /libraries/FlashStorage/library.properties: -------------------------------------------------------------------------------- 1 | name=FlashStorage 2 | version=0.5.0 3 | author=Cristian Maglie 4 | maintainer=Arduino 5 | sentence=Store data in flash memory. 6 | paragraph=Useful if the EEPROM is not available or too small. 7 | url=https://github.com/cmaglie/FlashStorage 8 | architectures=samd 9 | -------------------------------------------------------------------------------- /libraries/FlashStorage/src/FlashStorage.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2015 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 | 23 | // Concatenate after macro expansion 24 | #define PPCAT_NX(A, B) A ## B 25 | #define PPCAT(A, B) PPCAT_NX(A, B) 26 | 27 | #define Flash(name, size) \ 28 | __attribute__((__aligned__(256))) \ 29 | static const uint8_t PPCAT(_data,name)[(size+255)/256*256] = { }; \ 30 | FlashClass name(PPCAT(_data,name), size); 31 | 32 | #define FlashStorage(name, T) \ 33 | __attribute__((__aligned__(256))) \ 34 | static const uint8_t PPCAT(_data,name)[(sizeof(T)+255)/256*256] = { }; \ 35 | FlashStorageClass name(PPCAT(_data,name)); 36 | 37 | class FlashClass { 38 | public: 39 | FlashClass(const void *flash_addr = NULL, uint32_t size = 0); 40 | 41 | void write(const void *data) { write(flash_address, data, flash_size); } 42 | void erase() { erase(flash_address, flash_size); } 43 | void read(void *data) { read(flash_address, data, flash_size); } 44 | 45 | void write(const volatile void *flash_ptr, const void *data, uint32_t size); 46 | void erase(const volatile void *flash_ptr, uint32_t size); 47 | void read(const volatile void *flash_ptr, void *data, uint32_t size); 48 | 49 | private: 50 | void erase(const volatile void *flash_ptr); 51 | 52 | const uint32_t PAGE_SIZE, PAGES, MAX_FLASH, ROW_SIZE; 53 | const volatile void *flash_address; 54 | const uint32_t flash_size; 55 | }; 56 | 57 | template 58 | class FlashStorageClass { 59 | public: 60 | FlashStorageClass(const void *flash_addr) : flash(flash_addr, sizeof(T)) { }; 61 | 62 | // Write data into flash memory. 63 | // Compiler is able to optimize parameter copy. 64 | inline void write(T data) { flash.erase(); flash.write(&data); } 65 | 66 | // Read data from flash into variable. 67 | inline void read(T *data) { flash.read(data); } 68 | 69 | // Overloaded version of read. 70 | // Compiler is able to optimize copy-on-return. 71 | inline T read() { T data; read(&data); return data; } 72 | 73 | private: 74 | FlashClass flash; 75 | }; 76 | 77 | -------------------------------------------------------------------------------- /libraries/HID/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map HID 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | HID KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | begin KEYWORD2 15 | SendReport KEYWORD2 16 | AppendDescriptor KEYWORD2 17 | 18 | ####################################### 19 | # Constants (LITERAL1) 20 | ####################################### 21 | HID_TX LITERAL1 -------------------------------------------------------------------------------- /libraries/HID/library.properties: -------------------------------------------------------------------------------- 1 | name=HID 2 | version=1.0 3 | author=Arduino 4 | maintainer=Arduino 5 | sentence=Module for PluggableUSB infrastructure. Exposes an API for devices like Keyboards, Mice and Gamepads 6 | paragraph= 7 | category=Other 8 | url=http://www.arduino.cc/en/Reference/HID 9 | architectures=samd 10 | -------------------------------------------------------------------------------- /libraries/I2S/examples/InputSerialPlotter/InputSerialPlotter.ino: -------------------------------------------------------------------------------- 1 | /* 2 | This example reads audio data from an Invensense's ICS43432 I2S microphone 3 | breakout board, and prints out the samples to the Serial console. The 4 | Serial Plotter built into the Arduino IDE can be used to plot the audio 5 | data (Tools -> Serial Plotter) 6 | 7 | Circuit: 8 | * Arduino/Genuino Zero, MKRZero or MKR1000 board 9 | * ICS43432: 10 | * GND connected GND 11 | * 3.3V connected 3.3V (Zero) or VCC (MKR1000, MKRZero) 12 | * WS connected to pin 0 (Zero) or pin 3 (MKR1000, MKRZero) 13 | * CLK connected to pin 1 (Zero) or pin 2 (MKR1000, MKRZero) 14 | * SD connected to pin 9 (Zero) or pin A6 (MKR1000, MKRZero) 15 | 16 | created 17 November 2016 17 | by Sandeep Mistry 18 | */ 19 | 20 | #include 21 | 22 | void setup() { 23 | // Open serial communications and wait for port to open: 24 | // A baud rate of 115200 is used instead of 9600 for a faster data rate 25 | // on non-native USB ports 26 | Serial.begin(115200); 27 | while (!Serial) { 28 | ; // wait for serial port to connect. Needed for native USB port only 29 | } 30 | 31 | // start I2S at 8 kHz with 32-bits per sample 32 | if (!I2S.begin(I2S_PHILIPS_MODE, 8000, 32)) { 33 | Serial.println("Failed to initialize I2S!"); 34 | while (1); // do nothing 35 | } 36 | } 37 | 38 | void loop() { 39 | // read a sample 40 | int sample = I2S.read(); 41 | 42 | if (sample) { 43 | // if it's non-zero print value to serial 44 | Serial.println(sample); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /libraries/I2S/examples/SimpleTone/SimpleTone.ino: -------------------------------------------------------------------------------- 1 | /* 2 | This example generates a square wave based tone at a specified frequency 3 | and sample rate. Then outputs the data using the I2S interface to a 4 | MAX08357 I2S Amp Breakout board. 5 | 6 | Circuit: 7 | * Arduino/Genuino Zero, MKRZero or MKR1000 board 8 | * MAX08357: 9 | * GND connected GND 10 | * VIN connected 5V 11 | * LRC connected to pin 0 (Zero) or pin 3 (MKR1000, MKRZero) 12 | * BCLK connected to pin 1 (Zero) or pin 2 (MKR1000, MKRZero) 13 | * DIN connected to pin 9 (Zero) or pin A6 (MKR1000, MKRZero) 14 | 15 | created 17 November 2016 16 | by Sandeep Mistry 17 | */ 18 | 19 | #include 20 | 21 | const int frequency = 440; // frequency of square wave in Hz 22 | const int amplitude = 500; // amplitude of square wave 23 | const int sampleRate = 8000; // sample rate in Hz 24 | 25 | const int halfWavelength = (sampleRate / frequency); // half wavelength of square wave 26 | 27 | short sample = amplitude; // current sample value 28 | int count = 0; 29 | 30 | void setup() { 31 | Serial.begin(9600); 32 | Serial.println("I2S simple tone"); 33 | 34 | // start I2S at the sample rate with 16-bits per sample 35 | if (!I2S.begin(I2S_PHILIPS_MODE, sampleRate, 16)) { 36 | Serial.println("Failed to initialize I2S!"); 37 | while (1); // do nothing 38 | } 39 | } 40 | 41 | void loop() { 42 | if (count % halfWavelength == 0) { 43 | // invert the sample every half wavelength count multiple to generate square wave 44 | sample = -1 * sample; 45 | } 46 | 47 | // write the same sample twice, once for left and once for the right channel 48 | I2S.write(sample); 49 | I2S.write(sample); 50 | 51 | // increment the counter for the next sample 52 | count++; 53 | } 54 | -------------------------------------------------------------------------------- /libraries/I2S/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map I2S 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | I2S KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | begin KEYWORD2 15 | end KEYWORD2 16 | 17 | onReceive KEYWORD2 18 | onTransmit KEYWORD2 19 | 20 | ####################################### 21 | # Constants (LITERAL1) 22 | ####################################### 23 | I2S_PHILIPS_MODE LITERAL1 24 | I2S_RIGHT_JUSTIFIED_MODE LITERAL1 25 | I2S_LEFT_JUSTIFIED_MODE LITERAL1 26 | -------------------------------------------------------------------------------- /libraries/I2S/library.properties: -------------------------------------------------------------------------------- 1 | name=I2S 2 | version=1.0 3 | author=Arduino 4 | maintainer=Arduino 5 | sentence=Enables the communication with devices that use the Inter-IC Sound (I2S) Bus. Specific implementation for Arduino Zero. 6 | paragraph= 7 | category=Communication 8 | url=http://www.arduino.cc/en/Reference/I2S 9 | architectures=samd 10 | -------------------------------------------------------------------------------- /libraries/I2S/src/utility/DMA.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 | #pragma once 19 | 20 | #if defined(__SAMD51__) 21 | #define NUM_DMA_CHANNELS 4 22 | #else 23 | #define NUM_DMA_CHANNELS 1 24 | #endif 25 | 26 | /* 27 | WARNING: The API for this class may change and it's not intended for public use! 28 | */ 29 | class DMAClass 30 | { 31 | public: 32 | DMAClass(); 33 | virtual ~DMAClass(); 34 | 35 | void begin(); 36 | void end(); 37 | 38 | int allocateChannel(); 39 | void freeChannel(int channel); 40 | 41 | void setPriorityLevel(int channel, int level); 42 | void setTriggerSource(int channel, int source); 43 | void setTransferWidth(int channel, int transferWidth); 44 | void incSrc(int channel); 45 | void incDst(int channel); 46 | int transfer(int channel, void* src, void* dst, uint16_t size); 47 | 48 | void onTransferComplete(int channel, void(*function)(int)); 49 | void onTransferError(int channel, void(*function)(int)); 50 | 51 | void onService(); 52 | 53 | private: 54 | static int _beginCount; 55 | uint32_t _channelMask; 56 | 57 | void (*_transferCompleteCallbacks[NUM_DMA_CHANNELS])(int); 58 | void (*_transferErrorCallbacks[NUM_DMA_CHANNELS])(int); 59 | 60 | DmacDescriptor _descriptors[NUM_DMA_CHANNELS] __attribute__ ((aligned (16))); 61 | DmacDescriptor _descriptorsWriteBack[NUM_DMA_CHANNELS] __attribute__ ((aligned (16))); 62 | }; 63 | 64 | extern DMAClass DMA; 65 | -------------------------------------------------------------------------------- /libraries/I2S/src/utility/I2SDoubleBuffer.cpp: -------------------------------------------------------------------------------- 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 | #include 20 | 21 | #include "I2SDoubleBuffer.h" 22 | 23 | I2SDoubleBuffer::I2SDoubleBuffer() 24 | { 25 | reset(); 26 | } 27 | 28 | I2SDoubleBuffer::~I2SDoubleBuffer() 29 | { 30 | } 31 | 32 | void I2SDoubleBuffer::reset() 33 | { 34 | _index = 0; 35 | _length[0] = 0; 36 | _length[1] = 0; 37 | _readOffset[0] = 0; 38 | _readOffset[1] = 0; 39 | } 40 | 41 | size_t I2SDoubleBuffer::availableForWrite() 42 | { 43 | return (I2S_BUFFER_SIZE - (_length[_index] - _readOffset[_index])); 44 | } 45 | 46 | size_t I2SDoubleBuffer::write(const void *buffer, size_t size) 47 | { 48 | size_t space = availableForWrite(); 49 | 50 | if (size > space) { 51 | size = space; 52 | } 53 | 54 | if (size == 0) { 55 | return 0; 56 | } 57 | 58 | memcpy(&_buffer[_index][_length[_index]], buffer, size); 59 | 60 | _length[_index] += size; 61 | 62 | return size; 63 | } 64 | 65 | size_t I2SDoubleBuffer::read(void *buffer, size_t size) 66 | { 67 | size_t avail = available(); 68 | 69 | if (size > avail) { 70 | size = avail; 71 | } 72 | 73 | if (size == 0) { 74 | return 0; 75 | } 76 | 77 | memcpy(buffer, &_buffer[_index][_readOffset[_index]], size); 78 | _readOffset[_index] += size; 79 | 80 | return size; 81 | } 82 | 83 | size_t I2SDoubleBuffer::peek(void *buffer, size_t size) 84 | { 85 | size_t avail = available(); 86 | 87 | if (size > avail) { 88 | size = avail; 89 | } 90 | 91 | if (size == 0) { 92 | return 0; 93 | } 94 | 95 | memcpy(buffer, &_buffer[_index][_readOffset[_index]], size); 96 | 97 | return size; 98 | } 99 | 100 | void* I2SDoubleBuffer::data() 101 | { 102 | return (void*)_buffer[_index]; 103 | } 104 | 105 | size_t I2SDoubleBuffer::available() 106 | { 107 | return _length[_index] - _readOffset[_index]; 108 | } 109 | 110 | void I2SDoubleBuffer::swap(int length) 111 | { 112 | if (_index == 0) { 113 | _index = 1; 114 | } else { 115 | _index = 0; 116 | } 117 | 118 | _length[_index] = length; 119 | _readOffset[_index] = 0; 120 | } 121 | -------------------------------------------------------------------------------- /libraries/I2S/src/utility/I2SDoubleBuffer.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 | #ifndef _I2S_DOUBLE_BUFFER_H_INCLUDED 20 | #define _I2S_DOUBLE_BUFFER_H_INCLUDED 21 | 22 | #include 23 | #include 24 | 25 | #define I2S_BUFFER_SIZE 512 26 | 27 | class I2SDoubleBuffer 28 | { 29 | public: 30 | I2SDoubleBuffer(); 31 | virtual ~I2SDoubleBuffer(); 32 | 33 | void reset(); 34 | 35 | size_t availableForWrite(); 36 | size_t write(const void *buffer, size_t size); 37 | size_t read(void *buffer, size_t size); 38 | size_t peek(void *buffer, size_t size); 39 | void* data(); 40 | size_t available(); 41 | void swap(int length = 0); 42 | 43 | private: 44 | uint8_t _buffer[2][I2S_BUFFER_SIZE]; 45 | volatile int _length[2]; 46 | volatile int _readOffset[2]; 47 | volatile int _index; 48 | }; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /libraries/LoRaWan/License.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 Seeed Technology Inc. 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 13 | all 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 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /libraries/LoRaWan/examples/ABP/ABP.ino: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | 5 | unsigned char data[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0xA,}; 6 | char buffer[256]; 7 | 8 | 9 | void setup(void) 10 | { 11 | SerialUSB.begin(115200); 12 | while(!SerialUSB); 13 | 14 | lora.init(); 15 | 16 | memset(buffer, 0, 256); 17 | lora.getVersion(buffer, 256, 1); 18 | SerialUSB.print(buffer); 19 | 20 | memset(buffer, 0, 256); 21 | lora.getId(buffer, 256, 1); 22 | SerialUSB.print(buffer); 23 | 24 | lora.setKey("2B7E151628AED2A6ABF7158809CF4F3C", "2B7E151628AED2A6ABF7158809CF4F3C", "2B7E151628AED2A6ABF7158809CF4F3C"); 25 | 26 | lora.setDeciveMode(LWABP); 27 | lora.setDataRate(DR0, EU868); 28 | 29 | lora.setChannel(0, 868.1); 30 | lora.setChannel(1, 868.3); 31 | lora.setChannel(2, 868.5); 32 | 33 | lora.setReceiceWindowFirst(0, 868.1); 34 | lora.setReceiceWindowSecond(869.5, DR3); 35 | 36 | lora.setDutyCycle(false); 37 | lora.setJoinDutyCycle(false); 38 | 39 | lora.setPower(14); 40 | } 41 | 42 | void loop(void) 43 | { 44 | bool result = false; 45 | 46 | result = lora.transferPacket("Hello World!", 10); 47 | //result = lora.transferPacket(data, 10, 10); 48 | 49 | if(result) 50 | { 51 | short length; 52 | short rssi; 53 | 54 | memset(buffer, 0, 256); 55 | length = lora.receivePacket(buffer, 256, &rssi); 56 | 57 | if(length) 58 | { 59 | SerialUSB.print("Length is: "); 60 | SerialUSB.println(length); 61 | SerialUSB.print("RSSI is: "); 62 | SerialUSB.println(rssi); 63 | SerialUSB.print("Data is: "); 64 | for(unsigned char i = 0; i < length; i ++) 65 | { 66 | SerialUSB.print("0x"); 67 | SerialUSB.print(buffer[i], HEX); 68 | SerialUSB.print(" "); 69 | } 70 | SerialUSB.println(); 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /libraries/LoRaWan/examples/OTAA/OTAA.ino: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | 5 | unsigned char data[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0xA,}; 6 | char buffer[256]; 7 | 8 | 9 | void setup(void) 10 | { 11 | SerialUSB.begin(115200); 12 | while(!SerialUSB); 13 | 14 | lora.init(); 15 | 16 | memset(buffer, 0, 256); 17 | lora.getVersion(buffer, 256, 1); 18 | SerialUSB.print(buffer); 19 | 20 | memset(buffer, 0, 256); 21 | lora.getId(buffer, 256, 1); 22 | SerialUSB.print(buffer); 23 | 24 | lora.setKey("2B7E151628AED2A6ABF7158809CF4F3C", "2B7E151628AED2A6ABF7158809CF4F3C", "2B7E151628AED2A6ABF7158809CF4F3C"); 25 | 26 | lora.setDeciveMode(LWOTAA); 27 | lora.setDataRate(DR0, EU868); 28 | 29 | lora.setChannel(0, 868.1); 30 | lora.setChannel(1, 868.3); 31 | lora.setChannel(2, 868.5); 32 | 33 | lora.setReceiceWindowFirst(0, 868.1); 34 | lora.setReceiceWindowSecond(869.5, DR3); 35 | 36 | lora.setDutyCycle(false); 37 | lora.setJoinDutyCycle(false); 38 | 39 | lora.setPower(14); 40 | 41 | while(!lora.setOTAAJoin(JOIN)); 42 | } 43 | 44 | void loop(void) 45 | { 46 | bool result = false; 47 | 48 | result = lora.transferPacket("Hello World!", 10); 49 | //result = lora.transferPacket(data, 10, 10); 50 | 51 | if(result) 52 | { 53 | short length; 54 | short rssi; 55 | 56 | memset(buffer, 0, 256); 57 | length = lora.receivePacket(buffer, 256, &rssi); 58 | 59 | if(length) 60 | { 61 | SerialUSB.print("Length is: "); 62 | SerialUSB.println(length); 63 | SerialUSB.print("RSSI is: "); 64 | SerialUSB.println(rssi); 65 | SerialUSB.print("Data is: "); 66 | for(unsigned char i = 0; i < length; i ++) 67 | { 68 | SerialUSB.print("0x"); 69 | SerialUSB.print(buffer[i], HEX); 70 | SerialUSB.print(" "); 71 | } 72 | SerialUSB.println(); 73 | } 74 | } 75 | } 76 | 77 | 78 | -------------------------------------------------------------------------------- /libraries/LoRaWan/examples/p2p_rx/p2p_rx.ino: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | 5 | unsigned char buffer[128] = {0, }; 6 | 7 | 8 | void setup(void) 9 | { 10 | SerialUSB.begin(115200); 11 | 12 | lora.init(); 13 | 14 | lora.initP2PMode(433, SF12, BW125, 8, 8, 20); 15 | } 16 | 17 | void loop(void) 18 | { 19 | short length = 0; 20 | short rssi = 0; 21 | 22 | memset(buffer, 0, 128); 23 | length = lora.receivePacketP2PMode(buffer, 128, &rssi, 1); 24 | 25 | if(length) 26 | { 27 | SerialUSB.print("Length is: "); 28 | SerialUSB.println(length); 29 | SerialUSB.print("RSSI is: "); 30 | SerialUSB.println(rssi); 31 | SerialUSB.print("Data is: "); 32 | for(unsigned char i = 0; i < length; i ++) 33 | { 34 | SerialUSB.print("0x"); 35 | SerialUSB.print(buffer[i], HEX); 36 | SerialUSB.print(" "); 37 | } 38 | SerialUSB.println(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /libraries/LoRaWan/examples/p2p_tx/p2p_tx.ino: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | 5 | unsigned char buffer[128] = {0xef, 0xff, 0x55, 3, 4, 5, 6, 7, 8, 9,}; 6 | 7 | 8 | void setup(void) 9 | { 10 | SerialUSB.begin(115200); 11 | 12 | lora.init(); 13 | 14 | lora.initP2PMode(433, SF12, BW125, 8, 8, 20); 15 | } 16 | 17 | void loop(void) 18 | { 19 | lora.transferPacketP2PMode("Hello World!"); 20 | SerialUSB.println("Send string."); 21 | delay(3000); 22 | lora.transferPacketP2PMode(buffer, 10); 23 | SerialUSB.println("Send hex."); 24 | delay(3000); 25 | } 26 | -------------------------------------------------------------------------------- /libraries/SPI/examples/DigitalPotControl/DigitalPotControl.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Digital Pot Control 3 | 4 | This example controls an Analog Devices AD5206 digital potentiometer. 5 | The AD5206 has 6 potentiometer channels. Each channel's pins are labeled 6 | A - connect this to voltage 7 | W - this is the pot's wiper, which changes when you set it 8 | B - connect this to ground. 9 | 10 | The AD5206 is SPI-compatible,and to command it, you send two bytes, 11 | one with the channel number (0 - 5) and one with the resistance value for the 12 | channel (0 - 255). 13 | 14 | The circuit: 15 | * All A pins of AD5206 connected to +5V 16 | * All B pins of AD5206 connected to ground 17 | * An LED and a 220-ohm resisor in series connected from each W pin to ground 18 | * CS - to digital pin 10 (SS pin) 19 | * SDI - to digital pin 11 (MOSI pin) 20 | * CLK - to digital pin 13 (SCK pin) 21 | 22 | created 10 Aug 2010 23 | by Tom Igoe 24 | 25 | Thanks to Heather Dewey-Hagborg for the original tutorial, 2005 26 | 27 | */ 28 | 29 | 30 | // inslude the SPI library: 31 | #include 32 | 33 | 34 | // set pin 10 as the slave select for the digital pot: 35 | const int slaveSelectPin = 10; 36 | 37 | void setup() { 38 | // set the slaveSelectPin as an output: 39 | pinMode (slaveSelectPin, OUTPUT); 40 | // initialize SPI: 41 | SPI.begin(); 42 | } 43 | 44 | void loop() { 45 | // go through the six channels of the digital pot: 46 | for (int channel = 0; channel < 6; channel++) { 47 | // change the resistance on this channel from min to max: 48 | for (int level = 0; level < 255; level++) { 49 | digitalPotWrite(channel, level); 50 | delay(10); 51 | } 52 | // wait a second at the top: 53 | delay(100); 54 | // change the resistance on this channel from max to min: 55 | for (int level = 0; level < 255; level++) { 56 | digitalPotWrite(channel, 255 - level); 57 | delay(10); 58 | } 59 | } 60 | 61 | } 62 | 63 | void digitalPotWrite(int address, int value) { 64 | // take the SS pin low to select the chip: 65 | digitalWrite(slaveSelectPin, LOW); 66 | // send in the address and value via SPI: 67 | SPI.transfer(address); 68 | SPI.transfer(value); 69 | // take the SS pin high to de-select the chip: 70 | digitalWrite(slaveSelectPin, HIGH); 71 | } 72 | -------------------------------------------------------------------------------- /libraries/SPI/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map SPI 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | SPI KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | begin KEYWORD2 15 | end KEYWORD2 16 | transfer KEYWORD2 17 | #setBitOrder KEYWORD2 18 | setDataMode KEYWORD2 19 | setClockDivider KEYWORD2 20 | 21 | 22 | ####################################### 23 | # Constants (LITERAL1) 24 | ####################################### 25 | SPI_MODE0 LITERAL1 26 | SPI_MODE1 LITERAL1 27 | SPI_MODE2 LITERAL1 28 | SPI_MODE3 LITERAL1 29 | 30 | SPI_CONTINUE LITERAL1 31 | SPI_LAST LITERAL1 32 | -------------------------------------------------------------------------------- /libraries/SPI/library.properties: -------------------------------------------------------------------------------- 1 | name=SPI 2 | version=1.0 3 | author=Jonathan BAUDIN, Thibaut VIARD, Arduino 4 | maintainer=Arduino 5 | sentence=Enables the communication with devices that use the Serial Peripheral Interface (SPI) Bus. Specific implementation for Arduino Zero. 6 | paragraph= 7 | category=Communication 8 | url=http://www.arduino.cc/en/Reference/SPI 9 | architectures=samd 10 | -------------------------------------------------------------------------------- /libraries/SoftwareSerial/examples/SoftwareSerialExample/SoftwareSerialExample.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Software serial multiple serial test 3 | 4 | Receives from the hardware serial, sends to software serial. 5 | Receives from software serial, sends to hardware serial. 6 | 7 | The circuit: 8 | * RX is digital pin 9 (connect to TX of other device) 9 | * TX is digital pin 10 (connect to RX of other device) 10 | 11 | Note: 12 | You shouldn't use pin 2 13 | 14 | This example code is in the public domain. 15 | 16 | */ 17 | 18 | #include 19 | 20 | SoftwareSerial mySerial(9, 10); // RX, TX 21 | 22 | void setup() 23 | { 24 | // Open serial communications and wait for port to open: 25 | SerialUSB.begin(115200); 26 | // set the data rate for the SoftwareSerial port 27 | mySerial.begin(9600); // Tx ok, Rx ok 28 | //mySerial.begin(19200); // Tx ok, Rx ok 29 | //mySerial.begin(38400); // Tx ok, Rx fail 30 | //mySerial.begin(57600); // Tx ok, Rx fail 31 | //mySerial.begin(115200); // Tx fail, Rx fail 32 | } 33 | 34 | void loop() // run over and over// 35 | { 36 | if (mySerial.available()) 37 | SerialUSB.write(mySerial.read()); 38 | 39 | if (SerialUSB.available()) 40 | mySerial.write(SerialUSB.read()); 41 | } 42 | 43 | -------------------------------------------------------------------------------- /libraries/SoftwareSerial/examples/TwoPortReceive/TwoPortReceive.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Software serial multple serial test 3 | 4 | Receives from the two software serial ports, 5 | sends to the hardware serial port. 6 | 7 | In order to listen on a software port, you call port.listen(). 8 | When using two software serial ports, you have to switch ports 9 | by listen()ing on each one in turn. Pick a logical time to switch 10 | ports, like the end of an expected transmission, or when the 11 | buffer is empty. This example switches ports when there is nothing 12 | more to read from a port 13 | 14 | The circuit: 15 | Two devices which communicate serially are needed. 16 | * First serial device's TX attached to digital pin 9, RX to pin 11 17 | * Second serial device's TX attached to digital pin 8, RX to pin 10 18 | 19 | This example code is in the public domain. 20 | 21 | */ 22 | 23 | #include 24 | // software serial #1: TX = digital pin 11, RX = digital pin 9 25 | SoftwareSerial portOne(9, 11); 26 | 27 | // software serial #2: TX = digital pin 10, RX = digital pin 8 28 | SoftwareSerial portTwo(8, 10); 29 | 30 | void setup() 31 | { 32 | // Open serial communications and wait for port to open: 33 | SerialUSB.begin(115200); 34 | 35 | // Start each software serial port 36 | portOne.begin(9600); 37 | portTwo.begin(9600); 38 | } 39 | 40 | void loop() 41 | { 42 | // By default, the last intialized port is listening. 43 | // when you want to listen on a port, explicitly select it: 44 | portOne.listen(); 45 | 46 | SerialUSB.println("Data from port one:"); 47 | // while there is data coming in, read it 48 | // and send to the hardware serial port: 49 | while (portOne.available() > 0) { 50 | char inByte = portOne.read(); 51 | SerialUSB.write(inByte); 52 | } 53 | 54 | // blank line to separate data from the two ports: 55 | SerialUSB.println(""); 56 | 57 | // Now listen on the second port 58 | portTwo.listen(); 59 | // while there is data coming in, read it 60 | // and send to the hardware serial port: 61 | 62 | SerialUSB.println("Data from port two:"); 63 | while (portTwo.available() > 0) { 64 | char inByte = portTwo.read(); 65 | SerialUSB.write(inByte); 66 | } 67 | 68 | // blank line to separate data from the two ports: 69 | SerialUSB.println(); 70 | } 71 | 72 | -------------------------------------------------------------------------------- /libraries/TimerTC3/TimerTC3.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _TIMER_TC3_H_ 3 | #define _TIMER_TC3_H_ 4 | 5 | 6 | #define CPU_HZ 48000000 7 | #define RESOLUTION 0xffff // Timer TC3 is 16 bit 8 | 9 | 10 | class TimerTC3 11 | { 12 | public: 13 | 14 | void initialize(long microseconds = 1000000); 15 | 16 | void setPeriod(long microseconds); 17 | 18 | void start(); 19 | void stop(); 20 | void restart(); 21 | 22 | void attachInterrupt(void (*isr)()); 23 | void detachInterrupt(); 24 | 25 | void (*isrCallback)(); 26 | }; 27 | 28 | 29 | extern TimerTC3 TimerTc3; 30 | 31 | 32 | #endif -------------------------------------------------------------------------------- /libraries/TimerTC3/examples/ISRBlink/ISRBlink.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | 4 | bool isLEDOn = false; 5 | char time = 0; 6 | 7 | void setup() 8 | { 9 | //SerialUSB.begin(115200); 10 | //while(!SerialUSB); 11 | 12 | pinMode(13, OUTPUT); 13 | 14 | TimerTc3.initialize(1000000); 15 | TimerTc3.attachInterrupt(timerIsr); 16 | } 17 | 18 | void loop() 19 | { 20 | /* 21 | time ++; 22 | if(time == 10)TimerTc3.detachInterrupt(); 23 | else if(time == 20) 24 | { 25 | TimerTc3.attachInterrupt(timerIsr); 26 | time = 0; 27 | } 28 | delay(1000); 29 | */ 30 | } 31 | 32 | void timerIsr() 33 | { 34 | digitalWrite(13, isLEDOn); 35 | isLEDOn = !isLEDOn; 36 | } -------------------------------------------------------------------------------- /libraries/TimerTCC0/TimerTCC0.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _TIMER_TCC0_H_ 3 | #define _TIMER_TCC0_H_ 4 | 5 | 6 | #define CPU_HZ 48000000 7 | #define RESOLUTION 0xffffff // Timer TCC0 is 24 bit 8 | 9 | 10 | class TimerTCC0 11 | { 12 | public: 13 | 14 | void initialize(long microseconds = 1000000); 15 | 16 | void setPeriod(long microseconds); 17 | 18 | void start(); 19 | void stop(); 20 | void restart(); 21 | 22 | void attachInterrupt(void (*isr)()); 23 | void detachInterrupt(); 24 | 25 | void (*isrCallback)(); 26 | }; 27 | 28 | 29 | extern TimerTCC0 TimerTcc0; 30 | 31 | 32 | #endif -------------------------------------------------------------------------------- /libraries/TimerTCC0/examples/ISRBlink/ISRBlink.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | 4 | bool isLEDOn = false; 5 | char time = 0; 6 | 7 | void setup() 8 | { 9 | //SerialUSB.begin(115200); 10 | //while(!SerialUSB); 11 | 12 | pinMode(13, OUTPUT); 13 | 14 | TimerTcc0.initialize(1000000); 15 | TimerTcc0.attachInterrupt(timerIsr); 16 | } 17 | 18 | void loop() 19 | { 20 | /* 21 | time ++; 22 | if(time == 10)TimerTcc0.detachInterrupt(); 23 | else if(time == 20) 24 | { 25 | TimerTcc0.attachInterrupt(timerIsr); 26 | time = 0; 27 | } 28 | delay(1000); 29 | */ 30 | } 31 | 32 | void timerIsr() 33 | { 34 | digitalWrite(13, isLEDOn); 35 | isLEDOn = !isLEDOn; 36 | } -------------------------------------------------------------------------------- /libraries/USBHost/examples/ADKTerminalTest/ADKTerminalTest.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012 Arduino. 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 | #define ARDUINO_MAIN 20 | //#include "variant.h" 21 | #include "Arduino.h" 22 | #include 23 | #include 24 | 25 | 26 | USBHost usb; 27 | ADK adk(&usb,"Arduino SA", 28 | "Arduino_Terminal", 29 | "Arduino Terminal for Android", 30 | "1.0", 31 | "http://labs.arduino.cc/uploads/ADK/ArduinoTerminal/ThibaultTerminal_ICS_0001.apk", 32 | "1"); 33 | 34 | void setup(void) 35 | { 36 | SERIAL_PORT_MONITOR.begin( 115200 ); 37 | while (!SERIAL_PORT_MONITOR); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection 38 | SERIAL_PORT_MONITOR.println("\r\nADK demo start"); 39 | 40 | if (usb.Init() == -1) 41 | SERIAL_PORT_MONITOR.println("OSC did not start."); 42 | 43 | delay(20); 44 | } 45 | 46 | #define RCVSIZE 128 47 | 48 | void loop(void) 49 | { 50 | uint8_t buf[RCVSIZE]; 51 | uint32_t nbread = 0; 52 | char helloworld[] = "Hello World!\r\n"; 53 | 54 | usb.Task(); 55 | 56 | if( adk.isReady() == false ) { 57 | return; 58 | } 59 | /* Write hello string to ADK */ 60 | adk.SndData(strlen(helloworld), (uint8_t *)helloworld); 61 | 62 | delay(1000); 63 | 64 | /* Read data from ADK and print to UART */ 65 | adk.RcvData((uint8_t *)&nbread, buf); 66 | if (nbread > 0) 67 | { 68 | SERIAL_PORT_MONITOR.print("RCV: "); 69 | for (uint32_t i = 0; i < nbread; ++i) 70 | { 71 | SERIAL_PORT_MONITOR.print((char)buf[i]); 72 | } 73 | SERIAL_PORT_MONITOR.print("\r\n"); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /libraries/USBHost/examples/USB_desc/pgmstrings.h: -------------------------------------------------------------------------------- 1 | #if !defined(__PGMSTRINGS_H__) 2 | #define __PGMSTRINGS_H__ 3 | 4 | #define LOBYTE(x) ((char*)(&(x)))[0] 5 | #define HIBYTE(x) ((char*)(&(x)))[1] 6 | #define BUFSIZE 256 //buffer size 7 | 8 | 9 | /* Print strings in Program Memory */ 10 | const char Gen_Error_str[] PROGMEM = "\r\nRequest error. Error code:\t"; 11 | const char Dev_Header_str[] PROGMEM ="\r\nDevice descriptor: "; 12 | const char Dev_Length_str[] PROGMEM ="\r\nDescriptor Length:\t"; 13 | const char Dev_Type_str[] PROGMEM ="\r\nDescriptor type:\t"; 14 | const char Dev_Version_str[] PROGMEM ="\r\nUSB version:\t\t"; 15 | const char Dev_Class_str[] PROGMEM ="\r\nDevice class:\t\t"; 16 | const char Dev_Subclass_str[] PROGMEM ="\r\nDevice Subclass:\t"; 17 | const char Dev_Protocol_str[] PROGMEM ="\r\nDevice Protocol:\t"; 18 | const char Dev_Pktsize_str[] PROGMEM ="\r\nMax.packet size:\t"; 19 | const char Dev_Vendor_str[] PROGMEM ="\r\nVendor ID:\t\t"; 20 | const char Dev_Product_str[] PROGMEM ="\r\nProduct ID:\t\t"; 21 | const char Dev_Revision_str[] PROGMEM ="\r\nRevision ID:\t\t"; 22 | const char Dev_Mfg_str[] PROGMEM ="\r\nMfg.string index:\t"; 23 | const char Dev_Prod_str[] PROGMEM ="\r\nProd.string index:\t"; 24 | const char Dev_Serial_str[] PROGMEM ="\r\nSerial number index:\t"; 25 | const char Dev_Nconf_str[] PROGMEM ="\r\nNumber of conf.:\t"; 26 | const char Conf_Trunc_str[] PROGMEM ="Total length truncated to 256 bytes"; 27 | const char Conf_Header_str[] PROGMEM ="\r\nConfiguration descriptor:"; 28 | const char Conf_Totlen_str[] PROGMEM ="\r\nTotal length:\t\t"; 29 | const char Conf_Nint_str[] PROGMEM ="\r\nNum.intf:\t\t"; 30 | const char Conf_Value_str[] PROGMEM ="\r\nConf.value:\t\t"; 31 | const char Conf_String_str[] PROGMEM ="\r\nConf.string:\t\t"; 32 | const char Conf_Attr_str[] PROGMEM ="\r\nAttr.:\t\t\t"; 33 | const char Conf_Pwr_str[] PROGMEM ="\r\nMax.pwr:\t\t"; 34 | const char Int_Header_str[] PROGMEM ="\r\n\r\nInterface descriptor:"; 35 | const char Int_Number_str[] PROGMEM ="\r\nIntf.number:\t\t"; 36 | const char Int_Alt_str[] PROGMEM ="\r\nAlt.:\t\t\t"; 37 | const char Int_Endpoints_str[] PROGMEM ="\r\nEndpoints:\t\t"; 38 | const char Int_Class_str[] PROGMEM ="\r\nIntf. Class:\t\t"; 39 | const char Int_Subclass_str[] PROGMEM ="\r\nIntf. Subclass:\t\t"; 40 | const char Int_Protocol_str[] PROGMEM ="\r\nIntf. Protocol:\t\t"; 41 | const char Int_String_str[] PROGMEM ="\r\nIntf.string:\t\t"; 42 | const char End_Header_str[] PROGMEM ="\r\n\r\nEndpoint descriptor:"; 43 | const char End_Address_str[] PROGMEM ="\r\nEndpoint address:\t"; 44 | const char End_Attr_str[] PROGMEM ="\r\nAttr.:\t\t\t"; 45 | const char End_Pktsize_str[] PROGMEM ="\r\nMax.pkt size:\t\t"; 46 | const char End_Interval_str[] PROGMEM ="\r\nPolling interval:\t"; 47 | const char Unk_Header_str[] PROGMEM = "\r\nUnknown descriptor:"; 48 | const char Unk_Length_str[] PROGMEM ="\r\nLength:\t\t"; 49 | const char Unk_Type_str[] PROGMEM ="\r\nType:\t\t"; 50 | const char Unk_Contents_str[] PROGMEM ="\r\nContents:\t"; 51 | 52 | #endif // __PGMSTRINGS_H__ -------------------------------------------------------------------------------- /libraries/USBHost/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For USBHost 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | MouseController KEYWORD1 10 | USBHost KEYWORD1 11 | KeyboardController KEYWORD1 12 | 13 | ####################################### 14 | # Methods and Functions (KEYWORD2) 15 | ####################################### 16 | 17 | Task KEYWORD2 18 | mouseMoved KEYWORD2 19 | mouseDragged KEYWORD2 20 | mousePressed KEYWORD2 21 | mouseReleased KEYWORD2 22 | getXChange KEYWORD2 23 | getYChange KEYWORD2 24 | getButton KEYWORD2 25 | keyPressed KEYWORD2 26 | keyReleased KEYWORD2 27 | getModifiers KEYWORD2 28 | getKey KEYWORD2 29 | getOemKey KEYWORD2 30 | 31 | 32 | ####################################### 33 | # Constants (LITERAL1) 34 | ####################################### 35 | 36 | -------------------------------------------------------------------------------- /libraries/USBHost/library.properties: -------------------------------------------------------------------------------- 1 | name=USBHost 2 | version=1.0 3 | author=Arduino 4 | maintainer=Arduino 5 | sentence=Allows the communication with USB peripherals like mice, keyboards, and thumbdrives. For Arduino MKR1000 and Zero. 6 | paragraph=The USBHost library allows the board to appear as a USB host, enabling it to communicate with peripherals like USB mice and keyboards. USBHost does not support devices that are connected through USB hubs. This includes some keyboards that have an internal hub. 7 | category=Other 8 | url=http://arduino.cc/en/Reference/USBHost 9 | architectures=samd 10 | -------------------------------------------------------------------------------- /libraries/USBHost/src/KeyboardController.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012 Arduino. 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 | #include 20 | 21 | extern "C" { 22 | void __keyboardControllerEmptyCallback() { } 23 | } 24 | 25 | void keyPressed() __attribute__ ((weak, alias("__keyboardControllerEmptyCallback"))); 26 | void keyReleased() __attribute__ ((weak, alias("__keyboardControllerEmptyCallback"))); 27 | 28 | void KeyboardController::OnKeyDown(uint8_t _mod, uint8_t _oemKey) { 29 | modifiers = _mod; 30 | keyOem = _oemKey; 31 | key = OemToAscii(_mod, _oemKey); 32 | keyPressed(); 33 | } 34 | 35 | void KeyboardController::OnKeyUp(uint8_t _mod, uint8_t _oemKey) { 36 | modifiers = _mod; 37 | keyOem = _oemKey; 38 | key = OemToAscii(_mod, _oemKey); 39 | keyReleased(); 40 | } 41 | -------------------------------------------------------------------------------- /libraries/USBHost/src/KeyboardController.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012 Arduino. 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 | #ifndef KEYBOARD_CONTROLLER_H 20 | #define KEYBOARD_CONTROLLER_H 21 | 22 | #include 23 | 24 | enum KeyboardModifiers { 25 | LeftCtrl = 1, 26 | LeftShift = 2, 27 | Alt = 4, 28 | LeftCmd = 8, 29 | RightCtrl = 16, 30 | RightShift = 32, 31 | AltGr = 64, 32 | RightCmd = 128 33 | }; 34 | 35 | class KeyboardController : public KeyboardReportParser { 36 | public: 37 | KeyboardController(USBHost &usb) : hostKeyboard(&usb), key(0), keyOem(0), modifiers(0) { 38 | hostKeyboard.SetReportParser(0, this); 39 | }; 40 | 41 | uint8_t getKey() { return key; }; 42 | uint8_t getModifiers() { return modifiers; }; 43 | uint8_t getOemKey() { return keyOem; }; 44 | 45 | protected: 46 | virtual void OnKeyDown(uint8_t mod, uint8_t key); 47 | virtual void OnKeyUp(uint8_t mod, uint8_t key); 48 | 49 | private: 50 | HIDBoot hostKeyboard; 51 | uint8_t key, keyOem, modifiers; 52 | }; 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /libraries/USBHost/src/MouseController.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 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 | #include 20 | 21 | extern "C" { 22 | void __mouseControllerEmptyCallback() { } 23 | } 24 | 25 | void mouseClicked() __attribute__ ((weak, alias("__mouseControllerEmptyCallback"))); 26 | void mouseDragged() __attribute__ ((weak, alias("__mouseControllerEmptyCallback"))); 27 | void mouseMoved() __attribute__ ((weak, alias("__mouseControllerEmptyCallback"))); 28 | void mousePressed() __attribute__ ((weak, alias("__mouseControllerEmptyCallback"))); 29 | void mouseReleased() __attribute__ ((weak, alias("__mouseControllerEmptyCallback"))); 30 | 31 | int MouseController::getXChange() { 32 | int r = dx; 33 | dx = 0; 34 | return r; 35 | } 36 | 37 | int MouseController::getYChange() { 38 | int r = dy; 39 | dy = 0; 40 | return r; 41 | } 42 | 43 | void MouseController::OnMouseMove(MOUSEINFO *mi) { 44 | dx += mi->dX; 45 | dy += mi->dY; 46 | if (buttons != 0) 47 | mouseDragged(); 48 | else 49 | mouseMoved(); 50 | } 51 | 52 | void MouseController::OnLeftButtonUp(MOUSEINFO * /* mi */) { 53 | buttons &= ~LEFT_BUTTON; 54 | mouseReleased(); 55 | mouseClicked(); 56 | } 57 | 58 | void MouseController::OnLeftButtonDown(MOUSEINFO * /* mi */) { 59 | buttons |= LEFT_BUTTON; 60 | mousePressed(); 61 | } 62 | 63 | void MouseController::OnMiddleButtonUp(MOUSEINFO * /* mi */) { 64 | buttons &= ~MIDDLE_BUTTON; 65 | mouseReleased(); 66 | mouseClicked(); 67 | } 68 | 69 | void MouseController::OnMiddleButtonDown(MOUSEINFO * /* mi */) { 70 | buttons |= MIDDLE_BUTTON; 71 | mousePressed(); 72 | } 73 | 74 | void MouseController::OnRightButtonUp(MOUSEINFO * /* mi */) { 75 | buttons &= ~RIGHT_BUTTON; 76 | mouseReleased(); 77 | mouseClicked(); 78 | } 79 | 80 | void MouseController::OnRightButtonDown(MOUSEINFO * /* mi */) { 81 | buttons |= RIGHT_BUTTON; 82 | mousePressed(); 83 | } 84 | -------------------------------------------------------------------------------- /libraries/USBHost/src/MouseController.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012 Arduino. 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 | #ifndef MOUSE_CONTROLLER_H 20 | #define MOUSE_CONTROLLER_H 21 | 22 | #include 23 | 24 | enum MouseButton { 25 | LEFT_BUTTON = 0x01, 26 | MIDDLE_BUTTON = 0x02, 27 | RIGHT_BUTTON = 0x04 28 | }; 29 | 30 | class MouseController : public MouseReportParser 31 | { 32 | public: 33 | MouseController(USBHost &usb) : hostMouse(&usb), dx(0), dy(0), buttons(0) { 34 | hostMouse.SetReportParser(0, this); 35 | }; 36 | 37 | bool getButton(MouseButton button) { return (buttons & button) == button; }; 38 | int getXChange(); 39 | int getYChange(); 40 | // int getWheelChange(); // Not implemented 41 | 42 | protected: 43 | virtual void OnMouseMove(MOUSEINFO *mi); 44 | virtual void OnLeftButtonUp(MOUSEINFO *mi); 45 | virtual void OnLeftButtonDown(MOUSEINFO *mi); 46 | virtual void OnMiddleButtonUp(MOUSEINFO *mi); 47 | virtual void OnMiddleButtonDown(MOUSEINFO *mi); 48 | virtual void OnRightButtonUp(MOUSEINFO *mi); 49 | virtual void OnRightButtonDown(MOUSEINFO *mi); 50 | 51 | private: 52 | HIDBoot hostMouse; 53 | int dx, dy; 54 | int buttons; 55 | }; 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /libraries/USBHost/src/Usb.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Circuits At Home, LTD 14 | Web : http://www.circuitsathome.com 15 | e-mail : support@circuitsathome.com 16 | */ 17 | /* USB functions */ 18 | 19 | #ifndef USB_H_INCLUDED 20 | #define USB_H_INCLUDED 21 | #define _usb_h_ 22 | 23 | #include 24 | 25 | //#include "Arduino.h" 26 | #include "macros.h" 27 | // None of these should ever be included by a driver, or a user's sketch. 28 | 29 | #include "variant.h" 30 | #define USB_HOST_SERIAL SERIAL_PORT_MONITOR 31 | #include "Print.h" 32 | #include "printhex.h" 33 | #include "message.h" 34 | #include "hexdump.h" 35 | #include "sink_parser.h" 36 | 37 | #include "address.h" 38 | 39 | #include "usb_ch9.h" 40 | //#include "usbhost.h" 41 | #include "UsbCore.h" 42 | #include "parsetools.h" 43 | 44 | #include "confdescparser.h" 45 | 46 | #endif /* USB_H_INCLUDED */ 47 | -------------------------------------------------------------------------------- /libraries/USBHost/src/hexdump.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Circuits At Home, LTD 14 | Web : http://www.circuitsathome.com 15 | e-mail : support@circuitsathome.com 16 | */ 17 | #if !defined(_usb_h_) || defined(__HEXDUMP_H__) 18 | #error "Never include hexdump.h directly; include Usb.h instead" 19 | #else 20 | #define __HEXDUMP_H__ 21 | 22 | extern int UsbDEBUGlvl; 23 | 24 | template 25 | class HexDumper : public BASE_CLASS { 26 | uint8_t byteCount; 27 | OFFSET_TYPE byteTotal; 28 | 29 | public: 30 | 31 | HexDumper() : byteCount(0), byteTotal(0) { 32 | }; 33 | 34 | void Initialize() { 35 | byteCount = 0; 36 | byteTotal = 0; 37 | }; 38 | 39 | virtual void Parse(const LEN_TYPE len, const uint8_t *pbuf, const OFFSET_TYPE &offset); 40 | }; 41 | 42 | template 43 | void HexDumper::Parse(const LEN_TYPE len, const uint8_t *pbuf, const OFFSET_TYPE &offset) { 44 | if(UsbDEBUGlvl >= 0x80) { // Fully bypass this block of code if we do not debug. 45 | for(LEN_TYPE j = 0; j < len; j++, byteCount++, byteTotal++) { 46 | if(!byteCount) { 47 | PrintHex (byteTotal, 0x80); 48 | E_Notify(PSTR(": "), 0x80); 49 | } 50 | PrintHex (pbuf[j], 0x80); 51 | E_Notify(PSTR(" "), 0x80); 52 | 53 | if(byteCount == 15) { 54 | E_Notify(PSTR("\r\n"), 0x80); 55 | byteCount = 0xFF; 56 | } 57 | } 58 | } 59 | } 60 | 61 | #endif // __HEXDUMP_H__ 62 | -------------------------------------------------------------------------------- /libraries/USBHost/src/message.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Circuits At Home, LTD 14 | Web : http://www.circuitsathome.com 15 | e-mail : support@circuitsathome.com 16 | */ 17 | #if !defined(_usb_h_) || defined(__MESSAGE_H__) 18 | #error "Never include message.h directly; include Usb.h instead" 19 | #else 20 | #define __MESSAGE_H__ 21 | 22 | extern int UsbDEBUGlvl; 23 | 24 | void E_Notify(char const * msg, int lvl); 25 | void E_Notify(uint8_t b, int lvl); 26 | void E_NotifyStr(char const * msg, int lvl); 27 | void E_Notifyc(char c, int lvl); 28 | 29 | #ifdef DEBUG_USB_HOST 30 | #define Notify E_Notify 31 | #define NotifyStr E_NotifyStr 32 | #define Notifyc E_Notifyc 33 | void NotifyFailGetDevDescr(uint8_t reason); 34 | void NotifyFailSetDevTblEntry(uint8_t reason); 35 | void NotifyFailGetConfDescr(uint8_t reason); 36 | void NotifyFailSetConfDescr(uint8_t reason); 37 | void NotifyFailGetDevDescr(void); 38 | void NotifyFailSetDevTblEntry(void); 39 | void NotifyFailGetConfDescr(void); 40 | void NotifyFailSetConfDescr(void); 41 | void NotifyFailUnknownDevice(uint16_t VID, uint16_t PID); 42 | void NotifyFail(uint8_t rcode); 43 | #else 44 | #define Notify(...) ((void)0) 45 | #define NotifyStr(...) ((void)0) 46 | #define Notifyc(...) ((void)0) 47 | #define NotifyFailGetDevDescr(...) ((void)0) 48 | #define NotifyFailSetDevTblEntry(...) ((void)0) 49 | #define NotifyFailGetConfDescr(...) ((void)0) 50 | #define NotifyFailGetDevDescr(...) ((void)0) 51 | #define NotifyFailSetDevTblEntry(...) ((void)0) 52 | #define NotifyFailGetConfDescr(...) ((void)0) 53 | #define NotifyFailSetConfDescr(...) ((void)0) 54 | #define NotifyFailUnknownDevice(...) ((void)0) 55 | #define NotifyFail(...) ((void)0) 56 | #endif 57 | 58 | #ifdef DEBUG_USB_HOST 59 | template 60 | void ErrorMessage(uint8_t level, char const * msg, ERROR_TYPE rcode = 0) { 61 | Notify(msg, level); 62 | Notify(PSTR(": "), level); 63 | D_PrintHex (rcode, level); 64 | Notify(PSTR("\r\n"), level); 65 | } 66 | 67 | template 68 | void ErrorMessage(char const * msg, ERROR_TYPE rcode = 0) { 69 | Notify(msg, 0x80); 70 | Notify(PSTR(": "), 0x80); 71 | D_PrintHex (rcode, 0x80); 72 | Notify(PSTR("\r\n"), 0x80); 73 | } 74 | #else 75 | template 76 | void ErrorMessage(uint8_t, char const *, ERROR_TYPE = 0) { 77 | } 78 | 79 | template 80 | void ErrorMessage(char const *, ERROR_TYPE = 0) { 81 | } 82 | #endif 83 | 84 | #endif // __MESSAGE_H__ 85 | -------------------------------------------------------------------------------- /libraries/USBHost/src/parsetools.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Circuits At Home, LTD 14 | Web : http://www.circuitsathome.com 15 | e-mail : support@circuitsathome.com 16 | */ 17 | #include "Usb.h" 18 | 19 | bool MultiByteValueParser::Parse(uint8_t **pp, uint32_t *pcntdn) { 20 | if(!pBuf) { 21 | Notify(PSTR("Buffer pointer is NULL!\r\n"), 0x80); 22 | return false; 23 | } 24 | for (; countDown && (*pcntdn); countDown--, (*pcntdn)--, (*pp)++) 25 | pBuf[valueSize - countDown] = (**pp); 26 | 27 | if(countDown) 28 | return false; 29 | 30 | countDown = valueSize; 31 | return true; 32 | } 33 | 34 | bool PTPListParser::Parse(uint8_t **pp, uint32_t *pcntdn, PTP_ARRAY_EL_FUNC pf, const void *me) { 35 | switch(nStage) { 36 | case 0: 37 | pBuf->valueSize = lenSize; 38 | theParser.Initialize(pBuf); 39 | nStage = 1; 40 | 41 | case 1: 42 | if(!theParser.Parse(pp, pcntdn)) 43 | return false; 44 | 45 | arLen = 0; 46 | arLen = (pBuf->valueSize >= 4) ? *((uint32_t*)pBuf->pValue) : (uint32_t)(*((uint16_t*)pBuf->pValue)); 47 | arLenCntdn = arLen; 48 | nStage = 2; 49 | 50 | case 2: 51 | pBuf->valueSize = valSize; 52 | theParser.Initialize(pBuf); 53 | nStage = 3; 54 | 55 | case 3: 56 | for(; arLenCntdn; arLenCntdn--) { 57 | if(!theParser.Parse(pp, pcntdn)) 58 | return false; 59 | 60 | if(pf) 61 | pf(pBuf, (arLen - arLenCntdn), me); 62 | } 63 | 64 | nStage = 0; 65 | } 66 | return true; 67 | } 68 | -------------------------------------------------------------------------------- /libraries/USBHost/src/printhex.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Circuits At Home, LTD 14 | Web : http://www.circuitsathome.com 15 | e-mail : support@circuitsathome.com 16 | */ 17 | 18 | #if !defined(_usb_h_) || defined(__PRINTHEX_H__) 19 | #error "Never include printhex.h directly; include Usb.h instead" 20 | #else 21 | #define __PRINTHEX_H__ 22 | 23 | #include 24 | 25 | void E_Notifyc(char c, int lvl); 26 | 27 | template 28 | void PrintHex(T val, int lvl) { 29 | int num_nibbles = sizeof (T) * 2; 30 | 31 | do { 32 | char v = 48 + (((val >> (num_nibbles - 1) * 4)) & 0x0f); 33 | if(v > 57) v += 7; 34 | E_Notifyc(v, lvl); 35 | } while(--num_nibbles); 36 | } 37 | 38 | template 39 | void PrintBin(T val, int lvl) { 40 | for(T mask = (((T)1) << ((sizeof (T) << 3) - 1)); mask; mask >>= 1) 41 | if(val & mask) 42 | E_Notifyc('1', lvl); 43 | else 44 | E_Notifyc('0', lvl); 45 | } 46 | 47 | template 48 | void SerialPrintHex(T val) { 49 | int num_nibbles = sizeof (T) * 2; 50 | 51 | do { 52 | char v = 48 + (((val >> (num_nibbles - 1) * 4)) & 0x0f); 53 | if(v > 57) v += 7; 54 | USB_HOST_SERIAL.print(v); 55 | } while(--num_nibbles); 56 | } 57 | 58 | template 59 | void PrintHex2(Print *prn, T val) { 60 | T mask = (((T)1) << (((sizeof (T) << 1) - 1) << 2)); 61 | 62 | while(mask > 1) { 63 | if(val < mask) 64 | prn->print("0"); 65 | 66 | mask >>= 4; 67 | } 68 | prn->print((T)val, HEX); 69 | } 70 | 71 | #ifdef DEBUG_USB_HOST 72 | template void D_PrintHex(T val, int lvl) { 73 | PrintHex (val, lvl); 74 | } 75 | 76 | template 77 | void D_PrintBin(T val, int lvl) { 78 | PrintBin (val, lvl); 79 | } 80 | #else 81 | template void D_PrintHex(T, int) { 82 | } 83 | 84 | template 85 | void D_PrintBin(T, int) { 86 | } 87 | #endif 88 | 89 | 90 | 91 | #endif // __PRINTHEX_H__ 92 | -------------------------------------------------------------------------------- /libraries/USBHost/src/sink_parser.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved. 2 | 3 | This software may be distributed and modified under the terms of the GNU 4 | General Public License version 2 (GPL2) as published by the Free Software 5 | Foundation and appearing in the file GPL2.TXT included in the packaging of 6 | this file. Please note that GPL2 Section 2[b] requires that all works based 7 | on this software must also be made publicly available under the terms of 8 | the GPL2 ("Copyleft"). 9 | 10 | Contact information 11 | ------------------- 12 | 13 | Circuits At Home, LTD 14 | Web : http://www.circuitsathome.com 15 | e-mail : support@circuitsathome.com 16 | */ 17 | #if !defined(_usb_h_) || defined(__SINK_PARSER_H__) 18 | #error "Never include hexdump.h directly; include Usb.h instead" 19 | #else 20 | #define __SINK_PARSER_H__ 21 | 22 | extern int UsbDEBUGlvl; 23 | 24 | // This parser does absolutely nothing with the data, just swallows it. 25 | 26 | template 27 | class SinkParser : public BASE_CLASS { 28 | public: 29 | 30 | SinkParser() { 31 | }; 32 | 33 | void Initialize() { 34 | }; 35 | 36 | void Parse(const LEN_TYPE /* len */, const uint8_t * /* pbuf */, const OFFSET_TYPE & /* offset */) { 37 | }; 38 | }; 39 | 40 | 41 | #endif // __HEXDUMP_H__ 42 | -------------------------------------------------------------------------------- /libraries/Wire/examples/digital_potentiometer/digital_potentiometer.ino: -------------------------------------------------------------------------------- 1 | // I2C Digital Potentiometer 2 | // by Nicholas Zambetti 3 | // and Shawn Bonkowski 4 | 5 | // Demonstrates use of the Wire library 6 | // Controls AD5171 digital potentiometer via I2C/TWI 7 | 8 | // Created 31 March 2006 9 | 10 | // This example code is in the public domain. 11 | 12 | // This example code is in the public domain. 13 | 14 | 15 | #include 16 | 17 | void setup() 18 | { 19 | Wire.begin(); // join i2c bus (address optional for master) 20 | } 21 | 22 | byte val = 0; 23 | 24 | void loop() 25 | { 26 | Wire.beginTransmission(44); // transmit to device #44 (0x2c) 27 | // device address is specified in datasheet 28 | Wire.write(byte(0x00)); // sends instruction byte 29 | Wire.write(val); // sends potentiometer value byte 30 | Wire.endTransmission(); // stop transmitting 31 | 32 | val++; // increment value 33 | if(val == 64) // if reached 64th position (max) 34 | { 35 | val = 0; // start over from lowest value 36 | } 37 | delay(500); 38 | } 39 | 40 | -------------------------------------------------------------------------------- /libraries/Wire/examples/master_reader/master_reader.ino: -------------------------------------------------------------------------------- 1 | // Wire Master Reader 2 | // by Nicholas Zambetti 3 | 4 | // Demonstrates use of the Wire library 5 | // Reads data from an I2C/TWI slave device 6 | // Refer to the "Wire Slave Sender" example for use with this 7 | 8 | // Created 29 March 2006 9 | 10 | // This example code is in the public domain. 11 | 12 | 13 | #include 14 | 15 | void setup() 16 | { 17 | Wire.begin(); // join i2c bus (address optional for master) 18 | Serial.begin(9600); // start serial for output 19 | } 20 | 21 | void loop() 22 | { 23 | Wire.requestFrom(2, 6); // request 6 bytes from slave device #2 24 | 25 | while(Wire.available()) // slave may send less than requested 26 | { 27 | char c = Wire.read(); // receive a byte as character 28 | Serial.print(c); // print the character 29 | } 30 | 31 | delay(500); 32 | } 33 | -------------------------------------------------------------------------------- /libraries/Wire/examples/master_writer/master_writer.ino: -------------------------------------------------------------------------------- 1 | // Wire Master Writer 2 | // by Nicholas Zambetti 3 | 4 | // Demonstrates use of the Wire library 5 | // Writes data to an I2C/TWI slave device 6 | // Refer to the "Wire Slave Receiver" example for use with this 7 | 8 | // Created 29 March 2006 9 | 10 | // This example code is in the public domain. 11 | 12 | 13 | #include 14 | 15 | void setup() 16 | { 17 | Wire.begin(); // join i2c bus (address optional for master) 18 | } 19 | 20 | byte x = 0; 21 | 22 | void loop() 23 | { 24 | Wire.beginTransmission(4); // transmit to device #4 25 | Wire.write("x is "); // sends five bytes 26 | Wire.write(x); // sends one byte 27 | Wire.endTransmission(); // stop transmitting 28 | 29 | x++; 30 | delay(500); 31 | } 32 | -------------------------------------------------------------------------------- /libraries/Wire/examples/slave_receiver/slave_receiver.ino: -------------------------------------------------------------------------------- 1 | // Wire Slave Receiver 2 | // by Nicholas Zambetti 3 | 4 | // Demonstrates use of the Wire library 5 | // Receives data as an I2C/TWI slave device 6 | // Refer to the "Wire Master Writer" example for use with this 7 | 8 | // Created 29 March 2006 9 | 10 | // This example code is in the public domain. 11 | 12 | 13 | #include 14 | 15 | void setup() 16 | { 17 | Wire.begin(4); // join i2c bus with address #4 18 | Wire.onReceive(receiveEvent); // register event 19 | Serial.begin(9600); // start serial for output 20 | } 21 | 22 | void loop() 23 | { 24 | delay(100); 25 | } 26 | 27 | // function that executes whenever data is received from master 28 | // this function is registered as an event, see setup() 29 | void receiveEvent(int howMany) 30 | { 31 | (void)howMany; // avoid compiler warning about unused parameter 32 | 33 | while(1 < Wire.available()) // loop through all but the last 34 | { 35 | char c = Wire.read(); // receive byte as a character 36 | Serial.print(c); // print the character 37 | } 38 | int x = Wire.read(); // receive byte as an integer 39 | Serial.println(x); // print the integer 40 | } 41 | -------------------------------------------------------------------------------- /libraries/Wire/examples/slave_sender/slave_sender.ino: -------------------------------------------------------------------------------- 1 | // Wire Slave Sender 2 | // by Nicholas Zambetti 3 | 4 | // Demonstrates use of the Wire library 5 | // Sends data as an I2C/TWI slave device 6 | // Refer to the "Wire Master Reader" example for use with this 7 | 8 | // Created 29 March 2006 9 | 10 | // This example code is in the public domain. 11 | 12 | 13 | #include 14 | 15 | void setup() 16 | { 17 | Wire.begin(2); // join i2c bus with address #2 18 | Wire.onRequest(requestEvent); // register event 19 | } 20 | 21 | void loop() 22 | { 23 | delay(100); 24 | } 25 | 26 | // function that executes whenever data is requested by master 27 | // this function is registered as an event, see setup() 28 | void requestEvent() 29 | { 30 | Wire.write("hello "); // respond with message of 6 bytes 31 | // as expected by master 32 | } 33 | -------------------------------------------------------------------------------- /libraries/Wire/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For Wire 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | ####################################### 10 | # Methods and Functions (KEYWORD2) 11 | ####################################### 12 | 13 | begin KEYWORD2 14 | beginTransmission KEYWORD2 15 | endTransmission KEYWORD2 16 | requestFrom KEYWORD2 17 | onReceive KEYWORD2 18 | onRequest KEYWORD2 19 | 20 | ####################################### 21 | # Instances (KEYWORD2) 22 | ####################################### 23 | 24 | Wire KEYWORD2 25 | Wire1 KEYWORD2 26 | 27 | ####################################### 28 | # Constants (LITERAL1) 29 | ####################################### 30 | 31 | -------------------------------------------------------------------------------- /libraries/Wire/library.properties: -------------------------------------------------------------------------------- 1 | name=Wire 2 | version=1.0 3 | author=Jonathan BAUDIN, Thibaut VIARD, Arduino 4 | maintainer=Arduino 5 | sentence=Allows the communication between devices or sensors connected via Two Wire Interface Bus. Specific implementation for Arduino Zero. 6 | paragraph= 7 | category=Communication 8 | url=http://www.arduino.cc/en/Reference/Wire 9 | architectures=samd 10 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "framework-arduino-samd-seeed", 3 | "description": "Arduino Core for SAMD21 and SAMD51 (Seeed Studio)", 4 | "url": "https://github.com/Seeed-Studio/ArduinoCore-samd", 5 | "version": "1.8.5" 6 | } 7 | -------------------------------------------------------------------------------- /programmers.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2014-2015 Arduino LLC. All right reserved. 2 | # 3 | # This library is free software; you can redistribute it and/or 4 | # modify it under the terms of the GNU Lesser General Public 5 | # License as published by the Free Software Foundation; either 6 | # version 2.1 of the License, or (at your option) any later version. 7 | # 8 | # This library is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | # See the GNU Lesser General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU Lesser General Public 14 | # License along with this library; if not, write to the Free Software 15 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 16 | 17 | adafruit_jlink.name=J-Link over OpenOCD 18 | adafruit_jlink.communication=USB 19 | adafruit_jlink.protocol=jlink 20 | adafruit_jlink.program.protocol=jlink 21 | adafruit_jlink.program.tool=openocd 22 | adafruit_jlink.program.setup_command=interface jlink; transport select swd; reset_config none separate; set WORKAREASIZE 0; 23 | 24 | 25 | adafruit_atmel_ice.name=Atmel-ICE over OpenOCD 26 | adafruit_atmel_ice.communication=USB 27 | adafruit_atmel_ice.protocol=cmsis-dap 28 | adafruit_atmel_ice.program.protocol=cmsis-dap 29 | adafruit_atmel_ice.program.tool=openocd 30 | adafruit_atmel_ice.program.setup_command=cmsis_dap_vid_pid 0x03eb 0x2141; transport select swd; -------------------------------------------------------------------------------- /variants/Wio_LTE_Cat.1/debug_scripts/variant.gdb: -------------------------------------------------------------------------------- 1 | # 2 | # Arduino Zero OpenOCD script. 3 | # 4 | # Copyright (c) 2014-2015 Arduino LLC. All right reserved. 5 | # 6 | # This library is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU Lesser General Public 8 | # License as published by the Free Software Foundation; either 9 | # version 2.1 of the License, or (at your option) any later version. 10 | # 11 | # This library 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. 14 | # See the GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this library; if not, write to the Free Software 18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | # 20 | 21 | # Define 'reset' command 22 | define reset 23 | 24 | info reg 25 | 26 | break main 27 | 28 | # End of 'reset' command 29 | end 30 | 31 | target remote | openocd -c "interface cmsis-dap" -c "set CHIPNAME at91samd21g18" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" 32 | -------------------------------------------------------------------------------- /variants/Wio_LTE_Cat.1/openocd_scripts/Wio_LTE_Cat.cfg: -------------------------------------------------------------------------------- 1 | # 2 | # Adafruit Circuit Playground OpenOCD script. 3 | # 4 | # Copyright (c) 2014-2015 Arduino LLC. All right reserved. 5 | # 6 | # This library is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU Lesser General Public 8 | # License as published by the Free Software Foundation; either 9 | # version 2.1 of the License, or (at your option) any later version. 10 | # 11 | # This library 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. 14 | # See the GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this library; if not, write to the Free Software 18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | # 20 | 21 | # transport 22 | source [find interface/cmsis-dap.cfg] 23 | 24 | # chip name 25 | set CHIPNAME at91samd21g18 26 | set ENDIAN little 27 | 28 | # choose a port here 29 | set telnet_port 0 30 | 31 | source [find target/at91samdXX.cfg] 32 | -------------------------------------------------------------------------------- /variants/Wio_LTE_Cat.1/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 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 | // API compatibility 20 | #include "variant.h" 21 | 22 | -------------------------------------------------------------------------------- /variants/Wio_Lite_MG126/debug_scripts/variant.gdb: -------------------------------------------------------------------------------- 1 | # 2 | # Arduino Zero OpenOCD script. 3 | # 4 | # Copyright (c) 2014-2015 Arduino LLC. All right reserved. 5 | # 6 | # This library is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU Lesser General Public 8 | # License as published by the Free Software Foundation; either 9 | # version 2.1 of the License, or (at your option) any later version. 10 | # 11 | # This library 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. 14 | # See the GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this library; if not, write to the Free Software 18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | # 20 | 21 | # Define 'reset' command 22 | define reset 23 | 24 | info reg 25 | 26 | break main 27 | 28 | # End of 'reset' command 29 | end 30 | 31 | target remote | openocd -c "interface cmsis-dap" -c "set CHIPNAME at91samd21g18" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" 32 | -------------------------------------------------------------------------------- /variants/Wio_Lite_MG126/openocd_scripts/Wio_Lite_MG126.cfg: -------------------------------------------------------------------------------- 1 | # 2 | # Arduino Zero OpenOCD script. 3 | # 4 | # Copyright (c) 2014-2015 Arduino LLC. All right reserved. 5 | # 6 | # This library is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU Lesser General Public 8 | # License as published by the Free Software Foundation; either 9 | # version 2.1 of the License, or (at your option) any later version. 10 | # 11 | # This library 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. 14 | # See the GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this library; if not, write to the Free Software 18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | # 20 | 21 | source [find interface/cmsis-dap.cfg] 22 | 23 | # chip name 24 | set CHIPNAME at91samd21g18 25 | set ENDIAN little 26 | 27 | # choose a port here 28 | set telnet_port 0 29 | 30 | source [find target/at91samdXX.cfg] 31 | -------------------------------------------------------------------------------- /variants/Wio_Lite_MG126/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 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 | // API compatibility 20 | #include "variant.h" 21 | 22 | -------------------------------------------------------------------------------- /variants/XIAO_m0/debug_scripts/variant.gdb: -------------------------------------------------------------------------------- 1 | # 2 | # Arduino Zero OpenOCD script. 3 | # 4 | # Copyright (c) 2014-2015 Arduino LLC. All right reserved. 5 | # 6 | # This library is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU Lesser General Public 8 | # License as published by the Free Software Foundation; either 9 | # version 2.1 of the License, or (at your option) any later version. 10 | # 11 | # This library 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. 14 | # See the GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this library; if not, write to the Free Software 18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | # 20 | 21 | # Define 'reset' command 22 | define reset 23 | 24 | info reg 25 | 26 | break main 27 | 28 | # End of 'reset' command 29 | end 30 | 31 | target remote | openocd -c "interface cmsis-dap" -c "set CHIPNAME at91samd21g18" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" 32 | -------------------------------------------------------------------------------- /variants/XIAO_m0/openocd_scripts/XIAO_m0.cfg: -------------------------------------------------------------------------------- 1 | # 2 | # Adafruit Circuit Playground OpenOCD script. 3 | # 4 | # Copyright (c) 2014-2015 Arduino LLC. All right reserved. 5 | # 6 | # This library is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU Lesser General Public 8 | # License as published by the Free Software Foundation; either 9 | # version 2.1 of the License, or (at your option) any later version. 10 | # 11 | # This library 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. 14 | # See the GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this library; if not, write to the Free Software 18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | # 20 | 21 | # transport 22 | source [find interface/cmsis-dap.cfg] 23 | 24 | # chip name 25 | set CHIPNAME at91samd21g18 26 | set ENDIAN little 27 | 28 | # choose a port here 29 | set telnet_port 0 30 | 31 | source [find target/at91samdXX.cfg] 32 | -------------------------------------------------------------------------------- /variants/XIAO_m0/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 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 | // API compatibility 20 | #include "variant.h" 21 | 22 | -------------------------------------------------------------------------------- /variants/arduino_zero/debug_scripts/variant.gdb: -------------------------------------------------------------------------------- 1 | # 2 | # Arduino Zero OpenOCD script. 3 | # 4 | # Copyright (c) 2014-2015 Arduino LLC. All right reserved. 5 | # 6 | # This library is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU Lesser General Public 8 | # License as published by the Free Software Foundation; either 9 | # version 2.1 of the License, or (at your option) any later version. 10 | # 11 | # This library 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. 14 | # See the GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this library; if not, write to the Free Software 18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | # 20 | 21 | # Define 'reset' command 22 | define reset 23 | 24 | info reg 25 | 26 | break main 27 | 28 | # End of 'reset' command 29 | end 30 | 31 | target remote | openocd -c "interface cmsis-dap" -c "set CHIPNAME at91samd21g18" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" 32 | -------------------------------------------------------------------------------- /variants/arduino_zero/openocd_scripts/arduino_zero.cfg: -------------------------------------------------------------------------------- 1 | # 2 | # Arduino Zero OpenOCD script. 3 | # 4 | # Copyright (c) 2014-2015 Arduino LLC. All right reserved. 5 | # 6 | # This library is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU Lesser General Public 8 | # License as published by the Free Software Foundation; either 9 | # version 2.1 of the License, or (at your option) any later version. 10 | # 11 | # This library 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. 14 | # See the GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this library; if not, write to the Free Software 18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | # 20 | 21 | source [find interface/cmsis-dap.cfg] 22 | 23 | # chip name 24 | set CHIPNAME at91samd21g18 25 | set ENDIAN little 26 | 27 | # choose a port here 28 | set telnet_port 0 29 | 30 | source [find target/at91samdXX.cfg] 31 | -------------------------------------------------------------------------------- /variants/arduino_zero/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 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 | // API compatibility 20 | #include "variant.h" 21 | 22 | -------------------------------------------------------------------------------- /variants/femto_m0/debug_scripts/variant.gdb: -------------------------------------------------------------------------------- 1 | # 2 | # Arduino Zero OpenOCD script. 3 | # 4 | # Copyright (c) 2014-2015 Arduino LLC. All right reserved. 5 | # 6 | # This library is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU Lesser General Public 8 | # License as published by the Free Software Foundation; either 9 | # version 2.1 of the License, or (at your option) any later version. 10 | # 11 | # This library 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. 14 | # See the GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this library; if not, write to the Free Software 18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | # 20 | 21 | # Define 'reset' command 22 | define reset 23 | 24 | info reg 25 | 26 | break main 27 | 28 | # End of 'reset' command 29 | end 30 | 31 | target remote | openocd -c "interface cmsis-dap" -c "set CHIPNAME at91samd21g18" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" 32 | -------------------------------------------------------------------------------- /variants/femto_m0/openocd_scripts/femto_m0.cfg: -------------------------------------------------------------------------------- 1 | # 2 | # Adafruit Circuit Playground OpenOCD script. 3 | # 4 | # Copyright (c) 2014-2015 Arduino LLC. All right reserved. 5 | # 6 | # This library is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU Lesser General Public 8 | # License as published by the Free Software Foundation; either 9 | # version 2.1 of the License, or (at your option) any later version. 10 | # 11 | # This library 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. 14 | # See the GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this library; if not, write to the Free Software 18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | # 20 | 21 | # chip name 22 | set CHIPNAME at91samd21g18 23 | set ENDIAN little 24 | 25 | # choose a port here 26 | set telnet_port 0 27 | 28 | source [find target/at91samdXX.cfg] 29 | -------------------------------------------------------------------------------- /variants/femto_m0/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 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 | // API compatibility 20 | #include "variant.h" 21 | 22 | -------------------------------------------------------------------------------- /variants/grove_ui_wireless/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 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 | // API compatibility 20 | #include "../grove_ui_wireless/variant.h" 21 | 22 | -------------------------------------------------------------------------------- /variants/wio_terminal/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 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 | // API compatibility 20 | #include "variant.h" 21 | 22 | -------------------------------------------------------------------------------- /variants/zero_radio/debug_scripts/variant.gdb: -------------------------------------------------------------------------------- 1 | # 2 | # Arduino Zero OpenOCD script. 3 | # 4 | # Copyright (c) 2014-2015 Arduino LLC. All right reserved. 5 | # 6 | # This library is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU Lesser General Public 8 | # License as published by the Free Software Foundation; either 9 | # version 2.1 of the License, or (at your option) any later version. 10 | # 11 | # This library 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. 14 | # See the GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this library; if not, write to the Free Software 18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | # 20 | 21 | # Define 'reset' command 22 | define reset 23 | 24 | info reg 25 | 26 | break main 27 | 28 | # End of 'reset' command 29 | end 30 | 31 | target remote | openocd -c "interface cmsis-dap" -c "set CHIPNAME at91samd21g18" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" 32 | -------------------------------------------------------------------------------- /variants/zero_radio/openocd_scripts/zero_radio.cfg: -------------------------------------------------------------------------------- 1 | # 2 | # Adafruit Feather M0 Radio OpenOCD script. 3 | # 4 | # Copyright (c) 2014-2015 Arduino LLC. All right reserved. 5 | # 6 | # This library is free software; you can redistribute it and/or 7 | # modify it under the terms of the GNU Lesser General Public 8 | # License as published by the Free Software Foundation; either 9 | # version 2.1 of the License, or (at your option) any later version. 10 | # 11 | # This library 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. 14 | # See the GNU Lesser General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Lesser General Public 17 | # License along with this library; if not, write to the Free Software 18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | # 20 | 21 | # chip name 22 | set CHIPNAME at91samd21g18 23 | set ENDIAN little 24 | 25 | # choose a port here 26 | set telnet_port 0 27 | 28 | source [find target/at91samdXX.cfg] 29 | -------------------------------------------------------------------------------- /variants/zero_radio/pins_arduino.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014-2015 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 | // API compatibility 20 | #include "variant.h" 21 | 22 | --------------------------------------------------------------------------------