Commit graph

643 commits

Author SHA1 Message Date
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
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
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
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
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
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
GMagician
15aaa2459c Revert "Remove unused method"
This reverts commit bc8148ba3a.
2019-08-08 07:02:16 +02: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
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
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
GMagician
f937db2251 Fix compile warnings 2019-07-26 18:44:13 +02: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
hathach
fa04386790 fix incorrect midi descriptor template 2019-07-09 10:38:04 +07:00
hathach
edc13ba71f add itfnum to getDescriptor() 2019-07-08 22:49:05 +07:00
hathach
11d6f547c3 midi only use audio 1.0 without IAD 2019-07-05 16:44:38 +07: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
T. Carl Beery
206a7acd99
Wiring: Clean up repeated pin description access 2019-07-03 08:24:06 -07: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
Giuliano Zaro
29bfe96f8e
Fix compiler error
Removed unnecessary bracket
missing usb padcal
2019-06-14 11:35:05 +02: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
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
hathach
f8ad400ff2 fix serial issue with windows 2019-05-27 18:50:15 +07:00
hathach
4e4e2846f9 fix load_serial_number() warning 2019-05-25 14:01:25 +07:00
hathach
3faad0375e fix tinyusb hid raw inout issue 2019-05-24 12:50:39 +07: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
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
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
Phillip Burgess
4b57e88b4b Fix typedef syntax 2019-05-10 21:26:30 -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
hathach
e770ae4301 error message when compile usb demo without selecting it 2019-05-03 13:14:59 +07:00
hathach
dda4eaf546 fix load serial string based on device id 2019-05-03 13:07:19 +07:00
hathach
c21b6014b6 add hid bufsize 2019-05-03 00:00:58 +07:00
hathach
96075f637e update tinyusb to support bi-directional HID 2019-05-02 21:01:36 +07:00
hathach
ab16f9899d add menu dropdown list for usb stack selection 2019-05-01 01:01:59 +07: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
e40e387213 Fix for https://github.com/cstawarz 2019-04-24 12:47:02 -04:00
ladyada
da400c7283 Merge branch 'pb-overclock' 2019-04-22 16:36:57 -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
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
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
ladyada
4f8619b918 re-add erase, change Tone TC to TC3 2019-04-10 08:31:22 -04:00
ladyada
79fc15cdc5 fix merge 2019-03-08 17:12:10 -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
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
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
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
Riccardo Rizzo
3b6466b5e6 More accurate delay() function from BenF.
porting of 67c0a1995a (diff-ab397febf179e1982f4ee0758df4c982)
2018-12-13 10:33:06 -05:00
dean
0c9bb3488b DM: fix pwm initialization bug 2018-11-29 15:40:31 -05:00
dean
c7fa463c0d DM: fix pwm? 2018-11-29 13:54:35 -05:00
Sandeep Mistry
9d83af3e05 Fix USB warnings 2018-11-27 09:39:36 -05: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
deanm1278
9828191030 add grand central m4 (#67)
* 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
2018-11-20 08:26: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
dean
4429b05805 DM: fix samd21 dac resolution 2018-11-12 12:19:29 -05:00
dean
0a24711890 DM: update PWM for trellis m4 and m0 boards 2018-11-08 14:34:51 -05:00
dean
ddba3e4e6e DM: pwm fixes for feather 2018-11-07 18:03:57 -05:00
dean
83c5e15af2 DM: PWM fixes 2018-11-07 17:09:22 -05:00
dean
902d525d3c DM: add ADC1 support for SAMD51 2018-11-05 13:58:32 -05:00
dean
bcfd9a0faa Merge branch 'master' of github.com:adafruit/ArduinoCore-samd 2018-11-05 13:18:13 -05:00