LibDriver X9CXX
Loading...
Searching...
No Matches
x9cxx basic driver function

x9cxx basic driver modules More...

Collaboration diagram for x9cxx basic driver function:

Data Structures

struct  x9cxx_handle_s
 x9cxx handle structure definition More...
struct  x9cxx_info_s
 x9cxx information structure definition More...

Macros

#define X9CXX_STEP_DELAY_US   10
 x9cxx step delay definition
#define X9CXX_OPERATE_DELAY_US   10
 x9cxx operate delay definition
#define X9CXX_STORE_DELAY_MS   30
 x9cxx store delay definition

Typedefs

typedef struct x9cxx_handle_s x9cxx_handle_t
 x9cxx handle structure definition
typedef struct x9cxx_info_s x9cxx_info_t
 x9cxx information structure definition

Enumerations

enum  x9cxx_type_t { X9C102 = 1000 , X9C103 = 10000 , X9C503 = 50000 , X9C104 = 100000 }
 x9cxx type enumeration definition More...
enum  x9cxx_bool_t { X9CXX_BOOL_FALSE = 0x00 , X9CXX_BOOL_TRUE = 0x01 }
 x9cxx bool enumeration definition More...

Functions

uint8_t x9cxx_info (x9cxx_info_t *info)
 get chip's information
uint8_t x9cxx_set_type (x9cxx_handle_t *handle, x9cxx_type_t type)
 set chip type
uint8_t x9cxx_get_type (x9cxx_handle_t *handle, x9cxx_type_t *type)
 get chip type
uint8_t x9cxx_init (x9cxx_handle_t *handle)
 initialize the chip
uint8_t x9cxx_deinit (x9cxx_handle_t *handle)
 close the chip
uint8_t x9cxx_reset_to_min (x9cxx_handle_t *handle, x9cxx_bool_t store_enable)
 reset to min
uint8_t x9cxx_reset_to_max (x9cxx_handle_t *handle, x9cxx_bool_t store_enable)
 reset to max
uint8_t x9cxx_increment (x9cxx_handle_t *handle, uint8_t step, x9cxx_bool_t store_enable)
 increment
uint8_t x9cxx_decrement (x9cxx_handle_t *handle, uint8_t step, x9cxx_bool_t store_enable)
 decrement
uint8_t x9cxx_set_absolute_step_counter (x9cxx_handle_t *handle, uint8_t counter, x9cxx_bool_t store_enable)
 set absolute step counter
uint8_t x9cxx_get_step_counter (x9cxx_handle_t *handle, uint8_t *counter)
 get step counter
uint8_t x9cxx_resistor_convert_to_register (x9cxx_handle_t *handle, float ohm, uint8_t *step)
 resistor convert to register
uint8_t x9cxx_resistor_convert_to_data (x9cxx_handle_t *handle, uint8_t step, float *ohm)
 resistor convert to data

Detailed Description

x9cxx basic driver modules

Macro Definition Documentation

◆ X9CXX_OPERATE_DELAY_US

#define X9CXX_OPERATE_DELAY_US   10

x9cxx operate delay definition

10us

Definition at line 70 of file driver_x9cxx.h.

◆ X9CXX_STEP_DELAY_US

#define X9CXX_STEP_DELAY_US   10

x9cxx step delay definition

10us

Definition at line 63 of file driver_x9cxx.h.

◆ X9CXX_STORE_DELAY_MS

#define X9CXX_STORE_DELAY_MS   30

x9cxx store delay definition

30ms

Definition at line 77 of file driver_x9cxx.h.

Typedef Documentation

◆ x9cxx_handle_t

x9cxx handle structure definition

◆ x9cxx_info_t

typedef struct x9cxx_info_s x9cxx_info_t

x9cxx information structure definition

Enumeration Type Documentation

◆ x9cxx_bool_t

x9cxx bool enumeration definition

Enumerator
X9CXX_BOOL_FALSE 

false

X9CXX_BOOL_TRUE 

true

Definition at line 94 of file driver_x9cxx.h.

◆ x9cxx_type_t

x9cxx type enumeration definition

Enumerator
X9C102 

1k

X9C103 

10k

X9C503 

50k

X9C104 

100k

Definition at line 83 of file driver_x9cxx.h.

Function Documentation

◆ x9cxx_decrement()

uint8_t x9cxx_decrement ( x9cxx_handle_t * handle,
uint8_t step,
x9cxx_bool_t store_enable )

decrement

Parameters
[in]*handlepointer to a x9cxx handle structure
[in]stepstep counter
[in]store_enablebool value
Returns
status code
  • 0 success
  • 1 decrement failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 662 of file driver_x9cxx.c.

◆ x9cxx_deinit()

uint8_t x9cxx_deinit ( x9cxx_handle_t * handle)

close the chip

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

Definition at line 432 of file driver_x9cxx.c.

◆ x9cxx_get_step_counter()

uint8_t x9cxx_get_step_counter ( x9cxx_handle_t * handle,
uint8_t * counter )

get step counter

Parameters
[in]*handlepointer to a x9cxx handle structure
[out]*counterpointer to a step counter buffer
Returns
status code
  • 0 success
  • 1 step counter is invalid
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 733 of file driver_x9cxx.c.

◆ x9cxx_get_type()

uint8_t x9cxx_get_type ( x9cxx_handle_t * handle,
x9cxx_type_t * type )

get chip type

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

Definition at line 895 of file driver_x9cxx.c.

◆ x9cxx_increment()

uint8_t x9cxx_increment ( x9cxx_handle_t * handle,
uint8_t step,
x9cxx_bool_t store_enable )

increment

Parameters
[in]*handlepointer to a x9cxx handle structure
[in]stepstep counter
[in]store_enablebool value
Returns
status code
  • 0 success
  • 1 increment failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 590 of file driver_x9cxx.c.

◆ x9cxx_info()

uint8_t x9cxx_info ( x9cxx_info_t * info)

get chip's information

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

Definition at line 969 of file driver_x9cxx.c.

◆ x9cxx_init()

uint8_t x9cxx_init ( x9cxx_handle_t * handle)

initialize the chip

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

Definition at line 285 of file driver_x9cxx.c.

◆ x9cxx_reset_to_max()

uint8_t x9cxx_reset_to_max ( x9cxx_handle_t * handle,
x9cxx_bool_t store_enable )

reset to max

Parameters
[in]*handlepointer to a x9cxx handle structure
[in]store_enablebool value
Returns
status code
  • 0 success
  • 1 reset failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
this function can make step counter valid

Definition at line 533 of file driver_x9cxx.c.

◆ x9cxx_reset_to_min()

uint8_t x9cxx_reset_to_min ( x9cxx_handle_t * handle,
x9cxx_bool_t store_enable )

reset to min

Parameters
[in]*handlepointer to a x9cxx handle structure
[in]store_enablebool value
Returns
status code
  • 0 success
  • 1 reset failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
this function can make step counter valid

Definition at line 477 of file driver_x9cxx.c.

◆ x9cxx_resistor_convert_to_data()

uint8_t x9cxx_resistor_convert_to_data ( x9cxx_handle_t * handle,
uint8_t step,
float * ohm )

resistor convert to data

Parameters
[in]*handlepointer to a x9cxx handle structure
[in]stepstep counter
[out]*ohmpointer to an ohm buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 945 of file driver_x9cxx.c.

◆ x9cxx_resistor_convert_to_register()

uint8_t x9cxx_resistor_convert_to_register ( x9cxx_handle_t * handle,
float ohm,
uint8_t * step )

resistor convert to register

Parameters
[in]*handlepointer to a x9cxx handle structure
[in]ohmresistor ohm
[out]*steppointer to a step buffer
Returns
status code
  • 0 success
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 918 of file driver_x9cxx.c.

◆ x9cxx_set_absolute_step_counter()

uint8_t x9cxx_set_absolute_step_counter ( x9cxx_handle_t * handle,
uint8_t counter,
x9cxx_bool_t store_enable )

set absolute step counter

Parameters
[in]*handlepointer to a x9cxx handle structure
[in]counterabsolute step counter
[in]store_enablebool value
Returns
status code
  • 0 success
  • 1 set absolute step counter failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 step counter is invalid
  • 5 counter > 99
Note
you must run x9cxx_reset_to_min or x9cxx_reset_to_max to make step counter valid 0 <= counter <= 99

Definition at line 771 of file driver_x9cxx.c.

◆ x9cxx_set_type()

uint8_t x9cxx_set_type ( x9cxx_handle_t * handle,
x9cxx_type_t type )

set chip type

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

Definition at line 874 of file driver_x9cxx.c.