Reaktivate RX after received data

master
Friedl Ulrich 10 years ago
parent ec805e2772
commit e541265f23

@ -31,6 +31,7 @@ type Data struct {
Data []byte Data []byte
RequestAck bool RequestAck bool
SendAck bool SendAck bool
Rssi int
} }
// NewDevice creates a new device // NewDevice creates a new device
@ -388,5 +389,11 @@ func (r *Device) readFifo() (Data, error) {
data.SendAck = bool(rx[2]&0x80 > 0) data.SendAck = bool(rx[2]&0x80 > 0)
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
} }

@ -72,10 +72,6 @@ func (r *Device) Loop() (chan Data, chan int) {
log.Fatal(err) log.Fatal(err)
} }
case <-irq: case <-irq:
err = r.SetMode(RF_OPMODE_STANDBY)
if err != nil {
log.Fatal(err)
}
data, err := r.readFifo() data, err := r.readFifo()
if err != nil { if err != nil {
@ -94,6 +90,14 @@ func (r *Device) Loop() (chan Data, chan int) {
} }
txChan <- resp txChan <- resp
} }
rxChan <- data
err = r.SetMode(RF_OPMODE_RECEIVER)
if err != nil {
log.Fatal(err)
}
case <-quit: case <-quit:
quit <- 1 quit <- 1
return return

Loading…
Cancel
Save