|
enum | _i2cRegType {
kRegAsciiVersion = 0x00
, kRegAsciiVendor = 0x08
, kRegAsciiDeviceId = 0x10
, kRegUserVendorId = 0x18
,
kRegUserProductId = 0x19
, kRegFirmwareVersion = 0x20
, kRegDeviceType = 0x21
, kRegDeviceId = 0x22
,
kRegDeviceStatus = 0x23
} |
|
typedef enum vex::generic::_i2cRegType | i2cRegType |
|
|
| generic (int32_t index) |
| Creates a new generic sensor object on the port specified in the parameter.
|
|
bool | installed () |
|
int32_t | version () |
| Gets the firmware version of the generic sensor.
|
|
int32_t | vendorId () |
| Gets the vendor id of the generic sensor.
|
|
int32_t | productId () |
| Gets the product id of the generic sensor.
|
|
int32_t | readByte (uint8_t reg) |
| Read 1 byte from the generic sensor.
|
|
int32_t | writeByte (uint8_t reg, uint8_t value) |
| Write 1 byte to the generic sensor.
|
|
int32_t | readWord (uint8_t reg, bool bLittleEndian=false) |
| Read 1 word (2 bytes) from the generic sensor.
|
|
int32_t | writeWord (uint8_t reg, uint16_t value, bool bLittleEndian=false) |
| Write 1 word (2 bytes) to the generic sensor.
|
|
bool | readReg (uint8_t reg, uint8_t *pBytes, uint8_t nLength) |
| Read bytes from the generic sensor.
|
|
bool | writeReg (uint8_t reg, uint8_t *pBytes, uint8_t nLength) |
| Write bytes to the generic sensor.
|
|
bool | readRaw (uint8_t addr, uint8_t *pBytes, uint8_t nLength) |
| Read bytes from the device.
|
|
bool | writeRaw (uint8_t addr, uint8_t *pBytes, uint8_t nLength) |
| Write bytes to the device.
|
|
void | writeRawWait () |
| Wait for raw write to complete usually this is not needed, writeRaw will block when called waiting for previous transactions to complete. but during testing, if errors are occurring, then this method will clears errors and suppress the "I2C error" message.
|
|
| device (int32_t index) |
|
IQ_DeviceType | type () |
|
int32_t | index () |
|
void | init (int32_t index) |
|
virtual int32_t | value () |
|
int32_t | readDigitalPin () |
|
int32_t | readAnalogPin () |
|
|
void | setPollInterval (int32_t value) |
|
bool | pollValid (bool bSave) |
|
int16_t | _index |
|
Definition at line 26 of file vex_generic.h.
◆ _i2cRegType
enum vex::generic::_i2cRegType |
◆ generic()
vex::generic::generic |
( |
int32_t | index | ) |
|
Creates a new generic sensor object on the port specified in the parameter.
- Parameters
-
port | index to the brain port. |
◆ installed()
bool vex::generic::installed |
( |
| ) |
|
|
virtual |
◆ productId()
int32_t vex::generic::productId |
( |
| ) |
|
Gets the product id of the generic sensor.
- Returns
- Returns an integer with product id or -1 on error
◆ readByte()
int32_t vex::generic::readByte |
( |
uint8_t | reg | ) |
|
Read 1 byte from the generic sensor.
- Parameters
-
reg | the register to read from |
- Returns
- register value on success, -1 if error
◆ readRaw()
bool vex::generic::readRaw |
( |
uint8_t | addr, |
|
|
uint8_t * | pBytes, |
|
|
uint8_t | nLength ) |
Read bytes from the device.
- Parameters
-
addr | the 8 bit i2C address of the device |
pBytes | pointer to buffer to read into |
nLength | number of bytes to read |
- Returns
- true on success, false if error
◆ readReg()
bool vex::generic::readReg |
( |
uint8_t | reg, |
|
|
uint8_t * | pBytes, |
|
|
uint8_t | nLength ) |
Read bytes from the generic sensor.
- Parameters
-
reg | the starting register to read from |
pBytes | pointer to buffer to read into |
nLength | number of bytes to read |
- Returns
- true on success, false if error
◆ readWord()
int32_t vex::generic::readWord |
( |
uint8_t | reg, |
|
|
bool | bLittleEndian = false ) |
Read 1 word (2 bytes) from the generic sensor.
- Parameters
-
reg | the register to read from |
bLittleEndian | the endianess of the word in the sensor |
- Returns
- register value on success, -1 if error
◆ vendorId()
int32_t vex::generic::vendorId |
( |
| ) |
|
Gets the vendor id of the generic sensor.
- Returns
- Returns an integer with vendor id or -1 on error
◆ version()
int32_t vex::generic::version |
( |
| ) |
|
Gets the firmware version of the generic sensor.
- Returns
- Returns an integer with version or -1 on error
◆ writeByte()
int32_t vex::generic::writeByte |
( |
uint8_t | reg, |
|
|
uint8_t | value ) |
Write 1 byte to the generic sensor.
- Parameters
-
reg | the register to write to |
value | the data to write |
- Returns
- register value on success, -1 if error
◆ writeRaw()
bool vex::generic::writeRaw |
( |
uint8_t | addr, |
|
|
uint8_t * | pBytes, |
|
|
uint8_t | nLength ) |
Write bytes to the device.
- Parameters
-
addr | the 8 bit i2C address of the device |
pBytes | pointer to buffer with data |
nLength | number of bytes to write |
- Returns
- true on success, false if error
◆ writeReg()
bool vex::generic::writeReg |
( |
uint8_t | reg, |
|
|
uint8_t * | pBytes, |
|
|
uint8_t | nLength ) |
Write bytes to the generic sensor.
- Parameters
-
reg | the starting register to write to |
pBytes | pointer to buffer with data |
nLength | number of bytes to write |
- Returns
- true on success, false if error
◆ writeWord()
int32_t vex::generic::writeWord |
( |
uint8_t | reg, |
|
|
uint16_t | value, |
|
|
bool | bLittleEndian = false ) |
Write 1 word (2 bytes) to the generic sensor.
- Parameters
-
reg | the register to write to |
value | the data to write |
bLittleEndian | the endianess of the word in the sensor |
- Returns
- register value on success, -1 if error
The documentation for this class was generated from the following file: