Compare commits
No commits in common. "master" and "flashdefines" have entirely different histories.
master
...
flashdefin
70 changed files with 451 additions and 3346 deletions
6
.github/workflows/githubci.yml
vendored
6
.github/workflows/githubci.yml
vendored
|
|
@ -49,7 +49,7 @@ jobs:
|
|||
arduino-cli core update-index --additional-urls $BSP_URL
|
||||
arduino-cli core install arduino:samd --additional-urls $BSP_URL
|
||||
arduino-cli core install adafruit:samd --additional-urls $BSP_URL
|
||||
# Replace release BSP with our code
|
||||
# Repalce release BSP with our code
|
||||
BSP_VERSION=`eval ls $HOME/$BSP_PATH`
|
||||
rm -r $HOME/$BSP_PATH/*
|
||||
ln -s $GITHUB_WORKSPACE $HOME/$BSP_PATH/$BSP_VERSION
|
||||
|
|
@ -57,7 +57,3 @@ jobs:
|
|||
|
||||
- name: Build examples
|
||||
run: python3 extras/build_all.py ${{ matrix.arduino-platform }}
|
||||
|
||||
# How to mark this as allowed-to-fail?
|
||||
- name: Build examples (-Wall)
|
||||
run: python3 extras/build_all.py --all_warnings --warnings_do_not_cause_job_failure
|
||||
|
|
|
|||
168
boards.txt
168
boards.txt
|
|
@ -270,43 +270,6 @@ adafruit_trinket_m0.menu.debug.off=Off
|
|||
adafruit_trinket_m0.menu.debug.on=On
|
||||
adafruit_trinket_m0.menu.debug.on.build.flags.debug=-g
|
||||
|
||||
# Adafruit QT Py M0 (SAMD21)
|
||||
# ------------------------------
|
||||
adafruit_qtpy_m0.name=Adafruit QT PY (SAMD21)
|
||||
adafruit_qtpy_m0.vid.0=0x239A
|
||||
adafruit_qtpy_m0.pid.0=0x80CB
|
||||
adafruit_qtpy_m0.vid.1=0x239A
|
||||
adafruit_qtpy_m0.pid.1=0x00CB
|
||||
adafruit_qtpy_m0.vid.1=0x239A
|
||||
adafruit_qtpy_m0.pid.1=0x00CC
|
||||
adafruit_qtpy_m0.upload.tool=bossac
|
||||
adafruit_qtpy_m0.upload.protocol=sam-ba
|
||||
adafruit_qtpy_m0.upload.maximum_size=262144
|
||||
adafruit_qtpy_m0.upload.offset=0x2000
|
||||
adafruit_qtpy_m0.upload.use_1200bps_touch=true
|
||||
adafruit_qtpy_m0.upload.wait_for_upload_port=true
|
||||
adafruit_qtpy_m0.upload.native_usb=true
|
||||
adafruit_qtpy_m0.build.mcu=cortex-m0plus
|
||||
adafruit_qtpy_m0.build.f_cpu=48000000L
|
||||
adafruit_qtpy_m0.build.usb_product="QT Py M0"
|
||||
adafruit_qtpy_m0.build.usb_manufacturer="Adafruit"
|
||||
adafruit_qtpy_m0.build.board=QTPY_M0
|
||||
adafruit_qtpy_m0.build.core=arduino
|
||||
adafruit_qtpy_m0.build.extra_flags=-DCRYSTALLESS -DADAFRUIT_QTPY_M0 -D__SAMD21E18A__ -DARM_MATH_CM0PLUS {build.usb_flags}
|
||||
adafruit_qtpy_m0.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld
|
||||
adafruit_qtpy_m0.build.openocdscript=openocd_scripts/trinket_m0.cfg
|
||||
adafruit_qtpy_m0.build.variant=qtpy_m0
|
||||
adafruit_qtpy_m0.build.variant_system_lib=
|
||||
adafruit_qtpy_m0.build.vid=0x239A
|
||||
adafruit_qtpy_m0.build.pid=0x80CB
|
||||
adafruit_qtpy_m0.bootloader.tool=openocd
|
||||
adafruit_qtpy_m0.bootloader.file=qtpyM0/bootloader-qtpy_m0.bin
|
||||
adafruit_qtpy_m0.menu.usbstack.arduino=Arduino
|
||||
adafruit_qtpy_m0.menu.usbstack.tinyusb=TinyUSB
|
||||
adafruit_qtpy_m0.menu.usbstack.tinyusb.build.flags.usbstack=-DUSE_TINYUSB
|
||||
adafruit_qtpy_m0.menu.debug.off=Off
|
||||
adafruit_qtpy_m0.menu.debug.on=On
|
||||
adafruit_qtpy_m0.menu.debug.on.build.flags.debug=-g
|
||||
|
||||
# Adafruit ItsyBitsy M0 (SAMD21)
|
||||
# ------------------------------
|
||||
|
|
@ -485,7 +448,7 @@ adafruit_metro_m4.build.vid=0x239A
|
|||
adafruit_metro_m4.build.pid=0x8020
|
||||
adafruit_metro_m4.bootloader.tool=openocd
|
||||
adafruit_metro_m4.bootloader.file=metroM4/bootloader-metro_m4-v2.0.0-adafruit.5.bin
|
||||
adafruit_metro_m4.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-5.4.0.path}/CMSIS/Lib/GCC/" "-L{build.variant.path}" -larm_cortexM4lf_math -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
adafruit_metro_m4.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Lib/GCC/" "-L{build.variant.path}" -larm_cortexM4lf_math -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
adafruit_metro_m4.menu.cache.on=Enabled
|
||||
adafruit_metro_m4.menu.cache.on.build.cache_flags=-DENABLE_CACHE
|
||||
adafruit_metro_m4.menu.cache.off=Disabled
|
||||
|
|
@ -550,8 +513,8 @@ adafruit_grandcentral_m4.build.variant_system_lib=
|
|||
adafruit_grandcentral_m4.build.vid=0x239A
|
||||
adafruit_grandcentral_m4.build.pid=0x8031
|
||||
adafruit_grandcentral_m4.bootloader.tool=openocd
|
||||
adafruit_grandcentral_m4.bootloader.file=grand_central_m4/bootloader-grandcentral_m4.bin
|
||||
adafruit_grandcentral_m4.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-5.4.0.path}/CMSIS/Lib/GCC/" "-L{build.variant.path}" -larm_cortexM4lf_math -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
adafruit_grandcentral_m4.bootloader.file=grand_central_m4/bootloader-grandcentralM4-v2.0.0-adafruit.5.bin
|
||||
adafruit_grandcentral_m4.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Lib/GCC/" "-L{build.variant.path}" -larm_cortexM4lf_math -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
adafruit_grandcentral_m4.menu.cache.on=Enabled
|
||||
adafruit_grandcentral_m4.menu.cache.on.build.cache_flags=-DENABLE_CACHE
|
||||
adafruit_grandcentral_m4.menu.cache.off=Disabled
|
||||
|
|
@ -614,7 +577,7 @@ adafruit_itsybitsy_m4.build.vid=0x239A
|
|||
adafruit_itsybitsy_m4.build.pid=0x802B
|
||||
adafruit_itsybitsy_m4.bootloader.tool=openocd
|
||||
adafruit_itsybitsy_m4.bootloader.file=itsybitsyM4/bootloader-itsybitsy_m4-v2.0.0-adafruit.5.bin
|
||||
adafruit_itsybitsy_m4.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-5.4.0.path}/CMSIS/Lib/GCC/" "-L{build.variant.path}" -larm_cortexM4lf_math -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
adafruit_itsybitsy_m4.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Lib/GCC/" "-L{build.variant.path}" -larm_cortexM4lf_math -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
adafruit_itsybitsy_m4.menu.cache.on=Enabled
|
||||
adafruit_itsybitsy_m4.menu.cache.on.build.cache_flags=-DENABLE_CACHE
|
||||
adafruit_itsybitsy_m4.menu.cache.off=Disabled
|
||||
|
|
@ -677,7 +640,7 @@ adafruit_feather_m4.build.vid=0x239A
|
|||
adafruit_feather_m4.build.pid=0x8022
|
||||
adafruit_feather_m4.bootloader.tool=openocd
|
||||
adafruit_feather_m4.bootloader.file=featherM4/bootloader-feather_m4-v2.0.0-adafruit.5.bin
|
||||
adafruit_feather_m4.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-5.4.0.path}/CMSIS/Lib/GCC/" "-L{build.variant.path}" -larm_cortexM4lf_math -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
adafruit_feather_m4.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Lib/GCC/" "-L{build.variant.path}" -larm_cortexM4lf_math -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
adafruit_feather_m4.menu.cache.on=Enabled
|
||||
adafruit_feather_m4.menu.cache.on.build.cache_flags=-DENABLE_CACHE
|
||||
adafruit_feather_m4.menu.cache.off=Disabled
|
||||
|
|
@ -742,7 +705,7 @@ adafruit_trellis_m4.build.vid=0x239A
|
|||
adafruit_trellis_m4.build.pid=0x802F
|
||||
adafruit_trellis_m4.bootloader.tool=openocd
|
||||
adafruit_trellis_m4.bootloader.file=trellisM4/bootloader-trellis_m4-v2.0.0-adafruit.5.bin
|
||||
adafruit_trellis_m4.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-5.4.0.path}/CMSIS/Lib/GCC/" "-L{build.variant.path}" -larm_cortexM4lf_math -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
adafruit_trellis_m4.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Lib/GCC/" "-L{build.variant.path}" -larm_cortexM4lf_math -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
adafruit_trellis_m4.menu.cache.on=Enabled
|
||||
adafruit_trellis_m4.menu.cache.on.build.cache_flags=-DENABLE_CACHE
|
||||
adafruit_trellis_m4.menu.cache.off=Disabled
|
||||
|
|
@ -805,7 +768,7 @@ adafruit_pyportal_m4.build.vid=0x239A
|
|||
adafruit_pyportal_m4.build.pid=0x8035
|
||||
adafruit_pyportal_m4.bootloader.tool=openocd
|
||||
adafruit_pyportal_m4.bootloader.file=metroM4/bootloader-metro_m4-v2.0.0-adafruit.5.bin
|
||||
adafruit_pyportal_m4.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-5.4.0.path}/CMSIS/Lib/GCC/" "-L{build.variant.path}" -larm_cortexM4lf_math -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
adafruit_pyportal_m4.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Lib/GCC/" "-L{build.variant.path}" -larm_cortexM4lf_math -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
adafruit_pyportal_m4.menu.cache.on=Enabled
|
||||
adafruit_pyportal_m4.menu.cache.on.build.cache_flags=-DENABLE_CACHE
|
||||
adafruit_pyportal_m4.menu.cache.off=Disabled
|
||||
|
|
@ -868,7 +831,7 @@ adafruit_pyportal_m4_titano.build.vid=0x239A
|
|||
adafruit_pyportal_m4_titano.build.pid=0x8035
|
||||
adafruit_pyportal_m4_titano.bootloader.tool=openocd
|
||||
adafruit_pyportal_m4_titano.bootloader.file=metroM4/bootloader-metro_m4-v2.0.0-adafruit.5.bin
|
||||
adafruit_pyportal_m4_titano.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-5.4.0.path}/CMSIS/Lib/GCC/" "-L{build.variant.path}" -larm_cortexM4lf_math -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
adafruit_pyportal_m4_titano.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Lib/GCC/" "-L{build.variant.path}" -larm_cortexM4lf_math -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
adafruit_pyportal_m4_titano.menu.cache.on=Enabled
|
||||
adafruit_pyportal_m4_titano.menu.cache.on.build.cache_flags=-DENABLE_CACHE
|
||||
adafruit_pyportal_m4_titano.menu.cache.off=Disabled
|
||||
|
|
@ -933,7 +896,7 @@ adafruit_pybadge_m4.build.vid=0x239A
|
|||
adafruit_pybadge_m4.build.pid=0x8033
|
||||
adafruit_pybadge_m4.bootloader.tool=openocd
|
||||
adafruit_pybadge_m4.bootloader.file=featherM4/bootloader-feather_m4-v2.0.0-adafruit.5.bin
|
||||
adafruit_pybadge_m4.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-5.4.0.path}/CMSIS/Lib/GCC/" "-L{build.variant.path}" -larm_cortexM4lf_math -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
adafruit_pybadge_m4.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Lib/GCC/" "-L{build.variant.path}" -larm_cortexM4lf_math -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
adafruit_pybadge_m4.menu.cache.on=Enabled
|
||||
adafruit_pybadge_m4.menu.cache.on.build.cache_flags=-DENABLE_CACHE
|
||||
adafruit_pybadge_m4.menu.cache.off=Disabled
|
||||
|
|
@ -997,7 +960,7 @@ adafruit_metro_m4_airliftlite.build.vid=0x239A
|
|||
adafruit_metro_m4_airliftlite.build.pid=0x8037
|
||||
adafruit_metro_m4_airliftlite.bootloader.tool=openocd
|
||||
adafruit_metro_m4_airliftlite.bootloader.file=metroM4/bootloader-metro_m4-v2.0.0-adafruit.5.bin
|
||||
adafruit_metro_m4_airliftlite.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-5.4.0.path}/CMSIS/Lib/GCC/" "-L{build.variant.path}" -larm_cortexM4lf_math -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
adafruit_metro_m4_airliftlite.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Lib/GCC/" "-L{build.variant.path}" -larm_cortexM4lf_math -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
adafruit_metro_m4_airliftlite.menu.cache.on=Enabled
|
||||
adafruit_metro_m4_airliftlite.menu.cache.on.build.cache_flags=-DENABLE_CACHE
|
||||
adafruit_metro_m4_airliftlite.menu.cache.off=Disabled
|
||||
|
|
@ -1062,7 +1025,7 @@ adafruit_pygamer_m4.build.vid=0x239A
|
|||
adafruit_pygamer_m4.build.pid=0x803D
|
||||
adafruit_pygamer_m4.bootloader.tool=openocd
|
||||
adafruit_pygamer_m4.bootloader.file=featherM4/bootloader-feather_m4-v2.0.0-adafruit.5.bin
|
||||
adafruit_pygamer_m4.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-5.4.0.path}/CMSIS/Lib/GCC/" "-L{build.variant.path}" -larm_cortexM4lf_math -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
adafruit_pygamer_m4.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Lib/GCC/" "-L{build.variant.path}" -larm_cortexM4lf_math -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
adafruit_pygamer_m4.menu.cache.on=Enabled
|
||||
adafruit_pygamer_m4.menu.cache.on.build.cache_flags=-DENABLE_CACHE
|
||||
adafruit_pygamer_m4.menu.cache.off=Disabled
|
||||
|
|
@ -1126,7 +1089,7 @@ adafruit_pygamer_advance_m4.build.vid=0x239A
|
|||
adafruit_pygamer_advance_m4.build.pid=0x8041
|
||||
adafruit_pygamer_advance_m4.bootloader.tool=openocd
|
||||
adafruit_pygamer_advance_m4.bootloader.file=featherM4/bootloader-feather_m4-v2.0.0-adafruit.5.bin
|
||||
adafruit_pygamer_advance_m4.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-5.4.0.path}/CMSIS/Lib/GCC/" "-L{build.variant.path}" -larm_cortexM4lf_math -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
adafruit_pygamer_advance_m4.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Lib/GCC/" "-L{build.variant.path}" -larm_cortexM4lf_math -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
adafruit_pygamer_advance_m4.menu.cache.on=Enabled
|
||||
adafruit_pygamer_advance_m4.menu.cache.on.build.cache_flags=-DENABLE_CACHE
|
||||
adafruit_pygamer_advance_m4.menu.cache.off=Disabled
|
||||
|
|
@ -1192,7 +1155,7 @@ adafruit_pybadge_airlift_m4.build.vid=0x239A
|
|||
adafruit_pybadge_airlift_m4.build.pid=0x8043
|
||||
adafruit_pybadge_airlift_m4.bootloader.tool=openocd
|
||||
adafruit_pybadge_airlift_m4.bootloader.file=featherM4/bootloader-feather_m4-v2.0.0-adafruit.5.bin
|
||||
adafruit_pybadge_airlift_m4.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-5.4.0.path}/CMSIS/Lib/GCC/" "-L{build.variant.path}" -larm_cortexM4lf_math -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
adafruit_pybadge_airlift_m4.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Lib/GCC/" "-L{build.variant.path}" -larm_cortexM4lf_math -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
adafruit_pybadge_airlift_m4.menu.cache.on=Enabled
|
||||
adafruit_pybadge_airlift_m4.menu.cache.on.build.cache_flags=-DENABLE_CACHE
|
||||
adafruit_pybadge_airlift_m4.menu.cache.off=Disabled
|
||||
|
|
@ -1258,7 +1221,7 @@ adafruit_monster_m4sk.build.vid=0x239A
|
|||
adafruit_monster_m4sk.build.pid=0x8047
|
||||
adafruit_monster_m4sk.bootloader.tool=openocd
|
||||
adafruit_monster_m4sk.bootloader.file=featherM4/bootloader-feather_m4-v2.0.0-adafruit.5.bin
|
||||
adafruit_monster_m4sk.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-5.4.0.path}/CMSIS/Lib/GCC/" "-L{build.variant.path}" -larm_cortexM4lf_math -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
adafruit_monster_m4sk.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Lib/GCC/" "-L{build.variant.path}" -larm_cortexM4lf_math -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
adafruit_monster_m4sk.menu.cache.on=Enabled
|
||||
adafruit_monster_m4sk.menu.cache.on.build.cache_flags=-DENABLE_CACHE
|
||||
adafruit_monster_m4sk.menu.cache.off=Disabled
|
||||
|
|
@ -1324,7 +1287,7 @@ adafruit_hallowing_m4.build.vid=0x239A
|
|||
adafruit_hallowing_m4.build.pid=0x8049
|
||||
adafruit_hallowing_m4.bootloader.tool=openocd
|
||||
adafruit_hallowing_m4.bootloader.file=featherM4/bootloader-feather_m4-v2.0.0-adafruit.5.bin
|
||||
adafruit_hallowing_m4.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-5.4.0.path}/CMSIS/Lib/GCC/" "-L{build.variant.path}" -larm_cortexM4lf_math -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
adafruit_hallowing_m4.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Lib/GCC/" "-L{build.variant.path}" -larm_cortexM4lf_math -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
adafruit_hallowing_m4.menu.cache.on=Enabled
|
||||
adafruit_hallowing_m4.menu.cache.on.build.cache_flags=-DENABLE_CACHE
|
||||
adafruit_hallowing_m4.menu.cache.off=Disabled
|
||||
|
|
@ -1357,104 +1320,3 @@ adafruit_hallowing_m4.menu.usbstack.tinyusb.build.flags.usbstack=-DUSE_TINYUSB
|
|||
adafruit_hallowing_m4.menu.debug.off=Off
|
||||
adafruit_hallowing_m4.menu.debug.on=On
|
||||
adafruit_hallowing_m4.menu.debug.on.build.flags.debug=-g
|
||||
|
||||
# Adafruit Matrix Portal M4 (SAMD51)
|
||||
# ------------------------------
|
||||
adafruit_matrixportal_m4.name=Adafruit Matrix Portal M4 (SAMD51)
|
||||
adafruit_matrixportal_m4.vid.0=0x239A
|
||||
adafruit_matrixportal_m4.pid.0=0x80C9
|
||||
adafruit_matrixportal_m4.vid.1=0x239A
|
||||
adafruit_matrixportal_m4.pid.1=0x00C9
|
||||
adafruit_matrixportal_m4.vid.1=0x239A
|
||||
adafruit_matrixportal_m4.pid.1=0x80CA
|
||||
adafruit_matrixportal_m4.upload.tool=bossac18
|
||||
adafruit_matrixportal_m4.upload.protocol=sam-ba
|
||||
adafruit_matrixportal_m4.upload.maximum_size=507904
|
||||
adafruit_matrixportal_m4.upload.offset=0x4000
|
||||
adafruit_matrixportal_m4.upload.use_1200bps_touch=true
|
||||
adafruit_matrixportal_m4.upload.wait_for_upload_port=true
|
||||
adafruit_matrixportal_m4.upload.native_usb=true
|
||||
adafruit_matrixportal_m4.build.mcu=cortex-m4
|
||||
#adafruit_matrixportal_m4.build.f_cpu=120000000L
|
||||
adafruit_matrixportal_m4.build.usb_product="Adafruit Matrix Portal M4"
|
||||
adafruit_matrixportal_m4.build.usb_manufacturer="Adafruit LLC"
|
||||
adafruit_matrixportal_m4.build.board=MATRIXPORTAL_M4
|
||||
adafruit_matrixportal_m4.build.core=arduino
|
||||
adafruit_matrixportal_m4.build.extra_flags=-D__SAMD51J19A__ -DADAFRUIT_MATRIXPORTAL_M4_EXPRESS -DCRYSTALLESS -D__SAMD51__ {build.usb_flags} -D__FPU_PRESENT -DARM_MATH_CM4 -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
adafruit_matrixportal_m4.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld
|
||||
adafruit_matrixportal_m4.build.openocdscript=openocd_scripts/arduino_zero.cfg
|
||||
adafruit_matrixportal_m4.build.variant=matrixportal_m4
|
||||
adafruit_matrixportal_m4.build.variant_system_lib=
|
||||
adafruit_matrixportal_m4.build.vid=0x239A
|
||||
adafruit_matrixportal_m4.build.pid=0x80C9
|
||||
adafruit_matrixportal_m4.bootloader.tool=openocd
|
||||
adafruit_matrixportal_m4.bootloader.file=matrixportalM4/bootloader-matrixportal_m4.bin
|
||||
adafruit_matrixportal_m4.compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-5.4.0.path}/CMSIS/Lib/GCC/" "-L{build.variant.path}" -larm_cortexM4lf_math -mfloat-abi=hard -mfpu=fpv4-sp-d16
|
||||
adafruit_matrixportal_m4.menu.cache.on=Enabled
|
||||
adafruit_matrixportal_m4.menu.cache.on.build.cache_flags=-DENABLE_CACHE
|
||||
adafruit_matrixportal_m4.menu.cache.off=Disabled
|
||||
adafruit_matrixportal_m4.menu.cache.off.build.cache_flags=
|
||||
adafruit_matrixportal_m4.menu.speed.120=120 MHz (standard)
|
||||
adafruit_matrixportal_m4.menu.speed.120.build.f_cpu=120000000L
|
||||
adafruit_matrixportal_m4.menu.speed.150=150 MHz (overclock)
|
||||
adafruit_matrixportal_m4.menu.speed.150.build.f_cpu=150000000L
|
||||
adafruit_matrixportal_m4.menu.speed.180=180 MHz (overclock)
|
||||
adafruit_matrixportal_m4.menu.speed.180.build.f_cpu=180000000L
|
||||
adafruit_matrixportal_m4.menu.speed.200=200 MHz (overclock)
|
||||
adafruit_matrixportal_m4.menu.speed.200.build.f_cpu=200000000L
|
||||
adafruit_matrixportal_m4.menu.opt.small=Small (-Os) (standard)
|
||||
adafruit_matrixportal_m4.menu.opt.small.build.flags.optimize=-Os
|
||||
adafruit_matrixportal_m4.menu.opt.fast=Fast (-O2)
|
||||
adafruit_matrixportal_m4.menu.opt.fast.build.flags.optimize=-O2
|
||||
adafruit_matrixportal_m4.menu.opt.faster=Faster (-O3)
|
||||
adafruit_matrixportal_m4.menu.opt.faster.build.flags.optimize=-O3
|
||||
adafruit_matrixportal_m4.menu.opt.fastest=Fastest (-Ofast)
|
||||
adafruit_matrixportal_m4.menu.opt.fastest.build.flags.optimize=-Ofast
|
||||
adafruit_matrixportal_m4.menu.opt.dragons=Here be dragons (-Ofast -funroll-loops)
|
||||
adafruit_matrixportal_m4.menu.opt.dragons.build.flags.optimize=-Ofast -funroll-loops
|
||||
adafruit_matrixportal_m4.menu.maxqspi.50=50 MHz (standard)
|
||||
adafruit_matrixportal_m4.menu.maxqspi.50.build.flags.maxqspi=-DVARIANT_QSPI_BAUD_DEFAULT=50000000
|
||||
adafruit_matrixportal_m4.menu.maxqspi.fcpu=CPU Speed / 2
|
||||
adafruit_matrixportal_m4.menu.maxqspi.fcpu.build.flags.maxqspi=-DVARIANT_QSPI_BAUD_DEFAULT=({build.f_cpu})
|
||||
adafruit_matrixportal_m4.menu.usbstack.arduino=Arduino
|
||||
adafruit_matrixportal_m4.menu.usbstack.tinyusb=TinyUSB
|
||||
adafruit_matrixportal_m4.menu.usbstack.tinyusb.build.flags.usbstack=-DUSE_TINYUSB
|
||||
adafruit_matrixportal_m4.menu.debug.off=Off
|
||||
adafruit_matrixportal_m4.menu.debug.on=On
|
||||
adafruit_matrixportal_m4.menu.debug.on.build.flags.debug=-g
|
||||
|
||||
# Adafruit BLM Badge (SAMD21)
|
||||
# ------------------------------
|
||||
adafruit_blm_badge.name=Adafruit BLM Badge
|
||||
adafruit_blm_badge.vid.0=0x239A
|
||||
adafruit_blm_badge.pid.0=0x0x80BF
|
||||
adafruit_blm_badge.vid.1=0x239A
|
||||
adafruit_blm_badge.pid.1=0x00BF
|
||||
adafruit_blm_badge.upload.tool=bossac
|
||||
adafruit_blm_badge.upload.protocol=sam-ba
|
||||
adafruit_blm_badge.upload.maximum_size=262144
|
||||
adafruit_blm_badge.upload.offset=0x2000
|
||||
adafruit_blm_badge.upload.use_1200bps_touch=true
|
||||
adafruit_blm_badge.upload.wait_for_upload_port=true
|
||||
adafruit_blm_badge.upload.native_usb=true
|
||||
adafruit_blm_badge.build.mcu=cortex-m0plus
|
||||
adafruit_blm_badge.build.f_cpu=48000000L
|
||||
adafruit_blm_badge.build.usb_product="BLM Badge"
|
||||
adafruit_blm_badge.build.usb_manufacturer="Adafruit"
|
||||
adafruit_blm_badge.build.board=BLM_BADGE_M0
|
||||
adafruit_blm_badge.build.core=arduino
|
||||
adafruit_blm_badge.build.extra_flags=-DCRYSTALLESS -DADAFRUIT_BLM_BADGE -D__SAMD21E18A__ -DARM_MATH_CM0PLUS {build.usb_flags}
|
||||
adafruit_blm_badge.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld
|
||||
adafruit_blm_badge.build.openocdscript=openocd_scripts/=blm_badge.cfg
|
||||
adafruit_blm_badge.build.variant=blm_badge
|
||||
adafruit_blm_badge.build.variant_system_lib=
|
||||
adafruit_blm_badge.build.vid=0x239A
|
||||
adafruit_blm_badge.build.pid=0x80BF
|
||||
adafruit_blm_badge.bootloader.tool=openocd
|
||||
adafruit_blm_badge.bootloader.file=blmbadge/bootloader-blm_badge.bin
|
||||
adafruit_blm_badge.menu.usbstack.arduino=Arduino
|
||||
adafruit_blm_badge.menu.usbstack.tinyusb=TinyUSB
|
||||
adafruit_blm_badge.menu.usbstack.tinyusb.build.flags.usbstack=-DUSE_TINYUSB
|
||||
adafruit_blm_badge.menu.debug.off=Off
|
||||
adafruit_blm_badge.menu.debug.on=On
|
||||
adafruit_blm_badge.menu.debug.on.build.flags.debug=-g
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -29,7 +29,7 @@
|
|||
// location from which to read.
|
||||
|
||||
#ifndef SERIAL_BUFFER_SIZE
|
||||
#define SERIAL_BUFFER_SIZE 350
|
||||
#define SERIAL_BUFFER_SIZE 256
|
||||
#endif
|
||||
|
||||
template <int N>
|
||||
|
|
|
|||
|
|
@ -537,18 +537,8 @@ bool SERCOM::startTransmissionWIRE(uint8_t address, SercomWireReadWriteFlag flag
|
|||
// 7-bits address + 1-bits R/W
|
||||
address = (address << 0x1ul) | flag;
|
||||
|
||||
// If another master owns the bus or the last bus owner has not properly
|
||||
// sent a stop, return failure early. This will prevent some misbehaved
|
||||
// devices from deadlocking here at the cost of the caller being responsible
|
||||
// for retrying the failed transmission. See SercomWireBusState for the
|
||||
// possible bus states.
|
||||
if(!isBusOwnerWIRE())
|
||||
{
|
||||
if( isBusBusyWIRE() || (isArbLostWIRE() && !isBusIdleWIRE()) || isBusUnknownWIRE() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// Wait idle or owner bus mode
|
||||
while ( !isBusIdleWIRE() && !isBusOwnerWIRE() );
|
||||
|
||||
// Send start and address
|
||||
sercom->I2CM.ADDR.bit.ADDR = address;
|
||||
|
|
@ -644,21 +634,6 @@ bool SERCOM::isBusOwnerWIRE( void )
|
|||
return sercom->I2CM.STATUS.bit.BUSSTATE == WIRE_OWNER_STATE;
|
||||
}
|
||||
|
||||
bool SERCOM::isBusUnknownWIRE( void )
|
||||
{
|
||||
return sercom->I2CM.STATUS.bit.BUSSTATE == WIRE_UNKNOWN_STATE;
|
||||
}
|
||||
|
||||
bool SERCOM::isArbLostWIRE( void )
|
||||
{
|
||||
return sercom->I2CM.STATUS.bit.ARBLOST == 1;
|
||||
}
|
||||
|
||||
bool SERCOM::isBusBusyWIRE( void )
|
||||
{
|
||||
return sercom->I2CM.STATUS.bit.BUSSTATE == WIRE_BUSY_STATE;
|
||||
}
|
||||
|
||||
bool SERCOM::isDataReadyWIRE( void )
|
||||
{
|
||||
return sercom->I2CS.INTFLAG.bit.DRDY;
|
||||
|
|
|
|||
|
|
@ -225,9 +225,6 @@ class SERCOM
|
|||
bool isSlaveWIRE( void ) ;
|
||||
bool isBusIdleWIRE( void ) ;
|
||||
bool isBusOwnerWIRE( void ) ;
|
||||
bool isBusUnknownWIRE( void ) ;
|
||||
bool isArbLostWIRE( void );
|
||||
bool isBusBusyWIRE( void );
|
||||
bool isDataReadyWIRE( void ) ;
|
||||
bool isStopDetectedWIRE( void ) ;
|
||||
bool isRestartDetectedWIRE( void ) ;
|
||||
|
|
@ -248,7 +245,7 @@ class SERCOM
|
|||
uint32_t getFreqRef(void) { return freqRef; };
|
||||
#else
|
||||
// The equivalent SAMD21 dummy functions...
|
||||
void setClockSource(int8_t idx, SercomClockSource src, bool core) { (void)idx; (void)src; (void)core; };
|
||||
void setClockSource(__attribute__((unused)) int8_t idx, __attribute__((unused)) SercomClockSource src, __attribute__((unused)) bool core) { };
|
||||
SercomClockSource getClockSource(void) { return SERCOM_CLOCK_SOURCE_FCPU; };
|
||||
uint32_t getFreqRef(void) { return F_CPU; };
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit e7b892095f2bb5d8bef6a748238369bdd268ed5e
|
||||
Subproject commit 09968245ad675377f2265717f0e138d5dccb39a3
|
||||
|
|
@ -28,27 +28,6 @@
|
|||
#include "Adafruit_TinyUSB_Core.h"
|
||||
#include <Reset.h> // Needed for auto-reset with 1200bps port touch
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Forward USB interrupt events to TinyUSB IRQ Handler
|
||||
//--------------------------------------------------------------------+
|
||||
extern "C"
|
||||
{
|
||||
#if defined(__SAMD51__)
|
||||
|
||||
void USB_0_Handler (void) { tud_int_handler(0); }
|
||||
void USB_1_Handler (void) { tud_int_handler(0); }
|
||||
void USB_2_Handler (void) { tud_int_handler(0); }
|
||||
void USB_3_Handler (void) { tud_int_handler(0); }
|
||||
|
||||
#else
|
||||
|
||||
void USB_Handler(void) { tud_int_handler(0); }
|
||||
|
||||
#endif
|
||||
} // extern C
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// MACRO TYPEDEF CONSTANT ENUM DECLARATION
|
||||
//--------------------------------------------------------------------+
|
||||
|
|
@ -77,8 +56,7 @@ void Adafruit_TinyUSB_Core_init(void)
|
|||
serial1_printf("TinyUSB debugging with Serial1\n");
|
||||
#endif
|
||||
|
||||
Serial.setStringDescriptor("TinyUSB Serial");
|
||||
USBDevice.addInterface(Serial);
|
||||
USBDevice.addInterface( (Adafruit_USBD_Interface&) Serial);
|
||||
USBDevice.setID(USB_VID, USB_PID);
|
||||
USBDevice.begin();
|
||||
|
||||
|
|
@ -96,6 +74,15 @@ void Adafruit_TinyUSB_Core_touch1200(void)
|
|||
//--------------------------------------------------------------------+
|
||||
// Adafruit_USBD_Device platform dependent
|
||||
//--------------------------------------------------------------------+
|
||||
void Adafruit_USBD_Device::detach(void)
|
||||
{
|
||||
USB->DEVICE.CTRLB.reg |= USB_DEVICE_CTRLB_DETACH;
|
||||
}
|
||||
|
||||
void Adafruit_USBD_Device::attach(void)
|
||||
{
|
||||
USB->DEVICE.CTRLB.reg &= ~USB_DEVICE_CTRLB_DETACH;
|
||||
}
|
||||
|
||||
uint8_t Adafruit_USBD_Device::getSerialDescriptor(uint16_t* serial_str)
|
||||
{
|
||||
|
|
@ -165,11 +152,6 @@ static void usb_hardware_init(void)
|
|||
|
||||
|
||||
GCLK->PCHCTRL[USB_GCLK_ID].reg = GCLK_PCHCTRL_GEN_GCLK1_Val | (1 << GCLK_PCHCTRL_CHEN_Pos);
|
||||
|
||||
NVIC_SetPriority(USB_0_IRQn, 0UL);
|
||||
NVIC_SetPriority(USB_1_IRQn, 0UL);
|
||||
NVIC_SetPriority(USB_2_IRQn, 0UL);
|
||||
NVIC_SetPriority(USB_3_IRQn, 0UL);
|
||||
#else
|
||||
PM->APBBMASK.reg |= PM_APBBMASK_USB;
|
||||
|
||||
|
|
@ -187,8 +169,6 @@ static void usb_hardware_init(void)
|
|||
GCLK_CLKCTRL_CLKEN;
|
||||
while (GCLK->STATUS.bit.SYNCBUSY)
|
||||
;
|
||||
|
||||
NVIC_SetPriority((IRQn_Type) USB_IRQn, 0UL);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -79,8 +79,8 @@
|
|||
#define CFG_TUD_HID_BUFSIZE 64
|
||||
|
||||
// MIDI FIFO size of TX and RX
|
||||
#define CFG_TUD_MIDI_RX_BUFSIZE 128
|
||||
#define CFG_TUD_MIDI_TX_BUFSIZE 128
|
||||
#define CFG_TUD_MIDI_RX_BUFSIZE 64
|
||||
#define CFG_TUD_MIDI_TX_BUFSIZE 64
|
||||
|
||||
// Vendor FIFO size of TX and RX
|
||||
#define CFG_TUD_VENDOR_RX_BUFSIZE 64
|
||||
|
|
|
|||
|
|
@ -20,6 +20,12 @@
|
|||
#include "Tone.h"
|
||||
#include "variant.h"
|
||||
|
||||
#if defined(__SAMD51__)
|
||||
#define WAIT_TC16_REGS_SYNC(x) while(x->COUNT16.SYNCBUSY.bit.ENABLE);
|
||||
#else
|
||||
#define WAIT_TC16_REGS_SYNC(x) while(x->COUNT16.STATUS.bit.SYNCBUSY);
|
||||
#endif
|
||||
|
||||
uint32_t toneMaxFrequency = F_CPU / 2;
|
||||
uint32_t lastOutputPin = 0xFFFFFFFF;
|
||||
|
||||
|
|
@ -31,24 +37,22 @@ volatile bool toneIsActive = false;
|
|||
volatile bool firstTimeRunning = false;
|
||||
|
||||
#if defined(__SAMD51__)
|
||||
#define TONE_TC TC0
|
||||
#define TONE_TC_IRQn TC0_IRQn
|
||||
#define TONE_TC_GCLK_ID TC0_GCLK_ID
|
||||
#define Tone_Handler TC0_Handler
|
||||
|
||||
#define WAIT_TC16_REGS_SYNC(x) while(x->COUNT16.SYNCBUSY.bit.ENABLE);
|
||||
|
||||
#define TONE_TC TC0
|
||||
#define TONE_TC_IRQn TC0_IRQn
|
||||
#define TONE_TC_GCLK_ID TC0_GCLK_ID
|
||||
#else
|
||||
#define TONE_TC TC5
|
||||
#define TONE_TC_IRQn TC5_IRQn
|
||||
#define Tone_Handler TC5_Handler
|
||||
|
||||
#define WAIT_TC16_REGS_SYNC(x) while(x->COUNT16.STATUS.bit.SYNCBUSY);
|
||||
#define TONE_TC TC5
|
||||
#define TONE_TC_IRQn TC5_IRQn
|
||||
#endif
|
||||
|
||||
#define TONE_TC_TOP 0xFFFF
|
||||
#define TONE_TC_CHANNEL 0
|
||||
|
||||
#if defined(__SAMD51__)
|
||||
void TC0_Handler (void) __attribute__ ((weak, alias("Tone_Handler")));
|
||||
#else
|
||||
void TC5_Handler (void) __attribute__ ((weak, alias("Tone_Handler")));
|
||||
#endif
|
||||
|
||||
static inline void resetTC (Tc* TCx)
|
||||
{
|
||||
// Disable TCx
|
||||
|
|
@ -68,14 +72,6 @@ void toneAccurateClock (uint32_t accurateSystemCoreClockFrequency)
|
|||
|
||||
void tone (uint32_t outputPin, uint32_t frequency, uint32_t duration)
|
||||
{
|
||||
|
||||
// Avoid divide by zero error by calling 'noTone' instead
|
||||
if (frequency == 0)
|
||||
{
|
||||
noTone(outputPin);
|
||||
return;
|
||||
}
|
||||
|
||||
// Configure interrupt request
|
||||
NVIC_DisableIRQ(TONE_TC_IRQn);
|
||||
NVIC_ClearPendingIRQ(TONE_TC_IRQn);
|
||||
|
|
@ -95,6 +91,9 @@ void tone (uint32_t outputPin, uint32_t frequency, uint32_t duration)
|
|||
#endif
|
||||
}
|
||||
|
||||
//if it's a rest, set to 1Hz (below audio range)
|
||||
frequency = (frequency > 0 ? frequency : 1);
|
||||
|
||||
if (toneIsActive && (outputPin != lastOutputPin))
|
||||
noTone(lastOutputPin);
|
||||
|
||||
|
|
@ -168,8 +167,8 @@ void tone (uint32_t outputPin, uint32_t frequency, uint32_t duration)
|
|||
lastOutputPin = outputPin;
|
||||
digitalWrite(outputPin, LOW);
|
||||
pinMode(outputPin, OUTPUT);
|
||||
toneIsActive = true;
|
||||
}
|
||||
toneIsActive = true;
|
||||
|
||||
// Enable TONE_TC
|
||||
TONE_TC->COUNT16.CTRLA.reg |= TC_CTRLA_ENABLE;
|
||||
|
|
@ -180,19 +179,9 @@ void tone (uint32_t outputPin, uint32_t frequency, uint32_t duration)
|
|||
|
||||
void noTone (uint32_t outputPin)
|
||||
{
|
||||
/* 'tone' need to run at least once in order to enable GCLK for
|
||||
* the timers used for the tone-functionality. If 'noTone' is called
|
||||
* without ever calling 'tone' before then 'WAIT_TC16_REGS_SYNC(TCx)'
|
||||
* will wait infinitely. The variable 'firstTimeRunning' is set the
|
||||
* 1st time 'tone' is set so it can be used to detect wether or not
|
||||
* 'tone' has been called before.
|
||||
*/
|
||||
if(firstTimeRunning)
|
||||
{
|
||||
resetTC(TONE_TC);
|
||||
digitalWrite(outputPin, LOW);
|
||||
toneIsActive = false;
|
||||
}
|
||||
resetTC(TONE_TC);
|
||||
digitalWrite(outputPin, LOW);
|
||||
toneIsActive = false;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -250,9 +250,8 @@ void detachInterrupt(uint32_t pin)
|
|||
* External Interrupt Controller NVIC Interrupt Handler
|
||||
*/
|
||||
#if defined(__SAMD51__)
|
||||
void InterruptHandler(uint32_t unused_i)
|
||||
void InterruptHandler(uint32_t i)
|
||||
{
|
||||
(void)unused_i;
|
||||
// Calling the routine directly from -here- takes about 1us
|
||||
// Depending on where you are in the list it will take longer
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ extern "C" {
|
|||
#define FALLING 3
|
||||
#define RISING 4
|
||||
|
||||
//#define DEFAULT 1
|
||||
#define DEFAULT 1
|
||||
#define EXTERNAL 0
|
||||
|
||||
typedef void (*voidFuncPtr)(void);
|
||||
|
|
|
|||
|
|
@ -164,19 +164,18 @@ void arm_float_to_q12_20(float *pIn, q31_t * pOut, uint32_t numSamples)
|
|||
uint32_t arm_compare_fixed_q15(q15_t *pIn, q15_t * pOut, uint32_t numSamples)
|
||||
{
|
||||
uint32_t i;
|
||||
int32_t diff;
|
||||
uint32_t diffCrnt = 0;
|
||||
int32_t diff, diffCrnt = 0;
|
||||
uint32_t maxDiff = 0;
|
||||
|
||||
for (i = 0; i < numSamples; i++)
|
||||
{
|
||||
diff = pIn[i] - pOut[i];
|
||||
diffCrnt = (uint32_t)( (diff > 0) ? diff : -diff );
|
||||
diff = pIn[i] - pOut[i];
|
||||
diffCrnt = (diff > 0) ? diff : -diff;
|
||||
|
||||
if(diffCrnt > maxDiff)
|
||||
{
|
||||
maxDiff = diffCrnt;
|
||||
}
|
||||
if(diffCrnt > maxDiff)
|
||||
{
|
||||
maxDiff = diffCrnt;
|
||||
}
|
||||
}
|
||||
|
||||
return(maxDiff);
|
||||
|
|
@ -193,19 +192,18 @@ uint32_t arm_compare_fixed_q15(q15_t *pIn, q15_t * pOut, uint32_t numSamples)
|
|||
uint32_t arm_compare_fixed_q31(q31_t *pIn, q31_t * pOut, uint32_t numSamples)
|
||||
{
|
||||
uint32_t i;
|
||||
int32_t diff;
|
||||
uint32_t diffCrnt = 0;
|
||||
int32_t diff, diffCrnt = 0;
|
||||
uint32_t maxDiff = 0;
|
||||
|
||||
for (i = 0; i < numSamples; i++)
|
||||
{
|
||||
diff = pIn[i] - pOut[i];
|
||||
diffCrnt = (uint32_t)( (diff > 0) ? diff : -diff );
|
||||
diff = pIn[i] - pOut[i];
|
||||
diffCrnt = (diff > 0) ? diff : -diff;
|
||||
|
||||
if(diffCrnt > maxDiff)
|
||||
{
|
||||
maxDiff = diffCrnt;
|
||||
}
|
||||
if(diffCrnt > maxDiff)
|
||||
{
|
||||
maxDiff = diffCrnt;
|
||||
}
|
||||
}
|
||||
|
||||
return(maxDiff);
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ static int _writeResolution = 12;
|
|||
static int _dacResolution = 12;
|
||||
#else
|
||||
static int _writeResolution = 8;
|
||||
//static int _dacResolution = 10;
|
||||
static int _dacResolution = 10;
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,42 +3,27 @@ import glob
|
|||
import sys
|
||||
import subprocess
|
||||
import time
|
||||
import argparse
|
||||
|
||||
FQBN_PREFIX='adafruit:samd:adafruit_'
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description='python wrapper for adafruit arduino CI workflows',
|
||||
allow_abbrev=False
|
||||
)
|
||||
parser.add_argument(
|
||||
'--all_warnings', '--Wall',
|
||||
action='store_true',
|
||||
help='build with all warnings enabled (`--warnings all`)',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--warnings_do_not_cause_job_failure',
|
||||
action='store_true',
|
||||
help='failed builds will be listed as failed, but not cause job to exit with an error status',
|
||||
)
|
||||
parser.add_argument(
|
||||
'build_boards',
|
||||
metavar='board',
|
||||
nargs='*',
|
||||
help='list of boards to be built -- Note that the fqbn is created by prepending "{}"'.format(FQBN_PREFIX),
|
||||
default= [ 'metro_m0', 'metro_m4', 'circuitplayground_m0' ]
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
all_warnings = False
|
||||
exit_status = 0
|
||||
success_count = 0
|
||||
fail_count = 0
|
||||
skip_count = 0
|
||||
|
||||
build_format = '| {:22} | {:30} | {:9} '
|
||||
build_separator = '-' * 80
|
||||
|
||||
def errorOutputFilter(line: str):
|
||||
default_boards = [ 'metro_m0', 'metro_m4', 'circuitplayground_m0']
|
||||
|
||||
build_boards = []
|
||||
|
||||
# build all variants if input not existed
|
||||
if len(sys.argv) > 1:
|
||||
build_boards.append(sys.argv[1])
|
||||
else:
|
||||
build_boards = default_boards
|
||||
|
||||
def errorOutputFilter(line):
|
||||
if len(line) == 0:
|
||||
return False
|
||||
if line.isspace(): # Note: empty string does not match here!
|
||||
|
|
@ -46,8 +31,9 @@ def errorOutputFilter(line: str):
|
|||
# TODO: additional items to remove?
|
||||
return True
|
||||
|
||||
def build_examples(variant: str):
|
||||
global args, exit_status, success_count, fail_count, skip_count, build_format, build_separator
|
||||
|
||||
def build_examples(variant):
|
||||
global exit_status, success_count, fail_count, skip_count, build_format, build_separator
|
||||
|
||||
print('\n')
|
||||
print(build_separator)
|
||||
|
|
@ -56,7 +42,7 @@ def build_examples(variant: str):
|
|||
print((build_format + '| {:6} |').format('Library', 'Example', 'Result', 'Time'))
|
||||
print(build_separator)
|
||||
|
||||
fqbn = "{}{}".format(FQBN_PREFIX, variant)
|
||||
fqbn = "adafruit:samd:adafruit_{}".format(variant)
|
||||
|
||||
for sketch in glob.iglob('libraries/**/*.ino', recursive=True):
|
||||
start_time = time.monotonic()
|
||||
|
|
@ -72,14 +58,14 @@ def build_examples(variant: str):
|
|||
# TODO - preferably, would have STDERR show up in **both** STDOUT and STDERR.
|
||||
# preferably, would use Python logging handler to get both distinct outputs and one merged output
|
||||
# for now, split STDERR when building with all warnings enabled, so can detect warning/error output.
|
||||
if args.all_warnings:
|
||||
if all_warnings:
|
||||
build_result = subprocess.run("arduino-cli compile --warnings all --fqbn {} {}".format(fqbn, sketch), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
else:
|
||||
build_result = subprocess.run("arduino-cli compile --warnings default --fqbn {} {}".format(fqbn, sketch), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||
|
||||
# get stderr into a form where len(warningLines) indicates a true warning was output to stderr
|
||||
warningLines = [];
|
||||
if args.all_warnings and build_result.stderr:
|
||||
if all_warnings and build_result.stderr:
|
||||
tmpWarningLines = build_result.stderr.decode("utf-8").splitlines()
|
||||
warningLines = list(filter(errorOutputFilter, (tmpWarningLines)))
|
||||
|
||||
|
|
@ -88,8 +74,7 @@ def build_examples(variant: str):
|
|||
success = "\033[31mfailed\033[0m "
|
||||
fail_count += 1
|
||||
elif len(warningLines) != 0:
|
||||
if not args.warnings_do_not_cause_job_failure:
|
||||
exit_status = -1
|
||||
exit_status = -1
|
||||
success = "\033[31mwarnings\033[0m "
|
||||
fail_count += 1
|
||||
else:
|
||||
|
|
@ -113,7 +98,7 @@ def build_examples(variant: str):
|
|||
|
||||
build_time = time.monotonic()
|
||||
|
||||
for board in args.build_boards:
|
||||
for board in build_boards:
|
||||
build_examples(board)
|
||||
|
||||
print(build_separator)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ volatile bool transfer_is_done = false; // Done yet?
|
|||
|
||||
// Callback for end-of-DMA-transfer
|
||||
void dma_callback(Adafruit_ZeroDMA *dma) {
|
||||
(void)dma; // avoid compiler warning about unused function parameter
|
||||
transfer_is_done = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ volatile bool transfer_is_done = false; // Done yet?
|
|||
|
||||
// Callback for end-of-DMA-transfer
|
||||
void dma_callback(Adafruit_ZeroDMA *dma) {
|
||||
(void)dma; // avoid compiler warning about unused parameter
|
||||
transfer_is_done = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ volatile bool transfer_is_done = true; // Done yet?
|
|||
|
||||
// Callback for end-of-DMA-transfer
|
||||
void dma_callback(Adafruit_ZeroDMA *dma) {
|
||||
(void)dma; // avoid compiler warning about unused parameter
|
||||
transfer_is_done = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
// fake empty header file to make Arduino IDE happy
|
||||
|
|
@ -46,16 +46,7 @@ SPIClass::SPIClass(SERCOM *p_sercom, uint8_t uc_pinMISO, uint8_t uc_pinSCK, uint
|
|||
|
||||
void SPIClass::begin()
|
||||
{
|
||||
if(!initialized) {
|
||||
interruptMode = SPI_IMODE_NONE;
|
||||
interruptSave = 0;
|
||||
interruptMask = 0;
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
if(!use_dma) {
|
||||
dmaAllocate();
|
||||
}
|
||||
init();
|
||||
|
||||
// PIO init
|
||||
pinPeripheral(_uc_pinMiso, g_APinDescription[_uc_pinMiso].ulPinType);
|
||||
|
|
@ -65,6 +56,16 @@ void SPIClass::begin()
|
|||
config(DEFAULT_SPI_SETTINGS);
|
||||
}
|
||||
|
||||
void SPIClass::init()
|
||||
{
|
||||
if (initialized)
|
||||
return;
|
||||
interruptMode = SPI_IMODE_NONE;
|
||||
interruptSave = 0;
|
||||
interruptMask = 0;
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
void SPIClass::config(SPISettings settings)
|
||||
{
|
||||
_p_sercom->disableSPI();
|
||||
|
|
@ -79,7 +80,6 @@ void SPIClass::end()
|
|||
{
|
||||
_p_sercom->resetSPI();
|
||||
initialized = false;
|
||||
// Add DMA deallocation here
|
||||
}
|
||||
|
||||
#ifndef interruptsStatus
|
||||
|
|
@ -235,231 +235,157 @@ void SPIClass::transfer(void *buf, size_t count)
|
|||
}
|
||||
}
|
||||
|
||||
// DMA-based SPI transfer() function ---------------------------------------
|
||||
|
||||
// IMPORTANT: references to 65535 throughout the DMA code are INTENTIONAL.
|
||||
// DO NOT try to 'fix' by changing to 65536, or large transfers will fail!
|
||||
// The BTCNT value of a DMA descriptor is an unsigned 16-bit value with a
|
||||
// max of 65535. Larger transfers are handled by linked descriptors.
|
||||
|
||||
// Pointer to SPIClass object, one per DMA channel. This allows the
|
||||
// DMA callback (which has to exist outside the class context) to have
|
||||
// a reference back to the originating SPIClass object.
|
||||
// Pointer to SPIClass object, one per DMA channel.
|
||||
static SPIClass *spiPtr[DMAC_CH_NUM] = { 0 }; // Legit inits list to NULL
|
||||
|
||||
void SPIClass::dmaCallback(Adafruit_ZeroDMA *dma) {
|
||||
// dmaCallback() receives an Adafruit_ZeroDMA object. From this we can get
|
||||
// a channel number (0 to DMAC_CH_NUM-1, always unique per ZeroDMA object),
|
||||
// then locate the originating SPIClass object using array lookup, setting
|
||||
// the dma_busy element 'false' to indicate end of transfer. Doesn't matter
|
||||
// if it's a read or write transfer...both channels get pointers to it.
|
||||
// the dma_busy element 'false' to indicate end of transfer.
|
||||
spiPtr[dma->getChannel()]->dma_busy = false;
|
||||
}
|
||||
|
||||
// For read-only and read+write transfers, a callback is assigned only
|
||||
// to the read channel to indicate end-of-transfer, and the write channel's
|
||||
// callback is assigned to this nonsense function (for reasons I'm not
|
||||
// entirely sure of, setting the callback to NULL doesn't work).
|
||||
static void dmaDoNothingCallback(Adafruit_ZeroDMA *dma) { (void)dma; }
|
||||
|
||||
// This could've gone in begin(), but for the sake of organization...
|
||||
void SPIClass::dmaAllocate(void) {
|
||||
// In order to support fully non-blocking SPI transfers, DMA descriptor
|
||||
// lists must be created for the input and/or output data. Rather than
|
||||
// do this dynamically with every transfer, the lists are allocated once
|
||||
// on SPI init. Maximum list size is finite and knowable -- transfers to
|
||||
// or from RAM or from flash memory will never exceed the corresponding
|
||||
// memory size (if they do, you have bigger problems). Descriptors
|
||||
// aren't large and there's usually only a handful to a dozen, so this
|
||||
// isn't an excessive burden in exchange for big non-blocking transfers.
|
||||
uint32_t maxWriteBytes = FLASH_SIZE; // Writes can't exceed all of flash
|
||||
#if defined(__SAMD51__)
|
||||
uint32_t maxReadBytes = HSRAM_SIZE; // Reads can't exceed all of RAM
|
||||
#else
|
||||
uint32_t maxReadBytes = HMCRAMC0_SIZE;
|
||||
#endif
|
||||
if(maxReadBytes > maxWriteBytes) { // I don't think any SAMD devices
|
||||
maxWriteBytes = maxReadBytes; // have RAM > flash, but just in case
|
||||
}
|
||||
|
||||
// VITAL to alloc read channel first, assigns it a higher DMA priority!
|
||||
if(readChannel.allocate() == DMA_STATUS_OK) {
|
||||
if(writeChannel.allocate() == DMA_STATUS_OK) {
|
||||
|
||||
// Both DMA channels (read and write) allocated successfully,
|
||||
// set up transfer triggers and other basics...
|
||||
|
||||
// readChannel callback only needs to be set up once.
|
||||
// Unlike the write callback which may get switched on or off,
|
||||
// read callback stays put. In certain cases the read DMA job
|
||||
// just isn't started and the callback is a non-issue then.
|
||||
readChannel.setTrigger(getDMAC_ID_RX());
|
||||
readChannel.setAction(DMA_TRIGGER_ACTON_BEAT);
|
||||
readChannel.setCallback(dmaCallback);
|
||||
spiPtr[readChannel.getChannel()] = this;
|
||||
|
||||
writeChannel.setTrigger(getDMAC_ID_TX());
|
||||
writeChannel.setAction(DMA_TRIGGER_ACTON_BEAT);
|
||||
spiPtr[writeChannel.getChannel()] = this;
|
||||
|
||||
// One descriptor per channel has already been allocated
|
||||
// in Adafruit_ZeroDMA, this just gets pointers to them...
|
||||
firstReadDescriptor = readChannel.addDescriptor(
|
||||
(void *)getDataRegister(), // Source address (SPI data reg)
|
||||
NULL, // Dest address (set later)
|
||||
0, // Count (set later)
|
||||
DMA_BEAT_SIZE_BYTE, // Bytes/hwords/words
|
||||
false, // Don't increment source address
|
||||
true); // Increment dest address
|
||||
firstWriteDescriptor = writeChannel.addDescriptor(
|
||||
NULL, // Source address (set later)
|
||||
(void *)getDataRegister(), // Dest (SPI data register)
|
||||
0, // Count (set later)
|
||||
DMA_BEAT_SIZE_BYTE, // Bytes/hwords/words
|
||||
true, // Increment source address
|
||||
false); // Don't increment dest address
|
||||
// This is the number of EXTRA descriptors beyond the first.
|
||||
int numReadDescriptors = ((maxReadBytes + 65534) / 65535) - 1;
|
||||
int numWriteDescriptors = ((maxWriteBytes + 65534) / 65535) - 1;
|
||||
int totalDescriptors = numReadDescriptors + numWriteDescriptors;
|
||||
|
||||
if(totalDescriptors <= 0) { // Don't need extra descriptors,
|
||||
use_dma = true; // channels are allocated, we're good.
|
||||
} else { // Else allocate extra descriptor lists...
|
||||
// Although DMA descriptors are technically a linked list, we just
|
||||
// allocate a chunk all at once, and finesse the pointers later.
|
||||
if((extraReadDescriptors = (DmacDescriptor *)malloc(
|
||||
totalDescriptors * sizeof(DmacDescriptor)))) {
|
||||
use_dma = true; // Everything allocated successfully
|
||||
extraWriteDescriptors = &extraReadDescriptors[numReadDescriptors];
|
||||
// Initialize descriptors (copy from first ones)
|
||||
for(int i=0; i<numReadDescriptors; i++) {
|
||||
memcpy(&extraReadDescriptors[i], firstReadDescriptor,
|
||||
sizeof(DmacDescriptor));
|
||||
}
|
||||
for(int i=0; i<numWriteDescriptors; i++) {
|
||||
memcpy(&extraWriteDescriptors[i], firstWriteDescriptor,
|
||||
sizeof(DmacDescriptor));
|
||||
}
|
||||
} // end malloc
|
||||
} // end extra descriptor check
|
||||
|
||||
if(use_dma) { // If everything allocated successfully,
|
||||
return; // then we're done here.
|
||||
} // Otherwise clean up interim allocations...
|
||||
writeChannel.free();
|
||||
} // end writeChannel alloc
|
||||
readChannel.free();
|
||||
} // end readChannel alloc
|
||||
|
||||
// NOT FATAL if channel or descriptor allocation fails.
|
||||
// transfer() function will fall back on a manual byte-by-byte loop.
|
||||
}
|
||||
|
||||
void SPIClass::transfer(const void *txbuf, void *rxbuf, size_t count,
|
||||
void SPIClass::transfer(const void* txbuf, void* rxbuf, size_t count,
|
||||
bool block) {
|
||||
|
||||
if((!txbuf && !rxbuf) || !count) { // Validate inputs
|
||||
return;
|
||||
}
|
||||
// OK to assume now that txbuf and/or rxbuf are non-NULL, an if/else is
|
||||
// often sufficient, don't need else-ifs for everything buffer related.
|
||||
|
||||
uint8_t *txbuf8 = (uint8_t *)txbuf; // Must cast to byte size
|
||||
uint8_t *rxbuf8 = (uint8_t *)rxbuf; // for pointer math
|
||||
|
||||
if(use_dma) { // DMA-BASED TRANSFER YAY ----------------------------------
|
||||
|
||||
static const uint8_t dum = 0xFF; // Dummy byte for read-only xfers
|
||||
|
||||
// Set up DMA descriptor lists -----------------------------------------
|
||||
|
||||
DmacDescriptor *rDesc = firstReadDescriptor;
|
||||
DmacDescriptor *wDesc = firstWriteDescriptor;
|
||||
int descIdx = 0; // Index into extra descriptor lists
|
||||
|
||||
while(count) { // Counts down to end of transfer
|
||||
uint32_t bytesThisDescriptor = count;
|
||||
if(bytesThisDescriptor > 65535) { // Limit each descriptor
|
||||
bytesThisDescriptor = 65535; // to 65535 (not 65536) bytes
|
||||
}
|
||||
rDesc->BTCNT.reg = wDesc->BTCNT.reg = bytesThisDescriptor;
|
||||
if(rxbuf) { // Read-only or read+write
|
||||
// Auto-inc addresses in DMA descriptors must point to END of data.
|
||||
// Buf pointers would advance at end of loop anyway, do it now...
|
||||
rxbuf8 += bytesThisDescriptor;
|
||||
rDesc->DSTADDR.reg = (uint32_t)rxbuf8;
|
||||
}
|
||||
if(txbuf) { // Write-only or read+write
|
||||
txbuf8 += bytesThisDescriptor; // Same as above
|
||||
wDesc->SRCADDR.reg = (uint32_t)txbuf8;
|
||||
wDesc->BTCTRL.bit.SRCINC = 1; // Increment source pointer
|
||||
} else { // Read-only requires dummy write
|
||||
wDesc->SRCADDR.reg = (uint32_t)&dum;
|
||||
wDesc->BTCTRL.bit.SRCINC = 0; // Don't increment source pointer
|
||||
}
|
||||
count -= bytesThisDescriptor;
|
||||
if(count) { // Still more data?
|
||||
// Link to next descriptors. Extra descriptors are IN ADDITION
|
||||
// to first, so it's safe and correct that descIdx starts at 0.
|
||||
rDesc->DESCADDR.reg = (uint32_t)&extraReadDescriptors[descIdx];
|
||||
wDesc->DESCADDR.reg = (uint32_t)&extraWriteDescriptors[descIdx];
|
||||
rDesc = &extraReadDescriptors[descIdx]; // Update pointers to
|
||||
wDesc = &extraWriteDescriptors[descIdx]; // next descriptors
|
||||
descIdx++;
|
||||
// A write-only transfer doesn't use the read descriptor list, but
|
||||
// it's quicker to build it (full of nonsense) anyway than to check.
|
||||
} else { // No more data, end descriptor linked lists
|
||||
rDesc->DESCADDR.reg = wDesc->DESCADDR.reg = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Set up DMA transfer job(s) ------------------------------------------
|
||||
|
||||
if(rxbuf) { // Read+write or read-only
|
||||
// End-of-read callback is already set up, disable write CB, start job
|
||||
writeChannel.setCallback(dmaDoNothingCallback);
|
||||
readChannel.startJob();
|
||||
} else { // Write-only, use end-of-write callback
|
||||
writeChannel.setCallback(dmaCallback);
|
||||
}
|
||||
|
||||
// Run DMA jobs, blocking if requested ---------------------------------
|
||||
|
||||
dma_busy = true;
|
||||
writeChannel.startJob(); // All xfers, even read-only, need write job.
|
||||
if(block) { // If blocking transfer requested,
|
||||
while(dma_busy); // wait for job to finish
|
||||
}
|
||||
|
||||
} else { // NON-DMA FALLBACK ---------------------------------------------
|
||||
|
||||
if(txbuf8) {
|
||||
if(rxbuf8) { // Write + read simultaneously
|
||||
while(count--) {
|
||||
*rxbuf8++ = _p_sercom->transferDataSPI(*txbuf8++);
|
||||
// If receiving data and the RX DMA channel is not yet allocated...
|
||||
if(rxbuf && (readChannel.getChannel() >= DMAC_CH_NUM)) {
|
||||
if(readChannel.allocate() == DMA_STATUS_OK) {
|
||||
readDescriptor =
|
||||
readChannel.addDescriptor(
|
||||
(void *)getDataRegister(), // Source address (SPI data reg)
|
||||
NULL, // Dest address (set later)
|
||||
0, // Count (set later)
|
||||
DMA_BEAT_SIZE_BYTE, // Bytes/hwords/words
|
||||
false, // Don't increment source address
|
||||
true); // Increment dest address
|
||||
readChannel.setTrigger(getDMAC_ID_RX());
|
||||
readChannel.setAction(DMA_TRIGGER_ACTON_BEAT);
|
||||
spiPtr[readChannel.getChannel()] = this;
|
||||
// Since all RX transfers involve a TX, a
|
||||
// separate callback here is not necessary.
|
||||
}
|
||||
} else { // Write only
|
||||
while(count--) {
|
||||
(void)_p_sercom->transferDataSPI(*txbuf8++);
|
||||
}
|
||||
}
|
||||
} else { // Read only
|
||||
while(count--) {
|
||||
*rxbuf8++ = _p_sercom->transferDataSPI(0xFF);
|
||||
}
|
||||
}
|
||||
|
||||
} // end non-DMA
|
||||
// Unlike the rxbuf check above, where a RX DMA channel is allocated
|
||||
// only if receiving data (and channel not previously alloc'd), the
|
||||
// TX DMA channel is always needed, because even RX-only SPI requires
|
||||
// writing dummy bytes to the peripheral.
|
||||
if(writeChannel.getChannel() >= DMAC_CH_NUM) {
|
||||
if(writeChannel.allocate() == DMA_STATUS_OK) {
|
||||
writeDescriptor =
|
||||
writeChannel.addDescriptor(
|
||||
NULL, // Source address (set later)
|
||||
(void *)getDataRegister(), // Dest (SPI data register)
|
||||
0, // Count (set later)
|
||||
DMA_BEAT_SIZE_BYTE, // Bytes/hwords/words
|
||||
true, // Increment source address
|
||||
false); // Don't increment dest address
|
||||
writeChannel.setTrigger(getDMAC_ID_TX());
|
||||
writeChannel.setAction(DMA_TRIGGER_ACTON_BEAT);
|
||||
writeChannel.setCallback(dmaCallback);
|
||||
spiPtr[writeChannel.getChannel()] = this;
|
||||
}
|
||||
}
|
||||
|
||||
if(writeDescriptor && (readDescriptor || !rxbuf)) {
|
||||
static const uint8_t dum = 0xFF; // Dummy byte for read-only xfers
|
||||
|
||||
// Initialize read descriptor dest address to rxbuf
|
||||
if(rxbuf) readDescriptor->DSTADDR.reg = (uint32_t)rxbuf;
|
||||
|
||||
// If reading only, set up writeDescriptor to issue dummy bytes
|
||||
// (set SRCADDR to &dum and SRCINC to 0). Otherwise, set SRCADDR
|
||||
// to txbuf and SRCINC to 1. Only needed once at start.
|
||||
if(rxbuf && !txbuf) {
|
||||
writeDescriptor->SRCADDR.reg = (uint32_t)&dum;
|
||||
writeDescriptor->BTCTRL.bit.SRCINC = 0;
|
||||
} else {
|
||||
writeDescriptor->SRCADDR.reg = (uint32_t)txbuf;
|
||||
writeDescriptor->BTCTRL.bit.SRCINC = 1;
|
||||
}
|
||||
|
||||
while(count > 0) {
|
||||
// Maximum bytes per DMA descriptor is 65,535 (NOT 65,536).
|
||||
// We could set up a descriptor chain, but that gets more
|
||||
// complex. For now, instead, break up long transfers into
|
||||
// chunks of 65,535 bytes max...these transfers are all
|
||||
// blocking, regardless of the "block" argument, except
|
||||
// for the last one which will observe the background request.
|
||||
// The fractional part is done first, so for any "partially
|
||||
// blocking" transfers like these at least it's the largest
|
||||
// single-descriptor transfer possible that occurs in the
|
||||
// background, rather than the tail end.
|
||||
int bytesThisPass;
|
||||
bool blockThisPass;
|
||||
if(count > 65535) { // Too big for 1 descriptor
|
||||
blockThisPass = true;
|
||||
bytesThisPass = count % 65535; // Fractional part
|
||||
if(!bytesThisPass) bytesThisPass = 65535;
|
||||
} else {
|
||||
blockThisPass = block;
|
||||
bytesThisPass = count;
|
||||
}
|
||||
|
||||
// Issue 'bytesThisPass' bytes...
|
||||
if(rxbuf) {
|
||||
// Reading, or reading + writing.
|
||||
// Set up read descriptor.
|
||||
// Src address doesn't change, only dest & count.
|
||||
// DMA needs address set to END of buffer, so
|
||||
// increment the address now, before the transfer.
|
||||
readDescriptor->DSTADDR.reg += bytesThisPass;
|
||||
readDescriptor->BTCNT.reg = bytesThisPass;
|
||||
// Start the RX job BEFORE the TX job!
|
||||
// That's the whole secret sauce to the two-channel transfer.
|
||||
// Nothing will actually happen until the write channel job
|
||||
// is also started.
|
||||
readChannel.startJob();
|
||||
}
|
||||
if(txbuf) {
|
||||
// DMA needs address set to END of buffer, so
|
||||
// increment the address now, before the transfer.
|
||||
writeDescriptor->SRCADDR.reg += bytesThisPass;
|
||||
}
|
||||
writeDescriptor->BTCNT.reg = bytesThisPass;
|
||||
dma_busy = true;
|
||||
writeChannel.startJob();
|
||||
count -= bytesThisPass;
|
||||
if(blockThisPass) {
|
||||
while(dma_busy);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Non-DMA fallback.
|
||||
uint8_t *txbuf8 = (uint8_t *)txbuf,
|
||||
*rxbuf8 = (uint8_t *)rxbuf;
|
||||
if(rxbuf8) {
|
||||
if(txbuf8) {
|
||||
// Writing and reading simultaneously
|
||||
while(count--) {
|
||||
*rxbuf8++ = _p_sercom->transferDataSPI(*txbuf8++);
|
||||
}
|
||||
} else {
|
||||
// Reading only
|
||||
while(count--) {
|
||||
*rxbuf8++ = _p_sercom->transferDataSPI(0xFF);
|
||||
}
|
||||
}
|
||||
} else if(txbuf) {
|
||||
// Writing only
|
||||
while(count--) {
|
||||
(void)_p_sercom->transferDataSPI(*txbuf8++);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Waits for a prior in-background DMA transfer to complete.
|
||||
void SPIClass::waitForTransfer(void) {
|
||||
while(dma_busy);
|
||||
while(dma_busy);
|
||||
}
|
||||
|
||||
// End DMA-based SPI transfer() code ---------------------------------------
|
||||
|
||||
void SPIClass::attachInterrupt() {
|
||||
// Should be enableInterrupt()
|
||||
}
|
||||
|
|
@ -555,3 +481,4 @@ void SPIClass::setClockSource(SercomClockSource clk) {
|
|||
#if SPI_INTERFACES_COUNT > 5
|
||||
SPIClass SPI5(&PERIPH_SPI5, PIN_SPI5_MISO, PIN_SPI5_SCK, PIN_SPI5_MOSI, PAD_SPI5_TX, PAD_SPI5_RX);
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -149,10 +149,11 @@ class SPIClass {
|
|||
#else
|
||||
// On SAMD21, this compiles to nothing, so user code doesn't need to
|
||||
// check and conditionally compile lines for different architectures.
|
||||
void setClockSource(SercomClockSource clk) { (void)clk; };
|
||||
void setClockSource(SercomClockSource clk) { };
|
||||
#endif // end __SAMD51__
|
||||
|
||||
private:
|
||||
void init();
|
||||
void config(SPISettings settings);
|
||||
|
||||
SERCOM *_p_sercom;
|
||||
|
|
@ -168,16 +169,12 @@ class SPIClass {
|
|||
char interruptSave;
|
||||
uint32_t interruptMask;
|
||||
|
||||
// transfer(txbuf, rxbuf, count, block) uses DMA when possible
|
||||
Adafruit_ZeroDMA readChannel;
|
||||
Adafruit_ZeroDMA writeChannel;
|
||||
DmacDescriptor *firstReadDescriptor = NULL; // List entry point
|
||||
DmacDescriptor *firstWriteDescriptor = NULL;
|
||||
DmacDescriptor *extraReadDescriptors = NULL; // Add'l descriptors
|
||||
DmacDescriptor *extraWriteDescriptors = NULL;
|
||||
bool use_dma = false; // true on successful alloc
|
||||
volatile bool dma_busy = false;
|
||||
void dmaAllocate(void);
|
||||
// transfer(txbuf, rxbuf, count, block) uses DMA if possible
|
||||
Adafruit_ZeroDMA readChannel,
|
||||
writeChannel;
|
||||
DmacDescriptor *readDescriptor = NULL,
|
||||
*writeDescriptor = NULL;
|
||||
volatile bool dma_busy = false;
|
||||
static void dmaCallback(Adafruit_ZeroDMA *dma);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -174,7 +174,6 @@ static inline void resetTC (Tc* TCx)
|
|||
|
||||
static void _initISR(Tc *tc, uint8_t channel, uint32_t id, IRQn_Type irqn, uint8_t gcmForTimer, uint8_t intEnableBit)
|
||||
{
|
||||
(void)id;
|
||||
// Select GCLK0 as timer/counter input clock source
|
||||
#if defined(__SAMD51__)
|
||||
int idx = gcmForTimer; // see datasheet Table 14-9
|
||||
|
|
@ -266,7 +265,6 @@ static void initISR(timer16_Sequence_t timer)
|
|||
|
||||
static void finISR(timer16_Sequence_t timer)
|
||||
{
|
||||
(void)timer;
|
||||
#if defined (_useTimer1)
|
||||
// Disable the match channel interrupt request
|
||||
TC_FOR_TIMER1->COUNT16.INTENCLR.reg = INTENCLR_BIT_FOR_TIMER_1;
|
||||
|
|
|
|||
|
|
@ -38,52 +38,50 @@
|
|||
// to manage more than one channel per timer on the SAMD architecture
|
||||
|
||||
#if defined(__SAMD51__)
|
||||
#if defined (_useTimer1)
|
||||
#define TC_FOR_TIMER1 TC1
|
||||
#define CHANNEL_FOR_TIMER1 0
|
||||
#define INTENSET_BIT_FOR_TIMER_1 TC_INTENSET_MC0
|
||||
#define INTENCLR_BIT_FOR_TIMER_1 TC_INTENCLR_MC0
|
||||
#define INTFLAG_BIT_FOR_TIMER_1 TC_INTFLAG_MC0
|
||||
#define ID_TC_FOR_TIMER1 ID_TC1
|
||||
#define IRQn_FOR_TIMER1 TC1_IRQn
|
||||
#define HANDLER_FOR_TIMER1 TC1_Handler
|
||||
#define GCM_FOR_TIMER_1 TC1_GCLK_ID
|
||||
#endif
|
||||
|
||||
#if defined (_useTimer2)
|
||||
#define TC_FOR_TIMER2 TC1
|
||||
#define CHANNEL_FOR_TIMER2 1
|
||||
#define INTENSET_BIT_FOR_TIMER_2 TC_INTENSET_MC1
|
||||
#define INTENCLR_BIT_FOR_TIMER_2 TC_INTENCLR_MC1
|
||||
#define INTFLAG_BIT_FOR_TIMER_2 TC_INTFLAG_MC1
|
||||
#define ID_TC_FOR_TIMER2 ID_TC1
|
||||
#define IRQn_FOR_TIMER2 TC1_IRQn
|
||||
#define HANDLER_FOR_TIMER2 TC1_Handler
|
||||
#define GCM_FOR_TIMER_2 TC1_GCLK_ID
|
||||
#endif
|
||||
#if defined (_useTimer1)
|
||||
#define TC_FOR_TIMER1 TC0
|
||||
#define CHANNEL_FOR_TIMER1 0
|
||||
#define INTENSET_BIT_FOR_TIMER_1 TC_INTENSET_MC0
|
||||
#define INTENCLR_BIT_FOR_TIMER_1 TC_INTENCLR_MC0
|
||||
#define INTFLAG_BIT_FOR_TIMER_1 TC_INTFLAG_MC0
|
||||
#define ID_TC_FOR_TIMER1 ID_TC0
|
||||
#define IRQn_FOR_TIMER1 TC0_IRQn
|
||||
#define HANDLER_FOR_TIMER1 TC0_Handler
|
||||
#define GCM_FOR_TIMER_1 9 // GCLK_TC0
|
||||
#endif
|
||||
#if defined (_useTimer2)
|
||||
#define TC_FOR_TIMER2 TC0
|
||||
#define CHANNEL_FOR_TIMER2 1
|
||||
#define INTENSET_BIT_FOR_TIMER_2 TC_INTENSET_MC1
|
||||
#define INTENCLR_BIT_FOR_TIMER_2 TC_INTENCLR_MC1
|
||||
#define INTFLAG_BIT_FOR_TIMER_2 TC_INTFLAG_MC1
|
||||
#define ID_TC_FOR_TIMER2 ID_TC0
|
||||
#define IRQn_FOR_TIMER2 TC0_IRQn
|
||||
#define HANDLER_FOR_TIMER2 TC0_Handler
|
||||
#define GCM_FOR_TIMER_2 9 // GCLK_TC0
|
||||
#endif
|
||||
#else
|
||||
#if defined (_useTimer1)
|
||||
#define TC_FOR_TIMER1 TC4
|
||||
#define CHANNEL_FOR_TIMER1 0
|
||||
#define INTENSET_BIT_FOR_TIMER_1 TC_INTENSET_MC0
|
||||
#define INTENCLR_BIT_FOR_TIMER_1 TC_INTENCLR_MC0
|
||||
#define INTFLAG_BIT_FOR_TIMER_1 TC_INTFLAG_MC0
|
||||
#define ID_TC_FOR_TIMER1 ID_TC4
|
||||
#define IRQn_FOR_TIMER1 TC4_IRQn
|
||||
#define HANDLER_FOR_TIMER1 TC4_Handler
|
||||
#define GCM_FOR_TIMER_1 GCM_TC4_TC5
|
||||
#endif
|
||||
|
||||
#if defined (_useTimer2)
|
||||
#define TC_FOR_TIMER2 TC4
|
||||
#define CHANNEL_FOR_TIMER2 1
|
||||
#define INTENSET_BIT_FOR_TIMER_2 TC_INTENSET_MC1
|
||||
#define INTENCLR_BIT_FOR_TIMER_2 TC_INTENCLR_MC1
|
||||
#define ID_TC_FOR_TIMER2 ID_TC4
|
||||
#define IRQn_FOR_TIMER2 TC4_IRQn
|
||||
#define HANDLER_FOR_TIMER2 TC4_Handler
|
||||
#define GCM_FOR_TIMER_2 GCM_TC4_TC5
|
||||
#endif
|
||||
#if defined (_useTimer1)
|
||||
#define TC_FOR_TIMER1 TC4
|
||||
#define CHANNEL_FOR_TIMER1 0
|
||||
#define INTENSET_BIT_FOR_TIMER_1 TC_INTENSET_MC0
|
||||
#define INTENCLR_BIT_FOR_TIMER_1 TC_INTENCLR_MC0
|
||||
#define INTFLAG_BIT_FOR_TIMER_1 TC_INTFLAG_MC0
|
||||
#define ID_TC_FOR_TIMER1 ID_TC4
|
||||
#define IRQn_FOR_TIMER1 TC4_IRQn
|
||||
#define HANDLER_FOR_TIMER1 TC4_Handler
|
||||
#define GCM_FOR_TIMER_1 GCM_TC4_TC5
|
||||
#endif
|
||||
#if defined (_useTimer2)
|
||||
#define TC_FOR_TIMER2 TC4
|
||||
#define CHANNEL_FOR_TIMER2 1
|
||||
#define INTENSET_BIT_FOR_TIMER_2 TC_INTENSET_MC1
|
||||
#define INTENCLR_BIT_FOR_TIMER_2 TC_INTENCLR_MC1
|
||||
#define ID_TC_FOR_TIMER2 ID_TC4
|
||||
#define IRQn_FOR_TIMER2 TC4_IRQn
|
||||
#define HANDLER_FOR_TIMER2 TC4_Handler
|
||||
#define GCM_FOR_TIMER_2 GCM_TC4_TC5
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ void setup(void)
|
|||
while (!SERIAL_PORT_MONITOR); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
|
||||
SERIAL_PORT_MONITOR.println("\r\nADK demo start");
|
||||
|
||||
if (usb.Init() == (uint32_t)-1)
|
||||
if (usb.Init() == -1)
|
||||
SERIAL_PORT_MONITOR.println("OSC did not start.");
|
||||
|
||||
delay(20);
|
||||
|
|
|
|||
|
|
@ -83,7 +83,8 @@ void setup()
|
|||
{
|
||||
SerialDebug.begin( 115200 );
|
||||
SerialDebug.println("USB Host Keyboard Controller Program started");
|
||||
if (usb.Init() == (uint32_t)-1)
|
||||
|
||||
if (usb.Init() == -1)
|
||||
SerialDebug.println("USB Host did not start.");
|
||||
|
||||
SerialDebug.println("USB Host started");
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ void setup()
|
|||
SerialDebug.begin( 115200 );
|
||||
SerialDebug.println("USB Host Mouse Controller Program started");
|
||||
|
||||
if (usb.Init() == (uint32_t)-1)
|
||||
if (usb.Init() == -1)
|
||||
SerialDebug.println("USB Host did not start.");
|
||||
|
||||
SerialDebug.println("USB Host started");
|
||||
|
|
|
|||
|
|
@ -59,8 +59,8 @@ void setup()
|
|||
SerialDebug.println("Starting USB Descriptor test");
|
||||
|
||||
SerialDebug.println("Initializing USB");
|
||||
if (usb.Init() == (uint32_t)-1)
|
||||
SerialDebug.println("USBhost did not start.");
|
||||
if (usb.Init() == -1)
|
||||
SerialDebug.println("USBhost did not start.");
|
||||
|
||||
delay( 20 );
|
||||
|
||||
|
|
@ -161,7 +161,6 @@ byte getdevdescr( byte addr, byte &num_conf )
|
|||
|
||||
void printhubdescr(uint8_t *descrptr, uint8_t addr)
|
||||
{
|
||||
(void)addr;
|
||||
HubDescriptor *pHub = (HubDescriptor*) descrptr;
|
||||
uint8_t len = *((uint8_t*)descrptr);
|
||||
|
||||
|
|
@ -210,11 +209,10 @@ byte getconfdescr( byte addr, byte conf )
|
|||
{
|
||||
uint8_t buf[ BUFSIZE ];
|
||||
uint8_t* buf_ptr = buf;
|
||||
byte rcode; // FIXME -- code does not actually check return code (no error handling!)
|
||||
byte rcode;
|
||||
byte descr_length;
|
||||
byte descr_type;
|
||||
uint16_t total_length;
|
||||
// FIXME -- no check of return code from usb.getConfDescr()
|
||||
rcode = usb.getConfDescr( addr, 0, 4, conf, buf ); //get total length
|
||||
LOBYTE( total_length ) = buf[ 2 ];
|
||||
HIBYTE( total_length ) = buf[ 3 ];
|
||||
|
|
@ -222,7 +220,6 @@ byte getconfdescr( byte addr, byte conf )
|
|||
printProgStr(Conf_Trunc_str);
|
||||
total_length = sizeof(buf);
|
||||
}
|
||||
// FIXME -- no check of return code from usb.getConfDescr()
|
||||
rcode = usb.getConfDescr( addr, 0, total_length, conf, buf ); //get the whole descriptor
|
||||
while( buf_ptr < buf + total_length ) { //parsing descriptors
|
||||
descr_length = *( buf_ptr );
|
||||
|
|
|
|||
|
|
@ -59,15 +59,15 @@ class ConfigDescParser : public USBReadParser {
|
|||
uint32_t ifaceNumber; // Interface number
|
||||
uint32_t ifaceAltSet; // Interface alternate settings
|
||||
|
||||
bool UseOr;
|
||||
bool UseOr;
|
||||
bool ParseDescriptor(uint8_t **pp, uint32_t *pcntdn);
|
||||
void PrintHidDescriptor(const USB_HID_DESCRIPTOR *pDesc);
|
||||
|
||||
public:
|
||||
|
||||
void SetOR(void) {
|
||||
UseOr = true;
|
||||
}
|
||||
void SetOR(void) {
|
||||
UseOr = true;
|
||||
}
|
||||
ConfigDescParser(UsbConfigXtracter *xtractor);
|
||||
virtual void Parse(const uint32_t len, const uint8_t *pbuf, const uint32_t &offset);
|
||||
};
|
||||
|
|
@ -98,19 +98,8 @@ void ConfigDescParser<CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK>::Parse(const uin
|
|||
compare masks for them. When the match is found, calls EndpointXtract passing buffer containing endpoint descriptor */
|
||||
template <const uint8_t CLASS_ID, const uint8_t SUBCLASS_ID, const uint8_t PROTOCOL_ID, const uint8_t MASK>
|
||||
bool ConfigDescParser<CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK>::ParseDescriptor(uint8_t **pp, uint32_t *pcntdn) {
|
||||
USB_CONFIGURATION_DESCRIPTOR* ucd = reinterpret_cast<USB_CONFIGURATION_DESCRIPTOR*>(varBuffer);
|
||||
USB_INTERFACE_DESCRIPTOR* uid = reinterpret_cast<USB_INTERFACE_DESCRIPTOR*>(varBuffer);
|
||||
|
||||
|
||||
#pragma GCC diagnostic push // Available since GCC 4.6.4
|
||||
/*
|
||||
* FIXME -- Enabled and review all `-Wimplicit-fallthrough` messages
|
||||
* This code has multiple switch statements that "fall through" to the
|
||||
* next case -- but it's not always clear if this is intentional or not.
|
||||
* Review and commenting of code, and reducing cyclomatic complexity
|
||||
* are highly recommended....
|
||||
*/
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
|
||||
USB_CONFIGURATION_DESCRIPTOR* ucd = reinterpret_cast<USB_CONFIGURATION_DESCRIPTOR*>(varBuffer);
|
||||
USB_INTERFACE_DESCRIPTOR* uid = reinterpret_cast<USB_INTERFACE_DESCRIPTOR*>(varBuffer);
|
||||
switch(stateParseDescr) {
|
||||
case 0:
|
||||
theBuffer.valueSize = 2;
|
||||
|
|
@ -123,7 +112,7 @@ bool ConfigDescParser<CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK>::ParseDescriptor
|
|||
dscrType = *((uint8_t*)theBuffer.pValue + 1);
|
||||
stateParseDescr = 2;
|
||||
case 2:
|
||||
// This is a sort of hack. Assuming that two bytes are all ready in the buffer
|
||||
// This is a sort of hack. Assuming that two bytes are all ready in the buffer
|
||||
// the pointer is positioned two bytes ahead in order for the rest of descriptor
|
||||
// to be read right after the size and the type fields.
|
||||
// This should be used carefully. varBuffer should be used directly to handle data
|
||||
|
|
@ -131,14 +120,14 @@ bool ConfigDescParser<CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK>::ParseDescriptor
|
|||
theBuffer.pValue = varBuffer + 2;
|
||||
stateParseDescr = 3;
|
||||
case 3:
|
||||
switch(dscrType) {
|
||||
case USB_DESCRIPTOR_INTERFACE:
|
||||
isGoodInterface = false;
|
||||
case USB_DESCRIPTOR_CONFIGURATION:
|
||||
theBuffer.valueSize = sizeof (USB_CONFIGURATION_DESCRIPTOR) - 2;
|
||||
break;
|
||||
case USB_DESCRIPTOR_ENDPOINT:
|
||||
theBuffer.valueSize = sizeof (USB_ENDPOINT_DESCRIPTOR) - 2;
|
||||
switch(dscrType) {
|
||||
case USB_DESCRIPTOR_INTERFACE:
|
||||
isGoodInterface = false;
|
||||
case USB_DESCRIPTOR_CONFIGURATION:
|
||||
theBuffer.valueSize = sizeof (USB_CONFIGURATION_DESCRIPTOR) - 2;
|
||||
break;
|
||||
case USB_DESCRIPTOR_ENDPOINT:
|
||||
theBuffer.valueSize = sizeof (USB_ENDPOINT_DESCRIPTOR) - 2;
|
||||
break;
|
||||
case HID_DESCRIPTOR_HID:
|
||||
theBuffer.valueSize = dscrLen - 2;
|
||||
|
|
@ -147,37 +136,37 @@ bool ConfigDescParser<CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK>::ParseDescriptor
|
|||
valParser.Initialize(&theBuffer);
|
||||
stateParseDescr = 4;
|
||||
case 4:
|
||||
switch(dscrType) {
|
||||
switch(dscrType) {
|
||||
case USB_DESCRIPTOR_CONFIGURATION:
|
||||
if(!valParser.Parse(pp, pcntdn))
|
||||
return false;
|
||||
confValue = ucd->bConfigurationValue;
|
||||
if(!valParser.Parse(pp, pcntdn))
|
||||
return false;
|
||||
confValue = ucd->bConfigurationValue;
|
||||
break;
|
||||
case USB_DESCRIPTOR_INTERFACE:
|
||||
if(!valParser.Parse(pp, pcntdn))
|
||||
return false;
|
||||
if((MASK & CP_MASK_COMPARE_CLASS) && uid->bInterfaceClass != CLASS_ID)
|
||||
break;
|
||||
if((MASK & CP_MASK_COMPARE_SUBCLASS) && uid->bInterfaceSubClass != SUBCLASS_ID)
|
||||
break;
|
||||
if(UseOr) {
|
||||
if((!((MASK & CP_MASK_COMPARE_PROTOCOL) && uid->bInterfaceProtocol)))
|
||||
break;
|
||||
} else {
|
||||
if((MASK & CP_MASK_COMPARE_PROTOCOL) && uid->bInterfaceProtocol != PROTOCOL_ID)
|
||||
break;
|
||||
}
|
||||
isGoodInterface = true;
|
||||
ifaceNumber = uid->bInterfaceNumber;
|
||||
ifaceAltSet = uid->bAlternateSetting;
|
||||
protoValue = uid->bInterfaceProtocol;
|
||||
break;
|
||||
case USB_DESCRIPTOR_ENDPOINT:
|
||||
if(!valParser.Parse(pp, pcntdn))
|
||||
return false;
|
||||
if(isGoodInterface)
|
||||
if(theXtractor)
|
||||
theXtractor->EndpointXtract(confValue, ifaceNumber, ifaceAltSet, protoValue, (USB_ENDPOINT_DESCRIPTOR*)varBuffer);
|
||||
if(!valParser.Parse(pp, pcntdn))
|
||||
return false;
|
||||
if((MASK & CP_MASK_COMPARE_CLASS) && uid->bInterfaceClass != CLASS_ID)
|
||||
break;
|
||||
if((MASK & CP_MASK_COMPARE_SUBCLASS) && uid->bInterfaceSubClass != SUBCLASS_ID)
|
||||
break;
|
||||
if(UseOr) {
|
||||
if((!((MASK & CP_MASK_COMPARE_PROTOCOL) && uid->bInterfaceProtocol)))
|
||||
break;
|
||||
} else {
|
||||
if((MASK & CP_MASK_COMPARE_PROTOCOL) && uid->bInterfaceProtocol != PROTOCOL_ID)
|
||||
break;
|
||||
}
|
||||
isGoodInterface = true;
|
||||
ifaceNumber = uid->bInterfaceNumber;
|
||||
ifaceAltSet = uid->bAlternateSetting;
|
||||
protoValue = uid->bInterfaceProtocol;
|
||||
break;
|
||||
case USB_DESCRIPTOR_ENDPOINT:
|
||||
if(!valParser.Parse(pp, pcntdn))
|
||||
return false;
|
||||
if(isGoodInterface)
|
||||
if(theXtractor)
|
||||
theXtractor->EndpointXtract(confValue, ifaceNumber, ifaceAltSet, protoValue, (USB_ENDPOINT_DESCRIPTOR*)varBuffer);
|
||||
break;
|
||||
//case HID_DESCRIPTOR_HID:
|
||||
// if (!valParser.Parse(pp, pcntdn))
|
||||
|
|
@ -191,47 +180,44 @@ bool ConfigDescParser<CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK>::ParseDescriptor
|
|||
theBuffer.pValue = varBuffer;
|
||||
stateParseDescr = 0;
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <const uint8_t CLASS_ID, const uint8_t SUBCLASS_ID, const uint8_t PROTOCOL_ID, const uint8_t MASK>
|
||||
void ConfigDescParser<CLASS_ID, SUBCLASS_ID, PROTOCOL_ID, MASK>::PrintHidDescriptor(const USB_HID_DESCRIPTOR *pDesc) {
|
||||
Notify(PSTR("\r\n\r\nHID Descriptor:\r\n"), 0x80);
|
||||
Notify(PSTR("bDescLength:\t\t"), 0x80);
|
||||
PrintHex<uint8_t > (pDesc->bLength, 0x80);
|
||||
Notify(PSTR("\r\n\r\nHID Descriptor:\r\n"), 0x80);
|
||||
Notify(PSTR("bDescLength:\t\t"), 0x80);
|
||||
PrintHex<uint8_t > (pDesc->bLength, 0x80);
|
||||
|
||||
Notify(PSTR("\r\nbDescriptorType:\t"), 0x80);
|
||||
PrintHex<uint8_t > (pDesc->bDescriptorType, 0x80);
|
||||
Notify(PSTR("\r\nbDescriptorType:\t"), 0x80);
|
||||
PrintHex<uint8_t > (pDesc->bDescriptorType, 0x80);
|
||||
|
||||
Notify(PSTR("\r\nbcdHID:\t\t\t"), 0x80);
|
||||
PrintHex<uint16_t > (pDesc->bcdHID, 0x80);
|
||||
Notify(PSTR("\r\nbcdHID:\t\t\t"), 0x80);
|
||||
PrintHex<uint16_t > (pDesc->bcdHID, 0x80);
|
||||
|
||||
Notify(PSTR("\r\nbCountryCode:\t\t"), 0x80);
|
||||
PrintHex<uint8_t > (pDesc->bCountryCode, 0x80);
|
||||
Notify(PSTR("\r\nbCountryCode:\t\t"), 0x80);
|
||||
PrintHex<uint8_t > (pDesc->bCountryCode, 0x80);
|
||||
|
||||
Notify(PSTR("\r\nbNumDescriptors:\t"), 0x80);
|
||||
PrintHex<uint8_t > (pDesc->bNumDescriptors, 0x80);
|
||||
Notify(PSTR("\r\nbNumDescriptors:\t"), 0x80);
|
||||
PrintHex<uint8_t > (pDesc->bNumDescriptors, 0x80);
|
||||
|
||||
//Notify(PSTR("\r\nbDescrType:\t\t"));
|
||||
//PrintHex<uint8_t>(pDesc->bDescrType);
|
||||
//
|
||||
//Notify(PSTR("\r\nwDescriptorLength:\t"));
|
||||
//PrintHex<uint16_t>(pDesc->wDescriptorLength);
|
||||
//Notify(PSTR("\r\nbDescrType:\t\t"));
|
||||
//PrintHex<uint8_t>(pDesc->bDescrType);
|
||||
//
|
||||
//Notify(PSTR("\r\nwDescriptorLength:\t"));
|
||||
//PrintHex<uint16_t>(pDesc->wDescriptorLength);
|
||||
|
||||
for (uint32_t i = 0; i < pDesc->bNumDescriptors; i++) {
|
||||
HID_CLASS_DESCRIPTOR_LEN_AND_TYPE *pLT = (HID_CLASS_DESCRIPTOR_LEN_AND_TYPE*)&(pDesc->bDescrType);
|
||||
|
||||
Notify(PSTR("\r\nbDescrType:\t\t"), 0x80);
|
||||
PrintHex<uint8_t > (pLT[i].bDescrType, 0x80);
|
||||
Notify(PSTR("\r\nbDescrType:\t\t"), 0x80);
|
||||
PrintHex<uint8_t > (pLT[i].bDescrType, 0x80);
|
||||
|
||||
Notify(PSTR("\r\nwDescriptorLength:\t"), 0x80);
|
||||
PrintHex<uint16_t > (pLT[i].wDescriptorLength, 0x80);
|
||||
}
|
||||
Notify(PSTR("\r\n"), 0x80);
|
||||
Notify(PSTR("\r\nwDescriptorLength:\t"), 0x80);
|
||||
PrintHex<uint16_t > (pLT[i].wDescriptorLength, 0x80);
|
||||
}
|
||||
Notify(PSTR("\r\n"), 0x80);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif // __CONFDESCPARSER_H__
|
||||
|
|
|
|||
|
|
@ -994,6 +994,7 @@ void ReportDescParserBase::Parse(const uint32_t len, const uint8_t *pbuf, const
|
|||
uint32_t cntdn = (uint32_t)len;
|
||||
uint8_t *p = (uint8_t*)pbuf;
|
||||
|
||||
|
||||
totalSize = 0;
|
||||
|
||||
while(cntdn) {
|
||||
|
|
@ -1090,17 +1091,6 @@ void ReportDescParserBase::PrintItemTitle(uint8_t prefix) {
|
|||
uint8_t ReportDescParserBase::ParseItem(uint8_t **pp, uint32_t *pcntdn) {
|
||||
//uint8_t ret = enErrorSuccess;
|
||||
//reinterpret_cast<>(varBuffer);
|
||||
|
||||
|
||||
#pragma GCC diagnostic push // Available since GCC 4.6.4
|
||||
/*
|
||||
* FIXME -- Enabled and review all `-Wimplicit-fallthrough` messages
|
||||
* This code has multiple switch statements that "fall through" to the
|
||||
* next case -- but it's not always clear if this is intentional or not.
|
||||
* Review and commenting of code, and reducing cyclomatic complexity
|
||||
* are highly recommended....
|
||||
*/
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
|
||||
switch(itemParseState) {
|
||||
case 0:
|
||||
if(**pp == HID_LONG_ITEM_PREFIX)
|
||||
|
|
@ -1217,7 +1207,6 @@ uint8_t ReportDescParserBase::ParseItem(uint8_t **pp, uint32_t *pcntdn) {
|
|||
} // switch (**pp & (TYPE_MASK | TAG_MASK))
|
||||
}
|
||||
} // switch (itemParseState)
|
||||
#pragma GCC diagnostic pop
|
||||
itemParseState = 0;
|
||||
return enErrorSuccess;
|
||||
}
|
||||
|
|
@ -1247,18 +1236,18 @@ void ReportDescParserBase::SetUsagePage(uint16_t page) {
|
|||
if(VALUE_BETWEEN(page, 0x00, 0x11))
|
||||
pfUsage = (usagePageFunctions[page - 1]);
|
||||
|
||||
// Dead code...
|
||||
//
|
||||
// pfUsage = (UsagePageFunc)pgm_read_pointer(usagePageFunctions[page - 1]);
|
||||
//else if (page > 0x7f && page < 0x84)
|
||||
// E_Notify(pstrUsagePageMonitor);
|
||||
//else if (page > 0x83 && page < 0x8c)
|
||||
// E_Notify(pstrUsagePagePower);
|
||||
//else if (page > 0x8b && page < 0x92)
|
||||
// E_Notify((char*)pgm_read_pointer(&usagePageTitles1[page - 0x8c]));
|
||||
//else if (page > 0xfeff && page <= 0xffff)
|
||||
// E_Notify(pstrUsagePageVendorDefined);
|
||||
//
|
||||
// Dead code...
|
||||
//
|
||||
// pfUsage = (UsagePageFunc)pgm_read_pointer(usagePageFunctions[page - 1]);
|
||||
//else if (page > 0x7f && page < 0x84)
|
||||
// E_Notify(pstrUsagePageMonitor);
|
||||
//else if (page > 0x83 && page < 0x8c)
|
||||
// E_Notify(pstrUsagePagePower);
|
||||
//else if (page > 0x8b && page < 0x92)
|
||||
// E_Notify((char*)pgm_read_pointer(&usagePageTitles1[page - 0x8c]));
|
||||
//else if (page > 0xfeff && page <= 0xffff)
|
||||
// E_Notify(pstrUsagePageVendorDefined);
|
||||
//
|
||||
else
|
||||
switch(page) {
|
||||
case 0x14:
|
||||
|
|
@ -1451,15 +1440,6 @@ void ReportDescParserBase::PrintMedicalInstrumentPageUsage(uint16_t usage) {
|
|||
uint8_t ReportDescParser2::ParseItem(uint8_t **pp, uint32_t *pcntdn) {
|
||||
//uint8_t ret = enErrorSuccess;
|
||||
|
||||
#pragma GCC diagnostic push // Available since GCC 4.6.4
|
||||
/*
|
||||
* FIXME -- Enabled and review all `-Wimplicit-fallthrough` messages
|
||||
* This code has multiple switch statements that "fall through" to the
|
||||
* next case -- but it's not always clear if this is intentional or not.
|
||||
* Review and commenting of code, and reducing cyclomatic complexity
|
||||
* are highly recommended....
|
||||
*/
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
|
||||
switch(itemParseState) {
|
||||
case 0:
|
||||
if(**pp == HID_LONG_ITEM_PREFIX)
|
||||
|
|
@ -1539,8 +1519,6 @@ uint8_t ReportDescParser2::ParseItem(uint8_t **pp, uint32_t *pcntdn) {
|
|||
} // switch (**pp & (TYPE_MASK | TAG_MASK))
|
||||
}
|
||||
} // switch (itemParseState)
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
itemParseState = 0;
|
||||
return enErrorSuccess;
|
||||
}
|
||||
|
|
@ -1580,7 +1558,8 @@ void ReportDescParser2::OnInputItem(uint8_t itm) {
|
|||
// bits_to_copy - number of bits to copy to result buffer
|
||||
|
||||
// for each bit in a field
|
||||
for(uint8_t bits_left = rptSize, bits_to_copy = 0; bits_left; bits_left -= bits_to_copy) {
|
||||
for(uint8_t bits_left = rptSize, bits_to_copy = 0; bits_left;
|
||||
bits_left -= bits_to_copy) {
|
||||
bits_to_copy = (bits_left > bits_of_byte) ? bits_of_byte : bits_left;
|
||||
|
||||
result.dwResult <<= bits_to_copy; // Result buffer is shifted by the number of bits to be copied into it
|
||||
|
|
|
|||
|
|
@ -17,14 +17,14 @@ e-mail : support@circuitsathome.com
|
|||
#include "Usb.h"
|
||||
|
||||
bool MultiByteValueParser::Parse(uint8_t **pp, uint32_t *pcntdn) {
|
||||
if(!pBuf) {
|
||||
Notify(PSTR("Buffer pointer is NULL!\r\n"), 0x80);
|
||||
if(!pBuf) {
|
||||
Notify(PSTR("Buffer pointer is NULL!\r\n"), 0x80);
|
||||
return false;
|
||||
}
|
||||
for (; countDown && (*pcntdn); countDown--, (*pcntdn)--, (*pp)++)
|
||||
pBuf[valueSize - countDown] = (**pp);
|
||||
|
||||
if(countDown)
|
||||
if(countDown)
|
||||
return false;
|
||||
|
||||
countDown = valueSize;
|
||||
|
|
@ -32,48 +32,36 @@ bool MultiByteValueParser::Parse(uint8_t **pp, uint32_t *pcntdn) {
|
|||
}
|
||||
|
||||
bool PTPListParser::Parse(uint8_t **pp, uint32_t *pcntdn, PTP_ARRAY_EL_FUNC pf, const void *me) {
|
||||
switch(nStage) {
|
||||
case 0:
|
||||
pBuf->valueSize = lenSize;
|
||||
theParser.Initialize(pBuf);
|
||||
nStage = 1;
|
||||
|
||||
#pragma GCC diagnostic push // Available since GCC 4.6.4
|
||||
/*
|
||||
* FIXME -- Enabled and review all `-Wimplicit-fallthrough` messages
|
||||
* This code has multiple switch statements that "fall through" to the
|
||||
* next case -- but it's not always clear if this is intentional or not.
|
||||
* Review and commenting of code, and reducing cyclomatic complexity
|
||||
* are highly recommended....
|
||||
*/
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
|
||||
case 1:
|
||||
if(!theParser.Parse(pp, pcntdn))
|
||||
return false;
|
||||
|
||||
switch(nStage) {
|
||||
case 0:
|
||||
pBuf->valueSize = lenSize;
|
||||
theParser.Initialize(pBuf);
|
||||
nStage = 1;
|
||||
arLen = 0;
|
||||
arLen = (pBuf->valueSize >= 4) ? *((uint32_t*)pBuf->pValue) : (uint32_t)(*((uint16_t*)pBuf->pValue));
|
||||
arLenCntdn = arLen;
|
||||
nStage = 2;
|
||||
|
||||
case 1:
|
||||
case 2:
|
||||
pBuf->valueSize = valSize;
|
||||
theParser.Initialize(pBuf);
|
||||
nStage = 3;
|
||||
|
||||
case 3:
|
||||
for(; arLenCntdn; arLenCntdn--) {
|
||||
if(!theParser.Parse(pp, pcntdn))
|
||||
return false;
|
||||
|
||||
arLen = 0;
|
||||
arLen = (pBuf->valueSize >= 4) ? *((uint32_t*)pBuf->pValue) : (uint32_t)(*((uint16_t*)pBuf->pValue));
|
||||
arLenCntdn = arLen;
|
||||
nStage = 2;
|
||||
|
||||
case 2:
|
||||
pBuf->valueSize = valSize;
|
||||
theParser.Initialize(pBuf);
|
||||
nStage = 3;
|
||||
|
||||
case 3:
|
||||
for(; arLenCntdn; arLenCntdn--) {
|
||||
if(!theParser.Parse(pp, pcntdn))
|
||||
return false;
|
||||
|
||||
if(pf)
|
||||
pf(pBuf, (arLen - arLenCntdn), me);
|
||||
}
|
||||
|
||||
nStage = 0;
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,12 +35,12 @@ class MultiByteValueParser {
|
|||
|
||||
public:
|
||||
|
||||
MultiByteValueParser() : pBuf(NULL), countDown(0), valueSize(0) {
|
||||
};
|
||||
MultiByteValueParser() : pBuf(NULL), countDown(0), valueSize(0) {
|
||||
};
|
||||
|
||||
const uint8_t* GetBuffer() {
|
||||
return pBuf;
|
||||
};
|
||||
const uint8_t* GetBuffer() {
|
||||
return pBuf;
|
||||
};
|
||||
|
||||
void Initialize(MultiValueBuffer * const pbuf) {
|
||||
pBuf = (uint8_t*)pbuf->pValue;
|
||||
|
|
@ -58,7 +58,7 @@ class ByteSkipper {
|
|||
public:
|
||||
|
||||
ByteSkipper() : pBuf(NULL), nStage(0), countDown(0) {
|
||||
};
|
||||
};
|
||||
|
||||
void Initialize(MultiValueBuffer *pbuf) {
|
||||
pBuf = (uint8_t*)pbuf->pValue;
|
||||
|
|
@ -66,25 +66,16 @@ public:
|
|||
};
|
||||
|
||||
bool Skip(uint8_t **pp, uint32_t *pcntdn, uint32_t bytes_to_skip) {
|
||||
#pragma GCC diagnostic push // Available since GCC 4.6.4
|
||||
/*
|
||||
* FIXME -- Enabled and review all `-Wimplicit-fallthrough` messages
|
||||
* This code has multiple switch statements that "fall through" to the
|
||||
* next case -- but it's not always clear if this is intentional or not.
|
||||
* Review and commenting of code, and reducing cyclomatic complexity
|
||||
* are highly recommended....
|
||||
*/
|
||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
|
||||
switch(nStage) {
|
||||
case 0:
|
||||
countDown = bytes_to_skip;
|
||||
nStage++;
|
||||
case 1:
|
||||
for(; countDown && (*pcntdn); countDown--, (*pp)++, (*pcntdn)--);
|
||||
if(!countDown)
|
||||
nStage = 0;
|
||||
switch(nStage) {
|
||||
case 0:
|
||||
countDown = bytes_to_skip;
|
||||
nStage++;
|
||||
case 1:
|
||||
for(; countDown && (*pcntdn); countDown--, (*pp)++, (*pcntdn)--);
|
||||
|
||||
if(!countDown)
|
||||
nStage = 0;
|
||||
};
|
||||
#pragma GCC diagnostic pop
|
||||
return (!countDown);
|
||||
};
|
||||
};
|
||||
|
|
@ -95,9 +86,9 @@ typedef void (*PTP_ARRAY_EL_FUNC)(const MultiValueBuffer * const p, uint32_t cou
|
|||
class PTPListParser {
|
||||
public:
|
||||
|
||||
enum ParseMode {
|
||||
modeArray, modeRange/*, modeEnum*/
|
||||
};
|
||||
enum ParseMode {
|
||||
modeArray, modeRange/*, modeEnum*/
|
||||
};
|
||||
|
||||
private:
|
||||
uint32_t nStage;
|
||||
|
|
|
|||
|
|
@ -28,8 +28,6 @@ void loop()
|
|||
// this function is registered as an event, see setup()
|
||||
void receiveEvent(int howMany)
|
||||
{
|
||||
(void)howMany; // avoid compiler warning about unused parameter
|
||||
|
||||
while(1 < Wire.available()) // loop through all but the last
|
||||
{
|
||||
char c = Wire.read(); // receive byte as a character
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification
|
||||
|
||||
name=Adafruit SAMD (32-bits ARM Cortex-M0+ and Cortex-M4) Boards
|
||||
version=1.6.3
|
||||
version=1.5.9
|
||||
|
||||
# Compile variables
|
||||
# -----------------
|
||||
|
|
@ -31,7 +31,7 @@ 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.path}/bin/
|
||||
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++
|
||||
|
|
@ -70,8 +70,8 @@ compiler.S.extra_flags=
|
|||
compiler.ar.extra_flags=
|
||||
compiler.elf2hex.extra_flags=
|
||||
|
||||
compiler.arm.cmsis.c.flags="-I{runtime.tools.CMSIS-5.4.0.path}/CMSIS/Core/Include/" "-I{runtime.tools.CMSIS-5.4.0.path}/CMSIS/DSP/Include/" "-I{runtime.tools.CMSIS-Atmel-1.2.0.path}/CMSIS/Device/ATMEL/"
|
||||
compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-5.4.0.path}/CMSIS/Lib/GCC/" -larm_cortexM0l_math
|
||||
compiler.arm.cmsis.c.flags="-I{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Include/" "-I{runtime.tools.CMSIS-Atmel-1.2.0.path}/CMSIS/Device/ATMEL/"
|
||||
compiler.arm.cmsis.ldflags="-L{runtime.tools.CMSIS-4.5.0.path}/CMSIS/Lib/GCC/" -larm_cortexM0l_math
|
||||
|
||||
compiler.libraries.ldflags=
|
||||
|
||||
|
|
|
|||
|
|
@ -1,31 +0,0 @@
|
|||
#
|
||||
# Arduino Zero OpenOCD script.
|
||||
#
|
||||
# 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
|
||||
#
|
||||
|
||||
# Define 'reset' command
|
||||
define reset
|
||||
|
||||
info reg
|
||||
|
||||
break main
|
||||
|
||||
# End of 'reset' command
|
||||
end
|
||||
|
||||
target remote | openocd -c "interface cmsis-dap" -c "set CHIPNAME at91samd21g18" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log"
|
||||
|
|
@ -1,211 +0,0 @@
|
|||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
/* Linker script to configure memory regions.
|
||||
* Need modifying for a specific board.
|
||||
* FLASH.ORIGIN: starting address of flash
|
||||
* FLASH.LENGTH: length of flash
|
||||
* RAM.ORIGIN: starting address of RAM bank 0
|
||||
* RAM.LENGTH: length of RAM bank 0
|
||||
*/
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x00000000+0x2000, LENGTH = 0x00040000-0x2000 /* First 8KB used by bootloader */
|
||||
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000
|
||||
}
|
||||
|
||||
/* Linker script to place sections and symbol values. Should be used together
|
||||
* with other linker script that defines memory regions FLASH and RAM.
|
||||
* It references following symbols, which must be defined in code:
|
||||
* Reset_Handler : Entry of reset handler
|
||||
*
|
||||
* It defines following symbols, which code can use without definition:
|
||||
* __exidx_start
|
||||
* __exidx_end
|
||||
* __copy_table_start__
|
||||
* __copy_table_end__
|
||||
* __zero_table_start__
|
||||
* __zero_table_end__
|
||||
* __etext
|
||||
* __data_start__
|
||||
* __preinit_array_start
|
||||
* __preinit_array_end
|
||||
* __init_array_start
|
||||
* __init_array_end
|
||||
* __fini_array_start
|
||||
* __fini_array_end
|
||||
* __data_end__
|
||||
* __bss_start__
|
||||
* __bss_end__
|
||||
* __end__
|
||||
* end
|
||||
* __HeapLimit
|
||||
* __StackLimit
|
||||
* __StackTop
|
||||
* __stack
|
||||
*/
|
||||
ENTRY(Reset_Handler)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
KEEP(*(.isr_vector))
|
||||
*(.text*)
|
||||
|
||||
KEEP(*(.init))
|
||||
KEEP(*(.fini))
|
||||
|
||||
/* .ctors */
|
||||
*crtbegin.o(.ctors)
|
||||
*crtbegin?.o(.ctors)
|
||||
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
|
||||
*(SORT(.ctors.*))
|
||||
*(.ctors)
|
||||
|
||||
/* .dtors */
|
||||
*crtbegin.o(.dtors)
|
||||
*crtbegin?.o(.dtors)
|
||||
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
|
||||
*(SORT(.dtors.*))
|
||||
*(.dtors)
|
||||
|
||||
*(.rodata*)
|
||||
|
||||
KEEP(*(.eh_frame*))
|
||||
} > FLASH
|
||||
|
||||
.ARM.extab :
|
||||
{
|
||||
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||
} > FLASH
|
||||
|
||||
__exidx_start = .;
|
||||
.ARM.exidx :
|
||||
{
|
||||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||||
} > FLASH
|
||||
__exidx_end = .;
|
||||
|
||||
/* To copy multiple ROM to RAM sections,
|
||||
* uncomment .copy.table section and,
|
||||
* define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */
|
||||
/*
|
||||
.copy.table :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__copy_table_start__ = .;
|
||||
LONG (__etext)
|
||||
LONG (__data_start__)
|
||||
LONG (__data_end__ - __data_start__)
|
||||
LONG (__etext2)
|
||||
LONG (__data2_start__)
|
||||
LONG (__data2_end__ - __data2_start__)
|
||||
__copy_table_end__ = .;
|
||||
} > FLASH
|
||||
*/
|
||||
|
||||
/* To clear multiple BSS sections,
|
||||
* uncomment .zero.table section and,
|
||||
* define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */
|
||||
/*
|
||||
.zero.table :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__zero_table_start__ = .;
|
||||
LONG (__bss_start__)
|
||||
LONG (__bss_end__ - __bss_start__)
|
||||
LONG (__bss2_start__)
|
||||
LONG (__bss2_end__ - __bss2_start__)
|
||||
__zero_table_end__ = .;
|
||||
} > FLASH
|
||||
*/
|
||||
|
||||
__etext = .;
|
||||
|
||||
.data : AT (__etext)
|
||||
{
|
||||
__data_start__ = .;
|
||||
*(vtable)
|
||||
*(.data*)
|
||||
|
||||
. = ALIGN(4);
|
||||
/* preinit data */
|
||||
PROVIDE_HIDDEN (__preinit_array_start = .);
|
||||
KEEP(*(.preinit_array))
|
||||
PROVIDE_HIDDEN (__preinit_array_end = .);
|
||||
|
||||
. = ALIGN(4);
|
||||
/* init data */
|
||||
PROVIDE_HIDDEN (__init_array_start = .);
|
||||
KEEP(*(SORT(.init_array.*)))
|
||||
KEEP(*(.init_array))
|
||||
PROVIDE_HIDDEN (__init_array_end = .);
|
||||
|
||||
|
||||
. = ALIGN(4);
|
||||
/* finit data */
|
||||
PROVIDE_HIDDEN (__fini_array_start = .);
|
||||
KEEP(*(SORT(.fini_array.*)))
|
||||
KEEP(*(.fini_array))
|
||||
PROVIDE_HIDDEN (__fini_array_end = .);
|
||||
|
||||
KEEP(*(.jcr*))
|
||||
. = ALIGN(4);
|
||||
/* All data end */
|
||||
__data_end__ = .;
|
||||
|
||||
} > RAM
|
||||
|
||||
.bss :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__bss_start__ = .;
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
__bss_end__ = .;
|
||||
} > RAM
|
||||
|
||||
.heap (COPY):
|
||||
{
|
||||
__end__ = .;
|
||||
PROVIDE(end = .);
|
||||
*(.heap*)
|
||||
__HeapLimit = .;
|
||||
} > RAM
|
||||
|
||||
/* .stack_dummy section doesn't contains any symbols. It is only
|
||||
* used for linker to calculate size of stack sections, and assign
|
||||
* values to stack symbols later */
|
||||
.stack_dummy (COPY):
|
||||
{
|
||||
*(.stack*)
|
||||
} > RAM
|
||||
|
||||
/* Set stack top to end of RAM, and stack limit move down by
|
||||
* size of stack_dummy section */
|
||||
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
|
||||
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
|
||||
PROVIDE(__stack = __StackTop);
|
||||
|
||||
__ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ;
|
||||
|
||||
/* Check if data + heap + stack exceeds RAM limit */
|
||||
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
|
||||
}
|
||||
|
|
@ -1,212 +0,0 @@
|
|||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
/* Linker script to configure memory regions.
|
||||
* Need modifying for a specific board.
|
||||
* FLASH.ORIGIN: starting address of flash
|
||||
* FLASH.LENGTH: length of flash
|
||||
* RAM.ORIGIN: starting address of RAM bank 0
|
||||
* RAM.LENGTH: length of RAM bank 0
|
||||
*/
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000
|
||||
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000
|
||||
}
|
||||
|
||||
/* Linker script to place sections and symbol values. Should be used together
|
||||
* with other linker script that defines memory regions FLASH and RAM.
|
||||
* It references following symbols, which must be defined in code:
|
||||
* Reset_Handler : Entry of reset handler
|
||||
*
|
||||
* It defines following symbols, which code can use without definition:
|
||||
* __exidx_start
|
||||
* __exidx_end
|
||||
* __copy_table_start__
|
||||
* __copy_table_end__
|
||||
* __zero_table_start__
|
||||
* __zero_table_end__
|
||||
* __etext
|
||||
* __data_start__
|
||||
* __preinit_array_start
|
||||
* __preinit_array_end
|
||||
* __init_array_start
|
||||
* __init_array_end
|
||||
* __fini_array_start
|
||||
* __fini_array_end
|
||||
* __data_end__
|
||||
* __bss_start__
|
||||
* __bss_end__
|
||||
* __end__
|
||||
* end
|
||||
* __HeapLimit
|
||||
* __StackLimit
|
||||
* __StackTop
|
||||
* __stack
|
||||
* __ram_end__
|
||||
*/
|
||||
ENTRY(Reset_Handler)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
KEEP(*(.isr_vector))
|
||||
*(.text*)
|
||||
|
||||
KEEP(*(.init))
|
||||
KEEP(*(.fini))
|
||||
|
||||
/* .ctors */
|
||||
*crtbegin.o(.ctors)
|
||||
*crtbegin?.o(.ctors)
|
||||
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
|
||||
*(SORT(.ctors.*))
|
||||
*(.ctors)
|
||||
|
||||
/* .dtors */
|
||||
*crtbegin.o(.dtors)
|
||||
*crtbegin?.o(.dtors)
|
||||
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
|
||||
*(SORT(.dtors.*))
|
||||
*(.dtors)
|
||||
|
||||
*(.rodata*)
|
||||
|
||||
KEEP(*(.eh_frame*))
|
||||
} > FLASH
|
||||
|
||||
.ARM.extab :
|
||||
{
|
||||
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||
} > FLASH
|
||||
|
||||
__exidx_start = .;
|
||||
.ARM.exidx :
|
||||
{
|
||||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||||
} > FLASH
|
||||
__exidx_end = .;
|
||||
|
||||
/* To copy multiple ROM to RAM sections,
|
||||
* uncomment .copy.table section and,
|
||||
* define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */
|
||||
/*
|
||||
.copy.table :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__copy_table_start__ = .;
|
||||
LONG (__etext)
|
||||
LONG (__data_start__)
|
||||
LONG (__data_end__ - __data_start__)
|
||||
LONG (__etext2)
|
||||
LONG (__data2_start__)
|
||||
LONG (__data2_end__ - __data2_start__)
|
||||
__copy_table_end__ = .;
|
||||
} > FLASH
|
||||
*/
|
||||
|
||||
/* To clear multiple BSS sections,
|
||||
* uncomment .zero.table section and,
|
||||
* define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */
|
||||
/*
|
||||
.zero.table :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__zero_table_start__ = .;
|
||||
LONG (__bss_start__)
|
||||
LONG (__bss_end__ - __bss_start__)
|
||||
LONG (__bss2_start__)
|
||||
LONG (__bss2_end__ - __bss2_start__)
|
||||
__zero_table_end__ = .;
|
||||
} > FLASH
|
||||
*/
|
||||
|
||||
__etext = .;
|
||||
|
||||
.data : AT (__etext)
|
||||
{
|
||||
__data_start__ = .;
|
||||
*(vtable)
|
||||
*(.data*)
|
||||
|
||||
. = ALIGN(4);
|
||||
/* preinit data */
|
||||
PROVIDE_HIDDEN (__preinit_array_start = .);
|
||||
KEEP(*(.preinit_array))
|
||||
PROVIDE_HIDDEN (__preinit_array_end = .);
|
||||
|
||||
. = ALIGN(4);
|
||||
/* init data */
|
||||
PROVIDE_HIDDEN (__init_array_start = .);
|
||||
KEEP(*(SORT(.init_array.*)))
|
||||
KEEP(*(.init_array))
|
||||
PROVIDE_HIDDEN (__init_array_end = .);
|
||||
|
||||
|
||||
. = ALIGN(4);
|
||||
/* finit data */
|
||||
PROVIDE_HIDDEN (__fini_array_start = .);
|
||||
KEEP(*(SORT(.fini_array.*)))
|
||||
KEEP(*(.fini_array))
|
||||
PROVIDE_HIDDEN (__fini_array_end = .);
|
||||
|
||||
KEEP(*(.jcr*))
|
||||
. = ALIGN(4);
|
||||
/* All data end */
|
||||
__data_end__ = .;
|
||||
|
||||
} > RAM
|
||||
|
||||
.bss :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__bss_start__ = .;
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
__bss_end__ = .;
|
||||
} > RAM
|
||||
|
||||
.heap (COPY):
|
||||
{
|
||||
__end__ = .;
|
||||
PROVIDE(end = .);
|
||||
*(.heap*)
|
||||
__HeapLimit = .;
|
||||
} > RAM
|
||||
|
||||
/* .stack_dummy section doesn't contains any symbols. It is only
|
||||
* used for linker to calculate size of stack sections, and assign
|
||||
* values to stack symbols later */
|
||||
.stack_dummy (COPY):
|
||||
{
|
||||
*(.stack*)
|
||||
} > RAM
|
||||
|
||||
/* Set stack top to end of RAM, and stack limit move down by
|
||||
* size of stack_dummy section */
|
||||
__StackTop = ORIGIN(RAM) + LENGTH(RAM) ;
|
||||
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
|
||||
PROVIDE(__stack = __StackTop);
|
||||
|
||||
__ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ;
|
||||
|
||||
/* Check if data + heap + stack exceeds RAM limit */
|
||||
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
#
|
||||
# Adafruit Gemma M0 OpenOCD script.
|
||||
#
|
||||
# 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
|
||||
#
|
||||
|
||||
# chip name
|
||||
set CHIPNAME at91samd21g18
|
||||
set ENDIAN little
|
||||
|
||||
# choose a port here
|
||||
set telnet_port 0
|
||||
|
||||
source [find target/at91samdXX.cfg]
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
// API compatibility
|
||||
#include "variant.h"
|
||||
|
||||
|
|
@ -1,100 +0,0 @@
|
|||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
|
||||
#include "variant.h"
|
||||
|
||||
/*
|
||||
* Pins descriptions
|
||||
*/
|
||||
const PinDescription g_APinDescription[]=
|
||||
{
|
||||
// GPIO 0 - I2S Data
|
||||
{ PORTA, 8, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER|PIN_ATTR_ANALOG), ADC_Channel16, PWM0_CH0, TCC0_CH0, EXTERNAL_INT_NMI },
|
||||
|
||||
// GPIO 1 - Cap touch 1
|
||||
{ PORTA, 2, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel0, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_2 }, // ADC/AIN[0]
|
||||
|
||||
// GPIO 2 - Cap touch 2
|
||||
{ PORTA, 4, PIO_ANALOG, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), ADC_Channel4, PWM0_CH0, TCC0_CH0, EXTERNAL_INT_4 }, // TCC0/WO[0]
|
||||
|
||||
// GPIO 3 - Cap touch 3
|
||||
{ PORTA, 6, PIO_ANALOG, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), ADC_Channel6, PWM1_CH0, TCC1_CH0, EXTERNAL_INT_6 }, // TCC1/WO[0]
|
||||
|
||||
// GPIO 4 - Cap touch 4
|
||||
{ PORTA, 7, PIO_ANALOG, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), ADC_Channel7, PWM1_CH1, TCC1_CH1, EXTERNAL_INT_7 }, // TCC1/WO[1]
|
||||
|
||||
// GPIO 5 - Stemma I2C SDA
|
||||
{ PORTA, 0, PIO_SERCOM_ALT, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_0 }, // SDA
|
||||
|
||||
// GPIO 6 - Stemma I2C SCL
|
||||
{ PORTA, 1, PIO_SERCOM_ALT, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_1 }, // SCL
|
||||
|
||||
// GPIO 7 - PDM clock
|
||||
{ PORTA, 10, PIO_DIGITAL, (PIN_ATTR_DIGITAL|PIN_ATTR_ANALOG), ADC_Channel18, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_10 },
|
||||
|
||||
// D8/A0 - CT1
|
||||
{ PORTA, 2, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel0, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_2 }, // ADC/AIN[0]
|
||||
// D9/A1 - CT2
|
||||
{ PORTA, 4, PIO_ANALOG, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), ADC_Channel4, PWM0_CH0, TCC0_CH0, EXTERNAL_INT_4 }, // TCC0/WO[0]
|
||||
// D10/A2 - CT3
|
||||
{ PORTA, 6, PIO_ANALOG, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), ADC_Channel6, PWM1_CH0, TCC1_CH0, EXTERNAL_INT_6 }, // TCC1/WO[0]
|
||||
// D11/A3 - CT4
|
||||
{ PORTA, 7, PIO_ANALOG, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), ADC_Channel7, PWM1_CH1, TCC1_CH1, EXTERNAL_INT_7 }, // TCC1/WO[1]
|
||||
|
||||
// D12/A4 - Light
|
||||
{ PORTA, 11, PIO_ANALOG, (PIN_ATTR_DIGITAL|PIN_ATTR_ANALOG), ADC_Channel19, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_11 },
|
||||
|
||||
// D13 - LED
|
||||
{ PORTA, 3, PIO_DIGITAL, 0, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // LED
|
||||
|
||||
// GPIO 14 - NeoPixel
|
||||
{ PORTA, 5, PIO_TIMER, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), ADC_Channel5, PWM0_CH1, TCC0_CH1, EXTERNAL_INT_5 },
|
||||
|
||||
// GPIO 15 & 16 (SWCLK & SWDIO)
|
||||
// --------------------------
|
||||
{ PORTA, 30, PIO_TIMER, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE },
|
||||
{ PORTA, 31, PIO_TIMER, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE },
|
||||
|
||||
// 17..19 - USB
|
||||
// --------------------
|
||||
{ PORTA, 28, PIO_COM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // USB Host enable
|
||||
{ PORTA, 24, PIO_COM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // USB/DM
|
||||
{ PORTA, 25, PIO_COM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // USB/DP
|
||||
} ;
|
||||
|
||||
const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM]={ TCC0, TCC1, TCC2, TC3, TC4, TC5 } ;
|
||||
|
||||
// Multi-serial objects instantiation
|
||||
SERCOM sercom0( SERCOM0 ) ;
|
||||
SERCOM sercom1( SERCOM1 ) ;
|
||||
SERCOM sercom2( SERCOM2 ) ;
|
||||
SERCOM sercom3( SERCOM3 ) ;
|
||||
|
||||
Uart Serial1( &sercom0, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ;
|
||||
|
||||
|
||||
// If wire.h isnt included, just do nothing
|
||||
void WIRE_IT_HANDLER(void) __attribute__ ((weak));
|
||||
|
||||
void SERCOM1_Handler()
|
||||
{
|
||||
Serial1.IrqHandler();
|
||||
WIRE_IT_HANDLER();
|
||||
}
|
||||
|
||||
|
|
@ -1,192 +0,0 @@
|
|||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
#ifndef _VARIANT_ADAFRUIT_BLMBADGE_
|
||||
#define _VARIANT_ADAFRUIT_BLMBADGE_
|
||||
|
||||
// The definitions here needs a SAMD core >=1.6.6
|
||||
#define ARDUINO_SAMD_VARIANT_COMPLIANCE 10606
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Definitions
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/** Frequency of the board main oscillator */
|
||||
#define VARIANT_MAINOSC (32768ul)
|
||||
|
||||
/** Master clock frequency */
|
||||
#define VARIANT_MCK (F_CPU)
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Headers
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "WVariant.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include "SERCOM.h"
|
||||
#include "Uart.h"
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Pins
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
// Number of pins defined in PinDescription array
|
||||
#define PINS_COUNT (20u)
|
||||
#define NUM_DIGITAL_PINS (17u)
|
||||
#define NUM_ANALOG_INPUTS (5u)
|
||||
#define NUM_ANALOG_OUTPUTS (1u)
|
||||
#define analogInputToDigitalPin(p) ((p < 3u) ? (p) + PIN_A0 : -1)
|
||||
|
||||
#define digitalPinToPort(P) ( &(PORT->Group[g_APinDescription[P].ulPort]) )
|
||||
#define digitalPinToBitMask(P) ( 1 << g_APinDescription[P].ulPin )
|
||||
//#define analogInPinToBit(P) ( )
|
||||
#define portOutputRegister(port) ( &(port->OUT.reg) )
|
||||
#define portInputRegister(port) ( &(port->IN.reg) )
|
||||
#define portModeRegister(port) ( &(port->DIR.reg) )
|
||||
#define digitalPinHasPWM(P) ( g_APinDescription[P].ulPWMChannel != NOT_ON_PWM || g_APinDescription[P].ulTCChannel != NOT_ON_TIMER )
|
||||
|
||||
/*
|
||||
* digitalPinToTimer(..) is AVR-specific and is not defined for SAMD
|
||||
* architecture. If you need to check if a pin supports PWM you must
|
||||
* use digitalPinHasPWM(..).
|
||||
*
|
||||
* https://github.com/arduino/Arduino/issues/1833
|
||||
*/
|
||||
// #define digitalPinToTimer(P)
|
||||
|
||||
// LEDs
|
||||
#define PIN_LED_13 (13u)
|
||||
#define PIN_LED_RXL (13u)
|
||||
#define PIN_LED_TXL (13u)
|
||||
#define PIN_LED PIN_LED_13
|
||||
#define PIN_LED2 PIN_LED_RXL
|
||||
#define PIN_LED3 PIN_LED_TXL
|
||||
#define LED_BUILTIN PIN_LED_13
|
||||
|
||||
// Neopixel LED
|
||||
#define PIN_NEOPIXEL 14
|
||||
#define NEOPIXEL_NUM 6
|
||||
|
||||
/*
|
||||
* Analog pins
|
||||
*/
|
||||
#define PIN_A0 (8ul)
|
||||
#define PIN_A1 (9ul)
|
||||
#define PIN_A2 (10ul)
|
||||
#define PIN_A3 (11ul)
|
||||
#define PIN_A4 (12ul)
|
||||
|
||||
#define PIN_DAC0 (PIN_A0)
|
||||
|
||||
static const uint8_t A0 = PIN_A0;
|
||||
static const uint8_t A1 = PIN_A1;
|
||||
static const uint8_t A2 = PIN_A2;
|
||||
static const uint8_t A3 = PIN_A3;
|
||||
static const uint8_t A4 = PIN_A4;
|
||||
static const uint8_t DAC0 = PIN_DAC0;
|
||||
|
||||
#define ADC_RESOLUTION 12
|
||||
|
||||
/*
|
||||
* Serial interfaces
|
||||
*/
|
||||
|
||||
// Serial1 (sercom 0)
|
||||
#define PIN_SERIAL1_RX (6ul) // same as SCL
|
||||
#define PAD_SERIAL1_RX (SERCOM_RX_PAD_1)
|
||||
#define PIN_SERIAL1_TX (5ul) // same as SDA
|
||||
#define PAD_SERIAL1_TX (UART_TX_PAD_0)
|
||||
|
||||
/*
|
||||
* SPI Interfaces
|
||||
*/
|
||||
#define SPI_INTERFACES_COUNT 0 // we'll just have SPI CLK and MOSI on sercom 0, no MISO
|
||||
|
||||
/*
|
||||
* Wire Interfaces
|
||||
*/
|
||||
#define WIRE_INTERFACES_COUNT 1
|
||||
|
||||
#define PIN_WIRE_SDA (5u)
|
||||
#define PIN_WIRE_SCL (6u)
|
||||
#define PERIPH_WIRE sercom1
|
||||
//#define WIRE_IT_HANDLER // hack! we call the i2c handler from within the serial handler!
|
||||
|
||||
static const uint8_t SDA = PIN_WIRE_SDA;
|
||||
static const uint8_t SCL = PIN_WIRE_SCL;
|
||||
|
||||
/*
|
||||
* USB
|
||||
*/
|
||||
#define PIN_USB_HOST_ENABLE (17ul)
|
||||
#define PIN_USB_DM (18ul)
|
||||
#define PIN_USB_DP (19ul)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Arduino objects - C++ only
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
/* =========================
|
||||
* ===== SERCOM DEFINITION
|
||||
* =========================
|
||||
*/
|
||||
extern SERCOM sercom0;
|
||||
extern SERCOM sercom1;
|
||||
extern SERCOM sercom2;
|
||||
extern SERCOM sercom3;
|
||||
|
||||
extern Uart Serial1;
|
||||
|
||||
#endif
|
||||
|
||||
// These serial port names are intended to allow libraries and architecture-neutral
|
||||
// sketches to automatically default to the correct port name for a particular type
|
||||
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
|
||||
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
|
||||
//
|
||||
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
|
||||
//
|
||||
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
|
||||
//
|
||||
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
|
||||
//
|
||||
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
|
||||
//
|
||||
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
|
||||
// pins are NOT connected to anything by default.
|
||||
#define SERIAL_PORT_USBVIRTUAL Serial
|
||||
#define SERIAL_PORT_MONITOR Serial
|
||||
// Serial has no physical pins broken out, so it's not listed as HARDWARE port
|
||||
#define SERIAL_PORT_HARDWARE Serial1
|
||||
#define SERIAL_PORT_HARDWARE_OPEN Serial1
|
||||
|
||||
#endif /* _VARIANT_ADAFRUIT_BLMBADGE_ */
|
||||
|
||||
|
|
@ -51,10 +51,7 @@
|
|||
#define portInputRegister(port) (&(port->IN.reg))
|
||||
#define portModeRegister(port) (&(port->DIR.reg))
|
||||
#define digitalPinHasPWM(P) (g_APinDescription[P].ulPWMChannel != NOT_ON_PWM || g_APinDescription[P].ulTCChannel != NOT_ON_TIMER)
|
||||
|
||||
#if (ARDUINO_SAMD_VARIANT_COMPLIANCE < 10606)
|
||||
#define digitalPinToInterrupt(P) (g_APinDescription[P].ulExtInt)
|
||||
#endif
|
||||
#define digitalPinToInterrupt(P) (g_APinDescription[P].ulExtInt)
|
||||
|
||||
/*
|
||||
* digitalPinToTimer(..) is AVR-specific and is not defined for SAMD
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ const PinDescription g_APinDescription[]=
|
|||
{ PORTA, 7, PIO_ANALOG, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), ADC_Channel7, PWM1_CH1, TCC1_CH1, EXTERNAL_INT_7 }, // Captouch 4
|
||||
|
||||
// A13 - VIN sense pin
|
||||
{ PORTB, 3, PIO_ANALOG, 0, ADC_Channel11, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_3 }, // VIN sense divider
|
||||
{ PORTB, 3, PIO_ANALOG, 0, ADC_Channel11, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_2 }, // VIN sense divider
|
||||
|
||||
/**************/
|
||||
// 28..31 - 4 Motor PWM pins
|
||||
|
|
@ -88,7 +88,7 @@ const PinDescription g_APinDescription[]=
|
|||
{ PORTA, 25, PIO_COM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // USB/DP
|
||||
|
||||
// 35..36 - fake sercom 5 serial
|
||||
{ PORTB, 2, PIO_SERCOM_ALT, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_2 }, // Sercom 5.0 UART TX
|
||||
{ PORTB, 2, PIO_SERCOM_ALT, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_3 }, // Sercom 5.0 UART TX
|
||||
{ PORTB, 23, PIO_SERCOM_ALT, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_7 }, // Sercom 5.3 UART RX
|
||||
|
||||
} ;
|
||||
|
|
|
|||
|
|
@ -62,8 +62,8 @@ const PinDescription g_APinDescription[]=
|
|||
{ PORTA, 5, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel5, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_5 },
|
||||
{ PORTB, 8, PIO_ANALOG, (PIN_ATTR_ANALOG|PIN_ATTR_PWM_E), ADC_Channel2, TC4_CH0, TC4_CH0, EXTERNAL_INT_8 },
|
||||
{ PORTB, 9, PIO_ANALOG, (PIN_ATTR_ANALOG|PIN_ATTR_PWM_E), ADC_Channel3, TC4_CH1, TC4_CH1, EXTERNAL_INT_9 },
|
||||
{ PORTA, 4, PIO_ANALOG, (PIN_ATTR_ANALOG|PIN_ATTR_PWM_E), ADC_Channel4, TC0_CH0, TC0_CH0, EXTERNAL_INT_4 },
|
||||
{ PORTA, 6, PIO_ANALOG, (PIN_ATTR_ANALOG|PIN_ATTR_PWM_E), ADC_Channel6, TC1_CH0, TC1_CH0, EXTERNAL_INT_6 },
|
||||
{ PORTA, 4, PIO_ANALOG, (PIN_ATTR_ANALOG|PIN_ATTR_PWM_E), ADC_Channel4, TC0_CH0, TC0_CH0, EXTERNAL_INT_6 },
|
||||
{ PORTA, 6, PIO_ANALOG, (PIN_ATTR_ANALOG|PIN_ATTR_PWM_E), ADC_Channel6, TC1_CH0, TC1_CH0, EXTERNAL_INT_10 },
|
||||
|
||||
// A6, D20 - VDiv!
|
||||
{ PORTB, 1, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel13, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_1 },
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ const PinDescription g_APinDescription[]=
|
|||
|
||||
// GPIO 3 & 4 - DotStar internal data/clock
|
||||
// ----------------------------------------
|
||||
{ PORTA, 0, PIO_DIGITAL, 0, ADC_Channel4, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_0 }, // ADC/AIN[4]
|
||||
{ PORTA, 1, PIO_DIGITAL, 0, ADC_Channel5, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_1 }, // ADC/AIN[5]
|
||||
{ PORTA, 0, PIO_DIGITAL, 0, ADC_Channel4, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_4 }, // ADC/AIN[4]
|
||||
{ PORTA, 1, PIO_DIGITAL, 0, ADC_Channel5, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_5 }, // ADC/AIN[5]
|
||||
|
||||
// GPIO 5, 6, 7 (USB interface)
|
||||
// ----------------------------
|
||||
|
|
|
|||
|
|
@ -181,8 +181,6 @@ const PinDescription g_APinDescription[]=
|
|||
// ----------------------
|
||||
// 95 SD detect
|
||||
{ PORTB, 31, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_15 },
|
||||
// 96 SWO (on debug header)
|
||||
{ PORTB, 30, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_14 },
|
||||
} ;
|
||||
|
||||
const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM]={ TCC0, TCC1, TCC2, TCC3, TCC4, TC0, TC1, TC2, TC3, TC4, TC5, TC6, TC7 } ;
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ extern "C"
|
|||
*----------------------------------------------------------------------------*/
|
||||
|
||||
// Number of pins defined in PinDescription array
|
||||
#define PINS_COUNT (96)
|
||||
#define PINS_COUNT (94)
|
||||
#define NUM_DIGITAL_PINS (53)
|
||||
#define NUM_ANALOG_INPUTS (19)
|
||||
#define NUM_ANALOG_OUTPUTS (2)
|
||||
|
|
|
|||
|
|
@ -54,14 +54,14 @@ const PinDescription g_APinDescription[]=
|
|||
// --------------------
|
||||
{ PORTA, 2, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel0, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_2 }, // A0 (DAC0)
|
||||
{ PORTA, 5, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel5, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_5 }, // A1 (DAC1)
|
||||
{ PORTA, 6, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel6, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_6 }, // A2
|
||||
{ PORTA, 6, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel6, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_10 }, // A2
|
||||
{ PORTB, 9, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel3, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_9 }, // A3
|
||||
{ PORTB, 8, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel2, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_8 }, // A4
|
||||
{ PORTA, 4, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel4, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_4 }, // A5
|
||||
{ PORTA, 4, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel4, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_6 }, // A5
|
||||
|
||||
{ PORTB, 1, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel13, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_1 }, // A6, D20 - vbatt
|
||||
{ PORTB, 4, PIO_ANALOG, PIN_ATTR_ANALOG_ALT, ADC_Channel6, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_4 }, // A7, D21 - Light
|
||||
{ PORTB, 3, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel15, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_3 }, // A8 / D2
|
||||
{ PORTB, 3, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel15, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_2 }, // A8 / D2
|
||||
{ PORTB, 2, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel14, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_2 }, // A9 / D3
|
||||
|
||||
// 24..25 I2C pins (SDA/SCL)
|
||||
|
|
|
|||
|
|
@ -1,216 +0,0 @@
|
|||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
/* Linker script to configure memory regions.
|
||||
* Need modifying for a specific board.
|
||||
* FLASH.ORIGIN: starting address of flash
|
||||
* FLASH.LENGTH: length of flash
|
||||
* RAM.ORIGIN: starting address of RAM bank 0
|
||||
* RAM.LENGTH: length of RAM bank 0
|
||||
*/
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x00000000+0x4000, LENGTH = 0x00080000-0x4000 /* First 16KB used by bootloader */
|
||||
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00030000
|
||||
}
|
||||
|
||||
/* Linker script to place sections and symbol values. Should be used together
|
||||
* with other linker script that defines memory regions FLASH and RAM.
|
||||
* It references following symbols, which must be defined in code:
|
||||
* Reset_Handler : Entry of reset handler
|
||||
*
|
||||
* It defines following symbols, which code can use without definition:
|
||||
* __exidx_start
|
||||
* __exidx_end
|
||||
* __copy_table_start__
|
||||
* __copy_table_end__
|
||||
* __zero_table_start__
|
||||
* __zero_table_end__
|
||||
* __etext
|
||||
* __data_start__
|
||||
* __preinit_array_start
|
||||
* __preinit_array_end
|
||||
* __init_array_start
|
||||
* __init_array_end
|
||||
* __fini_array_start
|
||||
* __fini_array_end
|
||||
* __data_end__
|
||||
* __bss_start__
|
||||
* __bss_end__
|
||||
* __end__
|
||||
* end
|
||||
* __HeapLimit
|
||||
* __StackLimit
|
||||
* __StackTop
|
||||
* __stack
|
||||
*/
|
||||
ENTRY(Reset_Handler)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
__text_start__ = .;
|
||||
|
||||
KEEP(*(.sketch_boot))
|
||||
|
||||
. = ALIGN(0x4000);
|
||||
KEEP(*(.isr_vector))
|
||||
*(.text*)
|
||||
|
||||
KEEP(*(.init))
|
||||
KEEP(*(.fini))
|
||||
|
||||
/* .ctors */
|
||||
*crtbegin.o(.ctors)
|
||||
*crtbegin?.o(.ctors)
|
||||
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
|
||||
*(SORT(.ctors.*))
|
||||
*(.ctors)
|
||||
|
||||
/* .dtors */
|
||||
*crtbegin.o(.dtors)
|
||||
*crtbegin?.o(.dtors)
|
||||
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
|
||||
*(SORT(.dtors.*))
|
||||
*(.dtors)
|
||||
|
||||
*(.rodata*)
|
||||
|
||||
KEEP(*(.eh_frame*))
|
||||
} > FLASH
|
||||
|
||||
.ARM.extab :
|
||||
{
|
||||
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||
} > FLASH
|
||||
|
||||
__exidx_start = .;
|
||||
.ARM.exidx :
|
||||
{
|
||||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||||
} > FLASH
|
||||
__exidx_end = .;
|
||||
|
||||
/* To copy multiple ROM to RAM sections,
|
||||
* uncomment .copy.table section and,
|
||||
* define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */
|
||||
/*
|
||||
.copy.table :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__copy_table_start__ = .;
|
||||
LONG (__etext)
|
||||
LONG (__data_start__)
|
||||
LONG (__data_end__ - __data_start__)
|
||||
LONG (__etext2)
|
||||
LONG (__data2_start__)
|
||||
LONG (__data2_end__ - __data2_start__)
|
||||
__copy_table_end__ = .;
|
||||
} > FLASH
|
||||
*/
|
||||
|
||||
/* To clear multiple BSS sections,
|
||||
* uncomment .zero.table section and,
|
||||
* define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */
|
||||
/*
|
||||
.zero.table :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__zero_table_start__ = .;
|
||||
LONG (__bss_start__)
|
||||
LONG (__bss_end__ - __bss_start__)
|
||||
LONG (__bss2_start__)
|
||||
LONG (__bss2_end__ - __bss2_start__)
|
||||
__zero_table_end__ = .;
|
||||
} > FLASH
|
||||
*/
|
||||
|
||||
__etext = .;
|
||||
|
||||
.data : AT (__etext)
|
||||
{
|
||||
__data_start__ = .;
|
||||
*(vtable)
|
||||
*(.data*)
|
||||
|
||||
. = ALIGN(4);
|
||||
/* preinit data */
|
||||
PROVIDE_HIDDEN (__preinit_array_start = .);
|
||||
KEEP(*(.preinit_array))
|
||||
PROVIDE_HIDDEN (__preinit_array_end = .);
|
||||
|
||||
. = ALIGN(4);
|
||||
/* init data */
|
||||
PROVIDE_HIDDEN (__init_array_start = .);
|
||||
KEEP(*(SORT(.init_array.*)))
|
||||
KEEP(*(.init_array))
|
||||
PROVIDE_HIDDEN (__init_array_end = .);
|
||||
|
||||
|
||||
. = ALIGN(4);
|
||||
/* finit data */
|
||||
PROVIDE_HIDDEN (__fini_array_start = .);
|
||||
KEEP(*(SORT(.fini_array.*)))
|
||||
KEEP(*(.fini_array))
|
||||
PROVIDE_HIDDEN (__fini_array_end = .);
|
||||
|
||||
KEEP(*(.jcr*))
|
||||
. = ALIGN(16);
|
||||
/* All data end */
|
||||
__data_end__ = .;
|
||||
|
||||
} > RAM
|
||||
|
||||
.bss :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__bss_start__ = .;
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
__bss_end__ = .;
|
||||
} > RAM
|
||||
|
||||
.heap (COPY):
|
||||
{
|
||||
__end__ = .;
|
||||
PROVIDE(end = .);
|
||||
*(.heap*)
|
||||
__HeapLimit = .;
|
||||
} > RAM
|
||||
|
||||
/* .stack_dummy section doesn't contains any symbols. It is only
|
||||
* used for linker to calculate size of stack sections, and assign
|
||||
* values to stack symbols later */
|
||||
.stack_dummy (COPY):
|
||||
{
|
||||
*(.stack*)
|
||||
} > RAM
|
||||
|
||||
/* Set stack top to end of RAM, and stack limit move down by
|
||||
* size of stack_dummy section */
|
||||
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
|
||||
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
|
||||
PROVIDE(__stack = __StackTop);
|
||||
|
||||
__ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ;
|
||||
|
||||
/* Check if data + heap + stack exceeds RAM limit */
|
||||
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
|
||||
}
|
||||
|
|
@ -1,214 +0,0 @@
|
|||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
/* Linker script to configure memory regions.
|
||||
* Need modifying for a specific board.
|
||||
* FLASH.ORIGIN: starting address of flash
|
||||
* FLASH.LENGTH: length of flash
|
||||
* RAM.ORIGIN: starting address of RAM bank 0
|
||||
* RAM.LENGTH: length of RAM bank 0
|
||||
*/
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00080000
|
||||
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00030000
|
||||
}
|
||||
|
||||
/* Linker script to place sections and symbol values. Should be used together
|
||||
* with other linker script that defines memory regions FLASH and RAM.
|
||||
* It references following symbols, which must be defined in code:
|
||||
* Reset_Handler : Entry of reset handler
|
||||
*
|
||||
* It defines following symbols, which code can use without definition:
|
||||
* __exidx_start
|
||||
* __exidx_end
|
||||
* __copy_table_start__
|
||||
* __copy_table_end__
|
||||
* __zero_table_start__
|
||||
* __zero_table_end__
|
||||
* __etext
|
||||
* __data_start__
|
||||
* __preinit_array_start
|
||||
* __preinit_array_end
|
||||
* __init_array_start
|
||||
* __init_array_end
|
||||
* __fini_array_start
|
||||
* __fini_array_end
|
||||
* __data_end__
|
||||
* __bss_start__
|
||||
* __bss_end__
|
||||
* __end__
|
||||
* end
|
||||
* __HeapLimit
|
||||
* __StackLimit
|
||||
* __StackTop
|
||||
* __stack
|
||||
* __ram_end__
|
||||
*/
|
||||
ENTRY(Reset_Handler)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
__text_start__ = .;
|
||||
|
||||
KEEP(*(.isr_vector))
|
||||
*(.text*)
|
||||
|
||||
KEEP(*(.init))
|
||||
KEEP(*(.fini))
|
||||
|
||||
/* .ctors */
|
||||
*crtbegin.o(.ctors)
|
||||
*crtbegin?.o(.ctors)
|
||||
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
|
||||
*(SORT(.ctors.*))
|
||||
*(.ctors)
|
||||
|
||||
/* .dtors */
|
||||
*crtbegin.o(.dtors)
|
||||
*crtbegin?.o(.dtors)
|
||||
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
|
||||
*(SORT(.dtors.*))
|
||||
*(.dtors)
|
||||
|
||||
*(.rodata*)
|
||||
|
||||
KEEP(*(.eh_frame*))
|
||||
} > FLASH
|
||||
|
||||
.ARM.extab :
|
||||
{
|
||||
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||
} > FLASH
|
||||
|
||||
__exidx_start = .;
|
||||
.ARM.exidx :
|
||||
{
|
||||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||||
} > FLASH
|
||||
__exidx_end = .;
|
||||
|
||||
/* To copy multiple ROM to RAM sections,
|
||||
* uncomment .copy.table section and,
|
||||
* define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */
|
||||
/*
|
||||
.copy.table :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__copy_table_start__ = .;
|
||||
LONG (__etext)
|
||||
LONG (__data_start__)
|
||||
LONG (__data_end__ - __data_start__)
|
||||
LONG (__etext2)
|
||||
LONG (__data2_start__)
|
||||
LONG (__data2_end__ - __data2_start__)
|
||||
__copy_table_end__ = .;
|
||||
} > FLASH
|
||||
*/
|
||||
|
||||
/* To clear multiple BSS sections,
|
||||
* uncomment .zero.table section and,
|
||||
* define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */
|
||||
/*
|
||||
.zero.table :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__zero_table_start__ = .;
|
||||
LONG (__bss_start__)
|
||||
LONG (__bss_end__ - __bss_start__)
|
||||
LONG (__bss2_start__)
|
||||
LONG (__bss2_end__ - __bss2_start__)
|
||||
__zero_table_end__ = .;
|
||||
} > FLASH
|
||||
*/
|
||||
|
||||
__etext = .;
|
||||
|
||||
.data : AT (__etext)
|
||||
{
|
||||
__data_start__ = .;
|
||||
*(vtable)
|
||||
*(.data*)
|
||||
|
||||
. = ALIGN(4);
|
||||
/* preinit data */
|
||||
PROVIDE_HIDDEN (__preinit_array_start = .);
|
||||
KEEP(*(.preinit_array))
|
||||
PROVIDE_HIDDEN (__preinit_array_end = .);
|
||||
|
||||
. = ALIGN(4);
|
||||
/* init data */
|
||||
PROVIDE_HIDDEN (__init_array_start = .);
|
||||
KEEP(*(SORT(.init_array.*)))
|
||||
KEEP(*(.init_array))
|
||||
PROVIDE_HIDDEN (__init_array_end = .);
|
||||
|
||||
|
||||
. = ALIGN(4);
|
||||
/* finit data */
|
||||
PROVIDE_HIDDEN (__fini_array_start = .);
|
||||
KEEP(*(SORT(.fini_array.*)))
|
||||
KEEP(*(.fini_array))
|
||||
PROVIDE_HIDDEN (__fini_array_end = .);
|
||||
|
||||
KEEP(*(.jcr*))
|
||||
. = ALIGN(16);
|
||||
/* All data end */
|
||||
__data_end__ = .;
|
||||
|
||||
} > RAM
|
||||
|
||||
.bss :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__bss_start__ = .;
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
__bss_end__ = .;
|
||||
} > RAM
|
||||
|
||||
.heap (COPY):
|
||||
{
|
||||
__end__ = .;
|
||||
PROVIDE(end = .);
|
||||
*(.heap*)
|
||||
__HeapLimit = .;
|
||||
} > RAM
|
||||
|
||||
/* .stack_dummy section doesn't contains any symbols. It is only
|
||||
* used for linker to calculate size of stack sections, and assign
|
||||
* values to stack symbols later */
|
||||
.stack_dummy (COPY):
|
||||
{
|
||||
*(.stack*)
|
||||
} > RAM
|
||||
|
||||
/* Set stack top to end of RAM, and stack limit move down by
|
||||
* size of stack_dummy section */
|
||||
__StackTop = ORIGIN(RAM) + LENGTH(RAM) ;
|
||||
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
|
||||
PROVIDE(__stack = __StackTop);
|
||||
|
||||
__ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ;
|
||||
|
||||
/* Check if data + heap + stack exceeds RAM limit */
|
||||
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
// API compatibility
|
||||
#include "variant.h"
|
||||
|
||||
|
|
@ -1,173 +0,0 @@
|
|||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
#include "variant.h"
|
||||
|
||||
/*
|
||||
* Pins descriptions
|
||||
*/
|
||||
|
||||
//TCC0 IOSET 6
|
||||
//TCC1 IOSET 1
|
||||
//TC0 IOSET 1
|
||||
//TC1 IOSET 1
|
||||
//TC2 IOSET 2
|
||||
//TC3 IOSET 1
|
||||
//TC4 IOSET 1
|
||||
const PinDescription g_APinDescription[]=
|
||||
{
|
||||
// 0..13 - Digital pins
|
||||
// ----------------------
|
||||
// 0/1 - SERCOM/UART (Serial1)
|
||||
{ PORTA, 1, PIO_SERCOM_ALT, PIN_ATTR_PWM_E, No_ADC_Channel, TC2_CH1, TC2_CH1, EXTERNAL_INT_1 }, // RX: SERCOM1/PAD[1]
|
||||
{ PORTA, 0, PIO_SERCOM_ALT, PIN_ATTR_PWM_E, No_ADC_Channel, TC2_CH0, TC2_CH0, EXTERNAL_INT_0 }, // TX: SERCOM1/PAD[0]
|
||||
|
||||
// 2..3 buttons
|
||||
{ PORTB, 22, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_6 }, // Up
|
||||
{ PORTB, 23, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_7 }, // Down
|
||||
|
||||
// 4 neopixel
|
||||
{ PORTA, 23, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_7 }, // NeoPixel
|
||||
|
||||
// 5..6 I2C
|
||||
{ PORTB, 31, PIO_SERCOM_ALT, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_15 }, // SERCOM5.1 SDA
|
||||
{ PORTB, 30, PIO_SERCOM_ALT, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_14 }, // SERCOM5.0 SCL
|
||||
|
||||
// 7..12 RGBRGB pins
|
||||
{ PORTB, 0, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_0 }, // R1
|
||||
{ PORTB, 1, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_1 }, // G1
|
||||
{ PORTB, 2, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_2 }, // B1
|
||||
{ PORTB, 3, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_3 }, // R2
|
||||
{ PORTB, 4, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_4 }, // G2
|
||||
{ PORTB, 5, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_5 }, // B2
|
||||
|
||||
// 13 LED
|
||||
{ PORTA, 14, PIO_DIGITAL, PIN_ATTR_PWM_G, No_ADC_Channel, TCC1_CH2, TCC1_CH2, EXTERNAL_INT_14 }, // Red LED
|
||||
|
||||
// 14..21 Control pins
|
||||
{ PORTB, 6, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_6 }, // CLK
|
||||
{ PORTB, 14, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_14 }, // LAT
|
||||
{ PORTB, 12, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_12 }, // OE
|
||||
{ PORTB, 7, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_7 }, // ADDR A
|
||||
{ PORTB, 8, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_8 }, // ADDR B
|
||||
{ PORTB, 9, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_9 }, // ADDR C
|
||||
{ PORTB, 15, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_15 }, // ADDR D
|
||||
{ PORTB, 13, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_13 }, // ADDR E
|
||||
|
||||
// 22..26 Analog pins
|
||||
// --------------------
|
||||
{ PORTA, 2, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel0, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_2 }, // A0
|
||||
{ PORTA, 5, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel5, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_5 }, // A1
|
||||
{ PORTA, 4, PIO_ANALOG, (PIN_ATTR_ANALOG|PIN_ATTR_PWM_E), ADC_Channel4, TC0_CH0, TC0_CH0, EXTERNAL_INT_4 }, // A2
|
||||
{ PORTA, 6, PIO_ANALOG, (PIN_ATTR_ANALOG|PIN_ATTR_PWM_E), ADC_Channel6, TC1_CH0, TC1_CH0, EXTERNAL_INT_6 }, // A3
|
||||
{ PORTA, 7, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel7, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_7 }, // A4
|
||||
|
||||
// 27..28 ESP UART
|
||||
// ----------------------
|
||||
{ PORTA, 12, PIO_SERCOM_ALT, PIN_ATTR_PWM_E, No_ADC_Channel, TC2_CH0, TC2_CH0, EXTERNAL_INT_12 }, // RX: SERCOM4/PAD[1]
|
||||
{ PORTA, 13, PIO_SERCOM_ALT, PIN_ATTR_PWM_E, No_ADC_Channel, TC2_CH1, TC2_CH1, EXTERNAL_INT_13 }, // TX: SERCOM4/PAD[0]
|
||||
|
||||
// 29..33 ESP control
|
||||
{ PORTA, 20, PIO_DIGITAL, PIN_ATTR_PWM_G, No_ADC_Channel, TCC0_CH0, NOT_ON_TIMER, EXTERNAL_INT_4 }, // ESP GPIO0
|
||||
{ PORTA, 21, PIO_DIGITAL, PIN_ATTR_PWM_G, No_ADC_Channel, TCC0_CH1, NOT_ON_TIMER, EXTERNAL_INT_5 }, // ESP Reset
|
||||
{ PORTA, 22, PIO_DIGITAL, PIN_ATTR_PWM_G, No_ADC_Channel, TCC0_CH2, NOT_ON_TIMER, EXTERNAL_INT_6 }, // ESP Busy
|
||||
{ PORTA, 18, PIO_DIGITAL, PIN_ATTR_PWM_F, No_ADC_Channel, TCC1_CH2, NOT_ON_TIMER, EXTERNAL_INT_2 }, // ESP RTS
|
||||
{ PORTB, 17, PIO_DIGITAL, PIN_ATTR_PWM_G, No_ADC_Channel, TCC0_CH4, NOT_ON_TIMER, EXTERNAL_INT_1 }, // ESP CS
|
||||
|
||||
// 34..36 ESP SPI
|
||||
{ PORTA, 16, PIO_SERCOM_ALT, PIN_ATTR_PWM_F, No_ADC_Channel, TCC1_CH0, TC2_CH0, EXTERNAL_INT_0 }, // SCK: SERCOM3/PAD[1]
|
||||
{ PORTA, 17, PIO_SERCOM_ALT, PIN_ATTR_PWM_F, No_ADC_Channel, TCC1_CH1, TC2_CH1, EXTERNAL_INT_1 }, // MISO: SERCOM3/PAD[0]
|
||||
{ PORTA, 19, PIO_SERCOM_ALT, PIN_ATTR_PWM_F, No_ADC_Channel, TCC1_CH3, TC3_CH1, EXTERNAL_INT_3 }, // MOSI: SERCOM1/PAD[3]
|
||||
|
||||
// 37..39 - USB
|
||||
// --------------------
|
||||
{ NOT_A_PORT, 0, PIO_NOT_A_PIN, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // USB Host enable DOES NOT EXIST ON THIS BOARD
|
||||
{ PORTA, 24, PIO_COM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // USB/DM
|
||||
{ PORTA, 27, PIO_COM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // USB/DP
|
||||
|
||||
// 40 (AREF)
|
||||
{ PORTA, 3, PIO_ANALOG, PIN_ATTR_ANALOG, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // DAC/VREFP
|
||||
|
||||
// ----------------------
|
||||
// 41..46 QSPI (SCK, CS, IO0, IO1, IO2, IO3)
|
||||
{ PORTB, 10, PIO_COM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE },
|
||||
{ PORTB, 11, PIO_COM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE },
|
||||
{ PORTA, 8, PIO_COM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE },
|
||||
{ PORTA, 9, PIO_COM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE },
|
||||
{ PORTA, 10, PIO_COM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE },
|
||||
{ PORTA, 11, PIO_COM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE },
|
||||
|
||||
// 47 LIS IRQ
|
||||
{ PORTA, 27, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_11 }, // IRQ
|
||||
|
||||
// 48..50 external SPI #2 on sercom 0
|
||||
{ PORTA, 5, PIO_SERCOM_ALT, PIN_ATTR_ANALOG, ADC_Channel5, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_5 }, // SCK SERCOM 0.1
|
||||
{ PORTA, 4, PIO_SERCOM_ALT, (PIN_ATTR_ANALOG|PIN_ATTR_PWM_E), ADC_Channel4, TC0_CH0, TC0_CH0, EXTERNAL_INT_4 }, // MOSI SERCOM 0.0
|
||||
{ PORTA, 7, PIO_SERCOM_ALT, PIN_ATTR_ANALOG, ADC_Channel7, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_7 }, // MISO SERCOM 0.3
|
||||
} ;
|
||||
|
||||
const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM]={ TCC0, TCC1, TCC2, TCC3, TCC4, TC0, TC1, TC2, TC3, TC4, TC5 } ;
|
||||
const uint32_t GCLK_CLKCTRL_IDs[TCC_INST_NUM+TC_INST_NUM] = { TCC0_GCLK_ID, TCC1_GCLK_ID, TCC2_GCLK_ID, TCC3_GCLK_ID, TCC4_GCLK_ID, TC0_GCLK_ID, TC1_GCLK_ID, TC2_GCLK_ID, TC3_GCLK_ID, TC4_GCLK_ID, TC5_GCLK_ID } ;
|
||||
|
||||
// Multi-serial objects instantiation
|
||||
SERCOM sercom0( SERCOM0 ) ;
|
||||
SERCOM sercom1( SERCOM1 ) ;
|
||||
SERCOM sercom2( SERCOM2 ) ;
|
||||
SERCOM sercom3( SERCOM3 ) ;
|
||||
SERCOM sercom4( SERCOM4 ) ;
|
||||
SERCOM sercom5( SERCOM5 ) ;
|
||||
|
||||
Uart Serial1( &sercom1, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ;
|
||||
|
||||
void SERCOM1_0_Handler()
|
||||
{
|
||||
Serial1.IrqHandler();
|
||||
}
|
||||
void SERCOM1_1_Handler()
|
||||
{
|
||||
Serial1.IrqHandler();
|
||||
}
|
||||
void SERCOM1_2_Handler()
|
||||
{
|
||||
Serial1.IrqHandler();
|
||||
}
|
||||
void SERCOM1_3_Handler()
|
||||
{
|
||||
Serial1.IrqHandler();
|
||||
}
|
||||
|
||||
|
||||
// sercom for internal ESP32 UART connection
|
||||
Uart Serial2( &sercom4, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX ) ;
|
||||
|
||||
void SERCOM4_0_Handler()
|
||||
{
|
||||
Serial2.IrqHandler();
|
||||
}
|
||||
void SERCOM4_1_Handler()
|
||||
{
|
||||
Serial2.IrqHandler();
|
||||
}
|
||||
void SERCOM4_2_Handler()
|
||||
{
|
||||
Serial2.IrqHandler();
|
||||
}
|
||||
void SERCOM4_3_Handler()
|
||||
{
|
||||
Serial2.IrqHandler();
|
||||
}
|
||||
|
|
@ -1,275 +0,0 @@
|
|||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
#ifndef _VARIANT_MATRIXPORTAL_M4_
|
||||
#define _VARIANT_MATRIXPORTAL_M4_
|
||||
|
||||
// The definitions here needs a SAMD core >=1.6.10
|
||||
#define ARDUINO_SAMD_VARIANT_COMPLIANCE 10610
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Definitions
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/** Frequency of the board main oscillator */
|
||||
#define VARIANT_MAINOSC (32768ul)
|
||||
|
||||
/** Master clock frequency */
|
||||
#define VARIANT_MCK (F_CPU)
|
||||
|
||||
#define VARIANT_GCLK0_FREQ (F_CPU)
|
||||
#define VARIANT_GCLK1_FREQ (48000000UL)
|
||||
#define VARIANT_GCLK2_FREQ (100000000UL)
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Headers
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "WVariant.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include "SERCOM.h"
|
||||
#include "Uart.h"
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Pins
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
// Number of pins defined in PinDescription array
|
||||
#define PINS_COUNT (40u)
|
||||
#define NUM_DIGITAL_PINS (20u)
|
||||
#define NUM_ANALOG_INPUTS (6u)
|
||||
#define NUM_ANALOG_OUTPUTS (1u)
|
||||
#define analogInputToDigitalPin(p) ((p < 6u) ? (p) + 14u : -1)
|
||||
|
||||
#define digitalPinToPort(P) ( &(PORT->Group[g_APinDescription[P].ulPort]) )
|
||||
#define digitalPinToBitMask(P) ( 1 << g_APinDescription[P].ulPin )
|
||||
//#define analogInPinToBit(P) ( )
|
||||
#define portOutputRegister(port) ( &(port->OUT.reg) )
|
||||
#define portInputRegister(port) ( &(port->IN.reg) )
|
||||
#define portModeRegister(port) ( &(port->DIR.reg) )
|
||||
#define digitalPinHasPWM(P) ( g_APinDescription[P].ulPWMChannel != NOT_ON_PWM || g_APinDescription[P].ulTCChannel != NOT_ON_TIMER )
|
||||
|
||||
/*
|
||||
* digitalPinToTimer(..) is AVR-specific and is not defined for SAMD
|
||||
* architecture. If you need to check if a pin supports PWM you must
|
||||
* use digitalPinHasPWM(..).
|
||||
*
|
||||
* https://github.com/arduino/Arduino/issues/1833
|
||||
*/
|
||||
// #define digitalPinToTimer(P)
|
||||
|
||||
// LEDs
|
||||
#define PIN_LED_47 (47u)
|
||||
//#define PIN_LED_RXL (25u)
|
||||
//#define PIN_LED_TXL (26u)
|
||||
#define PIN_LED PIN_LED_47
|
||||
//#define PIN_LED2 PIN_LED_RXL
|
||||
//#define PIN_LED3 PIN_LED_TXL
|
||||
#define LED_BUILTIN PIN_LED_47
|
||||
#define PIN_NEOPIXEL (4)
|
||||
|
||||
/*
|
||||
* Analog pins
|
||||
*/
|
||||
#define PIN_A0 (22ul)
|
||||
#define PIN_A1 (PIN_A0 + 1)
|
||||
#define PIN_A2 (PIN_A0 + 2)
|
||||
#define PIN_A3 (PIN_A0 + 3)
|
||||
#define PIN_A4 (PIN_A0 + 4)
|
||||
|
||||
#define PIN_DAC0 (22ul)
|
||||
#define PIN_DAC1 PIN_A1
|
||||
|
||||
static const uint8_t A0 = PIN_A0;
|
||||
static const uint8_t A1 = PIN_A1;
|
||||
static const uint8_t A2 = PIN_A2;
|
||||
static const uint8_t A3 = PIN_A3;
|
||||
static const uint8_t A4 = PIN_A4;
|
||||
|
||||
static const uint8_t DAC0 = PIN_DAC0;
|
||||
static const uint8_t DAC1 = PIN_DAC1;
|
||||
|
||||
#define ADC_RESOLUTION 12
|
||||
|
||||
|
||||
|
||||
/* WiFi interfaces */
|
||||
#define SerialESP32 Serial2
|
||||
#define SerialNina SerialESP32
|
||||
#define SPIWIFI SPI
|
||||
#define ESP32_GPIO0 29
|
||||
#define ESP32_RESETN 30
|
||||
#define SPIWIFI_SS 33
|
||||
#define SPIWIFI_ACK 31
|
||||
#define SPIWIFI_RESET ESP32_RESETN
|
||||
#define NINA_GPIO0 ESP32_GPIO0
|
||||
#define NINA_RESETN ESP32_RESETN
|
||||
#define NINA_ACK SPIWIFI_ACK
|
||||
#define NINA_CTS SPIWIFI_ACK
|
||||
#define NINA_RTS NINA_GPIO0
|
||||
|
||||
|
||||
/*
|
||||
* Serial interfaces
|
||||
*/
|
||||
|
||||
// Serial1
|
||||
#define PIN_SERIAL1_RX (0ul)
|
||||
#define PIN_SERIAL1_TX (1ul)
|
||||
#define PAD_SERIAL1_RX (SERCOM_RX_PAD_1)
|
||||
#define PAD_SERIAL1_TX (UART_TX_PAD_0)
|
||||
|
||||
// Serial2
|
||||
#define PIN_SERIAL2_RX (27ul)
|
||||
#define PIN_SERIAL2_TX (28ul)
|
||||
#define PAD_SERIAL2_RX (SERCOM_RX_PAD_1)
|
||||
#define PAD_SERIAL2_TX (UART_TX_PAD_0)
|
||||
|
||||
|
||||
/*
|
||||
* SPI Interfaces
|
||||
*/
|
||||
#define SPI_INTERFACES_COUNT 2
|
||||
|
||||
#define PIN_SPI_SCK (34u)
|
||||
#define PIN_SPI_MISO (35u)
|
||||
#define PIN_SPI_MOSI (36u)
|
||||
#define PERIPH_SPI sercom3
|
||||
#define PAD_SPI_TX SPI_PAD_3_SCK_1
|
||||
#define PAD_SPI_RX SERCOM_RX_PAD_0
|
||||
|
||||
static const uint8_t SS = 33 ;
|
||||
static const uint8_t MOSI = PIN_SPI_MOSI ;
|
||||
static const uint8_t MISO = PIN_SPI_MISO ;
|
||||
static const uint8_t SCK = PIN_SPI_SCK ;
|
||||
|
||||
|
||||
#define PIN_SPI1_SCK (48u)
|
||||
#define PIN_SPI1_MOSI (49u)
|
||||
#define PIN_SPI1_MISO (50u)
|
||||
#define PERIPH_SPI1 sercom0
|
||||
#define PAD_SPI1_TX SPI_PAD_0_SCK_1
|
||||
#define PAD_SPI1_RX SERCOM_RX_PAD_3
|
||||
|
||||
static const uint8_t SS1 = PIN_A3 ;
|
||||
static const uint8_t MOSI1 = PIN_SPI1_MOSI ;
|
||||
static const uint8_t MISO1 = PIN_SPI1_MISO ;
|
||||
static const uint8_t SCK1 = PIN_SPI1_SCK ;
|
||||
|
||||
/*
|
||||
* Wire Interfaces
|
||||
*/
|
||||
#define WIRE_INTERFACES_COUNT 1
|
||||
|
||||
#define PIN_WIRE_SDA (5u)
|
||||
#define PIN_WIRE_SCL (6u)
|
||||
#define PERIPH_WIRE sercom5
|
||||
#define WIRE_IT_HANDLER SERCOM5_Handler
|
||||
#define WIRE_IT_HANDLER_0 SERCOM5_0_Handler
|
||||
#define WIRE_IT_HANDLER_1 SERCOM5_1_Handler
|
||||
#define WIRE_IT_HANDLER_2 SERCOM5_2_Handler
|
||||
#define WIRE_IT_HANDLER_3 SERCOM5_3_Handler
|
||||
|
||||
static const uint8_t SDA = PIN_WIRE_SDA;
|
||||
static const uint8_t SCL = PIN_WIRE_SCL;
|
||||
|
||||
/*
|
||||
* USB
|
||||
*/
|
||||
#define PIN_USB_HOST_ENABLE (37ul)
|
||||
#define PIN_USB_DM (38ul)
|
||||
#define PIN_USB_DP (39ul)
|
||||
|
||||
/*
|
||||
* I2S Interfaces
|
||||
*/
|
||||
#define I2S_INTERFACES_COUNT 0
|
||||
|
||||
// On-board QSPI Flash
|
||||
#define EXTERNAL_FLASH_DEVICES GD25Q16C
|
||||
#define EXTERNAL_FLASH_USE_QSPI
|
||||
|
||||
//QSPI Pins
|
||||
#define PIN_QSPI_SCK (41u)
|
||||
#define PIN_QSPI_CS (42u)
|
||||
#define PIN_QSPI_IO0 (43u)
|
||||
#define PIN_QSPI_IO1 (44u)
|
||||
#define PIN_QSPI_IO2 (45u)
|
||||
#define PIN_QSPI_IO3 (46u)
|
||||
|
||||
#if !defined(VARIANT_QSPI_BAUD_DEFAULT)
|
||||
// TODO: meaningful value for this
|
||||
#define VARIANT_QSPI_BAUD_DEFAULT 5000000
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Arduino objects - C++ only
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
/* =========================
|
||||
* ===== SERCOM DEFINITION
|
||||
* =========================
|
||||
*/
|
||||
extern SERCOM sercom0;
|
||||
extern SERCOM sercom1;
|
||||
extern SERCOM sercom2;
|
||||
extern SERCOM sercom3;
|
||||
extern SERCOM sercom4;
|
||||
extern SERCOM sercom5;
|
||||
|
||||
extern Uart Serial1;
|
||||
extern Uart Serial2;
|
||||
|
||||
#endif
|
||||
|
||||
// These serial port names are intended to allow libraries and architecture-neutral
|
||||
// sketches to automatically default to the correct port name for a particular type
|
||||
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
|
||||
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
|
||||
//
|
||||
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
|
||||
//
|
||||
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
|
||||
//
|
||||
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
|
||||
//
|
||||
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
|
||||
//
|
||||
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
|
||||
// pins are NOT connected to anything by default.
|
||||
#define SERIAL_PORT_USBVIRTUAL Serial
|
||||
#define SERIAL_PORT_MONITOR Serial
|
||||
// Serial has no physical pins broken out, so it's not listed as HARDWARE port
|
||||
#define SERIAL_PORT_HARDWARE Serial1
|
||||
#define SERIAL_PORT_HARDWARE_OPEN Serial1
|
||||
|
||||
#endif /* _VARIANT_MATRIX_PORTAL_M4_ */
|
||||
|
||||
|
|
@ -131,8 +131,7 @@ static const uint8_t ATN = PIN_ATN;
|
|||
#define NINA_GPIO0 ESP32_GPIO0
|
||||
#define NINA_RESETN ESP32_RESETN
|
||||
#define NINA_ACK SPIWIFI_ACK
|
||||
#define NINA_CTS SPIWIFI_ACK
|
||||
#define NINA_RTS NINA_GPIO0
|
||||
|
||||
|
||||
/*
|
||||
* Serial interfaces
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@ const PinDescription g_APinDescription[]=
|
|||
{
|
||||
// GPIO 0 & 1 - DotStar internal data/clock
|
||||
// ----------------------------------------
|
||||
{ PORTA, 0, PIO_DIGITAL, 0, ADC_Channel4, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_0 }, // ADC/AIN[4]
|
||||
{ PORTA, 1, PIO_DIGITAL, 0, ADC_Channel5, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_1 }, // ADC/AIN[5]
|
||||
{ PORTA, 0, PIO_DIGITAL, 0, ADC_Channel4, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_4 }, // ADC/AIN[4]
|
||||
{ PORTA, 1, PIO_DIGITAL, 0, ADC_Channel5, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_5 }, // ADC/AIN[5]
|
||||
|
||||
// GPIO 2 - Infrared In
|
||||
{ PORTA, 28, PIO_COM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_8 }, // USB Host enable - GPIO #2
|
||||
{ PORTA, 28, PIO_COM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // USB Host enable - GPIO #2
|
||||
|
||||
// GPIO 3 & 4 (SWCLK & SWDIO)
|
||||
// --------------------------
|
||||
|
|
|
|||
|
|
@ -54,12 +54,12 @@ const PinDescription g_APinDescription[]=
|
|||
{ PORTA, 5, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel5, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_5 },
|
||||
{ PORTB, 8, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel2, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_8 },
|
||||
{ PORTB, 9, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel3, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_9 },
|
||||
{ PORTA, 4, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel4, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_4 },
|
||||
{ PORTA, 6, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel6, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_6 },
|
||||
{ PORTA, 4, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel4, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_6 },
|
||||
{ PORTA, 6, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel6, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_10 },
|
||||
|
||||
{ PORTB, 1, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel13, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_1 }, // A6, D20 - vbatt
|
||||
{ PORTB, 4, PIO_ANALOG, PIN_ATTR_ANALOG_ALT, ADC_Channel6, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_4 }, // A7, D21 - Light
|
||||
{ PORTB, 3, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel15, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_3 }, // A8 / D2
|
||||
{ PORTB, 3, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel15, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_2 }, // A8 / D2
|
||||
{ PORTB, 2, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel14, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_2 }, // A9 / D3
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -54,12 +54,12 @@ const PinDescription g_APinDescription[]=
|
|||
{ PORTA, 5, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel5, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_5 },
|
||||
{ PORTB, 8, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel2, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_8 },
|
||||
{ PORTB, 9, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel3, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_9 },
|
||||
{ PORTA, 4, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel4, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_4 },
|
||||
{ PORTA, 6, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel6, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_6 },
|
||||
{ PORTA, 4, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel4, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_6 },
|
||||
{ PORTA, 6, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel6, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_10 },
|
||||
|
||||
{ PORTB, 1, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel13, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_1 }, // A6, D20 - vbatt
|
||||
{ PORTB, 4, PIO_ANALOG, PIN_ATTR_ANALOG_ALT, ADC_Channel6, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_4 }, // A7, D21 - Light
|
||||
{ PORTB, 3, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel15, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_3 }, // A8 / D2
|
||||
{ PORTB, 3, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel15, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_2 }, // A8 / D2
|
||||
{ PORTB, 2, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel14, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_2 }, // A9 / D3
|
||||
{ PORTB, 6, PIO_ANALOG, PIN_ATTR_ANALOG_ALT, ADC_Channel8, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_6 }, // A10 / JOYY
|
||||
{ PORTB, 7, PIO_ANALOG, PIN_ATTR_ANALOG_ALT, ADC_Channel9, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_7 }, // A11 / JOYX
|
||||
|
|
|
|||
|
|
@ -54,12 +54,12 @@ const PinDescription g_APinDescription[]=
|
|||
{ PORTA, 5, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel5, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_5 },
|
||||
{ PORTB, 8, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel2, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_8 },
|
||||
{ PORTB, 9, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel3, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_9 },
|
||||
{ PORTA, 4, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel4, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_4 },
|
||||
{ PORTA, 6, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel6, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_6 },
|
||||
{ PORTA, 4, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel4, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_6 },
|
||||
{ PORTA, 6, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel6, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_10 },
|
||||
|
||||
{ PORTB, 1, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel13, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_1 }, // A6, D20 - vbatt
|
||||
{ PORTB, 4, PIO_ANALOG, PIN_ATTR_ANALOG_ALT, ADC_Channel6, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_4 }, // A7, D21 - Light
|
||||
{ PORTB, 3, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel15, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_3 }, // A8 / D2
|
||||
{ PORTB, 3, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel15, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_2 }, // A8 / D2
|
||||
{ PORTB, 2, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel14, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_2 }, // A9 / D3
|
||||
{ PORTB, 6, PIO_ANALOG, PIN_ATTR_ANALOG_ALT, ADC_Channel8, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_6 }, // A10 / JOYY
|
||||
{ PORTB, 7, PIO_ANALOG, PIN_ATTR_ANALOG_ALT, ADC_Channel9, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_7 }, // A11 / JOYX
|
||||
|
|
|
|||
|
|
@ -1,31 +0,0 @@
|
|||
#
|
||||
# Arduino Zero OpenOCD script.
|
||||
#
|
||||
# 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
|
||||
#
|
||||
|
||||
# Define 'reset' command
|
||||
define reset
|
||||
|
||||
info reg
|
||||
|
||||
break main
|
||||
|
||||
# End of 'reset' command
|
||||
end
|
||||
|
||||
target remote | openocd -c "interface cmsis-dap" -c "set CHIPNAME at91samd21e18" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log"
|
||||
|
|
@ -1,216 +0,0 @@
|
|||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
/* Linker script to configure memory regions.
|
||||
* Need modifying for a specific board.
|
||||
* FLASH.ORIGIN: starting address of flash
|
||||
* FLASH.LENGTH: length of flash
|
||||
* RAM.ORIGIN: starting address of RAM bank 0
|
||||
* RAM.LENGTH: length of RAM bank 0
|
||||
*/
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x00000000+0x2000, LENGTH = 0x00040000-0x2000 /* First 8KB used by bootloader */
|
||||
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000
|
||||
}
|
||||
|
||||
/* Linker script to place sections and symbol values. Should be used together
|
||||
* with other linker script that defines memory regions FLASH and RAM.
|
||||
* It references following symbols, which must be defined in code:
|
||||
* Reset_Handler : Entry of reset handler
|
||||
*
|
||||
* It defines following symbols, which code can use without definition:
|
||||
* __exidx_start
|
||||
* __exidx_end
|
||||
* __copy_table_start__
|
||||
* __copy_table_end__
|
||||
* __zero_table_start__
|
||||
* __zero_table_end__
|
||||
* __etext
|
||||
* __data_start__
|
||||
* __preinit_array_start
|
||||
* __preinit_array_end
|
||||
* __init_array_start
|
||||
* __init_array_end
|
||||
* __fini_array_start
|
||||
* __fini_array_end
|
||||
* __data_end__
|
||||
* __bss_start__
|
||||
* __bss_end__
|
||||
* __end__
|
||||
* end
|
||||
* __HeapLimit
|
||||
* __StackLimit
|
||||
* __StackTop
|
||||
* __stack
|
||||
*/
|
||||
ENTRY(Reset_Handler)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
__text_start__ = .;
|
||||
|
||||
KEEP(*(.sketch_boot))
|
||||
|
||||
. = ALIGN(0x2000);
|
||||
KEEP(*(.isr_vector))
|
||||
*(.text*)
|
||||
|
||||
KEEP(*(.init))
|
||||
KEEP(*(.fini))
|
||||
|
||||
/* .ctors */
|
||||
*crtbegin.o(.ctors)
|
||||
*crtbegin?.o(.ctors)
|
||||
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
|
||||
*(SORT(.ctors.*))
|
||||
*(.ctors)
|
||||
|
||||
/* .dtors */
|
||||
*crtbegin.o(.dtors)
|
||||
*crtbegin?.o(.dtors)
|
||||
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
|
||||
*(SORT(.dtors.*))
|
||||
*(.dtors)
|
||||
|
||||
*(.rodata*)
|
||||
|
||||
KEEP(*(.eh_frame*))
|
||||
} > FLASH
|
||||
|
||||
.ARM.extab :
|
||||
{
|
||||
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||
} > FLASH
|
||||
|
||||
__exidx_start = .;
|
||||
.ARM.exidx :
|
||||
{
|
||||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||||
} > FLASH
|
||||
__exidx_end = .;
|
||||
|
||||
/* To copy multiple ROM to RAM sections,
|
||||
* uncomment .copy.table section and,
|
||||
* define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */
|
||||
/*
|
||||
.copy.table :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__copy_table_start__ = .;
|
||||
LONG (__etext)
|
||||
LONG (__data_start__)
|
||||
LONG (__data_end__ - __data_start__)
|
||||
LONG (__etext2)
|
||||
LONG (__data2_start__)
|
||||
LONG (__data2_end__ - __data2_start__)
|
||||
__copy_table_end__ = .;
|
||||
} > FLASH
|
||||
*/
|
||||
|
||||
/* To clear multiple BSS sections,
|
||||
* uncomment .zero.table section and,
|
||||
* define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */
|
||||
/*
|
||||
.zero.table :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__zero_table_start__ = .;
|
||||
LONG (__bss_start__)
|
||||
LONG (__bss_end__ - __bss_start__)
|
||||
LONG (__bss2_start__)
|
||||
LONG (__bss2_end__ - __bss2_start__)
|
||||
__zero_table_end__ = .;
|
||||
} > FLASH
|
||||
*/
|
||||
|
||||
__etext = .;
|
||||
|
||||
.data : AT (__etext)
|
||||
{
|
||||
__data_start__ = .;
|
||||
*(vtable)
|
||||
*(.data*)
|
||||
|
||||
. = ALIGN(4);
|
||||
/* preinit data */
|
||||
PROVIDE_HIDDEN (__preinit_array_start = .);
|
||||
KEEP(*(.preinit_array))
|
||||
PROVIDE_HIDDEN (__preinit_array_end = .);
|
||||
|
||||
. = ALIGN(4);
|
||||
/* init data */
|
||||
PROVIDE_HIDDEN (__init_array_start = .);
|
||||
KEEP(*(SORT(.init_array.*)))
|
||||
KEEP(*(.init_array))
|
||||
PROVIDE_HIDDEN (__init_array_end = .);
|
||||
|
||||
|
||||
. = ALIGN(4);
|
||||
/* finit data */
|
||||
PROVIDE_HIDDEN (__fini_array_start = .);
|
||||
KEEP(*(SORT(.fini_array.*)))
|
||||
KEEP(*(.fini_array))
|
||||
PROVIDE_HIDDEN (__fini_array_end = .);
|
||||
|
||||
KEEP(*(.jcr*))
|
||||
. = ALIGN(16);
|
||||
/* All data end */
|
||||
__data_end__ = .;
|
||||
|
||||
} > RAM
|
||||
|
||||
.bss :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__bss_start__ = .;
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
__bss_end__ = .;
|
||||
} > RAM
|
||||
|
||||
.heap (COPY):
|
||||
{
|
||||
__end__ = .;
|
||||
PROVIDE(end = .);
|
||||
*(.heap*)
|
||||
__HeapLimit = .;
|
||||
} > RAM
|
||||
|
||||
/* .stack_dummy section doesn't contains any symbols. It is only
|
||||
* used for linker to calculate size of stack sections, and assign
|
||||
* values to stack symbols later */
|
||||
.stack_dummy (COPY):
|
||||
{
|
||||
*(.stack*)
|
||||
} > RAM
|
||||
|
||||
/* Set stack top to end of RAM, and stack limit move down by
|
||||
* size of stack_dummy section */
|
||||
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
|
||||
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
|
||||
PROVIDE(__stack = __StackTop);
|
||||
|
||||
__ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ;
|
||||
|
||||
/* Check if data + heap + stack exceeds RAM limit */
|
||||
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
|
||||
}
|
||||
|
|
@ -1,214 +0,0 @@
|
|||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
/* Linker script to configure memory regions.
|
||||
* Need modifying for a specific board.
|
||||
* FLASH.ORIGIN: starting address of flash
|
||||
* FLASH.LENGTH: length of flash
|
||||
* RAM.ORIGIN: starting address of RAM bank 0
|
||||
* RAM.LENGTH: length of RAM bank 0
|
||||
*/
|
||||
MEMORY
|
||||
{
|
||||
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000
|
||||
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000
|
||||
}
|
||||
|
||||
/* Linker script to place sections and symbol values. Should be used together
|
||||
* with other linker script that defines memory regions FLASH and RAM.
|
||||
* It references following symbols, which must be defined in code:
|
||||
* Reset_Handler : Entry of reset handler
|
||||
*
|
||||
* It defines following symbols, which code can use without definition:
|
||||
* __exidx_start
|
||||
* __exidx_end
|
||||
* __copy_table_start__
|
||||
* __copy_table_end__
|
||||
* __zero_table_start__
|
||||
* __zero_table_end__
|
||||
* __etext
|
||||
* __data_start__
|
||||
* __preinit_array_start
|
||||
* __preinit_array_end
|
||||
* __init_array_start
|
||||
* __init_array_end
|
||||
* __fini_array_start
|
||||
* __fini_array_end
|
||||
* __data_end__
|
||||
* __bss_start__
|
||||
* __bss_end__
|
||||
* __end__
|
||||
* end
|
||||
* __HeapLimit
|
||||
* __StackLimit
|
||||
* __StackTop
|
||||
* __stack
|
||||
* __ram_end__
|
||||
*/
|
||||
ENTRY(Reset_Handler)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.text :
|
||||
{
|
||||
__text_start__ = .;
|
||||
|
||||
KEEP(*(.isr_vector))
|
||||
*(.text*)
|
||||
|
||||
KEEP(*(.init))
|
||||
KEEP(*(.fini))
|
||||
|
||||
/* .ctors */
|
||||
*crtbegin.o(.ctors)
|
||||
*crtbegin?.o(.ctors)
|
||||
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
|
||||
*(SORT(.ctors.*))
|
||||
*(.ctors)
|
||||
|
||||
/* .dtors */
|
||||
*crtbegin.o(.dtors)
|
||||
*crtbegin?.o(.dtors)
|
||||
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
|
||||
*(SORT(.dtors.*))
|
||||
*(.dtors)
|
||||
|
||||
*(.rodata*)
|
||||
|
||||
KEEP(*(.eh_frame*))
|
||||
} > FLASH
|
||||
|
||||
.ARM.extab :
|
||||
{
|
||||
*(.ARM.extab* .gnu.linkonce.armextab.*)
|
||||
} > FLASH
|
||||
|
||||
__exidx_start = .;
|
||||
.ARM.exidx :
|
||||
{
|
||||
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
|
||||
} > FLASH
|
||||
__exidx_end = .;
|
||||
|
||||
/* To copy multiple ROM to RAM sections,
|
||||
* uncomment .copy.table section and,
|
||||
* define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */
|
||||
/*
|
||||
.copy.table :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__copy_table_start__ = .;
|
||||
LONG (__etext)
|
||||
LONG (__data_start__)
|
||||
LONG (__data_end__ - __data_start__)
|
||||
LONG (__etext2)
|
||||
LONG (__data2_start__)
|
||||
LONG (__data2_end__ - __data2_start__)
|
||||
__copy_table_end__ = .;
|
||||
} > FLASH
|
||||
*/
|
||||
|
||||
/* To clear multiple BSS sections,
|
||||
* uncomment .zero.table section and,
|
||||
* define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */
|
||||
/*
|
||||
.zero.table :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__zero_table_start__ = .;
|
||||
LONG (__bss_start__)
|
||||
LONG (__bss_end__ - __bss_start__)
|
||||
LONG (__bss2_start__)
|
||||
LONG (__bss2_end__ - __bss2_start__)
|
||||
__zero_table_end__ = .;
|
||||
} > FLASH
|
||||
*/
|
||||
|
||||
__etext = .;
|
||||
|
||||
.data : AT (__etext)
|
||||
{
|
||||
__data_start__ = .;
|
||||
*(vtable)
|
||||
*(.data*)
|
||||
|
||||
. = ALIGN(4);
|
||||
/* preinit data */
|
||||
PROVIDE_HIDDEN (__preinit_array_start = .);
|
||||
KEEP(*(.preinit_array))
|
||||
PROVIDE_HIDDEN (__preinit_array_end = .);
|
||||
|
||||
. = ALIGN(4);
|
||||
/* init data */
|
||||
PROVIDE_HIDDEN (__init_array_start = .);
|
||||
KEEP(*(SORT(.init_array.*)))
|
||||
KEEP(*(.init_array))
|
||||
PROVIDE_HIDDEN (__init_array_end = .);
|
||||
|
||||
|
||||
. = ALIGN(4);
|
||||
/* finit data */
|
||||
PROVIDE_HIDDEN (__fini_array_start = .);
|
||||
KEEP(*(SORT(.fini_array.*)))
|
||||
KEEP(*(.fini_array))
|
||||
PROVIDE_HIDDEN (__fini_array_end = .);
|
||||
|
||||
KEEP(*(.jcr*))
|
||||
. = ALIGN(16);
|
||||
/* All data end */
|
||||
__data_end__ = .;
|
||||
|
||||
} > RAM
|
||||
|
||||
.bss :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
__bss_start__ = .;
|
||||
*(.bss*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
__bss_end__ = .;
|
||||
} > RAM
|
||||
|
||||
.heap (COPY):
|
||||
{
|
||||
__end__ = .;
|
||||
PROVIDE(end = .);
|
||||
*(.heap*)
|
||||
__HeapLimit = .;
|
||||
} > RAM
|
||||
|
||||
/* .stack_dummy section doesn't contains any symbols. It is only
|
||||
* used for linker to calculate size of stack sections, and assign
|
||||
* values to stack symbols later */
|
||||
.stack_dummy (COPY):
|
||||
{
|
||||
*(.stack*)
|
||||
} > RAM
|
||||
|
||||
/* Set stack top to end of RAM, and stack limit move down by
|
||||
* size of stack_dummy section */
|
||||
__StackTop = ORIGIN(RAM) + LENGTH(RAM) ;
|
||||
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
|
||||
PROVIDE(__stack = __StackTop);
|
||||
|
||||
__ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ;
|
||||
|
||||
/* Check if data + heap + stack exceeds RAM limit */
|
||||
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
#
|
||||
# Adafruit ItsyBitsy M0 OpenOCD script.
|
||||
#
|
||||
# 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
|
||||
#
|
||||
|
||||
# chip name
|
||||
set CHIPNAME at91samd21e18
|
||||
set ENDIAN little
|
||||
|
||||
# choose a port here
|
||||
set telnet_port 0
|
||||
|
||||
source [find target/at91samdXX.cfg]
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
// API compatibility
|
||||
#include "variant.h"
|
||||
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
#include "variant.h"
|
||||
#include "Arduino.h"
|
||||
/*
|
||||
* Pins descriptions
|
||||
*/
|
||||
const PinDescription g_APinDescription[]=
|
||||
{
|
||||
{ PORTA, 2, PIO_ANALOG, (PIN_ATTR_DIGITAL|PIN_ATTR_ANALOG|PIN_ATTR_PWM|PIN_ATTR_TIMER), ADC_Channel0, PWM2_CH0, TCC2_CH0, EXTERNAL_INT_2 }, // A0 / D0 / DAC
|
||||
{ PORTA, 3, PIO_ANALOG, (PIN_ATTR_DIGITAL|PIN_ATTR_ANALOG), ADC_Channel1, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_3 }, // A1 / D1 / AREF
|
||||
{ PORTA, 4, PIO_ANALOG, (PIN_ATTR_DIGITAL|PIN_ATTR_ANALOG|PIN_ATTR_PWM|PIN_ATTR_TIMER), ADC_Channel4, PWM0_CH0, TCC0_CH0, EXTERNAL_INT_4 }, // A2 / D2 / PWM
|
||||
{ PORTA, 5, PIO_ANALOG, (PIN_ATTR_DIGITAL|PIN_ATTR_ANALOG|PIN_ATTR_PWM|PIN_ATTR_TIMER), ADC_Channel5, PWM0_CH1, TCC0_CH1, EXTERNAL_INT_5 }, // A3 / D3 / PWM
|
||||
|
||||
// I2C SDA & SCL
|
||||
{ PORTA, 16, PIO_SERCOM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER_ALT), No_ADC_Channel, PWM0_CH6, TCC0_CH6, EXTERNAL_INT_0 }, // D4 / SDA / PWM
|
||||
{ PORTA, 17, PIO_SERCOM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER_ALT), No_ADC_Channel, PWM0_CH7, TCC0_CH7, EXTERNAL_INT_1 }, // D5 / SCL / PWM
|
||||
|
||||
// UART TX & RX
|
||||
{ PORTA, 6, PIO_SERCOM_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_ANALOG|PIN_ATTR_PWM|PIN_ATTR_TIMER), ADC_Channel6, PWM1_CH0, TCC1_CH0, EXTERNAL_INT_6 }, // A6 / D6 / TX / PWM
|
||||
{ PORTA, 7, PIO_SERCOM_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_ANALOG|PIN_ATTR_PWM|PIN_ATTR_TIMER), ADC_Channel7, PWM1_CH1, TCC1_CH1, EXTERNAL_INT_7 }, // A7 / D7 / RX / PWM
|
||||
|
||||
// SPI SCK, MISO, MOSI
|
||||
{ PORTA, 11, PIO_SERCOM_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_ANALOG|PIN_ATTR_PWM|PIN_ATTR_TIMER_ALT), ADC_Channel19, PWM0_CH3, TCC0_CH3, EXTERNAL_INT_11 }, // A8 / D8 / SCK / PWM
|
||||
{ PORTA, 9, PIO_SERCOM_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_ANALOG|PIN_ATTR_PWM|PIN_ATTR_TIMER_ALT), ADC_Channel17, PWM1_CH3, TCC1_CH3, EXTERNAL_INT_9 }, // A9 / D9 / MISO / PWM
|
||||
{ PORTA, 10, PIO_SERCOM_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_ANALOG|PIN_ATTR_PWM|PIN_ATTR_TIMER_ALT), ADC_Channel18, PWM0_CH2, TCC0_CH2, EXTERNAL_INT_10 }, // A10 / D10 / MOSI / PWM
|
||||
|
||||
{ PORTA, 18, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_2 }, // D11 Neopix
|
||||
{ PORTA, 15, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_15 }, // D12 Neopix power
|
||||
|
||||
// D13 fake pin
|
||||
{ PORTA, 27, PIO_OUTPUT, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // used as fake output only
|
||||
|
||||
// SPI1 SCK, MISO, MOSI
|
||||
{ PORTA, 23, PIO_SERCOM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER_ALT), No_ADC_Channel, PWM0_CH5, TCC0_CH5, EXTERNAL_INT_7 }, // D14 / SCK1
|
||||
{ PORTA, 19, PIO_SERCOM_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER), No_ADC_Channel, PWM3_CH1, TC3_CH1, EXTERNAL_INT_3 }, // D15 / MISO1
|
||||
{ PORTA, 22, PIO_SERCOM, (PIN_ATTR_DIGITAL|PIN_ATTR_PWM|PIN_ATTR_TIMER_ALT), No_ADC_Channel, PWM0_CH4, TCC0_CH4, EXTERNAL_INT_6 }, // D16 / MOSI1
|
||||
// SPI1 CS
|
||||
{ PORTA, 8, PIO_SERCOM_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_ANALOG|PIN_ATTR_PWM|PIN_ATTR_TIMER_ALT), ADC_Channel16, PWM1_CH2, TCC1_CH2, EXTERNAL_INT_NMI }, // D17 / CS
|
||||
|
||||
// USB pins
|
||||
{ PORTA, 28, PIO_COM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // USB Host enable
|
||||
{ PORTA, 24, PIO_COM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // USB/DM
|
||||
{ PORTA, 25, PIO_COM, PIN_ATTR_NONE, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // USB/DP
|
||||
|
||||
|
||||
} ;
|
||||
|
||||
const void* g_apTCInstances[TCC_INST_NUM+TC_INST_NUM]={ TCC0, TCC1, TCC2, TC3, TC4, TC5 } ;
|
||||
|
||||
// Multi-serial objects instantiation
|
||||
SERCOM sercom0( SERCOM0 ) ;
|
||||
SERCOM sercom1( SERCOM1 ) ;
|
||||
SERCOM sercom2( SERCOM2 ) ;
|
||||
SERCOM sercom3( SERCOM3 ) ;
|
||||
|
||||
Uart Serial1( &sercom0, PIN_SERIAL1_RX, PIN_SERIAL1_TX, PAD_SERIAL1_RX, PAD_SERIAL1_TX ) ;
|
||||
|
||||
void SERCOM0_Handler()
|
||||
{
|
||||
Serial1.IrqHandler();
|
||||
}
|
||||
|
||||
void initVariant(void) {
|
||||
// special initialization code just for us
|
||||
|
||||
// turn on neopixel
|
||||
pinMode(12, OUTPUT);
|
||||
digitalWrite(12, HIGH);
|
||||
}
|
||||
|
|
@ -1,236 +0,0 @@
|
|||
/*
|
||||
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
|
||||
*/
|
||||
|
||||
#ifndef _VARIANT_QTPY_ZERO_
|
||||
#define _VARIANT_QTPY_ZERO_
|
||||
|
||||
// The definitions here needs a SAMD core >=1.6.10
|
||||
#define ARDUINO_SAMD_VARIANT_COMPLIANCE 10610
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Definitions
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
/** Frequency of the board main oscillator */
|
||||
#define VARIANT_MAINOSC (32768ul)
|
||||
|
||||
/** Master clock frequency */
|
||||
#define VARIANT_MCK (F_CPU)
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Headers
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "WVariant.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include "SERCOM.h"
|
||||
#include "Uart.h"
|
||||
#endif // __cplusplus
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif // __cplusplus
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Pins
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
// Number of pins defined in PinDescription array
|
||||
#define PINS_COUNT (21u)
|
||||
#define NUM_DIGITAL_PINS (21u)
|
||||
#define NUM_ANALOG_INPUTS (9u)
|
||||
#define NUM_ANALOG_OUTPUTS (1u)
|
||||
#define analogInputToDigitalPin(p) (p)
|
||||
|
||||
#define digitalPinToPort(P) ( &(PORT->Group[g_APinDescription[P].ulPort]) )
|
||||
#define digitalPinToBitMask(P) ( 1 << g_APinDescription[P].ulPin )
|
||||
//#define analogInPinToBit(P) ( )
|
||||
#define portOutputRegister(port) ( &(port->OUT.reg) )
|
||||
#define portInputRegister(port) ( &(port->IN.reg) )
|
||||
#define portModeRegister(port) ( &(port->DIR.reg) )
|
||||
#define digitalPinHasPWM(P) ( g_APinDescription[P].ulPWMChannel != NOT_ON_PWM || g_APinDescription[P].ulTCChannel != NOT_ON_TIMER )
|
||||
|
||||
/*
|
||||
* digitalPinToTimer(..) is AVR-specific and is not defined for SAMD
|
||||
* architecture. If you need to check if a pin supports PWM you must
|
||||
* use digitalPinHasPWM(..).
|
||||
*
|
||||
* https://github.com/arduino/Arduino/issues/1833
|
||||
*/
|
||||
// #define digitalPinToTimer(P)
|
||||
|
||||
// LEDs
|
||||
#define PIN_LED_13 (13u)
|
||||
#define PIN_LED PIN_LED_13
|
||||
#define LED_BUILTIN PIN_LED_13
|
||||
#define PIN_NEOPIXEL (11u)
|
||||
|
||||
/*
|
||||
* Analog pins
|
||||
*/
|
||||
#define PIN_A0 (0ul)
|
||||
#define PIN_A1 (PIN_A0 + 1)
|
||||
#define PIN_A2 (PIN_A0 + 2)
|
||||
#define PIN_A3 (PIN_A0 + 3)
|
||||
#define PIN_A6 (PIN_A0 + 6)
|
||||
#define PIN_A7 (PIN_A0 + 7)
|
||||
#define PIN_A8 (PIN_A0 + 8)
|
||||
#define PIN_A9 (PIN_A0 + 9)
|
||||
#define PIN_A10 (PIN_A0 + 10)
|
||||
#define PIN_A11 (PIN_A0 + 11)
|
||||
#define PIN_DAC0 (00ul)
|
||||
|
||||
static const uint8_t A0 = PIN_A0;
|
||||
static const uint8_t A1 = PIN_A1;
|
||||
static const uint8_t A2 = PIN_A2;
|
||||
static const uint8_t A3 = PIN_A3;
|
||||
static const uint8_t A6 = PIN_A6 ;
|
||||
static const uint8_t A7 = PIN_A7 ;
|
||||
static const uint8_t A8 = PIN_A8 ;
|
||||
static const uint8_t A9 = PIN_A9 ;
|
||||
static const uint8_t A10 = PIN_A10 ;
|
||||
static const uint8_t A11 = PIN_A11 ;
|
||||
static const uint8_t DAC0 = PIN_DAC0;
|
||||
|
||||
#define ADC_RESOLUTION 12
|
||||
|
||||
// On-board SPI Flash
|
||||
#define EXTERNAL_FLASH_DEVICES GD25Q16C
|
||||
#define EXTERNAL_FLASH_USE_SPI SPI1
|
||||
#define EXTERNAL_FLASH_USE_CS SS1
|
||||
|
||||
/*
|
||||
* Serial interfaces
|
||||
*/
|
||||
|
||||
// Serial1
|
||||
#define PIN_SERIAL1_TX (6ul)
|
||||
#define PIN_SERIAL1_RX (7ul)
|
||||
#define PAD_SERIAL1_TX (UART_TX_PAD_2)
|
||||
#define PAD_SERIAL1_RX (SERCOM_RX_PAD_3)
|
||||
|
||||
/*
|
||||
* SPI Interfaces
|
||||
*/
|
||||
#define SPI_INTERFACES_COUNT 2
|
||||
|
||||
#define PIN_SPI_SCK (8u)
|
||||
#define PIN_SPI_MISO (9u)
|
||||
#define PIN_SPI_MOSI (10u)
|
||||
#define PERIPH_SPI sercom2
|
||||
#define PAD_SPI_TX SPI_PAD_2_SCK_3
|
||||
#define PAD_SPI_RX SERCOM_RX_PAD_1
|
||||
|
||||
static const uint8_t SS = PIN_A0 ; // unused, just for reference
|
||||
static const uint8_t MOSI = PIN_SPI_MOSI ;
|
||||
static const uint8_t MISO = PIN_SPI_MISO ;
|
||||
static const uint8_t SCK = PIN_SPI_SCK ;
|
||||
|
||||
|
||||
#define PIN_SPI1_SCK (14u)
|
||||
#define PIN_SPI1_MISO (15u)
|
||||
#define PIN_SPI1_MOSI (16u)
|
||||
#define PERIPH_SPI1 sercom3
|
||||
#define PAD_SPI1_TX SPI_PAD_0_SCK_1
|
||||
#define PAD_SPI1_RX SERCOM_RX_PAD_3
|
||||
|
||||
static const uint8_t SS1 = 17;
|
||||
static const uint8_t MOSI1 = PIN_SPI1_MOSI ;
|
||||
static const uint8_t MISO1 = PIN_SPI1_MISO ;
|
||||
static const uint8_t SCK1 = PIN_SPI1_SCK ;
|
||||
|
||||
/*
|
||||
* Wire Interfaces
|
||||
*/
|
||||
#define WIRE_INTERFACES_COUNT 1
|
||||
|
||||
#define PIN_WIRE_SDA (4u)
|
||||
#define PIN_WIRE_SCL (5u)
|
||||
#define PERIPH_WIRE sercom1
|
||||
#define WIRE_IT_HANDLER SERCOM1_Handler
|
||||
|
||||
static const uint8_t SDA = PIN_WIRE_SDA;
|
||||
static const uint8_t SCL = PIN_WIRE_SCL;
|
||||
|
||||
/*
|
||||
* USB
|
||||
*/
|
||||
#define PIN_USB_HOST_ENABLE (18ul)
|
||||
#define PIN_USB_DM (19ul)
|
||||
#define PIN_USB_DP (20ul)
|
||||
/*
|
||||
* I2S Interfaces
|
||||
*/
|
||||
#define I2S_INTERFACES_COUNT 1
|
||||
|
||||
#define I2S_DEVICE 0
|
||||
#define I2S_CLOCK_GENERATOR 3
|
||||
#define PIN_I2S_SD (A7)
|
||||
#define PIN_I2S_SCK (MOSI)
|
||||
#define PIN_I2S_FS (SCK)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
* Arduino objects - C++ only
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
/* =========================
|
||||
* ===== SERCOM DEFINITION
|
||||
* =========================
|
||||
*/
|
||||
extern SERCOM sercom0;
|
||||
extern SERCOM sercom1;
|
||||
extern SERCOM sercom2;
|
||||
extern SERCOM sercom3;
|
||||
extern SERCOM sercom4;
|
||||
extern SERCOM sercom5;
|
||||
|
||||
extern Uart Serial1;
|
||||
|
||||
#endif
|
||||
|
||||
// These serial port names are intended to allow libraries and architecture-neutral
|
||||
// sketches to automatically default to the correct port name for a particular type
|
||||
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
|
||||
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
|
||||
//
|
||||
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
|
||||
//
|
||||
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
|
||||
//
|
||||
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
|
||||
//
|
||||
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
|
||||
//
|
||||
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
|
||||
// pins are NOT connected to anything by default.
|
||||
#define SERIAL_PORT_USBVIRTUAL Serial
|
||||
#define SERIAL_PORT_MONITOR Serial
|
||||
// Serial has no physical pins broken out, so it's not listed as HARDWARE port
|
||||
#define SERIAL_PORT_HARDWARE Serial1
|
||||
#define SERIAL_PORT_HARDWARE_OPEN Serial1
|
||||
|
||||
#endif /* _VARIANT_ARDUINO_ZERO_ */
|
||||
|
||||
|
|
@ -65,8 +65,8 @@ const PinDescription g_APinDescription[]=
|
|||
|
||||
// 21..22 I2C pins (SDA/SCL) or Serial1 Pins
|
||||
// ----------------------
|
||||
{ PORTB, 8, PIO_SERCOM_ALT, PIN_ATTR_ANALOG, ADC_Channel2, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_8 }, // SERCOM 4.0
|
||||
{ PORTB, 9, PIO_SERCOM_ALT, PIN_ATTR_ANALOG_ALT, ADC_Channel1, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_9 }, // SERCOM 4.1
|
||||
{ PORTB, 8, PIO_SERCOM_ALT, PIN_ATTR_ANALOG, ADC_Channel2, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_12 }, // SERCOM 4.0
|
||||
{ PORTB, 9, PIO_SERCOM_ALT, PIN_ATTR_ANALOG_ALT, ADC_Channel1, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_13 }, // SERCOM 4.1
|
||||
|
||||
// ----------------------
|
||||
// 23 - 28 QSPI (SCK, CS, IO0, IO1, IO2, IO3)
|
||||
|
|
@ -81,8 +81,8 @@ const PinDescription g_APinDescription[]=
|
|||
// --------------------
|
||||
{ PORTA, 2, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel0, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_2 }, // A0
|
||||
{ PORTA, 5, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel5, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_5 }, // A1
|
||||
{ PORTA, 6, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel6, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_6 }, // Amp'd Mic
|
||||
{ PORTA, 7, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel7, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_7 }, // Raw Mic
|
||||
{ PORTA, 6, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel6, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_4 }, // Amp'd Mic
|
||||
{ PORTA, 7, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel7, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_6 }, // Raw Mic
|
||||
{ PORTB, 8, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel2, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_8 }, // SDA
|
||||
{ PORTB, 9, PIO_ANALOG, PIN_ATTR_ANALOG, ADC_Channel3, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_9 }, // SCL
|
||||
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@ const PinDescription g_APinDescription[]=
|
|||
|
||||
// GPIO 7 & 8 - DotStar internal data/clock
|
||||
// ----------------------------------------
|
||||
{ PORTA, 0, PIO_DIGITAL, 0, ADC_Channel4, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_0 }, // ADC/AIN[4]
|
||||
{ PORTA, 1, PIO_DIGITAL, 0, ADC_Channel5, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_1 }, // ADC/AIN[5]
|
||||
{ PORTA, 0, PIO_DIGITAL, 0, ADC_Channel4, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_4 }, // ADC/AIN[4]
|
||||
{ PORTA, 1, PIO_DIGITAL, 0, ADC_Channel5, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_5 }, // ADC/AIN[5]
|
||||
|
||||
// GPIO 9, 10, 11 USB Host enable
|
||||
// ----------------------------
|
||||
|
|
|
|||
Loading…
Reference in a new issue