Skip to content

Commit

Permalink
drivers: dac: dac_ad569x: Add bit shift for 14/12-bit variants
Browse files Browse the repository at this point in the history
The 14/12-bit variants (AD5692R/AD5691R) require the data to be in the
upper bits of the two byte data field of the write command. See table 12
and the associated footnotes in the AD5693R/AD5692R/AD5691R/AD5693
datasheet.

Signed-off-by: Brett Witherspoon <[email protected]>
  • Loading branch information
bwitherspoon authored and aescolar committed Jul 11, 2024
1 parent 0f97f0a commit f320535
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/dac/dac_ad569x.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ static int ad569x_write_value(const struct device *dev, uint8_t channel, uint32_
return -EINVAL;
}

value <<= 16 - config->resolution;

return ad569x_write(dev, AD569X_CMD_WRITE_AND_UPDATE, value);
}

Expand Down

0 comments on commit f320535

Please sign in to comment.