NXShield  v1.07
NXShield Library Reference by OpenElectrons.com
 All Classes Files Functions Variables Enumerations Enumerator Macros Pages
NXShieldBankB Class Reference

NXShield has two banks. Bank B has few differences from Bank A. This class defines overriding methods for the NXShield Bank B. More...

#include <NXShield.h>

Inheritance diagram for NXShieldBankB:
NXShieldBank NXShieldI2C BaseI2CDevice SoftI2cMaster

Public Member Functions

 NXShieldBankB (uint8_t i2c_address_b=SH_Bank_B)
 
int sensorReadRaw (uint8_t which_sensor)
 
bool sensorSetType (uint8_t which_sensor, uint8_t sensor_type)
 
- Public Member Functions inherited from NXShieldBank
 NXShieldBank (uint8_t i2c_address=SH_Bank_A)
 
int nxshieldGetBatteryVoltage ()
 
uint8_t nxshieldIssueCommand (char command)
 
bool motorSetEncoderTarget (SH_Motor which_motor, long target)
 
long motorGetEncoderTarget (SH_Motor which_motor)
 
bool motorSetSpeed (SH_Motor which_motor, int speed)
 
int8_t motorGetSpeed (SH_Motor which_motor)
 
bool motorSetTimeToRun (SH_Motor which_motor, int seconds)
 
uint8_t motorGetTimeToRun (SH_Motor which_motor)
 
bool motorSetCommandRegB (SH_Motor which_motor, uint8_t value)
 
uint8_t motorGetCommandRegB (SH_Motor which_motor)
 
bool motorSetCommandRegA (SH_Motor which_motor, uint8_t value)
 
uint8_t motorGetCommandRegA (SH_Motor which_motor)
 
int32_t motorGetEncoderPosition (SH_Motor which_motor)
 
uint8_t motorGetStatusByte (SH_Motor which_motor)
 
uint8_t motorGetTasksRunningByte (SH_Motor which_motor)
 
bool motorSetEncoderPID (uint16_t Kp, uint16_t Ki, uint16_t Kd)
 
bool motorSetSpeedPID (uint16_t Kp, uint16_t Ki, uint16_t Kd)
 
bool motorSetPassCount (uint8_t pass_count)
 
bool motorSetTolerance (uint8_t tolerance)
 
bool motorReset ()
 
bool motorStartBothInSync ()
 
bool motorResetEncoder (SH_Motor which_motor)
 
bool motorSetSpeedTimeAndControl (SH_Motor which_motors, int speed, uint8_t duration, uint8_t control)
 
bool motorSetEncoderSpeedTimeAndControl (SH_Motor which_motors, long encoder, int speed, uint8_t duration, uint8_t control)
 
uint8_t motorIsTimeDone (SH_Motor which_motors)
 
uint8_t motorWaitUntilTimeDone (SH_Motor which_motors)
 
uint8_t motorIsTachoDone (SH_Motor which_motors)
 
uint8_t motorWaitUntilTachoDone (SH_Motor which_motors)
 
void motorRunUnlimited (SH_Motor which_motors, SH_Direction direction, int speed)
 
uint8_t motorRunSeconds (SH_Motor which_motors, SH_Direction direction, int speed, uint8_t duration, SH_Completion_Wait wait_for_completion, SH_Next_Action next_action)
 
uint8_t motorRunTachometer (SH_Motor which_motors, SH_Direction direction, int speed, long tachometer, SH_Move relative, SH_Completion_Wait wait_for_completion, SH_Next_Action next_action)
 
uint8_t motorRunDegrees (SH_Motor which_motors, SH_Direction direction, int speed, long degrees, SH_Completion_Wait wait_for_completion, SH_Next_Action next_action)
 
uint8_t motorRunRotations (SH_Motor which_motors, SH_Direction direction, int speed, long rotations, SH_Completion_Wait wait_for_completion, SH_Next_Action next_action)
 
bool motorStop (SH_Motor which_motors, SH_Next_Action next_action)
 
bool sensorSetType (uint8_t which_sensor, uint8_t sensor_type)
 
int sensorReadRaw (uint8_t which_sensor)
 
- Public Member Functions inherited from NXShieldI2C
 NXShieldI2C (uint8_t i2c_address)
 
void init (void *shield, SH_BankPort bp)
 
uint8_t readByte (uint8_t location)
 
uint16_t readInteger (uint8_t location)
 
uint32_t readLong (uint8_t location)
 
uint8_t * readRegisters (uint8_t start_register, uint8_t bytes, uint8_t *buf)
 
char * readString (uint8_t location, uint8_t bytes_to_read, uint8_t *buffer=0, uint8_t buffer_length=0)
 
bool writeRegisters (uint8_t start_register, uint8_t bytes_to_write, uint8_t *buffer=0)
 
bool writeByte (uint8_t location, uint8_t data)
 
bool writeInteger (uint8_t location, uint16_t data)
 
bool writeLong (uint8_t location, uint32_t data)
 
char * getFirmwareVersion ()
 
char * getVendorID ()
 
char * getDeviceID ()
 
char * getFeatureSet ()
 
uint8_t getErrorCode ()
 
bool checkAddress ()
 
bool setAddress (uint8_t address)
 
- Public Member Functions inherited from BaseI2CDevice
 BaseI2CDevice (uint8_t i2c_address)
 
void initProtocol ()
 
uint8_t * readRegisters (uint8_t start_register, uint8_t bytes_to_read, uint8_t *buffer=0, uint8_t buffer_length=0, bool clear_buffer=false)
 
uint8_t readByte (uint8_t location)
 
int16_t readInteger (uint8_t location)
 
uint32_t readLong (uint8_t location)
 
char * readString (uint8_t location, uint8_t bytes_to_read, uint8_t *buffer=0, uint8_t buffer_length=0)
 
bool writeRegisters (uint8_t start_register, uint8_t bytes_to_write, uint8_t *buffer=0)
 
bool writeByte (uint8_t location, uint8_t data)
 
bool writeInteger (uint8_t location, uint16_t data)
 
bool writeLong (uint8_t location, uint32_t data)
 
bool checkAddress ()
 
bool setAddress (uint8_t i2c_address)
 
uint8_t getAddress ()
 
uint8_t getWriteErrorCode ()
 
char * getFirmwareVersion ()
 
char * getVendorID ()
 
char * getDeviceID ()
 
char * getFeatureSet ()
 
- Public Member Functions inherited from SoftI2cMaster
uint8_t start (uint8_t addressRW)
 
void stop (void)
 
uint8_t restart (uint8_t addressRW)
 
uint8_t write (uint8_t b)
 
uint8_t read (uint8_t last)
 
 SoftI2cMaster (uint8_t devAddr)
 
void initProtocol (uint8_t sclPin=NULL, uint8_t sdaPin=NULL)
 
uint8_t * readRegisters (uint8_t startRegister, uint8_t bytes, uint8_t *buf=NULL)
 
bool writeRegistersWithLocation (int bytes, uint8_t *buf)
 
bool writeRegisters (uint8_t location, uint8_t bytes_to_write, uint8_t *buffer=0)
 
bool writeByte (uint8_t location, uint8_t data)
 
bool writeInteger (uint8_t location, uint16_t data)
 
bool writeLong (uint8_t location, uint32_t data)
 
char * readString (uint8_t startRegister, uint8_t bytes, uint8_t *buf=NULL, uint8_t len=0)
 
uint8_t readByte (uint8_t location)
 
int16_t readInteger (uint8_t location)
 
uint32_t readLong (uint8_t location)
 
char * getFirmwareVersion ()
 
char * getVendorID ()
 
char * getDeviceID ()
 
uint8_t getWriteErrorCode ()
 
bool checkAddress ()
 
bool setAddress (uint8_t address)
 

Additional Inherited Members

- Public Attributes inherited from NXShieldI2C
void * mp_shield
 
uint8_t * _i2c_buffer
 
uint8_t m_protocol
 
- Public Attributes inherited from SoftI2cMaster
uint8_t * _so_buffer
 
- Static Public Attributes inherited from BaseI2CDevice
static uint8_t * _buffer = 0
 
static bool b_initialized = false
 
- Protected Member Functions inherited from BaseI2CDevice
void setWriteErrorCode (uint8_t code)
 

Detailed Description

NXShield has two banks. Bank B has few differences from Bank A. This class defines overriding methods for the NXShield Bank B.

Constructor & Destructor Documentation

NXShieldBankB::NXShieldBankB ( uint8_t  i2c_address_b = SH_Bank_B)

constructor for bank be of the NXShield; optional custom i2c address can be supplied

Member Function Documentation

int NXShieldBankB::sensorReadRaw ( uint8_t  which_sensor)

Read the raw analog value from the sensor and return as an int

Parameters
which_sensorthe sensor to read the raw value from
Returns
raw value from the sensor
bool NXShieldBankB::sensorSetType ( uint8_t  which_sensor,
uint8_t  sensor_type 
)

Set the sensor Type of the sensor on this bank

Parameters
which_sensorthe sensor to set the type to.
sensor_typetype value of the sensor, refer to Advanced User Guide for available values of sensor types.

The documentation for this class was generated from the following files: