Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After some discussion on the rust embedded matrix chat during the Oxidize impl days I made a very simple implementation for a blocking DAC trait. This is a blocking implementation to make it usable for implementing in peripherals that use busses that do not have an nb interface like I2C.
I created a sample implementation for the Microchip mcp4725 I2C DAC here; https://github.com/mendelt/mcp4725/blob/dac-hal/src/lib.rs
The trait only supports setting the output of a single DAC channel. I'm planning on trying this out for the AD5668 8 channel DAC using a .split method that returns a channel instance for each of the 8 channels next.
Some discussion. We might want to have prescribed behavior for DACs that use less than the full word-length. The mcp4725 for example uses 12 of the 16 bits. Right now it uses the least significant bits but I'm thinking about fixing this and using the 12 most significant bits. I think this might make more sense in terms of the abstraction the trait provides. Programs using this trait would get more logical behavior when replacing a 16 bit DAC with a 14 or 12 bit one.