#dac #i2c

no-std mcp4725

Microchip MCP4725 DAC Driver for Rust Embedded HAL

10 releases

0.4.1 May 7, 2021
0.4.0 Jul 19, 2020
0.3.1 May 12, 2020
0.2.2 May 10, 2020
0.1.0 May 8, 2019

#201 in Embedded development

Download history 4/week @ 2021-02-05 110/week @ 2021-02-12 16/week @ 2021-02-19 4/week @ 2021-02-26 3/week @ 2021-03-05 20/week @ 2021-03-19 19/week @ 2021-03-26 18/week @ 2021-04-02 4/week @ 2021-04-09 22/week @ 2021-04-16 17/week @ 2021-04-30 29/week @ 2021-05-07 10/week @ 2021-05-14 8/week @ 2021-05-21

81 downloads per month

MIT/Apache

17KB
251 lines

mcp4725  

Build Status

Microchip MCP4725 DAC Driver for Rust Embedded HAL This is a driver crate for embedded Rust. It's built on top of the Rust embedded HAL It supports sending commands to a MCP4725 DAC over I2C. To get started you can look at the examples on how to use this driver on an inexpensive blue pill STM32F103 board.

The driver can be initialized by calling create and passing it an I2C interface. The three least significant bits of the device address (A2, A1 and A0) also need to be specified. A2 and A1 are set in the device. A0 can be set by pulling the corresponding connection on the device high or low.

let mut dac = MCP4725::new(i2c, 0b010);

To set the dac output and powermode the dac register can be set;

dac.set_dac(PowerDown::Normal, 0x0fff);

The MCP4725 has a built in eeprom that is used to initialize the dac register on power up. The values in the eeprom can be set with the set_dac_and_eeprom method;

dac.set_dac_and_eeprom(PowerDown::Resistor100kOhm, 0x0fff);

More information

License

Licensed under either of

at your option.

Contribution

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

~82KB