Daniel Vizcaya / Mbed OS 04_RTOS_Embebidos
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers loraphy_target.h Source File

loraphy_target.h

00001 /**
00002  * Copyright (c) 2017, Arm Limited and affiliates.
00003  * SPDX-License-Identifier: Apache-2.0
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License");
00006  * you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 #ifndef LORAPHY_TARGET
00019 #define LORAPHY_TARGET
00020 
00021 #ifdef MBED_CONF_LORA_PHY
00022 
00023 #define LORA_REGION_EU868           0x10
00024 #define LORA_REGION_AS923           0x11
00025 #define LORA_REGION_AU915           0x12
00026 #define LORA_REGION_CN470           0x13
00027 #define LORA_REGION_CN779           0x14
00028 #define LORA_REGION_EU433           0x15
00029 #define LORA_REGION_IN865           0x16
00030 #define LORA_REGION_KR920           0x17
00031 #define LORA_REGION_US915           0x18
00032 #define LORA_REGION_US915_HYBRID    0x19
00033 
00034 //DO NOT USE integer values in mbed_app.json!
00035 //These are defined for backward compatibility and
00036 //Will be DEPRECATED in the future
00037 #define LORA_REGION_0       0x10
00038 #define LORA_REGION_1       0x11
00039 #define LORA_REGION_2       0x12
00040 #define LORA_REGION_3       0x13
00041 #define LORA_REGION_4       0x14
00042 #define LORA_REGION_5       0x15
00043 #define LORA_REGION_6       0x16
00044 #define LORA_REGION_7       0x17
00045 #define LORA_REGION_8       0x18
00046 #define LORA_REGION_9       0x19
00047 
00048 //Since 0 would be equal to any undefined value we need to handle this in a other way
00049 #define mbed_lora_concat_(x) LORA_REGION_##x
00050 #define mbed_lora_concat(x) mbed_lora_concat_(x)
00051 #define LORA_REGION mbed_lora_concat(MBED_CONF_LORA_PHY)
00052 
00053  #if LORA_REGION      == LORA_REGION_EU868
00054   #include "lorawan/lorastack/phy/LoRaPHYEU868.h"
00055   #define LoRaPHY_region LoRaPHYEU868
00056  #elif LORA_REGION    == LORA_REGION_AS923
00057   #include "lorawan/lorastack/phy/LoRaPHYAS923.h"
00058   #define LoRaPHY_region LoRaPHYAS923
00059  #elif LORA_REGION    == LORA_REGION_AU915
00060   #include "lorawan/lorastack/phy/LoRaPHYAU915.h"
00061  #define LoRaPHY_region LoRaPHYAU915
00062  #elif LORA_REGION    == LORA_REGION_CN470
00063   #include "lorawan/lorastack/phy/LoRaPHYCN470.h"
00064   #define LoRaPHY_region LoRaPHYCN470
00065  #elif LORA_REGION    == LORA_REGION_CN779
00066   #include "lorawan/lorastack/phy/LoRaPHYCN779.h"
00067   #define LoRaPHY_region LoRaPHYCN779
00068  #elif LORA_REGION    == LORA_REGION_EU433
00069   #include "lorawan/lorastack/phy/LoRaPHYEU433.h"
00070   #define LoRaPHY_region LoRaPHYEU433
00071  #elif LORA_REGION    == LORA_REGION_IN865
00072   #include "lorawan/lorastack/phy/LoRaPHYIN865.h"
00073   #define LoRaPHY_region LoRaPHYIN865
00074  #elif LORA_REGION    == LORA_REGION_KR920
00075   #include "lorawan/lorastack/phy/LoRaPHYKR920.h"
00076   #define LoRaPHY_region LoRaPHYKR920
00077  #elif LORA_REGION    == LORA_REGION_US915
00078   #include "lorawan/lorastack/phy/LoRaPHYUS915.h"
00079   #define LoRaPHY_region LoRaPHYUS915
00080  #elif LORA_REGION    == LORA_REGION_US915_HYBRID
00081   #include "lorawan/lorastack/phy/LoRaPHYUS915Hybrid.h"
00082   #define LoRaPHY_region LoRaPHYUS915Hybrid
00083  #else
00084   #error "Invalid region configuration, update mbed_app.json with correct MBED_CONF_LORA_PHY value"
00085  #endif //MBED_CONF_LORA_PHY == VALUE
00086 #else
00087  #error "Must set LoRa PHY layer parameters."
00088 #endif //MBED_CONF_LORA_PHY
00089 
00090 #endif // LORAPHY_TARGET
00091