- added DAConverter(s) - added ADConverter(s) - Fixed some display issues - Made repair process and signalProfileGenerator calculate with voltages (signed) instead of DAC/ADC values - Fixed several bugs in task handlings - Put display data mirror into dedicated file displaycontent git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@261 05563f52-14a8-4384-a975-3d1654cca0fa
120 lines
3.6 KiB
C
120 lines
3.6 KiB
C
// -----------------------------------------------------------------------------
|
|
/// @file ADConverters.c
|
|
/// @brief Description
|
|
// -----------------------------------------------------------------------------
|
|
// Micro-Key bv
|
|
// Industrieweg 28, 9804 TG Noordhorn
|
|
// Postbus 92, 9800 AB Zuidhorn
|
|
// The Netherlands
|
|
// Tel: +31 594 503020
|
|
// Fax: +31 594 505825
|
|
// Email: support@microkey.nl
|
|
// Web: www.microkey.nl
|
|
// -----------------------------------------------------------------------------
|
|
/// $Revision$
|
|
/// $Author$
|
|
/// $Date$
|
|
// (c) 2017 Micro-Key bv
|
|
// -----------------------------------------------------------------------------
|
|
|
|
/// @file ADConverters.c
|
|
/// @ingroup {group_name}
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Include files
|
|
// -----------------------------------------------------------------------------
|
|
|
|
#include "ADConverters.h"
|
|
#include "hsb-mrts.h"
|
|
|
|
#include "internalADC.h"
|
|
#include "PCBA.h"
|
|
// -----------------------------------------------------------------------------
|
|
// Constant and macro definitions
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Type definitions
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// File-scope variables
|
|
// -----------------------------------------------------------------------------
|
|
|
|
static struct ADConverter _adcRow1;
|
|
static struct ADConverter _adcRow2;
|
|
static struct ADConverter _adcRow3;
|
|
|
|
struct ADConverter* adcRow1 = &_adcRow1;
|
|
struct ADConverter* adcRow2 = &_adcRow2;
|
|
struct ADConverter* adcRow3 = &_adcRow3;
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Function declarations
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
// Function definitions
|
|
// -----------------------------------------------------------------------------
|
|
|
|
ErrorStatus ADConverters_construct(void)
|
|
{
|
|
ErrorStatus returnValue = SUCCESS;
|
|
|
|
int minVoltage;
|
|
int maxVoltage;
|
|
if (returnValue == SUCCESS)
|
|
{
|
|
if (PCBA_getInstance()->pcba == PCBA_Anode)
|
|
{
|
|
minVoltage = HSB_ADC_ANODE_MIN_VOLTAGE;
|
|
maxVoltage = HSB_ADC_ANODE_MAX_VOLTAGE;
|
|
}
|
|
else if (PCBA_getInstance()->pcba == PCBA_CathodeMCP)
|
|
{
|
|
minVoltage = HSB_ADC_CMCP_MIN_VOLTAGE;
|
|
maxVoltage = HSB_ADC_CMCP_MAX_VOLTAGE;
|
|
}
|
|
else if (PCBA_getInstance()->pcba == PCBA_Tesla)
|
|
{
|
|
minVoltage = HSB_ADC_TESLA_MIN_VOLTAGE;
|
|
maxVoltage = HSB_ADC_TESLA_MAX_VOLTAGE;
|
|
}
|
|
else
|
|
{
|
|
minVoltage = 0;
|
|
maxVoltage = 0;
|
|
returnValue = ERROR;
|
|
}
|
|
|
|
if (returnValue == SUCCESS)
|
|
{
|
|
returnValue = ADConverter_construct(adcRow1, minVoltage, maxVoltage, &adc1->channel[0].adcDevice);
|
|
}
|
|
if (returnValue == SUCCESS)
|
|
{
|
|
returnValue = ADConverter_construct(adcRow2, minVoltage, maxVoltage, &adc1->channel[1].adcDevice);
|
|
}
|
|
if (returnValue == SUCCESS)
|
|
{
|
|
returnValue = ADConverter_construct(adcRow3, minVoltage, maxVoltage, &adc1->channel[2].adcDevice);
|
|
}
|
|
}
|
|
return returnValue;
|
|
}
|
|
|
|
|
|
void ADConverters_destruct(void)
|
|
{
|
|
ADConverter_destruct(adcRow1);
|
|
ADConverter_destruct(adcRow2);
|
|
ADConverter_destruct(adcRow3);
|
|
}
|