Fix compilation of RFM69_new driver on aarch64 architecture (#1500)

This commit is contained in:
Vita
2023-10-07 12:06:35 +02:00
committed by GitHub
parent 64fcecee46
commit aa3583c50f
2 changed files with 20 additions and 7 deletions

View File

@@ -25,7 +25,7 @@
* Copyright Thomas Studwell (2014,2015)
* - MySensors generic radio driver implementation Copyright (C) 2017, 2018 Olivier Mauti <olivier@mysensors.org>
*
* Changes by : @tekka, @scalz, @marceloagno
* Changes by : @tekka, @scalz, @marceloagno, @docbender
*
* Definitions for Semtech SX1231/H radios:
* https://www.semtech.com/uploads/documents/sx1231.pdf
@@ -370,7 +370,7 @@ LOCAL bool RFM69_channelFree(void)
{
// returns true if channel activity under RFM69_CSMA_LIMIT_DBM
const rfm69_RSSI_t RSSI = RFM69_readRSSI(false);
RFM69_DEBUG(PSTR("RFM69:CSMA:RSSI=%" PRIi16 "\n"), RFM69_internalToRSSI(RSSI));
//RFM69_DEBUG(PSTR("RFM69:CSMA:RSSI=%" PRIi16 "\n"), RFM69_internalToRSSI(RSSI));
return (RSSI > RFM69_RSSItoInternal(MY_RFM69_CSMA_LIMIT_DBM));
}
@@ -500,8 +500,10 @@ LOCAL bool RFM69_setRadioMode(const rfm69_radio_mode_t newRadioMode)
if (newRadioMode == RFM69_RADIO_MODE_STDBY) {
regMode = RFM69_OPMODE_SEQUENCER_ON | RFM69_OPMODE_LISTEN_OFF | RFM69_OPMODE_STANDBY;
RFM69_DEBUG(PSTR("RFM69:RSB\n")); // put radio to standby
} else if (newRadioMode == RFM69_RADIO_MODE_SLEEP) {
regMode = RFM69_OPMODE_SEQUENCER_OFF | RFM69_OPMODE_LISTEN_OFF | RFM69_OPMODE_SLEEP;
RFM69_DEBUG(PSTR("RFM69:RSL\n")); // put radio to sleep
} else if (newRadioMode == RFM69_RADIO_MODE_RX) {
RFM69.dataReceived = false;
RFM69.ackReceived = false;
@@ -511,14 +513,18 @@ LOCAL bool RFM69_setRadioMode(const rfm69_radio_mode_t newRadioMode)
RFM69_setHighPowerRegs(false);
RFM69_writeReg(RFM69_REG_PACKETCONFIG2,
(RFM69_readReg(RFM69_REG_PACKETCONFIG2) & 0xFB) | RFM69_PACKET2_RXRESTART); // avoid RX deadlocks
RFM69_DEBUG(PSTR("RFM69:RRX\n"));
} else if (newRadioMode == RFM69_RADIO_MODE_TX) {
regMode = RFM69_OPMODE_SEQUENCER_ON | RFM69_OPMODE_LISTEN_OFF | RFM69_OPMODE_TRANSMITTER;
RFM69_writeReg(RFM69_REG_DIOMAPPING1, RFM69_DIOMAPPING1_DIO0_00); // Interrupt on PacketSent, DIO0
RFM69_setHighPowerRegs(RFM69.powerLevel >= (rfm69_powerlevel_t)RFM69_HIGH_POWER_DBM);
RFM69_DEBUG(PSTR("RFM69:RTX\n"));
} else if (newRadioMode == RFM69_RADIO_MODE_SYNTH) {
regMode = RFM69_OPMODE_SEQUENCER_ON | RFM69_OPMODE_LISTEN_OFF | RFM69_OPMODE_SYNTHESIZER;
RFM69_DEBUG(PSTR("RFM69:RSY\n"));
} else {
regMode = RFM69_OPMODE_SEQUENCER_ON | RFM69_OPMODE_LISTEN_OFF | RFM69_OPMODE_STANDBY;
RFM69_DEBUG(PSTR("RFM69:RSB\n")); // put radio to standby
}
// set new mode
@@ -553,13 +559,13 @@ LOCAL void RFM69_powerDown(void)
LOCAL bool RFM69_sleep(void)
{
RFM69_DEBUG(PSTR("RFM69:RSL\n")); // put radio to sleep
// put radio to sleep
return RFM69_setRadioMode(RFM69_RADIO_MODE_SLEEP);
}
LOCAL bool RFM69_standBy(void)
{
RFM69_DEBUG(PSTR("RFM69:RSB\n")); // put radio to standby
// put radio to standby
return RFM69_setRadioMode(RFM69_RADIO_MODE_STDBY);
}
@@ -617,7 +623,9 @@ LOCAL bool RFM69_sendWithRetry(const uint8_t recipient, const void *buffer,
rfm69_controlFlags_t flags = 0u; // reset all flags
RFM69_setACKRequested(flags, !noACK);
RFM69_setACKRSSIReport(flags, RFM69.ATCenabled);
(void)RFM69_send(recipient, (uint8_t *)buffer, bufferSize, flags, !retry);
if(!RFM69_send(recipient, (uint8_t *)buffer, bufferSize, flags, !retry)) {
RFM69_DEBUG(PSTR("RFM69:SWR:SEND,NOIRQ\n"));
}
if (noACK) {
// no ACK requested
return true;

View File

@@ -25,7 +25,7 @@
* Copyright Thomas Studwell (2014,2015)
* - MySensors generic radio driver implementation Copyright (C) 2017, 2018 Olivier Mauti <olivier@mysensors.org>
*
* Changes by : @tekka, @scalz, @marceloagno
* Changes by : @tekka, @scalz, @marceloagno, @docbender
*
* Definitions for Semtech SX1231/H radios:
* https://www.semtech.com/uploads/documents/sx1231.pdf
@@ -56,11 +56,16 @@
* | | RFM69 | SWR | SEND,TO=%%d,SEQ=%%d,RETRY=%%d | Send to (TO), sequence number (SWQ), retry if no ACK received (RETRY)
* | | RFM69 | SWR | ACK,FROM=%%d,SEQ=%%d,RSSI=%%d | ACK received from (FROM), sequence nr (SEQ), ACK RSSI (RSSI)
* |!| RFM69 | SWR | NACK | Message sent, no ACK received
* |!| RFM69 | SWR | NOIRQ | Interrupt from IRQ pin not received after message was sent
* | | RFM69 | SPP | PCT=%%d,TX LEVEL=%%d | Set TX level, input TX percent (PCT)
* | | RFM69 | RSL | | Radio in sleep mode
* | | RFM69 | RSB | | Radio in standby mode
* | | RFM69 | RRX | | Radio in receive mode
* | | RFM69 | RTX | | Radio in transmit mode
* | | RFM69 | RSY | | Radio in synth mode
* | | RFM69 | PWD | | Power down radio
* | | RFM69 | PWU | | Power up radio
* | | RFM69 | DUMP | %s | Dump radio registers
*
* @brief API declaration for RFM69
*
@@ -127,7 +132,7 @@
#endif
#define RFM69_FIFO_SIZE (0xFFu) //!< Max number of bytes the Rx/Tx FIFO can hold
#define RFM69_MAX_PACKET_LEN (0x40u) //!< This is the maximum number of bytes that can be carried
#define RFM69_MAX_PACKET_LEN static_cast<size_t>(0x40u) //!< This is the maximum number of bytes that can be carried
#define RFM69_ATC_TARGET_RANGE_DBM (2u) //!< ATC target range +/- dBm
#define RFM69_PACKET_HEADER_VERSION (1u) //!< RFM69 packet header version
#define RFM69_MIN_PACKET_HEADER_VERSION (1u) //!< Minimal RFM69 packet header version