Motion Master
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
OsCommand Class Reference

#include <os_command.h>

Public Types

enum class  Command {
  kEncoderRegisterCommunication = 0 , kIcmuCalibration = 1 , kOpenLoopFieldMode = 2 , kHrdStreaming = 3 ,
  kMotorPhaseOrderDetection = 4 , kCommutationOffsetMeasurement = 5 , kOpenPhaseDetection = 6 , kPolePairDetection = 7 ,
  kPhaseResistanceMeasurement = 8 , kPhaseInductanceMeasurement = 9 , kTorqueConstantMeasurement = 10 , kIgnoreBissStatusBits = 14 ,
  kReserved = 255
}
 

Public Member Functions

 OsCommand (Cia402Drive &cia402_drive, uint8_t *command_bytes, uint32_t timeout_in_ms=1000, bool auto_abort=false, bool wait=true, const std::function< void()> &started_callback={}, const std::function< void(uint8_t)> &progress_callback={})
 Create an OS command object. More...
 
 OsCommand (Cia402Drive &cia402_drive, uint32_t timeout_in_ms=1000, bool auto_abort=false, bool wait=true, const std::function< void()> &started_callback={}, const std::function< void(uint8_t)> &progress_callback={})
 Create an OS command object. More...
 
 OsCommand (Cia402Drive &cia402_drive, Command command, uint8_t command_byte_1=0, uint8_t command_byte_2=0, uint8_t command_byte_3=0, uint8_t command_byte_4=0, uint8_t command_byte_5=0, uint8_t command_byte_6=0, uint8_t command_byte_7=0, uint32_t timeout_in_ms=1000, bool auto_abort=false, bool wait=true, const std::function< void()> &started_callback={}, const std::function< void(uint8_t)> &progress_callback={})
 Create an OS command object. More...
 
MotionMasterError run ()
 Run the previously initialized OS command. More...
 
void set_command (const std::string &command)
 Set the OS command as a string (of bytes) More...
 
void set_command (uint8_t *command_bytes)
 Set the OS command as an array of bytes. More...
 
void set_command (Command command, uint8_t command_byte_1=0, uint8_t command_byte_2=0, uint8_t command_byte_3=0, uint8_t command_byte_4=0, uint8_t command_byte_5=0, uint8_t command_byte_6=0, uint8_t command_byte_7=0)
 Set the OS command as a command enum and separate byte values. More...
 
void set_command_uint32_value (uint32_t value)
 Set the data payload of the OS command as an unsigned 32-bit value. More...
 
void set_timeout (uint32_t timeout_in_ms)
 Set a timeout in milliseconds. More...
 
void set_auto_abort (bool auto_abort)
 Set the auto abort flag. More...
 
void set_wait (bool wait)
 Set the wait flag. More...
 
uint8_t * response_data ()
 Returns a pointer to the complete response data. More...
 
uint8_t get_uint8_response_data ()
 Get the unsigned 8-bit response payload if possible. More...
 
uint16_t get_uint16_response_data ()
 Get the unsigned 16-bit response payload if possible. More...
 
uint32_t get_uint32_response_data ()
 Get the unsigned 32-bit response payload if possible. More...
 
uint8_t get_error_code ()
 Get the OS command response error code. More...
 

Member Enumeration Documentation

◆ Command

enum class OsCommand::Command
strong
Enumerator
kEncoderRegisterCommunication 
kIcmuCalibration 
kOpenLoopFieldMode 
kHrdStreaming 
kMotorPhaseOrderDetection 
kCommutationOffsetMeasurement 
kOpenPhaseDetection 
kPolePairDetection 
kPhaseResistanceMeasurement 
kPhaseInductanceMeasurement 
kTorqueConstantMeasurement 
kIgnoreBissStatusBits 
kReserved 

Constructor & Destructor Documentation

◆ OsCommand() [1/3]

OsCommand::OsCommand ( Cia402Drive cia402_drive,
uint8_t *  command_bytes,
uint32_t  timeout_in_ms = 1000,
bool  auto_abort = false,
bool  wait = true,
const std::function< void()> &  started_callback = {},
const std::function< void(uint8_t)> &  progress_callback = {} 
)

Create an OS command object.

Parameters
cia402_drivereference to the Cia402Drive device
bytesOS command - 8 bytes
timeout_in_mstimeout in milliseconds
auto_abortabort if the device is not running any more
waitwait for the previous OS command to finish
started_callbackfunction to call on OS command start
progress_callbackfunction to call on OS command progress change

◆ OsCommand() [2/3]

OsCommand::OsCommand ( Cia402Drive cia402_drive,
uint32_t  timeout_in_ms = 1000,
bool  auto_abort = false,
bool  wait = true,
const std::function< void()> &  started_callback = {},
const std::function< void(uint8_t)> &  progress_callback = {} 
)
explicit

Create an OS command object.

Parameters
cia402_drivereference to the Cia402Drive device
timeout_in_mstimeout in milliseconds
auto_abortabort if the device is not running any more
waitwait for the previous OS command to finish
started_callbackfunction to call on OS command start
progress_callbackfunction to call on OS command progress change

◆ OsCommand() [3/3]

OsCommand::OsCommand ( Cia402Drive cia402_drive,
OsCommand::Command  command,
uint8_t  command_byte_1 = 0,
uint8_t  command_byte_2 = 0,
uint8_t  command_byte_3 = 0,
uint8_t  command_byte_4 = 0,
uint8_t  command_byte_5 = 0,
uint8_t  command_byte_6 = 0,
uint8_t  command_byte_7 = 0,
uint32_t  timeout_in_ms = 1000,
bool  auto_abort = false,
bool  wait = true,
const std::function< void()> &  started_callback = {},
const std::function< void(uint8_t)> &  progress_callback = {} 
)

Create an OS command object.

Parameters
cia402_drivereference to the Cia402Drive device
commandOS command to execute
command_byte_1byte 1 of the OS command
command_byte_2byte 2 of the OS command
command_byte_3byte 3 of the OS command
command_byte_4byte 4 of the OS command
command_byte_5byte 5 of the OS command
command_byte_6byte 6 of the OS command
command_byte_7byte 7 of the OS command
timeout_in_mstimeout in milliseconds
auto_abortabort if the device is not running any more
waitwait for the previous OS command to finish
started_callbackfunction to call on OS command start
progress_callbackfunction to call on OS command progress change

Member Function Documentation

◆ get_error_code()

uint8_t OsCommand::get_error_code ( )

Get the OS command response error code.

Returns
error code

◆ get_uint16_response_data()

uint16_t OsCommand::get_uint16_response_data ( )

Get the unsigned 16-bit response payload if possible.

Returns
unsigned 16-bit response payload data

◆ get_uint32_response_data()

uint32_t OsCommand::get_uint32_response_data ( )

Get the unsigned 32-bit response payload if possible.

Returns
unsigned 32-bit response payload data

◆ get_uint8_response_data()

uint8_t OsCommand::get_uint8_response_data ( )

Get the unsigned 8-bit response payload if possible.

Returns
unsigned 8-bit response payload data

◆ response_data()

uint8_t * OsCommand::response_data ( )

Returns a pointer to the complete response data.

Returns
a pointer to the response data

◆ run()

MotionMasterError OsCommand::run ( )

Run the previously initialized OS command.

Returns
MotionMasterError

◆ set_auto_abort()

void OsCommand::set_auto_abort ( bool  auto_abort)

Set the auto abort flag.

Automatically abort any running OS commands if the timeout runs out, or if the CiA402 drive executing the OS command is not running (not in OP ENABLED CiA402 state).

Parameters
auto_abort

◆ set_command() [1/3]

void OsCommand::set_command ( Command  command,
uint8_t  command_byte_1 = 0,
uint8_t  command_byte_2 = 0,
uint8_t  command_byte_3 = 0,
uint8_t  command_byte_4 = 0,
uint8_t  command_byte_5 = 0,
uint8_t  command_byte_6 = 0,
uint8_t  command_byte_7 = 0 
)

Set the OS command as a command enum and separate byte values.

Parameters
commandOS command to execute
command_byte_1byte 1 of the OS command
command_byte_2byte 2 of the OS command
command_byte_3byte 3 of the OS command
command_byte_4byte 4 of the OS command
command_byte_5byte 5 of the OS command
command_byte_6byte 6 of the OS command
command_byte_7byte 7 of the OS command

◆ set_command() [2/3]

void OsCommand::set_command ( const std::string &  command)

Set the OS command as a string (of bytes)

Parameters
commandan OS command as a string of bytes

◆ set_command() [3/3]

void OsCommand::set_command ( uint8_t *  command_bytes)

Set the OS command as an array of bytes.

Parameters
command_bytesan OS command as an array of bytes

◆ set_command_uint32_value()

void OsCommand::set_command_uint32_value ( uint32_t  value)

Set the data payload of the OS command as an unsigned 32-bit value.

Parameters
value

◆ set_timeout()

void OsCommand::set_timeout ( uint32_t  timeout_in_ms)

Set a timeout in milliseconds.

Parameters
timeout_in_ms

◆ set_wait()

void OsCommand::set_wait ( bool  wait)

Set the wait flag.

Wait until the OS command lock has been acquired.

Parameters
wait

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