new code ani

Dependencies:   mbed

Revision:
15:6d177c1f6a15
Parent:
14:fd17c5190f79
--- a/app/main.cpp	Wed Jul 24 15:21:23 2019 +0000
+++ b/app/main.cpp	Mon Dec 02 16:01:33 2019 +0000
@@ -83,13 +83,9 @@
 /*!
  * User application data buffer size
  */
-#if ( LORAWAN_CONFIRMED_MSG_ON == 1 )
-#define LORAWAN_APP_DATA_SIZE                       6
+#define LORAWAN_APP_DATA_SIZE                       41
 
-#else
-#define LORAWAN_APP_DATA_SIZE                       1
 
-#endif
 
 static uint8_t DevEui[] = LORAWAN_DEVICE_EUI;
 static uint8_t AppEui[] = LORAWAN_APPLICATION_EUI;
@@ -216,7 +212,7 @@
 
 
 // Application Globals
-DigitalOut myled(D6);
+DigitalOut myled(D7);
 
 
 
@@ -543,6 +539,18 @@
                     mibReq.Type = MIB_ADR;
                     mibReq.Param.AdrEnable = true;
                     LoRaMacMibSetRequestConfirm( &mibReq );
+                    
+                  // Limiting to just 2nd subband of 8 channels
+                static uint16_t GatewayChannelsMask[] = {0xFF00, 0x0000, 0x0000, 0x0000, 0x0002, 0x0000};
+                mibReq.Type = MIB_CHANNELS_DEFAULT_MASK;
+                mibReq.Param.ChannelsDefaultMask = GatewayChannelsMask;
+                LoRaMacMibSetRequestConfirm( &mibReq );
+ 
+                mibReq.Type = MIB_CHANNELS_MASK;
+                mibReq.Param.ChannelsMask = GatewayChannelsMask;
+                LoRaMacMibSetRequestConfirm( &mibReq );
+                    
+                    
 
 #if defined( USE_BAND_868 )
                     LoRaMacTestSetDutyCycleOn( false );
@@ -709,9 +717,9 @@
 
 void flash_builtin() {
     myled = 1;   // turn the LED on (HIGH is the voltage level)
-    wait(2);                       // wait for a second
+    wait(2);                       // wait for 2 second
     myled = 0;    // turn the LED off by making the voltage LOW
-    wait(1);
+    wait(1);    // wait for 1 second
 }
 
 /**
@@ -726,16 +734,26 @@
 
     HAL_StatusTypeDef status;
 
-#if defined(TARGET_NUCLEO_L073RZ) || defined(TARGET_NUCLEO_L152RE)
+#if defined(TARGET_NUCLEO_F411RE)
+    /* Start HSE first */
+    RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
+    RCC_OscInitStruct.HSEState       = RCC_HSE_ON; 
+    RCC_OscInitStruct.PLL.PLLState   = RCC_PLL_NONE;
+    
+    
+    
+
+    
+    
+    
+#elif defined(TARGET_NUCLEO_L073RZ) || defined(TARGET_NUCLEO_L152RE)
     /* To clear HSE_BYPASS, we need to stop HSE first */
     RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
     RCC_OscInitStruct.HSEState       = RCC_HSE_OFF;
     RCC_OscInitStruct.PLL.PLLState   = RCC_PLL_NONE;
-#elif defined(TARGET_NUCLEO_F411RE)
-    /* Start HSE first */
-    RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
-    RCC_OscInitStruct.HSEState       = RCC_HSE_ON; 
-    RCC_OscInitStruct.PLL.PLLState   = RCC_PLL_NONE;
+    
+    
+    
 #else
 #error "!! Target not supported.";
 #endif
@@ -989,6 +1007,20 @@
                 mibReq.Type = MIB_PUBLIC_NETWORK;
                 mibReq.Param.EnablePublicNetwork = LORAWAN_PUBLIC_NETWORK;
                 LoRaMacMibSetRequestConfirm( &mibReq );
+                
+                
+             // Limiting to just 2nd subband of 8 channels
+                static uint16_t GatewayChannelsMask[] = {0xFF00, 0x0000, 0x0000, 0x0000, 0x0002, 0x0000};
+                mibReq.Type = MIB_CHANNELS_DEFAULT_MASK;
+                mibReq.Param.ChannelsDefaultMask = GatewayChannelsMask;
+                LoRaMacMibSetRequestConfirm( &mibReq );
+ 
+                mibReq.Type = MIB_CHANNELS_MASK;
+                mibReq.Param.ChannelsMask = GatewayChannelsMask;
+                LoRaMacMibSetRequestConfirm( &mibReq );
+                
+                
+                
 
 #if defined( USE_BAND_868 )
                 LoRaMacTestSetDutyCycleOn( LORAWAN_DUTYCYCLE_ON );