CANTram Framework 1.0.1
Dieses Framework ermöglicht die Nutzung der CANTram Hardware, einer Mikrocontroller basierten mdoularen Steuerung.
Loading...
Searching...
No Matches
AnalogModuleV1_0.h
1#ifndef ANALOG_MODULE_V1_0_H
2#define ANALOG_MODULE_V1_0_H
3
4#include <Arduino.h>
5#include "CANTramModule.h"
6#include "MAX22531.h"
7#include "Interface.h"
8#include "AnalogInput.h"
9#include "AnalogOutput.h"
10#include "OutputDefinition.h"
11#include "Debug.h"
12
13class AnalogModuleV1_0 : public CANTramModule {
14 public:
15
16 AnalogModuleV1_0() =default;
17
18 //Module information
19 static const String HW_TYPE;
20 String getHWType() const override { return HW_TYPE; }
21 static const String HW_VERSION;
22 String getHWVersion() const override { return HW_VERSION; }
23 static const String FW_VERSION;
24 String getFWVersion() const override { return FW_VERSION; }
25 static constexpr uint8_t GPIO_DEMAND = 5;
26 uint8_t getGPIODemand() const override { return GPIO_DEMAND; }
27 static constexpr uint8_t GPIO_SUPPLY = 0;
28 uint8_t getGPIOSupply() const override { return GPIO_SUPPLY; }
29
30 //Core functions
31 bool attachModule(uint8_t slot, uint8_t gpioStart) override;
32 bool provideGPIOs() override;
33 bool requestGPIOs() override;
34 bool provideHardwareResources() override;
35 bool requestHardwareResources() override;
36 bool addInterfaces() override;
37 bool initialize() override;
38 void cycle(uint8_t* response) override;
39 bool reset() override;
40
41 //Interfaces
42 Interface** getInterfaces() override { return _interfaces; }
43 size_t getInterfaceCount() override { return INTERFACE_COUNT; }
44
45 private:
46 static constexpr size_t INTERFACE_COUNT = 8;
47 Interface* _interfaces[INTERFACE_COUNT];
48 AnalogInput _analogInputInterfaces[4];
49 AnalogOutput _analogOutputInterfaces[4];
50 OutputDefinition* CS_INPUTS; //Chip select pin for the input chip
51 OutputDefinition* PWM_OUTPUTS[4]; //Pins for analog outputs
52
53 //Hardware
54 MAX22531 _Inputs;
55 Interface::Resolution _resolution = Interface::RES_12BIT;
56};
57
58#endif
Base class for CANTram hardware modules.
Logging and debug macro definitions for CANTramCore.
Definitions for GPIO/output descriptors and provider interfaces.
Definition AnalogInput.h:7
bool provideHardwareResources() override
Provide hardware resources to the core.
Definition AnalogModuleV1_0.cpp:72
bool attachModule(uint8_t slot, uint8_t gpioStart) override
Attach module to a slot and set GPIO start.
Definition AnalogModuleV1_0.cpp:17
bool provideGPIOs() override
Provide GPIO definitions to the core.
Definition AnalogModuleV1_0.cpp:28
Interface ** getInterfaces() override
Get pointer to module's interface array.
Definition AnalogModuleV1_0.h:42
size_t getInterfaceCount() override
Get number of interfaces provided by the module.
Definition AnalogModuleV1_0.h:43
String getHWType() const override
Get the hardware type string.
Definition AnalogModuleV1_0.h:20
String getHWVersion() const override
Get the hardware version string.
Definition AnalogModuleV1_0.h:22
uint8_t getGPIOSupply() const override
Get the GPIO supply capacity of the module.
Definition AnalogModuleV1_0.h:28
String getFWVersion() const override
Get the firmware version string.
Definition AnalogModuleV1_0.h:24
uint8_t getGPIODemand() const override
Get the GPIO demand of the module.
Definition AnalogModuleV1_0.h:26
bool requestHardwareResources() override
Request hardware resources required by the module.
Definition AnalogModuleV1_0.cpp:82
bool requestGPIOs() override
Request and configure GPIOs used by the module.
Definition AnalogModuleV1_0.cpp:38
bool initialize() override
Initialize the analog module and external ADC chip interface.
Definition AnalogModuleV1_0.cpp:153
void cycle(uint8_t *response) override
Periodic cycle handler called by the core.
Definition AnalogModuleV1_0.cpp:179
bool addInterfaces() override
Add interface objects to the module's interface list.
Definition AnalogModuleV1_0.cpp:120
bool reset() override
Reset the module and its interfaces.
Definition AnalogModuleV1_0.cpp:219
Analog output interface implementation.
Definition AnalogOutput.h:11
CANTramModule()=default
Default constructor.
Definition Interface.h:7
Definition MAX22531.h:23
Describes an available output (GPIO or shift register bit).
Definition OutputDefinition.h:24