Nordic Thingy:52
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
BH1745 color sensor

BH1745 digital color sensor API. More...

Data Structures

struct  drv_bh1745_cfg_t
 BH1745 configuration. More...
 
struct  drv_bh1745_data_t
 Measurement result. More...
 
struct  drv_bh1745_threshold_t
 Measurement thresholds. More...
 

Enumerations

enum  drv_bh1745_gain_t
 RGBC (red, green, blue, clear) gain setting.
 
enum  drv_bh1745_meas_time_t
 Measurement time.
 

Functions

uint32_t drv_bh1745_close (void)
 Function for closing the BH1745 driver. More...
 
uint32_t drv_bh1745_data_get (drv_bh1745_data_t *p_data)
 Function for getting the BH1745 data. More...
 
uint32_t drv_bh1745_gain_set (drv_bh1745_gain_t gain)
 Function for setting the BH1745 ADC gain. More...
 
uint32_t drv_bh1745_init (void)
 Function for initializing the BH1745 driver. More...
 
uint32_t drv_bh1745_int_get (uint8_t *p_int_reg)
 Function for getting the BH1745 interrupt register. More...
 
uint32_t drv_bh1745_int_reset (void)
 Function for resetting the interrupt. More...
 
uint32_t drv_bh1745_int_set (uint8_t int_reg)
 Function for setting the BH1745 interrupt register. More...
 
uint32_t drv_bh1745_manu_id_get (uint8_t *p_manu_id)
 Function for getting the BH1745 manufacturer ID. More...
 
uint32_t drv_bh1745_meas_enable (bool enable)
 Function for enabling the BH1745 measurements. More...
 
uint32_t drv_bh1745_meas_time_set (drv_bh1745_meas_time_t meas_time)
 Function for setting the BH1745 measurement time. More...
 
uint32_t drv_bh1745_open (drv_bh1745_cfg_t const *const p_cfg)
 Function for opening the BH1745 driver according to the specified configuration. More...
 
uint32_t drv_bh1745_part_id_get (uint8_t *p_part_id)
 Function for getting the BH1745 part ID. More...
 
uint32_t drv_bh1745_persistance_get (uint8_t *p_per_reg)
 Function for getting the BH1745 persistance register. More...
 
uint32_t drv_bh1745_persistance_set (uint8_t per_reg)
 Function for setting the BH1745 persistance register. More...
 
uint32_t drv_bh1745_sw_reset (void)
 Function for resetting the BH1745 registers. More...
 
uint32_t drv_bh1745_threshold_get (drv_bh1745_threshold_t *p_th)
 Function for getting the BH1745 threshold. More...
 
uint32_t drv_bh1745_threshold_set (drv_bh1745_threshold_t const *p_th)
 Function for setting the BH1745 threshold. More...
 

Detailed Description

BH1745 digital color sensor API.

Function Documentation

uint32_t drv_bh1745_close ( void  )

Function for closing the BH1745 driver.

Returns
Codes from the underlying drivers.
uint32_t drv_bh1745_data_get ( drv_bh1745_data_t p_data)

Function for getting the BH1745 data.

Parameters
[out]p_dataThe measurement results.
Returns
NRF_ERROR_INVALID_STATE The driver was not open.
NRF_ERROR_NULL A NULL pointer was supplied.
Codes from the underlying drivers.
uint32_t drv_bh1745_gain_set ( drv_bh1745_gain_t  gain)

Function for setting the BH1745 ADC gain.

Parameters
[in]gainThe desired gain value.
Returns
NRF_ERROR_INVALID_STATE The driver was not open.
Codes from the underlying drivers.
uint32_t drv_bh1745_init ( void  )

Function for initializing the BH1745 driver.

Returns
NRF_SUCCESS Only possible return value.
uint32_t drv_bh1745_int_get ( uint8_t *  p_int_reg)

Function for getting the BH1745 interrupt register.

Parameters
[out]p_int_regContents of the interrupt register.
Returns
NRF_ERROR_INVALID_STATE The driver was not open.
Codes from the underlying drivers.
uint32_t drv_bh1745_int_reset ( void  )

Function for resetting the interrupt.

Returns
NRF_ERROR_INVALID_STATE The driver was not open.
Codes from the underlying drivers.
uint32_t drv_bh1745_int_set ( uint8_t  int_reg)

Function for setting the BH1745 interrupt register.

Parameters
[in]int_regContents of the interrupt register.
Returns
NRF_ERROR_INVALID_STATE The driver was not open.
NRF_ERROR_INVALID_PARAM Invalid register content supplied.
Codes from the underlying drivers.
uint32_t drv_bh1745_manu_id_get ( uint8_t *  p_manu_id)

Function for getting the BH1745 manufacturer ID.

Parameters
[out]p_manu_idThe manufacturer ID.
Returns
NRF_ERROR_INVALID_STATE The driver was not open.
Codes from the underlying drivers.
uint32_t drv_bh1745_meas_enable ( bool  enable)

Function for enabling the BH1745 measurements.

Parameters
[in]enableTrue if measurements are to be enabled.
Returns
NRF_ERROR_INVALID_STATE The driver was not open.
Codes from the underlying drivers.
uint32_t drv_bh1745_meas_time_set ( drv_bh1745_meas_time_t  meas_time)

Function for setting the BH1745 measurement time.

Parameters
[in]meas_timeThe desired measurement time.
Returns
NRF_ERROR_INVALID_STATE The driver was not open.
Codes from the underlying drivers.
uint32_t drv_bh1745_open ( drv_bh1745_cfg_t const *const  p_cfg)

Function for opening the BH1745 driver according to the specified configuration.

Parameters
[in]p_cfgPointer to the driver configuration for the session to be opened.
Returns
Codes from the underlying drivers.
uint32_t drv_bh1745_part_id_get ( uint8_t *  p_part_id)

Function for getting the BH1745 part ID.

Parameters
[out]p_part_idPart ID.
Returns
NRF_SUCCESS If the call was successful.
NRF_ERROR_INVALID_STATE The driver was not open.
Codes from the underlying drivers.
uint32_t drv_bh1745_persistance_get ( uint8_t *  p_per_reg)

Function for getting the BH1745 persistance register.

Parameters
[out]p_per_regContents of the persistance register.
Returns
NRF_ERROR_INVALID_STATE The driver was not open.
Codes from the underlying drivers.
uint32_t drv_bh1745_persistance_set ( uint8_t  per_reg)

Function for setting the BH1745 persistance register.

Parameters
[in]per_regContents of the persistance register.
Returns
NRF_ERROR_INVALID_STATE The driver was not open.
NRF_ERROR_INVALID_PARAM Invalid register content supplied.
Codes from the underlying drivers.
uint32_t drv_bh1745_sw_reset ( void  )

Function for resetting the BH1745 registers.

Note
Will also power down the BH1745.
Returns
NRF_ERROR_INVALID_STATE The driver was not open.
Codes from the underlying drivers.
uint32_t drv_bh1745_threshold_get ( drv_bh1745_threshold_t p_th)

Function for getting the BH1745 threshold.

Parameters
[out]p_thThe threshold.
Returns
NRF_SUCCESS If the call was successful.
NRF_ERROR_INVALID_STATE The driver was not open.
Codes from the underlying drivers.
uint32_t drv_bh1745_threshold_set ( drv_bh1745_threshold_t const *  p_th)

Function for setting the BH1745 threshold.

Parameters
[in]p_thThe threshold.
Returns
NRF_SUCCESS If the call was successful.
NRF_ERROR_INVALID_STATE The driver was not open.
Codes from the underlying drivers.