upm
1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
|
Public Member Functions | |
BH1749 (int bus=0, int addr=0x39) | |
Initialize a sensor instance with bus and address. More... | |
virtual | ~BH1749 () |
Close and free sensor. | |
void | Enable () |
Enables RGB color measurement on the sensor. More... | |
void | Disable () |
Disables RGB color measurement on the sensor. More... | |
void | CheckWhoAmI () |
Check "who am I" register value to identify the sensor. More... | |
void | SensorInit (OPERATING_MODES opMode, MEAS_TIMES measTime, RGB_GAINS rgbGain, IR_GAINS irGain, INT_SOURCES intSource) |
Initializes (writes) configuration values to sensor. More... | |
void | SetOperatingMode (OPERATING_MODES opMode) |
Sets operating mode (interrupt persistance) More... | |
int | GetOperatingMode () |
Gets operating mode (interrupt persistance) value. More... | |
void | SetMeasurementTime (MEAS_TIMES measTime) |
Sets measurement time (ODR) More... | |
int | GetMeasurementTime () |
Gets measurement time (ODR) value. More... | |
void | SetRgbGain (RGB_GAINS rgbGain) |
Sets RGB gain value. More... | |
int | GetRgbGain () |
Gets RGB gain value. More... | |
void | SetIrGain (IR_GAINS irGain) |
Sets IR gain value. More... | |
int | GetIrGain () |
Gets IR gain value. More... | |
void | SetIntSource (INT_SOURCES intSource) |
Sets interrupt source value. More... | |
char | GetInterruptSourceChar () |
Gets interrupt source value. More... | |
void | EnableInterrupt () |
Enables interrupt mode. More... | |
void | DisableInterrupt () |
Disables interrupt mode. More... | |
void | ResetInterrupt () |
Resets interrupt status (clear) to allow new interrupt reads. More... | |
bool | IsInterrupted () |
Gets interrupt status, whether interrupt is raised or not. More... | |
bool | IsInterruptEnabled () |
Gets interrupt mode status. More... | |
void | SoftReset () |
Initiates a software reset to the sensor. All register values will be written to their defaults, thus sensor_init() must be called after this, and thresholds also needs to be set. More... | |
void | SetThresholdHigh (uint16_t threshold) |
Sets threshold high value. More... | |
int | GetThresholdHigh () |
Gets threshold high value. More... | |
void | SetThresholdLow (uint16_t threshold) |
Sets threshold low value. More... | |
int | GetThresholdLow () |
Gets threshold low value. More... | |
uint16_t | GetRed () |
Gets value of Red color channel. More... | |
uint16_t | GetGreen () |
Gets value of Green color channel. More... | |
uint16_t | GetBlue () |
Gets value of Blue color channel. More... | |
uint16_t | GetIr () |
Gets value of IR color channel. More... | |
uint16_t | GetGeen2 () |
Gets value of Green2 color channel. More... | |
std::vector< uint16_t > | GetMeasurements () |
Gets all channels measurements values. More... | |
void | InstallISR (mraa_gpio_edge_t edge, int pin, void(*isr)(void *), void *isr_args) |
Installs the ISR to a given GPIO pin. More... | |
void | RemoveISR () |
Removes the ISR if it is installed. | |
std::string | RegistersDump () |
Gets a dump of configuration registers as a string. More... | |
BH1749 | ( | int | bus = 0 , |
int | addr = 0x39 |
||
) |
This calls SensorInit() to set default values for operating mode, gains, measurement time, interrupt source and then sets threshold high to 511.
bus | I2C bus number |
addr | I2C sensor address |
std::runtime_error | on initialization failure |
void Enable | ( | ) |
void Disable | ( | ) |
void CheckWhoAmI | ( | ) |
std::runtime_error | if this value is incorrect |
void SensorInit | ( | OPERATING_MODES | opMode, |
MEAS_TIMES | measTime, | ||
RGB_GAINS | rgbGain, | ||
IR_GAINS | irGain, | ||
INT_SOURCES | intSource | ||
) |
opMode | Operating mode choice, a value of OPERATING_MODES enum |
measTime | Measurement time choice, a value of MEAS_TIMES enum |
rgbGain | RGB gain choice, a value of RGB_GAINS enum |
irGain | IR gain choice, a value of IR_GAINS enum |
intSource | interrupt source choice, a value of INT_SOURCES enum |
std::runtime_error | if one of values setting fails |
void SetOperatingMode | ( | OPERATING_MODES | opMode | ) |
opMode | Operating mode choice, a value of OPERATING_MODES enum |
std::runtime_error | if writing value fails |
int GetOperatingMode | ( | ) |
opMode | pointer (uint8_t) to save value |
std::runtime_error | if reading the value fails |
void SetMeasurementTime | ( | MEAS_TIMES | measTime | ) |
measTime | measurement time choice, a value of MEAS_TIMES enum |
std::runtime_error | if writing value fails |
int GetMeasurementTime | ( | ) |
std::runtime_error | if reading the value fails |
void SetRgbGain | ( | RGB_GAINS | rgbGain | ) |
rgbGain | RGB gain choice, a value of RGB_GAINS enum |
std::runtime_error | if writing value fails |
int GetRgbGain | ( | ) |
std::runtime_error | if reading the value fails |
void SetIrGain | ( | IR_GAINS | irGain | ) |
irGain | IR gain choice, a value of IR_GAINS enum |
std::runtime_error | if writing value fails |
int GetIrGain | ( | ) |
std::runtime_error | if reading the value fails |
void SetIntSource | ( | INT_SOURCES | intSource | ) |
intSource | interrupt source choice, a value of INT_SOURCES enum |
std::runtime_error | if writing value fails |
char GetInterruptSourceChar | ( | ) |
std::runtime_error | if reading the value fails |
void EnableInterrupt | ( | ) |
std::runtime_error | if writing enable bit fails |
void DisableInterrupt | ( | ) |
std::runtime_error | if writing disable bit fails |
void ResetInterrupt | ( | ) |
std::runtime_error | if writing reset bit fails |
bool IsInterrupted | ( | ) |
bool IsInterruptEnabled | ( | ) |
void SoftReset | ( | ) |
std::runtime_error | if writing reset bit fails |
void SetThresholdHigh | ( | uint16_t | threshold | ) |
threshold | interrupt threshold high value, range 0-65536 |
std::runtime_error | if writing value fails |
int GetThresholdHigh | ( | ) |
std::runtime_error | if reading the value fails |
void SetThresholdLow | ( | uint16_t | threshold | ) |
threshold | interrupt threshold low value, range 0-65536 |
std::runtime_error | if writing value fails |
int GetThresholdLow | ( | ) |
std::runtime_error | if reading the value fails |
uint16_t GetRed | ( | ) |
std::runtime_error | if reading the value fails |
uint16_t GetGreen | ( | ) |
std::runtime_error | if reading the value fails |
uint16_t GetBlue | ( | ) |
std::runtime_error | if reading the value fails |
uint16_t GetIr | ( | ) |
std::runtime_error | if reading the value fails |
uint16_t GetGeen2 | ( | ) |
std::runtime_error | if reading the value fails |
std::vector< uint16_t > GetMeasurements | ( | ) |
std::runtime_error | if reading one of the values fails |
void InstallISR | ( | mraa_gpio_edge_t | edge, |
int | pin, | ||
void(*)(void *) | isr, | ||
void * | isr_args | ||
) |
edge | Edge type to raise ISR with, of type mraa_gpio_edge_t |
pin | GPIO pin number |
isr | Pointer to ISR function |
isr_args | Arguments to pass the ISR function |
std::runtime_error | if installing ISR fails |
std::string RegistersDump | ( | ) |
std::runtime_error | if reading one of the registers fails |