periph icon indicating copy to clipboard operation
periph copied to clipboard

i2creg, onewirereg, spireg: augment Ref to include the pins

Open maruel opened this issue 7 years ago • 1 comments

The goal is to be able to present the pin used by each I²C/1-wire/SPI port/bus without having to open the port/bus, as this is currently the case.

To achieve this, the corresponding Ref needs to be augmented with the corresponding pin name or reference (to be determined). This in itself isn't so bad and could be not considered a breaking change.

The breaking change is that this information needs to be passed to the Register() function, otherwise the register function would have to open the port/bus itself, which would slow down registration and would potentially cause unintended side effects. So if the Register() function needs to be changed, this is a breaking change.

Ref:

  • https://periph.io/x/periph/conn/spi/spireg#Ref
  • https://periph.io/x/periph/conn/i2c/i2creg#Ref
  • https://periph.io/x/periph/conn/onewire/onewirereg#Ref

maruel avatar Jul 17 '18 13:07 maruel

In the meantime this can be implemented without API breaking by adding a new function RegisterWithPins()

maruel avatar Jul 19 '18 20:07 maruel

Ported to https://github.com/periph/conn/issues/31.

maruel avatar Sep 20 '23 17:09 maruel