![]() |
Open FFBoard
Open source force feedback firmware
|
#include <EncoderSSI.h>
Public Types | |
enum class | EncoderSSI_commands { bits , cs , speed , errors , mode } |
enum class | EncoderSSI_modes : uint8_t { rawmsb , AMT23 } |
Public Member Functions | |
const ClassIdentifier | getInfo () |
Command handlers always have class infos. Works well with ChoosableClass. More... | |
EncoderSSI () | |
virtual | ~EncoderSSI () |
EncoderType | getEncoderType () |
bool | updateFrame () |
int32_t | getPos () |
int32_t | getPosAbs () |
void | setPos (int32_t pos) |
uint32_t | getCpr () |
void | saveFlash () |
void | restoreFlash () |
std::string | getHelpstring () |
template<size_t N> | |
std::string | printModes (const std::array< const char *, N > &names) |
std::string | printSpeeds () |
CommandStatus | command (const ParsedCommand &cmd, std::vector< CommandReply > &replies) |
void | registerCommands () |
void | configSPI () |
void | spiRxCompleted (SPIPort *port) override |
void | beginSpiTransfer (SPIPort *port) |
void | endSpiTransfer (SPIPort *port) |
void | setMode (EncoderSSI_modes mode) |
![]() | |
Encoder () | |
virtual | ~Encoder () |
virtual float | getPos_f () |
virtual float | getPosAbs_f () |
virtual const ClassType | getClassType () override |
returns the used classchooser selection id of this instance More... | |
![]() | |
virtual | ~ChoosableClass () |
uint16_t | getSelectionID () |
![]() | |
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 | spiTxRxCompleted (SPIPort *port) |
virtual void | spiRequestError (SPIPort *port) |
virtual SPIConfig * | getSpiConfig () |
![]() | |
virtual const ClassType | getClassType () |
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) |
![]() | |
PersistentStorage () | |
virtual | ~PersistentStorage () |
void | restoreFlashDelayed () |
Static Public Member Functions | |
static bool | isCreatable () |
![]() | |
static bool | isCreatable () |
![]() | |
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< PersistentStorage * > & | getFlashHandlers () |
static void | restoreFlashStartupCb () |
Static Public Attributes | |
static ClassIdentifier | info |
static constexpr std::array< const char *, 2 > | mode_names = {"Raw","AMT23"} |
![]() | |
static ClassIdentifier | info ={.name = "None" , .id=CLSID_ENCODER_NONE, .visibility = ClassVisibility::visible} |
static const std::vector< class_entry< Encoder > > | all_encoders |
![]() | |
static ClassIdentifier | info |
![]() | |
static bool | logEnabled = true |
Private Attributes | |
int | lenghtDataBit = 22 |
int | spiSpeed = 0 |
uint32_t | errors = 0 |
EncoderSSI_modes | mode |
uint32_t | lastUpdateTick = 0 |
int32_t | pos = 0 |
int32_t | posOffset = 0 |
int32_t | lastPos = 0 |
int32_t | newPos = 0 |
int32_t | mtpos = 0 |
uint8_t | spi_buf [bytes] = {0} |
uint8_t | transferlen = bytes |
bool | waitData = false |
Static Private Attributes | |
static const uint8_t | bytes = 8 |
static bool | inUse = false |
Additional Inherited Members | |
![]() | |
virtual void | setSpiConfig (SPIConfig config) |
![]() | |
void | setInstance (uint8_t instance) |
virtual void | addCommandHandler () |
virtual void | removeCommandHandler () |
![]() | |
static std::vector< uint16_t > & | getCommandHandlerIds () |
![]() | |
uint32_t | cpr = 0 |
![]() | |
uint16_t | selectionId |
Should only be written by ClassChooser during creation. More... | |
![]() | |
SPIPort & | spiPort |
SPIConfig | spiConfig |
![]() | |
bool | commandsEnabled = true |
std::vector< CmdHandlerCommanddef > | registeredCommands |
CmdHandlerInfo | cmdHandlerInfo |
![]() | |
bool | restoreDelayedFlag = false |
![]() | |
static bool | startupComplete = false |
Definition at line 23 of file EncoderSSI.h.
|
strong |
Enumerator | |
---|---|
bits | |
cs | |
speed | |
errors | |
mode |
Definition at line 44 of file EncoderSSI.h.
|
strong |
Enumerator | |
---|---|
rawmsb | |
AMT23 |
Definition at line 45 of file EncoderSSI.h.
EncoderSSI::EncoderSSI | ( | ) |
Definition at line 22 of file EncoderSSI.cpp.
|
virtual |
Definition at line 34 of file EncoderSSI.cpp.
|
virtual |
Reimplemented from SPIDevice.
Definition at line 141 of file EncoderSSI.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 209 of file EncoderSSI.cpp.
void EncoderSSI::configSPI | ( | ) |
Definition at line 61 of file EncoderSSI.cpp.
|
virtual |
Reimplemented from SPIDevice.
Definition at line 147 of file EncoderSSI.cpp.
|
virtual |
Gets the amount of counts per full rotation of the encoder
Reimplemented from Encoder.
Definition at line 178 of file EncoderSSI.cpp.
|
virtual |
Returns the type of the encoder. Must override this and NOT return NONE in other classes
Reimplemented from Encoder.
Definition at line 154 of file EncoderSSI.cpp.
|
inlinevirtual |
Returns a description of this class
Reimplemented from CommandHandler.
Definition at line 42 of file EncoderSSI.h.
|
virtual |
Command handlers always have class infos. Works well with ChoosableClass.
Implements CommandHandler.
Definition at line 17 of file EncoderSSI.cpp.
|
virtual |
Returns the encoder position as raw counts
Reimplemented from Encoder.
Definition at line 167 of file EncoderSSI.cpp.
|
virtual |
Returns absolute positions without offsets for absolute encoders. Otherwise it returns getPos
Reimplemented from Encoder.
Definition at line 159 of file EncoderSSI.cpp.
|
static |
Definition at line 92 of file EncoderSSI.cpp.
|
inline |
Definition at line 49 of file EncoderSSI.h.
std::string EncoderSSI::printSpeeds | ( | ) |
Definition at line 199 of file EncoderSSI.cpp.
void EncoderSSI::registerCommands | ( | ) |
Definition at line 182 of file EncoderSSI.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 41 of file EncoderSSI.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 52 of file EncoderSSI.cpp.
void EncoderSSI::setMode | ( | EncoderSSI_modes | mode | ) |
Definition at line 190 of file EncoderSSI.cpp.
|
virtual |
Change the position of the encoder Can be used to reset the center
Reimplemented from Encoder.
Definition at line 171 of file EncoderSSI.cpp.
|
overridevirtual |
Reimplemented from SPIDevice.
Definition at line 96 of file EncoderSSI.cpp.
bool EncoderSSI::updateFrame | ( | ) |
|
staticprivate |
Definition at line 80 of file EncoderSSI.h.
|
private |
Definition at line 72 of file EncoderSSI.h.
|
static |
Definition at line 26 of file EncoderSSI.h.
|
staticprivate |
Definition at line 84 of file EncoderSSI.h.
|
private |
Definition at line 77 of file EncoderSSI.h.
|
private |
Definition at line 75 of file EncoderSSI.h.
|
private |
Definition at line 70 of file EncoderSSI.h.
|
private |
Definition at line 73 of file EncoderSSI.h.
|
staticconstexpr |
Definition at line 46 of file EncoderSSI.h.
|
private |
Definition at line 78 of file EncoderSSI.h.
|
private |
Definition at line 77 of file EncoderSSI.h.
|
private |
Definition at line 77 of file EncoderSSI.h.
|
private |
Definition at line 77 of file EncoderSSI.h.
|
private |
Definition at line 81 of file EncoderSSI.h.
|
private |
Definition at line 71 of file EncoderSSI.h.
|
private |
Definition at line 82 of file EncoderSSI.h.
|
private |
Definition at line 86 of file EncoderSSI.h.