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

This class implements EV3 InfraRed Sensor using EV3SensorAdapter. More...

#include <EV3InfraRed.h>

Inheritance diagram for EV3InfraRed:
EV3SensorAdapter NXShieldI2C BaseI2CDevice SoftI2cMaster

Public Member Functions

 EV3InfraRed (uint8_t i2c_address=0x32)
 
uint8_t setMode (MODE_InfraRed)
 
int8_t readBeaconHeading (char channel)
 
uint8_t readBeaconProx (char channel)
 
uint8_t readButtonValue (char channel)
 
uint8_t BeaconInRange (char channel)
 
- Public Member Functions inherited from EV3SensorAdapter
 EV3SensorAdapter (uint8_t i2c_address=0x32)
 
uint8_t issueCommand (char command)
 
uint8_t setMode (char newMode)
 
byte getMode ()
 
int readValue ()
 
- 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

This class implements EV3 InfraRed Sensor using EV3SensorAdapter.

Member Function Documentation

uint8_t EV3InfraRed::BeaconInRange ( char  channel)
Infrared sensor will read a button value of the remote beacon.

Only used with mode 0x02

int8_t EV3InfraRed::readBeaconHeading ( char  channel)
Inrared sensor's values will be channel specific for Beacon and Remote modes. 

Channel can be between: 0-3

uint8_t EV3InfraRed::readBeaconProx ( char  channel)
Infrared sensor will show a heading value dependent on beacon placement with respect to the sensor.

Only used with mode 0x01

uint8_t EV3InfraRed::readButtonValue ( char  channel)
Infrared sensor will show a proximity value dependent on how far the beacon is from the sensor.

Only used with mode 0x01

uint8_t EV3InfraRed::setMode ( MODE_InfraRed  m)

Class constructor for EV3InfraRed; custom i2c address is an optional parameter


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