lora

Committer:
mbed_official
Date:
Sun Mar 11 09:45:20 2018 +0000
Revision:
3:8c7198d1a2a1
Parent:
2:dc95ac6d6d4e
Child:
18:1720bc3831ea
Added LORAWAN_ENABLED flag to disable building in unsupported devices

- Also added check for SPI as it is needed by Radio technoology

.
Commit copied from https://github.com/ARMmbed/mbed-os-example-lorawan

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 3:8c7198d1a2a1 23 #if MBED_CONF_APP_LORAWAN_ENABLED
mbed_official 3:8c7198d1a2a1 24
mbed_official 3:8c7198d1a2a1 25 #ifdef DEVICE_SPI
mbed_official 3:8c7198d1a2a1 26
mbed_official 2:dc95ac6d6d4e 27 #include "SX1272_LoRaRadio.h"
mbed_official 2:dc95ac6d6d4e 28 #include "SX1276_LoRaRadio.h"
mbed_official 2:dc95ac6d6d4e 29
mbed_official 2:dc95ac6d6d4e 30 #define SX1272 0xFF
mbed_official 2:dc95ac6d6d4e 31 #define SX1276 0xEE
mbed_official 2:dc95ac6d6d4e 32
mbed_official 2:dc95ac6d6d4e 33 #if (MBED_CONF_APP_LORA_RADIO == SX1272)
mbed_official 2:dc95ac6d6d4e 34
mbed_official 2:dc95ac6d6d4e 35 SX1272_LoRaRadio radio(MBED_CONF_APP_LORA_SPI_MOSI,
mbed_official 2:dc95ac6d6d4e 36 MBED_CONF_APP_LORA_SPI_MISO,
mbed_official 2:dc95ac6d6d4e 37 MBED_CONF_APP_LORA_SPI_SCLK,
mbed_official 2:dc95ac6d6d4e 38 MBED_CONF_APP_LORA_CS,
mbed_official 2:dc95ac6d6d4e 39 MBED_CONF_APP_LORA_RESET,
mbed_official 2:dc95ac6d6d4e 40 MBED_CONF_APP_LORA_DIO0,
mbed_official 2:dc95ac6d6d4e 41 MBED_CONF_APP_LORA_DIO1,
mbed_official 2:dc95ac6d6d4e 42 MBED_CONF_APP_LORA_DIO2,
mbed_official 2:dc95ac6d6d4e 43 MBED_CONF_APP_LORA_DIO3,
mbed_official 2:dc95ac6d6d4e 44 MBED_CONF_APP_LORA_DIO4,
mbed_official 2:dc95ac6d6d4e 45 MBED_CONF_APP_LORA_DIO5,
mbed_official 2:dc95ac6d6d4e 46 MBED_CONF_APP_LORA_RF_SWITCH_CTL1,
mbed_official 2:dc95ac6d6d4e 47 MBED_CONF_APP_LORA_RF_SWITCH_CTL2,
mbed_official 2:dc95ac6d6d4e 48 MBED_CONF_APP_LORA_TXCTL,
mbed_official 2:dc95ac6d6d4e 49 MBED_CONF_APP_LORA_RXCTL,
mbed_official 2:dc95ac6d6d4e 50 MBED_CONF_APP_LORA_ANT_SWITCH,
mbed_official 2:dc95ac6d6d4e 51 MBED_CONF_APP_LORA_PWR_AMP_CTL,
mbed_official 2:dc95ac6d6d4e 52 MBED_CONF_APP_LORA_TCXO);
mbed_official 2:dc95ac6d6d4e 53
mbed_official 2:dc95ac6d6d4e 54 #elif (MBED_CONF_APP_LORA_RADIO == SX1276)
mbed_official 2:dc95ac6d6d4e 55
mbed_official 2:dc95ac6d6d4e 56 SX1276_LoRaRadio radio(MBED_CONF_APP_LORA_SPI_MOSI,
mbed_official 2:dc95ac6d6d4e 57 MBED_CONF_APP_LORA_SPI_MISO,
mbed_official 2:dc95ac6d6d4e 58 MBED_CONF_APP_LORA_SPI_SCLK,
mbed_official 2:dc95ac6d6d4e 59 MBED_CONF_APP_LORA_CS,
mbed_official 2:dc95ac6d6d4e 60 MBED_CONF_APP_LORA_RESET,
mbed_official 2:dc95ac6d6d4e 61 MBED_CONF_APP_LORA_DIO0,
mbed_official 2:dc95ac6d6d4e 62 MBED_CONF_APP_LORA_DIO1,
mbed_official 2:dc95ac6d6d4e 63 MBED_CONF_APP_LORA_DIO2,
mbed_official 2:dc95ac6d6d4e 64 MBED_CONF_APP_LORA_DIO3,
mbed_official 2:dc95ac6d6d4e 65 MBED_CONF_APP_LORA_DIO4,
mbed_official 2:dc95ac6d6d4e 66 MBED_CONF_APP_LORA_DIO5,
mbed_official 2:dc95ac6d6d4e 67 MBED_CONF_APP_LORA_RF_SWITCH_CTL1,
mbed_official 2:dc95ac6d6d4e 68 MBED_CONF_APP_LORA_RF_SWITCH_CTL2,
mbed_official 2:dc95ac6d6d4e 69 MBED_CONF_APP_LORA_TXCTL,
mbed_official 2:dc95ac6d6d4e 70 MBED_CONF_APP_LORA_RXCTL,
mbed_official 2:dc95ac6d6d4e 71 MBED_CONF_APP_LORA_ANT_SWITCH,
mbed_official 2:dc95ac6d6d4e 72 MBED_CONF_APP_LORA_PWR_AMP_CTL,
mbed_official 2:dc95ac6d6d4e 73 MBED_CONF_APP_LORA_TCXO);
mbed_official 2:dc95ac6d6d4e 74
mbed_official 2:dc95ac6d6d4e 75 #else
mbed_official 2:dc95ac6d6d4e 76 #error "Unknown LoRa radio specified (SX1272,SX1276 are valid)"
mbed_official 2:dc95ac6d6d4e 77 #endif
mbed_official 0:7037ed05f54f 78
mbed_official 3:8c7198d1a2a1 79 #endif //DEVICE_SPI
mbed_official 3:8c7198d1a2a1 80
mbed_official 3:8c7198d1a2a1 81 #endif //MBED_CONF_APP_LORAWAN_ENABLED
mbed_official 3:8c7198d1a2a1 82
mbed_official 0:7037ed05f54f 83 #endif /* APP_LORA_RADIO_HELPER_H_ */