src/apps/callback_handler.c
void VariablesInit( ) {
        
    if( InitalizeFactory == 0 ) {
        T_STORAGE_buff *ptr;
        
        BoardGetUniqueId( DevEui );
        ptr = &storageBuff[TYPE_DEVEUI];
        eepromWriteFactoryDefault(ptr);        
        
        ptr = &storageBuff[TYPE_APPEUI];
        eepromWriteFactoryDefault(ptr);
        
        ptr = &storageBuff[TYPE_APPKEY];
        eepromWriteFactoryDefault(ptr);
        
        ptr = &storageBuff[TYPE_APPSKEY];
        eepromWriteFactoryDefault(ptr);
        
        ptr = &storageBuff[TYPE_NWKSKEY];
        eepromWriteFactoryDefault(ptr);
        
       srand1( BoardGetRandomSeed( ) );

        // Choose a random device address
        Addr = randr( 0, 0x01FFFFFF );
        DevAddr[0] = Addr >> 24;
        DevAddr[1] = Addr >> 16;
        DevAddr[2] = Addr >> 8;
        DevAddr[3] = Addr;
        ptr = &storageBuff[TYPE_DEVADDR];
        eepromWriteFactoryDefault(ptr);
        
        ptr = &storageBuff[TYPE_VERSION];
        eepromWriteFactoryDefault(ptr);
        
        ptr = &storageBuff[TYPE_ADRSTATUS];
        eepromWriteFactoryDefault(ptr);
        
        ptr = &storageBuff[TYPE_APPPORT];
        eepromWriteFactoryDefault(ptr);
        
        ptr = &storageBuff[TYPE_DATARATE];
        eepromWriteFactoryDefault(ptr);
        
        factoryDefaultSetting( );
        
    } else {
        eepromReadBuffer( &storageBuff[TYPE_DEVEUI] ); 
    
        eepromReadBuffer( &storageBuff[TYPE_APPEUI] );
    
        eepromReadBuffer( &storageBuff[TYPE_APPKEY] );
    
        eepromReadBuffer( &storageBuff[TYPE_APPSKEY] );
    
        eepromReadBuffer( &storageBuff[TYPE_NWKSKEY] );
    
        eepromReadBuffer( &storageBuff[TYPE_DEVADDR] );
    
        eepromReadBuffer( &storageBuff[TYPE_VERSION] ); 
        
        eepromReadBuffer( &storageBuff[TYPE_ADRSTATUS] ); 
        
        eepromReadBuffer( &storageBuff[TYPE_APPPORT] ); 
        
        eepromReadBuffer( &storageBuff[TYPE_DATARATE] ); 
    }
}
/** Variables Init , Initialize gloable variables from eeprom when program start */
Variables Init , Initialize gloable variables from eeprom when program start
Variables Init Initialize gloable variables from eeprom when program start
void VariablesInit( ) {
    if( InitalizeFactory == 0 ) {
        T_STORAGE_buff *ptr;
        BoardGetUniqueId( DevEui );
        ptr = &storageBuff[TYPE_DEVEUI];
        eepromWriteFactoryDefault(ptr);        
        ptr = &storageBuff[TYPE_APPEUI];
        eepromWriteFactoryDefault(ptr);
        ptr = &storageBuff[TYPE_APPKEY];
        eepromWriteFactoryDefault(ptr);
        ptr = &storageBuff[TYPE_APPSKEY];
        eepromWriteFactoryDefault(ptr);
        ptr = &storageBuff[TYPE_NWKSKEY];
        eepromWriteFactoryDefault(ptr);
       srand1( BoardGetRandomSeed( ) );
        Addr = randr( 0, 0x01FFFFFF );
        DevAddr[0] = Addr >> 24;
        DevAddr[1] = Addr >> 16;
        DevAddr[2] = Addr >> 8;
        DevAddr[3] = Addr;
        ptr = &storageBuff[TYPE_DEVADDR];
        eepromWriteFactoryDefault(ptr);
        ptr = &storageBuff[TYPE_VERSION];
        eepromWriteFactoryDefault(ptr);
        ptr = &storageBuff[TYPE_ADRSTATUS];
        eepromWriteFactoryDefault(ptr);
        ptr = &storageBuff[TYPE_APPPORT];
        eepromWriteFactoryDefault(ptr);
        ptr = &storageBuff[TYPE_DATARATE];
        eepromWriteFactoryDefault(ptr);
        factoryDefaultSetting( );
    } else {
        eepromReadBuffer( &storageBuff[TYPE_DEVEUI] ); 
        eepromReadBuffer( &storageBuff[TYPE_APPEUI] );
        eepromReadBuffer( &storageBuff[TYPE_APPKEY] );
        eepromReadBuffer( &storageBuff[TYPE_APPSKEY] );
        eepromReadBuffer( &storageBuff[TYPE_NWKSKEY] );
        eepromReadBuffer( &storageBuff[TYPE_DEVADDR] );
        eepromReadBuffer( &storageBuff[TYPE_VERSION] ); 
        eepromReadBuffer( &storageBuff[TYPE_ADRSTATUS] ); 
        eepromReadBuffer( &storageBuff[TYPE_APPPORT] ); 
        eepromReadBuffer( &storageBuff[TYPE_DATARATE] ); 
    }
}
void VariablesInit ( ) { if ( InitalizeFactory == 0 ) { T_STORAGE_buff * ptr ; BoardGetUniqueId ( DevEui ) ; ptr = & storageBuff [ TYPE_DEVEUI ] ; eepromWriteFactoryDefault ( ptr ) ; ptr = & storageBuff [ TYPE_APPEUI ] ; eepromWriteFactoryDefault ( ptr ) ; ptr = & storageBuff [ TYPE_APPKEY ] ; eepromWriteFactoryDefault ( ptr ) ; ptr = & storageBuff [ TYPE_APPSKEY ] ; eepromWriteFactoryDefault ( ptr ) ; ptr = & storageBuff [ TYPE_NWKSKEY ] ; eepromWriteFactoryDefault ( ptr ) ; srand1 ( BoardGetRandomSeed ( ) ) ; Addr = randr ( 0 , 0x01FFFFFF ) ; DevAddr [ 0 ] = Addr >> 24 ; DevAddr [ 1 ] = Addr >> 16 ; DevAddr [ 2 ] = Addr >> 8 ; DevAddr [ 3 ] = Addr ; ptr = & storageBuff [ TYPE_DEVADDR ] ; eepromWriteFactoryDefault ( ptr ) ; ptr = & storageBuff [ TYPE_VERSION ] ; eepromWriteFactoryDefault ( ptr ) ; ptr = & storageBuff [ TYPE_ADRSTATUS ] ; eepromWriteFactoryDefault ( ptr ) ; ptr = & storageBuff [ TYPE_APPPORT ] ; eepromWriteFactoryDefault ( ptr ) ; ptr = & storageBuff [ TYPE_DATARATE ] ; eepromWriteFactoryDefault ( ptr ) ; factoryDefaultSetting ( ) ; } else { eepromReadBuffer ( & storageBuff [ TYPE_DEVEUI ] ) ; eepromReadBuffer ( & storageBuff [ TYPE_APPEUI ] ) ; eepromReadBuffer ( & storageBuff [ TYPE_APPKEY ] ) ; eepromReadBuffer ( & storageBuff [ TYPE_APPSKEY ] ) ; eepromReadBuffer ( & storageBuff [ TYPE_NWKSKEY ] ) ; eepromReadBuffer ( & storageBuff [ TYPE_DEVADDR ] ) ; eepromReadBuffer ( & storageBuff [ TYPE_VERSION ] ) ; eepromReadBuffer ( & storageBuff [ TYPE_ADRSTATUS ] ) ; eepromReadBuffer ( & storageBuff [ TYPE_APPPORT ] ) ; eepromReadBuffer ( & storageBuff [ TYPE_DATARATE ] ) ; } }
Variables Init , Initialize gloable variables from eeprom when program start
Variables Init Initialize gloable variables from eeprom when program start
// Choose a random device address