LibDriver MAX44009
Loading...
Searching...
No Matches
max44009 basic driver function

max44009 basic driver modules More...

Collaboration diagram for max44009 basic driver function:

Data Structures

struct  max44009_handle_s
 max44009 handle structure definition More...
struct  max44009_info_s
 max44009 information structure definition More...

Typedefs

typedef struct max44009_handle_s max44009_handle_t
 max44009 handle structure definition
typedef struct max44009_info_s max44009_info_t
 max44009 information structure definition

Enumerations

enum  max44009_address_t { MAX44009_ADDRESS_0 = 0x94 , MAX44009_ADDRESS_1 = 0x96 }
 max44009 address enumeration definition More...
enum  max44009_bool_t { MAX44009_BOOL_FALSE = 0x00 , MAX44009_BOOL_TRUE = 0x01 }
 max44009 bool enumeration definition More...
enum  max44009_integration_time_t {
  MAX44009_INTEGRATION_TIME_800MS = 0x00 , MAX44009_INTEGRATION_TIME_400MS = 0x01 , MAX44009_INTEGRATION_TIME_200MS = 0x02 , MAX44009_INTEGRATION_TIME_100MS = 0x03 ,
  MAX44009_INTEGRATION_TIME_50MS = 0x04 , MAX44009_INTEGRATION_TIME_25MS = 0x05 , MAX44009_INTEGRATION_TIME_12P5MS = 0x06 , MAX44009_INTEGRATION_TIME_6P25MS = 0x07
}
 max44009 integration time enumeration definition More...

Functions

uint8_t max44009_info (max44009_info_t *info)
 get chip's information
uint8_t max44009_set_addr_pin (max44009_handle_t *handle, max44009_address_t addr_pin)
 set the address pin
uint8_t max44009_get_addr_pin (max44009_handle_t *handle, max44009_address_t *addr_pin)
 get the address pin
uint8_t max44009_init (max44009_handle_t *handle)
 initialize the chip
uint8_t max44009_deinit (max44009_handle_t *handle)
 close the chip
uint8_t max44009_read (max44009_handle_t *handle, uint16_t *raw, float *lux)
 read data
uint8_t max44009_get_interrupt_status (max44009_handle_t *handle, max44009_bool_t *enable)
 get interrupt status
uint8_t max44009_set_interrupt (max44009_handle_t *handle, max44009_bool_t enable)
 enable or disable interrupt
uint8_t max44009_get_interrupt (max44009_handle_t *handle, max44009_bool_t *enable)
 get interrupt status
uint8_t max44009_set_continuous_mode (max44009_handle_t *handle, max44009_bool_t enable)
 enable or disable continuous mode
uint8_t max44009_get_continuous_mode (max44009_handle_t *handle, max44009_bool_t *enable)
 get continuous mode stauts
uint8_t max44009_set_auto_range (max44009_handle_t *handle, max44009_bool_t enable)
 enable or disable auto range
uint8_t max44009_get_auto_range (max44009_handle_t *handle, max44009_bool_t *enable)
 get auto range
uint8_t max44009_set_current_div_8 (max44009_handle_t *handle, max44009_bool_t enable)
 enable or disable current div 8
uint8_t max44009_get_current_div_8 (max44009_handle_t *handle, max44009_bool_t *enable)
 get current div 8
uint8_t max44009_set_integration_time (max44009_handle_t *handle, max44009_integration_time_t t)
 set integration time
uint8_t max44009_get_integration_time (max44009_handle_t *handle, max44009_integration_time_t *t)
 get integration time
uint8_t max44009_set_interrupt_high_threshold (max44009_handle_t *handle, uint8_t threshold)
 set interrupt high threshold
uint8_t max44009_get_interrupt_high_threshold (max44009_handle_t *handle, uint8_t *threshold)
 get interrupt high threshold
uint8_t max44009_set_interrupt_low_threshold (max44009_handle_t *handle, uint8_t threshold)
 set interrupt low threshold
uint8_t max44009_get_interrupt_low_threshold (max44009_handle_t *handle, uint8_t *threshold)
 get interrupt low threshold
uint8_t max44009_set_threshold_timer (max44009_handle_t *handle, uint8_t t)
 set threshold timer
uint8_t max44009_get_threshold_timer (max44009_handle_t *handle, uint8_t *t)
 get threshold timer
uint8_t max44009_threshold_convert_to_register (max44009_handle_t *handle, float lux, uint8_t *reg)
 convert the threshold to the register raw data
uint8_t max44009_threshold_convert_to_data (max44009_handle_t *handle, uint8_t reg, float *lux)
 convert the register raw data to the threshold
uint8_t max44009_timer_convert_to_register (max44009_handle_t *handle, float ms, uint8_t *reg)
 convert the timer to the register raw data
uint8_t max44009_timer_convert_to_data (max44009_handle_t *handle, uint8_t reg, float *ms)
 convert the register raw data to timer

Detailed Description

max44009 basic driver modules

Typedef Documentation

◆ max44009_handle_t

max44009 handle structure definition

◆ max44009_info_t

max44009 information structure definition

Enumeration Type Documentation

◆ max44009_address_t

max44009 address enumeration definition

Enumerator
MAX44009_ADDRESS_0 

addr low

MAX44009_ADDRESS_1 

addr high

Definition at line 62 of file driver_max44009.h.

◆ max44009_bool_t

max44009 bool enumeration definition

Enumerator
MAX44009_BOOL_FALSE 

false

MAX44009_BOOL_TRUE 

true

Definition at line 71 of file driver_max44009.h.

◆ max44009_integration_time_t

max44009 integration time enumeration definition

Enumerator
MAX44009_INTEGRATION_TIME_800MS 

800ms, this is a preferred mode for boosting low-light sensitivity

MAX44009_INTEGRATION_TIME_400MS 

400ms

MAX44009_INTEGRATION_TIME_200MS 

200ms

MAX44009_INTEGRATION_TIME_100MS 

100ms, this is a preferred mode for high-brightness applications

MAX44009_INTEGRATION_TIME_50MS 

50ms, manual mode only

MAX44009_INTEGRATION_TIME_25MS 

25ms, manual mode only

MAX44009_INTEGRATION_TIME_12P5MS 

12.5ms, manual mode only

MAX44009_INTEGRATION_TIME_6P25MS 

6.25ms, manual mode only

Definition at line 80 of file driver_max44009.h.

Function Documentation

◆ max44009_deinit()

uint8_t max44009_deinit ( max44009_handle_t * handle)

close the chip

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

Definition at line 1026 of file driver_max44009.c.

◆ max44009_get_addr_pin()

uint8_t max44009_get_addr_pin ( max44009_handle_t * handle,
max44009_address_t * addr_pin )

get the address pin

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

Definition at line 136 of file driver_max44009.c.

◆ max44009_get_auto_range()

uint8_t max44009_get_auto_range ( max44009_handle_t * handle,
max44009_bool_t * enable )

get auto range

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

Definition at line 405 of file driver_max44009.c.

◆ max44009_get_continuous_mode()

uint8_t max44009_get_continuous_mode ( max44009_handle_t * handle,
max44009_bool_t * enable )

get continuous mode stauts

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

Definition at line 323 of file driver_max44009.c.

◆ max44009_get_current_div_8()

uint8_t max44009_get_current_div_8 ( max44009_handle_t * handle,
max44009_bool_t * enable )

get current div 8

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

Definition at line 487 of file driver_max44009.c.

◆ max44009_get_integration_time()

uint8_t max44009_get_integration_time ( max44009_handle_t * handle,
max44009_integration_time_t * t )

get integration time

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

Definition at line 569 of file driver_max44009.c.

◆ max44009_get_interrupt()

uint8_t max44009_get_interrupt ( max44009_handle_t * handle,
max44009_bool_t * enable )

get interrupt status

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

Definition at line 241 of file driver_max44009.c.

◆ max44009_get_interrupt_high_threshold()

uint8_t max44009_get_interrupt_high_threshold ( max44009_handle_t * handle,
uint8_t * threshold )

get interrupt high threshold

Parameters
[in]*handlepointer to a max44009 handle structure
[out]*thresholdpointer to a threshold buffer
Returns
status code
  • 0 success
  • 1 get interrupt high threshold failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 643 of file driver_max44009.c.

◆ max44009_get_interrupt_low_threshold()

uint8_t max44009_get_interrupt_low_threshold ( max44009_handle_t * handle,
uint8_t * threshold )

get interrupt low threshold

Parameters
[in]*handlepointer to a max44009 handle structure
[out]*thresholdpointer to a threshold buffer
Returns
status code
  • 0 success
  • 1 get interrupt low threshold failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 717 of file driver_max44009.c.

◆ max44009_get_interrupt_status()

uint8_t max44009_get_interrupt_status ( max44009_handle_t * handle,
max44009_bool_t * enable )

get interrupt status

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

Definition at line 159 of file driver_max44009.c.

◆ max44009_get_threshold_timer()

uint8_t max44009_get_threshold_timer ( max44009_handle_t * handle,
uint8_t * t )

get threshold timer

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

Definition at line 791 of file driver_max44009.c.

◆ max44009_info()

uint8_t max44009_info ( max44009_info_t * info)

get chip's information

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

Definition at line 1186 of file driver_max44009.c.

◆ max44009_init()

uint8_t max44009_init ( max44009_handle_t * handle)

initialize the chip

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

Definition at line 962 of file driver_max44009.c.

◆ max44009_read()

uint8_t max44009_read ( max44009_handle_t * handle,
uint16_t * raw,
float * lux )

read data

Parameters
[in]*handlepointer to a max44009 handle structure
[out]*rawpointer to a raw lux 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
Note
none

Definition at line 1079 of file driver_max44009.c.

◆ max44009_set_addr_pin()

uint8_t max44009_set_addr_pin ( max44009_handle_t * handle,
max44009_address_t addr_pin )

set the address pin

Parameters
[in]*handlepointer to a max44009 handle structure
[in]addr_pinchip address pins
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 115 of file driver_max44009.c.

◆ max44009_set_auto_range()

uint8_t max44009_set_auto_range ( max44009_handle_t * handle,
max44009_bool_t enable )

enable or disable auto range

Parameters
[in]*handlepointer to a max44009 handle structure
[in]enablebool value
Returns
status code
  • 0 success
  • 1 set auto range failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 360 of file driver_max44009.c.

◆ max44009_set_continuous_mode()

uint8_t max44009_set_continuous_mode ( max44009_handle_t * handle,
max44009_bool_t enable )

enable or disable continuous mode

Parameters
[in]*handlepointer to a max44009 handle structure
[in]enablebool value
Returns
status code
  • 0 success
  • 1 set continuous mode failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 278 of file driver_max44009.c.

◆ max44009_set_current_div_8()

uint8_t max44009_set_current_div_8 ( max44009_handle_t * handle,
max44009_bool_t enable )

enable or disable current div 8

Parameters
[in]*handlepointer to a max44009 handle structure
[in]enablebool value
Returns
status code
  • 0 success
  • 1 set current div 8 failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 442 of file driver_max44009.c.

◆ max44009_set_integration_time()

uint8_t max44009_set_integration_time ( max44009_handle_t * handle,
max44009_integration_time_t t )

set integration time

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

Definition at line 524 of file driver_max44009.c.

◆ max44009_set_interrupt()

uint8_t max44009_set_interrupt ( max44009_handle_t * handle,
max44009_bool_t enable )

enable or disable interrupt

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

Definition at line 196 of file driver_max44009.c.

◆ max44009_set_interrupt_high_threshold()

uint8_t max44009_set_interrupt_high_threshold ( max44009_handle_t * handle,
uint8_t threshold )

set interrupt high threshold

Parameters
[in]*handlepointer to a max44009 handle structure
[in]thresholdhigh threshold
Returns
status code
  • 0 success
  • 1 set interrupt high threshold failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 606 of file driver_max44009.c.

◆ max44009_set_interrupt_low_threshold()

uint8_t max44009_set_interrupt_low_threshold ( max44009_handle_t * handle,
uint8_t threshold )

set interrupt low threshold

Parameters
[in]*handlepointer to a max44009 handle structure
[in]thresholdlow threshold
Returns
status code
  • 0 success
  • 1 set interrupt low threshold failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 680 of file driver_max44009.c.

◆ max44009_set_threshold_timer()

uint8_t max44009_set_threshold_timer ( max44009_handle_t * handle,
uint8_t t )

set threshold timer

Parameters
[in]*handlepointer to a max44009 handle structure
[in]ttimer time
Returns
status code
  • 0 success
  • 1 set threshold timer failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 754 of file driver_max44009.c.

◆ max44009_threshold_convert_to_data()

uint8_t max44009_threshold_convert_to_data ( max44009_handle_t * handle,
uint8_t reg,
float * lux )

convert the register raw data to the threshold

Parameters
[in]*handlepointer to a max44009 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
Note
none

Definition at line 877 of file driver_max44009.c.

◆ max44009_threshold_convert_to_register()

uint8_t max44009_threshold_convert_to_register ( max44009_handle_t * handle,
float lux,
uint8_t * reg )

convert the threshold to the register raw data

Parameters
[in]*handlepointer to a max44009 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
Note
none

Definition at line 828 of file driver_max44009.c.

◆ max44009_timer_convert_to_data()

uint8_t max44009_timer_convert_to_data ( max44009_handle_t * handle,
uint8_t reg,
float * ms )

convert the register raw data to timer

Parameters
[in]*handlepointer to a max44009 handle structure
[in]regregister raw data
[out]*mspointer to a time buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 936 of file driver_max44009.c.

◆ max44009_timer_convert_to_register()

uint8_t max44009_timer_convert_to_register ( max44009_handle_t * handle,
float ms,
uint8_t * reg )

convert the timer to the register raw data

Parameters
[in]*handlepointer to a max44009 handle structure
[in]msinput time in ms
[out]*regpointer to a register raw buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 909 of file driver_max44009.c.