NuMaker mbed OS v5.x LoRaWAN

Committer:
cyliang
Date:
Tue Sep 01 21:06:51 2020 +0800
Revision:
0:895bbd4e6398
Mbed OS v5.x LoRaWAN example for NuMaker platforms based on https://github.com/ARMmbed/mbed-os-example-lorawan.git

Who changed what in which revision?

UserRevisionLine numberNew contents of line
cyliang 0:895bbd4e6398 1 /**
cyliang 0:895bbd4e6398 2 * Copyright (c) 2017, Arm Limited and affiliates.
cyliang 0:895bbd4e6398 3 * SPDX-License-Identifier: Apache-2.0
cyliang 0:895bbd4e6398 4 *
cyliang 0:895bbd4e6398 5 * Licensed under the Apache License, Version 2.0 (the "License");
cyliang 0:895bbd4e6398 6 * you may not use this file except in compliance with the License.
cyliang 0:895bbd4e6398 7 * You may obtain a copy of the License at
cyliang 0:895bbd4e6398 8 *
cyliang 0:895bbd4e6398 9 * http://www.apache.org/licenses/LICENSE-2.0
cyliang 0:895bbd4e6398 10 *
cyliang 0:895bbd4e6398 11 * Unless required by applicable law or agreed to in writing, software
cyliang 0:895bbd4e6398 12 * distributed under the License is distributed on an "AS IS" BASIS,
cyliang 0:895bbd4e6398 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
cyliang 0:895bbd4e6398 14 * See the License for the specific language governing permissions and
cyliang 0:895bbd4e6398 15 * limitations under the License.
cyliang 0:895bbd4e6398 16 */
cyliang 0:895bbd4e6398 17
cyliang 0:895bbd4e6398 18 #ifndef APP_LORA_RADIO_HELPER_H_
cyliang 0:895bbd4e6398 19 #define APP_LORA_RADIO_HELPER_H_
cyliang 0:895bbd4e6398 20
cyliang 0:895bbd4e6398 21 #include "lorawan/LoRaRadio.h"
cyliang 0:895bbd4e6398 22
cyliang 0:895bbd4e6398 23 #define SX1272 0xFF
cyliang 0:895bbd4e6398 24 #define SX1276 0xEE
cyliang 0:895bbd4e6398 25 #define SX126X 0xDD
cyliang 0:895bbd4e6398 26
cyliang 0:895bbd4e6398 27 #if (MBED_CONF_APP_LORA_RADIO == SX1272)
cyliang 0:895bbd4e6398 28 #include "SX1272_LoRaRadio.h"
cyliang 0:895bbd4e6398 29 SX1272_LoRaRadio radio(MBED_CONF_APP_LORA_SPI_MOSI,
cyliang 0:895bbd4e6398 30 MBED_CONF_APP_LORA_SPI_MISO,
cyliang 0:895bbd4e6398 31 MBED_CONF_APP_LORA_SPI_SCLK,
cyliang 0:895bbd4e6398 32 MBED_CONF_APP_LORA_CS,
cyliang 0:895bbd4e6398 33 MBED_CONF_APP_LORA_RESET,
cyliang 0:895bbd4e6398 34 MBED_CONF_APP_LORA_DIO0,
cyliang 0:895bbd4e6398 35 MBED_CONF_APP_LORA_DIO1,
cyliang 0:895bbd4e6398 36 MBED_CONF_APP_LORA_DIO2,
cyliang 0:895bbd4e6398 37 MBED_CONF_APP_LORA_DIO3,
cyliang 0:895bbd4e6398 38 MBED_CONF_APP_LORA_DIO4,
cyliang 0:895bbd4e6398 39 MBED_CONF_APP_LORA_DIO5,
cyliang 0:895bbd4e6398 40 MBED_CONF_APP_LORA_RF_SWITCH_CTL1,
cyliang 0:895bbd4e6398 41 MBED_CONF_APP_LORA_RF_SWITCH_CTL2,
cyliang 0:895bbd4e6398 42 MBED_CONF_APP_LORA_TXCTL,
cyliang 0:895bbd4e6398 43 MBED_CONF_APP_LORA_RXCTL,
cyliang 0:895bbd4e6398 44 MBED_CONF_APP_LORA_ANT_SWITCH,
cyliang 0:895bbd4e6398 45 MBED_CONF_APP_LORA_PWR_AMP_CTL,
cyliang 0:895bbd4e6398 46 MBED_CONF_APP_LORA_TCXO);
cyliang 0:895bbd4e6398 47
cyliang 0:895bbd4e6398 48 #elif (MBED_CONF_APP_LORA_RADIO == SX1276)
cyliang 0:895bbd4e6398 49 #include "SX1276_LoRaRadio.h"
cyliang 0:895bbd4e6398 50 SX1276_LoRaRadio radio(MBED_CONF_APP_LORA_SPI_MOSI,
cyliang 0:895bbd4e6398 51 MBED_CONF_APP_LORA_SPI_MISO,
cyliang 0:895bbd4e6398 52 MBED_CONF_APP_LORA_SPI_SCLK,
cyliang 0:895bbd4e6398 53 MBED_CONF_APP_LORA_CS,
cyliang 0:895bbd4e6398 54 MBED_CONF_APP_LORA_RESET,
cyliang 0:895bbd4e6398 55 MBED_CONF_APP_LORA_DIO0,
cyliang 0:895bbd4e6398 56 MBED_CONF_APP_LORA_DIO1,
cyliang 0:895bbd4e6398 57 MBED_CONF_APP_LORA_DIO2,
cyliang 0:895bbd4e6398 58 MBED_CONF_APP_LORA_DIO3,
cyliang 0:895bbd4e6398 59 MBED_CONF_APP_LORA_DIO4,
cyliang 0:895bbd4e6398 60 MBED_CONF_APP_LORA_DIO5,
cyliang 0:895bbd4e6398 61 MBED_CONF_APP_LORA_RF_SWITCH_CTL1,
cyliang 0:895bbd4e6398 62 MBED_CONF_APP_LORA_RF_SWITCH_CTL2,
cyliang 0:895bbd4e6398 63 MBED_CONF_APP_LORA_TXCTL,
cyliang 0:895bbd4e6398 64 MBED_CONF_APP_LORA_RXCTL,
cyliang 0:895bbd4e6398 65 MBED_CONF_APP_LORA_ANT_SWITCH,
cyliang 0:895bbd4e6398 66 MBED_CONF_APP_LORA_PWR_AMP_CTL,
cyliang 0:895bbd4e6398 67 MBED_CONF_APP_LORA_TCXO);
cyliang 0:895bbd4e6398 68
cyliang 0:895bbd4e6398 69 #elif (MBED_CONF_APP_LORA_RADIO == SX126X)
cyliang 0:895bbd4e6398 70 #include "SX126X_LoRaRadio.h"
cyliang 0:895bbd4e6398 71 SX126X_LoRaRadio radio(MBED_CONF_APP_LORA_SPI_MOSI,
cyliang 0:895bbd4e6398 72 MBED_CONF_APP_LORA_SPI_MISO,
cyliang 0:895bbd4e6398 73 MBED_CONF_APP_LORA_SPI_SCLK,
cyliang 0:895bbd4e6398 74 MBED_CONF_APP_LORA_CS,
cyliang 0:895bbd4e6398 75 MBED_CONF_APP_LORA_RESET,
cyliang 0:895bbd4e6398 76 MBED_CONF_APP_LORA_DIO1,
cyliang 0:895bbd4e6398 77 MBED_CONF_APP_LORA_BUSY,
cyliang 0:895bbd4e6398 78 MBED_CONF_APP_LORA_FREQ_SEL,
cyliang 0:895bbd4e6398 79 MBED_CONF_APP_LORA_DEV_SEL,
cyliang 0:895bbd4e6398 80 MBED_CONF_APP_LORA_XTAL_SEL,
cyliang 0:895bbd4e6398 81 MBED_CONF_APP_LORA_ANT_SWITCH);
cyliang 0:895bbd4e6398 82
cyliang 0:895bbd4e6398 83 #else
cyliang 0:895bbd4e6398 84 #error "Unknown LoRa radio specified (SX126X, SX1272, SX1276 are valid)"
cyliang 0:895bbd4e6398 85 #endif
cyliang 0:895bbd4e6398 86
cyliang 0:895bbd4e6398 87 #endif /* APP_LORA_RADIO_HELPER_H_ */