![]() |
Open FFBoard
Open source force feedback firmware
|
#include <CANPort2B.h>
Public Member Functions | |
| CANPort_2B (CAN_HandleTypeDef &hcan, const CANPortHardwareConfig &presets, const OutputPin *silentPin=nullptr, uint8_t instance=0) | |
| virtual | ~CANPort_2B () |
| bool | start () |
| bool | stop () |
| bool | sendMessage (CAN_tx_msg &msg) |
| bool | sendMessage (CAN_msg_header_tx *pHeader, uint8_t aData[], uint32_t *pTxMailbox=nullptr) |
| void | abortTxRequests () |
| int32_t | addCanFilter (CAN_filter filter) |
| void | removeCanFilter (uint8_t filterId) |
| void | setSpeed (uint32_t speed) |
| void | setSpeedPreset (uint8_t preset) |
| uint32_t | getSpeed () |
| uint8_t | getSpeedPreset () |
| void | setSilentMode (bool silent) |
| void | canTxCpltCallback (CANPort *port, uint32_t mailbox) override |
| void | canTxAbortCallback (CANPort *port, uint32_t mailbox) override |
| void | canErrorCallback (CANPort *port, uint32_t code) override |
| CommandStatus | command (const ParsedCommand &cmd, std::vector< CommandReply > &replies) |
| void | registerCommands () |
| void | saveFlash () |
| void | restoreFlash () |
| const ClassIdentifier | getInfo () |
| Command handlers always have class infos. Works well with ChoosableClass. | |
| const ClassType | getClassType () override |
| void * | getHandle () |
Public Member Functions inherited from CANPort | |
| CANPort (const CANPortHardwareConfig &presets, uint8_t instance=0) | |
| virtual | ~CANPort () |
| virtual int32_t | getPortUsers () |
| virtual void | takePort () |
| virtual void | freePort () |
| virtual void | giveSemaphore () |
| virtual bool | takeSemaphore (uint32_t delay=portMAX_DELAY) |
| virtual uint8_t | speedToPreset (uint32_t speed) |
| Gets preset index for a speed. | |
| virtual uint32_t | presetToSpeed (uint8_t preset) |
| Gets speed for a preset index. | |
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 std::string | getHelpstring () |
| 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 CanHandler | |
| CanHandler () | |
| virtual | ~CanHandler () |
| virtual void | canRxPendCallback (CANPort *port, CAN_rx_msg &msg) |
| virtual void | canRxFullCallback (CANPort *port, uint32_t fifo) |
Static Public Attributes | |
| static const uint8_t | slaveFilterStart = 14 |
| static ClassIdentifier | info |
Static Public Attributes inherited from CommandHandler | |
| static bool | logEnabled = true |
Private Types | |
| enum class | CanPort_commands : uint32_t { speed , send , len } |
Private Attributes | |
| uint8_t | speedPreset = speedToPreset(500000) |
| CAN_HandleTypeDef * | hcan = nullptr |
| std::vector< CAN_FilterTypeDef > | canFilters |
| uint32_t | txMailboxes = 0 |
| const OutputPin * | silentPin |
| bool | silent = true |
| bool | active = false |
| uint32_t | lastSentTime = 0 |
| CAN_TxHeaderTypeDef | header = {0,0,0,CAN_RTR_DATA,8,(FunctionalState)0} |
| uint8_t | nextLen = 8 |
Static Private Attributes | |
| static const uint32_t | sendTimeout = 20 |
Additional Inherited Members | |
Static Public Member Functions inherited from CANPort | |
| static CANPort * | handleToPort (void *handle) |
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 Public Member Functions inherited from CanHandler | |
| static std::vector< CanHandler * > & | getCANHandlers () |
Protected Member Functions inherited from CommandHandler | |
| void | setInstance (uint8_t instance) |
| virtual void | addCommandHandler () |
| virtual void | removeCommandHandler () |
Static Protected Member Functions inherited from CommandHandler | |
| static std::vector< uint16_t > & | getCommandHandlerIds () |
Protected Attributes inherited from CANPort | |
| cpp_freertos::BinarySemaphore | semaphore = cpp_freertos::BinarySemaphore(true) |
| cpp_freertos::BinarySemaphore | configSem = cpp_freertos::BinarySemaphore(true) |
| const CANPortHardwareConfig & | presets |
| CAN port presets for different speeds. Hardware dependent. | |
| bool | isWaitingFlag = false |
| int32_t | portUsers = 0 |
Protected Attributes inherited from PersistentStorage | |
| bool | restoreDelayedFlag = false |
Protected Attributes inherited from CommandHandler | |
| bool | commandsEnabled = true |
| std::vector< CmdHandlerCommanddef > | registeredCommands |
| CmdHandlerInfo | cmdHandlerInfo |
Static Protected Attributes inherited from PersistentStorage | |
| static bool | startupComplete = false |
Definition at line 15 of file CANPort2B.h.
|
strongprivate |
| Enumerator | |
|---|---|
| speed | |
| send | |
| len | |
Definition at line 16 of file CANPort2B.h.
| CANPort_2B::CANPort_2B | ( | CAN_HandleTypeDef & | hcan, |
| const CANPortHardwareConfig & | presets, | ||
| const OutputPin * | silentPin = nullptr, | ||
| uint8_t | instance = 0 ) |
Definition at line 19 of file CANPort2B.cpp.
|
virtual |
Definition at line 59 of file CANPort2B.cpp.
|
virtual |
Stops and clears pending requests if port is stuck
Implements CANPort.
Definition at line 180 of file CANPort2B.cpp.
|
virtual |
Adds a filter to the can handle Returns a free bank id if successfull and -1 if all banks are full Use the returned id to disable the filter again
Implements CANPort.
Definition at line 262 of file CANPort2B.cpp.
|
overridevirtual |
Error during can transfer
Reimplemented from CanHandler.
Definition at line 247 of file CANPort2B.cpp.
|
overridevirtual |
CAN transmission aborted
Reimplemented from CanHandler.
Definition at line 239 of file CANPort2B.cpp.
|
overridevirtual |
CAN transmission complete
Reimplemented from CanHandler.
Definition at line 230 of file CANPort2B.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 334 of file CANPort2B.cpp.
|
inlineoverridevirtual |
Type of this class. Mainclass, motordriver... Should be implemented by the parent class so it is not in the info struct
Reimplemented from CommandHandler.
Definition at line 53 of file CANPort2B.h.
|
inlinevirtual |
Implements CANPort.
Definition at line 54 of file CANPort2B.h.
|
inlinevirtual |
Command handlers always have class infos. Works well with ChoosableClass.
Implements CommandHandler.
Definition at line 52 of file CANPort2B.h.
|
virtual |
Implements CANPort.
Definition at line 124 of file CANPort2B.cpp.
|
virtual |
Implements CANPort.
Definition at line 128 of file CANPort2B.cpp.
| void CANPort_2B::registerCommands | ( | ) |
Definition at line 33 of file CANPort2B.cpp.
|
virtual |
Disables a can filter Use the id returned by the addCanFilter function
Implements CANPort.
Definition at line 320 of file CANPort2B.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 48 of file CANPort2B.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 40 of file CANPort2B.cpp.
|
virtual |
Transmits a CAN frame with separate data and header settings
Implements CANPort.
Definition at line 187 of file CANPort2B.cpp.
|
virtual |
Transmits a CAN frame on this port Wraps the internal transmit function
Implements CANPort.
Definition at line 176 of file CANPort2B.cpp.
|
virtual |
Sets the can port passive if a transceiver with silent mode is available
Implements CANPort.
Definition at line 165 of file CANPort2B.cpp.
|
virtual |
Changes the speed of the CAN port in bits/s Must match a preset speed
Implements CANPort.
Definition at line 155 of file CANPort2B.cpp.
|
virtual |
Changes the speed of the CAN port to a preset
Implements CANPort.
Definition at line 136 of file CANPort2B.cpp.
|
virtual |
Signals that this port is being used. Increments the user counter Signals that the port is not needed anymore. Decrements the user counter Enables the can port
Implements CANPort.
Definition at line 99 of file CANPort2B.cpp.
|
virtual |
|
private |
Definition at line 65 of file CANPort2B.h.
|
private |
Definition at line 59 of file CANPort2B.h.
|
private |
Definition at line 58 of file CANPort2B.h.
|
private |
Definition at line 71 of file CANPort2B.h.
|
static |
Definition at line 10 of file CANPort2B.h.
|
private |
Definition at line 67 of file CANPort2B.h.
|
private |
Definition at line 72 of file CANPort2B.h.
|
staticprivate |
Definition at line 69 of file CANPort2B.h.
|
private |
Definition at line 64 of file CANPort2B.h.
|
private |
Definition at line 63 of file CANPort2B.h.
|
static |
Definition at line 39 of file CANPort2B.h.
|
private |
Definition at line 57 of file CANPort2B.h.
|
private |
Definition at line 60 of file CANPort2B.h.