Better Transmit
This commit is contained in:
parent
05637feaf5
commit
b3a45db48a
1 changed files with 8 additions and 6 deletions
|
@ -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,6 +43,11 @@ func (r *Device) Loop() (chan Data, chan Data, chan int) {
|
|||
log.Fatal(err)
|
||||
}
|
||||
|
||||
err = r.writeReg(REG_DIOMAPPING1, RF_DIOMAPPING1_DIO0_00)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
err = r.writeFifo(&dataToTransmit)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -49,11 +56,6 @@ func (r *Device) Loop() (chan Data, chan Data, chan int) {
|
|||
log.Print("transmit")
|
||||
log.Print(dataToTransmit)
|
||||
|
||||
err = r.writeReg(REG_DIOMAPPING1, RF_DIOMAPPING1_DIO0_00)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
err = r.SetMode(RF_OPMODE_TRANSMITTER)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
|
Loading…
Add table
Reference in a new issue