LibDriver OPT300X
Loading...
Searching...
No Matches
opt300x base driver function

opt300x base driver modules More...

Collaboration diagram for opt300x base driver function:

Data Structures

struct  opt300x_handle_s
 opt300x handle structure definition More...
struct  opt300x_info_s
 opt300x information structure definition More...

Typedefs

typedef struct opt300x_handle_s opt300x_handle_t
 opt300x handle structure definition
typedef struct opt300x_info_s opt300x_info_t
 opt300x information structure definition

Enumerations

enum  opt300x_t {
  OPT3001 = 0x01 , OPT3002 = 0x02 , OPT3004 = 0x04 , OPT3005 = 0x05 ,
  OPT3006 = 0x06 , OPT3007 = 0x07
}
 opt300x type enumeration definition More...
enum  opt300x_address_t { OPT300X_ADDRESS_GND = 0x88 , OPT300X_ADDRESS_VCC = 0x8A , OPT300X_ADDRESS_SDA = 0x8C , OPT300X_ADDRESS_SCL = 0x8E }
 opt300x address enumeration definition More...
enum  opt300x_bool_t { OPT300X_BOOL_FALSE = 0x00 , OPT300X_BOOL_TRUE = 0x01 }
 opt300x bool enumeration definition More...
enum  opt300x_conversion_time_t { OPT300X_CONVERSION_TIME_100_MS = 0x00 , OPT300X_CONVERSION_TIME_800_MS = 0x01 }
 opt300x conversion time enumeration definition More...
enum  opt300x_interrupt_polarity_t { OPT300X_INTERRUPT_POLARITY_LOW = 0x00 , OPT300X_INTERRUPT_POLARITY_HIGH = 0x01 }
 opt300x interrupt polarity enumeration definition More...
enum  opt300x_fault_count_t { OPT300X_FAULT_COUNT_ONE = 0x00 , OPT300X_FAULT_COUNT_TWO = 0x01 , OPT300X_FAULT_COUNT_FOUR = 0x02 , OPT300X_FAULT_COUNT_EIGHT = 0x03 }
 opt300x fault count enumeration definition More...
enum  opt300x_range_t {
  OPT300X_RANGE_40P95_LUX = 0x00 , OPT300X_RANGE_81P90_LUX = 0x01 , OPT300X_RANGE_163P80_LUX = 0x02 , OPT300X_RANGE_327P60_LUX = 0x03 ,
  OPT300X_RANGE_655P20_LUX = 0x04 , OPT300X_RANGE_1310P40_LUX = 0x05 , OPT300X_RANGE_2620P80_LUX = 0x06 , OPT300X_RANGE_5241P60_LUX = 0x07 ,
  OPT300X_RANGE_10483P20_LUX = 0x08 , OPT300X_RANGE_20966P40_LUX = 0x09 , OPT300X_RANGE_41932P80_LUX = 0x0A , OPT300X_RANGE_83865P60_LUX = 0x0B ,
  OPT300X_RANGE_AUTO = 0x0C
}
 opt300x range enumeration definition More...
enum  opt3002_range_t {
  OPT3002_RANGE_4914_NW_CM2 = 0x00 , OPT3002_RANGE_9828_NW_CM2 = 0x00 , OPT3002_RANGE_19656_NW_CM2 = 0x00 , OPT3002_RANGE_39312_NW_CM2 = 0x00 ,
  OPT3002_RANGE_78624_NW_CM2 = 0x00 , OPT3002_RANGE_157248_NW_CM2 = 0x00 , OPT3002_RANGE_314496_NW_CM2 = 0x00 , OPT3002_RANGE_628992_NW_CM2 = 0x00 ,
  OPT3002_RANGE_1257984_NW_CM2 = 0x00 , OPT3002_RANGE_2515968_NW_CM2 = 0x00 , OPT3002_RANGE_5031936_NW_CM2 = 0x00 , OPT3002_RANGE_10063872_NW_CM2 = 0x00 ,
  OPT3002_RANGE_AUTO = 0x0C
}
 opt3002 range enumeration definition More...
enum  opt3005_range_t {
  OPT3005_RANGE_81P90_LUX = 0x00 , OPT3005_RANGE_163P80_LUX = 0x01 , OPT3005_RANGE_327P60_LUX = 0x02 , OPT3005_RANGE_655P20_LUX = 0x03 ,
  OPT3005_RANGE_1310P40_LUX = 0x04 , OPT3005_RANGE_2620P80_LUX = 0x05 , OPT3005_RANGE_5241P60_LUX = 0x06 , OPT3005_RANGE_10483P20_LUX = 0x07 ,
  OPT3005_RANGE_20966P40_LUX = 0x08 , OPT3005_RANGE_41932P80_LUX = 0x09 , OPT3005_RANGE_83865P60_LUX = 0x0A , OPT3005_RANGE_167731P20_LUX = 0x0B ,
  OPT3005_RANGE_AUTO = 0x0C
}
 opt3005 range enumeration definition More...
enum  opt300x_interrupt_t { OPT300X_INTERRUPT_HIGH_LIMIT = 0x00 , OPT300X_INTERRUPT_LOW_LIMIT = 0x01 }
 opt300x interrupt enumeration definition More...

Functions

uint8_t opt300x_info (opt300x_info_t *info)
 get chip's information
uint8_t opt300x_set_type (opt300x_handle_t *handle, opt300x_t type)
 set the chip type
uint8_t opt300x_get_type (opt300x_handle_t *handle, opt300x_t *type)
 get the iic chip type
uint8_t opt300x_set_addr_pin (opt300x_handle_t *handle, opt300x_address_t addr_pin)
 set the iic address pin
uint8_t opt300x_get_addr_pin (opt300x_handle_t *handle, opt300x_address_t *addr_pin)
 get the iic address pin
uint8_t opt300x_irq_handler (opt300x_handle_t *handle)
 irq handler
uint8_t opt300x_init (opt300x_handle_t *handle)
 initialize the chip
uint8_t opt300x_deinit (opt300x_handle_t *handle)
 close the chip
uint8_t opt300x_start_continuous_read (opt300x_handle_t *handle)
 start the chip reading
uint8_t opt300x_stop_continuous_read (opt300x_handle_t *handle)
 stop the chip reading
uint8_t opt300x_continuous_read (opt300x_handle_t *handle, uint16_t *raw, float *lux)
 read data from the chip continuously
uint8_t opt3002_continuous_read (opt300x_handle_t *handle, uint16_t *raw, float *nw_cm2)
 read data from the chip continuously
uint8_t opt300x_single_read (opt300x_handle_t *handle, uint16_t *raw, float *lux)
 read data from the chip
uint8_t opt3002_single_read (opt300x_handle_t *handle, uint16_t *raw, float *nw_cm2)
 read data from the chip
uint8_t opt300x_set_low_limit (opt300x_handle_t *handle, uint16_t limit)
 set low limit
uint8_t opt300x_get_low_limit (opt300x_handle_t *handle, uint16_t *limit)
 get low limit
uint8_t opt300x_set_high_limit (opt300x_handle_t *handle, uint16_t limit)
 set high limit
uint8_t opt300x_get_high_limit (opt300x_handle_t *handle, uint16_t *limit)
 get high limit
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 opt300x_limit_convert_to_data (opt300x_handle_t *handle, uint16_t reg, float *lux)
 convert the register raw data to the limit threshold
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 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_range (opt300x_handle_t *handle, opt300x_range_t range)
 set range
uint8_t opt300x_get_range (opt300x_handle_t *handle, opt300x_range_t *range)
 get range
uint8_t opt3002_set_range (opt300x_handle_t *handle, opt3002_range_t range)
 set range
uint8_t opt3002_get_range (opt300x_handle_t *handle, opt3002_range_t *range)
 get range
uint8_t opt3005_set_range (opt300x_handle_t *handle, opt3005_range_t range)
 set range
uint8_t opt3005_get_range (opt300x_handle_t *handle, opt3005_range_t *range)
 get range
uint8_t opt300x_set_conversion_time (opt300x_handle_t *handle, opt300x_conversion_time_t t)
 set conversion time
uint8_t opt300x_get_conversion_time (opt300x_handle_t *handle, opt300x_conversion_time_t *t)
 get conversion time
uint8_t opt300x_set_interrupt_latch (opt300x_handle_t *handle, opt300x_bool_t enable)
 enable or disable interrupt latch
uint8_t opt300x_get_interrupt_latch (opt300x_handle_t *handle, opt300x_bool_t *enable)
 get interrupt latch status
uint8_t opt300x_set_interrupt_pin_polarity (opt300x_handle_t *handle, opt300x_interrupt_polarity_t polarity)
 set interrupt pin polarity
uint8_t opt300x_get_interrupt_pin_polarity (opt300x_handle_t *handle, opt300x_interrupt_polarity_t *polarity)
 get interrupt pin polarity
uint8_t opt300x_set_mask_exponent (opt300x_handle_t *handle, opt300x_bool_t enable)
 enable or disable mask exponent
uint8_t opt300x_get_mask_exponent (opt300x_handle_t *handle, opt300x_bool_t *enable)
 get mask exponent status
uint8_t opt300x_set_fault_count (opt300x_handle_t *handle, opt300x_fault_count_t count)
 set fault count
uint8_t opt300x_get_fault_count (opt300x_handle_t *handle, opt300x_fault_count_t *count)
 get fault count

Detailed Description

opt300x base driver modules

Typedef Documentation

◆ opt300x_handle_t

opt300x handle structure definition

◆ opt300x_info_t

opt300x information structure definition

Enumeration Type Documentation

◆ opt3002_range_t

opt3002 range enumeration definition

Enumerator
OPT3002_RANGE_4914_NW_CM2 

4914 nW/cm2

OPT3002_RANGE_9828_NW_CM2 

9828 nW/cm2

OPT3002_RANGE_19656_NW_CM2 

19656 nW/cm2

OPT3002_RANGE_39312_NW_CM2 

39312 nW/cm2

OPT3002_RANGE_78624_NW_CM2 

78624 nW/cm2

OPT3002_RANGE_157248_NW_CM2 

157248 nW/cm2

OPT3002_RANGE_314496_NW_CM2 

314496 nW/cm2

OPT3002_RANGE_628992_NW_CM2 

628992 nW/cm2

OPT3002_RANGE_1257984_NW_CM2 

1257984 nW/cm2

OPT3002_RANGE_2515968_NW_CM2 

2515968 nW/cm2

OPT3002_RANGE_5031936_NW_CM2 

5031936 nW/cm2

OPT3002_RANGE_10063872_NW_CM2 

10063872 nW/cm2

OPT3002_RANGE_AUTO 

auto range nW/cm2

Definition at line 144 of file driver_opt300x.h.

◆ opt3005_range_t

opt3005 range enumeration definition

Enumerator
OPT3005_RANGE_81P90_LUX 

81.90 lux

OPT3005_RANGE_163P80_LUX 

163.80 lux

OPT3005_RANGE_327P60_LUX 

327.60 lux

OPT3005_RANGE_655P20_LUX 

655.20 lux

OPT3005_RANGE_1310P40_LUX 

1310.40 lux

OPT3005_RANGE_2620P80_LUX 

2620.80 lux

OPT3005_RANGE_5241P60_LUX 

5241.60 lux

OPT3005_RANGE_10483P20_LUX 

10483.20 lux

OPT3005_RANGE_20966P40_LUX 

20966.40 lux

OPT3005_RANGE_41932P80_LUX 

41932.80 lux

OPT3005_RANGE_83865P60_LUX 

83865.60 lux

OPT3005_RANGE_167731P20_LUX 

167731.20 lux

OPT3005_RANGE_AUTO 

auto range lux

Definition at line 164 of file driver_opt300x.h.

◆ opt300x_address_t

opt300x address enumeration definition

Enumerator
OPT300X_ADDRESS_GND 

ADDR pin connected to GND

OPT300X_ADDRESS_VCC 

ADDR pin connected to VCC

OPT300X_ADDRESS_SDA 

ADDR pin connected to SDA

OPT300X_ADDRESS_SCL 

ADDR pin connected to SCL

Definition at line 75 of file driver_opt300x.h.

◆ opt300x_bool_t

opt300x bool enumeration definition

Enumerator
OPT300X_BOOL_FALSE 

disable

OPT300X_BOOL_TRUE 

enable

Definition at line 86 of file driver_opt300x.h.

◆ opt300x_conversion_time_t

opt300x conversion time enumeration definition

Enumerator
OPT300X_CONVERSION_TIME_100_MS 

100ms

OPT300X_CONVERSION_TIME_800_MS 

800ms

Definition at line 95 of file driver_opt300x.h.

◆ opt300x_fault_count_t

opt300x fault count enumeration definition

Enumerator
OPT300X_FAULT_COUNT_ONE 

one fault count

OPT300X_FAULT_COUNT_TWO 

two fault counts

OPT300X_FAULT_COUNT_FOUR 

four fault counts

OPT300X_FAULT_COUNT_EIGHT 

eight fault counts

Definition at line 113 of file driver_opt300x.h.

◆ opt300x_interrupt_polarity_t

opt300x interrupt polarity enumeration definition

Enumerator
OPT300X_INTERRUPT_POLARITY_LOW 

polarity low

OPT300X_INTERRUPT_POLARITY_HIGH 

polarity high

Definition at line 104 of file driver_opt300x.h.

◆ opt300x_interrupt_t

opt300x interrupt enumeration definition

Enumerator
OPT300X_INTERRUPT_HIGH_LIMIT 

high limit

OPT300X_INTERRUPT_LOW_LIMIT 

low limit

Definition at line 184 of file driver_opt300x.h.

◆ opt300x_range_t

opt300x range enumeration definition

Enumerator
OPT300X_RANGE_40P95_LUX 

40.95 lux

OPT300X_RANGE_81P90_LUX 

81.90 lux

OPT300X_RANGE_163P80_LUX 

163.80 lux

OPT300X_RANGE_327P60_LUX 

327.60 lux

OPT300X_RANGE_655P20_LUX 

655.20 lux

OPT300X_RANGE_1310P40_LUX 

1310.40 lux

OPT300X_RANGE_2620P80_LUX 

2620.80 lux

OPT300X_RANGE_5241P60_LUX 

5241.60 lux

OPT300X_RANGE_10483P20_LUX 

10483.20 lux

OPT300X_RANGE_20966P40_LUX 

20966.40 lux

OPT300X_RANGE_41932P80_LUX 

41932.80 lux

OPT300X_RANGE_83865P60_LUX 

83865.60 lux

OPT300X_RANGE_AUTO 

auto range lux

Definition at line 124 of file driver_opt300x.h.

◆ opt300x_t

enum opt300x_t

opt300x type enumeration definition

Enumerator
OPT3001 

opt3001

OPT3002 

opt3002

OPT3004 

opt3004

OPT3005 

opt3005

OPT3006 

opt3006

OPT3007 

opt3007

Definition at line 62 of file driver_opt300x.h.

Function Documentation

◆ opt3002_continuous_read()

uint8_t opt3002_continuous_read ( opt300x_handle_t * handle,
uint16_t * raw,
float * nw_cm2 )

read data from the chip continuously

Parameters
[in]*handlepointer to an opt300x handle structure
[out]*rawpointer to a raw data buffer
[out]*nw_cm2pointer to a converted data buffer
Returns
status code
  • 0 success
  • 1 read failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 data is overflow
  • 5 only opt3002 can use this function
Note
none

Definition at line 519 of file driver_opt300x.c.

◆ opt3002_get_range()

uint8_t opt3002_get_range ( opt300x_handle_t * handle,
opt3002_range_t * range )

get range

Parameters
[in]*handlepointer to an opt300x handle structure
[out]*rangepointer to a range buffer
Returns
status code
  • 0 success
  • 1 get range failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 only opt3002 can use this function
Note
none

Definition at line 1286 of file driver_opt300x.c.

◆ opt3002_limit_convert_to_data()

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

Parameters
[in]*handlepointer to an opt300x handle structure
[in]regregister raw data
[out]*nw_cm2pointer to a converted data buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 only opt3002 can use this function
Note
none

Definition at line 1087 of file driver_opt300x.c.

◆ opt3002_limit_convert_to_register()

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

Parameters
[in]*handlepointer to an opt300x handle structure
[in]nw_cm2input data
[out]*regpointer to a register raw buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 only opt3002 can use this function
Note
none

Definition at line 1032 of file driver_opt300x.c.

◆ opt3002_set_range()

uint8_t opt3002_set_range ( opt300x_handle_t * handle,
opt3002_range_t range )

set range

Parameters
[in]*handlepointer to an opt300x handle structure
[in]rangeset range
Returns
status code
  • 0 success
  • 1 set range failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 only opt3002 can use this function
Note
none

Definition at line 1234 of file driver_opt300x.c.

◆ opt3002_single_read()

uint8_t opt3002_single_read ( opt300x_handle_t * handle,
uint16_t * raw,
float * nw_cm2 )

read data from the chip

Parameters
[in]*handlepointer to an opt300x handle structure
[out]*rawpointer to a raw data buffer
[out]*nw_cm2pointer to a converted data buffer
Returns
status code
  • 0 success
  • 1 read failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 data is overflow
  • 5 read timeout
  • 6 only opt3002 can use this function
Note
none

Definition at line 689 of file driver_opt300x.c.

◆ opt3005_get_range()

uint8_t opt3005_get_range ( opt300x_handle_t * handle,
opt3005_range_t * range )

get range

Parameters
[in]*handlepointer to an opt300x handle structure
[out]*rangepointer to a range buffer
Returns
status code
  • 0 success
  • 1 get range failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 only opt3005 can use this function
Note
none

Definition at line 1382 of file driver_opt300x.c.

◆ opt3005_set_range()

uint8_t opt3005_set_range ( opt300x_handle_t * handle,
opt3005_range_t range )

set range

Parameters
[in]*handlepointer to an opt300x handle structure
[in]rangeset range
Returns
status code
  • 0 success
  • 1 set range failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 only opt3005 can use this function
Note
none

Definition at line 1330 of file driver_opt300x.c.

◆ opt300x_continuous_read()

uint8_t opt300x_continuous_read ( opt300x_handle_t * handle,
uint16_t * raw,
float * lux )

read data from the chip continuously

Parameters
[in]*handlepointer to an opt300x handle structure
[out]*rawpointer to a raw data buffer
[out]*luxpointer to a converted lux buffer
Returns
status code
  • 0 success
  • 1 read failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 data is overflow
  • 5 opt3002 can't use this function
Note
none

Definition at line 448 of file driver_opt300x.c.

◆ opt300x_deinit()

uint8_t opt300x_deinit ( opt300x_handle_t * handle)

close the chip

Parameters
[in]*handlepointer to an opt300x handle structure
Returns
status code
  • 0 success
  • 1 iic deinit failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 power down failed
Note
none

Definition at line 307 of file driver_opt300x.c.

◆ opt300x_get_addr_pin()

uint8_t opt300x_get_addr_pin ( opt300x_handle_t * handle,
opt300x_address_t * addr_pin )

get the iic address pin

Parameters
[in]*handlepointer to an opt300x handle structure
[out]*addr_pinpointer to a chip iic address pin buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 182 of file driver_opt300x.c.

◆ opt300x_get_conversion_time()

uint8_t opt300x_get_conversion_time ( opt300x_handle_t * handle,
opt300x_conversion_time_t * t )

get conversion time

Parameters
[in]*handlepointer to an opt300x handle structure
[out]*tpointer to a conversion time buffer
Returns
status code
  • 0 success
  • 1 get conversion time failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1470 of file driver_opt300x.c.

◆ opt300x_get_fault_count()

uint8_t opt300x_get_fault_count ( opt300x_handle_t * handle,
opt300x_fault_count_t * count )

get fault count

Parameters
[in]*handlepointer to an opt300x handle structure
[out]*countpointer to a fault count buffer
Returns
status code
  • 0 success
  • 1 get fault count failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1798 of file driver_opt300x.c.

◆ opt300x_get_high_limit()

uint8_t opt300x_get_high_limit ( opt300x_handle_t * handle,
uint16_t * limit )

get high limit

Parameters
[in]*handlepointer to an opt300x handle structure
[out]*limitpointer to a high limit buffer
Returns
status code
  • 0 success
  • 1 get high limit failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 888 of file driver_opt300x.c.

◆ opt300x_get_interrupt_latch()

uint8_t opt300x_get_interrupt_latch ( opt300x_handle_t * handle,
opt300x_bool_t * enable )

get interrupt latch status

Parameters
[in]*handlepointer to an opt300x handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get interrupt latch failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1552 of file driver_opt300x.c.

◆ opt300x_get_interrupt_pin_polarity()

uint8_t opt300x_get_interrupt_pin_polarity ( opt300x_handle_t * handle,
opt300x_interrupt_polarity_t * polarity )

get interrupt pin polarity

Parameters
[in]*handlepointer to an opt300x handle structure
[out]*polaritypointer to an interrupt polarity buffer
Returns
status code
  • 0 success
  • 1 get interrupt pin latch failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1634 of file driver_opt300x.c.

◆ opt300x_get_low_limit()

uint8_t opt300x_get_low_limit ( opt300x_handle_t * handle,
uint16_t * limit )

get low limit

Parameters
[in]*handlepointer to an opt300x handle structure
[out]*limitpointer to a low limit buffer
Returns
status code
  • 0 success
  • 1 get low limit failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 818 of file driver_opt300x.c.

◆ opt300x_get_mask_exponent()

uint8_t opt300x_get_mask_exponent ( opt300x_handle_t * handle,
opt300x_bool_t * enable )

get mask exponent status

Parameters
[in]*handlepointer to an opt300x handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get mask exponent failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1716 of file driver_opt300x.c.

◆ opt300x_get_range()

uint8_t opt300x_get_range ( opt300x_handle_t * handle,
opt300x_range_t * range )

get range

Parameters
[in]*handlepointer to an opt300x handle structure
[out]*rangepointer to a range buffer
Returns
status code
  • 0 success
  • 1 get range failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 type is invalid
Note
none

Definition at line 1184 of file driver_opt300x.c.

◆ opt300x_get_type()

uint8_t opt300x_get_type ( opt300x_handle_t * handle,
opt300x_t * type )

get the iic chip type

Parameters
[in]*handlepointer to an opt300x handle structure
[out]*typepointer to a chip type buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 140 of file driver_opt300x.c.

◆ opt300x_info()

uint8_t opt300x_info ( opt300x_info_t * info)

get chip's information

Parameters
[out]*infopointer to an opt300x info structure
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 1948 of file driver_opt300x.c.

◆ opt300x_init()

uint8_t opt300x_init ( opt300x_handle_t * handle)

initialize the chip

Parameters
[in]*handlepointer to an opt300x handle structure
Returns
status code
  • 0 success
  • 1 iic initialization failed
  • 2 handle is NULL
  • 3 linked functions is NULL
  • 4 id is invalid
Note
none

Definition at line 205 of file driver_opt300x.c.

◆ opt300x_irq_handler()

uint8_t opt300x_irq_handler ( opt300x_handle_t * handle)

irq handler

Parameters
[in]*handlepointer to an opt300x handle structure
Returns
status code
  • 0 success
  • 1 run failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1834 of file driver_opt300x.c.

◆ opt300x_limit_convert_to_data()

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

Parameters
[in]*handlepointer to an opt300x handle structure
[in]regregister raw data
[out]*luxpointer to a lux buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 opt3002 can't use this function
Note
none

Definition at line 986 of file driver_opt300x.c.

◆ opt300x_limit_convert_to_register()

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

Parameters
[in]*handlepointer to an opt300x handle structure
[in]luxinput lux
[out]*regpointer to a register raw buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 opt3002 can't use this function
Note
none

Definition at line 924 of file driver_opt300x.c.

◆ opt300x_set_addr_pin()

uint8_t opt300x_set_addr_pin ( opt300x_handle_t * handle,
opt300x_address_t addr_pin )

set the iic address pin

Parameters
[in]*handlepointer to an opt300x handle structure
[in]addr_pinchip iic address pin
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 161 of file driver_opt300x.c.

◆ opt300x_set_conversion_time()

uint8_t opt300x_set_conversion_time ( opt300x_handle_t * handle,
opt300x_conversion_time_t t )

set conversion time

Parameters
[in]*handlepointer to an opt300x handle structure
[in]tconversion time
Returns
status code
  • 0 success
  • 1 set conversion time failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1425 of file driver_opt300x.c.

◆ opt300x_set_fault_count()

uint8_t opt300x_set_fault_count ( opt300x_handle_t * handle,
opt300x_fault_count_t count )

set fault count

Parameters
[in]*handlepointer to an opt300x handle structure
[in]countfault count
Returns
status code
  • 0 success
  • 1 set fault count failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1753 of file driver_opt300x.c.

◆ opt300x_set_high_limit()

uint8_t opt300x_set_high_limit ( opt300x_handle_t * handle,
uint16_t limit )

set high limit

Parameters
[in]*handlepointer to an opt300x handle structure
[in]limithigh limit
Returns
status code
  • 0 success
  • 1 set high limit failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 853 of file driver_opt300x.c.

◆ opt300x_set_interrupt_latch()

uint8_t opt300x_set_interrupt_latch ( opt300x_handle_t * handle,
opt300x_bool_t enable )

enable or disable interrupt latch

Parameters
[in]*handlepointer to an opt300x handle structure
[in]enablebool value
Returns
status code
  • 0 success
  • 1 set interrupt latch failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1507 of file driver_opt300x.c.

◆ opt300x_set_interrupt_pin_polarity()

uint8_t opt300x_set_interrupt_pin_polarity ( opt300x_handle_t * handle,
opt300x_interrupt_polarity_t polarity )

set interrupt pin polarity

Parameters
[in]*handlepointer to an opt300x handle structure
[in]polarityinterrupt polarity
Returns
status code
  • 0 success
  • 1 set interrupt pin polarity failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1589 of file driver_opt300x.c.

◆ opt300x_set_low_limit()

uint8_t opt300x_set_low_limit ( opt300x_handle_t * handle,
uint16_t limit )

set low limit

Parameters
[in]*handlepointer to an opt300x handle structure
[in]limitlow limit
Returns
status code
  • 0 success
  • 1 set low limit failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 783 of file driver_opt300x.c.

◆ opt300x_set_mask_exponent()

uint8_t opt300x_set_mask_exponent ( opt300x_handle_t * handle,
opt300x_bool_t enable )

enable or disable mask exponent

Parameters
[in]*handlepointer to an opt300x handle structure
[in]enablebool value
Returns
status code
  • 0 success
  • 1 set mask exponent failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1671 of file driver_opt300x.c.

◆ opt300x_set_range()

uint8_t opt300x_set_range ( opt300x_handle_t * handle,
opt300x_range_t range )

set range

Parameters
[in]*handlepointer to an opt300x handle structure
[in]rangeset range
Returns
status code
  • 0 success
  • 1 set range failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 type is invalid
Note
none

Definition at line 1126 of file driver_opt300x.c.

◆ opt300x_set_type()

uint8_t opt300x_set_type ( opt300x_handle_t * handle,
opt300x_t type )

set the chip type

Parameters
[in]*handlepointer to an opt300x handle structure
[in]typechip type
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 119 of file driver_opt300x.c.

◆ opt300x_single_read()

uint8_t opt300x_single_read ( opt300x_handle_t * handle,
uint16_t * raw,
float * lux )

read data from the chip

Parameters
[in]*handlepointer to an opt300x handle structure
[out]*rawpointer to a raw data buffer
[out]*luxpointer to a converted lux buffer
Returns
status code
  • 0 success
  • 1 read failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 data is overflow
  • 5 read timeout
  • 6 opt3002 can't use this function
Note
none

Definition at line 584 of file driver_opt300x.c.

◆ opt300x_start_continuous_read()

uint8_t opt300x_start_continuous_read ( opt300x_handle_t * handle)

start the chip reading

Parameters
[in]*handlepointer to an opt300x handle structure
Returns
status code
  • 0 success
  • 1 start continuous read failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 357 of file driver_opt300x.c.

◆ opt300x_stop_continuous_read()

uint8_t opt300x_stop_continuous_read ( opt300x_handle_t * handle)

stop the chip reading

Parameters
[in]*handlepointer to an opt300x handle structure
Returns
status code
  • 0 success
  • 1 stop continuous read failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 401 of file driver_opt300x.c.