mirror of
https://github.com/Lemonochrme/clover.git
synced 2025-06-08 08:40:50 +02:00
39 lines
No EOL
887 B
C++
39 lines
No EOL
887 B
C++
#ifndef _HEADER_COMPONENT
|
|
#define _HEADER_COMPONENT
|
|
#include <Arduino.h>
|
|
#include <any>
|
|
|
|
enum class ComponentType {
|
|
Digital,
|
|
Analog
|
|
};
|
|
|
|
class Component{
|
|
public:
|
|
/**
|
|
* @brief Construct a new Component object
|
|
*
|
|
* @param ct see ComponentType enum
|
|
* @param p pin conncted to the Component
|
|
*/
|
|
Component(ComponentType ct, uint8_t p);
|
|
|
|
/**
|
|
* @brief Get the Value as an std::any
|
|
*
|
|
* @return std::any recast into the type depending on the component
|
|
*/
|
|
std::any getValue();
|
|
|
|
/**
|
|
* @brief Send the value as an std::any,
|
|
*
|
|
* @param data be careful of the component type of the object
|
|
*/
|
|
void sendValue(std::any data);
|
|
private:
|
|
ComponentType _type;
|
|
const uint8_t _pin;
|
|
};
|
|
|
|
#endif //_HEADER_COMPONENT
|