1 unstable release
0.1.0 | May 24, 2023 |
---|
#11 in #volatile
24KB
533 lines
Driver for MCP47x6 DACs compatible with embedded-hal.
mcp47x6 has supports 7-bit addresses only and the address has to start with 0b1100. There are 8 versions of each chip that differ by last 3 bits of address. let mut dac = MCP4726::new(i2c, 0b_110_0010);
The chips have non-volatile memory that stores configuration. On power-on that momory is copied volatile configuration registers.
All memory is read with read method that returns DacStatus struct. Read DacStatus docs or code for available fields. let status = dac.read().unwrap(); let non_volatile_output = status.nv_output(); let volatile_output = status.output();
There are few command that change configuration registers. Read MCP4726 docs or implementation to see all of them. Simplest one is dac.set_volatile_fast(PowerState::On, 0x_fff);
Datasheet: https://ww1.microchip.com/downloads/en/DeviceDoc/22272C.pdf
I haven't had chanse to test 8 and 10-bit variants of the device and the datasheet multiple errors in it. Please contact me if You can confirm that some functionality actually works or that there are problems.
Licensed under either of Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0) MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT) at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Dependencies
~71KB