/************************************************************************************************** * @fn Hal_ProcessPoll * * @brief This routine will be called by OSAL to poll UART, TIMER... * * @param task_id - Hal TaskId * * @return None **************************************************************************************************/ void Hal_ProcessPoll () { /* Timer Poll */ #if (defined HAL_TIMER) && (HAL_TIMER == TRUE) #error "The hal timer driver module is removed." #endif /* UART Poll */ #if (defined HAL_UART) && (HAL_UART == TRUE) HalUARTPoll(); #endif /* SPI Poll */ #if (defined HAL_SPI) && (HAL_SPI == TRUE) HalSpiPoll(); #endif /* HID poll */ #if (defined HAL_HID) && (HAL_HID == TRUE) usbHidProcessEvents(); #endif #if defined( POWER_SAVING ) /* Allow sleep before the next OSAL event loop */ ALLOW_SLEEP_MODE(); #endif }
/************************************************************************************************** * @fn Hal_ProcessPoll * * @brief This routine will be called by OSAL to poll UART, TIMER... * * @param task_id - Hal TaskId * * @return None **************************************************************************************************/ void Hal_ProcessPoll () { /* UART Poll */ #if (defined HAL_UART) && (HAL_UART == TRUE) HalUARTPoll(); #endif /* HID poll */ #if (defined HAL_HID) && (HAL_HID == TRUE) usbHidProcessEvents(); #endif #if defined( POWER_SAVING ) /* Allow sleep before the next OSAL event loop */ ALLOW_SLEEP_MODE(); #endif }
/************************************************************************************************** * @fn Hal_ProcessPoll * * @brief This routine will be called by OSAL to poll UART, TIMER... * * @param task_id - Hal TaskId * * @return None **************************************************************************************************/ void Hal_ProcessPoll () { #if (defined HAL_VDDMON) && (HAL_VDDMON == TRUE) HalVddMonPoll(); #endif #if ((defined HAL_I2C) && (HAL_I2C == TRUE) && (defined HAL_I2C_POLLED) && (HAL_I2C_POLLED == TRUE)) HalI2CPoll(); #endif #if (defined HAL_UART) && (HAL_UART == TRUE) HalUARTPoll(); #endif #if (defined HAL_SPI) && (HAL_SPI == TRUE) HalSpiPoll(); #endif #if (defined HAL_HID) && (HAL_HID == TRUE) extern void usbHidProcessEvents(void); usbHidProcessEvents(); #endif }
void Hal_ProcessPoll () { /* Timer Poll */ #if (defined HAL_TIMER) && (HAL_TIMER == TRUE) HalTimerTick(); // Àˬd²×¤îªºcounter #endif /* UART Poll */ #if (defined HAL_UART) && (HAL_UART == TRUE) HalUARTPoll(); // Poll the UART #endif /* SPI Poll */ #if (defined HAL_SPI) && (HAL_SPI == TRUE) HalSpiPoll(); #endif /* HID poll */ #if (defined HAL_HID) && (HAL_HID == TRUE) usbHidProcessEvents(); #endif }
/********************************************************************* * @fn HVACTest_Init * * @brief Initialization function for the Generic App Task. * This is called during initialization and should contain * any application specific initialization (ie. hardware * initialization/setup, table initialization, power up * notificaiton ... ). * * @param task_id - the ID assigned by OSAL. This ID should be * used to send messages and set timers. * * @return none */ void HVACTest_Init( uint8 task_id ) { HVACTest_TaskID = task_id; HVACTest_NwkState = DEV_INIT; HVACTest_TransID = 0; uint8 initVersion = 0; uint8 startupMsg[4] = {0xFF,0xFF,0,0}; // use this code to trick compiler initVersion = firm_version + hardware_version + chip_version; (void)initVersion; // Device hardware initialization can be added here or in main() (Zmain.c). // If the hardware is application specific - add it here. // If the hardware is other parts of the device add it in main(). hvac_STM32ResetInit(); // Register UART, init UART MT_UartInit (); MT_UartRegisterTaskID (HVACTest_TaskID); HVACTest_DstAddr.addrMode = (afAddrMode_t)AddrNotPresent; HVACTest_DstAddr.endPoint = HVACQUEEN_ENDPOINT; HVACTest_DstAddr.addr.shortAddr = 0; // Fill out the endpoint description. HVACTest_epDesc.endPoint = HVACQUEEN_ENDPOINT; HVACTest_epDesc.task_id = &HVACTest_TaskID; HVACTest_epDesc.simpleDesc = (SimpleDescriptionFormat_t *)&HVACTest_SimpleDesc; HVACTest_epDesc.latencyReq = noLatencyReqs; // Register the endpoint description with the AF afRegister( &HVACTest_epDesc ); // Register ZDO Message ZDO_RegisterForZDOMsg( HVACTest_TaskID, Device_annce ); ZDO_RegisterForZDOMsg( HVACTest_TaskID, End_Device_Bind_rsp ); ZDO_RegisterForZDOMsg( HVACTest_TaskID, Match_Desc_rsp ); // Init critical resource ptl0_initPTL0Status(); // check valid MAC address? // // If a mac address copy is valid in flash, send "FF FF FF" Msg to // STM32 and start the zigbee network. // // If not, send "FF FF 00" Msg to STM32, and prepare to handle MAC // address message. // // The forth byte is the firmware version // Test program, no need init white list // However, to disable any device to join, enable the empty white list function // Add firmware version startupMsg[3] = firm_version; // send valid flash startup mag while(HalUARTWrite(0, startupMsg, 4) != 4) { #ifdef WDT_IN_PM1 // clear WDT WDCTL |= WDCLP1; WDCTL |= WDCLP2; #endif HalUARTPoll(); } // start network directly, form a network and check ZDOInitDevice(0); // Init timer osal_start_timerEx( HVACTest_TaskID, HVAC_PTL0_GUT_EVT, HVAC_PTL0_FAIL_TIMEOUT ); // WDT #ifdef WDT_IN_PM1 // Start WDT reset timer osal_start_timerEx( HVACTest_TaskID, HVAC_WDT_CLEAR_EVT, HVAC_WDT_CLEAR_TIMEOUT ); #endif #if defined( IAR_ARMCM3_LM ) // Register this task with RTOS task initiator RTOS_RegisterApp( task_id, HVACQUEEN_RTOS_MSG_EVT ); #endif }