Mindstorms 3rd Party ROBOTC Drivers RobotC
[Home] [Download] [Submit a bug/suggestion] [ROBOTC Forums] [Blog] [Support this project]
Defines | Functions | Variables

mindsensors-motormux.h File Reference

Mindsensors Motor MUX driver. More...

#include "common.h"
#include "common-MMUX.h"

Go to the source code of this file.

Defines

#define MSMMUX_I2C_ADDR   0x06
#define MSMMUX_REG_CMD   0x41
#define MSMMUX_MOT_OFFSET   0x42
#define MSMMUX_TARG_ENC   0x00
#define MSMMUX_POWER   0x04
#define MSMMUX_TARG_TIME   0x05
#define MSMMUX_CMD_B   0x06
#define MSMMUX_CMD_A   0x07
#define MSMMUX_ENTRY_SIZE   0x08
#define MSMMUX_TACHO_MOT1   0x62
#define MSMMUX_TACHO_MOT2   0x66
#define MSMMUX_STATUS_MOT1   0x72
#define MSMMUX_STATUS_MOT2   0x73
#define MSMMUX_KP_TACHO   0x7A
#define MSMMUX_KI_TACHO   0x7C
#define MSMMUX_KD_TACHO   0x7E
#define MSMMUX_KP_SPEED   0x80
#define MSMMUX_KI_SPEED   0x82
#define MSMMUX_KD_SPEED   0x84
#define MSMMUX_PASSCOUNT   0x86
#define MSMMUX_TOLERANCE   0x87
#define MSMMUX_CMD_RESET_ALL   0x52
#define MSMMUX_CMD_START_BOTH   0x53
#define MSMMUX_CMD_FLOAT_MOT1   0x61
#define MSMMUX_CMD_FLOAT_MOT2   0x62
#define MSMMUX_CMD_FLOAT_BOTH   0x63
#define MSMMUX_CMD_BRAKE_MOT1   0x41
#define MSMMUX_CMD_BRAKE_MOT2   0x42
#define MSMMUX_CMD_BRAKE_BOTH   0x43
#define MSMMUX_CMD_RESET_MOT1   0x72
#define MSMMUX_CMD_RESET_MOT2   0x73
#define MSMMUX_STAT_SPEED_CTRL   (0x01 << 0)
#define MSMMUX_STAT_RAMPING   (0x01 << 1)
#define MSMMUX_STAT_POWERED   (0x01 << 2)
#define MSMMUX_STAT_POS_CTRL   (0x01 << 3)
#define MSMMUX_STAT_BRAKED   (0x01 << 4)
#define MSMMUX_STAT_OVERLOADED   (0x01 << 5)
#define MSMMUX_STAT_TIMED   (0x01 << 6)
#define MSMMUX_STAT_STALLED   (0x01 << 7)
#define MSMMUX_CMD_SPEED   0x01
#define MSMMUX_CMD_RAMP   0x02
#define MSMMUX_CMD_RELATIVE   0x04
#define MSMMUX_CMD_TACHO   0x08
#define MSMMUX_CMD_BRK   0x10
#define MSMMUX_CMD_HOLDPOS   0x20
#define MSMMUX_CMD_TIME   0x40
#define MSMMUX_CMD_GO   0x80
#define MSMMUX_RAMP_NONE   0x00
#define MSMMUX_RAMP_UP_DOWN   0x03
#define MSMMUX_ROT_UNLIMITED   0x00
#define MSMMUX_ROT_DEGREES   0x01
#define MSMMUX_ROT_SECONDS   0x03

Functions

void MSMMUXinit ()
bool MSMMUXreadStatus (tMUXmotor muxmotor, ubyte &motorStatus)
bool MSMMUXsendCommand (tSensors link, ubyte channel, long setpoint, byte speed, ubyte seconds, ubyte commandA, ubyte address=MSMMUX_I2C_ADDR)
bool MSMMUXsendCommand (tSensors link, ubyte command, ubyte address=MSMMUX_I2C_ADDR)
bool MSMMUXsetPID (tSensors link, unsigned int kpTacho, unsigned int kiTacho, unsigned int kdTacho, unsigned int kpSpeed, unsigned int kiSpeed, unsigned int kdSpeed, ubyte passCount, ubyte tolerance, ubyte address=MSMMUX_I2C_ADDR)
bool MSMMotor (tMUXmotor muxmotor, byte power, ubyte address=MSMMUX_I2C_ADDR)
bool MSMotorStop (tMUXmotor muxmotor, ubyte address=MSMMUX_I2C_ADDR)
bool MSMotorStop (tMUXmotor muxmotor, bool brake, ubyte address=MSMMUX_I2C_ADDR)
void MSMMotorSetRotationTarget (tMUXmotor muxmotor, long target)
void MSMMotorSetTimeTarget (tMUXmotor muxmotor, int target)
void MSMMotorSetEncoderTarget (tMUXmotor muxmotor, long target)
void MSMMotorSetEncoderTarget (tMUXmotor muxmotor, long target, bool relative)
long MSMMotorEncoder (tMUXmotor muxmotor, ubyte address=MSMMUX_I2C_ADDR)
bool MSMMotorEncoderReset (tMUXmotor muxmotor, ubyte address=MSMMUX_I2C_ADDR)
bool MSMMotorEncoderResetAll (tSensors link, ubyte address=MSMMUX_I2C_ADDR)
bool MSMMotorBusy (tMUXmotor muxmotor, ubyte address=MSMMUX_I2C_ADDR)
bool MSMMotorStalled (tMUXmotor muxmotor, ubyte address=MSMMUX_I2C_ADDR)
void MSMMotorSetBrake (tMUXmotor muxmotor)
void MSMMotorSetFloat (tMUXmotor muxmotor)
void MSMMotorSetSpeedCtrl (tMUXmotor muxmotor, bool constspeed)
void MSMMotorSetRamping (tMUXmotor muxmotor, bool ramping)
bool MSMMUXreadStatus (tMUXmotor muxmotor, ubyte &motorStatus, ubyte address)

Variables

tByteArray MSMMUX_I2CRequest
tByteArray MSMMUX_I2CReply

Detailed Description

Mindsensors Motor MUX driver.

mindsensors-motormux.h provides an API for the Mindsensors Motor MUX.

Changelog:

Credits:

License: You may use this code as you wish, provided you give credit where its due.

THIS CODE WILL ONLY WORK WITH ROBOTC VERSION 3.59 AND HIGHER.

Author:
Xander Soldaat (xander_at_botbench.com)
Date:
05 April 2010
Version:
0.1

Definition in file mindsensors-motormux.h.