From 6c4dc84e384cf852933f6922742b3d1be09a9e1d Mon Sep 17 00:00:00 2001 From: Khoi Hoang <57012152+khoih-prog@users.noreply.github.com> Date: Wed, 26 Oct 2022 19:23:37 -0400 Subject: [PATCH] Update `Packages_Patches` --- .../hardware/samd/1.7.0/boards.txt | 1730 +++++++++++++++++ .../k210/0.3.10/cores/arduino/Stream.h | 293 +-- .../k210/0.3.11/cores/arduino/Stream.h | 293 +-- .../hardware/nrf52/1.0.0/cores/nRF5/Print.cpp | 466 +++++ .../hardware/nrf52/1.0.0/cores/nRF5/Print.h | 123 ++ .../hardware/nrf52/1.0.0/cores/nRF5/Udp.h | 99 + .../hardware/nrf52/1.0.0/platform.txt | 163 ++ .../1.9.3/variants/rpipico/pins_arduino.h | 2 +- .../variants/Seeed_XIAO_RP2040/pins_arduino.h | 36 +- .../Seeeduino/hardware/samd/1.7.0/boards.txt | 1730 +++++++++++++++++ .../samd/1.7.7/cores/arduino/Arduino.h | 60 +- .../samd/1.7.7/cores/arduino/Print.cpp | 474 +++-- .../hardware/samd/1.7.7/cores/arduino/Print.h | 159 +- .../samd/1.7.8/cores/arduino/Arduino.h | 60 +- .../samd/1.7.8/cores/arduino/Print.cpp | 474 +++-- .../hardware/samd/1.7.8/cores/arduino/Print.h | 159 +- .../samd/1.7.9/cores/arduino/Arduino.h | 60 +- .../samd/1.7.9/cores/arduino/Print.cpp | 474 +++-- .../hardware/samd/1.7.9/cores/arduino/Print.h | 159 +- .../samd/1.8.1/cores/arduino/Arduino.h | 60 +- .../samd/1.8.1/cores/arduino/Print.cpp | 474 +++-- .../hardware/samd/1.8.1/cores/arduino/Print.h | 158 +- .../samd/1.8.2/cores/arduino/Arduino.h | 60 +- .../samd/1.8.2/cores/arduino/Print.cpp | 474 +++-- .../hardware/samd/1.8.2/cores/arduino/Print.h | 158 +- .../samd/1.8.3/cores/arduino/Arduino.h | 181 ++ .../samd/1.8.3/cores/arduino/Print.cpp | 466 +++++ .../hardware/samd/1.8.3/cores/arduino/Print.h | 124 ++ .../hardware/samd/1.8.3/platform.txt | 204 ++ .../lwipstack/include/lwipstack/lwipopts.h | 214 +- .../libraries/SocketWrapper/src/MbedUdp.cpp | 384 ++-- .../libraries/SocketWrapper/src/MbedUdp.h | 145 +- .../lwipstack/include/lwipstack/lwipopts.h | 214 +- .../libraries/SocketWrapper/src/MbedUdp.cpp | 384 ++-- .../libraries/SocketWrapper/src/MbedUdp.h | 145 +- .../lwipstack/include/lwipstack/lwipopts.h | 214 +- .../libraries/SocketWrapper/src/MbedUdp.cpp | 384 ++-- .../libraries/SocketWrapper/src/MbedUdp.h | 145 +- .../lwipstack/include/lwipstack/lwipopts.h | 214 +- .../lwipstack/include/lwipstack/lwipopts.h | 214 +- .../lwipstack/include/lwipstack/lwipopts.h | 214 +- .../lwipstack/include/lwipstack/lwipopts.h | 214 +- .../lwipstack/include/lwipstack/lwipopts.h | 214 +- .../3.3.0/portenta_post_install.sh | 22 + .../3.4.1/portenta_post_install.sh | 22 + .../samd/1.8.6/cores/arduino/Arduino.h | 72 +- .../samd/1.8.7/cores/arduino/Arduino.h | 72 +- .../hardware/samd/1.8.8/cores/Arduino.h | 72 +- .../samd/1.8.8/cores/arduino/Arduino.h | 72 +- .../samd/1.8.9/cores/arduino/Arduino.h | 72 +- .../teensy/avr/cores/teensy/Stream.cpp | 528 +++-- .../hardware/teensy/avr/cores/teensy/Stream.h | 236 +-- .../teensy/avr/cores/teensy3/Stream.cpp | 528 +++-- .../teensy/avr/cores/teensy3/Stream.h | 236 +-- .../teensy/avr/cores/teensy4/Stream.cpp | 528 +++-- .../teensy/avr/cores/teensy4/Stream.h | 236 +-- .../avr/1.1.36/cores/industrialshields/Udp.h | 155 +- .../avr/1.1.37/cores/industrialshields/Udp.h | 155 +- .../3.0.10/cores/arduino/avr/pgmspace.h | 244 +-- .../AmebaD/3.0.8/cores/arduino/avr/pgmspace.h | 244 +-- .../AmebaD/3.1.0/cores/arduino/avr/pgmspace.h | 244 +-- .../AmebaD/3.1.1/cores/arduino/avr/pgmspace.h | 244 +-- .../AmebaD/3.1.2/cores/arduino/avr/pgmspace.h | 244 +-- .../AmebaD/3.1.3/cores/ambd/avr/pgmspace.h | 244 +-- .../AmebaD/3.1.4/cores/ambd/avr/pgmspace.h | 122 ++ .../rp2040/1.3.1/cores/rp2040/Arduino.h | 43 +- .../rp2040/1.4.0/cores/rp2040/Arduino.h | 43 +- 67 files changed, 11683 insertions(+), 5667 deletions(-) create mode 100644 Packages_Patches/Fab_SAM_Arduino/hardware/samd/1.7.0/boards.txt create mode 100644 Packages_Patches/Seeeduino/hardware/nrf52/1.0.0/cores/nRF5/Print.cpp create mode 100644 Packages_Patches/Seeeduino/hardware/nrf52/1.0.0/cores/nRF5/Print.h create mode 100644 Packages_Patches/Seeeduino/hardware/nrf52/1.0.0/cores/nRF5/Udp.h create mode 100644 Packages_Patches/Seeeduino/hardware/nrf52/1.0.0/platform.txt create mode 100644 Packages_Patches/Seeeduino/hardware/samd/1.7.0/boards.txt create mode 100644 Packages_Patches/Seeeduino/hardware/samd/1.8.3/cores/arduino/Arduino.h create mode 100644 Packages_Patches/Seeeduino/hardware/samd/1.8.3/cores/arduino/Print.cpp create mode 100644 Packages_Patches/Seeeduino/hardware/samd/1.8.3/cores/arduino/Print.h create mode 100644 Packages_Patches/Seeeduino/hardware/samd/1.8.3/platform.txt create mode 100644 Packages_Patches/arduino/hardware/mbed_portenta/3.3.0/portenta_post_install.sh create mode 100644 Packages_Patches/arduino/hardware/mbed_portenta/3.4.1/portenta_post_install.sh create mode 100644 Packages_Patches/realtek/hardware/AmebaD/3.1.4/cores/ambd/avr/pgmspace.h diff --git a/Packages_Patches/Fab_SAM_Arduino/hardware/samd/1.7.0/boards.txt b/Packages_Patches/Fab_SAM_Arduino/hardware/samd/1.7.0/boards.txt new file mode 100644 index 00000000..ec3f9ff3 --- /dev/null +++ b/Packages_Patches/Fab_SAM_Arduino/hardware/samd/1.7.0/boards.txt @@ -0,0 +1,1730 @@ +# Copyright (c) 2014-2017 Arduino LLC. All right reserved. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +menu.cpu=Microcontroller +menu.clock=Clock Source +menu.usb=USB Config +menu.serial=Serial Config +menu.bootloader=Bootloader Size +menu.timer=Timer PWM Frequency +menu.float=Floating Point +menu.config=Build Options + +# Generic D11C14A +d11c14a.name=Generic D11C14A +d11c14a.vid.0=0x16D0 +d11c14a.pid.0=0x1557 +d11c14a.vid.1=0x16D0 +d11c14a.pid.1=0x1856 +d11c14a.vid.2=0x16D0 +d11c14a.pid.2=0x1B41 +d11c14a.vid.3=0x16D0 +d11c14a.pid.3=0x1B40 +d11c14a.vid.4=0x16D0 +d11c14a.pid.4=0x1A0C +d11c14a.vid.5=0x16D0 +d11c14a.pid.5=0x1856 +d11c14a.build.mcu=cortex-m0plus +d11c14a.build.mathlib=arm_cortexM0l_math +d11c14a.build.f_cpu=48000000L +d11c14a.build.usb_product="D11C14A" +d11c14a.build.usb_manufacturer="Fab Foundation" +d11c14a.build.board=SAMD_ZERO +d11c14a.build.core=arduino +d11c14a.build.variant=Generic_D11C14A +d11c14a.build.variant_system_lib= +d11c14a.build.vid=0x16D0 +d11c14a.upload.protocol=sam-ba +d11c14a.bootloader.tool=openocd +d11c14a.menu.float.default=Print & String use auto-promoted doubles only +d11c14a.menu.float.default.build.floatconfig=FLOAT_BOTH_DOUBLES_ONLY +d11c14a.menu.float.print=Print uses separate singles and doubles +d11c14a.menu.float.print.build.floatconfig=FLOAT_PRINT_SINGLES_DOUBLES +d11c14a.menu.float.string=String uses separate singles and doubles +d11c14a.menu.float.string.build.floatconfig=FLOAT_STRING_SINGLES_DOUBLES +d11c14a.menu.float.both=Print & String use separate singles and doubles +d11c14a.menu.float.both.build.floatconfig=FLOAT_BOTH_SINGLES_DOUBLES +d11c14a.menu.config.disabled=config.h disabled +d11c14a.menu.config.disabled.build.buildconfig=CONFIG_H_DISABLED +d11c14a.menu.config.enabled=config.h enabled (mostly code size reductions) +d11c14a.menu.config.enabled.build.buildconfig=CONFIG_H_ENABLED +d11c14a.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED_OSCILLATOR +d11c14a.menu.clock.internal_usb.build.clockconfig=CLOCKCONFIG_INTERNAL_USB +d11c14a.menu.clock.internal=INTERNAL_OSCILLATOR +d11c14a.menu.clock.internal.build.clockconfig=CLOCKCONFIG_INTERNAL +d11c14a.menu.clock.crystal_32k=32KHZ_CRYSTAL +d11c14a.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32768HZ_CRYSTAL +d11c14a.menu.clock.crystal_hs=HIGH_SPEED_CRYSTAL +d11c14a.menu.clock.crystal_hs.build.clockconfig=CLOCKCONFIG_HS_CRYSTAL +d11c14a.menu.timer.timer_732Hz=732.4Hz (16-bit) +d11c14a.menu.timer.timer_732Hz.build.timerconfig=TIMER_732Hz +d11c14a.menu.timer.timer_366Hz=366.2Hz (16-bit) +d11c14a.menu.timer.timer_366Hz.build.timerconfig=TIMER_366Hz +d11c14a.menu.timer.timer_244Hz=244.1Hz (16-bit) +d11c14a.menu.timer.timer_244Hz.build.timerconfig=TIMER_244Hz +d11c14a.menu.timer.timer_183Hz=183.1Hz (16-bit) +d11c14a.menu.timer.timer_183Hz.build.timerconfig=TIMER_183Hz +d11c14a.menu.timer.timer_146Hz=146.5Hz (16-bit) +d11c14a.menu.timer.timer_146Hz.build.timerconfig=TIMER_146Hz +d11c14a.menu.timer.timer_122Hz=122.1Hz (16-bit) +d11c14a.menu.timer.timer_122Hz.build.timerconfig=TIMER_122Hz +d11c14a.menu.timer.timer_105Hz=104.6Hz (16-bit) +d11c14a.menu.timer.timer_105Hz.build.timerconfig=TIMER_105Hz +d11c14a.menu.timer.timer_81Hz=81.38Hz (16-bit) +d11c14a.menu.timer.timer_81Hz.build.timerconfig=TIMER_81Hz +d11c14a.menu.timer.timer_61Hz=61.04Hz (16-bit) +d11c14a.menu.timer.timer_61Hz.build.timerconfig=TIMER_61Hz +d11c14a.menu.timer.timer_31Hz=30.52Hz (16-bit) +d11c14a.menu.timer.timer_31Hz.build.timerconfig=TIMER_31Hz +d11c14a.menu.timer.timer_187500Hz=187500Hz (8-bit) +d11c14a.menu.timer.timer_187500Hz.build.timerconfig=TIMER_187500Hz +d11c14a.menu.timer.timer_93750Hz=93750Hz (8-bit) +d11c14a.menu.timer.timer_93750Hz.build.timerconfig=TIMER_93750Hz +d11c14a.menu.timer.timer_62500Hz=62500Hz (8-bit) +d11c14a.menu.timer.timer_62500Hz.build.timerconfig=TIMER_62500Hz +d11c14a.menu.timer.timer_37500Hz=37500Hz (8-bit) +d11c14a.menu.timer.timer_37500Hz.build.timerconfig=TIMER_37500Hz +d11c14a.menu.timer.timer_20833Hz=20833Hz (8-bit) +d11c14a.menu.timer.timer_20833Hz.build.timerconfig=TIMER_20833Hz +d11c14a.menu.timer.timer_12500Hz=12500Hz (8-bit) +d11c14a.menu.timer.timer_12500Hz.build.timerconfig=TIMER_12500Hz +d11c14a.menu.timer.timer_7500Hz=7500Hz (8-bit) +d11c14a.menu.timer.timer_7500Hz.build.timerconfig=TIMER_7500Hz +d11c14a.menu.timer.timer_4166Hz=4166Hz (8-bit) +d11c14a.menu.timer.timer_4166Hz.build.timerconfig=TIMER_4166Hz +d11c14a.menu.timer.timer_2930Hz=2930Hz (8-bit) +d11c14a.menu.timer.timer_2930Hz.build.timerconfig=TIMER_2930Hz +d11c14a.menu.timer.timer_1465Hz=1465Hz (8-bit) +d11c14a.menu.timer.timer_1465Hz.build.timerconfig=TIMER_1465Hz +d11c14a.build.extra_flags=-D__SAMD11C14A__ {build.usb_flags} -DARM_MATH_CM0PLUS +d11c14a.build.ldscript=flash_16KB.ld +d11c14a.build.openocdscript=openocd_scripts/SAMD11C14A.cfg +d11c14a.bootloader.file=zero/binaries/sam_ba_SAMD11C14A.bin +d11c14a.menu.bootloader.4kb=4KB_BOOTLOADER +d11c14a.menu.bootloader.4kb.build.bootloader_size=__4KB_BOOTLOADER__ +d11c14a.menu.bootloader.4kb.build.ldscript_path=linker_scripts/gcc/4KB_Bootloader +d11c14a.menu.bootloader.4kb.upload.tool=Fab_SAM_Arduino:bossac +d11c14a.menu.bootloader.4kb.upload.use_1200bps_touch=true +d11c14a.menu.bootloader.4kb.upload.wait_for_upload_port=true +d11c14a.menu.bootloader.4kb.upload.native_usb=true +d11c14a.menu.bootloader.4kb.upload.maximum_size=12288 +d11c14a.menu.bootloader.0kb=NO_BOOTLOADER +d11c14a.menu.bootloader.0kb.build.bootloader_size=__NO_BOOTLOADER__ +d11c14a.menu.bootloader.0kb.build.ldscript_path=linker_scripts/gcc/No_Bootloader +d11c14a.menu.bootloader.0kb.upload.tool=openocd +d11c14a.menu.bootloader.0kb.upload.use_1200bps_touch=false +d11c14a.menu.bootloader.0kb.upload.wait_for_upload_port=false +d11c14a.menu.bootloader.0kb.upload.native_usb=false +d11c14a.menu.bootloader.0kb.upload.maximum_size=16384 +d11c14a.menu.serial.one_uart=ONE_UART_ONE_WIRE_NO_SPI +d11c14a.menu.serial.one_uart.build.serialcom_uart=ONE_UART +d11c14a.menu.serial.one_uart.build.serialcom_wire=ONE_WIRE +d11c14a.menu.serial.one_uart.build.serialcom_spi=NO_SPI +d11c14a.menu.serial.two_uart=TWO_UART_NO_WIRE_NO_SPI +d11c14a.menu.serial.two_uart.build.serialcom_uart=TWO_UART +d11c14a.menu.serial.two_uart.build.serialcom_wire=NO_WIRE +d11c14a.menu.serial.two_uart.build.serialcom_spi=NO_SPI +d11c14a.menu.serial.one_uart_no_wire_one_spi=ONE_UART_NO_WIRE_ONE_SPI +d11c14a.menu.serial.one_uart_no_wire_one_spi.build.serialcom_uart=ONE_UART +d11c14a.menu.serial.one_uart_no_wire_one_spi.build.serialcom_wire=NO_WIRE +d11c14a.menu.serial.one_uart_no_wire_one_spi.build.serialcom_spi=ONE_SPI +d11c14a.menu.serial.no_uart=NO_UART_ONE_WIRE_ONE_SPI +d11c14a.menu.serial.no_uart.build.serialcom_uart=NO_UART +d11c14a.menu.serial.no_uart.build.serialcom_wire=ONE_WIRE +d11c14a.menu.serial.no_uart.build.serialcom_spi=ONE_SPI +d11c14a.menu.usb.cdc=CDC_ONLY +d11c14a.menu.usb.cdc.build.usbcom=CDC_ONLY +d11c14a.menu.usb.cdc.build.pid=0x1557 +d11c14a.menu.usb.cdc_hid=CDC_HID +d11c14a.menu.usb.cdc_hid.build.usbcom=CDC_HID +d11c14a.menu.usb.cdc_hid.build.pid=0x1856 +d11c14a.menu.usb.withcdc=WITH_CDC +d11c14a.menu.usb.withcdc.build.usbcom=WITH_CDC +d11c14a.menu.usb.withcdc.build.pid=0x1B41 +d11c14a.menu.usb.hid=HID_ONLY +d11c14a.menu.usb.hid.build.usbcom=HID_ONLY +d11c14a.menu.usb.hid.build.pid=0x1B40 +d11c14a.menu.usb.nocdc=WITHOUT_CDC +d11c14a.menu.usb.nocdc.build.usbcom=WITHOUT_CDC +d11c14a.menu.usb.nocdc.build.pid=0x1A0C +d11c14a.menu.usb.none=USB_DISABLED +d11c14a.menu.usb.none.build.usbcom=USB_DISABLED +d11c14a.menu.usb.none.build.pid=0x1856 + +# Generic D11D14AS +d11d14as.name=Generic D11D14AS +d11d14as.vid.0=0x16D0 +d11d14as.pid.0=0x2557 +d11d14as.vid.1=0x16D0 +d11d14as.pid.1=0x2856 +d11d14as.vid.2=0x16D0 +d11d14as.pid.2=0x2B41 +d11d14as.vid.3=0x16D0 +d11d14as.pid.3=0x2B40 +d11d14as.vid.4=0x16D0 +d11d14as.pid.4=0x2A0C +d11d14as.vid.5=0x16D0 +d11d14as.pid.5=0x2856 +d11d14as.build.mcu=cortex-m0plus +d11d14as.build.mathlib=arm_cortexM0l_math +d11d14as.build.f_cpu=48000000L +d11d14as.build.usb_product="D11D14AS" +d11d14as.build.usb_manufacturer="Fab Foundation" +d11d14as.build.board=SAMD_ZERO +d11d14as.build.core=arduino +d11d14as.build.variant=Generic_D11D14AS +d11d14as.build.variant_system_lib= +d11d14as.build.vid=0x16D0 +d11d14as.upload.protocol=sam-ba +d11d14as.bootloader.tool=openocd +d11d14as.menu.float.default=Print & String use auto-promoted doubles only +d11d14as.menu.float.default.build.floatconfig=FLOAT_BOTH_DOUBLES_ONLY +d11d14as.menu.float.print=Print uses separate singles and doubles +d11d14as.menu.float.print.build.floatconfig=FLOAT_PRINT_SINGLES_DOUBLES +d11d14as.menu.float.string=String uses separate singles and doubles +d11d14as.menu.float.string.build.floatconfig=FLOAT_STRING_SINGLES_DOUBLES +d11d14as.menu.float.both=Print & String use separate singles and doubles +d11d14as.menu.float.both.build.floatconfig=FLOAT_BOTH_SINGLES_DOUBLES +d11d14as.menu.config.disabled=config.h disabled +d11d14as.menu.config.disabled.build.buildconfig=CONFIG_H_DISABLED +d11d14as.menu.config.enabled=config.h enabled (mostly code size reductions) +d11d14as.menu.config.enabled.build.buildconfig=CONFIG_H_ENABLED +d11d14as.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED_OSCILLATOR +d11d14as.menu.clock.internal_usb.build.clockconfig=CLOCKCONFIG_INTERNAL_USB +d11d14as.menu.clock.internal=INTERNAL_OSCILLATOR +d11d14as.menu.clock.internal.build.clockconfig=CLOCKCONFIG_INTERNAL +d11d14as.menu.clock.crystal_32k=32KHZ_CRYSTAL +d11d14as.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32768HZ_CRYSTAL +d11d14as.menu.clock.crystal_hs=HIGH_SPEED_CRYSTAL +d11d14as.menu.clock.crystal_hs.build.clockconfig=CLOCKCONFIG_HS_CRYSTAL +d11d14as.menu.timer.timer_732Hz=732.4Hz (16-bit) +d11d14as.menu.timer.timer_732Hz.build.timerconfig=TIMER_732Hz +d11d14as.menu.timer.timer_366Hz=366.2Hz (16-bit) +d11d14as.menu.timer.timer_366Hz.build.timerconfig=TIMER_366Hz +d11d14as.menu.timer.timer_244Hz=244.1Hz (16-bit) +d11d14as.menu.timer.timer_244Hz.build.timerconfig=TIMER_244Hz +d11d14as.menu.timer.timer_183Hz=183.1Hz (16-bit) +d11d14as.menu.timer.timer_183Hz.build.timerconfig=TIMER_183Hz +d11d14as.menu.timer.timer_146Hz=146.5Hz (16-bit) +d11d14as.menu.timer.timer_146Hz.build.timerconfig=TIMER_146Hz +d11d14as.menu.timer.timer_122Hz=122.1Hz (16-bit) +d11d14as.menu.timer.timer_122Hz.build.timerconfig=TIMER_122Hz +d11d14as.menu.timer.timer_105Hz=104.6Hz (16-bit) +d11d14as.menu.timer.timer_105Hz.build.timerconfig=TIMER_105Hz +d11d14as.menu.timer.timer_81Hz=81.38Hz (16-bit) +d11d14as.menu.timer.timer_81Hz.build.timerconfig=TIMER_81Hz +d11d14as.menu.timer.timer_61Hz=61.04Hz (16-bit) +d11d14as.menu.timer.timer_61Hz.build.timerconfig=TIMER_61Hz +d11d14as.menu.timer.timer_31Hz=30.52Hz (16-bit) +d11d14as.menu.timer.timer_31Hz.build.timerconfig=TIMER_31Hz +d11d14as.menu.timer.timer_187500Hz=187500Hz (8-bit) +d11d14as.menu.timer.timer_187500Hz.build.timerconfig=TIMER_187500Hz +d11d14as.menu.timer.timer_93750Hz=93750Hz (8-bit) +d11d14as.menu.timer.timer_93750Hz.build.timerconfig=TIMER_93750Hz +d11d14as.menu.timer.timer_62500Hz=62500Hz (8-bit) +d11d14as.menu.timer.timer_62500Hz.build.timerconfig=TIMER_62500Hz +d11d14as.menu.timer.timer_37500Hz=37500Hz (8-bit) +d11d14as.menu.timer.timer_37500Hz.build.timerconfig=TIMER_37500Hz +d11d14as.menu.timer.timer_20833Hz=20833Hz (8-bit) +d11d14as.menu.timer.timer_20833Hz.build.timerconfig=TIMER_20833Hz +d11d14as.menu.timer.timer_12500Hz=12500Hz (8-bit) +d11d14as.menu.timer.timer_12500Hz.build.timerconfig=TIMER_12500Hz +d11d14as.menu.timer.timer_7500Hz=7500Hz (8-bit) +d11d14as.menu.timer.timer_7500Hz.build.timerconfig=TIMER_7500Hz +d11d14as.menu.timer.timer_4166Hz=4166Hz (8-bit) +d11d14as.menu.timer.timer_4166Hz.build.timerconfig=TIMER_4166Hz +d11d14as.menu.timer.timer_2930Hz=2930Hz (8-bit) +d11d14as.menu.timer.timer_2930Hz.build.timerconfig=TIMER_2930Hz +d11d14as.menu.timer.timer_1465Hz=1465Hz (8-bit) +d11d14as.menu.timer.timer_1465Hz.build.timerconfig=TIMER_1465Hz +d11d14as.build.extra_flags=-D__SAMD11D14AS__ {build.usb_flags} -DARM_MATH_CM0PLUS +d11d14as.build.ldscript=flash_16KB.ld +d11d14as.build.openocdscript=openocd_scripts/SAMD11D14AS.cfg +d11d14as.bootloader.file=zero/binaries/sam_ba_SAMD11D14AS.bin +d11d14as.menu.bootloader.4kb=4KB_BOOTLOADER +d11d14as.menu.bootloader.4kb.build.bootloader_size=__4KB_BOOTLOADER__ +d11d14as.menu.bootloader.4kb.build.ldscript_path=linker_scripts/gcc/4KB_Bootloader +d11d14as.menu.bootloader.4kb.upload.tool=Fab_SAM_Arduino:bossac +d11d14as.menu.bootloader.4kb.upload.use_1200bps_touch=true +d11d14as.menu.bootloader.4kb.upload.wait_for_upload_port=true +d11d14as.menu.bootloader.4kb.upload.native_usb=true +d11d14as.menu.bootloader.4kb.upload.maximum_size=12288 +d11d14as.menu.bootloader.0kb=NO_BOOTLOADER +d11d14as.menu.bootloader.0kb.build.bootloader_size=__NO_BOOTLOADER__ +d11d14as.menu.bootloader.0kb.build.ldscript_path=linker_scripts/gcc/No_Bootloader +d11d14as.menu.bootloader.0kb.upload.tool=openocd +d11d14as.menu.bootloader.0kb.upload.use_1200bps_touch=false +d11d14as.menu.bootloader.0kb.upload.wait_for_upload_port=false +d11d14as.menu.bootloader.0kb.upload.native_usb=false +d11d14as.menu.bootloader.0kb.upload.maximum_size=16384 +d11d14as.menu.serial.one_uart=ONE_UART_ONE_WIRE_ONE_SPI +d11d14as.menu.serial.one_uart.build.serialcom_uart=ONE_UART +d11d14as.menu.serial.one_uart.build.serialcom_wire=ONE_WIRE +d11d14as.menu.serial.one_uart.build.serialcom_spi=ONE_SPI +d11d14as.menu.serial.no_uart=NO_UART_ONE_WIRE_ONE_SPI +d11d14as.menu.serial.no_uart.build.serialcom_uart=NO_UART +d11d14as.menu.serial.no_uart.build.serialcom_wire=ONE_WIRE +d11d14as.menu.serial.no_uart.build.serialcom_spi=ONE_SPI +d11d14as.menu.serial.two_uart=TWO_UART_ONE_WIRE_NO_SPI +d11d14as.menu.serial.two_uart.build.serialcom_uart=TWO_UART +d11d14as.menu.serial.two_uart.build.serialcom_wire=ONE_WIRE +d11d14as.menu.serial.two_uart.build.serialcom_spi=NO_SPI +d11d14as.menu.usb.cdc=CDC_ONLY +d11d14as.menu.usb.cdc.build.usbcom=CDC_ONLY +d11d14as.menu.usb.cdc.build.pid=0x2557 +d11d14as.menu.usb.cdc_hid=CDC_HID +d11d14as.menu.usb.cdc_hid.build.usbcom=CDC_HID +d11d14as.menu.usb.cdc_hid.build.pid=0x2856 +d11d14as.menu.usb.withcdc=WITH_CDC +d11d14as.menu.usb.withcdc.build.usbcom=WITH_CDC +d11d14as.menu.usb.withcdc.build.pid=0x2B41 +d11d14as.menu.usb.hid=HID_ONLY +d11d14as.menu.usb.hid.build.usbcom=HID_ONLY +d11d14as.menu.usb.hid.build.pid=0x2B40 +d11d14as.menu.usb.nocdc=WITHOUT_CDC +d11d14as.menu.usb.nocdc.build.usbcom=WITHOUT_CDC +d11d14as.menu.usb.nocdc.build.pid=0x2A0C +d11d14as.menu.usb.none=USB_DISABLED +d11d14as.menu.usb.none.build.usbcom=USB_DISABLED +d11d14as.menu.usb.none.build.pid=0x2856 + +# Generic D11D14AM +d11d14am.name=Generic D11D14AM +d11d14am.vid.0=0x16D0 +d11d14am.pid.0=0x3557 +d11d14am.vid.1=0x16D0 +d11d14am.pid.1=0x3856 +d11d14am.vid.2=0x16D0 +d11d14am.pid.2=0x3B41 +d11d14am.vid.3=0x16D0 +d11d14am.pid.3=0x3B40 +d11d14am.vid.4=0x16D0 +d11d14am.pid.4=0x3A0C +d11d14am.vid.5=0x16D0 +d11d14am.pid.5=0x3856 +d11d14am.build.mcu=cortex-m0plus +d11d14am.build.mathlib=arm_cortexM0l_math +d11d14am.build.f_cpu=48000000L +d11d14am.build.usb_product="MT-D11" +d11d14am.build.usb_manufacturer="Fab Foundation" +d11d14am.build.board=SAMD_ZERO +d11d14am.build.core=arduino +d11d14am.build.variant=Generic_D11D14AM +d11d14am.build.variant_system_lib= +d11d14am.build.vid=0x16D0 +d11d14am.upload.protocol=sam-ba +d11d14am.bootloader.tool=openocd +d11d14am.menu.float.default=Print & String use auto-promoted doubles only +d11d14am.menu.float.default.build.floatconfig=FLOAT_BOTH_DOUBLES_ONLY +d11d14am.menu.float.print=Print uses separate singles and doubles +d11d14am.menu.float.print.build.floatconfig=FLOAT_PRINT_SINGLES_DOUBLES +d11d14am.menu.float.string=String uses separate singles and doubles +d11d14am.menu.float.string.build.floatconfig=FLOAT_STRING_SINGLES_DOUBLES +d11d14am.menu.float.both=Print & String use separate singles and doubles +d11d14am.menu.float.both.build.floatconfig=FLOAT_BOTH_SINGLES_DOUBLES +d11d14am.menu.config.disabled=config.h disabled +d11d14am.menu.config.disabled.build.buildconfig=CONFIG_H_DISABLED +d11d14am.menu.config.enabled=config.h enabled (mostly code size reductions) +d11d14am.menu.config.enabled.build.buildconfig=CONFIG_H_ENABLED +d11d14am.menu.clock.crystal_32k=32KHZ_CRYSTAL +d11d14am.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32768HZ_CRYSTAL +d11d14am.menu.clock.crystal_hs=HIGH_SPEED_CRYSTAL +d11d14am.menu.clock.crystal_hs.build.clockconfig=CLOCKCONFIG_HS_CRYSTAL +d11d14am.menu.clock.internal=INTERNAL_OSCILLATOR +d11d14am.menu.clock.internal.build.clockconfig=CLOCKCONFIG_INTERNAL +d11d14am.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED_OSCILLATOR +d11d14am.menu.clock.internal_usb.build.clockconfig=CLOCKCONFIG_INTERNAL_USB +d11d14am.menu.timer.timer_732Hz=732.4Hz (16-bit) +d11d14am.menu.timer.timer_732Hz.build.timerconfig=TIMER_732Hz +d11d14am.menu.timer.timer_366Hz=366.2Hz (16-bit) +d11d14am.menu.timer.timer_366Hz.build.timerconfig=TIMER_366Hz +d11d14am.menu.timer.timer_244Hz=244.1Hz (16-bit) +d11d14am.menu.timer.timer_244Hz.build.timerconfig=TIMER_244Hz +d11d14am.menu.timer.timer_183Hz=183.1Hz (16-bit) +d11d14am.menu.timer.timer_183Hz.build.timerconfig=TIMER_183Hz +d11d14am.menu.timer.timer_146Hz=146.5Hz (16-bit) +d11d14am.menu.timer.timer_146Hz.build.timerconfig=TIMER_146Hz +d11d14am.menu.timer.timer_122Hz=122.1Hz (16-bit) +d11d14am.menu.timer.timer_122Hz.build.timerconfig=TIMER_122Hz +d11d14am.menu.timer.timer_105Hz=104.6Hz (16-bit) +d11d14am.menu.timer.timer_105Hz.build.timerconfig=TIMER_105Hz +d11d14am.menu.timer.timer_81Hz=81.38Hz (16-bit) +d11d14am.menu.timer.timer_81Hz.build.timerconfig=TIMER_81Hz +d11d14am.menu.timer.timer_61Hz=61.04Hz (16-bit) +d11d14am.menu.timer.timer_61Hz.build.timerconfig=TIMER_61Hz +d11d14am.menu.timer.timer_31Hz=30.52Hz (16-bit) +d11d14am.menu.timer.timer_31Hz.build.timerconfig=TIMER_31Hz +d11d14am.menu.timer.timer_187500Hz=187500Hz (8-bit) +d11d14am.menu.timer.timer_187500Hz.build.timerconfig=TIMER_187500Hz +d11d14am.menu.timer.timer_93750Hz=93750Hz (8-bit) +d11d14am.menu.timer.timer_93750Hz.build.timerconfig=TIMER_93750Hz +d11d14am.menu.timer.timer_62500Hz=62500Hz (8-bit) +d11d14am.menu.timer.timer_62500Hz.build.timerconfig=TIMER_62500Hz +d11d14am.menu.timer.timer_37500Hz=37500Hz (8-bit) +d11d14am.menu.timer.timer_37500Hz.build.timerconfig=TIMER_37500Hz +d11d14am.menu.timer.timer_20833Hz=20833Hz (8-bit) +d11d14am.menu.timer.timer_20833Hz.build.timerconfig=TIMER_20833Hz +d11d14am.menu.timer.timer_12500Hz=12500Hz (8-bit) +d11d14am.menu.timer.timer_12500Hz.build.timerconfig=TIMER_12500Hz +d11d14am.menu.timer.timer_7500Hz=7500Hz (8-bit) +d11d14am.menu.timer.timer_7500Hz.build.timerconfig=TIMER_7500Hz +d11d14am.menu.timer.timer_4166Hz=4166Hz (8-bit) +d11d14am.menu.timer.timer_4166Hz.build.timerconfig=TIMER_4166Hz +d11d14am.menu.timer.timer_2930Hz=2930Hz (8-bit) +d11d14am.menu.timer.timer_2930Hz.build.timerconfig=TIMER_2930Hz +d11d14am.menu.timer.timer_1465Hz=1465Hz (8-bit) +d11d14am.menu.timer.timer_1465Hz.build.timerconfig=TIMER_1465Hz +d11d14am.build.extra_flags=-D__SAMD11D14AM__ {build.usb_flags} -DARM_MATH_CM0PLUS +d11d14am.build.ldscript=flash_16KB.ld +d11d14am.build.openocdscript=openocd_scripts/SAMD11D14AM.cfg +d11d14am.bootloader.file=zero/binaries/sam_ba_SAMD11D14AM.bin +d11d14am.menu.bootloader.4kb=4KB_BOOTLOADER +d11d14am.menu.bootloader.4kb.build.bootloader_size=__4KB_BOOTLOADER__ +d11d14am.menu.bootloader.4kb.build.ldscript_path=linker_scripts/gcc/4KB_Bootloader +d11d14am.menu.bootloader.4kb.upload.tool=Fab_SAM_Arduino:bossac +d11d14am.menu.bootloader.4kb.upload.use_1200bps_touch=true +d11d14am.menu.bootloader.4kb.upload.wait_for_upload_port=true +d11d14am.menu.bootloader.4kb.upload.native_usb=true +d11d14am.menu.bootloader.4kb.upload.maximum_size=12288 +d11d14am.menu.bootloader.0kb=NO_BOOTLOADER +d11d14am.menu.bootloader.0kb.build.bootloader_size=__NO_BOOTLOADER__ +d11d14am.menu.bootloader.0kb.build.ldscript_path=linker_scripts/gcc/No_Bootloader +d11d14am.menu.bootloader.0kb.upload.tool=openocd +d11d14am.menu.bootloader.0kb.upload.use_1200bps_touch=false +d11d14am.menu.bootloader.0kb.upload.wait_for_upload_port=false +d11d14am.menu.bootloader.0kb.upload.native_usb=false +d11d14am.menu.bootloader.0kb.upload.maximum_size=16384 +d11d14am.menu.serial.one_uart=ONE_UART_ONE_WIRE_ONE_SPI +d11d14am.menu.serial.one_uart.build.serialcom_uart=ONE_UART +d11d14am.menu.serial.one_uart.build.serialcom_wire=ONE_WIRE +d11d14am.menu.serial.one_uart.build.serialcom_spi=ONE_SPI +d11d14am.menu.serial.no_uart=NO_UART_ONE_WIRE_ONE_SPI +d11d14am.menu.serial.no_uart.build.serialcom_uart=NO_UART +d11d14am.menu.serial.no_uart.build.serialcom_wire=ONE_WIRE +d11d14am.menu.serial.no_uart.build.serialcom_spi=ONE_SPI +d11d14am.menu.serial.two_uart=TWO_UART_ONE_WIRE_NO_SPI +d11d14am.menu.serial.two_uart.build.serialcom_uart=TWO_UART +d11d14am.menu.serial.two_uart.build.serialcom_wire=ONE_WIRE +d11d14am.menu.serial.two_uart.build.serialcom_spi=NO_SPI +d11d14am.menu.usb.cdc=CDC_ONLY +d11d14am.menu.usb.cdc.build.usbcom=CDC_ONLY +d11d14am.menu.usb.cdc.build.pid=0x3557 +d11d14am.menu.usb.cdc_hid=CDC_HID +d11d14am.menu.usb.cdc_hid.build.usbcom=CDC_HID +d11d14am.menu.usb.cdc_hid.build.pid=0x3856 +d11d14am.menu.usb.withcdc=WITH_CDC +d11d14am.menu.usb.withcdc.build.usbcom=WITH_CDC +d11d14am.menu.usb.withcdc.build.pid=0x3B41 +d11d14am.menu.usb.hid=HID_ONLY +d11d14am.menu.usb.hid.build.usbcom=HID_ONLY +d11d14am.menu.usb.hid.build.pid=0x3B40 +d11d14am.menu.usb.nocdc=WITHOUT_CDC +d11d14am.menu.usb.nocdc.build.usbcom=WITHOUT_CDC +d11d14am.menu.usb.nocdc.build.pid=0x3A0C +d11d14am.menu.usb.none=USB_DISABLED +d11d14am.menu.usb.none.build.usbcom=USB_DISABLED +d11d14am.menu.usb.none.build.pid=0x3856 + +# Generic x21E +x21e.name=Generic x21E +x21e.vid.0=0x16D0 +x21e.pid.0=0x4557 +x21e.vid.1=0x16D0 +x21e.pid.1=0x4856 +x21e.vid.2=0x16D0 +x21e.pid.2=0x4B41 +x21e.vid.3=0x16D0 +x21e.pid.3=0x4B40 +x21e.vid.4=0x16D0 +x21e.pid.4=0x4A0C +x21e.vid.5=0x16D0 +x21e.pid.5=0x4856 +x21e.build.mcu=cortex-m0plus +x21e.build.mathlib=arm_cortexM0l_math +x21e.build.f_cpu=48000000L +x21e.build.usb_product="x21E" +x21e.build.usb_manufacturer="Fab Foundation" +x21e.build.board=SAMD_ZERO +x21e.build.core=arduino +x21e.build.variant=Generic_x21E +x21e.build.variant_system_lib= +x21e.build.vid=0x16D0 +x21e.upload.protocol=sam-ba +x21e.bootloader.tool=openocd +x21e.menu.float.default=Print & String use auto-promoted doubles only +x21e.menu.float.default.build.floatconfig=FLOAT_BOTH_DOUBLES_ONLY +x21e.menu.float.print=Print uses separate singles and doubles +x21e.menu.float.print.build.floatconfig=FLOAT_PRINT_SINGLES_DOUBLES +x21e.menu.float.string=String uses separate singles and doubles +x21e.menu.float.string.build.floatconfig=FLOAT_STRING_SINGLES_DOUBLES +x21e.menu.float.both=Print & String use separate singles and doubles +x21e.menu.float.both.build.floatconfig=FLOAT_BOTH_SINGLES_DOUBLES +x21e.menu.config.disabled=config.h disabled +x21e.menu.config.disabled.build.buildconfig=CONFIG_H_DISABLED +x21e.menu.config.enabled=config.h enabled (mostly code size reductions) +x21e.menu.config.enabled.build.buildconfig=CONFIG_H_ENABLED +x21e.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED_OSCILLATOR +x21e.menu.clock.internal_usb.build.clockconfig=CLOCKCONFIG_INTERNAL_USB +x21e.menu.clock.internal=INTERNAL_OSCILLATOR +x21e.menu.clock.internal.build.clockconfig=CLOCKCONFIG_INTERNAL +x21e.menu.clock.crystal_32k=32KHZ_CRYSTAL +x21e.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32768HZ_CRYSTAL +x21e.menu.clock.crystal_hs=HIGH_SPEED_CRYSTAL +x21e.menu.clock.crystal_hs.build.clockconfig=CLOCKCONFIG_HS_CRYSTAL +x21e.menu.timer.timer_732Hz=732.4Hz (16-bit) +x21e.menu.timer.timer_732Hz.build.timerconfig=TIMER_732Hz +x21e.menu.timer.timer_366Hz=366.2Hz (16-bit) +x21e.menu.timer.timer_366Hz.build.timerconfig=TIMER_366Hz +x21e.menu.timer.timer_244Hz=244.1Hz (16-bit) +x21e.menu.timer.timer_244Hz.build.timerconfig=TIMER_244Hz +x21e.menu.timer.timer_183Hz=183.1Hz (16-bit) +x21e.menu.timer.timer_183Hz.build.timerconfig=TIMER_183Hz +x21e.menu.timer.timer_146Hz=146.5Hz (16-bit) +x21e.menu.timer.timer_146Hz.build.timerconfig=TIMER_146Hz +x21e.menu.timer.timer_122Hz=122.1Hz (16-bit) +x21e.menu.timer.timer_122Hz.build.timerconfig=TIMER_122Hz +x21e.menu.timer.timer_105Hz=104.6Hz (16-bit) +x21e.menu.timer.timer_105Hz.build.timerconfig=TIMER_105Hz +x21e.menu.timer.timer_81Hz=81.38Hz (16-bit) +x21e.menu.timer.timer_81Hz.build.timerconfig=TIMER_81Hz +x21e.menu.timer.timer_61Hz=61.04Hz (16-bit) +x21e.menu.timer.timer_61Hz.build.timerconfig=TIMER_61Hz +x21e.menu.timer.timer_31Hz=30.52Hz (16-bit) +x21e.menu.timer.timer_31Hz.build.timerconfig=TIMER_31Hz +x21e.menu.timer.timer_187500Hz=187500Hz (8-bit) +x21e.menu.timer.timer_187500Hz.build.timerconfig=TIMER_187500Hz +x21e.menu.timer.timer_93750Hz=93750Hz (8-bit) +x21e.menu.timer.timer_93750Hz.build.timerconfig=TIMER_93750Hz +x21e.menu.timer.timer_62500Hz=62500Hz (8-bit) +x21e.menu.timer.timer_62500Hz.build.timerconfig=TIMER_62500Hz +x21e.menu.timer.timer_37500Hz=37500Hz (8-bit) +x21e.menu.timer.timer_37500Hz.build.timerconfig=TIMER_37500Hz +x21e.menu.timer.timer_20833Hz=20833Hz (8-bit) +x21e.menu.timer.timer_20833Hz.build.timerconfig=TIMER_20833Hz +x21e.menu.timer.timer_12500Hz=12500Hz (8-bit) +x21e.menu.timer.timer_12500Hz.build.timerconfig=TIMER_12500Hz +x21e.menu.timer.timer_7500Hz=7500Hz (8-bit) +x21e.menu.timer.timer_7500Hz.build.timerconfig=TIMER_7500Hz +x21e.menu.timer.timer_4166Hz=4166Hz (8-bit) +x21e.menu.timer.timer_4166Hz.build.timerconfig=TIMER_4166Hz +x21e.menu.timer.timer_2930Hz=2930Hz (8-bit) +x21e.menu.timer.timer_2930Hz.build.timerconfig=TIMER_2930Hz +x21e.menu.timer.timer_1465Hz=1465Hz (8-bit) +x21e.menu.timer.timer_1465Hz.build.timerconfig=TIMER_1465Hz +x21e.menu.cpu.samd21e15a=SAMD21E15A +x21e.menu.cpu.samd21e15a.upload.maximum_size=24576 +x21e.menu.cpu.samd21e15a.build.extra_flags=-D__SAMD21E15A__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21e.menu.cpu.samd21e15a.build.ldscript=flash_32KB.ld +x21e.menu.cpu.samd21e15a.build.openocdscript=openocd_scripts/SAMD21E15A.cfg +x21e.menu.cpu.samd21e15a.bootloader.file=zero/binaries/sam_ba_SAMD21E15A.bin +x21e.menu.cpu.samd21e16a=SAMD21E16A +x21e.menu.cpu.samd21e16a.upload.maximum_size=57344 +x21e.menu.cpu.samd21e16a.build.extra_flags=-D__SAMD21E16A__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21e.menu.cpu.samd21e16a.build.ldscript=flash_64KB.ld +x21e.menu.cpu.samd21e16a.build.openocdscript=openocd_scripts/SAMD21E16A.cfg +x21e.menu.cpu.samd21e16a.bootloader.file=zero/binaries/sam_ba_SAMD21E16A.bin +x21e.menu.cpu.samd21e17a=SAMD21E17A +x21e.menu.cpu.samd21e17a.upload.maximum_size=122880 +x21e.menu.cpu.samd21e17a.build.extra_flags=-D__SAMD21E17A__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21e.menu.cpu.samd21e17a.build.ldscript=flash_128KB.ld +x21e.menu.cpu.samd21e17a.build.openocdscript=openocd_scripts/SAMD21E17A.cfg +x21e.menu.cpu.samd21e17a.bootloader.file=zero/binaries/sam_ba_SAMD21E17A.bin +x21e.menu.cpu.samd21e18a=SAMD21E18A +x21e.menu.cpu.samd21e18a.upload.maximum_size=253952 +x21e.menu.cpu.samd21e18a.build.extra_flags=-D__SAMD21E18A__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21e.menu.cpu.samd21e18a.build.ldscript=flash_256KB.ld +x21e.menu.cpu.samd21e18a.build.openocdscript=openocd_scripts/SAMD21E18A.cfg +x21e.menu.cpu.samd21e18a.bootloader.file=zero/binaries/sam_ba_SAMD21E18A.bin +x21e.menu.cpu.saml21e15b=SAML21E15B +x21e.menu.cpu.saml21e15b.upload.maximum_size=24576 +x21e.menu.cpu.saml21e15b.build.extra_flags=-D__SAML21E15B__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21e.menu.cpu.saml21e15b.build.ldscript=flash_32KB.ld +x21e.menu.cpu.saml21e15b.build.openocdscript=openocd_scripts/SAML21E15B.cfg +x21e.menu.cpu.saml21e15b.bootloader.file=zero/binaries/sam_ba_SAML21E15B.bin +x21e.menu.cpu.saml21e16b=SAML21E16B +x21e.menu.cpu.saml21e16b.upload.maximum_size=57344 +x21e.menu.cpu.saml21e16b.build.extra_flags=-D__SAML21E16B__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21e.menu.cpu.saml21e16b.build.ldscript=flash_64KB.ld +x21e.menu.cpu.saml21e16b.build.openocdscript=openocd_scripts/SAML21E16B.cfg +x21e.menu.cpu.saml21e16b.bootloader.file=zero/binaries/sam_ba_SAML21E16B.bin +x21e.menu.cpu.saml21e17b=SAML21E17B +x21e.menu.cpu.saml21e17b.upload.maximum_size=122880 +x21e.menu.cpu.saml21e17b.build.extra_flags=-D__SAML21E17B__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21e.menu.cpu.saml21e17b.build.ldscript=flash_128KB.ld +x21e.menu.cpu.saml21e17b.build.openocdscript=openocd_scripts/SAML21E17B.cfg +x21e.menu.cpu.saml21e17b.bootloader.file=zero/binaries/sam_ba_SAML21E17B.bin +x21e.menu.cpu.saml21e18b=SAML21E18B +x21e.menu.cpu.saml21e18b.upload.maximum_size=253952 +x21e.menu.cpu.saml21e18b.build.extra_flags=-D__SAML21E18B__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21e.menu.cpu.saml21e18b.build.ldscript=flash_256KB.ld +x21e.menu.cpu.saml21e18b.build.openocdscript=openocd_scripts/SAML21E18B.cfg +x21e.menu.cpu.saml21e18b.bootloader.file=zero/binaries/sam_ba_SAML21E18B.bin +x21e.menu.cpu.samc21e15a=SAMC21E15A +x21e.menu.cpu.samc21e15a.upload.maximum_size=24576 +x21e.menu.cpu.samc21e15a.build.extra_flags=-D__SAMC21E15A__ -DARM_MATH_CM0PLUS +x21e.menu.cpu.samc21e15a.build.ldscript=flash_32KB.ld +x21e.menu.cpu.samc21e15a.build.openocdscript=openocd_scripts/SAMC21E15A.cfg +x21e.menu.cpu.samc21e15a.bootloader.file=zero/binaries/sam_ba_SAMC21E15A.bin +x21e.menu.cpu.samc21e16a=SAMC21E16A +x21e.menu.cpu.samc21e16a.upload.maximum_size=57344 +x21e.menu.cpu.samc21e16a.build.extra_flags=-D__SAMC21E16A__ -DARM_MATH_CM0PLUS +x21e.menu.cpu.samc21e16a.build.ldscript=flash_64KB.ld +x21e.menu.cpu.samc21e16a.build.openocdscript=openocd_scripts/SAMC21E16A.cfg +x21e.menu.cpu.samc21e16a.bootloader.file=zero/binaries/sam_ba_SAMC21E16A.bin +x21e.menu.cpu.samc21e17a=SAMC21E17A +x21e.menu.cpu.samc21e17a.upload.maximum_size=122880 +x21e.menu.cpu.samc21e17a.build.extra_flags=-D__SAMC21E17A__ -DARM_MATH_CM0PLUS +x21e.menu.cpu.samc21e17a.build.ldscript=flash_128KB.ld +x21e.menu.cpu.samc21e17a.build.openocdscript=openocd_scripts/SAMC21E17A.cfg +x21e.menu.cpu.samc21e17a.bootloader.file=zero/binaries/sam_ba_SAMC21E17A.bin +x21e.menu.cpu.samc21e18a=SAMC21E18A +x21e.menu.cpu.samc21e18a.upload.maximum_size=253952 +x21e.menu.cpu.samc21e18a.build.extra_flags=-D__SAMC21E18A__ -DARM_MATH_CM0PLUS +x21e.menu.cpu.samc21e18a.build.ldscript=flash_256KB.ld +x21e.menu.cpu.samc21e18a.build.openocdscript=openocd_scripts/SAMC21E18A.cfg +x21e.menu.cpu.samc21e18a.bootloader.file=zero/binaries/sam_ba_SAMC21E18A.bin +x21e.menu.bootloader.8kb=8KB_BOOTLOADER +x21e.menu.bootloader.8kb.build.bootloader_size=__8KB_BOOTLOADER__ +x21e.menu.bootloader.8kb.build.ldscript_path=linker_scripts/gcc/8KB_Bootloader +x21e.menu.bootloader.8kb.upload.tool=Fab_SAM_Arduino:bossac +x21e.menu.bootloader.8kb.upload.use_1200bps_touch=true +x21e.menu.bootloader.8kb.upload.wait_for_upload_port=true +x21e.menu.bootloader.8kb.upload.native_usb=true +x21e.menu.bootloader.16kb=16KB_BOOTLOADER +x21e.menu.bootloader.16kb.build.bootloader_size=__16KB_BOOTLOADER__ +x21e.menu.bootloader.16kb.build.ldscript_path=linker_scripts/gcc/16KB_Bootloader +x21e.menu.bootloader.16kb.upload.tool=Fab_SAM_Arduino:bossac +x21e.menu.bootloader.16kb.upload.use_1200bps_touch=true +x21e.menu.bootloader.16kb.upload.wait_for_upload_port=true +x21e.menu.bootloader.16kb.upload.native_usb=true +x21e.menu.bootloader.0kb=NO_BOOTLOADER +x21e.menu.bootloader.0kb.build.bootloader_size=__NO_BOOTLOADER__ +x21e.menu.bootloader.0kb.build.ldscript_path=linker_scripts/gcc/No_Bootloader +x21e.menu.bootloader.0kb.upload.tool=openocd +x21e.menu.bootloader.0kb.upload.use_1200bps_touch=false +x21e.menu.bootloader.0kb.upload.wait_for_upload_port=false +x21e.menu.bootloader.0kb.upload.native_usb=false +x21e.menu.serial.one_uart=ONE_UART_ONE_WIRE_ONE_SPI +x21e.menu.serial.one_uart.build.serialcom_uart=ONE_UART +x21e.menu.serial.one_uart.build.serialcom_wire=ONE_WIRE +x21e.menu.serial.one_uart.build.serialcom_spi=ONE_SPI +x21e.menu.serial.one_uart_one_wire_two_spi=ONE_UART_ONE_WIRE_TWO_SPI +x21e.menu.serial.one_uart_one_wire_two_spi.build.serialcom_uart=ONE_UART +x21e.menu.serial.one_uart_one_wire_two_spi.build.serialcom_wire=ONE_WIRE +x21e.menu.serial.one_uart_one_wire_two_spi.build.serialcom_spi=TWO_SPI +x21e.menu.serial.one_uart_two_wire_one_spi=ONE_UART_TWO_WIRE_ONE_SPI +x21e.menu.serial.one_uart_two_wire_one_spi.build.serialcom_uart=ONE_UART +x21e.menu.serial.one_uart_two_wire_one_spi.build.serialcom_wire=TWO_WIRE +x21e.menu.serial.one_uart_two_wire_one_spi.build.serialcom_spi=ONE_SPI +x21e.menu.serial.two_uart=TWO_UART_ONE_WIRE_ONE_SPI +x21e.menu.serial.two_uart.build.serialcom_uart=TWO_UART +x21e.menu.serial.two_uart.build.serialcom_wire=ONE_WIRE +x21e.menu.serial.two_uart.build.serialcom_spi=ONE_SPI +x21e.menu.serial.three_uart_one_wire_no_spi=THREE_UART_ONE_WIRE_NO_SPI +x21e.menu.serial.three_uart_one_wire_no_spi.build.serialcom_uart=THREE_UART +x21e.menu.serial.three_uart_one_wire_no_spi.build.serialcom_wire=ONE_WIRE +x21e.menu.serial.three_uart_one_wire_no_spi.build.serialcom_spi=NO_SPI +x21e.menu.serial.three_uart_no_wire_one_spi=THREE_UART_NO_WIRE_ONE_SPI +x21e.menu.serial.three_uart_no_wire_one_spi.build.serialcom_uart=THREE_UART +x21e.menu.serial.three_uart_no_wire_one_spi.build.serialcom_wire=NO_WIRE +x21e.menu.serial.three_uart_no_wire_one_spi.build.serialcom_spi=ONE_SPI +x21e.menu.serial.four_uart=FOUR_UART_NO_WIRE_NO_SPI +x21e.menu.serial.four_uart.build.serialcom_uart=FOUR_UART +x21e.menu.serial.four_uart.build.serialcom_wire=NO_WIRE +x21e.menu.serial.four_uart.build.serialcom_spi=NO_SPI +x21e.menu.serial.no_uart_one_wire_two_spi=NO_UART_ONE_WIRE_TWO_SPI +x21e.menu.serial.no_uart_one_wire_two_spi.build.serialcom_uart=NO_UART +x21e.menu.serial.no_uart_one_wire_two_spi.build.serialcom_wire=ONE_WIRE +x21e.menu.serial.no_uart_one_wire_two_spi.build.serialcom_spi=TWO_SPI +x21e.menu.serial.four_uart_one_wire_one_spi=FOUR_UART_ONE_WIRE_ONE_SPI (L21 only) +x21e.menu.serial.four_uart_one_wire_one_spi.build.serialcom_uart=FOUR_UART +x21e.menu.serial.four_uart_one_wire_one_spi.build.serialcom_wire=ONE_WIRE +x21e.menu.serial.four_uart_one_wire_one_spi.build.serialcom_spi=ONE_SPI +x21e.menu.serial.five_uart_no_wire_one_spi=FIVE_UART_NO_WIRE_ONE_SPI (L21 only) +x21e.menu.serial.five_uart_no_wire_one_spi.build.serialcom_uart=FIVE_UART +x21e.menu.serial.five_uart_no_wire_one_spi.build.serialcom_wire=NO_WIRE +x21e.menu.serial.five_uart_no_wire_one_spi.build.serialcom_spi=ONE_SPI +x21e.menu.serial.five_uart_one_wire_no_spi=FIVE_UART_ONE_WIRE_NO_SPI (L21 only) +x21e.menu.serial.five_uart_one_wire_no_spi.build.serialcom_uart=FIVE_UART +x21e.menu.serial.five_uart_one_wire_no_spi.build.serialcom_wire=ONE_WIRE +x21e.menu.serial.five_uart_one_wire_no_spi.build.serialcom_spi=NO_SPI +x21e.menu.serial.six_uart=SIX_UART_NO_WIRE_NO_SPI (L21 only) +x21e.menu.serial.six_uart.build.serialcom_uart=SIX_UART +x21e.menu.serial.six_uart.build.serialcom_wire=NO_WIRE +x21e.menu.serial.six_uart.build.serialcom_spi=NO_SPI +x21e.menu.usb.cdc=CDC_ONLY +x21e.menu.usb.cdc.build.usbcom=CDC_ONLY +x21e.menu.usb.cdc.build.pid=0x4557 +x21e.menu.usb.cdc_hid=CDC_HID +x21e.menu.usb.cdc_hid.build.usbcom=CDC_HID +x21e.menu.usb.cdc_hid.build.pid=0x4856 +x21e.menu.usb.withcdc=WITH_CDC +x21e.menu.usb.withcdc.build.usbcom=WITH_CDC +x21e.menu.usb.withcdc.build.pid=0x4B41 +x21e.menu.usb.hid=HID_ONLY +x21e.menu.usb.hid.build.usbcom=HID_ONLY +x21e.menu.usb.hid.build.pid=0x4B40 +x21e.menu.usb.nocdc=WITHOUT_CDC +x21e.menu.usb.nocdc.build.usbcom=WITHOUT_CDC +x21e.menu.usb.nocdc.build.pid=0x4A0C +x21e.menu.usb.none=USB_DISABLED +x21e.menu.usb.none.build.usbcom=USB_DISABLED +x21e.menu.usb.none.build.pid=0x4856 + +# Generic x21G +x21g.name=Generic x21G +x21g.vid.0=0x16D0 +x21g.pid.0=0x5557 +x21g.vid.1=0x16D0 +x21g.pid.1=0x5856 +x21g.vid.2=0x16D0 +x21g.pid.2=0x5B41 +x21g.vid.3=0x16D0 +x21g.pid.3=0x5B40 +x21g.vid.4=0x16D0 +x21g.pid.4=0x5A0C +x21g.vid.5=0x16D0 +x21g.pid.5=0x5856 +x21g.build.usb_manufacturer="Fab Foundation" +x21g.build.board=SAMD_ZERO +x21g.build.core=arduino +x21g.build.variant=Generic_xx1G +x21g.build.variant_system_lib= +x21g.build.vid=0x16D0 +x21g.upload.protocol=sam-ba +x21g.bootloader.tool=openocd +x21g.menu.float.default=Print & String use auto-promoted doubles only +x21g.menu.float.default.build.floatconfig=FLOAT_BOTH_DOUBLES_ONLY +x21g.menu.float.print=Print uses separate singles and doubles +x21g.menu.float.print.build.floatconfig=FLOAT_PRINT_SINGLES_DOUBLES +x21g.menu.float.string=String uses separate singles and doubles +x21g.menu.float.string.build.floatconfig=FLOAT_STRING_SINGLES_DOUBLES +x21g.menu.float.both=Print & String use separate singles and doubles +x21g.menu.float.both.build.floatconfig=FLOAT_BOTH_SINGLES_DOUBLES +x21g.menu.config.disabled=config.h disabled +x21g.menu.config.disabled.build.buildconfig=CONFIG_H_DISABLED +x21g.menu.config.enabled=config.h enabled (mostly code size reductions) +x21g.menu.config.enabled.build.buildconfig=CONFIG_H_ENABLED +x21g.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED_OSCILLATOR +x21g.menu.clock.internal_usb.build.clockconfig=CLOCKCONFIG_INTERNAL_USB +x21g.menu.clock.internal=INTERNAL_OSCILLATOR +x21g.menu.clock.internal.build.clockconfig=CLOCKCONFIG_INTERNAL +x21g.menu.clock.crystal_32k=32KHZ_CRYSTAL +x21g.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32768HZ_CRYSTAL +x21g.menu.clock.crystal_hs=HIGH_SPEED_CRYSTAL +x21g.menu.clock.crystal_hs.build.clockconfig=CLOCKCONFIG_HS_CRYSTAL +x21g.menu.timer.timer_732Hz=732.4Hz (16-bit) +x21g.menu.timer.timer_732Hz.build.timerconfig=TIMER_732Hz +x21g.menu.timer.timer_366Hz=366.2Hz (16-bit) +x21g.menu.timer.timer_366Hz.build.timerconfig=TIMER_366Hz +x21g.menu.timer.timer_244Hz=244.1Hz (16-bit) +x21g.menu.timer.timer_244Hz.build.timerconfig=TIMER_244Hz +x21g.menu.timer.timer_183Hz=183.1Hz (16-bit) +x21g.menu.timer.timer_183Hz.build.timerconfig=TIMER_183Hz +x21g.menu.timer.timer_146Hz=146.5Hz (16-bit) +x21g.menu.timer.timer_146Hz.build.timerconfig=TIMER_146Hz +x21g.menu.timer.timer_122Hz=122.1Hz (16-bit) +x21g.menu.timer.timer_122Hz.build.timerconfig=TIMER_122Hz +x21g.menu.timer.timer_105Hz=104.6Hz (16-bit) +x21g.menu.timer.timer_105Hz.build.timerconfig=TIMER_105Hz +x21g.menu.timer.timer_81Hz=81.38Hz (16-bit) +x21g.menu.timer.timer_81Hz.build.timerconfig=TIMER_81Hz +x21g.menu.timer.timer_61Hz=61.04Hz (16-bit) +x21g.menu.timer.timer_61Hz.build.timerconfig=TIMER_61Hz +x21g.menu.timer.timer_31Hz=30.52Hz (16-bit) +x21g.menu.timer.timer_31Hz.build.timerconfig=TIMER_31Hz +x21g.menu.timer.timer_187500Hz=187500Hz (8-bit) +x21g.menu.timer.timer_187500Hz.build.timerconfig=TIMER_187500Hz +x21g.menu.timer.timer_93750Hz=93750Hz (8-bit) +x21g.menu.timer.timer_93750Hz.build.timerconfig=TIMER_93750Hz +x21g.menu.timer.timer_62500Hz=62500Hz (8-bit) +x21g.menu.timer.timer_62500Hz.build.timerconfig=TIMER_62500Hz +x21g.menu.timer.timer_37500Hz=37500Hz (8-bit) +x21g.menu.timer.timer_37500Hz.build.timerconfig=TIMER_37500Hz +x21g.menu.timer.timer_20833Hz=20833Hz (8-bit) +x21g.menu.timer.timer_20833Hz.build.timerconfig=TIMER_20833Hz +x21g.menu.timer.timer_12500Hz=12500Hz (8-bit) +x21g.menu.timer.timer_12500Hz.build.timerconfig=TIMER_12500Hz +x21g.menu.timer.timer_7500Hz=7500Hz (8-bit) +x21g.menu.timer.timer_7500Hz.build.timerconfig=TIMER_7500Hz +x21g.menu.timer.timer_4166Hz=4166Hz (8-bit) +x21g.menu.timer.timer_4166Hz.build.timerconfig=TIMER_4166Hz +x21g.menu.timer.timer_2930Hz=2930Hz (8-bit) +x21g.menu.timer.timer_2930Hz.build.timerconfig=TIMER_2930Hz +x21g.menu.timer.timer_1465Hz=1465Hz (8-bit) +x21g.menu.timer.timer_1465Hz.build.timerconfig=TIMER_1465Hz +x21g.menu.cpu.samd21g17a=SAMD21G17A +x21g.menu.cpu.samd21g17a.upload.maximum_size=122880 +x21g.menu.cpu.samd21g17a.build.mcu=cortex-m0plus +x21g.menu.cpu.samd21g17a.build.mathlib=arm_cortexM0l_math +x21g.menu.cpu.samd21g17a.build.f_cpu=48000000L +x21g.menu.cpu.samd21g17a.build.usb_product="D21" +x21g.menu.cpu.samd21g17a.build.extra_flags=-D__SAMD21G17A__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21g.menu.cpu.samd21g17a.build.ldscript=flash_128KB.ld +x21g.menu.cpu.samd21g17a.build.openocdscript=openocd_scripts/SAMD21G17A.cfg +x21g.menu.cpu.samd21g17a.bootloader.file=zero/binaries/sam_ba_SAMD21G17A.bin +x21g.menu.cpu.samd21g18a=SAMD21G18A +x21g.menu.cpu.samd21g18a.upload.maximum_size=253952 +x21g.menu.cpu.samd21g18a.build.mcu=cortex-m0plus +x21g.menu.cpu.samd21g18a.build.mathlib=arm_cortexM0l_math +x21g.menu.cpu.samd21g18a.build.f_cpu=48000000L +x21g.menu.cpu.samd21g18a.build.usb_product="D21" +x21g.menu.cpu.samd21g18a.build.extra_flags=-D__SAMD21G18A__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21g.menu.cpu.samd21g18a.build.ldscript=flash_256KB.ld +x21g.menu.cpu.samd21g18a.build.openocdscript=openocd_scripts/SAMD21G18A.cfg +x21g.menu.cpu.samd21g18a.bootloader.file=zero/binaries/sam_ba_SAMD21G18A.bin +x21g.menu.cpu.samd21g15a=SAMD21G15A +x21g.menu.cpu.samd21g15a.upload.maximum_size=24576 +x21g.menu.cpu.samd21g15a.build.mcu=cortex-m0plus +x21g.menu.cpu.samd21g15a.build.mathlib=arm_cortexM0l_math +x21g.menu.cpu.samd21g15a.build.f_cpu=48000000L +x21g.menu.cpu.samd21g15a.build.usb_product="D21" +x21g.menu.cpu.samd21g15a.build.extra_flags=-D__SAMD21G15A__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21g.menu.cpu.samd21g15a.build.ldscript=flash_32KB.ld +x21g.menu.cpu.samd21g15a.build.openocdscript=openocd_scripts/SAMD21G15A.cfg +x21g.menu.cpu.samd21g15a.bootloader.file=zero/binaries/sam_ba_SAMD21G15A.bin +x21g.menu.cpu.samd21g16a=SAMD21G16A +x21g.menu.cpu.samd21g16a.upload.maximum_size=57344 +x21g.menu.cpu.samd21g16a.build.mcu=cortex-m0plus +x21g.menu.cpu.samd21g16a.build.mathlib=arm_cortexM0l_math +x21g.menu.cpu.samd21g16a.build.f_cpu=48000000L +x21g.menu.cpu.samd21g16a.build.usb_product="D21" +x21g.menu.cpu.samd21g16a.build.extra_flags=-D__SAMD21G16A__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21g.menu.cpu.samd21g16a.build.ldscript=flash_64KB.ld +x21g.menu.cpu.samd21g16a.build.openocdscript=openocd_scripts/SAMD21G16A.cfg +x21g.menu.cpu.samd21g16a.bootloader.file=zero/binaries/sam_ba_SAMD21G16A.bin +x21g.menu.cpu.saml21g17b=SAML21G17B +x21g.menu.cpu.saml21g17b.upload.maximum_size=122880 +x21g.menu.cpu.saml21g17b.build.mcu=cortex-m0plus +x21g.menu.cpu.saml21g17b.build.mathlib=arm_cortexM0l_math +x21g.menu.cpu.saml21g17b.build.f_cpu=48000000L +x21g.menu.cpu.saml21g17b.build.usb_product="L21" +x21g.menu.cpu.saml21g17b.build.extra_flags=-D__SAML21G17B__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21g.menu.cpu.saml21g17b.build.ldscript=flash_128KB.ld +x21g.menu.cpu.saml21g17b.build.openocdscript=openocd_scripts/SAML21G17B.cfg +x21g.menu.cpu.saml21g17b.bootloader.file=zero/binaries/sam_ba_SAML21G17B.bin +x21g.menu.cpu.saml21g18b=SAML21G18B +x21g.menu.cpu.saml21g18b.upload.maximum_size=253952 +x21g.menu.cpu.saml21g18b.build.mcu=cortex-m0plus +x21g.menu.cpu.saml21g18b.build.mathlib=arm_cortexM0l_math +x21g.menu.cpu.saml21g18b.build.f_cpu=48000000L +x21g.menu.cpu.saml21g18b.build.usb_product="L21" +x21g.menu.cpu.saml21g18b.build.extra_flags=-D__SAML21G18B__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21g.menu.cpu.saml21g18b.build.ldscript=flash_256KB.ld +x21g.menu.cpu.saml21g18b.build.openocdscript=openocd_scripts/SAML21G18B.cfg +x21g.menu.cpu.saml21g18b.bootloader.file=zero/binaries/sam_ba_SAML21G18B.bin +x21g.menu.cpu.saml21g15b=SAML21G15B +x21g.menu.cpu.saml21g15b.upload.maximum_size=24576 +x21g.menu.cpu.saml21g15b.build.mcu=cortex-m0plus +x21g.menu.cpu.saml21g15b.build.mathlib=arm_cortexM0l_math +x21g.menu.cpu.saml21g15b.build.f_cpu=48000000L +x21g.menu.cpu.saml21g15b.build.usb_product="L21" +x21g.menu.cpu.saml21g15b.build.extra_flags=-D__SAML21G15B__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21g.menu.cpu.saml21g15b.build.ldscript=flash_32KB.ld +x21g.menu.cpu.saml21g15b.build.openocdscript=openocd_scripts/SAML21G15B.cfg +x21g.menu.cpu.saml21g15b.bootloader.file=zero/binaries/sam_ba_SAML21G15B.bin +x21g.menu.cpu.saml21g16b=SAML21G16B +x21g.menu.cpu.saml21g16b.upload.maximum_size=57344 +x21g.menu.cpu.saml21g16b.build.mcu=cortex-m0plus +x21g.menu.cpu.saml21g16b.build.mathlib=arm_cortexM0l_math +x21g.menu.cpu.saml21g16b.build.f_cpu=48000000L +x21g.menu.cpu.saml21g16b.build.usb_product="L21" +x21g.menu.cpu.saml21g16b.build.extra_flags=-D__SAML21G16B__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21g.menu.cpu.saml21g16b.build.ldscript=flash_64KB.ld +x21g.menu.cpu.saml21g16b.build.openocdscript=openocd_scripts/SAML21G16B.cfg +x21g.menu.cpu.saml21g16b.bootloader.file=zero/binaries/sam_ba_SAML21G16B.bin +x21g.menu.cpu.samc21g17a=SAMC21G17A +x21g.menu.cpu.samc21g17a.upload.maximum_size=122880 +x21g.menu.cpu.samc21g17a.build.mcu=cortex-m0plus +x21g.menu.cpu.samc21g17a.build.mathlib=arm_cortexM0l_math +x21g.menu.cpu.samc21g17a.build.f_cpu=48000000L +x21g.menu.cpu.samc21g17a.build.usb_product="C21" +x21g.menu.cpu.samc21g17a.build.extra_flags=-D__SAMC21G17A__ -DARM_MATH_CM0PLUS +x21g.menu.cpu.samc21g17a.build.ldscript=flash_128KB.ld +x21g.menu.cpu.samc21g17a.build.openocdscript=openocd_scripts/SAMC21G17A.cfg +x21g.menu.cpu.samc21g17a.bootloader.file=zero/binaries/sam_ba_SAMC21G17A.bin +x21g.menu.cpu.samc21g18a=SAMC21G18A +x21g.menu.cpu.samc21g18a.upload.maximum_size=253952 +x21g.menu.cpu.samc21g18a.build.mcu=cortex-m0plus +x21g.menu.cpu.samc21g18a.build.mathlib=arm_cortexM0l_math +x21g.menu.cpu.samc21g18a.build.f_cpu=48000000L +x21g.menu.cpu.samc21g18a.build.usb_product="C21" +x21g.menu.cpu.samc21g18a.build.extra_flags=-D__SAMC21G18A__ -DARM_MATH_CM0PLUS +x21g.menu.cpu.samc21g18a.build.ldscript=flash_256KB.ld +x21g.menu.cpu.samc21g18a.build.openocdscript=openocd_scripts/SAMC21G18A.cfg +x21g.menu.cpu.samc21g18a.bootloader.file=zero/binaries/sam_ba_SAMC21G18A.bin +x21g.menu.cpu.samc21g15a=SAMC21G15A +x21g.menu.cpu.samc21g15a.upload.maximum_size=24576 +x21g.menu.cpu.samc21g15a.build.mcu=cortex-m0plus +x21g.menu.cpu.samc21g15a.build.mathlib=arm_cortexM0l_math +x21g.menu.cpu.samc21g15a.build.f_cpu=48000000L +x21g.menu.cpu.samc21g15a.build.usb_product="C21" +x21g.menu.cpu.samc21g15a.build.extra_flags=-D__SAMC21G15A__ -DARM_MATH_CM0PLUS +x21g.menu.cpu.samc21g15a.build.ldscript=flash_32KB.ld +x21g.menu.cpu.samc21g15a.build.openocdscript=openocd_scripts/SAMC21G15A.cfg +x21g.menu.cpu.samc21g15a.bootloader.file=zero/binaries/sam_ba_SAMC21G15A.bin +x21g.menu.cpu.samc21g16a=SAMC21G16A +x21g.menu.cpu.samc21g16a.upload.maximum_size=57344 +x21g.menu.cpu.samc21g16a.build.mcu=cortex-m0plus +x21g.menu.cpu.samc21g16a.build.mathlib=arm_cortexM0l_math +x21g.menu.cpu.samc21g16a.build.f_cpu=48000000L +x21g.menu.cpu.samc21g16a.build.usb_product="C21" +x21g.menu.cpu.samc21g16a.build.extra_flags=-D__SAMC21G16A__ -DARM_MATH_CM0PLUS +x21g.menu.cpu.samc21g16a.build.ldscript=flash_64KB.ld +x21g.menu.cpu.samc21g16a.build.openocdscript=openocd_scripts/SAMC21G16A.cfg +x21g.menu.cpu.samc21g16a.bootloader.file=zero/binaries/sam_ba_SAMC21G16A.bin +x21g.menu.bootloader.8kb=8KB_BOOTLOADER +x21g.menu.bootloader.8kb.build.bootloader_size=__8KB_BOOTLOADER__ +x21g.menu.bootloader.8kb.build.ldscript_path=linker_scripts/gcc/8KB_Bootloader +x21g.menu.bootloader.8kb.upload.tool=Fab_SAM_Arduino:bossac +x21g.menu.bootloader.8kb.upload.use_1200bps_touch=true +x21g.menu.bootloader.8kb.upload.wait_for_upload_port=true +x21g.menu.bootloader.8kb.upload.native_usb=true +x21g.menu.bootloader.16kb=16KB_BOOTLOADER +x21g.menu.bootloader.16kb.build.bootloader_size=__16KB_BOOTLOADER__ +x21g.menu.bootloader.16kb.build.ldscript_path=linker_scripts/gcc/16KB_Bootloader +x21g.menu.bootloader.16kb.upload.tool=Fab_SAM_Arduino:bossac +x21g.menu.bootloader.16kb.upload.use_1200bps_touch=true +x21g.menu.bootloader.16kb.upload.wait_for_upload_port=true +x21g.menu.bootloader.16kb.upload.native_usb=true +x21g.menu.bootloader.0kb=NO_BOOTLOADER +x21g.menu.bootloader.0kb.build.bootloader_size=__NO_BOOTLOADER__ +x21g.menu.bootloader.0kb.build.ldscript_path=linker_scripts/gcc/No_Bootloader +x21g.menu.bootloader.0kb.upload.tool=openocd +x21g.menu.bootloader.0kb.upload.use_1200bps_touch=false +x21g.menu.bootloader.0kb.upload.wait_for_upload_port=false +x21g.menu.bootloader.0kb.upload.native_usb=false +x21g.menu.serial.one_uart=ONE_UART_ONE_WIRE_ONE_SPI +x21g.menu.serial.one_uart.build.serialcom_uart=ONE_UART +x21g.menu.serial.one_uart.build.serialcom_wire=ONE_WIRE +x21g.menu.serial.one_uart.build.serialcom_spi=ONE_SPI +x21g.menu.serial.one_uart_two_spi=ONE_UART_ONE_WIRE_TWO_SPI +x21g.menu.serial.one_uart_two_spi.build.serialcom_uart=ONE_UART +x21g.menu.serial.one_uart_two_spi.build.serialcom_wire=ONE_WIRE +x21g.menu.serial.one_uart_two_spi.build.serialcom_spi=TWO_SPI +x21g.menu.serial.one_uart_two_wire=ONE_UART_TWO_WIRE_ONE_SPI +x21g.menu.serial.one_uart_two_wire.build.serialcom_uart=ONE_UART +x21g.menu.serial.one_uart_two_wire.build.serialcom_wire=TWO_WIRE +x21g.menu.serial.one_uart_two_wire.build.serialcom_spi=ONE_SPI +x21g.menu.serial.two_uart=TWO_UART_ONE_WIRE_ONE_SPI +x21g.menu.serial.two_uart.build.serialcom_uart=TWO_UART +x21g.menu.serial.two_uart.build.serialcom_wire=ONE_WIRE +x21g.menu.serial.two_uart.build.serialcom_spi=ONE_SPI +x21g.menu.serial.two_uart_two_spi=TWO_UART_ONE_WIRE_TWO_SPI +x21g.menu.serial.two_uart_two_spi.build.serialcom_uart=TWO_UART +x21g.menu.serial.two_uart_two_spi.build.serialcom_wire=ONE_WIRE +x21g.menu.serial.two_uart_two_spi.build.serialcom_spi=TWO_SPI +x21g.menu.serial.two_uart_two_wire=TWO_UART_TWO_WIRE_ONE_SPI +x21g.menu.serial.two_uart_two_wire.build.serialcom_uart=TWO_UART +x21g.menu.serial.two_uart_two_wire.build.serialcom_wire=TWO_WIRE +x21g.menu.serial.two_uart_two_wire.build.serialcom_spi=ONE_SPI +x21g.menu.serial.three_uart=THREE_UART_ONE_WIRE_ONE_SPI +x21g.menu.serial.three_uart.build.serialcom_uart=THREE_UART +x21g.menu.serial.three_uart.build.serialcom_wire=ONE_WIRE +x21g.menu.serial.three_uart.build.serialcom_spi=ONE_SPI +x21g.menu.serial.three_uart_two_spi=THREE_UART_ONE_WIRE_TWO_SPI +x21g.menu.serial.three_uart_two_spi.build.serialcom_uart=THREE_UART +x21g.menu.serial.three_uart_two_spi.build.serialcom_wire=ONE_WIRE +x21g.menu.serial.three_uart_two_spi.build.serialcom_spi=TWO_SPI +x21g.menu.serial.three_uart_two_wire=THREE_UART_TWO_WIRE_ONE_SPI +x21g.menu.serial.three_uart_two_wire.build.serialcom_uart=THREE_UART +x21g.menu.serial.three_uart_two_wire.build.serialcom_wire=TWO_WIRE +x21g.menu.serial.three_uart_two_wire.build.serialcom_spi=ONE_SPI +x21g.menu.serial.no_uart=NO_UART_ONE_WIRE_ONE_SPI +x21g.menu.serial.no_uart.build.serialcom_uart=NO_UART +x21g.menu.serial.no_uart.build.serialcom_wire=ONE_WIRE +x21g.menu.serial.no_uart.build.serialcom_spi=ONE_SPI +x21g.menu.usb.cdc=CDC_ONLY +x21g.menu.usb.cdc.build.usbcom=CDC_ONLY +x21g.menu.usb.cdc.build.pid=0x5557 +x21g.menu.usb.cdc_hid=CDC_HID +x21g.menu.usb.cdc_hid.build.usbcom=CDC_HID +x21g.menu.usb.cdc_hid.build.pid=0x5856 +x21g.menu.usb.withcdc=WITH_CDC +x21g.menu.usb.withcdc.build.usbcom=WITH_CDC +x21g.menu.usb.withcdc.build.pid=0x5B41 +x21g.menu.usb.hid=HID_ONLY +x21g.menu.usb.hid.build.usbcom=HID_ONLY +x21g.menu.usb.hid.build.pid=0x5B40 +x21g.menu.usb.nocdc=WITHOUT_CDC +x21g.menu.usb.nocdc.build.usbcom=WITHOUT_CDC +x21g.menu.usb.nocdc.build.pid=0x5A0C +x21g.menu.usb.none=USB_DISABLED +x21g.menu.usb.none.build.usbcom=USB_DISABLED +x21g.menu.usb.none.build.pid=0x5856 + +# Generic x21J +x21j.name=Generic x21J +x21j.vid.0=0x16D0 +x21j.pid.0=0x6557 +x21j.vid.1=0x16D0 +x21j.pid.1=0x6856 +x21j.vid.2=0x16D0 +x21j.pid.2=0x6B41 +x21j.vid.3=0x16D0 +x21j.pid.3=0x6B40 +x21j.vid.4=0x16D0 +x21j.pid.4=0x6A0C +x21j.vid.5=0x16D0 +x21j.pid.5=0x6856 +x21j.build.usb_manufacturer="Fab Foundation" +x21j.build.board=SAMD_ZERO +x21j.build.core=arduino +x21j.build.variant=Generic_xx1J +x21j.build.variant_system_lib= +x21j.build.vid=0x16D0 +x21j.upload.protocol=sam-ba +x21j.bootloader.tool=openocd +x21j.menu.float.default=Print & String use auto-promoted doubles only +x21j.menu.float.default.build.floatconfig=FLOAT_BOTH_DOUBLES_ONLY +x21j.menu.float.print=Print uses separate singles and doubles +x21j.menu.float.print.build.floatconfig=FLOAT_PRINT_SINGLES_DOUBLES +x21j.menu.float.string=String uses separate singles and doubles +x21j.menu.float.string.build.floatconfig=FLOAT_STRING_SINGLES_DOUBLES +x21j.menu.float.both=Print & String use separate singles and doubles +x21j.menu.float.both.build.floatconfig=FLOAT_BOTH_SINGLES_DOUBLES +x21j.menu.config.disabled=config.h disabled +x21j.menu.config.disabled.build.buildconfig=CONFIG_H_DISABLED +x21j.menu.config.enabled=config.h enabled (mostly code size reductions) +x21j.menu.config.enabled.build.buildconfig=CONFIG_H_ENABLED +x21j.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED_OSCILLATOR +x21j.menu.clock.internal_usb.build.clockconfig=CLOCKCONFIG_INTERNAL_USB +x21j.menu.clock.internal=INTERNAL_OSCILLATOR +x21j.menu.clock.internal.build.clockconfig=CLOCKCONFIG_INTERNAL +x21j.menu.clock.crystal_32k=32KHZ_CRYSTAL +x21j.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32768HZ_CRYSTAL +x21j.menu.clock.crystal_hs=HIGH_SPEED_CRYSTAL +x21j.menu.clock.crystal_hs.build.clockconfig=CLOCKCONFIG_HS_CRYSTAL +x21j.menu.timer.timer_732Hz=732.4Hz (16-bit) +x21j.menu.timer.timer_732Hz.build.timerconfig=TIMER_732Hz +x21j.menu.timer.timer_366Hz=366.2Hz (16-bit) +x21j.menu.timer.timer_366Hz.build.timerconfig=TIMER_366Hz +x21j.menu.timer.timer_244Hz=244.1Hz (16-bit) +x21j.menu.timer.timer_244Hz.build.timerconfig=TIMER_244Hz +x21j.menu.timer.timer_183Hz=183.1Hz (16-bit) +x21j.menu.timer.timer_183Hz.build.timerconfig=TIMER_183Hz +x21j.menu.timer.timer_146Hz=146.5Hz (16-bit) +x21j.menu.timer.timer_146Hz.build.timerconfig=TIMER_146Hz +x21j.menu.timer.timer_122Hz=122.1Hz (16-bit) +x21j.menu.timer.timer_122Hz.build.timerconfig=TIMER_122Hz +x21j.menu.timer.timer_105Hz=104.6Hz (16-bit) +x21j.menu.timer.timer_105Hz.build.timerconfig=TIMER_105Hz +x21j.menu.timer.timer_81Hz=81.38Hz (16-bit) +x21j.menu.timer.timer_81Hz.build.timerconfig=TIMER_81Hz +x21j.menu.timer.timer_61Hz=61.04Hz (16-bit) +x21j.menu.timer.timer_61Hz.build.timerconfig=TIMER_61Hz +x21j.menu.timer.timer_31Hz=30.52Hz (16-bit) +x21j.menu.timer.timer_31Hz.build.timerconfig=TIMER_31Hz +x21j.menu.timer.timer_187500Hz=187500Hz (8-bit) +x21j.menu.timer.timer_187500Hz.build.timerconfig=TIMER_187500Hz +x21j.menu.timer.timer_93750Hz=93750Hz (8-bit) +x21j.menu.timer.timer_93750Hz.build.timerconfig=TIMER_93750Hz +x21j.menu.timer.timer_62500Hz=62500Hz (8-bit) +x21j.menu.timer.timer_62500Hz.build.timerconfig=TIMER_62500Hz +x21j.menu.timer.timer_37500Hz=37500Hz (8-bit) +x21j.menu.timer.timer_37500Hz.build.timerconfig=TIMER_37500Hz +x21j.menu.timer.timer_20833Hz=20833Hz (8-bit) +x21j.menu.timer.timer_20833Hz.build.timerconfig=TIMER_20833Hz +x21j.menu.timer.timer_12500Hz=12500Hz (8-bit) +x21j.menu.timer.timer_12500Hz.build.timerconfig=TIMER_12500Hz +x21j.menu.timer.timer_7500Hz=7500Hz (8-bit) +x21j.menu.timer.timer_7500Hz.build.timerconfig=TIMER_7500Hz +x21j.menu.timer.timer_4166Hz=4166Hz (8-bit) +x21j.menu.timer.timer_4166Hz.build.timerconfig=TIMER_4166Hz +x21j.menu.timer.timer_2930Hz=2930Hz (8-bit) +x21j.menu.timer.timer_2930Hz.build.timerconfig=TIMER_2930Hz +x21j.menu.timer.timer_1465Hz=1465Hz (8-bit) +x21j.menu.timer.timer_1465Hz.build.timerconfig=TIMER_1465Hz +x21j.menu.cpu.samd21j17a=SAMD21J17A +x21j.menu.cpu.samd21j17a.upload.maximum_size=122880 +x21j.menu.cpu.samd21j17a.build.mcu=cortex-m0plus +x21j.menu.cpu.samd21j17a.build.mathlib=arm_cortexM0l_math +x21j.menu.cpu.samd21j17a.build.f_cpu=48000000L +x21j.menu.cpu.samd21j17a.build.usb_product="Xeno D21" +x21j.menu.cpu.samd21j17a.build.extra_flags=-D__SAMD21J17A__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21j.menu.cpu.samd21j17a.build.ldscript=flash_128KB.ld +x21j.menu.cpu.samd21j17a.build.openocdscript=openocd_scripts/SAMD21J17A.cfg +x21j.menu.cpu.samd21j17a.bootloader.file=zero/binaries/sam_ba_SAMD21J17A.bin +x21j.menu.cpu.samd21j18a=SAMD21J18A +x21j.menu.cpu.samd21j18a.upload.maximum_size=253952 +x21j.menu.cpu.samd21j18a.build.mcu=cortex-m0plus +x21j.menu.cpu.samd21j18a.build.mathlib=arm_cortexM0l_math +x21j.menu.cpu.samd21j18a.build.f_cpu=48000000L +x21j.menu.cpu.samd21j18a.build.usb_product="Xeno D21" +x21j.menu.cpu.samd21j18a.build.extra_flags=-D__SAMD21J18A__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21j.menu.cpu.samd21j18a.build.ldscript=flash_256KB.ld +x21j.menu.cpu.samd21j18a.build.openocdscript=openocd_scripts/SAMD21J18A.cfg +x21j.menu.cpu.samd21j18a.bootloader.file=zero/binaries/sam_ba_SAMD21J18A.bin +x21j.menu.cpu.samd21j15a=SAMD21J15A +x21j.menu.cpu.samd21j15a.upload.maximum_size=24576 +x21j.menu.cpu.samd21j15a.build.mcu=cortex-m0plus +x21j.menu.cpu.samd21j15a.build.mathlib=arm_cortexM0l_math +x21j.menu.cpu.samd21j15a.build.f_cpu=48000000L +x21j.menu.cpu.samd21j15a.build.usb_product="Xeno D21" +x21j.menu.cpu.samd21j15a.build.extra_flags=-D__SAMD21J15A__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21j.menu.cpu.samd21j15a.build.ldscript=flash_32KB.ld +x21j.menu.cpu.samd21j15a.build.openocdscript=openocd_scripts/SAMD21J15A.cfg +x21j.menu.cpu.samd21j15a.bootloader.file=zero/binaries/sam_ba_SAMD21J15A.bin +x21j.menu.cpu.samd21j16a=SAMD21J16A +x21j.menu.cpu.samd21j16a.upload.maximum_size=57344 +x21j.menu.cpu.samd21j16a.build.mcu=cortex-m0plus +x21j.menu.cpu.samd21j16a.build.mathlib=arm_cortexM0l_math +x21j.menu.cpu.samd21j16a.build.f_cpu=48000000L +x21j.menu.cpu.samd21j16a.build.usb_product="Xeno D21" +x21j.menu.cpu.samd21j16a.build.extra_flags=-D__SAMD21J16A__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21j.menu.cpu.samd21j16a.build.ldscript=flash_64KB.ld +x21j.menu.cpu.samd21j16a.build.openocdscript=openocd_scripts/SAMD21J16A.cfg +x21j.menu.cpu.samd21j16a.bootloader.file=zero/binaries/sam_ba_SAMD21J16A.bin +x21j.menu.cpu.saml21j17b=SAML21J17B +x21j.menu.cpu.saml21j17b.upload.maximum_size=122880 +x21j.menu.cpu.saml21j17b.build.mcu=cortex-m0plus +x21j.menu.cpu.saml21j17b.build.mathlib=arm_cortexM0l_math +x21j.menu.cpu.saml21j17b.build.f_cpu=48000000L +x21j.menu.cpu.saml21j17b.build.usb_product="Xeno L21" +x21j.menu.cpu.saml21j17b.build.extra_flags=-D__SAML21J17B__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21j.menu.cpu.saml21j17b.build.ldscript=flash_128KB.ld +x21j.menu.cpu.saml21j17b.build.openocdscript=openocd_scripts/SAML21J17B.cfg +x21j.menu.cpu.saml21j17b.bootloader.file=zero/binaries/sam_ba_SAML21J17B.bin +x21j.menu.cpu.saml21j18b=SAML21J18B +x21j.menu.cpu.saml21j18b.upload.maximum_size=253952 +x21j.menu.cpu.saml21j18b.build.mcu=cortex-m0plus +x21j.menu.cpu.saml21j18b.build.mathlib=arm_cortexM0l_math +x21j.menu.cpu.saml21j18b.build.f_cpu=48000000L +x21j.menu.cpu.saml21j18b.build.usb_product="Xeno L21" +x21j.menu.cpu.saml21j18b.build.extra_flags=-D__SAML21J18B__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21j.menu.cpu.saml21j18b.build.ldscript=flash_256KB.ld +x21j.menu.cpu.saml21j18b.build.openocdscript=openocd_scripts/SAML21J18B.cfg +x21j.menu.cpu.saml21j18b.bootloader.file=zero/binaries/sam_ba_SAML21J18B.bin +x21j.menu.cpu.saml21j16b=SAML21J16B +x21j.menu.cpu.saml21j16b.upload.maximum_size=57344 +x21j.menu.cpu.saml21j16b.build.mcu=cortex-m0plus +x21j.menu.cpu.saml21j16b.build.mathlib=arm_cortexM0l_math +x21j.menu.cpu.saml21j16b.build.f_cpu=48000000L +x21j.menu.cpu.saml21j16b.build.usb_product="Xeno L21" +x21j.menu.cpu.saml21j16b.build.extra_flags=-D__SAML21J16B__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21j.menu.cpu.saml21j16b.build.ldscript=flash_64KB.ld +x21j.menu.cpu.saml21j16b.build.openocdscript=openocd_scripts/SAML21J16B.cfg +x21j.menu.cpu.saml21j16b.bootloader.file=zero/binaries/sam_ba_SAML21J16B.bin +x21j.menu.cpu.samc21j17a=SAMC21J17A +x21j.menu.cpu.samc21j17a.upload.maximum_size=122880 +x21j.menu.cpu.samc21j17a.build.mcu=cortex-m0plus +x21j.menu.cpu.samc21j17a.build.mathlib=arm_cortexM0l_math +x21j.menu.cpu.samc21j17a.build.f_cpu=48000000L +x21j.menu.cpu.samc21j17a.build.usb_product="Xeno C21" +x21j.menu.cpu.samc21j17a.build.extra_flags=-D__SAMC21J17A__ -DARM_MATH_CM0PLUS +x21j.menu.cpu.samc21j17a.build.ldscript=flash_128KB.ld +x21j.menu.cpu.samc21j17a.build.openocdscript=openocd_scripts/SAMC21J17A.cfg +x21j.menu.cpu.samc21j17a.bootloader.file=zero/binaries/sam_ba_SAMC21J17A.bin +x21j.menu.cpu.samc21j18a=SAMC21J18A +x21j.menu.cpu.samc21j18a.upload.maximum_size=253952 +x21j.menu.cpu.samc21j18a.build.mcu=cortex-m0plus +x21j.menu.cpu.samc21j18a.build.mathlib=arm_cortexM0l_math +x21j.menu.cpu.samc21j18a.build.f_cpu=48000000L +x21j.menu.cpu.samc21j18a.build.usb_product="Xeno C21" +x21j.menu.cpu.samc21j18a.build.extra_flags=-D__SAMC21J18A__ -DARM_MATH_CM0PLUS +x21j.menu.cpu.samc21j18a.build.ldscript=flash_256KB.ld +x21j.menu.cpu.samc21j18a.build.openocdscript=openocd_scripts/SAMC21J18A.cfg +x21j.menu.cpu.samc21j18a.bootloader.file=zero/binaries/sam_ba_SAMC21J18A.bin +x21j.menu.cpu.samc21j15a=SAMC21J15A +x21j.menu.cpu.samc21j15a.upload.maximum_size=24576 +x21j.menu.cpu.samc21j15a.build.mcu=cortex-m0plus +x21j.menu.cpu.samc21j15a.build.mathlib=arm_cortexM0l_math +x21j.menu.cpu.samc21j15a.build.f_cpu=48000000L +x21j.menu.cpu.samc21j15a.build.usb_product="Xeno C21" +x21j.menu.cpu.samc21j15a.build.extra_flags=-D__SAMC21J15A__ -DARM_MATH_CM0PLUS +x21j.menu.cpu.samc21j15a.build.ldscript=flash_32KB.ld +x21j.menu.cpu.samc21j15a.build.openocdscript=openocd_scripts/SAMC21J15A.cfg +x21j.menu.cpu.samc21j15a.bootloader.file=zero/binaries/sam_ba_SAMC21J15A.bin +x21j.menu.cpu.samc21j16a=SAMC21J16A +x21j.menu.cpu.samc21j16a.upload.maximum_size=57344 +x21j.menu.cpu.samc21j16a.build.mcu=cortex-m0plus +x21j.menu.cpu.samc21j16a.build.mathlib=arm_cortexM0l_math +x21j.menu.cpu.samc21j16a.build.f_cpu=48000000L +x21j.menu.cpu.samc21j16a.build.usb_product="Xeno C21" +x21j.menu.cpu.samc21j16a.build.extra_flags=-D__SAMC21J16A__ -DARM_MATH_CM0PLUS +x21j.menu.cpu.samc21j16a.build.ldscript=flash_64KB.ld +x21j.menu.cpu.samc21j16a.build.openocdscript=openocd_scripts/SAMC21J16A.cfg +x21j.menu.cpu.samc21j16a.bootloader.file=zero/binaries/sam_ba_SAMC21J16A.bin +x21j.menu.bootloader.8kb=8KB_BOOTLOADER +x21j.menu.bootloader.8kb.build.bootloader_size=__8KB_BOOTLOADER__ +x21j.menu.bootloader.8kb.build.ldscript_path=linker_scripts/gcc/8KB_Bootloader +x21j.menu.bootloader.8kb.upload.tool=Fab_SAM_Arduino:bossac +x21j.menu.bootloader.8kb.upload.use_1200bps_touch=true +x21j.menu.bootloader.8kb.upload.wait_for_upload_port=true +x21j.menu.bootloader.8kb.upload.native_usb=true +x21j.menu.bootloader.16kb=16KB_BOOTLOADER +x21j.menu.bootloader.16kb.build.bootloader_size=__16KB_BOOTLOADER__ +x21j.menu.bootloader.16kb.build.ldscript_path=linker_scripts/gcc/16KB_Bootloader +x21j.menu.bootloader.16kb.upload.tool=Fab_SAM_Arduino:bossac +x21j.menu.bootloader.16kb.upload.use_1200bps_touch=true +x21j.menu.bootloader.16kb.upload.wait_for_upload_port=true +x21j.menu.bootloader.16kb.upload.native_usb=true +x21j.menu.bootloader.0kb=NO_BOOTLOADER +x21j.menu.bootloader.0kb.build.bootloader_size=__NO_BOOTLOADER__ +x21j.menu.bootloader.0kb.build.ldscript_path=linker_scripts/gcc/No_Bootloader +x21j.menu.bootloader.0kb.upload.tool=openocd +x21j.menu.bootloader.0kb.upload.use_1200bps_touch=false +x21j.menu.bootloader.0kb.upload.wait_for_upload_port=false +x21j.menu.bootloader.0kb.upload.native_usb=false +x21j.menu.serial.one_uart=ONE_UART_ONE_WIRE_ONE_SPI +x21j.menu.serial.one_uart.build.serialcom_uart=ONE_UART +x21j.menu.serial.one_uart.build.serialcom_wire=ONE_WIRE +x21j.menu.serial.one_uart.build.serialcom_spi=ONE_SPI +x21j.menu.serial.one_uart_two_spi=ONE_UART_ONE_WIRE_TWO_SPI +x21j.menu.serial.one_uart_two_spi.build.serialcom_uart=ONE_UART +x21j.menu.serial.one_uart_two_spi.build.serialcom_wire=ONE_WIRE +x21j.menu.serial.one_uart_two_spi.build.serialcom_spi=TWO_SPI +x21j.menu.serial.one_uart_two_wire=ONE_UART_TWO_WIRE_ONE_SPI +x21j.menu.serial.one_uart_two_wire.build.serialcom_uart=ONE_UART +x21j.menu.serial.one_uart_two_wire.build.serialcom_wire=TWO_WIRE +x21j.menu.serial.one_uart_two_wire.build.serialcom_spi=ONE_SPI +x21j.menu.serial.two_uart=TWO_UART_ONE_WIRE_ONE_SPI +x21j.menu.serial.two_uart.build.serialcom_uart=TWO_UART +x21j.menu.serial.two_uart.build.serialcom_wire=ONE_WIRE +x21j.menu.serial.two_uart.build.serialcom_spi=ONE_SPI +x21j.menu.serial.two_uart_two_spi=TWO_UART_ONE_WIRE_TWO_SPI +x21j.menu.serial.two_uart_two_spi.build.serialcom_uart=TWO_UART +x21j.menu.serial.two_uart_two_spi.build.serialcom_wire=ONE_WIRE +x21j.menu.serial.two_uart_two_spi.build.serialcom_spi=TWO_SPI +x21j.menu.serial.two_uart_two_wire=TWO_UART_TWO_WIRE_ONE_SPI +x21j.menu.serial.two_uart_two_wire.build.serialcom_uart=TWO_UART +x21j.menu.serial.two_uart_two_wire.build.serialcom_wire=TWO_WIRE +x21j.menu.serial.two_uart_two_wire.build.serialcom_spi=ONE_SPI +x21j.menu.serial.three_uart=THREE_UART_ONE_WIRE_ONE_SPI +x21j.menu.serial.three_uart.build.serialcom_uart=THREE_UART +x21j.menu.serial.three_uart.build.serialcom_wire=ONE_WIRE +x21j.menu.serial.three_uart.build.serialcom_spi=ONE_SPI +x21j.menu.serial.three_uart_two_spi=THREE_UART_ONE_WIRE_TWO_SPI +x21j.menu.serial.three_uart_two_spi.build.serialcom_uart=THREE_UART +x21j.menu.serial.three_uart_two_spi.build.serialcom_wire=ONE_WIRE +x21j.menu.serial.three_uart_two_spi.build.serialcom_spi=TWO_SPI +x21j.menu.serial.three_uart_two_wire=THREE_UART_TWO_WIRE_ONE_SPI +x21j.menu.serial.three_uart_two_wire.build.serialcom_uart=THREE_UART +x21j.menu.serial.three_uart_two_wire.build.serialcom_wire=TWO_WIRE +x21j.menu.serial.three_uart_two_wire.build.serialcom_spi=ONE_SPI +x21j.menu.serial.no_uart=NO_UART_ONE_WIRE_ONE_SPI +x21j.menu.serial.no_uart.build.serialcom_uart=NO_UART +x21j.menu.serial.no_uart.build.serialcom_wire=ONE_WIRE +x21j.menu.serial.no_uart.build.serialcom_spi=ONE_SPI +x21j.menu.usb.cdc=CDC_ONLY +x21j.menu.usb.cdc.build.usbcom=CDC_ONLY +x21j.menu.usb.cdc.build.pid=0x6557 +x21j.menu.usb.cdc_hid=CDC_HID +x21j.menu.usb.cdc_hid.build.usbcom=CDC_HID +x21j.menu.usb.cdc_hid.build.pid=0x6856 +x21j.menu.usb.withcdc=WITH_CDC +x21j.menu.usb.withcdc.build.usbcom=WITH_CDC +x21j.menu.usb.withcdc.build.pid=0x6B41 +x21j.menu.usb.hid=HID_ONLY +x21j.menu.usb.hid.build.usbcom=HID_ONLY +x21j.menu.usb.hid.build.pid=0x6B40 +x21j.menu.usb.nocdc=WITHOUT_CDC +x21j.menu.usb.nocdc.build.usbcom=WITHOUT_CDC +x21j.menu.usb.nocdc.build.pid=0x6A0C +x21j.menu.usb.none=USB_DISABLED +x21j.menu.usb.none.build.usbcom=USB_DISABLED +x21j.menu.usb.none.build.pid=0x6856 + +# Generic D51G +d51g.name=Generic D51G +d51g.vid.0=0x16D0 +d51g.pid.0=0x7557 +d51g.vid.1=0x16D0 +d51g.pid.1=0x7856 +d51g.vid.2=0x16D0 +d51g.pid.2=0x7B41 +d51g.vid.3=0x16D0 +d51g.pid.3=0x7B40 +d51g.vid.4=0x16D0 +d51g.pid.4=0x7A0C +d51g.vid.5=0x16D0 +d51g.pid.5=0x7856 +d51g.build.usb_manufacturer="Fab Foundation" + +# KH mod +#d51g.build.board=SAMD_ZERO +d51g.build.board=__SAMD51__ +###### + +d51g.build.core=arduino + +# KH mod +#d51g.build.variant=Generic_D51G +d51g.build.variant=Generic_xx1G +###### + +d51g.build.variant_system_lib= +d51g.build.vid=0x16D0 +d51g.upload.protocol=sam-ba +d51g.bootloader.tool=openocd +d51g.menu.float.default=Print & String use auto-promoted doubles only +d51g.menu.float.default.build.floatconfig=FLOAT_BOTH_DOUBLES_ONLY +d51g.menu.float.print=Print uses separate singles and doubles +d51g.menu.float.print.build.floatconfig=FLOAT_PRINT_SINGLES_DOUBLES +d51g.menu.float.string=String uses separate singles and doubles +d51g.menu.float.string.build.floatconfig=FLOAT_STRING_SINGLES_DOUBLES +d51g.menu.float.both=Print & String use separate singles and doubles +d51g.menu.float.both.build.floatconfig=FLOAT_BOTH_SINGLES_DOUBLES +d51g.menu.config.disabled=config.h disabled +d51g.menu.config.disabled.build.buildconfig=CONFIG_H_DISABLED +d51g.menu.config.enabled=config.h enabled (mostly code size reductions) +d51g.menu.config.enabled.build.buildconfig=CONFIG_H_ENABLED +d51g.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED_OSCILLATOR +d51g.menu.clock.internal_usb.build.clockconfig=CLOCKCONFIG_INTERNAL_USB +d51g.menu.clock.internal=INTERNAL_OSCILLATOR +d51g.menu.clock.internal.build.clockconfig=CLOCKCONFIG_INTERNAL +d51g.menu.clock.crystal_32k=32KHZ_CRYSTAL +d51g.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32768HZ_CRYSTAL +d51g.menu.clock.crystal_hs=HIGH_SPEED_CRYSTAL +d51g.menu.clock.crystal_hs.build.clockconfig=CLOCKCONFIG_HS_CRYSTAL +d51g.menu.timer.timer_732Hz=732.4Hz (16-bit) +d51g.menu.timer.timer_732Hz.build.timerconfig=TIMER_732Hz +d51g.menu.timer.timer_366Hz=366.2Hz (16-bit) +d51g.menu.timer.timer_366Hz.build.timerconfig=TIMER_366Hz +d51g.menu.timer.timer_244Hz=244.1Hz (16-bit) +d51g.menu.timer.timer_244Hz.build.timerconfig=TIMER_244Hz +d51g.menu.timer.timer_183Hz=183.1Hz (16-bit) +d51g.menu.timer.timer_183Hz.build.timerconfig=TIMER_183Hz +d51g.menu.timer.timer_146Hz=146.5Hz (16-bit) +d51g.menu.timer.timer_146Hz.build.timerconfig=TIMER_146Hz +d51g.menu.timer.timer_122Hz=122.1Hz (16-bit) +d51g.menu.timer.timer_122Hz.build.timerconfig=TIMER_122Hz +d51g.menu.timer.timer_105Hz=104.6Hz (16-bit) +d51g.menu.timer.timer_105Hz.build.timerconfig=TIMER_105Hz +d51g.menu.timer.timer_81Hz=81.38Hz (16-bit) +d51g.menu.timer.timer_81Hz.build.timerconfig=TIMER_81Hz +d51g.menu.timer.timer_61Hz=61.04Hz (16-bit) +d51g.menu.timer.timer_61Hz.build.timerconfig=TIMER_61Hz +d51g.menu.timer.timer_31Hz=30.52Hz (16-bit) +d51g.menu.timer.timer_31Hz.build.timerconfig=TIMER_31Hz +d51g.menu.timer.timer_187500Hz=187500Hz (8-bit) +d51g.menu.timer.timer_187500Hz.build.timerconfig=TIMER_187500Hz +d51g.menu.timer.timer_93750Hz=93750Hz (8-bit) +d51g.menu.timer.timer_93750Hz.build.timerconfig=TIMER_93750Hz +d51g.menu.timer.timer_62500Hz=62500Hz (8-bit) +d51g.menu.timer.timer_62500Hz.build.timerconfig=TIMER_62500Hz +d51g.menu.timer.timer_37500Hz=37500Hz (8-bit) +d51g.menu.timer.timer_37500Hz.build.timerconfig=TIMER_37500Hz +d51g.menu.timer.timer_20833Hz=20833Hz (8-bit) +d51g.menu.timer.timer_20833Hz.build.timerconfig=TIMER_20833Hz +d51g.menu.timer.timer_12500Hz=12500Hz (8-bit) +d51g.menu.timer.timer_12500Hz.build.timerconfig=TIMER_12500Hz +d51g.menu.timer.timer_7500Hz=7500Hz (8-bit) +d51g.menu.timer.timer_7500Hz.build.timerconfig=TIMER_7500Hz +d51g.menu.timer.timer_4166Hz=4166Hz (8-bit) +d51g.menu.timer.timer_4166Hz.build.timerconfig=TIMER_4166Hz +d51g.menu.timer.timer_2930Hz=2930Hz (8-bit) +d51g.menu.timer.timer_2930Hz.build.timerconfig=TIMER_2930Hz +d51g.menu.timer.timer_1465Hz=1465Hz (16-bit) +d51g.menu.timer.timer_1465Hz.build.timerconfig=TIMER_1465Hz +d51g.menu.cpu.samd51g18a_120=SAMD51G18A_120MHz +d51g.menu.cpu.samd51g18a_120.upload.maximum_size=253952 +d51g.menu.cpu.samd51g18a_120.build.mcu=cortex-m4 +d51g.menu.cpu.samd51g18a_120.build.mathlib=arm_cortexM4lf_math +d51g.menu.cpu.samd51g18a_120.build.f_cpu=120000000L +d51g.menu.cpu.samd51g18a_120.build.usb_product="Xeno Mini D51" + +# KH mod +#d51g.menu.cpu.samd51g18a_120.build.extra_flags=-D__SAMD51G18A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 +#d51g.menu.cpu.samd51g18a_120.build.extra_flags=-D__SAMD51G18A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 -D__SAMD51__ +d51g.menu.cpu.samd51g18a_120.build.extra_flags=-D__SAMD51G18A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 -D__SAMD51__ +###### + + +d51g.menu.cpu.samd51g18a_120.build.ldscript=flash_m4f_256KB.ld +d51g.menu.cpu.samd51g18a_120.build.openocdscript=openocd_scripts/SAMD51G18A.cfg +d51g.menu.cpu.samd51g18a_120.bootloader.file=zero/binaries/sam_ba_SAMD51G18A.bin +d51g.menu.cpu.samd51g18a_48=SAMD51G18A_48MHz +d51g.menu.cpu.samd51g18a_48.upload.maximum_size=253952 +d51g.menu.cpu.samd51g18a_48.build.mcu=cortex-m4 +d51g.menu.cpu.samd51g18a_48.build.mathlib=arm_cortexM4lf_math +d51g.menu.cpu.samd51g18a_48.build.f_cpu=48000000L +d51g.menu.cpu.samd51g18a_48.build.usb_product="Xeno Mini D51" + +# KH mod +#d51g.menu.cpu.samd51g18a_48.build.extra_flags=-D__SAMD51G18A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 +d51g.menu.cpu.samd51g18a_48.build.extra_flags=-D__SAMD51G18A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 -D__SAMD51__ +###### + +d51g.menu.cpu.samd51g18a_48.build.ldscript=flash_m4f_256KB.ld +d51g.menu.cpu.samd51g18a_48.build.openocdscript=openocd_scripts/SAMD51G18A.cfg +d51g.menu.cpu.samd51g18a_48.bootloader.file=zero/binaries/sam_ba_SAMD51G18A.bin +d51g.menu.cpu.samd51g19a_120=SAMD51G19A_120MHz +d51g.menu.cpu.samd51g19a_120.upload.maximum_size=516096 +d51g.menu.cpu.samd51g19a_120.build.mcu=cortex-m4 +d51g.menu.cpu.samd51g19a_120.build.mathlib=arm_cortexM4lf_math +d51g.menu.cpu.samd51g19a_120.build.f_cpu=120000000L +d51g.menu.cpu.samd51g19a_120.build.usb_product="Xeno Mini D51" + +# KH mod +#d51g.menu.cpu.samd51g19a_120.build.extra_flags=-D__SAMD51G19A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 +d51g.menu.cpu.samd51g19a_120.build.extra_flags=-D__SAMD51G19A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 -D__SAMD51__ +###### + +d51g.menu.cpu.samd51g19a_120.build.ldscript=flash_m4f_512KB.ld +d51g.menu.cpu.samd51g19a_120.build.openocdscript=openocd_scripts/SAMD51G19A.cfg +d51g.menu.cpu.samd51g19a_120.bootloader.file=zero/binaries/sam_ba_SAMD51G19A.bin +d51g.menu.cpu.samd51g19a_48=SAMD51G19A_48MHz +d51g.menu.cpu.samd51g19a_48.upload.maximum_size=516096 +d51g.menu.cpu.samd51g19a_48.build.mcu=cortex-m4 +d51g.menu.cpu.samd51g19a_48.build.mathlib=arm_cortexM4lf_math +d51g.menu.cpu.samd51g19a_48.build.f_cpu=48000000L +d51g.menu.cpu.samd51g19a_48.build.usb_product="Xeno Mini D51" + +# KH mod +#d51g.menu.cpu.samd51g19a_48.build.extra_flags=-D__SAMD51G19A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 +d51g.menu.cpu.samd51g19a_48.build.extra_flags=-D__SAMD51G19A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 -D__SAMD51__ +###### + +d51g.menu.cpu.samd51g19a_48.build.ldscript=flash_m4f_512KB.ld +d51g.menu.cpu.samd51g19a_48.build.openocdscript=openocd_scripts/SAMD51G19A.cfg +d51g.menu.cpu.samd51g19a_48.bootloader.file=zero/binaries/sam_ba_SAMD51G19A.bin +d51g.menu.bootloader.8kb=8KB_BOOTLOADER +d51g.menu.bootloader.8kb.build.bootloader_size=__8KB_BOOTLOADER__ +d51g.menu.bootloader.8kb.build.ldscript_path=linker_scripts/gcc/8KB_Bootloader +d51g.menu.bootloader.8kb.upload.tool=Fab_SAM_Arduino:bossac +d51g.menu.bootloader.8kb.upload.use_1200bps_touch=true +d51g.menu.bootloader.8kb.upload.wait_for_upload_port=true +d51g.menu.bootloader.8kb.upload.native_usb=true +d51g.menu.bootloader.16kb=16KB_BOOTLOADER +d51g.menu.bootloader.16kb.build.bootloader_size=__16KB_BOOTLOADER__ +d51g.menu.bootloader.16kb.build.ldscript_path=linker_scripts/gcc/16KB_Bootloader +d51g.menu.bootloader.16kb.upload.tool=Fab_SAM_Arduino:bossac +d51g.menu.bootloader.16kb.upload.use_1200bps_touch=true +d51g.menu.bootloader.16kb.upload.wait_for_upload_port=true +d51g.menu.bootloader.16kb.upload.native_usb=true +d51g.menu.bootloader.0kb=NO_BOOTLOADER +d51g.menu.bootloader.0kb.build.bootloader_size=__NO_BOOTLOADER__ +d51g.menu.bootloader.0kb.build.ldscript_path=linker_scripts/gcc/No_Bootloader +d51g.menu.bootloader.0kb.upload.tool=openocd +d51g.menu.bootloader.0kb.upload.use_1200bps_touch=false +d51g.menu.bootloader.0kb.upload.wait_for_upload_port=false +d51g.menu.bootloader.0kb.upload.native_usb=false +d51g.menu.serial.one_uart=ONE_UART_ONE_WIRE_ONE_SPI +d51g.menu.serial.one_uart.build.serialcom_uart=ONE_UART +d51g.menu.serial.one_uart.build.serialcom_wire=ONE_WIRE +d51g.menu.serial.one_uart.build.serialcom_spi=ONE_SPI +d51g.menu.serial.one_uart_two_spi=ONE_UART_ONE_WIRE_TWO_SPI +d51g.menu.serial.one_uart_two_spi.build.serialcom_uart=ONE_UART +d51g.menu.serial.one_uart_two_spi.build.serialcom_wire=ONE_WIRE +d51g.menu.serial.one_uart_two_spi.build.serialcom_spi=TWO_SPI +d51g.menu.serial.one_uart_two_wire=ONE_UART_TWO_WIRE_ONE_SPI +d51g.menu.serial.one_uart_two_wire.build.serialcom_uart=ONE_UART +d51g.menu.serial.one_uart_two_wire.build.serialcom_wire=TWO_WIRE +d51g.menu.serial.one_uart_two_wire.build.serialcom_spi=ONE_SPI +d51g.menu.serial.two_uart=TWO_UART_ONE_WIRE_ONE_SPI +d51g.menu.serial.two_uart.build.serialcom_uart=TWO_UART +d51g.menu.serial.two_uart.build.serialcom_wire=ONE_WIRE +d51g.menu.serial.two_uart.build.serialcom_spi=ONE_SPI +d51g.menu.serial.two_uart_two_spi=TWO_UART_ONE_WIRE_TWO_SPI +d51g.menu.serial.two_uart_two_spi.build.serialcom_uart=TWO_UART +d51g.menu.serial.two_uart_two_spi.build.serialcom_wire=ONE_WIRE +d51g.menu.serial.two_uart_two_spi.build.serialcom_spi=TWO_SPI +d51g.menu.serial.two_uart_two_wire=TWO_UART_TWO_WIRE_ONE_SPI +d51g.menu.serial.two_uart_two_wire.build.serialcom_uart=TWO_UART +d51g.menu.serial.two_uart_two_wire.build.serialcom_wire=TWO_WIRE +d51g.menu.serial.two_uart_two_wire.build.serialcom_spi=ONE_SPI +d51g.menu.serial.three_uart=THREE_UART_ONE_WIRE_ONE_SPI +d51g.menu.serial.three_uart.build.serialcom_uart=THREE_UART +d51g.menu.serial.three_uart.build.serialcom_wire=ONE_WIRE +d51g.menu.serial.three_uart.build.serialcom_spi=ONE_SPI +d51g.menu.serial.three_uart_two_spi=THREE_UART_ONE_WIRE_TWO_SPI +d51g.menu.serial.three_uart_two_spi.build.serialcom_uart=THREE_UART +d51g.menu.serial.three_uart_two_spi.build.serialcom_wire=ONE_WIRE +d51g.menu.serial.three_uart_two_spi.build.serialcom_spi=TWO_SPI +d51g.menu.serial.three_uart_two_wire=THREE_UART_TWO_WIRE_ONE_SPI +d51g.menu.serial.three_uart_two_wire.build.serialcom_uart=THREE_UART +d51g.menu.serial.three_uart_two_wire.build.serialcom_wire=TWO_WIRE +d51g.menu.serial.three_uart_two_wire.build.serialcom_spi=ONE_SPI +d51g.menu.serial.no_uart=NO_UART_ONE_WIRE_ONE_SPI +d51g.menu.serial.no_uart.build.serialcom_uart=NO_UART +d51g.menu.serial.no_uart.build.serialcom_wire=ONE_WIRE +d51g.menu.serial.no_uart.build.serialcom_spi=ONE_SPI +d51g.menu.usb.cdc=CDC_ONLY +d51g.menu.usb.cdc.build.usbcom=CDC_ONLY +d51g.menu.usb.cdc.build.pid=0x7557 +d51g.menu.usb.cdc_hid=CDC_HID +d51g.menu.usb.cdc_hid.build.usbcom=CDC_HID +d51g.menu.usb.cdc_hid.build.pid=0x7856 +d51g.menu.usb.withcdc=WITH_CDC +d51g.menu.usb.withcdc.build.usbcom=WITH_CDC +d51g.menu.usb.withcdc.build.pid=0x7B41 +d51g.menu.usb.hid=HID_ONLY +d51g.menu.usb.hid.build.usbcom=HID_ONLY +d51g.menu.usb.hid.build.pid=0x7B40 +d51g.menu.usb.nocdc=WITHOUT_CDC +d51g.menu.usb.nocdc.build.usbcom=WITHOUT_CDC +d51g.menu.usb.nocdc.build.pid=0x7A0C +d51g.menu.usb.none=USB_DISABLED +d51g.menu.usb.none.build.usbcom=USB_DISABLED +d51g.menu.usb.none.build.pid=0x7856 + +# Generic D51J +d51j.name=Generic D51J +d51j.vid.0=0x16D0 +d51j.pid.0=0x8557 +d51j.vid.1=0x16D0 +d51j.pid.1=0x8856 +d51j.vid.2=0x16D0 +d51j.pid.2=0x8B41 +d51j.vid.3=0x16D0 +d51j.pid.3=0x8B40 +d51j.vid.4=0x16D0 +d51j.pid.4=0x8A0C +d51j.vid.5=0x16D0 +d51j.pid.5=0x8856 +d51j.build.usb_manufacturer="Fab Foundation" + +# KH mod +#d51j.build.board=SAMD_ZERO +d51j.build.board=__SAMD51__ +###### + +d51j.build.core=arduino +d51j.build.variant=Generic_xx1J +d51j.build.variant_system_lib= +d51j.build.vid=0x16D0 +d51j.upload.protocol=sam-ba +d51j.bootloader.tool=openocd +d51j.menu.float.default=Print & String use auto-promoted doubles only +d51j.menu.float.default.build.floatconfig=FLOAT_BOTH_DOUBLES_ONLY +d51j.menu.float.print=Print uses separate singles and doubles +d51j.menu.float.print.build.floatconfig=FLOAT_PRINT_SINGLES_DOUBLES +d51j.menu.float.string=String uses separate singles and doubles +d51j.menu.float.string.build.floatconfig=FLOAT_STRING_SINGLES_DOUBLES +d51j.menu.float.both=Print & String use separate singles and doubles +d51j.menu.float.both.build.floatconfig=FLOAT_BOTH_SINGLES_DOUBLES +d51j.menu.config.disabled=config.h disabled +d51j.menu.config.disabled.build.buildconfig=CONFIG_H_DISABLED +d51j.menu.config.enabled=config.h enabled (mostly code size reductions) +d51j.menu.config.enabled.build.buildconfig=CONFIG_H_ENABLED +d51j.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED_OSCILLATOR +d51j.menu.clock.internal_usb.build.clockconfig=CLOCKCONFIG_INTERNAL_USB +d51j.menu.clock.internal=INTERNAL_OSCILLATOR +d51j.menu.clock.internal.build.clockconfig=CLOCKCONFIG_INTERNAL +d51j.menu.clock.crystal_32k=32KHZ_CRYSTAL +d51j.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32768HZ_CRYSTAL +d51j.menu.clock.crystal_hs=HIGH_SPEED_CRYSTAL +d51j.menu.clock.crystal_hs.build.clockconfig=CLOCKCONFIG_HS_CRYSTAL +d51j.menu.timer.timer_732Hz=732.4Hz (16-bit) +d51j.menu.timer.timer_732Hz.build.timerconfig=TIMER_732Hz +d51j.menu.timer.timer_366Hz=366.2Hz (16-bit) +d51j.menu.timer.timer_366Hz.build.timerconfig=TIMER_366Hz +d51j.menu.timer.timer_244Hz=244.1Hz (16-bit) +d51j.menu.timer.timer_244Hz.build.timerconfig=TIMER_244Hz +d51j.menu.timer.timer_183Hz=183.1Hz (16-bit) +d51j.menu.timer.timer_183Hz.build.timerconfig=TIMER_183Hz +d51j.menu.timer.timer_146Hz=146.5Hz (16-bit) +d51j.menu.timer.timer_146Hz.build.timerconfig=TIMER_146Hz +d51j.menu.timer.timer_122Hz=122.1Hz (16-bit) +d51j.menu.timer.timer_122Hz.build.timerconfig=TIMER_122Hz +d51j.menu.timer.timer_105Hz=104.6Hz (16-bit) +d51j.menu.timer.timer_105Hz.build.timerconfig=TIMER_105Hz +d51j.menu.timer.timer_81Hz=81.38Hz (16-bit) +d51j.menu.timer.timer_81Hz.build.timerconfig=TIMER_81Hz +d51j.menu.timer.timer_61Hz=61.04Hz (16-bit) +d51j.menu.timer.timer_61Hz.build.timerconfig=TIMER_61Hz +d51j.menu.timer.timer_31Hz=30.52Hz (16-bit) +d51j.menu.timer.timer_31Hz.build.timerconfig=TIMER_31Hz +d51j.menu.timer.timer_187500Hz=187500Hz (8-bit) +d51j.menu.timer.timer_187500Hz.build.timerconfig=TIMER_187500Hz +d51j.menu.timer.timer_93750Hz=93750Hz (8-bit) +d51j.menu.timer.timer_93750Hz.build.timerconfig=TIMER_93750Hz +d51j.menu.timer.timer_62500Hz=62500Hz (8-bit) +d51j.menu.timer.timer_62500Hz.build.timerconfig=TIMER_62500Hz +d51j.menu.timer.timer_37500Hz=37500Hz (8-bit) +d51j.menu.timer.timer_37500Hz.build.timerconfig=TIMER_37500Hz +d51j.menu.timer.timer_20833Hz=20833Hz (8-bit) +d51j.menu.timer.timer_20833Hz.build.timerconfig=TIMER_20833Hz +d51j.menu.timer.timer_12500Hz=12500Hz (8-bit) +d51j.menu.timer.timer_12500Hz.build.timerconfig=TIMER_12500Hz +d51j.menu.timer.timer_7500Hz=7500Hz (8-bit) +d51j.menu.timer.timer_7500Hz.build.timerconfig=TIMER_7500Hz +d51j.menu.timer.timer_4166Hz=4166Hz (8-bit) +d51j.menu.timer.timer_4166Hz.build.timerconfig=TIMER_4166Hz +d51j.menu.timer.timer_2930Hz=2930Hz (8-bit) +d51j.menu.timer.timer_2930Hz.build.timerconfig=TIMER_2930Hz +d51j.menu.timer.timer_1465Hz=1465Hz (16-bit) +d51j.menu.timer.timer_1465Hz.build.timerconfig=TIMER_1465Hz +d51j.menu.cpu.samd51j18a_120=SAMD51J18A_120MHz +d51j.menu.cpu.samd51j18a_120.upload.maximum_size=253952 +d51j.menu.cpu.samd51j18a_120.build.mcu=cortex-m4 +d51j.menu.cpu.samd51j18a_120.build.mathlib=arm_cortexM4lf_math +d51j.menu.cpu.samd51j18a_120.build.f_cpu=120000000L +d51j.menu.cpu.samd51j18a_120.build.usb_product="Xeno D51" + +# KH mod +#d51j.menu.cpu.samd51j18a_120.build.extra_flags=-D__SAMD51J18A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 +d51j.menu.cpu.samd51j18a_120.build.extra_flags=-D__SAMD51J18A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 -D__SAMD51__ +###### + +d51j.menu.cpu.samd51j18a_120.build.ldscript=flash_m4f_256KB.ld +d51j.menu.cpu.samd51j18a_120.build.openocdscript=openocd_scripts/SAMD51J18A.cfg +d51j.menu.cpu.samd51j18a_120.bootloader.file=zero/binaries/sam_ba_SAMD51J18A.bin +d51j.menu.cpu.samd51j18a_48=SAMD51J18A_48MHz +d51j.menu.cpu.samd51j18a_48.upload.maximum_size=253952 +d51j.menu.cpu.samd51j18a_48.build.mcu=cortex-m4 +d51j.menu.cpu.samd51j18a_48.build.mathlib=arm_cortexM4lf_math +d51j.menu.cpu.samd51j18a_48.build.f_cpu=48000000L +d51j.menu.cpu.samd51j18a_48.build.usb_product="Xeno D51" + +# KH mod +#d51j.menu.cpu.samd51j18a_48.build.extra_flags=-D__SAMD51J18A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 +d51j.menu.cpu.samd51j18a_48.build.extra_flags=-D__SAMD51J18A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 -D__SAMD51__ +###### + +d51j.menu.cpu.samd51j18a_48.build.ldscript=flash_m4f_256KB.ld +d51j.menu.cpu.samd51j18a_48.build.openocdscript=openocd_scripts/SAMD51J18A.cfg +d51j.menu.cpu.samd51j18a_48.bootloader.file=zero/binaries/sam_ba_SAMD51J18A.bin +d51j.menu.cpu.samd51j19a_120=SAMD51J19A_120MHz +d51j.menu.cpu.samd51j19a_120.upload.maximum_size=516096 +d51j.menu.cpu.samd51j19a_120.build.mcu=cortex-m4 +d51j.menu.cpu.samd51j19a_120.build.mathlib=arm_cortexM4lf_math +d51j.menu.cpu.samd51j19a_120.build.f_cpu=120000000L +d51j.menu.cpu.samd51j19a_120.build.usb_product="Xeno D51" + +# KH mod +#d51j.menu.cpu.samd51j19a_120.build.extra_flags=-D__SAMD51J19A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 +d51j.menu.cpu.samd51j19a_120.build.extra_flags=-D__SAMD51J19A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 -D__SAMD51__ +###### + +d51j.menu.cpu.samd51j19a_120.build.ldscript=flash_m4f_512KB.ld +d51j.menu.cpu.samd51j19a_120.build.openocdscript=openocd_scripts/SAMD51J19A.cfg +d51j.menu.cpu.samd51j19a_120.bootloader.file=zero/binaries/sam_ba_SAMD51J19A.bin +d51j.menu.cpu.samd51j19a_48=SAMD51J19A_48MHz +d51j.menu.cpu.samd51j19a_48.upload.maximum_size=516096 +d51j.menu.cpu.samd51j19a_48.build.mcu=cortex-m4 +d51j.menu.cpu.samd51j19a_48.build.mathlib=arm_cortexM4lf_math +d51j.menu.cpu.samd51j19a_48.build.f_cpu=48000000L +d51j.menu.cpu.samd51j19a_48.build.usb_product="Xeno D51" + +# KH mod +#d51j.menu.cpu.samd51j19a_48.build.extra_flags=-D__SAMD51J19A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 +d51j.menu.cpu.samd51j19a_48.build.extra_flags=-D__SAMD51J19A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 -D__SAMD51__ +###### + +d51j.menu.cpu.samd51j19a_48.build.ldscript=flash_m4f_512KB.ld +d51j.menu.cpu.samd51j19a_48.build.openocdscript=openocd_scripts/SAMD51J19A.cfg +d51j.menu.cpu.samd51j19a_48.bootloader.file=zero/binaries/sam_ba_SAMD51J19A.bin +d51j.menu.cpu.samd51j20a_120=SAMD51J20A_120MHz +d51j.menu.cpu.samd51j20a_120.upload.maximum_size=1040384 +d51j.menu.cpu.samd51j20a_120.build.mcu=cortex-m4 +d51j.menu.cpu.samd51j20a_120.build.mathlib=arm_cortexM4lf_math +d51j.menu.cpu.samd51j20a_120.build.f_cpu=120000000L +d51j.menu.cpu.samd51j20a_120.build.usb_product="Xeno D51" + +# KH mod +#d51j.menu.cpu.samd51j20a_120.build.extra_flags=-D__SAMD51J20A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 +d51j.menu.cpu.samd51j20a_120.build.extra_flags=-D__SAMD51J20A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 -D__SAMD51__ +###### + +d51j.menu.cpu.samd51j20a_120.build.ldscript=flash_m4f_1MB.ld +d51j.menu.cpu.samd51j20a_120.build.openocdscript=openocd_scripts/SAMD51J20A.cfg +d51j.menu.cpu.samd51j20a_120.bootloader.file=zero/binaries/sam_ba_SAMD51J20A.bin +d51j.menu.cpu.samd51j20a_48=SAMD51J20A_48MHz +d51j.menu.cpu.samd51j20a_48.upload.maximum_size=1040384 +d51j.menu.cpu.samd51j20a_48.build.mcu=cortex-m4 +d51j.menu.cpu.samd51j20a_48.build.mathlib=arm_cortexM4lf_math +d51j.menu.cpu.samd51j20a_48.build.f_cpu=48000000L +d51j.menu.cpu.samd51j20a_48.build.usb_product="Xeno D51" + +# KH mod +#d51j.menu.cpu.samd51j20a_48.build.extra_flags=-D__SAMD51J20A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 +d51j.menu.cpu.samd51j20a_48.build.extra_flags=-D__SAMD51J20A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 -D__SAMD51__ +###### + +d51j.menu.cpu.samd51j20a_48.build.ldscript=flash_m4f_1MB.ld +d51j.menu.cpu.samd51j20a_48.build.openocdscript=openocd_scripts/SAMD51J20A.cfg +d51j.menu.cpu.samd51j20a_48.bootloader.file=zero/binaries/sam_ba_SAMD51J20A.bin +d51j.menu.bootloader.8kb=8KB_BOOTLOADER +d51j.menu.bootloader.8kb.build.bootloader_size=__8KB_BOOTLOADER__ +d51j.menu.bootloader.8kb.build.ldscript_path=linker_scripts/gcc/8KB_Bootloader +d51j.menu.bootloader.8kb.upload.tool=Fab_SAM_Arduino:bossac +d51j.menu.bootloader.8kb.upload.use_1200bps_touch=true +d51j.menu.bootloader.8kb.upload.wait_for_upload_port=true +d51j.menu.bootloader.8kb.upload.native_usb=true +d51j.menu.bootloader.16kb=16KB_BOOTLOADER +d51j.menu.bootloader.16kb.build.bootloader_size=__16KB_BOOTLOADER__ +d51j.menu.bootloader.16kb.build.ldscript_path=linker_scripts/gcc/16KB_Bootloader +d51j.menu.bootloader.16kb.upload.tool=Fab_SAM_Arduino:bossac +d51j.menu.bootloader.16kb.upload.use_1200bps_touch=true +d51j.menu.bootloader.16kb.upload.wait_for_upload_port=true +d51j.menu.bootloader.16kb.upload.native_usb=true +d51j.menu.bootloader.0kb=NO_BOOTLOADER +d51j.menu.bootloader.0kb.build.bootloader_size=__NO_BOOTLOADER__ +d51j.menu.bootloader.0kb.build.ldscript_path=linker_scripts/gcc/No_Bootloader +d51j.menu.bootloader.0kb.upload.tool=openocd +d51j.menu.bootloader.0kb.upload.use_1200bps_touch=false +d51j.menu.bootloader.0kb.upload.wait_for_upload_port=false +d51j.menu.bootloader.0kb.upload.native_usb=false +d51j.menu.serial.one_uart=ONE_UART_ONE_WIRE_ONE_SPI +d51j.menu.serial.one_uart.build.serialcom_uart=ONE_UART +d51j.menu.serial.one_uart.build.serialcom_wire=ONE_WIRE +d51j.menu.serial.one_uart.build.serialcom_spi=ONE_SPI +d51j.menu.serial.one_uart_two_spi=ONE_UART_ONE_WIRE_TWO_SPI +d51j.menu.serial.one_uart_two_spi.build.serialcom_uart=ONE_UART +d51j.menu.serial.one_uart_two_spi.build.serialcom_wire=ONE_WIRE +d51j.menu.serial.one_uart_two_spi.build.serialcom_spi=TWO_SPI +d51j.menu.serial.one_uart_two_wire=ONE_UART_TWO_WIRE_ONE_SPI +d51j.menu.serial.one_uart_two_wire.build.serialcom_uart=ONE_UART +d51j.menu.serial.one_uart_two_wire.build.serialcom_wire=TWO_WIRE +d51j.menu.serial.one_uart_two_wire.build.serialcom_spi=ONE_SPI +d51j.menu.serial.two_uart=TWO_UART_ONE_WIRE_ONE_SPI +d51j.menu.serial.two_uart.build.serialcom_uart=TWO_UART +d51j.menu.serial.two_uart.build.serialcom_wire=ONE_WIRE +d51j.menu.serial.two_uart.build.serialcom_spi=ONE_SPI +d51j.menu.serial.two_uart_two_spi=TWO_UART_ONE_WIRE_TWO_SPI +d51j.menu.serial.two_uart_two_spi.build.serialcom_uart=TWO_UART +d51j.menu.serial.two_uart_two_spi.build.serialcom_wire=ONE_WIRE +d51j.menu.serial.two_uart_two_spi.build.serialcom_spi=TWO_SPI +d51j.menu.serial.two_uart_two_wire=TWO_UART_TWO_WIRE_ONE_SPI +d51j.menu.serial.two_uart_two_wire.build.serialcom_uart=TWO_UART +d51j.menu.serial.two_uart_two_wire.build.serialcom_wire=TWO_WIRE +d51j.menu.serial.two_uart_two_wire.build.serialcom_spi=ONE_SPI +d51j.menu.serial.three_uart=THREE_UART_ONE_WIRE_ONE_SPI +d51j.menu.serial.three_uart.build.serialcom_uart=THREE_UART +d51j.menu.serial.three_uart.build.serialcom_wire=ONE_WIRE +d51j.menu.serial.three_uart.build.serialcom_spi=ONE_SPI +d51j.menu.serial.three_uart_two_spi=THREE_UART_ONE_WIRE_TWO_SPI +d51j.menu.serial.three_uart_two_spi.build.serialcom_uart=THREE_UART +d51j.menu.serial.three_uart_two_spi.build.serialcom_wire=ONE_WIRE +d51j.menu.serial.three_uart_two_spi.build.serialcom_spi=TWO_SPI +d51j.menu.serial.three_uart_two_wire=THREE_UART_TWO_WIRE_ONE_SPI +d51j.menu.serial.three_uart_two_wire.build.serialcom_uart=THREE_UART +d51j.menu.serial.three_uart_two_wire.build.serialcom_wire=TWO_WIRE +d51j.menu.serial.three_uart_two_wire.build.serialcom_spi=ONE_SPI +d51j.menu.serial.no_uart=NO_UART_ONE_WIRE_ONE_SPI +d51j.menu.serial.no_uart.build.serialcom_uart=NO_UART +d51j.menu.serial.no_uart.build.serialcom_wire=ONE_WIRE +d51j.menu.serial.no_uart.build.serialcom_spi=ONE_SPI +d51j.menu.usb.cdc=CDC_ONLY +d51j.menu.usb.cdc.build.usbcom=CDC_ONLY +d51j.menu.usb.cdc.build.pid=0x8557 +d51j.menu.usb.cdc_hid=CDC_HID +d51j.menu.usb.cdc_hid.build.usbcom=CDC_HID +d51j.menu.usb.cdc_hid.build.pid=0x8856 +d51j.menu.usb.withcdc=WITH_CDC +d51j.menu.usb.withcdc.build.usbcom=WITH_CDC +d51j.menu.usb.withcdc.build.pid=0x8B41 +d51j.menu.usb.hid=HID_ONLY +d51j.menu.usb.hid.build.usbcom=HID_ONLY +d51j.menu.usb.hid.build.pid=0x8B40 +d51j.menu.usb.nocdc=WITHOUT_CDC +d51j.menu.usb.nocdc.build.usbcom=WITHOUT_CDC +d51j.menu.usb.nocdc.build.pid=0x8A0C +d51j.menu.usb.none=USB_DISABLED +d51j.menu.usb.none.build.usbcom=USB_DISABLED +d51j.menu.usb.none.build.pid=0x8856 diff --git a/Packages_Patches/Maixduino/hardware/k210/0.3.10/cores/arduino/Stream.h b/Packages_Patches/Maixduino/hardware/k210/0.3.10/cores/arduino/Stream.h index a7479d0a..490a2bad 100644 --- a/Packages_Patches/Maixduino/hardware/k210/0.3.10/cores/arduino/Stream.h +++ b/Packages_Patches/Maixduino/hardware/k210/0.3.10/cores/arduino/Stream.h @@ -1,129 +1,164 @@ -/* - Stream.h - base class for character-based streams. - Copyright (c) 2010 David A. Mellis. All right reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - parsing functions based on TextFinder library by Michael Margolis -*/ - -#ifndef Stream_h -#define Stream_h - -#include -#include "Print.h" - -// compatability macros for testing -/* -#define getInt() parseInt() -#define getInt(ignore) parseInt(ignore) -#define getFloat() parseFloat() -#define getFloat(ignore) parseFloat(ignore) -#define getString( pre_string, post_string, buffer, length) -readBytesBetween( pre_string, terminator, buffer, length) -*/ - -// This enumeration provides the lookahead options for parseInt(), parseFloat() -// The rules set out here are used until either the first valid character is found -// or a time out occurs due to lack of input. -enum LookaheadMode{ - SKIP_ALL, // All invalid characters are ignored. - SKIP_NONE, // Nothing is skipped, and the stream is not touched unless the first waiting character is valid. - SKIP_WHITESPACE // Only tabs, spaces, line feeds & carriage returns are skipped. -}; - -#define NO_IGNORE_CHAR '\x01' // a char not found in a valid ASCII numeric field - -class Stream : public Print -{ - protected: - unsigned long _timeout; // number of milliseconds to wait for the next char before aborting timed read - unsigned long _startMillis = 0; // used for timeout measurement - int timedRead(); // read stream with timeout - int timedPeek(); // peek stream with timeout - int peekNextDigit(LookaheadMode lookahead, bool detectDecimal); // returns the next numeric digit in the stream or -1 if timeout - - public: - virtual int available() = 0; - virtual int read() = 0; - virtual int peek() = 0; - - Stream() {_timeout=1000;} - -// parsing methods - - void setTimeout(unsigned long timeout); // sets maximum milliseconds to wait for stream data, default is 1 second - unsigned long getTimeout(void) { return _timeout; } - - bool find(char *target); // reads data from the stream until the target string is found - bool find(uint8_t *target) { return find ((char *)target); } - // returns true if target string is found, false if timed out (see setTimeout) - - bool find(char *target, size_t length); // reads data from the stream until the target string of given length is found - bool find(uint8_t *target, size_t length) { return find ((char *)target, length); } - // returns true if target string is found, false if timed out - - bool find(char target) { return find (&target, 1); } - - bool findUntil(char *target, char *terminator); // as find but search ends if the terminator string is found - bool findUntil(uint8_t *target, char *terminator) { return findUntil((char *)target, terminator); } - - bool findUntil(char *target, size_t targetLen, char *terminate, size_t termLen); // as above but search ends if the terminate string is found - bool findUntil(uint8_t *target, size_t targetLen, char *terminate, size_t termLen) {return findUntil((char *)target, targetLen, terminate, termLen); } - - long parseInt(LookaheadMode lookahead = SKIP_ALL, char ignore = NO_IGNORE_CHAR); - // returns the first valid (long) integer value from the current position. - // lookahead determines how parseInt looks ahead in the stream. - // See LookaheadMode enumeration at the top of the file. - // Lookahead is terminated by the first character that is not a valid part of an integer. - // Once parsing commences, 'ignore' will be skipped in the stream. - - float parseFloat(LookaheadMode lookahead = SKIP_ALL, char ignore = NO_IGNORE_CHAR); - // float version of parseInt - - size_t readBytes( char *buffer, size_t length); // read chars from stream into buffer - size_t readBytes( uint8_t *buffer, size_t length) { return readBytes((char *)buffer, length); } - // terminates if length characters have been read or timeout (see setTimeout) - // returns the number of characters placed in the buffer (0 means no valid data found) - - size_t readBytesUntil( char terminator, char *buffer, size_t length); // as readBytes with terminator character - size_t readBytesUntil( char terminator, uint8_t *buffer, size_t length) { return readBytesUntil(terminator, (char *)buffer, length); } - // terminates if length characters have been read, timeout, or if the terminator character detected - // returns the number of characters placed in the buffer (0 means no valid data found) - - // Arduino String functions to be added here - String readString(); - String readStringUntil(char terminator); - - protected: - long parseInt(char ignore) { return parseInt(SKIP_ALL, ignore); } - float parseFloat(char ignore) { return parseFloat(SKIP_ALL, ignore); } - // These overload exists for compatibility with any class that has derived - // Stream and used parseFloat/Int with a custom ignore character. To keep - // the public API simple, these overload remains protected. - - struct MultiTarget { - const char *str; // string you're searching for - size_t len; // length of string you're searching for - size_t index; // index used by the search routine. - }; - - // This allows you to search for an arbitrary number of strings. - // Returns index of the target that is found first or -1 if timeout occurs. - int findMulti(struct MultiTarget *targets, int tCount); -}; - -#undef NO_IGNORE_CHAR -#endif +/* + Stream.h - base class for character-based streams. + Copyright (c) 2010 David A. Mellis. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + parsing functions based on TextFinder library by Michael Margolis +*/ + +#ifndef Stream_h +#define Stream_h + +#include +#include "Print.h" + +// compatability macros for testing +/* + #define getInt() parseInt() + #define getInt(ignore) parseInt(ignore) + #define getFloat() parseFloat() + #define getFloat(ignore) parseFloat(ignore) + #define getString( pre_string, post_string, buffer, length) + readBytesBetween( pre_string, terminator, buffer, length) +*/ + +// This enumeration provides the lookahead options for parseInt(), parseFloat() +// The rules set out here are used until either the first valid character is found +// or a time out occurs due to lack of input. +enum LookaheadMode +{ + SKIP_ALL, // All invalid characters are ignored. + SKIP_NONE, // Nothing is skipped, and the stream is not touched unless the first waiting character is valid. + SKIP_WHITESPACE // Only tabs, spaces, line feeds & carriage returns are skipped. +}; + +#define NO_IGNORE_CHAR '\x01' // a char not found in a valid ASCII numeric field + +class Stream : public Print +{ + protected: + unsigned long _timeout; // number of milliseconds to wait for the next char before aborting timed read + unsigned long _startMillis = 0; // used for timeout measurement + int timedRead(); // read stream with timeout + int timedPeek(); // peek stream with timeout + int peekNextDigit(LookaheadMode lookahead, bool detectDecimal); // returns the next numeric digit in the stream or -1 if timeout + + public: + virtual int available() = 0; + virtual int read() = 0; + virtual int peek() = 0; + + Stream() + { + _timeout = 1000; + } + + // parsing methods + + void setTimeout(unsigned long timeout); // sets maximum milliseconds to wait for stream data, default is 1 second + unsigned long getTimeout(void) + { + return _timeout; + } + + bool find(char *target); // reads data from the stream until the target string is found + bool find(uint8_t *target) + { + return find ((char *)target); + } + // returns true if target string is found, false if timed out (see setTimeout) + + bool find(char *target, size_t length); // reads data from the stream until the target string of given length is found + bool find(uint8_t *target, size_t length) + { + return find ((char *)target, length); + } + // returns true if target string is found, false if timed out + + bool find(char target) + { + return find (&target, 1); + } + + bool findUntil(char *target, char *terminator); // as find but search ends if the terminator string is found + bool findUntil(uint8_t *target, char *terminator) + { + return findUntil((char *)target, terminator); + } + + bool findUntil(char *target, size_t targetLen, char *terminate, size_t termLen); // as above but search ends if the terminate string is found + bool findUntil(uint8_t *target, size_t targetLen, char *terminate, size_t termLen) + { + return findUntil((char *)target, targetLen, terminate, termLen); + } + + long parseInt(LookaheadMode lookahead = SKIP_ALL, char ignore = NO_IGNORE_CHAR); + // returns the first valid (long) integer value from the current position. + // lookahead determines how parseInt looks ahead in the stream. + // See LookaheadMode enumeration at the top of the file. + // Lookahead is terminated by the first character that is not a valid part of an integer. + // Once parsing commences, 'ignore' will be skipped in the stream. + + float parseFloat(LookaheadMode lookahead = SKIP_ALL, char ignore = NO_IGNORE_CHAR); + // float version of parseInt + + size_t readBytes( char *buffer, size_t length); // read chars from stream into buffer + size_t readBytes( uint8_t *buffer, size_t length) + { + return readBytes((char *)buffer, length); + } + // terminates if length characters have been read or timeout (see setTimeout) + // returns the number of characters placed in the buffer (0 means no valid data found) + + size_t readBytesUntil( char terminator, char *buffer, size_t length); // as readBytes with terminator character + size_t readBytesUntil( char terminator, uint8_t *buffer, size_t length) + { + return readBytesUntil(terminator, (char *)buffer, length); + } + // terminates if length characters have been read, timeout, or if the terminator character detected + // returns the number of characters placed in the buffer (0 means no valid data found) + + // Arduino String functions to be added here + String readString(); + String readStringUntil(char terminator); + + protected: + long parseInt(char ignore) + { + return parseInt(SKIP_ALL, ignore); + } + float parseFloat(char ignore) + { + return parseFloat(SKIP_ALL, ignore); + } + // These overload exists for compatibility with any class that has derived + // Stream and used parseFloat/Int with a custom ignore character. To keep + // the public API simple, these overload remains protected. + + struct MultiTarget + { + const char *str; // string you're searching for + size_t len; // length of string you're searching for + size_t index; // index used by the search routine. + }; + + // This allows you to search for an arbitrary number of strings. + // Returns index of the target that is found first or -1 if timeout occurs. + int findMulti(struct MultiTarget *targets, int tCount); +}; + +#undef NO_IGNORE_CHAR +#endif diff --git a/Packages_Patches/Maixduino/hardware/k210/0.3.11/cores/arduino/Stream.h b/Packages_Patches/Maixduino/hardware/k210/0.3.11/cores/arduino/Stream.h index a7479d0a..490a2bad 100644 --- a/Packages_Patches/Maixduino/hardware/k210/0.3.11/cores/arduino/Stream.h +++ b/Packages_Patches/Maixduino/hardware/k210/0.3.11/cores/arduino/Stream.h @@ -1,129 +1,164 @@ -/* - Stream.h - base class for character-based streams. - Copyright (c) 2010 David A. Mellis. All right reserved. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - parsing functions based on TextFinder library by Michael Margolis -*/ - -#ifndef Stream_h -#define Stream_h - -#include -#include "Print.h" - -// compatability macros for testing -/* -#define getInt() parseInt() -#define getInt(ignore) parseInt(ignore) -#define getFloat() parseFloat() -#define getFloat(ignore) parseFloat(ignore) -#define getString( pre_string, post_string, buffer, length) -readBytesBetween( pre_string, terminator, buffer, length) -*/ - -// This enumeration provides the lookahead options for parseInt(), parseFloat() -// The rules set out here are used until either the first valid character is found -// or a time out occurs due to lack of input. -enum LookaheadMode{ - SKIP_ALL, // All invalid characters are ignored. - SKIP_NONE, // Nothing is skipped, and the stream is not touched unless the first waiting character is valid. - SKIP_WHITESPACE // Only tabs, spaces, line feeds & carriage returns are skipped. -}; - -#define NO_IGNORE_CHAR '\x01' // a char not found in a valid ASCII numeric field - -class Stream : public Print -{ - protected: - unsigned long _timeout; // number of milliseconds to wait for the next char before aborting timed read - unsigned long _startMillis = 0; // used for timeout measurement - int timedRead(); // read stream with timeout - int timedPeek(); // peek stream with timeout - int peekNextDigit(LookaheadMode lookahead, bool detectDecimal); // returns the next numeric digit in the stream or -1 if timeout - - public: - virtual int available() = 0; - virtual int read() = 0; - virtual int peek() = 0; - - Stream() {_timeout=1000;} - -// parsing methods - - void setTimeout(unsigned long timeout); // sets maximum milliseconds to wait for stream data, default is 1 second - unsigned long getTimeout(void) { return _timeout; } - - bool find(char *target); // reads data from the stream until the target string is found - bool find(uint8_t *target) { return find ((char *)target); } - // returns true if target string is found, false if timed out (see setTimeout) - - bool find(char *target, size_t length); // reads data from the stream until the target string of given length is found - bool find(uint8_t *target, size_t length) { return find ((char *)target, length); } - // returns true if target string is found, false if timed out - - bool find(char target) { return find (&target, 1); } - - bool findUntil(char *target, char *terminator); // as find but search ends if the terminator string is found - bool findUntil(uint8_t *target, char *terminator) { return findUntil((char *)target, terminator); } - - bool findUntil(char *target, size_t targetLen, char *terminate, size_t termLen); // as above but search ends if the terminate string is found - bool findUntil(uint8_t *target, size_t targetLen, char *terminate, size_t termLen) {return findUntil((char *)target, targetLen, terminate, termLen); } - - long parseInt(LookaheadMode lookahead = SKIP_ALL, char ignore = NO_IGNORE_CHAR); - // returns the first valid (long) integer value from the current position. - // lookahead determines how parseInt looks ahead in the stream. - // See LookaheadMode enumeration at the top of the file. - // Lookahead is terminated by the first character that is not a valid part of an integer. - // Once parsing commences, 'ignore' will be skipped in the stream. - - float parseFloat(LookaheadMode lookahead = SKIP_ALL, char ignore = NO_IGNORE_CHAR); - // float version of parseInt - - size_t readBytes( char *buffer, size_t length); // read chars from stream into buffer - size_t readBytes( uint8_t *buffer, size_t length) { return readBytes((char *)buffer, length); } - // terminates if length characters have been read or timeout (see setTimeout) - // returns the number of characters placed in the buffer (0 means no valid data found) - - size_t readBytesUntil( char terminator, char *buffer, size_t length); // as readBytes with terminator character - size_t readBytesUntil( char terminator, uint8_t *buffer, size_t length) { return readBytesUntil(terminator, (char *)buffer, length); } - // terminates if length characters have been read, timeout, or if the terminator character detected - // returns the number of characters placed in the buffer (0 means no valid data found) - - // Arduino String functions to be added here - String readString(); - String readStringUntil(char terminator); - - protected: - long parseInt(char ignore) { return parseInt(SKIP_ALL, ignore); } - float parseFloat(char ignore) { return parseFloat(SKIP_ALL, ignore); } - // These overload exists for compatibility with any class that has derived - // Stream and used parseFloat/Int with a custom ignore character. To keep - // the public API simple, these overload remains protected. - - struct MultiTarget { - const char *str; // string you're searching for - size_t len; // length of string you're searching for - size_t index; // index used by the search routine. - }; - - // This allows you to search for an arbitrary number of strings. - // Returns index of the target that is found first or -1 if timeout occurs. - int findMulti(struct MultiTarget *targets, int tCount); -}; - -#undef NO_IGNORE_CHAR -#endif +/* + Stream.h - base class for character-based streams. + Copyright (c) 2010 David A. Mellis. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + parsing functions based on TextFinder library by Michael Margolis +*/ + +#ifndef Stream_h +#define Stream_h + +#include +#include "Print.h" + +// compatability macros for testing +/* + #define getInt() parseInt() + #define getInt(ignore) parseInt(ignore) + #define getFloat() parseFloat() + #define getFloat(ignore) parseFloat(ignore) + #define getString( pre_string, post_string, buffer, length) + readBytesBetween( pre_string, terminator, buffer, length) +*/ + +// This enumeration provides the lookahead options for parseInt(), parseFloat() +// The rules set out here are used until either the first valid character is found +// or a time out occurs due to lack of input. +enum LookaheadMode +{ + SKIP_ALL, // All invalid characters are ignored. + SKIP_NONE, // Nothing is skipped, and the stream is not touched unless the first waiting character is valid. + SKIP_WHITESPACE // Only tabs, spaces, line feeds & carriage returns are skipped. +}; + +#define NO_IGNORE_CHAR '\x01' // a char not found in a valid ASCII numeric field + +class Stream : public Print +{ + protected: + unsigned long _timeout; // number of milliseconds to wait for the next char before aborting timed read + unsigned long _startMillis = 0; // used for timeout measurement + int timedRead(); // read stream with timeout + int timedPeek(); // peek stream with timeout + int peekNextDigit(LookaheadMode lookahead, bool detectDecimal); // returns the next numeric digit in the stream or -1 if timeout + + public: + virtual int available() = 0; + virtual int read() = 0; + virtual int peek() = 0; + + Stream() + { + _timeout = 1000; + } + + // parsing methods + + void setTimeout(unsigned long timeout); // sets maximum milliseconds to wait for stream data, default is 1 second + unsigned long getTimeout(void) + { + return _timeout; + } + + bool find(char *target); // reads data from the stream until the target string is found + bool find(uint8_t *target) + { + return find ((char *)target); + } + // returns true if target string is found, false if timed out (see setTimeout) + + bool find(char *target, size_t length); // reads data from the stream until the target string of given length is found + bool find(uint8_t *target, size_t length) + { + return find ((char *)target, length); + } + // returns true if target string is found, false if timed out + + bool find(char target) + { + return find (&target, 1); + } + + bool findUntil(char *target, char *terminator); // as find but search ends if the terminator string is found + bool findUntil(uint8_t *target, char *terminator) + { + return findUntil((char *)target, terminator); + } + + bool findUntil(char *target, size_t targetLen, char *terminate, size_t termLen); // as above but search ends if the terminate string is found + bool findUntil(uint8_t *target, size_t targetLen, char *terminate, size_t termLen) + { + return findUntil((char *)target, targetLen, terminate, termLen); + } + + long parseInt(LookaheadMode lookahead = SKIP_ALL, char ignore = NO_IGNORE_CHAR); + // returns the first valid (long) integer value from the current position. + // lookahead determines how parseInt looks ahead in the stream. + // See LookaheadMode enumeration at the top of the file. + // Lookahead is terminated by the first character that is not a valid part of an integer. + // Once parsing commences, 'ignore' will be skipped in the stream. + + float parseFloat(LookaheadMode lookahead = SKIP_ALL, char ignore = NO_IGNORE_CHAR); + // float version of parseInt + + size_t readBytes( char *buffer, size_t length); // read chars from stream into buffer + size_t readBytes( uint8_t *buffer, size_t length) + { + return readBytes((char *)buffer, length); + } + // terminates if length characters have been read or timeout (see setTimeout) + // returns the number of characters placed in the buffer (0 means no valid data found) + + size_t readBytesUntil( char terminator, char *buffer, size_t length); // as readBytes with terminator character + size_t readBytesUntil( char terminator, uint8_t *buffer, size_t length) + { + return readBytesUntil(terminator, (char *)buffer, length); + } + // terminates if length characters have been read, timeout, or if the terminator character detected + // returns the number of characters placed in the buffer (0 means no valid data found) + + // Arduino String functions to be added here + String readString(); + String readStringUntil(char terminator); + + protected: + long parseInt(char ignore) + { + return parseInt(SKIP_ALL, ignore); + } + float parseFloat(char ignore) + { + return parseFloat(SKIP_ALL, ignore); + } + // These overload exists for compatibility with any class that has derived + // Stream and used parseFloat/Int with a custom ignore character. To keep + // the public API simple, these overload remains protected. + + struct MultiTarget + { + const char *str; // string you're searching for + size_t len; // length of string you're searching for + size_t index; // index used by the search routine. + }; + + // This allows you to search for an arbitrary number of strings. + // Returns index of the target that is found first or -1 if timeout occurs. + int findMulti(struct MultiTarget *targets, int tCount); +}; + +#undef NO_IGNORE_CHAR +#endif diff --git a/Packages_Patches/Seeeduino/hardware/nrf52/1.0.0/cores/nRF5/Print.cpp b/Packages_Patches/Seeeduino/hardware/nrf52/1.0.0/cores/nRF5/Print.cpp new file mode 100644 index 00000000..b47efa1a --- /dev/null +++ b/Packages_Patches/Seeeduino/hardware/nrf52/1.0.0/cores/nRF5/Print.cpp @@ -0,0 +1,466 @@ +/* + Copyright (c) 2014 Arduino. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include + +#include + +#include +#include +#include + +#include "Arduino.h" + +#include "Print.h" + +//using namespace arduino; + +// Public Methods ////////////////////////////////////////////////////////////// + +/* default implementation: may be overridden */ +size_t Print::write(const uint8_t *buffer, size_t size) +{ + size_t n = 0; + + while (size--) + { + if (write(*buffer++)) + n++; + else + break; + } + + return n; +} + +size_t Print::print(const __FlashStringHelper *ifsh) +{ + return print(reinterpret_cast(ifsh)); +} + +size_t Print::print(const String &s) +{ + return write(s.c_str(), s.length()); +} + +size_t Print::print(const char str[]) +{ + return write(str); +} + +size_t Print::print(char c) +{ + return write(c); +} + +size_t Print::print(unsigned char b, int base) +{ + return print((unsigned long) b, base); +} + +size_t Print::print(int n, int base) +{ + return print((long) n, base); +} + +size_t Print::print(unsigned int n, int base) +{ + return print((unsigned long) n, base); +} + +size_t Print::print(long n, int base) +{ + if (base == 0) + { + return write(n); + } + else if (base == 10) + { + if (n < 0) + { + int t = print('-'); + n = -n; + return printNumber(n, 10) + t; + } + + return printNumber(n, 10); + } + else + { + return printNumber(n, base); + } +} + +size_t Print::print(unsigned long n, int base) +{ + if (base == 0) + return write(n); + else + return printNumber(n, base); +} + +size_t Print::print(long long n, int base) +{ + if (base == 0) + { + return write(n); + } + else if (base == 10) + { + if (n < 0) + { + int t = print('-'); + n = -n; + return printULLNumber(n, 10) + t; + } + + return printULLNumber(n, 10); + } + else + { + return printULLNumber(n, base); + } +} + +size_t Print::print(unsigned long long n, int base) +{ + if (base == 0) + return write(n); + else + return printULLNumber(n, base); +} + +size_t Print::print(double n, int digits) +{ + return printFloat(n, digits); +} + +size_t Print::println(const __FlashStringHelper *ifsh) +{ + size_t n = print(ifsh); + n += println(); + return n; +} + +size_t Print::print(const Printable& x) +{ + return x.printTo(*this); +} + +size_t Print::println(void) +{ + return write("\r\n"); +} + +size_t Print::println(const String &s) +{ + size_t n = print(s); + n += println(); + return n; +} + +size_t Print::println(const char c[]) +{ + size_t n = print(c); + n += println(); + return n; +} + +size_t Print::println(char c) +{ + size_t n = print(c); + n += println(); + return n; +} + +size_t Print::println(unsigned char b, int base) +{ + size_t n = print(b, base); + n += println(); + return n; +} + +size_t Print::println(int num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(unsigned int num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(long num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(unsigned long num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(long long num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(unsigned long long num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(double num, int digits) +{ + size_t n = print(num, digits); + n += println(); + return n; +} + +size_t Print::println(const Printable& x) +{ + size_t n = print(x); + n += println(); + return n; +} + +size_t Print::printf(const char * format, ...) +{ + char buf[256]; + int len; + + va_list ap; + va_start(ap, format); + + len = vsnprintf(buf, 256, format, ap); + this->write(buf, len); + + va_end(ap); + return len; +} + +// Private Methods ///////////////////////////////////////////////////////////// + +size_t Print::printNumber(unsigned long n, uint8_t base) +{ + char buf[8 * sizeof(long) + 1]; // Assumes 8-bit chars plus zero byte. + char *str = &buf[sizeof(buf) - 1]; + + *str = '\0'; + + // prevent crash if called with base == 1 + if (base < 2) + base = 10; + + do + { + char c = n % base; + n /= base; + + *--str = c < 10 ? c + '0' : c + 'A' - 10; + } while (n); + + return write(str); +} + +// REFERENCE IMPLEMENTATION FOR ULL +// size_t Print::printULLNumber(unsigned long long n, uint8_t base) +// { +// // if limited to base 10 and 16 the bufsize can be smaller +// char buf[65]; +// char *str = &buf[64]; + +// *str = '\0'; + +// // prevent crash if called with base == 1 +// if (base < 2) base = 10; + +// do { +// unsigned long long t = n / base; +// char c = n - t * base; // faster than c = n%base; +// n = t; +// *--str = c < 10 ? c + '0' : c + 'A' - 10; +// } while(n); + +// return write(str); +// } + +// FAST IMPLEMENTATION FOR ULL +size_t Print::printULLNumber(unsigned long long n64, uint8_t base) +{ + // if limited to base 10 and 16 the bufsize can be 20 + char buf[64]; + uint8_t i = 0; + uint8_t innerLoops = 0; + + // prevent crash if called with base == 1 + if (base < 2) + base = 10; + + // process chunks that fit in "16 bit math". + uint16_t top = 0xFFFF / base; + uint16_t th16 = 1; + + while (th16 < top) + { + th16 *= base; + innerLoops++; + } + + while (n64 > th16) + { + // 64 bit math part + uint64_t q = n64 / th16; + uint16_t r = n64 - q * th16; + n64 = q; + + // 16 bit math loop to do remainder. (note buffer is filled reverse) + for (uint8_t j = 0; j < innerLoops; j++) + { + uint16_t qq = r / base; + buf[i++] = r - qq * base; + r = qq; + } + } + + uint16_t n16 = n64; + + while (n16 > 0) + { + uint16_t qq = n16 / base; + buf[i++] = n16 - qq * base; + n16 = qq; + } + + size_t bytes = i; + + for (; i > 0; i--) + write((char) (buf[i - 1] < 10 ? + '0' + buf[i - 1] : + 'A' + buf[i - 1] - 10)); + + return bytes; +} + +size_t Print::printFloat(double number, int digits) +{ + if (digits < 0) + digits = 2; + + size_t n = 0; + + if (isnan(number)) + return print("nan"); + + if (isinf(number)) + return print("inf"); + + if (number > 4294967040.0) + return print ("ovf"); // constant determined empirically + + if (number < -4294967040.0) + return print ("ovf"); // constant determined empirically + + // Handle negative numbers + if (number < 0.0) + { + n += print('-'); + number = -number; + } + + // Round correctly so that print(1.999, 2) prints as "2.00" + double rounding = 0.5; + + for (uint8_t i = 0; i < digits; ++i) + rounding /= 10.0; + + number += rounding; + + // Extract the integer part of the number and print it + unsigned long int_part = (unsigned long)number; + double remainder = number - (double)int_part; + n += print(int_part); + + // Print the decimal point, but only if there are digits beyond + if (digits > 0) + { + n += print("."); + } + + // Extract digits from the remainder one at a time + while (digits-- > 0) + { + remainder *= 10.0; + unsigned int toPrint = (unsigned int)remainder; + n += print(toPrint); + remainder -= toPrint; + } + + return n; +} + +size_t Print::printBuffer(uint8_t const buffer[], int len, char delim, int byteline) +{ + if (buffer == NULL || len == 0) + return 0; + + for (int i = 0; i < len; i++) + { + if ( i != 0 ) + print(delim); + + if ( byteline && (i % byteline == 0) ) + println(); + + this->printf("%02X", buffer[i]); + } + + return (len * 3 - 1); +} + +size_t Print::printBufferReverse(uint8_t const buffer[], int len, char delim, int byteline) +{ + if (buffer == NULL || len == 0) + return 0; + + for (int i = 0; i < len; i++) + { + if (i != 0) + print(delim); + + if ( byteline && (i % byteline == 0) ) + println(); + + this->printf("%02X", buffer[len - 1 - i]); + } + + return (len * 3 - 1); +} + diff --git a/Packages_Patches/Seeeduino/hardware/nrf52/1.0.0/cores/nRF5/Print.h b/Packages_Patches/Seeeduino/hardware/nrf52/1.0.0/cores/nRF5/Print.h new file mode 100644 index 00000000..810a7704 --- /dev/null +++ b/Packages_Patches/Seeeduino/hardware/nrf52/1.0.0/cores/nRF5/Print.h @@ -0,0 +1,123 @@ +/* + Copyright (c) 2016 Arduino LLC. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#pragma once + +#include +#include // for size_t + +#include "WString.h" +#include "Printable.h" + +#define DEC 10 +#define HEX 16 +#define OCT 8 +#define BIN 2 + +class Print +{ + private: + int write_error; + size_t printNumber(unsigned long, uint8_t); + size_t printULLNumber(unsigned long long, uint8_t); + size_t printFloat(double, int); + protected: + void setWriteError(int err = 1) + { + write_error = err; + } + public: + Print() : write_error(0) {} + + int getWriteError() + { + return write_error; + } + void clearWriteError() + { + setWriteError(0); + } + + virtual size_t write(uint8_t) = 0; + size_t write(const char *str) + { + if (str == NULL) + return 0; + + return write((const uint8_t *)str, strlen(str)); + } + virtual size_t write(const uint8_t *buffer, size_t size); + size_t write(const char *buffer, size_t size) + { + return write((const uint8_t *)buffer, size); + } + + // default to zero, meaning "a single write may block" + // should be overridden by subclasses with buffering + virtual int availableForWrite() + { + return 0; + } + + size_t print(const __FlashStringHelper *); + size_t print(const String &); + size_t print(const char[]); + size_t print(char); + size_t print(unsigned char, int = DEC); + size_t print(int, int = DEC); + size_t print(unsigned int, int = DEC); + size_t print(long, int = DEC); + size_t print(unsigned long, int = DEC); + size_t print(long long, int = DEC); + size_t print(unsigned long long, int = DEC); + size_t print(double, int = 2); + size_t print(const Printable&); + + size_t println(const __FlashStringHelper *); + size_t println(const String &s); + size_t println(const char[]); + size_t println(char); + size_t println(unsigned char, int = DEC); + size_t println(int, int = DEC); + size_t println(unsigned int, int = DEC); + size_t println(long, int = DEC); + size_t println(unsigned long, int = DEC); + size_t println(long long, int = DEC); + size_t println(unsigned long long, int = DEC); + size_t println(double, int = 2); + size_t println(const Printable&); + size_t println(void); + + size_t printf(const char * format, ...); + + size_t printBuffer(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); + size_t printBuffer(char const buffer[], int size, char delim = ' ', int byteline = 0) + { + return printBuffer((uint8_t const*) buffer, size, delim, byteline); + } + + size_t printBufferReverse(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); + size_t printBufferReverse(char const buffer[], int size, char delim = ' ', int byteline = 0) + { + return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); + } + + virtual void flush() { /* Empty implementation for backward compatibility */ } +}; + + diff --git a/Packages_Patches/Seeeduino/hardware/nrf52/1.0.0/cores/nRF5/Udp.h b/Packages_Patches/Seeeduino/hardware/nrf52/1.0.0/cores/nRF5/Udp.h new file mode 100644 index 00000000..b3604ea9 --- /dev/null +++ b/Packages_Patches/Seeeduino/hardware/nrf52/1.0.0/cores/nRF5/Udp.h @@ -0,0 +1,99 @@ +/* + Udp.cpp: Library to send/receive UDP packets. + + NOTE: UDP is fast, but has some important limitations (thanks to Warren Gray for mentioning these) + 1) UDP does not guarantee the order in which assembled UDP packets are received. This + might not happen often in practice, but in larger network topologies, a UDP + packet can be received out of sequence. + 2) UDP does not guard against lost packets - so packets *can* disappear without the sender being + aware of it. Again, this may not be a concern in practice on small local networks. + For more information, see http://www.cafeaulait.org/course/week12/35.html + + MIT License: + Copyright (c) 2008 Bjoern Hartmann + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + + bjoern@cs.stanford.edu 12/30/2008 +*/ + +#ifndef udp_h +#define udp_h + +#include +#include + +class UDP : public Stream +{ + + public: + virtual uint8_t begin(uint16_t) = 0; // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use + + // KH, add virtual function to support Multicast, necessary for many services (MDNS, UPnP, etc.) + virtual uint8_t beginMulticast(IPAddress, uint16_t) + { + return 0; // initialize, start listening on specified multicast IP address and port. Returns 1 if successful, 0 on failure + } + + virtual void stop() = 0; // Finish with the UDP socket + + // Sending UDP packets + + // Start building up a packet to send to the remote host specific in ip and port + // Returns 1 if successful, 0 if there was a problem with the supplied IP address or port + virtual int beginPacket(IPAddress ip, uint16_t port) = 0; + // Start building up a packet to send to the remote host specific in host and port + // Returns 1 if successful, 0 if there was a problem resolving the hostname or port + virtual int beginPacket(const char *host, uint16_t port) = 0; + // Finish off this packet and send it + // Returns 1 if the packet was sent successfully, 0 if there was an error + virtual int endPacket() = 0; + // Write a single byte into the packet + virtual size_t write(uint8_t) = 0; + // Write size bytes from buffer into the packet + virtual size_t write(const uint8_t *buffer, size_t size) = 0; + + // Start processing the next available incoming packet + // Returns the size of the packet in bytes, or 0 if no packets are available + virtual int parsePacket() = 0; + // Number of bytes remaining in the current packet + virtual int available() = 0; + // Read a single byte from the current packet + virtual int read() = 0; + // Read up to len bytes from the current packet and place them into buffer + // Returns the number of bytes read, or 0 if none are available + virtual int read(unsigned char* buffer, size_t len) = 0; + // Read up to len characters from the current packet and place them into buffer + // Returns the number of characters read, or 0 if none are available + virtual int read(char* buffer, size_t len) = 0; + // Return the next byte from the current packet without moving on to the next byte + virtual int peek() = 0; + virtual void flush() = 0; // Finish reading the current packet + + // Return the IP address of the host who sent the current incoming packet + virtual IPAddress remoteIP() = 0; + // Return the port of the host who sent the current incoming packet + virtual uint16_t remotePort() = 0; + protected: + uint8_t* rawIPAddress(IPAddress& addr) + { + return addr.raw_address(); + }; +}; + +#endif diff --git a/Packages_Patches/Seeeduino/hardware/nrf52/1.0.0/platform.txt b/Packages_Patches/Seeeduino/hardware/nrf52/1.0.0/platform.txt new file mode 100644 index 00000000..6d35ef98 --- /dev/null +++ b/Packages_Patches/Seeeduino/hardware/nrf52/1.0.0/platform.txt @@ -0,0 +1,163 @@ +# Copyright (c) 2014-2015 Arduino LLC. All right reserved. +# Copyright (c) 2016 Sandeep Mistry All right reserved. +# Copyright (c) 2017 Adafruit Industries. All rights reserved. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +name=Seeed nRF52 Boards +version=1.0.0 + +# Compile variables +# ----------------- + +compiler.warning_flags=-Werror=return-type +compiler.warning_flags.none=-Werror=return-type +compiler.warning_flags.default=-Werror=return-type +compiler.warning_flags.more=-Wall -Werror=return-type +compiler.warning_flags.all=-Wall -Wextra -Werror=return-type -Wno-unused-parameter -Wno-missing-field-initializers -Wno-pointer-arith + +# Allow changing optimization settings via platform.local.txt / boards.local.txt +compiler.optimization_flag=-Ofast + +compiler.path={runtime.tools.arm-none-eabi-gcc.path}/bin/ +compiler.c.cmd=arm-none-eabi-gcc +compiler.c.flags=-mcpu={build.mcu} -mthumb -c -g {compiler.warning_flags} {build.float_flags} -std=gnu11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -MMD + +# KH, Error here to use gcc, must use g++ +#compiler.c.elf.cmd=arm-none-eabi-gcc +compiler.c.elf.cmd=arm-none-eabi-g++ + +compiler.c.elf.flags={compiler.optimization_flag} -Wl,--gc-sections -save-temps +compiler.S.cmd=arm-none-eabi-gcc +compiler.S.flags=-mcpu={build.mcu} -mthumb -mabi=aapcs {compiler.optimization_flag} -g -c {build.float_flags} -x assembler-with-cpp + +compiler.cpp.cmd=arm-none-eabi-g++ +compiler.cpp.flags=-mcpu={build.mcu} -mthumb -c -g {compiler.warning_flags} {build.float_flags} -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD +compiler.ar.cmd=arm-none-eabi-ar +compiler.ar.flags=rcs +compiler.objcopy.cmd=arm-none-eabi-objcopy +compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 +compiler.elf2bin.flags=-O binary +compiler.elf2bin.cmd=arm-none-eabi-objcopy +compiler.elf2hex.flags=-O ihex +compiler.elf2hex.cmd=arm-none-eabi-objcopy +compiler.ldflags=-mcpu={build.mcu} -mthumb {build.float_flags} -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--wrap=malloc -Wl,--wrap=free --specs=nano.specs --specs=nosys.specs +compiler.size.cmd=arm-none-eabi-size + +# this can be overriden in boards.txt +# Logger 0: Serial (CDC), 1 Serial1 (UART), 2 Segger RTT +build.float_flags=-mfloat-abi=hard -mfpu=fpv4-sp-d16 -u _printf_float +build.debug_flags=-DCFG_DEBUG=0 +build.logger_flags=-DCFG_LOGGER=0 +build.sysview_flags=-DCFG_SYSVIEW=0 + +# USB flags +build.flags.usb= -DUSBCON -DUSE_TINYUSB -DUSB_VID={build.vid} -DUSB_PID={build.pid} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}' + +# These can be overridden in platform.local.txt +compiler.c.extra_flags= +compiler.c.elf.extra_flags= +compiler.cpp.extra_flags= +compiler.S.extra_flags= +compiler.ar.extra_flags= +compiler.libraries.ldflags= +compiler.elf2bin.extra_flags= +compiler.elf2hex.extra_flags= + +compiler.arm.cmsis.c.flags="-I{runtime.tools.CMSIS-5.7.0.path}/CMSIS/Core/Include/" "-I{runtime.tools.CMSIS-5.7.0.path}/CMSIS/DSP/Include/" +compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-5.7.0.path}/CMSIS/DSP/Lib/GCC/" -larm_cortexM4lf_math + +# common compiler for nrf +rtos.path={build.core.path}/freertos +nordic.path={build.core.path}/nordic + +build.flags.nrf= -DSOFTDEVICE_PRESENT -DARDUINO_NRF52_ADAFRUIT -DNRF52_SERIES -DDX_CC_TEE -DLFS_NAME_MAX=64 {compiler.optimization_flag} {build.debug_flags} {build.logger_flags} {build.sysview_flags} {compiler.arm.cmsis.c.flags} "-I{nordic.path}" "-I{nordic.path}/nrfx" "-I{nordic.path}/nrfx/hal" "-I{nordic.path}/nrfx/mdk" "-I{nordic.path}/nrfx/soc" "-I{nordic.path}/nrfx/drivers/include" "-I{nordic.path}/nrfx/drivers/src" "-I{nordic.path}/softdevice/{build.sd_name}_nrf52_{build.sd_version}_API/include" "-I{nordic.path}/softdevice/{build.sd_name}_nrf52_{build.sd_version}_API/include/nrf52" "-I{rtos.path}/Source/include" "-I{rtos.path}/config" "-I{rtos.path}/portable/GCC/nrf52" "-I{rtos.path}/portable/CMSIS/nrf52" "-I{build.core.path}/sysview/SEGGER" "-I{build.core.path}/sysview/Config" "-I{runtime.platform.path}/libraries/Adafruit_TinyUSB_Arduino/src/arduino" + +# Compile patterns +# ---------------- + +## Compile c files +recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} '-DARDUINO_BSP_VERSION="{version}"' {compiler.c.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}" + +## Compile c++ files +recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} '-DARDUINO_BSP_VERSION="{version}"' {compiler.cpp.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}" + +## Compile S files +recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {build.flags.nrf} {includes} "{source_file}" -o "{object_file}" + +## Create archives +recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}" + +## Combine gc-sections, archives, and objects +recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} "-L{build.core.path}/linker" "-T{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} -Wl,--start-group {compiler.arm.cmsis.ldflags} -lm "{build.path}/{archive_file}" {compiler.libraries.ldflags} -Wl,--end-group + +## Create output (bin file) +#recipe.objcopy.bin.pattern="{compiler.path}{compiler.elf2bin.cmd}" {compiler.elf2bin.flags} {compiler.elf2bin.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.bin" + +## Create output (hex file) +recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex" + +## Create dfu package zip file +recipe.objcopy.zip.pattern="{tools.nrfutil.cmd}" dfu genpkg --dev-type 0x0052 --sd-req {build.sd_fwid} --application "{build.path}/{build.project_name}.hex" "{build.path}/{build.project_name}.zip" + +## Create uf2 file +#recipe.objcopy.uf2.pattern=python "{runtime.platform.path}/tools/uf2conv/uf2conv.py" -f 0xADA52840 -c -o "{build.path}/{build.project_name}.uf2" "{build.path}/{build.project_name}.hex" + +## Save bin +recipe.output.tmp_file_bin={build.project_name}.bin +recipe.output.save_file_bin={build.project_name}.save.bin + +## Save hex +recipe.output.tmp_file_hex={build.project_name}.hex +recipe.output.save_file_hexu={build.project_name}.save.hex + +## Compute size +recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf" +recipe.size.regex=^(?:\.text|\.data|)\s+([0-9]+).* +recipe.size.regex.data=^(?:\.data|\.bss)\s+([0-9]+).* + +## Export Compiled Binary +recipe.output.tmp_file={build.project_name}.hex +recipe.output.save_file={build.project_name}.{build.variant}.hex + +#*************************************************** +# adafruit-nrfutil for uploading +# https://github.com/adafruit/Adafruit_nRF52_nrfutil +# pre-built binaries are provided for macos and windows +#*************************************************** +tools.nrfutil.cmd=adafruit-nrfutil +tools.nrfutil.cmd.windows={runtime.platform.path}/tools/adafruit-nrfutil/win32/adafruit-nrfutil.exe +tools.nrfutil.cmd.macosx={runtime.platform.path}/tools/adafruit-nrfutil/macos/adafruit-nrfutil + +tools.nrfutil.upload.params.verbose=--verbose +tools.nrfutil.upload.params.quiet= +tools.nrfutil.upload.pattern="{cmd}" {upload.verbose} dfu serial -pkg "{build.path}/{build.project_name}.zip" -p {serial.port} -b 115200 --singlebank + +#*************************************************** +# Burning bootloader with either jlink or nrfutil +#*************************************************** + +# Bootloader version +tools.bootburn.bootloader.file={runtime.platform.path}/bootloader/{build.variant}/{build.variant}_bootloader-0.6.2_{build.sd_name}_{build.sd_version} + +tools.bootburn.bootloader.params.verbose= +tools.bootburn.bootloader.params.quiet= +tools.bootburn.bootloader.pattern={program.burn_pattern} + +# erase flash page while programming +tools.bootburn.erase.params.verbose= +tools.bootburn.erase.params.quiet= +tools.bootburn.erase.pattern= + diff --git a/Packages_Patches/Seeeduino/hardware/rp2040/1.9.3/variants/rpipico/pins_arduino.h b/Packages_Patches/Seeeduino/hardware/rp2040/1.9.3/variants/rpipico/pins_arduino.h index 603700fc..b2b5352b 100644 --- a/Packages_Patches/Seeeduino/hardware/rp2040/1.9.3/variants/rpipico/pins_arduino.h +++ b/Packages_Patches/Seeeduino/hardware/rp2040/1.9.3/variants/rpipico/pins_arduino.h @@ -53,7 +53,7 @@ static const int A2 = PIN_A2; static const int A3 = PIN_A3; // D0 - D10 -#define D26 (26u) +#define D26 (26u) #define D1 (27u) #define D2 (28u) #define D3 (29u) diff --git a/Packages_Patches/Seeeduino/hardware/rp2040/2.7.2/variants/Seeed_XIAO_RP2040/pins_arduino.h b/Packages_Patches/Seeeduino/hardware/rp2040/2.7.2/variants/Seeed_XIAO_RP2040/pins_arduino.h index d51c54c6..f5d16f19 100644 --- a/Packages_Patches/Seeeduino/hardware/rp2040/2.7.2/variants/Seeed_XIAO_RP2040/pins_arduino.h +++ b/Packages_Patches/Seeeduino/hardware/rp2040/2.7.2/variants/Seeed_XIAO_RP2040/pins_arduino.h @@ -6,7 +6,7 @@ #define __PINS_ARDUINO__ #ifdef __cplusplus -extern "C" unsigned int PINCOUNT_fn(); + extern "C" unsigned int PINCOUNT_fn(); #endif // Pin count @@ -25,7 +25,7 @@ extern PinName digitalPinToPinName(pin_size_t P); // Digital pins // ---- -#define PIN_D0 (26u) +#define PIN_D0 (26u) #define PIN_D1 (27u) #define PIN_D2 (28u) #define PIN_D3 (29u) @@ -89,35 +89,35 @@ static const uint8_t SCK = PIN_SPI_SCK; #define SDA (6u) #define SCL (7u) -#define SERIAL_HOWMANY 1 -#define SERIAL1_TX (digitalPinToPinName(PIN_SERIAL_TX)) -#define SERIAL1_RX (digitalPinToPinName(PIN_SERIAL_RX)) +#define SERIAL_HOWMANY 1 +#define SERIAL1_TX (digitalPinToPinName(PIN_SERIAL_TX)) +#define SERIAL1_RX (digitalPinToPinName(PIN_SERIAL_RX)) -#define SERIAL_CDC 1 +#define SERIAL_CDC 1 #define HAS_UNIQUE_ISERIAL_DESCRIPTOR -#define BOARD_VENDORID 0x2886 -#define BOARD_PRODUCTID 0x8042 -#define BOARD_NAME "RaspberryPi Pico" +#define BOARD_VENDORID 0x2886 +#define BOARD_PRODUCTID 0x8042 +#define BOARD_NAME "RaspberryPi Pico" uint8_t getUniqueSerialNumber(uint8_t* name); void _ontouch1200bps_(); -#define SPI_HOWMANY (1) -#define SPI_MISO (digitalPinToPinName(PIN_SPI_MISO)) -#define SPI_MOSI (digitalPinToPinName(PIN_SPI_MOSI)) -#define SPI_SCK (digitalPinToPinName(PIN_SPI_SCK)) +#define SPI_HOWMANY (1) +#define SPI_MISO (digitalPinToPinName(PIN_SPI_MISO)) +#define SPI_MOSI (digitalPinToPinName(PIN_SPI_MOSI)) +#define SPI_SCK (digitalPinToPinName(PIN_SPI_SCK)) -#define WIRE_HOWMANY (1) -#define I2C_SDA (digitalPinToPinName(SDA)) -#define I2C_SCL (digitalPinToPinName(SCL)) +#define WIRE_HOWMANY (1) +#define I2C_SDA (digitalPinToPinName(SDA)) +#define I2C_SCL (digitalPinToPinName(SCL)) -#define digitalPinToPort(P) (digitalPinToPinName(P)/32) +#define digitalPinToPort(P) (digitalPinToPinName(P)/32) #define SERIAL_PORT_USBVIRTUAL SerialUSB #define SERIAL_PORT_MONITOR SerialUSB #define SERIAL_PORT_HARDWARE Serial1 #define SERIAL_PORT_HARDWARE_OPEN Serial1 -#define USB_MAX_POWER (500) +#define USB_MAX_POWER (500) #endif //__PINS_ARDUINO__ diff --git a/Packages_Patches/Seeeduino/hardware/samd/1.7.0/boards.txt b/Packages_Patches/Seeeduino/hardware/samd/1.7.0/boards.txt new file mode 100644 index 00000000..ec3f9ff3 --- /dev/null +++ b/Packages_Patches/Seeeduino/hardware/samd/1.7.0/boards.txt @@ -0,0 +1,1730 @@ +# Copyright (c) 2014-2017 Arduino LLC. All right reserved. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +menu.cpu=Microcontroller +menu.clock=Clock Source +menu.usb=USB Config +menu.serial=Serial Config +menu.bootloader=Bootloader Size +menu.timer=Timer PWM Frequency +menu.float=Floating Point +menu.config=Build Options + +# Generic D11C14A +d11c14a.name=Generic D11C14A +d11c14a.vid.0=0x16D0 +d11c14a.pid.0=0x1557 +d11c14a.vid.1=0x16D0 +d11c14a.pid.1=0x1856 +d11c14a.vid.2=0x16D0 +d11c14a.pid.2=0x1B41 +d11c14a.vid.3=0x16D0 +d11c14a.pid.3=0x1B40 +d11c14a.vid.4=0x16D0 +d11c14a.pid.4=0x1A0C +d11c14a.vid.5=0x16D0 +d11c14a.pid.5=0x1856 +d11c14a.build.mcu=cortex-m0plus +d11c14a.build.mathlib=arm_cortexM0l_math +d11c14a.build.f_cpu=48000000L +d11c14a.build.usb_product="D11C14A" +d11c14a.build.usb_manufacturer="Fab Foundation" +d11c14a.build.board=SAMD_ZERO +d11c14a.build.core=arduino +d11c14a.build.variant=Generic_D11C14A +d11c14a.build.variant_system_lib= +d11c14a.build.vid=0x16D0 +d11c14a.upload.protocol=sam-ba +d11c14a.bootloader.tool=openocd +d11c14a.menu.float.default=Print & String use auto-promoted doubles only +d11c14a.menu.float.default.build.floatconfig=FLOAT_BOTH_DOUBLES_ONLY +d11c14a.menu.float.print=Print uses separate singles and doubles +d11c14a.menu.float.print.build.floatconfig=FLOAT_PRINT_SINGLES_DOUBLES +d11c14a.menu.float.string=String uses separate singles and doubles +d11c14a.menu.float.string.build.floatconfig=FLOAT_STRING_SINGLES_DOUBLES +d11c14a.menu.float.both=Print & String use separate singles and doubles +d11c14a.menu.float.both.build.floatconfig=FLOAT_BOTH_SINGLES_DOUBLES +d11c14a.menu.config.disabled=config.h disabled +d11c14a.menu.config.disabled.build.buildconfig=CONFIG_H_DISABLED +d11c14a.menu.config.enabled=config.h enabled (mostly code size reductions) +d11c14a.menu.config.enabled.build.buildconfig=CONFIG_H_ENABLED +d11c14a.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED_OSCILLATOR +d11c14a.menu.clock.internal_usb.build.clockconfig=CLOCKCONFIG_INTERNAL_USB +d11c14a.menu.clock.internal=INTERNAL_OSCILLATOR +d11c14a.menu.clock.internal.build.clockconfig=CLOCKCONFIG_INTERNAL +d11c14a.menu.clock.crystal_32k=32KHZ_CRYSTAL +d11c14a.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32768HZ_CRYSTAL +d11c14a.menu.clock.crystal_hs=HIGH_SPEED_CRYSTAL +d11c14a.menu.clock.crystal_hs.build.clockconfig=CLOCKCONFIG_HS_CRYSTAL +d11c14a.menu.timer.timer_732Hz=732.4Hz (16-bit) +d11c14a.menu.timer.timer_732Hz.build.timerconfig=TIMER_732Hz +d11c14a.menu.timer.timer_366Hz=366.2Hz (16-bit) +d11c14a.menu.timer.timer_366Hz.build.timerconfig=TIMER_366Hz +d11c14a.menu.timer.timer_244Hz=244.1Hz (16-bit) +d11c14a.menu.timer.timer_244Hz.build.timerconfig=TIMER_244Hz +d11c14a.menu.timer.timer_183Hz=183.1Hz (16-bit) +d11c14a.menu.timer.timer_183Hz.build.timerconfig=TIMER_183Hz +d11c14a.menu.timer.timer_146Hz=146.5Hz (16-bit) +d11c14a.menu.timer.timer_146Hz.build.timerconfig=TIMER_146Hz +d11c14a.menu.timer.timer_122Hz=122.1Hz (16-bit) +d11c14a.menu.timer.timer_122Hz.build.timerconfig=TIMER_122Hz +d11c14a.menu.timer.timer_105Hz=104.6Hz (16-bit) +d11c14a.menu.timer.timer_105Hz.build.timerconfig=TIMER_105Hz +d11c14a.menu.timer.timer_81Hz=81.38Hz (16-bit) +d11c14a.menu.timer.timer_81Hz.build.timerconfig=TIMER_81Hz +d11c14a.menu.timer.timer_61Hz=61.04Hz (16-bit) +d11c14a.menu.timer.timer_61Hz.build.timerconfig=TIMER_61Hz +d11c14a.menu.timer.timer_31Hz=30.52Hz (16-bit) +d11c14a.menu.timer.timer_31Hz.build.timerconfig=TIMER_31Hz +d11c14a.menu.timer.timer_187500Hz=187500Hz (8-bit) +d11c14a.menu.timer.timer_187500Hz.build.timerconfig=TIMER_187500Hz +d11c14a.menu.timer.timer_93750Hz=93750Hz (8-bit) +d11c14a.menu.timer.timer_93750Hz.build.timerconfig=TIMER_93750Hz +d11c14a.menu.timer.timer_62500Hz=62500Hz (8-bit) +d11c14a.menu.timer.timer_62500Hz.build.timerconfig=TIMER_62500Hz +d11c14a.menu.timer.timer_37500Hz=37500Hz (8-bit) +d11c14a.menu.timer.timer_37500Hz.build.timerconfig=TIMER_37500Hz +d11c14a.menu.timer.timer_20833Hz=20833Hz (8-bit) +d11c14a.menu.timer.timer_20833Hz.build.timerconfig=TIMER_20833Hz +d11c14a.menu.timer.timer_12500Hz=12500Hz (8-bit) +d11c14a.menu.timer.timer_12500Hz.build.timerconfig=TIMER_12500Hz +d11c14a.menu.timer.timer_7500Hz=7500Hz (8-bit) +d11c14a.menu.timer.timer_7500Hz.build.timerconfig=TIMER_7500Hz +d11c14a.menu.timer.timer_4166Hz=4166Hz (8-bit) +d11c14a.menu.timer.timer_4166Hz.build.timerconfig=TIMER_4166Hz +d11c14a.menu.timer.timer_2930Hz=2930Hz (8-bit) +d11c14a.menu.timer.timer_2930Hz.build.timerconfig=TIMER_2930Hz +d11c14a.menu.timer.timer_1465Hz=1465Hz (8-bit) +d11c14a.menu.timer.timer_1465Hz.build.timerconfig=TIMER_1465Hz +d11c14a.build.extra_flags=-D__SAMD11C14A__ {build.usb_flags} -DARM_MATH_CM0PLUS +d11c14a.build.ldscript=flash_16KB.ld +d11c14a.build.openocdscript=openocd_scripts/SAMD11C14A.cfg +d11c14a.bootloader.file=zero/binaries/sam_ba_SAMD11C14A.bin +d11c14a.menu.bootloader.4kb=4KB_BOOTLOADER +d11c14a.menu.bootloader.4kb.build.bootloader_size=__4KB_BOOTLOADER__ +d11c14a.menu.bootloader.4kb.build.ldscript_path=linker_scripts/gcc/4KB_Bootloader +d11c14a.menu.bootloader.4kb.upload.tool=Fab_SAM_Arduino:bossac +d11c14a.menu.bootloader.4kb.upload.use_1200bps_touch=true +d11c14a.menu.bootloader.4kb.upload.wait_for_upload_port=true +d11c14a.menu.bootloader.4kb.upload.native_usb=true +d11c14a.menu.bootloader.4kb.upload.maximum_size=12288 +d11c14a.menu.bootloader.0kb=NO_BOOTLOADER +d11c14a.menu.bootloader.0kb.build.bootloader_size=__NO_BOOTLOADER__ +d11c14a.menu.bootloader.0kb.build.ldscript_path=linker_scripts/gcc/No_Bootloader +d11c14a.menu.bootloader.0kb.upload.tool=openocd +d11c14a.menu.bootloader.0kb.upload.use_1200bps_touch=false +d11c14a.menu.bootloader.0kb.upload.wait_for_upload_port=false +d11c14a.menu.bootloader.0kb.upload.native_usb=false +d11c14a.menu.bootloader.0kb.upload.maximum_size=16384 +d11c14a.menu.serial.one_uart=ONE_UART_ONE_WIRE_NO_SPI +d11c14a.menu.serial.one_uart.build.serialcom_uart=ONE_UART +d11c14a.menu.serial.one_uart.build.serialcom_wire=ONE_WIRE +d11c14a.menu.serial.one_uart.build.serialcom_spi=NO_SPI +d11c14a.menu.serial.two_uart=TWO_UART_NO_WIRE_NO_SPI +d11c14a.menu.serial.two_uart.build.serialcom_uart=TWO_UART +d11c14a.menu.serial.two_uart.build.serialcom_wire=NO_WIRE +d11c14a.menu.serial.two_uart.build.serialcom_spi=NO_SPI +d11c14a.menu.serial.one_uart_no_wire_one_spi=ONE_UART_NO_WIRE_ONE_SPI +d11c14a.menu.serial.one_uart_no_wire_one_spi.build.serialcom_uart=ONE_UART +d11c14a.menu.serial.one_uart_no_wire_one_spi.build.serialcom_wire=NO_WIRE +d11c14a.menu.serial.one_uart_no_wire_one_spi.build.serialcom_spi=ONE_SPI +d11c14a.menu.serial.no_uart=NO_UART_ONE_WIRE_ONE_SPI +d11c14a.menu.serial.no_uart.build.serialcom_uart=NO_UART +d11c14a.menu.serial.no_uart.build.serialcom_wire=ONE_WIRE +d11c14a.menu.serial.no_uart.build.serialcom_spi=ONE_SPI +d11c14a.menu.usb.cdc=CDC_ONLY +d11c14a.menu.usb.cdc.build.usbcom=CDC_ONLY +d11c14a.menu.usb.cdc.build.pid=0x1557 +d11c14a.menu.usb.cdc_hid=CDC_HID +d11c14a.menu.usb.cdc_hid.build.usbcom=CDC_HID +d11c14a.menu.usb.cdc_hid.build.pid=0x1856 +d11c14a.menu.usb.withcdc=WITH_CDC +d11c14a.menu.usb.withcdc.build.usbcom=WITH_CDC +d11c14a.menu.usb.withcdc.build.pid=0x1B41 +d11c14a.menu.usb.hid=HID_ONLY +d11c14a.menu.usb.hid.build.usbcom=HID_ONLY +d11c14a.menu.usb.hid.build.pid=0x1B40 +d11c14a.menu.usb.nocdc=WITHOUT_CDC +d11c14a.menu.usb.nocdc.build.usbcom=WITHOUT_CDC +d11c14a.menu.usb.nocdc.build.pid=0x1A0C +d11c14a.menu.usb.none=USB_DISABLED +d11c14a.menu.usb.none.build.usbcom=USB_DISABLED +d11c14a.menu.usb.none.build.pid=0x1856 + +# Generic D11D14AS +d11d14as.name=Generic D11D14AS +d11d14as.vid.0=0x16D0 +d11d14as.pid.0=0x2557 +d11d14as.vid.1=0x16D0 +d11d14as.pid.1=0x2856 +d11d14as.vid.2=0x16D0 +d11d14as.pid.2=0x2B41 +d11d14as.vid.3=0x16D0 +d11d14as.pid.3=0x2B40 +d11d14as.vid.4=0x16D0 +d11d14as.pid.4=0x2A0C +d11d14as.vid.5=0x16D0 +d11d14as.pid.5=0x2856 +d11d14as.build.mcu=cortex-m0plus +d11d14as.build.mathlib=arm_cortexM0l_math +d11d14as.build.f_cpu=48000000L +d11d14as.build.usb_product="D11D14AS" +d11d14as.build.usb_manufacturer="Fab Foundation" +d11d14as.build.board=SAMD_ZERO +d11d14as.build.core=arduino +d11d14as.build.variant=Generic_D11D14AS +d11d14as.build.variant_system_lib= +d11d14as.build.vid=0x16D0 +d11d14as.upload.protocol=sam-ba +d11d14as.bootloader.tool=openocd +d11d14as.menu.float.default=Print & String use auto-promoted doubles only +d11d14as.menu.float.default.build.floatconfig=FLOAT_BOTH_DOUBLES_ONLY +d11d14as.menu.float.print=Print uses separate singles and doubles +d11d14as.menu.float.print.build.floatconfig=FLOAT_PRINT_SINGLES_DOUBLES +d11d14as.menu.float.string=String uses separate singles and doubles +d11d14as.menu.float.string.build.floatconfig=FLOAT_STRING_SINGLES_DOUBLES +d11d14as.menu.float.both=Print & String use separate singles and doubles +d11d14as.menu.float.both.build.floatconfig=FLOAT_BOTH_SINGLES_DOUBLES +d11d14as.menu.config.disabled=config.h disabled +d11d14as.menu.config.disabled.build.buildconfig=CONFIG_H_DISABLED +d11d14as.menu.config.enabled=config.h enabled (mostly code size reductions) +d11d14as.menu.config.enabled.build.buildconfig=CONFIG_H_ENABLED +d11d14as.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED_OSCILLATOR +d11d14as.menu.clock.internal_usb.build.clockconfig=CLOCKCONFIG_INTERNAL_USB +d11d14as.menu.clock.internal=INTERNAL_OSCILLATOR +d11d14as.menu.clock.internal.build.clockconfig=CLOCKCONFIG_INTERNAL +d11d14as.menu.clock.crystal_32k=32KHZ_CRYSTAL +d11d14as.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32768HZ_CRYSTAL +d11d14as.menu.clock.crystal_hs=HIGH_SPEED_CRYSTAL +d11d14as.menu.clock.crystal_hs.build.clockconfig=CLOCKCONFIG_HS_CRYSTAL +d11d14as.menu.timer.timer_732Hz=732.4Hz (16-bit) +d11d14as.menu.timer.timer_732Hz.build.timerconfig=TIMER_732Hz +d11d14as.menu.timer.timer_366Hz=366.2Hz (16-bit) +d11d14as.menu.timer.timer_366Hz.build.timerconfig=TIMER_366Hz +d11d14as.menu.timer.timer_244Hz=244.1Hz (16-bit) +d11d14as.menu.timer.timer_244Hz.build.timerconfig=TIMER_244Hz +d11d14as.menu.timer.timer_183Hz=183.1Hz (16-bit) +d11d14as.menu.timer.timer_183Hz.build.timerconfig=TIMER_183Hz +d11d14as.menu.timer.timer_146Hz=146.5Hz (16-bit) +d11d14as.menu.timer.timer_146Hz.build.timerconfig=TIMER_146Hz +d11d14as.menu.timer.timer_122Hz=122.1Hz (16-bit) +d11d14as.menu.timer.timer_122Hz.build.timerconfig=TIMER_122Hz +d11d14as.menu.timer.timer_105Hz=104.6Hz (16-bit) +d11d14as.menu.timer.timer_105Hz.build.timerconfig=TIMER_105Hz +d11d14as.menu.timer.timer_81Hz=81.38Hz (16-bit) +d11d14as.menu.timer.timer_81Hz.build.timerconfig=TIMER_81Hz +d11d14as.menu.timer.timer_61Hz=61.04Hz (16-bit) +d11d14as.menu.timer.timer_61Hz.build.timerconfig=TIMER_61Hz +d11d14as.menu.timer.timer_31Hz=30.52Hz (16-bit) +d11d14as.menu.timer.timer_31Hz.build.timerconfig=TIMER_31Hz +d11d14as.menu.timer.timer_187500Hz=187500Hz (8-bit) +d11d14as.menu.timer.timer_187500Hz.build.timerconfig=TIMER_187500Hz +d11d14as.menu.timer.timer_93750Hz=93750Hz (8-bit) +d11d14as.menu.timer.timer_93750Hz.build.timerconfig=TIMER_93750Hz +d11d14as.menu.timer.timer_62500Hz=62500Hz (8-bit) +d11d14as.menu.timer.timer_62500Hz.build.timerconfig=TIMER_62500Hz +d11d14as.menu.timer.timer_37500Hz=37500Hz (8-bit) +d11d14as.menu.timer.timer_37500Hz.build.timerconfig=TIMER_37500Hz +d11d14as.menu.timer.timer_20833Hz=20833Hz (8-bit) +d11d14as.menu.timer.timer_20833Hz.build.timerconfig=TIMER_20833Hz +d11d14as.menu.timer.timer_12500Hz=12500Hz (8-bit) +d11d14as.menu.timer.timer_12500Hz.build.timerconfig=TIMER_12500Hz +d11d14as.menu.timer.timer_7500Hz=7500Hz (8-bit) +d11d14as.menu.timer.timer_7500Hz.build.timerconfig=TIMER_7500Hz +d11d14as.menu.timer.timer_4166Hz=4166Hz (8-bit) +d11d14as.menu.timer.timer_4166Hz.build.timerconfig=TIMER_4166Hz +d11d14as.menu.timer.timer_2930Hz=2930Hz (8-bit) +d11d14as.menu.timer.timer_2930Hz.build.timerconfig=TIMER_2930Hz +d11d14as.menu.timer.timer_1465Hz=1465Hz (8-bit) +d11d14as.menu.timer.timer_1465Hz.build.timerconfig=TIMER_1465Hz +d11d14as.build.extra_flags=-D__SAMD11D14AS__ {build.usb_flags} -DARM_MATH_CM0PLUS +d11d14as.build.ldscript=flash_16KB.ld +d11d14as.build.openocdscript=openocd_scripts/SAMD11D14AS.cfg +d11d14as.bootloader.file=zero/binaries/sam_ba_SAMD11D14AS.bin +d11d14as.menu.bootloader.4kb=4KB_BOOTLOADER +d11d14as.menu.bootloader.4kb.build.bootloader_size=__4KB_BOOTLOADER__ +d11d14as.menu.bootloader.4kb.build.ldscript_path=linker_scripts/gcc/4KB_Bootloader +d11d14as.menu.bootloader.4kb.upload.tool=Fab_SAM_Arduino:bossac +d11d14as.menu.bootloader.4kb.upload.use_1200bps_touch=true +d11d14as.menu.bootloader.4kb.upload.wait_for_upload_port=true +d11d14as.menu.bootloader.4kb.upload.native_usb=true +d11d14as.menu.bootloader.4kb.upload.maximum_size=12288 +d11d14as.menu.bootloader.0kb=NO_BOOTLOADER +d11d14as.menu.bootloader.0kb.build.bootloader_size=__NO_BOOTLOADER__ +d11d14as.menu.bootloader.0kb.build.ldscript_path=linker_scripts/gcc/No_Bootloader +d11d14as.menu.bootloader.0kb.upload.tool=openocd +d11d14as.menu.bootloader.0kb.upload.use_1200bps_touch=false +d11d14as.menu.bootloader.0kb.upload.wait_for_upload_port=false +d11d14as.menu.bootloader.0kb.upload.native_usb=false +d11d14as.menu.bootloader.0kb.upload.maximum_size=16384 +d11d14as.menu.serial.one_uart=ONE_UART_ONE_WIRE_ONE_SPI +d11d14as.menu.serial.one_uart.build.serialcom_uart=ONE_UART +d11d14as.menu.serial.one_uart.build.serialcom_wire=ONE_WIRE +d11d14as.menu.serial.one_uart.build.serialcom_spi=ONE_SPI +d11d14as.menu.serial.no_uart=NO_UART_ONE_WIRE_ONE_SPI +d11d14as.menu.serial.no_uart.build.serialcom_uart=NO_UART +d11d14as.menu.serial.no_uart.build.serialcom_wire=ONE_WIRE +d11d14as.menu.serial.no_uart.build.serialcom_spi=ONE_SPI +d11d14as.menu.serial.two_uart=TWO_UART_ONE_WIRE_NO_SPI +d11d14as.menu.serial.two_uart.build.serialcom_uart=TWO_UART +d11d14as.menu.serial.two_uart.build.serialcom_wire=ONE_WIRE +d11d14as.menu.serial.two_uart.build.serialcom_spi=NO_SPI +d11d14as.menu.usb.cdc=CDC_ONLY +d11d14as.menu.usb.cdc.build.usbcom=CDC_ONLY +d11d14as.menu.usb.cdc.build.pid=0x2557 +d11d14as.menu.usb.cdc_hid=CDC_HID +d11d14as.menu.usb.cdc_hid.build.usbcom=CDC_HID +d11d14as.menu.usb.cdc_hid.build.pid=0x2856 +d11d14as.menu.usb.withcdc=WITH_CDC +d11d14as.menu.usb.withcdc.build.usbcom=WITH_CDC +d11d14as.menu.usb.withcdc.build.pid=0x2B41 +d11d14as.menu.usb.hid=HID_ONLY +d11d14as.menu.usb.hid.build.usbcom=HID_ONLY +d11d14as.menu.usb.hid.build.pid=0x2B40 +d11d14as.menu.usb.nocdc=WITHOUT_CDC +d11d14as.menu.usb.nocdc.build.usbcom=WITHOUT_CDC +d11d14as.menu.usb.nocdc.build.pid=0x2A0C +d11d14as.menu.usb.none=USB_DISABLED +d11d14as.menu.usb.none.build.usbcom=USB_DISABLED +d11d14as.menu.usb.none.build.pid=0x2856 + +# Generic D11D14AM +d11d14am.name=Generic D11D14AM +d11d14am.vid.0=0x16D0 +d11d14am.pid.0=0x3557 +d11d14am.vid.1=0x16D0 +d11d14am.pid.1=0x3856 +d11d14am.vid.2=0x16D0 +d11d14am.pid.2=0x3B41 +d11d14am.vid.3=0x16D0 +d11d14am.pid.3=0x3B40 +d11d14am.vid.4=0x16D0 +d11d14am.pid.4=0x3A0C +d11d14am.vid.5=0x16D0 +d11d14am.pid.5=0x3856 +d11d14am.build.mcu=cortex-m0plus +d11d14am.build.mathlib=arm_cortexM0l_math +d11d14am.build.f_cpu=48000000L +d11d14am.build.usb_product="MT-D11" +d11d14am.build.usb_manufacturer="Fab Foundation" +d11d14am.build.board=SAMD_ZERO +d11d14am.build.core=arduino +d11d14am.build.variant=Generic_D11D14AM +d11d14am.build.variant_system_lib= +d11d14am.build.vid=0x16D0 +d11d14am.upload.protocol=sam-ba +d11d14am.bootloader.tool=openocd +d11d14am.menu.float.default=Print & String use auto-promoted doubles only +d11d14am.menu.float.default.build.floatconfig=FLOAT_BOTH_DOUBLES_ONLY +d11d14am.menu.float.print=Print uses separate singles and doubles +d11d14am.menu.float.print.build.floatconfig=FLOAT_PRINT_SINGLES_DOUBLES +d11d14am.menu.float.string=String uses separate singles and doubles +d11d14am.menu.float.string.build.floatconfig=FLOAT_STRING_SINGLES_DOUBLES +d11d14am.menu.float.both=Print & String use separate singles and doubles +d11d14am.menu.float.both.build.floatconfig=FLOAT_BOTH_SINGLES_DOUBLES +d11d14am.menu.config.disabled=config.h disabled +d11d14am.menu.config.disabled.build.buildconfig=CONFIG_H_DISABLED +d11d14am.menu.config.enabled=config.h enabled (mostly code size reductions) +d11d14am.menu.config.enabled.build.buildconfig=CONFIG_H_ENABLED +d11d14am.menu.clock.crystal_32k=32KHZ_CRYSTAL +d11d14am.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32768HZ_CRYSTAL +d11d14am.menu.clock.crystal_hs=HIGH_SPEED_CRYSTAL +d11d14am.menu.clock.crystal_hs.build.clockconfig=CLOCKCONFIG_HS_CRYSTAL +d11d14am.menu.clock.internal=INTERNAL_OSCILLATOR +d11d14am.menu.clock.internal.build.clockconfig=CLOCKCONFIG_INTERNAL +d11d14am.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED_OSCILLATOR +d11d14am.menu.clock.internal_usb.build.clockconfig=CLOCKCONFIG_INTERNAL_USB +d11d14am.menu.timer.timer_732Hz=732.4Hz (16-bit) +d11d14am.menu.timer.timer_732Hz.build.timerconfig=TIMER_732Hz +d11d14am.menu.timer.timer_366Hz=366.2Hz (16-bit) +d11d14am.menu.timer.timer_366Hz.build.timerconfig=TIMER_366Hz +d11d14am.menu.timer.timer_244Hz=244.1Hz (16-bit) +d11d14am.menu.timer.timer_244Hz.build.timerconfig=TIMER_244Hz +d11d14am.menu.timer.timer_183Hz=183.1Hz (16-bit) +d11d14am.menu.timer.timer_183Hz.build.timerconfig=TIMER_183Hz +d11d14am.menu.timer.timer_146Hz=146.5Hz (16-bit) +d11d14am.menu.timer.timer_146Hz.build.timerconfig=TIMER_146Hz +d11d14am.menu.timer.timer_122Hz=122.1Hz (16-bit) +d11d14am.menu.timer.timer_122Hz.build.timerconfig=TIMER_122Hz +d11d14am.menu.timer.timer_105Hz=104.6Hz (16-bit) +d11d14am.menu.timer.timer_105Hz.build.timerconfig=TIMER_105Hz +d11d14am.menu.timer.timer_81Hz=81.38Hz (16-bit) +d11d14am.menu.timer.timer_81Hz.build.timerconfig=TIMER_81Hz +d11d14am.menu.timer.timer_61Hz=61.04Hz (16-bit) +d11d14am.menu.timer.timer_61Hz.build.timerconfig=TIMER_61Hz +d11d14am.menu.timer.timer_31Hz=30.52Hz (16-bit) +d11d14am.menu.timer.timer_31Hz.build.timerconfig=TIMER_31Hz +d11d14am.menu.timer.timer_187500Hz=187500Hz (8-bit) +d11d14am.menu.timer.timer_187500Hz.build.timerconfig=TIMER_187500Hz +d11d14am.menu.timer.timer_93750Hz=93750Hz (8-bit) +d11d14am.menu.timer.timer_93750Hz.build.timerconfig=TIMER_93750Hz +d11d14am.menu.timer.timer_62500Hz=62500Hz (8-bit) +d11d14am.menu.timer.timer_62500Hz.build.timerconfig=TIMER_62500Hz +d11d14am.menu.timer.timer_37500Hz=37500Hz (8-bit) +d11d14am.menu.timer.timer_37500Hz.build.timerconfig=TIMER_37500Hz +d11d14am.menu.timer.timer_20833Hz=20833Hz (8-bit) +d11d14am.menu.timer.timer_20833Hz.build.timerconfig=TIMER_20833Hz +d11d14am.menu.timer.timer_12500Hz=12500Hz (8-bit) +d11d14am.menu.timer.timer_12500Hz.build.timerconfig=TIMER_12500Hz +d11d14am.menu.timer.timer_7500Hz=7500Hz (8-bit) +d11d14am.menu.timer.timer_7500Hz.build.timerconfig=TIMER_7500Hz +d11d14am.menu.timer.timer_4166Hz=4166Hz (8-bit) +d11d14am.menu.timer.timer_4166Hz.build.timerconfig=TIMER_4166Hz +d11d14am.menu.timer.timer_2930Hz=2930Hz (8-bit) +d11d14am.menu.timer.timer_2930Hz.build.timerconfig=TIMER_2930Hz +d11d14am.menu.timer.timer_1465Hz=1465Hz (8-bit) +d11d14am.menu.timer.timer_1465Hz.build.timerconfig=TIMER_1465Hz +d11d14am.build.extra_flags=-D__SAMD11D14AM__ {build.usb_flags} -DARM_MATH_CM0PLUS +d11d14am.build.ldscript=flash_16KB.ld +d11d14am.build.openocdscript=openocd_scripts/SAMD11D14AM.cfg +d11d14am.bootloader.file=zero/binaries/sam_ba_SAMD11D14AM.bin +d11d14am.menu.bootloader.4kb=4KB_BOOTLOADER +d11d14am.menu.bootloader.4kb.build.bootloader_size=__4KB_BOOTLOADER__ +d11d14am.menu.bootloader.4kb.build.ldscript_path=linker_scripts/gcc/4KB_Bootloader +d11d14am.menu.bootloader.4kb.upload.tool=Fab_SAM_Arduino:bossac +d11d14am.menu.bootloader.4kb.upload.use_1200bps_touch=true +d11d14am.menu.bootloader.4kb.upload.wait_for_upload_port=true +d11d14am.menu.bootloader.4kb.upload.native_usb=true +d11d14am.menu.bootloader.4kb.upload.maximum_size=12288 +d11d14am.menu.bootloader.0kb=NO_BOOTLOADER +d11d14am.menu.bootloader.0kb.build.bootloader_size=__NO_BOOTLOADER__ +d11d14am.menu.bootloader.0kb.build.ldscript_path=linker_scripts/gcc/No_Bootloader +d11d14am.menu.bootloader.0kb.upload.tool=openocd +d11d14am.menu.bootloader.0kb.upload.use_1200bps_touch=false +d11d14am.menu.bootloader.0kb.upload.wait_for_upload_port=false +d11d14am.menu.bootloader.0kb.upload.native_usb=false +d11d14am.menu.bootloader.0kb.upload.maximum_size=16384 +d11d14am.menu.serial.one_uart=ONE_UART_ONE_WIRE_ONE_SPI +d11d14am.menu.serial.one_uart.build.serialcom_uart=ONE_UART +d11d14am.menu.serial.one_uart.build.serialcom_wire=ONE_WIRE +d11d14am.menu.serial.one_uart.build.serialcom_spi=ONE_SPI +d11d14am.menu.serial.no_uart=NO_UART_ONE_WIRE_ONE_SPI +d11d14am.menu.serial.no_uart.build.serialcom_uart=NO_UART +d11d14am.menu.serial.no_uart.build.serialcom_wire=ONE_WIRE +d11d14am.menu.serial.no_uart.build.serialcom_spi=ONE_SPI +d11d14am.menu.serial.two_uart=TWO_UART_ONE_WIRE_NO_SPI +d11d14am.menu.serial.two_uart.build.serialcom_uart=TWO_UART +d11d14am.menu.serial.two_uart.build.serialcom_wire=ONE_WIRE +d11d14am.menu.serial.two_uart.build.serialcom_spi=NO_SPI +d11d14am.menu.usb.cdc=CDC_ONLY +d11d14am.menu.usb.cdc.build.usbcom=CDC_ONLY +d11d14am.menu.usb.cdc.build.pid=0x3557 +d11d14am.menu.usb.cdc_hid=CDC_HID +d11d14am.menu.usb.cdc_hid.build.usbcom=CDC_HID +d11d14am.menu.usb.cdc_hid.build.pid=0x3856 +d11d14am.menu.usb.withcdc=WITH_CDC +d11d14am.menu.usb.withcdc.build.usbcom=WITH_CDC +d11d14am.menu.usb.withcdc.build.pid=0x3B41 +d11d14am.menu.usb.hid=HID_ONLY +d11d14am.menu.usb.hid.build.usbcom=HID_ONLY +d11d14am.menu.usb.hid.build.pid=0x3B40 +d11d14am.menu.usb.nocdc=WITHOUT_CDC +d11d14am.menu.usb.nocdc.build.usbcom=WITHOUT_CDC +d11d14am.menu.usb.nocdc.build.pid=0x3A0C +d11d14am.menu.usb.none=USB_DISABLED +d11d14am.menu.usb.none.build.usbcom=USB_DISABLED +d11d14am.menu.usb.none.build.pid=0x3856 + +# Generic x21E +x21e.name=Generic x21E +x21e.vid.0=0x16D0 +x21e.pid.0=0x4557 +x21e.vid.1=0x16D0 +x21e.pid.1=0x4856 +x21e.vid.2=0x16D0 +x21e.pid.2=0x4B41 +x21e.vid.3=0x16D0 +x21e.pid.3=0x4B40 +x21e.vid.4=0x16D0 +x21e.pid.4=0x4A0C +x21e.vid.5=0x16D0 +x21e.pid.5=0x4856 +x21e.build.mcu=cortex-m0plus +x21e.build.mathlib=arm_cortexM0l_math +x21e.build.f_cpu=48000000L +x21e.build.usb_product="x21E" +x21e.build.usb_manufacturer="Fab Foundation" +x21e.build.board=SAMD_ZERO +x21e.build.core=arduino +x21e.build.variant=Generic_x21E +x21e.build.variant_system_lib= +x21e.build.vid=0x16D0 +x21e.upload.protocol=sam-ba +x21e.bootloader.tool=openocd +x21e.menu.float.default=Print & String use auto-promoted doubles only +x21e.menu.float.default.build.floatconfig=FLOAT_BOTH_DOUBLES_ONLY +x21e.menu.float.print=Print uses separate singles and doubles +x21e.menu.float.print.build.floatconfig=FLOAT_PRINT_SINGLES_DOUBLES +x21e.menu.float.string=String uses separate singles and doubles +x21e.menu.float.string.build.floatconfig=FLOAT_STRING_SINGLES_DOUBLES +x21e.menu.float.both=Print & String use separate singles and doubles +x21e.menu.float.both.build.floatconfig=FLOAT_BOTH_SINGLES_DOUBLES +x21e.menu.config.disabled=config.h disabled +x21e.menu.config.disabled.build.buildconfig=CONFIG_H_DISABLED +x21e.menu.config.enabled=config.h enabled (mostly code size reductions) +x21e.menu.config.enabled.build.buildconfig=CONFIG_H_ENABLED +x21e.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED_OSCILLATOR +x21e.menu.clock.internal_usb.build.clockconfig=CLOCKCONFIG_INTERNAL_USB +x21e.menu.clock.internal=INTERNAL_OSCILLATOR +x21e.menu.clock.internal.build.clockconfig=CLOCKCONFIG_INTERNAL +x21e.menu.clock.crystal_32k=32KHZ_CRYSTAL +x21e.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32768HZ_CRYSTAL +x21e.menu.clock.crystal_hs=HIGH_SPEED_CRYSTAL +x21e.menu.clock.crystal_hs.build.clockconfig=CLOCKCONFIG_HS_CRYSTAL +x21e.menu.timer.timer_732Hz=732.4Hz (16-bit) +x21e.menu.timer.timer_732Hz.build.timerconfig=TIMER_732Hz +x21e.menu.timer.timer_366Hz=366.2Hz (16-bit) +x21e.menu.timer.timer_366Hz.build.timerconfig=TIMER_366Hz +x21e.menu.timer.timer_244Hz=244.1Hz (16-bit) +x21e.menu.timer.timer_244Hz.build.timerconfig=TIMER_244Hz +x21e.menu.timer.timer_183Hz=183.1Hz (16-bit) +x21e.menu.timer.timer_183Hz.build.timerconfig=TIMER_183Hz +x21e.menu.timer.timer_146Hz=146.5Hz (16-bit) +x21e.menu.timer.timer_146Hz.build.timerconfig=TIMER_146Hz +x21e.menu.timer.timer_122Hz=122.1Hz (16-bit) +x21e.menu.timer.timer_122Hz.build.timerconfig=TIMER_122Hz +x21e.menu.timer.timer_105Hz=104.6Hz (16-bit) +x21e.menu.timer.timer_105Hz.build.timerconfig=TIMER_105Hz +x21e.menu.timer.timer_81Hz=81.38Hz (16-bit) +x21e.menu.timer.timer_81Hz.build.timerconfig=TIMER_81Hz +x21e.menu.timer.timer_61Hz=61.04Hz (16-bit) +x21e.menu.timer.timer_61Hz.build.timerconfig=TIMER_61Hz +x21e.menu.timer.timer_31Hz=30.52Hz (16-bit) +x21e.menu.timer.timer_31Hz.build.timerconfig=TIMER_31Hz +x21e.menu.timer.timer_187500Hz=187500Hz (8-bit) +x21e.menu.timer.timer_187500Hz.build.timerconfig=TIMER_187500Hz +x21e.menu.timer.timer_93750Hz=93750Hz (8-bit) +x21e.menu.timer.timer_93750Hz.build.timerconfig=TIMER_93750Hz +x21e.menu.timer.timer_62500Hz=62500Hz (8-bit) +x21e.menu.timer.timer_62500Hz.build.timerconfig=TIMER_62500Hz +x21e.menu.timer.timer_37500Hz=37500Hz (8-bit) +x21e.menu.timer.timer_37500Hz.build.timerconfig=TIMER_37500Hz +x21e.menu.timer.timer_20833Hz=20833Hz (8-bit) +x21e.menu.timer.timer_20833Hz.build.timerconfig=TIMER_20833Hz +x21e.menu.timer.timer_12500Hz=12500Hz (8-bit) +x21e.menu.timer.timer_12500Hz.build.timerconfig=TIMER_12500Hz +x21e.menu.timer.timer_7500Hz=7500Hz (8-bit) +x21e.menu.timer.timer_7500Hz.build.timerconfig=TIMER_7500Hz +x21e.menu.timer.timer_4166Hz=4166Hz (8-bit) +x21e.menu.timer.timer_4166Hz.build.timerconfig=TIMER_4166Hz +x21e.menu.timer.timer_2930Hz=2930Hz (8-bit) +x21e.menu.timer.timer_2930Hz.build.timerconfig=TIMER_2930Hz +x21e.menu.timer.timer_1465Hz=1465Hz (8-bit) +x21e.menu.timer.timer_1465Hz.build.timerconfig=TIMER_1465Hz +x21e.menu.cpu.samd21e15a=SAMD21E15A +x21e.menu.cpu.samd21e15a.upload.maximum_size=24576 +x21e.menu.cpu.samd21e15a.build.extra_flags=-D__SAMD21E15A__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21e.menu.cpu.samd21e15a.build.ldscript=flash_32KB.ld +x21e.menu.cpu.samd21e15a.build.openocdscript=openocd_scripts/SAMD21E15A.cfg +x21e.menu.cpu.samd21e15a.bootloader.file=zero/binaries/sam_ba_SAMD21E15A.bin +x21e.menu.cpu.samd21e16a=SAMD21E16A +x21e.menu.cpu.samd21e16a.upload.maximum_size=57344 +x21e.menu.cpu.samd21e16a.build.extra_flags=-D__SAMD21E16A__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21e.menu.cpu.samd21e16a.build.ldscript=flash_64KB.ld +x21e.menu.cpu.samd21e16a.build.openocdscript=openocd_scripts/SAMD21E16A.cfg +x21e.menu.cpu.samd21e16a.bootloader.file=zero/binaries/sam_ba_SAMD21E16A.bin +x21e.menu.cpu.samd21e17a=SAMD21E17A +x21e.menu.cpu.samd21e17a.upload.maximum_size=122880 +x21e.menu.cpu.samd21e17a.build.extra_flags=-D__SAMD21E17A__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21e.menu.cpu.samd21e17a.build.ldscript=flash_128KB.ld +x21e.menu.cpu.samd21e17a.build.openocdscript=openocd_scripts/SAMD21E17A.cfg +x21e.menu.cpu.samd21e17a.bootloader.file=zero/binaries/sam_ba_SAMD21E17A.bin +x21e.menu.cpu.samd21e18a=SAMD21E18A +x21e.menu.cpu.samd21e18a.upload.maximum_size=253952 +x21e.menu.cpu.samd21e18a.build.extra_flags=-D__SAMD21E18A__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21e.menu.cpu.samd21e18a.build.ldscript=flash_256KB.ld +x21e.menu.cpu.samd21e18a.build.openocdscript=openocd_scripts/SAMD21E18A.cfg +x21e.menu.cpu.samd21e18a.bootloader.file=zero/binaries/sam_ba_SAMD21E18A.bin +x21e.menu.cpu.saml21e15b=SAML21E15B +x21e.menu.cpu.saml21e15b.upload.maximum_size=24576 +x21e.menu.cpu.saml21e15b.build.extra_flags=-D__SAML21E15B__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21e.menu.cpu.saml21e15b.build.ldscript=flash_32KB.ld +x21e.menu.cpu.saml21e15b.build.openocdscript=openocd_scripts/SAML21E15B.cfg +x21e.menu.cpu.saml21e15b.bootloader.file=zero/binaries/sam_ba_SAML21E15B.bin +x21e.menu.cpu.saml21e16b=SAML21E16B +x21e.menu.cpu.saml21e16b.upload.maximum_size=57344 +x21e.menu.cpu.saml21e16b.build.extra_flags=-D__SAML21E16B__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21e.menu.cpu.saml21e16b.build.ldscript=flash_64KB.ld +x21e.menu.cpu.saml21e16b.build.openocdscript=openocd_scripts/SAML21E16B.cfg +x21e.menu.cpu.saml21e16b.bootloader.file=zero/binaries/sam_ba_SAML21E16B.bin +x21e.menu.cpu.saml21e17b=SAML21E17B +x21e.menu.cpu.saml21e17b.upload.maximum_size=122880 +x21e.menu.cpu.saml21e17b.build.extra_flags=-D__SAML21E17B__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21e.menu.cpu.saml21e17b.build.ldscript=flash_128KB.ld +x21e.menu.cpu.saml21e17b.build.openocdscript=openocd_scripts/SAML21E17B.cfg +x21e.menu.cpu.saml21e17b.bootloader.file=zero/binaries/sam_ba_SAML21E17B.bin +x21e.menu.cpu.saml21e18b=SAML21E18B +x21e.menu.cpu.saml21e18b.upload.maximum_size=253952 +x21e.menu.cpu.saml21e18b.build.extra_flags=-D__SAML21E18B__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21e.menu.cpu.saml21e18b.build.ldscript=flash_256KB.ld +x21e.menu.cpu.saml21e18b.build.openocdscript=openocd_scripts/SAML21E18B.cfg +x21e.menu.cpu.saml21e18b.bootloader.file=zero/binaries/sam_ba_SAML21E18B.bin +x21e.menu.cpu.samc21e15a=SAMC21E15A +x21e.menu.cpu.samc21e15a.upload.maximum_size=24576 +x21e.menu.cpu.samc21e15a.build.extra_flags=-D__SAMC21E15A__ -DARM_MATH_CM0PLUS +x21e.menu.cpu.samc21e15a.build.ldscript=flash_32KB.ld +x21e.menu.cpu.samc21e15a.build.openocdscript=openocd_scripts/SAMC21E15A.cfg +x21e.menu.cpu.samc21e15a.bootloader.file=zero/binaries/sam_ba_SAMC21E15A.bin +x21e.menu.cpu.samc21e16a=SAMC21E16A +x21e.menu.cpu.samc21e16a.upload.maximum_size=57344 +x21e.menu.cpu.samc21e16a.build.extra_flags=-D__SAMC21E16A__ -DARM_MATH_CM0PLUS +x21e.menu.cpu.samc21e16a.build.ldscript=flash_64KB.ld +x21e.menu.cpu.samc21e16a.build.openocdscript=openocd_scripts/SAMC21E16A.cfg +x21e.menu.cpu.samc21e16a.bootloader.file=zero/binaries/sam_ba_SAMC21E16A.bin +x21e.menu.cpu.samc21e17a=SAMC21E17A +x21e.menu.cpu.samc21e17a.upload.maximum_size=122880 +x21e.menu.cpu.samc21e17a.build.extra_flags=-D__SAMC21E17A__ -DARM_MATH_CM0PLUS +x21e.menu.cpu.samc21e17a.build.ldscript=flash_128KB.ld +x21e.menu.cpu.samc21e17a.build.openocdscript=openocd_scripts/SAMC21E17A.cfg +x21e.menu.cpu.samc21e17a.bootloader.file=zero/binaries/sam_ba_SAMC21E17A.bin +x21e.menu.cpu.samc21e18a=SAMC21E18A +x21e.menu.cpu.samc21e18a.upload.maximum_size=253952 +x21e.menu.cpu.samc21e18a.build.extra_flags=-D__SAMC21E18A__ -DARM_MATH_CM0PLUS +x21e.menu.cpu.samc21e18a.build.ldscript=flash_256KB.ld +x21e.menu.cpu.samc21e18a.build.openocdscript=openocd_scripts/SAMC21E18A.cfg +x21e.menu.cpu.samc21e18a.bootloader.file=zero/binaries/sam_ba_SAMC21E18A.bin +x21e.menu.bootloader.8kb=8KB_BOOTLOADER +x21e.menu.bootloader.8kb.build.bootloader_size=__8KB_BOOTLOADER__ +x21e.menu.bootloader.8kb.build.ldscript_path=linker_scripts/gcc/8KB_Bootloader +x21e.menu.bootloader.8kb.upload.tool=Fab_SAM_Arduino:bossac +x21e.menu.bootloader.8kb.upload.use_1200bps_touch=true +x21e.menu.bootloader.8kb.upload.wait_for_upload_port=true +x21e.menu.bootloader.8kb.upload.native_usb=true +x21e.menu.bootloader.16kb=16KB_BOOTLOADER +x21e.menu.bootloader.16kb.build.bootloader_size=__16KB_BOOTLOADER__ +x21e.menu.bootloader.16kb.build.ldscript_path=linker_scripts/gcc/16KB_Bootloader +x21e.menu.bootloader.16kb.upload.tool=Fab_SAM_Arduino:bossac +x21e.menu.bootloader.16kb.upload.use_1200bps_touch=true +x21e.menu.bootloader.16kb.upload.wait_for_upload_port=true +x21e.menu.bootloader.16kb.upload.native_usb=true +x21e.menu.bootloader.0kb=NO_BOOTLOADER +x21e.menu.bootloader.0kb.build.bootloader_size=__NO_BOOTLOADER__ +x21e.menu.bootloader.0kb.build.ldscript_path=linker_scripts/gcc/No_Bootloader +x21e.menu.bootloader.0kb.upload.tool=openocd +x21e.menu.bootloader.0kb.upload.use_1200bps_touch=false +x21e.menu.bootloader.0kb.upload.wait_for_upload_port=false +x21e.menu.bootloader.0kb.upload.native_usb=false +x21e.menu.serial.one_uart=ONE_UART_ONE_WIRE_ONE_SPI +x21e.menu.serial.one_uart.build.serialcom_uart=ONE_UART +x21e.menu.serial.one_uart.build.serialcom_wire=ONE_WIRE +x21e.menu.serial.one_uart.build.serialcom_spi=ONE_SPI +x21e.menu.serial.one_uart_one_wire_two_spi=ONE_UART_ONE_WIRE_TWO_SPI +x21e.menu.serial.one_uart_one_wire_two_spi.build.serialcom_uart=ONE_UART +x21e.menu.serial.one_uart_one_wire_two_spi.build.serialcom_wire=ONE_WIRE +x21e.menu.serial.one_uart_one_wire_two_spi.build.serialcom_spi=TWO_SPI +x21e.menu.serial.one_uart_two_wire_one_spi=ONE_UART_TWO_WIRE_ONE_SPI +x21e.menu.serial.one_uart_two_wire_one_spi.build.serialcom_uart=ONE_UART +x21e.menu.serial.one_uart_two_wire_one_spi.build.serialcom_wire=TWO_WIRE +x21e.menu.serial.one_uart_two_wire_one_spi.build.serialcom_spi=ONE_SPI +x21e.menu.serial.two_uart=TWO_UART_ONE_WIRE_ONE_SPI +x21e.menu.serial.two_uart.build.serialcom_uart=TWO_UART +x21e.menu.serial.two_uart.build.serialcom_wire=ONE_WIRE +x21e.menu.serial.two_uart.build.serialcom_spi=ONE_SPI +x21e.menu.serial.three_uart_one_wire_no_spi=THREE_UART_ONE_WIRE_NO_SPI +x21e.menu.serial.three_uart_one_wire_no_spi.build.serialcom_uart=THREE_UART +x21e.menu.serial.three_uart_one_wire_no_spi.build.serialcom_wire=ONE_WIRE +x21e.menu.serial.three_uart_one_wire_no_spi.build.serialcom_spi=NO_SPI +x21e.menu.serial.three_uart_no_wire_one_spi=THREE_UART_NO_WIRE_ONE_SPI +x21e.menu.serial.three_uart_no_wire_one_spi.build.serialcom_uart=THREE_UART +x21e.menu.serial.three_uart_no_wire_one_spi.build.serialcom_wire=NO_WIRE +x21e.menu.serial.three_uart_no_wire_one_spi.build.serialcom_spi=ONE_SPI +x21e.menu.serial.four_uart=FOUR_UART_NO_WIRE_NO_SPI +x21e.menu.serial.four_uart.build.serialcom_uart=FOUR_UART +x21e.menu.serial.four_uart.build.serialcom_wire=NO_WIRE +x21e.menu.serial.four_uart.build.serialcom_spi=NO_SPI +x21e.menu.serial.no_uart_one_wire_two_spi=NO_UART_ONE_WIRE_TWO_SPI +x21e.menu.serial.no_uart_one_wire_two_spi.build.serialcom_uart=NO_UART +x21e.menu.serial.no_uart_one_wire_two_spi.build.serialcom_wire=ONE_WIRE +x21e.menu.serial.no_uart_one_wire_two_spi.build.serialcom_spi=TWO_SPI +x21e.menu.serial.four_uart_one_wire_one_spi=FOUR_UART_ONE_WIRE_ONE_SPI (L21 only) +x21e.menu.serial.four_uart_one_wire_one_spi.build.serialcom_uart=FOUR_UART +x21e.menu.serial.four_uart_one_wire_one_spi.build.serialcom_wire=ONE_WIRE +x21e.menu.serial.four_uart_one_wire_one_spi.build.serialcom_spi=ONE_SPI +x21e.menu.serial.five_uart_no_wire_one_spi=FIVE_UART_NO_WIRE_ONE_SPI (L21 only) +x21e.menu.serial.five_uart_no_wire_one_spi.build.serialcom_uart=FIVE_UART +x21e.menu.serial.five_uart_no_wire_one_spi.build.serialcom_wire=NO_WIRE +x21e.menu.serial.five_uart_no_wire_one_spi.build.serialcom_spi=ONE_SPI +x21e.menu.serial.five_uart_one_wire_no_spi=FIVE_UART_ONE_WIRE_NO_SPI (L21 only) +x21e.menu.serial.five_uart_one_wire_no_spi.build.serialcom_uart=FIVE_UART +x21e.menu.serial.five_uart_one_wire_no_spi.build.serialcom_wire=ONE_WIRE +x21e.menu.serial.five_uart_one_wire_no_spi.build.serialcom_spi=NO_SPI +x21e.menu.serial.six_uart=SIX_UART_NO_WIRE_NO_SPI (L21 only) +x21e.menu.serial.six_uart.build.serialcom_uart=SIX_UART +x21e.menu.serial.six_uart.build.serialcom_wire=NO_WIRE +x21e.menu.serial.six_uart.build.serialcom_spi=NO_SPI +x21e.menu.usb.cdc=CDC_ONLY +x21e.menu.usb.cdc.build.usbcom=CDC_ONLY +x21e.menu.usb.cdc.build.pid=0x4557 +x21e.menu.usb.cdc_hid=CDC_HID +x21e.menu.usb.cdc_hid.build.usbcom=CDC_HID +x21e.menu.usb.cdc_hid.build.pid=0x4856 +x21e.menu.usb.withcdc=WITH_CDC +x21e.menu.usb.withcdc.build.usbcom=WITH_CDC +x21e.menu.usb.withcdc.build.pid=0x4B41 +x21e.menu.usb.hid=HID_ONLY +x21e.menu.usb.hid.build.usbcom=HID_ONLY +x21e.menu.usb.hid.build.pid=0x4B40 +x21e.menu.usb.nocdc=WITHOUT_CDC +x21e.menu.usb.nocdc.build.usbcom=WITHOUT_CDC +x21e.menu.usb.nocdc.build.pid=0x4A0C +x21e.menu.usb.none=USB_DISABLED +x21e.menu.usb.none.build.usbcom=USB_DISABLED +x21e.menu.usb.none.build.pid=0x4856 + +# Generic x21G +x21g.name=Generic x21G +x21g.vid.0=0x16D0 +x21g.pid.0=0x5557 +x21g.vid.1=0x16D0 +x21g.pid.1=0x5856 +x21g.vid.2=0x16D0 +x21g.pid.2=0x5B41 +x21g.vid.3=0x16D0 +x21g.pid.3=0x5B40 +x21g.vid.4=0x16D0 +x21g.pid.4=0x5A0C +x21g.vid.5=0x16D0 +x21g.pid.5=0x5856 +x21g.build.usb_manufacturer="Fab Foundation" +x21g.build.board=SAMD_ZERO +x21g.build.core=arduino +x21g.build.variant=Generic_xx1G +x21g.build.variant_system_lib= +x21g.build.vid=0x16D0 +x21g.upload.protocol=sam-ba +x21g.bootloader.tool=openocd +x21g.menu.float.default=Print & String use auto-promoted doubles only +x21g.menu.float.default.build.floatconfig=FLOAT_BOTH_DOUBLES_ONLY +x21g.menu.float.print=Print uses separate singles and doubles +x21g.menu.float.print.build.floatconfig=FLOAT_PRINT_SINGLES_DOUBLES +x21g.menu.float.string=String uses separate singles and doubles +x21g.menu.float.string.build.floatconfig=FLOAT_STRING_SINGLES_DOUBLES +x21g.menu.float.both=Print & String use separate singles and doubles +x21g.menu.float.both.build.floatconfig=FLOAT_BOTH_SINGLES_DOUBLES +x21g.menu.config.disabled=config.h disabled +x21g.menu.config.disabled.build.buildconfig=CONFIG_H_DISABLED +x21g.menu.config.enabled=config.h enabled (mostly code size reductions) +x21g.menu.config.enabled.build.buildconfig=CONFIG_H_ENABLED +x21g.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED_OSCILLATOR +x21g.menu.clock.internal_usb.build.clockconfig=CLOCKCONFIG_INTERNAL_USB +x21g.menu.clock.internal=INTERNAL_OSCILLATOR +x21g.menu.clock.internal.build.clockconfig=CLOCKCONFIG_INTERNAL +x21g.menu.clock.crystal_32k=32KHZ_CRYSTAL +x21g.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32768HZ_CRYSTAL +x21g.menu.clock.crystal_hs=HIGH_SPEED_CRYSTAL +x21g.menu.clock.crystal_hs.build.clockconfig=CLOCKCONFIG_HS_CRYSTAL +x21g.menu.timer.timer_732Hz=732.4Hz (16-bit) +x21g.menu.timer.timer_732Hz.build.timerconfig=TIMER_732Hz +x21g.menu.timer.timer_366Hz=366.2Hz (16-bit) +x21g.menu.timer.timer_366Hz.build.timerconfig=TIMER_366Hz +x21g.menu.timer.timer_244Hz=244.1Hz (16-bit) +x21g.menu.timer.timer_244Hz.build.timerconfig=TIMER_244Hz +x21g.menu.timer.timer_183Hz=183.1Hz (16-bit) +x21g.menu.timer.timer_183Hz.build.timerconfig=TIMER_183Hz +x21g.menu.timer.timer_146Hz=146.5Hz (16-bit) +x21g.menu.timer.timer_146Hz.build.timerconfig=TIMER_146Hz +x21g.menu.timer.timer_122Hz=122.1Hz (16-bit) +x21g.menu.timer.timer_122Hz.build.timerconfig=TIMER_122Hz +x21g.menu.timer.timer_105Hz=104.6Hz (16-bit) +x21g.menu.timer.timer_105Hz.build.timerconfig=TIMER_105Hz +x21g.menu.timer.timer_81Hz=81.38Hz (16-bit) +x21g.menu.timer.timer_81Hz.build.timerconfig=TIMER_81Hz +x21g.menu.timer.timer_61Hz=61.04Hz (16-bit) +x21g.menu.timer.timer_61Hz.build.timerconfig=TIMER_61Hz +x21g.menu.timer.timer_31Hz=30.52Hz (16-bit) +x21g.menu.timer.timer_31Hz.build.timerconfig=TIMER_31Hz +x21g.menu.timer.timer_187500Hz=187500Hz (8-bit) +x21g.menu.timer.timer_187500Hz.build.timerconfig=TIMER_187500Hz +x21g.menu.timer.timer_93750Hz=93750Hz (8-bit) +x21g.menu.timer.timer_93750Hz.build.timerconfig=TIMER_93750Hz +x21g.menu.timer.timer_62500Hz=62500Hz (8-bit) +x21g.menu.timer.timer_62500Hz.build.timerconfig=TIMER_62500Hz +x21g.menu.timer.timer_37500Hz=37500Hz (8-bit) +x21g.menu.timer.timer_37500Hz.build.timerconfig=TIMER_37500Hz +x21g.menu.timer.timer_20833Hz=20833Hz (8-bit) +x21g.menu.timer.timer_20833Hz.build.timerconfig=TIMER_20833Hz +x21g.menu.timer.timer_12500Hz=12500Hz (8-bit) +x21g.menu.timer.timer_12500Hz.build.timerconfig=TIMER_12500Hz +x21g.menu.timer.timer_7500Hz=7500Hz (8-bit) +x21g.menu.timer.timer_7500Hz.build.timerconfig=TIMER_7500Hz +x21g.menu.timer.timer_4166Hz=4166Hz (8-bit) +x21g.menu.timer.timer_4166Hz.build.timerconfig=TIMER_4166Hz +x21g.menu.timer.timer_2930Hz=2930Hz (8-bit) +x21g.menu.timer.timer_2930Hz.build.timerconfig=TIMER_2930Hz +x21g.menu.timer.timer_1465Hz=1465Hz (8-bit) +x21g.menu.timer.timer_1465Hz.build.timerconfig=TIMER_1465Hz +x21g.menu.cpu.samd21g17a=SAMD21G17A +x21g.menu.cpu.samd21g17a.upload.maximum_size=122880 +x21g.menu.cpu.samd21g17a.build.mcu=cortex-m0plus +x21g.menu.cpu.samd21g17a.build.mathlib=arm_cortexM0l_math +x21g.menu.cpu.samd21g17a.build.f_cpu=48000000L +x21g.menu.cpu.samd21g17a.build.usb_product="D21" +x21g.menu.cpu.samd21g17a.build.extra_flags=-D__SAMD21G17A__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21g.menu.cpu.samd21g17a.build.ldscript=flash_128KB.ld +x21g.menu.cpu.samd21g17a.build.openocdscript=openocd_scripts/SAMD21G17A.cfg +x21g.menu.cpu.samd21g17a.bootloader.file=zero/binaries/sam_ba_SAMD21G17A.bin +x21g.menu.cpu.samd21g18a=SAMD21G18A +x21g.menu.cpu.samd21g18a.upload.maximum_size=253952 +x21g.menu.cpu.samd21g18a.build.mcu=cortex-m0plus +x21g.menu.cpu.samd21g18a.build.mathlib=arm_cortexM0l_math +x21g.menu.cpu.samd21g18a.build.f_cpu=48000000L +x21g.menu.cpu.samd21g18a.build.usb_product="D21" +x21g.menu.cpu.samd21g18a.build.extra_flags=-D__SAMD21G18A__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21g.menu.cpu.samd21g18a.build.ldscript=flash_256KB.ld +x21g.menu.cpu.samd21g18a.build.openocdscript=openocd_scripts/SAMD21G18A.cfg +x21g.menu.cpu.samd21g18a.bootloader.file=zero/binaries/sam_ba_SAMD21G18A.bin +x21g.menu.cpu.samd21g15a=SAMD21G15A +x21g.menu.cpu.samd21g15a.upload.maximum_size=24576 +x21g.menu.cpu.samd21g15a.build.mcu=cortex-m0plus +x21g.menu.cpu.samd21g15a.build.mathlib=arm_cortexM0l_math +x21g.menu.cpu.samd21g15a.build.f_cpu=48000000L +x21g.menu.cpu.samd21g15a.build.usb_product="D21" +x21g.menu.cpu.samd21g15a.build.extra_flags=-D__SAMD21G15A__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21g.menu.cpu.samd21g15a.build.ldscript=flash_32KB.ld +x21g.menu.cpu.samd21g15a.build.openocdscript=openocd_scripts/SAMD21G15A.cfg +x21g.menu.cpu.samd21g15a.bootloader.file=zero/binaries/sam_ba_SAMD21G15A.bin +x21g.menu.cpu.samd21g16a=SAMD21G16A +x21g.menu.cpu.samd21g16a.upload.maximum_size=57344 +x21g.menu.cpu.samd21g16a.build.mcu=cortex-m0plus +x21g.menu.cpu.samd21g16a.build.mathlib=arm_cortexM0l_math +x21g.menu.cpu.samd21g16a.build.f_cpu=48000000L +x21g.menu.cpu.samd21g16a.build.usb_product="D21" +x21g.menu.cpu.samd21g16a.build.extra_flags=-D__SAMD21G16A__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21g.menu.cpu.samd21g16a.build.ldscript=flash_64KB.ld +x21g.menu.cpu.samd21g16a.build.openocdscript=openocd_scripts/SAMD21G16A.cfg +x21g.menu.cpu.samd21g16a.bootloader.file=zero/binaries/sam_ba_SAMD21G16A.bin +x21g.menu.cpu.saml21g17b=SAML21G17B +x21g.menu.cpu.saml21g17b.upload.maximum_size=122880 +x21g.menu.cpu.saml21g17b.build.mcu=cortex-m0plus +x21g.menu.cpu.saml21g17b.build.mathlib=arm_cortexM0l_math +x21g.menu.cpu.saml21g17b.build.f_cpu=48000000L +x21g.menu.cpu.saml21g17b.build.usb_product="L21" +x21g.menu.cpu.saml21g17b.build.extra_flags=-D__SAML21G17B__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21g.menu.cpu.saml21g17b.build.ldscript=flash_128KB.ld +x21g.menu.cpu.saml21g17b.build.openocdscript=openocd_scripts/SAML21G17B.cfg +x21g.menu.cpu.saml21g17b.bootloader.file=zero/binaries/sam_ba_SAML21G17B.bin +x21g.menu.cpu.saml21g18b=SAML21G18B +x21g.menu.cpu.saml21g18b.upload.maximum_size=253952 +x21g.menu.cpu.saml21g18b.build.mcu=cortex-m0plus +x21g.menu.cpu.saml21g18b.build.mathlib=arm_cortexM0l_math +x21g.menu.cpu.saml21g18b.build.f_cpu=48000000L +x21g.menu.cpu.saml21g18b.build.usb_product="L21" +x21g.menu.cpu.saml21g18b.build.extra_flags=-D__SAML21G18B__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21g.menu.cpu.saml21g18b.build.ldscript=flash_256KB.ld +x21g.menu.cpu.saml21g18b.build.openocdscript=openocd_scripts/SAML21G18B.cfg +x21g.menu.cpu.saml21g18b.bootloader.file=zero/binaries/sam_ba_SAML21G18B.bin +x21g.menu.cpu.saml21g15b=SAML21G15B +x21g.menu.cpu.saml21g15b.upload.maximum_size=24576 +x21g.menu.cpu.saml21g15b.build.mcu=cortex-m0plus +x21g.menu.cpu.saml21g15b.build.mathlib=arm_cortexM0l_math +x21g.menu.cpu.saml21g15b.build.f_cpu=48000000L +x21g.menu.cpu.saml21g15b.build.usb_product="L21" +x21g.menu.cpu.saml21g15b.build.extra_flags=-D__SAML21G15B__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21g.menu.cpu.saml21g15b.build.ldscript=flash_32KB.ld +x21g.menu.cpu.saml21g15b.build.openocdscript=openocd_scripts/SAML21G15B.cfg +x21g.menu.cpu.saml21g15b.bootloader.file=zero/binaries/sam_ba_SAML21G15B.bin +x21g.menu.cpu.saml21g16b=SAML21G16B +x21g.menu.cpu.saml21g16b.upload.maximum_size=57344 +x21g.menu.cpu.saml21g16b.build.mcu=cortex-m0plus +x21g.menu.cpu.saml21g16b.build.mathlib=arm_cortexM0l_math +x21g.menu.cpu.saml21g16b.build.f_cpu=48000000L +x21g.menu.cpu.saml21g16b.build.usb_product="L21" +x21g.menu.cpu.saml21g16b.build.extra_flags=-D__SAML21G16B__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21g.menu.cpu.saml21g16b.build.ldscript=flash_64KB.ld +x21g.menu.cpu.saml21g16b.build.openocdscript=openocd_scripts/SAML21G16B.cfg +x21g.menu.cpu.saml21g16b.bootloader.file=zero/binaries/sam_ba_SAML21G16B.bin +x21g.menu.cpu.samc21g17a=SAMC21G17A +x21g.menu.cpu.samc21g17a.upload.maximum_size=122880 +x21g.menu.cpu.samc21g17a.build.mcu=cortex-m0plus +x21g.menu.cpu.samc21g17a.build.mathlib=arm_cortexM0l_math +x21g.menu.cpu.samc21g17a.build.f_cpu=48000000L +x21g.menu.cpu.samc21g17a.build.usb_product="C21" +x21g.menu.cpu.samc21g17a.build.extra_flags=-D__SAMC21G17A__ -DARM_MATH_CM0PLUS +x21g.menu.cpu.samc21g17a.build.ldscript=flash_128KB.ld +x21g.menu.cpu.samc21g17a.build.openocdscript=openocd_scripts/SAMC21G17A.cfg +x21g.menu.cpu.samc21g17a.bootloader.file=zero/binaries/sam_ba_SAMC21G17A.bin +x21g.menu.cpu.samc21g18a=SAMC21G18A +x21g.menu.cpu.samc21g18a.upload.maximum_size=253952 +x21g.menu.cpu.samc21g18a.build.mcu=cortex-m0plus +x21g.menu.cpu.samc21g18a.build.mathlib=arm_cortexM0l_math +x21g.menu.cpu.samc21g18a.build.f_cpu=48000000L +x21g.menu.cpu.samc21g18a.build.usb_product="C21" +x21g.menu.cpu.samc21g18a.build.extra_flags=-D__SAMC21G18A__ -DARM_MATH_CM0PLUS +x21g.menu.cpu.samc21g18a.build.ldscript=flash_256KB.ld +x21g.menu.cpu.samc21g18a.build.openocdscript=openocd_scripts/SAMC21G18A.cfg +x21g.menu.cpu.samc21g18a.bootloader.file=zero/binaries/sam_ba_SAMC21G18A.bin +x21g.menu.cpu.samc21g15a=SAMC21G15A +x21g.menu.cpu.samc21g15a.upload.maximum_size=24576 +x21g.menu.cpu.samc21g15a.build.mcu=cortex-m0plus +x21g.menu.cpu.samc21g15a.build.mathlib=arm_cortexM0l_math +x21g.menu.cpu.samc21g15a.build.f_cpu=48000000L +x21g.menu.cpu.samc21g15a.build.usb_product="C21" +x21g.menu.cpu.samc21g15a.build.extra_flags=-D__SAMC21G15A__ -DARM_MATH_CM0PLUS +x21g.menu.cpu.samc21g15a.build.ldscript=flash_32KB.ld +x21g.menu.cpu.samc21g15a.build.openocdscript=openocd_scripts/SAMC21G15A.cfg +x21g.menu.cpu.samc21g15a.bootloader.file=zero/binaries/sam_ba_SAMC21G15A.bin +x21g.menu.cpu.samc21g16a=SAMC21G16A +x21g.menu.cpu.samc21g16a.upload.maximum_size=57344 +x21g.menu.cpu.samc21g16a.build.mcu=cortex-m0plus +x21g.menu.cpu.samc21g16a.build.mathlib=arm_cortexM0l_math +x21g.menu.cpu.samc21g16a.build.f_cpu=48000000L +x21g.menu.cpu.samc21g16a.build.usb_product="C21" +x21g.menu.cpu.samc21g16a.build.extra_flags=-D__SAMC21G16A__ -DARM_MATH_CM0PLUS +x21g.menu.cpu.samc21g16a.build.ldscript=flash_64KB.ld +x21g.menu.cpu.samc21g16a.build.openocdscript=openocd_scripts/SAMC21G16A.cfg +x21g.menu.cpu.samc21g16a.bootloader.file=zero/binaries/sam_ba_SAMC21G16A.bin +x21g.menu.bootloader.8kb=8KB_BOOTLOADER +x21g.menu.bootloader.8kb.build.bootloader_size=__8KB_BOOTLOADER__ +x21g.menu.bootloader.8kb.build.ldscript_path=linker_scripts/gcc/8KB_Bootloader +x21g.menu.bootloader.8kb.upload.tool=Fab_SAM_Arduino:bossac +x21g.menu.bootloader.8kb.upload.use_1200bps_touch=true +x21g.menu.bootloader.8kb.upload.wait_for_upload_port=true +x21g.menu.bootloader.8kb.upload.native_usb=true +x21g.menu.bootloader.16kb=16KB_BOOTLOADER +x21g.menu.bootloader.16kb.build.bootloader_size=__16KB_BOOTLOADER__ +x21g.menu.bootloader.16kb.build.ldscript_path=linker_scripts/gcc/16KB_Bootloader +x21g.menu.bootloader.16kb.upload.tool=Fab_SAM_Arduino:bossac +x21g.menu.bootloader.16kb.upload.use_1200bps_touch=true +x21g.menu.bootloader.16kb.upload.wait_for_upload_port=true +x21g.menu.bootloader.16kb.upload.native_usb=true +x21g.menu.bootloader.0kb=NO_BOOTLOADER +x21g.menu.bootloader.0kb.build.bootloader_size=__NO_BOOTLOADER__ +x21g.menu.bootloader.0kb.build.ldscript_path=linker_scripts/gcc/No_Bootloader +x21g.menu.bootloader.0kb.upload.tool=openocd +x21g.menu.bootloader.0kb.upload.use_1200bps_touch=false +x21g.menu.bootloader.0kb.upload.wait_for_upload_port=false +x21g.menu.bootloader.0kb.upload.native_usb=false +x21g.menu.serial.one_uart=ONE_UART_ONE_WIRE_ONE_SPI +x21g.menu.serial.one_uart.build.serialcom_uart=ONE_UART +x21g.menu.serial.one_uart.build.serialcom_wire=ONE_WIRE +x21g.menu.serial.one_uart.build.serialcom_spi=ONE_SPI +x21g.menu.serial.one_uart_two_spi=ONE_UART_ONE_WIRE_TWO_SPI +x21g.menu.serial.one_uart_two_spi.build.serialcom_uart=ONE_UART +x21g.menu.serial.one_uart_two_spi.build.serialcom_wire=ONE_WIRE +x21g.menu.serial.one_uart_two_spi.build.serialcom_spi=TWO_SPI +x21g.menu.serial.one_uart_two_wire=ONE_UART_TWO_WIRE_ONE_SPI +x21g.menu.serial.one_uart_two_wire.build.serialcom_uart=ONE_UART +x21g.menu.serial.one_uart_two_wire.build.serialcom_wire=TWO_WIRE +x21g.menu.serial.one_uart_two_wire.build.serialcom_spi=ONE_SPI +x21g.menu.serial.two_uart=TWO_UART_ONE_WIRE_ONE_SPI +x21g.menu.serial.two_uart.build.serialcom_uart=TWO_UART +x21g.menu.serial.two_uart.build.serialcom_wire=ONE_WIRE +x21g.menu.serial.two_uart.build.serialcom_spi=ONE_SPI +x21g.menu.serial.two_uart_two_spi=TWO_UART_ONE_WIRE_TWO_SPI +x21g.menu.serial.two_uart_two_spi.build.serialcom_uart=TWO_UART +x21g.menu.serial.two_uart_two_spi.build.serialcom_wire=ONE_WIRE +x21g.menu.serial.two_uart_two_spi.build.serialcom_spi=TWO_SPI +x21g.menu.serial.two_uart_two_wire=TWO_UART_TWO_WIRE_ONE_SPI +x21g.menu.serial.two_uart_two_wire.build.serialcom_uart=TWO_UART +x21g.menu.serial.two_uart_two_wire.build.serialcom_wire=TWO_WIRE +x21g.menu.serial.two_uart_two_wire.build.serialcom_spi=ONE_SPI +x21g.menu.serial.three_uart=THREE_UART_ONE_WIRE_ONE_SPI +x21g.menu.serial.three_uart.build.serialcom_uart=THREE_UART +x21g.menu.serial.three_uart.build.serialcom_wire=ONE_WIRE +x21g.menu.serial.three_uart.build.serialcom_spi=ONE_SPI +x21g.menu.serial.three_uart_two_spi=THREE_UART_ONE_WIRE_TWO_SPI +x21g.menu.serial.three_uart_two_spi.build.serialcom_uart=THREE_UART +x21g.menu.serial.three_uart_two_spi.build.serialcom_wire=ONE_WIRE +x21g.menu.serial.three_uart_two_spi.build.serialcom_spi=TWO_SPI +x21g.menu.serial.three_uart_two_wire=THREE_UART_TWO_WIRE_ONE_SPI +x21g.menu.serial.three_uart_two_wire.build.serialcom_uart=THREE_UART +x21g.menu.serial.three_uart_two_wire.build.serialcom_wire=TWO_WIRE +x21g.menu.serial.three_uart_two_wire.build.serialcom_spi=ONE_SPI +x21g.menu.serial.no_uart=NO_UART_ONE_WIRE_ONE_SPI +x21g.menu.serial.no_uart.build.serialcom_uart=NO_UART +x21g.menu.serial.no_uart.build.serialcom_wire=ONE_WIRE +x21g.menu.serial.no_uart.build.serialcom_spi=ONE_SPI +x21g.menu.usb.cdc=CDC_ONLY +x21g.menu.usb.cdc.build.usbcom=CDC_ONLY +x21g.menu.usb.cdc.build.pid=0x5557 +x21g.menu.usb.cdc_hid=CDC_HID +x21g.menu.usb.cdc_hid.build.usbcom=CDC_HID +x21g.menu.usb.cdc_hid.build.pid=0x5856 +x21g.menu.usb.withcdc=WITH_CDC +x21g.menu.usb.withcdc.build.usbcom=WITH_CDC +x21g.menu.usb.withcdc.build.pid=0x5B41 +x21g.menu.usb.hid=HID_ONLY +x21g.menu.usb.hid.build.usbcom=HID_ONLY +x21g.menu.usb.hid.build.pid=0x5B40 +x21g.menu.usb.nocdc=WITHOUT_CDC +x21g.menu.usb.nocdc.build.usbcom=WITHOUT_CDC +x21g.menu.usb.nocdc.build.pid=0x5A0C +x21g.menu.usb.none=USB_DISABLED +x21g.menu.usb.none.build.usbcom=USB_DISABLED +x21g.menu.usb.none.build.pid=0x5856 + +# Generic x21J +x21j.name=Generic x21J +x21j.vid.0=0x16D0 +x21j.pid.0=0x6557 +x21j.vid.1=0x16D0 +x21j.pid.1=0x6856 +x21j.vid.2=0x16D0 +x21j.pid.2=0x6B41 +x21j.vid.3=0x16D0 +x21j.pid.3=0x6B40 +x21j.vid.4=0x16D0 +x21j.pid.4=0x6A0C +x21j.vid.5=0x16D0 +x21j.pid.5=0x6856 +x21j.build.usb_manufacturer="Fab Foundation" +x21j.build.board=SAMD_ZERO +x21j.build.core=arduino +x21j.build.variant=Generic_xx1J +x21j.build.variant_system_lib= +x21j.build.vid=0x16D0 +x21j.upload.protocol=sam-ba +x21j.bootloader.tool=openocd +x21j.menu.float.default=Print & String use auto-promoted doubles only +x21j.menu.float.default.build.floatconfig=FLOAT_BOTH_DOUBLES_ONLY +x21j.menu.float.print=Print uses separate singles and doubles +x21j.menu.float.print.build.floatconfig=FLOAT_PRINT_SINGLES_DOUBLES +x21j.menu.float.string=String uses separate singles and doubles +x21j.menu.float.string.build.floatconfig=FLOAT_STRING_SINGLES_DOUBLES +x21j.menu.float.both=Print & String use separate singles and doubles +x21j.menu.float.both.build.floatconfig=FLOAT_BOTH_SINGLES_DOUBLES +x21j.menu.config.disabled=config.h disabled +x21j.menu.config.disabled.build.buildconfig=CONFIG_H_DISABLED +x21j.menu.config.enabled=config.h enabled (mostly code size reductions) +x21j.menu.config.enabled.build.buildconfig=CONFIG_H_ENABLED +x21j.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED_OSCILLATOR +x21j.menu.clock.internal_usb.build.clockconfig=CLOCKCONFIG_INTERNAL_USB +x21j.menu.clock.internal=INTERNAL_OSCILLATOR +x21j.menu.clock.internal.build.clockconfig=CLOCKCONFIG_INTERNAL +x21j.menu.clock.crystal_32k=32KHZ_CRYSTAL +x21j.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32768HZ_CRYSTAL +x21j.menu.clock.crystal_hs=HIGH_SPEED_CRYSTAL +x21j.menu.clock.crystal_hs.build.clockconfig=CLOCKCONFIG_HS_CRYSTAL +x21j.menu.timer.timer_732Hz=732.4Hz (16-bit) +x21j.menu.timer.timer_732Hz.build.timerconfig=TIMER_732Hz +x21j.menu.timer.timer_366Hz=366.2Hz (16-bit) +x21j.menu.timer.timer_366Hz.build.timerconfig=TIMER_366Hz +x21j.menu.timer.timer_244Hz=244.1Hz (16-bit) +x21j.menu.timer.timer_244Hz.build.timerconfig=TIMER_244Hz +x21j.menu.timer.timer_183Hz=183.1Hz (16-bit) +x21j.menu.timer.timer_183Hz.build.timerconfig=TIMER_183Hz +x21j.menu.timer.timer_146Hz=146.5Hz (16-bit) +x21j.menu.timer.timer_146Hz.build.timerconfig=TIMER_146Hz +x21j.menu.timer.timer_122Hz=122.1Hz (16-bit) +x21j.menu.timer.timer_122Hz.build.timerconfig=TIMER_122Hz +x21j.menu.timer.timer_105Hz=104.6Hz (16-bit) +x21j.menu.timer.timer_105Hz.build.timerconfig=TIMER_105Hz +x21j.menu.timer.timer_81Hz=81.38Hz (16-bit) +x21j.menu.timer.timer_81Hz.build.timerconfig=TIMER_81Hz +x21j.menu.timer.timer_61Hz=61.04Hz (16-bit) +x21j.menu.timer.timer_61Hz.build.timerconfig=TIMER_61Hz +x21j.menu.timer.timer_31Hz=30.52Hz (16-bit) +x21j.menu.timer.timer_31Hz.build.timerconfig=TIMER_31Hz +x21j.menu.timer.timer_187500Hz=187500Hz (8-bit) +x21j.menu.timer.timer_187500Hz.build.timerconfig=TIMER_187500Hz +x21j.menu.timer.timer_93750Hz=93750Hz (8-bit) +x21j.menu.timer.timer_93750Hz.build.timerconfig=TIMER_93750Hz +x21j.menu.timer.timer_62500Hz=62500Hz (8-bit) +x21j.menu.timer.timer_62500Hz.build.timerconfig=TIMER_62500Hz +x21j.menu.timer.timer_37500Hz=37500Hz (8-bit) +x21j.menu.timer.timer_37500Hz.build.timerconfig=TIMER_37500Hz +x21j.menu.timer.timer_20833Hz=20833Hz (8-bit) +x21j.menu.timer.timer_20833Hz.build.timerconfig=TIMER_20833Hz +x21j.menu.timer.timer_12500Hz=12500Hz (8-bit) +x21j.menu.timer.timer_12500Hz.build.timerconfig=TIMER_12500Hz +x21j.menu.timer.timer_7500Hz=7500Hz (8-bit) +x21j.menu.timer.timer_7500Hz.build.timerconfig=TIMER_7500Hz +x21j.menu.timer.timer_4166Hz=4166Hz (8-bit) +x21j.menu.timer.timer_4166Hz.build.timerconfig=TIMER_4166Hz +x21j.menu.timer.timer_2930Hz=2930Hz (8-bit) +x21j.menu.timer.timer_2930Hz.build.timerconfig=TIMER_2930Hz +x21j.menu.timer.timer_1465Hz=1465Hz (8-bit) +x21j.menu.timer.timer_1465Hz.build.timerconfig=TIMER_1465Hz +x21j.menu.cpu.samd21j17a=SAMD21J17A +x21j.menu.cpu.samd21j17a.upload.maximum_size=122880 +x21j.menu.cpu.samd21j17a.build.mcu=cortex-m0plus +x21j.menu.cpu.samd21j17a.build.mathlib=arm_cortexM0l_math +x21j.menu.cpu.samd21j17a.build.f_cpu=48000000L +x21j.menu.cpu.samd21j17a.build.usb_product="Xeno D21" +x21j.menu.cpu.samd21j17a.build.extra_flags=-D__SAMD21J17A__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21j.menu.cpu.samd21j17a.build.ldscript=flash_128KB.ld +x21j.menu.cpu.samd21j17a.build.openocdscript=openocd_scripts/SAMD21J17A.cfg +x21j.menu.cpu.samd21j17a.bootloader.file=zero/binaries/sam_ba_SAMD21J17A.bin +x21j.menu.cpu.samd21j18a=SAMD21J18A +x21j.menu.cpu.samd21j18a.upload.maximum_size=253952 +x21j.menu.cpu.samd21j18a.build.mcu=cortex-m0plus +x21j.menu.cpu.samd21j18a.build.mathlib=arm_cortexM0l_math +x21j.menu.cpu.samd21j18a.build.f_cpu=48000000L +x21j.menu.cpu.samd21j18a.build.usb_product="Xeno D21" +x21j.menu.cpu.samd21j18a.build.extra_flags=-D__SAMD21J18A__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21j.menu.cpu.samd21j18a.build.ldscript=flash_256KB.ld +x21j.menu.cpu.samd21j18a.build.openocdscript=openocd_scripts/SAMD21J18A.cfg +x21j.menu.cpu.samd21j18a.bootloader.file=zero/binaries/sam_ba_SAMD21J18A.bin +x21j.menu.cpu.samd21j15a=SAMD21J15A +x21j.menu.cpu.samd21j15a.upload.maximum_size=24576 +x21j.menu.cpu.samd21j15a.build.mcu=cortex-m0plus +x21j.menu.cpu.samd21j15a.build.mathlib=arm_cortexM0l_math +x21j.menu.cpu.samd21j15a.build.f_cpu=48000000L +x21j.menu.cpu.samd21j15a.build.usb_product="Xeno D21" +x21j.menu.cpu.samd21j15a.build.extra_flags=-D__SAMD21J15A__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21j.menu.cpu.samd21j15a.build.ldscript=flash_32KB.ld +x21j.menu.cpu.samd21j15a.build.openocdscript=openocd_scripts/SAMD21J15A.cfg +x21j.menu.cpu.samd21j15a.bootloader.file=zero/binaries/sam_ba_SAMD21J15A.bin +x21j.menu.cpu.samd21j16a=SAMD21J16A +x21j.menu.cpu.samd21j16a.upload.maximum_size=57344 +x21j.menu.cpu.samd21j16a.build.mcu=cortex-m0plus +x21j.menu.cpu.samd21j16a.build.mathlib=arm_cortexM0l_math +x21j.menu.cpu.samd21j16a.build.f_cpu=48000000L +x21j.menu.cpu.samd21j16a.build.usb_product="Xeno D21" +x21j.menu.cpu.samd21j16a.build.extra_flags=-D__SAMD21J16A__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21j.menu.cpu.samd21j16a.build.ldscript=flash_64KB.ld +x21j.menu.cpu.samd21j16a.build.openocdscript=openocd_scripts/SAMD21J16A.cfg +x21j.menu.cpu.samd21j16a.bootloader.file=zero/binaries/sam_ba_SAMD21J16A.bin +x21j.menu.cpu.saml21j17b=SAML21J17B +x21j.menu.cpu.saml21j17b.upload.maximum_size=122880 +x21j.menu.cpu.saml21j17b.build.mcu=cortex-m0plus +x21j.menu.cpu.saml21j17b.build.mathlib=arm_cortexM0l_math +x21j.menu.cpu.saml21j17b.build.f_cpu=48000000L +x21j.menu.cpu.saml21j17b.build.usb_product="Xeno L21" +x21j.menu.cpu.saml21j17b.build.extra_flags=-D__SAML21J17B__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21j.menu.cpu.saml21j17b.build.ldscript=flash_128KB.ld +x21j.menu.cpu.saml21j17b.build.openocdscript=openocd_scripts/SAML21J17B.cfg +x21j.menu.cpu.saml21j17b.bootloader.file=zero/binaries/sam_ba_SAML21J17B.bin +x21j.menu.cpu.saml21j18b=SAML21J18B +x21j.menu.cpu.saml21j18b.upload.maximum_size=253952 +x21j.menu.cpu.saml21j18b.build.mcu=cortex-m0plus +x21j.menu.cpu.saml21j18b.build.mathlib=arm_cortexM0l_math +x21j.menu.cpu.saml21j18b.build.f_cpu=48000000L +x21j.menu.cpu.saml21j18b.build.usb_product="Xeno L21" +x21j.menu.cpu.saml21j18b.build.extra_flags=-D__SAML21J18B__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21j.menu.cpu.saml21j18b.build.ldscript=flash_256KB.ld +x21j.menu.cpu.saml21j18b.build.openocdscript=openocd_scripts/SAML21J18B.cfg +x21j.menu.cpu.saml21j18b.bootloader.file=zero/binaries/sam_ba_SAML21J18B.bin +x21j.menu.cpu.saml21j16b=SAML21J16B +x21j.menu.cpu.saml21j16b.upload.maximum_size=57344 +x21j.menu.cpu.saml21j16b.build.mcu=cortex-m0plus +x21j.menu.cpu.saml21j16b.build.mathlib=arm_cortexM0l_math +x21j.menu.cpu.saml21j16b.build.f_cpu=48000000L +x21j.menu.cpu.saml21j16b.build.usb_product="Xeno L21" +x21j.menu.cpu.saml21j16b.build.extra_flags=-D__SAML21J16B__ {build.usb_flags} -DARM_MATH_CM0PLUS +x21j.menu.cpu.saml21j16b.build.ldscript=flash_64KB.ld +x21j.menu.cpu.saml21j16b.build.openocdscript=openocd_scripts/SAML21J16B.cfg +x21j.menu.cpu.saml21j16b.bootloader.file=zero/binaries/sam_ba_SAML21J16B.bin +x21j.menu.cpu.samc21j17a=SAMC21J17A +x21j.menu.cpu.samc21j17a.upload.maximum_size=122880 +x21j.menu.cpu.samc21j17a.build.mcu=cortex-m0plus +x21j.menu.cpu.samc21j17a.build.mathlib=arm_cortexM0l_math +x21j.menu.cpu.samc21j17a.build.f_cpu=48000000L +x21j.menu.cpu.samc21j17a.build.usb_product="Xeno C21" +x21j.menu.cpu.samc21j17a.build.extra_flags=-D__SAMC21J17A__ -DARM_MATH_CM0PLUS +x21j.menu.cpu.samc21j17a.build.ldscript=flash_128KB.ld +x21j.menu.cpu.samc21j17a.build.openocdscript=openocd_scripts/SAMC21J17A.cfg +x21j.menu.cpu.samc21j17a.bootloader.file=zero/binaries/sam_ba_SAMC21J17A.bin +x21j.menu.cpu.samc21j18a=SAMC21J18A +x21j.menu.cpu.samc21j18a.upload.maximum_size=253952 +x21j.menu.cpu.samc21j18a.build.mcu=cortex-m0plus +x21j.menu.cpu.samc21j18a.build.mathlib=arm_cortexM0l_math +x21j.menu.cpu.samc21j18a.build.f_cpu=48000000L +x21j.menu.cpu.samc21j18a.build.usb_product="Xeno C21" +x21j.menu.cpu.samc21j18a.build.extra_flags=-D__SAMC21J18A__ -DARM_MATH_CM0PLUS +x21j.menu.cpu.samc21j18a.build.ldscript=flash_256KB.ld +x21j.menu.cpu.samc21j18a.build.openocdscript=openocd_scripts/SAMC21J18A.cfg +x21j.menu.cpu.samc21j18a.bootloader.file=zero/binaries/sam_ba_SAMC21J18A.bin +x21j.menu.cpu.samc21j15a=SAMC21J15A +x21j.menu.cpu.samc21j15a.upload.maximum_size=24576 +x21j.menu.cpu.samc21j15a.build.mcu=cortex-m0plus +x21j.menu.cpu.samc21j15a.build.mathlib=arm_cortexM0l_math +x21j.menu.cpu.samc21j15a.build.f_cpu=48000000L +x21j.menu.cpu.samc21j15a.build.usb_product="Xeno C21" +x21j.menu.cpu.samc21j15a.build.extra_flags=-D__SAMC21J15A__ -DARM_MATH_CM0PLUS +x21j.menu.cpu.samc21j15a.build.ldscript=flash_32KB.ld +x21j.menu.cpu.samc21j15a.build.openocdscript=openocd_scripts/SAMC21J15A.cfg +x21j.menu.cpu.samc21j15a.bootloader.file=zero/binaries/sam_ba_SAMC21J15A.bin +x21j.menu.cpu.samc21j16a=SAMC21J16A +x21j.menu.cpu.samc21j16a.upload.maximum_size=57344 +x21j.menu.cpu.samc21j16a.build.mcu=cortex-m0plus +x21j.menu.cpu.samc21j16a.build.mathlib=arm_cortexM0l_math +x21j.menu.cpu.samc21j16a.build.f_cpu=48000000L +x21j.menu.cpu.samc21j16a.build.usb_product="Xeno C21" +x21j.menu.cpu.samc21j16a.build.extra_flags=-D__SAMC21J16A__ -DARM_MATH_CM0PLUS +x21j.menu.cpu.samc21j16a.build.ldscript=flash_64KB.ld +x21j.menu.cpu.samc21j16a.build.openocdscript=openocd_scripts/SAMC21J16A.cfg +x21j.menu.cpu.samc21j16a.bootloader.file=zero/binaries/sam_ba_SAMC21J16A.bin +x21j.menu.bootloader.8kb=8KB_BOOTLOADER +x21j.menu.bootloader.8kb.build.bootloader_size=__8KB_BOOTLOADER__ +x21j.menu.bootloader.8kb.build.ldscript_path=linker_scripts/gcc/8KB_Bootloader +x21j.menu.bootloader.8kb.upload.tool=Fab_SAM_Arduino:bossac +x21j.menu.bootloader.8kb.upload.use_1200bps_touch=true +x21j.menu.bootloader.8kb.upload.wait_for_upload_port=true +x21j.menu.bootloader.8kb.upload.native_usb=true +x21j.menu.bootloader.16kb=16KB_BOOTLOADER +x21j.menu.bootloader.16kb.build.bootloader_size=__16KB_BOOTLOADER__ +x21j.menu.bootloader.16kb.build.ldscript_path=linker_scripts/gcc/16KB_Bootloader +x21j.menu.bootloader.16kb.upload.tool=Fab_SAM_Arduino:bossac +x21j.menu.bootloader.16kb.upload.use_1200bps_touch=true +x21j.menu.bootloader.16kb.upload.wait_for_upload_port=true +x21j.menu.bootloader.16kb.upload.native_usb=true +x21j.menu.bootloader.0kb=NO_BOOTLOADER +x21j.menu.bootloader.0kb.build.bootloader_size=__NO_BOOTLOADER__ +x21j.menu.bootloader.0kb.build.ldscript_path=linker_scripts/gcc/No_Bootloader +x21j.menu.bootloader.0kb.upload.tool=openocd +x21j.menu.bootloader.0kb.upload.use_1200bps_touch=false +x21j.menu.bootloader.0kb.upload.wait_for_upload_port=false +x21j.menu.bootloader.0kb.upload.native_usb=false +x21j.menu.serial.one_uart=ONE_UART_ONE_WIRE_ONE_SPI +x21j.menu.serial.one_uart.build.serialcom_uart=ONE_UART +x21j.menu.serial.one_uart.build.serialcom_wire=ONE_WIRE +x21j.menu.serial.one_uart.build.serialcom_spi=ONE_SPI +x21j.menu.serial.one_uart_two_spi=ONE_UART_ONE_WIRE_TWO_SPI +x21j.menu.serial.one_uart_two_spi.build.serialcom_uart=ONE_UART +x21j.menu.serial.one_uart_two_spi.build.serialcom_wire=ONE_WIRE +x21j.menu.serial.one_uart_two_spi.build.serialcom_spi=TWO_SPI +x21j.menu.serial.one_uart_two_wire=ONE_UART_TWO_WIRE_ONE_SPI +x21j.menu.serial.one_uart_two_wire.build.serialcom_uart=ONE_UART +x21j.menu.serial.one_uart_two_wire.build.serialcom_wire=TWO_WIRE +x21j.menu.serial.one_uart_two_wire.build.serialcom_spi=ONE_SPI +x21j.menu.serial.two_uart=TWO_UART_ONE_WIRE_ONE_SPI +x21j.menu.serial.two_uart.build.serialcom_uart=TWO_UART +x21j.menu.serial.two_uart.build.serialcom_wire=ONE_WIRE +x21j.menu.serial.two_uart.build.serialcom_spi=ONE_SPI +x21j.menu.serial.two_uart_two_spi=TWO_UART_ONE_WIRE_TWO_SPI +x21j.menu.serial.two_uart_two_spi.build.serialcom_uart=TWO_UART +x21j.menu.serial.two_uart_two_spi.build.serialcom_wire=ONE_WIRE +x21j.menu.serial.two_uart_two_spi.build.serialcom_spi=TWO_SPI +x21j.menu.serial.two_uart_two_wire=TWO_UART_TWO_WIRE_ONE_SPI +x21j.menu.serial.two_uart_two_wire.build.serialcom_uart=TWO_UART +x21j.menu.serial.two_uart_two_wire.build.serialcom_wire=TWO_WIRE +x21j.menu.serial.two_uart_two_wire.build.serialcom_spi=ONE_SPI +x21j.menu.serial.three_uart=THREE_UART_ONE_WIRE_ONE_SPI +x21j.menu.serial.three_uart.build.serialcom_uart=THREE_UART +x21j.menu.serial.three_uart.build.serialcom_wire=ONE_WIRE +x21j.menu.serial.three_uart.build.serialcom_spi=ONE_SPI +x21j.menu.serial.three_uart_two_spi=THREE_UART_ONE_WIRE_TWO_SPI +x21j.menu.serial.three_uart_two_spi.build.serialcom_uart=THREE_UART +x21j.menu.serial.three_uart_two_spi.build.serialcom_wire=ONE_WIRE +x21j.menu.serial.three_uart_two_spi.build.serialcom_spi=TWO_SPI +x21j.menu.serial.three_uart_two_wire=THREE_UART_TWO_WIRE_ONE_SPI +x21j.menu.serial.three_uart_two_wire.build.serialcom_uart=THREE_UART +x21j.menu.serial.three_uart_two_wire.build.serialcom_wire=TWO_WIRE +x21j.menu.serial.three_uart_two_wire.build.serialcom_spi=ONE_SPI +x21j.menu.serial.no_uart=NO_UART_ONE_WIRE_ONE_SPI +x21j.menu.serial.no_uart.build.serialcom_uart=NO_UART +x21j.menu.serial.no_uart.build.serialcom_wire=ONE_WIRE +x21j.menu.serial.no_uart.build.serialcom_spi=ONE_SPI +x21j.menu.usb.cdc=CDC_ONLY +x21j.menu.usb.cdc.build.usbcom=CDC_ONLY +x21j.menu.usb.cdc.build.pid=0x6557 +x21j.menu.usb.cdc_hid=CDC_HID +x21j.menu.usb.cdc_hid.build.usbcom=CDC_HID +x21j.menu.usb.cdc_hid.build.pid=0x6856 +x21j.menu.usb.withcdc=WITH_CDC +x21j.menu.usb.withcdc.build.usbcom=WITH_CDC +x21j.menu.usb.withcdc.build.pid=0x6B41 +x21j.menu.usb.hid=HID_ONLY +x21j.menu.usb.hid.build.usbcom=HID_ONLY +x21j.menu.usb.hid.build.pid=0x6B40 +x21j.menu.usb.nocdc=WITHOUT_CDC +x21j.menu.usb.nocdc.build.usbcom=WITHOUT_CDC +x21j.menu.usb.nocdc.build.pid=0x6A0C +x21j.menu.usb.none=USB_DISABLED +x21j.menu.usb.none.build.usbcom=USB_DISABLED +x21j.menu.usb.none.build.pid=0x6856 + +# Generic D51G +d51g.name=Generic D51G +d51g.vid.0=0x16D0 +d51g.pid.0=0x7557 +d51g.vid.1=0x16D0 +d51g.pid.1=0x7856 +d51g.vid.2=0x16D0 +d51g.pid.2=0x7B41 +d51g.vid.3=0x16D0 +d51g.pid.3=0x7B40 +d51g.vid.4=0x16D0 +d51g.pid.4=0x7A0C +d51g.vid.5=0x16D0 +d51g.pid.5=0x7856 +d51g.build.usb_manufacturer="Fab Foundation" + +# KH mod +#d51g.build.board=SAMD_ZERO +d51g.build.board=__SAMD51__ +###### + +d51g.build.core=arduino + +# KH mod +#d51g.build.variant=Generic_D51G +d51g.build.variant=Generic_xx1G +###### + +d51g.build.variant_system_lib= +d51g.build.vid=0x16D0 +d51g.upload.protocol=sam-ba +d51g.bootloader.tool=openocd +d51g.menu.float.default=Print & String use auto-promoted doubles only +d51g.menu.float.default.build.floatconfig=FLOAT_BOTH_DOUBLES_ONLY +d51g.menu.float.print=Print uses separate singles and doubles +d51g.menu.float.print.build.floatconfig=FLOAT_PRINT_SINGLES_DOUBLES +d51g.menu.float.string=String uses separate singles and doubles +d51g.menu.float.string.build.floatconfig=FLOAT_STRING_SINGLES_DOUBLES +d51g.menu.float.both=Print & String use separate singles and doubles +d51g.menu.float.both.build.floatconfig=FLOAT_BOTH_SINGLES_DOUBLES +d51g.menu.config.disabled=config.h disabled +d51g.menu.config.disabled.build.buildconfig=CONFIG_H_DISABLED +d51g.menu.config.enabled=config.h enabled (mostly code size reductions) +d51g.menu.config.enabled.build.buildconfig=CONFIG_H_ENABLED +d51g.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED_OSCILLATOR +d51g.menu.clock.internal_usb.build.clockconfig=CLOCKCONFIG_INTERNAL_USB +d51g.menu.clock.internal=INTERNAL_OSCILLATOR +d51g.menu.clock.internal.build.clockconfig=CLOCKCONFIG_INTERNAL +d51g.menu.clock.crystal_32k=32KHZ_CRYSTAL +d51g.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32768HZ_CRYSTAL +d51g.menu.clock.crystal_hs=HIGH_SPEED_CRYSTAL +d51g.menu.clock.crystal_hs.build.clockconfig=CLOCKCONFIG_HS_CRYSTAL +d51g.menu.timer.timer_732Hz=732.4Hz (16-bit) +d51g.menu.timer.timer_732Hz.build.timerconfig=TIMER_732Hz +d51g.menu.timer.timer_366Hz=366.2Hz (16-bit) +d51g.menu.timer.timer_366Hz.build.timerconfig=TIMER_366Hz +d51g.menu.timer.timer_244Hz=244.1Hz (16-bit) +d51g.menu.timer.timer_244Hz.build.timerconfig=TIMER_244Hz +d51g.menu.timer.timer_183Hz=183.1Hz (16-bit) +d51g.menu.timer.timer_183Hz.build.timerconfig=TIMER_183Hz +d51g.menu.timer.timer_146Hz=146.5Hz (16-bit) +d51g.menu.timer.timer_146Hz.build.timerconfig=TIMER_146Hz +d51g.menu.timer.timer_122Hz=122.1Hz (16-bit) +d51g.menu.timer.timer_122Hz.build.timerconfig=TIMER_122Hz +d51g.menu.timer.timer_105Hz=104.6Hz (16-bit) +d51g.menu.timer.timer_105Hz.build.timerconfig=TIMER_105Hz +d51g.menu.timer.timer_81Hz=81.38Hz (16-bit) +d51g.menu.timer.timer_81Hz.build.timerconfig=TIMER_81Hz +d51g.menu.timer.timer_61Hz=61.04Hz (16-bit) +d51g.menu.timer.timer_61Hz.build.timerconfig=TIMER_61Hz +d51g.menu.timer.timer_31Hz=30.52Hz (16-bit) +d51g.menu.timer.timer_31Hz.build.timerconfig=TIMER_31Hz +d51g.menu.timer.timer_187500Hz=187500Hz (8-bit) +d51g.menu.timer.timer_187500Hz.build.timerconfig=TIMER_187500Hz +d51g.menu.timer.timer_93750Hz=93750Hz (8-bit) +d51g.menu.timer.timer_93750Hz.build.timerconfig=TIMER_93750Hz +d51g.menu.timer.timer_62500Hz=62500Hz (8-bit) +d51g.menu.timer.timer_62500Hz.build.timerconfig=TIMER_62500Hz +d51g.menu.timer.timer_37500Hz=37500Hz (8-bit) +d51g.menu.timer.timer_37500Hz.build.timerconfig=TIMER_37500Hz +d51g.menu.timer.timer_20833Hz=20833Hz (8-bit) +d51g.menu.timer.timer_20833Hz.build.timerconfig=TIMER_20833Hz +d51g.menu.timer.timer_12500Hz=12500Hz (8-bit) +d51g.menu.timer.timer_12500Hz.build.timerconfig=TIMER_12500Hz +d51g.menu.timer.timer_7500Hz=7500Hz (8-bit) +d51g.menu.timer.timer_7500Hz.build.timerconfig=TIMER_7500Hz +d51g.menu.timer.timer_4166Hz=4166Hz (8-bit) +d51g.menu.timer.timer_4166Hz.build.timerconfig=TIMER_4166Hz +d51g.menu.timer.timer_2930Hz=2930Hz (8-bit) +d51g.menu.timer.timer_2930Hz.build.timerconfig=TIMER_2930Hz +d51g.menu.timer.timer_1465Hz=1465Hz (16-bit) +d51g.menu.timer.timer_1465Hz.build.timerconfig=TIMER_1465Hz +d51g.menu.cpu.samd51g18a_120=SAMD51G18A_120MHz +d51g.menu.cpu.samd51g18a_120.upload.maximum_size=253952 +d51g.menu.cpu.samd51g18a_120.build.mcu=cortex-m4 +d51g.menu.cpu.samd51g18a_120.build.mathlib=arm_cortexM4lf_math +d51g.menu.cpu.samd51g18a_120.build.f_cpu=120000000L +d51g.menu.cpu.samd51g18a_120.build.usb_product="Xeno Mini D51" + +# KH mod +#d51g.menu.cpu.samd51g18a_120.build.extra_flags=-D__SAMD51G18A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 +#d51g.menu.cpu.samd51g18a_120.build.extra_flags=-D__SAMD51G18A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 -D__SAMD51__ +d51g.menu.cpu.samd51g18a_120.build.extra_flags=-D__SAMD51G18A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 -D__SAMD51__ +###### + + +d51g.menu.cpu.samd51g18a_120.build.ldscript=flash_m4f_256KB.ld +d51g.menu.cpu.samd51g18a_120.build.openocdscript=openocd_scripts/SAMD51G18A.cfg +d51g.menu.cpu.samd51g18a_120.bootloader.file=zero/binaries/sam_ba_SAMD51G18A.bin +d51g.menu.cpu.samd51g18a_48=SAMD51G18A_48MHz +d51g.menu.cpu.samd51g18a_48.upload.maximum_size=253952 +d51g.menu.cpu.samd51g18a_48.build.mcu=cortex-m4 +d51g.menu.cpu.samd51g18a_48.build.mathlib=arm_cortexM4lf_math +d51g.menu.cpu.samd51g18a_48.build.f_cpu=48000000L +d51g.menu.cpu.samd51g18a_48.build.usb_product="Xeno Mini D51" + +# KH mod +#d51g.menu.cpu.samd51g18a_48.build.extra_flags=-D__SAMD51G18A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 +d51g.menu.cpu.samd51g18a_48.build.extra_flags=-D__SAMD51G18A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 -D__SAMD51__ +###### + +d51g.menu.cpu.samd51g18a_48.build.ldscript=flash_m4f_256KB.ld +d51g.menu.cpu.samd51g18a_48.build.openocdscript=openocd_scripts/SAMD51G18A.cfg +d51g.menu.cpu.samd51g18a_48.bootloader.file=zero/binaries/sam_ba_SAMD51G18A.bin +d51g.menu.cpu.samd51g19a_120=SAMD51G19A_120MHz +d51g.menu.cpu.samd51g19a_120.upload.maximum_size=516096 +d51g.menu.cpu.samd51g19a_120.build.mcu=cortex-m4 +d51g.menu.cpu.samd51g19a_120.build.mathlib=arm_cortexM4lf_math +d51g.menu.cpu.samd51g19a_120.build.f_cpu=120000000L +d51g.menu.cpu.samd51g19a_120.build.usb_product="Xeno Mini D51" + +# KH mod +#d51g.menu.cpu.samd51g19a_120.build.extra_flags=-D__SAMD51G19A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 +d51g.menu.cpu.samd51g19a_120.build.extra_flags=-D__SAMD51G19A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 -D__SAMD51__ +###### + +d51g.menu.cpu.samd51g19a_120.build.ldscript=flash_m4f_512KB.ld +d51g.menu.cpu.samd51g19a_120.build.openocdscript=openocd_scripts/SAMD51G19A.cfg +d51g.menu.cpu.samd51g19a_120.bootloader.file=zero/binaries/sam_ba_SAMD51G19A.bin +d51g.menu.cpu.samd51g19a_48=SAMD51G19A_48MHz +d51g.menu.cpu.samd51g19a_48.upload.maximum_size=516096 +d51g.menu.cpu.samd51g19a_48.build.mcu=cortex-m4 +d51g.menu.cpu.samd51g19a_48.build.mathlib=arm_cortexM4lf_math +d51g.menu.cpu.samd51g19a_48.build.f_cpu=48000000L +d51g.menu.cpu.samd51g19a_48.build.usb_product="Xeno Mini D51" + +# KH mod +#d51g.menu.cpu.samd51g19a_48.build.extra_flags=-D__SAMD51G19A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 +d51g.menu.cpu.samd51g19a_48.build.extra_flags=-D__SAMD51G19A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 -D__SAMD51__ +###### + +d51g.menu.cpu.samd51g19a_48.build.ldscript=flash_m4f_512KB.ld +d51g.menu.cpu.samd51g19a_48.build.openocdscript=openocd_scripts/SAMD51G19A.cfg +d51g.menu.cpu.samd51g19a_48.bootloader.file=zero/binaries/sam_ba_SAMD51G19A.bin +d51g.menu.bootloader.8kb=8KB_BOOTLOADER +d51g.menu.bootloader.8kb.build.bootloader_size=__8KB_BOOTLOADER__ +d51g.menu.bootloader.8kb.build.ldscript_path=linker_scripts/gcc/8KB_Bootloader +d51g.menu.bootloader.8kb.upload.tool=Fab_SAM_Arduino:bossac +d51g.menu.bootloader.8kb.upload.use_1200bps_touch=true +d51g.menu.bootloader.8kb.upload.wait_for_upload_port=true +d51g.menu.bootloader.8kb.upload.native_usb=true +d51g.menu.bootloader.16kb=16KB_BOOTLOADER +d51g.menu.bootloader.16kb.build.bootloader_size=__16KB_BOOTLOADER__ +d51g.menu.bootloader.16kb.build.ldscript_path=linker_scripts/gcc/16KB_Bootloader +d51g.menu.bootloader.16kb.upload.tool=Fab_SAM_Arduino:bossac +d51g.menu.bootloader.16kb.upload.use_1200bps_touch=true +d51g.menu.bootloader.16kb.upload.wait_for_upload_port=true +d51g.menu.bootloader.16kb.upload.native_usb=true +d51g.menu.bootloader.0kb=NO_BOOTLOADER +d51g.menu.bootloader.0kb.build.bootloader_size=__NO_BOOTLOADER__ +d51g.menu.bootloader.0kb.build.ldscript_path=linker_scripts/gcc/No_Bootloader +d51g.menu.bootloader.0kb.upload.tool=openocd +d51g.menu.bootloader.0kb.upload.use_1200bps_touch=false +d51g.menu.bootloader.0kb.upload.wait_for_upload_port=false +d51g.menu.bootloader.0kb.upload.native_usb=false +d51g.menu.serial.one_uart=ONE_UART_ONE_WIRE_ONE_SPI +d51g.menu.serial.one_uart.build.serialcom_uart=ONE_UART +d51g.menu.serial.one_uart.build.serialcom_wire=ONE_WIRE +d51g.menu.serial.one_uart.build.serialcom_spi=ONE_SPI +d51g.menu.serial.one_uart_two_spi=ONE_UART_ONE_WIRE_TWO_SPI +d51g.menu.serial.one_uart_two_spi.build.serialcom_uart=ONE_UART +d51g.menu.serial.one_uart_two_spi.build.serialcom_wire=ONE_WIRE +d51g.menu.serial.one_uart_two_spi.build.serialcom_spi=TWO_SPI +d51g.menu.serial.one_uart_two_wire=ONE_UART_TWO_WIRE_ONE_SPI +d51g.menu.serial.one_uart_two_wire.build.serialcom_uart=ONE_UART +d51g.menu.serial.one_uart_two_wire.build.serialcom_wire=TWO_WIRE +d51g.menu.serial.one_uart_two_wire.build.serialcom_spi=ONE_SPI +d51g.menu.serial.two_uart=TWO_UART_ONE_WIRE_ONE_SPI +d51g.menu.serial.two_uart.build.serialcom_uart=TWO_UART +d51g.menu.serial.two_uart.build.serialcom_wire=ONE_WIRE +d51g.menu.serial.two_uart.build.serialcom_spi=ONE_SPI +d51g.menu.serial.two_uart_two_spi=TWO_UART_ONE_WIRE_TWO_SPI +d51g.menu.serial.two_uart_two_spi.build.serialcom_uart=TWO_UART +d51g.menu.serial.two_uart_two_spi.build.serialcom_wire=ONE_WIRE +d51g.menu.serial.two_uart_two_spi.build.serialcom_spi=TWO_SPI +d51g.menu.serial.two_uart_two_wire=TWO_UART_TWO_WIRE_ONE_SPI +d51g.menu.serial.two_uart_two_wire.build.serialcom_uart=TWO_UART +d51g.menu.serial.two_uart_two_wire.build.serialcom_wire=TWO_WIRE +d51g.menu.serial.two_uart_two_wire.build.serialcom_spi=ONE_SPI +d51g.menu.serial.three_uart=THREE_UART_ONE_WIRE_ONE_SPI +d51g.menu.serial.three_uart.build.serialcom_uart=THREE_UART +d51g.menu.serial.three_uart.build.serialcom_wire=ONE_WIRE +d51g.menu.serial.three_uart.build.serialcom_spi=ONE_SPI +d51g.menu.serial.three_uart_two_spi=THREE_UART_ONE_WIRE_TWO_SPI +d51g.menu.serial.three_uart_two_spi.build.serialcom_uart=THREE_UART +d51g.menu.serial.three_uart_two_spi.build.serialcom_wire=ONE_WIRE +d51g.menu.serial.three_uart_two_spi.build.serialcom_spi=TWO_SPI +d51g.menu.serial.three_uart_two_wire=THREE_UART_TWO_WIRE_ONE_SPI +d51g.menu.serial.three_uart_two_wire.build.serialcom_uart=THREE_UART +d51g.menu.serial.three_uart_two_wire.build.serialcom_wire=TWO_WIRE +d51g.menu.serial.three_uart_two_wire.build.serialcom_spi=ONE_SPI +d51g.menu.serial.no_uart=NO_UART_ONE_WIRE_ONE_SPI +d51g.menu.serial.no_uart.build.serialcom_uart=NO_UART +d51g.menu.serial.no_uart.build.serialcom_wire=ONE_WIRE +d51g.menu.serial.no_uart.build.serialcom_spi=ONE_SPI +d51g.menu.usb.cdc=CDC_ONLY +d51g.menu.usb.cdc.build.usbcom=CDC_ONLY +d51g.menu.usb.cdc.build.pid=0x7557 +d51g.menu.usb.cdc_hid=CDC_HID +d51g.menu.usb.cdc_hid.build.usbcom=CDC_HID +d51g.menu.usb.cdc_hid.build.pid=0x7856 +d51g.menu.usb.withcdc=WITH_CDC +d51g.menu.usb.withcdc.build.usbcom=WITH_CDC +d51g.menu.usb.withcdc.build.pid=0x7B41 +d51g.menu.usb.hid=HID_ONLY +d51g.menu.usb.hid.build.usbcom=HID_ONLY +d51g.menu.usb.hid.build.pid=0x7B40 +d51g.menu.usb.nocdc=WITHOUT_CDC +d51g.menu.usb.nocdc.build.usbcom=WITHOUT_CDC +d51g.menu.usb.nocdc.build.pid=0x7A0C +d51g.menu.usb.none=USB_DISABLED +d51g.menu.usb.none.build.usbcom=USB_DISABLED +d51g.menu.usb.none.build.pid=0x7856 + +# Generic D51J +d51j.name=Generic D51J +d51j.vid.0=0x16D0 +d51j.pid.0=0x8557 +d51j.vid.1=0x16D0 +d51j.pid.1=0x8856 +d51j.vid.2=0x16D0 +d51j.pid.2=0x8B41 +d51j.vid.3=0x16D0 +d51j.pid.3=0x8B40 +d51j.vid.4=0x16D0 +d51j.pid.4=0x8A0C +d51j.vid.5=0x16D0 +d51j.pid.5=0x8856 +d51j.build.usb_manufacturer="Fab Foundation" + +# KH mod +#d51j.build.board=SAMD_ZERO +d51j.build.board=__SAMD51__ +###### + +d51j.build.core=arduino +d51j.build.variant=Generic_xx1J +d51j.build.variant_system_lib= +d51j.build.vid=0x16D0 +d51j.upload.protocol=sam-ba +d51j.bootloader.tool=openocd +d51j.menu.float.default=Print & String use auto-promoted doubles only +d51j.menu.float.default.build.floatconfig=FLOAT_BOTH_DOUBLES_ONLY +d51j.menu.float.print=Print uses separate singles and doubles +d51j.menu.float.print.build.floatconfig=FLOAT_PRINT_SINGLES_DOUBLES +d51j.menu.float.string=String uses separate singles and doubles +d51j.menu.float.string.build.floatconfig=FLOAT_STRING_SINGLES_DOUBLES +d51j.menu.float.both=Print & String use separate singles and doubles +d51j.menu.float.both.build.floatconfig=FLOAT_BOTH_SINGLES_DOUBLES +d51j.menu.config.disabled=config.h disabled +d51j.menu.config.disabled.build.buildconfig=CONFIG_H_DISABLED +d51j.menu.config.enabled=config.h enabled (mostly code size reductions) +d51j.menu.config.enabled.build.buildconfig=CONFIG_H_ENABLED +d51j.menu.clock.internal_usb=INTERNAL_USB_CALIBRATED_OSCILLATOR +d51j.menu.clock.internal_usb.build.clockconfig=CLOCKCONFIG_INTERNAL_USB +d51j.menu.clock.internal=INTERNAL_OSCILLATOR +d51j.menu.clock.internal.build.clockconfig=CLOCKCONFIG_INTERNAL +d51j.menu.clock.crystal_32k=32KHZ_CRYSTAL +d51j.menu.clock.crystal_32k.build.clockconfig=CLOCKCONFIG_32768HZ_CRYSTAL +d51j.menu.clock.crystal_hs=HIGH_SPEED_CRYSTAL +d51j.menu.clock.crystal_hs.build.clockconfig=CLOCKCONFIG_HS_CRYSTAL +d51j.menu.timer.timer_732Hz=732.4Hz (16-bit) +d51j.menu.timer.timer_732Hz.build.timerconfig=TIMER_732Hz +d51j.menu.timer.timer_366Hz=366.2Hz (16-bit) +d51j.menu.timer.timer_366Hz.build.timerconfig=TIMER_366Hz +d51j.menu.timer.timer_244Hz=244.1Hz (16-bit) +d51j.menu.timer.timer_244Hz.build.timerconfig=TIMER_244Hz +d51j.menu.timer.timer_183Hz=183.1Hz (16-bit) +d51j.menu.timer.timer_183Hz.build.timerconfig=TIMER_183Hz +d51j.menu.timer.timer_146Hz=146.5Hz (16-bit) +d51j.menu.timer.timer_146Hz.build.timerconfig=TIMER_146Hz +d51j.menu.timer.timer_122Hz=122.1Hz (16-bit) +d51j.menu.timer.timer_122Hz.build.timerconfig=TIMER_122Hz +d51j.menu.timer.timer_105Hz=104.6Hz (16-bit) +d51j.menu.timer.timer_105Hz.build.timerconfig=TIMER_105Hz +d51j.menu.timer.timer_81Hz=81.38Hz (16-bit) +d51j.menu.timer.timer_81Hz.build.timerconfig=TIMER_81Hz +d51j.menu.timer.timer_61Hz=61.04Hz (16-bit) +d51j.menu.timer.timer_61Hz.build.timerconfig=TIMER_61Hz +d51j.menu.timer.timer_31Hz=30.52Hz (16-bit) +d51j.menu.timer.timer_31Hz.build.timerconfig=TIMER_31Hz +d51j.menu.timer.timer_187500Hz=187500Hz (8-bit) +d51j.menu.timer.timer_187500Hz.build.timerconfig=TIMER_187500Hz +d51j.menu.timer.timer_93750Hz=93750Hz (8-bit) +d51j.menu.timer.timer_93750Hz.build.timerconfig=TIMER_93750Hz +d51j.menu.timer.timer_62500Hz=62500Hz (8-bit) +d51j.menu.timer.timer_62500Hz.build.timerconfig=TIMER_62500Hz +d51j.menu.timer.timer_37500Hz=37500Hz (8-bit) +d51j.menu.timer.timer_37500Hz.build.timerconfig=TIMER_37500Hz +d51j.menu.timer.timer_20833Hz=20833Hz (8-bit) +d51j.menu.timer.timer_20833Hz.build.timerconfig=TIMER_20833Hz +d51j.menu.timer.timer_12500Hz=12500Hz (8-bit) +d51j.menu.timer.timer_12500Hz.build.timerconfig=TIMER_12500Hz +d51j.menu.timer.timer_7500Hz=7500Hz (8-bit) +d51j.menu.timer.timer_7500Hz.build.timerconfig=TIMER_7500Hz +d51j.menu.timer.timer_4166Hz=4166Hz (8-bit) +d51j.menu.timer.timer_4166Hz.build.timerconfig=TIMER_4166Hz +d51j.menu.timer.timer_2930Hz=2930Hz (8-bit) +d51j.menu.timer.timer_2930Hz.build.timerconfig=TIMER_2930Hz +d51j.menu.timer.timer_1465Hz=1465Hz (16-bit) +d51j.menu.timer.timer_1465Hz.build.timerconfig=TIMER_1465Hz +d51j.menu.cpu.samd51j18a_120=SAMD51J18A_120MHz +d51j.menu.cpu.samd51j18a_120.upload.maximum_size=253952 +d51j.menu.cpu.samd51j18a_120.build.mcu=cortex-m4 +d51j.menu.cpu.samd51j18a_120.build.mathlib=arm_cortexM4lf_math +d51j.menu.cpu.samd51j18a_120.build.f_cpu=120000000L +d51j.menu.cpu.samd51j18a_120.build.usb_product="Xeno D51" + +# KH mod +#d51j.menu.cpu.samd51j18a_120.build.extra_flags=-D__SAMD51J18A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 +d51j.menu.cpu.samd51j18a_120.build.extra_flags=-D__SAMD51J18A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 -D__SAMD51__ +###### + +d51j.menu.cpu.samd51j18a_120.build.ldscript=flash_m4f_256KB.ld +d51j.menu.cpu.samd51j18a_120.build.openocdscript=openocd_scripts/SAMD51J18A.cfg +d51j.menu.cpu.samd51j18a_120.bootloader.file=zero/binaries/sam_ba_SAMD51J18A.bin +d51j.menu.cpu.samd51j18a_48=SAMD51J18A_48MHz +d51j.menu.cpu.samd51j18a_48.upload.maximum_size=253952 +d51j.menu.cpu.samd51j18a_48.build.mcu=cortex-m4 +d51j.menu.cpu.samd51j18a_48.build.mathlib=arm_cortexM4lf_math +d51j.menu.cpu.samd51j18a_48.build.f_cpu=48000000L +d51j.menu.cpu.samd51j18a_48.build.usb_product="Xeno D51" + +# KH mod +#d51j.menu.cpu.samd51j18a_48.build.extra_flags=-D__SAMD51J18A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 +d51j.menu.cpu.samd51j18a_48.build.extra_flags=-D__SAMD51J18A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 -D__SAMD51__ +###### + +d51j.menu.cpu.samd51j18a_48.build.ldscript=flash_m4f_256KB.ld +d51j.menu.cpu.samd51j18a_48.build.openocdscript=openocd_scripts/SAMD51J18A.cfg +d51j.menu.cpu.samd51j18a_48.bootloader.file=zero/binaries/sam_ba_SAMD51J18A.bin +d51j.menu.cpu.samd51j19a_120=SAMD51J19A_120MHz +d51j.menu.cpu.samd51j19a_120.upload.maximum_size=516096 +d51j.menu.cpu.samd51j19a_120.build.mcu=cortex-m4 +d51j.menu.cpu.samd51j19a_120.build.mathlib=arm_cortexM4lf_math +d51j.menu.cpu.samd51j19a_120.build.f_cpu=120000000L +d51j.menu.cpu.samd51j19a_120.build.usb_product="Xeno D51" + +# KH mod +#d51j.menu.cpu.samd51j19a_120.build.extra_flags=-D__SAMD51J19A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 +d51j.menu.cpu.samd51j19a_120.build.extra_flags=-D__SAMD51J19A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 -D__SAMD51__ +###### + +d51j.menu.cpu.samd51j19a_120.build.ldscript=flash_m4f_512KB.ld +d51j.menu.cpu.samd51j19a_120.build.openocdscript=openocd_scripts/SAMD51J19A.cfg +d51j.menu.cpu.samd51j19a_120.bootloader.file=zero/binaries/sam_ba_SAMD51J19A.bin +d51j.menu.cpu.samd51j19a_48=SAMD51J19A_48MHz +d51j.menu.cpu.samd51j19a_48.upload.maximum_size=516096 +d51j.menu.cpu.samd51j19a_48.build.mcu=cortex-m4 +d51j.menu.cpu.samd51j19a_48.build.mathlib=arm_cortexM4lf_math +d51j.menu.cpu.samd51j19a_48.build.f_cpu=48000000L +d51j.menu.cpu.samd51j19a_48.build.usb_product="Xeno D51" + +# KH mod +#d51j.menu.cpu.samd51j19a_48.build.extra_flags=-D__SAMD51J19A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 +d51j.menu.cpu.samd51j19a_48.build.extra_flags=-D__SAMD51J19A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 -D__SAMD51__ +###### + +d51j.menu.cpu.samd51j19a_48.build.ldscript=flash_m4f_512KB.ld +d51j.menu.cpu.samd51j19a_48.build.openocdscript=openocd_scripts/SAMD51J19A.cfg +d51j.menu.cpu.samd51j19a_48.bootloader.file=zero/binaries/sam_ba_SAMD51J19A.bin +d51j.menu.cpu.samd51j20a_120=SAMD51J20A_120MHz +d51j.menu.cpu.samd51j20a_120.upload.maximum_size=1040384 +d51j.menu.cpu.samd51j20a_120.build.mcu=cortex-m4 +d51j.menu.cpu.samd51j20a_120.build.mathlib=arm_cortexM4lf_math +d51j.menu.cpu.samd51j20a_120.build.f_cpu=120000000L +d51j.menu.cpu.samd51j20a_120.build.usb_product="Xeno D51" + +# KH mod +#d51j.menu.cpu.samd51j20a_120.build.extra_flags=-D__SAMD51J20A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 +d51j.menu.cpu.samd51j20a_120.build.extra_flags=-D__SAMD51J20A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 -D__SAMD51__ +###### + +d51j.menu.cpu.samd51j20a_120.build.ldscript=flash_m4f_1MB.ld +d51j.menu.cpu.samd51j20a_120.build.openocdscript=openocd_scripts/SAMD51J20A.cfg +d51j.menu.cpu.samd51j20a_120.bootloader.file=zero/binaries/sam_ba_SAMD51J20A.bin +d51j.menu.cpu.samd51j20a_48=SAMD51J20A_48MHz +d51j.menu.cpu.samd51j20a_48.upload.maximum_size=1040384 +d51j.menu.cpu.samd51j20a_48.build.mcu=cortex-m4 +d51j.menu.cpu.samd51j20a_48.build.mathlib=arm_cortexM4lf_math +d51j.menu.cpu.samd51j20a_48.build.f_cpu=48000000L +d51j.menu.cpu.samd51j20a_48.build.usb_product="Xeno D51" + +# KH mod +#d51j.menu.cpu.samd51j20a_48.build.extra_flags=-D__SAMD51J20A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 +d51j.menu.cpu.samd51j20a_48.build.extra_flags=-D__SAMD51J20A__ {build.usb_flags} -mfloat-abi=softfp -mfpu=fpv4-sp-d16 -DARM_MATH_CM4 -D__SAMD51__ +###### + +d51j.menu.cpu.samd51j20a_48.build.ldscript=flash_m4f_1MB.ld +d51j.menu.cpu.samd51j20a_48.build.openocdscript=openocd_scripts/SAMD51J20A.cfg +d51j.menu.cpu.samd51j20a_48.bootloader.file=zero/binaries/sam_ba_SAMD51J20A.bin +d51j.menu.bootloader.8kb=8KB_BOOTLOADER +d51j.menu.bootloader.8kb.build.bootloader_size=__8KB_BOOTLOADER__ +d51j.menu.bootloader.8kb.build.ldscript_path=linker_scripts/gcc/8KB_Bootloader +d51j.menu.bootloader.8kb.upload.tool=Fab_SAM_Arduino:bossac +d51j.menu.bootloader.8kb.upload.use_1200bps_touch=true +d51j.menu.bootloader.8kb.upload.wait_for_upload_port=true +d51j.menu.bootloader.8kb.upload.native_usb=true +d51j.menu.bootloader.16kb=16KB_BOOTLOADER +d51j.menu.bootloader.16kb.build.bootloader_size=__16KB_BOOTLOADER__ +d51j.menu.bootloader.16kb.build.ldscript_path=linker_scripts/gcc/16KB_Bootloader +d51j.menu.bootloader.16kb.upload.tool=Fab_SAM_Arduino:bossac +d51j.menu.bootloader.16kb.upload.use_1200bps_touch=true +d51j.menu.bootloader.16kb.upload.wait_for_upload_port=true +d51j.menu.bootloader.16kb.upload.native_usb=true +d51j.menu.bootloader.0kb=NO_BOOTLOADER +d51j.menu.bootloader.0kb.build.bootloader_size=__NO_BOOTLOADER__ +d51j.menu.bootloader.0kb.build.ldscript_path=linker_scripts/gcc/No_Bootloader +d51j.menu.bootloader.0kb.upload.tool=openocd +d51j.menu.bootloader.0kb.upload.use_1200bps_touch=false +d51j.menu.bootloader.0kb.upload.wait_for_upload_port=false +d51j.menu.bootloader.0kb.upload.native_usb=false +d51j.menu.serial.one_uart=ONE_UART_ONE_WIRE_ONE_SPI +d51j.menu.serial.one_uart.build.serialcom_uart=ONE_UART +d51j.menu.serial.one_uart.build.serialcom_wire=ONE_WIRE +d51j.menu.serial.one_uart.build.serialcom_spi=ONE_SPI +d51j.menu.serial.one_uart_two_spi=ONE_UART_ONE_WIRE_TWO_SPI +d51j.menu.serial.one_uart_two_spi.build.serialcom_uart=ONE_UART +d51j.menu.serial.one_uart_two_spi.build.serialcom_wire=ONE_WIRE +d51j.menu.serial.one_uart_two_spi.build.serialcom_spi=TWO_SPI +d51j.menu.serial.one_uart_two_wire=ONE_UART_TWO_WIRE_ONE_SPI +d51j.menu.serial.one_uart_two_wire.build.serialcom_uart=ONE_UART +d51j.menu.serial.one_uart_two_wire.build.serialcom_wire=TWO_WIRE +d51j.menu.serial.one_uart_two_wire.build.serialcom_spi=ONE_SPI +d51j.menu.serial.two_uart=TWO_UART_ONE_WIRE_ONE_SPI +d51j.menu.serial.two_uart.build.serialcom_uart=TWO_UART +d51j.menu.serial.two_uart.build.serialcom_wire=ONE_WIRE +d51j.menu.serial.two_uart.build.serialcom_spi=ONE_SPI +d51j.menu.serial.two_uart_two_spi=TWO_UART_ONE_WIRE_TWO_SPI +d51j.menu.serial.two_uart_two_spi.build.serialcom_uart=TWO_UART +d51j.menu.serial.two_uart_two_spi.build.serialcom_wire=ONE_WIRE +d51j.menu.serial.two_uart_two_spi.build.serialcom_spi=TWO_SPI +d51j.menu.serial.two_uart_two_wire=TWO_UART_TWO_WIRE_ONE_SPI +d51j.menu.serial.two_uart_two_wire.build.serialcom_uart=TWO_UART +d51j.menu.serial.two_uart_two_wire.build.serialcom_wire=TWO_WIRE +d51j.menu.serial.two_uart_two_wire.build.serialcom_spi=ONE_SPI +d51j.menu.serial.three_uart=THREE_UART_ONE_WIRE_ONE_SPI +d51j.menu.serial.three_uart.build.serialcom_uart=THREE_UART +d51j.menu.serial.three_uart.build.serialcom_wire=ONE_WIRE +d51j.menu.serial.three_uart.build.serialcom_spi=ONE_SPI +d51j.menu.serial.three_uart_two_spi=THREE_UART_ONE_WIRE_TWO_SPI +d51j.menu.serial.three_uart_two_spi.build.serialcom_uart=THREE_UART +d51j.menu.serial.three_uart_two_spi.build.serialcom_wire=ONE_WIRE +d51j.menu.serial.three_uart_two_spi.build.serialcom_spi=TWO_SPI +d51j.menu.serial.three_uart_two_wire=THREE_UART_TWO_WIRE_ONE_SPI +d51j.menu.serial.three_uart_two_wire.build.serialcom_uart=THREE_UART +d51j.menu.serial.three_uart_two_wire.build.serialcom_wire=TWO_WIRE +d51j.menu.serial.three_uart_two_wire.build.serialcom_spi=ONE_SPI +d51j.menu.serial.no_uart=NO_UART_ONE_WIRE_ONE_SPI +d51j.menu.serial.no_uart.build.serialcom_uart=NO_UART +d51j.menu.serial.no_uart.build.serialcom_wire=ONE_WIRE +d51j.menu.serial.no_uart.build.serialcom_spi=ONE_SPI +d51j.menu.usb.cdc=CDC_ONLY +d51j.menu.usb.cdc.build.usbcom=CDC_ONLY +d51j.menu.usb.cdc.build.pid=0x8557 +d51j.menu.usb.cdc_hid=CDC_HID +d51j.menu.usb.cdc_hid.build.usbcom=CDC_HID +d51j.menu.usb.cdc_hid.build.pid=0x8856 +d51j.menu.usb.withcdc=WITH_CDC +d51j.menu.usb.withcdc.build.usbcom=WITH_CDC +d51j.menu.usb.withcdc.build.pid=0x8B41 +d51j.menu.usb.hid=HID_ONLY +d51j.menu.usb.hid.build.usbcom=HID_ONLY +d51j.menu.usb.hid.build.pid=0x8B40 +d51j.menu.usb.nocdc=WITHOUT_CDC +d51j.menu.usb.nocdc.build.usbcom=WITHOUT_CDC +d51j.menu.usb.nocdc.build.pid=0x8A0C +d51j.menu.usb.none=USB_DISABLED +d51j.menu.usb.none.build.usbcom=USB_DISABLED +d51j.menu.usb.none.build.pid=0x8856 diff --git a/Packages_Patches/Seeeduino/hardware/samd/1.7.7/cores/arduino/Arduino.h b/Packages_Patches/Seeeduino/hardware/samd/1.7.7/cores/arduino/Arduino.h index ca6ec0d5..51db668f 100644 --- a/Packages_Patches/Seeeduino/hardware/samd/1.7.7/cores/arduino/Arduino.h +++ b/Packages_Patches/Seeeduino/hardware/samd/1.7.7/cores/arduino/Arduino.h @@ -44,7 +44,7 @@ typedef uint16_t word; #include "itoa.h" #ifdef __cplusplus -extern "C"{ +extern "C" { #endif // __cplusplus // Include Atmel headers @@ -76,16 +76,16 @@ int __debug_buf(const char* head, char* buf, int len); // The following headers are for C++ only compilation #ifdef __cplusplus - #include "WCharacter.h" - #include "WString.h" - #include "Tone.h" - #include "WMath.h" - #include "HardwareSerial.h" - #include "pulse.h" + #include "WCharacter.h" + #include "WString.h" + #include "Tone.h" + #include "WMath.h" + #include "HardwareSerial.h" + #include "pulse.h" #endif #include "delay.h" #ifdef __cplusplus - #include "Uart.h" + #include "Uart.h" #endif // Include board variant @@ -100,25 +100,25 @@ int __debug_buf(const char* head, char* buf, int len); // undefine stdlib's abs if encountered #ifdef abs -#undef abs + #undef abs #endif // abs // undefine stdlib's abs if encountered #ifdef abs -#undef abs + #undef abs #endif // abs #ifdef __cplusplus - template - auto min(const T& a, const L& b) -> decltype((b < a) ? b : a) - { - return (b < a) ? b : a; - } - - template - auto max(const T& a, const L& b) -> decltype((b < a) ? b : a) - { - return (a < b) ? b : a; - } +template +auto min(const T& a, const L& b) -> decltype((b < a) ? b : a) +{ + return (b < a) ? b : a; +} + +template +auto max(const T& a, const L& b) -> decltype((b < a) ? b : a) +{ + return (a < b) ? b : a; +} #else #ifndef min #define min(a,b) \ @@ -147,8 +147,8 @@ int __debug_buf(const char* head, char* buf, int len); static inline unsigned char __interruptsStatus(void) __attribute__((always_inline, unused)); static inline unsigned char __interruptsStatus(void) { - // See http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0497a/CHDBIBGJ.html - return (__get_PRIMASK() ? 0 : 1); + // See http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0497a/CHDBIBGJ.html + return (__get_PRIMASK() ? 0 : 1); } #define interruptsStatus() __interruptsStatus() #endif @@ -164,18 +164,18 @@ static inline unsigned char __interruptsStatus(void) #define bit(b) (1UL << (b)) #if (ARDUINO_SAMD_VARIANT_COMPLIANCE >= 10606) -// Interrupts -#define digitalPinToInterrupt(P) ( P ) + // Interrupts + #define digitalPinToInterrupt(P) ( P ) #endif // USB #ifdef USE_TINYUSB -#include "Adafruit_TinyUSB_Core.h" + #include "Adafruit_TinyUSB_Core.h" #else -#include "USB/USBDesc.h" -#include "USB/USBCore.h" -#include "USB/USBAPI.h" -#include "USB/USB_host.h" + #include "USB/USBDesc.h" + #include "USB/USBCore.h" + #include "USB/USBAPI.h" + #include "USB/USB_host.h" #endif #endif // Arduino_h diff --git a/Packages_Patches/Seeeduino/hardware/samd/1.7.7/cores/arduino/Print.cpp b/Packages_Patches/Seeeduino/hardware/samd/1.7.7/cores/arduino/Print.cpp index 09d5864c..b47efa1a 100644 --- a/Packages_Patches/Seeeduino/hardware/samd/1.7.7/cores/arduino/Print.cpp +++ b/Packages_Patches/Seeeduino/hardware/samd/1.7.7/cores/arduino/Print.cpp @@ -35,386 +35,432 @@ /* default implementation: may be overridden */ size_t Print::write(const uint8_t *buffer, size_t size) { - size_t n = 0; - while (size--) { - if (write(*buffer++)) n++; - else break; - } - return n; + size_t n = 0; + + while (size--) + { + if (write(*buffer++)) + n++; + else + break; + } + + return n; } size_t Print::print(const __FlashStringHelper *ifsh) { - return print(reinterpret_cast(ifsh)); + return print(reinterpret_cast(ifsh)); } size_t Print::print(const String &s) { - return write(s.c_str(), s.length()); + return write(s.c_str(), s.length()); } size_t Print::print(const char str[]) { - return write(str); + return write(str); } size_t Print::print(char c) { - return write(c); + return write(c); } size_t Print::print(unsigned char b, int base) { - return print((unsigned long) b, base); + return print((unsigned long) b, base); } size_t Print::print(int n, int base) { - return print((long) n, base); + return print((long) n, base); } size_t Print::print(unsigned int n, int base) { - return print((unsigned long) n, base); + return print((unsigned long) n, base); } size_t Print::print(long n, int base) { - if (base == 0) { - return write(n); - } else if (base == 10) { - if (n < 0) { - int t = print('-'); - n = -n; - return printNumber(n, 10) + t; - } - return printNumber(n, 10); - } else { - return printNumber(n, base); - } + if (base == 0) + { + return write(n); + } + else if (base == 10) + { + if (n < 0) + { + int t = print('-'); + n = -n; + return printNumber(n, 10) + t; + } + + return printNumber(n, 10); + } + else + { + return printNumber(n, base); + } } size_t Print::print(unsigned long n, int base) { - if (base == 0) return write(n); - else return printNumber(n, base); + if (base == 0) + return write(n); + else + return printNumber(n, base); } size_t Print::print(long long n, int base) { - if (base == 0) { - return write(n); - } else if (base == 10) { - if (n < 0) { - int t = print('-'); - n = -n; - return printULLNumber(n, 10) + t; - } - return printULLNumber(n, 10); - } else { - return printULLNumber(n, base); - } + if (base == 0) + { + return write(n); + } + else if (base == 10) + { + if (n < 0) + { + int t = print('-'); + n = -n; + return printULLNumber(n, 10) + t; + } + + return printULLNumber(n, 10); + } + else + { + return printULLNumber(n, base); + } } size_t Print::print(unsigned long long n, int base) { - if (base == 0) return write(n); - else return printULLNumber(n, base); + if (base == 0) + return write(n); + else + return printULLNumber(n, base); } size_t Print::print(double n, int digits) { - return printFloat(n, digits); + return printFloat(n, digits); } size_t Print::println(const __FlashStringHelper *ifsh) { - size_t n = print(ifsh); - n += println(); - return n; + size_t n = print(ifsh); + n += println(); + return n; } size_t Print::print(const Printable& x) { - return x.printTo(*this); + return x.printTo(*this); } size_t Print::println(void) { - return write("\r\n"); + return write("\r\n"); } size_t Print::println(const String &s) { - size_t n = print(s); - n += println(); - return n; + size_t n = print(s); + n += println(); + return n; } size_t Print::println(const char c[]) { - size_t n = print(c); - n += println(); - return n; + size_t n = print(c); + n += println(); + return n; } size_t Print::println(char c) { - size_t n = print(c); - n += println(); - return n; + size_t n = print(c); + n += println(); + return n; } size_t Print::println(unsigned char b, int base) { - size_t n = print(b, base); - n += println(); - return n; + size_t n = print(b, base); + n += println(); + return n; } size_t Print::println(int num, int base) { - size_t n = print(num, base); - n += println(); - return n; + size_t n = print(num, base); + n += println(); + return n; } size_t Print::println(unsigned int num, int base) { - size_t n = print(num, base); - n += println(); - return n; + size_t n = print(num, base); + n += println(); + return n; } size_t Print::println(long num, int base) { - size_t n = print(num, base); - n += println(); - return n; + size_t n = print(num, base); + n += println(); + return n; } size_t Print::println(unsigned long num, int base) { - size_t n = print(num, base); - n += println(); - return n; + size_t n = print(num, base); + n += println(); + return n; } size_t Print::println(long long num, int base) { - size_t n = print(num, base); - n += println(); - return n; + size_t n = print(num, base); + n += println(); + return n; } size_t Print::println(unsigned long long num, int base) { - size_t n = print(num, base); - n += println(); - return n; + size_t n = print(num, base); + n += println(); + return n; } size_t Print::println(double num, int digits) { - size_t n = print(num, digits); - n += println(); - return n; + size_t n = print(num, digits); + n += println(); + return n; } size_t Print::println(const Printable& x) { - size_t n = print(x); - n += println(); - return n; + size_t n = print(x); + n += println(); + return n; } size_t Print::printf(const char * format, ...) { - char buf[256]; - int len; + char buf[256]; + int len; - va_list ap; - va_start(ap, format); + va_list ap; + va_start(ap, format); - len = vsnprintf(buf, 256, format, ap); - this->write(buf, len); + len = vsnprintf(buf, 256, format, ap); + this->write(buf, len); - va_end(ap); - return len; + va_end(ap); + return len; } // Private Methods ///////////////////////////////////////////////////////////// size_t Print::printNumber(unsigned long n, uint8_t base) { - char buf[8 * sizeof(long) + 1]; // Assumes 8-bit chars plus zero byte. - char *str = &buf[sizeof(buf) - 1]; + char buf[8 * sizeof(long) + 1]; // Assumes 8-bit chars plus zero byte. + char *str = &buf[sizeof(buf) - 1]; - *str = '\0'; + *str = '\0'; - // prevent crash if called with base == 1 - if (base < 2) base = 10; + // prevent crash if called with base == 1 + if (base < 2) + base = 10; - do { - char c = n % base; - n /= base; + do + { + char c = n % base; + n /= base; - *--str = c < 10 ? c + '0' : c + 'A' - 10; - } while(n); + *--str = c < 10 ? c + '0' : c + 'A' - 10; + } while (n); - return write(str); + return write(str); } // REFERENCE IMPLEMENTATION FOR ULL // size_t Print::printULLNumber(unsigned long long n, uint8_t base) // { - // // if limited to base 10 and 16 the bufsize can be smaller - // char buf[65]; - // char *str = &buf[64]; +// // if limited to base 10 and 16 the bufsize can be smaller +// char buf[65]; +// char *str = &buf[64]; - // *str = '\0'; +// *str = '\0'; - // // prevent crash if called with base == 1 - // if (base < 2) base = 10; +// // prevent crash if called with base == 1 +// if (base < 2) base = 10; - // do { - // unsigned long long t = n / base; - // char c = n - t * base; // faster than c = n%base; - // n = t; - // *--str = c < 10 ? c + '0' : c + 'A' - 10; - // } while(n); +// do { +// unsigned long long t = n / base; +// char c = n - t * base; // faster than c = n%base; +// n = t; +// *--str = c < 10 ? c + '0' : c + 'A' - 10; +// } while(n); - // return write(str); +// return write(str); // } // FAST IMPLEMENTATION FOR ULL size_t Print::printULLNumber(unsigned long long n64, uint8_t base) { - // if limited to base 10 and 16 the bufsize can be 20 - char buf[64]; - uint8_t i = 0; - uint8_t innerLoops = 0; - - // prevent crash if called with base == 1 - if (base < 2) base = 10; - - // process chunks that fit in "16 bit math". - uint16_t top = 0xFFFF / base; - uint16_t th16 = 1; - while (th16 < top) - { - th16 *= base; - innerLoops++; - } - - while (n64 > th16) - { - // 64 bit math part - uint64_t q = n64 / th16; - uint16_t r = n64 - q*th16; - n64 = q; - - // 16 bit math loop to do remainder. (note buffer is filled reverse) - for (uint8_t j=0; j < innerLoops; j++) - { - uint16_t qq = r/base; - buf[i++] = r - qq*base; - r = qq; - } - } - - uint16_t n16 = n64; - while (n16 > 0) - { - uint16_t qq = n16/base; - buf[i++] = n16 - qq*base; - n16 = qq; - } - - size_t bytes = i; - for (; i > 0; i--) - write((char) (buf[i - 1] < 10 ? - '0' + buf[i - 1] : - 'A' + buf[i - 1] - 10)); - - return bytes; + // if limited to base 10 and 16 the bufsize can be 20 + char buf[64]; + uint8_t i = 0; + uint8_t innerLoops = 0; + + // prevent crash if called with base == 1 + if (base < 2) + base = 10; + + // process chunks that fit in "16 bit math". + uint16_t top = 0xFFFF / base; + uint16_t th16 = 1; + + while (th16 < top) + { + th16 *= base; + innerLoops++; + } + + while (n64 > th16) + { + // 64 bit math part + uint64_t q = n64 / th16; + uint16_t r = n64 - q * th16; + n64 = q; + + // 16 bit math loop to do remainder. (note buffer is filled reverse) + for (uint8_t j = 0; j < innerLoops; j++) + { + uint16_t qq = r / base; + buf[i++] = r - qq * base; + r = qq; + } + } + + uint16_t n16 = n64; + + while (n16 > 0) + { + uint16_t qq = n16 / base; + buf[i++] = n16 - qq * base; + n16 = qq; + } + + size_t bytes = i; + + for (; i > 0; i--) + write((char) (buf[i - 1] < 10 ? + '0' + buf[i - 1] : + 'A' + buf[i - 1] - 10)); + + return bytes; } size_t Print::printFloat(double number, int digits) { - if (digits < 0) - digits = 2; + if (digits < 0) + digits = 2; + + size_t n = 0; + + if (isnan(number)) + return print("nan"); - size_t n = 0; + if (isinf(number)) + return print("inf"); - if (isnan(number)) return print("nan"); - if (isinf(number)) return print("inf"); - if (number > 4294967040.0) return print ("ovf"); // constant determined empirically - if (number <-4294967040.0) return print ("ovf"); // constant determined empirically + if (number > 4294967040.0) + return print ("ovf"); // constant determined empirically - // Handle negative numbers - if (number < 0.0) - { - n += print('-'); - number = -number; - } + if (number < -4294967040.0) + return print ("ovf"); // constant determined empirically - // Round correctly so that print(1.999, 2) prints as "2.00" - double rounding = 0.5; - for (uint8_t i=0; i 0) { - n += print("."); - } + number += rounding; - // Extract digits from the remainder one at a time - while (digits-- > 0) - { - remainder *= 10.0; - unsigned int toPrint = (unsigned int)remainder; - n += print(toPrint); - remainder -= toPrint; - } + // Extract the integer part of the number and print it + unsigned long int_part = (unsigned long)number; + double remainder = number - (double)int_part; + n += print(int_part); - return n; + // Print the decimal point, but only if there are digits beyond + if (digits > 0) + { + n += print("."); + } + + // Extract digits from the remainder one at a time + while (digits-- > 0) + { + remainder *= 10.0; + unsigned int toPrint = (unsigned int)remainder; + n += print(toPrint); + remainder -= toPrint; + } + + return n; } size_t Print::printBuffer(uint8_t const buffer[], int len, char delim, int byteline) { - if (buffer == NULL || len == 0) return 0; + if (buffer == NULL || len == 0) + return 0; - for(int i=0; iprintf("%02X", buffer[i]); - } + if ( byteline && (i % byteline == 0) ) + println(); - return (len*3 - 1); + this->printf("%02X", buffer[i]); + } + + return (len * 3 - 1); } size_t Print::printBufferReverse(uint8_t const buffer[], int len, char delim, int byteline) { - if (buffer == NULL || len == 0) return 0; + if (buffer == NULL || len == 0) + return 0; + + for (int i = 0; i < len; i++) + { + if (i != 0) + print(delim); - for(int i=0; iprintf("%02X", buffer[len-1-i]); - } + this->printf("%02X", buffer[len - 1 - i]); + } - return (len*3 - 1); + return (len * 3 - 1); } diff --git a/Packages_Patches/Seeeduino/hardware/samd/1.7.7/cores/arduino/Print.h b/Packages_Patches/Seeeduino/hardware/samd/1.7.7/cores/arduino/Print.h index 48353c44..810a7704 100644 --- a/Packages_Patches/Seeeduino/hardware/samd/1.7.7/cores/arduino/Print.h +++ b/Packages_Patches/Seeeduino/hardware/samd/1.7.7/cores/arduino/Print.h @@ -20,7 +20,6 @@ #include #include // for size_t -#include // for printf #include "WString.h" #include "Printable.h" @@ -32,77 +31,93 @@ class Print { - private: - int write_error; - size_t printNumber(unsigned long, uint8_t); - size_t printULLNumber(unsigned long long, uint8_t); - size_t printFloat(double, int); - protected: - void setWriteError(int err = 1) { write_error = err; } - public: - Print() : write_error(0) {} - - int getWriteError() { return write_error; } - void clearWriteError() { setWriteError(0); } - - virtual size_t write(uint8_t) = 0; - size_t write(const char *str) { - if (str == NULL) return 0; - return write((const uint8_t *)str, strlen(str)); - } - virtual size_t write(const uint8_t *buffer, size_t size); - size_t write(const char *buffer, size_t size) { - return write((const uint8_t *)buffer, size); - } - - // default to zero, meaning "a single write may block" - // should be overridden by subclasses with buffering - virtual int availableForWrite() { return 0; } - - size_t print(const __FlashStringHelper *); - size_t print(const String &); - size_t print(const char[]); - size_t print(char); - size_t print(unsigned char, int = DEC); - size_t print(int, int = DEC); - size_t print(unsigned int, int = DEC); - size_t print(long, int = DEC); - size_t print(unsigned long, int = DEC); - size_t print(long long, int = DEC); - size_t print(unsigned long long, int = DEC); - size_t print(double, int = 2); - size_t print(const Printable&); - - size_t println(const __FlashStringHelper *); - size_t println(const String &s); - size_t println(const char[]); - size_t println(char); - size_t println(unsigned char, int = DEC); - size_t println(int, int = DEC); - size_t println(unsigned int, int = DEC); - size_t println(long, int = DEC); - size_t println(unsigned long, int = DEC); - size_t println(long long, int = DEC); - size_t println(unsigned long long, int = DEC); - size_t println(double, int = 2); - size_t println(const Printable&); - size_t println(void); - - size_t printf(const char * format, ...); - - size_t printBuffer(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); - size_t printBuffer(char const buffer[], int size, char delim=' ', int byteline = 0) - { - return printBuffer((uint8_t const*) buffer, size, delim, byteline); - } - - size_t printBufferReverse(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); - size_t printBufferReverse(char const buffer[], int size, char delim=' ', int byteline = 0) - { - return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); - } - - virtual void flush() { /* Empty implementation for backward compatibility */ } + private: + int write_error; + size_t printNumber(unsigned long, uint8_t); + size_t printULLNumber(unsigned long long, uint8_t); + size_t printFloat(double, int); + protected: + void setWriteError(int err = 1) + { + write_error = err; + } + public: + Print() : write_error(0) {} + + int getWriteError() + { + return write_error; + } + void clearWriteError() + { + setWriteError(0); + } + + virtual size_t write(uint8_t) = 0; + size_t write(const char *str) + { + if (str == NULL) + return 0; + + return write((const uint8_t *)str, strlen(str)); + } + virtual size_t write(const uint8_t *buffer, size_t size); + size_t write(const char *buffer, size_t size) + { + return write((const uint8_t *)buffer, size); + } + + // default to zero, meaning "a single write may block" + // should be overridden by subclasses with buffering + virtual int availableForWrite() + { + return 0; + } + + size_t print(const __FlashStringHelper *); + size_t print(const String &); + size_t print(const char[]); + size_t print(char); + size_t print(unsigned char, int = DEC); + size_t print(int, int = DEC); + size_t print(unsigned int, int = DEC); + size_t print(long, int = DEC); + size_t print(unsigned long, int = DEC); + size_t print(long long, int = DEC); + size_t print(unsigned long long, int = DEC); + size_t print(double, int = 2); + size_t print(const Printable&); + + size_t println(const __FlashStringHelper *); + size_t println(const String &s); + size_t println(const char[]); + size_t println(char); + size_t println(unsigned char, int = DEC); + size_t println(int, int = DEC); + size_t println(unsigned int, int = DEC); + size_t println(long, int = DEC); + size_t println(unsigned long, int = DEC); + size_t println(long long, int = DEC); + size_t println(unsigned long long, int = DEC); + size_t println(double, int = 2); + size_t println(const Printable&); + size_t println(void); + + size_t printf(const char * format, ...); + + size_t printBuffer(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); + size_t printBuffer(char const buffer[], int size, char delim = ' ', int byteline = 0) + { + return printBuffer((uint8_t const*) buffer, size, delim, byteline); + } + + size_t printBufferReverse(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); + size_t printBufferReverse(char const buffer[], int size, char delim = ' ', int byteline = 0) + { + return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); + } + + virtual void flush() { /* Empty implementation for backward compatibility */ } }; diff --git a/Packages_Patches/Seeeduino/hardware/samd/1.7.8/cores/arduino/Arduino.h b/Packages_Patches/Seeeduino/hardware/samd/1.7.8/cores/arduino/Arduino.h index ca6ec0d5..51db668f 100644 --- a/Packages_Patches/Seeeduino/hardware/samd/1.7.8/cores/arduino/Arduino.h +++ b/Packages_Patches/Seeeduino/hardware/samd/1.7.8/cores/arduino/Arduino.h @@ -44,7 +44,7 @@ typedef uint16_t word; #include "itoa.h" #ifdef __cplusplus -extern "C"{ +extern "C" { #endif // __cplusplus // Include Atmel headers @@ -76,16 +76,16 @@ int __debug_buf(const char* head, char* buf, int len); // The following headers are for C++ only compilation #ifdef __cplusplus - #include "WCharacter.h" - #include "WString.h" - #include "Tone.h" - #include "WMath.h" - #include "HardwareSerial.h" - #include "pulse.h" + #include "WCharacter.h" + #include "WString.h" + #include "Tone.h" + #include "WMath.h" + #include "HardwareSerial.h" + #include "pulse.h" #endif #include "delay.h" #ifdef __cplusplus - #include "Uart.h" + #include "Uart.h" #endif // Include board variant @@ -100,25 +100,25 @@ int __debug_buf(const char* head, char* buf, int len); // undefine stdlib's abs if encountered #ifdef abs -#undef abs + #undef abs #endif // abs // undefine stdlib's abs if encountered #ifdef abs -#undef abs + #undef abs #endif // abs #ifdef __cplusplus - template - auto min(const T& a, const L& b) -> decltype((b < a) ? b : a) - { - return (b < a) ? b : a; - } - - template - auto max(const T& a, const L& b) -> decltype((b < a) ? b : a) - { - return (a < b) ? b : a; - } +template +auto min(const T& a, const L& b) -> decltype((b < a) ? b : a) +{ + return (b < a) ? b : a; +} + +template +auto max(const T& a, const L& b) -> decltype((b < a) ? b : a) +{ + return (a < b) ? b : a; +} #else #ifndef min #define min(a,b) \ @@ -147,8 +147,8 @@ int __debug_buf(const char* head, char* buf, int len); static inline unsigned char __interruptsStatus(void) __attribute__((always_inline, unused)); static inline unsigned char __interruptsStatus(void) { - // See http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0497a/CHDBIBGJ.html - return (__get_PRIMASK() ? 0 : 1); + // See http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0497a/CHDBIBGJ.html + return (__get_PRIMASK() ? 0 : 1); } #define interruptsStatus() __interruptsStatus() #endif @@ -164,18 +164,18 @@ static inline unsigned char __interruptsStatus(void) #define bit(b) (1UL << (b)) #if (ARDUINO_SAMD_VARIANT_COMPLIANCE >= 10606) -// Interrupts -#define digitalPinToInterrupt(P) ( P ) + // Interrupts + #define digitalPinToInterrupt(P) ( P ) #endif // USB #ifdef USE_TINYUSB -#include "Adafruit_TinyUSB_Core.h" + #include "Adafruit_TinyUSB_Core.h" #else -#include "USB/USBDesc.h" -#include "USB/USBCore.h" -#include "USB/USBAPI.h" -#include "USB/USB_host.h" + #include "USB/USBDesc.h" + #include "USB/USBCore.h" + #include "USB/USBAPI.h" + #include "USB/USB_host.h" #endif #endif // Arduino_h diff --git a/Packages_Patches/Seeeduino/hardware/samd/1.7.8/cores/arduino/Print.cpp b/Packages_Patches/Seeeduino/hardware/samd/1.7.8/cores/arduino/Print.cpp index 09d5864c..b47efa1a 100644 --- a/Packages_Patches/Seeeduino/hardware/samd/1.7.8/cores/arduino/Print.cpp +++ b/Packages_Patches/Seeeduino/hardware/samd/1.7.8/cores/arduino/Print.cpp @@ -35,386 +35,432 @@ /* default implementation: may be overridden */ size_t Print::write(const uint8_t *buffer, size_t size) { - size_t n = 0; - while (size--) { - if (write(*buffer++)) n++; - else break; - } - return n; + size_t n = 0; + + while (size--) + { + if (write(*buffer++)) + n++; + else + break; + } + + return n; } size_t Print::print(const __FlashStringHelper *ifsh) { - return print(reinterpret_cast(ifsh)); + return print(reinterpret_cast(ifsh)); } size_t Print::print(const String &s) { - return write(s.c_str(), s.length()); + return write(s.c_str(), s.length()); } size_t Print::print(const char str[]) { - return write(str); + return write(str); } size_t Print::print(char c) { - return write(c); + return write(c); } size_t Print::print(unsigned char b, int base) { - return print((unsigned long) b, base); + return print((unsigned long) b, base); } size_t Print::print(int n, int base) { - return print((long) n, base); + return print((long) n, base); } size_t Print::print(unsigned int n, int base) { - return print((unsigned long) n, base); + return print((unsigned long) n, base); } size_t Print::print(long n, int base) { - if (base == 0) { - return write(n); - } else if (base == 10) { - if (n < 0) { - int t = print('-'); - n = -n; - return printNumber(n, 10) + t; - } - return printNumber(n, 10); - } else { - return printNumber(n, base); - } + if (base == 0) + { + return write(n); + } + else if (base == 10) + { + if (n < 0) + { + int t = print('-'); + n = -n; + return printNumber(n, 10) + t; + } + + return printNumber(n, 10); + } + else + { + return printNumber(n, base); + } } size_t Print::print(unsigned long n, int base) { - if (base == 0) return write(n); - else return printNumber(n, base); + if (base == 0) + return write(n); + else + return printNumber(n, base); } size_t Print::print(long long n, int base) { - if (base == 0) { - return write(n); - } else if (base == 10) { - if (n < 0) { - int t = print('-'); - n = -n; - return printULLNumber(n, 10) + t; - } - return printULLNumber(n, 10); - } else { - return printULLNumber(n, base); - } + if (base == 0) + { + return write(n); + } + else if (base == 10) + { + if (n < 0) + { + int t = print('-'); + n = -n; + return printULLNumber(n, 10) + t; + } + + return printULLNumber(n, 10); + } + else + { + return printULLNumber(n, base); + } } size_t Print::print(unsigned long long n, int base) { - if (base == 0) return write(n); - else return printULLNumber(n, base); + if (base == 0) + return write(n); + else + return printULLNumber(n, base); } size_t Print::print(double n, int digits) { - return printFloat(n, digits); + return printFloat(n, digits); } size_t Print::println(const __FlashStringHelper *ifsh) { - size_t n = print(ifsh); - n += println(); - return n; + size_t n = print(ifsh); + n += println(); + return n; } size_t Print::print(const Printable& x) { - return x.printTo(*this); + return x.printTo(*this); } size_t Print::println(void) { - return write("\r\n"); + return write("\r\n"); } size_t Print::println(const String &s) { - size_t n = print(s); - n += println(); - return n; + size_t n = print(s); + n += println(); + return n; } size_t Print::println(const char c[]) { - size_t n = print(c); - n += println(); - return n; + size_t n = print(c); + n += println(); + return n; } size_t Print::println(char c) { - size_t n = print(c); - n += println(); - return n; + size_t n = print(c); + n += println(); + return n; } size_t Print::println(unsigned char b, int base) { - size_t n = print(b, base); - n += println(); - return n; + size_t n = print(b, base); + n += println(); + return n; } size_t Print::println(int num, int base) { - size_t n = print(num, base); - n += println(); - return n; + size_t n = print(num, base); + n += println(); + return n; } size_t Print::println(unsigned int num, int base) { - size_t n = print(num, base); - n += println(); - return n; + size_t n = print(num, base); + n += println(); + return n; } size_t Print::println(long num, int base) { - size_t n = print(num, base); - n += println(); - return n; + size_t n = print(num, base); + n += println(); + return n; } size_t Print::println(unsigned long num, int base) { - size_t n = print(num, base); - n += println(); - return n; + size_t n = print(num, base); + n += println(); + return n; } size_t Print::println(long long num, int base) { - size_t n = print(num, base); - n += println(); - return n; + size_t n = print(num, base); + n += println(); + return n; } size_t Print::println(unsigned long long num, int base) { - size_t n = print(num, base); - n += println(); - return n; + size_t n = print(num, base); + n += println(); + return n; } size_t Print::println(double num, int digits) { - size_t n = print(num, digits); - n += println(); - return n; + size_t n = print(num, digits); + n += println(); + return n; } size_t Print::println(const Printable& x) { - size_t n = print(x); - n += println(); - return n; + size_t n = print(x); + n += println(); + return n; } size_t Print::printf(const char * format, ...) { - char buf[256]; - int len; + char buf[256]; + int len; - va_list ap; - va_start(ap, format); + va_list ap; + va_start(ap, format); - len = vsnprintf(buf, 256, format, ap); - this->write(buf, len); + len = vsnprintf(buf, 256, format, ap); + this->write(buf, len); - va_end(ap); - return len; + va_end(ap); + return len; } // Private Methods ///////////////////////////////////////////////////////////// size_t Print::printNumber(unsigned long n, uint8_t base) { - char buf[8 * sizeof(long) + 1]; // Assumes 8-bit chars plus zero byte. - char *str = &buf[sizeof(buf) - 1]; + char buf[8 * sizeof(long) + 1]; // Assumes 8-bit chars plus zero byte. + char *str = &buf[sizeof(buf) - 1]; - *str = '\0'; + *str = '\0'; - // prevent crash if called with base == 1 - if (base < 2) base = 10; + // prevent crash if called with base == 1 + if (base < 2) + base = 10; - do { - char c = n % base; - n /= base; + do + { + char c = n % base; + n /= base; - *--str = c < 10 ? c + '0' : c + 'A' - 10; - } while(n); + *--str = c < 10 ? c + '0' : c + 'A' - 10; + } while (n); - return write(str); + return write(str); } // REFERENCE IMPLEMENTATION FOR ULL // size_t Print::printULLNumber(unsigned long long n, uint8_t base) // { - // // if limited to base 10 and 16 the bufsize can be smaller - // char buf[65]; - // char *str = &buf[64]; +// // if limited to base 10 and 16 the bufsize can be smaller +// char buf[65]; +// char *str = &buf[64]; - // *str = '\0'; +// *str = '\0'; - // // prevent crash if called with base == 1 - // if (base < 2) base = 10; +// // prevent crash if called with base == 1 +// if (base < 2) base = 10; - // do { - // unsigned long long t = n / base; - // char c = n - t * base; // faster than c = n%base; - // n = t; - // *--str = c < 10 ? c + '0' : c + 'A' - 10; - // } while(n); +// do { +// unsigned long long t = n / base; +// char c = n - t * base; // faster than c = n%base; +// n = t; +// *--str = c < 10 ? c + '0' : c + 'A' - 10; +// } while(n); - // return write(str); +// return write(str); // } // FAST IMPLEMENTATION FOR ULL size_t Print::printULLNumber(unsigned long long n64, uint8_t base) { - // if limited to base 10 and 16 the bufsize can be 20 - char buf[64]; - uint8_t i = 0; - uint8_t innerLoops = 0; - - // prevent crash if called with base == 1 - if (base < 2) base = 10; - - // process chunks that fit in "16 bit math". - uint16_t top = 0xFFFF / base; - uint16_t th16 = 1; - while (th16 < top) - { - th16 *= base; - innerLoops++; - } - - while (n64 > th16) - { - // 64 bit math part - uint64_t q = n64 / th16; - uint16_t r = n64 - q*th16; - n64 = q; - - // 16 bit math loop to do remainder. (note buffer is filled reverse) - for (uint8_t j=0; j < innerLoops; j++) - { - uint16_t qq = r/base; - buf[i++] = r - qq*base; - r = qq; - } - } - - uint16_t n16 = n64; - while (n16 > 0) - { - uint16_t qq = n16/base; - buf[i++] = n16 - qq*base; - n16 = qq; - } - - size_t bytes = i; - for (; i > 0; i--) - write((char) (buf[i - 1] < 10 ? - '0' + buf[i - 1] : - 'A' + buf[i - 1] - 10)); - - return bytes; + // if limited to base 10 and 16 the bufsize can be 20 + char buf[64]; + uint8_t i = 0; + uint8_t innerLoops = 0; + + // prevent crash if called with base == 1 + if (base < 2) + base = 10; + + // process chunks that fit in "16 bit math". + uint16_t top = 0xFFFF / base; + uint16_t th16 = 1; + + while (th16 < top) + { + th16 *= base; + innerLoops++; + } + + while (n64 > th16) + { + // 64 bit math part + uint64_t q = n64 / th16; + uint16_t r = n64 - q * th16; + n64 = q; + + // 16 bit math loop to do remainder. (note buffer is filled reverse) + for (uint8_t j = 0; j < innerLoops; j++) + { + uint16_t qq = r / base; + buf[i++] = r - qq * base; + r = qq; + } + } + + uint16_t n16 = n64; + + while (n16 > 0) + { + uint16_t qq = n16 / base; + buf[i++] = n16 - qq * base; + n16 = qq; + } + + size_t bytes = i; + + for (; i > 0; i--) + write((char) (buf[i - 1] < 10 ? + '0' + buf[i - 1] : + 'A' + buf[i - 1] - 10)); + + return bytes; } size_t Print::printFloat(double number, int digits) { - if (digits < 0) - digits = 2; + if (digits < 0) + digits = 2; + + size_t n = 0; + + if (isnan(number)) + return print("nan"); - size_t n = 0; + if (isinf(number)) + return print("inf"); - if (isnan(number)) return print("nan"); - if (isinf(number)) return print("inf"); - if (number > 4294967040.0) return print ("ovf"); // constant determined empirically - if (number <-4294967040.0) return print ("ovf"); // constant determined empirically + if (number > 4294967040.0) + return print ("ovf"); // constant determined empirically - // Handle negative numbers - if (number < 0.0) - { - n += print('-'); - number = -number; - } + if (number < -4294967040.0) + return print ("ovf"); // constant determined empirically - // Round correctly so that print(1.999, 2) prints as "2.00" - double rounding = 0.5; - for (uint8_t i=0; i 0) { - n += print("."); - } + number += rounding; - // Extract digits from the remainder one at a time - while (digits-- > 0) - { - remainder *= 10.0; - unsigned int toPrint = (unsigned int)remainder; - n += print(toPrint); - remainder -= toPrint; - } + // Extract the integer part of the number and print it + unsigned long int_part = (unsigned long)number; + double remainder = number - (double)int_part; + n += print(int_part); - return n; + // Print the decimal point, but only if there are digits beyond + if (digits > 0) + { + n += print("."); + } + + // Extract digits from the remainder one at a time + while (digits-- > 0) + { + remainder *= 10.0; + unsigned int toPrint = (unsigned int)remainder; + n += print(toPrint); + remainder -= toPrint; + } + + return n; } size_t Print::printBuffer(uint8_t const buffer[], int len, char delim, int byteline) { - if (buffer == NULL || len == 0) return 0; + if (buffer == NULL || len == 0) + return 0; - for(int i=0; iprintf("%02X", buffer[i]); - } + if ( byteline && (i % byteline == 0) ) + println(); - return (len*3 - 1); + this->printf("%02X", buffer[i]); + } + + return (len * 3 - 1); } size_t Print::printBufferReverse(uint8_t const buffer[], int len, char delim, int byteline) { - if (buffer == NULL || len == 0) return 0; + if (buffer == NULL || len == 0) + return 0; + + for (int i = 0; i < len; i++) + { + if (i != 0) + print(delim); - for(int i=0; iprintf("%02X", buffer[len-1-i]); - } + this->printf("%02X", buffer[len - 1 - i]); + } - return (len*3 - 1); + return (len * 3 - 1); } diff --git a/Packages_Patches/Seeeduino/hardware/samd/1.7.8/cores/arduino/Print.h b/Packages_Patches/Seeeduino/hardware/samd/1.7.8/cores/arduino/Print.h index 48353c44..810a7704 100644 --- a/Packages_Patches/Seeeduino/hardware/samd/1.7.8/cores/arduino/Print.h +++ b/Packages_Patches/Seeeduino/hardware/samd/1.7.8/cores/arduino/Print.h @@ -20,7 +20,6 @@ #include #include // for size_t -#include // for printf #include "WString.h" #include "Printable.h" @@ -32,77 +31,93 @@ class Print { - private: - int write_error; - size_t printNumber(unsigned long, uint8_t); - size_t printULLNumber(unsigned long long, uint8_t); - size_t printFloat(double, int); - protected: - void setWriteError(int err = 1) { write_error = err; } - public: - Print() : write_error(0) {} - - int getWriteError() { return write_error; } - void clearWriteError() { setWriteError(0); } - - virtual size_t write(uint8_t) = 0; - size_t write(const char *str) { - if (str == NULL) return 0; - return write((const uint8_t *)str, strlen(str)); - } - virtual size_t write(const uint8_t *buffer, size_t size); - size_t write(const char *buffer, size_t size) { - return write((const uint8_t *)buffer, size); - } - - // default to zero, meaning "a single write may block" - // should be overridden by subclasses with buffering - virtual int availableForWrite() { return 0; } - - size_t print(const __FlashStringHelper *); - size_t print(const String &); - size_t print(const char[]); - size_t print(char); - size_t print(unsigned char, int = DEC); - size_t print(int, int = DEC); - size_t print(unsigned int, int = DEC); - size_t print(long, int = DEC); - size_t print(unsigned long, int = DEC); - size_t print(long long, int = DEC); - size_t print(unsigned long long, int = DEC); - size_t print(double, int = 2); - size_t print(const Printable&); - - size_t println(const __FlashStringHelper *); - size_t println(const String &s); - size_t println(const char[]); - size_t println(char); - size_t println(unsigned char, int = DEC); - size_t println(int, int = DEC); - size_t println(unsigned int, int = DEC); - size_t println(long, int = DEC); - size_t println(unsigned long, int = DEC); - size_t println(long long, int = DEC); - size_t println(unsigned long long, int = DEC); - size_t println(double, int = 2); - size_t println(const Printable&); - size_t println(void); - - size_t printf(const char * format, ...); - - size_t printBuffer(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); - size_t printBuffer(char const buffer[], int size, char delim=' ', int byteline = 0) - { - return printBuffer((uint8_t const*) buffer, size, delim, byteline); - } - - size_t printBufferReverse(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); - size_t printBufferReverse(char const buffer[], int size, char delim=' ', int byteline = 0) - { - return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); - } - - virtual void flush() { /* Empty implementation for backward compatibility */ } + private: + int write_error; + size_t printNumber(unsigned long, uint8_t); + size_t printULLNumber(unsigned long long, uint8_t); + size_t printFloat(double, int); + protected: + void setWriteError(int err = 1) + { + write_error = err; + } + public: + Print() : write_error(0) {} + + int getWriteError() + { + return write_error; + } + void clearWriteError() + { + setWriteError(0); + } + + virtual size_t write(uint8_t) = 0; + size_t write(const char *str) + { + if (str == NULL) + return 0; + + return write((const uint8_t *)str, strlen(str)); + } + virtual size_t write(const uint8_t *buffer, size_t size); + size_t write(const char *buffer, size_t size) + { + return write((const uint8_t *)buffer, size); + } + + // default to zero, meaning "a single write may block" + // should be overridden by subclasses with buffering + virtual int availableForWrite() + { + return 0; + } + + size_t print(const __FlashStringHelper *); + size_t print(const String &); + size_t print(const char[]); + size_t print(char); + size_t print(unsigned char, int = DEC); + size_t print(int, int = DEC); + size_t print(unsigned int, int = DEC); + size_t print(long, int = DEC); + size_t print(unsigned long, int = DEC); + size_t print(long long, int = DEC); + size_t print(unsigned long long, int = DEC); + size_t print(double, int = 2); + size_t print(const Printable&); + + size_t println(const __FlashStringHelper *); + size_t println(const String &s); + size_t println(const char[]); + size_t println(char); + size_t println(unsigned char, int = DEC); + size_t println(int, int = DEC); + size_t println(unsigned int, int = DEC); + size_t println(long, int = DEC); + size_t println(unsigned long, int = DEC); + size_t println(long long, int = DEC); + size_t println(unsigned long long, int = DEC); + size_t println(double, int = 2); + size_t println(const Printable&); + size_t println(void); + + size_t printf(const char * format, ...); + + size_t printBuffer(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); + size_t printBuffer(char const buffer[], int size, char delim = ' ', int byteline = 0) + { + return printBuffer((uint8_t const*) buffer, size, delim, byteline); + } + + size_t printBufferReverse(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); + size_t printBufferReverse(char const buffer[], int size, char delim = ' ', int byteline = 0) + { + return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); + } + + virtual void flush() { /* Empty implementation for backward compatibility */ } }; diff --git a/Packages_Patches/Seeeduino/hardware/samd/1.7.9/cores/arduino/Arduino.h b/Packages_Patches/Seeeduino/hardware/samd/1.7.9/cores/arduino/Arduino.h index ca6ec0d5..51db668f 100644 --- a/Packages_Patches/Seeeduino/hardware/samd/1.7.9/cores/arduino/Arduino.h +++ b/Packages_Patches/Seeeduino/hardware/samd/1.7.9/cores/arduino/Arduino.h @@ -44,7 +44,7 @@ typedef uint16_t word; #include "itoa.h" #ifdef __cplusplus -extern "C"{ +extern "C" { #endif // __cplusplus // Include Atmel headers @@ -76,16 +76,16 @@ int __debug_buf(const char* head, char* buf, int len); // The following headers are for C++ only compilation #ifdef __cplusplus - #include "WCharacter.h" - #include "WString.h" - #include "Tone.h" - #include "WMath.h" - #include "HardwareSerial.h" - #include "pulse.h" + #include "WCharacter.h" + #include "WString.h" + #include "Tone.h" + #include "WMath.h" + #include "HardwareSerial.h" + #include "pulse.h" #endif #include "delay.h" #ifdef __cplusplus - #include "Uart.h" + #include "Uart.h" #endif // Include board variant @@ -100,25 +100,25 @@ int __debug_buf(const char* head, char* buf, int len); // undefine stdlib's abs if encountered #ifdef abs -#undef abs + #undef abs #endif // abs // undefine stdlib's abs if encountered #ifdef abs -#undef abs + #undef abs #endif // abs #ifdef __cplusplus - template - auto min(const T& a, const L& b) -> decltype((b < a) ? b : a) - { - return (b < a) ? b : a; - } - - template - auto max(const T& a, const L& b) -> decltype((b < a) ? b : a) - { - return (a < b) ? b : a; - } +template +auto min(const T& a, const L& b) -> decltype((b < a) ? b : a) +{ + return (b < a) ? b : a; +} + +template +auto max(const T& a, const L& b) -> decltype((b < a) ? b : a) +{ + return (a < b) ? b : a; +} #else #ifndef min #define min(a,b) \ @@ -147,8 +147,8 @@ int __debug_buf(const char* head, char* buf, int len); static inline unsigned char __interruptsStatus(void) __attribute__((always_inline, unused)); static inline unsigned char __interruptsStatus(void) { - // See http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0497a/CHDBIBGJ.html - return (__get_PRIMASK() ? 0 : 1); + // See http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0497a/CHDBIBGJ.html + return (__get_PRIMASK() ? 0 : 1); } #define interruptsStatus() __interruptsStatus() #endif @@ -164,18 +164,18 @@ static inline unsigned char __interruptsStatus(void) #define bit(b) (1UL << (b)) #if (ARDUINO_SAMD_VARIANT_COMPLIANCE >= 10606) -// Interrupts -#define digitalPinToInterrupt(P) ( P ) + // Interrupts + #define digitalPinToInterrupt(P) ( P ) #endif // USB #ifdef USE_TINYUSB -#include "Adafruit_TinyUSB_Core.h" + #include "Adafruit_TinyUSB_Core.h" #else -#include "USB/USBDesc.h" -#include "USB/USBCore.h" -#include "USB/USBAPI.h" -#include "USB/USB_host.h" + #include "USB/USBDesc.h" + #include "USB/USBCore.h" + #include "USB/USBAPI.h" + #include "USB/USB_host.h" #endif #endif // Arduino_h diff --git a/Packages_Patches/Seeeduino/hardware/samd/1.7.9/cores/arduino/Print.cpp b/Packages_Patches/Seeeduino/hardware/samd/1.7.9/cores/arduino/Print.cpp index 09d5864c..b47efa1a 100644 --- a/Packages_Patches/Seeeduino/hardware/samd/1.7.9/cores/arduino/Print.cpp +++ b/Packages_Patches/Seeeduino/hardware/samd/1.7.9/cores/arduino/Print.cpp @@ -35,386 +35,432 @@ /* default implementation: may be overridden */ size_t Print::write(const uint8_t *buffer, size_t size) { - size_t n = 0; - while (size--) { - if (write(*buffer++)) n++; - else break; - } - return n; + size_t n = 0; + + while (size--) + { + if (write(*buffer++)) + n++; + else + break; + } + + return n; } size_t Print::print(const __FlashStringHelper *ifsh) { - return print(reinterpret_cast(ifsh)); + return print(reinterpret_cast(ifsh)); } size_t Print::print(const String &s) { - return write(s.c_str(), s.length()); + return write(s.c_str(), s.length()); } size_t Print::print(const char str[]) { - return write(str); + return write(str); } size_t Print::print(char c) { - return write(c); + return write(c); } size_t Print::print(unsigned char b, int base) { - return print((unsigned long) b, base); + return print((unsigned long) b, base); } size_t Print::print(int n, int base) { - return print((long) n, base); + return print((long) n, base); } size_t Print::print(unsigned int n, int base) { - return print((unsigned long) n, base); + return print((unsigned long) n, base); } size_t Print::print(long n, int base) { - if (base == 0) { - return write(n); - } else if (base == 10) { - if (n < 0) { - int t = print('-'); - n = -n; - return printNumber(n, 10) + t; - } - return printNumber(n, 10); - } else { - return printNumber(n, base); - } + if (base == 0) + { + return write(n); + } + else if (base == 10) + { + if (n < 0) + { + int t = print('-'); + n = -n; + return printNumber(n, 10) + t; + } + + return printNumber(n, 10); + } + else + { + return printNumber(n, base); + } } size_t Print::print(unsigned long n, int base) { - if (base == 0) return write(n); - else return printNumber(n, base); + if (base == 0) + return write(n); + else + return printNumber(n, base); } size_t Print::print(long long n, int base) { - if (base == 0) { - return write(n); - } else if (base == 10) { - if (n < 0) { - int t = print('-'); - n = -n; - return printULLNumber(n, 10) + t; - } - return printULLNumber(n, 10); - } else { - return printULLNumber(n, base); - } + if (base == 0) + { + return write(n); + } + else if (base == 10) + { + if (n < 0) + { + int t = print('-'); + n = -n; + return printULLNumber(n, 10) + t; + } + + return printULLNumber(n, 10); + } + else + { + return printULLNumber(n, base); + } } size_t Print::print(unsigned long long n, int base) { - if (base == 0) return write(n); - else return printULLNumber(n, base); + if (base == 0) + return write(n); + else + return printULLNumber(n, base); } size_t Print::print(double n, int digits) { - return printFloat(n, digits); + return printFloat(n, digits); } size_t Print::println(const __FlashStringHelper *ifsh) { - size_t n = print(ifsh); - n += println(); - return n; + size_t n = print(ifsh); + n += println(); + return n; } size_t Print::print(const Printable& x) { - return x.printTo(*this); + return x.printTo(*this); } size_t Print::println(void) { - return write("\r\n"); + return write("\r\n"); } size_t Print::println(const String &s) { - size_t n = print(s); - n += println(); - return n; + size_t n = print(s); + n += println(); + return n; } size_t Print::println(const char c[]) { - size_t n = print(c); - n += println(); - return n; + size_t n = print(c); + n += println(); + return n; } size_t Print::println(char c) { - size_t n = print(c); - n += println(); - return n; + size_t n = print(c); + n += println(); + return n; } size_t Print::println(unsigned char b, int base) { - size_t n = print(b, base); - n += println(); - return n; + size_t n = print(b, base); + n += println(); + return n; } size_t Print::println(int num, int base) { - size_t n = print(num, base); - n += println(); - return n; + size_t n = print(num, base); + n += println(); + return n; } size_t Print::println(unsigned int num, int base) { - size_t n = print(num, base); - n += println(); - return n; + size_t n = print(num, base); + n += println(); + return n; } size_t Print::println(long num, int base) { - size_t n = print(num, base); - n += println(); - return n; + size_t n = print(num, base); + n += println(); + return n; } size_t Print::println(unsigned long num, int base) { - size_t n = print(num, base); - n += println(); - return n; + size_t n = print(num, base); + n += println(); + return n; } size_t Print::println(long long num, int base) { - size_t n = print(num, base); - n += println(); - return n; + size_t n = print(num, base); + n += println(); + return n; } size_t Print::println(unsigned long long num, int base) { - size_t n = print(num, base); - n += println(); - return n; + size_t n = print(num, base); + n += println(); + return n; } size_t Print::println(double num, int digits) { - size_t n = print(num, digits); - n += println(); - return n; + size_t n = print(num, digits); + n += println(); + return n; } size_t Print::println(const Printable& x) { - size_t n = print(x); - n += println(); - return n; + size_t n = print(x); + n += println(); + return n; } size_t Print::printf(const char * format, ...) { - char buf[256]; - int len; + char buf[256]; + int len; - va_list ap; - va_start(ap, format); + va_list ap; + va_start(ap, format); - len = vsnprintf(buf, 256, format, ap); - this->write(buf, len); + len = vsnprintf(buf, 256, format, ap); + this->write(buf, len); - va_end(ap); - return len; + va_end(ap); + return len; } // Private Methods ///////////////////////////////////////////////////////////// size_t Print::printNumber(unsigned long n, uint8_t base) { - char buf[8 * sizeof(long) + 1]; // Assumes 8-bit chars plus zero byte. - char *str = &buf[sizeof(buf) - 1]; + char buf[8 * sizeof(long) + 1]; // Assumes 8-bit chars plus zero byte. + char *str = &buf[sizeof(buf) - 1]; - *str = '\0'; + *str = '\0'; - // prevent crash if called with base == 1 - if (base < 2) base = 10; + // prevent crash if called with base == 1 + if (base < 2) + base = 10; - do { - char c = n % base; - n /= base; + do + { + char c = n % base; + n /= base; - *--str = c < 10 ? c + '0' : c + 'A' - 10; - } while(n); + *--str = c < 10 ? c + '0' : c + 'A' - 10; + } while (n); - return write(str); + return write(str); } // REFERENCE IMPLEMENTATION FOR ULL // size_t Print::printULLNumber(unsigned long long n, uint8_t base) // { - // // if limited to base 10 and 16 the bufsize can be smaller - // char buf[65]; - // char *str = &buf[64]; +// // if limited to base 10 and 16 the bufsize can be smaller +// char buf[65]; +// char *str = &buf[64]; - // *str = '\0'; +// *str = '\0'; - // // prevent crash if called with base == 1 - // if (base < 2) base = 10; +// // prevent crash if called with base == 1 +// if (base < 2) base = 10; - // do { - // unsigned long long t = n / base; - // char c = n - t * base; // faster than c = n%base; - // n = t; - // *--str = c < 10 ? c + '0' : c + 'A' - 10; - // } while(n); +// do { +// unsigned long long t = n / base; +// char c = n - t * base; // faster than c = n%base; +// n = t; +// *--str = c < 10 ? c + '0' : c + 'A' - 10; +// } while(n); - // return write(str); +// return write(str); // } // FAST IMPLEMENTATION FOR ULL size_t Print::printULLNumber(unsigned long long n64, uint8_t base) { - // if limited to base 10 and 16 the bufsize can be 20 - char buf[64]; - uint8_t i = 0; - uint8_t innerLoops = 0; - - // prevent crash if called with base == 1 - if (base < 2) base = 10; - - // process chunks that fit in "16 bit math". - uint16_t top = 0xFFFF / base; - uint16_t th16 = 1; - while (th16 < top) - { - th16 *= base; - innerLoops++; - } - - while (n64 > th16) - { - // 64 bit math part - uint64_t q = n64 / th16; - uint16_t r = n64 - q*th16; - n64 = q; - - // 16 bit math loop to do remainder. (note buffer is filled reverse) - for (uint8_t j=0; j < innerLoops; j++) - { - uint16_t qq = r/base; - buf[i++] = r - qq*base; - r = qq; - } - } - - uint16_t n16 = n64; - while (n16 > 0) - { - uint16_t qq = n16/base; - buf[i++] = n16 - qq*base; - n16 = qq; - } - - size_t bytes = i; - for (; i > 0; i--) - write((char) (buf[i - 1] < 10 ? - '0' + buf[i - 1] : - 'A' + buf[i - 1] - 10)); - - return bytes; + // if limited to base 10 and 16 the bufsize can be 20 + char buf[64]; + uint8_t i = 0; + uint8_t innerLoops = 0; + + // prevent crash if called with base == 1 + if (base < 2) + base = 10; + + // process chunks that fit in "16 bit math". + uint16_t top = 0xFFFF / base; + uint16_t th16 = 1; + + while (th16 < top) + { + th16 *= base; + innerLoops++; + } + + while (n64 > th16) + { + // 64 bit math part + uint64_t q = n64 / th16; + uint16_t r = n64 - q * th16; + n64 = q; + + // 16 bit math loop to do remainder. (note buffer is filled reverse) + for (uint8_t j = 0; j < innerLoops; j++) + { + uint16_t qq = r / base; + buf[i++] = r - qq * base; + r = qq; + } + } + + uint16_t n16 = n64; + + while (n16 > 0) + { + uint16_t qq = n16 / base; + buf[i++] = n16 - qq * base; + n16 = qq; + } + + size_t bytes = i; + + for (; i > 0; i--) + write((char) (buf[i - 1] < 10 ? + '0' + buf[i - 1] : + 'A' + buf[i - 1] - 10)); + + return bytes; } size_t Print::printFloat(double number, int digits) { - if (digits < 0) - digits = 2; + if (digits < 0) + digits = 2; + + size_t n = 0; + + if (isnan(number)) + return print("nan"); - size_t n = 0; + if (isinf(number)) + return print("inf"); - if (isnan(number)) return print("nan"); - if (isinf(number)) return print("inf"); - if (number > 4294967040.0) return print ("ovf"); // constant determined empirically - if (number <-4294967040.0) return print ("ovf"); // constant determined empirically + if (number > 4294967040.0) + return print ("ovf"); // constant determined empirically - // Handle negative numbers - if (number < 0.0) - { - n += print('-'); - number = -number; - } + if (number < -4294967040.0) + return print ("ovf"); // constant determined empirically - // Round correctly so that print(1.999, 2) prints as "2.00" - double rounding = 0.5; - for (uint8_t i=0; i 0) { - n += print("."); - } + number += rounding; - // Extract digits from the remainder one at a time - while (digits-- > 0) - { - remainder *= 10.0; - unsigned int toPrint = (unsigned int)remainder; - n += print(toPrint); - remainder -= toPrint; - } + // Extract the integer part of the number and print it + unsigned long int_part = (unsigned long)number; + double remainder = number - (double)int_part; + n += print(int_part); - return n; + // Print the decimal point, but only if there are digits beyond + if (digits > 0) + { + n += print("."); + } + + // Extract digits from the remainder one at a time + while (digits-- > 0) + { + remainder *= 10.0; + unsigned int toPrint = (unsigned int)remainder; + n += print(toPrint); + remainder -= toPrint; + } + + return n; } size_t Print::printBuffer(uint8_t const buffer[], int len, char delim, int byteline) { - if (buffer == NULL || len == 0) return 0; + if (buffer == NULL || len == 0) + return 0; - for(int i=0; iprintf("%02X", buffer[i]); - } + if ( byteline && (i % byteline == 0) ) + println(); - return (len*3 - 1); + this->printf("%02X", buffer[i]); + } + + return (len * 3 - 1); } size_t Print::printBufferReverse(uint8_t const buffer[], int len, char delim, int byteline) { - if (buffer == NULL || len == 0) return 0; + if (buffer == NULL || len == 0) + return 0; + + for (int i = 0; i < len; i++) + { + if (i != 0) + print(delim); - for(int i=0; iprintf("%02X", buffer[len-1-i]); - } + this->printf("%02X", buffer[len - 1 - i]); + } - return (len*3 - 1); + return (len * 3 - 1); } diff --git a/Packages_Patches/Seeeduino/hardware/samd/1.7.9/cores/arduino/Print.h b/Packages_Patches/Seeeduino/hardware/samd/1.7.9/cores/arduino/Print.h index 48353c44..810a7704 100644 --- a/Packages_Patches/Seeeduino/hardware/samd/1.7.9/cores/arduino/Print.h +++ b/Packages_Patches/Seeeduino/hardware/samd/1.7.9/cores/arduino/Print.h @@ -20,7 +20,6 @@ #include #include // for size_t -#include // for printf #include "WString.h" #include "Printable.h" @@ -32,77 +31,93 @@ class Print { - private: - int write_error; - size_t printNumber(unsigned long, uint8_t); - size_t printULLNumber(unsigned long long, uint8_t); - size_t printFloat(double, int); - protected: - void setWriteError(int err = 1) { write_error = err; } - public: - Print() : write_error(0) {} - - int getWriteError() { return write_error; } - void clearWriteError() { setWriteError(0); } - - virtual size_t write(uint8_t) = 0; - size_t write(const char *str) { - if (str == NULL) return 0; - return write((const uint8_t *)str, strlen(str)); - } - virtual size_t write(const uint8_t *buffer, size_t size); - size_t write(const char *buffer, size_t size) { - return write((const uint8_t *)buffer, size); - } - - // default to zero, meaning "a single write may block" - // should be overridden by subclasses with buffering - virtual int availableForWrite() { return 0; } - - size_t print(const __FlashStringHelper *); - size_t print(const String &); - size_t print(const char[]); - size_t print(char); - size_t print(unsigned char, int = DEC); - size_t print(int, int = DEC); - size_t print(unsigned int, int = DEC); - size_t print(long, int = DEC); - size_t print(unsigned long, int = DEC); - size_t print(long long, int = DEC); - size_t print(unsigned long long, int = DEC); - size_t print(double, int = 2); - size_t print(const Printable&); - - size_t println(const __FlashStringHelper *); - size_t println(const String &s); - size_t println(const char[]); - size_t println(char); - size_t println(unsigned char, int = DEC); - size_t println(int, int = DEC); - size_t println(unsigned int, int = DEC); - size_t println(long, int = DEC); - size_t println(unsigned long, int = DEC); - size_t println(long long, int = DEC); - size_t println(unsigned long long, int = DEC); - size_t println(double, int = 2); - size_t println(const Printable&); - size_t println(void); - - size_t printf(const char * format, ...); - - size_t printBuffer(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); - size_t printBuffer(char const buffer[], int size, char delim=' ', int byteline = 0) - { - return printBuffer((uint8_t const*) buffer, size, delim, byteline); - } - - size_t printBufferReverse(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); - size_t printBufferReverse(char const buffer[], int size, char delim=' ', int byteline = 0) - { - return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); - } - - virtual void flush() { /* Empty implementation for backward compatibility */ } + private: + int write_error; + size_t printNumber(unsigned long, uint8_t); + size_t printULLNumber(unsigned long long, uint8_t); + size_t printFloat(double, int); + protected: + void setWriteError(int err = 1) + { + write_error = err; + } + public: + Print() : write_error(0) {} + + int getWriteError() + { + return write_error; + } + void clearWriteError() + { + setWriteError(0); + } + + virtual size_t write(uint8_t) = 0; + size_t write(const char *str) + { + if (str == NULL) + return 0; + + return write((const uint8_t *)str, strlen(str)); + } + virtual size_t write(const uint8_t *buffer, size_t size); + size_t write(const char *buffer, size_t size) + { + return write((const uint8_t *)buffer, size); + } + + // default to zero, meaning "a single write may block" + // should be overridden by subclasses with buffering + virtual int availableForWrite() + { + return 0; + } + + size_t print(const __FlashStringHelper *); + size_t print(const String &); + size_t print(const char[]); + size_t print(char); + size_t print(unsigned char, int = DEC); + size_t print(int, int = DEC); + size_t print(unsigned int, int = DEC); + size_t print(long, int = DEC); + size_t print(unsigned long, int = DEC); + size_t print(long long, int = DEC); + size_t print(unsigned long long, int = DEC); + size_t print(double, int = 2); + size_t print(const Printable&); + + size_t println(const __FlashStringHelper *); + size_t println(const String &s); + size_t println(const char[]); + size_t println(char); + size_t println(unsigned char, int = DEC); + size_t println(int, int = DEC); + size_t println(unsigned int, int = DEC); + size_t println(long, int = DEC); + size_t println(unsigned long, int = DEC); + size_t println(long long, int = DEC); + size_t println(unsigned long long, int = DEC); + size_t println(double, int = 2); + size_t println(const Printable&); + size_t println(void); + + size_t printf(const char * format, ...); + + size_t printBuffer(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); + size_t printBuffer(char const buffer[], int size, char delim = ' ', int byteline = 0) + { + return printBuffer((uint8_t const*) buffer, size, delim, byteline); + } + + size_t printBufferReverse(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); + size_t printBufferReverse(char const buffer[], int size, char delim = ' ', int byteline = 0) + { + return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); + } + + virtual void flush() { /* Empty implementation for backward compatibility */ } }; diff --git a/Packages_Patches/Seeeduino/hardware/samd/1.8.1/cores/arduino/Arduino.h b/Packages_Patches/Seeeduino/hardware/samd/1.8.1/cores/arduino/Arduino.h index ca6ec0d5..51db668f 100644 --- a/Packages_Patches/Seeeduino/hardware/samd/1.8.1/cores/arduino/Arduino.h +++ b/Packages_Patches/Seeeduino/hardware/samd/1.8.1/cores/arduino/Arduino.h @@ -44,7 +44,7 @@ typedef uint16_t word; #include "itoa.h" #ifdef __cplusplus -extern "C"{ +extern "C" { #endif // __cplusplus // Include Atmel headers @@ -76,16 +76,16 @@ int __debug_buf(const char* head, char* buf, int len); // The following headers are for C++ only compilation #ifdef __cplusplus - #include "WCharacter.h" - #include "WString.h" - #include "Tone.h" - #include "WMath.h" - #include "HardwareSerial.h" - #include "pulse.h" + #include "WCharacter.h" + #include "WString.h" + #include "Tone.h" + #include "WMath.h" + #include "HardwareSerial.h" + #include "pulse.h" #endif #include "delay.h" #ifdef __cplusplus - #include "Uart.h" + #include "Uart.h" #endif // Include board variant @@ -100,25 +100,25 @@ int __debug_buf(const char* head, char* buf, int len); // undefine stdlib's abs if encountered #ifdef abs -#undef abs + #undef abs #endif // abs // undefine stdlib's abs if encountered #ifdef abs -#undef abs + #undef abs #endif // abs #ifdef __cplusplus - template - auto min(const T& a, const L& b) -> decltype((b < a) ? b : a) - { - return (b < a) ? b : a; - } - - template - auto max(const T& a, const L& b) -> decltype((b < a) ? b : a) - { - return (a < b) ? b : a; - } +template +auto min(const T& a, const L& b) -> decltype((b < a) ? b : a) +{ + return (b < a) ? b : a; +} + +template +auto max(const T& a, const L& b) -> decltype((b < a) ? b : a) +{ + return (a < b) ? b : a; +} #else #ifndef min #define min(a,b) \ @@ -147,8 +147,8 @@ int __debug_buf(const char* head, char* buf, int len); static inline unsigned char __interruptsStatus(void) __attribute__((always_inline, unused)); static inline unsigned char __interruptsStatus(void) { - // See http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0497a/CHDBIBGJ.html - return (__get_PRIMASK() ? 0 : 1); + // See http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0497a/CHDBIBGJ.html + return (__get_PRIMASK() ? 0 : 1); } #define interruptsStatus() __interruptsStatus() #endif @@ -164,18 +164,18 @@ static inline unsigned char __interruptsStatus(void) #define bit(b) (1UL << (b)) #if (ARDUINO_SAMD_VARIANT_COMPLIANCE >= 10606) -// Interrupts -#define digitalPinToInterrupt(P) ( P ) + // Interrupts + #define digitalPinToInterrupt(P) ( P ) #endif // USB #ifdef USE_TINYUSB -#include "Adafruit_TinyUSB_Core.h" + #include "Adafruit_TinyUSB_Core.h" #else -#include "USB/USBDesc.h" -#include "USB/USBCore.h" -#include "USB/USBAPI.h" -#include "USB/USB_host.h" + #include "USB/USBDesc.h" + #include "USB/USBCore.h" + #include "USB/USBAPI.h" + #include "USB/USB_host.h" #endif #endif // Arduino_h diff --git a/Packages_Patches/Seeeduino/hardware/samd/1.8.1/cores/arduino/Print.cpp b/Packages_Patches/Seeeduino/hardware/samd/1.8.1/cores/arduino/Print.cpp index 09d5864c..b47efa1a 100644 --- a/Packages_Patches/Seeeduino/hardware/samd/1.8.1/cores/arduino/Print.cpp +++ b/Packages_Patches/Seeeduino/hardware/samd/1.8.1/cores/arduino/Print.cpp @@ -35,386 +35,432 @@ /* default implementation: may be overridden */ size_t Print::write(const uint8_t *buffer, size_t size) { - size_t n = 0; - while (size--) { - if (write(*buffer++)) n++; - else break; - } - return n; + size_t n = 0; + + while (size--) + { + if (write(*buffer++)) + n++; + else + break; + } + + return n; } size_t Print::print(const __FlashStringHelper *ifsh) { - return print(reinterpret_cast(ifsh)); + return print(reinterpret_cast(ifsh)); } size_t Print::print(const String &s) { - return write(s.c_str(), s.length()); + return write(s.c_str(), s.length()); } size_t Print::print(const char str[]) { - return write(str); + return write(str); } size_t Print::print(char c) { - return write(c); + return write(c); } size_t Print::print(unsigned char b, int base) { - return print((unsigned long) b, base); + return print((unsigned long) b, base); } size_t Print::print(int n, int base) { - return print((long) n, base); + return print((long) n, base); } size_t Print::print(unsigned int n, int base) { - return print((unsigned long) n, base); + return print((unsigned long) n, base); } size_t Print::print(long n, int base) { - if (base == 0) { - return write(n); - } else if (base == 10) { - if (n < 0) { - int t = print('-'); - n = -n; - return printNumber(n, 10) + t; - } - return printNumber(n, 10); - } else { - return printNumber(n, base); - } + if (base == 0) + { + return write(n); + } + else if (base == 10) + { + if (n < 0) + { + int t = print('-'); + n = -n; + return printNumber(n, 10) + t; + } + + return printNumber(n, 10); + } + else + { + return printNumber(n, base); + } } size_t Print::print(unsigned long n, int base) { - if (base == 0) return write(n); - else return printNumber(n, base); + if (base == 0) + return write(n); + else + return printNumber(n, base); } size_t Print::print(long long n, int base) { - if (base == 0) { - return write(n); - } else if (base == 10) { - if (n < 0) { - int t = print('-'); - n = -n; - return printULLNumber(n, 10) + t; - } - return printULLNumber(n, 10); - } else { - return printULLNumber(n, base); - } + if (base == 0) + { + return write(n); + } + else if (base == 10) + { + if (n < 0) + { + int t = print('-'); + n = -n; + return printULLNumber(n, 10) + t; + } + + return printULLNumber(n, 10); + } + else + { + return printULLNumber(n, base); + } } size_t Print::print(unsigned long long n, int base) { - if (base == 0) return write(n); - else return printULLNumber(n, base); + if (base == 0) + return write(n); + else + return printULLNumber(n, base); } size_t Print::print(double n, int digits) { - return printFloat(n, digits); + return printFloat(n, digits); } size_t Print::println(const __FlashStringHelper *ifsh) { - size_t n = print(ifsh); - n += println(); - return n; + size_t n = print(ifsh); + n += println(); + return n; } size_t Print::print(const Printable& x) { - return x.printTo(*this); + return x.printTo(*this); } size_t Print::println(void) { - return write("\r\n"); + return write("\r\n"); } size_t Print::println(const String &s) { - size_t n = print(s); - n += println(); - return n; + size_t n = print(s); + n += println(); + return n; } size_t Print::println(const char c[]) { - size_t n = print(c); - n += println(); - return n; + size_t n = print(c); + n += println(); + return n; } size_t Print::println(char c) { - size_t n = print(c); - n += println(); - return n; + size_t n = print(c); + n += println(); + return n; } size_t Print::println(unsigned char b, int base) { - size_t n = print(b, base); - n += println(); - return n; + size_t n = print(b, base); + n += println(); + return n; } size_t Print::println(int num, int base) { - size_t n = print(num, base); - n += println(); - return n; + size_t n = print(num, base); + n += println(); + return n; } size_t Print::println(unsigned int num, int base) { - size_t n = print(num, base); - n += println(); - return n; + size_t n = print(num, base); + n += println(); + return n; } size_t Print::println(long num, int base) { - size_t n = print(num, base); - n += println(); - return n; + size_t n = print(num, base); + n += println(); + return n; } size_t Print::println(unsigned long num, int base) { - size_t n = print(num, base); - n += println(); - return n; + size_t n = print(num, base); + n += println(); + return n; } size_t Print::println(long long num, int base) { - size_t n = print(num, base); - n += println(); - return n; + size_t n = print(num, base); + n += println(); + return n; } size_t Print::println(unsigned long long num, int base) { - size_t n = print(num, base); - n += println(); - return n; + size_t n = print(num, base); + n += println(); + return n; } size_t Print::println(double num, int digits) { - size_t n = print(num, digits); - n += println(); - return n; + size_t n = print(num, digits); + n += println(); + return n; } size_t Print::println(const Printable& x) { - size_t n = print(x); - n += println(); - return n; + size_t n = print(x); + n += println(); + return n; } size_t Print::printf(const char * format, ...) { - char buf[256]; - int len; + char buf[256]; + int len; - va_list ap; - va_start(ap, format); + va_list ap; + va_start(ap, format); - len = vsnprintf(buf, 256, format, ap); - this->write(buf, len); + len = vsnprintf(buf, 256, format, ap); + this->write(buf, len); - va_end(ap); - return len; + va_end(ap); + return len; } // Private Methods ///////////////////////////////////////////////////////////// size_t Print::printNumber(unsigned long n, uint8_t base) { - char buf[8 * sizeof(long) + 1]; // Assumes 8-bit chars plus zero byte. - char *str = &buf[sizeof(buf) - 1]; + char buf[8 * sizeof(long) + 1]; // Assumes 8-bit chars plus zero byte. + char *str = &buf[sizeof(buf) - 1]; - *str = '\0'; + *str = '\0'; - // prevent crash if called with base == 1 - if (base < 2) base = 10; + // prevent crash if called with base == 1 + if (base < 2) + base = 10; - do { - char c = n % base; - n /= base; + do + { + char c = n % base; + n /= base; - *--str = c < 10 ? c + '0' : c + 'A' - 10; - } while(n); + *--str = c < 10 ? c + '0' : c + 'A' - 10; + } while (n); - return write(str); + return write(str); } // REFERENCE IMPLEMENTATION FOR ULL // size_t Print::printULLNumber(unsigned long long n, uint8_t base) // { - // // if limited to base 10 and 16 the bufsize can be smaller - // char buf[65]; - // char *str = &buf[64]; +// // if limited to base 10 and 16 the bufsize can be smaller +// char buf[65]; +// char *str = &buf[64]; - // *str = '\0'; +// *str = '\0'; - // // prevent crash if called with base == 1 - // if (base < 2) base = 10; +// // prevent crash if called with base == 1 +// if (base < 2) base = 10; - // do { - // unsigned long long t = n / base; - // char c = n - t * base; // faster than c = n%base; - // n = t; - // *--str = c < 10 ? c + '0' : c + 'A' - 10; - // } while(n); +// do { +// unsigned long long t = n / base; +// char c = n - t * base; // faster than c = n%base; +// n = t; +// *--str = c < 10 ? c + '0' : c + 'A' - 10; +// } while(n); - // return write(str); +// return write(str); // } // FAST IMPLEMENTATION FOR ULL size_t Print::printULLNumber(unsigned long long n64, uint8_t base) { - // if limited to base 10 and 16 the bufsize can be 20 - char buf[64]; - uint8_t i = 0; - uint8_t innerLoops = 0; - - // prevent crash if called with base == 1 - if (base < 2) base = 10; - - // process chunks that fit in "16 bit math". - uint16_t top = 0xFFFF / base; - uint16_t th16 = 1; - while (th16 < top) - { - th16 *= base; - innerLoops++; - } - - while (n64 > th16) - { - // 64 bit math part - uint64_t q = n64 / th16; - uint16_t r = n64 - q*th16; - n64 = q; - - // 16 bit math loop to do remainder. (note buffer is filled reverse) - for (uint8_t j=0; j < innerLoops; j++) - { - uint16_t qq = r/base; - buf[i++] = r - qq*base; - r = qq; - } - } - - uint16_t n16 = n64; - while (n16 > 0) - { - uint16_t qq = n16/base; - buf[i++] = n16 - qq*base; - n16 = qq; - } - - size_t bytes = i; - for (; i > 0; i--) - write((char) (buf[i - 1] < 10 ? - '0' + buf[i - 1] : - 'A' + buf[i - 1] - 10)); - - return bytes; + // if limited to base 10 and 16 the bufsize can be 20 + char buf[64]; + uint8_t i = 0; + uint8_t innerLoops = 0; + + // prevent crash if called with base == 1 + if (base < 2) + base = 10; + + // process chunks that fit in "16 bit math". + uint16_t top = 0xFFFF / base; + uint16_t th16 = 1; + + while (th16 < top) + { + th16 *= base; + innerLoops++; + } + + while (n64 > th16) + { + // 64 bit math part + uint64_t q = n64 / th16; + uint16_t r = n64 - q * th16; + n64 = q; + + // 16 bit math loop to do remainder. (note buffer is filled reverse) + for (uint8_t j = 0; j < innerLoops; j++) + { + uint16_t qq = r / base; + buf[i++] = r - qq * base; + r = qq; + } + } + + uint16_t n16 = n64; + + while (n16 > 0) + { + uint16_t qq = n16 / base; + buf[i++] = n16 - qq * base; + n16 = qq; + } + + size_t bytes = i; + + for (; i > 0; i--) + write((char) (buf[i - 1] < 10 ? + '0' + buf[i - 1] : + 'A' + buf[i - 1] - 10)); + + return bytes; } size_t Print::printFloat(double number, int digits) { - if (digits < 0) - digits = 2; + if (digits < 0) + digits = 2; + + size_t n = 0; + + if (isnan(number)) + return print("nan"); - size_t n = 0; + if (isinf(number)) + return print("inf"); - if (isnan(number)) return print("nan"); - if (isinf(number)) return print("inf"); - if (number > 4294967040.0) return print ("ovf"); // constant determined empirically - if (number <-4294967040.0) return print ("ovf"); // constant determined empirically + if (number > 4294967040.0) + return print ("ovf"); // constant determined empirically - // Handle negative numbers - if (number < 0.0) - { - n += print('-'); - number = -number; - } + if (number < -4294967040.0) + return print ("ovf"); // constant determined empirically - // Round correctly so that print(1.999, 2) prints as "2.00" - double rounding = 0.5; - for (uint8_t i=0; i 0) { - n += print("."); - } + number += rounding; - // Extract digits from the remainder one at a time - while (digits-- > 0) - { - remainder *= 10.0; - unsigned int toPrint = (unsigned int)remainder; - n += print(toPrint); - remainder -= toPrint; - } + // Extract the integer part of the number and print it + unsigned long int_part = (unsigned long)number; + double remainder = number - (double)int_part; + n += print(int_part); - return n; + // Print the decimal point, but only if there are digits beyond + if (digits > 0) + { + n += print("."); + } + + // Extract digits from the remainder one at a time + while (digits-- > 0) + { + remainder *= 10.0; + unsigned int toPrint = (unsigned int)remainder; + n += print(toPrint); + remainder -= toPrint; + } + + return n; } size_t Print::printBuffer(uint8_t const buffer[], int len, char delim, int byteline) { - if (buffer == NULL || len == 0) return 0; + if (buffer == NULL || len == 0) + return 0; - for(int i=0; iprintf("%02X", buffer[i]); - } + if ( byteline && (i % byteline == 0) ) + println(); - return (len*3 - 1); + this->printf("%02X", buffer[i]); + } + + return (len * 3 - 1); } size_t Print::printBufferReverse(uint8_t const buffer[], int len, char delim, int byteline) { - if (buffer == NULL || len == 0) return 0; + if (buffer == NULL || len == 0) + return 0; + + for (int i = 0; i < len; i++) + { + if (i != 0) + print(delim); - for(int i=0; iprintf("%02X", buffer[len-1-i]); - } + this->printf("%02X", buffer[len - 1 - i]); + } - return (len*3 - 1); + return (len * 3 - 1); } diff --git a/Packages_Patches/Seeeduino/hardware/samd/1.8.1/cores/arduino/Print.h b/Packages_Patches/Seeeduino/hardware/samd/1.8.1/cores/arduino/Print.h index 48353c44..a465eddb 100644 --- a/Packages_Patches/Seeeduino/hardware/samd/1.8.1/cores/arduino/Print.h +++ b/Packages_Patches/Seeeduino/hardware/samd/1.8.1/cores/arduino/Print.h @@ -32,77 +32,93 @@ class Print { - private: - int write_error; - size_t printNumber(unsigned long, uint8_t); - size_t printULLNumber(unsigned long long, uint8_t); - size_t printFloat(double, int); - protected: - void setWriteError(int err = 1) { write_error = err; } - public: - Print() : write_error(0) {} - - int getWriteError() { return write_error; } - void clearWriteError() { setWriteError(0); } - - virtual size_t write(uint8_t) = 0; - size_t write(const char *str) { - if (str == NULL) return 0; - return write((const uint8_t *)str, strlen(str)); - } - virtual size_t write(const uint8_t *buffer, size_t size); - size_t write(const char *buffer, size_t size) { - return write((const uint8_t *)buffer, size); - } - - // default to zero, meaning "a single write may block" - // should be overridden by subclasses with buffering - virtual int availableForWrite() { return 0; } - - size_t print(const __FlashStringHelper *); - size_t print(const String &); - size_t print(const char[]); - size_t print(char); - size_t print(unsigned char, int = DEC); - size_t print(int, int = DEC); - size_t print(unsigned int, int = DEC); - size_t print(long, int = DEC); - size_t print(unsigned long, int = DEC); - size_t print(long long, int = DEC); - size_t print(unsigned long long, int = DEC); - size_t print(double, int = 2); - size_t print(const Printable&); - - size_t println(const __FlashStringHelper *); - size_t println(const String &s); - size_t println(const char[]); - size_t println(char); - size_t println(unsigned char, int = DEC); - size_t println(int, int = DEC); - size_t println(unsigned int, int = DEC); - size_t println(long, int = DEC); - size_t println(unsigned long, int = DEC); - size_t println(long long, int = DEC); - size_t println(unsigned long long, int = DEC); - size_t println(double, int = 2); - size_t println(const Printable&); - size_t println(void); - - size_t printf(const char * format, ...); - - size_t printBuffer(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); - size_t printBuffer(char const buffer[], int size, char delim=' ', int byteline = 0) - { - return printBuffer((uint8_t const*) buffer, size, delim, byteline); - } - - size_t printBufferReverse(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); - size_t printBufferReverse(char const buffer[], int size, char delim=' ', int byteline = 0) - { - return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); - } - - virtual void flush() { /* Empty implementation for backward compatibility */ } + private: + int write_error; + size_t printNumber(unsigned long, uint8_t); + size_t printULLNumber(unsigned long long, uint8_t); + size_t printFloat(double, int); + protected: + void setWriteError(int err = 1) + { + write_error = err; + } + public: + Print() : write_error(0) {} + + int getWriteError() + { + return write_error; + } + void clearWriteError() + { + setWriteError(0); + } + + virtual size_t write(uint8_t) = 0; + size_t write(const char *str) + { + if (str == NULL) + return 0; + + return write((const uint8_t *)str, strlen(str)); + } + virtual size_t write(const uint8_t *buffer, size_t size); + size_t write(const char *buffer, size_t size) + { + return write((const uint8_t *)buffer, size); + } + + // default to zero, meaning "a single write may block" + // should be overridden by subclasses with buffering + virtual int availableForWrite() + { + return 0; + } + + size_t print(const __FlashStringHelper *); + size_t print(const String &); + size_t print(const char[]); + size_t print(char); + size_t print(unsigned char, int = DEC); + size_t print(int, int = DEC); + size_t print(unsigned int, int = DEC); + size_t print(long, int = DEC); + size_t print(unsigned long, int = DEC); + size_t print(long long, int = DEC); + size_t print(unsigned long long, int = DEC); + size_t print(double, int = 2); + size_t print(const Printable&); + + size_t println(const __FlashStringHelper *); + size_t println(const String &s); + size_t println(const char[]); + size_t println(char); + size_t println(unsigned char, int = DEC); + size_t println(int, int = DEC); + size_t println(unsigned int, int = DEC); + size_t println(long, int = DEC); + size_t println(unsigned long, int = DEC); + size_t println(long long, int = DEC); + size_t println(unsigned long long, int = DEC); + size_t println(double, int = 2); + size_t println(const Printable&); + size_t println(void); + + size_t printf(const char * format, ...); + + size_t printBuffer(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); + size_t printBuffer(char const buffer[], int size, char delim = ' ', int byteline = 0) + { + return printBuffer((uint8_t const*) buffer, size, delim, byteline); + } + + size_t printBufferReverse(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); + size_t printBufferReverse(char const buffer[], int size, char delim = ' ', int byteline = 0) + { + return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); + } + + virtual void flush() { /* Empty implementation for backward compatibility */ } }; diff --git a/Packages_Patches/Seeeduino/hardware/samd/1.8.2/cores/arduino/Arduino.h b/Packages_Patches/Seeeduino/hardware/samd/1.8.2/cores/arduino/Arduino.h index ca6ec0d5..51db668f 100644 --- a/Packages_Patches/Seeeduino/hardware/samd/1.8.2/cores/arduino/Arduino.h +++ b/Packages_Patches/Seeeduino/hardware/samd/1.8.2/cores/arduino/Arduino.h @@ -44,7 +44,7 @@ typedef uint16_t word; #include "itoa.h" #ifdef __cplusplus -extern "C"{ +extern "C" { #endif // __cplusplus // Include Atmel headers @@ -76,16 +76,16 @@ int __debug_buf(const char* head, char* buf, int len); // The following headers are for C++ only compilation #ifdef __cplusplus - #include "WCharacter.h" - #include "WString.h" - #include "Tone.h" - #include "WMath.h" - #include "HardwareSerial.h" - #include "pulse.h" + #include "WCharacter.h" + #include "WString.h" + #include "Tone.h" + #include "WMath.h" + #include "HardwareSerial.h" + #include "pulse.h" #endif #include "delay.h" #ifdef __cplusplus - #include "Uart.h" + #include "Uart.h" #endif // Include board variant @@ -100,25 +100,25 @@ int __debug_buf(const char* head, char* buf, int len); // undefine stdlib's abs if encountered #ifdef abs -#undef abs + #undef abs #endif // abs // undefine stdlib's abs if encountered #ifdef abs -#undef abs + #undef abs #endif // abs #ifdef __cplusplus - template - auto min(const T& a, const L& b) -> decltype((b < a) ? b : a) - { - return (b < a) ? b : a; - } - - template - auto max(const T& a, const L& b) -> decltype((b < a) ? b : a) - { - return (a < b) ? b : a; - } +template +auto min(const T& a, const L& b) -> decltype((b < a) ? b : a) +{ + return (b < a) ? b : a; +} + +template +auto max(const T& a, const L& b) -> decltype((b < a) ? b : a) +{ + return (a < b) ? b : a; +} #else #ifndef min #define min(a,b) \ @@ -147,8 +147,8 @@ int __debug_buf(const char* head, char* buf, int len); static inline unsigned char __interruptsStatus(void) __attribute__((always_inline, unused)); static inline unsigned char __interruptsStatus(void) { - // See http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0497a/CHDBIBGJ.html - return (__get_PRIMASK() ? 0 : 1); + // See http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0497a/CHDBIBGJ.html + return (__get_PRIMASK() ? 0 : 1); } #define interruptsStatus() __interruptsStatus() #endif @@ -164,18 +164,18 @@ static inline unsigned char __interruptsStatus(void) #define bit(b) (1UL << (b)) #if (ARDUINO_SAMD_VARIANT_COMPLIANCE >= 10606) -// Interrupts -#define digitalPinToInterrupt(P) ( P ) + // Interrupts + #define digitalPinToInterrupt(P) ( P ) #endif // USB #ifdef USE_TINYUSB -#include "Adafruit_TinyUSB_Core.h" + #include "Adafruit_TinyUSB_Core.h" #else -#include "USB/USBDesc.h" -#include "USB/USBCore.h" -#include "USB/USBAPI.h" -#include "USB/USB_host.h" + #include "USB/USBDesc.h" + #include "USB/USBCore.h" + #include "USB/USBAPI.h" + #include "USB/USB_host.h" #endif #endif // Arduino_h diff --git a/Packages_Patches/Seeeduino/hardware/samd/1.8.2/cores/arduino/Print.cpp b/Packages_Patches/Seeeduino/hardware/samd/1.8.2/cores/arduino/Print.cpp index 09d5864c..b47efa1a 100644 --- a/Packages_Patches/Seeeduino/hardware/samd/1.8.2/cores/arduino/Print.cpp +++ b/Packages_Patches/Seeeduino/hardware/samd/1.8.2/cores/arduino/Print.cpp @@ -35,386 +35,432 @@ /* default implementation: may be overridden */ size_t Print::write(const uint8_t *buffer, size_t size) { - size_t n = 0; - while (size--) { - if (write(*buffer++)) n++; - else break; - } - return n; + size_t n = 0; + + while (size--) + { + if (write(*buffer++)) + n++; + else + break; + } + + return n; } size_t Print::print(const __FlashStringHelper *ifsh) { - return print(reinterpret_cast(ifsh)); + return print(reinterpret_cast(ifsh)); } size_t Print::print(const String &s) { - return write(s.c_str(), s.length()); + return write(s.c_str(), s.length()); } size_t Print::print(const char str[]) { - return write(str); + return write(str); } size_t Print::print(char c) { - return write(c); + return write(c); } size_t Print::print(unsigned char b, int base) { - return print((unsigned long) b, base); + return print((unsigned long) b, base); } size_t Print::print(int n, int base) { - return print((long) n, base); + return print((long) n, base); } size_t Print::print(unsigned int n, int base) { - return print((unsigned long) n, base); + return print((unsigned long) n, base); } size_t Print::print(long n, int base) { - if (base == 0) { - return write(n); - } else if (base == 10) { - if (n < 0) { - int t = print('-'); - n = -n; - return printNumber(n, 10) + t; - } - return printNumber(n, 10); - } else { - return printNumber(n, base); - } + if (base == 0) + { + return write(n); + } + else if (base == 10) + { + if (n < 0) + { + int t = print('-'); + n = -n; + return printNumber(n, 10) + t; + } + + return printNumber(n, 10); + } + else + { + return printNumber(n, base); + } } size_t Print::print(unsigned long n, int base) { - if (base == 0) return write(n); - else return printNumber(n, base); + if (base == 0) + return write(n); + else + return printNumber(n, base); } size_t Print::print(long long n, int base) { - if (base == 0) { - return write(n); - } else if (base == 10) { - if (n < 0) { - int t = print('-'); - n = -n; - return printULLNumber(n, 10) + t; - } - return printULLNumber(n, 10); - } else { - return printULLNumber(n, base); - } + if (base == 0) + { + return write(n); + } + else if (base == 10) + { + if (n < 0) + { + int t = print('-'); + n = -n; + return printULLNumber(n, 10) + t; + } + + return printULLNumber(n, 10); + } + else + { + return printULLNumber(n, base); + } } size_t Print::print(unsigned long long n, int base) { - if (base == 0) return write(n); - else return printULLNumber(n, base); + if (base == 0) + return write(n); + else + return printULLNumber(n, base); } size_t Print::print(double n, int digits) { - return printFloat(n, digits); + return printFloat(n, digits); } size_t Print::println(const __FlashStringHelper *ifsh) { - size_t n = print(ifsh); - n += println(); - return n; + size_t n = print(ifsh); + n += println(); + return n; } size_t Print::print(const Printable& x) { - return x.printTo(*this); + return x.printTo(*this); } size_t Print::println(void) { - return write("\r\n"); + return write("\r\n"); } size_t Print::println(const String &s) { - size_t n = print(s); - n += println(); - return n; + size_t n = print(s); + n += println(); + return n; } size_t Print::println(const char c[]) { - size_t n = print(c); - n += println(); - return n; + size_t n = print(c); + n += println(); + return n; } size_t Print::println(char c) { - size_t n = print(c); - n += println(); - return n; + size_t n = print(c); + n += println(); + return n; } size_t Print::println(unsigned char b, int base) { - size_t n = print(b, base); - n += println(); - return n; + size_t n = print(b, base); + n += println(); + return n; } size_t Print::println(int num, int base) { - size_t n = print(num, base); - n += println(); - return n; + size_t n = print(num, base); + n += println(); + return n; } size_t Print::println(unsigned int num, int base) { - size_t n = print(num, base); - n += println(); - return n; + size_t n = print(num, base); + n += println(); + return n; } size_t Print::println(long num, int base) { - size_t n = print(num, base); - n += println(); - return n; + size_t n = print(num, base); + n += println(); + return n; } size_t Print::println(unsigned long num, int base) { - size_t n = print(num, base); - n += println(); - return n; + size_t n = print(num, base); + n += println(); + return n; } size_t Print::println(long long num, int base) { - size_t n = print(num, base); - n += println(); - return n; + size_t n = print(num, base); + n += println(); + return n; } size_t Print::println(unsigned long long num, int base) { - size_t n = print(num, base); - n += println(); - return n; + size_t n = print(num, base); + n += println(); + return n; } size_t Print::println(double num, int digits) { - size_t n = print(num, digits); - n += println(); - return n; + size_t n = print(num, digits); + n += println(); + return n; } size_t Print::println(const Printable& x) { - size_t n = print(x); - n += println(); - return n; + size_t n = print(x); + n += println(); + return n; } size_t Print::printf(const char * format, ...) { - char buf[256]; - int len; + char buf[256]; + int len; - va_list ap; - va_start(ap, format); + va_list ap; + va_start(ap, format); - len = vsnprintf(buf, 256, format, ap); - this->write(buf, len); + len = vsnprintf(buf, 256, format, ap); + this->write(buf, len); - va_end(ap); - return len; + va_end(ap); + return len; } // Private Methods ///////////////////////////////////////////////////////////// size_t Print::printNumber(unsigned long n, uint8_t base) { - char buf[8 * sizeof(long) + 1]; // Assumes 8-bit chars plus zero byte. - char *str = &buf[sizeof(buf) - 1]; + char buf[8 * sizeof(long) + 1]; // Assumes 8-bit chars plus zero byte. + char *str = &buf[sizeof(buf) - 1]; - *str = '\0'; + *str = '\0'; - // prevent crash if called with base == 1 - if (base < 2) base = 10; + // prevent crash if called with base == 1 + if (base < 2) + base = 10; - do { - char c = n % base; - n /= base; + do + { + char c = n % base; + n /= base; - *--str = c < 10 ? c + '0' : c + 'A' - 10; - } while(n); + *--str = c < 10 ? c + '0' : c + 'A' - 10; + } while (n); - return write(str); + return write(str); } // REFERENCE IMPLEMENTATION FOR ULL // size_t Print::printULLNumber(unsigned long long n, uint8_t base) // { - // // if limited to base 10 and 16 the bufsize can be smaller - // char buf[65]; - // char *str = &buf[64]; +// // if limited to base 10 and 16 the bufsize can be smaller +// char buf[65]; +// char *str = &buf[64]; - // *str = '\0'; +// *str = '\0'; - // // prevent crash if called with base == 1 - // if (base < 2) base = 10; +// // prevent crash if called with base == 1 +// if (base < 2) base = 10; - // do { - // unsigned long long t = n / base; - // char c = n - t * base; // faster than c = n%base; - // n = t; - // *--str = c < 10 ? c + '0' : c + 'A' - 10; - // } while(n); +// do { +// unsigned long long t = n / base; +// char c = n - t * base; // faster than c = n%base; +// n = t; +// *--str = c < 10 ? c + '0' : c + 'A' - 10; +// } while(n); - // return write(str); +// return write(str); // } // FAST IMPLEMENTATION FOR ULL size_t Print::printULLNumber(unsigned long long n64, uint8_t base) { - // if limited to base 10 and 16 the bufsize can be 20 - char buf[64]; - uint8_t i = 0; - uint8_t innerLoops = 0; - - // prevent crash if called with base == 1 - if (base < 2) base = 10; - - // process chunks that fit in "16 bit math". - uint16_t top = 0xFFFF / base; - uint16_t th16 = 1; - while (th16 < top) - { - th16 *= base; - innerLoops++; - } - - while (n64 > th16) - { - // 64 bit math part - uint64_t q = n64 / th16; - uint16_t r = n64 - q*th16; - n64 = q; - - // 16 bit math loop to do remainder. (note buffer is filled reverse) - for (uint8_t j=0; j < innerLoops; j++) - { - uint16_t qq = r/base; - buf[i++] = r - qq*base; - r = qq; - } - } - - uint16_t n16 = n64; - while (n16 > 0) - { - uint16_t qq = n16/base; - buf[i++] = n16 - qq*base; - n16 = qq; - } - - size_t bytes = i; - for (; i > 0; i--) - write((char) (buf[i - 1] < 10 ? - '0' + buf[i - 1] : - 'A' + buf[i - 1] - 10)); - - return bytes; + // if limited to base 10 and 16 the bufsize can be 20 + char buf[64]; + uint8_t i = 0; + uint8_t innerLoops = 0; + + // prevent crash if called with base == 1 + if (base < 2) + base = 10; + + // process chunks that fit in "16 bit math". + uint16_t top = 0xFFFF / base; + uint16_t th16 = 1; + + while (th16 < top) + { + th16 *= base; + innerLoops++; + } + + while (n64 > th16) + { + // 64 bit math part + uint64_t q = n64 / th16; + uint16_t r = n64 - q * th16; + n64 = q; + + // 16 bit math loop to do remainder. (note buffer is filled reverse) + for (uint8_t j = 0; j < innerLoops; j++) + { + uint16_t qq = r / base; + buf[i++] = r - qq * base; + r = qq; + } + } + + uint16_t n16 = n64; + + while (n16 > 0) + { + uint16_t qq = n16 / base; + buf[i++] = n16 - qq * base; + n16 = qq; + } + + size_t bytes = i; + + for (; i > 0; i--) + write((char) (buf[i - 1] < 10 ? + '0' + buf[i - 1] : + 'A' + buf[i - 1] - 10)); + + return bytes; } size_t Print::printFloat(double number, int digits) { - if (digits < 0) - digits = 2; + if (digits < 0) + digits = 2; + + size_t n = 0; + + if (isnan(number)) + return print("nan"); - size_t n = 0; + if (isinf(number)) + return print("inf"); - if (isnan(number)) return print("nan"); - if (isinf(number)) return print("inf"); - if (number > 4294967040.0) return print ("ovf"); // constant determined empirically - if (number <-4294967040.0) return print ("ovf"); // constant determined empirically + if (number > 4294967040.0) + return print ("ovf"); // constant determined empirically - // Handle negative numbers - if (number < 0.0) - { - n += print('-'); - number = -number; - } + if (number < -4294967040.0) + return print ("ovf"); // constant determined empirically - // Round correctly so that print(1.999, 2) prints as "2.00" - double rounding = 0.5; - for (uint8_t i=0; i 0) { - n += print("."); - } + number += rounding; - // Extract digits from the remainder one at a time - while (digits-- > 0) - { - remainder *= 10.0; - unsigned int toPrint = (unsigned int)remainder; - n += print(toPrint); - remainder -= toPrint; - } + // Extract the integer part of the number and print it + unsigned long int_part = (unsigned long)number; + double remainder = number - (double)int_part; + n += print(int_part); - return n; + // Print the decimal point, but only if there are digits beyond + if (digits > 0) + { + n += print("."); + } + + // Extract digits from the remainder one at a time + while (digits-- > 0) + { + remainder *= 10.0; + unsigned int toPrint = (unsigned int)remainder; + n += print(toPrint); + remainder -= toPrint; + } + + return n; } size_t Print::printBuffer(uint8_t const buffer[], int len, char delim, int byteline) { - if (buffer == NULL || len == 0) return 0; + if (buffer == NULL || len == 0) + return 0; - for(int i=0; iprintf("%02X", buffer[i]); - } + if ( byteline && (i % byteline == 0) ) + println(); - return (len*3 - 1); + this->printf("%02X", buffer[i]); + } + + return (len * 3 - 1); } size_t Print::printBufferReverse(uint8_t const buffer[], int len, char delim, int byteline) { - if (buffer == NULL || len == 0) return 0; + if (buffer == NULL || len == 0) + return 0; + + for (int i = 0; i < len; i++) + { + if (i != 0) + print(delim); - for(int i=0; iprintf("%02X", buffer[len-1-i]); - } + this->printf("%02X", buffer[len - 1 - i]); + } - return (len*3 - 1); + return (len * 3 - 1); } diff --git a/Packages_Patches/Seeeduino/hardware/samd/1.8.2/cores/arduino/Print.h b/Packages_Patches/Seeeduino/hardware/samd/1.8.2/cores/arduino/Print.h index 48353c44..a465eddb 100644 --- a/Packages_Patches/Seeeduino/hardware/samd/1.8.2/cores/arduino/Print.h +++ b/Packages_Patches/Seeeduino/hardware/samd/1.8.2/cores/arduino/Print.h @@ -32,77 +32,93 @@ class Print { - private: - int write_error; - size_t printNumber(unsigned long, uint8_t); - size_t printULLNumber(unsigned long long, uint8_t); - size_t printFloat(double, int); - protected: - void setWriteError(int err = 1) { write_error = err; } - public: - Print() : write_error(0) {} - - int getWriteError() { return write_error; } - void clearWriteError() { setWriteError(0); } - - virtual size_t write(uint8_t) = 0; - size_t write(const char *str) { - if (str == NULL) return 0; - return write((const uint8_t *)str, strlen(str)); - } - virtual size_t write(const uint8_t *buffer, size_t size); - size_t write(const char *buffer, size_t size) { - return write((const uint8_t *)buffer, size); - } - - // default to zero, meaning "a single write may block" - // should be overridden by subclasses with buffering - virtual int availableForWrite() { return 0; } - - size_t print(const __FlashStringHelper *); - size_t print(const String &); - size_t print(const char[]); - size_t print(char); - size_t print(unsigned char, int = DEC); - size_t print(int, int = DEC); - size_t print(unsigned int, int = DEC); - size_t print(long, int = DEC); - size_t print(unsigned long, int = DEC); - size_t print(long long, int = DEC); - size_t print(unsigned long long, int = DEC); - size_t print(double, int = 2); - size_t print(const Printable&); - - size_t println(const __FlashStringHelper *); - size_t println(const String &s); - size_t println(const char[]); - size_t println(char); - size_t println(unsigned char, int = DEC); - size_t println(int, int = DEC); - size_t println(unsigned int, int = DEC); - size_t println(long, int = DEC); - size_t println(unsigned long, int = DEC); - size_t println(long long, int = DEC); - size_t println(unsigned long long, int = DEC); - size_t println(double, int = 2); - size_t println(const Printable&); - size_t println(void); - - size_t printf(const char * format, ...); - - size_t printBuffer(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); - size_t printBuffer(char const buffer[], int size, char delim=' ', int byteline = 0) - { - return printBuffer((uint8_t const*) buffer, size, delim, byteline); - } - - size_t printBufferReverse(uint8_t const buffer[], int len, char delim=' ', int byteline = 0); - size_t printBufferReverse(char const buffer[], int size, char delim=' ', int byteline = 0) - { - return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); - } - - virtual void flush() { /* Empty implementation for backward compatibility */ } + private: + int write_error; + size_t printNumber(unsigned long, uint8_t); + size_t printULLNumber(unsigned long long, uint8_t); + size_t printFloat(double, int); + protected: + void setWriteError(int err = 1) + { + write_error = err; + } + public: + Print() : write_error(0) {} + + int getWriteError() + { + return write_error; + } + void clearWriteError() + { + setWriteError(0); + } + + virtual size_t write(uint8_t) = 0; + size_t write(const char *str) + { + if (str == NULL) + return 0; + + return write((const uint8_t *)str, strlen(str)); + } + virtual size_t write(const uint8_t *buffer, size_t size); + size_t write(const char *buffer, size_t size) + { + return write((const uint8_t *)buffer, size); + } + + // default to zero, meaning "a single write may block" + // should be overridden by subclasses with buffering + virtual int availableForWrite() + { + return 0; + } + + size_t print(const __FlashStringHelper *); + size_t print(const String &); + size_t print(const char[]); + size_t print(char); + size_t print(unsigned char, int = DEC); + size_t print(int, int = DEC); + size_t print(unsigned int, int = DEC); + size_t print(long, int = DEC); + size_t print(unsigned long, int = DEC); + size_t print(long long, int = DEC); + size_t print(unsigned long long, int = DEC); + size_t print(double, int = 2); + size_t print(const Printable&); + + size_t println(const __FlashStringHelper *); + size_t println(const String &s); + size_t println(const char[]); + size_t println(char); + size_t println(unsigned char, int = DEC); + size_t println(int, int = DEC); + size_t println(unsigned int, int = DEC); + size_t println(long, int = DEC); + size_t println(unsigned long, int = DEC); + size_t println(long long, int = DEC); + size_t println(unsigned long long, int = DEC); + size_t println(double, int = 2); + size_t println(const Printable&); + size_t println(void); + + size_t printf(const char * format, ...); + + size_t printBuffer(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); + size_t printBuffer(char const buffer[], int size, char delim = ' ', int byteline = 0) + { + return printBuffer((uint8_t const*) buffer, size, delim, byteline); + } + + size_t printBufferReverse(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); + size_t printBufferReverse(char const buffer[], int size, char delim = ' ', int byteline = 0) + { + return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); + } + + virtual void flush() { /* Empty implementation for backward compatibility */ } }; diff --git a/Packages_Patches/Seeeduino/hardware/samd/1.8.3/cores/arduino/Arduino.h b/Packages_Patches/Seeeduino/hardware/samd/1.8.3/cores/arduino/Arduino.h new file mode 100644 index 00000000..51db668f --- /dev/null +++ b/Packages_Patches/Seeeduino/hardware/samd/1.8.3/cores/arduino/Arduino.h @@ -0,0 +1,181 @@ +/* + Arduino.h - Main include file for the Arduino SDK + Copyright (c) 2014 Arduino LLC. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef Arduino_h +#define Arduino_h + +#include +#include +#include +#include +#include + +#define CORE_HAS_LIBB64 + +typedef bool boolean; +typedef uint8_t byte; +typedef uint16_t word; + +// some libraries and sketches depend on this AVR stuff, +// assuming Arduino.h or WProgram.h automatically includes it... +// +#include "avr/pgmspace.h" +#include "avr/interrupt.h" +#include "avr/dtostrf.h" +#include "avr/io.h" + +#include "binary.h" +#include "itoa.h" + +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + +// Include Atmel headers +#include "sam.h" + +#include "wiring_constants.h" + +#define clockCyclesPerMicrosecond() ( SystemCoreClock / 1000000L ) +#define clockCyclesToMicroseconds(a) ( ((a) * 1000L) / (SystemCoreClock / 1000L) ) +#define microsecondsToClockCycles(a) ( (a) * (SystemCoreClock / 1000000L) ) + +void yield( void ) ; + +/* system functions */ +int main( void ); +void init( void ); + +/* sketch */ +void setup( void ) ; +void loop( void ) ; + +int __debug_buf(const char* head, char* buf, int len); + +#include "WVariant.h" + +#ifdef __cplusplus +} // extern "C" +#endif + +// The following headers are for C++ only compilation +#ifdef __cplusplus + #include "WCharacter.h" + #include "WString.h" + #include "Tone.h" + #include "WMath.h" + #include "HardwareSerial.h" + #include "pulse.h" +#endif +#include "delay.h" +#ifdef __cplusplus + #include "Uart.h" +#endif + +// Include board variant +#include "variant.h" + +#include "wiring.h" +#include "wiring_digital.h" +#include "wiring_analog.h" +#include "wiring_shift.h" +#include "wiring_pwm.h" +#include "WInterrupts.h" + +// undefine stdlib's abs if encountered +#ifdef abs + #undef abs +#endif // abs +// undefine stdlib's abs if encountered +#ifdef abs + #undef abs +#endif // abs + +#ifdef __cplusplus +template +auto min(const T& a, const L& b) -> decltype((b < a) ? b : a) +{ + return (b < a) ? b : a; +} + +template +auto max(const T& a, const L& b) -> decltype((b < a) ? b : a) +{ + return (a < b) ? b : a; +} +#else +#ifndef min +#define min(a,b) \ + ({ __typeof__ (a) _a = (a); \ + __typeof__ (b) _b = (b); \ + _a < _b ? _a : _b; }) +#endif +#ifndef max +#define max(a,b) \ + ({ __typeof__ (a) _a = (a); \ + __typeof__ (b) _b = (b); \ + _a > _b ? _a : _b; }) +#endif +#endif + +#define abs(x) ((x)>0?(x):-(x)) +#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) +#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) +#define radians(deg) ((deg)*DEG_TO_RAD) +#define degrees(rad) ((rad)*RAD_TO_DEG) +#define sq(x) ((x)*(x)) + +#define interrupts() __enable_irq() +#define noInterrupts() __disable_irq() +#ifndef interruptsStatus +static inline unsigned char __interruptsStatus(void) __attribute__((always_inline, unused)); +static inline unsigned char __interruptsStatus(void) +{ + // See http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0497a/CHDBIBGJ.html + return (__get_PRIMASK() ? 0 : 1); +} +#define interruptsStatus() __interruptsStatus() +#endif + +#define lowByte(w) ((uint8_t) ((w) & 0xff)) +#define highByte(w) ((uint8_t) ((w) >> 8)) + +#define bitRead(value, bit) (((value) >> (bit)) & 0x01) +#define bitSet(value, bit) ((value) |= (1UL << (bit))) +#define bitClear(value, bit) ((value) &= ~(1UL << (bit))) +#define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit)) + +#define bit(b) (1UL << (b)) + +#if (ARDUINO_SAMD_VARIANT_COMPLIANCE >= 10606) + // Interrupts + #define digitalPinToInterrupt(P) ( P ) +#endif + +// USB +#ifdef USE_TINYUSB + #include "Adafruit_TinyUSB_Core.h" +#else + #include "USB/USBDesc.h" + #include "USB/USBCore.h" + #include "USB/USBAPI.h" + #include "USB/USB_host.h" +#endif + +#endif // Arduino_h diff --git a/Packages_Patches/Seeeduino/hardware/samd/1.8.3/cores/arduino/Print.cpp b/Packages_Patches/Seeeduino/hardware/samd/1.8.3/cores/arduino/Print.cpp new file mode 100644 index 00000000..b47efa1a --- /dev/null +++ b/Packages_Patches/Seeeduino/hardware/samd/1.8.3/cores/arduino/Print.cpp @@ -0,0 +1,466 @@ +/* + Copyright (c) 2014 Arduino. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include + +#include + +#include +#include +#include + +#include "Arduino.h" + +#include "Print.h" + +//using namespace arduino; + +// Public Methods ////////////////////////////////////////////////////////////// + +/* default implementation: may be overridden */ +size_t Print::write(const uint8_t *buffer, size_t size) +{ + size_t n = 0; + + while (size--) + { + if (write(*buffer++)) + n++; + else + break; + } + + return n; +} + +size_t Print::print(const __FlashStringHelper *ifsh) +{ + return print(reinterpret_cast(ifsh)); +} + +size_t Print::print(const String &s) +{ + return write(s.c_str(), s.length()); +} + +size_t Print::print(const char str[]) +{ + return write(str); +} + +size_t Print::print(char c) +{ + return write(c); +} + +size_t Print::print(unsigned char b, int base) +{ + return print((unsigned long) b, base); +} + +size_t Print::print(int n, int base) +{ + return print((long) n, base); +} + +size_t Print::print(unsigned int n, int base) +{ + return print((unsigned long) n, base); +} + +size_t Print::print(long n, int base) +{ + if (base == 0) + { + return write(n); + } + else if (base == 10) + { + if (n < 0) + { + int t = print('-'); + n = -n; + return printNumber(n, 10) + t; + } + + return printNumber(n, 10); + } + else + { + return printNumber(n, base); + } +} + +size_t Print::print(unsigned long n, int base) +{ + if (base == 0) + return write(n); + else + return printNumber(n, base); +} + +size_t Print::print(long long n, int base) +{ + if (base == 0) + { + return write(n); + } + else if (base == 10) + { + if (n < 0) + { + int t = print('-'); + n = -n; + return printULLNumber(n, 10) + t; + } + + return printULLNumber(n, 10); + } + else + { + return printULLNumber(n, base); + } +} + +size_t Print::print(unsigned long long n, int base) +{ + if (base == 0) + return write(n); + else + return printULLNumber(n, base); +} + +size_t Print::print(double n, int digits) +{ + return printFloat(n, digits); +} + +size_t Print::println(const __FlashStringHelper *ifsh) +{ + size_t n = print(ifsh); + n += println(); + return n; +} + +size_t Print::print(const Printable& x) +{ + return x.printTo(*this); +} + +size_t Print::println(void) +{ + return write("\r\n"); +} + +size_t Print::println(const String &s) +{ + size_t n = print(s); + n += println(); + return n; +} + +size_t Print::println(const char c[]) +{ + size_t n = print(c); + n += println(); + return n; +} + +size_t Print::println(char c) +{ + size_t n = print(c); + n += println(); + return n; +} + +size_t Print::println(unsigned char b, int base) +{ + size_t n = print(b, base); + n += println(); + return n; +} + +size_t Print::println(int num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(unsigned int num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(long num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(unsigned long num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(long long num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(unsigned long long num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(double num, int digits) +{ + size_t n = print(num, digits); + n += println(); + return n; +} + +size_t Print::println(const Printable& x) +{ + size_t n = print(x); + n += println(); + return n; +} + +size_t Print::printf(const char * format, ...) +{ + char buf[256]; + int len; + + va_list ap; + va_start(ap, format); + + len = vsnprintf(buf, 256, format, ap); + this->write(buf, len); + + va_end(ap); + return len; +} + +// Private Methods ///////////////////////////////////////////////////////////// + +size_t Print::printNumber(unsigned long n, uint8_t base) +{ + char buf[8 * sizeof(long) + 1]; // Assumes 8-bit chars plus zero byte. + char *str = &buf[sizeof(buf) - 1]; + + *str = '\0'; + + // prevent crash if called with base == 1 + if (base < 2) + base = 10; + + do + { + char c = n % base; + n /= base; + + *--str = c < 10 ? c + '0' : c + 'A' - 10; + } while (n); + + return write(str); +} + +// REFERENCE IMPLEMENTATION FOR ULL +// size_t Print::printULLNumber(unsigned long long n, uint8_t base) +// { +// // if limited to base 10 and 16 the bufsize can be smaller +// char buf[65]; +// char *str = &buf[64]; + +// *str = '\0'; + +// // prevent crash if called with base == 1 +// if (base < 2) base = 10; + +// do { +// unsigned long long t = n / base; +// char c = n - t * base; // faster than c = n%base; +// n = t; +// *--str = c < 10 ? c + '0' : c + 'A' - 10; +// } while(n); + +// return write(str); +// } + +// FAST IMPLEMENTATION FOR ULL +size_t Print::printULLNumber(unsigned long long n64, uint8_t base) +{ + // if limited to base 10 and 16 the bufsize can be 20 + char buf[64]; + uint8_t i = 0; + uint8_t innerLoops = 0; + + // prevent crash if called with base == 1 + if (base < 2) + base = 10; + + // process chunks that fit in "16 bit math". + uint16_t top = 0xFFFF / base; + uint16_t th16 = 1; + + while (th16 < top) + { + th16 *= base; + innerLoops++; + } + + while (n64 > th16) + { + // 64 bit math part + uint64_t q = n64 / th16; + uint16_t r = n64 - q * th16; + n64 = q; + + // 16 bit math loop to do remainder. (note buffer is filled reverse) + for (uint8_t j = 0; j < innerLoops; j++) + { + uint16_t qq = r / base; + buf[i++] = r - qq * base; + r = qq; + } + } + + uint16_t n16 = n64; + + while (n16 > 0) + { + uint16_t qq = n16 / base; + buf[i++] = n16 - qq * base; + n16 = qq; + } + + size_t bytes = i; + + for (; i > 0; i--) + write((char) (buf[i - 1] < 10 ? + '0' + buf[i - 1] : + 'A' + buf[i - 1] - 10)); + + return bytes; +} + +size_t Print::printFloat(double number, int digits) +{ + if (digits < 0) + digits = 2; + + size_t n = 0; + + if (isnan(number)) + return print("nan"); + + if (isinf(number)) + return print("inf"); + + if (number > 4294967040.0) + return print ("ovf"); // constant determined empirically + + if (number < -4294967040.0) + return print ("ovf"); // constant determined empirically + + // Handle negative numbers + if (number < 0.0) + { + n += print('-'); + number = -number; + } + + // Round correctly so that print(1.999, 2) prints as "2.00" + double rounding = 0.5; + + for (uint8_t i = 0; i < digits; ++i) + rounding /= 10.0; + + number += rounding; + + // Extract the integer part of the number and print it + unsigned long int_part = (unsigned long)number; + double remainder = number - (double)int_part; + n += print(int_part); + + // Print the decimal point, but only if there are digits beyond + if (digits > 0) + { + n += print("."); + } + + // Extract digits from the remainder one at a time + while (digits-- > 0) + { + remainder *= 10.0; + unsigned int toPrint = (unsigned int)remainder; + n += print(toPrint); + remainder -= toPrint; + } + + return n; +} + +size_t Print::printBuffer(uint8_t const buffer[], int len, char delim, int byteline) +{ + if (buffer == NULL || len == 0) + return 0; + + for (int i = 0; i < len; i++) + { + if ( i != 0 ) + print(delim); + + if ( byteline && (i % byteline == 0) ) + println(); + + this->printf("%02X", buffer[i]); + } + + return (len * 3 - 1); +} + +size_t Print::printBufferReverse(uint8_t const buffer[], int len, char delim, int byteline) +{ + if (buffer == NULL || len == 0) + return 0; + + for (int i = 0; i < len; i++) + { + if (i != 0) + print(delim); + + if ( byteline && (i % byteline == 0) ) + println(); + + this->printf("%02X", buffer[len - 1 - i]); + } + + return (len * 3 - 1); +} + diff --git a/Packages_Patches/Seeeduino/hardware/samd/1.8.3/cores/arduino/Print.h b/Packages_Patches/Seeeduino/hardware/samd/1.8.3/cores/arduino/Print.h new file mode 100644 index 00000000..a465eddb --- /dev/null +++ b/Packages_Patches/Seeeduino/hardware/samd/1.8.3/cores/arduino/Print.h @@ -0,0 +1,124 @@ +/* + Copyright (c) 2016 Arduino LLC. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#pragma once + +#include +#include // for size_t +#include // for printf + +#include "WString.h" +#include "Printable.h" + +#define DEC 10 +#define HEX 16 +#define OCT 8 +#define BIN 2 + +class Print +{ + private: + int write_error; + size_t printNumber(unsigned long, uint8_t); + size_t printULLNumber(unsigned long long, uint8_t); + size_t printFloat(double, int); + protected: + void setWriteError(int err = 1) + { + write_error = err; + } + public: + Print() : write_error(0) {} + + int getWriteError() + { + return write_error; + } + void clearWriteError() + { + setWriteError(0); + } + + virtual size_t write(uint8_t) = 0; + size_t write(const char *str) + { + if (str == NULL) + return 0; + + return write((const uint8_t *)str, strlen(str)); + } + virtual size_t write(const uint8_t *buffer, size_t size); + size_t write(const char *buffer, size_t size) + { + return write((const uint8_t *)buffer, size); + } + + // default to zero, meaning "a single write may block" + // should be overridden by subclasses with buffering + virtual int availableForWrite() + { + return 0; + } + + size_t print(const __FlashStringHelper *); + size_t print(const String &); + size_t print(const char[]); + size_t print(char); + size_t print(unsigned char, int = DEC); + size_t print(int, int = DEC); + size_t print(unsigned int, int = DEC); + size_t print(long, int = DEC); + size_t print(unsigned long, int = DEC); + size_t print(long long, int = DEC); + size_t print(unsigned long long, int = DEC); + size_t print(double, int = 2); + size_t print(const Printable&); + + size_t println(const __FlashStringHelper *); + size_t println(const String &s); + size_t println(const char[]); + size_t println(char); + size_t println(unsigned char, int = DEC); + size_t println(int, int = DEC); + size_t println(unsigned int, int = DEC); + size_t println(long, int = DEC); + size_t println(unsigned long, int = DEC); + size_t println(long long, int = DEC); + size_t println(unsigned long long, int = DEC); + size_t println(double, int = 2); + size_t println(const Printable&); + size_t println(void); + + size_t printf(const char * format, ...); + + size_t printBuffer(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); + size_t printBuffer(char const buffer[], int size, char delim = ' ', int byteline = 0) + { + return printBuffer((uint8_t const*) buffer, size, delim, byteline); + } + + size_t printBufferReverse(uint8_t const buffer[], int len, char delim = ' ', int byteline = 0); + size_t printBufferReverse(char const buffer[], int size, char delim = ' ', int byteline = 0) + { + return printBufferReverse((uint8_t const*) buffer, size, delim, byteline); + } + + virtual void flush() { /* Empty implementation for backward compatibility */ } +}; + + diff --git a/Packages_Patches/Seeeduino/hardware/samd/1.8.3/platform.txt b/Packages_Patches/Seeeduino/hardware/samd/1.8.3/platform.txt new file mode 100644 index 00000000..fa6d347a --- /dev/null +++ b/Packages_Patches/Seeeduino/hardware/samd/1.8.3/platform.txt @@ -0,0 +1,204 @@ +# Copyright (c) 2014-2015 Arduino LLC. All right reserved. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +# Arduino SAMD Core and platform. +# +# For more info: +# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification + +name=Seeed SAMD (32-bits ARM Cortex-M0+ and Cortex-M4) Boards +version=1.8.3 + +# Compile variables +# ----------------- + +compiler.warning_flags=-w +compiler.warning_flags.none=-w +compiler.warning_flags.default= +compiler.warning_flags.more=-Wall -Wno-expansion-to-defined +compiler.warning_flags.all=-Wall -Wextra -Wno-expansion-to-defined + +compiler.path={runtime.tools.arm-none-eabi-gcc-7-2017q4.path}/bin/ +compiler.c.cmd=arm-none-eabi-gcc +compiler.c.flags=-mcpu={build.mcu} -mthumb -c -g -Os {compiler.warning_flags} -std=gnu11 -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -MMD -D__SKETCH_NAME__="""{build.project_name}""" +compiler.c.elf.cmd=arm-none-eabi-g++ +compiler.c.elf.flags=-Os -Wl,--gc-sections -save-temps +compiler.S.cmd=arm-none-eabi-gcc +compiler.S.flags=-c -g -x assembler-with-cpp -MMD +compiler.cpp.cmd=arm-none-eabi-g++ +compiler.cpp.flags=-mcpu={build.mcu} -mthumb -c -g -Os {compiler.warning_flags} -std=gnu++14 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -MMD -D__SKETCH_NAME__="""{build.project_name}""" +compiler.ar.cmd=arm-none-eabi-ar +compiler.ar.flags=rcs +compiler.objcopy.cmd=arm-none-eabi-objcopy +compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 +compiler.elf2hex.bin.flags=-O binary +compiler.elf2hex.hex.flags=-O ihex -R .eeprom +compiler.elf2hex.cmd=arm-none-eabi-objcopy +compiler.ldflags=-mcpu={build.mcu} -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -u _printf_float -u _scanf_float -Wl,--wrap,_write -u __wrap__write +compiler.size.cmd=arm-none-eabi-size +compiler.define=-DARDUINO= +compiler.readelf.cmd=arm-none-eabi-readelf + +# this can be overriden in boards.txt +build.extra_flags= +build.project_flags= +build.cache_flags= +build.flags.optimize= +build.flags.maxspi= +build.flags.maxqspi= +build.flags.usbstack= +build.flags.debug= +build.flags.role= +build.flags.txrxled= + +# These can be overridden in platform.local.txt +compiler.c.extra_flags= +compiler.c.elf.extra_flags= +#compiler.c.elf.extra_flags=-v +compiler.cpp.extra_flags= +compiler.S.extra_flags= +compiler.ar.extra_flags= +compiler.elf2hex.extra_flags= + +compiler.arm.cmsis.c.flags="-I{runtime.tools.CMSIS-5.7.0.path}/CMSIS/Core/Include/" "-I{runtime.tools.CMSIS-5.7.0.path}/CMSIS/DSP/Include/" "-I{runtime.tools.CMSIS-Atmel-1.2.1.path}/CMSIS-Atmel/CMSIS/Device/ATMEL/" +compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-5.7.0.path}/CMSIS/DSP/Lib/GCC/" -larm_cortexM0l_math -lm + +compiler.libraries.ldflags= + +# USB Flags +# --------- +build.usb_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid} -DUSBCON -DUSB_CONFIG_POWER={build.usb_power} '-DUSB_MANUFACTURER={build.usb_manufacturer}' '-DUSB_PRODUCT={build.usb_product}' {build.flags.usbstack} {build.flags.debug} {build.flags.role} "-I{build.core.path}/TinyUSB" "-I{build.core.path}/TinyUSB/Adafruit_TinyUSB_ArduinoCore" "-I{build.core.path}/TinyUSB/Adafruit_TinyUSB_ArduinoCore/tinyusb/src" + +# Default advertised device power setting in mA +build.usb_power=100 + +# Default usb manufacturer will be replaced at compile time using +# numeric vendor ID if available or by board's specific value. +build.usb_manufacturer="Unknown" + + +# Compile patterns +# ---------------- + +## Compile c files +## KH Add -DBOARD_NAME="{build.board}" +recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DBOARD_NAME="{build.board}" -DARDUINO_ARCH_{build.arch} {compiler.c.extra_flags} {build.extra_flags} {build.project_flags} {build.cache_flags} {build.flags.debug} {build.flags.txrxled} {build.flags.role} {build.flags.optimize} {build.flags.maxspi} {build.flags.maxqspi} {compiler.arm.cmsis.c.flags} {includes} "{source_file}" -o "{object_file}" + +## Compile c++ files +## KH Add -DBOARD_NAME="{build.board}" +recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DBOARD_NAME="{build.board}" -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {build.project_flags} {build.cache_flags} {build.flags.debug} {build.flags.txrxled} {build.flags.role} {build.flags.optimize} {build.flags.maxspi} {build.flags.maxqspi} {build.extra_flags} {build.project_flags} {compiler.arm.cmsis.c.flags} {includes} "{source_file}" -o "{object_file}" + +## Compile S files +## KH Add -DBOARD_NAME="{build.board}" +recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DBOARD_NAME="{build.board}" -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {build.project_flags} {build.cache_flags} {compiler.arm.cmsis.c.flags} {includes} "{source_file}" -o "{object_file}" + +## Create archives +# archive_file_path is needed for backwards compatibility with IDE 1.6.5 or older, IDE 1.6.6 or newer overrides this value +archive_file_path={build.path}/{archive_file} +recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}" + +## Combine gc-sections, archives, and objects +recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" --specs=nano.specs --specs=nosys.specs {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} {compiler.libraries.ldflags} -Wl,--start-group {compiler.arm.cmsis.ldflags} "-L{build.variant.path}" -lm "{build.path}/{archive_file}" -Wl,--end-group + +## Create output (bin file) +recipe.objcopy.bin.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.bin.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.bin" + +## Create output (hex file) +recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex" + +build.preferred_out_format=bin + +## Save hex +recipe.output.tmp_file={build.project_name}.{build.preferred_out_format} +recipe.output.save_file={build.project_name}.{build.variant}.{build.preferred_out_format} + +## Compute size +recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf" +recipe.size.regex=\.text\s+([0-9]+).* + +# +# BOSSA +# +tools.bossac.path={runtime.tools.bossac-1.7.0-arduino3.path} +tools.bossac.cmd=bossac +tools.bossac.cmd.windows=bossac.exe +tools.bossac.upload.params.verbose=-i -d +tools.bossac.upload.params.quiet= +tools.bossac.upload.pattern="{path}/{cmd}" {upload.verbose} --port={serial.port.file} -U {upload.native_usb} -i -e -w -v "{build.path}/{build.project_name}.bin" -R +tools.bossac_remote.upload.pattern=/usr/bin/run-bossac {upload.verbose} --port=ttyATH0 -U {upload.native_usb} -e -w -v /tmp/sketch.bin -R +tools.bossac.network_cmd={runtime.tools.arduinoOTA.path}/bin/arduinoOTA +tools.bossac.upload.network_pattern="{network_cmd}" -address {serial.port} -port 65280 -username arduino -password "{network.password}" -sketch "{build.path}/{build.project_name}.bin" -upload /sketch -b +# v1.8.0 +tools.bossac18.path={runtime.tools.bossac-1.8.0-48-gb176eee.path} +tools.bossac18.cmd=bossac +tools.bossac18.upload.params.verbose=-i -d +tools.bossac18.upload.params.quiet= +tools.bossac18.upload.pattern="{path}/{cmd}" {upload.verbose} --port={serial.port.file} -U -i --offset={upload.offset} -w -v "{build.path}/{build.project_name}.bin" -R +tools.bossac18.network_cmd={runtime.tools.arduinoOTA.path}/bin/arduinoOTA +tools.bossac18.upload.network_pattern="{network_cmd}" -address {serial.port} -port 65280 -username arduino -password "{network.password}" -sketch "{build.path}/{build.project_name}.bin" -upload /sketch -b +# +# BOSSA (ignore binary size) +# +tools.bossacI.path={runtime.tools.bossac-1.7.0-arduino3.path} +tools.bossacI.cmd=bossac +tools.bossacI.cmd.windows=bossac.exe +tools.bossacI.upload.params.verbose=-i -d +tools.bossacI.upload.params.quiet= +tools.bossacI.upload.pattern="{path}/{cmd}" {upload.verbose} --port={serial.port.file} -I -U {upload.native_usb} -i -e -w "{build.path}/{build.project_name}.bin" -R +tools.bossacI_remote.upload.pattern=/usr/bin/run-bossac {upload.verbose} --port=ttyATH0 -U {upload.native_usb} -e -w -v /tmp/sketch.bin -R +tools.bossacI.network_cmd={runtime.tools.arduinoOTA.path}/bin/arduinoOTA +tools.bossacI.upload.network_pattern="{network_cmd}" -address {serial.port} -port 65280 -username arduino -password "{network.password}" -sketch "{build.path}/{build.project_name}.bin" -upload /sketch -b +# +# OpenOCD sketch upload +# +tools.openocd.path={runtime.tools.openocd-0.10.0-arduino7.path} +tools.openocd.cmd=bin/openocd +tools.openocd.cmd.windows=bin/openocd.exe +tools.openocd.upload.params.verbose=-d2 +tools.openocd.upload.params.quiet=-d0 +tools.openocd.upload.pattern="{path}/{cmd}" {upload.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; program {{build.path}/{build.project_name}.bin} verify reset 0x2000; shutdown" +tools.openocd.network_cmd={runtime.tools.arduinoOTA.path}/bin/arduinoOTA +tools.openocd.upload.network_pattern={network_cmd} -address {serial.port} -port 65280 -username arduino -password "{network.password}" -sketch "{build.path}/{build.project_name}.bin" -upload /sketch -b +# Program flashes the binary at 0x0000, so use the linker script without_bootloader +tools.openocd.program.params.verbose=-d2 +tools.openocd.program.params.quiet=-d0 +tools.openocd.program.pattern="{path}/{cmd}" {program.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; program {{build.path}/{build.project_name}.elf} verify reset; shutdown" +tools.openocd.erase.params.verbose=-d3 +tools.openocd.erase.params.quiet=-d0 +tools.openocd.erase.pattern= +tools.openocd.bootloader.params.verbose=-d2 +tools.openocd.bootloader.params.quiet=-d0 +tools.openocd.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; init; halt; at91samd bootloader 0; program {{runtime.platform.path}/bootloaders/{bootloader.file}} verify reset; shutdown" +# +# OpenOCD sketch upload - version with configurable bootloader size +# FIXME: this programmer is a workaround for default options being overwritten by uploadUsingPreferences +# +tools.openocd-withbootsize.path={runtime.tools.openocd-0.10.0-arduino7.path} +tools.openocd-withbootsize.cmd=bin/openocd +tools.openocd-withbootsize.cmd.windows=bin/openocd.exe +tools.openocd-withbootsize.upload.params.verbose=-d2 +tools.openocd-withbootsize.upload.params.quiet=-d0 +tools.openocd-withbootsize.upload.pattern="{path}/{cmd}" {upload.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; program {{build.path}/{build.project_name}.bin} verify reset {bootloader.size}; shutdown" +# Program flashes the binary at 0x0000, so use the linker script without_bootloader +tools.openocd-withbootsize.program.params.verbose=-d2 +tools.openocd-withbootsize.program.params.quiet=-d0 +tools.openocd-withbootsize.program.pattern="{path}/{cmd}" {program.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; program {{build.path}/{build.project_name}.elf} verify reset; shutdown" +tools.openocd-withbootsize.erase.params.verbose=-d3 +tools.openocd-withbootsize.erase.params.quiet=-d0 +tools.openocd-withbootsize.erase.pattern= +tools.openocd-withbootsize.bootloader.params.verbose=-d2 +tools.openocd-withbootsize.bootloader.params.quiet=-d0 +tools.openocd-withbootsize.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; init; halt; at91samd bootloader 0; program {{runtime.platform.path}/bootloaders/{bootloader.file}} verify reset; shutdown" diff --git a/Packages_Patches/arduino/hardware/mbed_portenta/2.4.1/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h b/Packages_Patches/arduino/hardware/mbed_portenta/2.4.1/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h index 84c18cf1..bd98fb95 100644 --- a/Packages_Patches/arduino/hardware/mbed_portenta/2.4.1/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h +++ b/Packages_Patches/arduino/hardware/mbed_portenta/2.4.1/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h @@ -1,28 +1,28 @@ /* Copyright (C) 2012 mbed.org, MIT License - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software - * and associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, - * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or - * substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING - * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software + and associated documentation files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, publish, distribute, + sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or + substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ #ifndef LWIPOPTS_H #define LWIPOPTS_H // Workaround for Linux timeval #if defined (TOOLCHAIN_GCC) -#define LWIP_TIMEVAL_PRIVATE 0 -#include + #define LWIP_TIMEVAL_PRIVATE 0 + #include #endif #include "nsapi_types.h" #include "mbed_retarget.h" @@ -35,7 +35,7 @@ #define NO_SYS 0 #if !MBED_CONF_LWIP_IPV4_ENABLED && !MBED_CONF_LWIP_IPV6_ENABLED -#error "Either IPv4 or IPv6 must be enabled." + #error "Either IPv4 or IPv6 must be enabled." #endif #define LWIP_IPV4 MBED_CONF_LWIP_IPV4_ENABLED @@ -47,16 +47,16 @@ // On dual stack configuration how long to wait for both or preferred stack // addresses before completing bring up. #if LWIP_IPV4 && LWIP_IPV6 -#if MBED_CONF_LWIP_ADDR_TIMEOUT_MODE -#define BOTH_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT -#define PREF_ADDR_TIMEOUT 0 -#else -#define PREF_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT -#define BOTH_ADDR_TIMEOUT 0 -#endif + #if MBED_CONF_LWIP_ADDR_TIMEOUT_MODE + #define BOTH_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT + #define PREF_ADDR_TIMEOUT 0 + #else + #define PREF_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT + #define BOTH_ADDR_TIMEOUT 0 + #endif #else -#define PREF_ADDR_TIMEOUT 0 -#define BOTH_ADDR_TIMEOUT 0 + #define PREF_ADDR_TIMEOUT 0 + #define BOTH_ADDR_TIMEOUT 0 #endif @@ -68,52 +68,52 @@ #define PREF_IPV6 2 #if MBED_CONF_LWIP_IP_VER_PREF == 6 -#define IP_VERSION_PREF PREF_IPV6 + #define IP_VERSION_PREF PREF_IPV6 #elif MBED_CONF_LWIP_IP_VER_PREF == 4 -#define IP_VERSION_PREF PREF_IPV4 + #define IP_VERSION_PREF PREF_IPV4 #else -#error "Either IPv4 or IPv6 must be preferred." + #error "Either IPv4 or IPv6 must be preferred." #endif #undef LWIP_DEBUG #if MBED_CONF_LWIP_DEBUG_ENABLED -#define LWIP_DEBUG 1 + #define LWIP_DEBUG 1 #endif #if NO_SYS == 0 -#include "cmsis_os2.h" + #include "cmsis_os2.h" -#define SYS_LIGHTWEIGHT_PROT 1 + #define SYS_LIGHTWEIGHT_PROT 1 -#define LWIP_RAW MBED_CONF_LWIP_RAW_SOCKET_ENABLED + #define LWIP_RAW MBED_CONF_LWIP_RAW_SOCKET_ENABLED -#define MEMP_NUM_TCPIP_MSG_INPKT MBED_CONF_LWIP_MEMP_NUM_TCPIP_MSG_INPKT + #define MEMP_NUM_TCPIP_MSG_INPKT MBED_CONF_LWIP_MEMP_NUM_TCPIP_MSG_INPKT -// Thread stacks use 8-byte alignment -#define LWIP_ALIGN_UP(pos, align) ((pos) % (align) ? (pos) + ((align) - (pos) % (align)) : (pos)) + // Thread stacks use 8-byte alignment + #define LWIP_ALIGN_UP(pos, align) ((pos) % (align) ? (pos) + ((align) - (pos) % (align)) : (pos)) -#ifdef LWIP_DEBUG -// For LWIP debug, double the stack -#define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE*2, 8) -#elif MBED_DEBUG -// When debug is enabled on the build increase stack 25 percent -#define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE + MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE / 4, 8) -#else -#define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE, 8) -#endif + #ifdef LWIP_DEBUG + // For LWIP debug, double the stack + #define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE*2, 8) + #elif MBED_DEBUG + // When debug is enabled on the build increase stack 25 percent + #define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE + MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE / 4, 8) + #else + #define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE, 8) + #endif -// Thread priority (osPriorityNormal by default) -#define TCPIP_THREAD_PRIO (MBED_CONF_LWIP_TCPIP_THREAD_PRIORITY) + // Thread priority (osPriorityNormal by default) + #define TCPIP_THREAD_PRIO (MBED_CONF_LWIP_TCPIP_THREAD_PRIORITY) -#ifdef LWIP_DEBUG -#define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE*2, 8) -#else -#define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE, 8) -#endif + #ifdef LWIP_DEBUG + #define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE*2, 8) + #else + #define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE, 8) + #endif -#define MEMP_NUM_SYS_TIMEOUT 16 + #define MEMP_NUM_SYS_TIMEOUT 16 -#define sys_msleep(ms) sys_msleep(ms) + #define sys_msleep(ms) sys_msleep(ms) #endif @@ -143,16 +143,16 @@ #define PBUF_POOL_SIZE MBED_CONF_LWIP_PBUF_POOL_SIZE #ifdef MBED_CONF_LWIP_PBUF_POOL_BUFSIZE -#undef PBUF_POOL_BUFSIZE -#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(MBED_CONF_LWIP_PBUF_POOL_BUFSIZE) + #undef PBUF_POOL_BUFSIZE + #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(MBED_CONF_LWIP_PBUF_POOL_BUFSIZE) #else -#ifndef PBUF_POOL_BUFSIZE -#if LWIP_IPV6 -#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) -#elif LWIP_IPV4 -#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+20+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) -#endif -#endif + #ifndef PBUF_POOL_BUFSIZE + #if LWIP_IPV6 + #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) + #elif LWIP_IPV4 + #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+20+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) + #endif + #endif #endif #define MEM_SIZE MBED_CONF_LWIP_MEM_SIZE @@ -181,14 +181,14 @@ #define MEMP_NUM_NETCONN MBED_CONF_LWIP_SOCKET_MAX #if MBED_CONF_LWIP_TCP_ENABLED -#define LWIP_TCP 1 -#define TCP_OVERSIZE 0 -#define LWIP_TCP_KEEPALIVE 1 + #define LWIP_TCP 1 + #define TCP_OVERSIZE 0 + #define LWIP_TCP_KEEPALIVE 1 -#define TCP_CLOSE_TIMEOUT MBED_CONF_LWIP_TCP_CLOSE_TIMEOUT + #define TCP_CLOSE_TIMEOUT MBED_CONF_LWIP_TCP_CLOSE_TIMEOUT #else -#define LWIP_TCP 0 + #define LWIP_TCP 0 #endif #define LWIP_DNS 1 @@ -251,13 +251,13 @@ #define UDP_LPC_EMAC LWIP_DBG_OFF #ifdef LWIP_DEBUG -#define MEMP_OVERFLOW_CHECK 1 -#define MEMP_SANITY_CHECK 1 -#define LWIP_DBG_TYPES_ON LWIP_DBG_ON -#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL + #define MEMP_OVERFLOW_CHECK 1 + #define MEMP_SANITY_CHECK 1 + #define LWIP_DBG_TYPES_ON LWIP_DBG_ON + #define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL #else -#define LWIP_NOASSERT 1 -#define LWIP_STATS 0 + #define LWIP_NOASSERT 1 + #define LWIP_STATS 0 #endif #define TRACE_TO_ASCII_HEX_DUMP 0 @@ -269,18 +269,18 @@ // Interface type configuration #if MBED_CONF_LWIP_ETHERNET_ENABLED -#define LWIP_ARP 1 -#define LWIP_ETHERNET 1 -#define LWIP_DHCP LWIP_IPV4 + #define LWIP_ARP 1 + #define LWIP_ETHERNET 1 + #define LWIP_DHCP LWIP_IPV4 #else -#define LWIP_ARP 0 -#define LWIP_ETHERNET 0 + #define LWIP_ARP 0 + #define LWIP_ETHERNET 0 #endif // MBED_CONF_LWIP_ETHERNET_ENABLED #if MBED_CONF_LWIP_L3IP_ENABLED -#define LWIP_L3IP 1 + #define LWIP_L3IP 1 #else -#define LWIP_L3IP 0 + #define LWIP_L3IP 0 #endif //Maximum size of network interface name @@ -291,27 +291,27 @@ // Enable PPP for now either from lwIP PPP configuration (obsolete) or from PPP service configuration #if MBED_CONF_PPP_ENABLED || MBED_CONF_LWIP_PPP_ENABLED -#define PPP_SUPPORT 1 - -#if MBED_CONF_PPP_IPV4_ENABLED || MBED_CONF_LWIP_IPV4_ENABLED -#define LWIP 0x11991199 -#if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV4_ENABLED -#error LWIP: IPv4 PPP enabled but not IPv4 -#endif -#undef LWIP -#define PPP_IPV4_SUPPORT 1 -#endif - -#if MBED_CONF_PPP_IPV6_ENABLED || MBED_CONF_LWIP_IPV6_ENABLED -#define LWIP 0x11991199 -#if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV6_ENABLED -#error LWIP: IPv6 PPP enabled but not IPv6 -#endif -#undef LWIP -#define PPP_IPV6_SUPPORT 1 -// Later to be dynamic for use for multiple interfaces -#define LWIP_IPV6_DUP_DETECT_ATTEMPTS 0 -#endif + #define PPP_SUPPORT 1 + + #if MBED_CONF_PPP_IPV4_ENABLED || MBED_CONF_LWIP_IPV4_ENABLED + #define LWIP 0x11991199 + #if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV4_ENABLED + #error LWIP: IPv4 PPP enabled but not IPv4 + #endif + #undef LWIP + #define PPP_IPV4_SUPPORT 1 + #endif + + #if MBED_CONF_PPP_IPV6_ENABLED || MBED_CONF_LWIP_IPV6_ENABLED + #define LWIP 0x11991199 + #if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV6_ENABLED + #error LWIP: IPv6 PPP enabled but not IPv6 + #endif + #undef LWIP + #define PPP_IPV6_SUPPORT 1 + // Later to be dynamic for use for multiple interfaces + #define LWIP_IPV6_DUP_DETECT_ATTEMPTS 0 + #endif #endif @@ -320,7 +320,7 @@ // Make sure we default these to off, so // LWIP doesn't default to on #ifndef LWIP_ARP -#define LWIP_ARP 0 + #define LWIP_ARP 0 #endif // Checksum-on-copy disabled due to https://savannah.nongnu.org/bugs/?50914 @@ -337,9 +337,9 @@ #include "lwip_tcp_isn.h" #define LWIP_HOOK_TCP_ISN lwip_hook_tcp_isn #ifdef MBEDTLS_MD5_C -#define LWIP_USE_EXTERNAL_MBEDTLS 1 + #define LWIP_USE_EXTERNAL_MBEDTLS 1 #else -#define LWIP_USE_EXTERNAL_MBEDTLS 0 + #define LWIP_USE_EXTERNAL_MBEDTLS 0 #endif #define LWIP_ND6_RDNSS_MAX_DNS_SERVERS MBED_CONF_LWIP_ND6_RDNSS_MAX_DNS_SERVERS diff --git a/Packages_Patches/arduino/hardware/mbed_portenta/2.4.1/libraries/SocketWrapper/src/MbedUdp.cpp b/Packages_Patches/arduino/hardware/mbed_portenta/2.4.1/libraries/SocketWrapper/src/MbedUdp.cpp index 2a1b0fc2..81399f3c 100644 --- a/Packages_Patches/arduino/hardware/mbed_portenta/2.4.1/libraries/SocketWrapper/src/MbedUdp.cpp +++ b/Packages_Patches/arduino/hardware/mbed_portenta/2.4.1/libraries/SocketWrapper/src/MbedUdp.cpp @@ -1,217 +1,273 @@ #include "MbedUdp.h" -arduino::MbedUDP::MbedUDP() { - _packet_buffer = new uint8_t[WIFI_UDP_BUFFER_SIZE]; - _current_packet = NULL; - _current_packet_size = 0; - // if this allocation fails then ::begin will fail +arduino::MbedUDP::MbedUDP() +{ + _packet_buffer = new uint8_t[WIFI_UDP_BUFFER_SIZE]; + _current_packet = NULL; + _current_packet_size = 0; + // if this allocation fails then ::begin will fail } -arduino::MbedUDP::~MbedUDP() { - delete[] _packet_buffer; +arduino::MbedUDP::~MbedUDP() +{ + delete[] _packet_buffer; } -uint8_t arduino::MbedUDP::begin(uint16_t port) { - // success = 1, fail = 0 +uint8_t arduino::MbedUDP::begin(uint16_t port) +{ + // success = 1, fail = 0 - nsapi_error_t rt = _socket.open(getNetwork()); - if (rt != NSAPI_ERROR_OK) { - return 0; - } + nsapi_error_t rt = _socket.open(getNetwork()); - if (_socket.bind(port) < 0) { - return 0; //Failed to bind UDP Socket to port - } + if (rt != NSAPI_ERROR_OK) + { + return 0; + } - if (!_packet_buffer) { - return 0; - } + if (_socket.bind(port) < 0) + { + return 0; //Failed to bind UDP Socket to port + } - _socket.set_blocking(false); - _socket.set_timeout(0); + if (!_packet_buffer) + { + return 0; + } - return 1; + _socket.set_blocking(false); + _socket.set_timeout(0); + + return 1; } -uint8_t arduino::MbedUDP::beginMulticast(IPAddress ip, uint16_t port) { - // success = 1, fail = 0 - if (begin(port) != 1) { - return 0; - } +uint8_t arduino::MbedUDP::beginMulticast(IPAddress ip, uint16_t port) +{ + // success = 1, fail = 0 + if (begin(port) != 1) + { + return 0; + } - SocketAddress socketAddress = SocketHelpers::socketAddressFromIpAddress(ip, port); + SocketAddress socketAddress = SocketHelpers::socketAddressFromIpAddress(ip, port); - if (_socket.join_multicast_group(socketAddress) != NSAPI_ERROR_OK) { - printf("Error joining the multicast group\n"); - return 0; - } + if (_socket.join_multicast_group(socketAddress) != NSAPI_ERROR_OK) + { + printf("Error joining the multicast group\n"); + return 0; + } - return 1; + return 1; } -void arduino::MbedUDP::stop() { - _socket.close(); +void arduino::MbedUDP::stop() +{ + _socket.close(); } -int arduino::MbedUDP::beginPacket(IPAddress ip, uint16_t port) { - _host = SocketHelpers::socketAddressFromIpAddress(ip, port); - //If IP is null and port is 0 the initialization failed - txBuffer.clear(); - return (_host.get_ip_address() == nullptr && _host.get_port() == 0) ? 0 : 1; +int arduino::MbedUDP::beginPacket(IPAddress ip, uint16_t port) +{ + _host = SocketHelpers::socketAddressFromIpAddress(ip, port); + //If IP is null and port is 0 the initialization failed + txBuffer.clear(); + return (_host.get_ip_address() == nullptr && _host.get_port() == 0) ? 0 : 1; } -int arduino::MbedUDP::beginPacket(const char *host, uint16_t port) { - _host = SocketAddress(host, port); - txBuffer.clear(); - getNetwork()->gethostbyname(host, &_host); - //If IP is null and port is 0 the initialization failed - return (_host.get_ip_address() == nullptr && _host.get_port() == 0) ? 0 : 1; +int arduino::MbedUDP::beginPacket(const char *host, uint16_t port) +{ + _host = SocketAddress(host, port); + txBuffer.clear(); + getNetwork()->gethostbyname(host, &_host); + //If IP is null and port is 0 the initialization failed + return (_host.get_ip_address() == nullptr && _host.get_port() == 0) ? 0 : 1; } -int arduino::MbedUDP::endPacket() { - _socket.set_blocking(true); - _socket.set_timeout(1000); +int arduino::MbedUDP::endPacket() +{ + _socket.set_blocking(true); + _socket.set_timeout(1000); + + size_t size = txBuffer.available(); + uint8_t buffer[size]; + + for (int i = 0; i < size; i++) + { + buffer[i] = txBuffer.read_char(); + } + + nsapi_size_or_error_t ret = _socket.sendto(_host, buffer, size); + _socket.set_blocking(false); + _socket.set_timeout(0); - size_t size = txBuffer.available(); - uint8_t buffer[size]; - for (int i = 0; i < size; i++) { - buffer[i] = txBuffer.read_char(); - } + if (ret < 0) + { + return 0; + } - nsapi_size_or_error_t ret = _socket.sendto(_host, buffer, size); - _socket.set_blocking(false); - _socket.set_timeout(0); - if (ret < 0) { - return 0; - } - return size; + return size; } // Write a single byte into the packet -size_t arduino::MbedUDP::write(uint8_t byte) { - return write(&byte, 1); +size_t arduino::MbedUDP::write(uint8_t byte) +{ + return write(&byte, 1); } // Write size bytes from buffer into the packet -size_t arduino::MbedUDP::write(const uint8_t *buffer, size_t size) { - for (int i = 0; i _packet_buffer + _current_packet_size) { - // try reading the next packet... - if (parsePacket() > 0) { - // if so, read first byte of next packet; - return read(); - } else { - // no new data... not sure what to return here now - return -1; - } - } - - return _current_packet[0]; +int arduino::MbedUDP::read() +{ + // no current packet... + if (_current_packet == NULL) + { + // try reading the next frame, if there is no data return + if (parsePacket() == 0) + return -1; + } + + _current_packet++; + + // check for overflow + if (_current_packet > _packet_buffer + _current_packet_size) + { + // try reading the next packet... + if (parsePacket() > 0) + { + // if so, read first byte of next packet; + return read(); + } + else + { + // no new data... not sure what to return here now + return -1; + } + } + + return _current_packet[0]; } // Read up to len bytes from the current packet and place them into buffer // Returns the number of bytes read, or 0 if none are available -int arduino::MbedUDP::read(unsigned char *buffer, size_t len) { - // Q: does Arduino read() function handle fragmentation? I won't for now... - if (_current_packet == NULL) { - if (parsePacket() == 0) return 0; - } - - // how much data do we have in the current packet? - int offset = _current_packet - _packet_buffer; - if (offset < 0) { - return 0; - } - - int max_bytes = _current_packet_size - offset; - if (max_bytes < 0) { - return 0; - } - - // at the end of the packet? - if (max_bytes == 0) { - // try read next packet... - if (parsePacket() > 0) { - return read(buffer, len); - } else { - return 0; - } - } - - if (len > (size_t)max_bytes) len = max_bytes; - - // copy to target buffer - memcpy(buffer, _current_packet, len); - - _current_packet += len; - - return len; +int arduino::MbedUDP::read(unsigned char *buffer, size_t len) +{ + // Q: does Arduino read() function handle fragmentation? I won't for now... + if (_current_packet == NULL) + { + if (parsePacket() == 0) + return 0; + } + + // how much data do we have in the current packet? + int offset = _current_packet - _packet_buffer; + + if (offset < 0) + { + return 0; + } + + int max_bytes = _current_packet_size - offset; + + if (max_bytes < 0) + { + return 0; + } + + // at the end of the packet? + if (max_bytes == 0) + { + // try read next packet... + if (parsePacket() > 0) + { + return read(buffer, len); + } + else + { + return 0; + } + } + + if (len > (size_t)max_bytes) + len = max_bytes; + + // copy to target buffer + memcpy(buffer, _current_packet, len); + + _current_packet += len; + + return len; } -IPAddress arduino::MbedUDP::remoteIP() { - nsapi_addr_t address = _remoteHost.get_addr(); - return IPAddress(address.bytes[0], address.bytes[1], address.bytes[2], address.bytes[3]); +IPAddress arduino::MbedUDP::remoteIP() +{ + nsapi_addr_t address = _remoteHost.get_addr(); + return IPAddress(address.bytes[0], address.bytes[1], address.bytes[2], address.bytes[3]); } -uint16_t arduino::MbedUDP::remotePort() { - return _remoteHost.get_port(); +uint16_t arduino::MbedUDP::remotePort() +{ + return _remoteHost.get_port(); } -void arduino::MbedUDP::flush() { - // TODO: a real check to ensure transmission has been completed +void arduino::MbedUDP::flush() +{ + // TODO: a real check to ensure transmission has been completed } -int arduino::MbedUDP::peek() { - if (_current_packet_size < 1) { - return -1; - } +int arduino::MbedUDP::peek() +{ + if (_current_packet_size < 1) + { + return -1; + } - return _current_packet[0]; + return _current_packet[0]; } diff --git a/Packages_Patches/arduino/hardware/mbed_portenta/2.4.1/libraries/SocketWrapper/src/MbedUdp.h b/Packages_Patches/arduino/hardware/mbed_portenta/2.4.1/libraries/SocketWrapper/src/MbedUdp.h index 7f81edec..cc28266c 100644 --- a/Packages_Patches/arduino/hardware/mbed_portenta/2.4.1/libraries/SocketWrapper/src/MbedUdp.h +++ b/Packages_Patches/arduino/hardware/mbed_portenta/2.4.1/libraries/SocketWrapper/src/MbedUdp.h @@ -25,79 +25,82 @@ #include "netsocket/UDPSocket.h" #ifndef WIFI_UDP_BUFFER_SIZE -#define WIFI_UDP_BUFFER_SIZE 508 + #define WIFI_UDP_BUFFER_SIZE 508 #endif -namespace arduino { - -class MbedUDP : public UDP { -private: - UDPSocket _socket; // Mbed OS socket - SocketAddress _host; // Host to be used to send data - SocketAddress _remoteHost; // Remote host that sent incoming packets - - uint8_t* _packet_buffer; // Raw packet buffer (contains data we got from the UDPSocket) - - // The Arduino APIs allow you to iterate through this buffer, so we need to be able to iterate over the current packet - // these two variables are used to cache the state of the current packet - uint8_t* _current_packet; - size_t _current_packet_size; - - RingBufferN txBuffer; - -protected: - virtual NetworkInterface* getNetwork() = 0; - -public: - MbedUDP(); // Constructor - ~MbedUDP(); - virtual uint8_t begin(uint16_t); // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use - virtual uint8_t beginMulticast(IPAddress, uint16_t); // initialize, start listening on specified multicast IP address and port. Returns 1 if successful, 0 if there are no sockets available to use - virtual void stop(); // Finish with the UDP socket - - // Sending UDP packets - - // Start building up a packet to send to the remote host specific in ip and port - // Returns 1 if successful, 0 if there was a problem with the supplied IP address or port - virtual int beginPacket(IPAddress ip, uint16_t port); - // Start building up a packet to send to the remote host specific in host and port - // Returns 1 if successful, 0 if there was a problem resolving the hostname or port - virtual int beginPacket(const char* host, uint16_t port); - // Finish off this packet and send it - // Returns 1 if the packet was sent successfully, 0 if there was an error - virtual int endPacket(); - // Write a single byte into the packet - virtual size_t write(uint8_t); - // Write size bytes from buffer into the packet - virtual size_t write(const uint8_t* buffer, size_t size); - - using Print::write; - - // Start processing the next available incoming packet - // Returns the size of the packet in bytes, or 0 if no packets are available - virtual int parsePacket(); - // Number of bytes remaining in the current packet - virtual int available(); - // Read a single byte from the current packet - virtual int read(); - // Read up to len bytes from the current packet and place them into buffer - // Returns the number of bytes read, or 0 if none are available - virtual int read(unsigned char* buffer, size_t len); - // Read up to len characters from the current packet and place them into buffer - // Returns the number of characters read, or 0 if none are available - virtual int read(char* buffer, size_t len) { - return read((unsigned char*)buffer, len); - }; - // Return the next byte from the current packet without moving on to the next byte - virtual int peek(); - virtual void flush(); // Finish reading the current packet - - // Return the IP address of the host who sent the current incoming packet - virtual IPAddress remoteIP(); - // // Return the port of the host who sent the current incoming packet - virtual uint16_t remotePort(); - - friend class MbedSocketClass; +namespace arduino +{ + +class MbedUDP : public UDP +{ + private: + UDPSocket _socket; // Mbed OS socket + SocketAddress _host; // Host to be used to send data + SocketAddress _remoteHost; // Remote host that sent incoming packets + + uint8_t* _packet_buffer; // Raw packet buffer (contains data we got from the UDPSocket) + + // The Arduino APIs allow you to iterate through this buffer, so we need to be able to iterate over the current packet + // these two variables are used to cache the state of the current packet + uint8_t* _current_packet; + size_t _current_packet_size; + + RingBufferN txBuffer; + + protected: + virtual NetworkInterface* getNetwork() = 0; + + public: + MbedUDP(); // Constructor + ~MbedUDP(); + virtual uint8_t begin(uint16_t); // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use + virtual uint8_t beginMulticast(IPAddress, uint16_t); // initialize, start listening on specified multicast IP address and port. Returns 1 if successful, 0 if there are no sockets available to use + virtual void stop(); // Finish with the UDP socket + + // Sending UDP packets + + // Start building up a packet to send to the remote host specific in ip and port + // Returns 1 if successful, 0 if there was a problem with the supplied IP address or port + virtual int beginPacket(IPAddress ip, uint16_t port); + // Start building up a packet to send to the remote host specific in host and port + // Returns 1 if successful, 0 if there was a problem resolving the hostname or port + virtual int beginPacket(const char* host, uint16_t port); + // Finish off this packet and send it + // Returns 1 if the packet was sent successfully, 0 if there was an error + virtual int endPacket(); + // Write a single byte into the packet + virtual size_t write(uint8_t); + // Write size bytes from buffer into the packet + virtual size_t write(const uint8_t* buffer, size_t size); + + using Print::write; + + // Start processing the next available incoming packet + // Returns the size of the packet in bytes, or 0 if no packets are available + virtual int parsePacket(); + // Number of bytes remaining in the current packet + virtual int available(); + // Read a single byte from the current packet + virtual int read(); + // Read up to len bytes from the current packet and place them into buffer + // Returns the number of bytes read, or 0 if none are available + virtual int read(unsigned char* buffer, size_t len); + // Read up to len characters from the current packet and place them into buffer + // Returns the number of characters read, or 0 if none are available + virtual int read(char* buffer, size_t len) + { + return read((unsigned char*)buffer, len); + }; + // Return the next byte from the current packet without moving on to the next byte + virtual int peek(); + virtual void flush(); // Finish reading the current packet + + // Return the IP address of the host who sent the current incoming packet + virtual IPAddress remoteIP(); + // // Return the port of the host who sent the current incoming packet + virtual uint16_t remotePort(); + + friend class MbedSocketClass; }; } diff --git a/Packages_Patches/arduino/hardware/mbed_portenta/2.5.2/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h b/Packages_Patches/arduino/hardware/mbed_portenta/2.5.2/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h index 84c18cf1..bd98fb95 100644 --- a/Packages_Patches/arduino/hardware/mbed_portenta/2.5.2/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h +++ b/Packages_Patches/arduino/hardware/mbed_portenta/2.5.2/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h @@ -1,28 +1,28 @@ /* Copyright (C) 2012 mbed.org, MIT License - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software - * and associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, - * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or - * substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING - * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software + and associated documentation files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, publish, distribute, + sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or + substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ #ifndef LWIPOPTS_H #define LWIPOPTS_H // Workaround for Linux timeval #if defined (TOOLCHAIN_GCC) -#define LWIP_TIMEVAL_PRIVATE 0 -#include + #define LWIP_TIMEVAL_PRIVATE 0 + #include #endif #include "nsapi_types.h" #include "mbed_retarget.h" @@ -35,7 +35,7 @@ #define NO_SYS 0 #if !MBED_CONF_LWIP_IPV4_ENABLED && !MBED_CONF_LWIP_IPV6_ENABLED -#error "Either IPv4 or IPv6 must be enabled." + #error "Either IPv4 or IPv6 must be enabled." #endif #define LWIP_IPV4 MBED_CONF_LWIP_IPV4_ENABLED @@ -47,16 +47,16 @@ // On dual stack configuration how long to wait for both or preferred stack // addresses before completing bring up. #if LWIP_IPV4 && LWIP_IPV6 -#if MBED_CONF_LWIP_ADDR_TIMEOUT_MODE -#define BOTH_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT -#define PREF_ADDR_TIMEOUT 0 -#else -#define PREF_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT -#define BOTH_ADDR_TIMEOUT 0 -#endif + #if MBED_CONF_LWIP_ADDR_TIMEOUT_MODE + #define BOTH_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT + #define PREF_ADDR_TIMEOUT 0 + #else + #define PREF_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT + #define BOTH_ADDR_TIMEOUT 0 + #endif #else -#define PREF_ADDR_TIMEOUT 0 -#define BOTH_ADDR_TIMEOUT 0 + #define PREF_ADDR_TIMEOUT 0 + #define BOTH_ADDR_TIMEOUT 0 #endif @@ -68,52 +68,52 @@ #define PREF_IPV6 2 #if MBED_CONF_LWIP_IP_VER_PREF == 6 -#define IP_VERSION_PREF PREF_IPV6 + #define IP_VERSION_PREF PREF_IPV6 #elif MBED_CONF_LWIP_IP_VER_PREF == 4 -#define IP_VERSION_PREF PREF_IPV4 + #define IP_VERSION_PREF PREF_IPV4 #else -#error "Either IPv4 or IPv6 must be preferred." + #error "Either IPv4 or IPv6 must be preferred." #endif #undef LWIP_DEBUG #if MBED_CONF_LWIP_DEBUG_ENABLED -#define LWIP_DEBUG 1 + #define LWIP_DEBUG 1 #endif #if NO_SYS == 0 -#include "cmsis_os2.h" + #include "cmsis_os2.h" -#define SYS_LIGHTWEIGHT_PROT 1 + #define SYS_LIGHTWEIGHT_PROT 1 -#define LWIP_RAW MBED_CONF_LWIP_RAW_SOCKET_ENABLED + #define LWIP_RAW MBED_CONF_LWIP_RAW_SOCKET_ENABLED -#define MEMP_NUM_TCPIP_MSG_INPKT MBED_CONF_LWIP_MEMP_NUM_TCPIP_MSG_INPKT + #define MEMP_NUM_TCPIP_MSG_INPKT MBED_CONF_LWIP_MEMP_NUM_TCPIP_MSG_INPKT -// Thread stacks use 8-byte alignment -#define LWIP_ALIGN_UP(pos, align) ((pos) % (align) ? (pos) + ((align) - (pos) % (align)) : (pos)) + // Thread stacks use 8-byte alignment + #define LWIP_ALIGN_UP(pos, align) ((pos) % (align) ? (pos) + ((align) - (pos) % (align)) : (pos)) -#ifdef LWIP_DEBUG -// For LWIP debug, double the stack -#define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE*2, 8) -#elif MBED_DEBUG -// When debug is enabled on the build increase stack 25 percent -#define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE + MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE / 4, 8) -#else -#define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE, 8) -#endif + #ifdef LWIP_DEBUG + // For LWIP debug, double the stack + #define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE*2, 8) + #elif MBED_DEBUG + // When debug is enabled on the build increase stack 25 percent + #define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE + MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE / 4, 8) + #else + #define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE, 8) + #endif -// Thread priority (osPriorityNormal by default) -#define TCPIP_THREAD_PRIO (MBED_CONF_LWIP_TCPIP_THREAD_PRIORITY) + // Thread priority (osPriorityNormal by default) + #define TCPIP_THREAD_PRIO (MBED_CONF_LWIP_TCPIP_THREAD_PRIORITY) -#ifdef LWIP_DEBUG -#define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE*2, 8) -#else -#define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE, 8) -#endif + #ifdef LWIP_DEBUG + #define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE*2, 8) + #else + #define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE, 8) + #endif -#define MEMP_NUM_SYS_TIMEOUT 16 + #define MEMP_NUM_SYS_TIMEOUT 16 -#define sys_msleep(ms) sys_msleep(ms) + #define sys_msleep(ms) sys_msleep(ms) #endif @@ -143,16 +143,16 @@ #define PBUF_POOL_SIZE MBED_CONF_LWIP_PBUF_POOL_SIZE #ifdef MBED_CONF_LWIP_PBUF_POOL_BUFSIZE -#undef PBUF_POOL_BUFSIZE -#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(MBED_CONF_LWIP_PBUF_POOL_BUFSIZE) + #undef PBUF_POOL_BUFSIZE + #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(MBED_CONF_LWIP_PBUF_POOL_BUFSIZE) #else -#ifndef PBUF_POOL_BUFSIZE -#if LWIP_IPV6 -#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) -#elif LWIP_IPV4 -#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+20+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) -#endif -#endif + #ifndef PBUF_POOL_BUFSIZE + #if LWIP_IPV6 + #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) + #elif LWIP_IPV4 + #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+20+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) + #endif + #endif #endif #define MEM_SIZE MBED_CONF_LWIP_MEM_SIZE @@ -181,14 +181,14 @@ #define MEMP_NUM_NETCONN MBED_CONF_LWIP_SOCKET_MAX #if MBED_CONF_LWIP_TCP_ENABLED -#define LWIP_TCP 1 -#define TCP_OVERSIZE 0 -#define LWIP_TCP_KEEPALIVE 1 + #define LWIP_TCP 1 + #define TCP_OVERSIZE 0 + #define LWIP_TCP_KEEPALIVE 1 -#define TCP_CLOSE_TIMEOUT MBED_CONF_LWIP_TCP_CLOSE_TIMEOUT + #define TCP_CLOSE_TIMEOUT MBED_CONF_LWIP_TCP_CLOSE_TIMEOUT #else -#define LWIP_TCP 0 + #define LWIP_TCP 0 #endif #define LWIP_DNS 1 @@ -251,13 +251,13 @@ #define UDP_LPC_EMAC LWIP_DBG_OFF #ifdef LWIP_DEBUG -#define MEMP_OVERFLOW_CHECK 1 -#define MEMP_SANITY_CHECK 1 -#define LWIP_DBG_TYPES_ON LWIP_DBG_ON -#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL + #define MEMP_OVERFLOW_CHECK 1 + #define MEMP_SANITY_CHECK 1 + #define LWIP_DBG_TYPES_ON LWIP_DBG_ON + #define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL #else -#define LWIP_NOASSERT 1 -#define LWIP_STATS 0 + #define LWIP_NOASSERT 1 + #define LWIP_STATS 0 #endif #define TRACE_TO_ASCII_HEX_DUMP 0 @@ -269,18 +269,18 @@ // Interface type configuration #if MBED_CONF_LWIP_ETHERNET_ENABLED -#define LWIP_ARP 1 -#define LWIP_ETHERNET 1 -#define LWIP_DHCP LWIP_IPV4 + #define LWIP_ARP 1 + #define LWIP_ETHERNET 1 + #define LWIP_DHCP LWIP_IPV4 #else -#define LWIP_ARP 0 -#define LWIP_ETHERNET 0 + #define LWIP_ARP 0 + #define LWIP_ETHERNET 0 #endif // MBED_CONF_LWIP_ETHERNET_ENABLED #if MBED_CONF_LWIP_L3IP_ENABLED -#define LWIP_L3IP 1 + #define LWIP_L3IP 1 #else -#define LWIP_L3IP 0 + #define LWIP_L3IP 0 #endif //Maximum size of network interface name @@ -291,27 +291,27 @@ // Enable PPP for now either from lwIP PPP configuration (obsolete) or from PPP service configuration #if MBED_CONF_PPP_ENABLED || MBED_CONF_LWIP_PPP_ENABLED -#define PPP_SUPPORT 1 - -#if MBED_CONF_PPP_IPV4_ENABLED || MBED_CONF_LWIP_IPV4_ENABLED -#define LWIP 0x11991199 -#if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV4_ENABLED -#error LWIP: IPv4 PPP enabled but not IPv4 -#endif -#undef LWIP -#define PPP_IPV4_SUPPORT 1 -#endif - -#if MBED_CONF_PPP_IPV6_ENABLED || MBED_CONF_LWIP_IPV6_ENABLED -#define LWIP 0x11991199 -#if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV6_ENABLED -#error LWIP: IPv6 PPP enabled but not IPv6 -#endif -#undef LWIP -#define PPP_IPV6_SUPPORT 1 -// Later to be dynamic for use for multiple interfaces -#define LWIP_IPV6_DUP_DETECT_ATTEMPTS 0 -#endif + #define PPP_SUPPORT 1 + + #if MBED_CONF_PPP_IPV4_ENABLED || MBED_CONF_LWIP_IPV4_ENABLED + #define LWIP 0x11991199 + #if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV4_ENABLED + #error LWIP: IPv4 PPP enabled but not IPv4 + #endif + #undef LWIP + #define PPP_IPV4_SUPPORT 1 + #endif + + #if MBED_CONF_PPP_IPV6_ENABLED || MBED_CONF_LWIP_IPV6_ENABLED + #define LWIP 0x11991199 + #if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV6_ENABLED + #error LWIP: IPv6 PPP enabled but not IPv6 + #endif + #undef LWIP + #define PPP_IPV6_SUPPORT 1 + // Later to be dynamic for use for multiple interfaces + #define LWIP_IPV6_DUP_DETECT_ATTEMPTS 0 + #endif #endif @@ -320,7 +320,7 @@ // Make sure we default these to off, so // LWIP doesn't default to on #ifndef LWIP_ARP -#define LWIP_ARP 0 + #define LWIP_ARP 0 #endif // Checksum-on-copy disabled due to https://savannah.nongnu.org/bugs/?50914 @@ -337,9 +337,9 @@ #include "lwip_tcp_isn.h" #define LWIP_HOOK_TCP_ISN lwip_hook_tcp_isn #ifdef MBEDTLS_MD5_C -#define LWIP_USE_EXTERNAL_MBEDTLS 1 + #define LWIP_USE_EXTERNAL_MBEDTLS 1 #else -#define LWIP_USE_EXTERNAL_MBEDTLS 0 + #define LWIP_USE_EXTERNAL_MBEDTLS 0 #endif #define LWIP_ND6_RDNSS_MAX_DNS_SERVERS MBED_CONF_LWIP_ND6_RDNSS_MAX_DNS_SERVERS diff --git a/Packages_Patches/arduino/hardware/mbed_portenta/2.5.2/libraries/SocketWrapper/src/MbedUdp.cpp b/Packages_Patches/arduino/hardware/mbed_portenta/2.5.2/libraries/SocketWrapper/src/MbedUdp.cpp index 2a1b0fc2..81399f3c 100644 --- a/Packages_Patches/arduino/hardware/mbed_portenta/2.5.2/libraries/SocketWrapper/src/MbedUdp.cpp +++ b/Packages_Patches/arduino/hardware/mbed_portenta/2.5.2/libraries/SocketWrapper/src/MbedUdp.cpp @@ -1,217 +1,273 @@ #include "MbedUdp.h" -arduino::MbedUDP::MbedUDP() { - _packet_buffer = new uint8_t[WIFI_UDP_BUFFER_SIZE]; - _current_packet = NULL; - _current_packet_size = 0; - // if this allocation fails then ::begin will fail +arduino::MbedUDP::MbedUDP() +{ + _packet_buffer = new uint8_t[WIFI_UDP_BUFFER_SIZE]; + _current_packet = NULL; + _current_packet_size = 0; + // if this allocation fails then ::begin will fail } -arduino::MbedUDP::~MbedUDP() { - delete[] _packet_buffer; +arduino::MbedUDP::~MbedUDP() +{ + delete[] _packet_buffer; } -uint8_t arduino::MbedUDP::begin(uint16_t port) { - // success = 1, fail = 0 +uint8_t arduino::MbedUDP::begin(uint16_t port) +{ + // success = 1, fail = 0 - nsapi_error_t rt = _socket.open(getNetwork()); - if (rt != NSAPI_ERROR_OK) { - return 0; - } + nsapi_error_t rt = _socket.open(getNetwork()); - if (_socket.bind(port) < 0) { - return 0; //Failed to bind UDP Socket to port - } + if (rt != NSAPI_ERROR_OK) + { + return 0; + } - if (!_packet_buffer) { - return 0; - } + if (_socket.bind(port) < 0) + { + return 0; //Failed to bind UDP Socket to port + } - _socket.set_blocking(false); - _socket.set_timeout(0); + if (!_packet_buffer) + { + return 0; + } - return 1; + _socket.set_blocking(false); + _socket.set_timeout(0); + + return 1; } -uint8_t arduino::MbedUDP::beginMulticast(IPAddress ip, uint16_t port) { - // success = 1, fail = 0 - if (begin(port) != 1) { - return 0; - } +uint8_t arduino::MbedUDP::beginMulticast(IPAddress ip, uint16_t port) +{ + // success = 1, fail = 0 + if (begin(port) != 1) + { + return 0; + } - SocketAddress socketAddress = SocketHelpers::socketAddressFromIpAddress(ip, port); + SocketAddress socketAddress = SocketHelpers::socketAddressFromIpAddress(ip, port); - if (_socket.join_multicast_group(socketAddress) != NSAPI_ERROR_OK) { - printf("Error joining the multicast group\n"); - return 0; - } + if (_socket.join_multicast_group(socketAddress) != NSAPI_ERROR_OK) + { + printf("Error joining the multicast group\n"); + return 0; + } - return 1; + return 1; } -void arduino::MbedUDP::stop() { - _socket.close(); +void arduino::MbedUDP::stop() +{ + _socket.close(); } -int arduino::MbedUDP::beginPacket(IPAddress ip, uint16_t port) { - _host = SocketHelpers::socketAddressFromIpAddress(ip, port); - //If IP is null and port is 0 the initialization failed - txBuffer.clear(); - return (_host.get_ip_address() == nullptr && _host.get_port() == 0) ? 0 : 1; +int arduino::MbedUDP::beginPacket(IPAddress ip, uint16_t port) +{ + _host = SocketHelpers::socketAddressFromIpAddress(ip, port); + //If IP is null and port is 0 the initialization failed + txBuffer.clear(); + return (_host.get_ip_address() == nullptr && _host.get_port() == 0) ? 0 : 1; } -int arduino::MbedUDP::beginPacket(const char *host, uint16_t port) { - _host = SocketAddress(host, port); - txBuffer.clear(); - getNetwork()->gethostbyname(host, &_host); - //If IP is null and port is 0 the initialization failed - return (_host.get_ip_address() == nullptr && _host.get_port() == 0) ? 0 : 1; +int arduino::MbedUDP::beginPacket(const char *host, uint16_t port) +{ + _host = SocketAddress(host, port); + txBuffer.clear(); + getNetwork()->gethostbyname(host, &_host); + //If IP is null and port is 0 the initialization failed + return (_host.get_ip_address() == nullptr && _host.get_port() == 0) ? 0 : 1; } -int arduino::MbedUDP::endPacket() { - _socket.set_blocking(true); - _socket.set_timeout(1000); +int arduino::MbedUDP::endPacket() +{ + _socket.set_blocking(true); + _socket.set_timeout(1000); + + size_t size = txBuffer.available(); + uint8_t buffer[size]; + + for (int i = 0; i < size; i++) + { + buffer[i] = txBuffer.read_char(); + } + + nsapi_size_or_error_t ret = _socket.sendto(_host, buffer, size); + _socket.set_blocking(false); + _socket.set_timeout(0); - size_t size = txBuffer.available(); - uint8_t buffer[size]; - for (int i = 0; i < size; i++) { - buffer[i] = txBuffer.read_char(); - } + if (ret < 0) + { + return 0; + } - nsapi_size_or_error_t ret = _socket.sendto(_host, buffer, size); - _socket.set_blocking(false); - _socket.set_timeout(0); - if (ret < 0) { - return 0; - } - return size; + return size; } // Write a single byte into the packet -size_t arduino::MbedUDP::write(uint8_t byte) { - return write(&byte, 1); +size_t arduino::MbedUDP::write(uint8_t byte) +{ + return write(&byte, 1); } // Write size bytes from buffer into the packet -size_t arduino::MbedUDP::write(const uint8_t *buffer, size_t size) { - for (int i = 0; i _packet_buffer + _current_packet_size) { - // try reading the next packet... - if (parsePacket() > 0) { - // if so, read first byte of next packet; - return read(); - } else { - // no new data... not sure what to return here now - return -1; - } - } - - return _current_packet[0]; +int arduino::MbedUDP::read() +{ + // no current packet... + if (_current_packet == NULL) + { + // try reading the next frame, if there is no data return + if (parsePacket() == 0) + return -1; + } + + _current_packet++; + + // check for overflow + if (_current_packet > _packet_buffer + _current_packet_size) + { + // try reading the next packet... + if (parsePacket() > 0) + { + // if so, read first byte of next packet; + return read(); + } + else + { + // no new data... not sure what to return here now + return -1; + } + } + + return _current_packet[0]; } // Read up to len bytes from the current packet and place them into buffer // Returns the number of bytes read, or 0 if none are available -int arduino::MbedUDP::read(unsigned char *buffer, size_t len) { - // Q: does Arduino read() function handle fragmentation? I won't for now... - if (_current_packet == NULL) { - if (parsePacket() == 0) return 0; - } - - // how much data do we have in the current packet? - int offset = _current_packet - _packet_buffer; - if (offset < 0) { - return 0; - } - - int max_bytes = _current_packet_size - offset; - if (max_bytes < 0) { - return 0; - } - - // at the end of the packet? - if (max_bytes == 0) { - // try read next packet... - if (parsePacket() > 0) { - return read(buffer, len); - } else { - return 0; - } - } - - if (len > (size_t)max_bytes) len = max_bytes; - - // copy to target buffer - memcpy(buffer, _current_packet, len); - - _current_packet += len; - - return len; +int arduino::MbedUDP::read(unsigned char *buffer, size_t len) +{ + // Q: does Arduino read() function handle fragmentation? I won't for now... + if (_current_packet == NULL) + { + if (parsePacket() == 0) + return 0; + } + + // how much data do we have in the current packet? + int offset = _current_packet - _packet_buffer; + + if (offset < 0) + { + return 0; + } + + int max_bytes = _current_packet_size - offset; + + if (max_bytes < 0) + { + return 0; + } + + // at the end of the packet? + if (max_bytes == 0) + { + // try read next packet... + if (parsePacket() > 0) + { + return read(buffer, len); + } + else + { + return 0; + } + } + + if (len > (size_t)max_bytes) + len = max_bytes; + + // copy to target buffer + memcpy(buffer, _current_packet, len); + + _current_packet += len; + + return len; } -IPAddress arduino::MbedUDP::remoteIP() { - nsapi_addr_t address = _remoteHost.get_addr(); - return IPAddress(address.bytes[0], address.bytes[1], address.bytes[2], address.bytes[3]); +IPAddress arduino::MbedUDP::remoteIP() +{ + nsapi_addr_t address = _remoteHost.get_addr(); + return IPAddress(address.bytes[0], address.bytes[1], address.bytes[2], address.bytes[3]); } -uint16_t arduino::MbedUDP::remotePort() { - return _remoteHost.get_port(); +uint16_t arduino::MbedUDP::remotePort() +{ + return _remoteHost.get_port(); } -void arduino::MbedUDP::flush() { - // TODO: a real check to ensure transmission has been completed +void arduino::MbedUDP::flush() +{ + // TODO: a real check to ensure transmission has been completed } -int arduino::MbedUDP::peek() { - if (_current_packet_size < 1) { - return -1; - } +int arduino::MbedUDP::peek() +{ + if (_current_packet_size < 1) + { + return -1; + } - return _current_packet[0]; + return _current_packet[0]; } diff --git a/Packages_Patches/arduino/hardware/mbed_portenta/2.5.2/libraries/SocketWrapper/src/MbedUdp.h b/Packages_Patches/arduino/hardware/mbed_portenta/2.5.2/libraries/SocketWrapper/src/MbedUdp.h index 7f81edec..cc28266c 100644 --- a/Packages_Patches/arduino/hardware/mbed_portenta/2.5.2/libraries/SocketWrapper/src/MbedUdp.h +++ b/Packages_Patches/arduino/hardware/mbed_portenta/2.5.2/libraries/SocketWrapper/src/MbedUdp.h @@ -25,79 +25,82 @@ #include "netsocket/UDPSocket.h" #ifndef WIFI_UDP_BUFFER_SIZE -#define WIFI_UDP_BUFFER_SIZE 508 + #define WIFI_UDP_BUFFER_SIZE 508 #endif -namespace arduino { - -class MbedUDP : public UDP { -private: - UDPSocket _socket; // Mbed OS socket - SocketAddress _host; // Host to be used to send data - SocketAddress _remoteHost; // Remote host that sent incoming packets - - uint8_t* _packet_buffer; // Raw packet buffer (contains data we got from the UDPSocket) - - // The Arduino APIs allow you to iterate through this buffer, so we need to be able to iterate over the current packet - // these two variables are used to cache the state of the current packet - uint8_t* _current_packet; - size_t _current_packet_size; - - RingBufferN txBuffer; - -protected: - virtual NetworkInterface* getNetwork() = 0; - -public: - MbedUDP(); // Constructor - ~MbedUDP(); - virtual uint8_t begin(uint16_t); // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use - virtual uint8_t beginMulticast(IPAddress, uint16_t); // initialize, start listening on specified multicast IP address and port. Returns 1 if successful, 0 if there are no sockets available to use - virtual void stop(); // Finish with the UDP socket - - // Sending UDP packets - - // Start building up a packet to send to the remote host specific in ip and port - // Returns 1 if successful, 0 if there was a problem with the supplied IP address or port - virtual int beginPacket(IPAddress ip, uint16_t port); - // Start building up a packet to send to the remote host specific in host and port - // Returns 1 if successful, 0 if there was a problem resolving the hostname or port - virtual int beginPacket(const char* host, uint16_t port); - // Finish off this packet and send it - // Returns 1 if the packet was sent successfully, 0 if there was an error - virtual int endPacket(); - // Write a single byte into the packet - virtual size_t write(uint8_t); - // Write size bytes from buffer into the packet - virtual size_t write(const uint8_t* buffer, size_t size); - - using Print::write; - - // Start processing the next available incoming packet - // Returns the size of the packet in bytes, or 0 if no packets are available - virtual int parsePacket(); - // Number of bytes remaining in the current packet - virtual int available(); - // Read a single byte from the current packet - virtual int read(); - // Read up to len bytes from the current packet and place them into buffer - // Returns the number of bytes read, or 0 if none are available - virtual int read(unsigned char* buffer, size_t len); - // Read up to len characters from the current packet and place them into buffer - // Returns the number of characters read, or 0 if none are available - virtual int read(char* buffer, size_t len) { - return read((unsigned char*)buffer, len); - }; - // Return the next byte from the current packet without moving on to the next byte - virtual int peek(); - virtual void flush(); // Finish reading the current packet - - // Return the IP address of the host who sent the current incoming packet - virtual IPAddress remoteIP(); - // // Return the port of the host who sent the current incoming packet - virtual uint16_t remotePort(); - - friend class MbedSocketClass; +namespace arduino +{ + +class MbedUDP : public UDP +{ + private: + UDPSocket _socket; // Mbed OS socket + SocketAddress _host; // Host to be used to send data + SocketAddress _remoteHost; // Remote host that sent incoming packets + + uint8_t* _packet_buffer; // Raw packet buffer (contains data we got from the UDPSocket) + + // The Arduino APIs allow you to iterate through this buffer, so we need to be able to iterate over the current packet + // these two variables are used to cache the state of the current packet + uint8_t* _current_packet; + size_t _current_packet_size; + + RingBufferN txBuffer; + + protected: + virtual NetworkInterface* getNetwork() = 0; + + public: + MbedUDP(); // Constructor + ~MbedUDP(); + virtual uint8_t begin(uint16_t); // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use + virtual uint8_t beginMulticast(IPAddress, uint16_t); // initialize, start listening on specified multicast IP address and port. Returns 1 if successful, 0 if there are no sockets available to use + virtual void stop(); // Finish with the UDP socket + + // Sending UDP packets + + // Start building up a packet to send to the remote host specific in ip and port + // Returns 1 if successful, 0 if there was a problem with the supplied IP address or port + virtual int beginPacket(IPAddress ip, uint16_t port); + // Start building up a packet to send to the remote host specific in host and port + // Returns 1 if successful, 0 if there was a problem resolving the hostname or port + virtual int beginPacket(const char* host, uint16_t port); + // Finish off this packet and send it + // Returns 1 if the packet was sent successfully, 0 if there was an error + virtual int endPacket(); + // Write a single byte into the packet + virtual size_t write(uint8_t); + // Write size bytes from buffer into the packet + virtual size_t write(const uint8_t* buffer, size_t size); + + using Print::write; + + // Start processing the next available incoming packet + // Returns the size of the packet in bytes, or 0 if no packets are available + virtual int parsePacket(); + // Number of bytes remaining in the current packet + virtual int available(); + // Read a single byte from the current packet + virtual int read(); + // Read up to len bytes from the current packet and place them into buffer + // Returns the number of bytes read, or 0 if none are available + virtual int read(unsigned char* buffer, size_t len); + // Read up to len characters from the current packet and place them into buffer + // Returns the number of characters read, or 0 if none are available + virtual int read(char* buffer, size_t len) + { + return read((unsigned char*)buffer, len); + }; + // Return the next byte from the current packet without moving on to the next byte + virtual int peek(); + virtual void flush(); // Finish reading the current packet + + // Return the IP address of the host who sent the current incoming packet + virtual IPAddress remoteIP(); + // // Return the port of the host who sent the current incoming packet + virtual uint16_t remotePort(); + + friend class MbedSocketClass; }; } diff --git a/Packages_Patches/arduino/hardware/mbed_portenta/2.6.1/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h b/Packages_Patches/arduino/hardware/mbed_portenta/2.6.1/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h index 84c18cf1..bd98fb95 100644 --- a/Packages_Patches/arduino/hardware/mbed_portenta/2.6.1/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h +++ b/Packages_Patches/arduino/hardware/mbed_portenta/2.6.1/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h @@ -1,28 +1,28 @@ /* Copyright (C) 2012 mbed.org, MIT License - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software - * and associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, - * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or - * substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING - * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software + and associated documentation files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, publish, distribute, + sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or + substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ #ifndef LWIPOPTS_H #define LWIPOPTS_H // Workaround for Linux timeval #if defined (TOOLCHAIN_GCC) -#define LWIP_TIMEVAL_PRIVATE 0 -#include + #define LWIP_TIMEVAL_PRIVATE 0 + #include #endif #include "nsapi_types.h" #include "mbed_retarget.h" @@ -35,7 +35,7 @@ #define NO_SYS 0 #if !MBED_CONF_LWIP_IPV4_ENABLED && !MBED_CONF_LWIP_IPV6_ENABLED -#error "Either IPv4 or IPv6 must be enabled." + #error "Either IPv4 or IPv6 must be enabled." #endif #define LWIP_IPV4 MBED_CONF_LWIP_IPV4_ENABLED @@ -47,16 +47,16 @@ // On dual stack configuration how long to wait for both or preferred stack // addresses before completing bring up. #if LWIP_IPV4 && LWIP_IPV6 -#if MBED_CONF_LWIP_ADDR_TIMEOUT_MODE -#define BOTH_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT -#define PREF_ADDR_TIMEOUT 0 -#else -#define PREF_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT -#define BOTH_ADDR_TIMEOUT 0 -#endif + #if MBED_CONF_LWIP_ADDR_TIMEOUT_MODE + #define BOTH_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT + #define PREF_ADDR_TIMEOUT 0 + #else + #define PREF_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT + #define BOTH_ADDR_TIMEOUT 0 + #endif #else -#define PREF_ADDR_TIMEOUT 0 -#define BOTH_ADDR_TIMEOUT 0 + #define PREF_ADDR_TIMEOUT 0 + #define BOTH_ADDR_TIMEOUT 0 #endif @@ -68,52 +68,52 @@ #define PREF_IPV6 2 #if MBED_CONF_LWIP_IP_VER_PREF == 6 -#define IP_VERSION_PREF PREF_IPV6 + #define IP_VERSION_PREF PREF_IPV6 #elif MBED_CONF_LWIP_IP_VER_PREF == 4 -#define IP_VERSION_PREF PREF_IPV4 + #define IP_VERSION_PREF PREF_IPV4 #else -#error "Either IPv4 or IPv6 must be preferred." + #error "Either IPv4 or IPv6 must be preferred." #endif #undef LWIP_DEBUG #if MBED_CONF_LWIP_DEBUG_ENABLED -#define LWIP_DEBUG 1 + #define LWIP_DEBUG 1 #endif #if NO_SYS == 0 -#include "cmsis_os2.h" + #include "cmsis_os2.h" -#define SYS_LIGHTWEIGHT_PROT 1 + #define SYS_LIGHTWEIGHT_PROT 1 -#define LWIP_RAW MBED_CONF_LWIP_RAW_SOCKET_ENABLED + #define LWIP_RAW MBED_CONF_LWIP_RAW_SOCKET_ENABLED -#define MEMP_NUM_TCPIP_MSG_INPKT MBED_CONF_LWIP_MEMP_NUM_TCPIP_MSG_INPKT + #define MEMP_NUM_TCPIP_MSG_INPKT MBED_CONF_LWIP_MEMP_NUM_TCPIP_MSG_INPKT -// Thread stacks use 8-byte alignment -#define LWIP_ALIGN_UP(pos, align) ((pos) % (align) ? (pos) + ((align) - (pos) % (align)) : (pos)) + // Thread stacks use 8-byte alignment + #define LWIP_ALIGN_UP(pos, align) ((pos) % (align) ? (pos) + ((align) - (pos) % (align)) : (pos)) -#ifdef LWIP_DEBUG -// For LWIP debug, double the stack -#define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE*2, 8) -#elif MBED_DEBUG -// When debug is enabled on the build increase stack 25 percent -#define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE + MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE / 4, 8) -#else -#define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE, 8) -#endif + #ifdef LWIP_DEBUG + // For LWIP debug, double the stack + #define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE*2, 8) + #elif MBED_DEBUG + // When debug is enabled on the build increase stack 25 percent + #define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE + MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE / 4, 8) + #else + #define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE, 8) + #endif -// Thread priority (osPriorityNormal by default) -#define TCPIP_THREAD_PRIO (MBED_CONF_LWIP_TCPIP_THREAD_PRIORITY) + // Thread priority (osPriorityNormal by default) + #define TCPIP_THREAD_PRIO (MBED_CONF_LWIP_TCPIP_THREAD_PRIORITY) -#ifdef LWIP_DEBUG -#define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE*2, 8) -#else -#define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE, 8) -#endif + #ifdef LWIP_DEBUG + #define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE*2, 8) + #else + #define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE, 8) + #endif -#define MEMP_NUM_SYS_TIMEOUT 16 + #define MEMP_NUM_SYS_TIMEOUT 16 -#define sys_msleep(ms) sys_msleep(ms) + #define sys_msleep(ms) sys_msleep(ms) #endif @@ -143,16 +143,16 @@ #define PBUF_POOL_SIZE MBED_CONF_LWIP_PBUF_POOL_SIZE #ifdef MBED_CONF_LWIP_PBUF_POOL_BUFSIZE -#undef PBUF_POOL_BUFSIZE -#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(MBED_CONF_LWIP_PBUF_POOL_BUFSIZE) + #undef PBUF_POOL_BUFSIZE + #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(MBED_CONF_LWIP_PBUF_POOL_BUFSIZE) #else -#ifndef PBUF_POOL_BUFSIZE -#if LWIP_IPV6 -#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) -#elif LWIP_IPV4 -#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+20+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) -#endif -#endif + #ifndef PBUF_POOL_BUFSIZE + #if LWIP_IPV6 + #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) + #elif LWIP_IPV4 + #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+20+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) + #endif + #endif #endif #define MEM_SIZE MBED_CONF_LWIP_MEM_SIZE @@ -181,14 +181,14 @@ #define MEMP_NUM_NETCONN MBED_CONF_LWIP_SOCKET_MAX #if MBED_CONF_LWIP_TCP_ENABLED -#define LWIP_TCP 1 -#define TCP_OVERSIZE 0 -#define LWIP_TCP_KEEPALIVE 1 + #define LWIP_TCP 1 + #define TCP_OVERSIZE 0 + #define LWIP_TCP_KEEPALIVE 1 -#define TCP_CLOSE_TIMEOUT MBED_CONF_LWIP_TCP_CLOSE_TIMEOUT + #define TCP_CLOSE_TIMEOUT MBED_CONF_LWIP_TCP_CLOSE_TIMEOUT #else -#define LWIP_TCP 0 + #define LWIP_TCP 0 #endif #define LWIP_DNS 1 @@ -251,13 +251,13 @@ #define UDP_LPC_EMAC LWIP_DBG_OFF #ifdef LWIP_DEBUG -#define MEMP_OVERFLOW_CHECK 1 -#define MEMP_SANITY_CHECK 1 -#define LWIP_DBG_TYPES_ON LWIP_DBG_ON -#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL + #define MEMP_OVERFLOW_CHECK 1 + #define MEMP_SANITY_CHECK 1 + #define LWIP_DBG_TYPES_ON LWIP_DBG_ON + #define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL #else -#define LWIP_NOASSERT 1 -#define LWIP_STATS 0 + #define LWIP_NOASSERT 1 + #define LWIP_STATS 0 #endif #define TRACE_TO_ASCII_HEX_DUMP 0 @@ -269,18 +269,18 @@ // Interface type configuration #if MBED_CONF_LWIP_ETHERNET_ENABLED -#define LWIP_ARP 1 -#define LWIP_ETHERNET 1 -#define LWIP_DHCP LWIP_IPV4 + #define LWIP_ARP 1 + #define LWIP_ETHERNET 1 + #define LWIP_DHCP LWIP_IPV4 #else -#define LWIP_ARP 0 -#define LWIP_ETHERNET 0 + #define LWIP_ARP 0 + #define LWIP_ETHERNET 0 #endif // MBED_CONF_LWIP_ETHERNET_ENABLED #if MBED_CONF_LWIP_L3IP_ENABLED -#define LWIP_L3IP 1 + #define LWIP_L3IP 1 #else -#define LWIP_L3IP 0 + #define LWIP_L3IP 0 #endif //Maximum size of network interface name @@ -291,27 +291,27 @@ // Enable PPP for now either from lwIP PPP configuration (obsolete) or from PPP service configuration #if MBED_CONF_PPP_ENABLED || MBED_CONF_LWIP_PPP_ENABLED -#define PPP_SUPPORT 1 - -#if MBED_CONF_PPP_IPV4_ENABLED || MBED_CONF_LWIP_IPV4_ENABLED -#define LWIP 0x11991199 -#if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV4_ENABLED -#error LWIP: IPv4 PPP enabled but not IPv4 -#endif -#undef LWIP -#define PPP_IPV4_SUPPORT 1 -#endif - -#if MBED_CONF_PPP_IPV6_ENABLED || MBED_CONF_LWIP_IPV6_ENABLED -#define LWIP 0x11991199 -#if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV6_ENABLED -#error LWIP: IPv6 PPP enabled but not IPv6 -#endif -#undef LWIP -#define PPP_IPV6_SUPPORT 1 -// Later to be dynamic for use for multiple interfaces -#define LWIP_IPV6_DUP_DETECT_ATTEMPTS 0 -#endif + #define PPP_SUPPORT 1 + + #if MBED_CONF_PPP_IPV4_ENABLED || MBED_CONF_LWIP_IPV4_ENABLED + #define LWIP 0x11991199 + #if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV4_ENABLED + #error LWIP: IPv4 PPP enabled but not IPv4 + #endif + #undef LWIP + #define PPP_IPV4_SUPPORT 1 + #endif + + #if MBED_CONF_PPP_IPV6_ENABLED || MBED_CONF_LWIP_IPV6_ENABLED + #define LWIP 0x11991199 + #if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV6_ENABLED + #error LWIP: IPv6 PPP enabled but not IPv6 + #endif + #undef LWIP + #define PPP_IPV6_SUPPORT 1 + // Later to be dynamic for use for multiple interfaces + #define LWIP_IPV6_DUP_DETECT_ATTEMPTS 0 + #endif #endif @@ -320,7 +320,7 @@ // Make sure we default these to off, so // LWIP doesn't default to on #ifndef LWIP_ARP -#define LWIP_ARP 0 + #define LWIP_ARP 0 #endif // Checksum-on-copy disabled due to https://savannah.nongnu.org/bugs/?50914 @@ -337,9 +337,9 @@ #include "lwip_tcp_isn.h" #define LWIP_HOOK_TCP_ISN lwip_hook_tcp_isn #ifdef MBEDTLS_MD5_C -#define LWIP_USE_EXTERNAL_MBEDTLS 1 + #define LWIP_USE_EXTERNAL_MBEDTLS 1 #else -#define LWIP_USE_EXTERNAL_MBEDTLS 0 + #define LWIP_USE_EXTERNAL_MBEDTLS 0 #endif #define LWIP_ND6_RDNSS_MAX_DNS_SERVERS MBED_CONF_LWIP_ND6_RDNSS_MAX_DNS_SERVERS diff --git a/Packages_Patches/arduino/hardware/mbed_portenta/2.6.1/libraries/SocketWrapper/src/MbedUdp.cpp b/Packages_Patches/arduino/hardware/mbed_portenta/2.6.1/libraries/SocketWrapper/src/MbedUdp.cpp index 2a1b0fc2..81399f3c 100644 --- a/Packages_Patches/arduino/hardware/mbed_portenta/2.6.1/libraries/SocketWrapper/src/MbedUdp.cpp +++ b/Packages_Patches/arduino/hardware/mbed_portenta/2.6.1/libraries/SocketWrapper/src/MbedUdp.cpp @@ -1,217 +1,273 @@ #include "MbedUdp.h" -arduino::MbedUDP::MbedUDP() { - _packet_buffer = new uint8_t[WIFI_UDP_BUFFER_SIZE]; - _current_packet = NULL; - _current_packet_size = 0; - // if this allocation fails then ::begin will fail +arduino::MbedUDP::MbedUDP() +{ + _packet_buffer = new uint8_t[WIFI_UDP_BUFFER_SIZE]; + _current_packet = NULL; + _current_packet_size = 0; + // if this allocation fails then ::begin will fail } -arduino::MbedUDP::~MbedUDP() { - delete[] _packet_buffer; +arduino::MbedUDP::~MbedUDP() +{ + delete[] _packet_buffer; } -uint8_t arduino::MbedUDP::begin(uint16_t port) { - // success = 1, fail = 0 +uint8_t arduino::MbedUDP::begin(uint16_t port) +{ + // success = 1, fail = 0 - nsapi_error_t rt = _socket.open(getNetwork()); - if (rt != NSAPI_ERROR_OK) { - return 0; - } + nsapi_error_t rt = _socket.open(getNetwork()); - if (_socket.bind(port) < 0) { - return 0; //Failed to bind UDP Socket to port - } + if (rt != NSAPI_ERROR_OK) + { + return 0; + } - if (!_packet_buffer) { - return 0; - } + if (_socket.bind(port) < 0) + { + return 0; //Failed to bind UDP Socket to port + } - _socket.set_blocking(false); - _socket.set_timeout(0); + if (!_packet_buffer) + { + return 0; + } - return 1; + _socket.set_blocking(false); + _socket.set_timeout(0); + + return 1; } -uint8_t arduino::MbedUDP::beginMulticast(IPAddress ip, uint16_t port) { - // success = 1, fail = 0 - if (begin(port) != 1) { - return 0; - } +uint8_t arduino::MbedUDP::beginMulticast(IPAddress ip, uint16_t port) +{ + // success = 1, fail = 0 + if (begin(port) != 1) + { + return 0; + } - SocketAddress socketAddress = SocketHelpers::socketAddressFromIpAddress(ip, port); + SocketAddress socketAddress = SocketHelpers::socketAddressFromIpAddress(ip, port); - if (_socket.join_multicast_group(socketAddress) != NSAPI_ERROR_OK) { - printf("Error joining the multicast group\n"); - return 0; - } + if (_socket.join_multicast_group(socketAddress) != NSAPI_ERROR_OK) + { + printf("Error joining the multicast group\n"); + return 0; + } - return 1; + return 1; } -void arduino::MbedUDP::stop() { - _socket.close(); +void arduino::MbedUDP::stop() +{ + _socket.close(); } -int arduino::MbedUDP::beginPacket(IPAddress ip, uint16_t port) { - _host = SocketHelpers::socketAddressFromIpAddress(ip, port); - //If IP is null and port is 0 the initialization failed - txBuffer.clear(); - return (_host.get_ip_address() == nullptr && _host.get_port() == 0) ? 0 : 1; +int arduino::MbedUDP::beginPacket(IPAddress ip, uint16_t port) +{ + _host = SocketHelpers::socketAddressFromIpAddress(ip, port); + //If IP is null and port is 0 the initialization failed + txBuffer.clear(); + return (_host.get_ip_address() == nullptr && _host.get_port() == 0) ? 0 : 1; } -int arduino::MbedUDP::beginPacket(const char *host, uint16_t port) { - _host = SocketAddress(host, port); - txBuffer.clear(); - getNetwork()->gethostbyname(host, &_host); - //If IP is null and port is 0 the initialization failed - return (_host.get_ip_address() == nullptr && _host.get_port() == 0) ? 0 : 1; +int arduino::MbedUDP::beginPacket(const char *host, uint16_t port) +{ + _host = SocketAddress(host, port); + txBuffer.clear(); + getNetwork()->gethostbyname(host, &_host); + //If IP is null and port is 0 the initialization failed + return (_host.get_ip_address() == nullptr && _host.get_port() == 0) ? 0 : 1; } -int arduino::MbedUDP::endPacket() { - _socket.set_blocking(true); - _socket.set_timeout(1000); +int arduino::MbedUDP::endPacket() +{ + _socket.set_blocking(true); + _socket.set_timeout(1000); + + size_t size = txBuffer.available(); + uint8_t buffer[size]; + + for (int i = 0; i < size; i++) + { + buffer[i] = txBuffer.read_char(); + } + + nsapi_size_or_error_t ret = _socket.sendto(_host, buffer, size); + _socket.set_blocking(false); + _socket.set_timeout(0); - size_t size = txBuffer.available(); - uint8_t buffer[size]; - for (int i = 0; i < size; i++) { - buffer[i] = txBuffer.read_char(); - } + if (ret < 0) + { + return 0; + } - nsapi_size_or_error_t ret = _socket.sendto(_host, buffer, size); - _socket.set_blocking(false); - _socket.set_timeout(0); - if (ret < 0) { - return 0; - } - return size; + return size; } // Write a single byte into the packet -size_t arduino::MbedUDP::write(uint8_t byte) { - return write(&byte, 1); +size_t arduino::MbedUDP::write(uint8_t byte) +{ + return write(&byte, 1); } // Write size bytes from buffer into the packet -size_t arduino::MbedUDP::write(const uint8_t *buffer, size_t size) { - for (int i = 0; i _packet_buffer + _current_packet_size) { - // try reading the next packet... - if (parsePacket() > 0) { - // if so, read first byte of next packet; - return read(); - } else { - // no new data... not sure what to return here now - return -1; - } - } - - return _current_packet[0]; +int arduino::MbedUDP::read() +{ + // no current packet... + if (_current_packet == NULL) + { + // try reading the next frame, if there is no data return + if (parsePacket() == 0) + return -1; + } + + _current_packet++; + + // check for overflow + if (_current_packet > _packet_buffer + _current_packet_size) + { + // try reading the next packet... + if (parsePacket() > 0) + { + // if so, read first byte of next packet; + return read(); + } + else + { + // no new data... not sure what to return here now + return -1; + } + } + + return _current_packet[0]; } // Read up to len bytes from the current packet and place them into buffer // Returns the number of bytes read, or 0 if none are available -int arduino::MbedUDP::read(unsigned char *buffer, size_t len) { - // Q: does Arduino read() function handle fragmentation? I won't for now... - if (_current_packet == NULL) { - if (parsePacket() == 0) return 0; - } - - // how much data do we have in the current packet? - int offset = _current_packet - _packet_buffer; - if (offset < 0) { - return 0; - } - - int max_bytes = _current_packet_size - offset; - if (max_bytes < 0) { - return 0; - } - - // at the end of the packet? - if (max_bytes == 0) { - // try read next packet... - if (parsePacket() > 0) { - return read(buffer, len); - } else { - return 0; - } - } - - if (len > (size_t)max_bytes) len = max_bytes; - - // copy to target buffer - memcpy(buffer, _current_packet, len); - - _current_packet += len; - - return len; +int arduino::MbedUDP::read(unsigned char *buffer, size_t len) +{ + // Q: does Arduino read() function handle fragmentation? I won't for now... + if (_current_packet == NULL) + { + if (parsePacket() == 0) + return 0; + } + + // how much data do we have in the current packet? + int offset = _current_packet - _packet_buffer; + + if (offset < 0) + { + return 0; + } + + int max_bytes = _current_packet_size - offset; + + if (max_bytes < 0) + { + return 0; + } + + // at the end of the packet? + if (max_bytes == 0) + { + // try read next packet... + if (parsePacket() > 0) + { + return read(buffer, len); + } + else + { + return 0; + } + } + + if (len > (size_t)max_bytes) + len = max_bytes; + + // copy to target buffer + memcpy(buffer, _current_packet, len); + + _current_packet += len; + + return len; } -IPAddress arduino::MbedUDP::remoteIP() { - nsapi_addr_t address = _remoteHost.get_addr(); - return IPAddress(address.bytes[0], address.bytes[1], address.bytes[2], address.bytes[3]); +IPAddress arduino::MbedUDP::remoteIP() +{ + nsapi_addr_t address = _remoteHost.get_addr(); + return IPAddress(address.bytes[0], address.bytes[1], address.bytes[2], address.bytes[3]); } -uint16_t arduino::MbedUDP::remotePort() { - return _remoteHost.get_port(); +uint16_t arduino::MbedUDP::remotePort() +{ + return _remoteHost.get_port(); } -void arduino::MbedUDP::flush() { - // TODO: a real check to ensure transmission has been completed +void arduino::MbedUDP::flush() +{ + // TODO: a real check to ensure transmission has been completed } -int arduino::MbedUDP::peek() { - if (_current_packet_size < 1) { - return -1; - } +int arduino::MbedUDP::peek() +{ + if (_current_packet_size < 1) + { + return -1; + } - return _current_packet[0]; + return _current_packet[0]; } diff --git a/Packages_Patches/arduino/hardware/mbed_portenta/2.6.1/libraries/SocketWrapper/src/MbedUdp.h b/Packages_Patches/arduino/hardware/mbed_portenta/2.6.1/libraries/SocketWrapper/src/MbedUdp.h index 7f81edec..cc28266c 100644 --- a/Packages_Patches/arduino/hardware/mbed_portenta/2.6.1/libraries/SocketWrapper/src/MbedUdp.h +++ b/Packages_Patches/arduino/hardware/mbed_portenta/2.6.1/libraries/SocketWrapper/src/MbedUdp.h @@ -25,79 +25,82 @@ #include "netsocket/UDPSocket.h" #ifndef WIFI_UDP_BUFFER_SIZE -#define WIFI_UDP_BUFFER_SIZE 508 + #define WIFI_UDP_BUFFER_SIZE 508 #endif -namespace arduino { - -class MbedUDP : public UDP { -private: - UDPSocket _socket; // Mbed OS socket - SocketAddress _host; // Host to be used to send data - SocketAddress _remoteHost; // Remote host that sent incoming packets - - uint8_t* _packet_buffer; // Raw packet buffer (contains data we got from the UDPSocket) - - // The Arduino APIs allow you to iterate through this buffer, so we need to be able to iterate over the current packet - // these two variables are used to cache the state of the current packet - uint8_t* _current_packet; - size_t _current_packet_size; - - RingBufferN txBuffer; - -protected: - virtual NetworkInterface* getNetwork() = 0; - -public: - MbedUDP(); // Constructor - ~MbedUDP(); - virtual uint8_t begin(uint16_t); // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use - virtual uint8_t beginMulticast(IPAddress, uint16_t); // initialize, start listening on specified multicast IP address and port. Returns 1 if successful, 0 if there are no sockets available to use - virtual void stop(); // Finish with the UDP socket - - // Sending UDP packets - - // Start building up a packet to send to the remote host specific in ip and port - // Returns 1 if successful, 0 if there was a problem with the supplied IP address or port - virtual int beginPacket(IPAddress ip, uint16_t port); - // Start building up a packet to send to the remote host specific in host and port - // Returns 1 if successful, 0 if there was a problem resolving the hostname or port - virtual int beginPacket(const char* host, uint16_t port); - // Finish off this packet and send it - // Returns 1 if the packet was sent successfully, 0 if there was an error - virtual int endPacket(); - // Write a single byte into the packet - virtual size_t write(uint8_t); - // Write size bytes from buffer into the packet - virtual size_t write(const uint8_t* buffer, size_t size); - - using Print::write; - - // Start processing the next available incoming packet - // Returns the size of the packet in bytes, or 0 if no packets are available - virtual int parsePacket(); - // Number of bytes remaining in the current packet - virtual int available(); - // Read a single byte from the current packet - virtual int read(); - // Read up to len bytes from the current packet and place them into buffer - // Returns the number of bytes read, or 0 if none are available - virtual int read(unsigned char* buffer, size_t len); - // Read up to len characters from the current packet and place them into buffer - // Returns the number of characters read, or 0 if none are available - virtual int read(char* buffer, size_t len) { - return read((unsigned char*)buffer, len); - }; - // Return the next byte from the current packet without moving on to the next byte - virtual int peek(); - virtual void flush(); // Finish reading the current packet - - // Return the IP address of the host who sent the current incoming packet - virtual IPAddress remoteIP(); - // // Return the port of the host who sent the current incoming packet - virtual uint16_t remotePort(); - - friend class MbedSocketClass; +namespace arduino +{ + +class MbedUDP : public UDP +{ + private: + UDPSocket _socket; // Mbed OS socket + SocketAddress _host; // Host to be used to send data + SocketAddress _remoteHost; // Remote host that sent incoming packets + + uint8_t* _packet_buffer; // Raw packet buffer (contains data we got from the UDPSocket) + + // The Arduino APIs allow you to iterate through this buffer, so we need to be able to iterate over the current packet + // these two variables are used to cache the state of the current packet + uint8_t* _current_packet; + size_t _current_packet_size; + + RingBufferN txBuffer; + + protected: + virtual NetworkInterface* getNetwork() = 0; + + public: + MbedUDP(); // Constructor + ~MbedUDP(); + virtual uint8_t begin(uint16_t); // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use + virtual uint8_t beginMulticast(IPAddress, uint16_t); // initialize, start listening on specified multicast IP address and port. Returns 1 if successful, 0 if there are no sockets available to use + virtual void stop(); // Finish with the UDP socket + + // Sending UDP packets + + // Start building up a packet to send to the remote host specific in ip and port + // Returns 1 if successful, 0 if there was a problem with the supplied IP address or port + virtual int beginPacket(IPAddress ip, uint16_t port); + // Start building up a packet to send to the remote host specific in host and port + // Returns 1 if successful, 0 if there was a problem resolving the hostname or port + virtual int beginPacket(const char* host, uint16_t port); + // Finish off this packet and send it + // Returns 1 if the packet was sent successfully, 0 if there was an error + virtual int endPacket(); + // Write a single byte into the packet + virtual size_t write(uint8_t); + // Write size bytes from buffer into the packet + virtual size_t write(const uint8_t* buffer, size_t size); + + using Print::write; + + // Start processing the next available incoming packet + // Returns the size of the packet in bytes, or 0 if no packets are available + virtual int parsePacket(); + // Number of bytes remaining in the current packet + virtual int available(); + // Read a single byte from the current packet + virtual int read(); + // Read up to len bytes from the current packet and place them into buffer + // Returns the number of bytes read, or 0 if none are available + virtual int read(unsigned char* buffer, size_t len); + // Read up to len characters from the current packet and place them into buffer + // Returns the number of characters read, or 0 if none are available + virtual int read(char* buffer, size_t len) + { + return read((unsigned char*)buffer, len); + }; + // Return the next byte from the current packet without moving on to the next byte + virtual int peek(); + virtual void flush(); // Finish reading the current packet + + // Return the IP address of the host who sent the current incoming packet + virtual IPAddress remoteIP(); + // // Return the port of the host who sent the current incoming packet + virtual uint16_t remotePort(); + + friend class MbedSocketClass; }; } diff --git a/Packages_Patches/arduino/hardware/mbed_portenta/2.7.2/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h b/Packages_Patches/arduino/hardware/mbed_portenta/2.7.2/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h index 84c18cf1..bd98fb95 100644 --- a/Packages_Patches/arduino/hardware/mbed_portenta/2.7.2/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h +++ b/Packages_Patches/arduino/hardware/mbed_portenta/2.7.2/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h @@ -1,28 +1,28 @@ /* Copyright (C) 2012 mbed.org, MIT License - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software - * and associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, - * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or - * substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING - * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software + and associated documentation files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, publish, distribute, + sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or + substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ #ifndef LWIPOPTS_H #define LWIPOPTS_H // Workaround for Linux timeval #if defined (TOOLCHAIN_GCC) -#define LWIP_TIMEVAL_PRIVATE 0 -#include + #define LWIP_TIMEVAL_PRIVATE 0 + #include #endif #include "nsapi_types.h" #include "mbed_retarget.h" @@ -35,7 +35,7 @@ #define NO_SYS 0 #if !MBED_CONF_LWIP_IPV4_ENABLED && !MBED_CONF_LWIP_IPV6_ENABLED -#error "Either IPv4 or IPv6 must be enabled." + #error "Either IPv4 or IPv6 must be enabled." #endif #define LWIP_IPV4 MBED_CONF_LWIP_IPV4_ENABLED @@ -47,16 +47,16 @@ // On dual stack configuration how long to wait for both or preferred stack // addresses before completing bring up. #if LWIP_IPV4 && LWIP_IPV6 -#if MBED_CONF_LWIP_ADDR_TIMEOUT_MODE -#define BOTH_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT -#define PREF_ADDR_TIMEOUT 0 -#else -#define PREF_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT -#define BOTH_ADDR_TIMEOUT 0 -#endif + #if MBED_CONF_LWIP_ADDR_TIMEOUT_MODE + #define BOTH_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT + #define PREF_ADDR_TIMEOUT 0 + #else + #define PREF_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT + #define BOTH_ADDR_TIMEOUT 0 + #endif #else -#define PREF_ADDR_TIMEOUT 0 -#define BOTH_ADDR_TIMEOUT 0 + #define PREF_ADDR_TIMEOUT 0 + #define BOTH_ADDR_TIMEOUT 0 #endif @@ -68,52 +68,52 @@ #define PREF_IPV6 2 #if MBED_CONF_LWIP_IP_VER_PREF == 6 -#define IP_VERSION_PREF PREF_IPV6 + #define IP_VERSION_PREF PREF_IPV6 #elif MBED_CONF_LWIP_IP_VER_PREF == 4 -#define IP_VERSION_PREF PREF_IPV4 + #define IP_VERSION_PREF PREF_IPV4 #else -#error "Either IPv4 or IPv6 must be preferred." + #error "Either IPv4 or IPv6 must be preferred." #endif #undef LWIP_DEBUG #if MBED_CONF_LWIP_DEBUG_ENABLED -#define LWIP_DEBUG 1 + #define LWIP_DEBUG 1 #endif #if NO_SYS == 0 -#include "cmsis_os2.h" + #include "cmsis_os2.h" -#define SYS_LIGHTWEIGHT_PROT 1 + #define SYS_LIGHTWEIGHT_PROT 1 -#define LWIP_RAW MBED_CONF_LWIP_RAW_SOCKET_ENABLED + #define LWIP_RAW MBED_CONF_LWIP_RAW_SOCKET_ENABLED -#define MEMP_NUM_TCPIP_MSG_INPKT MBED_CONF_LWIP_MEMP_NUM_TCPIP_MSG_INPKT + #define MEMP_NUM_TCPIP_MSG_INPKT MBED_CONF_LWIP_MEMP_NUM_TCPIP_MSG_INPKT -// Thread stacks use 8-byte alignment -#define LWIP_ALIGN_UP(pos, align) ((pos) % (align) ? (pos) + ((align) - (pos) % (align)) : (pos)) + // Thread stacks use 8-byte alignment + #define LWIP_ALIGN_UP(pos, align) ((pos) % (align) ? (pos) + ((align) - (pos) % (align)) : (pos)) -#ifdef LWIP_DEBUG -// For LWIP debug, double the stack -#define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE*2, 8) -#elif MBED_DEBUG -// When debug is enabled on the build increase stack 25 percent -#define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE + MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE / 4, 8) -#else -#define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE, 8) -#endif + #ifdef LWIP_DEBUG + // For LWIP debug, double the stack + #define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE*2, 8) + #elif MBED_DEBUG + // When debug is enabled on the build increase stack 25 percent + #define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE + MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE / 4, 8) + #else + #define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE, 8) + #endif -// Thread priority (osPriorityNormal by default) -#define TCPIP_THREAD_PRIO (MBED_CONF_LWIP_TCPIP_THREAD_PRIORITY) + // Thread priority (osPriorityNormal by default) + #define TCPIP_THREAD_PRIO (MBED_CONF_LWIP_TCPIP_THREAD_PRIORITY) -#ifdef LWIP_DEBUG -#define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE*2, 8) -#else -#define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE, 8) -#endif + #ifdef LWIP_DEBUG + #define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE*2, 8) + #else + #define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE, 8) + #endif -#define MEMP_NUM_SYS_TIMEOUT 16 + #define MEMP_NUM_SYS_TIMEOUT 16 -#define sys_msleep(ms) sys_msleep(ms) + #define sys_msleep(ms) sys_msleep(ms) #endif @@ -143,16 +143,16 @@ #define PBUF_POOL_SIZE MBED_CONF_LWIP_PBUF_POOL_SIZE #ifdef MBED_CONF_LWIP_PBUF_POOL_BUFSIZE -#undef PBUF_POOL_BUFSIZE -#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(MBED_CONF_LWIP_PBUF_POOL_BUFSIZE) + #undef PBUF_POOL_BUFSIZE + #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(MBED_CONF_LWIP_PBUF_POOL_BUFSIZE) #else -#ifndef PBUF_POOL_BUFSIZE -#if LWIP_IPV6 -#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) -#elif LWIP_IPV4 -#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+20+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) -#endif -#endif + #ifndef PBUF_POOL_BUFSIZE + #if LWIP_IPV6 + #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) + #elif LWIP_IPV4 + #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+20+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) + #endif + #endif #endif #define MEM_SIZE MBED_CONF_LWIP_MEM_SIZE @@ -181,14 +181,14 @@ #define MEMP_NUM_NETCONN MBED_CONF_LWIP_SOCKET_MAX #if MBED_CONF_LWIP_TCP_ENABLED -#define LWIP_TCP 1 -#define TCP_OVERSIZE 0 -#define LWIP_TCP_KEEPALIVE 1 + #define LWIP_TCP 1 + #define TCP_OVERSIZE 0 + #define LWIP_TCP_KEEPALIVE 1 -#define TCP_CLOSE_TIMEOUT MBED_CONF_LWIP_TCP_CLOSE_TIMEOUT + #define TCP_CLOSE_TIMEOUT MBED_CONF_LWIP_TCP_CLOSE_TIMEOUT #else -#define LWIP_TCP 0 + #define LWIP_TCP 0 #endif #define LWIP_DNS 1 @@ -251,13 +251,13 @@ #define UDP_LPC_EMAC LWIP_DBG_OFF #ifdef LWIP_DEBUG -#define MEMP_OVERFLOW_CHECK 1 -#define MEMP_SANITY_CHECK 1 -#define LWIP_DBG_TYPES_ON LWIP_DBG_ON -#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL + #define MEMP_OVERFLOW_CHECK 1 + #define MEMP_SANITY_CHECK 1 + #define LWIP_DBG_TYPES_ON LWIP_DBG_ON + #define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL #else -#define LWIP_NOASSERT 1 -#define LWIP_STATS 0 + #define LWIP_NOASSERT 1 + #define LWIP_STATS 0 #endif #define TRACE_TO_ASCII_HEX_DUMP 0 @@ -269,18 +269,18 @@ // Interface type configuration #if MBED_CONF_LWIP_ETHERNET_ENABLED -#define LWIP_ARP 1 -#define LWIP_ETHERNET 1 -#define LWIP_DHCP LWIP_IPV4 + #define LWIP_ARP 1 + #define LWIP_ETHERNET 1 + #define LWIP_DHCP LWIP_IPV4 #else -#define LWIP_ARP 0 -#define LWIP_ETHERNET 0 + #define LWIP_ARP 0 + #define LWIP_ETHERNET 0 #endif // MBED_CONF_LWIP_ETHERNET_ENABLED #if MBED_CONF_LWIP_L3IP_ENABLED -#define LWIP_L3IP 1 + #define LWIP_L3IP 1 #else -#define LWIP_L3IP 0 + #define LWIP_L3IP 0 #endif //Maximum size of network interface name @@ -291,27 +291,27 @@ // Enable PPP for now either from lwIP PPP configuration (obsolete) or from PPP service configuration #if MBED_CONF_PPP_ENABLED || MBED_CONF_LWIP_PPP_ENABLED -#define PPP_SUPPORT 1 - -#if MBED_CONF_PPP_IPV4_ENABLED || MBED_CONF_LWIP_IPV4_ENABLED -#define LWIP 0x11991199 -#if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV4_ENABLED -#error LWIP: IPv4 PPP enabled but not IPv4 -#endif -#undef LWIP -#define PPP_IPV4_SUPPORT 1 -#endif - -#if MBED_CONF_PPP_IPV6_ENABLED || MBED_CONF_LWIP_IPV6_ENABLED -#define LWIP 0x11991199 -#if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV6_ENABLED -#error LWIP: IPv6 PPP enabled but not IPv6 -#endif -#undef LWIP -#define PPP_IPV6_SUPPORT 1 -// Later to be dynamic for use for multiple interfaces -#define LWIP_IPV6_DUP_DETECT_ATTEMPTS 0 -#endif + #define PPP_SUPPORT 1 + + #if MBED_CONF_PPP_IPV4_ENABLED || MBED_CONF_LWIP_IPV4_ENABLED + #define LWIP 0x11991199 + #if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV4_ENABLED + #error LWIP: IPv4 PPP enabled but not IPv4 + #endif + #undef LWIP + #define PPP_IPV4_SUPPORT 1 + #endif + + #if MBED_CONF_PPP_IPV6_ENABLED || MBED_CONF_LWIP_IPV6_ENABLED + #define LWIP 0x11991199 + #if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV6_ENABLED + #error LWIP: IPv6 PPP enabled but not IPv6 + #endif + #undef LWIP + #define PPP_IPV6_SUPPORT 1 + // Later to be dynamic for use for multiple interfaces + #define LWIP_IPV6_DUP_DETECT_ATTEMPTS 0 + #endif #endif @@ -320,7 +320,7 @@ // Make sure we default these to off, so // LWIP doesn't default to on #ifndef LWIP_ARP -#define LWIP_ARP 0 + #define LWIP_ARP 0 #endif // Checksum-on-copy disabled due to https://savannah.nongnu.org/bugs/?50914 @@ -337,9 +337,9 @@ #include "lwip_tcp_isn.h" #define LWIP_HOOK_TCP_ISN lwip_hook_tcp_isn #ifdef MBEDTLS_MD5_C -#define LWIP_USE_EXTERNAL_MBEDTLS 1 + #define LWIP_USE_EXTERNAL_MBEDTLS 1 #else -#define LWIP_USE_EXTERNAL_MBEDTLS 0 + #define LWIP_USE_EXTERNAL_MBEDTLS 0 #endif #define LWIP_ND6_RDNSS_MAX_DNS_SERVERS MBED_CONF_LWIP_ND6_RDNSS_MAX_DNS_SERVERS diff --git a/Packages_Patches/arduino/hardware/mbed_portenta/2.8.0/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h b/Packages_Patches/arduino/hardware/mbed_portenta/2.8.0/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h index 84c18cf1..bd98fb95 100644 --- a/Packages_Patches/arduino/hardware/mbed_portenta/2.8.0/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h +++ b/Packages_Patches/arduino/hardware/mbed_portenta/2.8.0/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h @@ -1,28 +1,28 @@ /* Copyright (C) 2012 mbed.org, MIT License - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software - * and associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, - * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or - * substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING - * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software + and associated documentation files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, publish, distribute, + sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or + substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ #ifndef LWIPOPTS_H #define LWIPOPTS_H // Workaround for Linux timeval #if defined (TOOLCHAIN_GCC) -#define LWIP_TIMEVAL_PRIVATE 0 -#include + #define LWIP_TIMEVAL_PRIVATE 0 + #include #endif #include "nsapi_types.h" #include "mbed_retarget.h" @@ -35,7 +35,7 @@ #define NO_SYS 0 #if !MBED_CONF_LWIP_IPV4_ENABLED && !MBED_CONF_LWIP_IPV6_ENABLED -#error "Either IPv4 or IPv6 must be enabled." + #error "Either IPv4 or IPv6 must be enabled." #endif #define LWIP_IPV4 MBED_CONF_LWIP_IPV4_ENABLED @@ -47,16 +47,16 @@ // On dual stack configuration how long to wait for both or preferred stack // addresses before completing bring up. #if LWIP_IPV4 && LWIP_IPV6 -#if MBED_CONF_LWIP_ADDR_TIMEOUT_MODE -#define BOTH_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT -#define PREF_ADDR_TIMEOUT 0 -#else -#define PREF_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT -#define BOTH_ADDR_TIMEOUT 0 -#endif + #if MBED_CONF_LWIP_ADDR_TIMEOUT_MODE + #define BOTH_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT + #define PREF_ADDR_TIMEOUT 0 + #else + #define PREF_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT + #define BOTH_ADDR_TIMEOUT 0 + #endif #else -#define PREF_ADDR_TIMEOUT 0 -#define BOTH_ADDR_TIMEOUT 0 + #define PREF_ADDR_TIMEOUT 0 + #define BOTH_ADDR_TIMEOUT 0 #endif @@ -68,52 +68,52 @@ #define PREF_IPV6 2 #if MBED_CONF_LWIP_IP_VER_PREF == 6 -#define IP_VERSION_PREF PREF_IPV6 + #define IP_VERSION_PREF PREF_IPV6 #elif MBED_CONF_LWIP_IP_VER_PREF == 4 -#define IP_VERSION_PREF PREF_IPV4 + #define IP_VERSION_PREF PREF_IPV4 #else -#error "Either IPv4 or IPv6 must be preferred." + #error "Either IPv4 or IPv6 must be preferred." #endif #undef LWIP_DEBUG #if MBED_CONF_LWIP_DEBUG_ENABLED -#define LWIP_DEBUG 1 + #define LWIP_DEBUG 1 #endif #if NO_SYS == 0 -#include "cmsis_os2.h" + #include "cmsis_os2.h" -#define SYS_LIGHTWEIGHT_PROT 1 + #define SYS_LIGHTWEIGHT_PROT 1 -#define LWIP_RAW MBED_CONF_LWIP_RAW_SOCKET_ENABLED + #define LWIP_RAW MBED_CONF_LWIP_RAW_SOCKET_ENABLED -#define MEMP_NUM_TCPIP_MSG_INPKT MBED_CONF_LWIP_MEMP_NUM_TCPIP_MSG_INPKT + #define MEMP_NUM_TCPIP_MSG_INPKT MBED_CONF_LWIP_MEMP_NUM_TCPIP_MSG_INPKT -// Thread stacks use 8-byte alignment -#define LWIP_ALIGN_UP(pos, align) ((pos) % (align) ? (pos) + ((align) - (pos) % (align)) : (pos)) + // Thread stacks use 8-byte alignment + #define LWIP_ALIGN_UP(pos, align) ((pos) % (align) ? (pos) + ((align) - (pos) % (align)) : (pos)) -#ifdef LWIP_DEBUG -// For LWIP debug, double the stack -#define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE*2, 8) -#elif MBED_DEBUG -// When debug is enabled on the build increase stack 25 percent -#define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE + MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE / 4, 8) -#else -#define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE, 8) -#endif + #ifdef LWIP_DEBUG + // For LWIP debug, double the stack + #define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE*2, 8) + #elif MBED_DEBUG + // When debug is enabled on the build increase stack 25 percent + #define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE + MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE / 4, 8) + #else + #define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE, 8) + #endif -// Thread priority (osPriorityNormal by default) -#define TCPIP_THREAD_PRIO (MBED_CONF_LWIP_TCPIP_THREAD_PRIORITY) + // Thread priority (osPriorityNormal by default) + #define TCPIP_THREAD_PRIO (MBED_CONF_LWIP_TCPIP_THREAD_PRIORITY) -#ifdef LWIP_DEBUG -#define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE*2, 8) -#else -#define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE, 8) -#endif + #ifdef LWIP_DEBUG + #define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE*2, 8) + #else + #define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE, 8) + #endif -#define MEMP_NUM_SYS_TIMEOUT 16 + #define MEMP_NUM_SYS_TIMEOUT 16 -#define sys_msleep(ms) sys_msleep(ms) + #define sys_msleep(ms) sys_msleep(ms) #endif @@ -143,16 +143,16 @@ #define PBUF_POOL_SIZE MBED_CONF_LWIP_PBUF_POOL_SIZE #ifdef MBED_CONF_LWIP_PBUF_POOL_BUFSIZE -#undef PBUF_POOL_BUFSIZE -#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(MBED_CONF_LWIP_PBUF_POOL_BUFSIZE) + #undef PBUF_POOL_BUFSIZE + #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(MBED_CONF_LWIP_PBUF_POOL_BUFSIZE) #else -#ifndef PBUF_POOL_BUFSIZE -#if LWIP_IPV6 -#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) -#elif LWIP_IPV4 -#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+20+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) -#endif -#endif + #ifndef PBUF_POOL_BUFSIZE + #if LWIP_IPV6 + #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) + #elif LWIP_IPV4 + #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+20+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) + #endif + #endif #endif #define MEM_SIZE MBED_CONF_LWIP_MEM_SIZE @@ -181,14 +181,14 @@ #define MEMP_NUM_NETCONN MBED_CONF_LWIP_SOCKET_MAX #if MBED_CONF_LWIP_TCP_ENABLED -#define LWIP_TCP 1 -#define TCP_OVERSIZE 0 -#define LWIP_TCP_KEEPALIVE 1 + #define LWIP_TCP 1 + #define TCP_OVERSIZE 0 + #define LWIP_TCP_KEEPALIVE 1 -#define TCP_CLOSE_TIMEOUT MBED_CONF_LWIP_TCP_CLOSE_TIMEOUT + #define TCP_CLOSE_TIMEOUT MBED_CONF_LWIP_TCP_CLOSE_TIMEOUT #else -#define LWIP_TCP 0 + #define LWIP_TCP 0 #endif #define LWIP_DNS 1 @@ -251,13 +251,13 @@ #define UDP_LPC_EMAC LWIP_DBG_OFF #ifdef LWIP_DEBUG -#define MEMP_OVERFLOW_CHECK 1 -#define MEMP_SANITY_CHECK 1 -#define LWIP_DBG_TYPES_ON LWIP_DBG_ON -#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL + #define MEMP_OVERFLOW_CHECK 1 + #define MEMP_SANITY_CHECK 1 + #define LWIP_DBG_TYPES_ON LWIP_DBG_ON + #define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL #else -#define LWIP_NOASSERT 1 -#define LWIP_STATS 0 + #define LWIP_NOASSERT 1 + #define LWIP_STATS 0 #endif #define TRACE_TO_ASCII_HEX_DUMP 0 @@ -269,18 +269,18 @@ // Interface type configuration #if MBED_CONF_LWIP_ETHERNET_ENABLED -#define LWIP_ARP 1 -#define LWIP_ETHERNET 1 -#define LWIP_DHCP LWIP_IPV4 + #define LWIP_ARP 1 + #define LWIP_ETHERNET 1 + #define LWIP_DHCP LWIP_IPV4 #else -#define LWIP_ARP 0 -#define LWIP_ETHERNET 0 + #define LWIP_ARP 0 + #define LWIP_ETHERNET 0 #endif // MBED_CONF_LWIP_ETHERNET_ENABLED #if MBED_CONF_LWIP_L3IP_ENABLED -#define LWIP_L3IP 1 + #define LWIP_L3IP 1 #else -#define LWIP_L3IP 0 + #define LWIP_L3IP 0 #endif //Maximum size of network interface name @@ -291,27 +291,27 @@ // Enable PPP for now either from lwIP PPP configuration (obsolete) or from PPP service configuration #if MBED_CONF_PPP_ENABLED || MBED_CONF_LWIP_PPP_ENABLED -#define PPP_SUPPORT 1 - -#if MBED_CONF_PPP_IPV4_ENABLED || MBED_CONF_LWIP_IPV4_ENABLED -#define LWIP 0x11991199 -#if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV4_ENABLED -#error LWIP: IPv4 PPP enabled but not IPv4 -#endif -#undef LWIP -#define PPP_IPV4_SUPPORT 1 -#endif - -#if MBED_CONF_PPP_IPV6_ENABLED || MBED_CONF_LWIP_IPV6_ENABLED -#define LWIP 0x11991199 -#if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV6_ENABLED -#error LWIP: IPv6 PPP enabled but not IPv6 -#endif -#undef LWIP -#define PPP_IPV6_SUPPORT 1 -// Later to be dynamic for use for multiple interfaces -#define LWIP_IPV6_DUP_DETECT_ATTEMPTS 0 -#endif + #define PPP_SUPPORT 1 + + #if MBED_CONF_PPP_IPV4_ENABLED || MBED_CONF_LWIP_IPV4_ENABLED + #define LWIP 0x11991199 + #if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV4_ENABLED + #error LWIP: IPv4 PPP enabled but not IPv4 + #endif + #undef LWIP + #define PPP_IPV4_SUPPORT 1 + #endif + + #if MBED_CONF_PPP_IPV6_ENABLED || MBED_CONF_LWIP_IPV6_ENABLED + #define LWIP 0x11991199 + #if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV6_ENABLED + #error LWIP: IPv6 PPP enabled but not IPv6 + #endif + #undef LWIP + #define PPP_IPV6_SUPPORT 1 + // Later to be dynamic for use for multiple interfaces + #define LWIP_IPV6_DUP_DETECT_ATTEMPTS 0 + #endif #endif @@ -320,7 +320,7 @@ // Make sure we default these to off, so // LWIP doesn't default to on #ifndef LWIP_ARP -#define LWIP_ARP 0 + #define LWIP_ARP 0 #endif // Checksum-on-copy disabled due to https://savannah.nongnu.org/bugs/?50914 @@ -337,9 +337,9 @@ #include "lwip_tcp_isn.h" #define LWIP_HOOK_TCP_ISN lwip_hook_tcp_isn #ifdef MBEDTLS_MD5_C -#define LWIP_USE_EXTERNAL_MBEDTLS 1 + #define LWIP_USE_EXTERNAL_MBEDTLS 1 #else -#define LWIP_USE_EXTERNAL_MBEDTLS 0 + #define LWIP_USE_EXTERNAL_MBEDTLS 0 #endif #define LWIP_ND6_RDNSS_MAX_DNS_SERVERS MBED_CONF_LWIP_ND6_RDNSS_MAX_DNS_SERVERS diff --git a/Packages_Patches/arduino/hardware/mbed_portenta/3.0.0/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h b/Packages_Patches/arduino/hardware/mbed_portenta/3.0.0/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h index 84c18cf1..bd98fb95 100644 --- a/Packages_Patches/arduino/hardware/mbed_portenta/3.0.0/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h +++ b/Packages_Patches/arduino/hardware/mbed_portenta/3.0.0/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h @@ -1,28 +1,28 @@ /* Copyright (C) 2012 mbed.org, MIT License - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software - * and associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, - * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or - * substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING - * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software + and associated documentation files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, publish, distribute, + sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or + substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ #ifndef LWIPOPTS_H #define LWIPOPTS_H // Workaround for Linux timeval #if defined (TOOLCHAIN_GCC) -#define LWIP_TIMEVAL_PRIVATE 0 -#include + #define LWIP_TIMEVAL_PRIVATE 0 + #include #endif #include "nsapi_types.h" #include "mbed_retarget.h" @@ -35,7 +35,7 @@ #define NO_SYS 0 #if !MBED_CONF_LWIP_IPV4_ENABLED && !MBED_CONF_LWIP_IPV6_ENABLED -#error "Either IPv4 or IPv6 must be enabled." + #error "Either IPv4 or IPv6 must be enabled." #endif #define LWIP_IPV4 MBED_CONF_LWIP_IPV4_ENABLED @@ -47,16 +47,16 @@ // On dual stack configuration how long to wait for both or preferred stack // addresses before completing bring up. #if LWIP_IPV4 && LWIP_IPV6 -#if MBED_CONF_LWIP_ADDR_TIMEOUT_MODE -#define BOTH_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT -#define PREF_ADDR_TIMEOUT 0 -#else -#define PREF_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT -#define BOTH_ADDR_TIMEOUT 0 -#endif + #if MBED_CONF_LWIP_ADDR_TIMEOUT_MODE + #define BOTH_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT + #define PREF_ADDR_TIMEOUT 0 + #else + #define PREF_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT + #define BOTH_ADDR_TIMEOUT 0 + #endif #else -#define PREF_ADDR_TIMEOUT 0 -#define BOTH_ADDR_TIMEOUT 0 + #define PREF_ADDR_TIMEOUT 0 + #define BOTH_ADDR_TIMEOUT 0 #endif @@ -68,52 +68,52 @@ #define PREF_IPV6 2 #if MBED_CONF_LWIP_IP_VER_PREF == 6 -#define IP_VERSION_PREF PREF_IPV6 + #define IP_VERSION_PREF PREF_IPV6 #elif MBED_CONF_LWIP_IP_VER_PREF == 4 -#define IP_VERSION_PREF PREF_IPV4 + #define IP_VERSION_PREF PREF_IPV4 #else -#error "Either IPv4 or IPv6 must be preferred." + #error "Either IPv4 or IPv6 must be preferred." #endif #undef LWIP_DEBUG #if MBED_CONF_LWIP_DEBUG_ENABLED -#define LWIP_DEBUG 1 + #define LWIP_DEBUG 1 #endif #if NO_SYS == 0 -#include "cmsis_os2.h" + #include "cmsis_os2.h" -#define SYS_LIGHTWEIGHT_PROT 1 + #define SYS_LIGHTWEIGHT_PROT 1 -#define LWIP_RAW MBED_CONF_LWIP_RAW_SOCKET_ENABLED + #define LWIP_RAW MBED_CONF_LWIP_RAW_SOCKET_ENABLED -#define MEMP_NUM_TCPIP_MSG_INPKT MBED_CONF_LWIP_MEMP_NUM_TCPIP_MSG_INPKT + #define MEMP_NUM_TCPIP_MSG_INPKT MBED_CONF_LWIP_MEMP_NUM_TCPIP_MSG_INPKT -// Thread stacks use 8-byte alignment -#define LWIP_ALIGN_UP(pos, align) ((pos) % (align) ? (pos) + ((align) - (pos) % (align)) : (pos)) + // Thread stacks use 8-byte alignment + #define LWIP_ALIGN_UP(pos, align) ((pos) % (align) ? (pos) + ((align) - (pos) % (align)) : (pos)) -#ifdef LWIP_DEBUG -// For LWIP debug, double the stack -#define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE*2, 8) -#elif MBED_DEBUG -// When debug is enabled on the build increase stack 25 percent -#define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE + MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE / 4, 8) -#else -#define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE, 8) -#endif + #ifdef LWIP_DEBUG + // For LWIP debug, double the stack + #define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE*2, 8) + #elif MBED_DEBUG + // When debug is enabled on the build increase stack 25 percent + #define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE + MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE / 4, 8) + #else + #define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE, 8) + #endif -// Thread priority (osPriorityNormal by default) -#define TCPIP_THREAD_PRIO (MBED_CONF_LWIP_TCPIP_THREAD_PRIORITY) + // Thread priority (osPriorityNormal by default) + #define TCPIP_THREAD_PRIO (MBED_CONF_LWIP_TCPIP_THREAD_PRIORITY) -#ifdef LWIP_DEBUG -#define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE*2, 8) -#else -#define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE, 8) -#endif + #ifdef LWIP_DEBUG + #define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE*2, 8) + #else + #define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE, 8) + #endif -#define MEMP_NUM_SYS_TIMEOUT 16 + #define MEMP_NUM_SYS_TIMEOUT 16 -#define sys_msleep(ms) sys_msleep(ms) + #define sys_msleep(ms) sys_msleep(ms) #endif @@ -143,16 +143,16 @@ #define PBUF_POOL_SIZE MBED_CONF_LWIP_PBUF_POOL_SIZE #ifdef MBED_CONF_LWIP_PBUF_POOL_BUFSIZE -#undef PBUF_POOL_BUFSIZE -#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(MBED_CONF_LWIP_PBUF_POOL_BUFSIZE) + #undef PBUF_POOL_BUFSIZE + #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(MBED_CONF_LWIP_PBUF_POOL_BUFSIZE) #else -#ifndef PBUF_POOL_BUFSIZE -#if LWIP_IPV6 -#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) -#elif LWIP_IPV4 -#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+20+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) -#endif -#endif + #ifndef PBUF_POOL_BUFSIZE + #if LWIP_IPV6 + #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) + #elif LWIP_IPV4 + #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+20+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) + #endif + #endif #endif #define MEM_SIZE MBED_CONF_LWIP_MEM_SIZE @@ -181,14 +181,14 @@ #define MEMP_NUM_NETCONN MBED_CONF_LWIP_SOCKET_MAX #if MBED_CONF_LWIP_TCP_ENABLED -#define LWIP_TCP 1 -#define TCP_OVERSIZE 0 -#define LWIP_TCP_KEEPALIVE 1 + #define LWIP_TCP 1 + #define TCP_OVERSIZE 0 + #define LWIP_TCP_KEEPALIVE 1 -#define TCP_CLOSE_TIMEOUT MBED_CONF_LWIP_TCP_CLOSE_TIMEOUT + #define TCP_CLOSE_TIMEOUT MBED_CONF_LWIP_TCP_CLOSE_TIMEOUT #else -#define LWIP_TCP 0 + #define LWIP_TCP 0 #endif #define LWIP_DNS 1 @@ -251,13 +251,13 @@ #define UDP_LPC_EMAC LWIP_DBG_OFF #ifdef LWIP_DEBUG -#define MEMP_OVERFLOW_CHECK 1 -#define MEMP_SANITY_CHECK 1 -#define LWIP_DBG_TYPES_ON LWIP_DBG_ON -#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL + #define MEMP_OVERFLOW_CHECK 1 + #define MEMP_SANITY_CHECK 1 + #define LWIP_DBG_TYPES_ON LWIP_DBG_ON + #define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL #else -#define LWIP_NOASSERT 1 -#define LWIP_STATS 0 + #define LWIP_NOASSERT 1 + #define LWIP_STATS 0 #endif #define TRACE_TO_ASCII_HEX_DUMP 0 @@ -269,18 +269,18 @@ // Interface type configuration #if MBED_CONF_LWIP_ETHERNET_ENABLED -#define LWIP_ARP 1 -#define LWIP_ETHERNET 1 -#define LWIP_DHCP LWIP_IPV4 + #define LWIP_ARP 1 + #define LWIP_ETHERNET 1 + #define LWIP_DHCP LWIP_IPV4 #else -#define LWIP_ARP 0 -#define LWIP_ETHERNET 0 + #define LWIP_ARP 0 + #define LWIP_ETHERNET 0 #endif // MBED_CONF_LWIP_ETHERNET_ENABLED #if MBED_CONF_LWIP_L3IP_ENABLED -#define LWIP_L3IP 1 + #define LWIP_L3IP 1 #else -#define LWIP_L3IP 0 + #define LWIP_L3IP 0 #endif //Maximum size of network interface name @@ -291,27 +291,27 @@ // Enable PPP for now either from lwIP PPP configuration (obsolete) or from PPP service configuration #if MBED_CONF_PPP_ENABLED || MBED_CONF_LWIP_PPP_ENABLED -#define PPP_SUPPORT 1 - -#if MBED_CONF_PPP_IPV4_ENABLED || MBED_CONF_LWIP_IPV4_ENABLED -#define LWIP 0x11991199 -#if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV4_ENABLED -#error LWIP: IPv4 PPP enabled but not IPv4 -#endif -#undef LWIP -#define PPP_IPV4_SUPPORT 1 -#endif - -#if MBED_CONF_PPP_IPV6_ENABLED || MBED_CONF_LWIP_IPV6_ENABLED -#define LWIP 0x11991199 -#if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV6_ENABLED -#error LWIP: IPv6 PPP enabled but not IPv6 -#endif -#undef LWIP -#define PPP_IPV6_SUPPORT 1 -// Later to be dynamic for use for multiple interfaces -#define LWIP_IPV6_DUP_DETECT_ATTEMPTS 0 -#endif + #define PPP_SUPPORT 1 + + #if MBED_CONF_PPP_IPV4_ENABLED || MBED_CONF_LWIP_IPV4_ENABLED + #define LWIP 0x11991199 + #if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV4_ENABLED + #error LWIP: IPv4 PPP enabled but not IPv4 + #endif + #undef LWIP + #define PPP_IPV4_SUPPORT 1 + #endif + + #if MBED_CONF_PPP_IPV6_ENABLED || MBED_CONF_LWIP_IPV6_ENABLED + #define LWIP 0x11991199 + #if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV6_ENABLED + #error LWIP: IPv6 PPP enabled but not IPv6 + #endif + #undef LWIP + #define PPP_IPV6_SUPPORT 1 + // Later to be dynamic for use for multiple interfaces + #define LWIP_IPV6_DUP_DETECT_ATTEMPTS 0 + #endif #endif @@ -320,7 +320,7 @@ // Make sure we default these to off, so // LWIP doesn't default to on #ifndef LWIP_ARP -#define LWIP_ARP 0 + #define LWIP_ARP 0 #endif // Checksum-on-copy disabled due to https://savannah.nongnu.org/bugs/?50914 @@ -337,9 +337,9 @@ #include "lwip_tcp_isn.h" #define LWIP_HOOK_TCP_ISN lwip_hook_tcp_isn #ifdef MBEDTLS_MD5_C -#define LWIP_USE_EXTERNAL_MBEDTLS 1 + #define LWIP_USE_EXTERNAL_MBEDTLS 1 #else -#define LWIP_USE_EXTERNAL_MBEDTLS 0 + #define LWIP_USE_EXTERNAL_MBEDTLS 0 #endif #define LWIP_ND6_RDNSS_MAX_DNS_SERVERS MBED_CONF_LWIP_ND6_RDNSS_MAX_DNS_SERVERS diff --git a/Packages_Patches/arduino/hardware/mbed_portenta/3.0.1/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h b/Packages_Patches/arduino/hardware/mbed_portenta/3.0.1/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h index 84c18cf1..bd98fb95 100644 --- a/Packages_Patches/arduino/hardware/mbed_portenta/3.0.1/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h +++ b/Packages_Patches/arduino/hardware/mbed_portenta/3.0.1/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h @@ -1,28 +1,28 @@ /* Copyright (C) 2012 mbed.org, MIT License - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software - * and associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, - * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or - * substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING - * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software + and associated documentation files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, publish, distribute, + sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or + substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ #ifndef LWIPOPTS_H #define LWIPOPTS_H // Workaround for Linux timeval #if defined (TOOLCHAIN_GCC) -#define LWIP_TIMEVAL_PRIVATE 0 -#include + #define LWIP_TIMEVAL_PRIVATE 0 + #include #endif #include "nsapi_types.h" #include "mbed_retarget.h" @@ -35,7 +35,7 @@ #define NO_SYS 0 #if !MBED_CONF_LWIP_IPV4_ENABLED && !MBED_CONF_LWIP_IPV6_ENABLED -#error "Either IPv4 or IPv6 must be enabled." + #error "Either IPv4 or IPv6 must be enabled." #endif #define LWIP_IPV4 MBED_CONF_LWIP_IPV4_ENABLED @@ -47,16 +47,16 @@ // On dual stack configuration how long to wait for both or preferred stack // addresses before completing bring up. #if LWIP_IPV4 && LWIP_IPV6 -#if MBED_CONF_LWIP_ADDR_TIMEOUT_MODE -#define BOTH_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT -#define PREF_ADDR_TIMEOUT 0 -#else -#define PREF_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT -#define BOTH_ADDR_TIMEOUT 0 -#endif + #if MBED_CONF_LWIP_ADDR_TIMEOUT_MODE + #define BOTH_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT + #define PREF_ADDR_TIMEOUT 0 + #else + #define PREF_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT + #define BOTH_ADDR_TIMEOUT 0 + #endif #else -#define PREF_ADDR_TIMEOUT 0 -#define BOTH_ADDR_TIMEOUT 0 + #define PREF_ADDR_TIMEOUT 0 + #define BOTH_ADDR_TIMEOUT 0 #endif @@ -68,52 +68,52 @@ #define PREF_IPV6 2 #if MBED_CONF_LWIP_IP_VER_PREF == 6 -#define IP_VERSION_PREF PREF_IPV6 + #define IP_VERSION_PREF PREF_IPV6 #elif MBED_CONF_LWIP_IP_VER_PREF == 4 -#define IP_VERSION_PREF PREF_IPV4 + #define IP_VERSION_PREF PREF_IPV4 #else -#error "Either IPv4 or IPv6 must be preferred." + #error "Either IPv4 or IPv6 must be preferred." #endif #undef LWIP_DEBUG #if MBED_CONF_LWIP_DEBUG_ENABLED -#define LWIP_DEBUG 1 + #define LWIP_DEBUG 1 #endif #if NO_SYS == 0 -#include "cmsis_os2.h" + #include "cmsis_os2.h" -#define SYS_LIGHTWEIGHT_PROT 1 + #define SYS_LIGHTWEIGHT_PROT 1 -#define LWIP_RAW MBED_CONF_LWIP_RAW_SOCKET_ENABLED + #define LWIP_RAW MBED_CONF_LWIP_RAW_SOCKET_ENABLED -#define MEMP_NUM_TCPIP_MSG_INPKT MBED_CONF_LWIP_MEMP_NUM_TCPIP_MSG_INPKT + #define MEMP_NUM_TCPIP_MSG_INPKT MBED_CONF_LWIP_MEMP_NUM_TCPIP_MSG_INPKT -// Thread stacks use 8-byte alignment -#define LWIP_ALIGN_UP(pos, align) ((pos) % (align) ? (pos) + ((align) - (pos) % (align)) : (pos)) + // Thread stacks use 8-byte alignment + #define LWIP_ALIGN_UP(pos, align) ((pos) % (align) ? (pos) + ((align) - (pos) % (align)) : (pos)) -#ifdef LWIP_DEBUG -// For LWIP debug, double the stack -#define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE*2, 8) -#elif MBED_DEBUG -// When debug is enabled on the build increase stack 25 percent -#define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE + MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE / 4, 8) -#else -#define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE, 8) -#endif + #ifdef LWIP_DEBUG + // For LWIP debug, double the stack + #define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE*2, 8) + #elif MBED_DEBUG + // When debug is enabled on the build increase stack 25 percent + #define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE + MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE / 4, 8) + #else + #define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE, 8) + #endif -// Thread priority (osPriorityNormal by default) -#define TCPIP_THREAD_PRIO (MBED_CONF_LWIP_TCPIP_THREAD_PRIORITY) + // Thread priority (osPriorityNormal by default) + #define TCPIP_THREAD_PRIO (MBED_CONF_LWIP_TCPIP_THREAD_PRIORITY) -#ifdef LWIP_DEBUG -#define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE*2, 8) -#else -#define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE, 8) -#endif + #ifdef LWIP_DEBUG + #define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE*2, 8) + #else + #define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE, 8) + #endif -#define MEMP_NUM_SYS_TIMEOUT 16 + #define MEMP_NUM_SYS_TIMEOUT 16 -#define sys_msleep(ms) sys_msleep(ms) + #define sys_msleep(ms) sys_msleep(ms) #endif @@ -143,16 +143,16 @@ #define PBUF_POOL_SIZE MBED_CONF_LWIP_PBUF_POOL_SIZE #ifdef MBED_CONF_LWIP_PBUF_POOL_BUFSIZE -#undef PBUF_POOL_BUFSIZE -#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(MBED_CONF_LWIP_PBUF_POOL_BUFSIZE) + #undef PBUF_POOL_BUFSIZE + #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(MBED_CONF_LWIP_PBUF_POOL_BUFSIZE) #else -#ifndef PBUF_POOL_BUFSIZE -#if LWIP_IPV6 -#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) -#elif LWIP_IPV4 -#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+20+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) -#endif -#endif + #ifndef PBUF_POOL_BUFSIZE + #if LWIP_IPV6 + #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) + #elif LWIP_IPV4 + #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+20+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) + #endif + #endif #endif #define MEM_SIZE MBED_CONF_LWIP_MEM_SIZE @@ -181,14 +181,14 @@ #define MEMP_NUM_NETCONN MBED_CONF_LWIP_SOCKET_MAX #if MBED_CONF_LWIP_TCP_ENABLED -#define LWIP_TCP 1 -#define TCP_OVERSIZE 0 -#define LWIP_TCP_KEEPALIVE 1 + #define LWIP_TCP 1 + #define TCP_OVERSIZE 0 + #define LWIP_TCP_KEEPALIVE 1 -#define TCP_CLOSE_TIMEOUT MBED_CONF_LWIP_TCP_CLOSE_TIMEOUT + #define TCP_CLOSE_TIMEOUT MBED_CONF_LWIP_TCP_CLOSE_TIMEOUT #else -#define LWIP_TCP 0 + #define LWIP_TCP 0 #endif #define LWIP_DNS 1 @@ -251,13 +251,13 @@ #define UDP_LPC_EMAC LWIP_DBG_OFF #ifdef LWIP_DEBUG -#define MEMP_OVERFLOW_CHECK 1 -#define MEMP_SANITY_CHECK 1 -#define LWIP_DBG_TYPES_ON LWIP_DBG_ON -#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL + #define MEMP_OVERFLOW_CHECK 1 + #define MEMP_SANITY_CHECK 1 + #define LWIP_DBG_TYPES_ON LWIP_DBG_ON + #define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL #else -#define LWIP_NOASSERT 1 -#define LWIP_STATS 0 + #define LWIP_NOASSERT 1 + #define LWIP_STATS 0 #endif #define TRACE_TO_ASCII_HEX_DUMP 0 @@ -269,18 +269,18 @@ // Interface type configuration #if MBED_CONF_LWIP_ETHERNET_ENABLED -#define LWIP_ARP 1 -#define LWIP_ETHERNET 1 -#define LWIP_DHCP LWIP_IPV4 + #define LWIP_ARP 1 + #define LWIP_ETHERNET 1 + #define LWIP_DHCP LWIP_IPV4 #else -#define LWIP_ARP 0 -#define LWIP_ETHERNET 0 + #define LWIP_ARP 0 + #define LWIP_ETHERNET 0 #endif // MBED_CONF_LWIP_ETHERNET_ENABLED #if MBED_CONF_LWIP_L3IP_ENABLED -#define LWIP_L3IP 1 + #define LWIP_L3IP 1 #else -#define LWIP_L3IP 0 + #define LWIP_L3IP 0 #endif //Maximum size of network interface name @@ -291,27 +291,27 @@ // Enable PPP for now either from lwIP PPP configuration (obsolete) or from PPP service configuration #if MBED_CONF_PPP_ENABLED || MBED_CONF_LWIP_PPP_ENABLED -#define PPP_SUPPORT 1 - -#if MBED_CONF_PPP_IPV4_ENABLED || MBED_CONF_LWIP_IPV4_ENABLED -#define LWIP 0x11991199 -#if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV4_ENABLED -#error LWIP: IPv4 PPP enabled but not IPv4 -#endif -#undef LWIP -#define PPP_IPV4_SUPPORT 1 -#endif - -#if MBED_CONF_PPP_IPV6_ENABLED || MBED_CONF_LWIP_IPV6_ENABLED -#define LWIP 0x11991199 -#if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV6_ENABLED -#error LWIP: IPv6 PPP enabled but not IPv6 -#endif -#undef LWIP -#define PPP_IPV6_SUPPORT 1 -// Later to be dynamic for use for multiple interfaces -#define LWIP_IPV6_DUP_DETECT_ATTEMPTS 0 -#endif + #define PPP_SUPPORT 1 + + #if MBED_CONF_PPP_IPV4_ENABLED || MBED_CONF_LWIP_IPV4_ENABLED + #define LWIP 0x11991199 + #if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV4_ENABLED + #error LWIP: IPv4 PPP enabled but not IPv4 + #endif + #undef LWIP + #define PPP_IPV4_SUPPORT 1 + #endif + + #if MBED_CONF_PPP_IPV6_ENABLED || MBED_CONF_LWIP_IPV6_ENABLED + #define LWIP 0x11991199 + #if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV6_ENABLED + #error LWIP: IPv6 PPP enabled but not IPv6 + #endif + #undef LWIP + #define PPP_IPV6_SUPPORT 1 + // Later to be dynamic for use for multiple interfaces + #define LWIP_IPV6_DUP_DETECT_ATTEMPTS 0 + #endif #endif @@ -320,7 +320,7 @@ // Make sure we default these to off, so // LWIP doesn't default to on #ifndef LWIP_ARP -#define LWIP_ARP 0 + #define LWIP_ARP 0 #endif // Checksum-on-copy disabled due to https://savannah.nongnu.org/bugs/?50914 @@ -337,9 +337,9 @@ #include "lwip_tcp_isn.h" #define LWIP_HOOK_TCP_ISN lwip_hook_tcp_isn #ifdef MBEDTLS_MD5_C -#define LWIP_USE_EXTERNAL_MBEDTLS 1 + #define LWIP_USE_EXTERNAL_MBEDTLS 1 #else -#define LWIP_USE_EXTERNAL_MBEDTLS 0 + #define LWIP_USE_EXTERNAL_MBEDTLS 0 #endif #define LWIP_ND6_RDNSS_MAX_DNS_SERVERS MBED_CONF_LWIP_ND6_RDNSS_MAX_DNS_SERVERS diff --git a/Packages_Patches/arduino/hardware/mbed_portenta/3.1.1/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h b/Packages_Patches/arduino/hardware/mbed_portenta/3.1.1/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h index 84c18cf1..bd98fb95 100644 --- a/Packages_Patches/arduino/hardware/mbed_portenta/3.1.1/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h +++ b/Packages_Patches/arduino/hardware/mbed_portenta/3.1.1/cores/arduino/mbed/connectivity/lwipstack/include/lwipstack/lwipopts.h @@ -1,28 +1,28 @@ /* Copyright (C) 2012 mbed.org, MIT License - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software - * and associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, - * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or - * substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING - * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software + and associated documentation files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, publish, distribute, + sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or + substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ #ifndef LWIPOPTS_H #define LWIPOPTS_H // Workaround for Linux timeval #if defined (TOOLCHAIN_GCC) -#define LWIP_TIMEVAL_PRIVATE 0 -#include + #define LWIP_TIMEVAL_PRIVATE 0 + #include #endif #include "nsapi_types.h" #include "mbed_retarget.h" @@ -35,7 +35,7 @@ #define NO_SYS 0 #if !MBED_CONF_LWIP_IPV4_ENABLED && !MBED_CONF_LWIP_IPV6_ENABLED -#error "Either IPv4 or IPv6 must be enabled." + #error "Either IPv4 or IPv6 must be enabled." #endif #define LWIP_IPV4 MBED_CONF_LWIP_IPV4_ENABLED @@ -47,16 +47,16 @@ // On dual stack configuration how long to wait for both or preferred stack // addresses before completing bring up. #if LWIP_IPV4 && LWIP_IPV6 -#if MBED_CONF_LWIP_ADDR_TIMEOUT_MODE -#define BOTH_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT -#define PREF_ADDR_TIMEOUT 0 -#else -#define PREF_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT -#define BOTH_ADDR_TIMEOUT 0 -#endif + #if MBED_CONF_LWIP_ADDR_TIMEOUT_MODE + #define BOTH_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT + #define PREF_ADDR_TIMEOUT 0 + #else + #define PREF_ADDR_TIMEOUT MBED_CONF_LWIP_ADDR_TIMEOUT + #define BOTH_ADDR_TIMEOUT 0 + #endif #else -#define PREF_ADDR_TIMEOUT 0 -#define BOTH_ADDR_TIMEOUT 0 + #define PREF_ADDR_TIMEOUT 0 + #define BOTH_ADDR_TIMEOUT 0 #endif @@ -68,52 +68,52 @@ #define PREF_IPV6 2 #if MBED_CONF_LWIP_IP_VER_PREF == 6 -#define IP_VERSION_PREF PREF_IPV6 + #define IP_VERSION_PREF PREF_IPV6 #elif MBED_CONF_LWIP_IP_VER_PREF == 4 -#define IP_VERSION_PREF PREF_IPV4 + #define IP_VERSION_PREF PREF_IPV4 #else -#error "Either IPv4 or IPv6 must be preferred." + #error "Either IPv4 or IPv6 must be preferred." #endif #undef LWIP_DEBUG #if MBED_CONF_LWIP_DEBUG_ENABLED -#define LWIP_DEBUG 1 + #define LWIP_DEBUG 1 #endif #if NO_SYS == 0 -#include "cmsis_os2.h" + #include "cmsis_os2.h" -#define SYS_LIGHTWEIGHT_PROT 1 + #define SYS_LIGHTWEIGHT_PROT 1 -#define LWIP_RAW MBED_CONF_LWIP_RAW_SOCKET_ENABLED + #define LWIP_RAW MBED_CONF_LWIP_RAW_SOCKET_ENABLED -#define MEMP_NUM_TCPIP_MSG_INPKT MBED_CONF_LWIP_MEMP_NUM_TCPIP_MSG_INPKT + #define MEMP_NUM_TCPIP_MSG_INPKT MBED_CONF_LWIP_MEMP_NUM_TCPIP_MSG_INPKT -// Thread stacks use 8-byte alignment -#define LWIP_ALIGN_UP(pos, align) ((pos) % (align) ? (pos) + ((align) - (pos) % (align)) : (pos)) + // Thread stacks use 8-byte alignment + #define LWIP_ALIGN_UP(pos, align) ((pos) % (align) ? (pos) + ((align) - (pos) % (align)) : (pos)) -#ifdef LWIP_DEBUG -// For LWIP debug, double the stack -#define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE*2, 8) -#elif MBED_DEBUG -// When debug is enabled on the build increase stack 25 percent -#define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE + MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE / 4, 8) -#else -#define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE, 8) -#endif + #ifdef LWIP_DEBUG + // For LWIP debug, double the stack + #define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE*2, 8) + #elif MBED_DEBUG + // When debug is enabled on the build increase stack 25 percent + #define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE + MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE / 4, 8) + #else + #define TCPIP_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_TCPIP_THREAD_STACKSIZE, 8) + #endif -// Thread priority (osPriorityNormal by default) -#define TCPIP_THREAD_PRIO (MBED_CONF_LWIP_TCPIP_THREAD_PRIORITY) + // Thread priority (osPriorityNormal by default) + #define TCPIP_THREAD_PRIO (MBED_CONF_LWIP_TCPIP_THREAD_PRIORITY) -#ifdef LWIP_DEBUG -#define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE*2, 8) -#else -#define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE, 8) -#endif + #ifdef LWIP_DEBUG + #define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE*2, 8) + #else + #define DEFAULT_THREAD_STACKSIZE LWIP_ALIGN_UP(MBED_CONF_LWIP_DEFAULT_THREAD_STACKSIZE, 8) + #endif -#define MEMP_NUM_SYS_TIMEOUT 16 + #define MEMP_NUM_SYS_TIMEOUT 16 -#define sys_msleep(ms) sys_msleep(ms) + #define sys_msleep(ms) sys_msleep(ms) #endif @@ -143,16 +143,16 @@ #define PBUF_POOL_SIZE MBED_CONF_LWIP_PBUF_POOL_SIZE #ifdef MBED_CONF_LWIP_PBUF_POOL_BUFSIZE -#undef PBUF_POOL_BUFSIZE -#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(MBED_CONF_LWIP_PBUF_POOL_BUFSIZE) + #undef PBUF_POOL_BUFSIZE + #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(MBED_CONF_LWIP_PBUF_POOL_BUFSIZE) #else -#ifndef PBUF_POOL_BUFSIZE -#if LWIP_IPV6 -#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) -#elif LWIP_IPV4 -#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+20+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) -#endif -#endif + #ifndef PBUF_POOL_BUFSIZE + #if LWIP_IPV6 + #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+40+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) + #elif LWIP_IPV4 + #define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+20+20+PBUF_LINK_ENCAPSULATION_HLEN+PBUF_LINK_HLEN) + #endif + #endif #endif #define MEM_SIZE MBED_CONF_LWIP_MEM_SIZE @@ -181,14 +181,14 @@ #define MEMP_NUM_NETCONN MBED_CONF_LWIP_SOCKET_MAX #if MBED_CONF_LWIP_TCP_ENABLED -#define LWIP_TCP 1 -#define TCP_OVERSIZE 0 -#define LWIP_TCP_KEEPALIVE 1 + #define LWIP_TCP 1 + #define TCP_OVERSIZE 0 + #define LWIP_TCP_KEEPALIVE 1 -#define TCP_CLOSE_TIMEOUT MBED_CONF_LWIP_TCP_CLOSE_TIMEOUT + #define TCP_CLOSE_TIMEOUT MBED_CONF_LWIP_TCP_CLOSE_TIMEOUT #else -#define LWIP_TCP 0 + #define LWIP_TCP 0 #endif #define LWIP_DNS 1 @@ -251,13 +251,13 @@ #define UDP_LPC_EMAC LWIP_DBG_OFF #ifdef LWIP_DEBUG -#define MEMP_OVERFLOW_CHECK 1 -#define MEMP_SANITY_CHECK 1 -#define LWIP_DBG_TYPES_ON LWIP_DBG_ON -#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL + #define MEMP_OVERFLOW_CHECK 1 + #define MEMP_SANITY_CHECK 1 + #define LWIP_DBG_TYPES_ON LWIP_DBG_ON + #define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL #else -#define LWIP_NOASSERT 1 -#define LWIP_STATS 0 + #define LWIP_NOASSERT 1 + #define LWIP_STATS 0 #endif #define TRACE_TO_ASCII_HEX_DUMP 0 @@ -269,18 +269,18 @@ // Interface type configuration #if MBED_CONF_LWIP_ETHERNET_ENABLED -#define LWIP_ARP 1 -#define LWIP_ETHERNET 1 -#define LWIP_DHCP LWIP_IPV4 + #define LWIP_ARP 1 + #define LWIP_ETHERNET 1 + #define LWIP_DHCP LWIP_IPV4 #else -#define LWIP_ARP 0 -#define LWIP_ETHERNET 0 + #define LWIP_ARP 0 + #define LWIP_ETHERNET 0 #endif // MBED_CONF_LWIP_ETHERNET_ENABLED #if MBED_CONF_LWIP_L3IP_ENABLED -#define LWIP_L3IP 1 + #define LWIP_L3IP 1 #else -#define LWIP_L3IP 0 + #define LWIP_L3IP 0 #endif //Maximum size of network interface name @@ -291,27 +291,27 @@ // Enable PPP for now either from lwIP PPP configuration (obsolete) or from PPP service configuration #if MBED_CONF_PPP_ENABLED || MBED_CONF_LWIP_PPP_ENABLED -#define PPP_SUPPORT 1 - -#if MBED_CONF_PPP_IPV4_ENABLED || MBED_CONF_LWIP_IPV4_ENABLED -#define LWIP 0x11991199 -#if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV4_ENABLED -#error LWIP: IPv4 PPP enabled but not IPv4 -#endif -#undef LWIP -#define PPP_IPV4_SUPPORT 1 -#endif - -#if MBED_CONF_PPP_IPV6_ENABLED || MBED_CONF_LWIP_IPV6_ENABLED -#define LWIP 0x11991199 -#if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV6_ENABLED -#error LWIP: IPv6 PPP enabled but not IPv6 -#endif -#undef LWIP -#define PPP_IPV6_SUPPORT 1 -// Later to be dynamic for use for multiple interfaces -#define LWIP_IPV6_DUP_DETECT_ATTEMPTS 0 -#endif + #define PPP_SUPPORT 1 + + #if MBED_CONF_PPP_IPV4_ENABLED || MBED_CONF_LWIP_IPV4_ENABLED + #define LWIP 0x11991199 + #if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV4_ENABLED + #error LWIP: IPv4 PPP enabled but not IPv4 + #endif + #undef LWIP + #define PPP_IPV4_SUPPORT 1 + #endif + + #if MBED_CONF_PPP_IPV6_ENABLED || MBED_CONF_LWIP_IPV6_ENABLED + #define LWIP 0x11991199 + #if (MBED_CONF_NSAPI_DEFAULT_STACK == LWIP) && !MBED_CONF_LWIP_IPV6_ENABLED + #error LWIP: IPv6 PPP enabled but not IPv6 + #endif + #undef LWIP + #define PPP_IPV6_SUPPORT 1 + // Later to be dynamic for use for multiple interfaces + #define LWIP_IPV6_DUP_DETECT_ATTEMPTS 0 + #endif #endif @@ -320,7 +320,7 @@ // Make sure we default these to off, so // LWIP doesn't default to on #ifndef LWIP_ARP -#define LWIP_ARP 0 + #define LWIP_ARP 0 #endif // Checksum-on-copy disabled due to https://savannah.nongnu.org/bugs/?50914 @@ -337,9 +337,9 @@ #include "lwip_tcp_isn.h" #define LWIP_HOOK_TCP_ISN lwip_hook_tcp_isn #ifdef MBEDTLS_MD5_C -#define LWIP_USE_EXTERNAL_MBEDTLS 1 + #define LWIP_USE_EXTERNAL_MBEDTLS 1 #else -#define LWIP_USE_EXTERNAL_MBEDTLS 0 + #define LWIP_USE_EXTERNAL_MBEDTLS 0 #endif #define LWIP_ND6_RDNSS_MAX_DNS_SERVERS MBED_CONF_LWIP_ND6_RDNSS_MAX_DNS_SERVERS diff --git a/Packages_Patches/arduino/hardware/mbed_portenta/3.3.0/portenta_post_install.sh b/Packages_Patches/arduino/hardware/mbed_portenta/3.3.0/portenta_post_install.sh new file mode 100644 index 00000000..7fe71d64 --- /dev/null +++ b/Packages_Patches/arduino/hardware/mbed_portenta/3.3.0/portenta_post_install.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +portenta_h7_rules () { + echo "" + echo "# Portenta H7 bootloader mode UDEV rules" + echo "" +cat < /etc/udev/rules.d/49-portenta_h7.rules + +# reload udev rules +echo "Reload rules..." +udevadm trigger +udevadm control --reload-rules diff --git a/Packages_Patches/arduino/hardware/mbed_portenta/3.4.1/portenta_post_install.sh b/Packages_Patches/arduino/hardware/mbed_portenta/3.4.1/portenta_post_install.sh new file mode 100644 index 00000000..7fe71d64 --- /dev/null +++ b/Packages_Patches/arduino/hardware/mbed_portenta/3.4.1/portenta_post_install.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +portenta_h7_rules () { + echo "" + echo "# Portenta H7 bootloader mode UDEV rules" + echo "" +cat < /etc/udev/rules.d/49-portenta_h7.rules + +# reload udev rules +echo "Reload rules..." +udevadm trigger +udevadm control --reload-rules diff --git a/Packages_Patches/arduino/hardware/samd/1.8.6/cores/arduino/Arduino.h b/Packages_Patches/arduino/hardware/samd/1.8.6/cores/arduino/Arduino.h index 795f6053..92e45e6c 100644 --- a/Packages_Patches/arduino/hardware/samd/1.8.6/cores/arduino/Arduino.h +++ b/Packages_Patches/arduino/hardware/samd/1.8.6/cores/arduino/Arduino.h @@ -44,7 +44,7 @@ typedef uint16_t word; #include "itoa.h" #ifdef __cplusplus - extern "C"{ +extern "C" { #endif // __cplusplus // Include Atmel headers @@ -70,19 +70,19 @@ void loop( void ) ; // The following headers are for C++ only compilation #ifdef __cplusplus - #include "WCharacter.h" - #include "WString.h" - #include "Tone.h" - #include "WMath.h" - #include "HardwareSerial.h" - #include "pulse.h" - #include + #include "WCharacter.h" + #include "WString.h" + #include "Tone.h" + #include "WMath.h" + #include "HardwareSerial.h" + #include "pulse.h" + #include #endif #include "delay.h" #ifdef __cplusplus - #include "Uart.h" + #include "Uart.h" #endif // Include board variant @@ -94,30 +94,30 @@ void loop( void ) ; #include "WInterrupts.h" #ifndef __cplusplus - // undefine stdlib's abs if encountered - #ifdef abs - #undef abs - #endif // abs - - #define min(a,b) ((a)<(b)?(a):(b)) - #define max(a,b) ((a)>(b)?(a):(b)) - #define abs(x) ((x)>0?(x):-(x)) - #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) - +// undefine stdlib's abs if encountered +#ifdef abs + #undef abs +#endif // abs + +#define min(a,b) ((a)<(b)?(a):(b)) +#define max(a,b) ((a)>(b)?(a):(b)) +#define abs(x) ((x)>0?(x):-(x)) +#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) + #else - //using std::min; - //using std::max; - template - auto min(const T& a, const L& b) -> decltype((b < a) ? b : a) - { - return (b < a) ? b : a; - } - - template - auto max(const T& a, const L& b) -> decltype((b < a) ? b : a) - { - return (a < b) ? b : a; - } +//using std::min; +//using std::max; +template +auto min(const T& a, const L& b) -> decltype((b < a) ? b : a) +{ + return (b < a) ? b : a; +} + +template +auto max(const T& a, const L& b) -> decltype((b < a) ? b : a) +{ + return (a < b) ? b : a; +} #endif #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) @@ -138,13 +138,13 @@ void loop( void ) ; #define bit(b) (1UL << (b)) #if (ARDUINO_SAMD_VARIANT_COMPLIANCE >= 10606) - // Interrupts - #define digitalPinToInterrupt(P) ( P ) + // Interrupts + #define digitalPinToInterrupt(P) ( P ) #endif // Allows publishing the Beta core under samd-beta / arduino organization #ifndef ARDUINO_ARCH_SAMD -#define ARDUINO_ARCH_SAMD + #define ARDUINO_ARCH_SAMD #endif // USB Device @@ -154,7 +154,7 @@ void loop( void ) ; #include "USB/USB_host.h" #ifdef __cplusplus - #include "USB/CDC.h" + #include "USB/CDC.h" #endif #endif // Arduino_h diff --git a/Packages_Patches/arduino/hardware/samd/1.8.7/cores/arduino/Arduino.h b/Packages_Patches/arduino/hardware/samd/1.8.7/cores/arduino/Arduino.h index 795f6053..92e45e6c 100644 --- a/Packages_Patches/arduino/hardware/samd/1.8.7/cores/arduino/Arduino.h +++ b/Packages_Patches/arduino/hardware/samd/1.8.7/cores/arduino/Arduino.h @@ -44,7 +44,7 @@ typedef uint16_t word; #include "itoa.h" #ifdef __cplusplus - extern "C"{ +extern "C" { #endif // __cplusplus // Include Atmel headers @@ -70,19 +70,19 @@ void loop( void ) ; // The following headers are for C++ only compilation #ifdef __cplusplus - #include "WCharacter.h" - #include "WString.h" - #include "Tone.h" - #include "WMath.h" - #include "HardwareSerial.h" - #include "pulse.h" - #include + #include "WCharacter.h" + #include "WString.h" + #include "Tone.h" + #include "WMath.h" + #include "HardwareSerial.h" + #include "pulse.h" + #include #endif #include "delay.h" #ifdef __cplusplus - #include "Uart.h" + #include "Uart.h" #endif // Include board variant @@ -94,30 +94,30 @@ void loop( void ) ; #include "WInterrupts.h" #ifndef __cplusplus - // undefine stdlib's abs if encountered - #ifdef abs - #undef abs - #endif // abs - - #define min(a,b) ((a)<(b)?(a):(b)) - #define max(a,b) ((a)>(b)?(a):(b)) - #define abs(x) ((x)>0?(x):-(x)) - #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) - +// undefine stdlib's abs if encountered +#ifdef abs + #undef abs +#endif // abs + +#define min(a,b) ((a)<(b)?(a):(b)) +#define max(a,b) ((a)>(b)?(a):(b)) +#define abs(x) ((x)>0?(x):-(x)) +#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) + #else - //using std::min; - //using std::max; - template - auto min(const T& a, const L& b) -> decltype((b < a) ? b : a) - { - return (b < a) ? b : a; - } - - template - auto max(const T& a, const L& b) -> decltype((b < a) ? b : a) - { - return (a < b) ? b : a; - } +//using std::min; +//using std::max; +template +auto min(const T& a, const L& b) -> decltype((b < a) ? b : a) +{ + return (b < a) ? b : a; +} + +template +auto max(const T& a, const L& b) -> decltype((b < a) ? b : a) +{ + return (a < b) ? b : a; +} #endif #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) @@ -138,13 +138,13 @@ void loop( void ) ; #define bit(b) (1UL << (b)) #if (ARDUINO_SAMD_VARIANT_COMPLIANCE >= 10606) - // Interrupts - #define digitalPinToInterrupt(P) ( P ) + // Interrupts + #define digitalPinToInterrupt(P) ( P ) #endif // Allows publishing the Beta core under samd-beta / arduino organization #ifndef ARDUINO_ARCH_SAMD -#define ARDUINO_ARCH_SAMD + #define ARDUINO_ARCH_SAMD #endif // USB Device @@ -154,7 +154,7 @@ void loop( void ) ; #include "USB/USB_host.h" #ifdef __cplusplus - #include "USB/CDC.h" + #include "USB/CDC.h" #endif #endif // Arduino_h diff --git a/Packages_Patches/arduino/hardware/samd/1.8.8/cores/Arduino.h b/Packages_Patches/arduino/hardware/samd/1.8.8/cores/Arduino.h index 4c47b5c7..38852195 100644 --- a/Packages_Patches/arduino/hardware/samd/1.8.8/cores/Arduino.h +++ b/Packages_Patches/arduino/hardware/samd/1.8.8/cores/Arduino.h @@ -45,7 +45,7 @@ typedef uint16_t word; #include "itoa.h" #ifdef __cplusplus - extern "C"{ +extern "C" { #endif // __cplusplus // Include Atmel headers @@ -75,19 +75,19 @@ void loop( void ) ; // The following headers are for C++ only compilation #ifdef __cplusplus - #include "WCharacter.h" - #include "WString.h" - #include "Tone.h" - #include "WMath.h" - #include "HardwareSerial.h" - #include "pulse.h" - #include + #include "WCharacter.h" + #include "WString.h" + #include "Tone.h" + #include "WMath.h" + #include "HardwareSerial.h" + #include "pulse.h" + #include #endif #include "delay.h" #ifdef __cplusplus - #include "Uart.h" + #include "Uart.h" #endif // Include board variant @@ -99,30 +99,30 @@ void loop( void ) ; #include "WInterrupts.h" #ifndef __cplusplus - // undefine stdlib's abs if encountered - #ifdef abs - #undef abs - #endif // abs - - #define min(a,b) ((a)<(b)?(a):(b)) - #define max(a,b) ((a)>(b)?(a):(b)) - #define abs(x) ((x)>0?(x):-(x)) - #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) - +// undefine stdlib's abs if encountered +#ifdef abs + #undef abs +#endif // abs + +#define min(a,b) ((a)<(b)?(a):(b)) +#define max(a,b) ((a)>(b)?(a):(b)) +#define abs(x) ((x)>0?(x):-(x)) +#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) + #else - //using std::min; - //using std::max; - template - auto min(const T& a, const L& b) -> decltype((b < a) ? b : a) - { - return (b < a) ? b : a; - } - - template - auto max(const T& a, const L& b) -> decltype((b < a) ? b : a) - { - return (a < b) ? b : a; - } +//using std::min; +//using std::max; +template +auto min(const T& a, const L& b) -> decltype((b < a) ? b : a) +{ + return (b < a) ? b : a; +} + +template +auto max(const T& a, const L& b) -> decltype((b < a) ? b : a) +{ + return (a < b) ? b : a; +} #endif #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) @@ -143,13 +143,13 @@ void loop( void ) ; #define bit(b) (1UL << (b)) #if (ARDUINO_SAMD_VARIANT_COMPLIANCE >= 10606) - // Interrupts - #define digitalPinToInterrupt(P) ( P ) + // Interrupts + #define digitalPinToInterrupt(P) ( P ) #endif // Allows publishing the Beta core under samd-beta / arduino organization #ifndef ARDUINO_ARCH_SAMD -#define ARDUINO_ARCH_SAMD + #define ARDUINO_ARCH_SAMD #endif // USB Device @@ -159,7 +159,7 @@ void loop( void ) ; #include "USB/USB_host.h" #ifdef __cplusplus - #include "USB/CDC.h" + #include "USB/CDC.h" #endif #endif // Arduino_h diff --git a/Packages_Patches/arduino/hardware/samd/1.8.8/cores/arduino/Arduino.h b/Packages_Patches/arduino/hardware/samd/1.8.8/cores/arduino/Arduino.h index 4c47b5c7..38852195 100644 --- a/Packages_Patches/arduino/hardware/samd/1.8.8/cores/arduino/Arduino.h +++ b/Packages_Patches/arduino/hardware/samd/1.8.8/cores/arduino/Arduino.h @@ -45,7 +45,7 @@ typedef uint16_t word; #include "itoa.h" #ifdef __cplusplus - extern "C"{ +extern "C" { #endif // __cplusplus // Include Atmel headers @@ -75,19 +75,19 @@ void loop( void ) ; // The following headers are for C++ only compilation #ifdef __cplusplus - #include "WCharacter.h" - #include "WString.h" - #include "Tone.h" - #include "WMath.h" - #include "HardwareSerial.h" - #include "pulse.h" - #include + #include "WCharacter.h" + #include "WString.h" + #include "Tone.h" + #include "WMath.h" + #include "HardwareSerial.h" + #include "pulse.h" + #include #endif #include "delay.h" #ifdef __cplusplus - #include "Uart.h" + #include "Uart.h" #endif // Include board variant @@ -99,30 +99,30 @@ void loop( void ) ; #include "WInterrupts.h" #ifndef __cplusplus - // undefine stdlib's abs if encountered - #ifdef abs - #undef abs - #endif // abs - - #define min(a,b) ((a)<(b)?(a):(b)) - #define max(a,b) ((a)>(b)?(a):(b)) - #define abs(x) ((x)>0?(x):-(x)) - #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) - +// undefine stdlib's abs if encountered +#ifdef abs + #undef abs +#endif // abs + +#define min(a,b) ((a)<(b)?(a):(b)) +#define max(a,b) ((a)>(b)?(a):(b)) +#define abs(x) ((x)>0?(x):-(x)) +#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) + #else - //using std::min; - //using std::max; - template - auto min(const T& a, const L& b) -> decltype((b < a) ? b : a) - { - return (b < a) ? b : a; - } - - template - auto max(const T& a, const L& b) -> decltype((b < a) ? b : a) - { - return (a < b) ? b : a; - } +//using std::min; +//using std::max; +template +auto min(const T& a, const L& b) -> decltype((b < a) ? b : a) +{ + return (b < a) ? b : a; +} + +template +auto max(const T& a, const L& b) -> decltype((b < a) ? b : a) +{ + return (a < b) ? b : a; +} #endif #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) @@ -143,13 +143,13 @@ void loop( void ) ; #define bit(b) (1UL << (b)) #if (ARDUINO_SAMD_VARIANT_COMPLIANCE >= 10606) - // Interrupts - #define digitalPinToInterrupt(P) ( P ) + // Interrupts + #define digitalPinToInterrupt(P) ( P ) #endif // Allows publishing the Beta core under samd-beta / arduino organization #ifndef ARDUINO_ARCH_SAMD -#define ARDUINO_ARCH_SAMD + #define ARDUINO_ARCH_SAMD #endif // USB Device @@ -159,7 +159,7 @@ void loop( void ) ; #include "USB/USB_host.h" #ifdef __cplusplus - #include "USB/CDC.h" + #include "USB/CDC.h" #endif #endif // Arduino_h diff --git a/Packages_Patches/arduino/hardware/samd/1.8.9/cores/arduino/Arduino.h b/Packages_Patches/arduino/hardware/samd/1.8.9/cores/arduino/Arduino.h index 4c47b5c7..38852195 100644 --- a/Packages_Patches/arduino/hardware/samd/1.8.9/cores/arduino/Arduino.h +++ b/Packages_Patches/arduino/hardware/samd/1.8.9/cores/arduino/Arduino.h @@ -45,7 +45,7 @@ typedef uint16_t word; #include "itoa.h" #ifdef __cplusplus - extern "C"{ +extern "C" { #endif // __cplusplus // Include Atmel headers @@ -75,19 +75,19 @@ void loop( void ) ; // The following headers are for C++ only compilation #ifdef __cplusplus - #include "WCharacter.h" - #include "WString.h" - #include "Tone.h" - #include "WMath.h" - #include "HardwareSerial.h" - #include "pulse.h" - #include + #include "WCharacter.h" + #include "WString.h" + #include "Tone.h" + #include "WMath.h" + #include "HardwareSerial.h" + #include "pulse.h" + #include #endif #include "delay.h" #ifdef __cplusplus - #include "Uart.h" + #include "Uart.h" #endif // Include board variant @@ -99,30 +99,30 @@ void loop( void ) ; #include "WInterrupts.h" #ifndef __cplusplus - // undefine stdlib's abs if encountered - #ifdef abs - #undef abs - #endif // abs - - #define min(a,b) ((a)<(b)?(a):(b)) - #define max(a,b) ((a)>(b)?(a):(b)) - #define abs(x) ((x)>0?(x):-(x)) - #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) - +// undefine stdlib's abs if encountered +#ifdef abs + #undef abs +#endif // abs + +#define min(a,b) ((a)<(b)?(a):(b)) +#define max(a,b) ((a)>(b)?(a):(b)) +#define abs(x) ((x)>0?(x):-(x)) +#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) + #else - //using std::min; - //using std::max; - template - auto min(const T& a, const L& b) -> decltype((b < a) ? b : a) - { - return (b < a) ? b : a; - } - - template - auto max(const T& a, const L& b) -> decltype((b < a) ? b : a) - { - return (a < b) ? b : a; - } +//using std::min; +//using std::max; +template +auto min(const T& a, const L& b) -> decltype((b < a) ? b : a) +{ + return (b < a) ? b : a; +} + +template +auto max(const T& a, const L& b) -> decltype((b < a) ? b : a) +{ + return (a < b) ? b : a; +} #endif #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) @@ -143,13 +143,13 @@ void loop( void ) ; #define bit(b) (1UL << (b)) #if (ARDUINO_SAMD_VARIANT_COMPLIANCE >= 10606) - // Interrupts - #define digitalPinToInterrupt(P) ( P ) + // Interrupts + #define digitalPinToInterrupt(P) ( P ) #endif // Allows publishing the Beta core under samd-beta / arduino organization #ifndef ARDUINO_ARCH_SAMD -#define ARDUINO_ARCH_SAMD + #define ARDUINO_ARCH_SAMD #endif // USB Device @@ -159,7 +159,7 @@ void loop( void ) ; #include "USB/USB_host.h" #ifdef __cplusplus - #include "USB/CDC.h" + #include "USB/CDC.h" #endif #endif // Arduino_h diff --git a/Packages_Patches/hardware/teensy/avr/cores/teensy/Stream.cpp b/Packages_Patches/hardware/teensy/avr/cores/teensy/Stream.cpp index 6c78ed57..09903ebf 100644 --- a/Packages_Patches/hardware/teensy/avr/cores/teensy/Stream.cpp +++ b/Packages_Patches/hardware/teensy/avr/cores/teensy/Stream.cpp @@ -1,24 +1,24 @@ /* - Stream.cpp - adds parsing methods to Stream class - Copyright (c) 2008 David A. Mellis. All right reserved. + Stream.cpp - adds parsing methods to Stream class + Copyright (c) 2008 David A. Mellis. All right reserved. - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - Created July 2011 - parsing functions based on TextFinder library by Michael Margolis - */ + Created July 2011 + parsing functions based on TextFinder library by Michael Margolis +*/ #include @@ -28,65 +28,65 @@ // private method to read stream with timeout int Stream::timedRead() { - int c; - unsigned long startMillis = millis(); + int c; + unsigned long startMillis = millis(); - do - { - c = read(); + do + { + c = read(); - if (c >= 0) - return c; + if (c >= 0) + return c; - yield(); - } while (millis() - startMillis < _timeout); + yield(); + } while (millis() - startMillis < _timeout); - Serial.print(("timedRead timeout = ")); - Serial.println(_timeout); + Serial.print(("timedRead timeout = ")); + Serial.println(_timeout); - return -1; // -1 indicates timeout + return -1; // -1 indicates timeout } // private method to peek stream with timeout int Stream::timedPeek() { - int c; - unsigned long startMillis = millis(); + int c; + unsigned long startMillis = millis(); - do - { - c = peek(); + do + { + c = peek(); - if (c >= 0) - return c; + if (c >= 0) + return c; - yield(); - } while (millis() - startMillis < _timeout); + yield(); + } while (millis() - startMillis < _timeout); - return -1; // -1 indicates timeout + return -1; // -1 indicates timeout } // returns peek of the next digit in the stream or -1 if timeout // discards non-numeric characters int Stream::peekNextDigit() { - int c; + int c; - while (1) - { - c = timedPeek(); + while (1) + { + c = timedPeek(); - if (c < 0) - return c; // timeout + if (c < 0) + return c; // timeout - if (c == '-') - return c; + if (c == '-') + return c; - if (c >= '0' && c <= '9') - return c; + if (c >= '0' && c <= '9') + return c; - read(); // discard non-numeric - } + read(); // discard non-numeric + } } // Public Methods @@ -94,31 +94,31 @@ int Stream::peekNextDigit() void Stream::setTimeout(unsigned long timeout) // sets the maximum number of milliseconds to wait { - _timeout = timeout; + _timeout = timeout; } // find returns true if the target string is found bool Stream::find(const char *target) { - return findUntil(target, NULL); + return findUntil(target, NULL); } // reads data from the stream until the target string of given length is found // returns true if target string is found, false if timed out bool Stream::find(const char *target, size_t length) { - return findUntil(target, length, NULL, 0); + return findUntil(target, length, NULL, 0); } // as find but search ends if the terminator string is found bool Stream::findUntil(const char *target, const char *terminator) { - if (target == nullptr) - return true; + if (target == nullptr) + return true; - size_t tlen = (terminator == nullptr) ? 0 : strlen(terminator); + size_t tlen = (terminator == nullptr) ? 0 : strlen(terminator); - return findUntil(target, strlen(target), terminator, tlen); + return findUntil(target, strlen(target), terminator, tlen); } // reads data from the stream until the target string of the given length is found @@ -126,45 +126,45 @@ bool Stream::findUntil(const char *target, const char *terminator) // returns true if target string is found, false if terminated or timed out bool Stream::findUntil(const char *target, size_t targetLen, const char *terminator, size_t termLen) { - size_t index = 0; // maximum target string length is 64k bytes! - size_t termIndex = 0; - int c; - - if ( target == nullptr) - return true; - - if ( *target == 0) - return true; // return true if target is a null string - - if (terminator == nullptr) - termLen = 0; - - while ( (c = timedRead()) > 0) - { - if ( c == target[index]) - { - //////Serial.print("found "); Serial.write(c); Serial.print("index now"); Serial.println(index+1); - if (++index >= targetLen) - { - // return true if all chars in the target match - return true; - } - } - else - { - index = 0; // reset index if any char does not match - } - - if (termLen > 0 && c == terminator[termIndex]) - { - if (++termIndex >= termLen) - return false; // return false if terminate string found before target string - } - else - termIndex = 0; - } - - return false; + size_t index = 0; // maximum target string length is 64k bytes! + size_t termIndex = 0; + int c; + + if ( target == nullptr) + return true; + + if ( *target == 0) + return true; // return true if target is a null string + + if (terminator == nullptr) + termLen = 0; + + while ( (c = timedRead()) > 0) + { + if ( c == target[index]) + { + //////Serial.print("found "); Serial.write(c); Serial.print("index now"); Serial.println(index+1); + if (++index >= targetLen) + { + // return true if all chars in the target match + return true; + } + } + else + { + index = 0; // reset index if any char does not match + } + + if (termLen > 0 && c == terminator[termIndex]) + { + if (++termIndex >= termLen) + return false; // return false if terminate string found before target string + } + else + termIndex = 0; + } + + return false; } @@ -173,95 +173,93 @@ bool Stream::findUntil(const char *target, size_t targetLen, const char *termina // function is terminated by the first character that is not a digit. long Stream::parseInt() { - return parseInt(NO_SKIP_CHAR); // terminate on first non-digit character (or timeout) + return parseInt(NO_SKIP_CHAR); // terminate on first non-digit character (or timeout) } // as above but a given skipChar is ignored // this allows format characters (typically commas) in values to be ignored long Stream::parseInt(char skipChar) { - boolean isNegative = false; - long value = 0; - int c; - - c = peekNextDigit(); - - // ignore non numeric leading characters - if (c < 0) - return 0; // zero returned if timeout - - do - { - if (c == skipChar) - ; // ignore this charactor - else if (c == '-') - isNegative = true; - else if (c >= '0' && c <= '9') // is c a digit? - value = value * 10 + c - '0'; - - read(); // consume the character we got with peek - c = timedPeek(); - } - while ( (c >= '0' && c <= '9') || c == skipChar ); - - if (isNegative) - value = -value; - - return value; + boolean isNegative = false; + long value = 0; + int c; + + c = peekNextDigit(); + + // ignore non numeric leading characters + if (c < 0) + return 0; // zero returned if timeout + + do + { + if (c == skipChar) + ; // ignore this charactor + else if (c == '-') + isNegative = true; + else if (c >= '0' && c <= '9') // is c a digit? + value = value * 10 + c - '0'; + + read(); // consume the character we got with peek + c = timedPeek(); + } while ( (c >= '0' && c <= '9') || c == skipChar ); + + if (isNegative) + value = -value; + + return value; } // as parseInt but returns a floating point value float Stream::parseFloat() { - return parseFloat(NO_SKIP_CHAR); + return parseFloat(NO_SKIP_CHAR); } // as above but the given skipChar is ignored // this allows format characters (typically commas) in values to be ignored float Stream::parseFloat(char skipChar) { - boolean isNegative = false; - boolean isFraction = false; - long value = 0; - int c; - float fraction = 1.0; - - c = peekNextDigit(); - - // ignore non numeric leading characters - if (c < 0) - return 0; // zero returned if timeout - - do - { - if (c == skipChar) - ; // ignore - else if (c == '-') - isNegative = true; - else if (c == '.') - isFraction = true; - else if (c >= '0' && c <= '9') - { - // is c a digit? - value = value * 10 + c - '0'; - - if (isFraction) - fraction *= 0.1f; - } - - read(); // consume the character we got with peek - c = timedPeek(); - } - while ( (c >= '0' && c <= '9') || c == '.' || c == skipChar ); - - if (isNegative) - value = -value; - - if (isFraction) - return value * fraction; - else - return value; + boolean isNegative = false; + boolean isFraction = false; + long value = 0; + int c; + float fraction = 1.0; + + c = peekNextDigit(); + + // ignore non numeric leading characters + if (c < 0) + return 0; // zero returned if timeout + + do + { + if (c == skipChar) + ; // ignore + else if (c == '-') + isNegative = true; + else if (c == '.') + isFraction = true; + else if (c >= '0' && c <= '9') + { + // is c a digit? + value = value * 10 + c - '0'; + + if (isFraction) + fraction *= 0.1f; + } + + read(); // consume the character we got with peek + c = timedPeek(); + } while ( (c >= '0' && c <= '9') || c == '.' || c == skipChar ); + + if (isNegative) + value = -value; + + if (isFraction) + return value * fraction; + else + return value; } // read characters from stream into buffer @@ -271,26 +269,26 @@ float Stream::parseFloat(char skipChar) // size_t Stream::readBytes(char *buffer, size_t length) { - if (buffer == nullptr) - return 0; + if (buffer == nullptr) + return 0; - size_t count = 0; + size_t count = 0; - while (count < length) - { - int c = timedRead(); + while (count < length) + { + int c = timedRead(); - if (c < 0) - { - setReadError(); - break; - } + if (c < 0) + { + setReadError(); + break; + } - *buffer++ = (char)c; - count++; - } + *buffer++ = (char)c; + count++; + } - return count; + return count; } @@ -300,34 +298,34 @@ size_t Stream::readBytes(char *buffer, size_t length) size_t Stream::readBytesUntil(char terminator, char *buffer, size_t length) { - if (buffer == nullptr) - return 0; + if (buffer == nullptr) + return 0; - if (length < 1) - return 0; + if (length < 1) + return 0; - length--; - size_t index = 0; + length--; + size_t index = 0; - while (index < length) - { - int c = timedRead(); + while (index < length) + { + int c = timedRead(); - if (c == terminator) - break; + if (c == terminator) + break; - if (c < 0) - { - setReadError(); - break; - } + if (c < 0) + { + setReadError(); + break; + } - *buffer++ = (char)c; - index++; - } + *buffer++ = (char)c; + index++; + } - *buffer = 0; - return index; // return number of characters, not including null terminator + *buffer = 0; + return index; // return number of characters, not including null terminator } #if 1 @@ -335,112 +333,112 @@ size_t Stream::readBytesUntil(char terminator, char *buffer, size_t length) String Stream::readString(size_t max) { - String ret; - int c = timedRead(); + String ret; + int c = timedRead(); - while (c >= 0) - { - ret += (char)c; - c = timedRead(); - } + while (c >= 0) + { + ret += (char)c; + c = timedRead(); + } - return ret; + return ret; } char readStringBuffer[2048]; char* Stream::readCharsUntil(char terminator, size_t max) { - uint16_t offset = 0; + uint16_t offset = 0; - int c = timedRead(); + int c = timedRead(); - readStringBuffer[offset++] = c; + readStringBuffer[offset++] = c; - while (c >= 0 && c != terminator) - { - c = timedRead(); + while (c >= 0 && c != terminator) + { + c = timedRead(); - readStringBuffer[offset++] = c; - } + readStringBuffer[offset++] = c; + } - readStringBuffer[offset] = 0; + readStringBuffer[offset] = 0; - return readStringBuffer; + return readStringBuffer; } String Stream::readStringUntil(char terminator, size_t max) { - String ret; - uint16_t offset = 0; + String ret; + uint16_t offset = 0; - int c = timedRead(); + int c = timedRead(); - readStringBuffer[offset++] = c; + readStringBuffer[offset++] = c; - while (c >= 0 && c != terminator) - { - c = timedRead(); + while (c >= 0 && c != terminator) + { + c = timedRead(); - readStringBuffer[offset++] = c; - } + readStringBuffer[offset++] = c; + } - readStringBuffer[offset] = 0; + readStringBuffer[offset] = 0; - ret = String(readStringBuffer); + ret = String(readStringBuffer); - return String(readStringBuffer); + return String(readStringBuffer); } #else String Stream::readString(size_t max) { - String str; - size_t length = 0; + String str; + size_t length = 0; - while (length < max) - { - int c = timedRead(); + while (length < max) + { + int c = timedRead(); - if (c < 0) - { - setReadError(); - break; // timeout - } + if (c < 0) + { + setReadError(); + break; // timeout + } - if (c == 0) - break; + if (c == 0) + break; - str += (char)c; - length++; - } + str += (char)c; + length++; + } - return str; + return str; } String Stream::readStringUntil(char terminator, size_t max) { - String str; - size_t length = 0; + String str; + size_t length = 0; - while (length < max) - { - int c = timedRead(); + while (length < max) + { + int c = timedRead(); - if (c < 0) - { - setReadError(); - break; // timeout - } + if (c < 0) + { + setReadError(); + break; // timeout + } - if (c == 0 || c == terminator) - break; + if (c == 0 || c == terminator) + break; - str += (char)c; - length++; - } + str += (char)c; + length++; + } - return str; + return str; } #endif diff --git a/Packages_Patches/hardware/teensy/avr/cores/teensy/Stream.h b/Packages_Patches/hardware/teensy/avr/cores/teensy/Stream.h index e63330a8..b3cea254 100644 --- a/Packages_Patches/hardware/teensy/avr/cores/teensy/Stream.h +++ b/Packages_Patches/hardware/teensy/avr/cores/teensy/Stream.h @@ -25,124 +25,124 @@ class Stream : public Print { - public: - constexpr Stream() : _timeout(1000), read_error(0) {} - virtual int available() = 0; - virtual int read() = 0; - virtual int peek() = 0; - - void setTimeout(unsigned long timeout); - bool find(const char *target); - - bool find(const uint8_t *target) - { - return find ((const char *)target); - } - - bool find(const String &target) - { - return find(target.c_str()); - } - - bool find(const char *target, size_t length); - - bool find(const uint8_t *target, size_t length) - { - return find ((const char *)target, length); - } - - bool find(const String &target, size_t length) - { - return find(target.c_str(), length); - } - - bool findUntil(const char *target, const char *terminator); - - bool findUntil(const uint8_t *target, const char *terminator) - { - return findUntil((const char *)target, terminator); - } - - bool findUntil(const String &target, const char *terminator) - { - return findUntil(target.c_str(), terminator); - } - - bool findUntil(const char *target, const String &terminator) - { - return findUntil(target, terminator.c_str()); - } - - bool findUntil(const String &target, const String &terminator) - { - return findUntil(target.c_str(), terminator.c_str()); - } - - bool findUntil(const char *target, size_t targetLen, const char *terminate, size_t termLen); - - bool findUntil(const uint8_t *target, size_t targetLen, const char *terminate, size_t termLen) - { - return findUntil((const char *)target, targetLen, terminate, termLen); - } - - bool findUntil(const String &target, size_t targetLen, const char *terminate, size_t termLen); - bool findUntil(const char *target, size_t targetLen, const String &terminate, size_t termLen); - bool findUntil(const String &target, size_t targetLen, const String &terminate, size_t termLen); - - long parseInt(); - long parseInt(char skipChar); - - float parseFloat(); - float parseFloat(char skipChar); - - size_t readBytes(char *buffer, size_t length); - - size_t readBytes(uint8_t *buffer, size_t length) - { - return readBytes((char *)buffer, length); - } - - size_t readBytesUntil(char terminator, char *buffer, size_t length); - - size_t readBytesUntil(char terminator, uint8_t *buffer, size_t length) - { - return readBytesUntil(terminator, (char *)buffer, length); - } - - //////////////////////////////////////////////////////////// - String readString(size_t max = 512); - String readStringUntil(char terminator, size_t max = 512); - - // KH, to not use String - char* readCharsUntil(char terminator, size_t max = 512); - //////////////////////////////////////////////////////////// - - int getReadError() - { - return read_error; - } - - void clearReadError() - { - setReadError(0); - } - - protected: - void setReadError(int err = 1) - { - read_error = err; - } - - unsigned long _timeout; - - // KH - int timedRead(); - int timedPeek(); - int peekNextDigit(); - ////// - - private: - char read_error; + public: + constexpr Stream() : _timeout(1000), read_error(0) {} + virtual int available() = 0; + virtual int read() = 0; + virtual int peek() = 0; + + void setTimeout(unsigned long timeout); + bool find(const char *target); + + bool find(const uint8_t *target) + { + return find ((const char *)target); + } + + bool find(const String &target) + { + return find(target.c_str()); + } + + bool find(const char *target, size_t length); + + bool find(const uint8_t *target, size_t length) + { + return find ((const char *)target, length); + } + + bool find(const String &target, size_t length) + { + return find(target.c_str(), length); + } + + bool findUntil(const char *target, const char *terminator); + + bool findUntil(const uint8_t *target, const char *terminator) + { + return findUntil((const char *)target, terminator); + } + + bool findUntil(const String &target, const char *terminator) + { + return findUntil(target.c_str(), terminator); + } + + bool findUntil(const char *target, const String &terminator) + { + return findUntil(target, terminator.c_str()); + } + + bool findUntil(const String &target, const String &terminator) + { + return findUntil(target.c_str(), terminator.c_str()); + } + + bool findUntil(const char *target, size_t targetLen, const char *terminate, size_t termLen); + + bool findUntil(const uint8_t *target, size_t targetLen, const char *terminate, size_t termLen) + { + return findUntil((const char *)target, targetLen, terminate, termLen); + } + + bool findUntil(const String &target, size_t targetLen, const char *terminate, size_t termLen); + bool findUntil(const char *target, size_t targetLen, const String &terminate, size_t termLen); + bool findUntil(const String &target, size_t targetLen, const String &terminate, size_t termLen); + + long parseInt(); + long parseInt(char skipChar); + + float parseFloat(); + float parseFloat(char skipChar); + + size_t readBytes(char *buffer, size_t length); + + size_t readBytes(uint8_t *buffer, size_t length) + { + return readBytes((char *)buffer, length); + } + + size_t readBytesUntil(char terminator, char *buffer, size_t length); + + size_t readBytesUntil(char terminator, uint8_t *buffer, size_t length) + { + return readBytesUntil(terminator, (char *)buffer, length); + } + + //////////////////////////////////////////////////////////// + String readString(size_t max = 512); + String readStringUntil(char terminator, size_t max = 512); + + // KH, to not use String + char* readCharsUntil(char terminator, size_t max = 512); + //////////////////////////////////////////////////////////// + + int getReadError() + { + return read_error; + } + + void clearReadError() + { + setReadError(0); + } + + protected: + void setReadError(int err = 1) + { + read_error = err; + } + + unsigned long _timeout; + + // KH + int timedRead(); + int timedPeek(); + int peekNextDigit(); + ////// + + private: + char read_error; }; #endif diff --git a/Packages_Patches/hardware/teensy/avr/cores/teensy3/Stream.cpp b/Packages_Patches/hardware/teensy/avr/cores/teensy3/Stream.cpp index 6c78ed57..09903ebf 100644 --- a/Packages_Patches/hardware/teensy/avr/cores/teensy3/Stream.cpp +++ b/Packages_Patches/hardware/teensy/avr/cores/teensy3/Stream.cpp @@ -1,24 +1,24 @@ /* - Stream.cpp - adds parsing methods to Stream class - Copyright (c) 2008 David A. Mellis. All right reserved. + Stream.cpp - adds parsing methods to Stream class + Copyright (c) 2008 David A. Mellis. All right reserved. - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - Created July 2011 - parsing functions based on TextFinder library by Michael Margolis - */ + Created July 2011 + parsing functions based on TextFinder library by Michael Margolis +*/ #include @@ -28,65 +28,65 @@ // private method to read stream with timeout int Stream::timedRead() { - int c; - unsigned long startMillis = millis(); + int c; + unsigned long startMillis = millis(); - do - { - c = read(); + do + { + c = read(); - if (c >= 0) - return c; + if (c >= 0) + return c; - yield(); - } while (millis() - startMillis < _timeout); + yield(); + } while (millis() - startMillis < _timeout); - Serial.print(("timedRead timeout = ")); - Serial.println(_timeout); + Serial.print(("timedRead timeout = ")); + Serial.println(_timeout); - return -1; // -1 indicates timeout + return -1; // -1 indicates timeout } // private method to peek stream with timeout int Stream::timedPeek() { - int c; - unsigned long startMillis = millis(); + int c; + unsigned long startMillis = millis(); - do - { - c = peek(); + do + { + c = peek(); - if (c >= 0) - return c; + if (c >= 0) + return c; - yield(); - } while (millis() - startMillis < _timeout); + yield(); + } while (millis() - startMillis < _timeout); - return -1; // -1 indicates timeout + return -1; // -1 indicates timeout } // returns peek of the next digit in the stream or -1 if timeout // discards non-numeric characters int Stream::peekNextDigit() { - int c; + int c; - while (1) - { - c = timedPeek(); + while (1) + { + c = timedPeek(); - if (c < 0) - return c; // timeout + if (c < 0) + return c; // timeout - if (c == '-') - return c; + if (c == '-') + return c; - if (c >= '0' && c <= '9') - return c; + if (c >= '0' && c <= '9') + return c; - read(); // discard non-numeric - } + read(); // discard non-numeric + } } // Public Methods @@ -94,31 +94,31 @@ int Stream::peekNextDigit() void Stream::setTimeout(unsigned long timeout) // sets the maximum number of milliseconds to wait { - _timeout = timeout; + _timeout = timeout; } // find returns true if the target string is found bool Stream::find(const char *target) { - return findUntil(target, NULL); + return findUntil(target, NULL); } // reads data from the stream until the target string of given length is found // returns true if target string is found, false if timed out bool Stream::find(const char *target, size_t length) { - return findUntil(target, length, NULL, 0); + return findUntil(target, length, NULL, 0); } // as find but search ends if the terminator string is found bool Stream::findUntil(const char *target, const char *terminator) { - if (target == nullptr) - return true; + if (target == nullptr) + return true; - size_t tlen = (terminator == nullptr) ? 0 : strlen(terminator); + size_t tlen = (terminator == nullptr) ? 0 : strlen(terminator); - return findUntil(target, strlen(target), terminator, tlen); + return findUntil(target, strlen(target), terminator, tlen); } // reads data from the stream until the target string of the given length is found @@ -126,45 +126,45 @@ bool Stream::findUntil(const char *target, const char *terminator) // returns true if target string is found, false if terminated or timed out bool Stream::findUntil(const char *target, size_t targetLen, const char *terminator, size_t termLen) { - size_t index = 0; // maximum target string length is 64k bytes! - size_t termIndex = 0; - int c; - - if ( target == nullptr) - return true; - - if ( *target == 0) - return true; // return true if target is a null string - - if (terminator == nullptr) - termLen = 0; - - while ( (c = timedRead()) > 0) - { - if ( c == target[index]) - { - //////Serial.print("found "); Serial.write(c); Serial.print("index now"); Serial.println(index+1); - if (++index >= targetLen) - { - // return true if all chars in the target match - return true; - } - } - else - { - index = 0; // reset index if any char does not match - } - - if (termLen > 0 && c == terminator[termIndex]) - { - if (++termIndex >= termLen) - return false; // return false if terminate string found before target string - } - else - termIndex = 0; - } - - return false; + size_t index = 0; // maximum target string length is 64k bytes! + size_t termIndex = 0; + int c; + + if ( target == nullptr) + return true; + + if ( *target == 0) + return true; // return true if target is a null string + + if (terminator == nullptr) + termLen = 0; + + while ( (c = timedRead()) > 0) + { + if ( c == target[index]) + { + //////Serial.print("found "); Serial.write(c); Serial.print("index now"); Serial.println(index+1); + if (++index >= targetLen) + { + // return true if all chars in the target match + return true; + } + } + else + { + index = 0; // reset index if any char does not match + } + + if (termLen > 0 && c == terminator[termIndex]) + { + if (++termIndex >= termLen) + return false; // return false if terminate string found before target string + } + else + termIndex = 0; + } + + return false; } @@ -173,95 +173,93 @@ bool Stream::findUntil(const char *target, size_t targetLen, const char *termina // function is terminated by the first character that is not a digit. long Stream::parseInt() { - return parseInt(NO_SKIP_CHAR); // terminate on first non-digit character (or timeout) + return parseInt(NO_SKIP_CHAR); // terminate on first non-digit character (or timeout) } // as above but a given skipChar is ignored // this allows format characters (typically commas) in values to be ignored long Stream::parseInt(char skipChar) { - boolean isNegative = false; - long value = 0; - int c; - - c = peekNextDigit(); - - // ignore non numeric leading characters - if (c < 0) - return 0; // zero returned if timeout - - do - { - if (c == skipChar) - ; // ignore this charactor - else if (c == '-') - isNegative = true; - else if (c >= '0' && c <= '9') // is c a digit? - value = value * 10 + c - '0'; - - read(); // consume the character we got with peek - c = timedPeek(); - } - while ( (c >= '0' && c <= '9') || c == skipChar ); - - if (isNegative) - value = -value; - - return value; + boolean isNegative = false; + long value = 0; + int c; + + c = peekNextDigit(); + + // ignore non numeric leading characters + if (c < 0) + return 0; // zero returned if timeout + + do + { + if (c == skipChar) + ; // ignore this charactor + else if (c == '-') + isNegative = true; + else if (c >= '0' && c <= '9') // is c a digit? + value = value * 10 + c - '0'; + + read(); // consume the character we got with peek + c = timedPeek(); + } while ( (c >= '0' && c <= '9') || c == skipChar ); + + if (isNegative) + value = -value; + + return value; } // as parseInt but returns a floating point value float Stream::parseFloat() { - return parseFloat(NO_SKIP_CHAR); + return parseFloat(NO_SKIP_CHAR); } // as above but the given skipChar is ignored // this allows format characters (typically commas) in values to be ignored float Stream::parseFloat(char skipChar) { - boolean isNegative = false; - boolean isFraction = false; - long value = 0; - int c; - float fraction = 1.0; - - c = peekNextDigit(); - - // ignore non numeric leading characters - if (c < 0) - return 0; // zero returned if timeout - - do - { - if (c == skipChar) - ; // ignore - else if (c == '-') - isNegative = true; - else if (c == '.') - isFraction = true; - else if (c >= '0' && c <= '9') - { - // is c a digit? - value = value * 10 + c - '0'; - - if (isFraction) - fraction *= 0.1f; - } - - read(); // consume the character we got with peek - c = timedPeek(); - } - while ( (c >= '0' && c <= '9') || c == '.' || c == skipChar ); - - if (isNegative) - value = -value; - - if (isFraction) - return value * fraction; - else - return value; + boolean isNegative = false; + boolean isFraction = false; + long value = 0; + int c; + float fraction = 1.0; + + c = peekNextDigit(); + + // ignore non numeric leading characters + if (c < 0) + return 0; // zero returned if timeout + + do + { + if (c == skipChar) + ; // ignore + else if (c == '-') + isNegative = true; + else if (c == '.') + isFraction = true; + else if (c >= '0' && c <= '9') + { + // is c a digit? + value = value * 10 + c - '0'; + + if (isFraction) + fraction *= 0.1f; + } + + read(); // consume the character we got with peek + c = timedPeek(); + } while ( (c >= '0' && c <= '9') || c == '.' || c == skipChar ); + + if (isNegative) + value = -value; + + if (isFraction) + return value * fraction; + else + return value; } // read characters from stream into buffer @@ -271,26 +269,26 @@ float Stream::parseFloat(char skipChar) // size_t Stream::readBytes(char *buffer, size_t length) { - if (buffer == nullptr) - return 0; + if (buffer == nullptr) + return 0; - size_t count = 0; + size_t count = 0; - while (count < length) - { - int c = timedRead(); + while (count < length) + { + int c = timedRead(); - if (c < 0) - { - setReadError(); - break; - } + if (c < 0) + { + setReadError(); + break; + } - *buffer++ = (char)c; - count++; - } + *buffer++ = (char)c; + count++; + } - return count; + return count; } @@ -300,34 +298,34 @@ size_t Stream::readBytes(char *buffer, size_t length) size_t Stream::readBytesUntil(char terminator, char *buffer, size_t length) { - if (buffer == nullptr) - return 0; + if (buffer == nullptr) + return 0; - if (length < 1) - return 0; + if (length < 1) + return 0; - length--; - size_t index = 0; + length--; + size_t index = 0; - while (index < length) - { - int c = timedRead(); + while (index < length) + { + int c = timedRead(); - if (c == terminator) - break; + if (c == terminator) + break; - if (c < 0) - { - setReadError(); - break; - } + if (c < 0) + { + setReadError(); + break; + } - *buffer++ = (char)c; - index++; - } + *buffer++ = (char)c; + index++; + } - *buffer = 0; - return index; // return number of characters, not including null terminator + *buffer = 0; + return index; // return number of characters, not including null terminator } #if 1 @@ -335,112 +333,112 @@ size_t Stream::readBytesUntil(char terminator, char *buffer, size_t length) String Stream::readString(size_t max) { - String ret; - int c = timedRead(); + String ret; + int c = timedRead(); - while (c >= 0) - { - ret += (char)c; - c = timedRead(); - } + while (c >= 0) + { + ret += (char)c; + c = timedRead(); + } - return ret; + return ret; } char readStringBuffer[2048]; char* Stream::readCharsUntil(char terminator, size_t max) { - uint16_t offset = 0; + uint16_t offset = 0; - int c = timedRead(); + int c = timedRead(); - readStringBuffer[offset++] = c; + readStringBuffer[offset++] = c; - while (c >= 0 && c != terminator) - { - c = timedRead(); + while (c >= 0 && c != terminator) + { + c = timedRead(); - readStringBuffer[offset++] = c; - } + readStringBuffer[offset++] = c; + } - readStringBuffer[offset] = 0; + readStringBuffer[offset] = 0; - return readStringBuffer; + return readStringBuffer; } String Stream::readStringUntil(char terminator, size_t max) { - String ret; - uint16_t offset = 0; + String ret; + uint16_t offset = 0; - int c = timedRead(); + int c = timedRead(); - readStringBuffer[offset++] = c; + readStringBuffer[offset++] = c; - while (c >= 0 && c != terminator) - { - c = timedRead(); + while (c >= 0 && c != terminator) + { + c = timedRead(); - readStringBuffer[offset++] = c; - } + readStringBuffer[offset++] = c; + } - readStringBuffer[offset] = 0; + readStringBuffer[offset] = 0; - ret = String(readStringBuffer); + ret = String(readStringBuffer); - return String(readStringBuffer); + return String(readStringBuffer); } #else String Stream::readString(size_t max) { - String str; - size_t length = 0; + String str; + size_t length = 0; - while (length < max) - { - int c = timedRead(); + while (length < max) + { + int c = timedRead(); - if (c < 0) - { - setReadError(); - break; // timeout - } + if (c < 0) + { + setReadError(); + break; // timeout + } - if (c == 0) - break; + if (c == 0) + break; - str += (char)c; - length++; - } + str += (char)c; + length++; + } - return str; + return str; } String Stream::readStringUntil(char terminator, size_t max) { - String str; - size_t length = 0; + String str; + size_t length = 0; - while (length < max) - { - int c = timedRead(); + while (length < max) + { + int c = timedRead(); - if (c < 0) - { - setReadError(); - break; // timeout - } + if (c < 0) + { + setReadError(); + break; // timeout + } - if (c == 0 || c == terminator) - break; + if (c == 0 || c == terminator) + break; - str += (char)c; - length++; - } + str += (char)c; + length++; + } - return str; + return str; } #endif diff --git a/Packages_Patches/hardware/teensy/avr/cores/teensy3/Stream.h b/Packages_Patches/hardware/teensy/avr/cores/teensy3/Stream.h index e63330a8..b3cea254 100644 --- a/Packages_Patches/hardware/teensy/avr/cores/teensy3/Stream.h +++ b/Packages_Patches/hardware/teensy/avr/cores/teensy3/Stream.h @@ -25,124 +25,124 @@ class Stream : public Print { - public: - constexpr Stream() : _timeout(1000), read_error(0) {} - virtual int available() = 0; - virtual int read() = 0; - virtual int peek() = 0; - - void setTimeout(unsigned long timeout); - bool find(const char *target); - - bool find(const uint8_t *target) - { - return find ((const char *)target); - } - - bool find(const String &target) - { - return find(target.c_str()); - } - - bool find(const char *target, size_t length); - - bool find(const uint8_t *target, size_t length) - { - return find ((const char *)target, length); - } - - bool find(const String &target, size_t length) - { - return find(target.c_str(), length); - } - - bool findUntil(const char *target, const char *terminator); - - bool findUntil(const uint8_t *target, const char *terminator) - { - return findUntil((const char *)target, terminator); - } - - bool findUntil(const String &target, const char *terminator) - { - return findUntil(target.c_str(), terminator); - } - - bool findUntil(const char *target, const String &terminator) - { - return findUntil(target, terminator.c_str()); - } - - bool findUntil(const String &target, const String &terminator) - { - return findUntil(target.c_str(), terminator.c_str()); - } - - bool findUntil(const char *target, size_t targetLen, const char *terminate, size_t termLen); - - bool findUntil(const uint8_t *target, size_t targetLen, const char *terminate, size_t termLen) - { - return findUntil((const char *)target, targetLen, terminate, termLen); - } - - bool findUntil(const String &target, size_t targetLen, const char *terminate, size_t termLen); - bool findUntil(const char *target, size_t targetLen, const String &terminate, size_t termLen); - bool findUntil(const String &target, size_t targetLen, const String &terminate, size_t termLen); - - long parseInt(); - long parseInt(char skipChar); - - float parseFloat(); - float parseFloat(char skipChar); - - size_t readBytes(char *buffer, size_t length); - - size_t readBytes(uint8_t *buffer, size_t length) - { - return readBytes((char *)buffer, length); - } - - size_t readBytesUntil(char terminator, char *buffer, size_t length); - - size_t readBytesUntil(char terminator, uint8_t *buffer, size_t length) - { - return readBytesUntil(terminator, (char *)buffer, length); - } - - //////////////////////////////////////////////////////////// - String readString(size_t max = 512); - String readStringUntil(char terminator, size_t max = 512); - - // KH, to not use String - char* readCharsUntil(char terminator, size_t max = 512); - //////////////////////////////////////////////////////////// - - int getReadError() - { - return read_error; - } - - void clearReadError() - { - setReadError(0); - } - - protected: - void setReadError(int err = 1) - { - read_error = err; - } - - unsigned long _timeout; - - // KH - int timedRead(); - int timedPeek(); - int peekNextDigit(); - ////// - - private: - char read_error; + public: + constexpr Stream() : _timeout(1000), read_error(0) {} + virtual int available() = 0; + virtual int read() = 0; + virtual int peek() = 0; + + void setTimeout(unsigned long timeout); + bool find(const char *target); + + bool find(const uint8_t *target) + { + return find ((const char *)target); + } + + bool find(const String &target) + { + return find(target.c_str()); + } + + bool find(const char *target, size_t length); + + bool find(const uint8_t *target, size_t length) + { + return find ((const char *)target, length); + } + + bool find(const String &target, size_t length) + { + return find(target.c_str(), length); + } + + bool findUntil(const char *target, const char *terminator); + + bool findUntil(const uint8_t *target, const char *terminator) + { + return findUntil((const char *)target, terminator); + } + + bool findUntil(const String &target, const char *terminator) + { + return findUntil(target.c_str(), terminator); + } + + bool findUntil(const char *target, const String &terminator) + { + return findUntil(target, terminator.c_str()); + } + + bool findUntil(const String &target, const String &terminator) + { + return findUntil(target.c_str(), terminator.c_str()); + } + + bool findUntil(const char *target, size_t targetLen, const char *terminate, size_t termLen); + + bool findUntil(const uint8_t *target, size_t targetLen, const char *terminate, size_t termLen) + { + return findUntil((const char *)target, targetLen, terminate, termLen); + } + + bool findUntil(const String &target, size_t targetLen, const char *terminate, size_t termLen); + bool findUntil(const char *target, size_t targetLen, const String &terminate, size_t termLen); + bool findUntil(const String &target, size_t targetLen, const String &terminate, size_t termLen); + + long parseInt(); + long parseInt(char skipChar); + + float parseFloat(); + float parseFloat(char skipChar); + + size_t readBytes(char *buffer, size_t length); + + size_t readBytes(uint8_t *buffer, size_t length) + { + return readBytes((char *)buffer, length); + } + + size_t readBytesUntil(char terminator, char *buffer, size_t length); + + size_t readBytesUntil(char terminator, uint8_t *buffer, size_t length) + { + return readBytesUntil(terminator, (char *)buffer, length); + } + + //////////////////////////////////////////////////////////// + String readString(size_t max = 512); + String readStringUntil(char terminator, size_t max = 512); + + // KH, to not use String + char* readCharsUntil(char terminator, size_t max = 512); + //////////////////////////////////////////////////////////// + + int getReadError() + { + return read_error; + } + + void clearReadError() + { + setReadError(0); + } + + protected: + void setReadError(int err = 1) + { + read_error = err; + } + + unsigned long _timeout; + + // KH + int timedRead(); + int timedPeek(); + int peekNextDigit(); + ////// + + private: + char read_error; }; #endif diff --git a/Packages_Patches/hardware/teensy/avr/cores/teensy4/Stream.cpp b/Packages_Patches/hardware/teensy/avr/cores/teensy4/Stream.cpp index 6c78ed57..09903ebf 100644 --- a/Packages_Patches/hardware/teensy/avr/cores/teensy4/Stream.cpp +++ b/Packages_Patches/hardware/teensy/avr/cores/teensy4/Stream.cpp @@ -1,24 +1,24 @@ /* - Stream.cpp - adds parsing methods to Stream class - Copyright (c) 2008 David A. Mellis. All right reserved. + Stream.cpp - adds parsing methods to Stream class + Copyright (c) 2008 David A. Mellis. All right reserved. - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - Created July 2011 - parsing functions based on TextFinder library by Michael Margolis - */ + Created July 2011 + parsing functions based on TextFinder library by Michael Margolis +*/ #include @@ -28,65 +28,65 @@ // private method to read stream with timeout int Stream::timedRead() { - int c; - unsigned long startMillis = millis(); + int c; + unsigned long startMillis = millis(); - do - { - c = read(); + do + { + c = read(); - if (c >= 0) - return c; + if (c >= 0) + return c; - yield(); - } while (millis() - startMillis < _timeout); + yield(); + } while (millis() - startMillis < _timeout); - Serial.print(("timedRead timeout = ")); - Serial.println(_timeout); + Serial.print(("timedRead timeout = ")); + Serial.println(_timeout); - return -1; // -1 indicates timeout + return -1; // -1 indicates timeout } // private method to peek stream with timeout int Stream::timedPeek() { - int c; - unsigned long startMillis = millis(); + int c; + unsigned long startMillis = millis(); - do - { - c = peek(); + do + { + c = peek(); - if (c >= 0) - return c; + if (c >= 0) + return c; - yield(); - } while (millis() - startMillis < _timeout); + yield(); + } while (millis() - startMillis < _timeout); - return -1; // -1 indicates timeout + return -1; // -1 indicates timeout } // returns peek of the next digit in the stream or -1 if timeout // discards non-numeric characters int Stream::peekNextDigit() { - int c; + int c; - while (1) - { - c = timedPeek(); + while (1) + { + c = timedPeek(); - if (c < 0) - return c; // timeout + if (c < 0) + return c; // timeout - if (c == '-') - return c; + if (c == '-') + return c; - if (c >= '0' && c <= '9') - return c; + if (c >= '0' && c <= '9') + return c; - read(); // discard non-numeric - } + read(); // discard non-numeric + } } // Public Methods @@ -94,31 +94,31 @@ int Stream::peekNextDigit() void Stream::setTimeout(unsigned long timeout) // sets the maximum number of milliseconds to wait { - _timeout = timeout; + _timeout = timeout; } // find returns true if the target string is found bool Stream::find(const char *target) { - return findUntil(target, NULL); + return findUntil(target, NULL); } // reads data from the stream until the target string of given length is found // returns true if target string is found, false if timed out bool Stream::find(const char *target, size_t length) { - return findUntil(target, length, NULL, 0); + return findUntil(target, length, NULL, 0); } // as find but search ends if the terminator string is found bool Stream::findUntil(const char *target, const char *terminator) { - if (target == nullptr) - return true; + if (target == nullptr) + return true; - size_t tlen = (terminator == nullptr) ? 0 : strlen(terminator); + size_t tlen = (terminator == nullptr) ? 0 : strlen(terminator); - return findUntil(target, strlen(target), terminator, tlen); + return findUntil(target, strlen(target), terminator, tlen); } // reads data from the stream until the target string of the given length is found @@ -126,45 +126,45 @@ bool Stream::findUntil(const char *target, const char *terminator) // returns true if target string is found, false if terminated or timed out bool Stream::findUntil(const char *target, size_t targetLen, const char *terminator, size_t termLen) { - size_t index = 0; // maximum target string length is 64k bytes! - size_t termIndex = 0; - int c; - - if ( target == nullptr) - return true; - - if ( *target == 0) - return true; // return true if target is a null string - - if (terminator == nullptr) - termLen = 0; - - while ( (c = timedRead()) > 0) - { - if ( c == target[index]) - { - //////Serial.print("found "); Serial.write(c); Serial.print("index now"); Serial.println(index+1); - if (++index >= targetLen) - { - // return true if all chars in the target match - return true; - } - } - else - { - index = 0; // reset index if any char does not match - } - - if (termLen > 0 && c == terminator[termIndex]) - { - if (++termIndex >= termLen) - return false; // return false if terminate string found before target string - } - else - termIndex = 0; - } - - return false; + size_t index = 0; // maximum target string length is 64k bytes! + size_t termIndex = 0; + int c; + + if ( target == nullptr) + return true; + + if ( *target == 0) + return true; // return true if target is a null string + + if (terminator == nullptr) + termLen = 0; + + while ( (c = timedRead()) > 0) + { + if ( c == target[index]) + { + //////Serial.print("found "); Serial.write(c); Serial.print("index now"); Serial.println(index+1); + if (++index >= targetLen) + { + // return true if all chars in the target match + return true; + } + } + else + { + index = 0; // reset index if any char does not match + } + + if (termLen > 0 && c == terminator[termIndex]) + { + if (++termIndex >= termLen) + return false; // return false if terminate string found before target string + } + else + termIndex = 0; + } + + return false; } @@ -173,95 +173,93 @@ bool Stream::findUntil(const char *target, size_t targetLen, const char *termina // function is terminated by the first character that is not a digit. long Stream::parseInt() { - return parseInt(NO_SKIP_CHAR); // terminate on first non-digit character (or timeout) + return parseInt(NO_SKIP_CHAR); // terminate on first non-digit character (or timeout) } // as above but a given skipChar is ignored // this allows format characters (typically commas) in values to be ignored long Stream::parseInt(char skipChar) { - boolean isNegative = false; - long value = 0; - int c; - - c = peekNextDigit(); - - // ignore non numeric leading characters - if (c < 0) - return 0; // zero returned if timeout - - do - { - if (c == skipChar) - ; // ignore this charactor - else if (c == '-') - isNegative = true; - else if (c >= '0' && c <= '9') // is c a digit? - value = value * 10 + c - '0'; - - read(); // consume the character we got with peek - c = timedPeek(); - } - while ( (c >= '0' && c <= '9') || c == skipChar ); - - if (isNegative) - value = -value; - - return value; + boolean isNegative = false; + long value = 0; + int c; + + c = peekNextDigit(); + + // ignore non numeric leading characters + if (c < 0) + return 0; // zero returned if timeout + + do + { + if (c == skipChar) + ; // ignore this charactor + else if (c == '-') + isNegative = true; + else if (c >= '0' && c <= '9') // is c a digit? + value = value * 10 + c - '0'; + + read(); // consume the character we got with peek + c = timedPeek(); + } while ( (c >= '0' && c <= '9') || c == skipChar ); + + if (isNegative) + value = -value; + + return value; } // as parseInt but returns a floating point value float Stream::parseFloat() { - return parseFloat(NO_SKIP_CHAR); + return parseFloat(NO_SKIP_CHAR); } // as above but the given skipChar is ignored // this allows format characters (typically commas) in values to be ignored float Stream::parseFloat(char skipChar) { - boolean isNegative = false; - boolean isFraction = false; - long value = 0; - int c; - float fraction = 1.0; - - c = peekNextDigit(); - - // ignore non numeric leading characters - if (c < 0) - return 0; // zero returned if timeout - - do - { - if (c == skipChar) - ; // ignore - else if (c == '-') - isNegative = true; - else if (c == '.') - isFraction = true; - else if (c >= '0' && c <= '9') - { - // is c a digit? - value = value * 10 + c - '0'; - - if (isFraction) - fraction *= 0.1f; - } - - read(); // consume the character we got with peek - c = timedPeek(); - } - while ( (c >= '0' && c <= '9') || c == '.' || c == skipChar ); - - if (isNegative) - value = -value; - - if (isFraction) - return value * fraction; - else - return value; + boolean isNegative = false; + boolean isFraction = false; + long value = 0; + int c; + float fraction = 1.0; + + c = peekNextDigit(); + + // ignore non numeric leading characters + if (c < 0) + return 0; // zero returned if timeout + + do + { + if (c == skipChar) + ; // ignore + else if (c == '-') + isNegative = true; + else if (c == '.') + isFraction = true; + else if (c >= '0' && c <= '9') + { + // is c a digit? + value = value * 10 + c - '0'; + + if (isFraction) + fraction *= 0.1f; + } + + read(); // consume the character we got with peek + c = timedPeek(); + } while ( (c >= '0' && c <= '9') || c == '.' || c == skipChar ); + + if (isNegative) + value = -value; + + if (isFraction) + return value * fraction; + else + return value; } // read characters from stream into buffer @@ -271,26 +269,26 @@ float Stream::parseFloat(char skipChar) // size_t Stream::readBytes(char *buffer, size_t length) { - if (buffer == nullptr) - return 0; + if (buffer == nullptr) + return 0; - size_t count = 0; + size_t count = 0; - while (count < length) - { - int c = timedRead(); + while (count < length) + { + int c = timedRead(); - if (c < 0) - { - setReadError(); - break; - } + if (c < 0) + { + setReadError(); + break; + } - *buffer++ = (char)c; - count++; - } + *buffer++ = (char)c; + count++; + } - return count; + return count; } @@ -300,34 +298,34 @@ size_t Stream::readBytes(char *buffer, size_t length) size_t Stream::readBytesUntil(char terminator, char *buffer, size_t length) { - if (buffer == nullptr) - return 0; + if (buffer == nullptr) + return 0; - if (length < 1) - return 0; + if (length < 1) + return 0; - length--; - size_t index = 0; + length--; + size_t index = 0; - while (index < length) - { - int c = timedRead(); + while (index < length) + { + int c = timedRead(); - if (c == terminator) - break; + if (c == terminator) + break; - if (c < 0) - { - setReadError(); - break; - } + if (c < 0) + { + setReadError(); + break; + } - *buffer++ = (char)c; - index++; - } + *buffer++ = (char)c; + index++; + } - *buffer = 0; - return index; // return number of characters, not including null terminator + *buffer = 0; + return index; // return number of characters, not including null terminator } #if 1 @@ -335,112 +333,112 @@ size_t Stream::readBytesUntil(char terminator, char *buffer, size_t length) String Stream::readString(size_t max) { - String ret; - int c = timedRead(); + String ret; + int c = timedRead(); - while (c >= 0) - { - ret += (char)c; - c = timedRead(); - } + while (c >= 0) + { + ret += (char)c; + c = timedRead(); + } - return ret; + return ret; } char readStringBuffer[2048]; char* Stream::readCharsUntil(char terminator, size_t max) { - uint16_t offset = 0; + uint16_t offset = 0; - int c = timedRead(); + int c = timedRead(); - readStringBuffer[offset++] = c; + readStringBuffer[offset++] = c; - while (c >= 0 && c != terminator) - { - c = timedRead(); + while (c >= 0 && c != terminator) + { + c = timedRead(); - readStringBuffer[offset++] = c; - } + readStringBuffer[offset++] = c; + } - readStringBuffer[offset] = 0; + readStringBuffer[offset] = 0; - return readStringBuffer; + return readStringBuffer; } String Stream::readStringUntil(char terminator, size_t max) { - String ret; - uint16_t offset = 0; + String ret; + uint16_t offset = 0; - int c = timedRead(); + int c = timedRead(); - readStringBuffer[offset++] = c; + readStringBuffer[offset++] = c; - while (c >= 0 && c != terminator) - { - c = timedRead(); + while (c >= 0 && c != terminator) + { + c = timedRead(); - readStringBuffer[offset++] = c; - } + readStringBuffer[offset++] = c; + } - readStringBuffer[offset] = 0; + readStringBuffer[offset] = 0; - ret = String(readStringBuffer); + ret = String(readStringBuffer); - return String(readStringBuffer); + return String(readStringBuffer); } #else String Stream::readString(size_t max) { - String str; - size_t length = 0; + String str; + size_t length = 0; - while (length < max) - { - int c = timedRead(); + while (length < max) + { + int c = timedRead(); - if (c < 0) - { - setReadError(); - break; // timeout - } + if (c < 0) + { + setReadError(); + break; // timeout + } - if (c == 0) - break; + if (c == 0) + break; - str += (char)c; - length++; - } + str += (char)c; + length++; + } - return str; + return str; } String Stream::readStringUntil(char terminator, size_t max) { - String str; - size_t length = 0; + String str; + size_t length = 0; - while (length < max) - { - int c = timedRead(); + while (length < max) + { + int c = timedRead(); - if (c < 0) - { - setReadError(); - break; // timeout - } + if (c < 0) + { + setReadError(); + break; // timeout + } - if (c == 0 || c == terminator) - break; + if (c == 0 || c == terminator) + break; - str += (char)c; - length++; - } + str += (char)c; + length++; + } - return str; + return str; } #endif diff --git a/Packages_Patches/hardware/teensy/avr/cores/teensy4/Stream.h b/Packages_Patches/hardware/teensy/avr/cores/teensy4/Stream.h index e63330a8..b3cea254 100644 --- a/Packages_Patches/hardware/teensy/avr/cores/teensy4/Stream.h +++ b/Packages_Patches/hardware/teensy/avr/cores/teensy4/Stream.h @@ -25,124 +25,124 @@ class Stream : public Print { - public: - constexpr Stream() : _timeout(1000), read_error(0) {} - virtual int available() = 0; - virtual int read() = 0; - virtual int peek() = 0; - - void setTimeout(unsigned long timeout); - bool find(const char *target); - - bool find(const uint8_t *target) - { - return find ((const char *)target); - } - - bool find(const String &target) - { - return find(target.c_str()); - } - - bool find(const char *target, size_t length); - - bool find(const uint8_t *target, size_t length) - { - return find ((const char *)target, length); - } - - bool find(const String &target, size_t length) - { - return find(target.c_str(), length); - } - - bool findUntil(const char *target, const char *terminator); - - bool findUntil(const uint8_t *target, const char *terminator) - { - return findUntil((const char *)target, terminator); - } - - bool findUntil(const String &target, const char *terminator) - { - return findUntil(target.c_str(), terminator); - } - - bool findUntil(const char *target, const String &terminator) - { - return findUntil(target, terminator.c_str()); - } - - bool findUntil(const String &target, const String &terminator) - { - return findUntil(target.c_str(), terminator.c_str()); - } - - bool findUntil(const char *target, size_t targetLen, const char *terminate, size_t termLen); - - bool findUntil(const uint8_t *target, size_t targetLen, const char *terminate, size_t termLen) - { - return findUntil((const char *)target, targetLen, terminate, termLen); - } - - bool findUntil(const String &target, size_t targetLen, const char *terminate, size_t termLen); - bool findUntil(const char *target, size_t targetLen, const String &terminate, size_t termLen); - bool findUntil(const String &target, size_t targetLen, const String &terminate, size_t termLen); - - long parseInt(); - long parseInt(char skipChar); - - float parseFloat(); - float parseFloat(char skipChar); - - size_t readBytes(char *buffer, size_t length); - - size_t readBytes(uint8_t *buffer, size_t length) - { - return readBytes((char *)buffer, length); - } - - size_t readBytesUntil(char terminator, char *buffer, size_t length); - - size_t readBytesUntil(char terminator, uint8_t *buffer, size_t length) - { - return readBytesUntil(terminator, (char *)buffer, length); - } - - //////////////////////////////////////////////////////////// - String readString(size_t max = 512); - String readStringUntil(char terminator, size_t max = 512); - - // KH, to not use String - char* readCharsUntil(char terminator, size_t max = 512); - //////////////////////////////////////////////////////////// - - int getReadError() - { - return read_error; - } - - void clearReadError() - { - setReadError(0); - } - - protected: - void setReadError(int err = 1) - { - read_error = err; - } - - unsigned long _timeout; - - // KH - int timedRead(); - int timedPeek(); - int peekNextDigit(); - ////// - - private: - char read_error; + public: + constexpr Stream() : _timeout(1000), read_error(0) {} + virtual int available() = 0; + virtual int read() = 0; + virtual int peek() = 0; + + void setTimeout(unsigned long timeout); + bool find(const char *target); + + bool find(const uint8_t *target) + { + return find ((const char *)target); + } + + bool find(const String &target) + { + return find(target.c_str()); + } + + bool find(const char *target, size_t length); + + bool find(const uint8_t *target, size_t length) + { + return find ((const char *)target, length); + } + + bool find(const String &target, size_t length) + { + return find(target.c_str(), length); + } + + bool findUntil(const char *target, const char *terminator); + + bool findUntil(const uint8_t *target, const char *terminator) + { + return findUntil((const char *)target, terminator); + } + + bool findUntil(const String &target, const char *terminator) + { + return findUntil(target.c_str(), terminator); + } + + bool findUntil(const char *target, const String &terminator) + { + return findUntil(target, terminator.c_str()); + } + + bool findUntil(const String &target, const String &terminator) + { + return findUntil(target.c_str(), terminator.c_str()); + } + + bool findUntil(const char *target, size_t targetLen, const char *terminate, size_t termLen); + + bool findUntil(const uint8_t *target, size_t targetLen, const char *terminate, size_t termLen) + { + return findUntil((const char *)target, targetLen, terminate, termLen); + } + + bool findUntil(const String &target, size_t targetLen, const char *terminate, size_t termLen); + bool findUntil(const char *target, size_t targetLen, const String &terminate, size_t termLen); + bool findUntil(const String &target, size_t targetLen, const String &terminate, size_t termLen); + + long parseInt(); + long parseInt(char skipChar); + + float parseFloat(); + float parseFloat(char skipChar); + + size_t readBytes(char *buffer, size_t length); + + size_t readBytes(uint8_t *buffer, size_t length) + { + return readBytes((char *)buffer, length); + } + + size_t readBytesUntil(char terminator, char *buffer, size_t length); + + size_t readBytesUntil(char terminator, uint8_t *buffer, size_t length) + { + return readBytesUntil(terminator, (char *)buffer, length); + } + + //////////////////////////////////////////////////////////// + String readString(size_t max = 512); + String readStringUntil(char terminator, size_t max = 512); + + // KH, to not use String + char* readCharsUntil(char terminator, size_t max = 512); + //////////////////////////////////////////////////////////// + + int getReadError() + { + return read_error; + } + + void clearReadError() + { + setReadError(0); + } + + protected: + void setReadError(int err = 1) + { + read_error = err; + } + + unsigned long _timeout; + + // KH + int timedRead(); + int timedPeek(); + int peekNextDigit(); + ////// + + private: + char read_error; }; #endif diff --git a/Packages_Patches/industrialshields/hardware/avr/1.1.36/cores/industrialshields/Udp.h b/Packages_Patches/industrialshields/hardware/avr/1.1.36/cores/industrialshields/Udp.h index d0524465..267b221b 100644 --- a/Packages_Patches/industrialshields/hardware/avr/1.1.36/cores/industrialshields/Udp.h +++ b/Packages_Patches/industrialshields/hardware/avr/1.1.36/cores/industrialshields/Udp.h @@ -1,36 +1,36 @@ /* - * Udp.cpp: Library to send/receive UDP packets. - * - * NOTE: UDP is fast, but has some important limitations (thanks to Warren Gray for mentioning these) - * 1) UDP does not guarantee the order in which assembled UDP packets are received. This - * might not happen often in practice, but in larger network topologies, a UDP - * packet can be received out of sequence. - * 2) UDP does not guard against lost packets - so packets *can* disappear without the sender being - * aware of it. Again, this may not be a concern in practice on small local networks. - * For more information, see http://www.cafeaulait.org/course/week12/35.html - * - * MIT License: - * Copyright (c) 2008 Bjoern Hartmann - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * bjoern@cs.stanford.edu 12/30/2008 - */ + Udp.cpp: Library to send/receive UDP packets. + + NOTE: UDP is fast, but has some important limitations (thanks to Warren Gray for mentioning these) + 1) UDP does not guarantee the order in which assembled UDP packets are received. This + might not happen often in practice, but in larger network topologies, a UDP + packet can be received out of sequence. + 2) UDP does not guard against lost packets - so packets *can* disappear without the sender being + aware of it. Again, this may not be a concern in practice on small local networks. + For more information, see http://www.cafeaulait.org/course/week12/35.html + + MIT License: + Copyright (c) 2008 Bjoern Hartmann + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + + bjoern@cs.stanford.edu 12/30/2008 +*/ #ifndef udp_h #define udp_h @@ -38,52 +38,59 @@ #include #include -class UDP : public Stream { +class UDP : public Stream +{ + + public: + virtual uint8_t begin(uint16_t) = 0; // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use + virtual uint8_t beginMulticast(IPAddress, uint16_t) + { + return 0; // initialize, start listening on specified multicast IP address and port. Returns 1 if successful, 0 on failure + } + virtual void stop() = 0; // Finish with the UDP socket -public: - virtual uint8_t begin(uint16_t) =0; // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use - virtual uint8_t beginMulticast(IPAddress, uint16_t) { return 0; } // initialize, start listening on specified multicast IP address and port. Returns 1 if successful, 0 on failure - virtual void stop() =0; // Finish with the UDP socket + // Sending UDP packets - // Sending UDP packets - - // Start building up a packet to send to the remote host specific in ip and port - // Returns 1 if successful, 0 if there was a problem with the supplied IP address or port - virtual int beginPacket(IPAddress ip, uint16_t port) =0; - // Start building up a packet to send to the remote host specific in host and port - // Returns 1 if successful, 0 if there was a problem resolving the hostname or port - virtual int beginPacket(const char *host, uint16_t port) =0; - // Finish off this packet and send it - // Returns 1 if the packet was sent successfully, 0 if there was an error - virtual int endPacket() =0; - // Write a single byte into the packet - virtual size_t write(uint8_t) =0; - // Write size bytes from buffer into the packet - virtual size_t write(const uint8_t *buffer, size_t size) =0; + // Start building up a packet to send to the remote host specific in ip and port + // Returns 1 if successful, 0 if there was a problem with the supplied IP address or port + virtual int beginPacket(IPAddress ip, uint16_t port) = 0; + // Start building up a packet to send to the remote host specific in host and port + // Returns 1 if successful, 0 if there was a problem resolving the hostname or port + virtual int beginPacket(const char *host, uint16_t port) = 0; + // Finish off this packet and send it + // Returns 1 if the packet was sent successfully, 0 if there was an error + virtual int endPacket() = 0; + // Write a single byte into the packet + virtual size_t write(uint8_t) = 0; + // Write size bytes from buffer into the packet + virtual size_t write(const uint8_t *buffer, size_t size) = 0; - // Start processing the next available incoming packet - // Returns the size of the packet in bytes, or 0 if no packets are available - virtual int parsePacket() =0; - // Number of bytes remaining in the current packet - virtual int available() =0; - // Read a single byte from the current packet - virtual int read() =0; - // Read up to len bytes from the current packet and place them into buffer - // Returns the number of bytes read, or 0 if none are available - virtual int read(unsigned char* buffer, size_t len) =0; - // Read up to len characters from the current packet and place them into buffer - // Returns the number of characters read, or 0 if none are available - virtual int read(char* buffer, size_t len) =0; - // Return the next byte from the current packet without moving on to the next byte - virtual int peek() =0; - virtual void flush() =0; // Finish reading the current packet + // Start processing the next available incoming packet + // Returns the size of the packet in bytes, or 0 if no packets are available + virtual int parsePacket() = 0; + // Number of bytes remaining in the current packet + virtual int available() = 0; + // Read a single byte from the current packet + virtual int read() = 0; + // Read up to len bytes from the current packet and place them into buffer + // Returns the number of bytes read, or 0 if none are available + virtual int read(unsigned char* buffer, size_t len) = 0; + // Read up to len characters from the current packet and place them into buffer + // Returns the number of characters read, or 0 if none are available + virtual int read(char* buffer, size_t len) = 0; + // Return the next byte from the current packet without moving on to the next byte + virtual int peek() = 0; + virtual void flush() = 0; // Finish reading the current packet - // Return the IP address of the host who sent the current incoming packet - virtual IPAddress remoteIP() =0; - // Return the port of the host who sent the current incoming packet - virtual uint16_t remotePort() =0; -protected: - uint8_t* rawIPAddress(IPAddress& addr) { return addr.raw_address(); }; + // Return the IP address of the host who sent the current incoming packet + virtual IPAddress remoteIP() = 0; + // Return the port of the host who sent the current incoming packet + virtual uint16_t remotePort() = 0; + protected: + uint8_t* rawIPAddress(IPAddress& addr) + { + return addr.raw_address(); + }; }; #endif diff --git a/Packages_Patches/industrialshields/hardware/avr/1.1.37/cores/industrialshields/Udp.h b/Packages_Patches/industrialshields/hardware/avr/1.1.37/cores/industrialshields/Udp.h index d0524465..267b221b 100644 --- a/Packages_Patches/industrialshields/hardware/avr/1.1.37/cores/industrialshields/Udp.h +++ b/Packages_Patches/industrialshields/hardware/avr/1.1.37/cores/industrialshields/Udp.h @@ -1,36 +1,36 @@ /* - * Udp.cpp: Library to send/receive UDP packets. - * - * NOTE: UDP is fast, but has some important limitations (thanks to Warren Gray for mentioning these) - * 1) UDP does not guarantee the order in which assembled UDP packets are received. This - * might not happen often in practice, but in larger network topologies, a UDP - * packet can be received out of sequence. - * 2) UDP does not guard against lost packets - so packets *can* disappear without the sender being - * aware of it. Again, this may not be a concern in practice on small local networks. - * For more information, see http://www.cafeaulait.org/course/week12/35.html - * - * MIT License: - * Copyright (c) 2008 Bjoern Hartmann - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * bjoern@cs.stanford.edu 12/30/2008 - */ + Udp.cpp: Library to send/receive UDP packets. + + NOTE: UDP is fast, but has some important limitations (thanks to Warren Gray for mentioning these) + 1) UDP does not guarantee the order in which assembled UDP packets are received. This + might not happen often in practice, but in larger network topologies, a UDP + packet can be received out of sequence. + 2) UDP does not guard against lost packets - so packets *can* disappear without the sender being + aware of it. Again, this may not be a concern in practice on small local networks. + For more information, see http://www.cafeaulait.org/course/week12/35.html + + MIT License: + Copyright (c) 2008 Bjoern Hartmann + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + + bjoern@cs.stanford.edu 12/30/2008 +*/ #ifndef udp_h #define udp_h @@ -38,52 +38,59 @@ #include #include -class UDP : public Stream { +class UDP : public Stream +{ + + public: + virtual uint8_t begin(uint16_t) = 0; // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use + virtual uint8_t beginMulticast(IPAddress, uint16_t) + { + return 0; // initialize, start listening on specified multicast IP address and port. Returns 1 if successful, 0 on failure + } + virtual void stop() = 0; // Finish with the UDP socket -public: - virtual uint8_t begin(uint16_t) =0; // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use - virtual uint8_t beginMulticast(IPAddress, uint16_t) { return 0; } // initialize, start listening on specified multicast IP address and port. Returns 1 if successful, 0 on failure - virtual void stop() =0; // Finish with the UDP socket + // Sending UDP packets - // Sending UDP packets - - // Start building up a packet to send to the remote host specific in ip and port - // Returns 1 if successful, 0 if there was a problem with the supplied IP address or port - virtual int beginPacket(IPAddress ip, uint16_t port) =0; - // Start building up a packet to send to the remote host specific in host and port - // Returns 1 if successful, 0 if there was a problem resolving the hostname or port - virtual int beginPacket(const char *host, uint16_t port) =0; - // Finish off this packet and send it - // Returns 1 if the packet was sent successfully, 0 if there was an error - virtual int endPacket() =0; - // Write a single byte into the packet - virtual size_t write(uint8_t) =0; - // Write size bytes from buffer into the packet - virtual size_t write(const uint8_t *buffer, size_t size) =0; + // Start building up a packet to send to the remote host specific in ip and port + // Returns 1 if successful, 0 if there was a problem with the supplied IP address or port + virtual int beginPacket(IPAddress ip, uint16_t port) = 0; + // Start building up a packet to send to the remote host specific in host and port + // Returns 1 if successful, 0 if there was a problem resolving the hostname or port + virtual int beginPacket(const char *host, uint16_t port) = 0; + // Finish off this packet and send it + // Returns 1 if the packet was sent successfully, 0 if there was an error + virtual int endPacket() = 0; + // Write a single byte into the packet + virtual size_t write(uint8_t) = 0; + // Write size bytes from buffer into the packet + virtual size_t write(const uint8_t *buffer, size_t size) = 0; - // Start processing the next available incoming packet - // Returns the size of the packet in bytes, or 0 if no packets are available - virtual int parsePacket() =0; - // Number of bytes remaining in the current packet - virtual int available() =0; - // Read a single byte from the current packet - virtual int read() =0; - // Read up to len bytes from the current packet and place them into buffer - // Returns the number of bytes read, or 0 if none are available - virtual int read(unsigned char* buffer, size_t len) =0; - // Read up to len characters from the current packet and place them into buffer - // Returns the number of characters read, or 0 if none are available - virtual int read(char* buffer, size_t len) =0; - // Return the next byte from the current packet without moving on to the next byte - virtual int peek() =0; - virtual void flush() =0; // Finish reading the current packet + // Start processing the next available incoming packet + // Returns the size of the packet in bytes, or 0 if no packets are available + virtual int parsePacket() = 0; + // Number of bytes remaining in the current packet + virtual int available() = 0; + // Read a single byte from the current packet + virtual int read() = 0; + // Read up to len bytes from the current packet and place them into buffer + // Returns the number of bytes read, or 0 if none are available + virtual int read(unsigned char* buffer, size_t len) = 0; + // Read up to len characters from the current packet and place them into buffer + // Returns the number of characters read, or 0 if none are available + virtual int read(char* buffer, size_t len) = 0; + // Return the next byte from the current packet without moving on to the next byte + virtual int peek() = 0; + virtual void flush() = 0; // Finish reading the current packet - // Return the IP address of the host who sent the current incoming packet - virtual IPAddress remoteIP() =0; - // Return the port of the host who sent the current incoming packet - virtual uint16_t remotePort() =0; -protected: - uint8_t* rawIPAddress(IPAddress& addr) { return addr.raw_address(); }; + // Return the IP address of the host who sent the current incoming packet + virtual IPAddress remoteIP() = 0; + // Return the port of the host who sent the current incoming packet + virtual uint16_t remotePort() = 0; + protected: + uint8_t* rawIPAddress(IPAddress& addr) + { + return addr.raw_address(); + }; }; #endif diff --git a/Packages_Patches/realtek/hardware/AmebaD/3.0.10/cores/arduino/avr/pgmspace.h b/Packages_Patches/realtek/hardware/AmebaD/3.0.10/cores/arduino/avr/pgmspace.h index bf87a94f..de92051a 100644 --- a/Packages_Patches/realtek/hardware/AmebaD/3.0.10/cores/arduino/avr/pgmspace.h +++ b/Packages_Patches/realtek/hardware/AmebaD/3.0.10/cores/arduino/avr/pgmspace.h @@ -1,122 +1,122 @@ -/* - pgmspace.h - Definitions for compatibility with AVR pgmspace macros - - Copyright (c) 2015 Arduino LLC - - Based on work of Paul Stoffregen on Teensy 3 (http://pjrc.com) - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE -*/ - -#ifndef __PGMSPACE_H_ -#define __PGMSPACE_H_ 1 - -#include - -#define PROGMEM -#define PGM_P const char * -#define PSTR(str) (str) - -#define _SFR_BYTE(n) (n) - -typedef void prog_void; -typedef char prog_char; -typedef unsigned char prog_uchar; -typedef int8_t prog_int8_t; -typedef uint8_t prog_uint8_t; -typedef int16_t prog_int16_t; -typedef uint16_t prog_uint16_t; -typedef int32_t prog_int32_t; -typedef uint32_t prog_uint32_t; -typedef int64_t prog_int64_t; -typedef uint64_t prog_uint64_t; - -typedef const void* int_farptr_t; -typedef const void* uint_farptr_t; - -#define memchr_P(s, c, n) memchr((s), (c), (n)) -#define memcmp_P(s1, s2, n) memcmp((s1), (s2), (n)) -#define memccpy_P(dest, src, c, n) memccpy((dest), (src), (c), (n)) -#define memcpy_P(dest, src, n) memcpy((dest), (src), (n)) -#define memmem_P(haystack, haystacklen, needle, needlelen) memmem((haystack), (haystacklen), (needle), (needlelen)) -#define memrchr_P(s, c, n) memrchr((s), (c), (n)) -#define strcat_P(dest, src) strcat((dest), (src)) -#define strchr_P(s, c) strchr((s), (c)) -#define strchrnul_P(s, c) strchrnul((s), (c)) -#define strcmp_P(a, b) strcmp((a), (b)) -#define strcpy_P(dest, src) strcpy((dest), (src)) -#define strcasecmp_P(s1, s2) strcasecmp((s1), (s2)) -#define strcasestr_P(haystack, needle) strcasestr((haystack), (needle)) -#define strcspn_P(s, accept) strcspn((s), (accept)) -#define strlcat_P(s1, s2, n) strlcat((s1), (s2), (n)) -#define strlcpy_P(s1, s2, n) strlcpy((s1), (s2), (n)) -#define strlen_P(a) strlen((a)) -#define strnlen_P(s, n) strnlen((s), (n)) -#define strncmp_P(s1, s2, n) strncmp((s1), (s2), (n)) -#define strncasecmp_P(s1, s2, n) strncasecmp((s1), (s2), (n)) -#define strncat_P(s1, s2, n) strncat((s1), (s2), (n)) -#define strncpy_P(s1, s2, n) strncpy((s1), (s2), (n)) -#define strpbrk_P(s, accept) strpbrk((s), (accept)) -#define strrchr_P(s, c) strrchr((s), (c)) -#define strsep_P(sp, delim) strsep((sp), (delim)) -#define strspn_P(s, accept) strspn((s), (accept)) -#define strstr_P(a, b) strstr((a), (b)) -#define strtok_P(s, delim) strtok((s), (delim)) -#define strtok_rP(s, delim, last) strtok((s), (delim), (last)) - -#define strlen_PF(a) strlen((a)) -#define strnlen_PF(src, len) strnlen((src), (len)) -#define memcpy_PF(dest, src, len) memcpy((dest), (src), (len)) -#define strcpy_PF(dest, src) strcpy((dest), (src)) -#define strncpy_PF(dest, src, len) strncpy((dest), (src), (len)) -#define strcat_PF(dest, src) strcat((dest), (src)) -#define strlcat_PF(dest, src, len) strlcat((dest), (src), (len)) -#define strncat_PF(dest, src, len) strncat((dest), (src), (len)) -#define strcmp_PF(s1, s2) strcmp((s1), (s2)) -#define strncmp_PF(s1, s2, n) strncmp((s1), (s2), (n)) -#define strcasecmp_PF(s1, s2) strcasecmp((s1), (s2)) -#define strncasecmp_PF(s1, s2, n) strncasecmp((s1), (s2), (n)) -#define strstr_PF(s1, s2) strstr((s1), (s2)) -#define strlcpy_PF(dest, src, n) strlcpy((dest), (src), (n)) -#define memcmp_PF(s1, s2, n) memcmp((s1), (s2), (n)) - -#define sprintf_P(s, f, ...) sprintf((s), (f), __VA_ARGS__) -#define snprintf_P(s, f, ...) snprintf((s), (f), __VA_ARGS__) - -#define pgm_read_byte(addr) (*(const unsigned char *)(addr)) -#define pgm_read_word(addr) (*(const unsigned short *)(addr)) -#define pgm_read_dword(addr) (*(const unsigned long *)(addr)) -#define pgm_read_float(addr) (*(const float *)(addr)) -#define pgm_read_ptr(addr) (*(const void **)(addr)) - -#define pgm_read_byte_near(addr) pgm_read_byte(addr) -#define pgm_read_word_near(addr) pgm_read_word(addr) -#define pgm_read_dword_near(addr) pgm_read_dword(addr) -#define pgm_read_float_near(addr) pgm_read_float(addr) -#define pgm_read_ptr_near(addr) pgm_read_ptr(addr) - -#define pgm_read_byte_far(addr) pgm_read_byte(addr) -#define pgm_read_word_far(addr) pgm_read_word(addr) -#define pgm_read_dword_far(addr) pgm_read_dword(addr) -#define pgm_read_float_far(addr) pgm_read_float(addr) -#define pgm_read_ptr_far(addr) pgm_read_ptr(addr) - -#define pgm_get_far_address(addr) (&(addr)) - -#endif +/* + pgmspace.h - Definitions for compatibility with AVR pgmspace macros + + Copyright (c) 2015 Arduino LLC + + Based on work of Paul Stoffregen on Teensy 3 (http://pjrc.com) + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE +*/ + +#ifndef __PGMSPACE_H_ +#define __PGMSPACE_H_ 1 + +#include + +#define PROGMEM +#define PGM_P const char * +#define PSTR(str) (str) + +#define _SFR_BYTE(n) (n) + +typedef void prog_void; +typedef char prog_char; +typedef unsigned char prog_uchar; +typedef int8_t prog_int8_t; +typedef uint8_t prog_uint8_t; +typedef int16_t prog_int16_t; +typedef uint16_t prog_uint16_t; +typedef int32_t prog_int32_t; +typedef uint32_t prog_uint32_t; +typedef int64_t prog_int64_t; +typedef uint64_t prog_uint64_t; + +typedef const void* int_farptr_t; +typedef const void* uint_farptr_t; + +#define memchr_P(s, c, n) memchr((s), (c), (n)) +#define memcmp_P(s1, s2, n) memcmp((s1), (s2), (n)) +#define memccpy_P(dest, src, c, n) memccpy((dest), (src), (c), (n)) +#define memcpy_P(dest, src, n) memcpy((dest), (src), (n)) +#define memmem_P(haystack, haystacklen, needle, needlelen) memmem((haystack), (haystacklen), (needle), (needlelen)) +#define memrchr_P(s, c, n) memrchr((s), (c), (n)) +#define strcat_P(dest, src) strcat((dest), (src)) +#define strchr_P(s, c) strchr((s), (c)) +#define strchrnul_P(s, c) strchrnul((s), (c)) +#define strcmp_P(a, b) strcmp((a), (b)) +#define strcpy_P(dest, src) strcpy((dest), (src)) +#define strcasecmp_P(s1, s2) strcasecmp((s1), (s2)) +#define strcasestr_P(haystack, needle) strcasestr((haystack), (needle)) +#define strcspn_P(s, accept) strcspn((s), (accept)) +#define strlcat_P(s1, s2, n) strlcat((s1), (s2), (n)) +#define strlcpy_P(s1, s2, n) strlcpy((s1), (s2), (n)) +#define strlen_P(a) strlen((a)) +#define strnlen_P(s, n) strnlen((s), (n)) +#define strncmp_P(s1, s2, n) strncmp((s1), (s2), (n)) +#define strncasecmp_P(s1, s2, n) strncasecmp((s1), (s2), (n)) +#define strncat_P(s1, s2, n) strncat((s1), (s2), (n)) +#define strncpy_P(s1, s2, n) strncpy((s1), (s2), (n)) +#define strpbrk_P(s, accept) strpbrk((s), (accept)) +#define strrchr_P(s, c) strrchr((s), (c)) +#define strsep_P(sp, delim) strsep((sp), (delim)) +#define strspn_P(s, accept) strspn((s), (accept)) +#define strstr_P(a, b) strstr((a), (b)) +#define strtok_P(s, delim) strtok((s), (delim)) +#define strtok_rP(s, delim, last) strtok((s), (delim), (last)) + +#define strlen_PF(a) strlen((a)) +#define strnlen_PF(src, len) strnlen((src), (len)) +#define memcpy_PF(dest, src, len) memcpy((dest), (src), (len)) +#define strcpy_PF(dest, src) strcpy((dest), (src)) +#define strncpy_PF(dest, src, len) strncpy((dest), (src), (len)) +#define strcat_PF(dest, src) strcat((dest), (src)) +#define strlcat_PF(dest, src, len) strlcat((dest), (src), (len)) +#define strncat_PF(dest, src, len) strncat((dest), (src), (len)) +#define strcmp_PF(s1, s2) strcmp((s1), (s2)) +#define strncmp_PF(s1, s2, n) strncmp((s1), (s2), (n)) +#define strcasecmp_PF(s1, s2) strcasecmp((s1), (s2)) +#define strncasecmp_PF(s1, s2, n) strncasecmp((s1), (s2), (n)) +#define strstr_PF(s1, s2) strstr((s1), (s2)) +#define strlcpy_PF(dest, src, n) strlcpy((dest), (src), (n)) +#define memcmp_PF(s1, s2, n) memcmp((s1), (s2), (n)) + +#define sprintf_P(s, f, ...) sprintf((s), (f), __VA_ARGS__) +#define snprintf_P(s, f, ...) snprintf((s), (f), __VA_ARGS__) + +#define pgm_read_byte(addr) (*(const unsigned char *)(addr)) +#define pgm_read_word(addr) (*(const unsigned short *)(addr)) +#define pgm_read_dword(addr) (*(const unsigned long *)(addr)) +#define pgm_read_float(addr) (*(const float *)(addr)) +#define pgm_read_ptr(addr) (*(const void **)(addr)) + +#define pgm_read_byte_near(addr) pgm_read_byte(addr) +#define pgm_read_word_near(addr) pgm_read_word(addr) +#define pgm_read_dword_near(addr) pgm_read_dword(addr) +#define pgm_read_float_near(addr) pgm_read_float(addr) +#define pgm_read_ptr_near(addr) pgm_read_ptr(addr) + +#define pgm_read_byte_far(addr) pgm_read_byte(addr) +#define pgm_read_word_far(addr) pgm_read_word(addr) +#define pgm_read_dword_far(addr) pgm_read_dword(addr) +#define pgm_read_float_far(addr) pgm_read_float(addr) +#define pgm_read_ptr_far(addr) pgm_read_ptr(addr) + +#define pgm_get_far_address(addr) (&(addr)) + +#endif diff --git a/Packages_Patches/realtek/hardware/AmebaD/3.0.8/cores/arduino/avr/pgmspace.h b/Packages_Patches/realtek/hardware/AmebaD/3.0.8/cores/arduino/avr/pgmspace.h index bf87a94f..de92051a 100644 --- a/Packages_Patches/realtek/hardware/AmebaD/3.0.8/cores/arduino/avr/pgmspace.h +++ b/Packages_Patches/realtek/hardware/AmebaD/3.0.8/cores/arduino/avr/pgmspace.h @@ -1,122 +1,122 @@ -/* - pgmspace.h - Definitions for compatibility with AVR pgmspace macros - - Copyright (c) 2015 Arduino LLC - - Based on work of Paul Stoffregen on Teensy 3 (http://pjrc.com) - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE -*/ - -#ifndef __PGMSPACE_H_ -#define __PGMSPACE_H_ 1 - -#include - -#define PROGMEM -#define PGM_P const char * -#define PSTR(str) (str) - -#define _SFR_BYTE(n) (n) - -typedef void prog_void; -typedef char prog_char; -typedef unsigned char prog_uchar; -typedef int8_t prog_int8_t; -typedef uint8_t prog_uint8_t; -typedef int16_t prog_int16_t; -typedef uint16_t prog_uint16_t; -typedef int32_t prog_int32_t; -typedef uint32_t prog_uint32_t; -typedef int64_t prog_int64_t; -typedef uint64_t prog_uint64_t; - -typedef const void* int_farptr_t; -typedef const void* uint_farptr_t; - -#define memchr_P(s, c, n) memchr((s), (c), (n)) -#define memcmp_P(s1, s2, n) memcmp((s1), (s2), (n)) -#define memccpy_P(dest, src, c, n) memccpy((dest), (src), (c), (n)) -#define memcpy_P(dest, src, n) memcpy((dest), (src), (n)) -#define memmem_P(haystack, haystacklen, needle, needlelen) memmem((haystack), (haystacklen), (needle), (needlelen)) -#define memrchr_P(s, c, n) memrchr((s), (c), (n)) -#define strcat_P(dest, src) strcat((dest), (src)) -#define strchr_P(s, c) strchr((s), (c)) -#define strchrnul_P(s, c) strchrnul((s), (c)) -#define strcmp_P(a, b) strcmp((a), (b)) -#define strcpy_P(dest, src) strcpy((dest), (src)) -#define strcasecmp_P(s1, s2) strcasecmp((s1), (s2)) -#define strcasestr_P(haystack, needle) strcasestr((haystack), (needle)) -#define strcspn_P(s, accept) strcspn((s), (accept)) -#define strlcat_P(s1, s2, n) strlcat((s1), (s2), (n)) -#define strlcpy_P(s1, s2, n) strlcpy((s1), (s2), (n)) -#define strlen_P(a) strlen((a)) -#define strnlen_P(s, n) strnlen((s), (n)) -#define strncmp_P(s1, s2, n) strncmp((s1), (s2), (n)) -#define strncasecmp_P(s1, s2, n) strncasecmp((s1), (s2), (n)) -#define strncat_P(s1, s2, n) strncat((s1), (s2), (n)) -#define strncpy_P(s1, s2, n) strncpy((s1), (s2), (n)) -#define strpbrk_P(s, accept) strpbrk((s), (accept)) -#define strrchr_P(s, c) strrchr((s), (c)) -#define strsep_P(sp, delim) strsep((sp), (delim)) -#define strspn_P(s, accept) strspn((s), (accept)) -#define strstr_P(a, b) strstr((a), (b)) -#define strtok_P(s, delim) strtok((s), (delim)) -#define strtok_rP(s, delim, last) strtok((s), (delim), (last)) - -#define strlen_PF(a) strlen((a)) -#define strnlen_PF(src, len) strnlen((src), (len)) -#define memcpy_PF(dest, src, len) memcpy((dest), (src), (len)) -#define strcpy_PF(dest, src) strcpy((dest), (src)) -#define strncpy_PF(dest, src, len) strncpy((dest), (src), (len)) -#define strcat_PF(dest, src) strcat((dest), (src)) -#define strlcat_PF(dest, src, len) strlcat((dest), (src), (len)) -#define strncat_PF(dest, src, len) strncat((dest), (src), (len)) -#define strcmp_PF(s1, s2) strcmp((s1), (s2)) -#define strncmp_PF(s1, s2, n) strncmp((s1), (s2), (n)) -#define strcasecmp_PF(s1, s2) strcasecmp((s1), (s2)) -#define strncasecmp_PF(s1, s2, n) strncasecmp((s1), (s2), (n)) -#define strstr_PF(s1, s2) strstr((s1), (s2)) -#define strlcpy_PF(dest, src, n) strlcpy((dest), (src), (n)) -#define memcmp_PF(s1, s2, n) memcmp((s1), (s2), (n)) - -#define sprintf_P(s, f, ...) sprintf((s), (f), __VA_ARGS__) -#define snprintf_P(s, f, ...) snprintf((s), (f), __VA_ARGS__) - -#define pgm_read_byte(addr) (*(const unsigned char *)(addr)) -#define pgm_read_word(addr) (*(const unsigned short *)(addr)) -#define pgm_read_dword(addr) (*(const unsigned long *)(addr)) -#define pgm_read_float(addr) (*(const float *)(addr)) -#define pgm_read_ptr(addr) (*(const void **)(addr)) - -#define pgm_read_byte_near(addr) pgm_read_byte(addr) -#define pgm_read_word_near(addr) pgm_read_word(addr) -#define pgm_read_dword_near(addr) pgm_read_dword(addr) -#define pgm_read_float_near(addr) pgm_read_float(addr) -#define pgm_read_ptr_near(addr) pgm_read_ptr(addr) - -#define pgm_read_byte_far(addr) pgm_read_byte(addr) -#define pgm_read_word_far(addr) pgm_read_word(addr) -#define pgm_read_dword_far(addr) pgm_read_dword(addr) -#define pgm_read_float_far(addr) pgm_read_float(addr) -#define pgm_read_ptr_far(addr) pgm_read_ptr(addr) - -#define pgm_get_far_address(addr) (&(addr)) - -#endif +/* + pgmspace.h - Definitions for compatibility with AVR pgmspace macros + + Copyright (c) 2015 Arduino LLC + + Based on work of Paul Stoffregen on Teensy 3 (http://pjrc.com) + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE +*/ + +#ifndef __PGMSPACE_H_ +#define __PGMSPACE_H_ 1 + +#include + +#define PROGMEM +#define PGM_P const char * +#define PSTR(str) (str) + +#define _SFR_BYTE(n) (n) + +typedef void prog_void; +typedef char prog_char; +typedef unsigned char prog_uchar; +typedef int8_t prog_int8_t; +typedef uint8_t prog_uint8_t; +typedef int16_t prog_int16_t; +typedef uint16_t prog_uint16_t; +typedef int32_t prog_int32_t; +typedef uint32_t prog_uint32_t; +typedef int64_t prog_int64_t; +typedef uint64_t prog_uint64_t; + +typedef const void* int_farptr_t; +typedef const void* uint_farptr_t; + +#define memchr_P(s, c, n) memchr((s), (c), (n)) +#define memcmp_P(s1, s2, n) memcmp((s1), (s2), (n)) +#define memccpy_P(dest, src, c, n) memccpy((dest), (src), (c), (n)) +#define memcpy_P(dest, src, n) memcpy((dest), (src), (n)) +#define memmem_P(haystack, haystacklen, needle, needlelen) memmem((haystack), (haystacklen), (needle), (needlelen)) +#define memrchr_P(s, c, n) memrchr((s), (c), (n)) +#define strcat_P(dest, src) strcat((dest), (src)) +#define strchr_P(s, c) strchr((s), (c)) +#define strchrnul_P(s, c) strchrnul((s), (c)) +#define strcmp_P(a, b) strcmp((a), (b)) +#define strcpy_P(dest, src) strcpy((dest), (src)) +#define strcasecmp_P(s1, s2) strcasecmp((s1), (s2)) +#define strcasestr_P(haystack, needle) strcasestr((haystack), (needle)) +#define strcspn_P(s, accept) strcspn((s), (accept)) +#define strlcat_P(s1, s2, n) strlcat((s1), (s2), (n)) +#define strlcpy_P(s1, s2, n) strlcpy((s1), (s2), (n)) +#define strlen_P(a) strlen((a)) +#define strnlen_P(s, n) strnlen((s), (n)) +#define strncmp_P(s1, s2, n) strncmp((s1), (s2), (n)) +#define strncasecmp_P(s1, s2, n) strncasecmp((s1), (s2), (n)) +#define strncat_P(s1, s2, n) strncat((s1), (s2), (n)) +#define strncpy_P(s1, s2, n) strncpy((s1), (s2), (n)) +#define strpbrk_P(s, accept) strpbrk((s), (accept)) +#define strrchr_P(s, c) strrchr((s), (c)) +#define strsep_P(sp, delim) strsep((sp), (delim)) +#define strspn_P(s, accept) strspn((s), (accept)) +#define strstr_P(a, b) strstr((a), (b)) +#define strtok_P(s, delim) strtok((s), (delim)) +#define strtok_rP(s, delim, last) strtok((s), (delim), (last)) + +#define strlen_PF(a) strlen((a)) +#define strnlen_PF(src, len) strnlen((src), (len)) +#define memcpy_PF(dest, src, len) memcpy((dest), (src), (len)) +#define strcpy_PF(dest, src) strcpy((dest), (src)) +#define strncpy_PF(dest, src, len) strncpy((dest), (src), (len)) +#define strcat_PF(dest, src) strcat((dest), (src)) +#define strlcat_PF(dest, src, len) strlcat((dest), (src), (len)) +#define strncat_PF(dest, src, len) strncat((dest), (src), (len)) +#define strcmp_PF(s1, s2) strcmp((s1), (s2)) +#define strncmp_PF(s1, s2, n) strncmp((s1), (s2), (n)) +#define strcasecmp_PF(s1, s2) strcasecmp((s1), (s2)) +#define strncasecmp_PF(s1, s2, n) strncasecmp((s1), (s2), (n)) +#define strstr_PF(s1, s2) strstr((s1), (s2)) +#define strlcpy_PF(dest, src, n) strlcpy((dest), (src), (n)) +#define memcmp_PF(s1, s2, n) memcmp((s1), (s2), (n)) + +#define sprintf_P(s, f, ...) sprintf((s), (f), __VA_ARGS__) +#define snprintf_P(s, f, ...) snprintf((s), (f), __VA_ARGS__) + +#define pgm_read_byte(addr) (*(const unsigned char *)(addr)) +#define pgm_read_word(addr) (*(const unsigned short *)(addr)) +#define pgm_read_dword(addr) (*(const unsigned long *)(addr)) +#define pgm_read_float(addr) (*(const float *)(addr)) +#define pgm_read_ptr(addr) (*(const void **)(addr)) + +#define pgm_read_byte_near(addr) pgm_read_byte(addr) +#define pgm_read_word_near(addr) pgm_read_word(addr) +#define pgm_read_dword_near(addr) pgm_read_dword(addr) +#define pgm_read_float_near(addr) pgm_read_float(addr) +#define pgm_read_ptr_near(addr) pgm_read_ptr(addr) + +#define pgm_read_byte_far(addr) pgm_read_byte(addr) +#define pgm_read_word_far(addr) pgm_read_word(addr) +#define pgm_read_dword_far(addr) pgm_read_dword(addr) +#define pgm_read_float_far(addr) pgm_read_float(addr) +#define pgm_read_ptr_far(addr) pgm_read_ptr(addr) + +#define pgm_get_far_address(addr) (&(addr)) + +#endif diff --git a/Packages_Patches/realtek/hardware/AmebaD/3.1.0/cores/arduino/avr/pgmspace.h b/Packages_Patches/realtek/hardware/AmebaD/3.1.0/cores/arduino/avr/pgmspace.h index bf87a94f..de92051a 100644 --- a/Packages_Patches/realtek/hardware/AmebaD/3.1.0/cores/arduino/avr/pgmspace.h +++ b/Packages_Patches/realtek/hardware/AmebaD/3.1.0/cores/arduino/avr/pgmspace.h @@ -1,122 +1,122 @@ -/* - pgmspace.h - Definitions for compatibility with AVR pgmspace macros - - Copyright (c) 2015 Arduino LLC - - Based on work of Paul Stoffregen on Teensy 3 (http://pjrc.com) - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE -*/ - -#ifndef __PGMSPACE_H_ -#define __PGMSPACE_H_ 1 - -#include - -#define PROGMEM -#define PGM_P const char * -#define PSTR(str) (str) - -#define _SFR_BYTE(n) (n) - -typedef void prog_void; -typedef char prog_char; -typedef unsigned char prog_uchar; -typedef int8_t prog_int8_t; -typedef uint8_t prog_uint8_t; -typedef int16_t prog_int16_t; -typedef uint16_t prog_uint16_t; -typedef int32_t prog_int32_t; -typedef uint32_t prog_uint32_t; -typedef int64_t prog_int64_t; -typedef uint64_t prog_uint64_t; - -typedef const void* int_farptr_t; -typedef const void* uint_farptr_t; - -#define memchr_P(s, c, n) memchr((s), (c), (n)) -#define memcmp_P(s1, s2, n) memcmp((s1), (s2), (n)) -#define memccpy_P(dest, src, c, n) memccpy((dest), (src), (c), (n)) -#define memcpy_P(dest, src, n) memcpy((dest), (src), (n)) -#define memmem_P(haystack, haystacklen, needle, needlelen) memmem((haystack), (haystacklen), (needle), (needlelen)) -#define memrchr_P(s, c, n) memrchr((s), (c), (n)) -#define strcat_P(dest, src) strcat((dest), (src)) -#define strchr_P(s, c) strchr((s), (c)) -#define strchrnul_P(s, c) strchrnul((s), (c)) -#define strcmp_P(a, b) strcmp((a), (b)) -#define strcpy_P(dest, src) strcpy((dest), (src)) -#define strcasecmp_P(s1, s2) strcasecmp((s1), (s2)) -#define strcasestr_P(haystack, needle) strcasestr((haystack), (needle)) -#define strcspn_P(s, accept) strcspn((s), (accept)) -#define strlcat_P(s1, s2, n) strlcat((s1), (s2), (n)) -#define strlcpy_P(s1, s2, n) strlcpy((s1), (s2), (n)) -#define strlen_P(a) strlen((a)) -#define strnlen_P(s, n) strnlen((s), (n)) -#define strncmp_P(s1, s2, n) strncmp((s1), (s2), (n)) -#define strncasecmp_P(s1, s2, n) strncasecmp((s1), (s2), (n)) -#define strncat_P(s1, s2, n) strncat((s1), (s2), (n)) -#define strncpy_P(s1, s2, n) strncpy((s1), (s2), (n)) -#define strpbrk_P(s, accept) strpbrk((s), (accept)) -#define strrchr_P(s, c) strrchr((s), (c)) -#define strsep_P(sp, delim) strsep((sp), (delim)) -#define strspn_P(s, accept) strspn((s), (accept)) -#define strstr_P(a, b) strstr((a), (b)) -#define strtok_P(s, delim) strtok((s), (delim)) -#define strtok_rP(s, delim, last) strtok((s), (delim), (last)) - -#define strlen_PF(a) strlen((a)) -#define strnlen_PF(src, len) strnlen((src), (len)) -#define memcpy_PF(dest, src, len) memcpy((dest), (src), (len)) -#define strcpy_PF(dest, src) strcpy((dest), (src)) -#define strncpy_PF(dest, src, len) strncpy((dest), (src), (len)) -#define strcat_PF(dest, src) strcat((dest), (src)) -#define strlcat_PF(dest, src, len) strlcat((dest), (src), (len)) -#define strncat_PF(dest, src, len) strncat((dest), (src), (len)) -#define strcmp_PF(s1, s2) strcmp((s1), (s2)) -#define strncmp_PF(s1, s2, n) strncmp((s1), (s2), (n)) -#define strcasecmp_PF(s1, s2) strcasecmp((s1), (s2)) -#define strncasecmp_PF(s1, s2, n) strncasecmp((s1), (s2), (n)) -#define strstr_PF(s1, s2) strstr((s1), (s2)) -#define strlcpy_PF(dest, src, n) strlcpy((dest), (src), (n)) -#define memcmp_PF(s1, s2, n) memcmp((s1), (s2), (n)) - -#define sprintf_P(s, f, ...) sprintf((s), (f), __VA_ARGS__) -#define snprintf_P(s, f, ...) snprintf((s), (f), __VA_ARGS__) - -#define pgm_read_byte(addr) (*(const unsigned char *)(addr)) -#define pgm_read_word(addr) (*(const unsigned short *)(addr)) -#define pgm_read_dword(addr) (*(const unsigned long *)(addr)) -#define pgm_read_float(addr) (*(const float *)(addr)) -#define pgm_read_ptr(addr) (*(const void **)(addr)) - -#define pgm_read_byte_near(addr) pgm_read_byte(addr) -#define pgm_read_word_near(addr) pgm_read_word(addr) -#define pgm_read_dword_near(addr) pgm_read_dword(addr) -#define pgm_read_float_near(addr) pgm_read_float(addr) -#define pgm_read_ptr_near(addr) pgm_read_ptr(addr) - -#define pgm_read_byte_far(addr) pgm_read_byte(addr) -#define pgm_read_word_far(addr) pgm_read_word(addr) -#define pgm_read_dword_far(addr) pgm_read_dword(addr) -#define pgm_read_float_far(addr) pgm_read_float(addr) -#define pgm_read_ptr_far(addr) pgm_read_ptr(addr) - -#define pgm_get_far_address(addr) (&(addr)) - -#endif +/* + pgmspace.h - Definitions for compatibility with AVR pgmspace macros + + Copyright (c) 2015 Arduino LLC + + Based on work of Paul Stoffregen on Teensy 3 (http://pjrc.com) + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE +*/ + +#ifndef __PGMSPACE_H_ +#define __PGMSPACE_H_ 1 + +#include + +#define PROGMEM +#define PGM_P const char * +#define PSTR(str) (str) + +#define _SFR_BYTE(n) (n) + +typedef void prog_void; +typedef char prog_char; +typedef unsigned char prog_uchar; +typedef int8_t prog_int8_t; +typedef uint8_t prog_uint8_t; +typedef int16_t prog_int16_t; +typedef uint16_t prog_uint16_t; +typedef int32_t prog_int32_t; +typedef uint32_t prog_uint32_t; +typedef int64_t prog_int64_t; +typedef uint64_t prog_uint64_t; + +typedef const void* int_farptr_t; +typedef const void* uint_farptr_t; + +#define memchr_P(s, c, n) memchr((s), (c), (n)) +#define memcmp_P(s1, s2, n) memcmp((s1), (s2), (n)) +#define memccpy_P(dest, src, c, n) memccpy((dest), (src), (c), (n)) +#define memcpy_P(dest, src, n) memcpy((dest), (src), (n)) +#define memmem_P(haystack, haystacklen, needle, needlelen) memmem((haystack), (haystacklen), (needle), (needlelen)) +#define memrchr_P(s, c, n) memrchr((s), (c), (n)) +#define strcat_P(dest, src) strcat((dest), (src)) +#define strchr_P(s, c) strchr((s), (c)) +#define strchrnul_P(s, c) strchrnul((s), (c)) +#define strcmp_P(a, b) strcmp((a), (b)) +#define strcpy_P(dest, src) strcpy((dest), (src)) +#define strcasecmp_P(s1, s2) strcasecmp((s1), (s2)) +#define strcasestr_P(haystack, needle) strcasestr((haystack), (needle)) +#define strcspn_P(s, accept) strcspn((s), (accept)) +#define strlcat_P(s1, s2, n) strlcat((s1), (s2), (n)) +#define strlcpy_P(s1, s2, n) strlcpy((s1), (s2), (n)) +#define strlen_P(a) strlen((a)) +#define strnlen_P(s, n) strnlen((s), (n)) +#define strncmp_P(s1, s2, n) strncmp((s1), (s2), (n)) +#define strncasecmp_P(s1, s2, n) strncasecmp((s1), (s2), (n)) +#define strncat_P(s1, s2, n) strncat((s1), (s2), (n)) +#define strncpy_P(s1, s2, n) strncpy((s1), (s2), (n)) +#define strpbrk_P(s, accept) strpbrk((s), (accept)) +#define strrchr_P(s, c) strrchr((s), (c)) +#define strsep_P(sp, delim) strsep((sp), (delim)) +#define strspn_P(s, accept) strspn((s), (accept)) +#define strstr_P(a, b) strstr((a), (b)) +#define strtok_P(s, delim) strtok((s), (delim)) +#define strtok_rP(s, delim, last) strtok((s), (delim), (last)) + +#define strlen_PF(a) strlen((a)) +#define strnlen_PF(src, len) strnlen((src), (len)) +#define memcpy_PF(dest, src, len) memcpy((dest), (src), (len)) +#define strcpy_PF(dest, src) strcpy((dest), (src)) +#define strncpy_PF(dest, src, len) strncpy((dest), (src), (len)) +#define strcat_PF(dest, src) strcat((dest), (src)) +#define strlcat_PF(dest, src, len) strlcat((dest), (src), (len)) +#define strncat_PF(dest, src, len) strncat((dest), (src), (len)) +#define strcmp_PF(s1, s2) strcmp((s1), (s2)) +#define strncmp_PF(s1, s2, n) strncmp((s1), (s2), (n)) +#define strcasecmp_PF(s1, s2) strcasecmp((s1), (s2)) +#define strncasecmp_PF(s1, s2, n) strncasecmp((s1), (s2), (n)) +#define strstr_PF(s1, s2) strstr((s1), (s2)) +#define strlcpy_PF(dest, src, n) strlcpy((dest), (src), (n)) +#define memcmp_PF(s1, s2, n) memcmp((s1), (s2), (n)) + +#define sprintf_P(s, f, ...) sprintf((s), (f), __VA_ARGS__) +#define snprintf_P(s, f, ...) snprintf((s), (f), __VA_ARGS__) + +#define pgm_read_byte(addr) (*(const unsigned char *)(addr)) +#define pgm_read_word(addr) (*(const unsigned short *)(addr)) +#define pgm_read_dword(addr) (*(const unsigned long *)(addr)) +#define pgm_read_float(addr) (*(const float *)(addr)) +#define pgm_read_ptr(addr) (*(const void **)(addr)) + +#define pgm_read_byte_near(addr) pgm_read_byte(addr) +#define pgm_read_word_near(addr) pgm_read_word(addr) +#define pgm_read_dword_near(addr) pgm_read_dword(addr) +#define pgm_read_float_near(addr) pgm_read_float(addr) +#define pgm_read_ptr_near(addr) pgm_read_ptr(addr) + +#define pgm_read_byte_far(addr) pgm_read_byte(addr) +#define pgm_read_word_far(addr) pgm_read_word(addr) +#define pgm_read_dword_far(addr) pgm_read_dword(addr) +#define pgm_read_float_far(addr) pgm_read_float(addr) +#define pgm_read_ptr_far(addr) pgm_read_ptr(addr) + +#define pgm_get_far_address(addr) (&(addr)) + +#endif diff --git a/Packages_Patches/realtek/hardware/AmebaD/3.1.1/cores/arduino/avr/pgmspace.h b/Packages_Patches/realtek/hardware/AmebaD/3.1.1/cores/arduino/avr/pgmspace.h index bf87a94f..de92051a 100644 --- a/Packages_Patches/realtek/hardware/AmebaD/3.1.1/cores/arduino/avr/pgmspace.h +++ b/Packages_Patches/realtek/hardware/AmebaD/3.1.1/cores/arduino/avr/pgmspace.h @@ -1,122 +1,122 @@ -/* - pgmspace.h - Definitions for compatibility with AVR pgmspace macros - - Copyright (c) 2015 Arduino LLC - - Based on work of Paul Stoffregen on Teensy 3 (http://pjrc.com) - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE -*/ - -#ifndef __PGMSPACE_H_ -#define __PGMSPACE_H_ 1 - -#include - -#define PROGMEM -#define PGM_P const char * -#define PSTR(str) (str) - -#define _SFR_BYTE(n) (n) - -typedef void prog_void; -typedef char prog_char; -typedef unsigned char prog_uchar; -typedef int8_t prog_int8_t; -typedef uint8_t prog_uint8_t; -typedef int16_t prog_int16_t; -typedef uint16_t prog_uint16_t; -typedef int32_t prog_int32_t; -typedef uint32_t prog_uint32_t; -typedef int64_t prog_int64_t; -typedef uint64_t prog_uint64_t; - -typedef const void* int_farptr_t; -typedef const void* uint_farptr_t; - -#define memchr_P(s, c, n) memchr((s), (c), (n)) -#define memcmp_P(s1, s2, n) memcmp((s1), (s2), (n)) -#define memccpy_P(dest, src, c, n) memccpy((dest), (src), (c), (n)) -#define memcpy_P(dest, src, n) memcpy((dest), (src), (n)) -#define memmem_P(haystack, haystacklen, needle, needlelen) memmem((haystack), (haystacklen), (needle), (needlelen)) -#define memrchr_P(s, c, n) memrchr((s), (c), (n)) -#define strcat_P(dest, src) strcat((dest), (src)) -#define strchr_P(s, c) strchr((s), (c)) -#define strchrnul_P(s, c) strchrnul((s), (c)) -#define strcmp_P(a, b) strcmp((a), (b)) -#define strcpy_P(dest, src) strcpy((dest), (src)) -#define strcasecmp_P(s1, s2) strcasecmp((s1), (s2)) -#define strcasestr_P(haystack, needle) strcasestr((haystack), (needle)) -#define strcspn_P(s, accept) strcspn((s), (accept)) -#define strlcat_P(s1, s2, n) strlcat((s1), (s2), (n)) -#define strlcpy_P(s1, s2, n) strlcpy((s1), (s2), (n)) -#define strlen_P(a) strlen((a)) -#define strnlen_P(s, n) strnlen((s), (n)) -#define strncmp_P(s1, s2, n) strncmp((s1), (s2), (n)) -#define strncasecmp_P(s1, s2, n) strncasecmp((s1), (s2), (n)) -#define strncat_P(s1, s2, n) strncat((s1), (s2), (n)) -#define strncpy_P(s1, s2, n) strncpy((s1), (s2), (n)) -#define strpbrk_P(s, accept) strpbrk((s), (accept)) -#define strrchr_P(s, c) strrchr((s), (c)) -#define strsep_P(sp, delim) strsep((sp), (delim)) -#define strspn_P(s, accept) strspn((s), (accept)) -#define strstr_P(a, b) strstr((a), (b)) -#define strtok_P(s, delim) strtok((s), (delim)) -#define strtok_rP(s, delim, last) strtok((s), (delim), (last)) - -#define strlen_PF(a) strlen((a)) -#define strnlen_PF(src, len) strnlen((src), (len)) -#define memcpy_PF(dest, src, len) memcpy((dest), (src), (len)) -#define strcpy_PF(dest, src) strcpy((dest), (src)) -#define strncpy_PF(dest, src, len) strncpy((dest), (src), (len)) -#define strcat_PF(dest, src) strcat((dest), (src)) -#define strlcat_PF(dest, src, len) strlcat((dest), (src), (len)) -#define strncat_PF(dest, src, len) strncat((dest), (src), (len)) -#define strcmp_PF(s1, s2) strcmp((s1), (s2)) -#define strncmp_PF(s1, s2, n) strncmp((s1), (s2), (n)) -#define strcasecmp_PF(s1, s2) strcasecmp((s1), (s2)) -#define strncasecmp_PF(s1, s2, n) strncasecmp((s1), (s2), (n)) -#define strstr_PF(s1, s2) strstr((s1), (s2)) -#define strlcpy_PF(dest, src, n) strlcpy((dest), (src), (n)) -#define memcmp_PF(s1, s2, n) memcmp((s1), (s2), (n)) - -#define sprintf_P(s, f, ...) sprintf((s), (f), __VA_ARGS__) -#define snprintf_P(s, f, ...) snprintf((s), (f), __VA_ARGS__) - -#define pgm_read_byte(addr) (*(const unsigned char *)(addr)) -#define pgm_read_word(addr) (*(const unsigned short *)(addr)) -#define pgm_read_dword(addr) (*(const unsigned long *)(addr)) -#define pgm_read_float(addr) (*(const float *)(addr)) -#define pgm_read_ptr(addr) (*(const void **)(addr)) - -#define pgm_read_byte_near(addr) pgm_read_byte(addr) -#define pgm_read_word_near(addr) pgm_read_word(addr) -#define pgm_read_dword_near(addr) pgm_read_dword(addr) -#define pgm_read_float_near(addr) pgm_read_float(addr) -#define pgm_read_ptr_near(addr) pgm_read_ptr(addr) - -#define pgm_read_byte_far(addr) pgm_read_byte(addr) -#define pgm_read_word_far(addr) pgm_read_word(addr) -#define pgm_read_dword_far(addr) pgm_read_dword(addr) -#define pgm_read_float_far(addr) pgm_read_float(addr) -#define pgm_read_ptr_far(addr) pgm_read_ptr(addr) - -#define pgm_get_far_address(addr) (&(addr)) - -#endif +/* + pgmspace.h - Definitions for compatibility with AVR pgmspace macros + + Copyright (c) 2015 Arduino LLC + + Based on work of Paul Stoffregen on Teensy 3 (http://pjrc.com) + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE +*/ + +#ifndef __PGMSPACE_H_ +#define __PGMSPACE_H_ 1 + +#include + +#define PROGMEM +#define PGM_P const char * +#define PSTR(str) (str) + +#define _SFR_BYTE(n) (n) + +typedef void prog_void; +typedef char prog_char; +typedef unsigned char prog_uchar; +typedef int8_t prog_int8_t; +typedef uint8_t prog_uint8_t; +typedef int16_t prog_int16_t; +typedef uint16_t prog_uint16_t; +typedef int32_t prog_int32_t; +typedef uint32_t prog_uint32_t; +typedef int64_t prog_int64_t; +typedef uint64_t prog_uint64_t; + +typedef const void* int_farptr_t; +typedef const void* uint_farptr_t; + +#define memchr_P(s, c, n) memchr((s), (c), (n)) +#define memcmp_P(s1, s2, n) memcmp((s1), (s2), (n)) +#define memccpy_P(dest, src, c, n) memccpy((dest), (src), (c), (n)) +#define memcpy_P(dest, src, n) memcpy((dest), (src), (n)) +#define memmem_P(haystack, haystacklen, needle, needlelen) memmem((haystack), (haystacklen), (needle), (needlelen)) +#define memrchr_P(s, c, n) memrchr((s), (c), (n)) +#define strcat_P(dest, src) strcat((dest), (src)) +#define strchr_P(s, c) strchr((s), (c)) +#define strchrnul_P(s, c) strchrnul((s), (c)) +#define strcmp_P(a, b) strcmp((a), (b)) +#define strcpy_P(dest, src) strcpy((dest), (src)) +#define strcasecmp_P(s1, s2) strcasecmp((s1), (s2)) +#define strcasestr_P(haystack, needle) strcasestr((haystack), (needle)) +#define strcspn_P(s, accept) strcspn((s), (accept)) +#define strlcat_P(s1, s2, n) strlcat((s1), (s2), (n)) +#define strlcpy_P(s1, s2, n) strlcpy((s1), (s2), (n)) +#define strlen_P(a) strlen((a)) +#define strnlen_P(s, n) strnlen((s), (n)) +#define strncmp_P(s1, s2, n) strncmp((s1), (s2), (n)) +#define strncasecmp_P(s1, s2, n) strncasecmp((s1), (s2), (n)) +#define strncat_P(s1, s2, n) strncat((s1), (s2), (n)) +#define strncpy_P(s1, s2, n) strncpy((s1), (s2), (n)) +#define strpbrk_P(s, accept) strpbrk((s), (accept)) +#define strrchr_P(s, c) strrchr((s), (c)) +#define strsep_P(sp, delim) strsep((sp), (delim)) +#define strspn_P(s, accept) strspn((s), (accept)) +#define strstr_P(a, b) strstr((a), (b)) +#define strtok_P(s, delim) strtok((s), (delim)) +#define strtok_rP(s, delim, last) strtok((s), (delim), (last)) + +#define strlen_PF(a) strlen((a)) +#define strnlen_PF(src, len) strnlen((src), (len)) +#define memcpy_PF(dest, src, len) memcpy((dest), (src), (len)) +#define strcpy_PF(dest, src) strcpy((dest), (src)) +#define strncpy_PF(dest, src, len) strncpy((dest), (src), (len)) +#define strcat_PF(dest, src) strcat((dest), (src)) +#define strlcat_PF(dest, src, len) strlcat((dest), (src), (len)) +#define strncat_PF(dest, src, len) strncat((dest), (src), (len)) +#define strcmp_PF(s1, s2) strcmp((s1), (s2)) +#define strncmp_PF(s1, s2, n) strncmp((s1), (s2), (n)) +#define strcasecmp_PF(s1, s2) strcasecmp((s1), (s2)) +#define strncasecmp_PF(s1, s2, n) strncasecmp((s1), (s2), (n)) +#define strstr_PF(s1, s2) strstr((s1), (s2)) +#define strlcpy_PF(dest, src, n) strlcpy((dest), (src), (n)) +#define memcmp_PF(s1, s2, n) memcmp((s1), (s2), (n)) + +#define sprintf_P(s, f, ...) sprintf((s), (f), __VA_ARGS__) +#define snprintf_P(s, f, ...) snprintf((s), (f), __VA_ARGS__) + +#define pgm_read_byte(addr) (*(const unsigned char *)(addr)) +#define pgm_read_word(addr) (*(const unsigned short *)(addr)) +#define pgm_read_dword(addr) (*(const unsigned long *)(addr)) +#define pgm_read_float(addr) (*(const float *)(addr)) +#define pgm_read_ptr(addr) (*(const void **)(addr)) + +#define pgm_read_byte_near(addr) pgm_read_byte(addr) +#define pgm_read_word_near(addr) pgm_read_word(addr) +#define pgm_read_dword_near(addr) pgm_read_dword(addr) +#define pgm_read_float_near(addr) pgm_read_float(addr) +#define pgm_read_ptr_near(addr) pgm_read_ptr(addr) + +#define pgm_read_byte_far(addr) pgm_read_byte(addr) +#define pgm_read_word_far(addr) pgm_read_word(addr) +#define pgm_read_dword_far(addr) pgm_read_dword(addr) +#define pgm_read_float_far(addr) pgm_read_float(addr) +#define pgm_read_ptr_far(addr) pgm_read_ptr(addr) + +#define pgm_get_far_address(addr) (&(addr)) + +#endif diff --git a/Packages_Patches/realtek/hardware/AmebaD/3.1.2/cores/arduino/avr/pgmspace.h b/Packages_Patches/realtek/hardware/AmebaD/3.1.2/cores/arduino/avr/pgmspace.h index bf87a94f..de92051a 100644 --- a/Packages_Patches/realtek/hardware/AmebaD/3.1.2/cores/arduino/avr/pgmspace.h +++ b/Packages_Patches/realtek/hardware/AmebaD/3.1.2/cores/arduino/avr/pgmspace.h @@ -1,122 +1,122 @@ -/* - pgmspace.h - Definitions for compatibility with AVR pgmspace macros - - Copyright (c) 2015 Arduino LLC - - Based on work of Paul Stoffregen on Teensy 3 (http://pjrc.com) - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE -*/ - -#ifndef __PGMSPACE_H_ -#define __PGMSPACE_H_ 1 - -#include - -#define PROGMEM -#define PGM_P const char * -#define PSTR(str) (str) - -#define _SFR_BYTE(n) (n) - -typedef void prog_void; -typedef char prog_char; -typedef unsigned char prog_uchar; -typedef int8_t prog_int8_t; -typedef uint8_t prog_uint8_t; -typedef int16_t prog_int16_t; -typedef uint16_t prog_uint16_t; -typedef int32_t prog_int32_t; -typedef uint32_t prog_uint32_t; -typedef int64_t prog_int64_t; -typedef uint64_t prog_uint64_t; - -typedef const void* int_farptr_t; -typedef const void* uint_farptr_t; - -#define memchr_P(s, c, n) memchr((s), (c), (n)) -#define memcmp_P(s1, s2, n) memcmp((s1), (s2), (n)) -#define memccpy_P(dest, src, c, n) memccpy((dest), (src), (c), (n)) -#define memcpy_P(dest, src, n) memcpy((dest), (src), (n)) -#define memmem_P(haystack, haystacklen, needle, needlelen) memmem((haystack), (haystacklen), (needle), (needlelen)) -#define memrchr_P(s, c, n) memrchr((s), (c), (n)) -#define strcat_P(dest, src) strcat((dest), (src)) -#define strchr_P(s, c) strchr((s), (c)) -#define strchrnul_P(s, c) strchrnul((s), (c)) -#define strcmp_P(a, b) strcmp((a), (b)) -#define strcpy_P(dest, src) strcpy((dest), (src)) -#define strcasecmp_P(s1, s2) strcasecmp((s1), (s2)) -#define strcasestr_P(haystack, needle) strcasestr((haystack), (needle)) -#define strcspn_P(s, accept) strcspn((s), (accept)) -#define strlcat_P(s1, s2, n) strlcat((s1), (s2), (n)) -#define strlcpy_P(s1, s2, n) strlcpy((s1), (s2), (n)) -#define strlen_P(a) strlen((a)) -#define strnlen_P(s, n) strnlen((s), (n)) -#define strncmp_P(s1, s2, n) strncmp((s1), (s2), (n)) -#define strncasecmp_P(s1, s2, n) strncasecmp((s1), (s2), (n)) -#define strncat_P(s1, s2, n) strncat((s1), (s2), (n)) -#define strncpy_P(s1, s2, n) strncpy((s1), (s2), (n)) -#define strpbrk_P(s, accept) strpbrk((s), (accept)) -#define strrchr_P(s, c) strrchr((s), (c)) -#define strsep_P(sp, delim) strsep((sp), (delim)) -#define strspn_P(s, accept) strspn((s), (accept)) -#define strstr_P(a, b) strstr((a), (b)) -#define strtok_P(s, delim) strtok((s), (delim)) -#define strtok_rP(s, delim, last) strtok((s), (delim), (last)) - -#define strlen_PF(a) strlen((a)) -#define strnlen_PF(src, len) strnlen((src), (len)) -#define memcpy_PF(dest, src, len) memcpy((dest), (src), (len)) -#define strcpy_PF(dest, src) strcpy((dest), (src)) -#define strncpy_PF(dest, src, len) strncpy((dest), (src), (len)) -#define strcat_PF(dest, src) strcat((dest), (src)) -#define strlcat_PF(dest, src, len) strlcat((dest), (src), (len)) -#define strncat_PF(dest, src, len) strncat((dest), (src), (len)) -#define strcmp_PF(s1, s2) strcmp((s1), (s2)) -#define strncmp_PF(s1, s2, n) strncmp((s1), (s2), (n)) -#define strcasecmp_PF(s1, s2) strcasecmp((s1), (s2)) -#define strncasecmp_PF(s1, s2, n) strncasecmp((s1), (s2), (n)) -#define strstr_PF(s1, s2) strstr((s1), (s2)) -#define strlcpy_PF(dest, src, n) strlcpy((dest), (src), (n)) -#define memcmp_PF(s1, s2, n) memcmp((s1), (s2), (n)) - -#define sprintf_P(s, f, ...) sprintf((s), (f), __VA_ARGS__) -#define snprintf_P(s, f, ...) snprintf((s), (f), __VA_ARGS__) - -#define pgm_read_byte(addr) (*(const unsigned char *)(addr)) -#define pgm_read_word(addr) (*(const unsigned short *)(addr)) -#define pgm_read_dword(addr) (*(const unsigned long *)(addr)) -#define pgm_read_float(addr) (*(const float *)(addr)) -#define pgm_read_ptr(addr) (*(const void **)(addr)) - -#define pgm_read_byte_near(addr) pgm_read_byte(addr) -#define pgm_read_word_near(addr) pgm_read_word(addr) -#define pgm_read_dword_near(addr) pgm_read_dword(addr) -#define pgm_read_float_near(addr) pgm_read_float(addr) -#define pgm_read_ptr_near(addr) pgm_read_ptr(addr) - -#define pgm_read_byte_far(addr) pgm_read_byte(addr) -#define pgm_read_word_far(addr) pgm_read_word(addr) -#define pgm_read_dword_far(addr) pgm_read_dword(addr) -#define pgm_read_float_far(addr) pgm_read_float(addr) -#define pgm_read_ptr_far(addr) pgm_read_ptr(addr) - -#define pgm_get_far_address(addr) (&(addr)) - -#endif +/* + pgmspace.h - Definitions for compatibility with AVR pgmspace macros + + Copyright (c) 2015 Arduino LLC + + Based on work of Paul Stoffregen on Teensy 3 (http://pjrc.com) + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE +*/ + +#ifndef __PGMSPACE_H_ +#define __PGMSPACE_H_ 1 + +#include + +#define PROGMEM +#define PGM_P const char * +#define PSTR(str) (str) + +#define _SFR_BYTE(n) (n) + +typedef void prog_void; +typedef char prog_char; +typedef unsigned char prog_uchar; +typedef int8_t prog_int8_t; +typedef uint8_t prog_uint8_t; +typedef int16_t prog_int16_t; +typedef uint16_t prog_uint16_t; +typedef int32_t prog_int32_t; +typedef uint32_t prog_uint32_t; +typedef int64_t prog_int64_t; +typedef uint64_t prog_uint64_t; + +typedef const void* int_farptr_t; +typedef const void* uint_farptr_t; + +#define memchr_P(s, c, n) memchr((s), (c), (n)) +#define memcmp_P(s1, s2, n) memcmp((s1), (s2), (n)) +#define memccpy_P(dest, src, c, n) memccpy((dest), (src), (c), (n)) +#define memcpy_P(dest, src, n) memcpy((dest), (src), (n)) +#define memmem_P(haystack, haystacklen, needle, needlelen) memmem((haystack), (haystacklen), (needle), (needlelen)) +#define memrchr_P(s, c, n) memrchr((s), (c), (n)) +#define strcat_P(dest, src) strcat((dest), (src)) +#define strchr_P(s, c) strchr((s), (c)) +#define strchrnul_P(s, c) strchrnul((s), (c)) +#define strcmp_P(a, b) strcmp((a), (b)) +#define strcpy_P(dest, src) strcpy((dest), (src)) +#define strcasecmp_P(s1, s2) strcasecmp((s1), (s2)) +#define strcasestr_P(haystack, needle) strcasestr((haystack), (needle)) +#define strcspn_P(s, accept) strcspn((s), (accept)) +#define strlcat_P(s1, s2, n) strlcat((s1), (s2), (n)) +#define strlcpy_P(s1, s2, n) strlcpy((s1), (s2), (n)) +#define strlen_P(a) strlen((a)) +#define strnlen_P(s, n) strnlen((s), (n)) +#define strncmp_P(s1, s2, n) strncmp((s1), (s2), (n)) +#define strncasecmp_P(s1, s2, n) strncasecmp((s1), (s2), (n)) +#define strncat_P(s1, s2, n) strncat((s1), (s2), (n)) +#define strncpy_P(s1, s2, n) strncpy((s1), (s2), (n)) +#define strpbrk_P(s, accept) strpbrk((s), (accept)) +#define strrchr_P(s, c) strrchr((s), (c)) +#define strsep_P(sp, delim) strsep((sp), (delim)) +#define strspn_P(s, accept) strspn((s), (accept)) +#define strstr_P(a, b) strstr((a), (b)) +#define strtok_P(s, delim) strtok((s), (delim)) +#define strtok_rP(s, delim, last) strtok((s), (delim), (last)) + +#define strlen_PF(a) strlen((a)) +#define strnlen_PF(src, len) strnlen((src), (len)) +#define memcpy_PF(dest, src, len) memcpy((dest), (src), (len)) +#define strcpy_PF(dest, src) strcpy((dest), (src)) +#define strncpy_PF(dest, src, len) strncpy((dest), (src), (len)) +#define strcat_PF(dest, src) strcat((dest), (src)) +#define strlcat_PF(dest, src, len) strlcat((dest), (src), (len)) +#define strncat_PF(dest, src, len) strncat((dest), (src), (len)) +#define strcmp_PF(s1, s2) strcmp((s1), (s2)) +#define strncmp_PF(s1, s2, n) strncmp((s1), (s2), (n)) +#define strcasecmp_PF(s1, s2) strcasecmp((s1), (s2)) +#define strncasecmp_PF(s1, s2, n) strncasecmp((s1), (s2), (n)) +#define strstr_PF(s1, s2) strstr((s1), (s2)) +#define strlcpy_PF(dest, src, n) strlcpy((dest), (src), (n)) +#define memcmp_PF(s1, s2, n) memcmp((s1), (s2), (n)) + +#define sprintf_P(s, f, ...) sprintf((s), (f), __VA_ARGS__) +#define snprintf_P(s, f, ...) snprintf((s), (f), __VA_ARGS__) + +#define pgm_read_byte(addr) (*(const unsigned char *)(addr)) +#define pgm_read_word(addr) (*(const unsigned short *)(addr)) +#define pgm_read_dword(addr) (*(const unsigned long *)(addr)) +#define pgm_read_float(addr) (*(const float *)(addr)) +#define pgm_read_ptr(addr) (*(const void **)(addr)) + +#define pgm_read_byte_near(addr) pgm_read_byte(addr) +#define pgm_read_word_near(addr) pgm_read_word(addr) +#define pgm_read_dword_near(addr) pgm_read_dword(addr) +#define pgm_read_float_near(addr) pgm_read_float(addr) +#define pgm_read_ptr_near(addr) pgm_read_ptr(addr) + +#define pgm_read_byte_far(addr) pgm_read_byte(addr) +#define pgm_read_word_far(addr) pgm_read_word(addr) +#define pgm_read_dword_far(addr) pgm_read_dword(addr) +#define pgm_read_float_far(addr) pgm_read_float(addr) +#define pgm_read_ptr_far(addr) pgm_read_ptr(addr) + +#define pgm_get_far_address(addr) (&(addr)) + +#endif diff --git a/Packages_Patches/realtek/hardware/AmebaD/3.1.3/cores/ambd/avr/pgmspace.h b/Packages_Patches/realtek/hardware/AmebaD/3.1.3/cores/ambd/avr/pgmspace.h index bf87a94f..de92051a 100644 --- a/Packages_Patches/realtek/hardware/AmebaD/3.1.3/cores/ambd/avr/pgmspace.h +++ b/Packages_Patches/realtek/hardware/AmebaD/3.1.3/cores/ambd/avr/pgmspace.h @@ -1,122 +1,122 @@ -/* - pgmspace.h - Definitions for compatibility with AVR pgmspace macros - - Copyright (c) 2015 Arduino LLC - - Based on work of Paul Stoffregen on Teensy 3 (http://pjrc.com) - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE -*/ - -#ifndef __PGMSPACE_H_ -#define __PGMSPACE_H_ 1 - -#include - -#define PROGMEM -#define PGM_P const char * -#define PSTR(str) (str) - -#define _SFR_BYTE(n) (n) - -typedef void prog_void; -typedef char prog_char; -typedef unsigned char prog_uchar; -typedef int8_t prog_int8_t; -typedef uint8_t prog_uint8_t; -typedef int16_t prog_int16_t; -typedef uint16_t prog_uint16_t; -typedef int32_t prog_int32_t; -typedef uint32_t prog_uint32_t; -typedef int64_t prog_int64_t; -typedef uint64_t prog_uint64_t; - -typedef const void* int_farptr_t; -typedef const void* uint_farptr_t; - -#define memchr_P(s, c, n) memchr((s), (c), (n)) -#define memcmp_P(s1, s2, n) memcmp((s1), (s2), (n)) -#define memccpy_P(dest, src, c, n) memccpy((dest), (src), (c), (n)) -#define memcpy_P(dest, src, n) memcpy((dest), (src), (n)) -#define memmem_P(haystack, haystacklen, needle, needlelen) memmem((haystack), (haystacklen), (needle), (needlelen)) -#define memrchr_P(s, c, n) memrchr((s), (c), (n)) -#define strcat_P(dest, src) strcat((dest), (src)) -#define strchr_P(s, c) strchr((s), (c)) -#define strchrnul_P(s, c) strchrnul((s), (c)) -#define strcmp_P(a, b) strcmp((a), (b)) -#define strcpy_P(dest, src) strcpy((dest), (src)) -#define strcasecmp_P(s1, s2) strcasecmp((s1), (s2)) -#define strcasestr_P(haystack, needle) strcasestr((haystack), (needle)) -#define strcspn_P(s, accept) strcspn((s), (accept)) -#define strlcat_P(s1, s2, n) strlcat((s1), (s2), (n)) -#define strlcpy_P(s1, s2, n) strlcpy((s1), (s2), (n)) -#define strlen_P(a) strlen((a)) -#define strnlen_P(s, n) strnlen((s), (n)) -#define strncmp_P(s1, s2, n) strncmp((s1), (s2), (n)) -#define strncasecmp_P(s1, s2, n) strncasecmp((s1), (s2), (n)) -#define strncat_P(s1, s2, n) strncat((s1), (s2), (n)) -#define strncpy_P(s1, s2, n) strncpy((s1), (s2), (n)) -#define strpbrk_P(s, accept) strpbrk((s), (accept)) -#define strrchr_P(s, c) strrchr((s), (c)) -#define strsep_P(sp, delim) strsep((sp), (delim)) -#define strspn_P(s, accept) strspn((s), (accept)) -#define strstr_P(a, b) strstr((a), (b)) -#define strtok_P(s, delim) strtok((s), (delim)) -#define strtok_rP(s, delim, last) strtok((s), (delim), (last)) - -#define strlen_PF(a) strlen((a)) -#define strnlen_PF(src, len) strnlen((src), (len)) -#define memcpy_PF(dest, src, len) memcpy((dest), (src), (len)) -#define strcpy_PF(dest, src) strcpy((dest), (src)) -#define strncpy_PF(dest, src, len) strncpy((dest), (src), (len)) -#define strcat_PF(dest, src) strcat((dest), (src)) -#define strlcat_PF(dest, src, len) strlcat((dest), (src), (len)) -#define strncat_PF(dest, src, len) strncat((dest), (src), (len)) -#define strcmp_PF(s1, s2) strcmp((s1), (s2)) -#define strncmp_PF(s1, s2, n) strncmp((s1), (s2), (n)) -#define strcasecmp_PF(s1, s2) strcasecmp((s1), (s2)) -#define strncasecmp_PF(s1, s2, n) strncasecmp((s1), (s2), (n)) -#define strstr_PF(s1, s2) strstr((s1), (s2)) -#define strlcpy_PF(dest, src, n) strlcpy((dest), (src), (n)) -#define memcmp_PF(s1, s2, n) memcmp((s1), (s2), (n)) - -#define sprintf_P(s, f, ...) sprintf((s), (f), __VA_ARGS__) -#define snprintf_P(s, f, ...) snprintf((s), (f), __VA_ARGS__) - -#define pgm_read_byte(addr) (*(const unsigned char *)(addr)) -#define pgm_read_word(addr) (*(const unsigned short *)(addr)) -#define pgm_read_dword(addr) (*(const unsigned long *)(addr)) -#define pgm_read_float(addr) (*(const float *)(addr)) -#define pgm_read_ptr(addr) (*(const void **)(addr)) - -#define pgm_read_byte_near(addr) pgm_read_byte(addr) -#define pgm_read_word_near(addr) pgm_read_word(addr) -#define pgm_read_dword_near(addr) pgm_read_dword(addr) -#define pgm_read_float_near(addr) pgm_read_float(addr) -#define pgm_read_ptr_near(addr) pgm_read_ptr(addr) - -#define pgm_read_byte_far(addr) pgm_read_byte(addr) -#define pgm_read_word_far(addr) pgm_read_word(addr) -#define pgm_read_dword_far(addr) pgm_read_dword(addr) -#define pgm_read_float_far(addr) pgm_read_float(addr) -#define pgm_read_ptr_far(addr) pgm_read_ptr(addr) - -#define pgm_get_far_address(addr) (&(addr)) - -#endif +/* + pgmspace.h - Definitions for compatibility with AVR pgmspace macros + + Copyright (c) 2015 Arduino LLC + + Based on work of Paul Stoffregen on Teensy 3 (http://pjrc.com) + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE +*/ + +#ifndef __PGMSPACE_H_ +#define __PGMSPACE_H_ 1 + +#include + +#define PROGMEM +#define PGM_P const char * +#define PSTR(str) (str) + +#define _SFR_BYTE(n) (n) + +typedef void prog_void; +typedef char prog_char; +typedef unsigned char prog_uchar; +typedef int8_t prog_int8_t; +typedef uint8_t prog_uint8_t; +typedef int16_t prog_int16_t; +typedef uint16_t prog_uint16_t; +typedef int32_t prog_int32_t; +typedef uint32_t prog_uint32_t; +typedef int64_t prog_int64_t; +typedef uint64_t prog_uint64_t; + +typedef const void* int_farptr_t; +typedef const void* uint_farptr_t; + +#define memchr_P(s, c, n) memchr((s), (c), (n)) +#define memcmp_P(s1, s2, n) memcmp((s1), (s2), (n)) +#define memccpy_P(dest, src, c, n) memccpy((dest), (src), (c), (n)) +#define memcpy_P(dest, src, n) memcpy((dest), (src), (n)) +#define memmem_P(haystack, haystacklen, needle, needlelen) memmem((haystack), (haystacklen), (needle), (needlelen)) +#define memrchr_P(s, c, n) memrchr((s), (c), (n)) +#define strcat_P(dest, src) strcat((dest), (src)) +#define strchr_P(s, c) strchr((s), (c)) +#define strchrnul_P(s, c) strchrnul((s), (c)) +#define strcmp_P(a, b) strcmp((a), (b)) +#define strcpy_P(dest, src) strcpy((dest), (src)) +#define strcasecmp_P(s1, s2) strcasecmp((s1), (s2)) +#define strcasestr_P(haystack, needle) strcasestr((haystack), (needle)) +#define strcspn_P(s, accept) strcspn((s), (accept)) +#define strlcat_P(s1, s2, n) strlcat((s1), (s2), (n)) +#define strlcpy_P(s1, s2, n) strlcpy((s1), (s2), (n)) +#define strlen_P(a) strlen((a)) +#define strnlen_P(s, n) strnlen((s), (n)) +#define strncmp_P(s1, s2, n) strncmp((s1), (s2), (n)) +#define strncasecmp_P(s1, s2, n) strncasecmp((s1), (s2), (n)) +#define strncat_P(s1, s2, n) strncat((s1), (s2), (n)) +#define strncpy_P(s1, s2, n) strncpy((s1), (s2), (n)) +#define strpbrk_P(s, accept) strpbrk((s), (accept)) +#define strrchr_P(s, c) strrchr((s), (c)) +#define strsep_P(sp, delim) strsep((sp), (delim)) +#define strspn_P(s, accept) strspn((s), (accept)) +#define strstr_P(a, b) strstr((a), (b)) +#define strtok_P(s, delim) strtok((s), (delim)) +#define strtok_rP(s, delim, last) strtok((s), (delim), (last)) + +#define strlen_PF(a) strlen((a)) +#define strnlen_PF(src, len) strnlen((src), (len)) +#define memcpy_PF(dest, src, len) memcpy((dest), (src), (len)) +#define strcpy_PF(dest, src) strcpy((dest), (src)) +#define strncpy_PF(dest, src, len) strncpy((dest), (src), (len)) +#define strcat_PF(dest, src) strcat((dest), (src)) +#define strlcat_PF(dest, src, len) strlcat((dest), (src), (len)) +#define strncat_PF(dest, src, len) strncat((dest), (src), (len)) +#define strcmp_PF(s1, s2) strcmp((s1), (s2)) +#define strncmp_PF(s1, s2, n) strncmp((s1), (s2), (n)) +#define strcasecmp_PF(s1, s2) strcasecmp((s1), (s2)) +#define strncasecmp_PF(s1, s2, n) strncasecmp((s1), (s2), (n)) +#define strstr_PF(s1, s2) strstr((s1), (s2)) +#define strlcpy_PF(dest, src, n) strlcpy((dest), (src), (n)) +#define memcmp_PF(s1, s2, n) memcmp((s1), (s2), (n)) + +#define sprintf_P(s, f, ...) sprintf((s), (f), __VA_ARGS__) +#define snprintf_P(s, f, ...) snprintf((s), (f), __VA_ARGS__) + +#define pgm_read_byte(addr) (*(const unsigned char *)(addr)) +#define pgm_read_word(addr) (*(const unsigned short *)(addr)) +#define pgm_read_dword(addr) (*(const unsigned long *)(addr)) +#define pgm_read_float(addr) (*(const float *)(addr)) +#define pgm_read_ptr(addr) (*(const void **)(addr)) + +#define pgm_read_byte_near(addr) pgm_read_byte(addr) +#define pgm_read_word_near(addr) pgm_read_word(addr) +#define pgm_read_dword_near(addr) pgm_read_dword(addr) +#define pgm_read_float_near(addr) pgm_read_float(addr) +#define pgm_read_ptr_near(addr) pgm_read_ptr(addr) + +#define pgm_read_byte_far(addr) pgm_read_byte(addr) +#define pgm_read_word_far(addr) pgm_read_word(addr) +#define pgm_read_dword_far(addr) pgm_read_dword(addr) +#define pgm_read_float_far(addr) pgm_read_float(addr) +#define pgm_read_ptr_far(addr) pgm_read_ptr(addr) + +#define pgm_get_far_address(addr) (&(addr)) + +#endif diff --git a/Packages_Patches/realtek/hardware/AmebaD/3.1.4/cores/ambd/avr/pgmspace.h b/Packages_Patches/realtek/hardware/AmebaD/3.1.4/cores/ambd/avr/pgmspace.h new file mode 100644 index 00000000..de92051a --- /dev/null +++ b/Packages_Patches/realtek/hardware/AmebaD/3.1.4/cores/ambd/avr/pgmspace.h @@ -0,0 +1,122 @@ +/* + pgmspace.h - Definitions for compatibility with AVR pgmspace macros + + Copyright (c) 2015 Arduino LLC + + Based on work of Paul Stoffregen on Teensy 3 (http://pjrc.com) + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE +*/ + +#ifndef __PGMSPACE_H_ +#define __PGMSPACE_H_ 1 + +#include + +#define PROGMEM +#define PGM_P const char * +#define PSTR(str) (str) + +#define _SFR_BYTE(n) (n) + +typedef void prog_void; +typedef char prog_char; +typedef unsigned char prog_uchar; +typedef int8_t prog_int8_t; +typedef uint8_t prog_uint8_t; +typedef int16_t prog_int16_t; +typedef uint16_t prog_uint16_t; +typedef int32_t prog_int32_t; +typedef uint32_t prog_uint32_t; +typedef int64_t prog_int64_t; +typedef uint64_t prog_uint64_t; + +typedef const void* int_farptr_t; +typedef const void* uint_farptr_t; + +#define memchr_P(s, c, n) memchr((s), (c), (n)) +#define memcmp_P(s1, s2, n) memcmp((s1), (s2), (n)) +#define memccpy_P(dest, src, c, n) memccpy((dest), (src), (c), (n)) +#define memcpy_P(dest, src, n) memcpy((dest), (src), (n)) +#define memmem_P(haystack, haystacklen, needle, needlelen) memmem((haystack), (haystacklen), (needle), (needlelen)) +#define memrchr_P(s, c, n) memrchr((s), (c), (n)) +#define strcat_P(dest, src) strcat((dest), (src)) +#define strchr_P(s, c) strchr((s), (c)) +#define strchrnul_P(s, c) strchrnul((s), (c)) +#define strcmp_P(a, b) strcmp((a), (b)) +#define strcpy_P(dest, src) strcpy((dest), (src)) +#define strcasecmp_P(s1, s2) strcasecmp((s1), (s2)) +#define strcasestr_P(haystack, needle) strcasestr((haystack), (needle)) +#define strcspn_P(s, accept) strcspn((s), (accept)) +#define strlcat_P(s1, s2, n) strlcat((s1), (s2), (n)) +#define strlcpy_P(s1, s2, n) strlcpy((s1), (s2), (n)) +#define strlen_P(a) strlen((a)) +#define strnlen_P(s, n) strnlen((s), (n)) +#define strncmp_P(s1, s2, n) strncmp((s1), (s2), (n)) +#define strncasecmp_P(s1, s2, n) strncasecmp((s1), (s2), (n)) +#define strncat_P(s1, s2, n) strncat((s1), (s2), (n)) +#define strncpy_P(s1, s2, n) strncpy((s1), (s2), (n)) +#define strpbrk_P(s, accept) strpbrk((s), (accept)) +#define strrchr_P(s, c) strrchr((s), (c)) +#define strsep_P(sp, delim) strsep((sp), (delim)) +#define strspn_P(s, accept) strspn((s), (accept)) +#define strstr_P(a, b) strstr((a), (b)) +#define strtok_P(s, delim) strtok((s), (delim)) +#define strtok_rP(s, delim, last) strtok((s), (delim), (last)) + +#define strlen_PF(a) strlen((a)) +#define strnlen_PF(src, len) strnlen((src), (len)) +#define memcpy_PF(dest, src, len) memcpy((dest), (src), (len)) +#define strcpy_PF(dest, src) strcpy((dest), (src)) +#define strncpy_PF(dest, src, len) strncpy((dest), (src), (len)) +#define strcat_PF(dest, src) strcat((dest), (src)) +#define strlcat_PF(dest, src, len) strlcat((dest), (src), (len)) +#define strncat_PF(dest, src, len) strncat((dest), (src), (len)) +#define strcmp_PF(s1, s2) strcmp((s1), (s2)) +#define strncmp_PF(s1, s2, n) strncmp((s1), (s2), (n)) +#define strcasecmp_PF(s1, s2) strcasecmp((s1), (s2)) +#define strncasecmp_PF(s1, s2, n) strncasecmp((s1), (s2), (n)) +#define strstr_PF(s1, s2) strstr((s1), (s2)) +#define strlcpy_PF(dest, src, n) strlcpy((dest), (src), (n)) +#define memcmp_PF(s1, s2, n) memcmp((s1), (s2), (n)) + +#define sprintf_P(s, f, ...) sprintf((s), (f), __VA_ARGS__) +#define snprintf_P(s, f, ...) snprintf((s), (f), __VA_ARGS__) + +#define pgm_read_byte(addr) (*(const unsigned char *)(addr)) +#define pgm_read_word(addr) (*(const unsigned short *)(addr)) +#define pgm_read_dword(addr) (*(const unsigned long *)(addr)) +#define pgm_read_float(addr) (*(const float *)(addr)) +#define pgm_read_ptr(addr) (*(const void **)(addr)) + +#define pgm_read_byte_near(addr) pgm_read_byte(addr) +#define pgm_read_word_near(addr) pgm_read_word(addr) +#define pgm_read_dword_near(addr) pgm_read_dword(addr) +#define pgm_read_float_near(addr) pgm_read_float(addr) +#define pgm_read_ptr_near(addr) pgm_read_ptr(addr) + +#define pgm_read_byte_far(addr) pgm_read_byte(addr) +#define pgm_read_word_far(addr) pgm_read_word(addr) +#define pgm_read_dword_far(addr) pgm_read_dword(addr) +#define pgm_read_float_far(addr) pgm_read_float(addr) +#define pgm_read_ptr_far(addr) pgm_read_ptr(addr) + +#define pgm_get_far_address(addr) (&(addr)) + +#endif diff --git a/Packages_Patches/rp2040/hardware/rp2040/1.3.1/cores/rp2040/Arduino.h b/Packages_Patches/rp2040/hardware/rp2040/1.3.1/cores/rp2040/Arduino.h index 99c1eb85..f1a61729 100644 --- a/Packages_Patches/rp2040/hardware/rp2040/1.3.1/cores/rp2040/Arduino.h +++ b/Packages_Patches/rp2040/hardware/rp2040/1.3.1/cores/rp2040/Arduino.h @@ -1,22 +1,22 @@ /* - * Arduino header for the Raspberry Pi Pico RP2040 - * - * Copyright (c) 2021 Earle F. Philhower, III - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ + Arduino header for the Raspberry Pi Pico RP2040 + + Copyright (c) 2021 Earle F. Philhower, III + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ #ifndef Arduino_h #define Arduino_h @@ -37,7 +37,7 @@ #include "debug_internal.h" #ifdef __cplusplus -extern "C"{ +extern "C" { #endif // __cplusplus // For compatibility to many platforms and libraries @@ -103,8 +103,9 @@ unsigned long millis(); // Template which will evaluate at *compile time* to a single 32b number // with the specified bits set. template -constexpr uint32_t __bitset(const int (&a)[N], size_t i = 0U) { - return i < N ? (1L << a[i]) | __bitset(a, i+1) : 0; +constexpr uint32_t __bitset(const int (&a)[N], size_t i = 0U) +{ + return i < N ? (1L << a[i]) | __bitset(a, i + 1) : 0; } #endif diff --git a/Packages_Patches/rp2040/hardware/rp2040/1.4.0/cores/rp2040/Arduino.h b/Packages_Patches/rp2040/hardware/rp2040/1.4.0/cores/rp2040/Arduino.h index 99c1eb85..f1a61729 100644 --- a/Packages_Patches/rp2040/hardware/rp2040/1.4.0/cores/rp2040/Arduino.h +++ b/Packages_Patches/rp2040/hardware/rp2040/1.4.0/cores/rp2040/Arduino.h @@ -1,22 +1,22 @@ /* - * Arduino header for the Raspberry Pi Pico RP2040 - * - * Copyright (c) 2021 Earle F. Philhower, III - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ + Arduino header for the Raspberry Pi Pico RP2040 + + Copyright (c) 2021 Earle F. Philhower, III + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ #ifndef Arduino_h #define Arduino_h @@ -37,7 +37,7 @@ #include "debug_internal.h" #ifdef __cplusplus -extern "C"{ +extern "C" { #endif // __cplusplus // For compatibility to many platforms and libraries @@ -103,8 +103,9 @@ unsigned long millis(); // Template which will evaluate at *compile time* to a single 32b number // with the specified bits set. template -constexpr uint32_t __bitset(const int (&a)[N], size_t i = 0U) { - return i < N ? (1L << a[i]) | __bitset(a, i+1) : 0; +constexpr uint32_t __bitset(const int (&a)[N], size_t i = 0U) +{ + return i < N ? (1L << a[i]) | __bitset(a, i + 1) : 0; } #endif