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:
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user