update headers
This commit is contained in:
@ -30,17 +30,16 @@
|
||||
// Description: List of required include files.
|
||||
//=================================================================================================
|
||||
|
||||
#include "../PDEF_ProjectDefinitions.h"
|
||||
#include "MAIN_MainApplication.h"
|
||||
|
||||
// Application
|
||||
#include "VARH_VariableHandler.h"
|
||||
#include "PECO_PeltierController.h"
|
||||
|
||||
// Drivers
|
||||
#include "../Drivers/TEMP_Temperature.h"
|
||||
#include "../Drivers/DIPO_DigitalPorts.h"
|
||||
#include "../Drivers/CAND_CanDriver.h"
|
||||
#include "PECO_PeltierController.h"
|
||||
#include "../Drivers/ANPI_AnalogPortsIn.h"
|
||||
|
||||
// Toolbox
|
||||
@ -126,12 +125,11 @@ LOCAL CONST osThreadAttr_t stTaskAttribute =
|
||||
0, // size of provided memory for control block
|
||||
NULL, // memory for stack
|
||||
1024, // size of stack
|
||||
osPriorityNormal, // initial thread priority (default: osPriorityNormal)
|
||||
osPriorityAboveNormal1, // initial thread priority (default: osPriorityNormal)
|
||||
0, // TrustZone module identifier
|
||||
0, // reserved (must be 0)
|
||||
};
|
||||
|
||||
|
||||
LOCAL CONST osMessageQueueAttr_t stCANRxMsgQueueAttribute =
|
||||
{
|
||||
"MAIN_CAN_Rx_Queue", // name of the message queue
|
||||
@ -142,8 +140,6 @@ LOCAL CONST osMessageQueueAttr_t stCANRxMsgQueueAttribute =
|
||||
0, // size of provided memory for data storage
|
||||
};
|
||||
|
||||
|
||||
|
||||
LOCAL CONST osEventFlagsAttr_t stEventAttribute =
|
||||
{
|
||||
"MAIN_Event_Flags", // name of the event flags
|
||||
@ -232,34 +228,35 @@ PRIVATE VOID vTask( PVOID arg )
|
||||
while( TRUE )
|
||||
{
|
||||
|
||||
u32Flags = osEventFlagsWait( m_pstEventID, EVENT_FLAGS_ALL, osFlagsWaitAny, osWaitForever );
|
||||
u32Flags = osEventFlagsWait( m_pstEventID, EVENT_FLAGS_ALL, osFlagsWaitAny, osWaitForever ); // wait until flags getting triggered
|
||||
|
||||
if( u32Flags & EVENT_NEW_MESSAGE ) {
|
||||
if( u32Flags & EVENT_NEW_MESSAGE ) { // New message from CAN
|
||||
|
||||
CAND_Message stMessage;
|
||||
osMessageQueueGet( m_pstCANRxMsgQueueID, &stMessage, NULL, 0 );
|
||||
osMessageQueueGet( m_pstCANRxMsgQueueID, &stMessage, NULL, 0 ); // get message from queue
|
||||
|
||||
U8 u8Register = stMessage.au8Data[0];
|
||||
U8 u8Type = stMessage.u8Type;
|
||||
|
||||
if( u8Type == MESSAGE_TYPE_READ ){
|
||||
if( u8Register >= VARH_eNumberOfVariables ){
|
||||
au8Buffer[0] = 0xFF;
|
||||
if( u8Type == MESSAGE_TYPE_READ ){ // Message type read
|
||||
if( u8Register >= VARH_eNumberOfVariables ){ // check register
|
||||
// send register not found
|
||||
au8Buffer[0] = 0xFF;
|
||||
CAND_boSendMessage( au8Buffer, 1 );
|
||||
} else {
|
||||
VARH_UVariable uVariable = VARH_uGetVariableData(u8Register);
|
||||
VARH_UVariable uVariable = VARH_uGetVariableData(u8Register); // get data
|
||||
au8Buffer[0] = u8Register;
|
||||
UTIL_vMemCopy(&uVariable, &au8Buffer[1], 4);
|
||||
UTIL_vMemCopy(&uVariable, &au8Buffer[1], 4); // copy data in buffer
|
||||
|
||||
CAND_boSendMessage( au8Buffer, 5 );
|
||||
}
|
||||
|
||||
} else if( u8Type == MESSAGE_TYPE_WRITE ){
|
||||
} else if( u8Type == MESSAGE_TYPE_WRITE ){ // Message type write
|
||||
VARH_UVariable uData;
|
||||
UTIL_vMemCopy(&stMessage.au8Data[1], &uData, 4);
|
||||
|
||||
VARH_vSetVariableData(u8Register, uData);
|
||||
} else if( u8Type == MESSAGE_TYPE_COMMAND ){
|
||||
} else if( u8Type == MESSAGE_TYPE_COMMAND ){ // Message type command
|
||||
|
||||
switch (u8Register)
|
||||
{
|
||||
@ -271,7 +268,7 @@ PRIVATE VOID vTask( PVOID arg )
|
||||
PECO_Enable( FALSE );
|
||||
break;
|
||||
case COMMAND_WATCHDOG:
|
||||
osTimerStart( m_pstWatchdogTimer, WATCHDOG )
|
||||
osTimerStart( m_pstWatchdogTimer, WATCHDOG );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
Reference in New Issue
Block a user