Major updates:
- 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
This commit is contained in:
@@ -0,0 +1,120 @@
|
||||
// -----------------------------------------------------------------------------
|
||||
/// @file DAConverters.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 DAConverters.c
|
||||
/// @ingroup {group_name}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Include files
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#include "DAConverters.h"
|
||||
#include "hsb-mrts.h"
|
||||
|
||||
#include "MAX5715.h"
|
||||
#include "PCBA.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Constant and macro definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Type definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// File-scope variables
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
static struct DAConverter _dacRow1;
|
||||
static struct DAConverter _dacRow2;
|
||||
static struct DAConverter _dacRow3;
|
||||
|
||||
struct DAConverter* dacRow1 = &_dacRow1;
|
||||
struct DAConverter* dacRow2 = &_dacRow2;
|
||||
struct DAConverter* dacRow3 = &_dacRow3;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function declarations
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Function definitions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
ErrorStatus DAConverters_construct(void)
|
||||
{
|
||||
ErrorStatus returnValue = SUCCESS;
|
||||
|
||||
int minVoltage;
|
||||
int maxVoltage;
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
if (PCBA_getInstance()->pcba == PCBA_Anode)
|
||||
{
|
||||
minVoltage = HSB_DAC_ANODE_MIN_VOLTAGE;
|
||||
maxVoltage = HSB_DAC_ANODE_MAX_VOLTAGE;
|
||||
}
|
||||
else if (PCBA_getInstance()->pcba == PCBA_CathodeMCP)
|
||||
{
|
||||
minVoltage = HSB_DAC_CMCP_MIN_VOLTAGE;
|
||||
maxVoltage = HSB_DAC_CMCP_MAX_VOLTAGE;
|
||||
}
|
||||
else if (PCBA_getInstance()->pcba == PCBA_Tesla)
|
||||
{
|
||||
minVoltage = HSB_DAC_TESLA_MIN_VOLTAGE;
|
||||
maxVoltage = HSB_DAC_TESLA_MAX_VOLTAGE;
|
||||
}
|
||||
else
|
||||
{
|
||||
minVoltage = 0;
|
||||
maxVoltage = 0;
|
||||
returnValue = ERROR;
|
||||
}
|
||||
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
returnValue = DAConverter_construct(dacRow1, minVoltage, maxVoltage, &max5715->dac[0].dacDevice);
|
||||
}
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
returnValue = DAConverter_construct(dacRow2, minVoltage, maxVoltage, &max5715->dac[1].dacDevice);
|
||||
}
|
||||
if (returnValue == SUCCESS)
|
||||
{
|
||||
returnValue = DAConverter_construct(dacRow3, minVoltage, maxVoltage, &max5715->dac[2].dacDevice);
|
||||
}
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
|
||||
void DAConverters_destruct(void)
|
||||
{
|
||||
DAConverter_destruct(dacRow1);
|
||||
DAConverter_destruct(dacRow2);
|
||||
DAConverter_destruct(dacRow3);
|
||||
}
|
||||
Reference in New Issue
Block a user