NuMaker mbed OS v6.x LoRaWAN

Committer:
cyliang
Date:
Tue Sep 01 20:28:04 2020 +0800
Revision:
0:a160d512fe55
Mbed OS v6.x LoRaWAN example for NuMaker platforms

Who changed what in which revision?

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