Skip to content

Commit

Permalink
machine/i2c: return error when calling not yet implemented SetBaudRat…
Browse files Browse the repository at this point in the history
…e() function

Signed-off-by: deadprogram <[email protected]>
  • Loading branch information
deadprogram committed Oct 13, 2023
1 parent 756fe3b commit be73c66
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/machine/i2c.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ var (
errI2CBusError = errors.New("I2C bus error")
errI2COverflow = errors.New("I2C receive buffer overflow")
errI2COverread = errors.New("I2C transmit buffer overflow")
errI2CNotImplemented = errors.New("I2C operation not yet implemented")
)

// I2CTargetEvent reflects events on the I2C bus
Expand Down
2 changes: 1 addition & 1 deletion src/machine/machine_mimxrt1062_i2c.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func (i2c *I2C) Configure(config I2CConfig) {
// SetBaudRate sets the communication speed for I2C.
func (i2c I2C) SetBaudRate(br uint32) error {
// TODO: implement
return nil
return errI2CNotImplemented
}

func (i2c I2C) Tx(addr uint16, w, r []byte) error {
Expand Down
2 changes: 1 addition & 1 deletion src/machine/machine_stm32_i2c_reva.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func (i2c *I2C) Configure(config I2CConfig) error {
// SetBaudRate sets the communication speed for I2C.
func (i2c *I2C) SetBaudRate(br uint32) error {
// TODO: implement
return nil
return errI2CNotImplemented
}

func (i2c *I2C) Tx(addr uint16, w, r []byte) error {
Expand Down
2 changes: 1 addition & 1 deletion src/machine/machine_stm32_i2c_revb.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (i2c *I2C) Configure(config I2CConfig) error {
// SetBaudRate sets the communication speed for I2C.
func (i2c *I2C) SetBaudRate(br uint32) error {
// TODO: implement
return nil
return errI2CNotImplemented
}

func (i2c *I2C) Tx(addr uint16, w, r []byte) error {
Expand Down

0 comments on commit be73c66

Please sign in to comment.