LibDriver TSL2561
Loading...
Searching...
No Matches
tsl2561 base driver function

tsl2561 base driver modules More...

Collaboration diagram for tsl2561 base driver function:

Data Structures

struct  tsl2561_handle_s
 tsl2561 handle structure definition More...
struct  tsl2561_info_s
 tsl2561 information structure definition More...

Typedefs

typedef struct tsl2561_handle_s tsl2561_handle_t
 tsl2561 handle structure definition
typedef struct tsl2561_info_s tsl2561_info_t
 tsl2561 information structure definition

Enumerations

enum  tsl2561_address_t { TSL2561_ADDRESS_GND = 0x52 , TSL2561_ADDRESS_FLOAT = 0x72 , TSL2561_ADDRESS_VCC = 0x92 }
 tsl2561 address enumeration definition More...
enum  tsl2561_bool_t { TSL2561_BOOL_FALSE = 0x00 , TSL2561_BOOL_TRUE = 0x01 }
 tsl2561 bool enumeration definition More...
enum  tsl2561_gain_t { TSL2561_GAIN_1 = 0x00 , TSL2561_GAIN_16 = 0x01 }
 tsl2561 gain enumeration definition More...
enum  tsl2561_integration_time_t { TSL2561_INTEGRATION_TIME_13MS = 0x00 , TSL2561_INTEGRATION_TIME_101MS = 0x01 , TSL2561_INTEGRATION_TIME_402MS = 0x02 }
 tsl2561 integration time enumeration definition More...

Functions

uint8_t tsl2561_info (tsl2561_info_t *info)
 get chip's information
uint8_t tsl2561_set_addr_pin (tsl2561_handle_t *handle, tsl2561_address_t addr_pin)
 set the iic address pin
uint8_t tsl2561_get_addr_pin (tsl2561_handle_t *handle, tsl2561_address_t *addr_pin)
 get the iic address pin
uint8_t tsl2561_init (tsl2561_handle_t *handle)
 initialize the chip
uint8_t tsl2561_deinit (tsl2561_handle_t *handle)
 close the chip
uint8_t tsl2561_read (tsl2561_handle_t *handle, uint16_t *channel_0_raw, uint16_t *channel_1_raw, uint32_t *lux)
 read data from the chip
uint8_t tsl2561_power_down (tsl2561_handle_t *handle)
 power down the chip
uint8_t tsl2561_wake_up (tsl2561_handle_t *handle)
 wake up the chip
uint8_t tsl2561_set_gain (tsl2561_handle_t *handle, tsl2561_gain_t gain)
 set the adc gain
uint8_t tsl2561_get_gain (tsl2561_handle_t *handle, tsl2561_gain_t *gain)
 get the adc gain
uint8_t tsl2561_set_integration_time (tsl2561_handle_t *handle, tsl2561_integration_time_t t)
 set the integration time
uint8_t tsl2561_get_integration_time (tsl2561_handle_t *handle, tsl2561_integration_time_t *t)
 get the integration time

Detailed Description

tsl2561 base driver modules

Typedef Documentation

◆ tsl2561_handle_t

tsl2561 handle structure definition

◆ tsl2561_info_t

tsl2561 information structure definition

Enumeration Type Documentation

◆ tsl2561_address_t

tsl2561 address enumeration definition

Enumerator
TSL2561_ADDRESS_GND 

ADDR pin connected to GND

TSL2561_ADDRESS_FLOAT 

ADDR pin connected to FLOAT

TSL2561_ADDRESS_VCC 

ADDR pin connected to VCC

Definition at line 63 of file driver_tsl2561.h.

◆ tsl2561_bool_t

tsl2561 bool enumeration definition

Enumerator
TSL2561_BOOL_FALSE 

disable function

TSL2561_BOOL_TRUE 

enable function

Definition at line 73 of file driver_tsl2561.h.

◆ tsl2561_gain_t

tsl2561 gain enumeration definition

Enumerator
TSL2561_GAIN_1 

1x gain

TSL2561_GAIN_16 

16x gain

Definition at line 82 of file driver_tsl2561.h.

◆ tsl2561_integration_time_t

tsl2561 integration time enumeration definition

Enumerator
TSL2561_INTEGRATION_TIME_13MS 

13 ms integration time

TSL2561_INTEGRATION_TIME_101MS 

101 ms integration time

TSL2561_INTEGRATION_TIME_402MS 

402 ms integration time

Definition at line 91 of file driver_tsl2561.h.

Function Documentation

◆ tsl2561_deinit()

uint8_t tsl2561_deinit ( tsl2561_handle_t * handle)

close the chip

Parameters
[in]*handlepointer to a tsl2561 handle structure
Returns
status code
  • 0 success
  • 1 iic deinit failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 294 of file driver_tsl2561.c.

◆ tsl2561_get_addr_pin()

uint8_t tsl2561_get_addr_pin ( tsl2561_handle_t * handle,
tsl2561_address_t * addr_pin )

get the iic address pin

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

Definition at line 357 of file driver_tsl2561.c.

◆ tsl2561_get_gain()

uint8_t tsl2561_get_gain ( tsl2561_handle_t * handle,
tsl2561_gain_t * gain )

get the adc gain

Parameters
[in]*handlepointer to a tsl2561 handle structure
[out]*gainpointer to an adc gain buffer
Returns
status code
  • 0 success
  • 1 get gain failed
  • 2 handle is NULL
Note
none

Definition at line 477 of file driver_tsl2561.c.

◆ tsl2561_get_integration_time()

uint8_t tsl2561_get_integration_time ( tsl2561_handle_t * handle,
tsl2561_integration_time_t * t )

get the integration time

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

Definition at line 557 of file driver_tsl2561.c.

◆ tsl2561_info()

uint8_t tsl2561_info ( tsl2561_info_t * info)

get chip's information

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

Definition at line 1043 of file driver_tsl2561.c.

◆ tsl2561_init()

uint8_t tsl2561_init ( tsl2561_handle_t * handle)

initialize the chip

Parameters
[in]*handlepointer to a tsl2561 handle structure
Returns
status code
  • 0 success
  • 1 iic initialization failed
  • 2 handle is NULL
  • 3 linked functions is NULL
Note
none

Definition at line 214 of file driver_tsl2561.c.

◆ tsl2561_power_down()

uint8_t tsl2561_power_down ( tsl2561_handle_t * handle)

power down the chip

Parameters
[in]*handlepointer to a tsl2561 handle structure
Returns
status code
  • 0 success
  • 1 power down failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 901 of file driver_tsl2561.c.

◆ tsl2561_read()

uint8_t tsl2561_read ( tsl2561_handle_t * handle,
uint16_t * channel_0_raw,
uint16_t * channel_1_raw,
uint32_t * lux )

read data from the chip

Parameters
[in]*handlepointer to a tsl2561 handle structure
[out]*channel_0_rawpointer to a channel 0 raw data
[out]*channel_1_rawpointer to a channel 1 raw data
[out]*luxpointer to a converted lux
Returns
status code
  • 0 success
  • 1 read failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 382 of file driver_tsl2561.c.

◆ tsl2561_set_addr_pin()

uint8_t tsl2561_set_addr_pin ( tsl2561_handle_t * handle,
tsl2561_address_t addr_pin )

set the iic address pin

Parameters
[in]*handlepointer to a tsl2561 handle structure
[in]addr_pinchip iic address pin
Returns
status code
  • 0 success
  • 1 set addr pin failed
  • 2 handle is NULL
Note
none

Definition at line 335 of file driver_tsl2561.c.

◆ tsl2561_set_gain()

uint8_t tsl2561_set_gain ( tsl2561_handle_t * handle,
tsl2561_gain_t gain )

set the adc gain

Parameters
[in]*handlepointer to a tsl2561 handle structure
[in]gainadc gain
Returns
status code
  • 0 success
  • 1 set gain failed
  • 2 handle is NULL
Note
none

Definition at line 433 of file driver_tsl2561.c.

◆ tsl2561_set_integration_time()

uint8_t tsl2561_set_integration_time ( tsl2561_handle_t * handle,
tsl2561_integration_time_t t )

set the integration time

Parameters
[in]*handlepointer to a tsl2561 handle structure
[in]tintegration time
Returns
status code
  • 0 success
  • 1 set integration time failed
  • 2 handle is NULL
Note
none

Definition at line 513 of file driver_tsl2561.c.

◆ tsl2561_wake_up()

uint8_t tsl2561_wake_up ( tsl2561_handle_t * handle)

wake up the chip

Parameters
[in]*handlepointer to a tsl2561 handle structure
Returns
status code
  • 0 success
  • 1 wake up failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 937 of file driver_tsl2561.c.