Skip to content

Commit aa3583c

Browse files
authored
Fix compilation of RFM69_new driver on aarch64 architecture (mysensors#1500)
1 parent 64fcece commit aa3583c

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

hal/transport/RFM69/driver/new/RFM69_new.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* Copyright Thomas Studwell (2014,2015)
2626
* - MySensors generic radio driver implementation Copyright (C) 2017, 2018 Olivier Mauti <[email protected]>
2727
*
28-
* Changes by : @tekka, @scalz, @marceloagno
28+
* Changes by : @tekka, @scalz, @marceloagno, @docbender
2929
*
3030
* Definitions for Semtech SX1231/H radios:
3131
* https://www.semtech.com/uploads/documents/sx1231.pdf
@@ -370,7 +370,7 @@ LOCAL bool RFM69_channelFree(void)
370370
{
371371
// returns true if channel activity under RFM69_CSMA_LIMIT_DBM
372372
const rfm69_RSSI_t RSSI = RFM69_readRSSI(false);
373-
RFM69_DEBUG(PSTR("RFM69:CSMA:RSSI=%" PRIi16 "\n"), RFM69_internalToRSSI(RSSI));
373+
//RFM69_DEBUG(PSTR("RFM69:CSMA:RSSI=%" PRIi16 "\n"), RFM69_internalToRSSI(RSSI));
374374
return (RSSI > RFM69_RSSItoInternal(MY_RFM69_CSMA_LIMIT_DBM));
375375
}
376376

@@ -500,8 +500,10 @@ LOCAL bool RFM69_setRadioMode(const rfm69_radio_mode_t newRadioMode)
500500

501501
if (newRadioMode == RFM69_RADIO_MODE_STDBY) {
502502
regMode = RFM69_OPMODE_SEQUENCER_ON | RFM69_OPMODE_LISTEN_OFF | RFM69_OPMODE_STANDBY;
503+
RFM69_DEBUG(PSTR("RFM69:RSB\n")); // put radio to standby
503504
} else if (newRadioMode == RFM69_RADIO_MODE_SLEEP) {
504505
regMode = RFM69_OPMODE_SEQUENCER_OFF | RFM69_OPMODE_LISTEN_OFF | RFM69_OPMODE_SLEEP;
506+
RFM69_DEBUG(PSTR("RFM69:RSL\n")); // put radio to sleep
505507
} else if (newRadioMode == RFM69_RADIO_MODE_RX) {
506508
RFM69.dataReceived = false;
507509
RFM69.ackReceived = false;
@@ -511,14 +513,18 @@ LOCAL bool RFM69_setRadioMode(const rfm69_radio_mode_t newRadioMode)
511513
RFM69_setHighPowerRegs(false);
512514
RFM69_writeReg(RFM69_REG_PACKETCONFIG2,
513515
(RFM69_readReg(RFM69_REG_PACKETCONFIG2) & 0xFB) | RFM69_PACKET2_RXRESTART); // avoid RX deadlocks
516+
RFM69_DEBUG(PSTR("RFM69:RRX\n"));
514517
} else if (newRadioMode == RFM69_RADIO_MODE_TX) {
515518
regMode = RFM69_OPMODE_SEQUENCER_ON | RFM69_OPMODE_LISTEN_OFF | RFM69_OPMODE_TRANSMITTER;
516519
RFM69_writeReg(RFM69_REG_DIOMAPPING1, RFM69_DIOMAPPING1_DIO0_00); // Interrupt on PacketSent, DIO0
517520
RFM69_setHighPowerRegs(RFM69.powerLevel >= (rfm69_powerlevel_t)RFM69_HIGH_POWER_DBM);
521+
RFM69_DEBUG(PSTR("RFM69:RTX\n"));
518522
} else if (newRadioMode == RFM69_RADIO_MODE_SYNTH) {
519523
regMode = RFM69_OPMODE_SEQUENCER_ON | RFM69_OPMODE_LISTEN_OFF | RFM69_OPMODE_SYNTHESIZER;
524+
RFM69_DEBUG(PSTR("RFM69:RSY\n"));
520525
} else {
521526
regMode = RFM69_OPMODE_SEQUENCER_ON | RFM69_OPMODE_LISTEN_OFF | RFM69_OPMODE_STANDBY;
527+
RFM69_DEBUG(PSTR("RFM69:RSB\n")); // put radio to standby
522528
}
523529

524530
// set new mode
@@ -553,13 +559,13 @@ LOCAL void RFM69_powerDown(void)
553559

554560
LOCAL bool RFM69_sleep(void)
555561
{
556-
RFM69_DEBUG(PSTR("RFM69:RSL\n")); // put radio to sleep
562+
// put radio to sleep
557563
return RFM69_setRadioMode(RFM69_RADIO_MODE_SLEEP);
558564
}
559565

560566
LOCAL bool RFM69_standBy(void)
561567
{
562-
RFM69_DEBUG(PSTR("RFM69:RSB\n")); // put radio to standby
568+
// put radio to standby
563569
return RFM69_setRadioMode(RFM69_RADIO_MODE_STDBY);
564570
}
565571

@@ -617,7 +623,9 @@ LOCAL bool RFM69_sendWithRetry(const uint8_t recipient, const void *buffer,
617623
rfm69_controlFlags_t flags = 0u; // reset all flags
618624
RFM69_setACKRequested(flags, !noACK);
619625
RFM69_setACKRSSIReport(flags, RFM69.ATCenabled);
620-
(void)RFM69_send(recipient, (uint8_t *)buffer, bufferSize, flags, !retry);
626+
if(!RFM69_send(recipient, (uint8_t *)buffer, bufferSize, flags, !retry)) {
627+
RFM69_DEBUG(PSTR("RFM69:SWR:SEND,NOIRQ\n"));
628+
}
621629
if (noACK) {
622630
// no ACK requested
623631
return true;

hal/transport/RFM69/driver/new/RFM69_new.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* Copyright Thomas Studwell (2014,2015)
2626
* - MySensors generic radio driver implementation Copyright (C) 2017, 2018 Olivier Mauti <[email protected]>
2727
*
28-
* Changes by : @tekka, @scalz, @marceloagno
28+
* Changes by : @tekka, @scalz, @marceloagno, @docbender
2929
*
3030
* Definitions for Semtech SX1231/H radios:
3131
* https://www.semtech.com/uploads/documents/sx1231.pdf
@@ -56,11 +56,16 @@
5656
* | | RFM69 | SWR | SEND,TO=%%d,SEQ=%%d,RETRY=%%d | Send to (TO), sequence number (SWQ), retry if no ACK received (RETRY)
5757
* | | RFM69 | SWR | ACK,FROM=%%d,SEQ=%%d,RSSI=%%d | ACK received from (FROM), sequence nr (SEQ), ACK RSSI (RSSI)
5858
* |!| RFM69 | SWR | NACK | Message sent, no ACK received
59+
* |!| RFM69 | SWR | NOIRQ | Interrupt from IRQ pin not received after message was sent
5960
* | | RFM69 | SPP | PCT=%%d,TX LEVEL=%%d | Set TX level, input TX percent (PCT)
6061
* | | RFM69 | RSL | | Radio in sleep mode
6162
* | | RFM69 | RSB | | Radio in standby mode
63+
* | | RFM69 | RRX | | Radio in receive mode
64+
* | | RFM69 | RTX | | Radio in transmit mode
65+
* | | RFM69 | RSY | | Radio in synth mode
6266
* | | RFM69 | PWD | | Power down radio
6367
* | | RFM69 | PWU | | Power up radio
68+
* | | RFM69 | DUMP | %s | Dump radio registers
6469
*
6570
* @brief API declaration for RFM69
6671
*
@@ -127,7 +132,7 @@
127132
#endif
128133

129134
#define RFM69_FIFO_SIZE (0xFFu) //!< Max number of bytes the Rx/Tx FIFO can hold
130-
#define RFM69_MAX_PACKET_LEN (0x40u) //!< This is the maximum number of bytes that can be carried
135+
#define RFM69_MAX_PACKET_LEN static_cast<size_t>(0x40u) //!< This is the maximum number of bytes that can be carried
131136
#define RFM69_ATC_TARGET_RANGE_DBM (2u) //!< ATC target range +/- dBm
132137
#define RFM69_PACKET_HEADER_VERSION (1u) //!< RFM69 packet header version
133138
#define RFM69_MIN_PACKET_HEADER_VERSION (1u) //!< Minimal RFM69 packet header version

0 commit comments

Comments
 (0)