Skip to content

Commit a16a352

Browse files
author
Kimmo Vaisanen
committed
Lora: Add driver implementation inside DEVICE_SPI flag
These drivers uses SPI to communicate with radio so SPI must be present when compiling these.
1 parent 6ca66e2 commit a16a352

File tree

6 files changed

+24
-0
lines changed

6 files changed

+24
-0
lines changed

components/lora/SX126X/SX126X_LoRaRadio.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ Copyright (c) 2019, Arm Limited and affiliates.
2222
SPDX-License-Identifier: BSD-3-Clause
2323
*/
2424

25+
#if DEVICE_SPI
26+
2527
#include <math.h>
2628
#include "ThisThread.h"
2729
#include "mbed_wait_api.h"
@@ -1337,3 +1339,4 @@ void SX126X_LoRaRadio::clear_device_errors(void)
13371339
write_opmode_command((uint8_t) RADIO_CLR_ERROR, buf, 2);
13381340
}
13391341

1342+
#endif // DEVICE_SPI

components/lora/SX126X/SX126X_LoRaRadio.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ SPDX-License-Identifier: BSD-3-Clause
2525
#ifndef MBED_LORA_RADIO_DRV_SX126X_LORARADIO_H_
2626
#define MBED_LORA_RADIO_DRV_SX126X_LORARADIO_H_
2727

28+
#if DEVICE_SPI
29+
2830
#include "mbed_critical.h"
2931
#include "PinNames.h"
3032
#include "InterruptIn.h"
@@ -401,4 +403,6 @@ class SX126X_LoRaRadio : public LoRaRadio {
401403
packet_params_t _packet_params;
402404
};
403405

406+
#endif // DEVICE_SPI
407+
404408
#endif /* MBED_LORA_RADIO_DRV_SX126X_LORARADIO_H_ */

components/lora/SX1272/SX1272_LoRaRadio.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Copyright (c) 2017, Arm Limited and affiliates.
2323
SPDX-License-Identifier: BSD-3-Clause
2424
*/
2525

26+
#if DEVICE_SPI
27+
2628
#include "SX1272_LoRaRadio.h"
2729
#include "sx1272Regs-Fsk.h"
2830
#include "sx1272Regs-LoRa.h"
@@ -2080,3 +2082,5 @@ void SX1272_LoRaRadio::handle_timeout_irq()
20802082
}
20812083
}
20822084
}
2085+
2086+
#endif // DEVICE_SPI

components/lora/SX1272/SX1272_LoRaRadio.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ SPDX-License-Identifier: BSD-3-Clause
2626
#ifndef SX1272_LORARADIO_H_
2727
#define SX1272_LORARADIO_H_
2828

29+
#if DEVICE_SPI
30+
2931
#include "PinNames.h"
3032
#include "InterruptIn.h"
3133
#include "DigitalOut.h"
@@ -435,4 +437,6 @@ class SX1272_LoRaRadio: public LoRaRadio {
435437
void handle_timeout_irq();
436438
};
437439

440+
#endif // DEVICE_SPI
441+
438442
#endif /* SX1272_LORARADIO_H_ */

components/lora/SX1276/SX1276_LoRaRadio.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ Copyright (c) 2017, Arm Limited and affiliates.
2222
SPDX-License-Identifier: BSD-3-Clause
2323
*/
2424

25+
#if DEVICE_SPI
26+
2527
#include "PinNames.h"
2628
#include "platform/Callback.h"
2729
#include "platform/mbed_wait_api.h"
@@ -2268,4 +2270,7 @@ void SX1276_LoRaRadio::handle_timeout_irq()
22682270
}
22692271
}
22702272
}
2273+
2274+
#endif // DEVICE_SPI
2275+
22712276
// EOF

components/lora/SX1276/SX1276_LoRaRadio.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ SPDX-License-Identifier: BSD-3-Clause
2626
#ifndef SX1276_LORARADIO_H_
2727
#define SX1276_LORARADIO_H_
2828

29+
#if DEVICE_SPI
30+
2931
#include "PinNames.h"
3032
#include "InterruptIn.h"
3133
#include "DigitalOut.h"
@@ -446,4 +448,6 @@ class SX1276_LoRaRadio: public LoRaRadio {
446448
void handle_timeout_irq();
447449
};
448450

451+
#endif // DEVICE_SPI
452+
449453
#endif // SX1276_LORARADIO_H_

0 commit comments

Comments
 (0)