BH1792 Class
Item Index
Methods
- BH1792
- CheckWhoAmI
- IsEnabled
- SoftReset
- GetMeasurementTimeMS
- SetGreenLedsCurrent
- GetGreenLedsCurrent
- SetIrLedCurrent
- GetIrLedCurrent
- SetIrThreshold
- GetIrThreshold
- GetFifoSize
- DisableInterrupt
- ClearInterrupt
- StartMeasurement
- StopMeasurement
- RestartMeasurement
- GetFifoData
- DiscardFifoData
- GetGreenData
- GetIrData
- EnableSyncMode
- EnableNonSyncMode
- EnableSingleMode
- InstallISR
- InstallISR
- RemoveISR
- RegistersDump
Methods
BH1792
-
bus
-
addr
Parameters:
-
bus
NumberI2C bus number
-
addr
NumberI2C sensor address
Returns:
CheckWhoAmI
()
IsEnabled
()
Boolean
Returns:
True if measurement is enabled, or false otherwise
SoftReset
()
GetMeasurementTimeMS
()
Number
Returns:
measurement time float in milli-seconds
SetGreenLedsCurrent
-
current
Parameters:
-
current
NumberThe current value, accepted values are between 0-63
GetGreenLedsCurrent
()
Number
Returns:
Green LED used current
SetIrLedCurrent
-
current
Parameters:
-
current
NumberThe current value, accepted values are between 0-63
GetIrLedCurrent
()
Number
Returns:
Green LED used current
SetIrThreshold
-
threshold
Parameters:
-
threshold
NumberValue to be written, range 0-65536
GetIrThreshold
()
Number
Returns:
Green LED used current
GetFifoSize
()
Number
Returns:
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:
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:
vector of values (led off, led on) of green led values
GetIrData
()
Std::vector int
Returns:
vector of values (led off, led on) of IR led values
EnableSyncMode
-
measFreq
-
green_current
You need to call StartMeasurement() after this.
Parameters:
-
measFreq
NumberMeasurement frequncy mode, valid values 32, 64, 128, 256, 1024
-
green_current
NumberGreen LED current value
EnableNonSyncMode
-
ir_current
-
threshold
You need to call StartMeasurement() after this.
Parameters:
-
ir_current
NumberThe IR LED current value
-
threshold
NumberThe 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_TYPESLED light type to use, takes GREEN or IR (0 or 1)
-
current
NumberThe chosen led_type current value
InstallISR
-
edge
-
pin
-
isr
-
isr_args
Parameters:
-
edge
Mraa_gpio_edge_tEdge type to raise ISR with, of type mraa_gpio_edge_t
-
pin
NumberGPIO pin number
-
isr
FunctionPointer to ISR function
-
isr_args
Void *Arguments to pass the ISR function
InstallISR
-
pin
-
isr
-
isr_args
Parameters:
-
pin
NumberGPIO pin number
-
isr
FunctionPointer to ISR function
-
isr_args
Void *Arguments to pass the ISR function
RemoveISR
()
RegistersDump
()
String
Returns:
string of dumped registers