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
17
class
SelectableInputs
{
18
public
:
19
SelectableInputs
(
const
ClassChooser<ButtonSource>
&
btn_chooser
,
const
ClassChooser<AnalogSource>
&
analog_chooser
);
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
34
protected
:
35
std::vector<std::unique_ptr<ButtonSource>>
btns
;
36
std::vector<std::unique_ptr<AnalogSource>>
analog_inputs
;
37
38
cpp_freertos::BinarySemaphore
sourcesSem
=
cpp_freertos::BinarySemaphore
(
true
);
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
45
ClassChooser<ButtonSource>
btn_chooser
;
46
ClassChooser<AnalogSource>
analog_chooser
;
47
};
48
49
#endif
/* SRC_SELECTABLEINPUTS_H_ */
AnalogSource.h
ButtonSource.h
ClassChooser
Definition:
ClassChooser.h:87
SelectableInputs
Definition:
SelectableInputs.h:17
SelectableInputs::setAinTypes
virtual void setAinTypes(uint16_t aintypes)
Definition:
SelectableInputs.cpp:61
SelectableInputs::setBtnTypes
virtual void setBtnTypes(uint16_t btntypes)
Definition:
SelectableInputs.cpp:28
SelectableInputs::clearAinTypes
virtual void clearAinTypes()
Definition:
SelectableInputs.cpp:55
SelectableInputs::addAinType
virtual void addAinType(uint16_t id)
Definition:
SelectableInputs.cpp:75
SelectableInputs::analogsources_buf
std::vector< int32_t > analogsources_buf
Definition:
SelectableInputs.h:43
SelectableInputs::sourcesSem
cpp_freertos::BinarySemaphore sourcesSem
Definition:
SelectableInputs.h:38
SelectableInputs::getAnalogValues
virtual std::vector< int32_t > * getAnalogValues()
Definition:
SelectableInputs.cpp:105
SelectableInputs::ainsources
uint16_t ainsources
Definition:
SelectableInputs.h:41
SelectableInputs::addBtnType
virtual void addBtnType(uint16_t id)
Definition:
SelectableInputs.cpp:43
SelectableInputs::analog_chooser
ClassChooser< AnalogSource > analog_chooser
Definition:
SelectableInputs.h:46
SelectableInputs::SelectableInputs
SelectableInputs(const ClassChooser< ButtonSource > &btn_chooser, const ClassChooser< AnalogSource > &analog_chooser)
Definition:
SelectableInputs.cpp:10
SelectableInputs::clearBtnTypes
virtual void clearBtnTypes()
Definition:
SelectableInputs.cpp:22
SelectableInputs::btns
std::vector< std::unique_ptr< ButtonSource > > btns
Definition:
SelectableInputs.h:35
SelectableInputs::analog_inputs
std::vector< std::unique_ptr< AnalogSource > > analog_inputs
Definition:
SelectableInputs.h:36
SelectableInputs::btn_chooser
ClassChooser< ButtonSource > btn_chooser
Definition:
SelectableInputs.h:45
SelectableInputs::btnsources
uint16_t btnsources
Definition:
SelectableInputs.h:40
SelectableInputs::~SelectableInputs
virtual ~SelectableInputs()
Definition:
SelectableInputs.cpp:16
SelectableInputs::getButtonValues
virtual uint8_t getButtonValues(uint64_t &values)
Definition:
SelectableInputs.cpp:89
cpp_freertos::BinarySemaphore
Definition:
semaphore.hpp:194
semaphore.hpp
Firmware
FFBoard
Inc
SelectableInputs.h
Generated by
1.9.2