Struct tmcl::Command
[−]
[src]
pub struct Command<T: Instruction> { /* fields omitted */ }
A Comamnd
is an Instruction
with a module address.
It contains everything required to serialize itself into Binary command format.
Methods
impl<T: Instruction> Command<T>
[src]
pub fn new(module_address: u8, instruction: T) -> Command<T>
[src]
pub fn module_address(&self) -> u8
[src]
Returns the module address
pub fn serialize(&self) -> [u8; 9]
[src]
Serialize into binary command format suited for RS232, RS485 etc
The array will look like the following:
[MODULE_ADR, CMD_N, TYPE_N, MOTOR_N, VALUE3, VALUE2, VALUE1, VALUE0, CHECKSUM]
pub fn serialize_i2c(&self) -> [u8; 8]
[src]
Serialize into binary command format suited for I2C
The array will look like the following:
[CMD_N, TYPE_N, MOTOR_N, VALUE3, VALUE2, VALUE1, VALUE0, CHECKSUM]
pub fn serialize_can(&self) -> [u8; 7]
[src]
Serialize into binary command format suited for CAN (controller area network)
When using CAN the module address and checksum will be excluded.
The array will look like the following:
[CMD_N, TYPE_N, MOTOR_N, VALUE3, VALUE2, VALUE1, VALUE0]
Trait Implementations
impl<T: Debug + Instruction> Debug for Command<T>
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more