Skip to content

Commit 0da4368

Browse files
committed
eliminate SPI3w heap allocation in status read
1 parent 7f6c7b6 commit 0da4368

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

rp2-pio/piolib/spi3w.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,11 @@ func (spi *SPI3w) getStatus(dl deadline) error {
203203
}
204204
gosched()
205205
}
206-
var buf [1]uint32
207-
err := spi.read(buf[:1], dl)
206+
207+
err := spi.read(unsafe.Slice(&spi.lastStatus, 1), dl)
208208
if err != nil {
209209
return err
210210
}
211-
spi.lastStatus = buf[0]
212211
return nil
213212
}
214213

0 commit comments

Comments
 (0)