Reading RSSI before data
This commit is contained in:
parent
e9326a1e33
commit
789dc3ba73
1 changed files with 7 additions and 5 deletions
12
device.go
12
device.go
|
@ -360,7 +360,14 @@ func (r *Device) writeFifo(data *Data) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Device) readFifo() (Data, error) {
|
func (r *Device) readFifo() (Data, error) {
|
||||||
|
var err error
|
||||||
data := Data{}
|
data := Data{}
|
||||||
|
|
||||||
|
data.Rssi, err = r.readRSSI(false)
|
||||||
|
if err != nil {
|
||||||
|
return data, err
|
||||||
|
}
|
||||||
|
|
||||||
tx := new([67]byte)
|
tx := new([67]byte)
|
||||||
tx[0] = REG_FIFO & 0x7f
|
tx[0] = REG_FIFO & 0x7f
|
||||||
rx, err := r.SpiDevice.Xfer(tx[:3])
|
rx, err := r.SpiDevice.Xfer(tx[:3])
|
||||||
|
@ -384,10 +391,5 @@ func (r *Device) readFifo() (Data, error) {
|
||||||
data.RequestAck = bool(rx[2]&0x40 > 0)
|
data.RequestAck = bool(rx[2]&0x40 > 0)
|
||||||
data.Data = rx[3:]
|
data.Data = rx[3:]
|
||||||
|
|
||||||
data.Rssi, err = r.readRSSI(false)
|
|
||||||
if err != nil {
|
|
||||||
return data, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return data, nil
|
return data, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue