CANTram Framework 1.0.1
Dieses Framework ermöglicht die Nutzung der CANTram Hardware, einer Mikrocontroller basierten mdoularen Steuerung.
Loading...
Searching...
No Matches
CANTramModule.h
Go to the documentation of this file.
1#ifndef CANTRAMMODULE_H
2#define CANTRAMMODULE_H
3
4#include <Arduino.h>
5#include "Interface.h"
6#include "Debug.h"
7
15 public:
20 CANTramModule() = default;
21
26 virtual ~CANTramModule() = default;
27
33 virtual String getHWType() const = 0;
34
40 virtual String getHWVersion() const = 0;
41
47 virtual String getFWVersion() const = 0;
48
54 virtual uint8_t getGPIODemand() const = 0;
55
61 virtual uint8_t getGPIOSupply() const = 0;
62
68 virtual bool reset();
69
75 uint8_t getSlot() const { return SLOT; }
76
82 uint8_t getGPIOStart() const { return GPIO_START; }
83
89 virtual void cycle(uint8_t* response){
90 DEBUG_PRINTLN("[CANTramModule] cycle() called on module " + getHWType() + " in slot " + String(SLOT));
91 }
92
101 virtual bool attachModule(uint8_t slot, uint8_t gpioStart);
102
108 virtual bool provideGPIOs() = 0;
109
115 virtual bool requestGPIOs() = 0;
116
122 virtual bool provideHardwareResources() = 0;
123
129 virtual bool requestHardwareResources() = 0;
130
136 virtual bool addInterfaces() = 0;
137
143 virtual bool preInitialize() { return true; }
149 virtual bool initialize() = 0;
150
156 virtual Interface** getInterfaces() = 0;
157
163 virtual size_t getInterfaceCount() = 0;
164
165 protected:
166 uint8_t SLOT = 0;
167 uint8_t GPIO_START = 0;
168};
169
170#endif
Logging and debug macro definitions for CANTramCore.
#define DEBUG_PRINTLN(x)
Print a debug message with newline.
Definition Debug.h:63
virtual Interface ** getInterfaces()=0
Get pointer to module's interface array.
virtual bool addInterfaces()=0
Setup and validate module interfaces.
virtual void cycle(uint8_t *response)
Periodic cycle callback.
Definition CANTramModule.h:89
virtual bool preInitialize()
Pre-initialize the module after attachment and provisioning.
Definition CANTramModule.h:143
virtual String getHWType() const =0
Get the hardware type string.
virtual bool reset()
Reset the module to a known default state.
Definition CANTramModule.cpp:9
virtual String getHWVersion() const =0
Get the hardware version string.
virtual bool attachModule(uint8_t slot, uint8_t gpioStart)
Attach this module to a slot and assign GPIO range.
Definition CANTramModule.cpp:23
virtual size_t getInterfaceCount()=0
Get number of interfaces provided by the module.
virtual bool initialize()=0
Initialize the module after attachment and provisioning.
uint8_t getGPIOStart() const
Get starting GPIO index assigned to the module.
Definition CANTramModule.h:82
virtual bool requestGPIOs()=0
Request GPIO definitions from the core.
uint8_t getSlot() const
Get assigned slot index.
Definition CANTramModule.h:75
virtual bool requestHardwareResources()=0
Request hardware resources from the core.
virtual ~CANTramModule()=default
Destructor.
virtual bool provideHardwareResources()=0
Provide hardware resources (e.g., I2C, SPI, UART) to the core.
virtual bool provideGPIOs()=0
Provide GPIO definitions to the core.
virtual String getFWVersion() const =0
Get the firmware version string.
CANTramModule()=default
Default constructor.
virtual uint8_t getGPIOSupply() const =0
Get the GPIO supply capacity of the module.
virtual uint8_t getGPIODemand() const =0
Get the GPIO demand of the module.
Definition Interface.h:7