mirror of
https://github.com/kidoman/embd
synced 2024-12-21 12:20:05 +01:00
Fix typo
TransferAndRecieveData --> TransferAndReceiveData
This commit is contained in:
parent
5065e49386
commit
42be169804
@ -38,7 +38,7 @@ func (m *MCP3008) AnalogValueAt(chanNum int) (int, error) {
|
||||
data[2] = 0
|
||||
|
||||
glog.V(2).Infof("mcp3008: sendingdata buffer %v", data)
|
||||
if err := m.Bus.TransferAndRecieveData(data[:]); err != nil {
|
||||
if err := m.Bus.TransferAndReceiveData(data[:]); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
|
@ -174,7 +174,7 @@ func (b *spiBus) setDelay() {
|
||||
b.spiTransferData.delayus = delay
|
||||
}
|
||||
|
||||
func (b *spiBus) TransferAndRecieveData(dataBuffer []uint8) error {
|
||||
func (b *spiBus) TransferAndReceiveData(dataBuffer []uint8) error {
|
||||
if err := b.init(); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -203,7 +203,7 @@ func (b *spiBus) ReceiveData(len int) ([]uint8, error) {
|
||||
}
|
||||
|
||||
data := make([]uint8, len)
|
||||
if err := b.TransferAndRecieveData(data); err != nil {
|
||||
if err := b.TransferAndReceiveData(data); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return data, nil
|
||||
@ -215,7 +215,7 @@ func (b *spiBus) TransferAndReceiveByte(data byte) (byte, error) {
|
||||
}
|
||||
|
||||
d := [1]uint8{uint8(data)}
|
||||
if err := b.TransferAndRecieveData(d[:]); err != nil {
|
||||
if err := b.TransferAndReceiveData(d[:]); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return d[0], nil
|
||||
@ -227,7 +227,7 @@ func (b *spiBus) ReceiveByte() (byte, error) {
|
||||
}
|
||||
|
||||
var d [1]uint8
|
||||
if err := b.TransferAndRecieveData(d[:]); err != nil {
|
||||
if err := b.TransferAndReceiveData(d[:]); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return byte(d[0]), nil
|
||||
|
@ -20,7 +20,7 @@ func main() {
|
||||
|
||||
dataBuf := [3]uint8{1, 2, 3}
|
||||
|
||||
if err := spiBus.TransferAndRecieveData(dataBuf[:]); err != nil {
|
||||
if err := spiBus.TransferAndReceiveData(dataBuf[:]); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ func getSensorValue(bus embd.SPIBus) (uint16, error) {
|
||||
data := [3]uint8{1, 128, 0}
|
||||
|
||||
var err error
|
||||
err = bus.TransferAndRecieveData(data[:])
|
||||
err = bus.TransferAndReceiveData(data[:])
|
||||
if err != nil {
|
||||
return uint16(0), err
|
||||
}
|
||||
|
4
spi.go
4
spi.go
@ -27,8 +27,8 @@ const (
|
||||
type SPIBus interface {
|
||||
io.Writer
|
||||
|
||||
// TransferAndRecieveData transmits data in a buffer(slice) and receives into it.
|
||||
TransferAndRecieveData(dataBuffer []uint8) error
|
||||
// TransferAndReceiveData transmits data in a buffer(slice) and receives into it.
|
||||
TransferAndReceiveData(dataBuffer []uint8) error
|
||||
|
||||
// ReceiveData receives data of length len into a slice.
|
||||
ReceiveData(len int) ([]uint8, error)
|
||||
|
Loading…
x
Reference in New Issue
Block a user