UPM

The UPM API is a high level sensor library for IoT devices using MRAA. See examples here. Back to index page.
SparkFun sensor images provided under CC BY-NC-SA-3.0.

BH1749 Class

Module: common

Methods

BH1749

(
  • bus
  • addr
)
Number

This calls SensorInit() to set default values for operating mode, gains, measurement time, interrupt source and then sets threshold high to 511.

Parameters:

  • bus Number

    I2C bus number

  • addr Number

    I2C sensor address

Returns:

Number:

Enable

()

Disable

()

CheckWhoAmI

()

SensorInit

(
  • opMode
  • measTime
  • rgbGain
  • irGain
  • intSource
)

Parameters:

  • opMode OPERATING_MODES

    Operating mode choice, a value of OPERATING_MODES enum

  • measTime MEAS_TIMES

    Measurement time choice, a value of MEAS_TIMES enum

  • rgbGain RGB_GAINS

    RGB gain choice, a value of RGB_GAINS enum

  • irGain IR_GAINS

    IR gain choice, a value of IR_GAINS enum

  • intSource INT_SOURCES

    interrupt source choice, a value of INT_SOURCES enum

SetOperatingMode

(
  • opMode
)

Parameters:

  • opMode OPERATING_MODES

    Operating mode choice, a value of OPERATING_MODES enum

GetOperatingMode

() Number

Returns:

Number:

operating mode value

SetMeasurementTime

(
  • measTime
)

Parameters:

  • measTime MEAS_TIMES

    measurement time choice, a value of MEAS_TIMES enum

GetMeasurementTime

() Number

Returns:

Number:

measurement time value

SetRgbGain

(
  • rgbGain
)

Parameters:

  • rgbGain RGB_GAINS

    RGB gain choice, a value of RGB_GAINS enum

GetRgbGain

() Number

Returns:

Number:

RGB gain value value

SetIrGain

(
  • irGain
)

Parameters:

  • irGain IR_GAINS

    IR gain choice, a value of IR_GAINS enum

GetIrGain

() Number

Returns:

Number:

IR gain value value

SetIntSource

(
  • intSource
)

Parameters:

  • intSource INT_SOURCES

    interrupt source choice, a value of INT_SOURCES enum

GetInterruptSourceChar

() String

Returns:

String:

interrupt source value

EnableInterrupt

()

DisableInterrupt

()

ResetInterrupt

()

IsInterrupted

() Boolean

Returns:

Boolean:

true if interrupt is raised, otherwise false

IsInterruptEnabled

() Boolean

Returns:

Boolean:

true if interrupt is enabled, otherwise false

SoftReset

()

SetThresholdHigh

(
  • threshold
)

Parameters:

  • threshold Number

    interrupt threshold high value, range 0-65536

GetThresholdHigh

() Number

Returns:

Number:

threshold high value

SetThresholdLow

(
  • threshold
)

Parameters:

  • threshold Number

    interrupt threshold low value, range 0-65536

GetThresholdLow

() Number

Returns:

Number:

threshold low value

GetRed

() Number

Returns:

Number:

red channel value

GetGreen

() Number

Returns:

Number:

green channel value

GetBlue

() Number

Returns:

Number:

blue channel value

GetIr

() Number

Returns:

Number:

ir channel value

GetGeen2

() Number

Returns:

Number:

green2 channel value

GetMeasurements

() Std::vector uint16_t

Returns:

Std::vector uint16_t :

vector with all channels values ordered as: Red, Green, Blue, IR, Green2

InstallISR

(
  • edge
  • pin
  • isr
  • isr_args
)

Parameters:

  • edge Mraa_gpio_edge_t

    Edge type to raise ISR with, of type mraa_gpio_edge_t

  • pin Number

    GPIO pin number

  • isr Function

    Pointer to ISR function

  • isr_args Void *

    Arguments to pass the ISR function

RemoveISR

()

RegistersDump

() String

Returns:

String:

string of dumped registers