48 #ifndef __DRV_BH1745_H__ 49 #define __DRV_BH1745_H__ 51 #include "nrf_drv_twi.h" 54 #define REG_SYSTEM_CONTROL 0x40 55 #define REG_MODE_CONTROL1 0x41 56 #define REG_MODE_CONTROL2 0x42 57 #define REG_MODE_CONTROL3 0x44 58 #define REG_RED_DATA_LSBs 0x50 59 #define REG_RED_DATA_MSBs 0x51 60 #define REG_GREEN_DATA_LSB 0x52 61 #define REG_GREEN_DATA_MSB 0x53 62 #define REG_BLUE_DATA_LSB 0x54 63 #define REG_BLUE_DATA_MSB 0x55 64 #define REG_CLEAR_DATA_LSB 0x56 65 #define REG_CLEAR_DATA_MSB 0x57 66 #define REG_DINT_DATA_LSB 0x58 67 #define REG_DINT_DATA_MSB 0x59 68 #define REG_INTERRUPT 0x60 69 #define REG_PERSISTENCE 0x61 70 #define REG_TH_LSB 0x62 71 #define REG_TH_MSB 0x63 72 #define REG_TL_LSB 0x64 73 #define REG_TL_MSB 0x65 74 #define REG_MANUFACTURER_ID 0x92 76 #define REG_SYSTEM_CONTROL_PART_ID_Msk 0x3F 77 #define REG_SYSTEM_CONTROL_SW_RESET_Msk 0x80 78 #define REG_SYSTEM_CONTROL_INT_RESET_Msk 0x40 80 #define REG_MODE_CONTROL1_MEAS_TIME_Msk 0x07 82 #define REG_MODE_CONTROL2_VALID_Msk 0x80 83 #define REG_MODE_CONTROL2_RGBC_EN_Msk 0x10 84 #define REG_MODE_CONTROL2_GAIN_Msk 0x03 86 #define REG_INTERRUPT_STATUS_Msk 0x80 87 #define REG_INTERRUPT_LATCH_Msk 0x10 88 #define REG_INTERRUPT_SOURCE_Msk 0x0C 89 #define REG_INTERRUPT_ENABLE_Msk 0x01 91 #define REG_PERSISTENCE_PERSISTENCE_Msk 0x03 107 DRV_BH1745_MEAS_TIME_160MS,
108 DRV_BH1745_MEAS_TIME_320MS,
109 DRV_BH1745_MEAS_TIME_640MS,
110 DRV_BH1745_MEAS_TIME_1280MS,
111 DRV_BH1745_MEAS_TIME_2560MS,
112 DRV_BH1745_MEAS_TIME_5120MS
uint32_t drv_bh1745_threshold_set(drv_bh1745_threshold_t const *p_th)
Function for setting the BH1745 threshold.
uint32_t drv_bh1745_persistance_get(uint8_t *p_per_reg)
Function for getting the BH1745 persistance register.
uint32_t drv_bh1745_part_id_get(uint8_t *p_part_id)
Function for getting the BH1745 part ID.
uint32_t drv_bh1745_int_set(uint8_t int_reg)
Function for setting the BH1745 interrupt register.
uint32_t drv_bh1745_open(drv_bh1745_cfg_t const *const p_cfg)
Function for opening the BH1745 driver according to the specified configuration.
Measurement thresholds.
Definition: drv_bh1745.h:136
uint32_t drv_bh1745_manu_id_get(uint8_t *p_manu_id)
Function for getting the BH1745 manufacturer ID.
Measurement result.
Definition: drv_bh1745.h:126
drv_bh1745_gain_t
RGBC (red, green, blue, clear) gain setting.
Definition: drv_bh1745.h:117
drv_bh1745_meas_time_t
Measurement time.
Definition: drv_bh1745.h:105
uint32_t drv_bh1745_close(void)
Function for closing the BH1745 driver.
nrf_drv_twi_config_t const * p_twi_cfg
The TWI configuration to use while the driver is enabled.
Definition: drv_bh1745.h:100
uint32_t drv_bh1745_int_reset(void)
Function for resetting the interrupt.
uint8_t twi_addr
TWI address of BH1745.
Definition: drv_bh1745.h:98
nrf_drv_twi_t const * p_twi_instance
The instance of TWI master to be used for transactions.
Definition: drv_bh1745.h:99
uint32_t drv_bh1745_threshold_get(drv_bh1745_threshold_t *p_th)
Function for getting the BH1745 threshold.
BH1745 configuration.
Definition: drv_bh1745.h:96
uint32_t drv_bh1745_meas_time_set(drv_bh1745_meas_time_t meas_time)
Function for setting the BH1745 measurement time.
uint32_t drv_bh1745_data_get(drv_bh1745_data_t *p_data)
Function for getting the BH1745 data.
uint32_t drv_bh1745_gain_set(drv_bh1745_gain_t gain)
Function for setting the BH1745 ADC gain.
uint32_t drv_bh1745_meas_enable(bool enable)
Function for enabling the BH1745 measurements.
uint32_t drv_bh1745_init(void)
Function for initializing the BH1745 driver.
uint32_t drv_bh1745_int_get(uint8_t *p_int_reg)
Function for getting the BH1745 interrupt register.
uint32_t drv_bh1745_persistance_set(uint8_t per_reg)
Function for setting the BH1745 persistance register.
uint32_t drv_bh1745_sw_reset(void)
Function for resetting the BH1745 registers.