mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			LoRa: Improved region macro handling
							parent
							
								
									1a86bb3604
								
							
						
					
					
						commit
						96610a6aed
					
				| 
						 | 
					@ -18,48 +18,70 @@
 | 
				
			||||||
#ifndef LORAPHY_TARGET
 | 
					#ifndef LORAPHY_TARGET
 | 
				
			||||||
#define LORAPHY_TARGET
 | 
					#define LORAPHY_TARGET
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define EU868 0
 | 
					 | 
				
			||||||
#define AS923 1
 | 
					 | 
				
			||||||
#define AU915 2
 | 
					 | 
				
			||||||
#define CN470 3
 | 
					 | 
				
			||||||
#define CN779 4
 | 
					 | 
				
			||||||
#define EU433 5
 | 
					 | 
				
			||||||
#define IN865 6
 | 
					 | 
				
			||||||
#define KR920 7
 | 
					 | 
				
			||||||
#define US915 8
 | 
					 | 
				
			||||||
#define US915_HYBRID 9
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifdef MBED_CONF_LORA_PHY
 | 
					#ifdef MBED_CONF_LORA_PHY
 | 
				
			||||||
 #if MBED_CONF_LORA_PHY      == EU868
 | 
					
 | 
				
			||||||
 | 
					#define LORA_REGION_EU868           0x10
 | 
				
			||||||
 | 
					#define LORA_REGION_AS923           0x11
 | 
				
			||||||
 | 
					#define LORA_REGION_AU915           0x12
 | 
				
			||||||
 | 
					#define LORA_REGION_CN470           0x13
 | 
				
			||||||
 | 
					#define LORA_REGION_CN779           0x14
 | 
				
			||||||
 | 
					#define LORA_REGION_EU433           0x15
 | 
				
			||||||
 | 
					#define LORA_REGION_IN865           0x16
 | 
				
			||||||
 | 
					#define LORA_REGION_KR920           0x17
 | 
				
			||||||
 | 
					#define LORA_REGION_US915           0x18
 | 
				
			||||||
 | 
					#define LORA_REGION_US915_HYBRID    0x19
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//DO NOT USE integer values in mbed_app.json!
 | 
				
			||||||
 | 
					//These are defined for backward compatibility and
 | 
				
			||||||
 | 
					//Will be DEPRECATED in the future
 | 
				
			||||||
 | 
					#define LORA_REGION_0       0x10
 | 
				
			||||||
 | 
					#define LORA_REGION_1       0x11
 | 
				
			||||||
 | 
					#define LORA_REGION_2       0x12
 | 
				
			||||||
 | 
					#define LORA_REGION_3       0x13
 | 
				
			||||||
 | 
					#define LORA_REGION_4       0x14
 | 
				
			||||||
 | 
					#define LORA_REGION_5       0x15
 | 
				
			||||||
 | 
					#define LORA_REGION_6       0x16
 | 
				
			||||||
 | 
					#define LORA_REGION_7       0x17
 | 
				
			||||||
 | 
					#define LORA_REGION_8       0x18
 | 
				
			||||||
 | 
					#define LORA_REGION_9       0x19
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//Since 0 would be equal to any undefined value we need to handle this in a other way
 | 
				
			||||||
 | 
					#define mbed_lora_concat_(x) LORA_REGION_##x
 | 
				
			||||||
 | 
					#define mbed_lora_concat(x) mbed_lora_concat_(x)
 | 
				
			||||||
 | 
					#define LORA_REGION mbed_lora_concat(MBED_CONF_LORA_PHY)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 #if LORA_REGION      == LORA_REGION_EU868
 | 
				
			||||||
  #include "lorawan/lorastack/phy/LoRaPHYEU868.h"
 | 
					  #include "lorawan/lorastack/phy/LoRaPHYEU868.h"
 | 
				
			||||||
  #define LoRaPHY_region LoRaPHYEU868
 | 
					  #define LoRaPHY_region LoRaPHYEU868
 | 
				
			||||||
 #elif MBED_CONF_LORA_PHY    == AS923
 | 
					 #elif LORA_REGION    == LORA_REGION_AS923
 | 
				
			||||||
  #include "lorawan/lorastack/phy/LoRaPHYAS923.h"
 | 
					  #include "lorawan/lorastack/phy/LoRaPHYAS923.h"
 | 
				
			||||||
  #define LoRaPHY_region LoRaPHYAS923
 | 
					  #define LoRaPHY_region LoRaPHYAS923
 | 
				
			||||||
 #elif MBED_CONF_LORA_PHY    == AU915
 | 
					 #elif LORA_REGION    == LORA_REGION_AU915
 | 
				
			||||||
  #include "lorawan/lorastack/phy/LoRaPHYAU915.h"
 | 
					  #include "lorawan/lorastack/phy/LoRaPHYAU915.h"
 | 
				
			||||||
 #define LoRaPHY_region LoRaPHYAU915;
 | 
					 #define LoRaPHY_region LoRaPHYAU915;
 | 
				
			||||||
 #elif MBED_CONF_LORA_PHY    == CN470
 | 
					 #elif LORA_REGION    == LORA_REGION_CN470
 | 
				
			||||||
  #include "lorawan/lorastack/phy/LoRaPHYCN470.h"
 | 
					  #include "lorawan/lorastack/phy/LoRaPHYCN470.h"
 | 
				
			||||||
  #define LoRaPHY_region LoRaPHYCN470
 | 
					  #define LoRaPHY_region LoRaPHYCN470
 | 
				
			||||||
 #elif MBED_CONF_LORA_PHY    == CN779
 | 
					 #elif LORA_REGION    == LORA_REGION_CN779
 | 
				
			||||||
  #include "lorawan/lorastack/phy/LoRaPHYCN779.h"
 | 
					  #include "lorawan/lorastack/phy/LoRaPHYCN779.h"
 | 
				
			||||||
  #define LoRaPHY_region LoRaPHYCN779
 | 
					  #define LoRaPHY_region LoRaPHYCN779
 | 
				
			||||||
 #elif MBED_CONF_LORA_PHY    == EU433
 | 
					 #elif LORA_REGION    == LORA_REGION_EU433
 | 
				
			||||||
  #include "lorawan/lorastack/phy/LoRaPHYEU433.h"
 | 
					  #include "lorawan/lorastack/phy/LoRaPHYEU433.h"
 | 
				
			||||||
  #define LoRaPHY_region LoRaPHYEU433
 | 
					  #define LoRaPHY_region LoRaPHYEU433
 | 
				
			||||||
 #elif MBED_CONF_LORA_PHY    == IN865
 | 
					 #elif LORA_REGION    == LORA_REGION_IN865
 | 
				
			||||||
  #include "lorawan/lorastack/phy/LoRaPHYIN865.h"
 | 
					  #include "lorawan/lorastack/phy/LoRaPHYIN865.h"
 | 
				
			||||||
  #define LoRaPHY_region LoRaPHYIN865
 | 
					  #define LoRaPHY_region LoRaPHYIN865
 | 
				
			||||||
 #elif MBED_CONF_LORA_PHY    == KR920
 | 
					 #elif LORA_REGION    == LORA_REGION_KR920
 | 
				
			||||||
  #include "lorawan/lorastack/phy/LoRaPHYKR920.h"
 | 
					  #include "lorawan/lorastack/phy/LoRaPHYKR920.h"
 | 
				
			||||||
  #define LoRaPHY_region LoRaPHYKR920
 | 
					  #define LoRaPHY_region LoRaPHYKR920
 | 
				
			||||||
 #elif MBED_CONF_LORA_PHY    == US915
 | 
					 #elif LORA_REGION    == LORA_REGION_US915
 | 
				
			||||||
  #include "lorawan/lorastack/phy/LoRaPHYUS915.h"
 | 
					  #include "lorawan/lorastack/phy/LoRaPHYUS915.h"
 | 
				
			||||||
  #define LoRaPHY_region LoRaPHYUS915
 | 
					  #define LoRaPHY_region LoRaPHYUS915
 | 
				
			||||||
 #elif MBED_CONF_LORA_PHY    == US915_HYBRID
 | 
					 #elif LORA_REGION    == LORA_REGION_US915_HYBRID
 | 
				
			||||||
  #include "lorawan/lorastack/phy/LoRaPHYUS915Hybrid.h"
 | 
					  #include "lorawan/lorastack/phy/LoRaPHYUS915Hybrid.h"
 | 
				
			||||||
  #define LoRaPHY_region LoRaPHYUS915Hybrid
 | 
					  #define LoRaPHY_region LoRaPHYUS915Hybrid
 | 
				
			||||||
 | 
					 #else
 | 
				
			||||||
 | 
					  #error "Invalid region configuration, update mbed_app.json with correct MBED_CONF_LORA_PHY value"
 | 
				
			||||||
 #endif //MBED_CONF_LORA_PHY == VALUE
 | 
					 #endif //MBED_CONF_LORA_PHY == VALUE
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
 #error "Must set LoRa PHY layer parameters."
 | 
					 #error "Must set LoRa PHY layer parameters."
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue