We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5c202bd commit 08b2d01Copy full SHA for 08b2d01
src/machine/machine_nrf52xxx.go
@@ -338,6 +338,16 @@ func (spi *SPI) Tx(w, r []byte) error {
338
return nil
339
}
340
341
+// Read implements [io.Reader]. And reads as many bytes as the given buffer is long
342
+func (spi *SPI) Read(r []byte) (int, error) {
343
+ return len(r), spi.Tx(nil, r)
344
+}
345
+
346
+// Write implements [io.Writer]. And writes as long as there are bytes in w.
347
+func (spi *SPI) Write(w []byte) (int, error) {
348
+ return len(w), spi.Tx(w, nil)
349
350
351
// PWM is one PWM peripheral, which consists of a counter and multiple output
352
// channels (that can be connected to actual pins). You can set the frequency
353
// using SetPeriod, but only for all the channels in this PWM peripheral at
0 commit comments