From b55704a1e477c7c92c44a6585743585bb96e264b Mon Sep 17 00:00:00 2001 From: iMega34 Date: Sat, 26 Oct 2024 21:19:57 +0000 Subject: [PATCH 1/2] Proposal for `Controller` interface --- inc/Controller.hpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 inc/Controller.hpp diff --git a/inc/Controller.hpp b/inc/Controller.hpp new file mode 100644 index 0000000..280833d --- /dev/null +++ b/inc/Controller.hpp @@ -0,0 +1,29 @@ + +/** + * @brief Interface for motor speed controllers + * @author Erick Daniel Ortiz Cervantes + * @date October 26, 2024 + */ +#ifndef Controller_HPP +#define Controller_HPP + +#include "stm32f4xx_hal.h" + +typedef enum { PWM, CAN } ControllerType; + +class Controller { + private: + ControllerType type; + + public: + Controller(); + ~Controller(); + + void setType(ControllerType); + + virtual void sendSignal(uint32_t); + virtual uint32_t readSignal(); + virtual void stopActuator(uint32_t); +}; + +#endif From 60bcde0915ad52010e84e2977560b889e2f4515e Mon Sep 17 00:00:00 2001 From: iMega34 Date: Sat, 26 Oct 2024 21:24:50 +0000 Subject: [PATCH 2/2] Added missing documentation --- inc/Controller.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/inc/Controller.hpp b/inc/Controller.hpp index 280833d..f7b5082 100644 --- a/inc/Controller.hpp +++ b/inc/Controller.hpp @@ -13,6 +13,7 @@ typedef enum { PWM, CAN } ControllerType; class Controller { private: + // Defines the controller type for debugging purposes ControllerType type; public: @@ -20,7 +21,9 @@ class Controller { ~Controller(); void setType(ControllerType); + ControllerType getType(); + // Abstract functions virtual void sendSignal(uint32_t); virtual uint32_t readSignal(); virtual void stopActuator(uint32_t);