Class BO.I2CBase
A base class for I2C objects. Extend this class
when creating an interface for a new I2C device. I2CBase should
not be instantiated directly.
Defined in: I2CBase.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
BO.I2CBase(board, address, delayUS)
Creates a new I2CBase base class
|
| Field Attributes | Field Name and Description |
|---|---|
|
[read-only] The address of the i2c device.
|
|
| <static> <constant> |
BO.I2CBase.I2C_CONFIG
|
| <static> <constant> |
BO.I2CBase.I2C_REPLY
|
| <static> <constant> |
BO.I2CBase.I2C_REQUEST
|
| <static> <constant> |
BO.I2CBase.READ
|
| <static> <constant> |
BO.I2CBase.READ_CONTINUOUS
|
| <static> <constant> |
BO.I2CBase.STOP_READING
|
| <static> <constant> |
BO.I2CBase.WRITE
|
| Method Attributes | Method Name and Description |
|---|---|
|
addEventListener(type, listener)
|
|
|
dispatchEvent(type, optionalParams)
|
|
|
handleI2C(data)
|
|
|
hasEventListener(type)
|
|
|
removeEventListener(type, listener)
|
|
|
sendI2CRequest(command, data)
Send an i2c request command to the board
|
|
|
update()
|
Class Detail
BO.I2CBase(board, address, delayUS)
Creates a new I2CBase base class
- Parameters:
- {IOBoard} board
- A reference to the IOBoard instance
- {Number} address
- The I2C address of the device
- {Number} delayUS
- The number of microseconds ...
Field Detail
{Number}
address
[read-only] The address of the i2c device.
board
<static> <constant>
BO.I2CBase.I2C_CONFIG
<static> <constant>
BO.I2CBase.I2C_REPLY
<static> <constant>
BO.I2CBase.I2C_REQUEST
<static> <constant>
BO.I2CBase.READ
<static> <constant>
BO.I2CBase.READ_CONTINUOUS
<static> <constant>
BO.I2CBase.STOP_READING
<static> <constant>
BO.I2CBase.WRITE
Method Detail
addEventListener(type, listener)
- Parameters:
- {String} type
- The event type
- {Function} listener
- The function to be called when the event is fired
dispatchEvent(type, optionalParams)
- Parameters:
- {Event} type
- The Event object
- {Object} optionalParams
- Optional parameters to assign to the event object. return {boolean} True if dispatch is successful, false if not.
handleI2C(data)
- Parameters:
- data
hasEventListener(type)
- Parameters:
- {String} type
- The event type return {boolean} True is listener exists for this type, false if not.
removeEventListener(type, listener)
- Parameters:
- {String} type
- The event type
- {Function} listener
- The function to be called when the event is fired
sendI2CRequest(command, data)
Send an i2c request command to the board
- Parameters:
- {Number} command
- {Number[]} data
update()
