Example #1
0
/***********************************************************************************
* @fn          main
*
* @brief       This is the main entry of the "Light Switch" application.
*              After the application modes are chosen the switch can
*              send toggle commands to a light device.
*
* @param       basicRfConfig - file scope variable. Basic RF configuration
*              data
*              appState - file scope variable. Holds application state
*
* @return      none
*/
void main(void)
{
    uint8 appMode = NONE;

    // Config basicRF
    basicRfConfig.panId = PAN_ID;
    basicRfConfig.channel = RF_CHANNEL;
    basicRfConfig.ackRequest = TRUE;
#ifdef SECURITY_CCM
    basicRfConfig.securityKey = key;
#endif

    // Initalise board peripherals
    halBoardInit();
 //   halJoystickInit();

    // Initalise hal_rf
    if(halRfInit()==FAILED) {
      HAL_ASSERT(FALSE);
    }

    // Indicate that device is powered
    halLedSet(2);//*****************by boo LED2(P1_1=1)
    halLedClear(1);//***************by boo LED1(P1_0=0)
    
    /************Select one and shield to another***********by boo*/
    appSwitch();        //½ÚµãΪ°´¼üS1       P0_4    
    // Role is undefined. This code should not be reached
    HAL_ASSERT(FALSE);
}
Example #2
0
/*************************************************************************//**
*****************************************************************************/
void OTA_ClientNotification(OTA_Status_t status)
{
  if (OTA_UPGRADE_STARTED_STATUS == status)
  {
    if (appUpgradeInProgress)
      return; // Should not happen at all

    appUpgradeInProgress = true;
    appOtaAddr = STARTING_ADDRESS;
    appOtaSize = 0;
  }
  else if (OTA_UPGRADE_COMPLETED_STATUS == status)
  {
    appWritePage();
    appSwitch();
    appUpgradeInProgress = false;
  }
  else
  {
    // Some error happened, upgrade will be stopped.
    appUpgradeInProgress = false;
  }
}