Fixed multiple bugs and errors.

- Added WARNING handler
- put voltage calculations to dedicated module

fixed last errors. Updated menu repair screen without ERROR from PID 

This is version 0.9.0.3, which is used for the first duration test
Will also be tagged

git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@272 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
mmi
2017-11-15 15:40:39 +00:00
parent 17207a3a4b
commit 711f8e72be
46 changed files with 2572 additions and 454 deletions

View File

@@ -53,6 +53,7 @@
// -----------------------------------------------------------------------------
static ErrorStatus channelWrite(const struct DACDevice* self, uint32_t voltage);
static uint32_t channelReadback (const struct DACDevice* self);
// -----------------------------------------------------------------------------
// Function definitions
@@ -166,7 +167,7 @@ ErrorStatus MAX5715Channel_construct(struct MAX5715_DAC* self, struct MAX5715* p
if (returnValue == SUCCESS)
{
returnValue = DACDevice_construct(&self->dacDevice, channelWrite, MAX5715_RESOLUTION_IN_BITS);
returnValue = DACDevice_construct(&self->dacDevice, channelWrite, channelReadback, MAX5715_RESOLUTION_IN_BITS);
}
}
else
@@ -187,7 +188,7 @@ ErrorStatus MAX5715Channel_construct(struct MAX5715_DAC* self, struct MAX5715* p
}
ErrorStatus MAX5715Channel_setValue(const struct MAX5715_DAC* self, uint16_t value)
ErrorStatus MAX5715Channel_setValue(struct MAX5715_DAC* self, uint16_t value)
{
ErrorStatus returnValue = SUCCESS;
@@ -195,8 +196,11 @@ ErrorStatus MAX5715Channel_setValue(const struct MAX5715_DAC* self, uint16_t val
{
if ((self->initialized) && (self->parent->initialized))
{
///TODO value must be verified with DAC device boarders (add limits to class)
self->value = value;
// Send data to CODEn register
MAX5715_writeCODEn(self->parent, self->id, value);
MAX5715_writeCODEn(self->parent, self->id, self->value);
// Load CODEn register to DAC output
MAX5715_writeLOADn(self->parent, self->id);
@@ -225,3 +229,11 @@ static ErrorStatus channelWrite(const struct DACDevice* self, uint32_t voltage)
// MASK the uint32_t DAC value (voltage) with the resolution of the MAX5715 DAC
return MAX5715Channel_setValue((struct MAX5715_DAC*)self, (((1 << MAX5715_RESOLUTION_IN_BITS) - 1) & voltage));
}
static uint32_t channelReadback (const struct DACDevice* self)
{
struct MAX5715_DAC* tempDac = (struct MAX5715_DAC*)self;
return tempDac->value;
}