CANTram Framework 1.0.1
Dieses Framework ermöglicht die Nutzung der CANTram Hardware, einer Mikrocontroller basierten mdoularen Steuerung.
Loading...
Searching...
No Matches
AnalogModuleV1_0 Class Reference
Inheritance diagram for AnalogModuleV1_0:
Collaboration diagram for AnalogModuleV1_0:

Public Member Functions

String getHWType () const override
 Get the hardware type string.
String getHWVersion () const override
 Get the hardware version string.
String getFWVersion () const override
 Get the firmware version string.
uint8_t getGPIODemand () const override
 Get the GPIO demand of the module.
uint8_t getGPIOSupply () const override
 Get the GPIO supply capacity of the module.
bool attachModule (uint8_t slot, uint8_t gpioStart) override
 Attach module to a slot and set GPIO start.
bool provideGPIOs () override
 Provide GPIO definitions to the core.
bool requestGPIOs () override
 Request and configure GPIOs used by the module.
bool provideHardwareResources () override
 Provide hardware resources to the core.
bool requestHardwareResources () override
 Request hardware resources required by the module.
bool addInterfaces () override
 Add interface objects to the module's interface list.
bool initialize () override
 Initialize the analog module and external ADC chip interface.
void cycle (uint8_t *response) override
 Periodic cycle handler called by the core.
bool reset () override
 Reset the module and its interfaces.
Interface ** getInterfaces () override
 Get pointer to module's interface array.
size_t getInterfaceCount () override
 Get number of interfaces provided by the module.
Public Member Functions inherited from CANTramModule
 CANTramModule ()=default
 Default constructor.
virtual ~CANTramModule ()=default
 Destructor.
uint8_t getSlot () const
 Get assigned slot index.
uint8_t getGPIOStart () const
 Get starting GPIO index assigned to the module.
virtual bool preInitialize ()
 Pre-initialize the module after attachment and provisioning.

Static Public Attributes

static const String HW_TYPE = "AnalogModuleV1.0"
static const String HW_VERSION = "1.0"
static const String FW_VERSION = "1.0"
static constexpr uint8_t GPIO_DEMAND = 5
static constexpr uint8_t GPIO_SUPPLY = 0

Additional Inherited Members

Protected Attributes inherited from CANTramModule
uint8_t SLOT = 0
uint8_t GPIO_START = 0

Member Function Documentation

◆ addInterfaces()

bool AnalogModuleV1_0::addInterfaces ( )
overridevirtual

Add interface objects to the module's interface list.

Constructs and names analog input and output interface objects and places pointers into the module interface array. Input interfaces are validated only if a valid CS output definition exists.

Returns
true if interfaces were added and validated where possible, false if any required interface validation failed.

Implements CANTramModule.

◆ attachModule()

bool AnalogModuleV1_0::attachModule ( uint8_t slot,
uint8_t gpioStart )
overridevirtual

Attach module to a slot and set GPIO start.

Calls base class attach to register slot and gpio start. Module-specific initialization is minimal here.

Parameters
slotModule slot index.
gpioStartStarting GPIO index assigned to this module.
Returns
true if base attach succeeded, false otherwise.

Reimplemented from CANTramModule.

Here is the call graph for this function:

◆ cycle()

void AnalogModuleV1_0::cycle ( uint8_t * response)
overridevirtual

Periodic cycle handler called by the core.

Performs a burst read from the external ADC chip, logs and validates the status, updates analog input interface values, and propagates PWM output values to the PWM providers for validated outputs.

Parameters
responseOptional pointer to a response buffer where the module can write response bytes; may be nullptr if unused.

Reimplemented from CANTramModule.

Here is the call graph for this function:

◆ getFWVersion()

String AnalogModuleV1_0::getFWVersion ( ) const
inlineoverridevirtual

Get the firmware version string.

Returns the firmware version string implemented by the module.

Returns
String Firmware version (e.g. "1.0").

Implements CANTramModule.

◆ getGPIODemand()

uint8_t AnalogModuleV1_0::getGPIODemand ( ) const
inlineoverridevirtual

Get the GPIO demand of the module.

Returns how many GPIOs this module requires from the core.

Returns
uint8_t Number of GPIOs demanded by the module.

Implements CANTramModule.

◆ getGPIOSupply()

uint8_t AnalogModuleV1_0::getGPIOSupply ( ) const
inlineoverridevirtual

Get the GPIO supply capacity of the module.

Returns how many GPIOs this module provides/supplies to the system.

Returns
uint8_t Number of GPIOs supplied by the module.

Implements CANTramModule.

◆ getHWType()

String AnalogModuleV1_0::getHWType ( ) const
inlineoverridevirtual

Get the hardware type string.

Returns a human readable hardware type identifier for the concrete module implementation.

Returns
String Hardware type identifier (e.g. "MainModuleV1.0").

Implements CANTramModule.

◆ getHWVersion()

String AnalogModuleV1_0::getHWVersion ( ) const
inlineoverridevirtual

Get the hardware version string.

Returns the hardware revision/version string for the module.

Returns
String Hardware version (e.g. "1.0").

Implements CANTramModule.

◆ getInterfaceCount()

size_t AnalogModuleV1_0::getInterfaceCount ( )
inlineoverridevirtual

Get number of interfaces provided by the module.

Return the number of entries in the interfaces array returned by getInterfaces().

Returns
size_t Number of interface pointers.

Implements CANTramModule.

◆ getInterfaces()

Interface ** AnalogModuleV1_0::getInterfaces ( )
inlineoverridevirtual

Get pointer to module's interface array.

Returns a pointer to the internal Interface* array used by the core to enumerate interfaces.

Returns
Interface** Pointer to the first element of the module's interfaces array.

Implements CANTramModule.

◆ initialize()

bool AnalogModuleV1_0::initialize ( )
overridevirtual

Initialize the analog module and external ADC chip interface.

Activates external chip-select management on the input driver, installs a CS control callback that uses the module's CS output provider, and starts the input driver. Logs an error if initialization fails.

Returns
true if initialization succeeded, false otherwise.

Implements CANTramModule.

◆ provideGPIOs()

bool AnalogModuleV1_0::provideGPIOs ( )
overridevirtual

Provide GPIO definitions to the core.

This module does not add additional GPIO definitions beyond those provided elsewhere, so this function currently returns true and acts as a placeholder for future additions.

Returns
true on success.

Implements CANTramModule.

◆ provideHardwareResources()

bool AnalogModuleV1_0::provideHardwareResources ( )
overridevirtual

Provide hardware resources to the core.

Currently this module does not attach additional hardware resources (e.g., cores) to CANTramCore.

Returns
true on success.

Implements CANTramModule.

◆ requestGPIOs()

bool AnalogModuleV1_0::requestGPIOs ( )
overridevirtual

Request and configure GPIOs used by the module.

Retrieves the chip-select output definition and PWM output definitions from CANTramCore. Configures the CS pin as an output and sets its initial state high to deselect the external ADC chip.

Returns
true if all required GPIOs were obtained/configured, false if any were missing or misconfigured.

Implements CANTramModule.

Here is the call graph for this function:

◆ requestHardwareResources()

bool AnalogModuleV1_0::requestHardwareResources ( )
overridevirtual

Request hardware resources required by the module.

Registers analog output interfaces and requests PWM channels from the PWM provider for each output. Validates interfaces when registration succeeds.

Returns
true if all requested hardware resources were successfully acquired and interfaces validated, false otherwise.

Implements CANTramModule.

Here is the call graph for this function:

◆ reset()

bool AnalogModuleV1_0::reset ( )
overridevirtual

Reset the module and its interfaces.

Calls base reset, attempts to reset the external input chip, and clears interface values to zero.

Returns
true if reset operations succeeded, false if any reset failed.

Reimplemented from CANTramModule.

Here is the call graph for this function:

The documentation for this class was generated from the following files:
  • C:/Users/leowa/Documents/PlatformIO/Projects/CANTramFrameworkUsage/lib/CANTramFramework/include/AnalogModuleV1_0.h
  • C:/Users/leowa/Documents/PlatformIO/Projects/CANTramFrameworkUsage/lib/CANTramFramework/src/modules/AnalogModuleV1_0.cpp