Open FFBoard
Open source force feedback firmware
SelectableInputs.h
Go to the documentation of this file.
1/*
2 * SelectableInputs.h
3 *
4 * Created on: Apr 28, 2025
5 * Author: Yannick
6 */
7
8#ifndef SRC_SELECTABLEINPUTS_H_
9#define SRC_SELECTABLEINPUTS_H_
10#include "AnalogSource.h"
11#include "ButtonSource.h"
12#include "semaphore.hpp"
13
18public:
20 virtual ~SelectableInputs();
21
22 virtual void setBtnTypes(uint16_t btntypes);
23 virtual void addBtnType(uint16_t id);
24 virtual void clearBtnTypes();
25
26 virtual void setAinTypes(uint16_t aintypes);
27 virtual void addAinType(uint16_t id);
28 virtual void clearAinTypes();
29
30 virtual uint8_t getButtonValues(uint64_t &values);
31 virtual std::vector<int32_t>* getAnalogValues();
32
33
34protected:
35 std::vector<std::unique_ptr<ButtonSource>> btns;
36 std::vector<std::unique_ptr<AnalogSource>> analog_inputs;
37
39
40 uint16_t btnsources = 0; // Disabled by default
41 uint16_t ainsources = 0;
42
43 std::vector<int32_t> analogsources_buf; // Persistent buffer
44
47};
48
49#endif /* SRC_SELECTABLEINPUTS_H_ */
virtual void setAinTypes(uint16_t aintypes)
virtual void setBtnTypes(uint16_t btntypes)
virtual void clearAinTypes()
virtual void addAinType(uint16_t id)
std::vector< int32_t > analogsources_buf
cpp_freertos::BinarySemaphore sourcesSem
virtual std::vector< int32_t > * getAnalogValues()
virtual void addBtnType(uint16_t id)
ClassChooser< AnalogSource > analog_chooser
SelectableInputs(const ClassChooser< ButtonSource > &btn_chooser, const ClassChooser< AnalogSource > &analog_chooser)
virtual void clearBtnTypes()
std::vector< std::unique_ptr< ButtonSource > > btns
std::vector< std::unique_ptr< AnalogSource > > analog_inputs
ClassChooser< ButtonSource > btn_chooser
virtual ~SelectableInputs()
virtual uint8_t getButtonValues(uint64_t &values)