machine: make I2C.Configure signature consistent

It's better to always return an error value (even if it is nil) for
consistency.
This commit is contained in:
Ayke van Laethem
2021-02-04 19:18:49 +01:00
committed by Ron Evans
parent 6c5409bd17
commit d6cdf8ca28
5 changed files with 14 additions and 5 deletions
+3 -1
View File
@@ -13,7 +13,7 @@ type I2CConfig struct {
}
// Configure is intended to setup the I2C interface.
func (i2c I2C) Configure(config I2CConfig) {
func (i2c I2C) Configure(config I2CConfig) error {
// Default I2C bus speed is 100 kHz.
if config.Frequency == 0 {
config.Frequency = TWI_FREQ_100KHZ
@@ -33,6 +33,8 @@ func (i2c I2C) Configure(config I2CConfig) {
// Enable twi module.
avr.TWCR.Set(avr.TWCR_TWEN)
return nil
}
// Tx does a single I2C transaction at the specified address.