LibDriver TPL0501
Loading...
Searching...
No Matches
tpl0501 base driver function

tpl0501 base driver modules More...

Collaboration diagram for tpl0501 base driver function:

Data Structures

struct  tpl0501_handle_s
 tpl0501 handle structure definition More...
struct  tpl0501_info_s
 tpl0501 information structure definition More...

Typedefs

typedef struct tpl0501_handle_s tpl0501_handle_t
 tpl0501 handle structure definition
typedef struct tpl0501_info_s tpl0501_info_t
 tpl0501 information structure definition

Functions

uint8_t tpl0501_info (tpl0501_info_t *info)
 get chip's information
uint8_t tpl0501_init (tpl0501_handle_t *handle)
 initialize the chip
uint8_t tpl0501_deinit (tpl0501_handle_t *handle)
 close the chip
uint8_t tpl0501_write (tpl0501_handle_t *handle, uint8_t raw)
 write data
uint8_t tpl0501_percentage_convert_to_register (tpl0501_handle_t *handle, float percentage, uint8_t *reg, float *wl_ohm, float *hw_ohm)
 convert the percentage to the register raw data
uint8_t tpl0501_percentage_convert_to_data (tpl0501_handle_t *handle, uint8_t reg, float *percentage, float *wl_ohm, float *hw_ohm)
 convert the register raw data to percentage

Detailed Description

tpl0501 base driver modules

Typedef Documentation

◆ tpl0501_handle_t

tpl0501 handle structure definition

◆ tpl0501_info_t

tpl0501 information structure definition

Function Documentation

◆ tpl0501_deinit()

uint8_t tpl0501_deinit ( tpl0501_handle_t * handle)

close the chip

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

Definition at line 139 of file driver_tpl0501.c.

◆ tpl0501_info()

uint8_t tpl0501_info ( tpl0501_info_t * info)

get chip's information

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

Definition at line 298 of file driver_tpl0501.c.

◆ tpl0501_init()

uint8_t tpl0501_init ( tpl0501_handle_t * handle)

initialize the chip

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

Definition at line 83 of file driver_tpl0501.c.

◆ tpl0501_percentage_convert_to_data()

uint8_t tpl0501_percentage_convert_to_data ( tpl0501_handle_t * handle,
uint8_t reg,
float * percentage,
float * wl_ohm,
float * hw_ohm )

convert the register raw data to percentage

Parameters
[in]*handlepointer to a tpl0501 handle structure
[in]regregister raw data
[out]*percentagepointer to a percentage buffer
[out]*wl_ohmpointer to a wl ohm buffer
[out]*hw_ohmpointer to a hw ohm buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 245 of file driver_tpl0501.c.

◆ tpl0501_percentage_convert_to_register()

uint8_t tpl0501_percentage_convert_to_register ( tpl0501_handle_t * handle,
float percentage,
uint8_t * reg,
float * wl_ohm,
float * hw_ohm )

convert the percentage to the register raw data

Parameters
[in]*handlepointer to a tpl0501 handle structure
[in]percentageset percentage
[out]*regpointer to a register raw buffer
[out]*wl_ohmpointer to a wl ohm buffer
[out]*hw_ohmpointer to a hw ohm buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 212 of file driver_tpl0501.c.

◆ tpl0501_write()

uint8_t tpl0501_write ( tpl0501_handle_t * handle,
uint8_t raw )

write data

Parameters
[in]*handlepointer to a tpl0501 handle structure
[in]rawset data
Returns
status code
  • 0 success
  • 1 write failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 175 of file driver_tpl0501.c.