Go to the documentation of this file.
39 #ifdef PREINIT_SUPPORTED
43 #ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49 #include "drv_digital_out.h"
50 #include "drv_digital_in.h"
51 #include "drv_i2c_master.h"
73 #define ILLUMINANCE_REG_CONTROL 0x00
74 #define ILLUMINANCE_REG_TIMING 0x01
75 #define ILLUMINANCE_REG_INTERRUPT 0x02
76 #define ILLUMINANCE_REG_THL_LOW 0x03
77 #define ILLUMINANCE_REG_THL_HIGH 0x04
78 #define ILLUMINANCE_REG_THH_LOW 0x05
79 #define ILLUMINANCE_REG_THH_HIGH 0x06
80 #define ILLUMINANCE_REG_ANALOG 0x07
81 #define ILLUMINANCE_REG_ID 0x12
82 #define ILLUMINANCE_REG_DATA0_LOW 0x14
83 #define ILLUMINANCE_REG_DATA0_HIGH 0x15
84 #define ILLUMINANCE_REG_DATA1_LOW 0x16
85 #define ILLUMINANCE_REG_DATA1_HIGH 0x17
86 #define ILLUMINANCE_REG_TIMER_LOW 0x18
87 #define ILLUMINANCE_REG_TIMER_HIGH 0x19
88 #define ILLUMINANCE_REG_ID2 0x1E
106 #define ILLUMINANCE_CMD_BIT 0x80
107 #define ILLUMINANCE_TRANSACTION_REPEATED 0x00
108 #define ILLUMINANCE_TRANSACTION_AUTO_INC 0x20
109 #define ILLUMINANCE_TRANSACTION_SPEC_FUNC 0x60
110 #define ILLUMINANCE_SPEC_FUNC_INT_CLEAR 0x01
111 #define ILLUMINANCE_SPEC_FUNC_STOP_MAN_INT 0x02
112 #define ILLUMINANCE_SPEC_FUNC_START_MAN_INT 0x03
118 #define ILLUMINANCE_CONTROL_ADC_INTR 0x20
119 #define ILLUMINANCE_CONTROL_ADC_VALID 0x10
120 #define ILLUMINANCE_CONTROL_ADC_ENABLE 0x02
121 #define ILLUMINANCE_CONTROL_POWER_ON 0x01
127 #define ILLUMINANCE_ATIME_MAX 688.5
128 #define ILLUMINANCE_ATIME_MIN 2.7
129 #define ILLUMINANCE_ATIME_STEP 2.7
130 #define ILLUMINANCE_DEFAULT_ATIME 200.0
136 #define ILLUMINANCE_ENABLE_INTERRUPT 0x10
142 #define ILLUMINANCE_GAIN_1X 0x00
143 #define ILLUMINANCE_GAIN_8X 0x01
144 #define ILLUMINANCE_GAIN_16X 0x02
145 #define ILLUMINANCE_GAIN_111X 0x03
151 #define ILLUMINANCE_ID_PARTNO 0x90
152 #define ILLUMINANCE_ID2 0x30
159 #define ILLUMINANCE_SET_DEV_ADDR_GND 0x29
160 #define ILLUMINANCE_SET_DEV_ADDR_FLOAT 0x39
161 #define ILLUMINANCE_SET_DEV_ADDR_VCC 0x49
179 #define ILLUMINANCE_MAP_MIKROBUS( cfg, mikrobus ) \
180 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
181 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
182 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
407 #endif // ILLUMINANCE_H
float atime_ms
Definition: illuminance.h:202
pin_name_t sda
Definition: illuminance.h:214
err_t illuminance_default_cfg(illuminance_t *ctx)
Illuminance default configuration function.
digital_in_t int_pin
Definition: illuminance.h:194
err_t illuminance_read_register(illuminance_t *ctx, uint8_t reg, uint8_t *data_out)
Illuminance read register function.
uint8_t illuminance_get_int_pin(illuminance_t *ctx)
Illuminance get int pin function.
@ ILLUMINANCE_OK
Definition: illuminance.h:229
err_t illuminance_init(illuminance_t *ctx, illuminance_cfg_t *cfg)
Illuminance initialization function.
err_t illuminance_check_communication(illuminance_t *ctx)
Illuminance check communication function.
err_t illuminance_set_atime(illuminance_t *ctx, float atime_ms)
Illuminance set atime function.
uint8_t gain
Definition: illuminance.h:203
@ ILLUMINANCE_ERROR
Definition: illuminance.h:230
uint8_t slave_address
Definition: illuminance.h:200
err_t illuminance_generic_read(illuminance_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
Illuminance I2C reading function.
illuminance_return_value_t
Illuminance Click return value data.
Definition: illuminance.h:228
uint8_t i2c_address
Definition: illuminance.h:219
pin_name_t int_pin
Definition: illuminance.h:216
i2c_master_t i2c
Definition: illuminance.h:197
pin_name_t scl
Definition: illuminance.h:213
err_t illuminance_write_register(illuminance_t *ctx, uint8_t reg, uint8_t data_in)
Illuminance write register function.
Illuminance Click context object.
Definition: illuminance.h:192
Illuminance Click configuration object.
Definition: illuminance.h:212
err_t illuminance_set_gain(illuminance_t *ctx, uint8_t gain)
Illuminance set gain function.
err_t illuminance_read_raw_data(illuminance_t *ctx, uint16_t *ch_0, uint16_t *ch_1)
Illuminance read raw data function.
void illuminance_cfg_setup(illuminance_cfg_t *cfg)
Illuminance configuration object setup function.
uint32_t i2c_speed
Definition: illuminance.h:218
err_t illuminance_generic_write(illuminance_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
Illuminance I2C writing function.