324 limit = rand() % 0xFFFFU;
348 limit = rand() % 0xFFFFU;
1424 nw_cm2 = (float)(rand() % 10000) / 10.0f;
1449 lux = (float)(rand() % 10000) / 10.0f;
driver opt300x register test header file
uint8_t opt300x_get_range(opt300x_handle_t *handle, opt300x_range_t *range)
get range
uint8_t opt300x_set_fault_count(opt300x_handle_t *handle, opt300x_fault_count_t count)
set fault count
uint8_t opt300x_info(opt300x_info_t *info)
get chip's information
uint8_t opt300x_get_low_limit(opt300x_handle_t *handle, uint16_t *limit)
get low limit
uint8_t opt300x_get_high_limit(opt300x_handle_t *handle, uint16_t *limit)
get high limit
uint8_t opt3005_set_range(opt300x_handle_t *handle, opt3005_range_t range)
set range
uint8_t opt300x_set_type(opt300x_handle_t *handle, opt300x_t type)
set the chip type
uint8_t opt300x_set_mask_exponent(opt300x_handle_t *handle, opt300x_bool_t enable)
enable or disable mask exponent
opt300x_address_t
opt300x address enumeration definition
uint8_t opt300x_set_high_limit(opt300x_handle_t *handle, uint16_t limit)
set high limit
opt300x_bool_t
opt300x bool enumeration definition
uint8_t opt300x_get_interrupt_pin_polarity(opt300x_handle_t *handle, opt300x_interrupt_polarity_t *polarity)
get interrupt pin polarity
opt3005_range_t
opt3005 range enumeration definition
uint8_t opt300x_get_conversion_time(opt300x_handle_t *handle, opt300x_conversion_time_t *t)
get conversion time
opt300x_range_t
opt300x range enumeration definition
uint8_t opt300x_set_low_limit(opt300x_handle_t *handle, uint16_t limit)
set low limit
struct opt300x_info_s opt300x_info_t
opt300x information structure definition
uint8_t opt300x_limit_convert_to_register(opt300x_handle_t *handle, float lux, uint16_t *reg)
convert the limit threshold to the register raw data
uint8_t opt3005_get_range(opt300x_handle_t *handle, opt3005_range_t *range)
get range
opt300x_t
opt300x type enumeration definition
uint8_t opt3002_get_range(opt300x_handle_t *handle, opt3002_range_t *range)
get range
uint8_t opt300x_set_interrupt_pin_polarity(opt300x_handle_t *handle, opt300x_interrupt_polarity_t polarity)
set interrupt pin polarity
uint8_t opt300x_get_type(opt300x_handle_t *handle, opt300x_t *type)
get the iic chip type
uint8_t opt3002_limit_convert_to_register(opt300x_handle_t *handle, float nw_cm2, uint16_t *reg)
convert the limit threshold to the register raw data
uint8_t opt300x_set_conversion_time(opt300x_handle_t *handle, opt300x_conversion_time_t t)
set conversion time
uint8_t opt300x_get_addr_pin(opt300x_handle_t *handle, opt300x_address_t *addr_pin)
get the iic address pin
uint8_t opt300x_get_interrupt_latch(opt300x_handle_t *handle, opt300x_bool_t *enable)
get interrupt latch status
uint8_t opt3002_limit_convert_to_data(opt300x_handle_t *handle, uint16_t reg, float *nw_cm2)
convert the register raw data to the limit threshold
uint8_t opt300x_set_interrupt_latch(opt300x_handle_t *handle, opt300x_bool_t enable)
enable or disable interrupt latch
uint8_t opt300x_set_range(opt300x_handle_t *handle, opt300x_range_t range)
set range
uint8_t opt300x_deinit(opt300x_handle_t *handle)
close the chip
opt300x_conversion_time_t
opt300x conversion time enumeration definition
uint8_t opt300x_get_fault_count(opt300x_handle_t *handle, opt300x_fault_count_t *count)
get fault count
uint8_t opt300x_limit_convert_to_data(opt300x_handle_t *handle, uint16_t reg, float *lux)
convert the register raw data to the limit threshold
opt3002_range_t
opt3002 range enumeration definition
uint8_t opt300x_set_addr_pin(opt300x_handle_t *handle, opt300x_address_t addr_pin)
set the iic address pin
uint8_t opt300x_init(opt300x_handle_t *handle)
initialize the chip
opt300x_interrupt_polarity_t
opt300x interrupt polarity enumeration definition
uint8_t opt3002_set_range(opt300x_handle_t *handle, opt3002_range_t range)
set range
opt300x_fault_count_t
opt300x fault count enumeration definition
struct opt300x_handle_s opt300x_handle_t
opt300x handle structure definition
uint8_t opt300x_get_mask_exponent(opt300x_handle_t *handle, opt300x_bool_t *enable)
get mask exponent status
@ OPT3005_RANGE_5241P60_LUX
@ OPT3005_RANGE_167731P20_LUX
@ OPT3005_RANGE_2620P80_LUX
@ OPT3005_RANGE_81P90_LUX
@ OPT3005_RANGE_655P20_LUX
@ OPT3005_RANGE_41932P80_LUX
@ OPT3005_RANGE_327P60_LUX
@ OPT3005_RANGE_20966P40_LUX
@ OPT3005_RANGE_163P80_LUX
@ OPT3005_RANGE_83865P60_LUX
@ OPT3005_RANGE_10483P20_LUX
@ OPT3005_RANGE_1310P40_LUX
@ OPT300X_RANGE_1310P40_LUX
@ OPT300X_RANGE_10483P20_LUX
@ OPT300X_RANGE_83865P60_LUX
@ OPT300X_RANGE_5241P60_LUX
@ OPT300X_RANGE_81P90_LUX
@ OPT300X_RANGE_40P95_LUX
@ OPT300X_RANGE_20966P40_LUX
@ OPT300X_RANGE_41932P80_LUX
@ OPT300X_RANGE_163P80_LUX
@ OPT300X_RANGE_327P60_LUX
@ OPT300X_RANGE_655P20_LUX
@ OPT300X_RANGE_2620P80_LUX
@ OPT300X_CONVERSION_TIME_800_MS
@ OPT300X_CONVERSION_TIME_100_MS
@ OPT3002_RANGE_19656_NW_CM2
@ OPT3002_RANGE_9828_NW_CM2
@ OPT3002_RANGE_78624_NW_CM2
@ OPT3002_RANGE_39312_NW_CM2
@ OPT3002_RANGE_1257984_NW_CM2
@ OPT3002_RANGE_157248_NW_CM2
@ OPT3002_RANGE_10063872_NW_CM2
@ OPT3002_RANGE_2515968_NW_CM2
@ OPT3002_RANGE_314496_NW_CM2
@ OPT3002_RANGE_4914_NW_CM2
@ OPT3002_RANGE_5031936_NW_CM2
@ OPT3002_RANGE_628992_NW_CM2
@ OPT300X_INTERRUPT_POLARITY_LOW
@ OPT300X_INTERRUPT_POLARITY_HIGH
@ OPT300X_FAULT_COUNT_EIGHT
@ OPT300X_FAULT_COUNT_ONE
@ OPT300X_FAULT_COUNT_TWO
@ OPT300X_FAULT_COUNT_FOUR
void opt300x_interface_delay_ms(uint32_t ms)
interface delay ms
void opt300x_interface_receive_callback(uint8_t type)
interface receive callback
void opt300x_interface_debug_print(const char *const fmt,...)
interface print format data
uint8_t opt300x_interface_iic_read(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
interface iic bus read
uint8_t opt300x_interface_iic_init(void)
interface iic bus init
uint8_t opt300x_interface_iic_write(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
interface iic bus write
uint8_t opt300x_interface_iic_deinit(void)
interface iic bus deinit
#define DRIVER_OPT300X_LINK_IIC_READ(HANDLE, FUC)
link iic_read function
#define DRIVER_OPT300X_LINK_INIT(HANDLE, STRUCTURE)
initialize opt300x_handle_t structure
#define DRIVER_OPT300X_LINK_IIC_WRITE(HANDLE, FUC)
link iic_write function
#define DRIVER_OPT300X_LINK_RECEIVE_CALLBACK(HANDLE, FUC)
link receive_callback function
#define DRIVER_OPT300X_LINK_DELAY_MS(HANDLE, FUC)
link delay_ms function
#define DRIVER_OPT300X_LINK_DEBUG_PRINT(HANDLE, FUC)
link debug_print function
#define DRIVER_OPT300X_LINK_IIC_INIT(HANDLE, FUC)
link iic_init function
#define DRIVER_OPT300X_LINK_IIC_DEINIT(HANDLE, FUC)
link iic_deinit function
uint8_t opt300x_register_test(opt300x_t type, opt300x_address_t addr)
register test
float supply_voltage_max_v
char manufacturer_name[32]
float supply_voltage_min_v