refactor: use *SPI everywhere to make consistant for implementations.

Fixes #4663 "in reverse" by making SPI a pointer everywhere, as discussed
in the comments.

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
deadprogram
2025-02-25 11:09:14 +01:00
committed by Ron Evans
parent cab3834bc9
commit 2bee29959b
31 changed files with 99 additions and 101 deletions
+3 -3
View File
@@ -60,13 +60,13 @@ type SPIConfig struct {
Mode uint8
}
func (spi SPI) Configure(config SPIConfig) error {
func (spi *SPI) Configure(config SPIConfig) error {
spiConfigure(spi.Bus, config.SCK, config.SDO, config.SDI)
return nil
}
// Transfer writes/reads a single byte using the SPI interface.
func (spi SPI) Transfer(w byte) (byte, error) {
func (spi *SPI) Transfer(w byte) (byte, error) {
return spiTransfer(spi.Bus, w), nil
}
@@ -87,7 +87,7 @@ func (spi SPI) Transfer(w byte) (byte, error) {
// This form sends zeros, putting the result into the rx buffer. Good for reading a "result packet":
//
// spi.Tx(nil, rx)
func (spi SPI) Tx(w, r []byte) error {
func (spi *SPI) Tx(w, r []byte) error {
var wptr, rptr *byte
var wlen, rlen int
if len(w) != 0 {