Lora: Add driver implementation inside DEVICE_SPI flag

These drivers uses SPI to communicate with radio so SPI must be present
when compiling these.
pull/12741/head
Kimmo Vaisanen 2020-04-06 08:26:29 +03:00
parent 6ca66e23df
commit a16a35246b
6 changed files with 24 additions and 0 deletions

View File

@ -22,6 +22,8 @@ Copyright (c) 2019, Arm Limited and affiliates.
SPDX-License-Identifier: BSD-3-Clause SPDX-License-Identifier: BSD-3-Clause
*/ */
#if DEVICE_SPI
#include <math.h> #include <math.h>
#include "ThisThread.h" #include "ThisThread.h"
#include "mbed_wait_api.h" #include "mbed_wait_api.h"
@ -1337,3 +1339,4 @@ void SX126X_LoRaRadio::clear_device_errors(void)
write_opmode_command((uint8_t) RADIO_CLR_ERROR, buf, 2); write_opmode_command((uint8_t) RADIO_CLR_ERROR, buf, 2);
} }
#endif // DEVICE_SPI

View File

@ -25,6 +25,8 @@ SPDX-License-Identifier: BSD-3-Clause
#ifndef MBED_LORA_RADIO_DRV_SX126X_LORARADIO_H_ #ifndef MBED_LORA_RADIO_DRV_SX126X_LORARADIO_H_
#define MBED_LORA_RADIO_DRV_SX126X_LORARADIO_H_ #define MBED_LORA_RADIO_DRV_SX126X_LORARADIO_H_
#if DEVICE_SPI
#include "mbed_critical.h" #include "mbed_critical.h"
#include "PinNames.h" #include "PinNames.h"
#include "InterruptIn.h" #include "InterruptIn.h"
@ -401,4 +403,6 @@ private:
packet_params_t _packet_params; packet_params_t _packet_params;
}; };
#endif // DEVICE_SPI
#endif /* MBED_LORA_RADIO_DRV_SX126X_LORARADIO_H_ */ #endif /* MBED_LORA_RADIO_DRV_SX126X_LORARADIO_H_ */

View File

@ -23,6 +23,8 @@ Copyright (c) 2017, Arm Limited and affiliates.
SPDX-License-Identifier: BSD-3-Clause SPDX-License-Identifier: BSD-3-Clause
*/ */
#if DEVICE_SPI
#include "SX1272_LoRaRadio.h" #include "SX1272_LoRaRadio.h"
#include "sx1272Regs-Fsk.h" #include "sx1272Regs-Fsk.h"
#include "sx1272Regs-LoRa.h" #include "sx1272Regs-LoRa.h"
@ -2080,3 +2082,5 @@ void SX1272_LoRaRadio::handle_timeout_irq()
} }
} }
} }
#endif // DEVICE_SPI

View File

@ -26,6 +26,8 @@ SPDX-License-Identifier: BSD-3-Clause
#ifndef SX1272_LORARADIO_H_ #ifndef SX1272_LORARADIO_H_
#define SX1272_LORARADIO_H_ #define SX1272_LORARADIO_H_
#if DEVICE_SPI
#include "PinNames.h" #include "PinNames.h"
#include "InterruptIn.h" #include "InterruptIn.h"
#include "DigitalOut.h" #include "DigitalOut.h"
@ -435,4 +437,6 @@ private:
void handle_timeout_irq(); void handle_timeout_irq();
}; };
#endif // DEVICE_SPI
#endif /* SX1272_LORARADIO_H_ */ #endif /* SX1272_LORARADIO_H_ */

View File

@ -22,6 +22,8 @@ Copyright (c) 2017, Arm Limited and affiliates.
SPDX-License-Identifier: BSD-3-Clause SPDX-License-Identifier: BSD-3-Clause
*/ */
#if DEVICE_SPI
#include "PinNames.h" #include "PinNames.h"
#include "platform/Callback.h" #include "platform/Callback.h"
#include "platform/mbed_wait_api.h" #include "platform/mbed_wait_api.h"
@ -2268,4 +2270,7 @@ void SX1276_LoRaRadio::handle_timeout_irq()
} }
} }
} }
#endif // DEVICE_SPI
// EOF // EOF

View File

@ -26,6 +26,8 @@ SPDX-License-Identifier: BSD-3-Clause
#ifndef SX1276_LORARADIO_H_ #ifndef SX1276_LORARADIO_H_
#define SX1276_LORARADIO_H_ #define SX1276_LORARADIO_H_
#if DEVICE_SPI
#include "PinNames.h" #include "PinNames.h"
#include "InterruptIn.h" #include "InterruptIn.h"
#include "DigitalOut.h" #include "DigitalOut.h"
@ -446,4 +448,6 @@ private:
void handle_timeout_irq(); void handle_timeout_irq();
}; };
#endif // DEVICE_SPI
#endif // SX1276_LORARADIO_H_ #endif // SX1276_LORARADIO_H_