![]() |
Open FFBoard
Open source force feedback firmware
|
#include <SPIButtons.h>
Public Member Functions | |
| virtual | ~SPI_Buttons () |
| uint8_t | readButtons (uint64_t *buf) |
| CommandStatus | command (const ParsedCommand &cmd, std::vector< CommandReply > &replies) override |
| void | registerCommands () |
| virtual std::string | getHelpstring () |
| void | saveFlash () |
| void | restoreFlash () |
| std::string | printModes (const std::vector< std::string > &names) |
| void | setMode (SPI_BtnMode mode) |
| void | initSPI () |
| const ClassType | getClassType () override |
| returns the used classchooser selection id of this instance | |
| void | setSpiSpeed (uint8_t speedPreset) |
Public Member Functions inherited from ButtonSource | |
| ButtonSource () | |
| virtual | ~ButtonSource () |
| virtual uint16_t | getBtnNum () |
| virtual const ClassIdentifier | getInfo ()=0 |
Public Member Functions inherited from ChoosableClass | |
| virtual | ~ChoosableClass () |
| uint16_t | getSelectionID () |
Public Member Functions inherited from PersistentStorage | |
| PersistentStorage () | |
| virtual | ~PersistentStorage () |
| void | restoreFlashDelayed () |
Public Member Functions inherited from CommandHandler | |
| 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 const ClassIdentifier | getInfo ()=0 |
| Command handlers always have class infos. Works well with ChoosableClass. | |
| 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) |
Public Member Functions inherited from SPIDevice | |
| SPIDevice (SPIPort &port, OutputPin csPin) | |
| SPIDevice (SPIPort &port, SPIConfig &spiConfig) | |
| virtual | ~SPIDevice () |
| void | assertChipSelect () |
| void | clearChipSelect () |
| virtual bool | updateCSPin (OutputPin &csPin) |
| virtual void | spiTxCompleted (SPIPort *port) |
| virtual void | spiRxCompleted (SPIPort *port) |
| virtual void | spiTxRxCompleted (SPIPort *port) |
| virtual void | spiRequestError (SPIPort *port) |
| virtual void | beginSpiTransfer (SPIPort *port) |
| virtual void | endSpiTransfer (SPIPort *port) |
| virtual SPIConfig * | getSpiConfig () |
Public Attributes | |
| const uint8_t | maxButtons = 64 |
Static Public Attributes | |
| static const std::vector< std::string > | mode_names = {"Thrustmaster/HEF4021BT","74xx165"} |
| static const std::vector< std::string > | speed_names = {"Fast","Medium","Slow"} |
Static Public Attributes inherited from ButtonSource | |
| static ClassIdentifier | info |
| static const std::vector< class_entry< ButtonSource > > | all_buttonsources |
Static Public Attributes inherited from ChoosableClass | |
| static ClassIdentifier | info |
Static Public Attributes inherited from CommandHandler | |
| static bool | logEnabled = true |
Protected Member Functions | |
| SPI_Buttons (uint16_t configuration_address, uint16_t configuration_address_2) | |
Protected Member Functions inherited from CommandHandler | |
| void | setInstance (uint8_t instance) |
| virtual void | addCommandHandler () |
| virtual void | removeCommandHandler () |
Protected Member Functions inherited from SPIDevice | |
| virtual void | setSpiConfig (SPIConfig config) |
Private Types | |
| enum class | SPIButtons_commands : uint32_t { mode , btncut , btnpol , btnnum , cs , spispeed } |
Private Member Functions | |
| void | setConfig (ButtonSourceConfig config) |
| virtual ButtonSourceConfig * | getConfig () |
| void | process (uint64_t *buf) |
Private Attributes | |
| uint16_t | configuration_address |
| uint16_t | configuration_address_2 |
| bool | ready = false |
| uint8_t | bytes = 4 |
| uint64_t | mask = 0xff |
| uint8_t | offset = 0 |
| ButtonSourceConfig | conf |
| uint8_t | spi_buf [4] = {0} |
Static Private Attributes | |
| static constexpr std::array< uint32_t, 3 > | speedPresets = {SPI_BAUDRATEPRESCALER_16,SPI_BAUDRATEPRESCALER_32,SPI_BAUDRATEPRESCALER_64} |
Additional Inherited Members | |
Static Public Member Functions inherited from ButtonSource | |
| static bool | isCreatable () |
Static Public Member Functions inherited from ChoosableClass | |
| static bool | isCreatable () |
Static Public Member Functions inherited from PersistentStorage | |
| static std::vector< PersistentStorage * > & | getFlashHandlers () |
| static void | restoreFlashStartupCb () |
Static Public Member Functions inherited from CommandHandler | |
| static void | logSerial (std::string string) |
| Send a log formatted sequence. | |
| static void | logSerialDebug (std::string string) |
| Send a log formatted sequence if debug is on. | |
| 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 Protected Member Functions inherited from CommandHandler | |
| static std::vector< uint16_t > & | getCommandHandlerIds () |
Protected Attributes inherited from ButtonSource | |
| uint16_t | btnnum = 0 |
Protected Attributes inherited from ChoosableClass | |
| uint16_t | selectionId |
| Should only be written by ClassChooser during creation. | |
Protected Attributes inherited from PersistentStorage | |
| bool | restoreDelayedFlag = false |
Protected Attributes inherited from CommandHandler | |
| bool | commandsEnabled = true |
| std::vector< CmdHandlerCommanddef > | registeredCommands |
| CmdHandlerInfo | cmdHandlerInfo |
Protected Attributes inherited from SPIDevice | |
| SPIPort & | spiPort |
| SPIConfig | spiConfig |
Static Protected Attributes inherited from PersistentStorage | |
| static bool | startupComplete = false |
Definition at line 35 of file SPIButtons.h.
|
strongprivate |
| Enumerator | |
|---|---|
| mode | |
| btncut | |
| btnpol | |
| btnnum | |
| cs | |
| spispeed | |
Definition at line 37 of file SPIButtons.h.
|
virtual |
Definition at line 74 of file SPIButtons.cpp.
|
protected |
Definition at line 47 of file SPIButtons.cpp.
|
overridevirtual |
| [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 202 of file SPIButtons.cpp.
|
inlineoverridevirtual |
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 61 of file SPIButtons.h.
|
privatevirtual |
Definition at line 142 of file SPIButtons.cpp.
|
inlinevirtual |
Returns a description of this class
Reimplemented from CommandHandler.
Definition at line 51 of file SPIButtons.h.
| void SPI_Buttons::initSPI | ( | ) |
Definition at line 68 of file SPIButtons.cpp.
| std::string SPI_Buttons::printModes | ( | const std::vector< std::string > & | names | ) |
Definition at line 194 of file SPIButtons.cpp.
|
private |
Definition at line 167 of file SPIButtons.cpp.
|
virtual |
Return a bit field without offset of pressed buttons in the supplied buffer. Returns amount of button read.
Implements ButtonSource.
| void SPI_Buttons::registerCommands | ( | ) |
Definition at line 79 of file SPIButtons.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 160 of file SPIButtons.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 153 of file SPIButtons.cpp.
|
private |
Definition at line 97 of file SPIButtons.cpp.
| void SPI_Buttons::setMode | ( | SPI_BtnMode | mode | ) |
Called on preset change
Definition at line 92 of file SPIButtons.cpp.
| void SPI_Buttons::setSpiSpeed | ( | uint8_t | speedPreset | ) |
Definition at line 146 of file SPIButtons.cpp.
|
private |
Definition at line 75 of file SPIButtons.h.
|
private |
Definition at line 79 of file SPIButtons.h.
|
private |
Definition at line 69 of file SPIButtons.h.
|
private |
Definition at line 70 of file SPIButtons.h.
|
private |
Definition at line 76 of file SPIButtons.h.
| const uint8_t SPI_Buttons::maxButtons = 64 |
Definition at line 56 of file SPIButtons.h.
|
static |
Definition at line 18 of file SPIButtons.h.
|
private |
Definition at line 77 of file SPIButtons.h.
|
private |
Definition at line 71 of file SPIButtons.h.
|
static |
Definition at line 19 of file SPIButtons.h.
|
staticconstexprprivate |
Definition at line 83 of file SPIButtons.h.
|
private |
Definition at line 81 of file SPIButtons.h.