|
M5Unit-ANADIG 0.4.1 git rev:a449179
|
Digital-to-analog signal conversion unit. More...
#include <unit_MCP4725.hpp>
Classes | |
| struct | config_t |
| Settings for begin. More... | |
Public Member Functions | |
| UnitMCP4725 (const uint8_t addr=DEFAULT_ADDRESS) | |
| Constructor. | |
| virtual bool | begin () override |
| Initialize the unit and apply config_t. | |
| bool | generalReset () |
| General reset. | |
| bool | readDACRegister (mcp4725::PowerDown &pd, uint16_t &raw) |
| Read the DAC register. | |
| bool | readEEPROM (mcp4725::PowerDown &pd, uint16_t &raw) |
| Read the EEPROM settings. | |
Settings for begin | |
| config_t | config () |
| Gets the configuration. | |
| void | config (const config_t &cfg) |
| Set the configuration. | |
Properties | |
| mcp4725::PowerDown | powerDown () const |
| Gets the inner power down mode. | |
| uint16_t | lastValue () const |
| Gets the last output raw value. | |
Settings | |
| bool | writePowerDown (const mcp4725::PowerDown pd) |
| Write the power down mode. | |
Output the voltage | |
| |
| template<typename T , typename std::enable_if< std::is_floating_point< T >::value, std::nullptr_t >::type = nullptr> | |
| bool | writeVoltage (const T mv) |
| Output the voltage. | |
| bool | writeVoltage (const uint16_t raw) |
| Output the voltage. | |
| template<typename T , typename std::enable_if<!std::is_same< uint16_t, T >::value &&std::is_unsigned< T >::value, std::nullptr_t >::type = nullptr> | |
| bool | writeVoltage (const T raw) |
| Output the voltage. | |
Write to DAC register and EEPROM | |
| |
| template<typename T , typename std::enable_if< std::is_floating_point< T >::value, std::nullptr_t >::type = nullptr> | |
| bool | writeVoltageAndEEPROM (const T mv, const bool blocking=true) |
| Write to DAC register and EEPROM. | |
| bool | writeVoltageAndEEPROM (const uint16_t raw, const bool blocking=true) |
| Write to DAC register and EEPROM. | |
| template<typename T , typename std::enable_if<!std::is_same< uint16_t, T >::value &&std::is_unsigned< T >::value, std::nullptr_t >::type = nullptr> | |
| bool | writeVoltageAndEEPROM (const T raw, const bool blocking=true) |
| Write to DAC register and EEPROM. | |
Static Public Member Functions | |
| static float | raw_to_voltage (const uint16_t raw, const float supply_voltage) |
| Raw value to voltage(mV) | |
| static uint16_t | voltage_to_raw (const float mv, const float supply_voltage) |
| Voltage(mV) to raw value. | |
Static Public Attributes | |
| static constexpr uint16_t | RESOLUTION {0x0FFF} |
| Maximum raw output value (12 bits) | |
Protected Types | |
| enum class | Command : uint8_t { FastMode , WriteDAC , WriteDACAndEEPROM } |
Digital-to-analog signal conversion unit.
|
inlineexplicit |
Constructor.
| addr | I2C address |
|
overridevirtual |
Initialize the unit and apply config_t.
| bool m5::unit::UnitMCP4725::generalReset | ( | ) |
General reset.
Reset using I2C general call
|
inlinestatic |
Raw value to voltage(mV)
| raw | Raw value |
| supply_voltage | VDD of the chip (mV) |
| bool m5::unit::UnitMCP4725::readDACRegister | ( | mcp4725::PowerDown & | pd, |
| uint16_t & | raw ) |
Read the DAC register.
| [out] | pd | Power down mode |
| [out] | raw | Output voltage raw value |
| bool m5::unit::UnitMCP4725::readEEPROM | ( | mcp4725::PowerDown & | pd, |
| uint16_t & | raw ) |
Read the EEPROM settings.
| [out] | pd | Power down mode |
| [out] | raw | Output voltage raw value |
|
inlinestatic |
Voltage(mV) to raw value.
| mv | Voltage (mV), clamped to 0 - supply_voltage |
| supply_voltage | VDD of the chip (mV) |
| bool m5::unit::UnitMCP4725::writePowerDown | ( | const mcp4725::PowerDown | pd | ) |
Write the power down mode.
| pd | Mode |
|
inline |
Output the voltage.
| mv | Output voltage(mV) |
|
inline |
Output the voltage.
| raw | Output raw value (unsigned integer other than uint16_t) |
|
inline |
Output the voltage.
| raw | Output raw value |
|
inline |
Write to DAC register and EEPROM.
| mv | Output voltage(mV) |
| blocking | Wait until EEPROM write is complete if true |
|
inline |
Write to DAC register and EEPROM.
| raw | Output raw value (unsigned integer other than uint16_t) |
| blocking | Wait until EEPROM write is complete if true |
| bool m5::unit::UnitMCP4725::writeVoltageAndEEPROM | ( | const uint16_t | raw, |
| const bool | blocking = true ) |
Write to DAC register and EEPROM.
| raw | Output raw value |
| blocking | Wait until EEPROM write is complete if true |