![]() |
Open FFBoard
Open source force feedback firmware
|
#include <LocalButtons.h>
Public Member Functions | |
LocalButtons () | |
virtual | ~LocalButtons () |
uint8_t | readButtons (uint64_t *buf) |
uint8_t | getButtonInputs (uint64_t *buf, bool pol) |
const ClassIdentifier | getInfo () |
CommandStatus | command (const ParsedCommand &cmd, std::vector< CommandReply > &replies) |
std::string | getHelpstring () |
void | saveFlash () |
void | restoreFlash () |
const ClassType | getClassType () |
returns the used classchooser selection id of this instance More... | |
![]() | |
ButtonSource () | |
virtual | ~ButtonSource () |
virtual uint16_t | getBtnNum () |
![]() | |
virtual | ~ChoosableClass () |
uint16_t | getSelectionID () |
![]() | |
PersistentStorage () | |
virtual | ~PersistentStorage () |
void | restoreFlashDelayed () |
Static Public Member Functions | |
static bool | isCreatable () |
static bool | readButton (int button_num) |
![]() | |
static bool | isCreatable () |
![]() | |
static bool | isCreatable () |
![]() | |
static std::vector< PersistentStorage * > & | getFlashHandlers () |
static void | restoreFlashStartupCb () |
Static Public Attributes | |
static ClassIdentifier | info |
static constexpr uint16_t | maxButtons {BUTTON_PINS} |
![]() | |
static ClassIdentifier | info |
static const std::vector< class_entry< ButtonSource > > | all_buttonsources |
![]() | |
static ClassIdentifier | info |
Private Types | |
enum class | LocalButtons_commands : uint32_t { mask , polarity , pins , values , pulse } |
Private Member Functions | |
void | setMask (uint32_t mask) |
![]() | |
CommandHandler (const char *clsname, uint16_t clsid, uint8_t instance=0) | |
virtual | ~CommandHandler () |
virtual bool | hasCommands () |
virtual void | setCommandsEnabled (bool enable) |
void | registerCommands () |
virtual CommandStatus | internalCommand (const ParsedCommand &cmd, std::vector< CommandReply > &replies) |
virtual std::string | getCommandsHelpstring () |
virtual std::string | getCsvHelpstring () |
virtual uint8_t | getCommandHandlerInstance () |
void | broadcastCommandReply (CommandReply reply, uint32_t cmdId, CMDtype type) |
void | sendCommandReplyAsync (CommandReply reply, uint32_t cmdId, CMDtype type, CommandInterface *interface=nullptr) |
virtual uint16_t | getCommandHandlerID () |
virtual CmdHandlerInfo * | getCommandHandlerInfo () |
virtual bool | isValidCommandId (uint32_t cmdid, uint32_t ignoredFlags=0, uint32_t requiredFlag=0) |
virtual CmdHandlerCommanddef * | getCommandFromName (const std::string &cmd, uint32_t ignoredFlags=0) |
virtual CmdHandlerCommanddef * | getCommandFromId (const uint32_t id, uint32_t ignoredFlags=0) |
template<typename ID > | |
void | registerCommand (const char *cmd, const ID cmdid, const char *help=nullptr, uint32_t flags=0) |
void | setInstance (uint8_t instance) |
virtual void | addCommandHandler () |
virtual void | removeCommandHandler () |
Private Attributes | |
uint32_t | mask = 0xff |
uint32_t | pulsemask = 0 |
uint32_t | lastPulseTime = 0 |
bool | polarity = false |
uint64_t | lastOutputs = 0 |
uint64_t | lastButtons = 0 |
![]() | |
bool | commandsEnabled = true |
std::vector< CmdHandlerCommanddef > | registeredCommands |
CmdHandlerInfo | cmdHandlerInfo |
Static Private Attributes | |
static constexpr uint32_t | pulseTimeout = 50 |
static const std::array< InputPin, BUTTON_PINS > | button_pins |
![]() | |
static bool | logEnabled = true |
Additional Inherited Members | |
![]() | |
uint16_t | btnnum = 0 |
![]() | |
uint16_t | selectionId |
Should only be written by ClassChooser during creation. More... | |
![]() | |
bool | restoreDelayedFlag = false |
![]() | |
static bool | startupComplete = false |
![]() | |
static void | logSerial (std::string string) |
Send a log formatted sequence. More... | |
static void | logSerialDebug (std::string string) |
Send a log formatted sequence if debug is on. More... | |
static bool | logsEnabled () |
static void | setLogsEnabled (bool enabled) |
static uint32_t | getClassIdFromName (const char *name) |
static const char * | getClassNameFromId (const uint32_t id) |
static CommandHandler * | getHandlerFromHandlerId (const uint16_t cmdhandlerID) |
static CommandHandler * | getHandlerFromId (const uint16_t id, const uint8_t instance=0xFF) |
static CommandHandler * | getHandlerFromClassName (const char *name, const uint8_t instance=0xFF) |
static std::vector< CommandHandler * > | getHandlersFromClassName (const char *name) |
static std::vector< CommandHandler * > | getHandlersFromId (const uint16_t id) |
static bool | isInHandlerList (CommandHandler *handler) |
static std::string | getAllHelpstrings () |
static std::vector< CommandHandler * > & | getCommandHandlers () |
template<typename TVal > | |
static CommandStatus | handleGetSet (const ParsedCommand &cmd, std::vector< CommandReply > &replies, TVal &value) |
template<typename TVal , class cls , class cls1 > | |
static CommandStatus | handleGetSetFunc (const ParsedCommand &cmd, std::vector< CommandReply > &replies, TVal &value, void(cls1::*setfunc)(TVal), cls *obj) |
template<typename TVal , class cls , class cls1 , class cls2 > | |
static CommandStatus | handleGetFuncSetFunc (const ParsedCommand &cmd, std::vector< CommandReply > &replies, TVal(cls1::*getfunc)(), void(cls2::*setfunc)(TVal), cls *obj) |
template<typename TVal , class cls , class cls1 > | |
static CommandStatus | handleGetFuncSet (const ParsedCommand &cmd, std::vector< CommandReply > &replies, TVal &value, TVal(cls1::*getfunc)(), cls *obj) |
static std::vector< uint16_t > & | getCommandHandlerIds () |
Definition at line 18 of file LocalButtons.h.
|
strongprivate |
Enumerator | |
---|---|
mask | |
polarity | |
pins | |
values | |
pulse |
Definition at line 19 of file LocalButtons.h.
LocalButtons::LocalButtons | ( | ) |
Definition at line 15 of file LocalButtons.cpp.
|
virtual |
Definition at line 27 of file LocalButtons.cpp.
|
virtual |
[in] | cmd | The parsed command to be executed. |
[out] | replies | A vector to return one or multiple reply objects into. Replies to the interface will be generated based on the reply objects. A string reply may not contain start, end and separation markers: [,],| Other characters are allowed. |
Reimplemented from CommandHandler.
Definition at line 112 of file LocalButtons.cpp.
uint8_t LocalButtons::getButtonInputs | ( | uint64_t * | buf, |
bool | pol | ||
) |
Definition at line 46 of file LocalButtons.cpp.
|
inlinevirtual |
returns the used classchooser selection id of this instance
Type of this class. Mainclass, motordriver... Should be implemented by the parent class so it is not in the info struct
Reimplemented from ButtonSource.
Definition at line 58 of file LocalButtons.h.
|
inlinevirtual |
Returns a description of this class
Reimplemented from CommandHandler.
Definition at line 46 of file LocalButtons.h.
|
virtual |
Implements ButtonSource.
Definition at line 31 of file LocalButtons.cpp.
|
inlinestatic |
Definition at line 40 of file LocalButtons.h.
|
inlinestatic |
Definition at line 51 of file LocalButtons.h.
|
virtual |
Return a bit field without offset of pressed buttons in the supplied buffer. Returns amount of button read.
Implements ButtonSource.
Definition at line 61 of file LocalButtons.cpp.
|
virtual |
Should be implemented to restore settings. This is not automatically called and should be called when appropriate.
Reimplemented from PersistentStorage.
Definition at line 97 of file LocalButtons.cpp.
|
virtual |
Called when the user uses the "save" command and presses the save button in the configurator Automatically called by the command parser thread for every class that inherits from PersistentStorage
Reimplemented from PersistentStorage.
Definition at line 86 of file LocalButtons.cpp.
|
private |
Definition at line 35 of file LocalButtons.cpp.
|
staticprivate |
All DIN pins must be defined as inputs. Not more than 16 pins can be defined
Definition at line 29 of file LocalButtons.h.
|
static |
Definition at line 39 of file LocalButtons.h.
|
private |
Definition at line 31 of file LocalButtons.h.
|
private |
Definition at line 30 of file LocalButtons.h.
|
private |
Definition at line 26 of file LocalButtons.h.
|
private |
Definition at line 23 of file LocalButtons.h.
|
staticconstexpr |
Definition at line 42 of file LocalButtons.h.
|
private |
Definition at line 28 of file LocalButtons.h.
|
private |
Definition at line 24 of file LocalButtons.h.
|
staticconstexprprivate |
Definition at line 25 of file LocalButtons.h.