-
Notifications
You must be signed in to change notification settings - Fork 230
Description
In the case of the I2C interface, since no driver calls the I2C Configure() method, we did not have any troubles refactoring all the I2C drivers to use the interface.
However in the case of both the SPI and the Pin objects passed to the New() function , some of the drivers then go on to call the Configure() method.
For example: https://github.com/tinygo-org/drivers/blob/release/flash/transport_spi.go#L54
Since Confgure() expects a concrete type as param here, it becomes difficult to then replace the call with an interface that does not depend on the machine package.
What should we do about this?
One option would be to expect any configuration to already be done and hence to not allow any drivers to call Configure().
Another would be to refactor the machine package itself to expect a pointer so that we can define Configure(interface{}) in the drivers.SPI interface.
Any other ideas on how to handle this?