Show:

BO.I2CBase Class

A base class for I2C objects. Extend this class when creating an interface for a new I2C device. I2CBase should not be instantiated directly.

Constructor

BO.I2CBase

(
  • board
  • address
  • delayUS
)

Parameters:

  • board IOBoard

    A reference to the IOBoard instance

  • address Number

    The I2C address of the device

  • delayUS Number

    The number of microseconds ...

Methods

addEventListener

(
  • type
  • listener
)

Parameters:

  • type String

    The event type

  • listener Function

    The function to be called when the event is fired

dispatchEvent

(
  • type
  • optionalParams
)

Parameters:

  • type Event

    The Event object.

  • optionalParams Object

    Optional parameters passed as an object. return {boolean} True if dispatch is successful, false if not.

handleI2C

() protected

To be implemented in subclass. Data should be: slave address, register, data0, data1...

hasEventListener

(
  • type
)

Parameters:

  • type String

    The event type return {boolean} True is listener exists for this type, false if not.

removeEventListener

(
  • type
  • listener
)

Parameters:

  • type String

    The event type

  • listener Function

    The function to be called when the event is fired

sendI2CRequest

(
  • command
  • data
)
protected

Send an i2c request command to the board

Parameters:

  • command Number
  • data Number

update

() protected

To be implemented in subclass

Properties

address

Number

[read-only] The address of the i2c device.

I2CBase.I2C_CONFIG

Unknown static

I2CBase.I2C_REPLY

Unknown

I2CBase.I2C_REQUEST

Unknown static

I2CBase.READ

Unknown static

I2CBase.READ_CONTINUOUS

Unknown static

I2CBase.STOP_READING

Unknown static

I2CBase.WRITE

Unknown static