|
|
|
@ -30,7 +30,9 @@ func (r *Device) Loop() (chan Data, chan Data, chan int) {
|
|
|
|
|
for {
|
|
|
|
|
select {
|
|
|
|
|
case dataToTransmit := <-txChan:
|
|
|
|
|
// can send?
|
|
|
|
|
// TODO: can send?
|
|
|
|
|
r.readWriteReg(REG_PACKETCONFIG2, 0xFB, RF_PACKET2_RXRESTART) // avoid RX deadlocks
|
|
|
|
|
|
|
|
|
|
err = r.SetMode(RF_OPMODE_STANDBY)
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Fatal(err)
|
|
|
|
@ -41,19 +43,19 @@ func (r *Device) Loop() (chan Data, chan Data, chan int) {
|
|
|
|
|
log.Fatal(err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
err = r.writeFifo(&dataToTransmit)
|
|
|
|
|
err = r.writeReg(REG_DIOMAPPING1, RF_DIOMAPPING1_DIO0_00)
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Fatal(err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
log.Print("transmit")
|
|
|
|
|
log.Print(dataToTransmit)
|
|
|
|
|
|
|
|
|
|
err = r.writeReg(REG_DIOMAPPING1, RF_DIOMAPPING1_DIO0_00)
|
|
|
|
|
err = r.writeFifo(&dataToTransmit)
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Fatal(err)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
log.Print("transmit")
|
|
|
|
|
log.Print(dataToTransmit)
|
|
|
|
|
|
|
|
|
|
err = r.SetMode(RF_OPMODE_TRANSMITTER)
|
|
|
|
|
if err != nil {
|
|
|
|
|
log.Fatal(err)
|
|
|
|
|