/**************************************************************************** * * NAME: vActionOnButtonActivationAfterDeepSleep * * DESCRIPTION: * When we wake up, we have restarted so we need to manually check to see * what Dio woke us. Start the ButtonScanTask and disable wake interrupts * ****************************************************************************/ PUBLIC void vActionOnButtonActivationAfterDeepSleep(void) { DBG_vPrintf(TRACE_APP_BUTTON, "\nAPP Button: Interrupt Status = %d", u32AHI_DioInterruptStatus()); u32DioInterrupts |= APP_BUTTONS_DIO_MASK; vAHI_DioWakeEnable(0, u32DioInterrupts); OS_eActivateTask(APP_ButtonsScanTask); }
/**************************************************************************** * * NAME: aupsSendApiFrm * * DESCRIPTION: * send a api frame into the stream processor * * PARAMETERS: Name RW Usage * dst W Pointer to destination of the buffer * len R number of the bytes you want to read * RETURNS: * uint8: real number of bytes you read * ****************************************************************************/ PUBLIC uint8 aupsSendApiFrm(void *data, int len) { uint32 avlb_cnt = SPM_u32PushData(data, len); if (avlb_cnt >= THRESHOLD_READ) { OS_eActivateTask(APP_taskHandleUartRx); //Activate SPM immediately } else { vResetATimer(APP_tmrHandleUartRx, APP_TIME_MS(5)); //Activate SPM 5ms later } }
/**************************************************************************** * * NAME: clientOtaRestartDownload * * DESCRIPTION: * restart OTA download when crc check failed * * PARAMETERS: Name RW Usage * None * * RETURNS: * void * ****************************************************************************/ void clientOtaRestartDownload() { if (g_sDevice.otaTotalBytes == 0) { DBG_vPrintf(TRACE_EP, "otaTotalBytes info lost, cant restart download. \r\n"); return; } // restart the downloading g_sDevice.otaCurBlock = 0; g_sDevice.otaDownloading = 1; DBG_vPrintf(TRACE_EP, "restart downloading... \r\n"); PDM_vSaveRecord(&g_sDevicePDDesc); //erase covered sectors APP_vOtaFlashLockEraseAll(); //start the ota task OS_eActivateTask(APP_taskOTAReq); }
/**************************************************************************** * * NAME: vHandleConfigureNetworkEvent * * DESCRIPTION: * Handles stack events when the Controller is in its network configuration state * * PARAMETERS: Name RW Usage * sStackEvent R Contains details of the stack event * * RETURNS: * Sequence number * ****************************************************************************/ PRIVATE void vHandleConfigureNetworkEvent(ZPS_tsAfEvent sStackEvent, APP_tsEvent sAppEvent) { /* * respond to button presses on the splash screen to configure the * network channel number. */ if (APP_E_EVENT_BUTTON_UP == sAppEvent.eType) { if (APP_E_BUTTONS_BUTTON_2 == sAppEvent.sButton.u8Button) { /* perform action channel up action */ if (26 > s_sDevice.u8CurrentRadioChan) { s_sDevice.u8CurrentRadioChan++; APP_vDisplayUpdate(); } } else if (APP_E_BUTTONS_BUTTON_3 == sAppEvent.sButton.u8Button) { /* perform action channel down action */ if (11 < s_sDevice.u8CurrentRadioChan) { s_sDevice.u8CurrentRadioChan--; APP_vDisplayUpdate(); } } else if (APP_E_BUTTONS_BUTTON_4 == sAppEvent.sButton.u8Button) { /* Start ZBPro stack from a low priority task to allow the display * to be updated */ APP_vDisplaySetState(APP_E_DISPLAY_STATE_NETWORK_STARTUP); APP_vDisplayUpdate(); OS_eActivateTask(APP_StartZBProStack); } } }