/************************************************************************** * * Copyright (c) 2019-2019 Diality Inc. - All Rights Reserved. * * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. * * @file TaskGeneral.c * * @date 19-Sep-2019 * @author S. Nash * * @brief General task handler. * **************************************************************************/ //#include "gio.h" #include "Common.h" #include "AlarmLamp.h" #include "OperationModes.h" #include "SystemComm.h" #include "WatchdogMgmt.h" #include "TaskGeneral.h" #include "RTC.h" #ifdef RM46_EVAL_BOARD_TARGET #include "CPLD.h" #include "SystemCommMessages.h" static BOOL lastUserPress = FALSE; #endif /************************************************************************* * @brief taskGeneral * The taskGeneral function handles the scheduled General Task interrupt.\n * Calls the executive functions for most monitors and controllers, the\n * operation modes, the system communications, and alarms.\n * @details * Inputs : none * Outputs : Executive for the TBD called. * @param none * @return none *************************************************************************/ void taskGeneral( void ) { // check in with watchdog manager checkInWithWatchdogMgmt( TASK_GENERAL ); // do this first to keep timing consistent with watchdog management // manage data received from other sub-systems //execSystemCommRx(); // FOR DEBUGGING PURPOSES ONLY REMOVE // PLEASE DO NOT REVIEW THIS CODE // Used 120 and 200 so it will not read or write during POST /*static U16 test = 0; RTC_RAM_STATUS_T status = getRTCRAMStatus(); RTC_RAM_STATE_T state = getRTCRAMState(); static U16 returndata[5]; static BOOL readRAM = FALSE; static U16 data[5]; if ( test >=120 && test%120 == 0 ) { if ( state == RTC_RAM_STATE_READY ) { U16 test1 = test/10; data[0] = test1; data[1] = test1+1; data[2] = test1+2; data[3] = test1+3; data[4] = test1+4; status = writeToRAM(122, &data[0], 5); } } if ( test >= 120 && test%133 == 0 ) { if ( state == RTC_RAM_STATE_READY ) { readFromRAM(122, 5); readRAM = TRUE; } } else if ( status == RTC_RAM_STATUS_IDLE && readRAM) { getDataFromRAM(&returndata[0], 5); readRAM = FALSE; } test++; */ // FOR DEBUGGING PURPOSES ONLY REMOVE // PLEASE DO NOT REVIEW THIS CODE // Control RTC // After CommRx and and before execOperationModes() execRTC(); // run operation mode state machine execOperationModes(); // manage alarm state //execAlarmMgmt(); // control alarm lamp execAlarmLamp(); #ifdef RM46_EVAL_BOARD_TARGET if ( getUserButtonState() == PIN_SIGNAL_LOW ) { if ( lastUserPress == FALSE ) { lastUserPress = TRUE; setUserLED( FALSE ); sendOffButtonMsgToUI(); } } else { lastUserPress = FALSE; } #endif // manage data to be transmitted to other sub-systems //execSystemCommTx(); // toggle GPIO to indicate general task has executed // gioToggleBit( gioPORTB, 1 ); }