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.

BH1792 Class

Module: common

Methods

BH1792

(
  • bus
  • addr
)
Number

Parameters:

  • bus Number

    I2C bus number

  • addr Number

    I2C sensor address

Returns:

Number:

CheckWhoAmI

()

IsEnabled

() Boolean

Returns:

Boolean:

True if measurement is enabled, or false otherwise

SoftReset

()

GetMeasurementTimeMS

() Number

Returns:

Number:

measurement time float in milli-seconds

SetGreenLedsCurrent

(
  • current
)

Parameters:

  • current Number

    The current value, accepted values are between 0-63

GetGreenLedsCurrent

() Number

Returns:

Number:

Green LED used current

SetIrLedCurrent

(
  • current
)

Parameters:

  • current Number

    The current value, accepted values are between 0-63

GetIrLedCurrent

() Number

Returns:

Number:

Green LED used current

SetIrThreshold

(
  • threshold
)

Parameters:

  • threshold Number

    Value to be written, range 0-65536

GetIrThreshold

() Number

Returns:

Number:

Green LED used current

GetFifoSize

() Number

Returns:

Number:

Number of entries store in FIFO

DisableInterrupt

()

ClearInterrupt

()

StartMeasurement

()

StopMeasurement

()

Stops the measurement by setting the software reset bit. This function will reset all config registers. To resume from previous configuration call RestartMeasurement() .

RestartMeasurement

()

GetFifoData

() Std::vector std::vector< int >

Returns:

Std::vector std::vector< int >:

vector of values of the retrieved FIFO values, which are vectors containing 2 values each (led off, led_on)

DiscardFifoData

()

GetGreenData

() Std::vector int

Returns:

Std::vector int :

vector of values (led off, led on) of green led values

GetIrData

() Std::vector int

Returns:

Std::vector int :

vector of values (led off, led on) of IR led values

EnableSyncMode

(
  • measFreq
  • green_current
)

You need to call StartMeasurement() after this.

Parameters:

  • measFreq Number

    Measurement frequncy mode, valid values 32, 64, 128, 256, 1024

  • green_current Number

    Green LED current value

EnableNonSyncMode

(
  • ir_current
  • threshold
)

You need to call StartMeasurement() after this.

Parameters:

  • ir_current Number

    The IR LED current value

  • threshold Number

    The IR LED interrupt threshold value

EnableSingleMode

(
  • led_type
  • current
)

You need to call StartMeasurement() after this. If you need to get continuous values, clear interrupt and StartMeasurement() continuously.

Parameters:

  • led_type LED_TYPES

    LED light type to use, takes GREEN or IR (0 or 1)

  • current Number

    The chosen led_type current value

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

InstallISR

(
  • pin
  • isr
  • isr_args
)

Parameters:

  • 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