CANTram Framework 1.0.1
Dieses Framework ermöglicht die Nutzung der CANTram Hardware, einer Mikrocontroller basierten mdoularen Steuerung.
Loading...
Searching...
No Matches
BusModuleV1_0 Class Reference
Inheritance diagram for BusModuleV1_0:
Collaboration diagram for BusModuleV1_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 this module to a slot and GPIO start index.
bool provideGPIOs () override
 Provide GPIO definitions to the core.
bool requestGPIOs () override
 Request GPIO definitions from CANTramCore and validate pins for module interfaces.
bool provideHardwareResources () override
 Provide hardware resources to CANTramCore.
bool requestHardwareResources () override
 Request hardware resources required by the BusModule.
bool addInterfaces () override
 Add interfaces provided by the BusModule to the module interface list.
bool addSPIDevice (SPIChip *spiDevice, bool allowOverride=false)
bool setLoopFunction (std::function< void(uint8_t *response)> loopFunction)
bool initialize () override
 Initialize the module after attachment and provisioning.
bool preInitialize () override
 Pre-initialize the module after attachment and provisioning.
void cycle (uint8_t *response) override
 Periodic cycle callback for the BusModule.
bool reset () override
 Reset the module to a known default state.
Interface ** getInterfaces () override
 Get pointer to module's interface array.
size_t getInterfaceCount () override
 Get number of interfaces provided by the module.
bool addUARTInterface ()
 Add and configure the UART interface for this module.
bool addI2CInterface ()
 Add and configure the I2C interface for this 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.

Static Public Attributes

static const String HW_TYPE = "BusModuleV1.0"
static const String HW_VERSION = "1.0"
static const String FW_VERSION = "1.0"
static constexpr uint8_t GPIO_DEMAND = 3
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

◆ addI2CInterface()

bool BusModuleV1_0::addI2CInterface ( )

Add and configure the I2C interface for this module.

Inserts the I2C interface into the module interface array.

Returns
true if I2C interface setup succeeded, false otherwise.
Here is the caller graph for this function:

◆ addInterfaces()

bool BusModuleV1_0::addInterfaces ( )
overridevirtual

Add interfaces provided by the BusModule to the module interface list.

Adds UART and I2C interfaces (I2C stubbed) and logs the operation.

Returns
true if interfaces were added successfully, false otherwise.

Implements CANTramModule.

Here is the call graph for this function:

◆ addUARTInterface()

bool BusModuleV1_0::addUARTInterface ( )

Add and configure the UART interface for this module.

Inserts the UART interface into the module interface array, validates associated pins and configures UART core pins.

Returns
true if UART interface setup succeeded, false otherwise.
Here is the caller graph for this function:

◆ attachModule()

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

Attach this module to a slot and GPIO start index.

Calls the base CANTramModule attach implementation and performs any module-specific attach logic.

Parameters
slotSlot index to attach the module to.
gpioStartStarting GPIO index assigned to this module.
Returns
true if the attach operation was successful, false otherwise.

Reimplemented from CANTramModule.

Here is the call graph for this function:

◆ cycle()

void BusModuleV1_0::cycle ( uint8_t * response)
overridevirtual

Periodic cycle callback for the BusModule.

Called by the core to perform periodic tasks. Implement module-specific cyclic behavior here.

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

Reimplemented from CANTramModule.

◆ getFWVersion()

String BusModuleV1_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 BusModuleV1_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 BusModuleV1_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 BusModuleV1_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 BusModuleV1_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 BusModuleV1_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 ** BusModuleV1_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 BusModuleV1_0::initialize ( )
overridevirtual

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.

Implements CANTramModule.

◆ preInitialize()

bool BusModuleV1_0::preInitialize ( )
overridevirtual

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 from CANTramModule.

◆ provideGPIOs()

bool BusModuleV1_0::provideGPIOs ( )
overridevirtual

Provide GPIO definitions to the core.

Placeholder for BusModule-specific GPIO provisioning. Currently does not register additional GPIOs.

Returns
true on success.

Implements CANTramModule.

◆ provideHardwareResources()

bool BusModuleV1_0::provideHardwareResources ( )
overridevirtual

Provide hardware resources to CANTramCore.

Placeholder for attaching hardware resources (UART, I2C, SPI, etc.) that BusModule may provide.

Returns
true on success.

Implements CANTramModule.

◆ requestGPIOs()

bool BusModuleV1_0::requestGPIOs ( )
overridevirtual

Request GPIO definitions from CANTramCore and validate pins for module interfaces.

Retrieves UART RX/TX and SPI CS output definitions from the core, validates they are not on shift registers and logs the assigned pins. Invalid pins will cause related interfaces to be invalidated.

Returns
true if all required GPIO definitions were found and valid, false otherwise.

Implements CANTramModule.

Here is the call graph for this function:

◆ requestHardwareResources()

bool BusModuleV1_0::requestHardwareResources ( )
overridevirtual

Request hardware resources required by the BusModule.

Attempts to acquire a UART hardware resource from CANTramCore and assigns it to the module's UART interface. If no UART resource is available the UART interface is invalidated.

Returns
true if required resources were successfully acquired, false otherwise.

Implements CANTramModule.

◆ reset()

bool BusModuleV1_0::reset ( )
overridevirtual

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 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/BusModule.h
  • C:/Users/leowa/Documents/PlatformIO/Projects/CANTramFrameworkUsage/lib/CANTramFramework/src/modules/BusModule.cpp