add ANPI to VARH
This commit is contained in:
@ -23,36 +23,26 @@
|
||||
//
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
|
||||
//=================================================================================================
|
||||
// Section: INCLUDES
|
||||
// Description: List of required include files.
|
||||
//=================================================================================================
|
||||
|
||||
#include "../Application/VARH_VariableHandler.h"
|
||||
#include "../PDEF_ProjectDefinitions.h"
|
||||
#include "TEMP_Temperature.h"
|
||||
|
||||
// Application
|
||||
//#include "../Application/ELOG_ErrorLogger.h"
|
||||
//#include "../Application/RTOS_RealTimeOs.h"
|
||||
#include "../Application/VARH_VariableHandler.h"
|
||||
|
||||
// Toolbox
|
||||
//#include "../Toolbox/ASRT_Assert.h"
|
||||
#include "../Toolbox/UTIL_Utility.h"
|
||||
|
||||
// Drivers
|
||||
|
||||
#include "DIPO_DigitalPorts.h"
|
||||
#include "SPID_SpiDriver.h"
|
||||
#include "ADCD_ADCDriver.h"
|
||||
|
||||
// include STM32 drivers
|
||||
#include "stm32l4xx_hal.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "cmsis_os2.h"
|
||||
|
||||
//=================================================================================================
|
||||
@ -90,7 +80,6 @@ PRIVATE VOID vTempTask( PVOID arg );
|
||||
// Description: Definition of local constants (visible by this module only).
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
LOCAL CONST osThreadAttr_t stTaskAttribute =
|
||||
{
|
||||
"TEMP_Thread", // name of the thread
|
||||
@ -116,15 +105,11 @@ LOCAL osThreadId_t m_pstThreadID = NULL;
|
||||
// Description: Definition of external (global) functions.
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
|
||||
//=================================================================================================
|
||||
// Section: EXTERNAL VARIABLES
|
||||
// Description: Definition of external (global) variables.
|
||||
//=================================================================================================
|
||||
|
||||
|
||||
|
||||
//=================================================================================================
|
||||
// Section: GLOBAL FUNCTIONS
|
||||
// Description: Definition (implementation) of global functions.
|
||||
@ -171,70 +156,19 @@ PRIVATE VOID vTempTask( PVOID arg )
|
||||
|
||||
while( TRUE )
|
||||
{
|
||||
|
||||
|
||||
//u32Flags = osEventFlagsWait( m_pstEventID, EVENT_REFRESH, osFlagsWaitAny, osWaitForever );
|
||||
boOK &= ADCD_dReadData(ADCD_eHot, &error, &u16ADC_data[ADCD_eHot]);
|
||||
boOK &= ADCD_dReadData(ADCD_eCold, &error, &u16ADC_data[ADCD_eCold]);
|
||||
if( boOK )
|
||||
{
|
||||
flTempData[ADCD_eHot] = flConvertADCData( u16ADC_data[ADCD_eHot] );
|
||||
flTempData[ADCD_eCold] = flConvertADCData( u16ADC_data[ADCD_eCold] );
|
||||
VARH_vSetVariableDataFromSystem( VARH_eTemp_H, (VARH_UVariable)flTempData[ADCD_eHot] );
|
||||
VARH_vSetVariableDataFromSystem( VARH_eTemp_C, (VARH_UVariable)flTempData[ADCD_eCold] );
|
||||
VARH_vSetVariableDataFromSystem( VARH_eTemp_Diff, (VARH_UVariable)(flTempData[ADCD_eHot] - flTempData[ADCD_eCold]) );
|
||||
|
||||
//if( u32Flags & EVENT_REFRESH )
|
||||
//{
|
||||
boOK &= ADCD_dReadData(ADCD_eHot, &error, &u16ADC_data[ADCD_eHot]);
|
||||
boOK &= ADCD_dReadData(ADCD_eCold, &error, &u16ADC_data[ADCD_eCold]);
|
||||
if( boOK )
|
||||
{
|
||||
flTempData[ADCD_eHot] = flConvertADCData( u16ADC_data[ADCD_eHot] );
|
||||
flTempData[ADCD_eCold] = flConvertADCData( u16ADC_data[ADCD_eCold] );
|
||||
VARH_vSetVariableData( VARH_eTemp_H, (VARH_UVariable)flTempData[ADCD_eHot] );
|
||||
VARH_vSetVariableData( VARH_eTemp_C, (VARH_UVariable)flTempData[ADCD_eCold] );
|
||||
VARH_vSetVariableData( VARH_eTemp_Diff, (VARH_UVariable)(flTempData[ADCD_eHot] - flTempData[ADCD_eCold]) );
|
||||
}
|
||||
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
|
||||
osDelay(REFRESH_MS);
|
||||
|
||||
|
||||
|
||||
|
||||
// wait for ADC conversions completed
|
||||
// u32Flags = osEventFlagsWait( m_pstEventID, OS_EVENT_ADC_COMPLETED_FLAG, osFlagsWaitAll , ADC_TIMEOUT_MS );
|
||||
// boTimeout = (u32Flags == osFlagsErrorTimeout) ? TRUE : FALSE;
|
||||
// boError = FALSE;
|
||||
//
|
||||
// // check if we have a timeout
|
||||
// if( boTimeout )
|
||||
// {
|
||||
// //ELOG_ADD_LOG( ELOG_eADCTimeout );
|
||||
// }
|
||||
//
|
||||
// // read ADC data
|
||||
// if( !(boSuccess = boReadADCData() ) )
|
||||
// {
|
||||
// //ELOG_ADD_LOG( ELOG_eADCReadingDataFailed );
|
||||
// }
|
||||
//// vIncrementChannel();
|
||||
//
|
||||
// // reinit ADC on error, on spi failure or when timeout reached
|
||||
// if( boTimeout || !boSuccess )
|
||||
// {
|
||||
// boError = TRUE;
|
||||
//// vADCInit();
|
||||
// }
|
||||
|
||||
// // send event to worker task, if all channels completed and no error
|
||||
// if( m_stADCData.u8Cannel == 0 && !boError )
|
||||
// {
|
||||
// // send event to tasks
|
||||
// for( U16 u16Cnt = 0; u16Cnt < NUMBER_OF_EVENT_CALLBACKS; u16Cnt++ )
|
||||
// {
|
||||
// if( m_apfnEventCallback[u16Cnt] != NULL )
|
||||
// {
|
||||
// m_apfnEventCallback[u16Cnt]( m_apvCallbackArgument[u16Cnt] );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user