EVShield  v1.3
EVShield Library Reference by mindsensors.com
EVShield.h File Reference
#include "SHDefines.h"
#include "EVShieldI2C.h"

Go to the source code of this file.

Classes

class  EVShieldBank
 This class defines methods for the EVShield Bank(s). More...
 
class  EVShieldBankB
 EVShield has two banks. Bank B has few differences from Bank A. This class defines overriding methods for the EVShield Bank B. More...
 
class  EVShield
 This class defines methods to access EVShield features. More...
 

Macros

#define SH_CONTROL_SPEED   0x01
 
#define SH_CONTROL_RAMP   0x02
 
#define SH_CONTROL_RELATIVE   0x04
 
#define SH_CONTROL_TACHO   0x08
 
#define SH_CONTROL_BRK   0x10
 
#define SH_CONTROL_ON   0x20
 
#define SH_CONTROL_TIME   0x40
 
#define SH_CONTROL_GO   0x80
 
#define SH_STATUS_SPEED   0x01
 
#define SH_STATUS_RAMP   0x02
 
#define SH_STATUS_MOVING   0x04
 
#define SH_STATUS_TACHO   0x08
 
#define SH_STATUS_BREAK   0x10
 
#define SH_STATUS_OVERLOAD   0x20
 
#define SH_STATUS_TIME   0x40
 
#define SH_STATUS_STALL   0x80
 
#define SH_COMMAND   0x41
 
#define SH_VOLTAGE   0x6E
 
#define SH_SETPT_M1   0x42
 
#define SH_SPEED_M1   0x46
 
#define SH_TIME_M1   0x47
 
#define SH_CMD_B_M1   0x48
 
#define SH_CMD_A_M1   0x49
 
#define SH_SETPT_M2   0x4A
 
#define SH_SPEED_M2   0x4E
 
#define SH_TIME_M2   0x4F
 
#define SH_CMD_B_M2   0x50
 
#define SH_CMD_A_M2   0x51
 
#define SH_POSITION_M1   0x52
 
#define SH_POSITION_M2   0x56
 
#define SH_STATUS_M1   0x5A
 
#define SH_STATUS_M2   0x5B
 
#define SH_TASKS_M1   0x5C
 
#define SH_TASKS_M2   0x5D
 
#define SH_ENCODER_PID   0x5E
 
#define SH_SPEED_PID   0x64
 
#define SH_PASS_COUNT   0x6A
 
#define SH_TOLERANCE   0x6B
 
#define SH_S1_MODE   0x6F
 
#define SH_S1_EV3_MODE   0x6F
 
#define SH_S1_ANALOG   0x70
 
#define SH_S2_MODE   0xA3
 
#define SH_S2_EV3_MODE   0x6F
 
#define SH_S2_ANALOG   0xA4
 
#define SH_BTN_PRESS   0xDA
 
#define SH_RGB_LED   0xD7
 
#define SH_CENTER_RGB_LED   0xDE
 
#define SH_PS_TS_X   0xE3
 
#define SH_PS_TS_Y   0xE5
 
#define SH_PS_TS_RAWX   0xE7
 
#define SH_PS_TS_RAWY   0xE9
 
#define SH_PS_TS_CALIBRATION_DATA_READY   0x70
 
#define SH_PS_TS_CALIBRATION_DATA   0x71
 
#define SH_PS_TS_SAVE   0x77
 
#define SH_PS_TS_LOAD   0x6C
 
#define SH_PS_TS_UNLOCK   0x45
 
#define SH_Speed_Full   90
 
#define SH_Speed_Medium   60
 
#define SH_Speed_Slow   25
 
#define SH_Bank_A   0x34
 
#define SH_Bank_B   0x36
 
#define SH_Type_NONE   0x00
 
#define SH_Type_SWITCH   0x01
 
#define SH_Type_ANALOG   0x02
 
#define SH_Type_LIGHT_REFLECTED   0x03
 
#define SH_Type_LIGHT_AMBIENT   0x04
 
#define SH_Type_I2C   0x09
 
#define SH_Type_COLORFULL   13
 
#define SH_Type_COLORRED   14
 
#define SH_Type_COLORGREEN   15
 
#define SH_Type_COLORBLUE   16
 
#define SH_Type_COLORNONE   17
 
#define SH_Type_EV3_SWITCH   18
 
#define SH_Type_EV3   19
 
#define SH_S1   1
 
#define SH_S2   2
 

Enumerations

enum  SH_Motor { SH_Motor_1 = 0x01, SH_Motor_2 = 0x02, SH_Motor_Both = 0x03 }
 
enum  SH_Next_Action { SH_Next_Action_Float = 0x00, SH_Next_Action_Brake = 0x01, SH_Next_Action_BrakeHold = 0x02 }
 
enum  SH_Direction { SH_Direction_Reverse = 0x00, SH_Direction_Forward = 0x01 }
 
enum  SH_Move { SH_Move_Absolute = 0x00, SH_Move_Relative = 0x01 }
 
enum  SH_Completion_Wait { SH_Completion_Dont_Wait = 0x00, SH_Completion_Wait_For = 0x01 }
 

Functions

bool format_bin (uint8_t i, char *s)
 

Detailed Description

EVShield.h defines main interfaces used in the EVShield library.

Macro Definition Documentation

§ SH_Bank_A

#define SH_Bank_A   0x34

I2C address of bank A

§ SH_Bank_B

#define SH_Bank_B   0x36

I2C address of bank B

§ SH_S1

#define SH_S1   1

This is used internally to address Sensor Port 1. Do not use this in sketches. Sketches should use SH_BankPort enums.

§ SH_S2

#define SH_S2   2

This is used internally to address Sensor Port 2. Do not use this in sketches. Sketches should use SH_BankPort enums.

§ SH_Type_ANALOG

#define SH_Type_ANALOG   0x02

In this type the sensor port is not powered (for sensors like touch sensor).

§ SH_Type_COLORBLUE

#define SH_Type_COLORBLUE   16

In this type the sensor connected is NXT color sensor in BLUE color mode

§ SH_Type_COLORFULL

#define SH_Type_COLORFULL   13

In this type the sensor connected is NXT color sensor in color mode

§ SH_Type_COLORGREEN

#define SH_Type_COLORGREEN   15

In this type the sensor connected is NXT color sensor in GREEN color mode

§ SH_Type_COLORNONE

#define SH_Type_COLORNONE   17

In this type the sensor connected is NXT color sensor in ambient light mode

§ SH_Type_COLORRED

#define SH_Type_COLORRED   14

In this type the sensor connected is NXT color sensor in RED color mode

§ SH_Type_EV3

#define SH_Type_EV3   19

In this type the sensor connected is EV3 UART sensor

§ SH_Type_EV3_SWITCH

#define SH_Type_EV3_SWITCH   18

In this type the sensor connected is EV3 touch sensor

§ SH_Type_I2C

#define SH_Type_I2C   0x09

In this type the sensor connected should be an i2c device.

§ SH_Type_LIGHT_AMBIENT

#define SH_Type_LIGHT_AMBIENT   0x04

Used for detection of ambient Light using the light sensors,

§ SH_Type_LIGHT_REFLECTED

#define SH_Type_LIGHT_REFLECTED   0x03

Used for detection of Refelected Light from Light sensors,

§ SH_Type_NONE

#define SH_Type_NONE   0x00

In this type the sensor port is not defined and used.

Enumeration Type Documentation

§ SH_Completion_Wait

Enumerator
SH_Completion_Dont_Wait 

Don't wait for motor to finish, program will continue with next function

SH_Completion_Wait_For 

Wait for motor to finish, program will wait until current function finishes it's operation

§ SH_Direction

Motor direction related constants.

Enumerator
SH_Direction_Reverse 

Run motor in reverse direction

SH_Direction_Forward 

Run motor in forward direction

§ SH_Motor

enum SH_Motor

Motor selection related constants

Enumerator
SH_Motor_1 

Choose Motor 1 for selected operation

SH_Motor_2 

Choose Motor 2 for selected operation

SH_Motor_Both 

Choose Both Motors for selected operation

§ SH_Move

enum SH_Move
Enumerator
SH_Move_Absolute 

Move the tach to absolute value provided

SH_Move_Relative 

Move the tach relative to previous position

§ SH_Next_Action

Enumerator
SH_Next_Action_Float 

stop and let the motor coast.

SH_Next_Action_Brake 

apply brakes, and resist change to tachometer, but if tach position is forcibly changed, do not restore position

SH_Next_Action_BrakeHold 

apply brakes, and restore externally forced change to tachometer

Function Documentation

§ format_bin()

bool format_bin ( uint8_t  i,
char *  s 
)

This function formats an integer in binary format.

Parameters
i8 bit integer value
sreturned string of the binary representation