Граф коммитов

49 коммитов

Автор SHA1 Сообщение Дата
Ayke van Laethem
90b42799a2 machine: make machine.I2C0 and similar objects pointers
This makes it possible to assign I2C objects (machine.I2C0,
machine.I2C1, etc.) without needing to take a pointer.

This is important especially in the future when I2C may be driven using
DMA and the machine.I2C type needs to store some state.
2021-03-29 02:02:04 +02:00
sago35
0cabd4de69 atsamd5x: improve SPI 2021-03-14 15:40:53 +01:00
sago35
1aac8a0cb1 atsamd5x: avoid infinite loop when USBCDC is disconnected 2021-02-19 17:20:15 +01:00
sago35
01b917fb11 atsamd5x: improve USBCDC 2021-02-16 12:48:52 +01:00
ardnew
7842e6940d Fix typo in ADC switch on config field Samples 2021-02-01 12:25:18 +01:00
ardnew
06f231468d
accept configuration struct for ADC parameters (#1533) 2021-01-31 14:54:27 -06:00
sago35
2540172cc5
atsam: add a length check to findPinPadMapping 2020-12-02 01:21:38 +01:00
Ayke van Laethem
7c4e83f5c0 machine: clarify caller's responsibility in SetInterrupt 2020-11-08 15:11:50 +01:00
jypelle
db27541b1a Fix #1483 2020-11-08 09:32:13 +01:00
sago35
8170f59440 atsamd5x: fix BAUD value 2020-09-17 09:46:15 +02:00
deadprogram
58565fa46d machine/atsamd51x,runtime/atsamd51x: fixes needed for full support for all PWM pins. Also adds some useful constants to clarify peripheral clock usage
Signed-off-by: deadprogram <ron@hybridgroup.com>
2020-08-30 09:27:17 +02:00
deadprogram
d1c4ed664e all: changeover to eliminate all direct use of master/slave terminology
Signed-off-by: deadprogram <ron@hybridgroup.com>
2020-07-23 22:45:23 +02:00
Ethan Reesor
ca1a282495 Use runtime/volatile.T.ReplaceBits 2020-07-14 06:08:08 +02:00
sago35
1a6bed3305
machine/samd51: add DAC support (#1198)
* machine/samd51: add DAC support
2020-07-06 14:02:51 +02:00
sago35
0c880ec44c
Standardize SAMD51 UART settings (#1155)
* machine/samd51: standardize samd51 uart settings
2020-06-05 08:14:31 +02:00
sago35
64d51b215f Extend SAMD51 pinPadMapping 2020-06-03 19:37:16 +02:00
sago35
f103e910d7 Add SAMD51 pin change interrupt settings 2020-06-03 19:37:16 +02:00
sago35
40afeea569 Add SAMD51 ADC settings 2020-06-03 19:37:16 +02:00
sago35
97122972fb Add SAMD51 pins 2020-06-03 19:37:16 +02:00
sago35
b92fad8da6
sam: fix register access for interrupts pins in samd51 (#1141)
* machine/samd51: fix register access for interrupts pins in samd51
2020-05-30 18:03:46 +02:00
sago35
5c8d4e54d6 sam: add support for pin change interrupts (samd5x) 2020-05-29 11:36:22 +02:00
Ayke van Laethem
38fc340802 sam: return an error when an incorrect PWM pin is used
Previously it would trigger a nil pointer panic.
2020-05-13 19:19:45 +02:00
Ayke van Laethem
012c4a02c9 machine: switch to modern interrupt registration method
This saves about 112 bytes in flash and 288 bytes in RAM when the UART
is not used.
2020-04-07 17:53:52 +02:00
Ayke van Laethem
b8f5627c9f machine: move errors.New calls to globals
Calling errors.New in an error path causes a heap allocation at an
already unfortunate moment. It is more efficient to create these error
values in globals and return these constant globals. If these errors are
not used (because the related code was optimized out), the globals will
also be optimized out.
2020-04-07 13:24:26 +02:00
Ron Evans
5d539df216 machine/atsamd21,atsamd51: clear the USB packet size before setting it again when sending
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2020-04-02 11:09:24 -04:00
Ron Evans
03fa9dd9b7 machine/atsamd21,atsamd51,nrf52840: refactor USB CDC device descriptor to reduce code duplication and heap allocations
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2020-03-29 17:54:58 +02:00
Ron Evans
06797b6d1a machine/atsamd21,atsamd51,nrf52840: correct USB CDC composite descriptors
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2020-03-29 17:54:58 +02:00
Ayke van Laethem
c01f81144e machine: avoid binary size regression after LLVM memory intrinsics
Somehow moving to LLVM memory intrinsics for calls like memcpy made the
machine.sendUSBPacket get inlined. This is a problem because it is
called in many different functions and it is just big enough to cause a
significant file size increase.

Adding //go:noinline solves this problem and gets the examples/blinky1
program below the file size it was before this change (tested:
itsybitsy-m0, itsybitsy-m4, circuitplay-bluefruit).
2020-03-27 21:00:54 +01:00
Ron Evans
c03e3616a2 machine/atsamd21 and atsamd51: corrections needed to return valid UCB CDC device and string descriptors
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2020-03-18 12:08:15 +01:00
Daniel Esteban
3aaa029c70 added support for ADC1 on atsamd51 (PB04 / PB05 / PB06 / PB07) 2020-03-01 21:27:59 +01:00
BCG
2138fd7854
machine/samd51: Moving QSPI definitions to common file
The QSPI peripheral is only available on a fixed set of pins, so these can be added as constants for all atsamd51 boards.
2020-02-05 17:45:33 +01:00
Ayke van Laethem
c61657d22d machine: refactor pin handling to auto-detect pin mode
With this change, it's no longer necessary to set a specific pin mode:
it will get autodetected in the Configure() call.

Tested on an ItsyBitsy M4 with the mpu6050 example in the drivers repo.
2020-01-23 00:08:34 +01:00
Ayke van Laethem
e17a2e6776 machine/atsamd51: use only the necessary UART interrupts
A small footnote in the datasheet says that interrupt source numbers
correspond to the bit position in INTFLAG. We only need the RXC
interrupt for UART. In other words, ony the _2 interrupts (RXC is in the
2nd bit position) needs to be used for UART to work correctly.

In the future, more interrupts may be needed. They can then be added as
necessary.
2020-01-20 21:33:53 +01:00
Ayke van Laethem
bdfa4d28cf machine/atsamd51: fix obvious bug in I2C code
I2C uses a hardcoded peripheral instead of referring to a specific
peripheral. In addition to that, it refers to the wrong SERCOM
(SERCOM3), which isn't used on any of the atsamd51 boards for I2C.
2020-01-20 21:33:53 +01:00
Ayke van Laethem
3745fb1c40 machine/atsamd51: switch UART to use new pin configuration
This makes UART configuration much more flexible.

I confirmed that UART1 and UART2 still work with this change on the
ItsyBitsy M4.
2020-01-20 21:33:53 +01:00
Ayke van Laethem
a5ed993f8d all: add compiler support for interrupts
This commit lets the compiler know about interrupts and allows
optimizations to be performed based on that: interrupts are eliminated
when they appear to be unused in a program. This is done with a new
pseudo-call (runtime/interrupt.New) that is treated specially by the
compiler.
2020-01-20 21:19:12 +01:00
Ayke van Laethem
31d3ac725f machine/atsamd51: refactor SPI pin configuration to only look at pin numbers
This commit does the same thing as
https://github.com/tinygo-org/tinygo/pull/597 but for samd51 series
chips. Pin mode and pad numbers are automatically calculated from pin
numbers, returning an error if no valid pinout is possible.
2020-01-11 20:57:10 +01:00
BCG
ecff6f8e0c Adafruit PyPortal Support (#800)
* machine/PyPortal: implementation, also includes refinements for other members of samd51x familty.
2020-01-06 11:53:43 +01:00
BCG
5f77447e1a Adding code use 12-bit resolution for ADC and to clear previous ADC INPUTCTRL before subsequent read 2020-01-05 12:34:47 +01:00
Ayke van Laethem
768c652468 machine: rename CPU_FREQUENCY -> CPUFrequency()
These all-caps constants aren't in the Go style, so rename it to
CPUFrequency (which is more aligned with Go style). Additionally, make
it a function so that it is possible to add support for changing the
frequency in the future.

Tested by running `make smoketest`. None of the outputs did change.
2019-12-16 20:34:39 +01:00
BCG
ea5df0f214 Fixes for UART2 on Metro M4 Airlift Lite (#739)
* machine/samd51: Fixes for UART2
2019-11-21 21:45:13 +01:00
BCG
009b27350e Adding Support for Adafruit Metro M4 Express Airlift (#694)
* machine/metro-m4: add support for Adafruit Metro M4 Express Airlift board
2019-11-15 09:52:54 +01:00
Ron Evans
41df9648a8 machine/samd51: correct channel init and pin map for ADC based on ItsyBitsy-M4
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-11-01 10:07:07 +01:00
Ron Evans
3777791aa3 machine/samd51: allow setting pinmode for each of the SPI pins
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-10-31 12:47:48 +01:00
Infinoid
f7dde33842 machine/atsamd51: pin method cleanup (#659)
* machine/samd51: pin method cleanups.
- Use bit-math to select the group in Pin methods.
- Move Pin methods to atsamd51. They are not chip-specific, they apply to the whole atsamd51 family.
- Move the group/pin-id calculation into a helper method.
- Add a Pin.Toggle() method.
2019-10-27 21:37:52 +01:00
Ron Evans
92e07ec8af machine/samd51: update to accomodate differences in updated SVD files for from main CMSIS-SVD repo
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-10-09 18:53:32 +02:00
Jaden Weiss
8fe126b1f6 raise timeouts on USB on atsamd and fix slice sizing 2019-10-06 13:25:55 +02:00
Ron Evans
c16e07469b machine/samd21,samd51: remove use of binary package to avoid reflection and reduce binary size
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-09-24 19:41:34 +02:00
Ron Evans
02c4020228 machine/atsamd51: add support for ATSAMD51 processor using Adafruit ItsyBitsy-M4 board
Signed-off-by: Ron Evans <ron@hybridgroup.com>
2019-09-14 17:56:14 +02:00