![]() |
Open FFBoard
Open source force feedback firmware
|
#include <CanInputMain.h>
Public Member Functions | |
| CANInputMain () | |
| CANInputMain (CANPort &canport) | |
| virtual | ~CANInputMain () |
| const ClassIdentifier | getInfo () |
| CommandStatus | command (const ParsedCommand &cmd, std::vector< CommandReply > &replies) |
| void | registerCommands () |
| virtual std::string | getHelpstring () |
| void | usbInit () override |
| void | saveFlash () |
| void | restoreFlash () |
| void | Run () |
| void | updateControl () |
| void | sendReport () |
| void | setReportRate (uint8_t rateidx) |
| std::string | report_rates_names () |
Public Member Functions inherited from FFBoardMain | |
| const ClassType | getClassType () override |
| returns the used classchooser selection id of this instance | |
| FFBoardMain () | |
| virtual | ~FFBoardMain () |
| virtual void | update () |
| virtual void | cdcRcv (char *Buf, uint32_t *Len) |
| virtual void | cdcRcvReady (uint8_t itf) |
| virtual void | usbSuspend () |
| virtual void | usbResume () |
Public Member Functions inherited from ChoosableClass | |
| virtual | ~ChoosableClass () |
| uint16_t | getSelectionID () |
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 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 PersistentStorage | |
| PersistentStorage () | |
| virtual | ~PersistentStorage () |
| void | restoreFlashDelayed () |
Public Member Functions inherited from SelectableInputs | |
| SelectableInputs (const ClassChooser< ButtonSource > &btn_chooser, const ClassChooser< AnalogSource > &analog_chooser) | |
| virtual | ~SelectableInputs () |
| virtual void | setBtnTypes (uint16_t btntypes) |
| virtual void | addBtnType (uint16_t id) |
| virtual void | clearBtnTypes () |
| virtual void | setAinTypes (uint16_t aintypes) |
| virtual void | addAinType (uint16_t id) |
| virtual void | clearAinTypes () |
| virtual uint8_t | getButtonValues (uint64_t &values) |
| virtual std::vector< int32_t > * | getAnalogValues () |
Public Member Functions inherited from cpp_freertos::Thread | |
| Thread (const std::string Name, uint16_t StackDepth, UBaseType_t Priority) | |
| Thread (const char *Name, uint16_t StackDepth, UBaseType_t Priority) | |
| Thread (uint16_t StackDepth, UBaseType_t Priority) | |
| bool | Start () |
| virtual | ~Thread () |
| TaskHandle_t | GetHandle () |
| void | Suspend () |
| void | Resume () |
| void | ResumeFromISR () |
| void | Notify () |
| void | NotifyFromISR () |
| uint32_t | WaitForNotification (TickType_t Timeout=portMAX_DELAY) |
| UBaseType_t | GetPriority () |
| UBaseType_t | GetPriorityFromISR () |
| void | SetPriority (UBaseType_t NewPriority) |
| std::string | GetName () |
| char * | GetName () |
Static Public Member Functions | |
| static bool | isCreatable () |
Static Public Member Functions inherited from FFBoardMain | |
| static bool | isCreatable () |
Static Public Member Functions inherited from ChoosableClass | |
| static bool | isCreatable () |
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 Public Member Functions inherited from PersistentStorage | |
| static std::vector< PersistentStorage * > & | getFlashHandlers () |
| static void | restoreFlashStartupCb () |
Static Public Member Functions inherited from cpp_freertos::Thread | |
| static void | Yield () |
| static void | StartScheduler () |
| static void | EndScheduler () |
Static Public Attributes | |
| static ClassIdentifier | info |
Static Public Attributes inherited from FFBoardMain | |
| static ClassIdentifier | info ={.name = "Basic (Failsafe)" ,.id=0} |
Static Public Attributes inherited from ChoosableClass | |
| static ClassIdentifier | info |
Static Public Attributes inherited from CommandHandler | |
| static bool | logEnabled = true |
Protected Attributes | |
| uint32_t | report_rate_cnt = 0 |
| uint32_t | report_rate = 1 |
| std::vector< int32_t > | analogBuffer |
| uint64_t | digitalBuffer |
| CANPort & | can |
| uint32_t | buttons_id = 100 |
| uint32_t | analog_id = 110 |
| uint8_t | rate_idx = 0 |
| const std::array< uint8_t, 7 > | report_rates = {1,2,4,8,10,16,32} |
Protected Attributes inherited from FFBoardMain | |
| std::unique_ptr< USBdevice > | usbdev |
Protected Attributes inherited from ChoosableClass | |
| uint16_t | selectionId |
| Should only be written by ClassChooser during creation. | |
Protected Attributes inherited from CommandHandler | |
| bool | commandsEnabled = true |
| std::vector< CmdHandlerCommanddef > | registeredCommands |
| CmdHandlerInfo | cmdHandlerInfo |
Protected Attributes inherited from PersistentStorage | |
| bool | restoreDelayedFlag = false |
Protected Attributes inherited from SelectableInputs | |
| std::vector< std::unique_ptr< ButtonSource > > | btns |
| std::vector< std::unique_ptr< AnalogSource > > | analog_inputs |
| cpp_freertos::BinarySemaphore | sourcesSem = cpp_freertos::BinarySemaphore(true) |
| uint16_t | btnsources = 0 |
| uint16_t | ainsources = 0 |
| std::vector< int32_t > | analogsources_buf |
| ClassChooser< ButtonSource > | btn_chooser |
| ClassChooser< AnalogSource > | analog_chooser |
Private Types | |
| enum class | CANInput_commands : uint32_t { caniddigital , canidanalog , btntypes , lsbtn , addbtn , aintypes , lsain , addain , rate , dvals , avals } |
Additional Inherited Members | |
Public Attributes inherited from FFBoardMain | |
| std::unique_ptr< FFBoardMainCommandThread > | commandThread |
| std::unique_ptr< CDC_CommandInterface > | cdcCmdInterface = std::make_unique<CDC_CommandInterface>() |
| ErrorPrinter | errorPrinter |
| SystemCommands | systemCommands |
| System command handler. | |
| std::unique_ptr< UART_CommandInterface > | uartCmdInterface = std::make_unique<UART_CommandInterface>(115200) |
Protected Member Functions inherited from CommandHandler | |
| void | setInstance (uint8_t instance) |
| virtual void | addCommandHandler () |
| virtual void | removeCommandHandler () |
Protected Member Functions inherited from cpp_freertos::Thread | |
| virtual void | Cleanup () |
| void | Delay (const TickType_t Delay) |
| void | DelayUntil (const TickType_t Period) |
| void | ResetDelayUntil () |
| bool | Wait (ConditionVariable &Cv, Mutex &CvLock, TickType_t Timeout=portMAX_DELAY) |
Static Protected Member Functions inherited from CommandHandler | |
| static std::vector< uint16_t > & | getCommandHandlerIds () |
Static Protected Attributes inherited from FFBoardMain | |
| static char | cdcbuf [] |
Static Protected Attributes inherited from PersistentStorage | |
| static bool | startupComplete = false |
Definition at line 21 of file CanInputMain.h.
|
strongprivate |
| Enumerator | |
|---|---|
| caniddigital | |
| canidanalog | |
| btntypes | |
| lsbtn | |
| addbtn | |
| aintypes | |
| lsain | |
| addain | |
| rate | |
| dvals | |
| avals | |
Definition at line 22 of file CanInputMain.h.
| CANInputMain::CANInputMain | ( | ) |
Definition at line 23 of file CanInputMain.cpp.
| CANInputMain::CANInputMain | ( | CANPort & | canport | ) |
Definition at line 27 of file CanInputMain.cpp.
|
virtual |
Definition at line 38 of file CanInputMain.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 FFBoardMain.
Definition at line 198 of file CanInputMain.cpp.
|
inlinevirtual |
Returns a description of this class
Reimplemented from FFBoardMain.
Definition at line 36 of file CanInputMain.h.
|
virtual |
Reimplemented from FFBoardMain.
Definition at line 18 of file CanInputMain.cpp.
|
inlinestatic |
Definition at line 32 of file CanInputMain.h.
| void CANInputMain::registerCommands | ( | ) |
Definition at line 179 of file CanInputMain.cpp.
| std::string CANInputMain::report_rates_names | ( | ) |
Generates the speed strings to display to the user
Definition at line 168 of file CanInputMain.cpp.
|
virtual |
Read parameters from flash and restore settings
Reimplemented from PersistentStorage.
Definition at line 54 of file CanInputMain.cpp.
|
virtual |
Implementation of your actual thread code. You must override this function.
Implements cpp_freertos::Thread.
Definition at line 91 of file CanInputMain.cpp.
|
virtual |
Save parameters to flash
Reimplemented from PersistentStorage.
Definition at line 76 of file CanInputMain.cpp.
| void CANInputMain::sendReport | ( | ) |
Definition at line 111 of file CanInputMain.cpp.
| void CANInputMain::setReportRate | ( | uint8_t | rateidx | ) |
Changes the report rate based on the index for report_rates
Definition at line 159 of file CanInputMain.cpp.
| void CANInputMain::updateControl | ( | ) |
Main update loop
Definition at line 103 of file CanInputMain.cpp.
|
overridevirtual |
Called during the startup Should initialize a USBdevice and call registerUsb()
Reimplemented from FFBoardMain.
Definition at line 44 of file CanInputMain.cpp.
|
protected |
Definition at line 64 of file CanInputMain.h.
|
protected |
Definition at line 58 of file CanInputMain.h.
|
protected |
Definition at line 63 of file CanInputMain.h.
|
protected |
Definition at line 61 of file CanInputMain.h.
|
protected |
Definition at line 59 of file CanInputMain.h.
|
static |
Definition at line 13 of file CanInputMain.h.
|
protected |
Definition at line 66 of file CanInputMain.h.
|
protected |
Definition at line 56 of file CanInputMain.h.
|
protected |
Definition at line 55 of file CanInputMain.h.
|
protected |
Definition at line 67 of file CanInputMain.h.