aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/machine/machine_atmega2560.go
diff options
context:
space:
mode:
authorWeston Schmidt <[email protected]>2021-02-09 14:28:28 -0800
committerRon Evans <[email protected]>2021-02-10 12:56:48 +0100
commitf4b4dd8d62eb89922525d2a9ab35843aa0ad3062 (patch)
tree361c040946198b28c11c4c2cc2b8dae8cb722299 /src/machine/machine_atmega2560.go
parent9f5bd2c460cfcf5dca40fe043d8a51a25f1a79b3 (diff)
downloadtinygo-f4b4dd8d62eb89922525d2a9ab35843aa0ad3062.tar.gz
tinygo-f4b4dd8d62eb89922525d2a9ab35843aa0ad3062.zip
Add SPI support for Atmega based chips.
This is based on @Nerzal's #1398 PR, but is a bit of a refactor and expansion to support all the Atmega based chips present in tinygo.
Diffstat (limited to 'src/machine/machine_atmega2560.go')
-rw-r--r--src/machine/machine_atmega2560.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/machine/machine_atmega2560.go b/src/machine/machine_atmega2560.go
index f14731aa5..d50f9081d 100644
--- a/src/machine/machine_atmega2560.go
+++ b/src/machine/machine_atmega2560.go
@@ -126,3 +126,13 @@ func (p Pin) getPortMask() (*volatile.Register8, uint8) {
return avr.PORTA, 255
}
}
+
+// SPI configuration
+var SPI0 = SPI{
+ spcr: avr.SPCR,
+ spdr: avr.SPDR,
+ spsr: avr.SPSR,
+ sck: PB1,
+ sdo: PB2,
+ sdi: PB3,
+ cs: PB0}