First program for SmartCampus LoRaWan

Committer:
bastienvincke
Date:
Wed Feb 05 13:17:21 2020 +0000
Revision:
52:bfaf25ee5cd5
Parent:
46:a124538e2891
bv

Who changed what in which revision?

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