Created a version that regulates negatively. Buggy, though. Enough for pre-compliance but must be fixed afterwards

git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@264 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
mmi
2017-10-25 06:33:49 +00:00
parent a41e792565
commit 6cc49f4e47
11 changed files with 147 additions and 42 deletions

View File

@@ -218,6 +218,10 @@ ErrorStatus MAX5715Channel_setValue(const struct MAX5715_DAC* self, uint16_t val
static ErrorStatus channelWrite(const struct DACDevice* self, uint32_t voltage)
{
if (voltage > ((1 << MAX5715_RESOLUTION_IN_BITS) - 1))
{
voltage = ((1 << MAX5715_RESOLUTION_IN_BITS) - 1);
}
// 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));
}