CANTram Framework 1.0.1
Dieses Framework ermöglicht die Nutzung der CANTram Hardware, einer Mikrocontroller basierten mdoularen Steuerung.
Loading...
Searching...
No Matches
AnalogOutput Class Reference

Analog output interface implementation. More...

#include <AnalogOutput.h>

Inheritance diagram for AnalogOutput:
Collaboration diagram for AnalogOutput:

Public Member Functions

 AnalogOutput (Interface::Resolution res=Interface::RES_12BIT)
 Construct a new AnalogOutput object.
Interface::Type getType () const override
 Get the interface type.
void setQ (uint16_t q) override
 Set the output value (Q).
Public Member Functions inherited from Interface
virtual uint16_t getQ () const
void rename (const String &newName)
template<typename T>
T as ()
void validate ()
void validate (bool state)
void invalidate ()
bool isValid ()
bool isInvalid ()
String getName () const

Public Attributes

uint8_t channel

Additional Inherited Members

Public Types inherited from Interface
enum  Resolution { RES_8BIT = 8 , RES_10BIT = 10 , RES_12BIT = 12 , RES_16BIT = 16 }
enum  Type {
  DIGITAL_INPUT , DIGITAL_OUTPUT , ANALOG_INPUT , ANALOG_OUTPUT ,
  RELAIS , BUS
}
Protected Attributes inherited from Interface
String name
uint16_t Q = 0
bool _valid = false
bool _invalid = false

Detailed Description

Analog output interface implementation.

Provides an Interface-derived analog output implementation that stores a resolution and a value (Q).

Constructor & Destructor Documentation

◆ AnalogOutput()

AnalogOutput::AnalogOutput ( Interface::Resolution res = Interface::RES_12BIT)
inline

Construct a new AnalogOutput object.

Initializes the analog output with the given resolution and sets the internal value Q to zero.

Parameters
resResolution to use for this analog output. Defaults to Interface::RES_12BIT.

Member Function Documentation

◆ getType()

Interface::Type AnalogOutput::getType ( ) const
inlineoverridevirtual

Get the interface type.

Returns the type identifier for this interface implementation so callers can distinguish analog outputs from other interface types.

Returns
Interface::Type The type value ANALOG_OUTPUT.

Implements Interface.

◆ setQ()

void AnalogOutput::setQ ( uint16_t q)
inlineoverridevirtual

Set the output value (Q).

Sets the internal value Q. If the provided value exceeds the maximum representable value for the configured resolution, the value is clamped to the maximum and a warning is logged.

Parameters
qThe value to set for this analog output. Range is 0 .. (2^resolution - 1).
Returns
void

Reimplemented from Interface.


The documentation for this class was generated from the following file:
  • C:/Users/leowa/Documents/PlatformIO/Projects/CANTramFrameworkUsage/lib/CANTramFramework/include/AnalogOutput.h