machine/spi: use interface to ensure uniformity for all machine implementations

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
deadprogram
2023-10-15 16:49:26 +02:00
committed by Ron Evans
parent 7019c4e8fc
commit fa4ca63ff2
6 changed files with 25 additions and 5 deletions
+11
View File
@@ -16,3 +16,14 @@ var (
ErrTxInvalidSliceSize = errors.New("SPI write and read slices must be same size")
errSPIInvalidMachineConfig = errors.New("SPI port was not configured properly by the machine")
)
// If you are getting a compile error on this line please check to see you've
// correctly implemented the methods on the SPI type. They must match
// the interface method signatures type to type perfectly.
// If not implementing the SPI type please remove your target from the build tags
// at the top of this file.
var _ interface { // 2
Configure(config SPIConfig) error
Tx(w, r []byte) error
Transfer(w byte) (byte, error)
} = (*SPI)(nil)