mirror of
https://github.com/kidoman/embd
synced 2025-07-03 11:57:38 +02:00
spi: more refactoring
This commit is contained in:
parent
67d316851a
commit
2d3dee8764
5 changed files with 11 additions and 9 deletions
|
@ -36,12 +36,10 @@ func main() {
|
|||
}
|
||||
|
||||
func getSensorValue(bus embd.SPIBus) (uint16, error) {
|
||||
data := make([]uint8, 3)
|
||||
data[0] = 1
|
||||
data[1] = 128
|
||||
data[2] = 0
|
||||
data := [3]uint8{1, 128, 0}
|
||||
|
||||
var err error
|
||||
err = bus.TransferAndRecieveData(data)
|
||||
err = bus.TransferAndRecieveData(data[:])
|
||||
if err != nil {
|
||||
return uint16(0), err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue