From 71bbe93ab2e482239fbab790a83c528bc077d74e Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Sat, 6 Feb 2021 12:32:13 +0100 Subject: [PATCH] avr: remove I2C stubs from attiny support These stubs don't really belong there: attiny currently doesn't directly support I2C at all (although it has hardware to support a software implementation). --- src/machine/i2c.go | 2 +- src/machine/machine_atmega.go | 7 +++++++ src/machine/machine_attiny.go | 9 --------- src/machine/machine_avr.go | 7 ------- 4 files changed, 8 insertions(+), 17 deletions(-) delete mode 100644 src/machine/machine_attiny.go diff --git a/src/machine/i2c.go b/src/machine/i2c.go index 25cf54c3..4a19000d 100644 --- a/src/machine/i2c.go +++ b/src/machine/i2c.go @@ -1,4 +1,4 @@ -// +build avr nrf sam stm32,!stm32l0 fe310 k210 +// +build atmega nrf sam stm32,!stm32l0 fe310 k210 package machine diff --git a/src/machine/machine_atmega.go b/src/machine/machine_atmega.go index 7bfdb9ca..d1e0c3ae 100644 --- a/src/machine/machine_atmega.go +++ b/src/machine/machine_atmega.go @@ -9,6 +9,13 @@ import ( "unsafe" ) +// I2C on AVR. +type I2C struct { +} + +// I2C0 is the only I2C interface on most AVRs. +var I2C0 = I2C{} + // I2CConfig is used to store config info for I2C. type I2CConfig struct { Frequency uint32 diff --git a/src/machine/machine_attiny.go b/src/machine/machine_attiny.go deleted file mode 100644 index 402b4e31..00000000 --- a/src/machine/machine_attiny.go +++ /dev/null @@ -1,9 +0,0 @@ -// +build avr,attiny - -package machine - -// Tx is a dummy implementation. I2C has not been implemented for ATtiny -// devices. -func (i2c I2C) Tx(addr uint16, w, r []byte) error { - return nil -} diff --git a/src/machine/machine_avr.go b/src/machine/machine_avr.go index 68626bd1..5cf70cca 100644 --- a/src/machine/machine_avr.go +++ b/src/machine/machine_avr.go @@ -141,10 +141,3 @@ func (a ADC) Get() uint16 { return uint16(avr.ADCL.Get()) | uint16(avr.ADCH.Get())<<8 } - -// I2C on AVR. -type I2C struct { -} - -// I2C0 is the only I2C interface on most AVRs. -var I2C0 = I2C{}