| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- /**
- ******************************************************************************
- * @file ui_task.c
- * @author Motor Control SDK Team, ST Microelectronics
- * @brief This file implementes user interface tasks definition
- *
- ******************************************************************************
- * @attention
- *
- * <h2><center>© Copyright (c) 2019 STMicroelectronics.
- * All rights reserved.</center></h2>
- *
- * This software component is licensed by ST under Ultimate Liberty license
- * SLA0044, the "License"; You may not use this file except in compliance with
- * the License. You may obtain a copy of the License at:
- * www.st.com/SLA0044
- *
- ******************************************************************************
- */
- /* Includes ------------------------------------------------------------------*/
- /* Pre-compiler coherency check */
- #include "ui_task.h"
- #include "mc_config.h"
- #include "parameters_conversion.h"
- #define OPT_DACX 0x20 /*!<Bit field indicating that the UI uses SPI AD7303 DAC.*/
- MCP_Handle_t * pMCP = MC_NULL;
- MCP_Handle_t MCP_UI_Params;
- static volatile uint16_t bUITaskCounter;
- static volatile uint16_t bCOMTimeoutCounter;
- static volatile uint16_t bCOMATRTimeCounter = SERIALCOM_ATR_TIME_TICKS;
- void UI_TaskInit( uint32_t* pUICfg, uint8_t bMCNum, MCI_Handle_t* pMCIList[],
- MCT_Handle_t* pMCTList[],const char* s_fwVer )
- {
- pMCP = &MCP_UI_Params;
- pMCP->_Super = UI_Params;
- UFCP_Init( & pUSART );
- MCP_Init(pMCP, (FCP_Handle_t *) & pUSART, & UFCP_Send, & UFCP_Receive, & UFCP_AbortReceive, s_fwVer);
- UI_Init( &pMCP->_Super, bMCNum, pMCIList, pMCTList, pUICfg ); /* Initialize UI and link MC components */
- }
- __weak void UI_Scheduler(void)
- {
- if(bUITaskCounter > 0u)
- {
- bUITaskCounter--;
- }
- if(bCOMTimeoutCounter > 1u)
- {
- bCOMTimeoutCounter--;
- }
- if(bCOMATRTimeCounter > 1u)
- {
- bCOMATRTimeCounter--;
- }
- }
- __weak MCP_Handle_t * GetMCP(void)
- {
- return pMCP;
- }
- __weak bool UI_IdleTimeHasElapsed(void)
- {
- bool retVal = false;
- if (bUITaskCounter == 0u)
- {
- retVal = true;
- }
- return (retVal);
- }
- __weak void UI_SetIdleTime(uint16_t SysTickCount)
- {
- bUITaskCounter = SysTickCount;
- }
- __weak bool UI_SerialCommunicationTimeOutHasElapsed(void)
- {
- bool retVal = false;
- if (bCOMTimeoutCounter == 1u)
- {
- bCOMTimeoutCounter = 0u;
- retVal = true;
- }
- return (retVal);
- }
- __weak bool UI_SerialCommunicationATRTimeHasElapsed(void)
- {
- bool retVal = false;
- if (bCOMATRTimeCounter == 1u)
- {
- bCOMATRTimeCounter = 0u;
- retVal = true;
- }
- return (retVal);
- }
- __weak void UI_SerialCommunicationTimeOutStop(void)
- {
- bCOMTimeoutCounter = 0u;
- }
- __weak void UI_SerialCommunicationTimeOutStart(void)
- {
- bCOMTimeoutCounter = SERIALCOM_TIMEOUT_OCCURENCE_TICKS;
- }
- /******************* (C) COPYRIGHT 2019 STMicroelectronics *****END OF FILE****/
|