|
CANTram Framework 1.0.1
Dieses Framework ermöglicht die Nutzung der CANTram Hardware, einer Mikrocontroller basierten mdoularen Steuerung.
|


Public Types | |
| enum | ERROR_CODES { STATUS_OK = 0 , DEACTIVATED_CHANNEL = 11 } |
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. | |
| DigitalModuleV1_0 (uint8_t outputMask=0xF0) | |
| Construct a DigitalModuleV1_0 instance. | |
| bool | attachModule (uint8_t slot, uint8_t gpioStart) override |
| Attach the module to a slot and assign GPIO range. | |
| bool | provideGPIOs () override |
| Provide GPIO definitions to the core. | |
| bool | requestGPIOs () override |
| Request and configure GPIOs from the core. | |
| bool | provideHardwareResources () override |
| Provide hardware resources to the core. | |
| bool | requestHardwareResources () override |
| Request hardware resources required by this module. | |
| bool | addInterfaces () override |
| Add and validate interfaces provided by the module. | |
| bool | initialize () override |
| Initialize the module and its IC drivers. | |
| void | cycle (uint8_t *response) override |
| Periodic cycle callback. | |
| void | setWireBreakMask (uint8_t mask=0) |
| Configure wire-break detection mask. | |
| Interface ** | getInterfaces () override |
| Get pointer to the module's interface array. | |
| size_t | getInterfaceCount () override |
| Get number of interfaces provided by this module. | |
| uint8_t | setOutputs (uint8_t outputs) |
| Set all digital outputs at once. | |
| uint8_t | setOutput (uint8_t output, bool state) |
| Set a single digital output. | |
| uint8_t | getInputs () const |
| Get current input states. | |
| uint8_t | getWireBreaks () const |
| Get current wire-break status. | |
| Public Member Functions inherited from CANTramModule | |
| CANTramModule ()=default | |
| Default constructor. | |
| virtual | ~CANTramModule ()=default |
| Destructor. | |
| 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 bool | preInitialize () |
| Pre-initialize the module after attachment and provisioning. | |
Additional Inherited Members | |
| Protected Attributes inherited from CANTramModule | |
| uint8_t | SLOT = 0 |
| uint8_t | GPIO_START = 0 |
| DigitalModuleV1_0::DigitalModuleV1_0 | ( | uint8_t | outputMask = 0xF0 | ) |
Construct a DigitalModuleV1_0 instance.
Construct a new DigitalModuleV1_0 object.
Create the digital module and configure which channels act as outputs using the outputMask.
| outputMask | Bitmask where a set bit configures the corresponding channel as an output. |
Initializes internal state, output mask and constructs input/output IC driver and interface objects.
| outputMask | Bitmask selecting which channels are configured as outputs. |
|
overridevirtual |
Add and validate interfaces provided by the module.
Add and configure interfaces exposed by the module.
Populate the internal Interface* array with DigitalInput/DigitalOutput instances and validate them.
Populates the module's internal interface array with DigitalInput and DigitalOutput instances, sets interface names and validates them based on availability of CS pins and output mask.
Implements CANTramModule.
|
overridevirtual |
Attach the module to a slot and assign GPIO range.
Attach module to a slot and assign GPIO start index.
Performs CANTramModule base attach logic and any module specific attach-time configuration.
| slot | Slot index to attach the module to. |
| gpioStart | Starting GPIO index assigned to this module. |
Calls the base CANTramModule attach implementation and performs any DigitalModule-specific attach logic.
| slot | Slot index to attach the module to. |
| gpioStart | Starting GPIO index assigned to this module. |
Reimplemented from CANTramModule.

|
overridevirtual |
Periodic cycle callback.
Periodic cycle handler called by the core.
Called by the core to perform cyclic tasks: update outputs, read inputs and update interface values.
| response | Optional pointer to a response buffer where response bytes may be written (may be nullptr). |
Updates outputs based on interface values, writes outputs to the output IC, reads inputs from the input IC (with repeated fetches for stability), and updates input interface values.
| response | Optional pointer to a response buffer; may be nullptr if not used. |
Reimplemented from CANTramModule.
|
inlineoverridevirtual |
Get the firmware version string.
Returns the firmware version string implemented by the module.
Implements CANTramModule.
|
inlineoverridevirtual |
Get the GPIO demand of the module.
Returns how many GPIOs this module requires from the core.
Implements CANTramModule.
|
inlineoverridevirtual |
Get the GPIO supply capacity of the module.
Returns how many GPIOs this module provides/supplies to the system.
Implements CANTramModule.
|
inlineoverridevirtual |
Get the hardware type string.
Returns a human readable hardware type identifier for the concrete module implementation.
Implements CANTramModule.
|
inlineoverridevirtual |
Get the hardware version string.
Returns the hardware revision/version string for the module.
Implements CANTramModule.
|
inline |
Get current input states.
Returns the cached input state byte where each bit represents an input channel state.
|
inlineoverridevirtual |
Get number of interfaces provided by this module.
Returns the compile-time count of interface slots for this module.
Implements CANTramModule.
|
inlineoverridevirtual |
Get pointer to the module's interface array.
Returns a pointer to the internal array of Interface pointers for enumeration by the core.
Implements CANTramModule.
|
inline |
Get current wire-break status.
Returns the cached wire-break status byte where each bit represents a wire-break flag for a channel.
|
overridevirtual |
Initialize the module and its IC drivers.
Initialize the digital module hardware and ICs.
Configure and start the input/output driver ICs, set up external CS handling and prepare for operation.
Initializes output and input ICs, configures external chip-select handling using the configured CS output providers, and starts IC drivers. Logs configuration state for debugging.
Implements CANTramModule.
|
overridevirtual |
Provide GPIO definitions to the core.
Declare any GPIOs this module provides to CANTramCore. Called during attachment.
Placeholder: the digital module does not add additional GPIO definitions beyond core expectations.
Implements CANTramModule.
|
overridevirtual |
Provide hardware resources to the core.
Provide hardware resources to CANTramCore.
Attach any HardwareResource instances offered by this module so other modules can request them.
Currently no additional hardware resources are attached by this module.
Implements CANTramModule.
|
overridevirtual |
Request and configure GPIOs from the core.
Request and configure GPIOs used by the module.
Obtain OutputDefinition pointers for CS pins and configure their initialValue and mode. This method must keep the configuration and initialValue assignment for correct operation.
Obtains CS output definitions from CANTramCore for outputs and inputs, configures them as outputs, and sets their initial state to HIGH (deselected). Logs errors when definitions are missing.
Implements CANTramModule.

|
overridevirtual |
Request hardware resources required by this module.
Request hardware resources required by the module.
Acquire shared hardware resources (if any) from CANTramCore for module operation.
Placeholder for requesting shared hardware resources. Returns true by default.
Implements CANTramModule.
| uint8_t DigitalModuleV1_0::setOutput | ( | uint8_t | output, |
| bool | state ) |
Set a single digital output.
Set or clear a single output bit in the module's cached output state if the channel is configured as output.
| output | Index of the output channel (0..7). |
| state | Desired logical state for the channel (true = HIGH, false = LOW). |
Sets or clears the specified output bit in the module's cached output state if that channel is configured as an output.
| output | Index of the output channel (0..7). |
| state | Desired logical state for the channel (true = HIGH, false = LOW). |
| uint8_t DigitalModuleV1_0::setOutputs | ( | uint8_t | outputs | ) |
Set all digital outputs at once.
Update the module's outputs cache and corresponding output interfaces, respecting the output mask.
| outputs | Byte containing 8 output bits (bit0..bit7). |
Updates the module's cached output state respecting the output mask and writes the values into the output interfaces.
| outputs | Byte containing 8 output bits (bit0..bit7). |
| void DigitalModuleV1_0::setWireBreakMask | ( | uint8_t | mask = 0 | ) |
Configure wire-break detection mask.
Configure wire-break mask for input detection.
Apply the provided mask to enable/disable wire-break detection per channel on the input IC.
| mask | Bitmask indicating channels for which wire-break detection should be active. |
Iterates through channels and sets the wire-break detection mask on the input IC. Logs errors for any failure to apply the mask on individual channels.
| mask | Bitmask specifying which channels should have wire-break detection enabled. |