Open FFBoard
Open source force feedback firmware
MotorSimplemotion1 Class Reference

#include <MotorSimplemotion.h>

Inheritance diagram for MotorSimplemotion1:
MotorSimplemotion MotorDriver Encoder CommandHandler UARTDevice ChoosableClass ChoosableClass

Public Member Functions

 MotorSimplemotion1 ()
 
const ClassIdentifier getInfo ()
 Command handlers always have class infos. Works well with ChoosableClass. More...
 
 ~MotorSimplemotion1 ()
 
- Public Member Functions inherited from MotorSimplemotion
 MotorSimplemotion (uint8_t instance)
 
virtual ~MotorSimplemotion ()
 
void turn (int16_t power) override
 
void stopMotor () override
 
void startMotor () override
 
EncodergetEncoder () override
 
bool hasIntegratedEncoder ()
 
int32_t getPos () override
 
void setPos (int32_t pos) override
 
EncoderType getEncoderType () override
 
uint32_t getCpr () override
 
CommandStatus command (const ParsedCommand &cmd, std::vector< CommandReply > &replies) override
 
void registerCommands ()
 
std::string getHelpstring ()
 
void uartRcv (char &buf)
 
void sendFastUpdate (uint16_t val1, uint16_t val2=0)
 
void startUartTransfer (UARTPort *port, bool transmit)
 
void endUartTransfer (UARTPort *port, bool transmit)
 
bool sendCommand (uint8_t *buf, uint8_t len, uint8_t adr)
 
uint8_t queueCommand (uint8_t *buf, MotorSimplemotion_cmdtypes type, uint32_t data)
 
bool read1Parameter (MotorSimplemotion_param paramId, uint32_t *reply_p, MotorSimplemotion_cmdtypes replylen=MotorSimplemotion_cmdtypes::none)
 
bool set1Parameter (MotorSimplemotion_param paramId, int32_t value, uint32_t *reply_p=nullptr)
 
bool getSettings ()
 
uint32_t getCumstat ()
 
bool motorReady ()
 
int16_t getTorque ()
 
int16_t getVoltage ()
 
void restart ()
 
- Public Member Functions inherited from MotorDriver
 MotorDriver ()
 
virtual ~MotorDriver ()
 
const ClassType getClassType () override
 returns the used classchooser selection id of this instance More...
 
virtual void emergencyStop (bool reset=false)
 
virtual void setEncoder (std::shared_ptr< Encoder > &encoder)
 
- Public Member Functions inherited from ChoosableClass
virtual ~ChoosableClass ()
 
uint16_t getSelectionID ()
 
- Public Member Functions inherited from Encoder
 Encoder ()
 
virtual ~Encoder ()
 
virtual float getPos_f ()
 
virtual int32_t getPosAbs ()
 
virtual float getPosAbs_f ()
 
virtual const ClassType getClassType () override
 returns the used classchooser selection id of this instance More...
 
- Public Member Functions inherited from CommandHandler
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 CmdHandlerInfogetCommandHandlerInfo ()
 
virtual bool isValidCommandId (uint32_t cmdid, uint32_t ignoredFlags=0, uint32_t requiredFlag=0)
 
virtual CmdHandlerCommanddefgetCommandFromName (const std::string &cmd, uint32_t ignoredFlags=0)
 
virtual CmdHandlerCommanddefgetCommandFromId (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 UARTDevice
 UARTDevice ()
 
 UARTDevice (UARTPort &port)
 
virtual ~UARTDevice ()
 

Static Public Member Functions

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. 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 CommandHandlergetHandlerFromHandlerId (const uint16_t cmdhandlerID)
 
static CommandHandlergetHandlerFromId (const uint16_t id, const uint8_t instance=0xFF)
 
static CommandHandlergetHandlerFromClassName (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 Attributes

static ClassIdentifier info
 
- Static Public Attributes inherited from MotorSimplemotion
static const uint8_t SMCMD_FAST_UPDATE_CYCLE = 2<<3
 
static const uint8_t SMCMD_FAST_UPDATE_CYCLE_RET = (2<<3) | 1
 
static const uint8_t SMP_FAST_UPDATE_CYCLE_FORMAT = 17
 
static const uint8_t SMCMD_INSTANT_CMD = 0x24
 
static const uint8_t SMCMD_INSTANT_CMD_RET = 0x25
 
static const uint8_t SMPCMD_SETPARAMADDR = 2
 
- Static Public Attributes inherited from MotorDriver
static ClassIdentifier info ={.name = "None" , .id=CLSID_MOT_NONE, .visibility = ClassVisibility::visible}
 
static const std::vector< class_entry< MotorDriver > > all_drivers
 
- Static Public Attributes inherited from ChoosableClass
static ClassIdentifier info
 
- Static Public Attributes inherited from Encoder
static ClassIdentifier info ={.name = "None" , .id=CLSID_ENCODER_NONE, .visibility = ClassVisibility::visible}
 
static const std::vector< class_entry< Encoder > > all_encoders
 
- Static Public Attributes inherited from CommandHandler
static bool logEnabled = true
 

Static Private Attributes

static bool inUse = false
 

Additional Inherited Members

- 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 MotorSimplemotion
const OutputPinwriteEnablePin = gpMotor
 
volatile char rxbuf [RXBUF_SIZE]
 
volatile uint8_t rxbuf_i = 0
 
char txbuf [TXBUF_SIZE]
 
volatile uint8_t replyidx = 0
 
volatile uint32_t replyvalues [REPLYBUF_SIZE]
 
volatile uint32_t crcerrors = 0
 
int16_t lastTorque = 0
 
volatile uint32_t lastUpdateTime = 0
 
volatile uint32_t uarterrors = 0
 
- Protected Attributes inherited from MotorDriver
std::shared_ptr< EncoderdrvEncoder = std::make_shared<Encoder>()
 
- Protected Attributes inherited from ChoosableClass
uint16_t selectionId
 Should only be written by ClassChooser during creation. More...
 
- Protected Attributes inherited from Encoder
uint32_t cpr = 0
 
- Protected Attributes inherited from CommandHandler
bool commandsEnabled = true
 
std::vector< CmdHandlerCommanddefregisteredCommands
 
CmdHandlerInfo cmdHandlerInfo
 
- Protected Attributes inherited from UARTDevice
UARTPortuartport = nullptr
 
- Static Protected Attributes inherited from MotorSimplemotion
static std::array< uint8_t, 256 > tableCRC8
 
static std::array< uint16_t, 256 > tableCRC16
 
static const uint8_t crcpoly = 0x07
 
static const uint16_t crcpoly16 = 0x8005
 
static bool crcTableInitialized = false
 
static const uint8_t crc8init = 0x52
 
static const uint8_t RXBUF_SIZE = 32
 
static const uint8_t TXBUF_SIZE = 32
 
static const uint8_t REPLYBUF_SIZE = 32
 

Detailed Description

Instance 1

Definition at line 261 of file MotorSimplemotion.h.

Constructor & Destructor Documentation

◆ MotorSimplemotion1()

MotorSimplemotion1::MotorSimplemotion1 ( )
inline

Definition at line 265 of file MotorSimplemotion.h.

◆ ~MotorSimplemotion1()

MotorSimplemotion1::~MotorSimplemotion1 ( )
inline

Definition at line 268 of file MotorSimplemotion.h.

Member Function Documentation

◆ getInfo()

const ClassIdentifier MotorSimplemotion1::getInfo ( )
inlinevirtual

Command handlers always have class infos. Works well with ChoosableClass.

Implements MotorSimplemotion.

Definition at line 267 of file MotorSimplemotion.h.

◆ isCreatable()

static bool MotorSimplemotion1::isCreatable ( )
inlinestatic

Definition at line 269 of file MotorSimplemotion.h.

Member Data Documentation

◆ info

ClassIdentifier MotorSimplemotion1::info
static
Initial value:
= {
.name = "Simplemotion 1" ,
.id=CLSID_MOT_SM1
}

Definition at line 266 of file MotorSimplemotion.h.

◆ inUse

bool MotorSimplemotion1::inUse = false
staticprivate

Definition at line 263 of file MotorSimplemotion.h.


The documentation for this class was generated from the following files: