M5Unit-ANADIG 0.1.0 git rev:3fbd370
Loading...
Searching...
No Matches
m5::unit::UnitGP8413 Class Reference

Digital-to-analog signal conversion unit. More...

#include <unit_GP8413.hpp>

Inheritance diagram for m5::unit::UnitGP8413:

Classes

struct  config_t
 Settings for begin. More...
 

Public Member Functions

 UnitGP8413 (const uint8_t addr=DEFAULT_ADDRESS)
 
virtual bool begin () override
 
Settings for begin
config_t config ()
 Gets the configration.
 
void config (const config_t &cfg)
 Set the configration.
 
Settings
gp8413::Output range (const gp8413::Channel channel) const
 Gets the inner range.
 
float maximumVoltage (const gp8413::Channel channel) const
 Get the maximum voltage of the channel.
 
bool writeOutputRange (const gp8413::Output range0, const gp8413::Output range1)
 Write the output range.
 
Output the voltage
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(mV) 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(mV) 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 channel.
 
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 channel.
 
Output the raw value
bool writeVoltage (const gp8413::Channel channel, const uint16_t raw)
 Output the raw value.
 
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 gp8413::Channel channel, const T raw)
 Output the raw value.
 
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 writeChannel0Voltage (const T raw)
 Output the raw value to channel 0.
 
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 writeChannel1Voltage (const 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 channel.
 
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 writeBothVoltage (const T raw0, const T raw1)
 Output the raw value to both channel.
 
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 writeBothVoltage (const T raw)
 Output the raw value to both channel.
 

Static Public Attributes

static constexpr uint16_t RESOLUTION {0x7FFF}
 

Protected Member Functions

uint16_t voltage_to_raw (const gp8413::Channel channel, const float mv)
 
bool write_voltage (const uint8_t reg, const uint8_t *buf, const uint32_t len)
 

Detailed Description

Digital-to-analog signal conversion unit.

Member Function Documentation

◆ writeBothVoltage() [1/4]

template<typename T , typename std::enable_if< std::is_floating_point< T >::value, std::nullptr_t >::type = nullptr>
bool m5::unit::UnitGP8413::writeBothVoltage ( const T mv)
inline

Output the voltage to both channel.

Parameters
mvOutput voltage(mV)
Returns
True if successful
Note
Write the same value to both channels

◆ writeBothVoltage() [2/4]

template<typename T , typename std::enable_if< std::is_floating_point< T >::value, std::nullptr_t >::type = nullptr>
bool m5::unit::UnitGP8413::writeBothVoltage ( const T mv0,
const T mv1 )
inline

Output the voltage to both channel.

Parameters
mv0Output voltage(mV) for channel 0
mv1Output voltage(mV) for channel 1
Returns
True if successful

◆ writeBothVoltage() [3/4]

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 m5::unit::UnitGP8413::writeBothVoltage ( const T raw)
inline

Output the raw value to both channel.

Parameters
rawOutput raw value
Returns
True if successful
Note
Write the same value to both channels

◆ writeBothVoltage() [4/4]

bool m5::unit::UnitGP8413::writeBothVoltage ( const uint16_t raw0,
const uint16_t raw1 )

Output the raw value to both channel.

Parameters
raw0Output raw value for channel 0
raw1Output raw value for channel 1
Returns
True if successful

◆ writeOutputRange()

bool m5::unit::UnitGP8413::writeOutputRange ( const gp8413::Output range0,
const gp8413::Output range1 )

Write the output range.

Parameters
range0Output range for channel 0
range1Output range for channel 1
Returns
True if successful

◆ writeVoltage() [1/2]

template<typename T , typename std::enable_if< std::is_floating_point< T >::value, std::nullptr_t >::type = nullptr>
bool m5::unit::UnitGP8413::writeVoltage ( const gp8413::Channel channel,
const T mv )
inline

Output the voltage.

Parameters
channelChannel to output
mvOutput voltage(mV)
Returns
True if successful @Note If exceeding the range, it will be kept within the range

◆ writeVoltage() [2/2]

bool m5::unit::UnitGP8413::writeVoltage ( const gp8413::Channel channel,
const uint16_t raw )

Output the raw value.

Parameters
channelChannel to output
rawOutput raw value
Returns
True if successful