mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-10 22:13:39 +00:00
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:
committed by
Ron Evans
parent
6c5409bd17
commit
d6cdf8ca28
@@ -220,7 +220,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
|
||||
@@ -254,6 +254,8 @@ func (i2c I2C) Configure(config I2CConfig) {
|
||||
|
||||
i2c.Bus.ENABLE.Set(nrf.TWI_ENABLE_ENABLE_Enabled)
|
||||
i2c.setPins(config.SCL, config.SDA)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Tx does a single I2C transaction at the specified address.
|
||||
|
||||
Reference in New Issue
Block a user