Crate tmcl [] [src]

TMCL - Trinamic Motion Control Language

As described in The TMCL Reference

Examples

Socketcan

To use this example the socketcan feature must be enabled. And a socketcan interface named vcan0 must exist.

extern crate tmcl;
extern crate socketcan;

use std::cell::RefCell;

use tmcl::modules::tmcm::instructions::*;
use tmcl::modules::tmcm::axis_parameters::*;
use tmcl::modules::tmcm::TmcmModule as Module;
fn main() {
    let interface = RefCell::new(socketcan::CANSocket::open("vcan0").unwrap());

    let module1 = Module::new(&interface, 1);
    let module2 = Module::new(&interface, 2);

    module1.write_command(ROR::new(0, 250)).unwrap();
    module2.write_command(ROL::new(0, 250)).unwrap();
}
fn main() {}

Socketcan and threading

To use this example the socketcan feature must be enabled. And a socketcan interface named vcan0 must exist.

extern crate tmcl;
extern crate socketcan;

use std::sync::Mutex;
use std::sync::Arc;

use tmcl::modules::tmcm::instructions::*;
use tmcl::modules::tmcm::axis_parameters::*;
use tmcl::modules::tmcm::TmcmModule as Module;

fn main() {

    let interface = Arc::new(Mutex::new(socketcan::CANSocket::open("vcan0").unwrap()));

    let module1 = Module::new(interface.clone(), 1);
    let module2 = Module::new(interface, 2);

    std::thread::spawn(move || {
        module1.write_command(ROR::new(0, 250)).unwrap();
    });

    std::thread::spawn(move || {
        module2.write_command(ROL::new(0, 250)).unwrap();
    });
}
fn main() {}

Modules

modules

Implementation of functionality special for different hardware modules

Structs

Command

A Comamnd is an Instruction with a module address.

NonValidErrorCode

The result of attempting to converted a number that is not a valid status code into Status.

Reply

A TMCM module will respond with a Reply after receiving a Command.

Enums

ErrStatus

A Status that indicate an Error has occured.

Error

All possible errors when communicating with

OkStatus

A Status that indicates that everything went well.

Status

Every reply from a Module contains a Status

Traits

AxisParameter

Axis parameter - useable with SAP, GAP, AAP, STAP and/or RSAP instructions.

Instruction

A TMCL Instruction

Interface

A interface for a TMCM module

ReadableAxisParameter

An axis parameter useable with the GAP instruction.

WriteableAxisParameter

An axis parameter useable with the SAP instruction.