Compare commits

...

659 commits

Author SHA1 Message Date
Ha Thach
05e83bcb71
Merge pull request #373 from adafruit/add-issue-template
add issue template
2025-08-07 17:09:11 +07:00
hathach
0a48a55866
add issue template 2025-08-07 15:33:58 +07:00
Ha Thach
6653744ce4
Merge pull request #370 from adafruit/fix-TRRS-Trinkey-variant-name
fix variant folder name case for trrstrinkey_m0
2024-12-25 16:10:07 +07:00
hathach
592ec7707d
fix variant folder name case for trrstrinkey_m0 2024-12-25 15:06:00 +07:00
Mikey Sklar
bb552819ba
Pixel Trinkey Analog JST pin (#369)
Adding analog support to the 3-pin JST A6.
2024-09-18 13:54:26 -04:00
Ha Thach
8859387343
Merge pull request #367 from DennisErnst/master
Fix hangs when transfer errors occur
2024-09-05 19:00:38 +07:00
hathach
c8287a11c6
clean up format 2024-09-05 18:47:37 +07:00
Dennis Ernst
6e5580d9b2
Add files via upload 2024-07-21 10:50:03 -07:00
Dennis Ernst
ccfc7db988
Add files via upload 2024-07-18 12:43:41 -07:00
Ha Thach
ce20340620
Merge pull request #339 from yosinski/master
Add .ramfunc attribute to flash_with_bootloader.ld to enable keeping functions in RAM
2024-07-18 17:57:17 +07:00
Ha Thach
6ed425f871
Merge pull request #362 from nerdyscout/fix/update_TinyUSB
update to 3.1.5 of Adafruit TinyUSB
2024-07-18 17:47:55 +07:00
Liz
576d6271ed Revert "Merge pull request #363 from BlitzCityDIY/trrs_update"
This reverts commit e7a9d6d762, reversing
changes made to 9bb5b21093.
2024-06-25 19:14:24 -04:00
Liz
726453fa91 Revert "Merge pull request #364 from BlitzCityDIY/master"
This reverts commit 3044845d73, reversing
changes made to e7a9d6d762.
2024-06-25 19:14:19 -04:00
Liz
3044845d73
Merge pull request #364 from BlitzCityDIY/master
two more TRRS
2024-06-25 18:59:56 -04:00
Liz
12e2013e2b two more TRRS 2024-06-25 18:52:49 -04:00
e7a9d6d762
Merge pull request #363 from BlitzCityDIY/trrs_update
updating TRRS Trinkey naming for case sensitivity
2024-06-25 16:21:58 -05:00
Liz
463eb00619 updating TRRS Trinkey naming for case sensitivity 2024-06-25 16:30:51 -04:00
nerdyscout
c0c7bd0bcb update to 3.1.5 2024-06-10 13:29:54 +02:00
Ha Thach
9bb5b21093
Merge pull request #361 from adafruit/bump-1.7.16
bump up version 1.7.16
2024-05-22 09:52:13 +07:00
Ha Thach
3a527f8e85
bump up version 1.7.16 2024-05-22 09:45:15 +07:00
ladyada
7473729af3 Merge branch 'master' of github.com:adafruit/ArduinoCore-samd 2024-05-21 20:23:06 -04:00
ladyada
b64fe90c4a fix for rev B hardware
cc @blitzcitydiy
2024-05-21 20:23:02 -04:00
Ha Thach
4693b93d69
Merge pull request #360 from adafruit/minor-update
update makeboards.py, fix board name typo
2024-05-17 10:09:16 +07:00
hathach
ffb6935392
update makeboards.py, fix board name typo 2024-05-17 09:58:01 +07:00
Ha Thach
9dc3465b47
Merge pull request #359 from adafruit/bump-version-1.7.15
bump up version to 1.7.15
2024-05-17 09:38:04 +07:00
hathach
61da91c518
bump up version to 1.7.15 2024-05-17 09:24:46 +07:00
Ha Thach
ac9e81e58e
Merge pull request #358 from rcross-lc/master
Use the correct openocd flash driver for ATSAMD51 devices
2024-05-15 16:54:15 +07:00
ladyada
72e88b41ea many variant trinks! 2024-05-11 13:10:07 -04:00
ladyada
5a5790412c hardware design rev B 2024-05-11 13:09:32 -04:00
Robert Cross
634b97cc40 Use the correct openocd flash driver for ATSAMD51 devices
see openocd docs ( https://github.com/openocd-org/openocd/blob/v0.11.0/doc/openocd.texi#L5827C1-L5827C54 )
2024-05-09 16:44:23 -04:00
Liz
b2358faa51
increase version for 1.7.14 release 2024-03-26 08:38:21 -04:00
Liz
1a8763701d
Merge pull request #355 from adafruit/sht4xtrinkey
Tested SHT4x Trinkey
2024-03-25 08:22:29 -04:00
hathach
e82192ca1a
update makeboards.py 2024-03-13 17:42:41 +07:00
ladyada
9b1b3ba02d Tested SHT4x Trinkey 2024-03-05 11:00:29 -05:00
Ha Thach
0bf32589c9
Merge pull request #328 from caternuson/iss320_dotstar
add PIN_DOTSTAR_CLOCK
2024-03-05 12:58:34 +07:00
Ha Thach
e43b1ef3aa
Merge pull request #347 from IanBurwell/ib/pyportal-ss-fix
PyPortal: fix SS pin definition
2024-03-05 12:58:12 +07:00
Ha Thach
4c6cc0ef6f
Merge pull request #354 from adafruit/update-tinyusb
Update tinyusb to v3.1
2024-03-05 12:56:23 +07:00
hathach
c1b79a8231
udpate tinyusb to v3.1 2024-03-05 12:44:54 +07:00
Ha Thach
767168482d
Merge pull request #353 from adafruit/update-libraries
update tinyusb and zerodma libraries
2024-02-06 16:17:17 +07:00
hathach
8619fd9190 update tinyusb and zerodma libraries 2024-02-06 15:22:24 +07:00
Ha Thach
21ac7624c9
Merge pull request #351 from adafruit/fix-sendStringDescriptor
fix sendStringDescriptor() maxlen uitn8_t to uint32_t
2023-11-27 18:32:44 +07:00
hathach
f85cf1b8a3 fix sendStringDescriptor() maxlen uitn8_t to uint32_t 2023-11-27 11:54:09 +07:00
Ha Thach
e2b78cbd36
Merge pull request #348 from adafruit/hathach-patch-1
increase version for release 1.7.13
2023-06-23 10:48:43 +07:00
Ha Thach
eebe841a7d
increase version for release 1.7.13 2023-06-23 10:41:05 +07:00
Ha Thach
164decde3b
Merge pull request #346 from adafruit/ide2-debug
Arduino IDE v2 debuging suport
2023-06-23 10:38:54 +07:00
hathach
bc76c89c90 explicit specify openocd 0.11.0-arduino2 2023-06-23 09:55:55 +07:00
Ian Burwell
b0322762a5 pyportal: add SS pin 2023-06-22 20:34:16 -04:00
hathach
df5b8c6054 comment out jlink over openocd since IDE does not pick that up and could cause questions 2023-06-22 23:28:21 +07:00
hathach
c3d53add36 add support for jlink as transport for openocd
though menu selection does not seem to work with debug script. Though
this is probably IDE issue.
2023-06-22 23:05:24 +07:00
hathach
c9e285c482 fix ci, rename script 2023-06-22 19:19:18 +07:00
hathach
41cd7a70e1 adding samd51 debug, still wip 2023-06-22 16:42:55 +07:00
hathach
463beee02d debug work with itsybitsy and pico probe 2023-06-22 12:25:24 +07:00
hathach
2f8f40c05c more script update 2023-06-21 23:07:26 +07:00
hathach
ef8903ac8e move makboards.py scripts tools/, refactor to use f-string 2023-06-21 21:34:19 +07:00
Ha Thach
313ef47993
Merge pull request #344 from adafruit/release-1.7.12
fix incorrect PID for pIRKey board (conflict with M0 trinket)
2023-05-23 11:14:01 +07:00
hathach
c307d378eb
fix incorrect PID for pIRKey board (conflict with M0 trinket) 2023-05-23 10:12:41 +07:00
dherrada
159e3c31ed Update CI action versions 2023-05-12 11:24:12 -04:00
Jason Yosinski
a6b4ae7738 Added .ramfunc attribute to linker script to enable keeping functions in RAM. 2022-12-20 11:27:08 -08:00
Ha Thach
0fd44a54b7
Merge pull request #278 from rlcamp/master
Fix typo in samd51 clock init which was preventing XOSC1K from being used in RTCCTRL
2022-11-15 09:24:47 +07:00
Ha Thach
7812526590
Merge pull request #338 from rlcamp/ltofix
Prevent LTO from omitting the ISR vector table
2022-11-15 09:02:35 +07:00
Richard Campbell
7ca484ac85 Prevent LTO from omitting the ISR vector table for SAMD21 too 2022-11-13 22:13:30 -08:00
Richard Campbell
88bafcc09e Prevent LTO from omitting the ISR vector table 2022-11-13 10:53:59 -08:00
rlcamp
22176f8c20
Merge branch 'adafruit:master' into master 2022-11-13 10:35:57 -08:00
Ha Thach
024eaa50d1
Merge pull request #337 from adafruit/release-1.7.11
Remove ARDUINO_SAMD_ZERO for some boards
2022-11-01 12:09:42 +07:00
hathach
66ebeeb4dc
bump version to 1.7.11 2022-11-01 11:51:41 +07:00
hathach
7c47afb817
remove ARDUINO_SAMD_ZERO from some boards due to fastled issue 2022-11-01 11:51:14 +07:00
hathach
ad12ce969f fix possible windows bossac tool 2022-10-12 21:42:23 +07:00
Tim Vrakas
c2d4153929
Proposal to improve WVariant part number define logic (#326)
* add ethernet interupt dummy handler

* fix timer definitions for -N and -P SAMx5x parts
2022-07-31 23:38:27 -04:00
Ha Thach
bd2a9cdbe7
change the SDA, SCL timer from alt to primary to avoid pwm conflict (#331) 2022-06-05 16:49:30 -04:00
caternuson
b13ae7f0b7 add PIN_DOTSTAR_CLOCK 2022-03-23 11:43:51 -07:00
Ha Thach
137b8d2de0
fix typo board defines for feather m0 express (#325) 2022-03-08 14:24:19 -05:00
Ha Thach
85f71fb7c1
Merge pull request #324 from adafruit/release-1.7.10
increase verion to 1.7.10
2022-02-17 17:07:05 +07:00
hathach
ada1b9d9d3 increase verion to 1.7.10
bump up included tinyusb to 1.9.4
2022-02-17 16:54:43 +07:00
Ha Thach
81f9ee0889
Merge pull request #323 from adafruit/revert-bossac-to-1.8
revert bossac tool from 1.9 back to 1.8
2022-02-06 00:39:01 +07:00
hathach
327fbceb48 revert bossac tool from 1.9 back to 1.8
move blm badge up in boards.txt, update id for portal m4
2022-02-04 12:12:52 +07:00
Kattni
d4ed1fd456
Merge pull request #321 from caternuson/iss320_dotstar
Add defines for internal DotStar pins
2022-01-26 18:50:42 -05:00
caternuson
dd787f583c paran u 2022-01-26 15:23:50 -08:00
caternuson
6398c2a1ac add dotstar pin defs 2022-01-26 15:19:30 -08:00
Ha Thach
2a7aae79ee
Update makeboards.py 2022-01-27 01:15:58 +07:00
Ha Thach
d8893ff12f
Merge pull request #319 from adafruit/bossac-1.9
migrate all boards upload tool from bossac 1.8 to 1.9 and auto-generate boards.txt
2022-01-27 01:15:03 +07:00
hathach
5528bf224f add makeboard.py to genearte boards.txt to prevent error in board addition 2022-01-26 17:25:48 +07:00
hathach
6bc12c92fe
migrate all boards from bossac 1.8 to 1.9 2022-01-25 22:03:49 +07:00
Ha Thach
67dfb93a4a
migrate all m0 upload tool to bossac 1.8 (#318) 2022-01-14 16:59:59 -05:00
Ha Thach
c999601efc
increase version to 1.7.7 for release 2022-01-13 11:42:21 +07:00
Ha Thach
3f214fea3b
Merge pull request #317 from adafruit/more-bossac18
update bossac18 for neokey, neo, rotary, slide trinkey m0
2022-01-13 11:27:05 +07:00
hathach
53248609ec
update bossac18 for neokey, neo, rotary, slide trinkey m0
also add fake SPI interfaces for them as well
2022-01-13 11:04:19 +07:00
Ha Thach
525980e0ee
Prepare BSP for Internal Flash filesystem (#316)
* update upload tool for adafruit_proxlighttrinkey_m0 to bossac18

* fake SPI Interface so we could compile with SdFat
2022-01-12 13:34:27 -05:00
hathach
90b4d35236
increase version 1.7.6 for release 2022-01-10 22:46:08 +07:00
Ha Thach
9785217e25
Merge pull request #315 from adafruit/add-Werror=return-type
add -Werror=return-type for all warning options
2022-01-07 02:19:25 +07:00
hathach
bac2839448 add -Werror=return-type for all warning options 2022-01-06 18:20:59 +07:00
ladyada
a8c4b4d8e3 Merge branch 'master' of github.com:adafruit/ArduinoCore-samd 2022-01-04 13:50:18 -05:00
ladyada
3db7484736 'hot fix' for https://github.com/arduino-libraries/WiFiNINA/issues/184 2022-01-04 13:50:14 -05:00
Ha Thach
e669a01bc1
Merge pull request #314 from prampec/patch-1
Introduce digital pin definitions
2021-12-21 12:24:25 +07:00
Balázs Kelemen
e715d707ef
Introduce digital pin definitions
Pin definitions are based on the schematics.
2021-12-20 23:20:19 +01:00
Ha Thach
1710c41552
enable DRVSTR for output pin (#313)
add neopixel and button pin define for circuitplay
2021-12-13 22:58:26 -05:00
Ha Thach
41c0a72f37
Merge pull request #310 from MartinL1/master
Add int64_t and uint64_t data types to Serial.print(ln)
2021-10-01 15:21:57 +07:00
hathach
6f5a596b31
indentation 2021-10-01 14:58:17 +07:00
MartinL1
3b2df62575
Update Print.cpp 2021-09-30 12:27:12 +01:00
MartinL1
6907751dd1
Update Print.h 2021-09-30 12:25:26 +01:00
Ha Thach
8b70e4c252
Merge pull request #309 from zuyan9/master
Bugfix - waiting for first ADC read to complete after ADC enable.
2021-09-17 17:38:54 +07:00
Zuyang
6ddfddf877
Bugfix - waiting for first ADC read to complete after ADC enable. 2021-09-15 19:14:42 -04:00
Ha Thach
bafcb36c19
bump up version for release 1.7.5 2021-09-01 12:27:38 +07:00
Ha Thach
11b223acef
Merge pull request #308 from adafruit/more-m4-can-typo
fix m4 can typo
2021-08-31 22:28:27 +07:00
hathach
e24e4af26b
fix m4 can typo 2021-08-31 22:15:41 +07:00
Ha Thach
1b17683575
increase version for 1.7.4 release 2021-08-17 11:38:02 +07:00
Ha Thach
46e2271984
fix m4 can pin typo (#307)
also bump up tinyusb lib
2021-08-16 11:56:21 -04:00
Ha Thach
de975d929c
Merge pull request #306 from 2bndy5/global-define-for-any-adafruit-boards
add -DADAFRUIT_ARCH_SAMD to all board's build.extra_flags
2021-07-16 00:19:08 +07:00
Brendan
42d3ad1e0b requested changes 2021-07-15 00:20:52 -07:00
Brendan
a02b851395 add -DADAFRUIT_ARCH_SAMD to all board's build.extra_flags 2021-07-14 18:45:39 -07:00
hathach
f5564f85f1 bump TinyUSB to 1.3.0 2021-06-29 11:55:50 +07:00
hathach
2163aa82fe
bump tinyusb 2021-06-26 01:38:30 +07:00
Ha Thach
203746757a
Update tinyusb library to compatible with 1.2.0 (#303)
* more Adafruit_TinyUSB include

* add metro m0 m4 with tinyusb to ci

* correct fqbn

* support ci with tinyusb variant

bump zeroDMA and fix warnings with USBHost library example

* install missing libraries

* more libraries

* update tinyusb library to 1.2.0

increase version to 1.7.3
2021-06-25 10:08:33 -04:00
Ha Thach
4e51791226
Merge pull request #301 from adafruit/more-ci-work
More ci work
2021-05-26 13:13:26 +07:00
hathach
aff98b3875
increase version 1.7.2 for release 2021-05-26 12:54:37 +07:00
hathach
3c601b613e
bump builtin TinyUSB to 1.0.3 2021-05-26 10:05:12 +07:00
hathach
481e4920dd
always build with all warnings, but not fatal error 2021-05-25 22:37:20 +07:00
hathach
8c2dd0b682
bump zeroDMA 2021-05-25 22:01:22 +07:00
hathach
9c2bdbc314
include TinyUSB header for builtin libraries if selected 2021-05-25 18:30:09 +07:00
hathach
69a2211b81
add Adafruit_ZeroDMA as submodules 2021-05-25 18:04:21 +07:00
hathach
14a6b40ed9
remove local copy of Adafruit_ZeroDMA 2021-05-25 18:03:58 +07:00
Ha Thach
cca8448cfe
Merge pull request #300 from adafruit/fix-warnings
Fix warnings
2021-05-24 23:41:00 +07:00
hathach
33a1e15fb0 increase version to 1.7.1 2021-05-24 23:33:50 +07:00
hathach
e49dab6406 also bump tinyusb 2021-05-24 23:33:24 +07:00
hathach
51bd7a7967 better fix warning with "-Wclass-memaccess" in SPI 2021-05-24 21:31:52 +07:00
hathach
a7a8b02854 use CMSIS-Atmel-1.2.2 to fix LITTLE_ENDIAN warning 2021-05-24 20:44:16 +07:00
Ha Thach
fa24f50fb4
increase version to 1.7.0 for release 2021-05-19 13:24:46 +07:00
Ha Thach
7585cb7b76
Merge pull request #298 from adafruit/rework-tinyusb
Rework tinyusb lib
2021-05-19 13:23:48 +07:00
lady ada
32b62c86ff add AREF pin as A12 2021-05-18 11:13:01 -04:00
hathach
461f855940 ci skip tinyusb lib examples for now 2021-05-18 21:24:48 +07:00
hathach
a7bab5b591 update tinyusb lib to 1.0.0 2021-05-18 17:35:49 +07:00
ladyada
93b1ba1e4a A11 isnt an analog in! 2021-05-14 16:34:46 -04:00
lady ada
322f2ff8c9 add definition for touchpad 2021-05-13 10:12:18 -04:00
hathach
a9d41b6019 fix typo in tinyusb lib 2021-05-10 19:11:44 +07:00
hathach
c262dc2ff9 clean up and add note for "-Wclass-memaccess" 2021-05-10 19:06:44 +07:00
Ha Thach
48956ddef8
increase version for release 1.6.8 2021-05-10 18:23:18 +07:00
hathach
7234390bc1
sync tinyusb lib 2021-05-10 17:16:42 +07:00
hathach
3c173d5d19
update with TinyUSB_Device_FlushCDC() 2021-05-10 12:52:55 +07:00
hathach
30d0738262 sync with tinyusb lib latest change 2021-05-10 12:22:18 +07:00
Limor "Ladyada" Fried
c26a8371f9
Trinkeys (#296)
* add rotary trinkey rev B

* add slide trinkey

* proximity sensing trinkey

* update variant to shipping

* forgot one!

* fix two typos

* fix up slide trinkey for rev B
2021-05-08 16:28:31 -04:00
hathach
704450cc1c
add libraries/Adafruit_TinyUSB_Arduino as submodule
include Adafruit_USBD_CDC.h from submodule
2021-05-08 01:08:31 +07:00
hathach
15fd604313 clean up 2021-05-07 17:30:00 +07:00
hathach
88520ba975 update tinyusb header 2021-05-07 14:49:02 +07:00
hathach
1f029ece68 fix typo 2021-05-07 00:30:15 +07:00
hathach
6fd7609c6e add feather m4 can to ci 2021-05-07 00:15:08 +07:00
hathach
d3091df758
change porting API 2021-05-06 21:47:26 +07:00
hathach
fc358eaf65
remove tinyusb core submodule, move tinyusb src to its own library to reduce dependency 2021-05-06 16:03:34 +07:00
Henry Gabryjelski
439c6b51c9
Narrowly silence new (GCC 8.1+) warning (#290)
Fixes #287

The warnings look like:
```
      Line 338 Char 37
      warning: 'void* memcpy(void*, const void*, size_t)' 
               writing to an object of type 'struct DmacDescriptor'
               with no trivial copy-assignment [-Wclass-memaccess]
```
2021-04-30 11:42:15 -04:00
Ha Thach
ade7cafbae
Merge pull request #289 from henrygab/patch-2
Fix [-Wrestrict] bug
2021-04-13 12:46:32 +07:00
hathach
ea208a42b2
use correct CMSIS-Atmel-1.2.1.path 2021-04-09 14:07:30 +07:00
Ha Thach
dffa5b8acd
Merge pull request #291 from adafruit/use-same51-from-cmsis-atmel-tool
Use same51 from cmsis atmel tool
2021-04-09 13:52:16 +07:00
hathach
c47727252c
increase version to 1.6.7 2021-04-09 13:50:15 +07:00
hathach
1870cefd75
use same51 header from cmsis-atmel package 2021-04-09 13:33:17 +07:00
Henry Gabryjelski
a7a9d2dbc1
Fix loop iterations 2021-04-08 17:51:06 -07:00
Ha Thach
e3407013a8
Merge pull request #288 from henrygab/patch-1
Cast to integral type ignores qualifier `volatile`
2021-03-30 01:01:41 +07:00
Henry Gabryjelski
76f999b825
Fix [-Wrestrict] bug
Untested...
2021-03-25 15:09:54 -07:00
Henry Gabryjelski
d542a60ae6
Cast to integral type ignores qualifier volatile
Attempting to cast to a `volatile uint32_t` does nothing different from cast to a `uint32_t`,
with the exception of **_looking like_** it's accessing a register.
2021-03-25 14:52:25 -07:00
Ha Thach
243c208b22
bump version for 1.6.6 release 2021-03-15 23:40:24 +07:00
Ha Thach
9e15226813
Merge pull request #286 from adafruit/neotrinkey
add new variant
2021-03-15 23:22:22 +07:00
lady ada
af4f2cb75c typo fixes! 2021-03-15 12:13:48 -04:00
lady ada
3adf881254 add new variant 2021-03-14 17:22:49 -04:00
Phillip Pearson
aebf3cb686
Port some AVR Serial_ (SerialUSB) API's over (#285)
Co-authored-by: Sandeep Mistry <s.mistry@arduino.cc>
2021-03-06 11:56:47 -05:00
Ha Thach
e16a55ba0b
Merge pull request #281 from matt-chan/patch-1
Fix EINT listing for pin 4
2021-01-26 11:31:46 +07:00
lady ada
8dcab42ce3 bump to add fixes for CAN Feather and BLM Badge 2021-01-25 20:07:13 -05:00
lady ada
7716ebbcd6 update BLM badge for uart (used in testing) 2021-01-25 14:40:44 -05:00
Matthew Chan
8c6f2dd466
Fix remaining EINT values
Add additional EINT fixes for PA{0,1,30}, PB{3, 23}.
2021-01-25 13:12:49 -05:00
Matthew Chan
aa706d706d
Fix EINT listing for pin 4
I think this file doesn't match the circuit diagram listing at https://cdn-learn.adafruit.com/assets/assets/000/047/156/original/circuit_playground_Adafruit_Circuit_Playground_Express_Pinout.png?1507829017.

It causes the interrupt pin checking code in ArduinoLowPower to fail, meaning it won't listen to interrupts from button A. Button B works fine.
2021-01-25 03:07:12 -05:00
lady ada
812399fe45 Merge branch 'master' of github.com:adafruit/ArduinoCore-samd 2021-01-10 17:26:12 -05:00
lady ada
9ddc306013 CAN variant updates, fix for PDM on badge 2021-01-10 17:26:07 -05:00
Paint Your Dragon
12e0a79fea
Merge pull request #279 from RudolphRiedel/master
Added a isBusy() method to SPI calls to allow non-blocking polling of…
2020-12-28 11:46:52 -08:00
Rudolph Riedel
3c7a2d5bad Added a isBusy() method to SPI calls to allow non-blocking polling of the DMA transfer status. 2020-12-28 13:51:55 +01:00
Richard Campbell
146e8b8e53 Fix typo in samd51 clock init 2020-12-27 00:52:53 -08:00
Valerii Koval
dcc531f963
Typo fix in PID for BLM Badge (#274) 2020-12-10 14:38:38 -05:00
Limor "Ladyada" Fried
f2a72d1c1e
Fix addpath (#275)
* try it!
2020-12-10 14:25:11 -05:00
lady ada
ec69488b42 add boost enable pin for CAN feather 2020-12-01 20:12:05 -05:00
Ha Thach
1fa45ad6a6
update version to 1.6.4 for release 2020-11-05 22:43:46 +07:00
Limor "Ladyada" Fried
0b160161de
Merge pull request #270 from mdonoughe/matrixportal-led
update LED_BUILTIN for matrixportal_m4
2020-10-31 17:20:42 -04:00
Matthew Donoughe
b8235856be update LED_BUILTIN for matrixportal_m4 2020-10-31 16:16:44 -04:00
Limor "Ladyada" Fried
d0396b05ce
Merge pull request #269 from adafruit/m0-optimization-option
added optimization menu option for M0
2020-10-31 11:46:57 -04:00
hathach
54beccb9b4 added optimization menu option for M0 2020-10-31 14:39:22 +07:00
Limor "Ladyada" Fried
b94b432dad
Merge pull request #267 from jepler/feather-can-bsp
Adafruit Feather M4 CAN: Add support for board
2020-10-20 15:23:57 -04:00
da80034588 Add CAN handlers for SAM E51 2020-10-20 08:55:53 -05:00
3471cdffa4 update feather can board property 2020-10-08 21:04:11 -05:00
f077606591 correct board name string 2020-10-07 14:03:21 -05:00
3ab4dfe9de feather_can_m4: define PIN_CAN_abc macros 2020-10-07 13:29:44 -05:00
308e949881 feather_m4_can: Add CAN-related pins to variant files
40: CAN_STANDBY
41: CAN_TX
42: CAN_RX
2020-10-07 12:50:07 -05:00
ad022b412a Add special linker script stanza for CAN message RAM 2020-10-06 11:48:55 -05:00
7ae96b4323 Adapt feather_m4 variant files to can 2020-10-06 11:42:24 -05:00
1ffdc7d0f0 Files from Atmel.SAME51_DFP.1.1.139.atpack 2020-10-06 11:42:08 -05:00
0c8e1ede52 boards.txt: add Feather CAN 2020-10-06 10:47:41 -05:00
lady ada
4c6d754c50 fix https://github.com/adafruit/ArduinoCore-samd/issues/266 2020-10-01 16:18:06 -04:00
lady ada
fa095b35c0 Merge branch 'master' of github.com:adafruit/ArduinoCore-samd 2020-09-28 20:23:35 -04:00
Ha Thach
9d4bdb8a01
increase for 1.6.3 release 2020-09-23 10:27:54 +07:00
Limor "Ladyada" Fried
9c667a4409
Merge pull request #265 from adafruit/fix-warning
fix matrixportal_m4 warning define
2020-09-22 23:26:08 -04:00
Ha Thach
e99eb502ae
Merge pull request #264 from adafruit/qtpy
QT Py!
2020-09-23 10:23:39 +07:00
hathach
a2151f384e fix matrixportal_m4 warning define 2020-09-23 10:15:49 +07:00
lady ada
0d46fb5839 fix name of chip 2020-09-22 23:07:48 -04:00
lady ada
4a5f9f7aae add custom init code for neopixel power pin to default on 2020-09-22 22:48:50 -04:00
lady ada
bdd8ee911b rev C complete! 2020-09-22 22:41:26 -04:00
lady ada
a029d61925 Merge branch 'master' of github.com:adafruit/ArduinoCore-samd 2020-09-19 17:22:08 -04:00
lady ada
fad2d91143 increase serial buffer (helps with bno08x uart!) 2020-09-19 17:22:03 -04:00
Ha Thach
6a59e8347d
Merge pull request #262 from adafruit/update-tinyusb
update tinyusb core
2020-09-15 23:50:03 +07:00
Limor "Ladyada" Fried
e6c07cc7d0
Merge pull request #263 from ulysse314/adafruit-master
Avoiding unused parameter warning for dmaDoNothingCallback()
2020-09-15 10:51:59 -04:00
moussaillon
814a352588 Avoiding unused parameter warning for dmaDoNothingCallback() 2020-09-15 16:32:21 +02:00
hathach
4888cdc958 update tinyusb core to commit e7b892095f2bb5d8bef6a748238369bdd268ed5e 2020-09-15 20:59:46 +07:00
hathach
a0d7cfdebc update tinyusb core to commit 0328bd4c134d05b4bb0472e0db918153f4dd15dd
also set string descriptor for Serial CDC
2020-09-15 19:41:28 +07:00
lady ada
bdf5ac8117 fix some pin numbers so that there's an LED on pin 13
add external SPI
2020-09-13 17:08:19 -04:00
lady ada
28cbc716e4 test external SPI flash + I2S 2020-09-13 00:15:00 -04:00
lady ada
028ca90052 rev A variant 2020-09-12 17:21:18 -04:00
Ha Thach
9ba4e98237
Increase version for release 1.6.2 2020-09-08 10:34:51 +07:00
Limor "Ladyada" Fried
8d3b49bf39
Merge pull request #259 from adafruit/matrixportal
Matrix portal draft
2020-09-03 23:30:44 -04:00
lady ada
c044ba3929 add bootloader 2020-08-31 11:57:49 -04:00
lady ada
9827155244 oof bad merge 2020-08-30 15:36:21 -04:00
lady ada
287d079c4d Merge remote-tracking branch 'origin/master' into matrixportal 2020-08-30 14:03:12 -04:00
Limor "Ladyada" Fried
d1c52f223b
Merge pull request #258 from adafruit/blmbadge
add blm badge
2020-08-30 13:44:48 -04:00
lady ada
1ba7379107 add blm badge 2020-08-30 13:25:44 -04:00
lady ada
66097a89e7 add fake LED 2020-08-30 13:19:38 -04:00
lady ada
731adc71be add variant 2020-08-29 02:39:04 -04:00
lady ada
1264ec61d7 Merge branch 'master' into matrixportal 2020-08-29 00:49:38 -04:00
Ha Thach
83b63b1e83
Merge pull request #257 from adafruit/fix-tone
Fix tone on SAMD51
2020-08-29 00:20:13 +07:00
hathach
aa5fa81bb7 use TC1 for servo, TC0 for tone for samd51
- make Tone_Handler() a strong symbol
2020-08-28 14:41:48 +07:00
Phillip Burgess
1e92424a50 Obscure SPI DMA bug fixed. Also, big non-blocking transfers supported. 2020-08-20 20:22:39 -07:00
Ha Thach
37a6ab97fa
Merge pull request #196 from ulysse314/unusedvariable
Removing _dacResolution for __SAMD51__ is not defined (variable not used)
2020-08-20 13:23:37 +07:00
Ha Thach
94e908c453
Merge branch 'master' into unusedvariable 2020-08-20 10:57:40 +07:00
Phillip Burgess
420b9a8429 Small SPI lib fix, add SWO pin to variant header 2020-08-19 11:36:20 -07:00
Ha Thach
fd40287bcb
Merge pull request #207 from henrygab/fix_compile_warnings3
Improve build script & fix more warnings
2020-08-10 14:12:13 +07:00
Henry Gabryjelski
66b0a74073 Use FIXME instead of BUGBUG 2020-08-09 23:50:13 -07:00
Henry Gabryjelski
55a9930808 reduce affected area of diagnostic push/pop 2020-08-07 11:28:53 -07:00
Henry Gabryjelski
134ebe7e18 typo - missing semicolon 2020-08-06 16:11:10 -07:00
Henry Gabryjelski
528a25e0ab @hathach is uncomfortable with attributes on function parameters 2020-08-05 21:27:36 -07:00
Henry Gabryjelski
adc0866b7d Hathach doesn't like attributes on parameters 2020-08-05 01:54:03 -07:00
Henry Gabryjelski
eb3c11472c Revert "TEST: Is LITTLE_ENDIAN already properly defined?"
This reverts commit 5cbfd74f4d.
2020-08-04 21:08:58 -07:00
Henry Gabryjelski
77321a6827 Merge branch 'fix_compile_warnings3' of https://github.com/henrygab/ArduinoCore-samd into fix_compile_warnings3 2020-08-03 20:43:25 -07:00
Henry Gabryjelski
a2801a1602 fix tab/space mixtures -- whitespace only change 2020-08-03 20:43:13 -07:00
Henry Gabryjelski
25a57896c0
Merge branch 'master' into fix_compile_warnings3 2020-08-03 17:09:31 -07:00
Henry Gabryjelski
00dd2e0097 Per @hathach request 2020-08-03 17:06:51 -07:00
Limor "Ladyada" Fried
ea9f1a5d28
Merge pull request #243 from nekuneko/patch-1
Enable Interrupt #8 on Pin PORTA28 (GPIO2)
2020-07-27 10:38:03 -04:00
Neku
b1572ceb25
Enable Interrupt #8 on Pin PORTA28 (GPIO2)
In order to use IRLibRecvPCI class from IRLib2 with Adafruit pIRKey, it's necessary to allow interrupts on this pin.
2020-07-27 02:21:31 +02:00
lady ada
0947169772 add blm badge 2020-07-25 17:21:05 -04:00
Ha Thach
d9e9508be4
Merge pull request #242 from adafruit/fix-extint-m4
Fix extint m4
2020-07-25 00:14:20 +07:00
hathach
76f0206f01 fix all other incorrect EXTINT 2020-07-24 23:05:48 +07:00
hathach
860bc6c6b9 fix EXTINT for PA4 and PA6
follow up to #239
2020-07-24 19:05:16 +07:00
Ha Thach
3f0f35fbc5
Merge pull request #239 from NanoCodeBug/patch-1
Fix external pin interrupt definitions for Feather M4
2020-07-24 17:00:43 +07:00
Ha Thach
4141fce796
Merge pull request #241 from adafruit/sync-tinyusb-238a5c0b95fcd402d24524c7bebbdd822168a51e
Sync with Adafruit_TinyUSB_ArduinoCore
2020-07-24 02:01:06 +07:00
hathach
2555c2d68a
sync with Adafruit_TinyUSB_ArduinoCore commit 238a5c0b95fcd402d24524c7bebbdd822168a51e 2020-07-23 07:02:41 +07:00
NanoCodeBug
57db4d7132
Fix external pin interrupt definitions for Feather M4
Spent a while trying to figure out why analog pins A4/18 and A5/19 where not working as interrupts, turns out the external interrupt definitions are wrong in-code. These fixed definitions now match the published pinout diagram for the feather m4 and the samd51 datasheet.
2020-07-21 22:07:38 -07:00
Ha Thach
50f9be1544
increase 1.6.1 for release 2020-07-21 18:37:20 +07:00
Limor "Ladyada" Fried
4b669eadb0
Merge pull request #235 from hathach/fix-ci-build
move test_cmsis_fast_rfft example to its own folder to fix ci build
2020-07-13 08:21:17 -04:00
hathach
2569103e1a move test_cmsis_fast_rfft example to its own folder to fix ci build 2020-07-13 18:26:29 +07:00
Ha Thach
196a29fc90
Merge pull request #232 from hathach/update-toolchain-cmsis
Update toolchain cmsis, fix build with tensorflow
2020-07-07 11:06:21 +07:00
Ha Thach
53c92d46e9
Increase version to 1.6.0 per review 2020-07-07 09:37:15 +07:00
hathach
290f3d6308
update cmsis from 4.5.0 to 5.4.0 2020-07-06 16:22:30 +07:00
hathach
246c75a1ae
bump up version for 1.5.15 2020-07-05 22:57:40 +07:00
hathach
00a863c100
update tinyusb to 0749077 2020-07-05 22:57:02 +07:00
hathach
ff82b735f2
remove gcc 7-2017q4 specific 2020-07-05 22:40:37 +07:00
lady ada
fdddb19a3c add BLE uart test support 2020-06-23 14:57:52 -04:00
Limor "Ladyada" Fried
bdf0c84109
Merge pull request #227 from OPEnSLab-OSU/master
Fix I2C SERCOM Hang (from Arduino SAMD core)
2020-05-28 22:06:27 -04:00
Noah Laptop
dad77cd8cc add SERCOM patch from arduino SAMD core 2020-05-28 17:20:30 -07:00
Ha Thach
52d793ed8e
release 1.5.14
fix samd21 USB IRQ typo,
2020-05-04 22:11:14 +07:00
Ha Thach
e607c3ddbe
Merge pull request #226 from hathach/fix-samd21-usb
fix incorrect USB IRQ typo for samd
2020-05-04 22:09:56 +07:00
hathach
6d6e5b1ee9 fix incorrect USB IRQ typo for samd 2020-05-04 22:00:22 +07:00
Ha Thach
d60ec0fae3
Merge pull request #224 from hathach/release-.1.5.13
Update TinyUSB to commit c59fa77 due to a bug in the stack
2020-04-24 00:09:34 +07:00
hathach
159ae8e550 Update TinyUSB to commit c59fa77 due to a bug in the stack
increase version 1.5.13
2020-04-23 23:44:46 +07:00
Ha Thach
d56901d13b
increase version to release 1.5.12 2020-04-22 11:41:28 +07:00
Ha Thach
a45b5c56f6
Merge pull request #221 from hathach/update-tinyusb
update tinyusb core and samd port
2020-04-22 11:30:28 +07:00
Ha Thach
6c2a982c35
Merge pull request #222 from versioduo/midi-buffer-size
tinyusb: MIDI - Increase buffer size
2020-04-22 11:08:16 +07:00
Kay Sievers
aa9792167d tinyusb: MIDI - Increase buffer size
We only transfer new packets when 64 bytes are available in the FIFO
buffer. This increase the buffer, so we can receive the next new packet
while still processing the current one.
2020-04-21 20:28:02 +02:00
hathach
72ebc1a809 sync with tinyusb commit 1d33aa9
fix issue with MIDI sysex driver
2020-04-22 00:20:50 +07:00
hathach
f564235648 update tinyusb core and samd port 2020-04-21 12:05:51 +07:00
Limor "Ladyada" Fried
bf24e95f7e
Merge pull request #217 from d-a-v/wless
less warnings on featherM0
2020-03-05 15:09:32 -05:00
David Gauchard
1112d77c3d less warnings on featherM0 2020-03-05 18:25:12 +01:00
Ha Thach
aa21fb1e13
increase version 1.5.11 for release 2020-02-27 00:09:20 +07:00
Limor "Ladyada" Fried
18e455f2df
Merge pull request #214 from hathach/fix-CI_Tests-warning
add fake CI_Tests.h header to make Arduino happy
2020-02-10 22:18:40 -05:00
hathach
bfba9812b7 add fake CI_Tests.h header to make Arduino happy 2020-02-11 10:10:12 +07:00
Limor "Ladyada" Fried
5b24029000
Merge pull request #211 from GMagician/Fix-AGCM4-total-pins
[AGCM4] Update total pins
2020-02-08 19:21:30 -05:00
GMagician
a5271b3d1c Update total pins
pin 95 is onboard SD detect. Real total pins is then 96 not 95
2020-02-08 23:42:15 +01:00
Ha Thach
b13e6c68b5
Update platform.txt
Increase version for release 1.5.10
2020-02-03 14:23:30 +07:00
Ha Thach
f55ecadb78
Merge pull request #210 from adafruit/flashdefines
Flashdefines
2020-02-03 10:26:14 +07:00
Lady Ada
b09a92698a & circuitplay too! 2020-02-01 22:00:17 -05:00
Lady Ada
6be91634fd add flash definitions 2020-02-01 21:59:12 -05:00
Henry Gabryjelski
12c4506437 Improve variant compliance
Starting in SAMD CORE 1.6.6, `digitalPinToInterrupt`
was moved to Arduino.h, variant.h must no longer define it.
2020-01-17 01:16:20 -08:00
Henry Gabryjelski
c68c0b19ae Disable -Wimplicit-fallthrough in sections
These two files contain code with switch statements,
where one case "fall through" to the next case.
As it's not currently clear if this is intentional or not,
rather than modifying the code in any way (regression risk),
use GCC diagnostic pragmas to disable this warning for
only these two files, with BUGBUG marking to encourage
review by someone more familiar with this code.
2020-01-17 01:16:20 -08:00
Henry Gabryjelski
5cbfd74f4d TEST: Is LITTLE_ENDIAN already properly defined? 2020-01-17 01:16:20 -08:00
Henry Gabryjelski
1a89b145ef Enhance warning output.
Add comment to line GCC points finger at.
This is not intended to fix the warning.
Rather, it is intended to make it clearer
that this may need a deeper review before
determining what (if any) code change would
be appropriate.
2020-01-17 01:16:20 -08:00
Henry Gabryjelski
e1e7b37ff3 Disable -Wimplicit-fallthrough for these two files.
These two files contain code with multiple switch statements,
where one case "fall through" to the next case.
As it's not currently clear if this is intentional or not,
rather than modifying the code in any way (regression risk),
use GCC diagnostic pragmas to disable this warning for
only these two files, with BUGBUG marking to encourage
review by someone more familiar with this code.
2020-01-17 01:16:20 -08:00
Henry Gabryjelski
4276526c67 Avoid compiler warning for unused parameter 2020-01-17 01:16:20 -08:00
Henry Gabryjelski
a2dd8614d4 Avoid signed/unsigned comparison warning. 2020-01-17 01:16:20 -08:00
Henry Gabryjelski
3253d46f45 Avoid unused parameter compiler warnings 2020-01-17 01:16:20 -08:00
Henry Gabryjelski
d5935a8c51 remove 'unused parameter' compiler warning 2020-01-17 01:16:20 -08:00
Henry Gabryjelski
4f80972c23 cast to uint32_t to avoid compiler warning
that said, it's possible this api might return
a variety of non-zero codes.  code could benefit
from being updated (e.g., documenting return codes)
2020-01-17 01:16:20 -08:00
Henry Gabryjelski
9ab68e1aff avoid warnings on unused parameter 2020-01-17 01:16:20 -08:00
Henry Gabryjelski
155cbc5262 Friendlier name for -Wall build 2020-01-17 01:16:20 -08:00
Henry Gabryjelski
622d9f6183 re-enable builds with all warnings 2020-01-17 01:16:20 -08:00
Henry Gabryjelski
cb97944642 Can we mark jobs as allowed to fail? 2020-01-17 01:16:20 -08:00
Limor "Ladyada" Fried
bee96c4a80
Merge pull request #206 from henrygab/fix_compile_warnings
Fix compile warnings
2020-01-16 21:16:54 -05:00
Henry Gabryjelski
8afd0523b1 Fix unintended fall-through
The compiler found this, not me.  Building with
all warnings enabled is recommended.
2020-01-16 16:15:34 -08:00
Henry Gabryjelski
52c988fea0 Mark unused parameters as such. 2020-01-16 16:14:30 -08:00
Henry Gabryjelski
70d3c1dbfe Fix warnings about redefinition of LITTLE_ENDIAN
For safety, this fix also validates that, if
`LITTLE_ENDIAN` was already defined, that it
was defined to have the same value that the
code sets this to.
2020-01-16 16:11:40 -08:00
Limor "Ladyada" Fried
330cb4e652
Merge pull request #202 from rlcamp/master
Force linker to use newer Arduino-provided versions of libarm_cortexM4lf_math.a
2020-01-07 00:01:56 -05:00
rlcamp
34013bfd63
Update boards.txt
Added extra space to force rerun of CI
2020-01-06 20:47:02 -08:00
Lady Ada
1df7e524ed add math linker test! 2020-01-06 23:34:20 -05:00
rlcamp
460b1c2249 Force linker to use newer Arduino-provided versions of libarm_cortexM4lf_math.a 2020-01-06 19:52:07 -08:00
Lady Ada
4cc3251b02 Merge branch 'master' of github.com:adafruit/ArduinoCore-samd 2020-01-06 22:35:55 -05:00
Lady Ada
ed2dded753 fix https://github.com/adafruit/ArduinoCore-samd/issues/187 2020-01-06 22:35:49 -05:00
Limor "Ladyada" Fried
c14e07828f
Merge pull request #200 from hathach/action-ci
Add action ci to build examples in libraries folder that comes with BSP
2020-01-02 14:05:29 -05:00
hathach
f2a21265b3 add action badge to readme 2020-01-02 17:24:17 +07:00
hathach
2cc7f72400 drop monster_m4sk 2020-01-02 17:17:30 +07:00
hathach
bab8b92f60 add skip file 2020-01-02 17:08:26 +07:00
hathach
c53c44331e build most of adafruit samd boards 2020-01-02 17:03:44 +07:00
hathach
9d9b509084 add metro_m4 test 2020-01-02 13:07:55 +07:00
hathach
1595e2f59b update lib deps 2020-01-02 12:53:46 +07:00
hathach
90c0b48235 add build all script 2020-01-02 12:47:54 +07:00
hathach
411cfa6d9a test metro_m0 build 2020-01-02 12:45:43 +07:00
Ha Thach
137c0bdf9f
increase version to 1.5.9 for release 2019-12-31 11:52:56 +07:00
Ha Thach
18b64d471f
Merge pull request #199 from hathach/develop
revert 6630fe7 availableForWrite() return int
2019-12-31 11:52:08 +07:00
hathach
fc737be24e revert 6630fe7cc0 availableForWrite() return int 2019-12-31 11:44:26 +07:00
Ha Thach
32e5394aea
Increase version for release 2019-12-30 15:55:52 +07:00
moussaillon
99f1fa3de8 Removing _dacResolution for no-__SAMD51__ (variable not used) 2019-12-29 02:29:16 +01:00
Ha Thach
2bf2a37784
Merge pull request #194 from hathach/develop
improve tinyusb samd driver
2019-12-27 11:17:42 +07:00
hathach
2ca9dfd40e
update tinyusb core 2019-12-27 11:15:59 +07:00
hathach
8e3c4bcaac
improve tinyusb samd driver 2019-12-26 23:00:37 +07:00
Ha Thach
1dcf3c53ed
Merge pull request #193 from hathach/develop
tinyusb core: improve setup handling
2019-12-25 23:19:02 +07:00
hathach
2179f63a97 tinyusb core: improve setup handling 2019-12-25 10:50:37 +07:00
Ha Thach
b1a79758ee
Merge pull request #192 from hathach/develop
update tinyusb
2019-12-24 22:22:14 +07:00
hathach
861fec5dbd update tinyusb core 2019-12-24 21:43:26 +07:00
hathach
31fc54d037 added option to debug tinyusb with Serial1 2019-12-24 16:03:23 +07:00
Limor "Ladyada" Fried
1941e1717a
Merge pull request #190 from hathach/develop
refactor tinyusb core
2019-12-20 12:30:38 -05:00
hathach
f996c946f3
clean up 2019-12-20 13:15:01 +07:00
hathach
21b3e13b70
update tinyusb core 2019-12-20 13:11:04 +07:00
hathach
bffd3048d7
clean up 2019-12-20 00:13:24 +07:00
hathach
dd19013a79
rename Adafruit_TinyUSB_Core.cpp to Adafruit_TinyUSB_SAMD.cpp 2019-12-20 00:11:19 +07:00
hathach
4f8ccb165c
move yield() to main.cpp 2019-12-19 23:54:15 +07:00
hathach
b92b61b36f
refactor load_serial_number() to Adafruit_USBD_Device::getSerialDescriptor() 2019-12-19 23:42:27 +07:00
hathach
a346cf760f
implement detach/attach 2019-12-19 23:12:25 +07:00
hathach
2bb0a7a759
tinyusb submodule work well 2019-12-19 14:49:53 +07:00
hathach
dfac9e8582
move tinyusb core & cdc to submodule 2019-12-19 13:25:36 +07:00
hathach
4cca5de20a Merge remote-tracking branch 'adafruit/master' 2019-12-18 22:27:22 +07:00
Lady Ada
516cec5a9b Merge branch 'master' of github.com:adafruit/ArduinoCore-samd 2019-12-10 22:41:17 -05:00
Lady Ada
6630fe7cc0 @hathach Arduino core now wants size_t returned 2019-12-10 22:41:12 -05:00
hathach
5f68c65680
Merge pull request #182 from kaysievers/tinyusb-descriptor-len
tinyusb: Correct descriptor string length calculation
2019-11-19 23:52:47 +07:00
Kay Sievers
7f3211f46d tinyusb: Correct descriptor string length calculation
This fixes strcpy_uni16() to return the correct number of characters.
It wasn't visible in the host so far, because the strings have been NUL
terminated.
2019-11-19 12:30:25 +01:00
Limor "Ladyada" Fried
361481d34d
Merge pull request #186 from adafruit/baud-fix
SAMD21: Fix freq clipping in SPI.h, allow 24 MHz SPI
2019-11-04 17:52:19 -05:00
Phillip Burgess
a2c0a5b547 SAMD21: Fix freq clipping in SPI.h, allow 24 MHz SPI
SPI clock freq previously clipped at MAX_SPI/2 (6 MHz) rather than MAX_SPI. Now works correctly.
Additionally, MAX_SPI set at 24 MHz on SAMD21. This is only slightly beyond spec and so far seems reliable with SD and SdFat tests on M0 Adalogger, eyes on HalloWing M0.
2019-11-04 14:45:51 -08:00
Lady Ada
9df0b07308 fix i2c for peripheral use thanks to https://github.com/adafruit/ArduinoCore-samd/pull/185 @JordanMajd 2019-11-02 23:26:49 -04:00
Lady Ada
6be0d1fa34 Merge branch 'JordanMajd-patch_samd51_i2c_slave' 2019-11-02 23:24:22 -04:00
Lady Ada
feb846a1ff add monster m4sk too 2019-11-02 22:44:40 -04:00
Jordan Majd
2b052e11f8 Reenable Serial1 sercom int handlers, disable Wire i2c slave int handlers 2019-10-31 18:26:16 +00:00
Jordan Majd
04a2dd8ace Preserve original formatting on base sercom handler 2019-10-31 16:32:16 +00:00
Jordan Majd
7a60a36a05 I2C slave support for Pyportal Titano M4 2019-10-31 03:51:06 +00:00
Jordan Majd
bc5fcc0d35 I2C slave support for Pyportal M4 2019-10-31 03:48:54 +00:00
Jordan Majd
8368e5f487 Update endif macro comment to reflect macro 2019-10-31 03:47:41 +00:00
Jordan Majd
684811d7ac I2C slave support for PyGamer M4 2019-10-31 03:46:38 +00:00
Jordan Majd
ccd2ef97c5 I2C slave support for PyGamer Advance M4 2019-10-31 03:44:15 +00:00
Jordan Majd
43e7bd8356 I2C slave support for Pybadge M4 2019-10-31 03:43:06 +00:00
Jordan Majd
84cef9a876 I2C slave support for Pybadge Airlift M4 2019-10-31 03:39:03 +00:00
Jordan Majd
3202e7794e I2C slave support for Metro Airlift M4 2019-10-31 03:35:27 +00:00
Jordan Majd
0897920a8c I2C slave support for Metro M4 2019-10-31 03:34:37 +00:00
Jordan Majd
74cfc245ba I2C slave support for Hallowing M4 2019-10-31 03:31:38 +00:00
Jordan Majd
efd29616db I2C slave support for Grand Central M4 2019-10-31 03:29:22 +00:00
Jordan Majd
3ed74de232 I2C slave support for Feather M4 2019-10-31 03:16:08 +00:00
Jordan Majd
4dbfc244cc I2C slave support for Trellis M4, temporarily disables UART Serial 1 2019-10-31 03:03:15 +00:00
Jordan Majd
e72343c867 Add the SAMD51s 4 i2c interrupts to ensure slave support 2019-10-31 01:11:32 +00:00
hathach
c7c17484b1 Merge remote-tracking branch 'adafruit/master' 2019-10-29 11:17:48 +07:00
ladyada
1ab7cb6cdd force using 2017 toolchain (instead of 2014) 2019-10-28 18:17:22 -04:00
ladyada
ee9df548b7 fix min/max macros
allow PDM mic on pybadge edge
change pyportal backlight timer
2019-10-27 23:53:38 -04:00
ladyada
841a1b8188 use arduino-api for min/max 2019-10-27 20:08:01 -04:00
ladyada
ceccc257e7 change backlight to tcc4 so it doesnt collide with servo 2019-10-17 01:35:53 -04:00
ladyada
6076e22f1a allow PDM mic on SPI 2019-10-16 19:24:58 -04:00
ladyada
a6e9eb3686 experiment with a bandgap analog read (not working) 2019-10-07 01:04:04 -04:00
ladyada
1efed72ada bump to add new boards, fix servo and tone 2019-10-04 18:28:54 -04:00
ladyada
1e9a669f07 change Tone on samd51 to be TC0 so we can use higher numbers for other stuff! (servo is TC1) 2019-10-04 18:26:27 -04:00
ladyada
e204bf375d add samd51-capable servo for now 2019-10-04 18:08:18 -04:00
ladyada
4bcbaa7287 fix typo from contrib 2019-10-04 18:06:23 -04:00
ladyada
ec12be530d Merge branch 'master' of github.com:adafruit/ArduinoCore-samd 2019-10-04 18:00:16 -04:00
ladyada
9a6ab51b0f remove serial1 2019-10-04 18:00:12 -04:00
hathach
bb4b17bf86 Merge remote-tracking branch 'adafruit/master' 2019-10-04 22:19:38 +07:00
hathach
2cc8b49e27
Merge pull request #179 from kaysievers/tinyusb-midi-jacks
tinyusb: MIDI - split descriptor initializer into individual sections
2019-10-04 21:59:54 +07:00
Limor "Ladyada" Fried
918379dacd
Merge pull request #180 from nekuneko/patch-1
Change references from A0 & A1 to DAC0 & DAC1
2019-09-19 22:01:42 -04:00
nekuneko
a09d821f9e
Change references from A0 & A1 to DAC0 & DAC1
New boards could have DAC0 & DAC1 on different pins. DAC0 & DAC1 pins are defined on each variant.h file, so it is not needed to reference to pins A0 & A1. With this change the code is more generic. Changes affect to analogWrite & analogRead functions.
2019-09-19 11:32:29 +02:00
Kay Sievers
e5af75a476 tinyusb: MIDI - split descriptor initializer into individual sections
This allows to compose the descriptor programmatically. The calling code
can compose a MIDI descriptor with up to 16 virtual wires/jacks at
initialization time.

Tested with the tinyusb -> MIDI -> midi_test example. This commit should
not change any behavior, future extensions of the calling MIDI device
will make use of it.
2019-09-11 12:58:36 +02:00
hathach
e5b45edf5b clean up 2019-09-10 17:21:47 +07:00
hathach
f739f3c37b
Merge pull request #177 from hathach/master
follow up to pr #172
2019-09-10 17:14:04 +07:00
hathach
7c02454fc7 added set/get LanguageDescriptor
add Descriptor to setManufacturer/setProduct
2019-09-10 17:11:40 +07:00
hathach
c4f34905db
Merge pull request #172 from kaysievers/usb-names-override
tinyusb: Allow to set the USB manufacturer/product identifiers
2019-09-10 16:49:02 +07:00
hathach
04eb7d174c
Merge pull request #173 from kaysievers/tinyusb-descriptor-size
tinyusb: Allow to replace the built-in descriptor buffer
2019-09-01 14:27:37 +07:00
Limor "Ladyada" Fried
ef4072fc23
Merge pull request #175 from nekuneko/patch-3
Added Additonal Timers
2019-08-28 14:52:07 -04:00
Limor "Ladyada" Fried
29c27b6a5a
Merge pull request #174 from nekuneko/patch-2
Enable TC6 & TC7 for __SAMD21J18A__
2019-08-28 14:51:34 -04:00
nekuneko
256bc5a70d
Added Additonal Timers
TC6_CH0, TC6_CH1, TC7_CH0, TC7_CH1 on SAMD21J
TCC0_CH6, TCC0_CH7, TCC1_CH4, TCC1_CH5, TCC1_CH6, TCC1_CH7, TC6_CH0, TC6_CH1, TC7_CH0, TC7_CH1 on SAMD51J
2019-08-28 13:36:51 +02:00
nekuneko
3591f2813f
Enable TC6 & TC7 for __SAMD21J18A__ 2019-08-28 13:26:48 +02:00
Kay Sievers
dcd4e5b4ff tinyusb: Allow to replace the built-in descriptor buffer
Huge USB configurations might need more than 256 bytes for the
config descriptor buffer. MIDI devices with 16 virtual ports
grow the descriptor to 600+ bytes.

This call replaces the built-in buffer with the supllied buffer. The
call copies the content of the old buffer to the new buffer:

  uint8_t buf[1024];
  USBDevice.setDescriptorBuffer(buf, sizeof(buf));
2019-08-27 13:04:18 +02:00
Kay Sievers
9417d790a7 tinyusb: Allow to set the USB manufacturer/product identifiers
Set the USB descriptor strings. I accepts UTF-8 strings with
codepoints up to 16 bit.

  void setup() {
    USBDevice.setManufacturer("MyManufacturer");
    USBDevice.setProduct("MyProduct");
  }
2019-08-27 12:05:44 +02:00
Limor "Ladyada" Fried
52ea598baa
Merge pull request #171 from kaysievers/platform-usb-power
platform: Add USB device MaxPower default setting
2019-08-26 12:48:48 -04:00
Kay Sievers
3a022a6812 platform: Add USB device MaxPower default setting
The MaxPower field specifies the maximum power that a device can
draw from the host, when the device is bus-powered.

Define the default value of 100mA default in the platform to
allow to override it from the board definition.

Some mobile devices will only supply 20mA. If a device is known to
draw less current, adding this to the board config will make it work:
  <boardname>.build.usb_power=20
2019-08-26 09:53:00 +02:00
hathach
e33ec1fe36
Merge pull request #167 from kaysievers/master
tinyusb: correct SAMD51 serial number extraction
2019-08-26 10:20:51 +07:00
hathach
3cad30de21
Merge pull request #170 from kaysievers/tinyusb-config-power
tinyusb: Allow configuration of power setting
2019-08-26 10:18:34 +07:00
hathach
c842d61919
Merge pull request #169 from kaysievers/tinyusb-warnings
tinyusb: Avoid compilation warnings
2019-08-26 10:17:23 +07:00
Limor "Ladyada" Fried
e214f12e28
Merge pull request #168 from kaysievers/warnings
Fix compilation warning
2019-08-24 23:00:31 -04:00
Kay Sievers
b369396d0a tinyusb: Allow configuration of power setting
In some cases the power value in the device descriptor needs to
be set to a lower value, commonly 20 mA, to not get rejected by iOS
devices.

The classic USB stack reads USB_CONFIG_POWER, this adds the same
logic to tinyusb.
2019-08-25 04:04:03 +02:00
Kay Sievers
4af46bfaaa tinyusb: Avoid compilation warnings
TinyUSB adds new warnings to the compilation process. Operations
inside of {} initializers get propagated to 'int' but get assigned
to uint8_t.

Add static casts to to uint8_t to avoid a bunch of warnings like this:
  cores/arduino/Adafruit_TinyUSB_Core/Adafruit_USBD_CDC.cpp: In member function
  'virtual uint16_t Adafruit_USBD_CDC::getDescriptor(uint8_t, uint8_t*, uint16_t)':
  cores/arduino/Adafruit_TinyUSB_Core/tinyusb/src/device/usbd.h:172:74: warning:
  narrowing conversion of '(((int)itfnum) + 1)' from 'int' to 'uint8_t
  {aka unsigned char}' inside { } [-Wnarrowing]
     5, TUSB_DESC_CS_INTERFACE, CDC_FUNC_DESC_CALL_MANAGEMENT, 0, (_itfnum) + 1,\
2019-08-25 03:13:43 +02:00
Kay Sievers
8f1711f7cc Fix compilation warning
Add 'const' declaration to avoid:
  cores/arduino/pulse.c: In function 'pulseIn':
    cores/arduino/pulse.c:44:29: warning: initialization discards
  'const' qualifier from pointer target type [enabled by default]
     volatile uint32_t *port = &(PORT->Group[p.ulPort].IN.reg);
                             ^
2019-08-25 03:08:17 +02:00
Kay Sievers
42915717a4 tinyusb: correct SAMD51 serial number extraction
TinyUSB does not match the exported serial numbers of the classic USB
stack.

The current code serializes the 32-bit words backwards, and the byte
nibbles are also backwards serialized.

A SAMD51 is exported like:
 EFADAF3113347335020202938343E0FF

while it should read:
  13FADAFE5337433139202020FF0E3438
2019-08-25 00:39:38 +02:00
Limor "Ladyada" Fried
54be8f04e3
Merge pull request #127 from GMagician/user-area
[SAMD51] Add software calibration init on startup
2019-08-22 12:56:38 -04:00
ladyada
3999dffd81 they'll need to define Serial1 so we dont get irq conflicts with DMA on the same pins, zats ok! 2019-08-14 18:19:55 -04:00
Ladyada
0b3ddf585a fix typo 2019-08-11 19:18:07 -04:00
hathach
955e28fe56
Merge pull request #164 from GMagician/fix-tinyusb
Fix tinyusb lost written chars
2019-08-08 13:25:07 +07:00
GMagician
15aaa2459c Revert "Remove unused method"
This reverts commit bc8148ba3a.
2019-08-08 07:02:16 +02:00
Limor "Ladyada" Fried
5ff858c1d5
Merge pull request #165 from brentru/add-pyportal-titano
Add Board Definition for PyPortal Titano
2019-08-07 17:42:37 -04:00
brentru
c551c20104 add definition for pyportal titano 2019-08-07 16:48:26 -04:00
GMagician
bc8148ba3a Remove unused method 2019-08-07 20:01:41 +02:00
GMagician
49f9e2f066 Fix tinyusb lost written chars
This will fix lost chars when tx buffer is full
2019-08-07 19:59:57 +02:00
ladyada
8a97e31803 unused file 2019-08-07 13:37:32 -04:00
hathach
e80f2f1b49
Update platform.txt 2019-08-06 12:23:32 +07:00
Limor "Ladyada" Fried
6ff862e6a4
Merge pull request #158 from hathach/tinyusb-webusb
update Tinyusb to support webusb
2019-08-01 13:29:46 -04:00
hathach
96adc67184 add PIN_NEOPIXEL macro for feather/metro m0/m4 hallow_m0 2019-08-01 21:31:56 +07:00
hathach
c4aebf3bd7 tinyusb clean up 2019-08-01 13:18:11 +07:00
hathach
b88912c4cf fix availableForWrite() signature 2019-08-01 11:25:57 +07:00
hathach
732bc9e3a0 add missing files 2019-08-01 11:17:20 +07:00
hathach
6f8675815e update tinyusb stack for webusb support
- add Serial availableForWrite()
-
2019-08-01 11:03:27 +07:00
Limor "Ladyada" Fried
553d3c8f0e
Merge pull request #155 from GMagician/fix-tone
Fix tone
2019-07-29 13:20:54 -04:00
GMagician
e51b006a3f Fix tone
- match timer and timer handler
- lower interrupt priority (0 seems to big for a simple tone)
- be sure 'toneIsActive' is always set (if previous tone was using a different pin, it's not set
2019-07-29 18:46:42 +02:00
Limor "Ladyada" Fried
b22e7654fc
Merge pull request #154 from adafruit/hallowings
hallowing m4 final UART fix
2019-07-27 13:21:29 -04:00
ladyada
0c63da60f7 hallowing m4 final UART fix 2019-07-27 13:20:45 -04:00
Limor "Ladyada" Fried
7cc4586130
Merge pull request #153 from adafruit/hallowings
add hallowing and m4sk
2019-07-27 13:19:16 -04:00
Limor "Ladyada" Fried
c08f564269
Merge pull request #152 from GMagician/Fix-missin-unsigned-pin
Fix missing unsigned pin and indetation
2019-07-26 16:59:18 -04:00
GMagician
2bf7821f70 Missing pin 2019-07-26 21:56:08 +02:00
Limor "Ladyada" Fried
3cd1d9e430
Merge pull request #151 from adafruit-mike-stone/master
minor correction to comments in variants/metro_m4/variant.cpp
2019-07-26 15:50:39 -04:00
Mike Stone
e20ac5e5be minor correction to comments in variants/metro_m4/variant.cpp 2019-07-26 14:43:02 -05:00
hathach
fbc7ec4dff
Merge pull request #149 from GMagician/fix-compile-warnings
Fix compile warnings
2019-07-27 01:19:08 +07:00
Limor "Ladyada" Fried
10ebeba6b9
Merge pull request #147 from GMagician/fixes
Remove unsigned from pins
2019-07-26 14:00:48 -04:00
GMagician
f937db2251 Fix compile warnings 2019-07-26 18:44:13 +02:00
GMagician
8362ba3b96 Removing unsigned from pins 2019-07-26 18:24:04 +02:00
Limor "Ladyada" Fried
f4f87c8ba3
Merge pull request #146 from GMagician/addmissingpin
Add missing pin
2019-07-25 17:31:48 -04:00
GMagician
54910c06cf Add missing pin
- Added onboard sd detect pin
- Removed duplicated space chars
2019-07-25 22:15:04 +02:00
Limor "Ladyada" Fried
6e78986f34
Merge pull request #145 from GMagician/uniform-with-arduino
Standardize pins count
2019-07-24 16:12:11 -04:00
GMagician
5e7f7a14bb Standardize pins count
Arduino framework doesn't force unsigned (checked in different boards).
This also prevent undesired warnings in Marlin Firmware
2019-07-24 22:06:11 +02:00
ladyada
d8b0ad85c3 fix for rev C 2019-07-23 17:06:24 -04:00
Limor "Ladyada" Fried
0b069c10e7
Merge pull request #143 from GMagician/fix-analog-count
Update nr of analog input
2019-07-22 12:25:27 -04:00
GMagician
56b5392088 Update nr of analog input
Following #125
2019-07-22 17:22:49 +02:00
Limor "Ladyada" Fried
751cec6c03
Merge pull request #140 from hathach/fix-samd51-ram-macro
Fix samd51 ram macro
2019-07-17 12:45:57 -04:00
hathach
2568b78213 use __SAMD51__ macro for io.h 2019-07-17 14:26:48 +07:00
hathach
3bb94f51b8 fix RAMSTART, RAMSIZE, RAMEND for samd51 and same21 2019-07-17 12:45:44 +07:00
ladyada
51461f9a3a add tinyusb midi support 2019-07-15 15:53:35 -04:00
ladyada
f8208799be Merge branch 'master' into hallowings 2019-07-14 17:40:51 -04:00
ladyada
70240054fb fix pin numberings 2019-07-14 17:40:37 -04:00
ladyada
9e2724918c update naming 2019-07-13 16:17:07 -04:00
Limor "Ladyada" Fried
68e65f2b9a
Merge pull request #138 from hathach/master
fix incorrect midi descriptor template
2019-07-08 23:41:07 -04:00
hathach
fa04386790 fix incorrect midi descriptor template 2019-07-09 10:38:04 +07:00
Limor "Ladyada" Fried
961c470159
Merge pull request #137 from hathach/master
fix auto descriptor's auto interface e.g MIDI interface
2019-07-08 12:16:14 -04:00
hathach
edc13ba71f add itfnum to getDescriptor() 2019-07-08 22:49:05 +07:00
ladyada
e8303705b3 fix missing dac1 definition (on stemma connector) 2019-07-07 18:57:11 -04:00
Limor "Ladyada" Fried
b216a22e0e
Merge pull request #136 from hathach/master
fix MIDI with window driver
2019-07-06 20:20:24 -04:00
hathach
11d6f547c3 midi only use audio 1.0 without IAD 2019-07-05 16:44:38 +07:00
ladyada
692b4a6944 hallowing m4 2019-07-04 13:21:32 -04:00
Limor "Ladyada" Fried
855523d669
Merge pull request #135 from hathach/tinyusb-midi
enable TinyUSB MIDI
2019-07-03 15:26:38 -04:00
hathach
ff7b62d45b enable usb midi in tusb_config.h 2019-07-04 01:48:24 +07:00
hathach
0aa2b2fcb6 update tinyusb to support midi 2019-07-04 01:48:08 +07:00
Limor "Ladyada" Fried
5c318aad3b
Merge pull request #134 from beeryt/patch-1
Wiring: Clean up repeated pin description access
2019-07-03 12:26:10 -04:00
T. Carl Beery
206a7acd99
Wiring: Clean up repeated pin description access 2019-07-03 08:24:06 -07:00
ladyada
d9ef135999 Merge branch 'hallowings' of github.com:adafruit/ArduinoCore-samd into hallowings 2019-06-29 00:29:16 -04:00
ladyada
3688c468ce fix some mask GPIO - add hallowing m4 (TFT untested) 2019-06-29 00:28:58 -04:00
Phillip Burgess
3b0115cffc SERCOM3 pad juggling for PDM 2019-06-27 18:21:39 -07:00
ladyada
5078941dfb some stuff working on mask (i2c, audio) 2019-06-25 21:32:32 -04:00
Limor "Ladyada" Fried
1672e7124b
Merge pull request #132 from kaysievers/master
USBCore: Read the SAMD51 serial number
2019-06-24 09:24:47 -04:00
Kay Sievers
23fd362a72 USBCore: Read the SAMD51 serial number
Export the unique hardware serial number from the SAMD51 MCU
to the USB device descriptor.

Remove the concatenation of the USB class device string, it is
superfluous, and an USB interface property should not become a
part of the USB device property.

Tested on SAMD21 and SAMD51:

Before:
  SAMD21: 10BD8E4051504C3750202020FF0B1410MIDI
  SAMD51: MIDI

After:
  SAMD21: 10BD8E4051504C3750202020FF0B1410
  SAMD51: AAFC165853574E514D202020FF083C44
2019-06-23 22:02:35 +02:00
Limor "Ladyada" Fried
5c60a5ac21
Merge pull request #130 from brentru/add-pybadge-airlift-m4
Add PyBadge AirLift
2019-06-20 13:33:46 -04:00
Limor "Ladyada" Fried
fd0d925466
Merge pull request #131 from brentru/add-nina-naming
Add NINA_ACK to WiFi Boards
2019-06-20 13:31:14 -04:00
brentru
616f0c929a add to pyportal 2019-06-20 11:14:52 -04:00
brentru
92d99e90ad add NINA_ACK standard pin 2019-06-20 11:12:33 -04:00
Limor "Ladyada" Fried
9b2e698f6b
Merge pull request #125 from GMagician/Fix-analogInputToDigitalPin
Fix analogInputToDigitalPin for Grand Central M4
2019-06-15 23:00:35 -04:00
ladyada
b2cf1b106c bump version, remove -g flags 2019-06-15 23:00:04 -04:00
ladyada
66a844f050 fix for trinket/gemma m0 2019-06-15 22:59:15 -04:00
brentru
135eb717f4 add tft pins 2019-06-14 10:09:44 -04:00
Giuliano Zaro
29bfe96f8e
Fix compiler error
Removed unnecessary bracket
missing usb padcal
2019-06-14 11:35:05 +02:00
brentru
c94e1598bf adding correct number of pins, fix header guard, cleanup comments, rename to nina fw defaults 2019-06-13 18:27:41 -04:00
brentru
aa23d7a56f fix SS and ACK pins 2019-06-13 17:55:07 -04:00
brentru
4269f8a3f3 add correct ESP32 pins 2019-06-13 16:16:38 -04:00
brentru
d78c105f08 add SPIWIF_ACK 2019-06-13 15:37:59 -04:00
brentru
ff27aa43e9 add updated pin variant 2019-06-13 15:29:38 -04:00
brentru
d1ae3d83af added variant for pybadge airlift, modified pins in variant.cpp to reflect schematic 2019-06-12 14:55:10 -04:00
brentru
e95527efbb changed size to match J20 size 2019-06-12 14:24:28 -04:00
brentru
b2dab994af added pybadge airlift to boards.txt 2019-06-12 14:17:20 -04:00
ladyada
cec0a6bd7d add opts all around 2019-06-09 22:11:04 -04:00
ladyada
b89404cf52 Merge branch 'master' of github.com:adafruit/ArduinoCore-samd 2019-06-08 13:50:39 -04:00
ladyada
02d93cca94 more opts! and advance 2019-06-08 13:50:34 -04:00
GMagician
7a550677bc [SAMD51] Add softwater calibration init on startup
Use calibration software area fuses to initialize devices
2019-06-08 18:45:23 +02:00
GMagician
3c7073326c Fix analogInputToDigitalPin for Grand Central M4 2019-06-06 18:57:08 +02:00
Limor "Ladyada" Fried
c84ce7edb1
Merge pull request #122 from hathach/tinyusb
run usb background when checking for Serial.available() if needed
2019-06-05 14:12:33 -04:00
hathach
34389498c5
yield() if needed when calling Serial.write() 2019-06-05 23:09:44 +07:00
hathach
a89950536a
run usb background when checking for Serial.available() if needed 2019-06-05 17:37:15 +07:00
ladyada
d787240dab add debug flag option 2019-06-03 18:45:22 -04:00
Limor "Ladyada" Fried
3ca3967711
Merge pull request #121 from adafruit/tinyusb
windows serial fix
2019-05-27 14:44:11 -04:00
Limor "Ladyada" Fried
c85d59c371
Merge pull request #120 from hathach/adafruit-tinyusb
fix windows serial issue
2019-05-27 14:43:11 -04:00
hathach
f8ad400ff2 fix serial issue with windows 2019-05-27 18:50:15 +07:00
Limor "Ladyada" Fried
b73c167ce0
Update platform.txt
Big update since we've added so much!
2019-05-26 23:33:44 -04:00
Limor "Ladyada" Fried
a027455d39
Merge pull request #119 from hathach/adafruit-tinyusb
fix load_serial_number() warning
2019-05-26 23:05:30 -04:00
hathach
4e4e2846f9 fix load_serial_number() warning 2019-05-25 14:01:25 +07:00
Limor "Ladyada" Fried
e7c57199e8
Merge pull request #117 from adafruit/tinyusb
Tinyusb branch
2019-05-24 01:54:00 -04:00
Limor "Ladyada" Fried
918d820d53
Merge pull request #118 from hathach/adafruit-tinyusb
fix tinyusb hid raw inout issue
2019-05-24 01:53:50 -04:00
hathach
3faad0375e fix tinyusb hid raw inout issue 2019-05-24 12:50:39 +07:00
Limor "Ladyada" Fried
6194fc367b
Merge pull request #116 from adafruit/pb-spi
Merge Adafruit_ZeroDMA into SAMD core libraries
2019-05-23 02:43:25 -04:00
Phillip Burgess
9a07f418ce SPI DMA transfer() function working now 2019-05-22 21:35:58 -07:00
Phillip Burgess
8b88806d46 SPI DMA still WIP still not working 2019-05-22 21:11:49 -07:00
Phillip Burgess
8f123f315b SPI DMA WIP and still not working :/ 2019-05-22 14:22:50 -07:00
Phillip Burgess
99b90ffb48 DMA WIP still not working 2019-05-22 11:17:52 -07:00
Phillip Burgess
91e43ef443 SPIClass DMA transfer() function WIP 2019-05-21 22:14:45 -07:00
Limor "Ladyada" Fried
595aa2c126
Merge pull request #115 from hathach/adafruit-tinyusb
minor enhancement for usb cdc
2019-05-21 22:21:33 -04:00
hathach
217fe38647 move yield() usb background in to TinyUSB Core 2019-05-22 09:02:24 +07:00
hathach
a75a324a4c fix TinyUSB stack read signed char 2019-05-22 08:59:10 +07:00
hathach
404c9e4068 improve TinyUSB port
add yield to stream timeRead() timePeek() and Serial::bool()
2019-05-22 00:48:41 +07:00
Phillip Burgess
10b8b55c27 Move Adafruit_ZeroDMA into SAMD core so SPI lib can rely on it 2019-05-20 22:26:17 -07:00
Limor "Ladyada" Fried
212c1922ba
Merge pull request #114 from hathach/adafruit-tinyusb
sync with master
2019-05-16 21:48:33 -04:00
hathach
0f22c475f5 Merge remote-tracking branch 'adafruit/master' into adafruit-tinyusb 2019-05-17 08:45:53 +07:00
hathach
a524e2cbea
add Adafruit_TinyUSB_Core_touch1200() 2019-05-15 23:32:56 +07:00
hathach
b148e8a614 update tinyusb 2019-05-15 23:26:45 +07:00
ladyada
3f79b9db6f add extra PID option https://github.com/adafruit/ArduinoCore-samd/issues/113 2019-05-13 17:22:49 -04:00
Limor "Ladyada" Fried
f36d409355
Merge pull request #112 from hathach/adafruit-tinyusb
update tinyusb
2019-05-13 01:01:48 -04:00
hathach
3e415ba7be
add tud_cdc_write_flush() call in main() and yield() 2019-05-12 23:51:37 +07:00
hathach
5632e53759
update tinyusb tud_descriptor_configuration_cb 2019-05-12 20:01:18 +07:00
hathach
caf36be549
update tinyusb for new string/hid/device/config descriptor callback 2019-05-12 15:45:42 +07:00
hathach
c727f2b197 update usb core to use tud_descriptor_string_cb() 2019-05-11 23:34:46 +07:00
Limor "Ladyada" Fried
60c0542463
Merge pull request #111 from adafruit/pb-spi
Fix typedef syntax
2019-05-11 00:40:07 -04:00
Phillip Burgess
4b57e88b4b Fix typedef syntax 2019-05-10 21:26:30 -07:00
Limor "Ladyada" Fried
01ea159d19
Merge pull request #110 from adafruit/pb-spi
Better SPI SERCOM clock control
2019-05-10 21:33:23 -04:00
Phillip Burgess
e86546521f Separated getDMACID() function into getDMAC_ID_TX() and getDMAC_ID_RX() 2019-05-10 17:46:33 -07:00
Phillip Burgess
adc7241859 REMOVE M4 boards "Max SPI" menu 2019-05-09 13:18:53 -07:00
Limor "Ladyada" Fried
d81bda401e
Merge pull request #109 from hathach/adafruit-tinyusb
fix tinyusb bug with clear stall and reset data toggle
2019-05-09 13:37:17 -04:00
hathach
0552d34dab Merge remote-tracking branch 'adafruit/master' into adafruit-tinyusb 2019-05-10 00:12:33 +07:00
hathach
af90d98a6e fix samd dcd_clear_stall also reset data toggle 2019-05-10 00:08:23 +07:00
hathach
3c5f92d49d better use USE_TINYUSB for stack detection 2019-05-09 23:50:20 +07:00
hathach
4f9fef7b0e update tinyusb lib 2019-05-09 23:49:44 +07:00
Phillip Burgess
7616dab297 SERCOM stuff - simplify, cleanup, add SAMD21 dummy funcs 2019-05-08 09:44:05 -07:00
Phillip Burgess
651862fd47 WIP SPI SERCOM clock source changes 2019-05-07 23:30:55 -07:00
Phillip Burgess
59d869d79d WIP change SPI SERCOM clock source at runtime rather than compile-time 2019-05-07 23:05:52 -07:00
ladyada
d331767eac woops wrong PIDs 2019-05-03 03:03:29 -04:00
hathach
e770ae4301 error message when compile usb demo without selecting it 2019-05-03 13:14:59 +07:00
Limor "Ladyada" Fried
cd0f54edfc
Merge pull request #108 from hathach/adafruit-tinyusb
fix load serial string based on device id
2019-05-03 02:11:45 -04:00
hathach
dda4eaf546 fix load serial string based on device id 2019-05-03 13:07:19 +07:00
Limor "Ladyada" Fried
4d317b03dc
Merge pull request #107 from hathach/adafruit-tinyusb
add bi-directional HID
2019-05-03 01:00:51 -04:00
hathach
c21b6014b6 add hid bufsize 2019-05-03 00:00:58 +07:00
hathach
71922ef9e2 Merge branch 'tinyusb' into adafruit-tinyusb 2019-05-02 21:05:40 +07:00
hathach
96075f637e update tinyusb to support bi-directional HID 2019-05-02 21:01:36 +07:00
Limor "Ladyada" Fried
7a2e3e1a99
Merge pull request #106 from hathach/adafruit-tinyusb
Add TinyUSB as optional usb stack (drop down selection)
2019-04-30 16:01:31 -04:00
hathach
ab16f9899d add menu dropdown list for usb stack selection 2019-05-01 01:01:59 +07:00
brentrubell
498429e7a8 rename nina to esp32_, redefine NINA_ (#105) 2019-04-29 17:31:13 -04:00
hathach
617cc6c596 rename usb core folder 2019-04-30 00:21:13 +07:00
hathach
9c07070580 get msc & hid example work with metro m0 express 2019-04-30 00:12:17 +07:00
ladyada
ff2cb608a9 fix wrong SPI pins 2019-04-27 14:25:50 -04:00
ladyada
bf24eaaf7d match pybadge better 2019-04-27 02:25:36 -04:00
ladyada
356bf82843 annotate ADCs 2019-04-26 22:54:54 -04:00
ladyada
71e953f011 fix variant multi-define complaints 2019-04-26 22:49:41 -04:00
ladyada
f2f99a2392 allow non '51s to compile 2019-04-24 13:27:25 -04:00
ladyada
beb338ebea post-release fixes, including hopefully automated travis builds 2019-04-24 13:06:10 -04:00
ladyada
e40e387213 Fix for https://github.com/cstawarz 2019-04-24 12:47:02 -04:00
ladyada
046de9b4af move build flags to platform 2019-04-24 00:34:44 -04:00
ladyada
22efce962f fix backlight timer PWM 2019-04-23 23:29:59 -04:00
ladyada
54768abed7 woops forget to setup serial pins as sercoms 2019-04-23 16:30:05 -04:00
Paint Your Dragon
eb639a9bd7 Change QSPI menu (#104)
* Add QSPI menu, fix SPI compiler settings for some boards

* Change QSPI menu (fast = F_CPU/2)
2019-04-22 23:07:57 -04:00
Paint Your Dragon
3ec33c9c02 Add QSPI menu, fix SPI compiler settings for some boards (#103) 2019-04-22 22:01:37 -04:00
ladyada
1b780ba76d Merge branch 'master' of https://github.com/arduino/ArduinoCore-samd 2019-04-22 16:40:53 -04:00
ladyada
68ff9d5402 typo fix for https://github.com/adafruit/ArduinoCore-samd/issues/99 2019-04-22 16:37:54 -04:00
ladyada
da400c7283 Merge branch 'pb-overclock' 2019-04-22 16:36:57 -04:00
ladyada
896b203184 we swapped backlight and reset on final design (to be more circuitpy-happy) 2019-04-22 16:30:21 -04:00
Phillip Burgess
2b2b8f0610 Add max SPI speed select menu for M4 2019-04-21 22:30:57 -07:00
ladyada
e35b44b997 Merge branch 'master' of github.com:adafruit/ArduinoCore-samd 2019-04-21 01:55:18 -04:00
ladyada
39b621391b some alternate SPI's for CPX 2019-04-21 01:55:00 -04:00
ladyada
a89a0dfe23 tweaks to make gamebuino meta compile 2019-04-21 01:54:21 -04:00
Limor "Ladyada" Fried
bc8d8b861f
Overclocking and optimizer settings for M4 boards (#100) 2019-04-21 01:47:47 -04:00
Phillip Burgess
2061fe33c7 Overclocking and optimizer settings for M4 boards 2019-04-19 21:08:44 -07:00
ladyada
451a78e430 add pygamer, rename wifi to airlift 2019-04-18 12:18:11 -04:00
jesserod
bd082fa1f6 Do not initialize all pins to INPUT (#98)
Comment out the initialization of all SAMD21 pins to INPUT to allow them to remain tri-stated by default.   

See https://github.com/adafruit/Adafruit_SleepyDog/issues/17#issuecomment-481798215
2019-04-17 11:40:56 -04:00
Martino Facchin
cee8257749
Merge pull request #400 from sandeepmistry/mkrwan-spi1-sercom-fix
MKR WAN 1300: Correct sercom pads for SPI1
2019-04-11 17:59:41 +02:00
Sandeep Mistry
dea5340516 MKR WAN 1300: Correct sercom pads for SPI1 2019-04-11 11:52:15 -04:00
ladyada
d9d87d60d2 pybagdge non-final variant 2019-04-10 08:32:01 -04:00
ladyada
4f8619b918 re-add erase, change Tone TC to TC3 2019-04-10 08:31:22 -04:00
ladyada
904acd1071 speed up samd21 by not erasing (we auto-erase). add SPI1 for TFT connection 2019-04-07 16:36:18 -04:00
ladyada
a2d9587950 up to 24 mhz SPI on SAMD51. added another ESP32 def 2019-04-04 13:44:37 -04:00
Sandeep Mistry
5564125d7c Version 1.6.21 2019-04-01 10:18:03 -04:00
ladyada
9daef7b4b5 metro m4 with wifi! 2019-03-16 02:11:21 -04:00
ladyada
79fc15cdc5 fix merge 2019-03-08 17:12:10 -05:00
ladyada
94ac9318d0 Merge branch 'arduino-master' 2019-03-08 14:04:30 -05:00
ladyada
4d8adc9be4 Merge branch 'master' of https://github.com/arduino/ArduinoCore-samd into arduino-master 2019-03-08 14:03:54 -05:00
Riccardo Rizzo
07c2e57fe4 Changed POW_ON pin value on MKR1500's variant
Changed POW_ON pin value on MKRNB 1500 vatriant file, to allow the power on from MKRNB library.
2019-03-04 09:20:40 -05:00
ladyada
1b2de9f6de bump version 2019-03-01 20:32:55 -05:00
ladyada
d22831bcd7 no longer used 2019-03-01 20:30:40 -05:00
ladyada
ef5bf392c7 rearrange analog pins, let D3/D4 be a sercom 2019-03-01 20:28:07 -05:00
aryelevin
98e2a3e429 Some fixes to the startup code - clocks configs (#89)
* Reverted 1MHz clock generator to GCLK5 instead GCLK7
Fixed the clock divider of 1MHz clock generator to be 48 (its source is DFLL which clocking at 48MHz, so 48 / 48 = 1, it was 48 / 24 = 2).
Updated the PLLs to the proper Ratio afetr the change of the 1MHz clock source.
Disabled GCLK_GENCTRL_DIVSEL reg on the 12MHz clock generator, since this caused the clock to be 1.5MHz.

* Fixed a description comment.
2019-02-13 15:27:27 -05:00
ladyada
3f7a027cf1 Merge branch 'pb-portal'
# Conflicts:
#	boards.txt
2019-01-30 17:51:23 -05:00
ladyada
5df9f65eaf rev C 2019-01-30 17:49:35 -05:00
ladyada
3a32265142 we erase per sector on update anyway - this is a huge speedup! 2019-01-26 15:59:35 -05:00
ademuri
d2620a72d2 Fix analog ref enums. (#83)
AR_INTERNAL was removed in #74. Because of this, non-SAMD51 boards fail because AR_INTERNAL isn't defined.
This also define AR_INTERNAL_2V23, which is also used for non-SAMD51
boards.
2019-01-26 15:26:05 -05:00
brentrubell
2443eac3ac fix typo, add more board openocd configs, link in boards.txt (#82) 2019-01-23 11:05:52 -05:00
ladyada
6af6f7e417 we erase per sector anyways 2019-01-23 02:16:13 -05:00
ladyada
5de9436aae jlink openocd fixes (needs testing on non-windows) 2019-01-22 22:58:58 -05:00
ladyada
abbad5fcb0 Merge branch 'master' of github.com:adafruit/ArduinoCore-samd 2019-01-22 21:27:29 -05:00
brentrubell
0145c48321 force jlink/swd, rename all m0 arduino_zero.cfg to board_name.cfg (#81) 2019-01-22 21:01:57 -05:00
Carter Nelson
eef12c3d91 fix Feather M4 I2S pins (#80) 2019-01-22 01:18:31 -05:00
brentrubell
d86ce47cd4 update programmers.txt file for seger jlink (#79) 2019-01-18 18:24:26 -05:00
ladyada
cf1d43cf7c add wifi esp32 support 2019-01-18 15:54:05 -05:00
ladyada
87d70e47d4 start defining some wifi pads 2019-01-18 01:32:58 -05:00
ladyada
74fc71a2f2 remove unavail timers! 2019-01-17 18:36:59 -05:00
Phillip Burgess
4cd8f8c0f2 Update boards.txt 2019-01-17 15:26:01 -08:00
Phillip Burgess
2bd27cd95f Update boards.txt 2019-01-17 15:24:43 -08:00
Phillip Burgess
134067bea8 Begin boards.txt entry, rename pyportal to pyportal_m4 2019-01-17 15:08:30 -08:00
Phillip Burgess
7506ded082 PyPortal variant work 2019-01-17 15:01:51 -08:00
Phillip Burgess
3580fc5847 Juggling pins 2019-01-17 14:49:33 -08:00
Phillip Burgess
1ea494ed0c Pin desc WIP 2019-01-17 14:35:07 -08:00
ladyada
e49bf19a9d Merge branch 'master' of github.com:adafruit/ArduinoCore-samd 2019-01-17 17:19:43 -05:00
Phillip Burgess
b0ec44506f More pyportal variant WIP 2019-01-17 12:30:56 -08:00
Phillip Burgess
23190e0165 More pin def WIP 2019-01-17 12:05:17 -08:00
Phillip Burgess
2d4ff30450 More pin def WIP 2019-01-17 10:28:04 -08:00
Phillip Burgess
aaddcc7eeb Initial PyPortal WIP 2019-01-16 23:10:59 -08:00
Phillip Burgess
6288f12695 Remove from wrong branch argh 2019-01-16 23:10:18 -08:00
Phillip Burgess
126e06acce Initial PyPortal WIP 2019-01-16 23:09:29 -08:00
ladyada
e4b25f2b53 Merge branch 'master' of github.com:adafruit/ArduinoCore-samd 2019-01-12 12:40:18 -05:00
Florian Heilmann
458b5d9dd7 Fix 'Unused Parameter' warnings in HardwareSerial.h (#78)
This small change removes many of the warnings that are generated when compiling this core with warnings switched on.
2019-01-11 12:21:49 -05:00
Bill Westfield
2ca67fc36b Fix delayMicroseconds() on SAMD51 (#77)
* Fix pulseIn() on SAMD51 by writing it in plain C, so that
the CM0+-specific pulse_asm won't need to be linked.
The SAMD51 is fast enough that we can time pulses with micros()
Tested with a bunch of pulse lengths from <1us to >1s

* Implement a new delayMicroseconds() function for SAMD51
This version enables the "Debug Watchpoint and Trace" module (DWT)
in startup.c and then uses the 32bit cycle counter that is part
of DWT to count cycles indepenent of instruction timing.
Tested for good accuracy with various values between 1 and 2000us.
2019-01-09 19:57:43 -05:00
Bill Westfield
f4b1ecfcea Fix pulseIn() on SAMD51 by writing it in plain C, so that (#76)
the CM0+-specific pulse_asm won't need to be linked.
The SAMD51 is fast enough that we can time pulses with micros()
Tested with a bunch of pulse lengths from <1us to >1s
2019-01-09 12:05:51 -05:00
John Baker
166b43b8dc Update wiring_analog.c and wiring_analog.h (#74)
* Update wiring_analog.c and wiring_analog.h

* Correct typos in comments so voltages are correctly identified
2019-01-05 18:42:09 -05:00
Arturo Guadalupi
a69fbe34a5
Merge pull request #378 from sandeepmistry/MKR-sercom-juggle
MKR boards: I2C to sercom2, SPI1 + Serial2 to sercom4
2018-12-13 16:57:05 +01:00
Riccardo Rizzo
3b6466b5e6 More accurate delay() function from BenF.
porting of 67c0a1995a (diff-ab397febf179e1982f4ee0758df4c982)
2018-12-13 10:33:06 -05:00
Dan Halbert
2fed3d20e3 bump to version 1.2.9 for new release 2018-12-07 12:39:14 -05:00
Dan Halbert
ef69627363
Merge pull request #60 from dhalbert/no-win10-cpx-adafruit
Do not install CPX drivers on Windows 10
2018-12-07 10:36:18 -05:00
deanm1278
34b81c2c48
Merge pull request #70 from adafruit/dm-hallowing-pwm
fix pwm for m0
2018-11-29 15:47:55 -05:00
dean
0c9bb3488b DM: fix pwm initialization bug 2018-11-29 15:40:31 -05:00
Sandeep Mistry
f0ca3afab8 MKR boards: I2C to sercom2, SPI1 + Serial2 to sercom4 2018-11-29 14:03:37 -05:00
dean
c7fa463c0d DM: fix pwm? 2018-11-29 13:54:35 -05:00
Sandeep Mistry
97502e969d Update CHANGELOG 2018-11-28 09:57:03 -05:00
dean
c629896172 DM: add PWM to pins 8, 9, 10 on mega 2018-11-27 13:36:33 -05:00
Sandeep Mistry
9d83af3e05 Fix USB warnings 2018-11-27 09:39:36 -05:00
Sandeep Mistry
6e0a2b52fc Add SDU support for the MKR NB 1500 2018-11-27 09:18:41 -05:00
Martino Facchin
adc07537f0 Update platform version to 1.6.20 2018-11-27 09:39:06 +01:00
Sandeep Mistry
be9aa4b811 Re-order MKR boards.txt entried 2018-11-27 09:28:19 +01:00
Sandeep Mistry
622910313c Rebuild MKR NB 1500 bootloader 2018-11-27 09:25:54 +01:00
Sandeep Mistry
f7756d8012 Rename left over MKR NB-IoT 1500's to MKR NB 1500 2018-11-27 09:25:54 +01:00
Sandeep Mistry
da9bfe8cf9 Increase the default serial buffer size to 256 (variant can override via define) 2018-11-27 09:25:54 +01:00
Sandeep Mistry
4b24b9dcbb Disable h/w flow control on UART, set RTS to LOW on init
It’s not supported by the SARA-R410M
2018-11-27 09:25:54 +01:00
Sandeep Mistry
249cd86f2e Add SerialSARA as keyword 2018-11-27 09:25:54 +01:00
Sandeep Mistry
c48c0cabaf Add SARA DTR pin and enable SARA PWR ON in initVariant 2018-11-27 09:25:54 +01:00
Sandeep Mistry
0412ef805d Spilt the MKR NB IoT 1500 into it's own variant folder 2018-11-27 09:25:54 +01:00
Martino Facchin
253f211e16 Fix MKRNB name and module init 2018-11-27 09:24:22 +01:00
Martino Facchin
fc95e909c9 Add initial MKRNbIoT support 2018-11-27 09:24:22 +01:00
Martino Facchin
3d8acdc1c4 Add initial MKR-NbIoT bootloader 2018-11-27 09:24:22 +01:00
dean
37b81426ad DM: fix grandcentral SPI miso pad 2018-11-26 16:49:22 -05:00
ladyada
43ebb77dae Merge branch 'master' of github.com:adafruit/ArduinoCore-samd 2018-11-21 01:25:52 -05:00
ladyada
a0fd9d4ce8 adding upcoming pybadge 2018-11-21 01:25:48 -05:00
deanm1278
97bedc773f updates for pin numbering (#68)
* DM: grandcentral variant

* DM: updates for m4 mega

* DM: metro mega updates

* DM: fixes for mega m4 pcc

* DM: fix grandcentral boards.txt naming

* DM: remove openocd for samd51, fix include guards

* DM: remove unnecessary debug scripts for m4 boards

* DM: update grandcentral pin numbering
2018-11-20 13:55:01 -08:00
Riccardo Rizzo
4a6d6ee5ee fix freeze due to tone()
In file Tone.cpp added suffix -1LL to the costant in line 117 in order to avoid freeze for instance of tone(pin, 35000);
2018-11-16 09:15:45 -05:00
Cristian Maglie
bab730bf6e Better formatted boards.txt (same style) 2018-10-23 18:02:00 +02:00
Cristian Maglie
584e7bb4b5 Added defines to identify MKR layout 2018-10-23 18:02:00 +02:00
Helmut Tschemernjak
2ef5b7810e Added alternate ports 44,45 to make the SWCLK and SWDIO pins available
when no debugger is being used.
BTW. The presence of a debugger can be checked via:
if (DSU->STATUSB.bit.DBGPRES) ...
2018-10-23 13:53:59 +02:00
Gabriel Notman
253e40e736 Removes the requirement that the DAC is on A0 (which requires that A0 uses PA02) 2018-10-23 13:51:49 +02:00
gdsports
9ac80d9a3a Fix memory overwrite in USBHost
Fix issue #271.
2018-10-23 11:31:34 +02:00
Martino Facchin
3b38a41278 Inplement USBDevice.end() 2018-10-23 11:19:08 +02:00
Martino Facchin
d5557ec4b4 Clear _usbLineInfo structure on SerialUSB.end() 2018-10-23 11:19:08 +02:00
Mark Fischer
a6ab0f3bf6 Added method to return USB Error code. 2018-10-22 15:01:04 +02:00
Dan Halbert
efc0ad189f re-sign CPX driver, making sure line endings are correct 2018-10-10 22:47:11 -04:00
Dan Halbert
285ca1b285 fix webusb nullinstall and re-sign 2018-10-09 18:16:54 -04:00
Dan Halbert
0fd0659852 Merge remote-tracking branch 'adafruit/master' into no-win10-cpx-adafruit 2018-10-09 18:16:28 -04:00
Dan Halbert
bdfe4a952b do not install CPX drivers on win10 2018-08-27 09:51:53 -04:00
Dan Halbert
69d73daa6a CPX fixes: add &MI_00 to all devices so CPLAYBOOT is not hidden on Windows 10 2018-08-27 09:51:46 -04:00
349 changed files with 30296 additions and 1321 deletions

95
.github/ISSUE_TEMPLATE/bug_report.yml vendored Normal file
View file

@ -0,0 +1,95 @@
name: Bug Report
description: Report a problem
labels: 'Bug'
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
It's okay to leave some blank if it doesn't apply to your problem.
- type: dropdown
attributes:
label: Operating System
options:
- Linux
- MacOS
- RaspberryPi OS
- Windows 7
- Windows 10
- Windows 11
- Others
validations:
required: true
- type: input
attributes:
label: Arduino IDE version
placeholder: e.g Arduino 1.8.15
validations:
required: true
- type: input
attributes:
label: Board
placeholder: e.g Metro M4 Express
validations:
required: true
- type: input
attributes:
label: ArduinoCore version
description: Can be found under "Board Manager" menu
validations:
required: true
- type: textarea
attributes:
label: Sketch as ATTACHED TXT
placeholder: |
e.g examples/MassStorage/msc_ramdisk.
If it is custom sketch, please provide it as **ATTACHED** files or link to it.
Pasting raw long code that hurts readability can get your issue **closed**
validations:
required: true
- type: textarea
attributes:
label: Compiled Log as ATTACHED TXT
placeholder: |
Compiled log from Arduino IDE as **ATTACHED** txt.
Pasting raw long log that hurts readability can get your issue **closed**
validations:
required: true
- type: textarea
attributes:
label: What happened ?
placeholder: A clear and concise description of what the bug is.
validations:
required: true
- type: textarea
attributes:
label: How to reproduce ?
placeholder: |
1. Go to '...'
2. Click on '....'
3. See error
validations:
required: true
- type: textarea
attributes:
label: Debug Log as ATTACHED TXT
placeholder: |
Debug log where the issue occurred as attached txt file, best with comments to explain the actual events.
validations:
required: false
- type: textarea
attributes:
label: Screenshots
description: If applicable, add screenshots to help explain your problem.
validations:
required: false

5
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View file

@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Adafruit Support Forum
url: https://forums.adafruit.com
about: If you have other questions or need help, post it here.

View file

@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: Feature
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

61
.github/workflows/githubci.yml vendored Normal file
View file

@ -0,0 +1,61 @@
name: Build
on: [pull_request, push]
jobs:
build:
strategy:
fail-fast: false
matrix:
board:
# Alphabetical order
- 'circuitplayground_m0'
- 'feather_m4_can'
- 'hallowing'
- 'hallowing_m4'
- 'metro_m0'
- 'metro_m4'
- 'pybadge_m4'
- 'pygamer_m4'
- 'pyportal_m4'
- 'pyportal_m4_titano'
# with TinyUSB
- 'metro_m0:usbstack=tinyusb'
- 'metro_m4:speed=120,usbstack=tinyusb'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: 'true'
- name: Install Arduino CLI and Tools
run: |
# make all our directories we need for files and libraries
mkdir $HOME/.arduino15
mkdir $HOME/.arduino15/packages
mkdir $HOME/Arduino
mkdir $HOME/Arduino/libraries
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH
- name: Install BSP and Libraries
env:
BSP_URL: https://adafruit.github.io/arduino-board-index/package_adafruit_index.json
BSP_PATH: .arduino15/packages/adafruit/hardware/samd
run: |
arduino-cli config init
arduino-cli core update-index
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
BSP_VERSION=`eval ls $HOME/$BSP_PATH`
rm -r $HOME/$BSP_PATH/*
ln -s $GITHUB_WORKSPACE $HOME/$BSP_PATH/$BSP_VERSION
arduino-cli lib install "Adafruit NeoPixel" "Adafruit seesaw Library" "Adafruit SPIFlash" "FlashStorage" "MIDI Library" "SD" "SdFat - Adafruit Fork"
- name: Build examples
run: python3 tools/build_all.py ${{ matrix.board }}

3
.gitignore vendored
View file

@ -2,4 +2,5 @@
*.atsuo
bootloaders/*/build/
*~
*~
/libraries/**/build/

6
.gitmodules vendored Normal file
View file

@ -0,0 +1,6 @@
[submodule "libraries/Adafruit_TinyUSB_Arduino"]
path = libraries/Adafruit_TinyUSB_Arduino
url = https://github.com/adafruit/Adafruit_TinyUSB_Arduino.git
[submodule "libraries/Adafruit_ZeroDMA"]
path = libraries/Adafruit_ZeroDMA
url = https://github.com/adafruit/Adafruit_ZeroDMA

View file

@ -1,5 +1,40 @@
SAMD CORE ?.?.?? ????.??.??
SAMD CORE 1.6.21 2019.04.01
* MKR boards: changed I2C to sercom2, SPI1 + Serial2 to sercom4
* Improved accuracy of delay() function. Thanks @BenF
* MKR 1500: Changed SARA module to be powered off on boot
SAMD CORE 1.6.20 2018.11.28
* Replaced boolean type with bool in examples. Thanks @per1234
* Added c++ linker command to allow to include libstdc++ when linking. Thanks @helmut64
* CPX driver fixes. Thanks @dhalbert
* I2S: Changed library to use 8 MHz oscillator source if 48MHz divider does not fit in 8 bits
* UART: Added frame error handling
* USB: Fixed memory leak on reconnects
* SDU: Added support for Arduino M0. Thanks @jandrassy
* Added arduinoOTA upload keys for Arduino M0. Thanks @jandrassy
* USB: Fixed USB Host failures and fixed memory overwrite in USBHost. Thanks @gdsports
* USB: Added method to return USB error code. Thanks @MarkFischer
* CDC: Clear line state on end()
* USB: Added USB device end() method
* Removed requirement that the DAC is on A0. Thanks @GabrielNotman
* Added alternate ports 44, 45 to make the SWCLK and SWDIO pins available on the Zero. Thanks @helmut64
* Added defines for MKR pin layout
* Fixed freeze in tone()
* Added MKR NB 1500 variant and bootloader
* Increased the default serial buffer size to 256
SAMD CORE 1.6.19 2018.07.11
* Fixed bootloader tools for .org boards
* M0: Updated pin definitions for D6, D7 and D13 to match Zero
* SPI: Fixed interrupt mask to block. Thanks @ggajoch
* Added MKR WiFi 1010 variant and bootloader
* Updated Windows Drivers to 1.4.0 and re-signed Adafruit_Circuit_Playground_Express.inf
SAMD CORE 1.6.18 2018.03.05
* Wire: Added support for general call (broadcast)

View file

@ -1,5 +1,7 @@
# Arduino Core for SAMD21 and SAMD51 CPU
[![Build Status](https://github.com/adafruit/ArduinoCore-samd/workflows/Build/badge.svg)](https://github.com/adafruit/ArduinoCore-samd/actions)
This repository contains the source code and configuration files of the Arduino Core
for Atmel's SAMD21 and SAMD51 processor (used on the Arduino/Genuino Zero, MKR1000 and MKRZero boards).

2568
boards.txt

File diff suppressed because it is too large Load diff

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,502 @@
:10000000FC7F0020810B0000710B0000750B0000CD
:1000100000000000000000000000000000000000E0
:10002000000000000000000000000000790B00004C
:1000300000000000000000007D0B0000D50C000057
:1000400010B5064C2378002B07D1054B002B02D0AE
:10005000044800E000BF0123237010BD5C000020B5
:1000600000000000D41E000008B5084B002B03D090
:100070000748084900E000BF07480368002B03D089
:10008000064B002B00D0984708BDC046000000007A
:10009000D41E000060000020580000200000000076
:1000A000064B0322104002040549586808401043DB
:1000B0005860DA695107FCD47047C0460008004216
:1000C000FFFFFCFF38B5284A284B5A805A7852B2B5
:1000D000002AFBDB264B04211A6A264D0A431A62CA
:1000E0002B68012213432B602A680123214C1A42FA
:1000F000FAD1E2691A42F7D11423236041001E4865
:1001000001F00CFD421EE068FF231A4098431043A3
:10011000E0602368022213432360EA69154B9107CC
:10012000FBD45A8B30218A4310210A435A83EB694E
:1001300001205A07FBD4114B02241A7802431A708B
:100140000F4B0F22197891431970197821431970B8
:100150000C490C782043087019780A401A701A78F4
:1001600020210A431A7038BD14400000000C0040E2
:100170000004004000080042006CDC0248440041DA
:100180003444004149440041F7B500230F1C01925B
:100190001D1C994254D001212A4E4000084333705F
:1001A000C1B2294B0322588B1C1C000910400128A6
:1001B00004D05B8B1B091A40022AF2D1606AC00A84
:1001C000C00208436062217E1F4B0122880708D4C9
:1001D000197E1142F7D05968C02292020A435A6030
:1001E00003E05B8B9B08134201D0002528E03270AE
:1001F000237E9907FCD5154A154B117801251970F6
:100200006268BD4212D0134B022013406360FFF7B7
:1002100047FF33785A1C3270227E9007FCD50B4979
:100220000B480A780135C254EDB2E9E78023DB02BE
:10023000134363600199002902D00320FFF730FFC8
:10024000281CFEBD7800002000080042280800425B
:1002500099000020FFFFFBFF024B00221870024BA9
:100260001A7070477A00002079000020F8B5274BFB
:100270001C786400E4B2264B03215D8B1A1C2D0907
:100280000D40012D04D05B8B1B0919400229F2D1CE
:10029000536ADB0ADB0223435362117E01231942B6
:1002A000FBD01B49498B8908194204D00320FFF772
:1002B000F7FE022427E017490D782B1C002B11D0E4
:1002C000154EEC1A365D154C2670114E177E012422
:1002D000768B274202D12642F7D00BE0B6082642A1
:1002E0000ED007E00B701C1C00280CD00320FFF779
:1002F000D7FE08E003200B700324FFF7D1FE02E0D5
:10030000013BDBB2DAE7201CF8BDC0467A000020D2
:1003100000080042790000207B00002028080042ED
:10032000034A1378591C1170024AD05401207047B7
:10033000790000207B000020154A164B1178002917
:1003400009D11549187809784118C9B21970802067
:1003500012494003C86111780131C9B2117019788E
:10036000F02902D81978092909D80B4908784042A0
:10037000C0B20870187809784118C9B2197012789B
:100380001B789A4203D18022044B5203DA617047F2
:100390007D000020010000200000002000440041FA
:1003A00010B5041C6B20FFF757FF201CFFF7B8FFA8
:1003B0000120FFF75BFF01210A1C6B20FFF7E4FE21
:1003C000014B187810BDC0469900002038B5051CB7
:1003D0006B200C1CFFF740FF281CFFF7A1FF201C1F
:1003E000FFF79EFF0120FFF741FF022038BD08B54F
:1003F0000520FFF7D5FFCE23011C19400520FFF78C
:10040000E5FF012008BD000010B5041C0020FFF727
:10041000C7FF78232D4A9843C1B2944242D018D8DE
:100420002B4B9C4238D009D82A4B9C4230D02A4BC7
:100430009C422FD0294B9C4245D13FE0284B9C4207
:100440002CD0284B9C422BD0274B9C423BD12023C5
:1004500033E0264A94422BD00AD8254B9C4223D025
:10046000244B9C4222D0244B9C422CD1402324E09C
:10047000224A94421ED004D8214B9C4223D16023AF
:100480001BE0204A944217D01F4A944215D01AE02C
:10049000082312E0102310E018230EE028230CE0BC
:1004A00030230AE0382308E0482306E0502304E024
:1004B000582302E0682300E0702319430020FFF76F
:1004C00085FF012000E0002010BDC046581100004B
:1004D00018100000780F0000C80F0000280F00005F
:1004E000B810000008110000681000009812000009
:1004F000F811000048120000A81100003813000095
:10050000E812000088130000D813000010B5041C86
:100510000020FFF745FF07239843E122C1B2920074
:10052000944220D008D8962C18D0FA235B009C4225
:1005300017D0642C22D11CE0114A944215D005D862
:100540009623DB009C4219D1042311E0FA22D20049
:1005500094420CD00B4A94420AD00FE0012421436C
:1005600007E0022304E0032302E0052300E0062362
:1005700019430020FFF72AFF012000E0002010BDF2
:10058000DC050000B80B000070B504AC267805ACA3
:100590002578441EA041C401002901D040210C430C
:1005A000002A01D020221443002B01D010231C4329
:1005B000002E01D008231C43002D01D004231C432E
:1005C0000220FFF7EDFE0125011C294021430220F6
:1005D000FFF7FCFE281C70BD10B5041C0420FFF7BB
:1005E000DFFE03231840084B9C4204D0074B9C427B
:1005F00008D1B02100E0982101430420FFF7E6FE76
:10060000012000E0002010BD10100000701000005C
:1006100008B50120FFF7C4FECF23011C19400120BB
:10062000FFF7D4FE012008BD07B5FFF7E0FEFFF796
:10063000EFFF0948FFF7E8FEFA20C000FFF766FF6A
:10064000002300930193181C191C1A1CFFF79CFF30
:100650000248FFF7C1FF07BD08110000101000009D
:1006600008B50348FFF72EFDFFF7DEFF08BDC046C3
:10067000A086010010B5C3699C07FCD4036802245E
:10068000A3430360C46901231C42FBD104682343D4
:1006900003600368DC07FCD4C46901231C42FBD15E
:1006A000C469DC401C42F7D1084B1A430260C3699D
:1006B0005A07FCD4C0239B0243608181C3699C0715
:1006C000FCD4036802221343036010BD0400004001
:1006D000037EDA07FCD5018570470000027E012306
:1006E0005107FBD5428B1A4207D1428BDA401A429E
:1006F00003D1428B92081A4202D0034B01221A7096
:10070000008DC0B27047C0467E00002070B50368FF
:10071000041C988B1A1C0821FF32084226D0802026
:1007200099839872112353704021144B9171507129
:100730005E68134DC0202E40800506435E605E69F2
:100740003540284358610F4818600F4818615D68AC
:100750000E4828408025AD02284358605868800B19
:100760008003586000235171237105E0137ADA0683
:1007700002D5201C00F0E8FA207970BD9C01002011
:10078000FFFFFF8F9C0000201C010020FF3F00F0B6
:10079000002303714371044B016083600B780222D4
:1007A00013430B707047C0460D07000038B5364B39
:1007B0002021DA6901200A43DA61344B06241A78D1
:1007C00002431A70324B0F2219789143197019782D
:1007D000214319702F490C782043087019780A407A
:1007E0001A701A7860210A431A702B4B2B4A5A80D0
:1007F0005A7852B2002AFBDB294B01211A780A43AE
:100800001A709A78D107FCD426480268510B1F222F
:100810001140914200D1052111408C011D8D2249CA
:100820002940214319850468A10C0A401F2A00D1E0
:100830001D221C8D1F210A408C4322431A85026809
:100840000721D20D0A408A4200D103220A40188DA6
:100850001103164A02400A431A8519787F220A407A
:100860001A701A78042112480A431A7058621A89B9
:100870000C218A431A811A8901218A431A81002195
:10088000802201F0A4F938BD000400405844004122
:100890003C44004159440041000C00400640000027
:1008A00000500041246080003FF8FFFFFF8FFFFFF2
:1008B0009C010020F7B5141C1F4A5F0101971D1C05
:1008C000D319061C5869271C4000400F0330103311
:1008D000C74006D00F1C8022596812060A435A608E
:1008E00009E02F1C7B1E9F41144BBF01FF18381CD1
:1008F000221C01F063F901990F480835421817616D
:10090000131C5269A104920B890C92030A435A6189
:1009100059690B4A0A405A616B01F3180222DA71D5
:100920005979802252420A435A716B01F318DB79DC
:100930009A07FAD5201CFEBD9C0100201C01002056
:10094000FF3F00F0F8B51A4E051C3378141C002B3D
:1009500012D1184B184A1A645A6C920B92035A64BB
:10096000586C164A02405A64A2235B00EA5C40209D
:100970000243EA54012333704827FF37EA5D01231D
:10098000134012D00B4B5A6C9204920CA24202D22A
:100990005C6CA404A40C081C221C074901F00EF98D
:1009A0000123EB550023337000E01C1C201CF8BD14
:1009B0007F0000209C010020DC000020FF3F00F0B1
:1009C000FF3083792022002900D110221343837144
:1009D00070470000084BFF305A69920B92035A612E
:1009E00002230372827980235B4213438371037A6B
:1009F0009A07FCD57047C0469C01002080235B42CB
:100A00001943C9B28172704770B5A02303225B00FD
:100A1000C254134B134A5C6CC021144089050C432B
:100A200046255C64FF35402444550F4D30261D6437
:100A300090256D0046555D6B1540294392255963FD
:100A40006D0080214155094D1D63B0256D00445551
:100A50005C6F22405A67B2235B00C15470BDC04630
:100A60009C010020FFFFFF8FDC0000205C010020C4
:100A700030B5364A1E235168082099430223194392
:100A8000516033498A6902438A613248324A90820E
:100A9000908A03439382D3689807FCD52F4B01209B
:100AA00018701878C40704D52C48407840B2002844
:100AB000F7DB01209860587840B20028FBDB284C17
:100AC00026484460587840B20028FBDB8224234843
:100AD000E4014480587840B20028FBDB908C8024ED
:100AE000A0439084D068C506FCD51E4C1A48C46249
:100AF000D4681948E506FBD5848C1B4D2C438484AF
:100B0000D4681548E506FBD5848C02252C438484E3
:100B1000D0680406FCD51048C0684506F8D5D068F2
:100B2000C406FCD500229A605A7852B2002AFBDB38
:100B30000E480A4A50605A7852B2002AFBDB002362
:100B40000B724B728B72CB7230BDC04600400041BD
:100B5000000400400C06000000080040000C0040AB
:100B600001050100B805FF7D040A0000000703002D
:100B70000EBEFEE70DBEFEE705BEFEE702BEFEE7C7
:100B80000E4A0F4838B5824204D10E4A0E4B9342AA
:100B90000ED10AE00D4C9442F7D00023D1188842C0
:100BA000F3D9E55804330D60F8E700F011F804E0DC
:100BB0009342FAD2002102C3FAE7FEE700000020C8
:100BC0005C000020AC0300205C000020D81E000068
:100BD00038B5344D2B6801331AD0334B2A1D1A60B7
:100BE000EAB2002A14D1314B197801231940304B55
:100BF0000AD118682F4A904201D1196008E01A60A2
:100C00002D4A013A002AFCD11A602C4B01221A709D
:100C1000FFF72EFF62B6FFF723FD284B284C1B7809
:100C2000002B0AD02B6883F308881E4BFF229343C6
:100C3000A3601D4B1B681B68184700F09DFD00F06A
:100C40004FF8204B802252039A601F4B1F4A051C0D
:100C50005A60216AC0220902090A12060A43226266
:100C600000229A6007221A60AB68281C9847184B2C
:100C7000002801D001221A701A78002A05D000201D
:100C800000F08CFA00F004FBFCE71B78002BEBD1A2
:100C900000F0E6FD0028E7D0012000F07FFA00F028
:100CA000F7FAFCE7002000001C0200203804004096
:100CB000FC7F00203581730748E801008000002098
:100CC00000ED00E00044004110E000E0E703000018
:100CD0008100002008B5FFF72FFB00F0C3FA08BD24
:100CE00010B5054B054C2360FFF760FD201C216803
:100CF000FFF74EFD201C10BD0050004120020020D7
:100D000070B5051CC0B0081C161C0C1C00F067FF59
:100D100040006A46032302305370107076080123A6
:100D2000E218013A11785A00002906D1281C6946B8
:100D30000023FFF7BFFD40B070BDB342F6DA68464E
:100D400081520133ECE70000F7B5BA4A0468137822
:100D5000B949271CFF37051C102038720B705378D7
:100D6000B648B74E037093783380D1783388090240
:100D70000B4333801179B34B1980517918880902DC
:100D8000084318809079B0490880D2790888120207
:100D900002430A8040227A71A84F3A78A64F120285
:100DA00038780F1C0243A9488446181C624500D1BC
:100DB000C2E020DC802149008A4200D16EE109DCDA
:100DC000812A00D192E0822A00D195E0802A00D0C9
:100DD00064E18BE081235B009A4200D1CFE000DA2E
:100DE00058E1C0239B009A4200D157E1984B9A42A8
:100DF00000D14FE152E190231B019A4269D015DCEA
:100E0000D023DB009A4222D088231B019A4269D06A
:100E1000A023DB009A4200D040E1201CFFF7DAFD5E
:100E20003188286889B2FFF7E9FD3BE1894B9A4296
:100E300000D12FE100DC31E1874B9A4200D11DE166
:100E4000864B9A4200D029E133886B7122E13388C6
:100E50001B0A012B08D10B8812222868934201D863
:100E60000A8892B27E4911E133881B0A022B08D10D
:100E70000B8843222868934201D80A8892B27949A4
:100E800004E133881B0A032B00D007E13388DBB26F
:100E9000012B17D0002B07D0022B00D0FEE00A88D0
:100EA0002868D2B2704911E0042201A86F4900F00D
:100EB00085FE3B8804222868934201D83A8892B282
:100EC00001A9E3E00A8828686949D2B2FFF718FF50
:100ED000E8E03388201C2B71FFF77CFD201CFFF716
:100EE00093FDDFE0291C01C90122CFE06149002305
:100EF0000B8028680222CAE05E4900220A80188816
:100F0000502210405C4A10701E880F20304018801C
:100F10001888032800D9C1E012781B8808335B01C8
:100F2000E418A379002A01D09B0600E0DB06DB0F62
:100F30000B8028680222A9E019887F2291434E4A3B
:100F4000C9B2117018880F21014019803188002919
:100F500000D0A3E01988002900D19FE01988032957
:100F600000D99BE012781B8808335B01E318002A44
:100F700002D020225A718DE0102159718AE0028836
:100F80007F239A433C4BD2B21A7001880F220A4049
:100F900002803288002A00D080E00288002A00D136
:100FA0007CE00288032A00D978E01B78002B1FD050
:100FB000038808335B01E3189B799A066AD5038896
:100FC000202208335B01E3181A71038808335B01A0
:100FD000E318DB795F065DD50388402208335B01A7
:100FE000E318DA710388022208335B01E3181EE07C
:100FF000038808335B01E3189B79D9064AD5038837
:10100000102208335B01E3181A71038808335B016F
:10101000E318DB799A063DD50388202208335B016B
:10102000E318DA710388012208335B01E3181A71AF
:1010300030E0C0469C000020830000208800002093
:101040008A0000208C00002086000020020300009F
:101050000103000021200000A12100002122000046
:10106000281C000004000020141C0000041C0000C8
:10107000081C000084000020820000200B88082249
:101080002868934201D80A8892B207490023FFF7E3
:1010900011FC07E0201CFFF79DFC03E0201C012150
:1010A000FFF78EFCF7BDC0464800002007B5054B92
:1010B0000122019001A91868131CFFF7FBFB012016
:1010C0000EBDC0462002002013B5054B6C46073408
:1010D0001868211C0122FFF735FC207816BDC04698
:1010E0002002002010B5074C201CFFF70FFB031C4B
:1010F0000020834205D022684823FF33D05C0123BF
:10110000184010BD2002002010B5054A0C1C031C1D
:10111000191C10680123221CFFF7CCFB201C10BDFA
:101120002002002070B5084C061C201C0D1CFFF787
:10113000EDFA0023984205D02068311C2A1CFFF7E5
:1011400001FC031C181C70BD20020020F8B50C4CDB
:10115000051C201C0E1CFFF7D9FA0023271C341C89
:1011600098420AD0002C07D0291C221C3868FFF7AF
:10117000E9FB241A2D18F5E7331C181CF8BDC046EE
:101180002002002008B5031C081C111C9847024BC4
:1011900064221A8008BDC04692000020012805D1B3
:1011A000054B064A1A60064B187004E0002802D16D
:1011B000044A014B1A607047900200205C1C00003A
:1011C00098000020A81C000030B50A1C1C4985B0FE
:1011D0000978031C00292AD0042A01D1006804E000
:1011E000022A01D1008800E00078520004A98B187F
:1011F0000B3B9C1AA3420BD00F210140092902D8B6
:101200003025294300E0373119700009013BF1E72F
:1012100001A930230B7078234B700A208B1898702B
:101220000D20D870074B04321B68D86803E00549CD
:101230000968C868191CFFF7A5FF05B030BDC04696
:101240008E0000209002002072B6EFF30883044A5B
:101250001360036883F30888436818477047C046E3
:1012600094020020084B1A88002A03D01A88013AF9
:1012700092B21A80054B1A88002A03D01A88013AC4
:1012800092B21A807047C046920000209000002061
:10129000F0B591B008A9CC4A0B1C31CA31C351CA70
:1012A00051C360CA60C3C94BC9489A687A255203C2
:1012B000520F92005258C74902609C68A4B2624320
:1012C0000C60C54900240A60C44A1460C44C2570EF
:1012D000C44CC54D2368281C1B6940219847002831
:1012E00002D0C24B64221A80C14B00221860C14B4D
:1012F0001D60C14BC04DBE4F1A602A683B689A42C0
:10130000E6D2BC4B1B681A78FF2A00D114E2232ACC
:1013100000D0EBE1B94E3378002B06D0B14BB84981
:101320001B680222D868FFF72DFFAD4B1B78532BAB
:101330003CD13B682A6893421ED9AE4801322A60EC
:101340009A1AB04B01681B6801310160AE4E9A4297
:1013500001D2326000E03360A04832680068049037
:1013600000F02CFC336829685A182A60A14A1668D4
:10137000F1181160A54A13702B68013B2B609D4B3F
:101380001A68013A1A60A14B9E4A1B7811688B4279
:101390000AD222689148C91A0068926990470028C9
:1013A00002D0924B64221A80C0468DE1522B0AD1A2
:1013B0008A48944A2368006811685B6903909847DB
:1013C0006422934B0DE04F2B05D1844B8D4A1B6853
:1013D00012681A7078E1482B05D1804B894A1B6846
:1013E00012681A8070E1572B05D17C4B854A1B6827
:1013F00012681A6068E16F2B03D1784B01211868DD
:1014000007E0682B08D1754B7E481B6802211B88BA
:101410000360FFF7D9FE57E1772B06D16F4B794870
:101420001B6804211B680360F3E7472B13D1754B3E
:101430001868FFF709FF774B1B6883F3088862B6CB
:10144000754B1B78002B00D13EE1664B06201B68D4
:101450001B68984738E1542B04D101233370614B4A
:101460001B6864E04E2B0CD13378002B06D15D4B0A
:1014700063491B680222D868FFF784FE002333709B
:1014800022E1562B57D123686449D8680122FFF71F
:1014900079FE23686249D8680322FFF773FE614D25
:1014A0002368291CD8680122FFF76CFE23685E4977
:1014B000D8680D22FFF766FE2368291CD868012230
:1014C000FFF760FE4B4F4C4D5849002339602B60AD
:1014D0003A1C281C13685E1C16601B780593002BB1
:1014E00003D0036801330360F4E73E4E2A68336893
:1014F000D868FFF747FE33684A49D8680122FFF7EA
:1015000041FE059929604A4939603A4A1368581CD6
:1015100010601B78002B04D0374B1A6801321A6018
:10152000F3E733682A68D868FFF72CFE3368D86879
:1015300033490222C6E0334A582B17D1244E264D98
:10154000366813682A68B10093420AD21F4D5808C2
:10155000E861384828801D4D287DC607FBD55B18FB
:10156000F2E7204B34491B68D868AAE0592B79D19F
:1015700012681A4B3149002A02D11B680B606CE0DB
:10158000124D086819686B68104E8025AB439208AD
:101590007360002A61D02A4B0C4D2B800B4E337D9B
:1015A000DD07FBD500230A4D2D680195AD08AB4240
:1015B00003D3244D054E358046E09342F9D09D007B
:1015C000465901334E51EEE73C1C000000400041FB
:1015D00048020020400200203C0200208C02002033
:1015E00038020020900200204C02002090000020D1
:1015F0003002002034020020440200208E0000202F
:101600009C1C0000980200209C0200202C0200205C
:10161000920000209402002098000020781C000016
:10162000A11C00007A1C0000C41C00007C1C0000EF
:10163000881C000002A5FFFF911C00009400002000
:1016400044A5FFFF04A5FFFF3F4E357DEE07FBD508
:101650009D0049194019D21A9BE73C4B3C491B6835
:10166000D8682EE05A2B2FD13A4B17681D680026F8
:10167000EF19BD4206D02878311C00F013F901356E
:10168000061CF6E7314B34491B680122D868FFF786
:1016900079FD07230F223240111C36093031092A07
:1016A00000DD07311820C0186A468154013BF1D291
:1016B000236806A9D8680822FFF764FD2368274934
:1016C000D8680322FFF75EFD254B7A221A70254B5E
:1016D00000221A60244B1B7893422DD01B4B2349C8
:1016E0001B680122D868FFF74DFD25E0111C303939
:1016F000C8B21C4B092804D81D682A01114319607F
:101700001AE0111C4139052903D81E68373A310106
:1017100006E0111C6139052904D81868573A0101FF
:101720000A4308E02C2A03D10A4A1968116001E033
:101730000B490A7000221A600D4B1A6801321A60B8
:101740000C4B1A680132D5E50040004190020020A0
:10175000951C00008C020020991C00009B1C0000BE
:1017600038020020980200208E0000209F1C0000FC
:10177000440200203402002010B51C4B01201A78CE
:10178000032402431A701A4B0F22197891431970DF
:1017900019782143197017490C782043087019787B
:1017A0000A401A701A7830210A431A70124B8021AD
:1017B0001A6A0A431A62114B114A5A805A7852B275
:1017C000002AFBDBC4220F480F499203FEF752FFA9
:1017D0000E4A002313700E4A13700E4A13700E4AFD
:1017E00013700E4A13700E4A137010BDD644004198
:1017F000BB440041D744004100040040000C0040BD
:1018000019400000001C00422AF60000A00200203F
:1018100027030020A1020020A402002028030020AA
:101820002503002008B5C1B20248FEF751FF012090
:1018300008BDC046001C0042024B187E4007C00F86
:101840007047C046001C004208B5FFF7F5FF0028AE
:10185000FBD00248FEF742FF08BDC046001C004214
:1018600008B5FFF7E9FF0023984205D0FFF7ECFF2A
:10187000031C233B5A425341181C08BD70B5041C7D
:101880000D1C4618B44204D02078FFF7CBFF01347A
:10189000F8E7281C70BD10B5041CFFF7D5FF2070B9
:1018A000012010BD0B0A5840034B4000C05A0902EA
:1018B000484080B27047C046D21C0000F7B50024F3
:1018C000051C0F1C261CBC4220D0FFF7BDFF114B8E
:1018D000C0B21B780190002B1AD1311CFFF7E2FF38
:1018E0000D4B061C1A88002A04D10C4A11782A1CB8
:1018F000002907D001996A1C2970802F02D119880C
:10190000013919800134A4B2151CDCE7301C00E059
:101910000120FEBD25030020A20200202603002096
:10192000F0B53E4E85B0002203900C1C32703C4B4B
:10193000914201D1012201E03A490C801A707F23C3
:101940001C4201D080349C43FFF77EFF3378C0B245
:10195000002B07D000253570FFF776FF3378C0B233
:10196000AB4236D1432803D0712853D01528EBD190
:10197000012300930120FFF755FF0098FFF752FF66
:1019800000998025C843C0B2FFF74CFF039B002796
:101990000293244A1388002B1DD121490193097811
:1019A000002918D10198FFF73DFF391C0198FFF776
:1019B00079FF013D071C002DEBD1000AC0B2FFF7F3
:1019C00031FFF8B2FFF72EFFFFF73EFF3378002B11
:1019D0000AD035701FE00299013B09781380029B01
:1019E000019101330293DDE7C0B2062807D1009BC5
:1019F00003990133DBB280310093803C0391002CCA
:101A0000B8D10420FFF70EFFFFF71EFF044B01259E
:101A10001C7000E00025281C05B0F0BD2503002047
:101A200026030020A2020020F0B5384C87B0002326
:101A300001902370994201D1012301E0344A1180C1
:101A4000344A642613704320FFF7ECFE324FFFF751
:101A5000F3FE002803D1002F03D0013FF7E7002F4A
:101A600003D1013E002EEED14DE00125FFF7ECFE43
:101A70002378002B38D1C0B20290012805D0042869
:101A80003DD10620FFF7CEFE39E005AE0221301C25
:101A9000FFF714FF01988021FFF710FF23780390D0
:101AA000002B18D1FFF7D0FE0702FFF7CDFEBFB223
:101AB00023783F18BFB2012B0DD0039B9F4207D163
:101AC0003378AB4204D1EB437278DBB29A4204D054
:101AD0001820FFF7A7FE002303E00620FFF7A2FE71
:101AE000029B2278002A02D0002626700BE0012BF0
:101AF00005D1019A6B1C8032DDB20192B6E7054A2E
:101B0000002313700126301C07B0F0BD2503002010
:101B1000A20200202603002000350C00002934D04A
:101B20000123002210B488422CD301242407A142AF
:101B300004D2814202D209011B01F8E7E400A1426C
:101B400004D2814202D249005B00F8E7884201D307
:101B5000401A1A434C08A04202D3001B5C082243DF
:101B60008C08A04202D3001B9C082243CC08A04250
:101B700002D3001BDC082243002803D01B0901D03C
:101B80000909E3E7101C10BC7047002801D00020B1
:101B9000C04307B4024802A14018029003BDC046EA
:101BA000190000000029F0D003B5FFF7B9FF0EBC03
:101BB0004243891A1847C0467047C04610B50023F3
:101BC000934203D0CC5CC4540133F9E710BD031C2D
:101BD0008218934202D019700133FAE7704700234C
:101BE000C25C0133002AFBD1581E7047F8B5C046CD
:101BF000F8BC08BC9E467047F8B5C046F8BC08BCA7
:101C00009E4670470403090441726475696E6F2033
:101C10004C4C430041726475696E6F204D4B5220ED
:101C20004E422031353030001201000202000040E7
:101C300041235500000201020001000008000000DD
:101C400010000000200000004000000080000000A4
:101C50000001000000020000000400002518000040
:101C600049180000391800007D180000971800007E
:101C700021190000291A0000760020004E6F7620FE
:101C8000323620323031380031343A32383A333754
:101C900000580A0D00590A0D005A00230A0D003E93
:101CA00000322E3000000000AD100000C91000000E
:101CB000E5100000091100002511000009110000C5
:101CC0004D1100005B41726475696E6F3A58595A44
:101CD0005D0000002110422063308440A550C660A2
:101CE000E770088129914AA16BB18CC1ADD1CEE1D9
:101CF000EFF13112100273325222B5529442F77250
:101D0000D662399318837BB35AA3BDD39CC3FFF328
:101D1000DEE36224433420040114E664C774A4445F
:101D200085546AA54BB528850995EEE5CFF5ACC578
:101D30008DD55336722611163006D776F66695562F
:101D4000B4465BB77AA719973887DFF7FEE79DD7C8
:101D5000BCC7C448E5588668A778400861180228BF
:101D60002338CCC9EDD98EE9AFF9488969990AA918
:101D70002BB9F55AD44AB77A966A711A500A333A8F
:101D8000122AFDDBDCCBBFFB9EEB799B588B3BBB68
:101D90001AABA66C877CE44CC55C222C033C600C1F
:101DA000411CAEED8FFDECCDCDDD2AAD0BBD688DB8
:101DB000499D977EB66ED55EF44E133E322E511E6F
:101DC000700E9FFFBEEFDDDFFCCF1BBF3AAF599F08
:101DD000788F8891A981CAB1EBA10CD12DC14EF1A8
:101DE0006FE18010A100C230E3200450254046700E
:101DF0006760B9839893FBA3DAB33DC31CD37FE339
:101E00005EF3B1029012F322D2323542145277625D
:101E10005672EAB5CBA5A89589856EF54FE52CD508
:101E20000DC5E234C324A0148104667447642454AD
:101E30000544DBA7FAB79987B8975FE77EF71DC718
:101E40003CD7D326F2369106B016576676761546FD
:101E500034564CD96DC90EF92FE9C899E9898AB968
:101E6000ABA94458654806782768C018E10882384D
:101E7000A3287DCB5CDB3FEB1EFBF98BD89BBBAB78
:101E80009ABB754A545A376A167AF10AD01AB32A9D
:101E9000923A2EFD0FED6CDD4DCDAABD8BADE89DC8
:101EA000C98D267C076C645C454CA23C832CE01CED
:101EB000C10C1FEF3EFF5DCF7CDF9BAFBABFD98F58
:101EC000F89F176E367E554E745E932EB23ED10E3D
:081ED000F01E000000000000FC
:101ED80001140000090243000201008032090400D5
:101EE800000102020000052400100104240200057C
:101EF800240600010524010001070583030800FFEB
:101F080009040100020A00000007058102400000E0
:101F1800070502024000000000C20100000008009E
:0C1F280069000000410000000000000003
:0400000300000B816D
:00000001FF

View file

@ -218,7 +218,11 @@ void I2S_Handler ( void );
* \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
*/
#define LITTLE_ENDIAN 1
#if defined(LITTLE_ENDIAN) && (LITTLE_ENDIAN != 1)
#error "Little Endian is already defined, but to different value than expected?!"
#else
#define LITTLE_ENDIAN 1
#endif
#define __CM0PLUS_REV 1 /*!< Core revision r0p1 */
#define __MPU_PRESENT 0 /*!< MPU present or not */
#define __NVIC_PRIO_BITS 2 /*!< Number of bits used for Priority Levels */

View file

@ -218,7 +218,11 @@ void I2S_Handler ( void );
* \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
*/
#define LITTLE_ENDIAN 1
#if defined(LITTLE_ENDIAN) && (LITTLE_ENDIAN != 1)
#error "Little Endian is already defined, but to different value than expected?!"
#else
#define LITTLE_ENDIAN 1
#endif
#define __CM0PLUS_REV 1 /*!< Core revision r0p1 */
#define __MPU_PRESENT 0 /*!< MPU present or not */
#define __NVIC_PRIO_BITS 2 /*!< Number of bits used for Priority Levels */

View file

@ -218,7 +218,11 @@ void I2S_Handler ( void );
* \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
*/
#define LITTLE_ENDIAN 1
#if defined(LITTLE_ENDIAN) && (LITTLE_ENDIAN != 1)
#error "Little Endian is already defined, but to different value than expected?!"
#else
#define LITTLE_ENDIAN 1
#endif
#define __CM0PLUS_REV 1 /*!< Core revision r0p1 */
#define __MPU_PRESENT 0 /*!< MPU present or not */
#define __NVIC_PRIO_BITS 2 /*!< Number of bits used for Priority Levels */

View file

@ -218,7 +218,11 @@ void I2S_Handler ( void );
* \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
*/
#define LITTLE_ENDIAN 1
#if defined(LITTLE_ENDIAN) && (LITTLE_ENDIAN != 1)
#error "Little Endian is already defined, but to different value than expected?!"
#else
#define LITTLE_ENDIAN 1
#endif
#define __CM0PLUS_REV 1 /*!< Core revision r0p1 */
#define __MPU_PRESENT 0 /*!< MPU present or not */
#define __NVIC_PRIO_BITS 2 /*!< Number of bits used for Priority Levels */

View file

@ -222,7 +222,11 @@ void I2S_Handler ( void );
* \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
*/
#define LITTLE_ENDIAN 1
#if defined(LITTLE_ENDIAN) && (LITTLE_ENDIAN != 1)
#error "Little Endian is already defined, but to different value than expected?!"
#else
#define LITTLE_ENDIAN 1
#endif
#define __CM0PLUS_REV 1 /*!< Core revision r0p1 */
#define __MPU_PRESENT 0 /*!< MPU present or not */
#define __NVIC_PRIO_BITS 2 /*!< Number of bits used for Priority Levels */

View file

@ -222,7 +222,11 @@ void I2S_Handler ( void );
* \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
*/
#define LITTLE_ENDIAN 1
#if defined(LITTLE_ENDIAN) && (LITTLE_ENDIAN != 1)
#error "Little Endian is already defined, but to different value than expected?!"
#else
#define LITTLE_ENDIAN 1
#endif
#define __CM0PLUS_REV 1 /*!< Core revision r0p1 */
#define __MPU_PRESENT 0 /*!< MPU present or not */
#define __NVIC_PRIO_BITS 2 /*!< Number of bits used for Priority Levels */

View file

@ -222,7 +222,11 @@ void I2S_Handler ( void );
* \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
*/
#define LITTLE_ENDIAN 1
#if defined(LITTLE_ENDIAN) && (LITTLE_ENDIAN != 1)
#error "Little Endian is already defined, but to different value than expected?!"
#else
#define LITTLE_ENDIAN 1
#endif
#define __CM0PLUS_REV 1 /*!< Core revision r0p1 */
#define __MPU_PRESENT 0 /*!< MPU present or not */
#define __NVIC_PRIO_BITS 2 /*!< Number of bits used for Priority Levels */

View file

@ -222,7 +222,11 @@ void I2S_Handler ( void );
* \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
*/
#define LITTLE_ENDIAN 1
#if defined(LITTLE_ENDIAN) && (LITTLE_ENDIAN != 1)
#error "Little Endian is already defined, but to different value than expected?!"
#else
#define LITTLE_ENDIAN 1
#endif
#define __CM0PLUS_REV 1 /*!< Core revision r0p1 */
#define __MPU_PRESENT 0 /*!< MPU present or not */
#define __NVIC_PRIO_BITS 2 /*!< Number of bits used for Priority Levels */

View file

@ -226,7 +226,11 @@ void I2S_Handler ( void );
* \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
*/
#define LITTLE_ENDIAN 1
#if defined(LITTLE_ENDIAN) && (LITTLE_ENDIAN != 1)
#error "Little Endian is already defined, but to different value than expected?!"
#else
#define LITTLE_ENDIAN 1
#endif
#define __CM0PLUS_REV 1 /*!< Core revision r0p1 */
#define __MPU_PRESENT 0 /*!< MPU present or not */
#define __NVIC_PRIO_BITS 2 /*!< Number of bits used for Priority Levels */

View file

@ -226,7 +226,11 @@ void I2S_Handler ( void );
* \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
*/
#define LITTLE_ENDIAN 1
#if defined(LITTLE_ENDIAN) && (LITTLE_ENDIAN != 1)
#error "Little Endian is already defined, but to different value than expected?!"
#else
#define LITTLE_ENDIAN 1
#endif
#define __CM0PLUS_REV 1 /*!< Core revision r0p1 */
#define __MPU_PRESENT 0 /*!< MPU present or not */
#define __NVIC_PRIO_BITS 2 /*!< Number of bits used for Priority Levels */

View file

@ -226,7 +226,11 @@ void I2S_Handler ( void );
* \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
*/
#define LITTLE_ENDIAN 1
#if defined(LITTLE_ENDIAN) && (LITTLE_ENDIAN != 1)
#error "Little Endian is already defined, but to different value than expected?!"
#else
#define LITTLE_ENDIAN 1
#endif
#define __CM0PLUS_REV 1 /*!< Core revision r0p1 */
#define __MPU_PRESENT 0 /*!< MPU present or not */
#define __NVIC_PRIO_BITS 2 /*!< Number of bits used for Priority Levels */

View file

@ -226,7 +226,11 @@ void I2S_Handler ( void );
* \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
*/
#define LITTLE_ENDIAN 1
#if defined(LITTLE_ENDIAN) && (LITTLE_ENDIAN != 1)
#error "Little Endian is already defined, but to different value than expected?!"
#else
#define LITTLE_ENDIAN 1
#endif
#define __CM0PLUS_REV 1 /*!< Core revision r0p1 */
#define __MPU_PRESENT 0 /*!< MPU present or not */
#define __NVIC_PRIO_BITS 2 /*!< Number of bits used for Priority Levels */

Binary file not shown.

Binary file not shown.

View file

@ -218,7 +218,11 @@ void I2S_Handler ( void );
* \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
*/
#define LITTLE_ENDIAN 1
#if defined(LITTLE_ENDIAN) && (LITTLE_ENDIAN != 1)
#error "Little Endian is already defined, but to different value than expected?!"
#else
#define LITTLE_ENDIAN 1
#endif
#define __CM0PLUS_REV 1 /*!< Core revision r0p1 */
#define __MPU_PRESENT 0 /*!< MPU present or not */
#define __NVIC_PRIO_BITS 2 /*!< Number of bits used for Priority Levels */

View file

@ -218,7 +218,11 @@ void I2S_Handler ( void );
* \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
*/
#define LITTLE_ENDIAN 1
#if defined(LITTLE_ENDIAN) && (LITTLE_ENDIAN != 1)
#error "Little Endian is already defined, but to different value than expected?!"
#else
#define LITTLE_ENDIAN 1
#endif
#define __CM0PLUS_REV 1 /*!< Core revision r0p1 */
#define __MPU_PRESENT 0 /*!< MPU present or not */
#define __NVIC_PRIO_BITS 2 /*!< Number of bits used for Priority Levels */

View file

@ -218,7 +218,11 @@ void I2S_Handler ( void );
* \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
*/
#define LITTLE_ENDIAN 1
#if defined(LITTLE_ENDIAN) && (LITTLE_ENDIAN != 1)
#error "Little Endian is already defined, but to different value than expected?!"
#else
#define LITTLE_ENDIAN 1
#endif
#define __CM0PLUS_REV 1 /*!< Core revision r0p1 */
#define __MPU_PRESENT 0 /*!< MPU present or not */
#define __NVIC_PRIO_BITS 2 /*!< Number of bits used for Priority Levels */

View file

@ -218,7 +218,11 @@ void I2S_Handler ( void );
* \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
*/
#define LITTLE_ENDIAN 1
#if defined(LITTLE_ENDIAN) && (LITTLE_ENDIAN != 1)
#error "Little Endian is already defined, but to different value than expected?!"
#else
#define LITTLE_ENDIAN 1
#endif
#define __CM0PLUS_REV 1 /*!< Core revision r0p1 */
#define __MPU_PRESENT 0 /*!< MPU present or not */
#define __NVIC_PRIO_BITS 2 /*!< Number of bits used for Priority Levels */

View file

@ -222,7 +222,11 @@ void I2S_Handler ( void );
* \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
*/
#define LITTLE_ENDIAN 1
#if defined(LITTLE_ENDIAN) && (LITTLE_ENDIAN != 1)
#error "Little Endian is already defined, but to different value than expected?!"
#else
#define LITTLE_ENDIAN 1
#endif
#define __CM0PLUS_REV 1 /*!< Core revision r0p1 */
#define __MPU_PRESENT 0 /*!< MPU present or not */
#define __NVIC_PRIO_BITS 2 /*!< Number of bits used for Priority Levels */

View file

@ -222,7 +222,11 @@ void I2S_Handler ( void );
* \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
*/
#define LITTLE_ENDIAN 1
#if defined(LITTLE_ENDIAN) && (LITTLE_ENDIAN != 1)
#error "Little Endian is already defined, but to different value than expected?!"
#else
#define LITTLE_ENDIAN 1
#endif
#define __CM0PLUS_REV 1 /*!< Core revision r0p1 */
#define __MPU_PRESENT 0 /*!< MPU present or not */
#define __NVIC_PRIO_BITS 2 /*!< Number of bits used for Priority Levels */

View file

@ -222,7 +222,11 @@ void I2S_Handler ( void );
* \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
*/
#define LITTLE_ENDIAN 1
#if defined(LITTLE_ENDIAN) && (LITTLE_ENDIAN != 1)
#error "Little Endian is already defined, but to different value than expected?!"
#else
#define LITTLE_ENDIAN 1
#endif
#define __CM0PLUS_REV 1 /*!< Core revision r0p1 */
#define __MPU_PRESENT 0 /*!< MPU present or not */
#define __NVIC_PRIO_BITS 2 /*!< Number of bits used for Priority Levels */

View file

@ -222,7 +222,11 @@ void I2S_Handler ( void );
* \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
*/
#define LITTLE_ENDIAN 1
#if defined(LITTLE_ENDIAN) && (LITTLE_ENDIAN != 1)
#error "Little Endian is already defined, but to different value than expected?!"
#else
#define LITTLE_ENDIAN 1
#endif
#define __CM0PLUS_REV 1 /*!< Core revision r0p1 */
#define __MPU_PRESENT 0 /*!< MPU present or not */
#define __NVIC_PRIO_BITS 2 /*!< Number of bits used for Priority Levels */

View file

@ -226,7 +226,11 @@ void I2S_Handler ( void );
* \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
*/
#define LITTLE_ENDIAN 1
#if defined(LITTLE_ENDIAN) && (LITTLE_ENDIAN != 1)
#error "Little Endian is already defined, but to different value than expected?!"
#else
#define LITTLE_ENDIAN 1
#endif
#define __CM0PLUS_REV 1 /*!< Core revision r0p1 */
#define __MPU_PRESENT 0 /*!< MPU present or not */
#define __NVIC_PRIO_BITS 2 /*!< Number of bits used for Priority Levels */

View file

@ -226,7 +226,11 @@ void I2S_Handler ( void );
* \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
*/
#define LITTLE_ENDIAN 1
#if defined(LITTLE_ENDIAN) && (LITTLE_ENDIAN != 1)
#error "Little Endian is already defined, but to different value than expected?!"
#else
#define LITTLE_ENDIAN 1
#endif
#define __CM0PLUS_REV 1 /*!< Core revision r0p1 */
#define __MPU_PRESENT 0 /*!< MPU present or not */
#define __NVIC_PRIO_BITS 2 /*!< Number of bits used for Priority Levels */

View file

@ -226,7 +226,11 @@ void I2S_Handler ( void );
* \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
*/
#define LITTLE_ENDIAN 1
#if defined(LITTLE_ENDIAN) && (LITTLE_ENDIAN != 1)
#error "Little Endian is already defined, but to different value than expected?!"
#else
#define LITTLE_ENDIAN 1
#endif
#define __CM0PLUS_REV 1 /*!< Core revision r0p1 */
#define __MPU_PRESENT 0 /*!< MPU present or not */
#define __NVIC_PRIO_BITS 2 /*!< Number of bits used for Priority Levels */

View file

@ -226,7 +226,11 @@ void I2S_Handler ( void );
* \brief Configuration of the Cortex-M0+ Processor and Core Peripherals
*/
#define LITTLE_ENDIAN 1
#if defined(LITTLE_ENDIAN) && (LITTLE_ENDIAN != 1)
#error "Little Endian is already defined, but to different value than expected?!"
#else
#define LITTLE_ENDIAN 1
#endif
#define __CM0PLUS_REV 1 /*!< Core revision r0p1 */
#define __MPU_PRESENT 0 /*!< MPU present or not */
#define __NVIC_PRIO_BITS 2 /*!< Number of bits used for Priority Levels */

View file

@ -20,6 +20,35 @@
#ifndef _BOARD_DEFINITIONS_H_
#define _BOARD_DEFINITIONS_H_
#if defined(BOARD_ID_arduino_zero)
#include "board_definitions_arduino_zero.h"
#elif defined(BOARD_ID_genuino_zero)
#include "board_definitions_genuino_zero.h"
#elif defined(BOARD_ID_arduino_mkr1000)
#include "board_definitions_arduino_mkr1000.h"
#elif defined(BOARD_ID_genuino_mkr1000)
#include "board_definitions_genuino_mkr1000.h"
#elif defined(BOARD_ID_arduino_mkrzero)
#include "board_definitions_arduino_mkrzero.h"
#elif defined(BOARD_ID_arduino_mkrfox1200)
#include "board_definitions_arduino_mkrfox1200.h"
#elif defined(BOARD_ID_arduino_mkrgsm1400)
#include "board_definitions_arduino_mkrgsm1400.h"
#elif defined(BOARD_ID_arduino_mkrwan1300)
#include "board_definitions_arduino_mkrwan1300.h"
#elif defined(BOARD_ID_arduino_mkrwifi1010)
#include "board_definitions_arduino_mkrwifi1010.h"
#elif defined(BOARD_ID_arduino_mkrnb1500)
#include "board_definitions_arduino_mkrnb1500.h"
#else
#error You must define a BOARD_ID and add the corresponding definitions in board_definitions.h
#endif
// Common definitions
// ------------------
#define BOOT_PIN_MASK (1U << (BOOT_LOAD_PIN & 0x1f))
/*
* If BOOT_DOUBLE_TAP_ADDRESS is defined the bootloader is started by
* quickly tapping two times on the reset button.

View file

@ -0,0 +1,86 @@
/*
Copyright (c) 2016 Arduino LLC. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _BOARD_DEFINITIONS_H_
#define _BOARD_DEFINITIONS_H_
/*
* USB device definitions
*/
#define STRING_PRODUCT "Arduino MKR NB 1500"
#define USB_VID_HIGH 0x23
#define USB_VID_LOW 0x41
#define USB_PID_HIGH 0x00
#define USB_PID_LOW 0x55
/*
* If BOOT_DOUBLE_TAP_ADDRESS is defined the bootloader is started by
* quickly tapping two times on the reset button.
* BOOT_DOUBLE_TAP_ADDRESS must point to a free SRAM cell that must not
* be touched from the loaded application.
*/
#define BOOT_DOUBLE_TAP_ADDRESS (0x20007FFCul)
#define BOOT_DOUBLE_TAP_DATA (*((volatile uint32_t *) BOOT_DOUBLE_TAP_ADDRESS))
/*
* If BOOT_LOAD_PIN is defined the bootloader is started if the selected
* pin is tied LOW.
*/
//#define BOOT_LOAD_PIN PIN_PA21
//#define BOOT_LOAD_PIN PIN_PA15
#define BOOT_USART_MODULE SERCOM5
#define BOOT_USART_BUS_CLOCK_INDEX PM_APBCMASK_SERCOM5
#define BOOT_USART_PER_CLOCK_INDEX GCLK_CLKCTRL_ID_SERCOM5_CORE_Val
#define BOOT_USART_PAD_SETTINGS UART_RX_PAD3_TX_PAD2
#define BOOT_USART_PAD3 PINMUX_PB23D_SERCOM5_PAD3
#define BOOT_USART_PAD2 PINMUX_PB22D_SERCOM5_PAD2
#define BOOT_USART_PAD1 PINMUX_UNUSED
#define BOOT_USART_PAD0 PINMUX_UNUSED
/* Master clock frequency */
#define CPU_FREQUENCY (48000000ul)
#define VARIANT_MCK CPU_FREQUENCY
/* Frequency of the board main oscillator */
#define VARIANT_MAINOSC (32768ul)
/* Calibration values for DFLL48 pll */
#define NVM_SW_CALIB_DFLL48M_COARSE_VAL (58)
#define NVM_SW_CALIB_DFLL48M_FINE_VAL (64)
/*
* LEDs definitions
*/
// PA20 (digital pin 6)
#define BOARD_LED_PORT (0)
#define BOARD_LED_PIN (20)
#define CONFIGURE_PMIC 1
#define PMIC_PIN_SCL 12
#define PMIC_PIN_SDA 11
#define PMIC_SERCOM SERCOM0
// No RX/TX led
//#define BOARD_LEDRX_PORT
//#define BOARD_LEDRX_PIN
//#define BOARD_LEDTX_PORT
//#define BOARD_LEDTX_PIN
#endif // _BOARD_DEFINITIONS_H_

View file

@ -25,5 +25,8 @@ mv -v samd21_sam_ba_arduino_mkrwan1300.* ../mkrwan1300/
BOARD_ID=arduino_mkrwifi1010 NAME=samd21_sam_ba_arduino_mkrwifi1010 make clean all
mv -v samd21_sam_ba_arduino_mkrwifi1010.* ../mkrwifi1010/
BOARD_ID=arduino_mkrnb1500 NAME=samd21_sam_ba_arduino_mkrnb1500 make clean all
mv -v samd21_sam_ba_arduino_mkrnb1500.* ../mkrnb1500/
echo Done building bootloaders!

View file

@ -46,7 +46,6 @@ extern "C"{
// Include Atmel headers
#include "sam.h"
#include "wiring_constants.h"
#define clockCyclesPerMicrosecond() ( SystemCoreClock / 1000000L )
@ -97,8 +96,33 @@ void loop( void ) ;
#undef abs
#endif // abs
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#ifdef __cplusplus
template<class T, class L>
auto min(const T& a, const L& b) -> decltype((b < a) ? b : a)
{
return (b < a) ? b : a;
}
template<class T, class L>
auto max(const T& a, const L& b) -> decltype((b < a) ? b : a)
{
return (a < b) ? b : a;
}
#else
#ifndef min
#define min(a,b) \
({ __typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
_a < _b ? _a : _b; })
#endif
#ifndef max
#define max(a,b) \
({ __typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
_a > _b ? _a : _b; })
#endif
#endif
#define abs(x) ((x)>0?(x):-(x))
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
@ -124,10 +148,15 @@ void loop( void ) ;
#define digitalPinToInterrupt(P) ( P )
#endif
// USB Device
#include "USB/USBDesc.h"
#include "USB/USBCore.h"
#include "USB/USBAPI.h"
#include "USB/USB_host.h"
// USB
#ifdef USE_TINYUSB
// Needed for declaring Serial
#include "Adafruit_USBD_CDC.h"
#else
#include "USB/USBDesc.h"
#include "USB/USBCore.h"
#include "USB/USBAPI.h"
#include "USB/USB_host.h"
#endif
#endif // Arduino_h

View file

@ -68,7 +68,7 @@ class HardwareSerial : public Stream
{
public:
virtual void begin(unsigned long) {}
virtual void begin(unsigned long baudrate, uint16_t config) {}
virtual void begin(unsigned long, uint16_t) {}
virtual void end() {}
virtual int available(void) = 0;
virtual int peek(void) = 0;

View file

@ -94,6 +94,28 @@ size_t Print::print(unsigned long n, int base)
else return printNumber(n, base);
}
size_t Print::print(long long n, int base)
{
if (base == 0) {
return write(n);
} else if (base == 10) {
if (n < 0) {
int t = print('-');
n = -n;
return printULLNumber(n, 10) + t;
}
return printULLNumber(n, 10);
} else {
return printULLNumber(n, base);
}
}
size_t Print::print(unsigned long long n, int base)
{
if (base == 0) return write(n);
else return printULLNumber(n, base);
}
size_t Print::print(double n, int digits)
{
return printFloat(n, digits);
@ -172,6 +194,20 @@ size_t Print::println(unsigned long num, int base)
return n;
}
size_t Print::println(long long num, int base)
{
size_t n = print(num, base);
n += println();
return n;
}
size_t Print::println(unsigned long long num, int base)
{
size_t n = print(num, base);
n += println();
return n;
}
size_t Print::println(double num, int digits)
{
size_t n = print(num, digits);
@ -186,6 +222,16 @@ size_t Print::println(const Printable& x)
return n;
}
void Print::printf(const char format[], ...)
{
char buf[PRINTF_BUF];
va_list ap;
va_start(ap, format);
vsnprintf(buf, sizeof(buf), format, ap);
write(buf);
va_end(ap);
}
// Private Methods /////////////////////////////////////////////////////////////
size_t Print::printNumber(unsigned long n, uint8_t base)
@ -208,6 +254,81 @@ size_t Print::printNumber(unsigned long n, uint8_t base)
return write(str);
}
// REFERENCE IMPLEMENTATION FOR ULL
// size_t Print::printULLNumber(unsigned long long n, uint8_t base)
// {
// // if limited to base 10 and 16 the bufsize can be smaller
// char buf[65];
// char *str = &buf[64];
// *str = '\0';
// // prevent crash if called with base == 1
// if (base < 2) base = 10;
// do {
// unsigned long long t = n / base;
// char c = n - t * base; // faster than c = n%base;
// n = t;
// *--str = c < 10 ? c + '0' : c + 'A' - 10;
// } while(n);
// return write(str);
// }
// FAST IMPLEMENTATION FOR ULL
size_t Print::printULLNumber(unsigned long long n64, uint8_t base)
{
// if limited to base 10 and 16 the bufsize can be 20
char buf[64];
uint8_t i = 0;
uint8_t innerLoops = 0;
// prevent crash if called with base == 1
if (base < 2) base = 10;
// process chunks that fit in "16 bit math".
uint16_t top = 0xFFFF / base;
uint16_t th16 = 1;
while (th16 < top)
{
th16 *= base;
innerLoops++;
}
while (n64 > th16)
{
// 64 bit math part
uint64_t q = n64 / th16;
uint16_t r = n64 - q*th16;
n64 = q;
// 16 bit math loop to do remainder. (note buffer is filled reverse)
for (uint8_t j=0; j < innerLoops; j++)
{
uint16_t qq = r/base;
buf[i++] = r - qq*base;
r = qq;
}
}
uint16_t n16 = n64;
while (n16 > 0)
{
uint16_t qq = n16/base;
buf[i++] = n16 - qq*base;
n16 = qq;
}
size_t bytes = i;
for (; i > 0; i--)
write((char) (buf[i - 1] < 10 ?
'0' + buf[i - 1] :
'A' + buf[i - 1] - 10));
return bytes;
}
size_t Print::printFloat(double number, uint8_t digits)
{
size_t n = 0;
@ -238,17 +359,18 @@ size_t Print::printFloat(double number, uint8_t digits)
// Print the decimal point, but only if there are digits beyond
if (digits > 0) {
n += print('.');
n += print(".");
}
// Extract digits from the remainder one at a time
while (digits-- > 0)
{
remainder *= 10.0;
unsigned int toPrint = (unsigned int)(remainder);
unsigned int toPrint = (unsigned int)remainder;
n += print(toPrint);
remainder -= toPrint;
}
return n;
}

View file

@ -21,6 +21,8 @@
#include <inttypes.h>
#include <stdio.h> // for size_t
#include <stdarg.h> // for printf
#define PRINTF_BUF 80
#include "WString.h"
#include "Printable.h"
@ -28,9 +30,6 @@
#define DEC 10
#define HEX 16
#define OCT 8
#ifdef BIN // Prevent warnings if BIN is previously defined in "iotnx4.h" or similar
#undef BIN
#endif
#define BIN 2
class Print
@ -38,6 +37,7 @@ class Print
private:
int write_error;
size_t printNumber(unsigned long, uint8_t);
size_t printULLNumber(unsigned long long, uint8_t);
size_t printFloat(double, uint8_t);
protected:
void setWriteError(int err = 1) { write_error = err; }
@ -70,6 +70,8 @@ class Print
size_t print(unsigned int, int = DEC);
size_t print(long, int = DEC);
size_t print(unsigned long, int = DEC);
size_t print(long long, int = DEC);
size_t print(unsigned long long, int = DEC);
size_t print(double, int = 2);
size_t print(const Printable&);
@ -82,9 +84,13 @@ class Print
size_t println(unsigned int, int = DEC);
size_t println(long, int = DEC);
size_t println(unsigned long, int = DEC);
size_t println(long long, int = DEC);
size_t println(unsigned long long, int = DEC);
size_t println(double, int = 2);
size_t println(const Printable&);
size_t println(void);
void printf(const char[], ...);
virtual void flush() { /* Empty implementation for backward compatibility */ }
};

View file

@ -29,7 +29,7 @@ extern "C" {
#if (ARDUINO_SAMD_VARIANT_COMPLIANCE >= 10610)
extern const uint32_t __text_start__;
#define APP_START ((volatile uint32_t)(&__text_start__) + 4)
#define APP_START ((uint32_t)(&__text_start__) + 4)
#else

View file

@ -27,7 +27,10 @@
// using a ring buffer (I think), in which head is the index of the location
// to which to write the next incoming character and tail is the index of the
// location from which to read.
#define SERIAL_BUFFER_SIZE 164
#ifndef SERIAL_BUFFER_SIZE
#define SERIAL_BUFFER_SIZE 350
#endif
template <int N>
class RingBufferN

View file

@ -30,11 +30,29 @@
SERCOM::SERCOM(Sercom* s)
{
sercom = s;
#if defined(__SAMD51__)
// A briefly-available but now deprecated feature had the SPI clock source
// set via a compile-time setting (MAX_SPI)...problem was this affected
// ALL SERCOMs, whereas some (anything read/write, e.g. SD cards) should
// not exceed the standard 24 MHz setting. Newer code, if it needs faster
// write-only SPI (e.g. to screen), should override the SERCOM clock on a
// per-peripheral basis. Nonetheless, we check SERCOM_SPI_FREQ_REF here
// (MAX_SPI * 2) to retain compatibility with any interim projects that
// might have relied on the compile-time setting. But please, don't.
#if SERCOM_SPI_FREQ_REF == F_CPU // F_CPU clock = GCLK0
clockSource = SERCOM_CLOCK_SOURCE_FCPU;
#elif SERCOM_SPI_FREQ_REF == 48000000 // 48 MHz clock = GCLK1 (standard)
clockSource = SERCOM_CLOCK_SOURCE_48M;
#elif SERCOM_SPI_FREQ_REF == 100000000 // 100 MHz clock = GCLK2
clockSource = SERCOM_CLOCK_SOURCE_100M;
#endif
#endif // end __SAMD51__
}
/* =========================
* ===== Sercom UART
* =========================
/* =========================
* ===== Sercom UART
* =========================
*/
void SERCOM::initUART(SercomUartMode mode, SercomUartSampleRate sampleRate, uint32_t baudrate)
{
@ -42,12 +60,12 @@ void SERCOM::initUART(SercomUartMode mode, SercomUartSampleRate sampleRate, uint
resetUART();
//Setting the CTRLA register
sercom->USART.CTRLA.reg = SERCOM_USART_CTRLA_MODE(mode) |
SERCOM_USART_CTRLA_SAMPR(sampleRate);
sercom->USART.CTRLA.reg = SERCOM_USART_CTRLA_MODE(mode) |
SERCOM_USART_CTRLA_SAMPR(sampleRate);
//Setting the Interrupt register
sercom->USART.INTENSET.reg = SERCOM_USART_INTENSET_RXC | //Received complete
SERCOM_USART_INTENSET_ERROR; //All others errors
sercom->USART.INTENSET.reg = SERCOM_USART_INTENSET_RXC | //Received complete
SERCOM_USART_INTENSET_ERROR; //All others errors
if ( mode == UART_INT_CLOCK )
{
@ -75,20 +93,22 @@ void SERCOM::initUART(SercomUartMode mode, SercomUartSampleRate sampleRate, uint
void SERCOM::initFrame(SercomUartCharSize charSize, SercomDataOrder dataOrder, SercomParityMode parityMode, SercomNumberStopBit nbStopBits)
{
//Setting the CTRLA register
sercom->USART.CTRLA.reg |= SERCOM_USART_CTRLA_FORM( (parityMode == SERCOM_NO_PARITY ? 0 : 1) ) |
dataOrder << SERCOM_USART_CTRLA_DORD_Pos;
sercom->USART.CTRLA.reg |=
SERCOM_USART_CTRLA_FORM((parityMode == SERCOM_NO_PARITY ? 0 : 1) ) |
dataOrder << SERCOM_USART_CTRLA_DORD_Pos;
//Setting the CTRLB register
sercom->USART.CTRLB.reg |= SERCOM_USART_CTRLB_CHSIZE(charSize) |
nbStopBits << SERCOM_USART_CTRLB_SBMODE_Pos |
(parityMode == SERCOM_NO_PARITY ? 0 : parityMode) << SERCOM_USART_CTRLB_PMODE_Pos; //If no parity use default value
sercom->USART.CTRLB.reg |= SERCOM_USART_CTRLB_CHSIZE(charSize) |
nbStopBits << SERCOM_USART_CTRLB_SBMODE_Pos |
(parityMode == SERCOM_NO_PARITY ? 0 : parityMode) <<
SERCOM_USART_CTRLB_PMODE_Pos; //If no parity use default value
}
void SERCOM::initPads(SercomUartTXPad txPad, SercomRXPad rxPad)
{
//Setting the CTRLA register
sercom->USART.CTRLA.reg |= SERCOM_USART_CTRLA_TXPO(txPad) |
SERCOM_USART_CTRLA_RXPO(rxPad);
sercom->USART.CTRLA.reg |= SERCOM_USART_CTRLA_TXPO(txPad) |
SERCOM_USART_CTRLA_RXPO(rxPad);
// Enable Transceiver and Receiver
sercom->USART.CTRLB.reg |= SERCOM_USART_CTRLB_TXEN | SERCOM_USART_CTRLB_RXEN ;
@ -201,9 +221,9 @@ void SERCOM::disableDataRegisterEmptyInterruptUART()
sercom->USART.INTENCLR.reg = SERCOM_USART_INTENCLR_DRE;
}
/* =========================
* ===== Sercom SPI
* =========================
/* =========================
* ===== Sercom SPI
* =========================
*/
void SERCOM::initSPI(SercomSpiTXPad mosi, SercomRXPad miso, SercomSpiCharSize charSize, SercomDataOrder dataOrder)
{
@ -211,13 +231,13 @@ void SERCOM::initSPI(SercomSpiTXPad mosi, SercomRXPad miso, SercomSpiCharSize ch
initClockNVIC();
#if defined(__SAMD51__)
sercom->SPI.CTRLA.reg = SERCOM_SPI_CTRLA_MODE(0x3) | //master mode
SERCOM_SPI_CTRLA_DOPO(mosi) |
SERCOM_SPI_CTRLA_DIPO(miso) |
dataOrder << SERCOM_SPI_CTRLA_DORD_Pos;
sercom->SPI.CTRLA.reg = SERCOM_SPI_CTRLA_MODE(0x3) | // master mode
SERCOM_SPI_CTRLA_DOPO(mosi) |
SERCOM_SPI_CTRLA_DIPO(miso) |
dataOrder << SERCOM_SPI_CTRLA_DORD_Pos;
#else
//Setting the CTRLA register
sercom->SPI.CTRLA.reg = SERCOM_SPI_CTRLA_MODE_SPI_MASTER |
sercom->SPI.CTRLA.reg = SERCOM_SPI_CTRLA_MODE_SPI_MASTER |
SERCOM_SPI_CTRLA_DOPO(mosi) |
SERCOM_SPI_CTRLA_DIPO(miso) |
dataOrder << SERCOM_SPI_CTRLA_DORD_Pos;
@ -225,10 +245,9 @@ void SERCOM::initSPI(SercomSpiTXPad mosi, SercomRXPad miso, SercomSpiCharSize ch
//Setting the CTRLB register
sercom->SPI.CTRLB.reg = SERCOM_SPI_CTRLB_CHSIZE(charSize) |
SERCOM_SPI_CTRLB_RXEN; //Active the SPI receiver.
SERCOM_SPI_CTRLB_RXEN; //Active the SPI receiver.
while( sercom->SPI.SYNCBUSY.bit.CTRLB == 1 );
}
void SERCOM::initSPIClock(SercomSpiClockMode clockMode, uint32_t baudrate)
@ -247,8 +266,8 @@ void SERCOM::initSPIClock(SercomSpiClockMode clockMode, uint32_t baudrate)
cpol = 1;
//Setting the CTRLA register
sercom->SPI.CTRLA.reg |= ( cpha << SERCOM_SPI_CTRLA_CPHA_Pos ) |
( cpol << SERCOM_SPI_CTRLA_CPOL_Pos );
sercom->SPI.CTRLA.reg |= ( cpha << SERCOM_SPI_CTRLA_CPHA_Pos ) |
( cpol << SERCOM_SPI_CTRLA_CPOL_Pos );
//Synchronous arithmetic
sercom->SPI.BAUD.reg = calculateBaudrateSynchronous(baudrate);
@ -302,14 +321,13 @@ SercomDataOrder SERCOM::getDataOrderSPI()
void SERCOM::setBaudrateSPI(uint8_t divider)
{
//Can't divide by 0
if(divider == 0)
return;
disableSPI(); // Register is enable-protected
//Register enable-protected
disableSPI();
sercom->SPI.BAUD.reg = calculateBaudrateSynchronous( SERCOM_FREQ_REF / divider );
#if defined(__SAMD51__)
sercom->SPI.BAUD.reg = calculateBaudrateSynchronous(freqRef / divider);
#else
sercom->SPI.BAUD.reg = calculateBaudrateSynchronous(SERCOM_SPI_FREQ_REF / divider);
#endif
enableSPI();
}
@ -340,10 +358,7 @@ uint8_t SERCOM::transferDataSPI(uint8_t data)
{
sercom->SPI.DATA.bit.DATA = data; // Writing data into Data register
while( sercom->SPI.INTFLAG.bit.RXC == 0 )
{
// Waiting Complete Reception
}
while(sercom->SPI.INTFLAG.bit.RXC == 0); // Waiting Complete Reception
return sercom->SPI.DATA.bit.DATA; // Reading data
}
@ -361,25 +376,30 @@ bool SERCOM::isDataRegisterEmptySPI()
//bool SERCOM::isTransmitCompleteSPI()
//{
// //TXC : Transmit complete
// return sercom->SPI.INTFLAG.bit.TXC;
// //TXC : Transmit complete
// return sercom->SPI.INTFLAG.bit.TXC;
//}
//
//bool SERCOM::isReceiveCompleteSPI()
//{
// //RXC : Receive complete
// return sercom->SPI.INTFLAG.bit.RXC;
// //RXC : Receive complete
// return sercom->SPI.INTFLAG.bit.RXC;
//}
uint8_t SERCOM::calculateBaudrateSynchronous(uint32_t baudrate)
{
return SERCOM_FREQ_REF / (2 * baudrate) - 1;
uint8_t SERCOM::calculateBaudrateSynchronous(uint32_t baudrate) {
#if defined(__SAMD51__)
uint16_t b = freqRef / (2 * baudrate);
#else
uint16_t b = SERCOM_SPI_FREQ_REF / (2 * baudrate);
#endif
if(b > 0) b--; // Don't -1 on baud calc if already at 0
return b;
}
/* =========================
* ===== Sercom WIRE
* =========================
/* =========================
* ===== Sercom WIRE
* =========================
*/
void SERCOM::resetWIRE()
{
@ -517,8 +537,18 @@ bool SERCOM::startTransmissionWIRE(uint8_t address, SercomWireReadWriteFlag flag
// 7-bits address + 1-bits R/W
address = (address << 0x1ul) | flag;
// Wait idle or owner bus mode
while ( !isBusIdleWIRE() && !isBusOwnerWIRE() );
// 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;
}
}
// Send start and address
sercom->I2CM.ADDR.bit.ADDR = address;
@ -526,29 +556,35 @@ bool SERCOM::startTransmissionWIRE(uint8_t address, SercomWireReadWriteFlag flag
// Address Transmitted
if ( flag == WIRE_WRITE_FLAG ) // Write mode
{
while( !sercom->I2CM.INTFLAG.bit.MB )
{
while( !sercom->I2CM.INTFLAG.bit.MB ) {
// Wait transmission complete
// If certain errors occur, the MB bit may never be set (RFTM: SAMD21 sec:28.10.6; SAMD51 sec:36.10.7).
// The data transfer errors that can occur (including BUSERR) are all
// rolled up into INTFLAG.bit.ERROR from STATUS.reg
if (sercom->I2CM.INTFLAG.bit.ERROR) {
return false;
}
}
}
else // Read mode
{
while( !sercom->I2CM.INTFLAG.bit.SB )
{
// If the slave NACKS the address, the MB bit will be set.
// In that case, send a stop condition and return false.
if (sercom->I2CM.INTFLAG.bit.MB) {
sercom->I2CM.CTRLB.bit.CMD = 3; // Stop condition
return false;
}
while( !sercom->I2CM.INTFLAG.bit.SB ) {
// Wait transmission complete
// If the slave NACKS the address, the MB bit will be set.
// A variety of errors in the STATUS register can set the ERROR bit in the INTFLAG register
// In that case, send a stop condition and return false.
if (sercom->I2CM.INTFLAG.bit.MB || sercom->I2CM.INTFLAG.bit.ERROR) {
sercom->I2CM.CTRLB.bit.CMD = 3; // Stop condition
return false;
}
}
// Clean the 'Slave on Bus' flag, for further usage.
//sercom->I2CM.INTFLAG.bit.SB = 0x1ul;
}
//ACK received (0: ACK, 1: NACK)
if(sercom->I2CM.STATUS.bit.RXNACK)
{
@ -567,10 +603,11 @@ bool SERCOM::sendDataMasterWIRE(uint8_t data)
//Wait transmission successful
while(!sercom->I2CM.INTFLAG.bit.MB) {
// If a bus error occurs, the MB bit may never be set.
// Check the bus error bit and bail if it's set.
if (sercom->I2CM.STATUS.bit.BUSERR) {
// If a data transfer error occurs, the MB bit may never be set.
// Check the error bit and bail if it's set.
// The data transfer errors that can occur (including BUSERR) are all
// rolled up into INTFLAG.bit.ERROR from STATUS.reg
if (sercom->I2CM.INTFLAG.bit.ERROR) {
return false;
}
}
@ -614,6 +651,21 @@ 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;
@ -656,9 +708,17 @@ uint8_t SERCOM::readDataWIRE( void )
{
if(isMasterWIRE())
{
while( sercom->I2CM.INTFLAG.bit.SB == 0 )
{
while (sercom->I2CM.INTFLAG.bit.SB == 0) {
// Waiting complete receive
// A variety of errors in the STATUS register can set the ERROR bit in the INTFLAG register
// In that case, send a stop condition and return false.
// readDataWIRE should really be able to indicate an error (which would never be used
// because the readDataWIRE callers (in Wire.cpp) should have checked availableWIRE() first and timed it
// out if the data never showed up
if (sercom->I2CM.INTFLAG.bit.MB || sercom->I2CM.INTFLAG.bit.ERROR) {
sercom->I2CM.CTRLB.bit.CMD = 3; // Stop condition
return 0xFF;
}
}
return sercom->I2CM.DATA.bit.DATA ;
@ -669,244 +729,152 @@ uint8_t SERCOM::readDataWIRE( void )
}
}
#if defined(__SAMD51__)
static const struct {
Sercom *sercomPtr;
uint8_t id_core;
uint8_t id_slow;
IRQn_Type irq[4];
} sercomData[] = {
{ SERCOM0, SERCOM0_GCLK_ID_CORE, SERCOM0_GCLK_ID_SLOW,
SERCOM0_0_IRQn, SERCOM0_1_IRQn, SERCOM0_2_IRQn, SERCOM0_3_IRQn },
{ SERCOM1, SERCOM1_GCLK_ID_CORE, SERCOM1_GCLK_ID_SLOW,
SERCOM1_0_IRQn, SERCOM1_1_IRQn, SERCOM1_2_IRQn, SERCOM1_3_IRQn },
{ SERCOM2, SERCOM2_GCLK_ID_CORE, SERCOM2_GCLK_ID_SLOW,
SERCOM2_0_IRQn, SERCOM2_1_IRQn, SERCOM2_2_IRQn, SERCOM2_3_IRQn },
{ SERCOM3, SERCOM3_GCLK_ID_CORE, SERCOM3_GCLK_ID_SLOW,
SERCOM3_0_IRQn, SERCOM3_1_IRQn, SERCOM3_2_IRQn, SERCOM3_3_IRQn },
{ SERCOM4, SERCOM4_GCLK_ID_CORE, SERCOM4_GCLK_ID_SLOW,
SERCOM4_0_IRQn, SERCOM4_1_IRQn, SERCOM4_2_IRQn, SERCOM4_3_IRQn },
{ SERCOM5, SERCOM5_GCLK_ID_CORE, SERCOM5_GCLK_ID_SLOW,
SERCOM5_0_IRQn, SERCOM5_1_IRQn, SERCOM5_2_IRQn, SERCOM5_3_IRQn },
#if defined(SERCOM6)
{ SERCOM6, SERCOM6_GCLK_ID_CORE, SERCOM6_GCLK_ID_SLOW,
SERCOM6_0_IRQn, SERCOM6_1_IRQn, SERCOM6_2_IRQn, SERCOM6_3_IRQn },
#endif
#if defined(SERCOM7)
{ SERCOM7, SERCOM7_GCLK_ID_CORE, SERCOM7_GCLK_ID_SLOW,
SERCOM7_0_IRQn, SERCOM7_1_IRQn, SERCOM7_2_IRQn, SERCOM7_3_IRQn },
#endif
};
#else // end if SAMD51 (prob SAMD21)
static const struct {
Sercom *sercomPtr;
uint8_t clock;
IRQn_Type irqn;
} sercomData[] = {
SERCOM0, GCM_SERCOM0_CORE, SERCOM0_IRQn,
SERCOM1, GCM_SERCOM1_CORE, SERCOM1_IRQn,
SERCOM2, GCM_SERCOM2_CORE, SERCOM2_IRQn,
SERCOM3, GCM_SERCOM3_CORE, SERCOM3_IRQn,
#if defined(SERCOM4)
SERCOM4, GCM_SERCOM4_CORE, SERCOM4_IRQn,
#endif
#if defined(SERCOM5)
SERCOM5, GCM_SERCOM5_CORE, SERCOM5_IRQn,
#endif
};
#endif // end !SAMD51
int8_t SERCOM::getSercomIndex(void) {
for(uint8_t i=0; i<(sizeof(sercomData) / sizeof(sercomData[0])); i++) {
if(sercom == sercomData[i].sercomPtr) return i;
}
return -1;
}
#if defined(__SAMD51__)
// This is currently for overriding an SPI SERCOM's clock source only --
// NOT for UART or WIRE SERCOMs, where it will have unintended consequences.
// It does not check.
// SERCOM clock source override is available only on SAMD51 (not 21).
// A dummy function for SAMD21 (compiles to nothing) is present in SERCOM.h
// so user code doesn't require a lot of conditional situations.
void SERCOM::setClockSource(int8_t idx, SercomClockSource src, bool core) {
if(src == SERCOM_CLOCK_SOURCE_NO_CHANGE) return;
uint8_t clk_id = core ? sercomData[idx].id_core : sercomData[idx].id_slow;
GCLK->PCHCTRL[clk_id].bit.CHEN = 0; // Disable timer
while(GCLK->PCHCTRL[clk_id].bit.CHEN); // Wait for disable
if(core) clockSource = src; // Save SercomClockSource value
// From cores/arduino/startup.c:
// GCLK0 = F_CPU
// GCLK1 = 48 MHz
// GCLK2 = 100 MHz
// GCLK3 = XOSC32K
// GCLK4 = 12 MHz
if(src == SERCOM_CLOCK_SOURCE_FCPU) {
GCLK->PCHCTRL[clk_id].reg =
GCLK_PCHCTRL_GEN_GCLK0_Val | (1 << GCLK_PCHCTRL_CHEN_Pos);
if(core) freqRef = F_CPU; // Save clock frequency value
} else if(src == SERCOM_CLOCK_SOURCE_48M) {
GCLK->PCHCTRL[clk_id].reg =
GCLK_PCHCTRL_GEN_GCLK1_Val | (1 << GCLK_PCHCTRL_CHEN_Pos);
if(core) freqRef = 48000000;
} else if(src == SERCOM_CLOCK_SOURCE_100M) {
GCLK->PCHCTRL[clk_id].reg =
GCLK_PCHCTRL_GEN_GCLK2_Val | (1 << GCLK_PCHCTRL_CHEN_Pos);
if(core) freqRef = 100000000;
} else if(src == SERCOM_CLOCK_SOURCE_32K) {
GCLK->PCHCTRL[clk_id].reg =
GCLK_PCHCTRL_GEN_GCLK3_Val | (1 << GCLK_PCHCTRL_CHEN_Pos);
if(core) freqRef = 32768;
} else if(src == SERCOM_CLOCK_SOURCE_12M) {
GCLK->PCHCTRL[clk_id].reg =
GCLK_PCHCTRL_GEN_GCLK4_Val | (1 << GCLK_PCHCTRL_CHEN_Pos);
if(core) freqRef = 12000000;
}
while(!GCLK->PCHCTRL[clk_id].bit.CHEN); // Wait for clock enable
}
#endif
void SERCOM::initClockNVIC( void )
{
int8_t idx = getSercomIndex();
if(idx < 0) return; // We got a problem here
#if defined(__SAMD51__)
uint32_t clk_core;
uint32_t clk_slow;
if(sercom == SERCOM0)
{
clk_core = SERCOM0_GCLK_ID_CORE;
clk_slow = SERCOM0_GCLK_ID_SLOW;
NVIC_ClearPendingIRQ(SERCOM0_0_IRQn);
NVIC_ClearPendingIRQ(SERCOM0_1_IRQn);
NVIC_ClearPendingIRQ(SERCOM0_2_IRQn);
NVIC_ClearPendingIRQ(SERCOM0_3_IRQn);
NVIC_SetPriority (SERCOM0_0_IRQn, (1<<__NVIC_PRIO_BITS) - 1); /* set Priority */
NVIC_SetPriority (SERCOM0_1_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
NVIC_SetPriority (SERCOM0_2_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
NVIC_SetPriority (SERCOM0_3_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
NVIC_EnableIRQ(SERCOM0_0_IRQn);
NVIC_EnableIRQ(SERCOM0_1_IRQn);
NVIC_EnableIRQ(SERCOM0_2_IRQn);
NVIC_EnableIRQ(SERCOM0_3_IRQn);
}
else if(sercom == SERCOM1)
{
clk_core = SERCOM1_GCLK_ID_CORE;
clk_slow = SERCOM1_GCLK_ID_SLOW;
NVIC_ClearPendingIRQ(SERCOM1_0_IRQn);
NVIC_ClearPendingIRQ(SERCOM1_1_IRQn);
NVIC_ClearPendingIRQ(SERCOM1_2_IRQn);
NVIC_ClearPendingIRQ(SERCOM1_3_IRQn);
NVIC_SetPriority (SERCOM1_0_IRQn, (1<<__NVIC_PRIO_BITS) - 1); /* set Priority */
NVIC_SetPriority (SERCOM1_1_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
NVIC_SetPriority (SERCOM1_2_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
NVIC_SetPriority (SERCOM1_3_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
NVIC_EnableIRQ(SERCOM1_0_IRQn);
NVIC_EnableIRQ(SERCOM1_1_IRQn);
NVIC_EnableIRQ(SERCOM1_2_IRQn);
NVIC_EnableIRQ(SERCOM1_3_IRQn);
}
else if(sercom == SERCOM2)
{
clk_core = SERCOM2_GCLK_ID_CORE;
clk_slow = SERCOM2_GCLK_ID_SLOW;
NVIC_ClearPendingIRQ(SERCOM2_0_IRQn);
NVIC_ClearPendingIRQ(SERCOM2_1_IRQn);
NVIC_ClearPendingIRQ(SERCOM2_2_IRQn);
NVIC_ClearPendingIRQ(SERCOM2_3_IRQn);
NVIC_SetPriority (SERCOM2_0_IRQn, (1<<__NVIC_PRIO_BITS) - 1); /* set Priority */
NVIC_SetPriority (SERCOM2_1_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
NVIC_SetPriority (SERCOM2_2_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
NVIC_SetPriority (SERCOM2_3_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
NVIC_EnableIRQ(SERCOM2_0_IRQn);
NVIC_EnableIRQ(SERCOM2_1_IRQn);
NVIC_EnableIRQ(SERCOM2_2_IRQn);
NVIC_EnableIRQ(SERCOM2_3_IRQn);
}
else if(sercom == SERCOM3)
{
clk_core = SERCOM3_GCLK_ID_CORE;
clk_slow = SERCOM3_GCLK_ID_SLOW;
NVIC_ClearPendingIRQ(SERCOM3_0_IRQn);
NVIC_ClearPendingIRQ(SERCOM3_1_IRQn);
NVIC_ClearPendingIRQ(SERCOM3_2_IRQn);
NVIC_ClearPendingIRQ(SERCOM3_3_IRQn);
NVIC_SetPriority (SERCOM3_0_IRQn, (1<<__NVIC_PRIO_BITS) - 1); /* set Priority */
NVIC_SetPriority (SERCOM3_1_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
NVIC_SetPriority (SERCOM3_2_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
NVIC_SetPriority (SERCOM3_3_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
NVIC_EnableIRQ(SERCOM3_0_IRQn);
NVIC_EnableIRQ(SERCOM3_1_IRQn);
NVIC_EnableIRQ(SERCOM3_2_IRQn);
NVIC_EnableIRQ(SERCOM3_3_IRQn);
}
else if(sercom == SERCOM4)
{
clk_core = SERCOM4_GCLK_ID_CORE;
clk_slow = SERCOM4_GCLK_ID_SLOW;
NVIC_ClearPendingIRQ(SERCOM4_0_IRQn);
NVIC_ClearPendingIRQ(SERCOM4_1_IRQn);
NVIC_ClearPendingIRQ(SERCOM4_2_IRQn);
NVIC_ClearPendingIRQ(SERCOM4_3_IRQn);
NVIC_SetPriority (SERCOM4_0_IRQn, (1<<__NVIC_PRIO_BITS) - 1); /* set Priority */
NVIC_SetPriority (SERCOM4_1_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
NVIC_SetPriority (SERCOM4_2_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
NVIC_SetPriority (SERCOM4_3_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
NVIC_EnableIRQ(SERCOM4_0_IRQn);
NVIC_EnableIRQ(SERCOM4_1_IRQn);
NVIC_EnableIRQ(SERCOM4_2_IRQn);
NVIC_EnableIRQ(SERCOM4_3_IRQn);
}
else if(sercom == SERCOM5)
{
clk_core = SERCOM5_GCLK_ID_CORE;
clk_slow = SERCOM5_GCLK_ID_SLOW;
NVIC_ClearPendingIRQ(SERCOM5_0_IRQn);
NVIC_ClearPendingIRQ(SERCOM5_1_IRQn);
NVIC_ClearPendingIRQ(SERCOM5_2_IRQn);
NVIC_ClearPendingIRQ(SERCOM5_3_IRQn);
NVIC_SetPriority (SERCOM5_0_IRQn, (1<<__NVIC_PRIO_BITS) - 1); /* set Priority */
NVIC_SetPriority (SERCOM5_1_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
NVIC_SetPriority (SERCOM5_2_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
NVIC_SetPriority (SERCOM5_3_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
NVIC_EnableIRQ(SERCOM5_0_IRQn);
NVIC_EnableIRQ(SERCOM5_1_IRQn);
NVIC_EnableIRQ(SERCOM5_2_IRQn);
NVIC_EnableIRQ(SERCOM5_3_IRQn);
}
#if defined SERCOM6
else if(sercom == SERCOM6)
{
clk_core = SERCOM6_GCLK_ID_CORE;
clk_slow = SERCOM6_GCLK_ID_SLOW;
NVIC_ClearPendingIRQ(SERCOM6_0_IRQn);
NVIC_ClearPendingIRQ(SERCOM6_1_IRQn);
NVIC_ClearPendingIRQ(SERCOM6_2_IRQn);
NVIC_ClearPendingIRQ(SERCOM6_3_IRQn);
NVIC_SetPriority (SERCOM6_0_IRQn, (1<<__NVIC_PRIO_BITS) - 1); /* set Priority */
NVIC_SetPriority (SERCOM6_1_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
NVIC_SetPriority (SERCOM6_2_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
NVIC_SetPriority (SERCOM6_3_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
NVIC_EnableIRQ(SERCOM6_0_IRQn);
NVIC_EnableIRQ(SERCOM6_1_IRQn);
NVIC_EnableIRQ(SERCOM6_2_IRQn);
NVIC_EnableIRQ(SERCOM6_3_IRQn);
}
#endif
#if defined SERCOM7
else if(sercom == SERCOM7)
{
clk_core = SERCOM7_GCLK_ID_CORE;
clk_slow = SERCOM7_GCLK_ID_SLOW;
NVIC_ClearPendingIRQ(SERCOM7_0_IRQn);
NVIC_ClearPendingIRQ(SERCOM7_1_IRQn);
NVIC_ClearPendingIRQ(SERCOM7_2_IRQn);
NVIC_ClearPendingIRQ(SERCOM7_3_IRQn);
NVIC_SetPriority (SERCOM7_0_IRQn, (1<<__NVIC_PRIO_BITS) - 1); /* set Priority */
NVIC_SetPriority (SERCOM7_1_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
NVIC_SetPriority (SERCOM7_2_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
NVIC_SetPriority (SERCOM7_3_IRQn, (1<<__NVIC_PRIO_BITS) - 1);
NVIC_EnableIRQ(SERCOM7_0_IRQn);
NVIC_EnableIRQ(SERCOM7_1_IRQn);
NVIC_EnableIRQ(SERCOM7_2_IRQn);
NVIC_EnableIRQ(SERCOM7_3_IRQn);
}
#endif
#else
IRQn_Type IdNvic=PendSV_IRQn ; // Dummy init to intercept potential error later
uint8_t clockId = 0;
if(sercom == SERCOM0)
{
clockId = GCM_SERCOM0_CORE;
IdNvic = SERCOM0_IRQn;
for(uint8_t i=0; i<4; i++) {
NVIC_ClearPendingIRQ(sercomData[idx].irq[i]);
NVIC_SetPriority(sercomData[idx].irq[i], SERCOM_NVIC_PRIORITY);
NVIC_EnableIRQ(sercomData[idx].irq[i]);
}
else if(sercom == SERCOM1)
{
clockId = GCM_SERCOM1_CORE;
IdNvic = SERCOM1_IRQn;
}
else if(sercom == SERCOM2)
{
clockId = GCM_SERCOM2_CORE;
IdNvic = SERCOM2_IRQn;
}
else if(sercom == SERCOM3)
{
clockId = GCM_SERCOM3_CORE;
IdNvic = SERCOM3_IRQn;
}
#if defined(SERCOM4)
else if(sercom == SERCOM4)
{
clockId = GCM_SERCOM4_CORE;
IdNvic = SERCOM4_IRQn;
}
#endif
#if defined(SERCOM5)
else if(sercom == SERCOM5)
{
clockId = GCM_SERCOM5_CORE;
IdNvic = SERCOM5_IRQn;
}
#endif
if ( IdNvic == PendSV_IRQn )
{
// We got a problem here
return ;
}
#endif
// SPI DMA speed is dictated by the "slow clock" (I think...maybe) so
// BOTH are set to the same clock source (clk_slow isn't sourced from
// XOSC32K as in prior versions of SAMD core).
// This might have power implications for sleep code.
#if defined(__SAMD51__)
GCLK->PCHCTRL[clk_core].reg = GCLK_PCHCTRL_GEN_GCLK1_Val | (1 << GCLK_PCHCTRL_CHEN_Pos);
GCLK->PCHCTRL[clk_slow].reg = GCLK_PCHCTRL_GEN_GCLK3_Val | (1 << GCLK_PCHCTRL_CHEN_Pos);
#else
// Setting NVIC
setClockSource(idx, clockSource, true); // true = core clock
setClockSource(idx, clockSource, false); // false = slow clock
#else // end if SAMD51 (prob SAMD21)
uint8_t clockId = sercomData[idx].clock;
IRQn_Type IdNvic = sercomData[idx].irqn;
// Setting NVIC
NVIC_ClearPendingIRQ(IdNvic);
NVIC_SetPriority (IdNvic, (1<<__NVIC_PRIO_BITS) - 1); /* set Priority */
NVIC_SetPriority(IdNvic, SERCOM_NVIC_PRIORITY);
NVIC_EnableIRQ(IdNvic);
//Setting clock
GCLK->CLKCTRL.reg = GCLK_CLKCTRL_ID( clockId ) | // Generic Clock 0 (SERCOMx)
GCLK_CLKCTRL_GEN_GCLK0 | // Generic Clock Generator 0 is source
GCLK_CLKCTRL_CLKEN ;
// Setting clock
GCLK->CLKCTRL.reg =
GCLK_CLKCTRL_ID( clockId ) | // Generic Clock 0 (SERCOMx)
GCLK_CLKCTRL_GEN_GCLK0 | // Generic Clock Generator 0 is source
GCLK_CLKCTRL_CLKEN;
while ( GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY )
{
/* Wait for synchronization */
}
#endif
while(GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY); // Wait for synchronization
#endif // end !SAMD51
}

View file

@ -21,8 +21,19 @@
#include "sam.h"
#define SERCOM_FREQ_REF 48000000ul
#define SERCOM_NVIC_PRIORITY ((1<<__NVIC_PRIO_BITS) - 1)
// SAMD51 has configurable MAX_SPI, else use peripheral clock default.
// Update: changing MAX_SPI via compiler flags is DEPRECATED, because
// this affects ALL SPI peripherals including some that should NOT be
// changed (e.g. anything using SD card). Instead, use setClockSource().
// This is left here for compatibility w/interim MAX_SPI-dependent code:
#if defined(MAX_SPI)
#define SERCOM_SPI_FREQ_REF (MAX_SPI * 2)
#else
#define SERCOM_SPI_FREQ_REF 48000000ul
#endif
// Other SERCOM peripherals always use the 48 MHz clock
#define SERCOM_FREQ_REF 48000000ul
#define SERCOM_NVIC_PRIORITY ((1<<__NVIC_PRIO_BITS) - 1)
typedef enum
{
@ -80,23 +91,23 @@ typedef enum
typedef enum
{
UART_TX_PAD_0 = 0x0ul, // Only for UART
UART_TX_PAD_0 = 0x0ul, // Only for UART
UART_TX_PAD_2 = 0x1ul, // Only for UART
UART_TX_RTS_CTS_PAD_0_2_3 = 0x2ul, // Only for UART with TX on PAD0, RTS on PAD2 and CTS on PAD3
} SercomUartTXPad;
typedef enum
{
SAMPLE_RATE_x16 = 0x1, //Fractional
SAMPLE_RATE_x8 = 0x3, //Fractional
SAMPLE_RATE_x16 = 0x1, // Fractional
SAMPLE_RATE_x8 = 0x3, // Fractional
} SercomUartSampleRate;
typedef enum
{
SERCOM_SPI_MODE_0 = 0, // CPOL : 0 | CPHA : 0
SERCOM_SPI_MODE_1, // CPOL : 0 | CPHA : 1
SERCOM_SPI_MODE_2, // CPOL : 1 | CPHA : 0
SERCOM_SPI_MODE_3 // CPOL : 1 | CPHA : 1
SERCOM_SPI_MODE_0 = 0, // CPOL : 0 | CPHA : 0
SERCOM_SPI_MODE_1, // CPOL : 0 | CPHA : 1
SERCOM_SPI_MODE_2, // CPOL : 1 | CPHA : 0
SERCOM_SPI_MODE_3 // CPOL : 1 | CPHA : 1
} SercomSpiClockMode;
typedef enum
@ -141,6 +152,19 @@ typedef enum
WIRE_MASTER_NACK_ACTION
} SercomMasterAckActionWire;
// SERCOM clock source override is available only on SAMD51 (not 21)
// but the enumeration is made regardless so user code doesn't need
// ifdefs or lengthy comments explaining the different situations --
// the clock-sourcing functions just compile to nothing on SAMD21.
typedef enum {
SERCOM_CLOCK_SOURCE_FCPU, // F_CPU clock (GCLK0)
SERCOM_CLOCK_SOURCE_48M, // 48 MHz peripheral clock (GCLK1) (standard)
SERCOM_CLOCK_SOURCE_100M, // 100 MHz peripheral clock (GCLK2)
SERCOM_CLOCK_SOURCE_32K, // XOSC32K clock (GCLK3)
SERCOM_CLOCK_SOURCE_12M, // 12 MHz peripheral clock (GCLK4)
SERCOM_CLOCK_SOURCE_NO_CHANGE // Leave clock source setting unchanged
} SercomClockSource;
class SERCOM
{
public:
@ -171,7 +195,6 @@ class SERCOM
/* ========== SPI ========== */
void initSPI(SercomSpiTXPad mosi, SercomRXPad miso, SercomSpiCharSize charSize, SercomDataOrder dataOrder) ;
void initSPIClock(SercomSpiClockMode clockMode, uint32_t baudrate) ;
void resetSPI( void ) ;
void enableSPI( void ) ;
void disableSPI( void ) ;
@ -202,6 +225,9 @@ 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 ) ;
@ -210,10 +236,30 @@ class SERCOM
bool isRXNackReceivedWIRE( void ) ;
int availableWIRE( void ) ;
uint8_t readDataWIRE( void ) ;
int8_t getSercomIndex(void);
#if defined(__SAMD51__)
// SERCOM clock source override is only available on
// SAMD51 (not 21) ... but these functions are declared
// regardless so user code doesn't need ifdefs or lengthy
// comments explaining the different situations -- these
// just compile to nothing on SAMD21.
void setClockSource(int8_t idx, SercomClockSource src, bool core);
SercomClockSource getClockSource(void) { return clockSource; };
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; };
SercomClockSource getClockSource(void) { return SERCOM_CLOCK_SOURCE_FCPU; };
uint32_t getFreqRef(void) { return F_CPU; };
#endif
private:
Sercom* sercom;
uint8_t calculateBaudrateSynchronous(uint32_t baudrate) ;
#if defined(__SAMD51__)
SercomClockSource clockSource;
uint32_t freqRef; // Frequency corresponding to clockSource
#endif
uint8_t calculateBaudrateSynchronous(uint32_t baudrate);
uint32_t division(uint32_t dividend, uint32_t divisor) ;
void initClockNVIC( void ) ;
};

View file

@ -35,6 +35,7 @@ int Stream::timedRead()
do {
c = read();
if (c >= 0) return c;
yield(); // running TinyUSB task
} while(millis() - _startMillis < _timeout);
return -1; // -1 indicates timeout
}
@ -47,6 +48,7 @@ int Stream::timedPeek()
do {
c = peek();
if (c >= 0) return c;
yield(); // running TinyUSB task
} while(millis() - _startMillis < _timeout);
return -1; // -1 indicates timeout
}

View file

@ -20,12 +20,6 @@
#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;
@ -37,22 +31,24 @@ volatile bool toneIsActive = false;
volatile bool firstTimeRunning = false;
#if defined(__SAMD51__)
#define TONE_TC TC2
#define TONE_TC_IRQn TC2_IRQn
#define TONE_TC_GCLK_ID TC2_GCLK_ID
#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);
#else
#define TONE_TC TC5
#define TONE_TC_IRQn TC5_IRQn
#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);
#endif
#define TONE_TC_TOP 0xFFFF
#define TONE_TC_CHANNEL 0
#if defined(__SAMD51__)
void TC2_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
@ -72,6 +68,14 @@ 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);
@ -80,19 +84,16 @@ void tone (uint32_t outputPin, uint32_t frequency, uint32_t duration)
{
firstTimeRunning = true;
NVIC_SetPriority(TONE_TC_IRQn, 0);
NVIC_SetPriority(TONE_TC_IRQn, 5);
#if defined(__SAMD51__)
GCLK->PCHCTRL[TONE_TC_GCLK_ID].reg = GCLK_PCHCTRL_GEN_GCLK0_Val | (1 << GCLK_PCHCTRL_CHEN_Pos);
GCLK->PCHCTRL[TONE_TC_GCLK_ID].reg = GCLK_PCHCTRL_GEN_GCLK0_Val | (1 << GCLK_PCHCTRL_CHEN_Pos);
#else
// Enable GCLK for TC4 and TC5 (timer counter input clock)
GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID(GCM_TC4_TC5));
while (GCLK->STATUS.bit.SYNCBUSY);
#endif
}
//if it's a rest, set to 1Hz (below audio range)
frequency = (frequency > 0 ? frequency : 1);
if (toneIsActive && (outputPin != lastOutputPin))
noTone(lastOutputPin);
@ -136,7 +137,7 @@ void tone (uint32_t outputPin, uint32_t frequency, uint32_t duration)
default: break;
}
toggleCount = (duration > 0 ? frequency * duration * 2 / 1000UL : -1);
toggleCount = (duration > 0 ? frequency * duration * 2 / 1000UL : -1LL);
resetTC(TONE_TC);
@ -179,9 +180,19 @@ void tone (uint32_t outputPin, uint32_t frequency, uint32_t duration)
void noTone (uint32_t outputPin)
{
resetTC(TONE_TC);
digitalWrite(outputPin, LOW);
toneIsActive = false;
/* '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;
}
}
#ifdef __cplusplus

View file

@ -16,6 +16,8 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef USE_TINYUSB
#include <Arduino.h>
#include <Reset.h> // Needed for auto-reset with 1200bps port touch
@ -150,6 +152,7 @@ void Serial_::begin(uint32_t /* baud_count */, uint8_t /* config */)
void Serial_::end(void)
{
memset((void*)&_usbLineInfo, 0, sizeof(_usbLineInfo));
}
int Serial_::available(void)
@ -256,6 +259,52 @@ Serial_::operator bool()
return result;
}
int32_t Serial_::readBreak() {
uint8_t enableInterrupts = ((__get_PRIMASK() & 0x1) == 0);
// disable interrupts,
// to avoid clearing a breakValue that might occur
// while processing the current break value
__disable_irq();
int32_t ret = breakValue;
breakValue = -1;
if (enableInterrupts) {
// re-enable the interrupts
__enable_irq();
}
return ret;
}
unsigned long Serial_::baud() {
return _usbLineInfo.dwDTERate;
}
uint8_t Serial_::stopbits() {
return _usbLineInfo.bCharFormat;
}
uint8_t Serial_::paritytype() {
return _usbLineInfo.bParityType;
}
uint8_t Serial_::numbits() {
return _usbLineInfo.bDataBits;
}
bool Serial_::dtr() {
return _usbLineInfo.lineState & 0x1;
}
bool Serial_::rts() {
return _usbLineInfo.lineState & 0x2;
}
Serial_ Serial(USBDevice);
#endif
#endif // USE_TINYUSB

View file

@ -17,6 +17,8 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef USE_TINYUSB
#include "USBAPI.h"
#include "USBDesc.h"
#include "USBCore.h"
@ -113,4 +115,6 @@ PluggableUSB_::PluggableUSB_() : lastIf(CDC_ACM_INTERFACE + CDC_INTERFACE_COUNT)
}
#endif
#endif
#endif
#endif // USE_TINYUSB

View file

@ -5,6 +5,7 @@
* Author: deanm
*/
#ifndef USE_TINYUSB
#include "SAMD21_USBDevice.h"
@ -36,3 +37,5 @@ void USBDevice_SAMD21G18x::calibrate() {
usb.PADCAL.bit.TRANSP = pad_transp;
usb.PADCAL.bit.TRIM = pad_trim;
}
#endif // USE_TINYUSB

View file

@ -237,7 +237,7 @@ public:
release();
}
~DoubleBufferedEPOutHandler() {
virtual ~DoubleBufferedEPOutHandler() {
free((void*)data0);
free((void*)data1);
}

View file

@ -65,6 +65,7 @@ public:
// USB Device API
void init();
bool end();
bool attach();
bool detach();
void setAddress(uint32_t addr);
@ -84,7 +85,7 @@ public:
uint32_t sendControl(int /* ep */, const void *data, uint32_t len) { return sendControl(data, len); }
uint32_t recvControl(void *data, uint32_t len);
uint32_t sendConfiguration(uint32_t maxlen);
bool sendStringDescriptor(const uint8_t *string, uint8_t maxlen);
bool sendStringDescriptor(const uint8_t *string, uint32_t maxlen);
void initControl(int end);
uint8_t SendInterfaces(uint32_t* total);
void packMessages(bool val);

View file

@ -16,7 +16,7 @@
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 USE_TINYUSB
#if defined(USBCON)
#include <Arduino.h>
@ -110,12 +110,12 @@ static EPHandler *epHandlers[7] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL};
// Send a USB descriptor string. The string is stored as a
// plain ASCII string but is sent out as UTF-16 with the
// correct 2-byte prefix
bool USBDeviceClass::sendStringDescriptor(const uint8_t *string, uint8_t maxlen)
bool USBDeviceClass::sendStringDescriptor(const uint8_t *string, uint32_t maxlen)
{
if (maxlen < 2)
return false;
uint8_t buffer[maxlen];
uint8_t* buffer = (uint8_t*)malloc(maxlen);
buffer[0] = strlen((const char*)string) * 2 + 2;
buffer[1] = 0x03;
@ -126,7 +126,9 @@ bool USBDeviceClass::sendStringDescriptor(const uint8_t *string, uint8_t maxlen)
buffer[i] = 0;
}
return USBDevice.sendControl(buffer, i);
bool ret = USBDevice.sendControl(buffer, i);
free(buffer);
return ret;
}
bool _dry_run = false;
@ -244,26 +246,25 @@ bool USBDeviceClass::sendDescriptor(USBSetup &setup)
}
else if (setup.wValueL == ISERIAL) {
#ifdef PLUGGABLE_USB_ENABLED
#if defined(__SAMD51__)
char name[ISERIAL_MAX_LEN];
PluggableUSB().getShortName(name);
return sendStringDescriptor((uint8_t*)name, setup.wLength);
#else
#ifdef __SAMD51__
#define SERIAL_NUMBER_WORD_0 *(volatile uint32_t*)(0x008061FC)
#define SERIAL_NUMBER_WORD_1 *(volatile uint32_t*)(0x00806010)
#define SERIAL_NUMBER_WORD_2 *(volatile uint32_t*)(0x00806014)
#define SERIAL_NUMBER_WORD_3 *(volatile uint32_t*)(0x00806018)
#else // samd21
// from section 9.3.3 of the datasheet
#define SERIAL_NUMBER_WORD_0 *(volatile uint32_t*)(0x0080A00C)
#define SERIAL_NUMBER_WORD_1 *(volatile uint32_t*)(0x0080A040)
#define SERIAL_NUMBER_WORD_2 *(volatile uint32_t*)(0x0080A044)
#define SERIAL_NUMBER_WORD_3 *(volatile uint32_t*)(0x0080A048)
#endif
char name[ISERIAL_MAX_LEN];
utox8(SERIAL_NUMBER_WORD_0, &name[0]);
utox8(SERIAL_NUMBER_WORD_1, &name[8]);
utox8(SERIAL_NUMBER_WORD_2, &name[16]);
utox8(SERIAL_NUMBER_WORD_3, &name[24]);
PluggableUSB().getShortName(&name[32]);
name[32] = '\0';
return sendStringDescriptor((uint8_t*)name, setup.wLength);
#endif
#endif
}
else {
@ -434,6 +435,13 @@ bool USBDeviceClass::detach()
return true;
}
bool USBDeviceClass::end() {
if (!initialized)
return false;
usbd.disable();
return true;
}
bool USBDeviceClass::configured()
{
return _usbConfiguration != 0;
@ -871,6 +879,7 @@ bool USBDeviceClass::handleStandardSetup(USBSetup &setup)
sendZlp(0);
return true;
}
return false;
case SET_ADDRESS:
setAddress(setup.wValueL);
@ -1032,3 +1041,4 @@ void USBDeviceClass::ISRHandler()
USBDeviceClass USBDevice;
#endif
#endif // USE_TINYUSB

View file

@ -17,6 +17,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef USE_TINYUSB
#include <stdio.h>
#include <stdint.h>
@ -63,7 +64,6 @@ void UHD_Init(void)
uint32_t pad_transn;
uint32_t pad_transp;
uint32_t pad_trim;
uint32_t i;
USB_SetHandler(&UHD_Handler);
@ -172,10 +172,7 @@ void UHD_Init(void)
USB->HOST.DESCADD.reg = (uint32_t)(&usb_pipe_table[0]);
// For USB_SPEED_FULL
uhd_force_full_speed();
for (i = 0; i < sizeof(usb_pipe_table); i++)
{
(*(uint32_t *)(&usb_pipe_table[0] + i)) = 0;
}
memset((void *)usb_pipe_table, 0, sizeof(usb_pipe_table));
uhd_state = UHD_STATE_NO_VBUS;
@ -557,3 +554,5 @@ uint32_t UHD_Pipe_Is_Transfer_Complete(uint32_t ul_pipe, uint32_t ul_token_type)
// }
#endif // HOST_DEFINED
#endif // USE_TINYUSB

View file

@ -250,8 +250,9 @@ void detachInterrupt(uint32_t pin)
* External Interrupt Controller NVIC Interrupt Handler
*/
#if defined(__SAMD51__)
void InterruptHandler(uint32_t i)
void InterruptHandler(uint32_t unused_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

View file

@ -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);

View file

@ -693,12 +693,21 @@ void String::remove(unsigned int index){
}
void String::remove(unsigned int index, unsigned int count){
if (index >= len) { return; }
if (count <= 0) { return; }
if (count > len - index) { count = len - index; }
char *writeTo = buffer + index;
// removes characters from the middle of a string.
if (count <= 0) { return; } // exit if nothing to remove
if (index >= len) { return; } // ensure start is within string length; thus, ensures (len-index >= 1)
if (count > len - index) { // ensure characters to remove is no larger than total length remaining
count = len - index;
}
char *writeTo = buffer + index;
char *copyFrom = buffer + index + count;
len = len - count;
strncpy(writeTo, buffer + index + count,len - index);
// strncpy() cannot be used with overlapping buffers, so copy one char at a time
unsigned int charactersToMove = len - index; // yes, uses post-adjusted length
for (unsigned int i = 0; i < charactersToMove; i++, writeTo++, copyFrom++) {
*writeTo = *copyFrom;
}
buffer[len] = 0;
}

View file

@ -57,6 +57,8 @@ typedef enum _EAnalogChannel
ADC_Channel19=19,
DAC_Channel0,
DAC_Channel1,
ADC_Channel_Bandgap=0x1B,
ADC_Channel_PTAT=0x1C,
} EAnalogChannel ;
#if defined(__SAMD51__)
@ -88,7 +90,7 @@ typedef enum _ETCChannel
TC3_CH0 = (6<<8)|(0),
TC3_CH1 = (6<<8)|(1),
} ETCChannel ;
#elif defined(__SAMD51J19A__) || defined(__SAMD51J20A__)
#elif defined(__SAMD51J19A__) || defined(__SAMD51J20A__) || defined(__SAME51J19A__)
typedef enum _ETCChannel
{
@ -99,10 +101,16 @@ typedef enum _ETCChannel
TCC0_CH3 = (0<<8)|(3),
TCC0_CH4 = (0<<8)|(4),
TCC0_CH5 = (0<<8)|(5),
TCC0_CH6 = (0<<8)|(6),
TCC0_CH7 = (0<<8)|(7),
TCC1_CH0 = (1<<8)|(0),
TCC1_CH1 = (1<<8)|(1),
TCC1_CH2 = (1<<8)|(2),
TCC1_CH3 = (1<<8)|(3),
TCC1_CH4 = (1<<8)|(4),
TCC1_CH5 = (1<<8)|(5),
TCC1_CH6 = (1<<8)|(6),
TCC1_CH7 = (1<<8)|(7),
TCC2_CH0 = (2<<8)|(0),
TCC2_CH1 = (2<<8)|(1),
TCC2_CH2 = (2<<8)|(2),
@ -122,9 +130,13 @@ typedef enum _ETCChannel
TC4_CH1 = (9<<8)|(1),
TC5_CH0 = (10<<8)|(0),
TC5_CH1 = (10<<8)|(1),
TC6_CH0 = (11<<8)|(0),
TC6_CH1 = (11<<8)|(1),
TC7_CH0 = (12<<8)|(0),
TC7_CH1 = (12<<8)|(1),
} ETCChannel ;
#elif defined(__SAMD51P19A__) || defined(__SAMD51P20A__)
#elif defined(__SAME53N20A__) || defined(__SAME53N19A__) || defined(__SAME54P20A__) || defined(__SAME54P19A__) || defined(__SAME54N20A__) || defined(__SAME54N19A__) || defined(__SAMD51P20A__) || defined(__SAMD51P19A__) || defined(__SAMD51N20A__) || defined(__SAMD51N19A__) || defined(__SAME51N20A__) || defined(__SAME51N19A__)
typedef enum _ETCChannel
{
@ -198,6 +210,12 @@ typedef enum _ETCChannel
TC4_CH1 = (4<<8)|(1),
TC5_CH0 = (5<<8)|(0),
TC5_CH1 = (5<<8)|(1),
#if defined (__SAMD21J18A__)
TC6_CH0 = (6<<8)|(0),
TC6_CH1 = (6<<8)|(1),
TC7_CH0 = (7<<8)|(0),
TC7_CH1 = (7<<8)|(1),
#endif // __SAMD21J18A__
} ETCChannel ;
// Definitions for PWM channels

View file

@ -25,8 +25,14 @@
#ifndef _IO_H_
#define _IO_H_
#define RAMSTART (HMCRAMC0_ADDR)
#define RAMSIZE (HMCRAMC0_SIZE)
#ifdef __SAMD51__
#define RAMSTART (HSRAM_ADDR)
#define RAMSIZE (HSRAM_SIZE)
#else
#define RAMSTART (HMCRAMC0_ADDR)
#define RAMSIZE (HMCRAMC0_SIZE)
#endif
#define RAMEND (RAMSTART + RAMSIZE - 1)
#endif

View file

@ -127,10 +127,13 @@ void SERCOM7_0_Handler ( void ) __attribute__ ((weak, alias("Dummy_Han
void SERCOM7_1_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void SERCOM7_2_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void SERCOM7_3_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void CAN0_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void CAN1_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void USB_0_Handler ( void ) __attribute__ ((weak));
void USB_1_Handler ( void ) __attribute__ ((weak));
void USB_2_Handler ( void ) __attribute__ ((weak));
void USB_3_Handler ( void ) __attribute__ ((weak));
void GMAC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void TCC0_0_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void TCC0_1_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
void TCC0_2_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));
@ -193,6 +196,7 @@ extern uint32_t __bss_end__;
extern uint32_t __StackTop;
/* Exception Table */
__attribute__ ((used))
__attribute__ ((section(".isr_vector"))) const DeviceVectors exception_table =
{
/* Configure Initial Stack Pointer, using linker-generated symbols */
@ -294,13 +298,13 @@ __attribute__ ((section(".isr_vector"))) const DeviceVectors exception_table =
(void*) SERCOM7_1_Handler, /* 75 Serial Communication Interface 7 IRQ 1 */
(void*) SERCOM7_2_Handler, /* 76 Serial Communication Interface 7 IRQ 2 */
(void*) SERCOM7_3_Handler, /* 77 Serial Communication Interface 7 IRQ 3 */
(void*) (0UL),
(void*) (0UL),
(void*) CAN0_Handler, /* 78 Control Area Network 0 (SAM E5x) */
(void*) CAN1_Handler, /* 79 Control Area Network 0 (SAM E5x) */
(void*) USB_0_Handler, /* 80 Universal Serial Bus IRQ 0 */
(void*) USB_1_Handler, /* 81 Universal Serial Bus IRQ 1 */
(void*) USB_2_Handler, /* 82 Universal Serial Bus IRQ 2 */
(void*) USB_3_Handler, /* 83 Universal Serial Bus IRQ 3 */
(void*) (0UL),
(void*) GMAC_Handler, /* 84 Ethernet MAC */
(void*) TCC0_0_Handler, /* 85 Timer Counter Control 0 IRQ 0 */
(void*) TCC0_1_Handler, /* 86 Timer Counter Control 0 IRQ 1 */
(void*) TCC0_2_Handler, /* 87 Timer Counter Control 0 IRQ 2 */
@ -404,6 +408,7 @@ extern uint32_t __bss_end__;
extern uint32_t __StackTop;
/* Exception Table */
__attribute__ ((used))
__attribute__ ((section(".isr_vector"))) const DeviceVectors exception_table =
{
/* Configure Initial Stack Pointer, using linker-generated symbols */

View file

@ -61,19 +61,51 @@ unsigned long micros( void )
// a runtime multiplication and shift, saving a few cycles
}
#ifdef __SAMD51__
/*
* On SAMD51, use the (32bit) cycle count maintained by the DWT unit,
* and count exact number of cycles elapsed, rather than guessing how
* many cycles a loop takes, which is dangerous in the presence of
* cache. The overhead of the call and internal code is "about" 20
* cycles. (at 120MHz, that's about 1/6 us)
*/
void delayMicroseconds(unsigned int us)
{
uint32_t start, elapsed;
uint32_t count;
if (us == 0)
return;
count = us * (VARIANT_MCK / 1000000) - 20; // convert us to cycles.
start = DWT->CYCCNT; //CYCCNT is 32bits, takes 37s or so to wrap.
while (1) {
elapsed = DWT->CYCCNT - start;
if (elapsed >= count)
return;
}
}
#endif
void delay( unsigned long ms )
{
if ( ms == 0 )
if (ms == 0)
{
return ;
return;
}
uint32_t start = _ulTickCount ;
uint32_t start = micros();
do
while (ms > 0)
{
yield() ;
} while ( _ulTickCount - start < ms ) ;
yield();
while (ms > 0 && (micros() - start) >= 1000)
{
ms--;
start += 1000;
}
}
}
#include "Reset.h" // for tickReset()
@ -85,6 +117,17 @@ void SysTick_DefaultHandler(void)
tickReset();
}
#if defined(USE_TINYUSB)
// run TinyUSB background task when yield()
void yield(void)
{
TinyUSB_Device_Task();
TinyUSB_Device_FlushCDC();
}
#endif
#ifdef __cplusplus
}
#endif

View file

@ -61,6 +61,9 @@ extern void delay( unsigned long dwMs ) ;
*
* \param dwUs the number of microseconds to pause (uint32_t)
*/
#if defined(__SAMD51__)
extern void delayMicroseconds( unsigned int );
#else
static __inline__ void delayMicroseconds( unsigned int ) __attribute__((always_inline, unused)) ;
static __inline__ void delayMicroseconds( unsigned int usec )
{
@ -68,21 +71,6 @@ static __inline__ void delayMicroseconds( unsigned int usec )
{
return ;
}
#if defined(__SAMD51__)
uint32_t n = usec * (VARIANT_MCK / 1000000) / 12;
__asm__ __volatile__(
"1: \n"
" sub %0, #1 \n" // substract 1 from %0 (n)
" cmp %0, #0 \n" // compare to 0
" bne 1b \n" // if result is not 0 jump to 1
: "+r" (n) // '%0' is n variable with RW constraints
: // no input
: // no clobber
);
#else
/*
* The following loop:
*
@ -109,10 +97,10 @@ static __inline__ void delayMicroseconds( unsigned int usec )
: // no input
: // no clobber
);
#endif
// https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html
// https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#Volatile
}
#endif
#ifdef __cplusplus
}

View file

@ -28,6 +28,7 @@
static void __empty() {
// Empty
}
void yield(void) __attribute__ ((weak, alias("__empty")));
/**

View file

@ -39,7 +39,10 @@ int main( void )
initVariant();
delay(1);
#if defined(USBCON)
#if defined(USE_TINYUSB)
TinyUSB_Device_Init(0);
#elif defined(USBCON)
USBDevice.init();
USBDevice.attach();
#endif
@ -49,6 +52,8 @@ int main( void )
for (;;)
{
loop();
yield(); // yield run usb background task
if (serialEventRun) serialEventRun();
}

View file

@ -164,18 +164,19 @@ 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, diffCrnt = 0;
int32_t diff;
uint32_t diffCrnt = 0;
uint32_t maxDiff = 0;
for (i = 0; i < numSamples; i++)
{
diff = pIn[i] - pOut[i];
diffCrnt = (diff > 0) ? diff : -diff;
diff = pIn[i] - pOut[i];
diffCrnt = (uint32_t)( (diff > 0) ? diff : -diff );
if(diffCrnt > maxDiff)
{
maxDiff = diffCrnt;
}
if(diffCrnt > maxDiff)
{
maxDiff = diffCrnt;
}
}
return(maxDiff);
@ -192,18 +193,19 @@ 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, diffCrnt = 0;
int32_t diff;
uint32_t diffCrnt = 0;
uint32_t maxDiff = 0;
for (i = 0; i < numSamples; i++)
{
diff = pIn[i] - pOut[i];
diffCrnt = (diff > 0) ? diff : -diff;
diff = pIn[i] - pOut[i];
diffCrnt = (uint32_t)( (diff > 0) ? diff : -diff );
if(diffCrnt > maxDiff)
{
maxDiff = diffCrnt;
}
if(diffCrnt > maxDiff)
{
maxDiff = diffCrnt;
}
}
return(maxDiff);

View file

@ -34,6 +34,36 @@ uint32_t pulseIn(uint32_t pin, uint32_t state, uint32_t timeout)
uint32_t bit = 1 << p.ulPin;
uint32_t stateMask = state ? bit : 0;
#if defined(__SAMD51__)
/*
* The SAMD51 is fast enough to use really obvious code (similar to
* what was used to produce pulse_asm.S, but using micros() for timing.
* No assembly required, no conversion of loop counts to times (which is
* worrisome in the presence of cache.)
*/
const volatile uint32_t *port = &(PORT->Group[p.ulPort].IN.reg);
uint32_t usCallStart; // microseconds at start of call, for timeout.
uint32_t usPulseStart; // microseconds at start of measured pulse.
usCallStart = usPulseStart = micros();
// wait for any previous pulse to end
while ((*port & bit) == stateMask) {
if (micros() - usCallStart > timeout)
return -1;
}
// wait for the pulse to start
while ((*port & bit) != stateMask) {
usPulseStart = micros();
if (usPulseStart - usCallStart > timeout)
return -2;
}
// wait for the pulse to stop
while ((*port & bit) == stateMask) {
if (micros() - usCallStart > timeout)
return -3;
}
return micros() - usPulseStart;
#else
// convert the timeout from microseconds to a number of times through
// the initial loop; it takes (roughly) 13 clock cycles per iteration.
uint32_t maxloops = microsecondsToClockCycles(timeout) / 13;
@ -48,5 +78,6 @@ uint32_t pulseIn(uint32_t pin, uint32_t state, uint32_t timeout)
return clockCyclesToMicroseconds(width * 13 + 16);
else
return 0;
#endif // SAMD51
}

View file

@ -37,7 +37,7 @@
//USE DPLL0 for 120MHZ
#define MAIN_CLOCK_SOURCE GCLK_GENCTRL_SRC_DPLL0
#define GENERIC_CLOCK_GENERATOR_1M (7u)
#define GENERIC_CLOCK_GENERATOR_1M (5u)
//#define CRYSTALLESS
#else
@ -63,7 +63,7 @@ void SystemInit( void )
* 1) Enable XOSC32K clock (External on-board 32.768Hz oscillator)
*/
OSC32KCTRL->XOSC32K.reg = OSC32KCTRL_XOSC32K_ENABLE | OSC32KCTRL_XOSC32K_EN32K | OSC32KCTRL_XOSC32K_EN32K | OSC32KCTRL_XOSC32K_CGM_XT | OSC32KCTRL_XOSC32K_XTALEN;
OSC32KCTRL->XOSC32K.reg = OSC32KCTRL_XOSC32K_ENABLE | OSC32KCTRL_XOSC32K_EN1K | OSC32KCTRL_XOSC32K_EN32K | OSC32KCTRL_XOSC32K_CGM_XT | OSC32KCTRL_XOSC32K_XTALEN;
while( (OSC32KCTRL->STATUS.reg & OSC32KCTRL_STATUS_XOSC32KRDY) == 0 ){
/* Wait for oscillator to be ready */
@ -97,7 +97,7 @@ void SystemInit( void )
}
/* ----------------------------------------------------------------------------------------------
* 3) Put Generic Clock Generator 3 as source for Generic Clock Gen 0 (DFLL48M reference)
* 3) Put OSCULP32K as source for Generic Clock Generator 0
*/
GCLK->GENCTRL[0].reg = GCLK_GENCTRL_SRC(GCLK_GENCTRL_SRC_OSCULP32K) | GCLK_GENCTRL_GENEN;
@ -146,7 +146,7 @@ void SystemInit( void )
/* Wait for synchronization */
}
GCLK->GENCTRL[GENERIC_CLOCK_GENERATOR_1M].reg = GCLK_GENCTRL_SRC(GCLK_GENCTRL_SRC_DFLL_Val) | GCLK_GENCTRL_GENEN | GCLK_GENCTRL_DIV(24u);
GCLK->GENCTRL[GENERIC_CLOCK_GENERATOR_1M].reg = GCLK_GENCTRL_SRC(GCLK_GENCTRL_SRC_DFLL_Val) | GCLK_GENCTRL_GENEN | GCLK_GENCTRL_DIV(48u);
while ( GCLK->SYNCBUSY.bit.GENCTRL5 ){
/* Wait for synchronization */
@ -158,9 +158,10 @@ void SystemInit( void )
*/
//PLL0 is 120MHz
GCLK->PCHCTRL[OSCCTRL_GCLK_ID_FDPLL0].reg = (1 << GCLK_PCHCTRL_CHEN_Pos) | GCLK_PCHCTRL_GEN(GCLK_PCHCTRL_GEN_GCLK7_Val);
GCLK->PCHCTRL[OSCCTRL_GCLK_ID_FDPLL0].reg = (1 << GCLK_PCHCTRL_CHEN_Pos) | GCLK_PCHCTRL_GEN(GCLK_PCHCTRL_GEN_GCLK5_Val);
OSCCTRL->Dpll[0].DPLLRATIO.reg = OSCCTRL_DPLLRATIO_LDRFRAC(0x00) | OSCCTRL_DPLLRATIO_LDR(59); //120 Mhz
// This rounds to nearest full-MHz increment; not currently using frac
OSCCTRL->Dpll[0].DPLLRATIO.reg = OSCCTRL_DPLLRATIO_LDRFRAC(0x00) | OSCCTRL_DPLLRATIO_LDR((F_CPU - 500000) / 1000000);
while(OSCCTRL->Dpll[0].DPLLSYNCBUSY.bit.DPLLRATIO);
@ -172,9 +173,9 @@ void SystemInit( void )
while( OSCCTRL->Dpll[0].DPLLSTATUS.bit.CLKRDY == 0 || OSCCTRL->Dpll[0].DPLLSTATUS.bit.LOCK == 0 );
//PLL1 is 100MHz
GCLK->PCHCTRL[OSCCTRL_GCLK_ID_FDPLL1].reg = (1 << GCLK_PCHCTRL_CHEN_Pos) | GCLK_PCHCTRL_GEN(GCLK_PCHCTRL_GEN_GCLK7_Val);
GCLK->PCHCTRL[OSCCTRL_GCLK_ID_FDPLL1].reg = (1 << GCLK_PCHCTRL_CHEN_Pos) | GCLK_PCHCTRL_GEN(GCLK_PCHCTRL_GEN_GCLK5_Val);
OSCCTRL->Dpll[1].DPLLRATIO.reg = OSCCTRL_DPLLRATIO_LDRFRAC(0x00) | OSCCTRL_DPLLRATIO_LDR(49); //100 Mhz
OSCCTRL->Dpll[1].DPLLRATIO.reg = OSCCTRL_DPLLRATIO_LDRFRAC(0x00) | OSCCTRL_DPLLRATIO_LDR(99); //100 Mhz
while(OSCCTRL->Dpll[1].DPLLSYNCBUSY.bit.DPLLRATIO);
@ -216,7 +217,7 @@ void SystemInit( void )
GCLK->GENCTRL[GENERIC_CLOCK_GENERATOR_12M].reg = GCLK_GENCTRL_SRC(GCLK_GENCTRL_SRC_DFLL_Val) |
GCLK_GENCTRL_IDC |
GCLK_GENCTRL_DIV(4) |
GCLK_GENCTRL_DIVSEL |
//GCLK_GENCTRL_DIVSEL |
//GCLK_GENCTRL_OE |
GCLK_GENCTRL_GENEN;
@ -252,7 +253,55 @@ void SystemInit( void )
CMCC->CTRL.reg = 1;
__enable_irq();
#endif
/*---------------------------------------------------------------------
* Start up the "Debug Watchpoint and Trace" unit, so that we can use
* it's 32bit cycle counter for timing.
*/
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk;
/* ----------------------------------------------------------------------------------------------
* 5) Load AC factory calibration values
*/
uint32_t bias0 = (*((uint32_t *)AC_FUSES_BIAS0_ADDR) & AC_FUSES_BIAS0_Msk) >> AC_FUSES_BIAS0_Pos;
AC->CALIB.reg = AC_CALIB_BIAS0(bias0);
/* ----------------------------------------------------------------------------------------------
* 6) Load ADC factory calibration values
*/
// ADC0 Bias Calibration
uint32_t biascomp = (*((uint32_t *)ADC0_FUSES_BIASCOMP_ADDR) & ADC0_FUSES_BIASCOMP_Msk) >> ADC0_FUSES_BIASCOMP_Pos;
uint32_t biasr2r = (*((uint32_t *)ADC0_FUSES_BIASR2R_ADDR) & ADC0_FUSES_BIASR2R_Msk) >> ADC0_FUSES_BIASR2R_Pos;
uint32_t biasref = (*((uint32_t *)ADC0_FUSES_BIASREFBUF_ADDR) & ADC0_FUSES_BIASREFBUF_Msk) >> ADC0_FUSES_BIASREFBUF_Pos;
ADC0->CALIB.reg = ADC_CALIB_BIASREFBUF(biasref)
| ADC_CALIB_BIASR2R(biasr2r)
| ADC_CALIB_BIASCOMP(biascomp);
// ADC1 Bias Calibration
biascomp = (*((uint32_t *)ADC1_FUSES_BIASCOMP_ADDR) & ADC1_FUSES_BIASCOMP_Msk) >> ADC1_FUSES_BIASCOMP_Pos;
biasr2r = (*((uint32_t *)ADC1_FUSES_BIASR2R_ADDR) & ADC1_FUSES_BIASR2R_Msk) >> ADC1_FUSES_BIASR2R_Pos;
biasref = (*((uint32_t *)ADC1_FUSES_BIASREFBUF_ADDR) & ADC1_FUSES_BIASREFBUF_Msk) >> ADC1_FUSES_BIASREFBUF_Pos;
ADC1->CALIB.reg = ADC_CALIB_BIASREFBUF(biasref)
| ADC_CALIB_BIASR2R(biasr2r)
| ADC_CALIB_BIASCOMP(biascomp);
/* ----------------------------------------------------------------------------------------------
* 7) Load USB factory calibration values
*/
//USB Calibration
uint32_t usbtransn = (*((uint32_t *)USB_FUSES_TRANSN_ADDR) & USB_FUSES_TRANSN_Msk) >> USB_FUSES_TRANSN_Pos;
uint32_t usbtransp = (*((uint32_t *)USB_FUSES_TRANSP_ADDR) & USB_FUSES_TRANSP_Msk) >> USB_FUSES_TRANSP_Pos;
uint32_t usbtrim = (*((uint32_t *)USB_FUSES_TRIM_ADDR) & USB_FUSES_TRIM_Msk) >> USB_FUSES_TRIM_Pos;
USB->DEVICE.PADCAL.reg = USB_PADCAL_TRIM(usbtrim)
| USB_PADCAL_TRANSN(usbtransn)
| USB_PADCAL_TRANSP(usbtransp);
//*************** END SAMD51 *************************//
#else
@ -528,4 +577,3 @@ void SystemInit( void )
NVMCTRL->CTRLB.bit.MANW = 1;
#endif
}

View file

@ -25,8 +25,7 @@ extern "C" {
#if defined(__SAMD51__)
//CHANGE THIS IF YOU CHANGE THE CLOCK SPEED
uint32_t SystemCoreClock=120000000ul ;
uint32_t SystemCoreClock=F_CPU;
#else
/*
* System Core Clock is at 1MHz (8MHz/8) at Reset.
@ -93,7 +92,7 @@ void init( void )
PM->APBCMASK.reg |= PM_APBCMASK_SERCOM0 | PM_APBCMASK_SERCOM1 | PM_APBCMASK_SERCOM2 | PM_APBCMASK_SERCOM3 | PM_APBCMASK_SERCOM4 | PM_APBCMASK_SERCOM5 ;
// Clock TC/TCC for Pulse and Analog
PM->APBCMASK.reg |= PM_APBCMASK_TCC0 | PM_APBCMASK_TCC1 | PM_APBCMASK_TCC2 | PM_APBCMASK_TC3 | PM_APBCMASK_TC4 | PM_APBCMASK_TC5 ;
PM->APBCMASK.reg |= PM_APBCMASK_TCC0 | PM_APBCMASK_TCC1 | PM_APBCMASK_TCC2 | PM_APBCMASK_TC3 | PM_APBCMASK_TC4 | PM_APBCMASK_TC5 | PM_APBCMASK_TC6 | PM_APBCMASK_TC7;
// ATSAMR, for example, doesn't have a DAC
#ifdef PM_APBCMASK_DAC
@ -102,11 +101,16 @@ void init( void )
#endif
#endif
/*
Commented out to leave pins in default tri-state. This is
aimed at avoiding power consumption in DeepSleep.
// Setup all pins (digital and analog) in INPUT mode (default is nothing)
for (uint32_t ul = 0 ; ul < NUM_DIGITAL_PINS ; ul++ )
{
pinMode( ul, INPUT ) ;
}
*/
// Initialize Analog Controller
// Setting clock

View file

@ -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
@ -140,38 +140,87 @@ void analogReference(eAnalogReference mode)
//TODO: fix gains
switch (mode)
{
case AR_INTERNAL:
case AR_INTERNAL2V23:
case AR_INTERNAL1V0:
//ADC0->GAINCORR.reg = ADC_GAINCORR_GAINCORR(); // Gain Factor Selection
ADC0->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTVCC0_Val; // 1/1.48 VDDANA = 1/1.48* 3V3 = 2.2297
ADC1->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTVCC0_Val; // 1/1.48 VDDANA = 1/1.48* 3V3 = 2.2297
SUPC->VREF.bit.SEL = SUPC_VREF_SEL_1V0_Val; // select 1.0V
SUPC->VREF.bit.VREFOE = 1; // Turn on for use with ADC
ADC0->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTREF_Val; // Use SUPC.VREF
ADC1->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTREF_Val; //
break;
case AR_INTERNAL1V1:
//ADC0->GAINCORR.reg = ADC_GAINCORR_GAINCORR(); // Gain Factor Selection
SUPC->VREF.bit.SEL = SUPC_VREF_SEL_1V1_Val; // select 1.1V
SUPC->VREF.bit.VREFOE = 1; // Turn on for use with ADC
ADC0->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTREF_Val; // Use SUPC.VREF
ADC1->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTREF_Val; //
break;
case AR_INTERNAL1V2:
//ADC0->GAINCORR.reg = ADC_GAINCORR_GAINCORR(); // Gain Factor Selection
SUPC->VREF.bit.SEL = SUPC_VREF_SEL_1V2_Val; // select 1V2
SUPC->VREF.bit.VREFOE = 1; // Turn on for use with ADC
ADC0->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTREF_Val; // Use SUPC.VREF
ADC1->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTREF_Val; //
break;
case AR_INTERNAL1V25:
//ADC0->GAINCORR.reg = ADC_GAINCORR_GAINCORR(); // Gain Factor Selection
SUPC->VREF.bit.SEL = SUPC_VREF_SEL_1V25_Val; // select 1.25V
SUPC->VREF.bit.VREFOE = 1; // Turn on for use with ADC
ADC0->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTREF_Val; // Use SUPC.VREF
ADC1->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTREF_Val; //
break;
case AR_INTERNAL2V0:
//ADC0->GAINCORR.reg = ADC_GAINCORR_GAINCORR(); // Gain Factor Selection
SUPC->VREF.bit.SEL = SUPC_VREF_SEL_2V0_Val; // select 2.0V
SUPC->VREF.bit.VREFOE = 1; // Turn on for use with ADC
ADC0->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTREF_Val; // Use SUPC.VREF
ADC1->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTREF_Val; //
break;
case AR_INTERNAL2V2:
//ADC0->GAINCORR.reg = ADC_GAINCORR_GAINCORR(); // Gain Factor Selection
SUPC->VREF.bit.SEL = SUPC_VREF_SEL_2V2_Val; // select 2.2V
SUPC->VREF.bit.VREFOE = 1; // Turn on for use with ADC
ADC0->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTREF_Val; // Use SUPC.VREF
ADC1->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTREF_Val; //
break;
case AR_INTERNAL2V4:
//ADC0->GAINCORR.reg = ADC_GAINCORR_GAINCORR(); // Gain Factor Selection
SUPC->VREF.bit.SEL = SUPC_VREF_SEL_2V4_Val; // select 2.4V
SUPC->VREF.bit.VREFOE = 1; // Turn on for use with ADC
ADC0->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTREF_Val; // Use SUPC.VREF
ADC1->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTREF_Val; //
break;
case AR_INTERNAL2V5:
//ADC0->GAINCORR.reg = ADC_GAINCORR_GAINCORR(); // Gain Factor Selection
SUPC->VREF.bit.SEL = SUPC_VREF_SEL_2V5_Val; // select 2.5V
SUPC->VREF.bit.VREFOE = 1; // Turn on for use with ADC
ADC0->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTREF_Val; // Use SUPC.VREF
ADC1->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTREF_Val; //
break;
case AR_EXTERNAL:
//ADC0->INPUTCTRL.bit.GAIN = ADC_INPUTCTRL_GAIN_1X_Val; // Gain Factor Selection
ADC0->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_AREFA_Val;
ADC0->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_AREFA_Val; // AREF is jumpered to VCC, so 3.3V
ADC1->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_AREFA_Val;
break;
/* Don't think this works on SAMD51
case AR_INTERNAL1V0:
//ADC0->INPUTCTRL.bit.GAIN = ADC_INPUTCTRL_GAIN_1X_Val; // Gain Factor Selection
ADC0->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INT1V_Val; // 1.0V voltage reference
break;
*/
case AR_INTERNAL1V65:
//ADC0->INPUTCTRL.bit.GAIN = ADC_INPUTCTRL_GAIN_1X_Val; // Gain Factor Selection
ADC0->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTVCC1_Val; // 1/2 VDDANA = 0.5* 3V3 = 1.65V
ADC1->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTVCC1_Val; // 1/2 VDDANA = 0.5* 3V3 = 1.65V
//ADC0->INPUTCTRL.bit.GAIN = ADC_INPUTCTRL_GAIN_DIV2_Val;
ADC0->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTVCC0_Val; // 1/2 VDDANA = 1.65
ADC1->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTVCC0_Val; //
break;
case AR_DEFAULT:
default:
//ADC0->INPUTCTRL.bit.GAIN = ADC_INPUTCTRL_GAIN_DIV2_Val;
ADC0->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTVCC1_Val; // 1/2 VDDANA = 0.5* 3V3 = 1.65V
ADC1->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTVCC1_Val; // 1/2 VDDANA = 0.5* 3V3 = 1.65V
ADC0->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTVCC1_Val; // VDDANA = 3V3
ADC1->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTVCC1_Val; //
break;
}
@ -179,7 +228,6 @@ void analogReference(eAnalogReference mode)
syncADC();
switch (mode)
{
case AR_INTERNAL:
case AR_INTERNAL2V23:
ADC->INPUTCTRL.bit.GAIN = ADC_INPUTCTRL_GAIN_1X_Val; // Gain Factor Selection
ADC->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_INTVCC0_Val; // 1/1.48 VDDANA = 1/1.48* 3V3 = 2.2297
@ -232,8 +280,8 @@ uint32_t analogRead(uint32_t pin)
#ifdef DAC
#if defined(__SAMD51__)
if (pin == A0 || pin == A1) { // Disable DAC, if analogWrite(A0,dval) used previously the DAC is enabled
uint8_t channel = (pin == PIN_A0 ? 0 : 1);
if (pin == PIN_DAC0 || pin == PIN_DAC1) { // Disable DAC, if analogWrite(A0,dval) used previously the DAC is enabled
uint8_t channel = (pin == PIN_DAC0 ? 0 : 1);
if(dacEnabled[channel]){
dacEnabled[channel] = false;
@ -250,7 +298,7 @@ uint32_t analogRead(uint32_t pin)
while (DAC->SYNCBUSY.bit.ENABLE);
#else
if (pin == A0) { // Disable DAC, if analogWrite(A0,dval) used previously the DAC is enabled
if (pin == PIN_DAC0) { // Disable DAC, if analogWrite(A0,dval) used previously the DAC is enabled
syncDAC();
DAC->CTRLA.bit.ENABLE = 0x00; // Disable DAC
@ -327,6 +375,9 @@ uint32_t analogRead(uint32_t pin)
syncADC();
ADC->SWTRIG.bit.START = 1;
// Waiting for the 1st conversion to complete
while (ADC->INTFLAG.bit.RESRDY == 0);
// Clear the Data Ready flag
ADC->INTFLAG.reg = ADC_INTFLAG_RESRDY;
@ -358,21 +409,21 @@ void analogWrite(uint32_t pin, uint32_t value)
// ATSAMR, for example, doesn't have a DAC
#ifdef DAC
if ((attr & PIN_ATTR_ANALOG) == PIN_ATTR_ANALOG)
{
// DAC handling code
#if defined(__SAMD51__)
if (pin == PIN_A0 || pin == PIN_A1) { // 2 DACs on A0 (PA02) and A1 (PA05)
if (pin == PIN_DAC0 || pin == PIN_DAC1) { // 2 DACs on A0 (PA02) and A1 (PA05)
#else
if (pin == PIN_A0) { // Only 1 DAC on A0 (PA02)
if (pin == PIN_DAC0) { // Only 1 DAC on A0 (PA02)
#endif
value = mapResolution(value, _writeResolution, _dacResolution);
#if defined(__SAMD51__)
uint8_t channel = (pin == PIN_A0 ? 0 : 1);
value = mapResolution(value, _writeResolution, _dacResolution);
uint8_t channel = (pin == PIN_DAC0 ? 0 : 1);
pinPeripheral(pin, PIO_ANALOG);
@ -557,7 +608,6 @@ void analogWrite(uint32_t pin, uint32_t value)
if (!tcEnabled[tcNum]) {
tcEnabled[tcNum] = true;
value = mapResolution(value, _writeResolution, 16);
uint16_t GCLK_CLKCTRL_IDs[] = {
GCLK_CLKCTRL_ID(GCM_TCC0_TCC1), // TCC0
GCLK_CLKCTRL_ID(GCM_TCC0_TCC1), // TCC1

View file

@ -27,14 +27,21 @@ extern "C" {
/*
* \brief SAMD products have only one reference for ADC
*/
// add internal voltages for ATSAMD51 SUPC VREF register
typedef enum _eAnalogReference
{
AR_DEFAULT,
AR_INTERNAL,
AR_EXTERNAL,
AR_INTERNAL1V0,
AR_INTERNAL1V1,
AR_INTERNAL1V2,
AR_INTERNAL1V25,
AR_INTERNAL2V0,
AR_INTERNAL2V2,
AR_INTERNAL2V23,
AR_INTERNAL2V4,
AR_INTERNAL2V5,
AR_INTERNAL1V65,
AR_INTERNAL2V23
AR_EXTERNAL
} eAnalogReference ;

View file

@ -30,44 +30,48 @@ void pinMode( uint32_t ulPin, uint32_t ulMode )
return ;
}
EPortType port = g_APinDescription[ulPin].ulPort;
uint32_t pin = g_APinDescription[ulPin].ulPin;
uint32_t pinMask = (1ul << pin);
// Set pin mode according to chapter '22.6.3 I/O Pin Configuration'
switch ( ulMode )
{
case INPUT:
// Set pin to input mode
PORT->Group[g_APinDescription[ulPin].ulPort].PINCFG[g_APinDescription[ulPin].ulPin].reg=(uint8_t)(PORT_PINCFG_INEN) ;
PORT->Group[g_APinDescription[ulPin].ulPort].DIRCLR.reg = (uint32_t)(1<<g_APinDescription[ulPin].ulPin) ;
break ;
PORT->Group[port].PINCFG[pin].reg = (uint8_t) (PORT_PINCFG_INEN);
PORT->Group[port].DIRCLR.reg = pinMask;
break;
case INPUT_PULLUP:
// Set pin to input mode with pull-up resistor enabled
PORT->Group[g_APinDescription[ulPin].ulPort].PINCFG[g_APinDescription[ulPin].ulPin].reg=(uint8_t)(PORT_PINCFG_INEN|PORT_PINCFG_PULLEN) ;
PORT->Group[g_APinDescription[ulPin].ulPort].DIRCLR.reg = (uint32_t)(1<<g_APinDescription[ulPin].ulPin) ;
PORT->Group[port].PINCFG[pin].reg = (uint8_t) (PORT_PINCFG_INEN | PORT_PINCFG_PULLEN);
PORT->Group[port].DIRCLR.reg = pinMask;
// Enable pull level (cf '22.6.3.2 Input Configuration' and '22.8.7 Data Output Value Set')
PORT->Group[g_APinDescription[ulPin].ulPort].OUTSET.reg = (uint32_t)(1<<g_APinDescription[ulPin].ulPin) ;
break ;
PORT->Group[port].OUTSET.reg = pinMask;
break;
case INPUT_PULLDOWN:
// Set pin to input mode with pull-down resistor enabled
PORT->Group[g_APinDescription[ulPin].ulPort].PINCFG[g_APinDescription[ulPin].ulPin].reg=(uint8_t)(PORT_PINCFG_INEN|PORT_PINCFG_PULLEN) ;
PORT->Group[g_APinDescription[ulPin].ulPort].DIRCLR.reg = (uint32_t)(1<<g_APinDescription[ulPin].ulPin) ;
PORT->Group[port].PINCFG[pin].reg = (uint8_t) (PORT_PINCFG_INEN | PORT_PINCFG_PULLEN);
PORT->Group[port].DIRCLR.reg = pinMask;
// Enable pull level (cf '22.6.3.2 Input Configuration' and '22.8.6 Data Output Value Clear')
PORT->Group[g_APinDescription[ulPin].ulPort].OUTCLR.reg = (uint32_t)(1<<g_APinDescription[ulPin].ulPin) ;
break ;
PORT->Group[port].OUTCLR.reg = pinMask;
break;
case OUTPUT:
// enable input, to support reading back values, with pullups disabled
PORT->Group[g_APinDescription[ulPin].ulPort].PINCFG[g_APinDescription[ulPin].ulPin].reg=(uint8_t)(PORT_PINCFG_INEN) ;
PORT->Group[port].PINCFG[pin].reg = (uint8_t) (PORT_PINCFG_INEN | PORT_PINCFG_DRVSTR);
// Set pin to output mode
PORT->Group[g_APinDescription[ulPin].ulPort].DIRSET.reg = (uint32_t)(1<<g_APinDescription[ulPin].ulPin) ;
break ;
PORT->Group[port].DIRSET.reg = pinMask;
break;
default:
// do nothing
break ;
break;
}
}

View file

@ -25,6 +25,8 @@
#include "WVariant.h"
typedef int PinStatus;
/**
* \brief Configures the specified pin to behave either as an input or an output. See the description of digital pins for details.
*

View file

@ -46,6 +46,14 @@ StartType=3
ErrorControl=1
ServiceBinary=%12%\%DRIVERFILENAME%.sys
[NullInstall.nt]
; nothing to do for a null driver
[NullInstall.nt.Services]
; null driver has no service and no service name
AddService=, 0x00000002
;------------------------------------------------------------------------------
; Vista-64bit Sections
;------------------------------------------------------------------------------
@ -73,6 +81,13 @@ StartType=3
ErrorControl=1
ServiceBinary=%12%\%DRIVERFILENAME%.sys
[NullInstall.NTamd64]
; nothing to do for a null driver
[NullInstall.NTamd64.Services]
; null driver has no service and no service name
AddService=, 0x00000002
;------------------------------------------------------------------------------
; Vendor and Product ID Definitions
@ -87,14 +102,14 @@ ServiceBinary=%12%\%DRIVERFILENAME%.sys
[SourceDisksNames]
[DeviceList]
"%DESCRIPTION% UF2 Bootloader (0018:00) BSP"=DriverInstall, USB\VID_239A&PID_0018&MI_00
"%DESCRIPTION% UF2 WebUSB dummy (0018:04) BSP"=DriverInstall, USB\VID_239A&PID_0018&MI_00
"%DESCRIPTION% UF2 WebUSB dummy (0018:04) BSP"=NullInstall, USB\VID_239A&PID_0018&MI_04
"%DESCRIPTION% (0019:00) BSP"=DriverInstall, USB\VID_239A&PID_0019&MI_00
"%DESCRIPTION% Arduino (8018:00) BSP"=DriverInstall, USB\VID_239A&PID_8018&MI_00
"%DESCRIPTION% CircuitPython (8019:00) BSP"=DriverInstall, USB\VID_239A&PID_8019&MI_00
[DeviceList.NTamd64]
"%DESCRIPTION% UF2 Bootloader (0018:00) BSP"=DriverInstall, USB\VID_239A&PID_0018&MI_00
"%DESCRIPTION% UF2 WebUSB dummy (0018:04) BSP"=DriverInstall, USB\VID_239A&PID_0018&MI_00
"%DESCRIPTION% UF2 WebUSB dummy (0018:04) BSP"=NullInstall, USB\VID_239A&PID_0018&MI_04
"%DESCRIPTION% (0019:00) BSP"=DriverInstall, USB\VID_239A&PID_0019&MI_00
"%DESCRIPTION% Arduino (8018:00) BSP"=DriverInstall, USB\VID_239A&PID_8018&MI_00
"%DESCRIPTION% CircuitPython (8019:00) BSP"=DriverInstall, USB\VID_239A&PID_8019&MI_00

View file

@ -1,2 +1,3 @@
SerialGSM KEYWORD1
SerialSARA KEYWORD1
INPUT_PULLDOWN LITERAL1 Constants RESERVED_WORD_2

@ -0,0 +1 @@
Subproject commit c953968c468218d8968138b5ed8482fa565373df

@ -0,0 +1 @@
Subproject commit acc5dadb458b2c329757a61dc4f18dda945a0c36

View file

@ -0,0 +1 @@
// fake empty header file to make Arduino IDE happy

View file

@ -0,0 +1,12 @@
#include <arm_math.h>
arm_rfft_fast_instance_f32 plan;
void setup() {
arm_rfft_fast_init_f32(&plan, 256);
}
void loop() {
float in[256] = { 0 }, out[256] = { 0 };
arm_rfft_fast_f32(&plan, in, out, 0);
}

View file

@ -37,6 +37,12 @@ static I2SDevice_SAMD21G18x i2sd(*I2S);
#include "I2S.h"
#ifdef USE_TINYUSB
// For Serial when selecting TinyUSB
#include <Adafruit_TinyUSB.h>
#endif
int I2SClass::_beginCount = 0;
I2SClass::I2SClass(uint8_t deviceIndex, uint8_t clockGenerator, uint8_t sdPin, uint8_t sckPin, uint8_t fsPin) :

View file

@ -19,6 +19,11 @@
#include "SAMD_AnalogCorrection.h"
#ifdef USE_TINYUSB
// For Serial when selecting TinyUSB
#include <Adafruit_TinyUSB.h>
#endif
void analogReadCorrection (int offset, uint16_t gain)
{
Adc *adc;

View file

@ -28,4 +28,5 @@ buildSDUBootSketch "arduino:samd:mkrfox1200" "$OUTPUT_PATH/mkrfox1200.h"
buildSDUBootSketch "arduino:samd:mkrgsm1400" "$OUTPUT_PATH/mkrgsm1400.h"
buildSDUBootSketch "arduino:samd:mkrwan1300" "$OUTPUT_PATH/mkrwan1300.h"
buildSDUBootSketch "arduino:samd:mkrwifi1010" "$OUTPUT_PATH/mkrwifi1010.h"
buildSDUBootSketch "arduino:samd:mkrnb1500" "$OUTPUT_PATH/mkrnb1500.h"
buildSDUBootSketch "arduino:samd:mzero_bl" "$OUTPUT_PATH/mzero.h"

View file

@ -36,6 +36,8 @@ unsigned char sduBoot[0x4000] = {
#include "boot/mkrwan1300.h"
#elif defined(ARDUINO_SAMD_MKRWIFI1010)
#include "boot/mkrwifi1010.h"
#elif defined(ARDUINO_SAMD_MKRNB1500)
#include "boot/mkrnb1500.h"
#elif defined(ARDUINO_SAM_ZERO)
#include "boot/mzero.h"
#else

File diff suppressed because it is too large Load diff

View file

@ -22,6 +22,11 @@
#include <wiring_private.h>
#include <assert.h>
#ifdef USE_TINYUSB
// For Serial when selecting TinyUSB
#include <Adafruit_TinyUSB.h>
#endif
#define SPI_IMODE_NONE 0
#define SPI_IMODE_EXTINT 1
#define SPI_IMODE_GLOBAL 2
@ -46,7 +51,16 @@ SPIClass::SPIClass(SERCOM *p_sercom, uint8_t uc_pinMISO, uint8_t uc_pinSCK, uint
void SPIClass::begin()
{
init();
if(!initialized) {
interruptMode = SPI_IMODE_NONE;
interruptSave = 0;
interruptMask = 0;
initialized = true;
}
if(!use_dma) {
dmaAllocate();
}
// PIO init
pinPeripheral(_uc_pinMiso, g_APinDescription[_uc_pinMiso].ulPinType);
@ -56,16 +70,6 @@ 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();
@ -80,6 +84,7 @@ void SPIClass::end()
{
_p_sercom->resetSPI();
initialized = false;
// Add DMA deallocation here
}
#ifndef interruptsStatus
@ -198,7 +203,7 @@ void SPIClass::setDataMode(uint8_t mode)
void SPIClass::setClockDivider(uint8_t div)
{
if (div < SPI_MIN_CLOCK_DIVIDER) {
if(div < SPI_MIN_CLOCK_DIVIDER) {
_p_sercom->setBaudrateSPI(SPI_MIN_CLOCK_DIVIDER);
} else {
_p_sercom->setBaudrateSPI(div);
@ -235,6 +240,239 @@ 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.
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.
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)
// cast to void* to suppress warning: with no trivial copy-assignment [-Wclass-memaccess]
for(int i=0; i<numReadDescriptors; i++) {
memcpy((void*) &extraReadDescriptors[i], firstReadDescriptor,
sizeof(DmacDescriptor));
}
for(int i=0; i<numWriteDescriptors; i++) {
memcpy((void*) &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,
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++);
}
} else { // Write only
while(count--) {
(void)_p_sercom->transferDataSPI(*txbuf8++);
}
}
} else { // Read only
while(count--) {
*rxbuf8++ = _p_sercom->transferDataSPI(0xFF);
}
}
} // end non-DMA
}
// Waits for a prior in-background DMA transfer to complete.
void SPIClass::waitForTransfer(void) {
while(dma_busy);
}
/* returns the current DMA transfer status to allow non-blocking polling */
bool SPIClass::isBusy(void) {
return dma_busy;
}
// End DMA-based SPI transfer() code ---------------------------------------
void SPIClass::attachInterrupt() {
// Should be enableInterrupt()
}
@ -243,6 +481,61 @@ void SPIClass::detachInterrupt() {
// Should be disableInterrupt()
}
// SPI DMA lookup works on both SAMD21 and SAMD51
static const struct {
volatile uint32_t *data_reg;
int dmac_id_tx;
int dmac_id_rx;
} sercomData[] = {
{ &SERCOM0->SPI.DATA.reg, SERCOM0_DMAC_ID_TX, SERCOM0_DMAC_ID_RX },
{ &SERCOM1->SPI.DATA.reg, SERCOM1_DMAC_ID_TX, SERCOM1_DMAC_ID_RX },
{ &SERCOM2->SPI.DATA.reg, SERCOM2_DMAC_ID_TX, SERCOM2_DMAC_ID_RX },
{ &SERCOM3->SPI.DATA.reg, SERCOM3_DMAC_ID_TX, SERCOM3_DMAC_ID_RX },
#if defined(SERCOM4)
{ &SERCOM4->SPI.DATA.reg, SERCOM4_DMAC_ID_TX, SERCOM4_DMAC_ID_RX },
#endif
#if defined(SERCOM5)
{ &SERCOM5->SPI.DATA.reg, SERCOM5_DMAC_ID_TX, SERCOM5_DMAC_ID_RX },
#endif
#if defined(SERCOM6)
{ &SERCOM6->SPI.DATA.reg, SERCOM6_DMAC_ID_TX, SERCOM6_DMAC_ID_RX },
#endif
#if defined(SERCOM7)
{ &SERCOM7->SPI.DATA.reg, SERCOM7_DMAC_ID_TX, SERCOM7_DMAC_ID_RX },
#endif
};
volatile uint32_t *SPIClass::getDataRegister(void) {
int8_t idx = _p_sercom->getSercomIndex();
return (idx >= 0) ? sercomData[idx].data_reg: NULL;
}
int SPIClass::getDMAC_ID_TX(void) {
int8_t idx = _p_sercom->getSercomIndex();
return (idx >= 0) ? sercomData[idx].dmac_id_tx : -1;
}
int SPIClass::getDMAC_ID_RX(void) {
int8_t idx = _p_sercom->getSercomIndex();
return (idx >= 0) ? sercomData[idx].dmac_id_rx : -1;
}
#if defined(__SAMD51__)
// Set the SPI device's SERCOM clock CORE and SLOW clock sources.
// SercomClockSource values are an enumeration in SERCOM.h.
// This works on SAMD51 only. On SAMD21, a dummy function is declared
// in SPI.h which compiles to nothing, so user code doesn't need to check
// and conditionally compile lines for different architectures.
void SPIClass::setClockSource(SercomClockSource clk) {
int8_t idx = _p_sercom->getSercomIndex();
_p_sercom->setClockSource(idx, clk, true); // true = set core clock
_p_sercom->setClockSource(idx, clk, false); // false = set slow clock
}
#endif // end __SAMD51__
#if SPI_INTERFACES_COUNT > 0
/* In case new variant doesn't define these macros,
* we put here the ones for Arduino Zero.
@ -275,4 +568,3 @@ void SPIClass::detachInterrupt() {
#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

View file

@ -21,6 +21,7 @@
#define _SPI_H_INCLUDED
#include <Arduino.h>
#include <Adafruit_ZeroDMA.h>
// SPI_HAS_TRANSACTION means SPI has
// - beginTransaction()
@ -37,12 +38,27 @@
#define SPI_MODE2 0x03
#define SPI_MODE3 0x01
#if defined(ARDUINO_ARCH_SAMD)
#if defined(__SAMD51__)
// SAMD51 has configurable MAX_SPI, else use peripheral clock default.
// Update: changing MAX_SPI via compiler flags is DEPRECATED, because
// this affects ALL SPI peripherals including some that should NOT be
// changed (e.g. anything using SD card). Use the setClockSource()
// function instead. This is left here for compatibility with interim code.
#if !defined(MAX_SPI)
#define MAX_SPI 24000000
#endif
#define SPI_MIN_CLOCK_DIVIDER 1
#else
// The datasheet specifies a typical SPI SCK period (tSCK) of 42 ns,
// see "Table 36-48. SPI Timing Characteristics and Requirements",
// which translates into a maximum SPI clock of 23.8 MHz.
// Conservatively, the divider is set for a 12 MHz maximum SPI clock.
#define SPI_MIN_CLOCK_DIVIDER (uint8_t)(1 + ((F_CPU - 1) / 12000000))
// We'll permit use of 24 MHz SPI even though this is slightly out
// of spec. Given how clock dividers work, the next "sensible"
// threshold would be a substantial drop down to 12 MHz.
#if !defined(MAX_SPI)
#define MAX_SPI 24000000
#endif
#define SPI_MIN_CLOCK_DIVIDER (uint8_t)(1 + ((F_CPU - 1) / MAX_SPI))
#endif
class SPISettings {
@ -64,7 +80,11 @@ class SPISettings {
}
void init_AlwaysInline(uint32_t clock, BitOrder bitOrder, uint8_t dataMode) __attribute__((__always_inline__)) {
this->clockFreq = (clock >= (F_CPU / SPI_MIN_CLOCK_DIVIDER) ? F_CPU / SPI_MIN_CLOCK_DIVIDER : clock);
#if defined(__SAMD51__)
this->clockFreq = clock; // Clipping handled in SERCOM.cpp
#else
this->clockFreq = clock >= MAX_SPI ? MAX_SPI : clock;
#endif
this->bitOrder = (bitOrder == MSBFIRST ? MSB_FIRST : LSB_FIRST);
@ -94,10 +114,13 @@ class SPIClass {
public:
SPIClass(SERCOM *p_sercom, uint8_t uc_pinMISO, uint8_t uc_pinSCK, uint8_t uc_pinMOSI, SercomSpiTXPad, SercomRXPad);
byte transfer(uint8_t data);
uint16_t transfer16(uint16_t data);
void transfer(void *buf, size_t count);
void transfer(const void* txbuf, void* rxbuf, size_t count,
bool block = true);
void waitForTransfer(void);
bool isBusy(void);
// Transaction Functions
void usingInterrupt(int interruptNumber);
@ -116,8 +139,21 @@ class SPIClass {
void setDataMode(uint8_t uc_mode);
void setClockDivider(uint8_t uc_div);
// SERCOM lookup functions are available on both SAMD51 and 21.
volatile uint32_t *getDataRegister(void);
int getDMAC_ID_TX(void);
int getDMAC_ID_RX(void);
uint8_t getSercomIndex(void) { return _p_sercom->getSercomIndex(); };
#if defined(__SAMD51__)
// SERCOM clock source override is available only on SAMD51.
void setClockSource(SercomClockSource clk);
#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; };
#endif // end __SAMD51__
private:
void init();
void config(SPISettings settings);
SERCOM *_p_sercom;
@ -132,6 +168,18 @@ class SPIClass {
uint8_t interruptMode;
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);
static void dmaCallback(Adafruit_ZeroDMA *dma);
};
#if SPI_INTERFACES_COUNT > 0
@ -155,14 +203,12 @@ class SPIClass {
// For compatibility with sketches designed for AVR @ 16 MHz
// New programs should use SPI.beginTransaction to set the SPI clock
#if F_CPU == 48000000
#define SPI_CLOCK_DIV2 6
#define SPI_CLOCK_DIV4 12
#define SPI_CLOCK_DIV8 24
#define SPI_CLOCK_DIV16 48
#define SPI_CLOCK_DIV32 96
#define SPI_CLOCK_DIV64 192
#define SPI_CLOCK_DIV128 255
#endif
#define SPI_CLOCK_DIV2 (MAX_SPI * 2 / 8000000)
#define SPI_CLOCK_DIV4 (MAX_SPI * 2 / 4000000)
#define SPI_CLOCK_DIV8 (MAX_SPI * 2 / 2000000)
#define SPI_CLOCK_DIV16 (MAX_SPI * 2 / 1000000)
#define SPI_CLOCK_DIV32 (MAX_SPI * 2 / 500000)
#define SPI_CLOCK_DIV64 (MAX_SPI * 2 / 250000)
#define SPI_CLOCK_DIV128 (MAX_SPI * 2 / 125000)
#endif

Some files were not shown because too many files have changed in this diff Show more