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

PFMate Sensor
[Mindsensors]

Files

file  mindsensors-pfmate.h
 

Mindsensors PFMate Sensor driver.


Defines

#define MSPFM_I2C_ADDR   0x48
#define MSPFM_CMD   0x41
#define MSPFM_IRCHAN   0x42
#define MSPFM_MSELECT   0x43
#define MSPFM_MOTOPA   0x44
#define MSPFM_MOTSPA   0x45
#define MSPFM_MOTOPB   0x46
#define MSPFM_MOTSPB   0x47
#define MSPFM_GOCMD   0x47
#define MSPFM_MOTORAB   0x00
#define MSPFM_MOTORA   0x01
#define MSPFM_MOTORB   0x02
#define MSPFM_FLOAT   0x00
#define MSPFM_FORWARD   0x01
#define MSPFM_REVERSE   0x02
#define MSPFM_BRAKE   0x03
#define MSPFM_NOOP   0x0F

Functions

bool MSPFMcontrolMotorA (tSensors link, byte chan, byte motor_op, byte motor_speed, ubyte address=MSPFM_I2C_ADDR)
bool MSPFMcontrolMotorB (tSensors link, byte chan, byte motor_op, byte motor_speed, ubyte address=MSPFM_I2C_ADDR)
bool MSPFMcontrolMotorAB (tSensors link, byte chan, byte motorA_op, byte motorA_speed, byte motorB_op, byte motorB_speed, ubyte address=MSPFM_I2C_ADDR)

Variables

tByteArray MSPFM_I2CRequest

Detailed Description

PFMate Sensor


Define Documentation

#define MSPFM_BRAKE   0x03
Examples:
mindsensors-pfmate-test1.c.

Definition at line 60 of file mindsensors-pfmate.h.

#define MSPFM_CMD   0x41

Command register

Definition at line 43 of file mindsensors-pfmate.h.

#define MSPFM_FLOAT   0x00
Examples:
mindsensors-pfmate-test1.c.

Definition at line 57 of file mindsensors-pfmate.h.

#define MSPFM_FORWARD   0x01
Examples:
mindsensors-pfmate-test1.c.

Definition at line 58 of file mindsensors-pfmate.h.

#define MSPFM_GOCMD   0x47

"Go" command to start sending IR signals to PF receiver

Definition at line 51 of file mindsensors-pfmate.h.

#define MSPFM_I2C_ADDR   0x48

I2C address for sensor

Definition at line 42 of file mindsensors-pfmate.h.

#define MSPFM_IRCHAN   0x42

IR Channel selection register

Definition at line 44 of file mindsensors-pfmate.h.

#define MSPFM_MOTOPA   0x44

Motor A operation register

Definition at line 46 of file mindsensors-pfmate.h.

#define MSPFM_MOTOPB   0x46

Motor B operation register

Definition at line 48 of file mindsensors-pfmate.h.

#define MSPFM_MOTORA   0x01

Definition at line 54 of file mindsensors-pfmate.h.

#define MSPFM_MOTORAB   0x00

Definition at line 53 of file mindsensors-pfmate.h.

#define MSPFM_MOTORB   0x02

Definition at line 55 of file mindsensors-pfmate.h.

#define MSPFM_MOTSPA   0x45

Motor A speed register

Definition at line 47 of file mindsensors-pfmate.h.

#define MSPFM_MOTSPB   0x47

Motor B speed register

Definition at line 49 of file mindsensors-pfmate.h.

#define MSPFM_MSELECT   0x43

Motor selection register

Definition at line 45 of file mindsensors-pfmate.h.

#define MSPFM_NOOP   0x0F

Definition at line 61 of file mindsensors-pfmate.h.

#define MSPFM_REVERSE   0x02
Examples:
mindsensors-pfmate-test1.c.

Definition at line 59 of file mindsensors-pfmate.h.


Function Documentation

bool MSPFMcontrolMotorA ( tSensors  link,
byte  chan,
byte  motor_op,
byte  motor_speed,
ubyte  address 
)

Control motor A with the PFMate.

Parameters:
linkthe PFMate port number
chanthe channel of the IR receiver, value of 1-4
motor_opmotor A operation, 0: float, 1: forward, 2: reverse, 3: brake
motor_speedthe speed at which motor A should turn, value between 1-7
addressthe I2C address to use, optional, defaults to 0x48
Returns:
true if no error occured, false if it did
Examples:
mindsensors-pfmate-test1.c.

Definition at line 82 of file mindsensors-pfmate.h.

bool MSPFMcontrolMotorAB ( tSensors  link,
byte  chan,
byte  motorA_op,
byte  motorA_speed,
byte  motorB_op,
byte  motorB_speed,
ubyte  address 
)

Control motors A and B with the PFMate.

Parameters:
linkthe PFMate port number
chanthe channel of the IR receiver, value of 1-4
motorA_opmotor A operation, 0: float, 1: forward, 2: reverse, 3: brake
motorA_speedthe speed at which motor A should turn, value between 1-7
motorB_opmotor B operation, 0: float, 1: forward, 2: reverse, 3: brake
motorB_speedthe speed at which motor B should turn, value between 1-7
addressthe I2C address to use, optional, defaults to 0x48
Returns:
true if no error occured, false if it did
Examples:
mindsensors-pfmate-test1.c.

Definition at line 114 of file mindsensors-pfmate.h.

bool MSPFMcontrolMotorB ( tSensors  link,
byte  chan,
byte  motor_op,
byte  motor_speed,
ubyte  address 
)

Control motor B with the PFMate.

Parameters:
linkthe PFMate port number
chanthe channel of the IR receiver, value of 1-4
motor_opmotor B operation, 0: float, 1: forward, 2: reverse, 3: brake
motor_speedthe speed at which motor B should turn, value between 1-7
addressthe I2C address to use, optional, defaults to 0x48
Returns:
true if no error occured, false if it did
Examples:
mindsensors-pfmate-test1.c.

Definition at line 97 of file mindsensors-pfmate.h.


Variable Documentation

Array to hold I2C command data

Definition at line 69 of file mindsensors-pfmate.h.