11#include "UARTInterface.h"
13#include "I2CInterface.h"
17 static const String HW_TYPE;
18 String
getHWType()
const override {
return HW_TYPE; }
19 static const String HW_VERSION;
21 static const String FW_VERSION;
23 static constexpr uint8_t GPIO_DEMAND = 3;
25 static constexpr uint8_t GPIO_SUPPLY = 0;
28 bool attachModule(uint8_t slot,uint8_t gpioStart)
override;
34 bool addSPIDevice(
SPIChip* spiDevice,
bool allowOverride =
false);
36 bool setLoopFunction(std::function<
void(uint8_t* response)> loopFunction){_loopFunction = loopFunction;
return true; };
41 void cycle(uint8_t* response)
override;
43 bool reset()
override;
56 static constexpr size_t INTERFACE_COUNT = 2;
60 std::function<void(uint8_t* response)> _loopFunction =
nullptr;
This class serves as the core manager for the CANTram modular system. It handles module attachment,...
Base class for CANTram hardware modules.
Logging and debug macro definitions for CANTramCore.
Abstract base for UART hardware cores and provider interface.
Definition BusModule.h:15
bool attachModule(uint8_t slot, uint8_t gpioStart) override
Attach this module to a slot and GPIO start index.
Definition BusModule.cpp:16
void cycle(uint8_t *response) override
Periodic cycle callback for the BusModule.
Definition BusModule.cpp:194
bool requestGPIOs() override
Request GPIO definitions from CANTramCore and validate pins for module interfaces.
Definition BusModule.cpp:41
bool provideHardwareResources() override
Provide hardware resources to CANTramCore.
Definition BusModule.cpp:117
String getHWVersion() const override
Get the hardware version string.
Definition BusModule.h:20
bool addI2CInterface()
Add and configure the I2C interface for this module.
Definition BusModule.cpp:243
bool requestHardwareResources() override
Request hardware resources required by the BusModule.
Definition BusModule.cpp:128
uint8_t getGPIODemand() const override
Get the GPIO demand of the module.
Definition BusModule.h:24
size_t getInterfaceCount() override
Get number of interfaces provided by the module.
Definition BusModule.h:46
uint8_t getGPIOSupply() const override
Get the GPIO supply capacity of the module.
Definition BusModule.h:26
String getFWVersion() const override
Get the firmware version string.
Definition BusModule.h:22
String getHWType() const override
Get the hardware type string.
Definition BusModule.h:18
bool addInterfaces() override
Add interfaces provided by the BusModule to the module interface list.
Definition BusModule.cpp:207
bool reset() override
Reset the module to a known default state.
Definition BusModule.cpp:315
bool preInitialize() override
Pre-initialize the module after attachment and provisioning.
Definition BusModule.cpp:277
bool provideGPIOs() override
Provide GPIO definitions to the core.
Definition BusModule.cpp:30
bool addUARTInterface()
Add and configure the UART interface for this module.
Definition BusModule.cpp:225
bool initialize() override
Initialize the module after attachment and provisioning.
Definition BusModule.cpp:271
Interface ** getInterfaces() override
Get pointer to module's interface array.
Definition BusModule.h:45
CANTramModule()=default
Default constructor.
Definition I2CInterface.h:8
Describes an available output (GPIO or shift register bit).
Definition OutputDefinition.h:24
Definition UARTInterface.h:7