32 #include "upm_types.h"
46 #define BH1750_DEFAULT_I2C_BUS 0
47 #define BH1750_DEFAULT_I2C_ADDR 0x23
51 #define BH1750_CMD_POWER_DOWN 0x00
52 #define BH1750_CMD_POWER_UP 0x01
54 #define BH1750_CMD_RESET 0x07
57 #define BH1750_CMD_CONT_H_RES_MODE1 0x10 // 1 lx resolution
58 #define BH1750_CMD_CONT_H_RES_MODE2 0x11 // .5 lx resolution
59 #define BH1750_CMD_CONT_L_RES_MODE 0x13 // 4 lx resolution
62 #define BH1750_CMD_ONETIME_H_RES_MODE1 0x20
63 #define BH1750_CMD_ONETIME_H_RES_MODE2 0x21
64 #define BH1750_CMD_ONETIME_L_RES_MODE 0x23
67 #define BH1750_MAX_MEAS_TIME_H 180
70 #define BH1750_MAX_MEAS_TIME_L 30
74 BH1750_OPMODE_H1_CONT,
75 BH1750_OPMODE_H2_CONT,
77 BH1750_OPMODE_H1_ONCE,
78 BH1750_OPMODE_H2_ONCE,
175 BH1750_OPMODES_T mode);
179 #endif // __cplusplus
upm_result_t bh1750_set_opmode(const bh1750_context dev, BH1750_OPMODES_T mode)
Definition: bh1750.c:222
bh1750_context bh1750_init(int bus, uint8_t addr, BH1750_OPMODES_T mode)
Definition: bh1750.c:30
upm_result_t bh1750_get_lux(const bh1750_context dev, float *lux)
Definition: bh1750.c:95
bool bh1750_power_down(const bh1750_context dev)
Definition: bh1750.c:132
upm_result_t bh1750_read_data(const bh1750_context dev, uint16_t *data)
Definition: bh1750.c:174
upm_result_t bh1750_send_command(const bh1750_context dev, uint8_t cmd)
Definition: bh1750.c:160
bool bh1750_power_up(const bh1750_context dev)
Definition: bh1750.c:118
struct _bh1750_context * bh1750_context
bool bh1750_reset(const bh1750_context dev)
Definition: bh1750.c:146
void bh1750_close(const bh1750_context dev)
Definition: bh1750.c:85