Lorawan to Pulga

Dependencies:   pulga-lorawan-drv SPI_MX25R Si1133 BME280

Committer:
mbed_official
Date:
Tue Sep 03 14:01:54 2019 +0100
Revision:
57:36e87c44c920
Parent:
53:1b6c71e938ac
Merge pull request #140 from bentcooke/add_sx126x

add SX126X radio option and update driver lib
.
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 #ifndef APP_LORA_RADIO_HELPER_H_
mbed_official 0:7037ed05f54f 19 #define APP_LORA_RADIO_HELPER_H_
mbed_official 0:7037ed05f54f 20
mbed_official 53:1b6c71e938ac 21 #include "lorawan/LoRaRadio.h"
mbed_official 53:1b6c71e938ac 22
mbed_official 2:dc95ac6d6d4e 23 #define SX1272 0xFF
mbed_official 2:dc95ac6d6d4e 24 #define SX1276 0xEE
mbed_official 57:36e87c44c920 25 #define SX126X 0xDD
mbed_official 2:dc95ac6d6d4e 26
mbed_official 2:dc95ac6d6d4e 27 #if (MBED_CONF_APP_LORA_RADIO == SX1272)
mbed_official 57:36e87c44c920 28 #include "SX1272_LoRaRadio.h"
mbed_official 46:a124538e2891 29 SX1272_LoRaRadio radio(MBED_CONF_APP_LORA_SPI_MOSI,
mbed_official 46:a124538e2891 30 MBED_CONF_APP_LORA_SPI_MISO,
mbed_official 46:a124538e2891 31 MBED_CONF_APP_LORA_SPI_SCLK,
mbed_official 46:a124538e2891 32 MBED_CONF_APP_LORA_CS,
mbed_official 46:a124538e2891 33 MBED_CONF_APP_LORA_RESET,
mbed_official 46:a124538e2891 34 MBED_CONF_APP_LORA_DIO0,
mbed_official 46:a124538e2891 35 MBED_CONF_APP_LORA_DIO1,
mbed_official 46:a124538e2891 36 MBED_CONF_APP_LORA_DIO2,
mbed_official 46:a124538e2891 37 MBED_CONF_APP_LORA_DIO3,
mbed_official 46:a124538e2891 38 MBED_CONF_APP_LORA_DIO4,
mbed_official 46:a124538e2891 39 MBED_CONF_APP_LORA_DIO5,
mbed_official 46:a124538e2891 40 MBED_CONF_APP_LORA_RF_SWITCH_CTL1,
mbed_official 46:a124538e2891 41 MBED_CONF_APP_LORA_RF_SWITCH_CTL2,
mbed_official 46:a124538e2891 42 MBED_CONF_APP_LORA_TXCTL,
mbed_official 46:a124538e2891 43 MBED_CONF_APP_LORA_RXCTL,
mbed_official 46:a124538e2891 44 MBED_CONF_APP_LORA_ANT_SWITCH,
mbed_official 46:a124538e2891 45 MBED_CONF_APP_LORA_PWR_AMP_CTL,
mbed_official 46:a124538e2891 46 MBED_CONF_APP_LORA_TCXO);
mbed_official 2:dc95ac6d6d4e 47
mbed_official 2:dc95ac6d6d4e 48 #elif (MBED_CONF_APP_LORA_RADIO == SX1276)
mbed_official 57:36e87c44c920 49 #include "SX1276_LoRaRadio.h"
mbed_official 46:a124538e2891 50 SX1276_LoRaRadio radio(MBED_CONF_APP_LORA_SPI_MOSI,
mbed_official 46:a124538e2891 51 MBED_CONF_APP_LORA_SPI_MISO,
mbed_official 46:a124538e2891 52 MBED_CONF_APP_LORA_SPI_SCLK,
mbed_official 46:a124538e2891 53 MBED_CONF_APP_LORA_CS,
mbed_official 46:a124538e2891 54 MBED_CONF_APP_LORA_RESET,
mbed_official 46:a124538e2891 55 MBED_CONF_APP_LORA_DIO0,
mbed_official 46:a124538e2891 56 MBED_CONF_APP_LORA_DIO1,
mbed_official 46:a124538e2891 57 MBED_CONF_APP_LORA_DIO2,
mbed_official 46:a124538e2891 58 MBED_CONF_APP_LORA_DIO3,
mbed_official 46:a124538e2891 59 MBED_CONF_APP_LORA_DIO4,
mbed_official 46:a124538e2891 60 MBED_CONF_APP_LORA_DIO5,
mbed_official 46:a124538e2891 61 MBED_CONF_APP_LORA_RF_SWITCH_CTL1,
mbed_official 46:a124538e2891 62 MBED_CONF_APP_LORA_RF_SWITCH_CTL2,
mbed_official 46:a124538e2891 63 MBED_CONF_APP_LORA_TXCTL,
mbed_official 46:a124538e2891 64 MBED_CONF_APP_LORA_RXCTL,
mbed_official 46:a124538e2891 65 MBED_CONF_APP_LORA_ANT_SWITCH,
mbed_official 46:a124538e2891 66 MBED_CONF_APP_LORA_PWR_AMP_CTL,
mbed_official 46:a124538e2891 67 MBED_CONF_APP_LORA_TCXO);
mbed_official 2:dc95ac6d6d4e 68
mbed_official 57:36e87c44c920 69 #elif (MBED_CONF_APP_LORA_RADIO == SX126X)
mbed_official 57:36e87c44c920 70 #include "SX126X_LoRaRadio.h"
mbed_official 57:36e87c44c920 71 SX126X_LoRaRadio radio(MBED_CONF_APP_LORA_SPI_MOSI,
mbed_official 57:36e87c44c920 72 MBED_CONF_APP_LORA_SPI_MISO,
mbed_official 57:36e87c44c920 73 MBED_CONF_APP_LORA_SPI_SCLK,
mbed_official 57:36e87c44c920 74 MBED_CONF_APP_LORA_CS,
mbed_official 57:36e87c44c920 75 MBED_CONF_APP_LORA_RESET,
mbed_official 57:36e87c44c920 76 MBED_CONF_APP_LORA_DIO1,
mbed_official 57:36e87c44c920 77 MBED_CONF_APP_LORA_BUSY,
mbed_official 57:36e87c44c920 78 MBED_CONF_APP_LORA_FREQ_SEL,
mbed_official 57:36e87c44c920 79 MBED_CONF_APP_LORA_DEV_SEL,
mbed_official 57:36e87c44c920 80 MBED_CONF_APP_LORA_XTAL_SEL,
mbed_official 57:36e87c44c920 81 MBED_CONF_APP_LORA_ANT_SWITCH);
mbed_official 57:36e87c44c920 82
mbed_official 2:dc95ac6d6d4e 83 #else
mbed_official 57:36e87c44c920 84 #error "Unknown LoRa radio specified (SX126X, SX1272, SX1276 are valid)"
mbed_official 2:dc95ac6d6d4e 85 #endif
mbed_official 0:7037ed05f54f 86
mbed_official 0:7037ed05f54f 87 #endif /* APP_LORA_RADIO_HELPER_H_ */