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

Public Member Functions

 CANTramModule ()=default
 Default constructor.
virtual ~CANTramModule ()=default
 Destructor.
virtual String getHWType () const =0
 Get the hardware type string.
virtual String getHWVersion () const =0
 Get the hardware version string.
virtual String getFWVersion () const =0
 Get the firmware version string.
virtual uint8_t getGPIODemand () const =0
 Get the GPIO demand of the module.
virtual uint8_t getGPIOSupply () const =0
 Get the GPIO supply capacity of the module.
virtual bool reset ()
 Reset the module to a known default state.
uint8_t getSlot () const
 Get assigned slot index.
uint8_t getGPIOStart () const
 Get starting GPIO index assigned to the module.
virtual void cycle (uint8_t *response)
 Periodic cycle callback.
virtual bool attachModule (uint8_t slot, uint8_t gpioStart)
 Attach this module to a slot and assign GPIO range.
virtual bool provideGPIOs ()=0
 Provide GPIO definitions to the core.
virtual bool requestGPIOs ()=0
 Request GPIO definitions from the core.
virtual bool provideHardwareResources ()=0
 Provide hardware resources (e.g., I2C, SPI, UART) to the core.
virtual bool requestHardwareResources ()=0
 Request hardware resources from the core.
virtual bool addInterfaces ()=0
 Setup and validate module interfaces.
virtual bool preInitialize ()
 Pre-initialize the module after attachment and provisioning.
virtual bool initialize ()=0
 Initialize the module after attachment and provisioning.
virtual Interface ** getInterfaces ()=0
 Get pointer to module's interface array.
virtual size_t getInterfaceCount ()=0
 Get number of interfaces provided by the module.

Protected Attributes

uint8_t SLOT = 0
uint8_t GPIO_START = 0

Constructor & Destructor Documentation

◆ CANTramModule()

CANTramModule::CANTramModule ( )
default

Default constructor.

Constructs an empty CANTramModule instance. Derived classes should perform initialization in attachModule()/initialize().

◆ ~CANTramModule()

virtual CANTramModule::~CANTramModule ( )
virtualdefault

Destructor.

Virtual destructor to ensure proper cleanup in derived classes.

Member Function Documentation

◆ addInterfaces()

virtual bool CANTramModule::addInterfaces ( )
pure virtual

Setup and validate module interfaces.

Populate the module's Interface* array, name interfaces and validate them as needed.

Returns
true if interfaces were successfully added and validated, false otherwise.

Implemented in AnalogModuleV1_0, BusModuleV1_0, DigitalModuleV1_0, MainModuleV1_0, and RelaisModuleV1_0.

Here is the caller graph for this function:

◆ attachModule()

bool CANTramModule::attachModule ( uint8_t slot,
uint8_t gpioStart )
virtual

Attach this module to a slot and assign GPIO range.

Attach this module to a slot and assign its GPIO range.

Initializes the module's internal SLOT and GPIO_START and triggers GPIO/resource provisioning and interface registration sequences.

Parameters
slotSlot index to attach the module to.
gpioStartStarting GPIO index assigned to this module.
Returns
true if attachment and provisioning succeeded, false otherwise.

Sets the module's SLOT and GPIO_START values, logs the attachment and runs the standard initialization sequence: provideGPIOs, provideHardwareResources, requestGPIOs, requestHardwareResources and addInterfaces. Logs success or warnings based on the combined result.

Parameters
slotSlot index to attach the module to.
gpioStartStarting GPIO index assigned to this module.
Returns
true if all initialization steps succeeded, false if any step failed.

Reimplemented in AnalogModuleV1_0, BusModuleV1_0, DigitalModuleV1_0, MainModuleV1_0, and RelaisModuleV1_0.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cycle()

virtual void CANTramModule::cycle ( uint8_t * response)
inlinevirtual

Periodic cycle callback.

Called regularly by the core to allow the module to perform time-based tasks.

Parameters
responseOptional pointer to a response buffer where the module may write response bytes. May be nullptr.

Reimplemented in AnalogModuleV1_0, BusModuleV1_0, DigitalModuleV1_0, MainModuleV1_0, and RelaisModuleV1_0.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFWVersion()

virtual String CANTramModule::getFWVersion ( ) const
pure virtual

Get the firmware version string.

Returns the firmware version string implemented by the module.

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

Implemented in AnalogModuleV1_0, BusModuleV1_0, DigitalModuleV1_0, MainModuleV1_0, and RelaisModuleV1_0.

◆ getGPIODemand()

virtual uint8_t CANTramModule::getGPIODemand ( ) const
pure virtual

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.

Implemented in AnalogModuleV1_0, BusModuleV1_0, DigitalModuleV1_0, MainModuleV1_0, and RelaisModuleV1_0.

◆ getGPIOStart()

uint8_t CANTramModule::getGPIOStart ( ) const
inline

Get starting GPIO index assigned to the module.

Returns the first GPIO index allocated to this module.

Returns
uint8_t GPIO start index.
Here is the caller graph for this function:

◆ getGPIOSupply()

virtual uint8_t CANTramModule::getGPIOSupply ( ) const
pure virtual

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.

Implemented in AnalogModuleV1_0, BusModuleV1_0, DigitalModuleV1_0, MainModuleV1_0, and RelaisModuleV1_0.

◆ getHWType()

virtual String CANTramModule::getHWType ( ) const
pure virtual

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").

Implemented in AnalogModuleV1_0, BusModuleV1_0, DigitalModuleV1_0, MainModuleV1_0, and RelaisModuleV1_0.

Here is the caller graph for this function:

◆ getHWVersion()

virtual String CANTramModule::getHWVersion ( ) const
pure virtual

Get the hardware version string.

Returns the hardware revision/version string for the module.

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

Implemented in AnalogModuleV1_0, BusModuleV1_0, DigitalModuleV1_0, MainModuleV1_0, and RelaisModuleV1_0.

◆ getInterfaceCount()

virtual size_t CANTramModule::getInterfaceCount ( )
pure virtual

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.

Implemented in AnalogModuleV1_0, BusModuleV1_0, DigitalModuleV1_0, MainModuleV1_0, and RelaisModuleV1_0.

◆ getInterfaces()

virtual Interface ** CANTramModule::getInterfaces ( )
pure virtual

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.

Implemented in AnalogModuleV1_0, BusModuleV1_0, DigitalModuleV1_0, MainModuleV1_0, and RelaisModuleV1_0.

◆ getSlot()

uint8_t CANTramModule::getSlot ( ) const
inline

Get assigned slot index.

Returns the slot index the module was attached to via attachModule().

Returns
uint8_t Slot index.
Here is the caller graph for this function:

◆ initialize()

virtual bool CANTramModule::initialize ( )
pure virtual

Initialize the module after attachment and provisioning.

Perform runtime initialization (start drivers, begin peripherals) once all modules have been attached.

Returns
true if initialization succeeded, false otherwise.

Implemented in AnalogModuleV1_0, BusModuleV1_0, DigitalModuleV1_0, MainModuleV1_0, and RelaisModuleV1_0.

◆ preInitialize()

virtual bool CANTramModule::preInitialize ( )
inlinevirtual

Pre-initialize the module after attachment and provisioning.

Perform any pre-initialization steps before the main initialize() call. May be used to establish e.g. i2c communication needed for initialization.

Returns
true if pre-initialization succeeded, false otherwise.

Reimplemented in BusModuleV1_0, and MainModuleV1_0.

◆ provideGPIOs()

virtual bool CANTramModule::provideGPIOs ( )
pure virtual

Provide GPIO definitions to the core.

Called during module attachment to allow the module to declare any GPIOs it owns or provides.

Returns
true if GPIO definitions were provided successfully, false otherwise.

Implemented in AnalogModuleV1_0, BusModuleV1_0, DigitalModuleV1_0, MainModuleV1_0, and RelaisModuleV1_0.

Here is the caller graph for this function:

◆ provideHardwareResources()

virtual bool CANTramModule::provideHardwareResources ( )
pure virtual

Provide hardware resources (e.g., I2C, SPI, UART) to the core.

Called during attachment to attach HardwareResource instances that other modules can request.

Returns
true if resources were successfully provided, false otherwise.

Implemented in AnalogModuleV1_0, BusModuleV1_0, DigitalModuleV1_0, MainModuleV1_0, and RelaisModuleV1_0.

Here is the caller graph for this function:

◆ requestGPIOs()

virtual bool CANTramModule::requestGPIOs ( )
pure virtual

Request GPIO definitions from the core.

Called after provideGPIOs to obtain runtime GPIO assignments from CANTramCore.

Returns
true if required GPIOs were acquired and validated, false otherwise.

Implemented in AnalogModuleV1_0, BusModuleV1_0, DigitalModuleV1_0, MainModuleV1_0, and RelaisModuleV1_0.

Here is the caller graph for this function:

◆ requestHardwareResources()

virtual bool CANTramModule::requestHardwareResources ( )
pure virtual

Request hardware resources from the core.

Called when the module should acquire hardware resources supplied by the system (e.g., UART core).

Returns
true if all required hardware resources were granted, false otherwise.

Implemented in AnalogModuleV1_0, BusModuleV1_0, DigitalModuleV1_0, MainModuleV1_0, and RelaisModuleV1_0.

Here is the caller graph for this function:

◆ reset()

bool CANTramModule::reset ( )
virtual

Reset the module to a known default state.

Optional override for module-specific reset logic. Base implementation should be safe to call.

Returns
true if reset succeeded, false otherwise.

Default implementation performs module reset actions. It logs the reset operation and returns true. Derived classes may override to perform additional hardware or state reset behavior.

Returns
true if reset succeeded, false otherwise.

Reimplemented in AnalogModuleV1_0, BusModuleV1_0, and MainModuleV1_0.

Here is the caller 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/CANTramModule.h
  • C:/Users/leowa/Documents/PlatformIO/Projects/CANTramFrameworkUsage/lib/CANTramFramework/src/abstract/CANTramModule.cpp