├── ArduinoCore-samd ├── README.md ├── boards.txt ├── bootloaders │ ├── LICENSE │ ├── sam_ba_SAMD11C_DevBoard_SAMD11C14A.bin │ ├── sam_ba_SAMD11D_DevBoard_SAMD11D14AS.bin │ ├── sam_ba_SAMD21E_DevBoard_SAMD21E15A.bin │ ├── sam_ba_SAMD21E_DevBoard_SAMD21E15B.bin │ ├── sam_ba_SAMD21E_DevBoard_SAMD21E16A.bin │ ├── sam_ba_SAMD21E_DevBoard_SAMD21E16B.bin │ ├── sam_ba_SAMD21E_DevBoard_SAMD21E17A.bin │ ├── sam_ba_SAMD21E_DevBoard_SAMD21E18A.bin │ ├── sam_uf2_SAMD21E_DevBoard_SAMD21E18A.bin │ └── source │ │ └── sam-ba │ │ ├── Makefile │ │ ├── SDCard │ │ ├── 00readme.txt │ │ ├── diskio.h │ │ ├── integer.h │ │ ├── mmcbbp.c │ │ ├── pff.c │ │ ├── pff.h │ │ ├── pffconf.h │ │ ├── sdBootloader.c │ │ └── sdBootloader.h │ │ ├── board_definitions.h │ │ ├── board_definitions │ │ ├── board_definitions_SAMD11C_DevBoard.h │ │ └── board_definitions_SAMD21E_DevBoard.h │ │ ├── board_driver_led.c │ │ ├── board_driver_led.h │ │ ├── board_driver_serial.c │ │ ├── board_driver_serial.h │ │ ├── board_driver_usb.c │ │ ├── board_driver_usb.h │ │ ├── board_init.c │ │ ├── board_startup.c │ │ ├── build_all_bootloaders.sh │ │ ├── linker_scripts │ │ ├── bootloader_sam_m0p_128KB.ld │ │ ├── bootloader_sam_m0p_16KB.ld │ │ ├── bootloader_sam_m0p_256KB.ld │ │ ├── bootloader_sam_m0p_32KB.ld │ │ ├── bootloader_sam_m0p_64KB.ld │ │ ├── bootloader_sam_m4f_1MB.ld │ │ ├── bootloader_sam_m4f_256KB.ld │ │ └── bootloader_sam_m4f_512KB.ld │ │ ├── main.c │ │ ├── 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 │ │ ├── util.c │ │ └── util.h ├── config.h ├── cores │ └── arduino │ │ ├── Arduino.h │ │ ├── Client.h │ │ ├── HardwareSerial.h │ │ ├── IPAddress.cpp │ │ ├── IPAddress.h │ │ ├── Print.cpp │ │ ├── Print.h │ │ ├── Printable.h │ │ ├── Reset.cpp │ │ ├── Reset.h │ │ ├── RingBuffer.cpp │ │ ├── RingBuffer.h │ │ ├── SERCOM.cpp │ │ ├── SERCOM.h │ │ ├── Server.h │ │ ├── Stream.cpp │ │ ├── Stream.h │ │ ├── Tone.cpp │ │ ├── Tone.h │ │ ├── USB │ │ ├── CDC.cpp │ │ ├── PluggableUSB.cpp │ │ ├── PluggableUSB.h │ │ ├── SAMD21_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 │ │ ├── dtoa_conv.h │ │ ├── dtoa_prf.c │ │ ├── dtostrf.c │ │ ├── dtostrf.h │ │ ├── ftoa_engine.c │ │ ├── ftoa_engine.h │ │ ├── ftostrf.c │ │ ├── ftostrf.h │ │ ├── interrupt.h │ │ ├── io.h │ │ └── pgmspace.h │ │ ├── binary.h │ │ ├── cortex_handlers.c │ │ ├── delay.c │ │ ├── delay.h │ │ ├── hooks.c │ │ ├── itoa.c │ │ ├── itoa.h │ │ ├── main.cpp │ │ ├── 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_shift.c │ │ └── wiring_shift.h ├── drivers │ ├── 99-mattairtech-USB-CDC.rules │ ├── MattairTech_CDC.inf │ └── mattairtech_cdc.cat ├── keywords.txt ├── libraries │ ├── 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 │ ├── SAMD_AnalogCorrection │ │ ├── examples │ │ │ └── CorrectADCResponse │ │ │ │ └── CorrectADCResponse.ino │ │ ├── library.properties │ │ └── src │ │ │ ├── SAMD_AnalogCorrection.cpp │ │ │ └── SAMD_AnalogCorrection.h │ ├── SPI │ │ ├── SPI.cpp │ │ ├── SPI.h │ │ ├── examples │ │ │ ├── BarometricPressureSensor │ │ │ │ └── BarometricPressureSensor.ino │ │ │ └── DigitalPotControl │ │ │ │ └── DigitalPotControl.ino │ │ ├── keywords.txt │ │ └── library.properties │ ├── 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 ├── platform.txt ├── programmers.txt └── variants │ ├── SAMD11C │ ├── debug_scripts │ │ └── SAMD11C14A.gdb │ ├── linker_scripts │ │ └── gcc │ │ │ ├── 4KB_Bootloader │ │ │ └── flash_16KB.ld │ │ │ └── No_Bootloader │ │ │ └── flash_16KB.ld │ ├── openocd_scripts │ │ └── SAMD11C14A.cfg │ ├── pins_arduino.h │ ├── variant.cpp │ └── variant.h │ ├── SAMD11D │ ├── debug_scripts │ │ └── SAMD11D14AS.gdb │ ├── linker_scripts │ │ └── gcc │ │ │ ├── 4KB_Bootloader │ │ │ └── flash_16KB.ld │ │ │ └── No_Bootloader │ │ │ └── flash_16KB.ld │ ├── openocd_scripts │ │ └── SAMD11D14AS.cfg │ ├── pins_arduino.h │ ├── variant.cpp │ └── variant.h │ └── SAMD21E │ ├── debug_scripts │ ├── SAMD21E15A.gdb │ ├── SAMD21E16A.gdb │ ├── SAMD21E17A.gdb │ └── SAMD21E18A.gdb │ ├── linker_scripts │ └── gcc │ │ ├── 16KB_Bootloader │ │ ├── flash_128KB.ld │ │ ├── flash_256KB.ld │ │ ├── flash_32KB.ld │ │ └── flash_64KB.ld │ │ ├── 8KB_Bootloader │ │ ├── flash_128KB.ld │ │ ├── flash_256KB.ld │ │ ├── flash_32KB.ld │ │ └── flash_64KB.ld │ │ └── No_Bootloader │ │ ├── flash_128KB.ld │ │ ├── flash_256KB.ld │ │ ├── flash_32KB.ld │ │ └── flash_64KB.ld │ ├── openocd_scripts │ ├── SAMD21E15A.cfg │ ├── SAMD21E16A.cfg │ ├── SAMD21E17A.cfg │ └── SAMD21E18A.cfg │ ├── pins_arduino.h │ ├── variant.cpp │ └── variant.h ├── LICENSE ├── README.md ├── SAMD11C_DevBoard ├── README.md ├── bootloader │ ├── LICENSE │ ├── cmsis-dap.cfg │ ├── flash.jlink │ ├── jlink.cfg │ ├── readme.txt │ ├── sam_ba_samd11c14a.bin │ ├── samd_bootprot_4k.mot │ └── samd_bootprot_clear.mot ├── documentation │ ├── SAMD11C_DevBoard_pic1.jpg │ ├── SAMD11C_DevBoard_pic2.jpg │ ├── SAMD11C_DevBoard_pic3.jpg │ └── SAMD11C_DevBoard_pinout.png └── hardware │ ├── SAMD11C_DevBoard_BOM.tsv │ ├── SAMD11C_DevBoard_gerber.zip │ └── SAMD11C_DevBoard_schematic.pdf ├── SAMD11D_DevBoard ├── README.md ├── bootloader │ ├── LICENSE │ ├── cmsis-dap.cfg │ ├── flash.jlink │ ├── jlink.cfg │ ├── readme.txt │ ├── sam_ba_samd11d14as.bin │ ├── samd_bootprot_4k.mot │ └── samd_bootprot_clear.mot ├── documentation │ ├── SAMD11D_DevBoard_pic1.jpg │ ├── SAMD11D_DevBoard_pic2.jpg │ └── SAMD11D_DevBoard_pic3.jpg └── hardware │ ├── SAMD11D_DevBoard_BOM.tsv │ ├── SAMD11D_DevBoard_gerber.zip │ └── SAMD11D_DevBoard_schematic.pdf ├── SAMD21E_DevBoard ├── README.md ├── bootloader │ ├── LICENSE │ ├── cmsis-dap.cfg │ ├── flash.jlink │ ├── jlink.cfg │ ├── readme.txt │ ├── sam_ba_samd21e15a.bin │ ├── sam_ba_samd21e15b.bin │ ├── sam_ba_samd21e16a.bin │ ├── sam_ba_samd21e16b.bin │ ├── sam_ba_samd21e17a.bin │ ├── sam_ba_samd21e18a.bin │ ├── sam_uf2_samd21e18a.bin │ ├── samd_bootprot_8k.mot │ └── samd_bootprot_clear.mot ├── documentation │ ├── SAMD21E_DevBoard_pic1.jpg │ ├── SAMD21E_DevBoard_pic2.jpg │ ├── SAMD21E_DevBoard_pic3.jpg │ └── SAMD21E_DevBoard_pinout.png └── hardware │ ├── SAMD21E_DevBoard_BOM.tsv │ ├── SAMD21E_DevBoard_gerber.zip │ └── SAMD21E_DevBoard_schematic.pdf ├── SAMD_Programmer_Adapter ├── README.md ├── SAMD_Programmer_Adapter_BOM.tsv ├── SAMD_Programmer_Adapter_gerber.zip ├── SAMD_Programmer_Adapter_pic1.jpg ├── SAMD_Programmer_Adapter_pic2.jpg └── SAMD_Programmer_Adapter_schematic.pdf ├── SWD_Programmer_Stick ├── README.md ├── documentation │ ├── CMSIS-DAP.png │ ├── SWD_DAPLink.jpg │ ├── SWD_Programmer_Stick_pic1.jpg │ ├── SWD_Programmer_Stick_pic2.jpg │ ├── SWD_Programmer_Stick_pic3.jpg │ ├── SWD_Programmer_Stick_pic4.jpg │ ├── SWD_nanoDAP.jpg │ └── SWD_segger.jpg ├── hardware │ ├── SWD_Programmer_Stick_BOM.tsv │ ├── SWD_Programmer_Stick_gerber.zip │ └── SWD_Programmer_Stick_schematic.pdf └── software │ ├── binaries │ ├── LICENSE │ ├── cmsis-dap.cfg │ ├── flash.jlink │ ├── jlink.cfg │ ├── readme.txt │ ├── samd_bootprot_clear.mot │ └── swd_programmer_stick.bin │ └── sources │ ├── LICENSE │ ├── Makefile │ ├── Makefile_bl │ ├── dap.c │ ├── dap.h │ ├── dap_config.h │ ├── hal_gpio.h │ ├── include │ ├── component │ │ ├── ac.h │ │ ├── adc.h │ │ ├── dac.h │ │ ├── dmac.h │ │ ├── dsu.h │ │ ├── eic.h │ │ ├── evsys.h │ │ ├── gclk.h │ │ ├── hmatrixb.h │ │ ├── mtb.h │ │ ├── nvmctrl.h │ │ ├── pac.h │ │ ├── pm.h │ │ ├── port.h │ │ ├── rtc.h │ │ ├── sercom.h │ │ ├── sysctrl.h │ │ ├── tc.h │ │ ├── tcc.h │ │ ├── usb.h │ │ └── wdt.h │ ├── core_cm0plus.h │ ├── core_cmFunc.h │ ├── core_cmInstr.h │ ├── instance │ │ ├── ac.h │ │ ├── adc.h │ │ ├── dac.h │ │ ├── dmac.h │ │ ├── dsu.h │ │ ├── eic.h │ │ ├── evsys.h │ │ ├── gclk.h │ │ ├── mtb.h │ │ ├── nvmctrl.h │ │ ├── pac0.h │ │ ├── pac1.h │ │ ├── pac2.h │ │ ├── pm.h │ │ ├── port.h │ │ ├── rtc.h │ │ ├── sbmatrix.h │ │ ├── sercom0.h │ │ ├── sercom1.h │ │ ├── sercom2.h │ │ ├── sysctrl.h │ │ ├── tc1.h │ │ ├── tc2.h │ │ ├── tcc0.h │ │ ├── usb.h │ │ └── wdt.h │ ├── pio │ │ ├── samd11c14a.h │ │ ├── samd11d14am.h │ │ ├── samd11d14as.h │ │ └── samd11d14au.h │ ├── samd11.h │ ├── samd11c14a.h │ ├── samd11d14am.h │ ├── samd11d14as.h │ └── samd11d14au.h │ ├── linker │ ├── samd11d14_bl.ld │ └── samd11d14_std.ld │ ├── main.c │ ├── nvm_data.h │ ├── startup_samd11.c │ ├── udc.c │ ├── udc.h │ ├── usb.c │ ├── usb.h │ ├── usb_descriptors.c │ ├── usb_descriptors.h │ └── utils.h └── packages ├── CMSIS-Atmel-3.49.1.tar.gz ├── SAMD_DevBoards_0.1.0.tar.gz ├── SAMD_DevBoards_0.2.0.tar.gz ├── bossac-1.7.0-mattairtech-3-i686-linux-gnu.tar.gz ├── bossac-1.7.0-mattairtech-3-mingw32.tar.gz ├── bossac-1.7.0-mattairtech-3-x86_64-apple-darwin.tar.gz ├── bossac-1.7.0-mattairtech-3-x86_64-linux-gnu.tar.gz └── package_wagiminator_samd_index.json /ArduinoCore-samd/bootloaders/sam_ba_SAMD11C_DevBoard_SAMD11C14A.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/ArduinoCore-samd/bootloaders/sam_ba_SAMD11C_DevBoard_SAMD11C14A.bin -------------------------------------------------------------------------------- /ArduinoCore-samd/bootloaders/sam_ba_SAMD11D_DevBoard_SAMD11D14AS.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/ArduinoCore-samd/bootloaders/sam_ba_SAMD11D_DevBoard_SAMD11D14AS.bin -------------------------------------------------------------------------------- /ArduinoCore-samd/bootloaders/sam_ba_SAMD21E_DevBoard_SAMD21E15A.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/ArduinoCore-samd/bootloaders/sam_ba_SAMD21E_DevBoard_SAMD21E15A.bin -------------------------------------------------------------------------------- /ArduinoCore-samd/bootloaders/sam_ba_SAMD21E_DevBoard_SAMD21E15B.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/ArduinoCore-samd/bootloaders/sam_ba_SAMD21E_DevBoard_SAMD21E15B.bin -------------------------------------------------------------------------------- /ArduinoCore-samd/bootloaders/sam_ba_SAMD21E_DevBoard_SAMD21E16A.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/ArduinoCore-samd/bootloaders/sam_ba_SAMD21E_DevBoard_SAMD21E16A.bin -------------------------------------------------------------------------------- /ArduinoCore-samd/bootloaders/sam_ba_SAMD21E_DevBoard_SAMD21E16B.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/ArduinoCore-samd/bootloaders/sam_ba_SAMD21E_DevBoard_SAMD21E16B.bin -------------------------------------------------------------------------------- /ArduinoCore-samd/bootloaders/sam_ba_SAMD21E_DevBoard_SAMD21E17A.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/ArduinoCore-samd/bootloaders/sam_ba_SAMD21E_DevBoard_SAMD21E17A.bin -------------------------------------------------------------------------------- /ArduinoCore-samd/bootloaders/sam_ba_SAMD21E_DevBoard_SAMD21E18A.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/ArduinoCore-samd/bootloaders/sam_ba_SAMD21E_DevBoard_SAMD21E18A.bin -------------------------------------------------------------------------------- /ArduinoCore-samd/bootloaders/sam_uf2_SAMD21E_DevBoard_SAMD21E18A.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/ArduinoCore-samd/bootloaders/sam_uf2_SAMD21E_DevBoard_SAMD21E18A.bin -------------------------------------------------------------------------------- /ArduinoCore-samd/bootloaders/source/sam-ba/SDCard/00readme.txt: -------------------------------------------------------------------------------- 1 | Petit FatFs Module Source Files R0.03 (C)ChaN, 2014 2 | 3 | 4 | FILES 5 | 6 | pff.h Common include file for Petit FatFs and application module. 7 | pff.c Petit FatFs module. 8 | diskio.h Common include file for Petit FatFs and disk I/O module. 9 | diskio.c Skeleton of low level disk I/O module. 10 | integer.h Alternative type definitions for integer variables. 11 | 12 | Low level disk I/O module is not included in this archive because the Petit 13 | FatFs module is only a generic file system layer and not depend on any 14 | specific storage device. You have to provide a low level disk I/O module that 15 | written to control your storage device. 16 | 17 | 18 | 19 | AGREEMENTS 20 | 21 | Petit FatFs module is an open source software to implement FAT file system to 22 | small embedded systems. This is a free software and is opened for education, 23 | research and commercial developments under license policy of following trems. 24 | 25 | Copyright (C) 2014, ChaN, all right reserved. 26 | 27 | * The Petit FatFs module is a free software and there is NO WARRANTY. 28 | * No restriction on use. You can use, modify and redistribute it for 29 | personal, non-profit or commercial use UNDER YOUR RESPONSIBILITY. 30 | * Redistributions of source code must retain the above copyright notice. 31 | 32 | 33 | 34 | REVISION HISTORY 35 | 36 | Jun 15, 2009 R0.01a First release (Branched from FatFs R0.07b) 37 | 38 | Dec 14, 2009 R0.02 Added multiple code page support. 39 | Added write funciton. 40 | Changed stream read mode interface. 41 | Dec 07,'2010 R0.02a Added some configuration options. 42 | Fixed fails to open objects with DBCS character. 43 | 44 | Jun 10, 2014 R0.03 Separated out configuration options to pffconf.h. 45 | Added _USE_LCC option. 46 | Added _FS_FAT16 option. 47 | -------------------------------------------------------------------------------- /ArduinoCore-samd/bootloaders/source/sam-ba/SDCard/integer.h: -------------------------------------------------------------------------------- 1 | /*-------------------------------------------*/ 2 | /* Integer type definitions for FatFs module */ 3 | /*-------------------------------------------*/ 4 | 5 | #ifndef _FF_INTEGER 6 | #define _FF_INTEGER 7 | 8 | #ifdef _WIN32 /* FatFs development platform */ 9 | 10 | #include 11 | #include 12 | 13 | #else /* Embedded platform */ 14 | 15 | /* This type MUST be 8 bit */ 16 | typedef unsigned char BYTE; 17 | 18 | /* These types MUST be 16 bit */ 19 | typedef short SHORT; 20 | typedef unsigned short WORD; 21 | typedef unsigned short WCHAR; 22 | 23 | /* These types MUST be 16 bit or 32 bit */ 24 | typedef int INT; 25 | typedef unsigned int UINT; 26 | 27 | /* These types MUST be 32 bit */ 28 | typedef long LONG; 29 | typedef unsigned long DWORD; 30 | 31 | #endif 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /ArduinoCore-samd/bootloaders/source/sam-ba/SDCard/sdBootloader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017 MattairTech LLC. All right reserved. 3 | * Copyright (C) 2014, ChaN, 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 _SD_BOOTLOADER_H_ 21 | #define _SD_BOOTLOADER_H_ 22 | 23 | #include "sam.h" 24 | #include 25 | #include 26 | #include "pff.h" 27 | #include "../board_definitions.h" 28 | #include "../board_driver_led.h" 29 | #include "../util.h" 30 | 31 | #define SD_BOOTLOADER_MODE_NO_UPDATE 0 32 | #define SD_BOOTLOADER_MODE_UPDATE 1 33 | #define SD_BOOTLOADER_MODE_UPDATE2 2 34 | 35 | #define SD_BOOTLOADER_NOT_CALLED 0 36 | #define SD_BOOTLOADER_SUCCESS 1 37 | #define SD_BOOTLOADER_FILE_ALREADY_MATCHES 2 38 | #define SD_BOOTLOADER_FILE_NOT_FOUND 3 39 | #define SD_BOOTLOADER_FILE_TOO_LARGE 4 40 | #define SD_BOOTLOADER_VERIFICATION_FAILURE 5 41 | 42 | uint8_t sdBootloader (uint8_t mode); 43 | bool flashVerify (void); 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /ArduinoCore-samd/bootloaders/source/sam-ba/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 | Copyright (c) 2017 MattairTech 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 | #include "board_driver_led.h" 22 | 23 | #define LED_TARGET_VALUE_MIN_1 5 24 | #define LED_TARGET_VALUE_MIN_2 70 25 | #define LED_TARGET_VALUE_MAX 240 26 | 27 | volatile uint8_t ledKeepValue = 0; 28 | volatile uint8_t ledTargetValue = 20; 29 | volatile int8_t ledDirection = 8; 30 | volatile uint8_t ledTargetValueMin = LED_TARGET_VALUE_MIN_1; 31 | 32 | inline void LED_pulse(void) 33 | { 34 | if (ledKeepValue == 0) { 35 | ledTargetValue += ledDirection; 36 | LED_toggle(); 37 | } 38 | ledKeepValue ++; 39 | 40 | if (ledTargetValue > LED_TARGET_VALUE_MAX) { 41 | ledDirection = -ledDirection; 42 | ledTargetValue += ledDirection; 43 | } else if ((ledTargetValue < ledTargetValueMin) && ledDirection < 0) { 44 | if (ledTargetValueMin == LED_TARGET_VALUE_MIN_1) { 45 | ledTargetValueMin = LED_TARGET_VALUE_MIN_2; 46 | } else { 47 | ledTargetValueMin = LED_TARGET_VALUE_MIN_1; 48 | } 49 | ledDirection = -ledDirection; 50 | ledTargetValue += ledDirection; 51 | } 52 | 53 | if (ledKeepValue == ledTargetValue) { 54 | LED_toggle(); 55 | } 56 | } 57 | 58 | void LED_status(uint32_t periodMS) 59 | { 60 | __disable_irq(); 61 | 62 | while (1) { 63 | LED_toggle(); 64 | delayUs(periodMS * 500UL); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /ArduinoCore-samd/bootloaders/source/sam-ba/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 | 28 | /* SERCOM UART available pad settings */ 29 | enum uart_pad_settings { 30 | UART_RX_PAD0_TX_PAD2 = SERCOM_USART_CTRLA_RXPO(0) | SERCOM_USART_CTRLA_TXPO(1), 31 | UART_RX_PAD1_TX_PAD2 = SERCOM_USART_CTRLA_RXPO(1) | SERCOM_USART_CTRLA_TXPO(1), 32 | UART_RX_PAD2_TX_PAD0 = SERCOM_USART_CTRLA_RXPO(2), 33 | UART_RX_PAD3_TX_PAD0 = SERCOM_USART_CTRLA_RXPO(3), 34 | UART_RX_PAD1_TX_PAD0 = SERCOM_USART_CTRLA_RXPO(1), 35 | UART_RX_PAD3_TX_PAD2 = SERCOM_USART_CTRLA_RXPO(3) | SERCOM_USART_CTRLA_TXPO(1), 36 | }; 37 | 38 | /** 39 | * \brief Initializes the UART 40 | * 41 | * \param Pointer to SERCOM instance 42 | * \param Baud value corresponding to the desired baudrate 43 | * \param SERCOM pad settings 44 | */ 45 | void uart_basic_init(Sercom *sercom, uint16_t baud_val, enum uart_pad_settings pad_conf); 46 | 47 | /** 48 | * \brief Disables UART interface 49 | * 50 | * \param Pointer to SERCOM instance 51 | */ 52 | void uart_disable(Sercom *sercom); 53 | 54 | /** 55 | * \brief Sends a single byte through UART interface 56 | * 57 | * \param Pointer to SERCOM instance 58 | * \param Data to send 59 | */ 60 | void uart_write_byte(Sercom *sercom, uint8_t data); 61 | 62 | /** 63 | * \brief Reads a single character from UART interface 64 | * 65 | * \param Pointer to SERCOM instance 66 | * \return Data byte read 67 | */ 68 | uint8_t uart_read_byte(Sercom *sercom); 69 | 70 | /** 71 | * \brief Sends buffer on UART interface 72 | * 73 | * \param Pointer to SERCOM instance 74 | * \param Pointer to data to send 75 | * \param Number of bytes to send 76 | */ 77 | void uart_write_buffer_polled(Sercom *sercom, uint8_t *ptr, uint16_t length); 78 | 79 | /** 80 | * \brief Reads data on UART interface 81 | * 82 | * \param Pointer to SERCOM instance 83 | * \param Pointer to store read data 84 | * \param Number of bytes to read 85 | */ 86 | void uart_read_buffer_polled(Sercom *sercom, uint8_t *ptr, uint16_t length); 87 | 88 | #endif 89 | -------------------------------------------------------------------------------- /ArduinoCore-samd/bootloaders/source/sam-ba/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 | #include "util.h" 25 | 26 | extern UsbDeviceDescriptor usb_endpoint_table[MAX_EP]; 27 | extern uint8_t udd_ep_out_cache_buffer[2][64]; //1 for CTRL, 1 for BULK 28 | extern uint8_t udd_ep_in_cache_buffer[2][64]; //1 for CTRL, 1 for BULK 29 | 30 | P_USB_CDC USB_Open(P_USB_CDC pCdc, Usb *pUsb); 31 | 32 | void USB_Init(void); 33 | 34 | uint32_t USB_Write(Usb *pUsb, const char *pData, uint32_t length, uint8_t ep_num); 35 | uint32_t USB_Read(Usb *pUsb, char *pData, uint32_t length); 36 | uint32_t USB_Read_blocking(Usb *pUsb, char *pData, uint32_t length); 37 | 38 | uint8_t USB_IsConfigured(P_USB_CDC pCdc); 39 | 40 | void USB_SendStall(Usb *pUsb, bool direction_in); 41 | void USB_SendZlp(Usb *pUsb); 42 | 43 | void USB_SetAddress(Usb *pUsb, uint16_t wValue); 44 | void USB_Configure(Usb *pUsb); 45 | 46 | #endif // _BOARD_DRIVER_USB_H_ 47 | -------------------------------------------------------------------------------- /ArduinoCore-samd/bootloaders/source/sam-ba/build_all_bootloaders.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -ex 2 | 3 | make clean 4 | 5 | # With SDCARD_DISABLED 6 | BOARD_ID=SAMD21E_DevBoard MCU=SAMD21E15A SDCARD=SDCARD_DISABLED make all mostly_clean 7 | BOARD_ID=SAMD21E_DevBoard MCU=SAMD21E15B SDCARD=SDCARD_DISABLED make all mostly_clean 8 | BOARD_ID=SAMD21E_DevBoard MCU=SAMD21E16A SDCARD=SDCARD_DISABLED make all mostly_clean 9 | BOARD_ID=SAMD21E_DevBoard MCU=SAMD21E16B SDCARD=SDCARD_DISABLED make all mostly_clean 10 | BOARD_ID=SAMD21E_DevBoard MCU=SAMD21E17A SDCARD=SDCARD_DISABLED make all mostly_clean 11 | BOARD_ID=SAMD21E_DevBoard MCU=SAMD21E18A SDCARD=SDCARD_DISABLED make all mostly_clean 12 | BOARD_ID=SAMD11C_DevBoard MCU=SAMD11C14A SDCARD=SDCARD_DISABLED make all mostly_clean 13 | 14 | # With SDCARD_ENABLED 15 | #BOARD_ID=SAMD21E_DevBoard MCU=SAMD21E15A SDCARD=SDCARD_ENABLED make all mostly_clean 16 | #BOARD_ID=SAMD21E_DevBoard MCU=SAMD21E16A SDCARD=SDCARD_ENABLED make all mostly_clean 17 | #BOARD_ID=SAMD21E_DevBoard MCU=SAMD21E17A SDCARD=SDCARD_ENABLED make all mostly_clean 18 | #BOARD_ID=SAMD21E_DevBoard MCU=SAMD21E18A SDCARD=SDCARD_ENABLED make all mostly_clean 19 | #BOARD_ID=SAMD11C_DevBoard MCU=SAMD11C14A SDCARD=SDCARD_ENABLED make all mostly_clean 20 | 21 | mv -v *.bin ./binaries/ 22 | 23 | echo Done building bootloaders! 24 | 25 | -------------------------------------------------------------------------------- /ArduinoCore-samd/bootloaders/source/sam-ba/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/bootloaders/source/sam-ba/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 | #define SAM_BA_NONE 3 30 | 31 | /* Selects USB as the communication interface of the monitor */ 32 | #define SAM_BA_INTERFACE_USBCDC 0 33 | /* Selects USART as the communication interface of the monitor */ 34 | #define SAM_BA_INTERFACE_USART 1 35 | 36 | /* Buffer size */ 37 | #define SIZEBUFMAX 64 38 | 39 | /** 40 | * \brief Initialize the monitor 41 | * 42 | */ 43 | void sam_ba_monitor_init(uint8_t com_interface); 44 | 45 | /** 46 | * \brief System tick function of the SAM-BA Monitor 47 | * 48 | */ 49 | void sam_ba_monitor_sys_tick(void); 50 | 51 | /** 52 | * \brief Main function of the SAM-BA Monitor 53 | * 54 | */ 55 | void sam_ba_monitor_run(void); 56 | 57 | /** 58 | * \brief 59 | * 60 | */ 61 | void sam_ba_putdata_term(uint8_t* data, uint32_t length); 62 | 63 | /** 64 | * \brief 65 | * 66 | */ 67 | void call_applet(uint32_t address); 68 | 69 | #endif // _MONITOR_SAM_BA_H_ 70 | -------------------------------------------------------------------------------- /ArduinoCore-samd/bootloaders/source/sam-ba/util.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2015 Arduino LLC. All right reserved. 3 | * Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. All right reserved. 4 | * Copyright (c) 2017 MattairTech LLC. All right reserved. 5 | * Copyright (C) 2014, ChaN, all right reserved. 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. 15 | * See the GNU 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 | #ifndef _UTIL_H_ 23 | #define _UTIL_H_ 24 | 25 | #include "sam.h" 26 | #include 27 | #include "board_definitions.h" 28 | 29 | // TODO: Variable bootloader sizes 30 | #if (SAMD11) 31 | #define APP_START 0x00001000 32 | #else 33 | #define APP_START 0x00002000 34 | #endif 35 | 36 | #define SCB_AIRCR_VECTKEY_Val 0x05FA 37 | 38 | void flashErase (uint32_t startAddress); 39 | void flashWrite (uint32_t startAddress, uint32_t * buffer, uint32_t * ptr_data); 40 | void pinMux (uint32_t pinmux); 41 | void systemReset (void); 42 | void pinConfig (uint8_t port, uint8_t pin, uint8_t config); 43 | bool isPinActive (uint8_t port, uint8_t pin, uint8_t config); 44 | void delayUs (uint32_t delay); 45 | void waitForSync (void); 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/cores/arduino/RingBuffer.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 "RingBuffer.h" 20 | #include 21 | 22 | RingBuffer::RingBuffer( void ) 23 | { 24 | memset( _aucBuffer, 0, SERIAL_BUFFER_SIZE ) ; 25 | clear(); 26 | } 27 | 28 | void RingBuffer::store_char( uint8_t c ) 29 | { 30 | int i = nextIndex(_iHead); 31 | 32 | // if we should be storing the received character into the location 33 | // just before the tail (meaning that the head would advance to the 34 | // current location of the tail), we're about to overflow the buffer 35 | // and so we don't write the character or advance the head. 36 | if ( i != _iTail ) 37 | { 38 | _aucBuffer[_iHead] = c ; 39 | _iHead = i ; 40 | } 41 | } 42 | 43 | void RingBuffer::clear() 44 | { 45 | _iHead = 0; 46 | _iTail = 0; 47 | } 48 | 49 | int RingBuffer::read_char() 50 | { 51 | if(_iTail == _iHead) 52 | return -1; 53 | 54 | uint8_t value = _aucBuffer[_iTail]; 55 | _iTail = nextIndex(_iTail); 56 | 57 | return value; 58 | } 59 | 60 | int RingBuffer::available() 61 | { 62 | int delta = _iHead - _iTail; 63 | 64 | if(delta < 0) 65 | return SERIAL_BUFFER_SIZE + delta; 66 | else 67 | return delta; 68 | } 69 | 70 | int RingBuffer::availableForStore() 71 | { 72 | if (_iHead >= _iTail) 73 | return SERIAL_BUFFER_SIZE - 1 - _iHead + _iTail; 74 | else 75 | return _iTail - _iHead - 1; 76 | } 77 | 78 | int RingBuffer::peek() 79 | { 80 | if(_iTail == _iHead) 81 | return -1; 82 | 83 | return _aucBuffer[_iTail]; 84 | } 85 | 86 | int RingBuffer::nextIndex(int index) 87 | { 88 | return (uint32_t)(index + 1) % SERIAL_BUFFER_SIZE; 89 | } 90 | 91 | bool RingBuffer::isFull() 92 | { 93 | return (nextIndex(_iHead) == _iTail); 94 | } 95 | -------------------------------------------------------------------------------- /ArduinoCore-samd/cores/arduino/RingBuffer.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 _RING_BUFFER_ 20 | #define _RING_BUFFER_ 21 | 22 | #include 23 | 24 | // Define constants and variables for buffering incoming serial data. We're 25 | // using a ring buffer (I think), in which head is the index of the location 26 | // to which to write the next incoming character and tail is the index of the 27 | // location from which to read. 28 | #define SERIAL_BUFFER_SIZE 64 29 | 30 | class RingBuffer 31 | { 32 | public: 33 | uint8_t _aucBuffer[SERIAL_BUFFER_SIZE] ; 34 | volatile int _iHead ; 35 | volatile int _iTail ; 36 | 37 | public: 38 | RingBuffer( void ) ; 39 | void store_char( uint8_t c ) ; 40 | void clear(); 41 | int read_char(); 42 | int available(); 43 | int availableForStore(); 44 | int peek(); 45 | bool isFull(); 46 | 47 | private: 48 | int nextIndex(int index); 49 | } ; 50 | 51 | #endif /* _RING_BUFFER_ */ 52 | 53 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 uint8_t getShortName(char *name) { name[0] = 'A'+pluggedInterface; return 1; } 39 | 40 | uint8_t pluggedInterface; 41 | uint8_t pluggedEndpoint; 42 | 43 | const uint8_t numEndpoints; 44 | const uint8_t numInterfaces; 45 | const uint32_t *endpointType; 46 | 47 | PluggableUSBModule *next = NULL; 48 | 49 | friend class PluggableUSB_; 50 | }; 51 | 52 | class PluggableUSB_ { 53 | public: 54 | PluggableUSB_(); 55 | bool plug(PluggableUSBModule *node); 56 | int getInterface(uint8_t* interfaceCount); 57 | int getDescriptor(USBSetup& setup); 58 | bool setup(USBSetup& setup); 59 | void getShortName(char *iSerialNum); 60 | 61 | private: 62 | uint8_t lastIf; 63 | uint8_t lastEp; 64 | PluggableUSBModule* rootNode; 65 | }; 66 | 67 | // Replacement for global singleton. 68 | // This function prevents static-initialization-order-fiasco 69 | // https://isocpp.org/wiki/faq/ctors#static-init-order-on-first-use 70 | PluggableUSB_& PluggableUSB(); 71 | 72 | #endif 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | #if !defined(USB_DISABLED) 23 | #define PLUGGABLE_USB_ENABLED 24 | #endif 25 | 26 | #if defined(CDC_ONLY) || defined(CDC_HID) || defined(WITH_CDC) 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 | #if defined(CDC_ONLY) || defined(CDC_HID) || defined(WITH_CDC) 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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | #if (SAMD51) 51 | extern void UHD_Main_Handler(void); 52 | extern void UHD_SOF_Handler(void); 53 | extern void USB_SetMainHandler(void (*pf_isr)(void)); 54 | extern void USB_SetSOFHandler(void (*pf_isr)(void)); 55 | #else 56 | extern void UHD_Handler(void); 57 | extern void USB_SetHandler(void (*pf_isr)(void)); 58 | #endif 59 | extern uhd_vbus_state_t UHD_GetVBUSState(void); 60 | extern uint32_t UHD_Pipe0_Alloc(uint32_t ul_add, uint32_t ul_ep_size); 61 | 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); 62 | extern void UHD_Pipe_CountZero(uint32_t ul_pipe); 63 | extern void UHD_Pipe_Free(uint32_t ul_pipe); 64 | extern uint32_t UHD_Pipe_Read(uint32_t ul_pipe, uint32_t ul_size, uint8_t* data); 65 | extern void UHD_Pipe_Write(uint32_t ul_pipe, uint32_t ul_size, uint8_t* data); 66 | extern void UHD_Pipe_Send(uint32_t ul_pipe, uint32_t ul_token_type); 67 | extern uint32_t UHD_Pipe_Is_Transfer_Complete(uint32_t ul_pipe, uint32_t ul_token_type); 68 | 69 | #ifdef __cplusplus 70 | } 71 | #endif 72 | 73 | #endif /* USB_HOST_H_INCLUDED */ 74 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | #if (SAMD51) 44 | void availableDataHandler(); 45 | void dataRegisterEmptyHandler(); 46 | void errorHandler(); 47 | #else 48 | void IrqHandler(); 49 | #endif 50 | 51 | operator bool() { return true; } 52 | 53 | private: 54 | SERCOM *sercom; 55 | RingBuffer rxBuffer; 56 | RingBuffer txBuffer; 57 | 58 | uint8_t uc_pinRX; 59 | uint8_t uc_pinTX; 60 | SercomRXPad uc_padRX; 61 | SercomUartTXPad uc_padTX; 62 | uint8_t uc_pinRTS; 63 | volatile uint32_t* pul_outsetRTS; 64 | volatile uint32_t* pul_outclrRTS; 65 | uint32_t ul_pinMaskRTS; 66 | uint8_t uc_pinCTS; 67 | 68 | SercomNumberStopBit extractNbStopBit(uint16_t config); 69 | SercomUartCharSize extractCharSize(uint16_t config); 70 | SercomParityMode extractParity(uint16_t config); 71 | }; 72 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/cores/arduino/avr/dtoa_conv.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2005, Dmitry Xmelkov 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in 11 | the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of the copyright holders nor the names of 14 | contributors may be used to endorse or promote products derived 15 | from this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | POSSIBILITY OF SUCH DAMAGE. */ 28 | 29 | /* $Id: dtoa_conv.h 1175 2007-01-14 15:18:18Z dmix $ */ 30 | 31 | #ifndef _DTOA_CONV_H 32 | #define _DTOA_CONV_H 33 | 34 | #include 35 | 36 | int dtoa_prf (float val, char *s, unsigned char width, unsigned char prec, 37 | unsigned char flags); 38 | 39 | #define DTOA_SPACE 0x01 /* put space for positives */ 40 | #define DTOA_PLUS 0x02 /* put '+' for positives */ 41 | #define DTOA_UPPER 0x04 /* use uppercase letters */ 42 | #define DTOA_ZFILL 0x08 /* fill zeroes */ 43 | #define DTOA_LEFT 0x10 /* adjust to left */ 44 | #define DTOA_NOFILL 0x20 /* do not fill to width */ 45 | #define DTOA_EXP 0x40 /* d2stream: 'e(E)' format */ 46 | #define DTOA_FIX 0x80 /* d2stream: 'f(F)' format */ 47 | 48 | #define DTOA_EWIDTH (-1) /* Width too small */ 49 | #define DTOA_NONFINITE (-2) /* Value is NaN or Inf */ 50 | 51 | #endif /* !_DTOA_CONV_H */ 52 | -------------------------------------------------------------------------------- /ArduinoCore-samd/cores/arduino/avr/dtostrf.c: -------------------------------------------------------------------------------- 1 | /* 2 | dtostrf - Emulation for dtostrf function from avr-libc, but with double-precision 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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/cores/arduino/avr/dtostrf.h: -------------------------------------------------------------------------------- 1 | /* 2 | dtostrf - Emulation for dtostrf function from avr-libc, but with double-precision 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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/cores/arduino/avr/ftoa_engine.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2005, Dmitry Xmelkov 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in 11 | the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of the copyright holders nor the names of 14 | contributors may be used to endorse or promote products derived 15 | from this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | POSSIBILITY OF SUCH DAMAGE. */ 28 | 29 | /* $Id: ftoa_engine.h 1218 2007-02-18 13:18:41Z dmix $ */ 30 | 31 | #ifndef _FTOA_ENGINE_H 32 | #define _FTOA_ENGINE_H 33 | 34 | #include 35 | 36 | int16_t ftoa_engine(float val, char *buf, 37 | uint8_t precision, uint8_t maxDecimals); 38 | 39 | /* '__ftoa_engine' return next flags (in buf[0]): */ 40 | #define FTOA_MINUS 1 41 | #define FTOA_ZERO 2 42 | #define FTOA_INF 4 43 | #define FTOA_NAN 8 44 | #define FTOA_CARRY 16 /* Carry was to master position. */ 45 | 46 | #endif /* !_FTOA_ENGINE_H */ 47 | -------------------------------------------------------------------------------- /ArduinoCore-samd/cores/arduino/avr/ftostrf.c: -------------------------------------------------------------------------------- 1 | /* ftostrf - Same as dtostrf function from avr-libc, which used single-precision 2 | 3 | Copyright (c) 2005, Dmitry Xmelkov 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | * Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in 13 | the documentation and/or other materials provided with the 14 | distribution. 15 | * Neither the name of the copyright holders nor the names of 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. */ 30 | 31 | /* $Id: dtostrf.c 1944 2009-04-01 23:12:20Z arcanum $ */ 32 | 33 | #include 34 | #include "ftoa_engine.h" 35 | #include "dtoa_conv.h" 36 | 37 | /* ??? Is 'width' a signed value? 38 | dtostrf.S comment: 39 | If precision is < 0, the string is left adjusted with leading spaces. 40 | If precision is > 0, the string is right adjusted with trailing spaces. 41 | dtostrf.S code: 42 | 'p_width' is a register for left/right adjustment 43 | avr-libc manual: 44 | nothing about this 45 | 46 | So, for compatibilty 'width' is signed value to left/right adjust. 47 | */ 48 | 49 | char *ftostrf (float val, signed char width, unsigned char prec, char *sout) 50 | { 51 | unsigned char flags; 52 | 53 | /* DTOA_UPPER: for compatibility with avr-libc <= 1.4 with NaNs */ 54 | flags = width < 0 ? DTOA_LEFT | DTOA_UPPER : DTOA_UPPER; 55 | dtoa_prf (val, sout, abs(width), prec, flags); 56 | return sout; 57 | } 58 | -------------------------------------------------------------------------------- /ArduinoCore-samd/cores/arduino/avr/ftostrf.h: -------------------------------------------------------------------------------- 1 | /* 2 | ftostrf - Same as dtostrf function from avr-libc, which used single-precision 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 *ftostrf(float val, signed char width, unsigned char prec, char *sout); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | #if (SAMD21 || SAMD11) 28 | #define RAMSTART (HMCRAMC0_ADDR) 29 | #define RAMSIZE (HMCRAMC0_SIZE) 30 | #elif (SAMD51 || SAML21 || SAMC21) 31 | #define RAMSTART (HSRAM_ADDR) 32 | #define RAMSIZE (HSRAM_SIZE) 33 | #endif 34 | #define RAMEND (RAMSTART + RAMSIZE - 1) 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | /** 20 | * Empty yield() hook. 21 | * 22 | * This function is intended to be used by library writers to build 23 | * libraries or sketches that supports cooperative threads. 24 | * 25 | * Its defined as a weak symbol and it can be redefined to implement a 26 | * real cooperative scheduler. 27 | */ 28 | static void __empty() { 29 | // Empty 30 | } 31 | void yield(void) __attribute__ ((weak, alias("__empty"))); 32 | 33 | /** 34 | * SysTick hook 35 | * 36 | * This function is called from SysTick handler, before the default 37 | * handler provided by Arduino. 38 | */ 39 | static int __false() { 40 | // Return false 41 | return 0; 42 | } 43 | int sysTickHook(void) __attribute__ ((weak, alias("__false"))); 44 | 45 | /** 46 | * SVC hook 47 | * PendSV hook 48 | * 49 | * These functions are called from SVC handler, and PensSV handler. 50 | * Default action is halting. 51 | */ 52 | static void __halt() { 53 | // Halts 54 | while (1) 55 | ; 56 | } 57 | void svcHook(void) __attribute__ ((weak, alias("__halt"))); 58 | void pendSVHook(void) __attribute__ ((weak, alias("__halt"))); 59 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | #include "sam.h" 22 | 23 | // Weak empty variant initialization function. 24 | // May be redefined by variant files. 25 | void initVariant() __attribute__((weak)); 26 | void initVariant() { } 27 | 28 | // Initialize C library 29 | extern "C" void __libc_init_array(void); 30 | 31 | /* 32 | * \brief Main entry point of Arduino application 33 | */ 34 | int main( void ) 35 | { 36 | init(); 37 | 38 | __libc_init_array(); 39 | 40 | initVariant(); 41 | 42 | delay(1); 43 | #if defined(USBCON) && !defined(USB_DISABLED) 44 | USBDevice.init(); 45 | USBDevice.attach(); 46 | #endif 47 | 48 | setup(); 49 | 50 | for (;;) 51 | { 52 | loop(); 53 | if (serialEventRun) serialEventRun(); 54 | } 55 | 56 | return 0; 57 | } 58 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | 21 | void *operator new(size_t size) { 22 | return malloc(size); 23 | } 24 | 25 | void *operator new[](size_t size) { 26 | return malloc(size); 27 | } 28 | 29 | void operator delete(void * ptr) { 30 | free(ptr); 31 | } 32 | 33 | void operator delete[](void * ptr) { 34 | free(ptr); 35 | } 36 | 37 | -------------------------------------------------------------------------------- /ArduinoCore-samd/cores/arduino/pulse.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 | // See pulse_asm.S 22 | extern unsigned long countPulseASM(const volatile uint32_t *port, uint32_t bit, uint32_t stateMask, unsigned long maxloops); 23 | 24 | /* Measures the length (in microseconds) of a pulse on the pin; state is HIGH 25 | * or LOW, the type of pulse to measure. Works on pulses from 2-3 microseconds 26 | * to 3 minutes in length, but must be called at least a few dozen microseconds 27 | * before the start of the pulse. */ 28 | uint32_t pulseIn(uint32_t pin, uint32_t state, uint32_t timeout) 29 | { 30 | // cache the port and bit of the pin in order to speed up the 31 | // pulse width measuring loop and achieve finer resolution. calling 32 | // digitalRead() instead yields much coarser resolution. 33 | uint32_t bit = 1 << GetPin(pin); 34 | uint32_t stateMask = state ? bit : 0; 35 | 36 | // convert the timeout from microseconds to a number of times through 37 | // the initial loop; it takes (roughly) 13 clock cycles per iteration. 38 | uint32_t maxloops = microsecondsToClockCycles(timeout) / 13; 39 | 40 | uint32_t width = countPulseASM(&(PORT->Group[GetPort(pin)].IN.reg), bit, stateMask, maxloops); 41 | 42 | // convert the reading to microseconds. The loop has been determined 43 | // to be 13 clock cycles long and have about 16 clocks between the edge 44 | // and the start of the loop. There will be some error introduced by 45 | // the interrupt handlers. 46 | if (width) 47 | return clockCyclesToMicroseconds(width * 13 + 16); 48 | else 49 | return 0; 50 | } 51 | 52 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | #define RET_STATUS_OK 0 35 | 36 | int pinPeripheral( uint32_t ulPin, uint32_t ulPeripheral ); 37 | 38 | #ifdef __cplusplus 39 | } // extern "C" 40 | 41 | #include "HardwareSerial.h" 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/drivers/99-mattairtech-USB-CDC.rules: -------------------------------------------------------------------------------- 1 | # udev rules for USB CDC devices on MattairTech development boards 2 | # 3 | # Copy this file to the location of your distribution's udev rules, for example on Ubuntu: 4 | # sudo cp 99-mattairtech-USB-CDC.rules /etc/udev/rules.d/ 5 | # Then reload udev configuration by executing: 6 | # sudo reload udev 7 | # Or if that doesn't work try: 8 | # sudo udevadm control --reload-rules 9 | # sudo udevadm trigger 10 | 11 | # Rule to access MattairTech USB CDC devices without running Arduino as root. 12 | # Should work as-is for Ubuntu. Other distributions might need to change 13 | # GROUP="dialout" to another group (ie: "users"). 14 | SUBSYSTEM=="usb", ATTR{idProduct}=="0557", ATTRS{idVendor}=="16D0", MODE="0660", GROUP="dialout" 15 | SUBSYSTEM=="usb", ATTR{idProduct}=="0856", ATTRS{idVendor}=="16D0", MODE="0660", GROUP="dialout" 16 | SUBSYSTEM=="usb", ATTR{idProduct}=="0B41", ATTRS{idVendor}=="16D0", MODE="0660", GROUP="dialout" 17 | 18 | # Rule to blacklist MattairTech USB CDC devices from being manipulated by ModemManager. 19 | # Fixes issue with hanging references to /dev/ttyACM* devices. 20 | ATTRS{idVendor}=="16D0", ENV{ID_MM_DEVICE_IGNORE}="1" 21 | -------------------------------------------------------------------------------- /ArduinoCore-samd/drivers/mattairtech_cdc.cat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/ArduinoCore-samd/drivers/mattairtech_cdc.cat -------------------------------------------------------------------------------- /ArduinoCore-samd/keywords.txt: -------------------------------------------------------------------------------- 1 | SerialGSM KEYWORD1 2 | INPUT_PULLDOWN LITERAL1 Constants RESERVED_WORD_2 3 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | #define NUM_DMA_CHANNELS 1 21 | 22 | /* 23 | WARNING: The API for this class may change and it's not intended for public use! 24 | */ 25 | class DMAClass 26 | { 27 | public: 28 | DMAClass(); 29 | virtual ~DMAClass(); 30 | 31 | void begin(); 32 | void end(); 33 | 34 | int allocateChannel(); 35 | void freeChannel(int channel); 36 | 37 | void setPriorityLevel(int channel, int level); 38 | void setTriggerSource(int channel, int source); 39 | void setTransferWidth(int channel, int transferWidth); 40 | void incSrc(int channel); 41 | void incDst(int channel); 42 | int transfer(int channel, void* src, void* dst, uint16_t size); 43 | 44 | void onTransferComplete(int channel, void(*function)(int)); 45 | void onTransferError(int channel, void(*function)(int)); 46 | 47 | void onService(); 48 | 49 | private: 50 | static int _beginCount; 51 | uint32_t _channelMask; 52 | 53 | void (*_transferCompleteCallbacks[NUM_DMA_CHANNELS])(int); 54 | void (*_transferErrorCallbacks[NUM_DMA_CHANNELS])(int); 55 | 56 | DmacDescriptor _descriptors[NUM_DMA_CHANNELS] __attribute__ ((aligned (16))); 57 | DmacDescriptor _descriptorsWriteBack[NUM_DMA_CHANNELS] __attribute__ ((aligned (16))); 58 | }; 59 | 60 | extern DMAClass DMA; 61 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/libraries/SAMD_AnalogCorrection/library.properties: -------------------------------------------------------------------------------- 1 | name=SAMD_AnalogCorrection 2 | version=1.0 3 | author=Arduino 4 | maintainer=Arduino 5 | sentence=Sets and enables the digital correction logic of the SAMD ADC. 6 | paragraph=Useful to correct the values returned by the ADC. 7 | category=Other 8 | url= 9 | architectures=samd 10 | -------------------------------------------------------------------------------- /ArduinoCore-samd/libraries/SAMD_AnalogCorrection/src/SAMD_AnalogCorrection.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 "SAMD_AnalogCorrection.h" 20 | 21 | void analogReadCorrection (int offset, uint16_t gain) 22 | { 23 | // Set correction values 24 | ADC->OFFSETCORR.reg = ADC_OFFSETCORR_OFFSETCORR(offset); 25 | ADC->GAINCORR.reg = ADC_GAINCORR_GAINCORR(gain); 26 | 27 | // Enable digital correction logic 28 | #if (SAMD21 || SAMD11) 29 | ADC->CTRLB.bit.CORREN = 1; 30 | while(ADC->STATUS.bit.SYNCBUSY); 31 | #elif (SAML21 || SAMC21) 32 | ADC->CTRLC.bit.CORREN = 1; 33 | while ( ADC->SYNCBUSY.reg & ADC_SYNCBUSY_MASK ); 34 | #elif (SAMD51) 35 | ADC->CTRLB.bit.CORREN = 1; 36 | while ( ADC->SYNCBUSY.reg & ADC_SYNCBUSY_MASK ); 37 | #else 38 | #error "SAMD_AnalogCorrection.h: Unsupported chip" 39 | #endif 40 | } 41 | 42 | -------------------------------------------------------------------------------- /ArduinoCore-samd/libraries/SAMD_AnalogCorrection/src/SAMD_AnalogCorrection.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 | void analogReadCorrection (int offset, uint16_t gain); 24 | 25 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/libraries/USBHost/examples/KeyboardController/KeyboardController.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Keyboard Controller Example 3 | 4 | Shows the output of a USB Keyboard connected to 5 | the Native USB port on an Arduino Due Board. 6 | 7 | created 8 Oct 2012 8 | by Cristian Maglie 9 | 10 | http://arduino.cc/en/Tutorial/KeyboardController 11 | 12 | This sample code is part of the public domain. 13 | */ 14 | 15 | // Require keyboard control library 16 | #include 17 | 18 | // Initialize USB Controller 19 | USBHost usb; 20 | 21 | // Attach keyboard controller to USB 22 | KeyboardController keyboard(usb); 23 | 24 | void printKey(); 25 | 26 | // This function intercepts key press 27 | void keyPressed() { 28 | SERIAL_PORT_MONITOR.print("Pressed: "); 29 | printKey(); 30 | } 31 | 32 | // This function intercepts key release 33 | void keyReleased() { 34 | SERIAL_PORT_MONITOR.print("Released: "); 35 | printKey(); 36 | } 37 | 38 | void printKey() { 39 | // getOemKey() returns the OEM-code associated with the key 40 | SERIAL_PORT_MONITOR.print(" key:"); 41 | SERIAL_PORT_MONITOR.print(keyboard.getOemKey()); 42 | 43 | // getModifiers() returns a bits field with the modifiers-keys 44 | int mod = keyboard.getModifiers(); 45 | SERIAL_PORT_MONITOR.print(" mod:"); 46 | SERIAL_PORT_MONITOR.print(mod); 47 | 48 | SERIAL_PORT_MONITOR.print(" => "); 49 | 50 | if (mod & LeftCtrl) 51 | SERIAL_PORT_MONITOR.print("L-Ctrl "); 52 | if (mod & LeftShift) 53 | SERIAL_PORT_MONITOR.print("L-Shift "); 54 | if (mod & Alt) 55 | SERIAL_PORT_MONITOR.print("Alt "); 56 | if (mod & LeftCmd) 57 | SERIAL_PORT_MONITOR.print("L-Cmd "); 58 | if (mod & RightCtrl) 59 | SERIAL_PORT_MONITOR.print("R-Ctrl "); 60 | if (mod & RightShift) 61 | SERIAL_PORT_MONITOR.print("R-Shift "); 62 | if (mod & AltGr) 63 | SERIAL_PORT_MONITOR.print("AltGr "); 64 | if (mod & RightCmd) 65 | SERIAL_PORT_MONITOR.print("R-Cmd "); 66 | 67 | // getKey() returns the ASCII translation of OEM key 68 | // combined with modifiers. 69 | SERIAL_PORT_MONITOR.write(keyboard.getKey()); 70 | SERIAL_PORT_MONITOR.println(); 71 | } 72 | 73 | void setup() 74 | { 75 | SERIAL_PORT_MONITOR.begin( 115200 ); 76 | while (!SERIAL_PORT_MONITOR); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection 77 | SERIAL_PORT_MONITOR.println("Keyboard Controller Program started"); 78 | 79 | if (usb.Init() == -1) 80 | SERIAL_PORT_MONITOR.println("OSC did not start."); 81 | 82 | delay( 20 ); 83 | } 84 | 85 | void loop() 86 | { 87 | // Process USB tasks 88 | usb.Task(); 89 | } 90 | -------------------------------------------------------------------------------- /ArduinoCore-samd/libraries/USBHost/examples/MouseController/MouseController.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Mouse Controller Example 3 | 4 | Shows the output of a USB Mouse connected to 5 | the Native USB port on an Arduino Due Board. 6 | 7 | created 8 Oct 2012 8 | by Cristian Maglie 9 | 10 | http://arduino.cc/en/Tutorial/MouseController 11 | 12 | This sample code is part of the public domain. 13 | */ 14 | 15 | // Require mouse control library 16 | #include 17 | 18 | // Initialize USB Controller 19 | USBHost usb; 20 | 21 | // Attach mouse controller to USB 22 | MouseController mouse(usb); 23 | 24 | // variables for mouse button states 25 | boolean leftButton = false; 26 | boolean middleButton = false; 27 | boolean rightButton = false; 28 | 29 | // This function intercepts mouse movements 30 | void mouseMoved() { 31 | SERIAL_PORT_MONITOR.print("Move: "); 32 | SERIAL_PORT_MONITOR.print(mouse.getXChange()); 33 | SERIAL_PORT_MONITOR.print(", "); 34 | SERIAL_PORT_MONITOR.println(mouse.getYChange()); 35 | } 36 | 37 | // This function intercepts mouse movements while a button is pressed 38 | void mouseDragged() { 39 | SERIAL_PORT_MONITOR.print("DRAG: "); 40 | SERIAL_PORT_MONITOR.print(mouse.getXChange()); 41 | SERIAL_PORT_MONITOR.print(", "); 42 | SERIAL_PORT_MONITOR.println(mouse.getYChange()); 43 | } 44 | 45 | // This function intercepts mouse button press 46 | void mousePressed() { 47 | SERIAL_PORT_MONITOR.print("Pressed: "); 48 | if (mouse.getButton(LEFT_BUTTON)) { 49 | SERIAL_PORT_MONITOR.print("L"); 50 | leftButton = true; 51 | } 52 | if (mouse.getButton(MIDDLE_BUTTON)) { 53 | SERIAL_PORT_MONITOR.print("M"); 54 | middleButton = true; 55 | } 56 | if (mouse.getButton(RIGHT_BUTTON)) { 57 | SERIAL_PORT_MONITOR.print("R"); 58 | rightButton = true; 59 | } 60 | SERIAL_PORT_MONITOR.println(); 61 | } 62 | 63 | // This function intercepts mouse button release 64 | void mouseReleased() { 65 | SERIAL_PORT_MONITOR.print("Released: "); 66 | if (!mouse.getButton(LEFT_BUTTON) && leftButton == true) { 67 | SERIAL_PORT_MONITOR.print("L"); 68 | leftButton = false; 69 | } 70 | if (!mouse.getButton(MIDDLE_BUTTON) && middleButton == true) { 71 | SERIAL_PORT_MONITOR.print("M"); 72 | middleButton = false; 73 | } 74 | if (!mouse.getButton(RIGHT_BUTTON) && rightButton == true) { 75 | SERIAL_PORT_MONITOR.print("R"); 76 | rightButton = false; 77 | } 78 | SERIAL_PORT_MONITOR.println(); 79 | } 80 | 81 | void setup() 82 | { 83 | SERIAL_PORT_MONITOR.begin( 115200 ); 84 | while (!SERIAL_PORT_MONITOR); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection 85 | SERIAL_PORT_MONITOR.println("Mouse Controller Program started"); 86 | 87 | if (usb.Init() == -1) 88 | SERIAL_PORT_MONITOR.println("OSC did not start."); 89 | 90 | delay( 20 ); 91 | } 92 | 93 | void loop() 94 | { 95 | // Process USB tasks 96 | usb.Task(); 97 | } 98 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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__ -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | while(1 < Wire.available()) // loop through all but the last 32 | { 33 | char c = Wire.read(); // receive byte as a character 34 | Serial.print(c); // print the character 35 | } 36 | int x = Wire.read(); // receive byte as an integer 37 | Serial.println(x); // print the integer 38 | } 39 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/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 | # Modified 2021 by Stefan Wagner, https://github.com/wagiminator 18 | 19 | cmsis_dap.name=Generic CMSIS-DAP 20 | cmsis_dap.communication=USB 21 | cmsis_dap.protocol= 22 | cmsis_dap.program.protocol= 23 | cmsis_dap.program.interface=cmsis-dap 24 | cmsis_dap.program.transport=swd 25 | cmsis_dap.program.tool=openocd 26 | cmsis_dap.program.extra_params= 27 | 28 | jlink.name=SEGGER J-Link 29 | jlink.communication=USB 30 | jlink.protocol= 31 | jlink.program.protocol= 32 | jlink.program.interface=jlink 33 | jlink.program.transport=swd 34 | jlink.program.tool=openocd 35 | jlink.program.extra_params=reset_config none separate; set WORKAREASIZE 0; 36 | -------------------------------------------------------------------------------- /ArduinoCore-samd/variants/SAMD11C/debug_scripts/SAMD11C14A.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 at91samd11c14a" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" 32 | -------------------------------------------------------------------------------- /ArduinoCore-samd/variants/SAMD11C/openocd_scripts/SAMD11C14A.cfg: -------------------------------------------------------------------------------- 1 | set CHIPNAME at91samd11c14a 2 | set ENDIAN little 3 | set telnet_port 0 4 | source [find target/at91samdXX.cfg] 5 | -------------------------------------------------------------------------------- /ArduinoCore-samd/variants/SAMD11C/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/variants/SAMD11D/debug_scripts/SAMD11D14AS.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 at91samd11d14as" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" 32 | -------------------------------------------------------------------------------- /ArduinoCore-samd/variants/SAMD11D/openocd_scripts/SAMD11D14AS.cfg: -------------------------------------------------------------------------------- 1 | set CHIPNAME at91samd11d14as 2 | set ENDIAN little 3 | set telnet_port 0 4 | source [find target/at91samdXX.cfg] 5 | -------------------------------------------------------------------------------- /ArduinoCore-samd/variants/SAMD11D/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 | -------------------------------------------------------------------------------- /ArduinoCore-samd/variants/SAMD21E/debug_scripts/SAMD21E15A.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 at91samd21e15" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" 32 | -------------------------------------------------------------------------------- /ArduinoCore-samd/variants/SAMD21E/debug_scripts/SAMD21E16A.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 at91samd21e16" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" 32 | -------------------------------------------------------------------------------- /ArduinoCore-samd/variants/SAMD21E/debug_scripts/SAMD21E17A.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 at91samd21e17" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" 32 | -------------------------------------------------------------------------------- /ArduinoCore-samd/variants/SAMD21E/debug_scripts/SAMD21E18A.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 at91samd21e18" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log" 32 | -------------------------------------------------------------------------------- /ArduinoCore-samd/variants/SAMD21E/openocd_scripts/SAMD21E15A.cfg: -------------------------------------------------------------------------------- 1 | set CHIPNAME at91samd21e15 2 | set ENDIAN little 3 | set telnet_port 0 4 | source [find target/at91samdXX.cfg] 5 | -------------------------------------------------------------------------------- /ArduinoCore-samd/variants/SAMD21E/openocd_scripts/SAMD21E16A.cfg: -------------------------------------------------------------------------------- 1 | set CHIPNAME at91samd21e16 2 | set ENDIAN little 3 | set telnet_port 0 4 | source [find target/at91samdXX.cfg] 5 | -------------------------------------------------------------------------------- /ArduinoCore-samd/variants/SAMD21E/openocd_scripts/SAMD21E17A.cfg: -------------------------------------------------------------------------------- 1 | set CHIPNAME at91samd21e17 2 | set ENDIAN little 3 | set telnet_port 0 4 | source [find target/at91samdXX.cfg] 5 | -------------------------------------------------------------------------------- /ArduinoCore-samd/variants/SAMD21E/openocd_scripts/SAMD21E18A.cfg: -------------------------------------------------------------------------------- 1 | set CHIPNAME at91samd21e18 2 | set ENDIAN little 3 | set telnet_port 0 4 | source [find target/at91samdXX.cfg] 5 | -------------------------------------------------------------------------------- /ArduinoCore-samd/variants/SAMD21E/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 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. 2 | To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or send 3 | a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SAMD Development Boards 2 | Collection of SAMD development boards, programmers, tools and firmware. 3 | 4 | ## [ArduinoCore for SAMD DevBoards](https://github.com/wagiminator/SAMD-Development-Boards/tree/main/ArduinoCore-samd) 5 | The ArduinoCore adds Arduino IDE support for the SAMD Development Boards as well as support for Generic CMSIS-DAP and SEGGER J-Link programmers. 6 | 7 | ## [SAMD11C Development Board](https://github.com/wagiminator/SAMD-Development-Boards/tree/main/SAMD11C_DevBoard) 8 | Development board for the ATSAMD11C14A 32-bit ARM Cortex-M0+ microcontroller with native USB, 3.3V voltage regulator and support for Arduino IDE. 9 | 10 | ![SAMD11C_DevBoard_pic1.jpg](https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/main/SAMD11C_DevBoard/documentation/SAMD11C_DevBoard_pic1.jpg) 11 | 12 | ## [SAMD11D Development Board](https://github.com/wagiminator/SAMD-Development-Boards/tree/main/SAMD11D_DevBoard) 13 | Development board for the ATSAMD11D14A (20-pin SOIC) 32-bit ARM Cortex-M0+ microcontroller with native USB, 3.3V voltage regulator and support for Arduino IDE. 14 | 15 | ![SAMD11D_DevBoard_pic1.jpg](https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/main/SAMD11D_DevBoard/documentation/SAMD11D_DevBoard_pic1.jpg) 16 | 17 | ## [SAMD21E Development Board](https://github.com/wagiminator/SAMD-Development-Boards/tree/main/SAMD21E_DevBoard) 18 | Development board for the ATSAMD21E series of 32-bit ARM Cortex-M0+ microcontrollers with native USB, 32.768 kHz crystal, 3.3V voltage regulator and support for Arduino IDE. 19 | 20 | ![SAMD21E_DevBoard_pic1.jpg](https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/main/SAMD21E_DevBoard/documentation/SAMD21E_DevBoard_pic1.jpg) 21 | 22 | ## [SWD Programmer Stick](https://github.com/wagiminator/SAMD-Development-Boards/tree/main/SWD_Programmer_Stick) 23 | The SWD Programmer Stick is a CMSIS-DAP compliant debugging probe with SWD protocol support based on [Free-DAP](https://github.com/ataradov/free-dap) by Alex Taradov. It can be used to program Microchip SAM and other ARM-based microcontrollers. 24 | 25 | ![SWD_Programmer_Stick_pic1.jpg](https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/main/SWD_Programmer_Stick/documentation/SWD_Programmer_Stick_pic1.jpg) 26 | 27 | ## [SAMD Programmer Adapter](https://github.com/wagiminator/SAMD-Development-Boards/tree/main/SAMD_Programmer_Adapter) 28 | The SAMD Programmer Adapter makes it easy to flash SAMD microcontrollers in TQFP-32 or SOIC-14 packages prior to soldering. 29 | 30 | ![SAMD_Programmer_Adapter.jpg](https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/main/SAMD_Programmer_Adapter/SAMD_Programmer_Adapter_pic2.jpg) 31 | -------------------------------------------------------------------------------- /SAMD11C_DevBoard/bootloader/cmsis-dap.cfg: -------------------------------------------------------------------------------- 1 | interface cmsis-dap 2 | transport select swd 3 | set CHIPNAME at91samd11c14a 4 | source [find target/at91samdXX.cfg] 5 | 6 | init 7 | targets 8 | reset halt 9 | at91samd bootloader 0 10 | reset 11 | program sam_ba_samd11c14a.bin verify 12 | at91samd bootloader 4096 13 | reset 14 | shutdown 15 | -------------------------------------------------------------------------------- /SAMD11C_DevBoard/bootloader/flash.jlink: -------------------------------------------------------------------------------- 1 | device atsamd11c14 2 | if swd 3 | speed 4000 4 | loadfile samd_bootprot_clear.mot 5 | r 6 | loadbin sam_ba_samd11c14a.bin,0 7 | verifybin sam_ba_samd11c14a.bin,0 8 | loadfile samd_bootprot_4k.mot 9 | r 10 | g 11 | exit 12 | -------------------------------------------------------------------------------- /SAMD11C_DevBoard/bootloader/jlink.cfg: -------------------------------------------------------------------------------- 1 | interface jlink 2 | transport select swd 3 | set CHIPNAME at91samd11c14a 4 | source [find target/at91samdXX.cfg] 5 | 6 | init 7 | targets 8 | reset halt 9 | at91samd bootloader 0 10 | reset 11 | program sam_ba_samd11c14a.bin verify 12 | at91samd bootloader 4096 13 | reset 14 | shutdown 15 | -------------------------------------------------------------------------------- /SAMD11C_DevBoard/bootloader/readme.txt: -------------------------------------------------------------------------------- 1 | Installing bootloader using CMSIS-DAP device 2 | ============================================ 3 | run the following command: 4 | openocd -f cmsis-dap.cfg 5 | 6 | 7 | Installing bootloader using SEGGER J-Link 8 | ============================================ 9 | run the following command (openocd): 10 | openocd -f jlink.cfg 11 | 12 | or (jlink commander): 13 | JLinkExe -commanderscript flash.jlink 14 | 15 | 16 | More information and source code 17 | ============================================ 18 | - https://github.com/mattairtech/ArduinoCore-samd 19 | - https://github.com/wagiminator 20 | - http://openocd.org/ 21 | - http://www.segger.com/download-jlink.html 22 | -------------------------------------------------------------------------------- /SAMD11C_DevBoard/bootloader/sam_ba_samd11c14a.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SAMD11C_DevBoard/bootloader/sam_ba_samd11c14a.bin -------------------------------------------------------------------------------- /SAMD11C_DevBoard/bootloader/samd_bootprot_4k.mot: -------------------------------------------------------------------------------- 1 | S214804000FBC7E0D85DFCFFFFFFFFFFFFFFFFFFFF62 2 | S9030000FC 3 | -------------------------------------------------------------------------------- /SAMD11C_DevBoard/bootloader/samd_bootprot_clear.mot: -------------------------------------------------------------------------------- 1 | S214804000FFC7E0D85DFCFFFFFFFFFFFFFFFFFFFF5E 2 | S9030000FC 3 | -------------------------------------------------------------------------------- /SAMD11C_DevBoard/documentation/SAMD11C_DevBoard_pic1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SAMD11C_DevBoard/documentation/SAMD11C_DevBoard_pic1.jpg -------------------------------------------------------------------------------- /SAMD11C_DevBoard/documentation/SAMD11C_DevBoard_pic2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SAMD11C_DevBoard/documentation/SAMD11C_DevBoard_pic2.jpg -------------------------------------------------------------------------------- /SAMD11C_DevBoard/documentation/SAMD11C_DevBoard_pic3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SAMD11C_DevBoard/documentation/SAMD11C_DevBoard_pic3.jpg -------------------------------------------------------------------------------- /SAMD11C_DevBoard/documentation/SAMD11C_DevBoard_pinout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SAMD11C_DevBoard/documentation/SAMD11C_DevBoard_pinout.png -------------------------------------------------------------------------------- /SAMD11C_DevBoard/hardware/SAMD11C_DevBoard_BOM.tsv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SAMD11C_DevBoard/hardware/SAMD11C_DevBoard_BOM.tsv -------------------------------------------------------------------------------- /SAMD11C_DevBoard/hardware/SAMD11C_DevBoard_gerber.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SAMD11C_DevBoard/hardware/SAMD11C_DevBoard_gerber.zip -------------------------------------------------------------------------------- /SAMD11C_DevBoard/hardware/SAMD11C_DevBoard_schematic.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SAMD11C_DevBoard/hardware/SAMD11C_DevBoard_schematic.pdf -------------------------------------------------------------------------------- /SAMD11D_DevBoard/bootloader/cmsis-dap.cfg: -------------------------------------------------------------------------------- 1 | interface cmsis-dap 2 | transport select swd 3 | set CHIPNAME at91samd11d14as 4 | source [find target/at91samdXX.cfg] 5 | 6 | init 7 | targets 8 | reset halt 9 | at91samd bootloader 0 10 | reset 11 | program sam_ba_samd11d14as.bin verify 12 | at91samd bootloader 4096 13 | reset 14 | shutdown 15 | -------------------------------------------------------------------------------- /SAMD11D_DevBoard/bootloader/flash.jlink: -------------------------------------------------------------------------------- 1 | device atsamd11d14 2 | if swd 3 | speed 4000 4 | loadfile samd_bootprot_clear.mot 5 | r 6 | loadbin sam_ba_samd11d14as.bin,0 7 | verifybin sam_ba_samd11d14as.bin,0 8 | loadfile samd_bootprot_4k.mot 9 | r 10 | g 11 | exit 12 | -------------------------------------------------------------------------------- /SAMD11D_DevBoard/bootloader/jlink.cfg: -------------------------------------------------------------------------------- 1 | interface jlink 2 | transport select swd 3 | set CHIPNAME at91samd11d14as 4 | source [find target/at91samdXX.cfg] 5 | 6 | init 7 | targets 8 | reset halt 9 | at91samd bootloader 0 10 | reset 11 | program sam_ba_samd11d14as.bin verify 12 | at91samd bootloader 4096 13 | reset 14 | shutdown 15 | -------------------------------------------------------------------------------- /SAMD11D_DevBoard/bootloader/readme.txt: -------------------------------------------------------------------------------- 1 | Installing bootloader using CMSIS-DAP device 2 | ============================================ 3 | run the following command: 4 | openocd -f cmsis-dap.cfg 5 | 6 | 7 | Installing bootloader using SEGGER J-Link 8 | ============================================ 9 | run the following command (openocd): 10 | openocd -f jlink.cfg 11 | 12 | or (jlink commander): 13 | JLinkExe -commanderscript flash.jlink 14 | 15 | 16 | More information and source code 17 | ============================================ 18 | - https://github.com/mattairtech/ArduinoCore-samd 19 | - https://github.com/wagiminator 20 | - http://openocd.org/ 21 | - http://www.segger.com/download-jlink.html 22 | -------------------------------------------------------------------------------- /SAMD11D_DevBoard/bootloader/sam_ba_samd11d14as.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SAMD11D_DevBoard/bootloader/sam_ba_samd11d14as.bin -------------------------------------------------------------------------------- /SAMD11D_DevBoard/bootloader/samd_bootprot_4k.mot: -------------------------------------------------------------------------------- 1 | S214804000FBC7E0D85DFCFFFFFFFFFFFFFFFFFFFF62 2 | S9030000FC 3 | -------------------------------------------------------------------------------- /SAMD11D_DevBoard/bootloader/samd_bootprot_clear.mot: -------------------------------------------------------------------------------- 1 | S214804000FFC7E0D85DFCFFFFFFFFFFFFFFFFFFFF5E 2 | S9030000FC 3 | -------------------------------------------------------------------------------- /SAMD11D_DevBoard/documentation/SAMD11D_DevBoard_pic1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SAMD11D_DevBoard/documentation/SAMD11D_DevBoard_pic1.jpg -------------------------------------------------------------------------------- /SAMD11D_DevBoard/documentation/SAMD11D_DevBoard_pic2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SAMD11D_DevBoard/documentation/SAMD11D_DevBoard_pic2.jpg -------------------------------------------------------------------------------- /SAMD11D_DevBoard/documentation/SAMD11D_DevBoard_pic3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SAMD11D_DevBoard/documentation/SAMD11D_DevBoard_pic3.jpg -------------------------------------------------------------------------------- /SAMD11D_DevBoard/hardware/SAMD11D_DevBoard_BOM.tsv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SAMD11D_DevBoard/hardware/SAMD11D_DevBoard_BOM.tsv -------------------------------------------------------------------------------- /SAMD11D_DevBoard/hardware/SAMD11D_DevBoard_gerber.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SAMD11D_DevBoard/hardware/SAMD11D_DevBoard_gerber.zip -------------------------------------------------------------------------------- /SAMD11D_DevBoard/hardware/SAMD11D_DevBoard_schematic.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SAMD11D_DevBoard/hardware/SAMD11D_DevBoard_schematic.pdf -------------------------------------------------------------------------------- /SAMD21E_DevBoard/bootloader/cmsis-dap.cfg: -------------------------------------------------------------------------------- 1 | interface cmsis-dap 2 | transport select swd 3 | set CHIPNAME at91samd21e18a 4 | source [find target/at91samdXX.cfg] 5 | 6 | init 7 | targets 8 | reset halt 9 | at91samd bootloader 0 10 | reset 11 | program sam_uf2_samd21e18a.bin verify 12 | at91samd bootloader 8192 13 | reset 14 | shutdown 15 | -------------------------------------------------------------------------------- /SAMD21E_DevBoard/bootloader/flash.jlink: -------------------------------------------------------------------------------- 1 | device atsamd21e18 2 | if swd 3 | speed 4000 4 | loadfile samd_bootprot_clear.mot 5 | r 6 | loadbin sam_uf2_samd21e18a.bin,0 7 | verifybin sam_uf2_samd21e18a.bin,0 8 | loadfile samd_bootprot_8k.mot 9 | r 10 | g 11 | exit 12 | -------------------------------------------------------------------------------- /SAMD21E_DevBoard/bootloader/jlink.cfg: -------------------------------------------------------------------------------- 1 | interface jlink 2 | transport select swd 3 | set CHIPNAME at91samd21e18a 4 | source [find target/at91samdXX.cfg] 5 | 6 | init 7 | targets 8 | reset halt 9 | at91samd bootloader 0 10 | reset 11 | program sam_uf2_samd21e18a.bin verify 12 | at91samd bootloader 8192 13 | reset 14 | shutdown 15 | -------------------------------------------------------------------------------- /SAMD21E_DevBoard/bootloader/readme.txt: -------------------------------------------------------------------------------- 1 | Installing bootloader using CMSIS-DAP device 2 | ============================================ 3 | run the following command: 4 | openocd -f cmsis-dap.cfg 5 | 6 | 7 | Installing bootloader using SEGGER J-Link 8 | ============================================ 9 | run the following command (openocd): 10 | openocd -f jlink.cfg 11 | 12 | or (jlink commander): 13 | JLinkExe -commanderscript flash.jlink 14 | 15 | 16 | More information and source code 17 | ============================================ 18 | You have to modify the scripts if you are using 19 | a differnet MCU than the SAM21E18A !! 20 | 21 | - https://github.com/mattairtech/ArduinoCore-samd 22 | - https://github.com/wagiminator 23 | - http://openocd.org/ 24 | - http://www.segger.com/download-jlink.html 25 | -------------------------------------------------------------------------------- /SAMD21E_DevBoard/bootloader/sam_ba_samd21e15a.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SAMD21E_DevBoard/bootloader/sam_ba_samd21e15a.bin -------------------------------------------------------------------------------- /SAMD21E_DevBoard/bootloader/sam_ba_samd21e15b.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SAMD21E_DevBoard/bootloader/sam_ba_samd21e15b.bin -------------------------------------------------------------------------------- /SAMD21E_DevBoard/bootloader/sam_ba_samd21e16a.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SAMD21E_DevBoard/bootloader/sam_ba_samd21e16a.bin -------------------------------------------------------------------------------- /SAMD21E_DevBoard/bootloader/sam_ba_samd21e16b.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SAMD21E_DevBoard/bootloader/sam_ba_samd21e16b.bin -------------------------------------------------------------------------------- /SAMD21E_DevBoard/bootloader/sam_ba_samd21e17a.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SAMD21E_DevBoard/bootloader/sam_ba_samd21e17a.bin -------------------------------------------------------------------------------- /SAMD21E_DevBoard/bootloader/sam_ba_samd21e18a.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SAMD21E_DevBoard/bootloader/sam_ba_samd21e18a.bin -------------------------------------------------------------------------------- /SAMD21E_DevBoard/bootloader/sam_uf2_samd21e18a.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SAMD21E_DevBoard/bootloader/sam_uf2_samd21e18a.bin -------------------------------------------------------------------------------- /SAMD21E_DevBoard/bootloader/samd_bootprot_8k.mot: -------------------------------------------------------------------------------- 1 | S214804000FAC7E0D85DFCFFFFFFFFFFFFFFFFFFFF63 2 | S9030000FC 3 | -------------------------------------------------------------------------------- /SAMD21E_DevBoard/bootloader/samd_bootprot_clear.mot: -------------------------------------------------------------------------------- 1 | S214804000FFC7E0D85DFCFFFFFFFFFFFFFFFFFFFF5E 2 | S9030000FC 3 | -------------------------------------------------------------------------------- /SAMD21E_DevBoard/documentation/SAMD21E_DevBoard_pic1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SAMD21E_DevBoard/documentation/SAMD21E_DevBoard_pic1.jpg -------------------------------------------------------------------------------- /SAMD21E_DevBoard/documentation/SAMD21E_DevBoard_pic2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SAMD21E_DevBoard/documentation/SAMD21E_DevBoard_pic2.jpg -------------------------------------------------------------------------------- /SAMD21E_DevBoard/documentation/SAMD21E_DevBoard_pic3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SAMD21E_DevBoard/documentation/SAMD21E_DevBoard_pic3.jpg -------------------------------------------------------------------------------- /SAMD21E_DevBoard/documentation/SAMD21E_DevBoard_pinout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SAMD21E_DevBoard/documentation/SAMD21E_DevBoard_pinout.png -------------------------------------------------------------------------------- /SAMD21E_DevBoard/hardware/SAMD21E_DevBoard_BOM.tsv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SAMD21E_DevBoard/hardware/SAMD21E_DevBoard_BOM.tsv -------------------------------------------------------------------------------- /SAMD21E_DevBoard/hardware/SAMD21E_DevBoard_gerber.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SAMD21E_DevBoard/hardware/SAMD21E_DevBoard_gerber.zip -------------------------------------------------------------------------------- /SAMD21E_DevBoard/hardware/SAMD21E_DevBoard_schematic.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SAMD21E_DevBoard/hardware/SAMD21E_DevBoard_schematic.pdf -------------------------------------------------------------------------------- /SAMD_Programmer_Adapter/README.md: -------------------------------------------------------------------------------- 1 | # SAMD Programmer Adapter 2 | The SAMD Programmer Adapter makes it easy to flash SAMD microcontrollers in TQFP-32 or SOIC-14 packages prior to soldering. 3 | - EasyEDA Design Files: https://easyeda.com/wagiminator/swd-programmer-adapter 4 | 5 | ![SAMD_Programmer_Adapter.jpg](https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/main/SAMD_Programmer_Adapter/SAMD_Programmer_Adapter_pic2.jpg) 6 | -------------------------------------------------------------------------------- /SAMD_Programmer_Adapter/SAMD_Programmer_Adapter_BOM.tsv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SAMD_Programmer_Adapter/SAMD_Programmer_Adapter_BOM.tsv -------------------------------------------------------------------------------- /SAMD_Programmer_Adapter/SAMD_Programmer_Adapter_gerber.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SAMD_Programmer_Adapter/SAMD_Programmer_Adapter_gerber.zip -------------------------------------------------------------------------------- /SAMD_Programmer_Adapter/SAMD_Programmer_Adapter_pic1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SAMD_Programmer_Adapter/SAMD_Programmer_Adapter_pic1.jpg -------------------------------------------------------------------------------- /SAMD_Programmer_Adapter/SAMD_Programmer_Adapter_pic2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SAMD_Programmer_Adapter/SAMD_Programmer_Adapter_pic2.jpg -------------------------------------------------------------------------------- /SAMD_Programmer_Adapter/SAMD_Programmer_Adapter_schematic.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SAMD_Programmer_Adapter/SAMD_Programmer_Adapter_schematic.pdf -------------------------------------------------------------------------------- /SWD_Programmer_Stick/documentation/CMSIS-DAP.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SWD_Programmer_Stick/documentation/CMSIS-DAP.png -------------------------------------------------------------------------------- /SWD_Programmer_Stick/documentation/SWD_DAPLink.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SWD_Programmer_Stick/documentation/SWD_DAPLink.jpg -------------------------------------------------------------------------------- /SWD_Programmer_Stick/documentation/SWD_Programmer_Stick_pic1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SWD_Programmer_Stick/documentation/SWD_Programmer_Stick_pic1.jpg -------------------------------------------------------------------------------- /SWD_Programmer_Stick/documentation/SWD_Programmer_Stick_pic2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SWD_Programmer_Stick/documentation/SWD_Programmer_Stick_pic2.jpg -------------------------------------------------------------------------------- /SWD_Programmer_Stick/documentation/SWD_Programmer_Stick_pic3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SWD_Programmer_Stick/documentation/SWD_Programmer_Stick_pic3.jpg -------------------------------------------------------------------------------- /SWD_Programmer_Stick/documentation/SWD_Programmer_Stick_pic4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SWD_Programmer_Stick/documentation/SWD_Programmer_Stick_pic4.jpg -------------------------------------------------------------------------------- /SWD_Programmer_Stick/documentation/SWD_nanoDAP.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SWD_Programmer_Stick/documentation/SWD_nanoDAP.jpg -------------------------------------------------------------------------------- /SWD_Programmer_Stick/documentation/SWD_segger.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SWD_Programmer_Stick/documentation/SWD_segger.jpg -------------------------------------------------------------------------------- /SWD_Programmer_Stick/hardware/SWD_Programmer_Stick_BOM.tsv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SWD_Programmer_Stick/hardware/SWD_Programmer_Stick_BOM.tsv -------------------------------------------------------------------------------- /SWD_Programmer_Stick/hardware/SWD_Programmer_Stick_gerber.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SWD_Programmer_Stick/hardware/SWD_Programmer_Stick_gerber.zip -------------------------------------------------------------------------------- /SWD_Programmer_Stick/hardware/SWD_Programmer_Stick_schematic.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SWD_Programmer_Stick/hardware/SWD_Programmer_Stick_schematic.pdf -------------------------------------------------------------------------------- /SWD_Programmer_Stick/software/binaries/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016, Alex Taradov 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of free-dap nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /SWD_Programmer_Stick/software/binaries/cmsis-dap.cfg: -------------------------------------------------------------------------------- 1 | interface cmsis-dap 2 | transport select swd 3 | set CHIPNAME at91samd11c14a 4 | source [find target/at91samdXX.cfg] 5 | 6 | init 7 | targets 8 | reset halt 9 | at91samd bootloader 0 10 | reset 11 | program swd_programmer_stick.bin verify 12 | reset 13 | shutdown 14 | -------------------------------------------------------------------------------- /SWD_Programmer_Stick/software/binaries/flash.jlink: -------------------------------------------------------------------------------- 1 | device atsamd11c14 2 | if swd 3 | speed 4000 4 | loadfile samd_bootprot_clear.mot 5 | r 6 | loadbin swd_programmer_stick.bin,0 7 | verifybin swd_programmer_stick.bin,0 8 | r 9 | g 10 | exit 11 | -------------------------------------------------------------------------------- /SWD_Programmer_Stick/software/binaries/jlink.cfg: -------------------------------------------------------------------------------- 1 | interface jlink 2 | transport select swd 3 | set CHIPNAME at91samd11c14a 4 | source [find target/at91samdXX.cfg] 5 | 6 | init 7 | targets 8 | reset halt 9 | at91samd bootloader 0 10 | reset 11 | program swd_programmer_stick.bin verify 12 | reset 13 | shutdown 14 | -------------------------------------------------------------------------------- /SWD_Programmer_Stick/software/binaries/readme.txt: -------------------------------------------------------------------------------- 1 | Uploading firmware using CMSIS-DAP device 2 | ========================================= 3 | run the following command: 4 | openocd -f cmsis-dap.cfg 5 | 6 | 7 | Uploading firmware using SEGGER J-Link 8 | ========================================= 9 | run the following command (openocd): 10 | openocd -f jlink.cfg 11 | 12 | or (jlink commander): 13 | JLinkExe -commanderscript flash.jlink 14 | 15 | 16 | More information and source code 17 | ========================================= 18 | - https://github.com/ataradov/free-dap 19 | - https://github.com/wagiminator 20 | - http://openocd.org/ 21 | - http://www.segger.com/download-jlink.html 22 | -------------------------------------------------------------------------------- /SWD_Programmer_Stick/software/binaries/samd_bootprot_clear.mot: -------------------------------------------------------------------------------- 1 | S214804000FFC7E0D85DFCFFFFFFFFFFFFFFFFFFFF5E 2 | S9030000FC 3 | -------------------------------------------------------------------------------- /SWD_Programmer_Stick/software/binaries/swd_programmer_stick.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/SWD_Programmer_Stick/software/binaries/swd_programmer_stick.bin -------------------------------------------------------------------------------- /SWD_Programmer_Stick/software/sources/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016, Alex Taradov 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of free-dap nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /SWD_Programmer_Stick/software/sources/Makefile: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | BUILD = build 3 | BIN = swd_programmer_stick 4 | 5 | ############################################################################## 6 | .PHONY: all directory clean size 7 | 8 | CC = arm-none-eabi-gcc 9 | OBJCOPY = arm-none-eabi-objcopy 10 | SIZE = arm-none-eabi-size 11 | 12 | ifeq ($(OS), Windows_NT) 13 | MKDIR = gmkdir 14 | else 15 | MKDIR = mkdir 16 | endif 17 | 18 | CFLAGS += -W -Wall --std=gnu99 -Os 19 | CFLAGS += -fno-diagnostics-show-caret 20 | CFLAGS += -fdata-sections -ffunction-sections 21 | CFLAGS += -funsigned-char -funsigned-bitfields 22 | CFLAGS += -mcpu=cortex-m0plus -mthumb 23 | CFLAGS += -MD -MP -MT $(BUILD)/$(*F).o -MF $(BUILD)/$(@F).d 24 | 25 | LDFLAGS += -mcpu=cortex-m0plus -mthumb 26 | LDFLAGS += -Wl,--gc-sections 27 | LDFLAGS += -Wl,--script=linker/samd11d14_std.ld 28 | 29 | INCLUDES += \ 30 | -I include \ 31 | 32 | SRCS += \ 33 | ./dap.c \ 34 | ./main.c \ 35 | ./udc.c \ 36 | ./usb.c \ 37 | ./usb_descriptors.c \ 38 | ./startup_samd11.c 39 | 40 | DEFINES += \ 41 | -D__SAMD11C14A__ \ 42 | -DDONT_USE_CMSIS_INIT \ 43 | -DF_CPU=48000000 44 | 45 | CFLAGS += $(INCLUDES) $(DEFINES) 46 | 47 | OBJS = $(addprefix $(BUILD)/, $(notdir %/$(subst .c,.o, $(SRCS)))) 48 | 49 | all: directory $(BUILD)/$(BIN).elf $(BUILD)/$(BIN).hex $(BUILD)/$(BIN).bin size 50 | 51 | $(BUILD)/$(BIN).elf: $(OBJS) 52 | @echo LD $@ 53 | @$(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o $@ 54 | 55 | $(BUILD)/$(BIN).hex: $(BUILD)/$(BIN).elf 56 | @echo OBJCOPY $@ 57 | @$(OBJCOPY) -O ihex $^ $@ 58 | 59 | $(BUILD)/$(BIN).bin: $(BUILD)/$(BIN).elf 60 | @echo OBJCOPY $@ 61 | @$(OBJCOPY) -O binary $^ $@ 62 | 63 | %.o: 64 | @echo CC $@ 65 | @$(CC) $(CFLAGS) $(filter %/$(subst .o,.c,$(notdir $@)), $(SRCS)) -c -o $@ 66 | 67 | directory: 68 | @$(MKDIR) -p $(BUILD) 69 | 70 | size: $(BUILD)/$(BIN).elf 71 | @echo size: 72 | @$(SIZE) -t $^ 73 | 74 | clean: 75 | @echo clean 76 | @-rm -rf $(BUILD) 77 | 78 | -include $(wildcard $(BUILD)/*.d) 79 | 80 | -------------------------------------------------------------------------------- /SWD_Programmer_Stick/software/sources/Makefile_bl: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | BUILD = build 3 | BIN = swd_programmer_stick_bl 4 | 5 | ############################################################################## 6 | .PHONY: all directory clean size 7 | 8 | CC = arm-none-eabi-gcc 9 | OBJCOPY = arm-none-eabi-objcopy 10 | SIZE = arm-none-eabi-size 11 | 12 | ifeq ($(OS), Windows_NT) 13 | MKDIR = gmkdir 14 | else 15 | MKDIR = mkdir 16 | endif 17 | 18 | CFLAGS += -W -Wall --std=gnu99 -Os 19 | CFLAGS += -fno-diagnostics-show-caret 20 | CFLAGS += -fdata-sections -ffunction-sections 21 | CFLAGS += -funsigned-char -funsigned-bitfields 22 | CFLAGS += -mcpu=cortex-m0plus -mthumb 23 | CFLAGS += -MD -MP -MT $(BUILD)/$(*F).o -MF $(BUILD)/$(@F).d 24 | 25 | LDFLAGS += -mcpu=cortex-m0plus -mthumb 26 | LDFLAGS += -Wl,--gc-sections 27 | LDFLAGS += -Wl,--script=linker/samd11d14_bl.ld 28 | 29 | INCLUDES += \ 30 | -I include \ 31 | 32 | SRCS += \ 33 | ./dap.c \ 34 | ./main.c \ 35 | ./udc.c \ 36 | ./usb.c \ 37 | ./usb_descriptors.c \ 38 | ./startup_samd11.c 39 | 40 | DEFINES += \ 41 | -D__SAMD11C14A__ \ 42 | -DDONT_USE_CMSIS_INIT \ 43 | -DF_CPU=48000000 44 | 45 | CFLAGS += $(INCLUDES) $(DEFINES) 46 | 47 | OBJS = $(addprefix $(BUILD)/, $(notdir %/$(subst .c,.o, $(SRCS)))) 48 | 49 | all: directory $(BUILD)/$(BIN).elf $(BUILD)/$(BIN).hex $(BUILD)/$(BIN).bin size 50 | 51 | $(BUILD)/$(BIN).elf: $(OBJS) 52 | @echo LD $@ 53 | @$(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o $@ 54 | 55 | $(BUILD)/$(BIN).hex: $(BUILD)/$(BIN).elf 56 | @echo OBJCOPY $@ 57 | @$(OBJCOPY) -O ihex $^ $@ 58 | 59 | $(BUILD)/$(BIN).bin: $(BUILD)/$(BIN).elf 60 | @echo OBJCOPY $@ 61 | @$(OBJCOPY) -O binary $^ $@ 62 | 63 | %.o: 64 | @echo CC $@ 65 | @$(CC) $(CFLAGS) $(filter %/$(subst .o,.c,$(notdir $@)), $(SRCS)) -c -o $@ 66 | 67 | directory: 68 | @$(MKDIR) -p $(BUILD) 69 | 70 | size: $(BUILD)/$(BIN).elf 71 | @echo size: 72 | @$(SIZE) -t $^ 73 | 74 | clean: 75 | @echo clean 76 | @-rm -rf $(BUILD) 77 | 78 | -include $(wildcard $(BUILD)/*.d) 79 | 80 | -------------------------------------------------------------------------------- /SWD_Programmer_Stick/software/sources/dap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Alex Taradov 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #ifndef _DAP_H_ 30 | #define _DAP_H_ 31 | 32 | /*- Includes ----------------------------------------------------------------*/ 33 | #include 34 | #include 35 | 36 | /*- Prototypes --------------------------------------------------------------*/ 37 | void dap_init(void); 38 | bool dap_filter_request(uint8_t *req); 39 | void dap_process_request(uint8_t *req, uint8_t *resp); 40 | void dap_clock_test(int delay); 41 | 42 | #endif // _DAP_H_ 43 | 44 | -------------------------------------------------------------------------------- /SWD_Programmer_Stick/software/sources/include/instance/pac0.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 4 | * \brief Instance description for PAC0 5 | * 6 | * Copyright (c) 2015 Atmel Corporation. All rights reserved. 7 | * 8 | * \asf_license_start 9 | * 10 | * \page License 11 | * 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions are met: 14 | * 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, 19 | * this list of conditions and the following disclaimer in the documentation 20 | * and/or other materials provided with the distribution. 21 | * 22 | * 3. The name of Atmel may not be used to endorse or promote products derived 23 | * from this software without specific prior written permission. 24 | * 25 | * 4. This software may only be redistributed and used in connection with an 26 | * Atmel microcontroller product. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 29 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 30 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 31 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 32 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 33 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 34 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 35 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 36 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * 40 | * \asf_license_stop 41 | * 42 | */ 43 | 44 | #ifndef _SAMD11_PAC0_INSTANCE_ 45 | #define _SAMD11_PAC0_INSTANCE_ 46 | 47 | /* ========== Register definition for PAC0 peripheral ========== */ 48 | #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) 49 | #define REG_PAC0_WPCLR (0x40000000U) /**< \brief (PAC0) Write Protection Clear */ 50 | #define REG_PAC0_WPSET (0x40000004U) /**< \brief (PAC0) Write Protection Set */ 51 | #else 52 | #define REG_PAC0_WPCLR (*(RwReg *)0x40000000U) /**< \brief (PAC0) Write Protection Clear */ 53 | #define REG_PAC0_WPSET (*(RwReg *)0x40000004U) /**< \brief (PAC0) Write Protection Set */ 54 | #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ 55 | 56 | /* ========== Instance parameters for PAC0 peripheral ========== */ 57 | #define PAC0_WPROT_DEFAULT_VAL 0x00000000 // PAC protection mask at reset 58 | 59 | #endif /* _SAMD11_PAC0_INSTANCE_ */ 60 | -------------------------------------------------------------------------------- /SWD_Programmer_Stick/software/sources/include/instance/pac1.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 4 | * \brief Instance description for PAC1 5 | * 6 | * Copyright (c) 2015 Atmel Corporation. All rights reserved. 7 | * 8 | * \asf_license_start 9 | * 10 | * \page License 11 | * 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions are met: 14 | * 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, 19 | * this list of conditions and the following disclaimer in the documentation 20 | * and/or other materials provided with the distribution. 21 | * 22 | * 3. The name of Atmel may not be used to endorse or promote products derived 23 | * from this software without specific prior written permission. 24 | * 25 | * 4. This software may only be redistributed and used in connection with an 26 | * Atmel microcontroller product. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 29 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 30 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 31 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 32 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 33 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 34 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 35 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 36 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * 40 | * \asf_license_stop 41 | * 42 | */ 43 | 44 | #ifndef _SAMD11_PAC1_INSTANCE_ 45 | #define _SAMD11_PAC1_INSTANCE_ 46 | 47 | /* ========== Register definition for PAC1 peripheral ========== */ 48 | #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) 49 | #define REG_PAC1_WPCLR (0x41000000U) /**< \brief (PAC1) Write Protection Clear */ 50 | #define REG_PAC1_WPSET (0x41000004U) /**< \brief (PAC1) Write Protection Set */ 51 | #else 52 | #define REG_PAC1_WPCLR (*(RwReg *)0x41000000U) /**< \brief (PAC1) Write Protection Clear */ 53 | #define REG_PAC1_WPSET (*(RwReg *)0x41000004U) /**< \brief (PAC1) Write Protection Set */ 54 | #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ 55 | 56 | /* ========== Instance parameters for PAC1 peripheral ========== */ 57 | #define PAC1_WPROT_DEFAULT_VAL 0x00000002 // PAC protection mask at reset 58 | 59 | #endif /* _SAMD11_PAC1_INSTANCE_ */ 60 | -------------------------------------------------------------------------------- /SWD_Programmer_Stick/software/sources/include/instance/pac2.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 4 | * \brief Instance description for PAC2 5 | * 6 | * Copyright (c) 2015 Atmel Corporation. All rights reserved. 7 | * 8 | * \asf_license_start 9 | * 10 | * \page License 11 | * 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions are met: 14 | * 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, 19 | * this list of conditions and the following disclaimer in the documentation 20 | * and/or other materials provided with the distribution. 21 | * 22 | * 3. The name of Atmel may not be used to endorse or promote products derived 23 | * from this software without specific prior written permission. 24 | * 25 | * 4. This software may only be redistributed and used in connection with an 26 | * Atmel microcontroller product. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 29 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 30 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 31 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 32 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 33 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 34 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 35 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 36 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * 40 | * \asf_license_stop 41 | * 42 | */ 43 | 44 | #ifndef _SAMD11_PAC2_INSTANCE_ 45 | #define _SAMD11_PAC2_INSTANCE_ 46 | 47 | /* ========== Register definition for PAC2 peripheral ========== */ 48 | #if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) 49 | #define REG_PAC2_WPCLR (0x42000000U) /**< \brief (PAC2) Write Protection Clear */ 50 | #define REG_PAC2_WPSET (0x42000004U) /**< \brief (PAC2) Write Protection Set */ 51 | #else 52 | #define REG_PAC2_WPCLR (*(RwReg *)0x42000000U) /**< \brief (PAC2) Write Protection Clear */ 53 | #define REG_PAC2_WPSET (*(RwReg *)0x42000004U) /**< \brief (PAC2) Write Protection Set */ 54 | #endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */ 55 | 56 | /* ========== Instance parameters for PAC2 peripheral ========== */ 57 | #define PAC2_WPROT_DEFAULT_VAL 0x00001000 // PAC protection mask at reset 58 | 59 | #endif /* _SAMD11_PAC2_INSTANCE_ */ 60 | -------------------------------------------------------------------------------- /SWD_Programmer_Stick/software/sources/include/samd11.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \file 3 | * 4 | * \brief Top header file for SAMD11 5 | * 6 | * Copyright (c) 2015 Atmel Corporation. All rights reserved. 7 | * 8 | * \asf_license_start 9 | * 10 | * \page License 11 | * 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions are met: 14 | * 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, 19 | * this list of conditions and the following disclaimer in the documentation 20 | * and/or other materials provided with the distribution. 21 | * 22 | * 3. The name of Atmel may not be used to endorse or promote products derived 23 | * from this software without specific prior written permission. 24 | * 25 | * 4. This software may only be redistributed and used in connection with an 26 | * Atmel microcontroller product. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 29 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 30 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 31 | * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 32 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 33 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 34 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 35 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 36 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * 40 | * \asf_license_stop 41 | * 42 | */ 43 | 44 | #ifndef _SAMD11_ 45 | #define _SAMD11_ 46 | 47 | /** 48 | * \defgroup SAMD11_definitions SAMD11 Device Definitions 49 | * \brief SAMD11 CMSIS Definitions. 50 | */ 51 | 52 | #if defined(__SAMD11C14A__) || defined(__ATSAMD11C14A__) 53 | #include "samd11c14a.h" 54 | #elif defined(__SAMD11D14AM__) || defined(__ATSAMD11D14AM__) 55 | #include "samd11d14am.h" 56 | #elif defined(__SAMD11D14AS__) || defined(__ATSAMD11D14AS__) 57 | #include "samd11d14as.h" 58 | #elif defined(__SAMD11D14AU__) || defined(__ATSAMD11D14AU__) 59 | #include "samd11d14au.h" 60 | #else 61 | #error Library does not support the specified device. 62 | #endif 63 | 64 | #endif /* _SAMD11_ */ 65 | -------------------------------------------------------------------------------- /SWD_Programmer_Stick/software/sources/linker/samd11d14_bl.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017, Alex Taradov 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | MEMORY 30 | { 31 | flash (rx) : ORIGIN = 0x00001000, LENGTH = 0x3000 32 | ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x1000 33 | } 34 | 35 | __top_flash = ORIGIN(flash) + LENGTH(flash); 36 | __top_ram = ORIGIN(ram) + LENGTH(ram); 37 | 38 | ENTRY(irq_handler_reset) 39 | 40 | SECTIONS 41 | { 42 | .text : ALIGN(4) 43 | { 44 | FILL(0xff) 45 | KEEP(*(.vectors)) 46 | *(.text*) 47 | *(.rodata) 48 | *(.rodata.*) 49 | . = ALIGN(4); 50 | } > flash 51 | 52 | . = ALIGN(4); 53 | _etext = .; 54 | 55 | .uninit_RESERVED : ALIGN(4) 56 | { 57 | KEEP(*(.bss.$RESERVED*)) 58 | } > ram 59 | 60 | .data : ALIGN(4) 61 | { 62 | FILL(0xff) 63 | _data = .; 64 | *(.ramfunc .ramfunc.*); 65 | *(vtable) 66 | *(.data*) 67 | . = ALIGN(4); 68 | _edata = .; 69 | } > ram AT > flash 70 | 71 | .bss : ALIGN(4) 72 | { 73 | _bss = .; 74 | *(.bss*) 75 | *(COMMON) 76 | . = ALIGN(4); 77 | _ebss = .; 78 | PROVIDE(_end = .); 79 | } > ram 80 | 81 | PROVIDE(_stack_top = __top_ram - 0); 82 | } 83 | -------------------------------------------------------------------------------- /SWD_Programmer_Stick/software/sources/linker/samd11d14_std.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2017, Alex Taradov 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | MEMORY 30 | { 31 | flash (rx) : ORIGIN = 0x00000000, LENGTH = 0x4000 /* 16k */ 32 | ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x1000 /* 4k */ 33 | } 34 | 35 | __top_flash = ORIGIN(flash) + LENGTH(flash); 36 | __top_ram = ORIGIN(ram) + LENGTH(ram); 37 | 38 | ENTRY(irq_handler_reset) 39 | 40 | SECTIONS 41 | { 42 | .text : ALIGN(4) 43 | { 44 | FILL(0xff) 45 | KEEP(*(.vectors)) 46 | *(.text*) 47 | *(.rodata) 48 | *(.rodata.*) 49 | . = ALIGN(4); 50 | } > flash 51 | 52 | . = ALIGN(4); 53 | _etext = .; 54 | 55 | .uninit_RESERVED : ALIGN(4) 56 | { 57 | KEEP(*(.bss.$RESERVED*)) 58 | } > ram 59 | 60 | .data : ALIGN(4) 61 | { 62 | FILL(0xff) 63 | _data = .; 64 | *(.ramfunc .ramfunc.*); 65 | *(vtable) 66 | *(.data*) 67 | . = ALIGN(4); 68 | _edata = .; 69 | } > ram AT > flash 70 | 71 | .bss : ALIGN(4) 72 | { 73 | _bss = .; 74 | *(.bss*) 75 | *(COMMON) 76 | . = ALIGN(4); 77 | _ebss = .; 78 | PROVIDE(_end = .); 79 | } > ram 80 | 81 | PROVIDE(_stack_top = __top_ram - 0); 82 | } 83 | -------------------------------------------------------------------------------- /SWD_Programmer_Stick/software/sources/nvm_data.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Alex Taradov 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #ifndef _NVM_DATA_H_ 30 | #define _NVM_DATA_H_ 31 | 32 | /*- Definitions -------------------------------------------------------------*/ 33 | #define NVM_ADC_LINEARITY_POS 27 34 | #define NVM_ADC_LINEARITY_SIZE 8 35 | 36 | #define NVM_ADC_BIASCAL_POS 35 37 | #define NVM_ADC_BIASCAL_SIZE 3 38 | 39 | #define NVM_OSC32K_CAL_POS 38 40 | #define NVM_OSC32K_CAL_SIZE 7 41 | 42 | #define NVM_USB_TRANSN_POS 45 43 | #define NVM_USB_TRANSN_SIZE 5 44 | 45 | #define NVM_USB_TRANSP_POS 50 46 | #define NVM_USB_TRANSP_SIZE 5 47 | 48 | #define NVM_USB_TRIM_POS 55 49 | #define NVM_USB_TRIM_SIZE 3 50 | 51 | #define NVM_DFLL48M_COARSE_CAL_POS 58 52 | #define NVM_DFLL48M_COARSE_CAL_SIZE 6 53 | 54 | #define NVM_DFLL48M_FINE_CAL_POS 64 55 | #define NVM_DFLL48M_FINE_CAL_SIZE 10 56 | 57 | #define NVM_READ_CAL(cal) \ 58 | ((*((uint32_t *)NVMCTRL_OTP4 + cal##_POS / 32)) >> (cal##_POS % 32)) & ((1 << cal##_SIZE) - 1) 59 | 60 | #endif // _NVM_DATA_H_ 61 | 62 | -------------------------------------------------------------------------------- /SWD_Programmer_Stick/software/sources/udc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Alex Taradov 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #ifndef _UDC_H_ 30 | #define _UDC_H_ 31 | 32 | /*- Includes ----------------------------------------------------------------*/ 33 | #include 34 | #include 35 | #include "usb.h" 36 | 37 | /*- Definitions -------------------------------------------------------------*/ 38 | #define UDC_EPT_NUM 8 39 | 40 | /*- Prototypes --------------------------------------------------------------*/ 41 | void udc_init(void); 42 | void udc_attach(void); 43 | void udc_detach(void); 44 | void udc_reset_endpoint(int ep, int dir); 45 | void udc_configure_endpoint(usb_endpoint_descriptor_t *ep_desc); 46 | bool udc_endpoint_configured(int ep, int dir); 47 | int udc_endpoint_get_status(int ep, int dir); 48 | void udc_endpoint_set_feature(int ep, int dir); 49 | void udc_endpoint_clear_feature(int ep, int dir); 50 | void udc_set_address(int address); 51 | void udc_send(int ep, uint8_t *data, int size); 52 | void udc_recv(int ep, uint8_t *data, int size); 53 | void udc_control_send_zlp(void); 54 | void udc_control_stall(void); 55 | void udc_control_send(uint8_t *data, int size); 56 | 57 | void udc_send_callback(int ep); 58 | void udc_recv_callback(int ep); 59 | 60 | #endif // _UDC_H_ 61 | 62 | -------------------------------------------------------------------------------- /SWD_Programmer_Stick/software/sources/utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Alex Taradov 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, 9 | * this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. The name of the author may not be used to endorse or promote products 14 | * derived from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #ifndef _UTILS_H_ 30 | #define _UTILS_H_ 31 | 32 | /*- Definitions -------------------------------------------------------------*/ 33 | #define PACK __attribute__((packed)) 34 | 35 | #define INLINE static inline __attribute__((always_inline)) 36 | 37 | #define LIMIT(a, b) (((a) > (b)) ? (b) : (a)) 38 | 39 | #endif // _UTILS_H_ 40 | 41 | -------------------------------------------------------------------------------- /packages/CMSIS-Atmel-3.49.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/packages/CMSIS-Atmel-3.49.1.tar.gz -------------------------------------------------------------------------------- /packages/SAMD_DevBoards_0.1.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/packages/SAMD_DevBoards_0.1.0.tar.gz -------------------------------------------------------------------------------- /packages/SAMD_DevBoards_0.2.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/packages/SAMD_DevBoards_0.2.0.tar.gz -------------------------------------------------------------------------------- /packages/bossac-1.7.0-mattairtech-3-i686-linux-gnu.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/packages/bossac-1.7.0-mattairtech-3-i686-linux-gnu.tar.gz -------------------------------------------------------------------------------- /packages/bossac-1.7.0-mattairtech-3-mingw32.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/packages/bossac-1.7.0-mattairtech-3-mingw32.tar.gz -------------------------------------------------------------------------------- /packages/bossac-1.7.0-mattairtech-3-x86_64-apple-darwin.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/packages/bossac-1.7.0-mattairtech-3-x86_64-apple-darwin.tar.gz -------------------------------------------------------------------------------- /packages/bossac-1.7.0-mattairtech-3-x86_64-linux-gnu.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wagiminator/SAMD-Development-Boards/24070dfbee96df97319ff0a4cc7571a4117766d5/packages/bossac-1.7.0-mattairtech-3-x86_64-linux-gnu.tar.gz --------------------------------------------------------------------------------