|
| | UnitGP8413 (const uint8_t addr=DEFAULT_ADDRESS) |
| | Constructor.
|
| |
| virtual bool | begin () override |
| | Initialize the unit and apply config_t (output ranges)
|
| |
|
|
config_t | config () |
| | Gets the configuration.
|
| |
|
void | config (const config_t &cfg) |
| | Set the configuration.
|
| |
|
| gp8413::Output | range (const gp8413::Channel channel) const |
| | Gets the output range set for the channel.
|
| |
| float | maximumVoltage (const gp8413::Channel channel) const |
| | Gets the maximum voltage of the channel.
|
| |
| bool | writeOutputRange (const gp8413::Output range0, const gp8413::Output range1) |
| | Write the output range.
|
| |
|
| template<typename T , typename std::enable_if< std::is_floating_point< T >::value, std::nullptr_t >::type = nullptr> |
| bool | writeVoltage (const gp8413::Channel channel, const T mv) |
| | Output the voltage.
|
| |
| template<typename T , typename std::enable_if< std::is_floating_point< T >::value, std::nullptr_t >::type = nullptr> |
| bool | writeChannel0Voltage (const T mv) |
| | Output the voltage to channel 0.
|
| |
| template<typename T , typename std::enable_if< std::is_floating_point< T >::value, std::nullptr_t >::type = nullptr> |
| bool | writeChannel1Voltage (const T mv) |
| | Output the voltage to channel 1.
|
| |
| template<typename T , typename std::enable_if< std::is_floating_point< T >::value, std::nullptr_t >::type = nullptr> |
| bool | writeBothVoltage (const T mv0, const T mv1) |
| | Output the voltage to both channels.
|
| |
| template<typename T , typename std::enable_if< std::is_floating_point< T >::value, std::nullptr_t >::type = nullptr> |
| bool | writeBothVoltage (const T mv) |
| | Output the voltage to both channels.
|
| |
|
| bool | writeVoltage (const gp8413::Channel channel, const uint16_t raw) |
| | Output the raw value.
|
| |
| bool | writeChannel0Voltage (const uint16_t raw) |
| | Output the raw value to channel 0.
|
| |
| bool | writeChannel1Voltage (const uint16_t raw) |
| | Output the raw value to channel 1.
|
| |
| bool | writeBothVoltage (const uint16_t raw0, const uint16_t raw1) |
| | Output the raw value to both channels.
|
| |
| bool | writeBothVoltage (const uint16_t raw) |
| | Output the raw value to both channels.
|
| |
|
- Note
- The GP8413 supports storing voltage data in the chip to ensure that the voltage output state remains in the corresponding state after power-down or start-up.
|
| bool | storeBothVoltage () |
| | Store the current output voltage to the chip.
|
| |
Digital-to-analog signal conversion unit.
| bool m5::unit::UnitGP8413::storeBothVoltage |
( |
| ) |
|
Store the current output voltage to the chip.
The stored voltage is output when the chip is powered on (until the output is written again). The store sequence cannot be generated by the I2C controller, so the I2C bus is released and the sequence is bit-banged on the SDA/SCL pins, then the bus is restored. Supported buses: Arduino TwoWire (including the LP I2C Wire1, e.g. NessoN1 Hat port), m5::I2C_Class (M5.Ex_I2C etc.), M5HAL software I2C, ESP-IDF native I2C drivers, and via a hub (PaHub etc.) connected to one of these
- Returns
- True if successful. False if the chip does not acknowledge the store sequence (e.g. not connected)
- Warning
- Not supported on the ESP-IDF native I2C drivers when the pins are not routed through the GPIO matrix (LP I2C) (returns false)
-
Other devices on the same bus cannot be accessed during the store (about 10 ms). Blocked until complete
-
Note that the output range is not stored
- Note
- The chip has no read command, so the stored value can only be checked by power-cycling the unit and measuring the output