Motion Master
|
#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... | |
|
strong |
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.
cia402_drive | reference to the Cia402Drive device |
bytes | OS command - 8 bytes |
timeout_in_ms | timeout in milliseconds |
auto_abort | abort if the device is not running any more |
wait | wait for the previous OS command to finish |
started_callback | function to call on OS command start |
progress_callback | function to call on OS command progress change |
|
explicit |
Create an OS command object.
cia402_drive | reference to the Cia402Drive device |
timeout_in_ms | timeout in milliseconds |
auto_abort | abort if the device is not running any more |
wait | wait for the previous OS command to finish |
started_callback | function to call on OS command start |
progress_callback | function to call on OS command progress change |
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.
cia402_drive | reference to the Cia402Drive device |
command | OS command to execute |
command_byte_1 | byte 1 of the OS command |
command_byte_2 | byte 2 of the OS command |
command_byte_3 | byte 3 of the OS command |
command_byte_4 | byte 4 of the OS command |
command_byte_5 | byte 5 of the OS command |
command_byte_6 | byte 6 of the OS command |
command_byte_7 | byte 7 of the OS command |
timeout_in_ms | timeout in milliseconds |
auto_abort | abort if the device is not running any more |
wait | wait for the previous OS command to finish |
started_callback | function to call on OS command start |
progress_callback | function to call on OS command progress change |
uint8_t OsCommand::get_error_code | ( | ) |
Get the OS command response error code.
uint16_t OsCommand::get_uint16_response_data | ( | ) |
Get the unsigned 16-bit response payload if possible.
uint32_t OsCommand::get_uint32_response_data | ( | ) |
Get the unsigned 32-bit response payload if possible.
uint8_t OsCommand::get_uint8_response_data | ( | ) |
Get the unsigned 8-bit response payload if possible.
uint8_t * OsCommand::response_data | ( | ) |
Returns a pointer to the complete response data.
MotionMasterError OsCommand::run | ( | ) |
Run the previously initialized OS command.
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).
auto_abort |
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.
command | OS command to execute |
command_byte_1 | byte 1 of the OS command |
command_byte_2 | byte 2 of the OS command |
command_byte_3 | byte 3 of the OS command |
command_byte_4 | byte 4 of the OS command |
command_byte_5 | byte 5 of the OS command |
command_byte_6 | byte 6 of the OS command |
command_byte_7 | byte 7 of the OS command |
void OsCommand::set_command | ( | const std::string & | command | ) |
Set the OS command as a string (of bytes)
command | an OS command as a string of bytes |
void OsCommand::set_command | ( | uint8_t * | command_bytes | ) |
Set the OS command as an array of bytes.
command_bytes | an OS command as an array of bytes |
void OsCommand::set_command_uint32_value | ( | uint32_t | value | ) |
Set the data payload of the OS command as an unsigned 32-bit value.
value |
void OsCommand::set_timeout | ( | uint32_t | timeout_in_ms | ) |
Set a timeout in milliseconds.
timeout_in_ms |
void OsCommand::set_wait | ( | bool | wait | ) |
Set the wait flag.
Wait until the OS command lock has been acquired.
wait |