NXShield  v1.07
NXShield Library Reference by OpenElectrons.com
 All Classes Files Functions Variables Enumerations Enumerator Macros Pages
NXShield.h File Reference
#include "SHDefines.h"
#include "NXShieldI2C.h"

Go to the source code of this file.

Classes

class  NXShieldBank
 This class defines methods for the NXShield Bank(s). More...
 
class  NXShieldBankB
 NXShield has two banks. Bank B has few differences from Bank A. This class defines overriding methods for the NXShield Bank B. More...
 
class  NXShield
 This class defines methods to access NXShield 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   0x41
 
#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   0x62
 
#define SH_POSITION_M2   0x66
 
#define SH_STATUS_M1   0x72
 
#define SH_STATUS_M2   0x73
 
#define SH_TASKS_M1   0x76
 
#define SH_TASKS_M2   0x77
 
#define SH_ENCODER_PID   0x7A
 
#define SH_SPEED_PID   0x80
 
#define SH_PASS_COUNT   0x86
 
#define SH_TOLERANCE   0x87
 
#define SH_Speed_Full   90
 
#define SH_Speed_Medium   60
 
#define SH_Speed_Slow   25
 
#define SH_Bank_A   0x06
 
#define SH_Bank_B   0x08
 
#define SH_Type_ANALOG_PASSIVE   0x01
 
#define SH_Type_ANALOG_9VOLTS   0x02
 
#define SH_Type_ANALOG_ACTIVE   0x02
 
#define SH_Type_I2C   0x04
 
#define SH_Type_ANALOG   0x08
 
#define SH_Type_MIXED   0x10
 
#define SH_Type_DATABIT0_HIGH   0x40
 
#define SH_Type_DATABIT1_HIGH   0x80
 
#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

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

Macro Definition Documentation

#define SH_Bank_A   0x06

I2C address of bank A

#define SH_Bank_B   0x08

I2C address of bank B

#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.

#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.

#define SH_Type_ANALOG   0x08

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

#define SH_Type_ANALOG_9VOLTS   0x02

In this type 9 volt power is supplied to sensor.

#define SH_Type_ANALOG_ACTIVE   0x02

Useed for Active sensors, in which pulsed power (9 volts) is supplied to sensor.

#define SH_Type_ANALOG_PASSIVE   0x01

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

#define SH_Type_DATABIT0_HIGH   0x40

in this type: light sensor - light is turned on, sumoeyes changes range, and sound sensor changes range (db to linear)

#define SH_Type_DATABIT1_HIGH   0x80

required for sound sensor to change range (db to linear)

#define SH_Type_I2C   0x04

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

#define SH_Type_MIXED   0x10

this type is theoratical. (possibly for SumoEyes)

Enumeration Type Documentation

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

Motor direction related constants.

Enumerator
SH_Direction_Reverse 

Run motor in reverse direction

SH_Direction_Forward 

Run motor in forward direction

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

enum SH_Move
Enumerator
SH_Move_Absolute 

Move the tach to absolute value provided

SH_Move_Relative 

Move the tach relative to previous position

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

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