LibDriver CH9120
Loading...
Searching...
No Matches
ch9120 base driver function

ch9120 base driver modules More...

Collaboration diagram for ch9120 base driver function:

Data Structures

struct  ch9120_handle_s
 ch9120 handle structure definition More...
struct  ch9120_info_s
 ch9120 information structure definition More...

Macros

#define CH9120_UART_PRE_DELAY   50
 ch9120 uart pre delay definition

Typedefs

typedef struct ch9120_handle_s ch9120_handle_t
 ch9120 handle structure definition
typedef struct ch9120_info_s ch9120_info_t
 ch9120 information structure definition

Enumerations

enum  ch9120_bool_t { CH9120_BOOL_FALSE = 0x00 , CH9120_BOOL_TRUE = 0x01 }
 ch9120 bool enumeration definition More...
enum  ch9120_status_t { CH9120_STATUS_DISCONNECT = 0x00 , CH9120_STATUS_CONNECT = 0x01 }
 ch9120 status enumeration definition More...
enum  ch9120_mode_t { CH9120_MODE_TCP_SERVER = 0x00 , CH9120_MODE_TCP_CLIENT = 0x01 , CH9120_MODE_UDP_SERVER = 0x02 , CH9120_MODE_UDP_CLIENT = 0x03 }
 ch9120 mode enumeration definition More...
enum  ch9120_parity_t {
  CH9120_PARITY_EVEN = 0x00 , CH9120_PARITY_ODD = 0x01 , CH9120_PARITY_MARK = 0x02 , CH9120_PARITY_SPACE = 0x03 ,
  CH9120_PARITY_NONE = 0x04
}
 ch9120 parity enumeration definition More...

Functions

uint8_t ch9120_info (ch9120_info_t *info)
 get chip's information
uint8_t ch9120_init (ch9120_handle_t *handle)
 initialize the chip
uint8_t ch9120_deinit (ch9120_handle_t *handle)
 close the chip
uint8_t ch9120_read (ch9120_handle_t *handle, uint8_t *buf, uint16_t *len)
 read data
uint8_t ch9120_write (ch9120_handle_t *handle, uint8_t *buf, uint16_t len)
 write data
uint8_t ch9120_get_version (ch9120_handle_t *handle, uint8_t *version)
 get version
uint8_t ch9120_reset (ch9120_handle_t *handle)
 reset the chip
uint8_t ch9120_get_status (ch9120_handle_t *handle, ch9120_status_t *status)
 get status
uint8_t ch9120_save_to_eeprom (ch9120_handle_t *handle)
 save to eeprom
uint8_t ch9120_config_and_reset (ch9120_handle_t *handle)
 config and reset the chip
uint8_t ch9120_exit (ch9120_handle_t *handle)
 exit
uint8_t ch9120_set_mode (ch9120_handle_t *handle, ch9120_mode_t mode)
 set mode
uint8_t ch9120_get_mode (ch9120_handle_t *handle, ch9120_mode_t *mode)
 get mode
uint8_t ch9120_set_ip (ch9120_handle_t *handle, uint8_t ip[4])
 set ip address
uint8_t ch9120_get_ip (ch9120_handle_t *handle, uint8_t ip[4])
 get ip address
uint8_t ch9120_set_subnet_mask (ch9120_handle_t *handle, uint8_t mask[4])
 set subnet mask
uint8_t ch9120_get_subnet_mask (ch9120_handle_t *handle, uint8_t mask[4])
 get subnet mask
uint8_t ch9120_set_gateway (ch9120_handle_t *handle, uint8_t ip[4])
 set gateway
uint8_t ch9120_get_gateway (ch9120_handle_t *handle, uint8_t ip[4])
 get gateway
uint8_t ch9120_set_source_port (ch9120_handle_t *handle, uint16_t num)
 set source port
uint8_t ch9120_get_source_port (ch9120_handle_t *handle, uint16_t *num)
 get source port
uint8_t ch9120_set_dest_ip (ch9120_handle_t *handle, uint8_t ip[4])
 set dest ip
uint8_t ch9120_get_dest_ip (ch9120_handle_t *handle, uint8_t ip[4])
 get dest ip
uint8_t ch9120_set_dest_port (ch9120_handle_t *handle, uint16_t num)
 set dest port
uint8_t ch9120_get_dest_port (ch9120_handle_t *handle, uint16_t *num)
 get dest port
uint8_t ch9120_set_uart_baud (ch9120_handle_t *handle, uint32_t baud)
 set uart baud
uint8_t ch9120_get_uart_baud (ch9120_handle_t *handle, uint32_t *baud)
 get uart baud
uint8_t ch9120_set_uart_config (ch9120_handle_t *handle, uint8_t data_bit, ch9120_parity_t parity, uint8_t stop_bit)
 set uart config
uint8_t ch9120_get_uart_config (ch9120_handle_t *handle, uint8_t *data_bit, ch9120_parity_t *parity, uint8_t *stop_bit)
 get uart config
uint8_t ch9120_set_uart_timeout (ch9120_handle_t *handle, uint8_t timeout)
 set uart timeout
uint8_t ch9120_get_uart_timeout (ch9120_handle_t *handle, uint8_t *timeout)
 get uart timeout
uint8_t ch9120_uart_timeout_convert_to_register (ch9120_handle_t *handle, uint16_t ms, uint8_t *reg)
 convert the uart timeout to the register raw data
uint8_t ch9120_uart_timeout_convert_to_data (ch9120_handle_t *handle, uint8_t reg, uint16_t *ms)
 convert the register raw data to the offset
uint8_t ch9120_set_source_port_random (ch9120_handle_t *handle, ch9120_bool_t enable)
 enable or disable random source port number
uint8_t ch9120_set_uart_buffer_length (ch9120_handle_t *handle, uint32_t len)
 set uart buffer length
uint8_t ch9120_get_uart_buffer_length (ch9120_handle_t *handle, uint32_t *len)
 get uart buffer length
uint8_t ch9120_set_uart_flush (ch9120_handle_t *handle, ch9120_bool_t enable)
 enable or disable uart auto flush
uint8_t ch9120_get_uart_flush (ch9120_handle_t *handle, ch9120_bool_t *enable)
 get uart auto flush status
uint8_t ch9120_set_disconnect_with_no_rj45 (ch9120_handle_t *handle, ch9120_bool_t enable)
 enable or disable disconnect with no rj45
uint8_t ch9120_get_disconnect_with_no_rj45 (ch9120_handle_t *handle, ch9120_bool_t *enable)
 get disconnect with no rj45 status
uint8_t ch9120_set_dhcp (ch9120_handle_t *handle, ch9120_bool_t enable)
 enable or disable dhcp

Detailed Description

ch9120 base driver modules

Macro Definition Documentation

◆ CH9120_UART_PRE_DELAY

#define CH9120_UART_PRE_DELAY   50

ch9120 uart pre delay definition

50ms

Definition at line 63 of file driver_ch9120.h.

Typedef Documentation

◆ ch9120_handle_t

ch9120 handle structure definition

◆ ch9120_info_t

typedef struct ch9120_info_s ch9120_info_t

ch9120 information structure definition

Enumeration Type Documentation

◆ ch9120_bool_t

ch9120 bool enumeration definition

Enumerator
CH9120_BOOL_FALSE 

false

CH9120_BOOL_TRUE 

true

Definition at line 69 of file driver_ch9120.h.

◆ ch9120_mode_t

ch9120 mode enumeration definition

Enumerator
CH9120_MODE_TCP_SERVER 

tcp server

CH9120_MODE_TCP_CLIENT 

tcp client

CH9120_MODE_UDP_SERVER 

udp server

CH9120_MODE_UDP_CLIENT 

udp client

Definition at line 87 of file driver_ch9120.h.

◆ ch9120_parity_t

ch9120 parity enumeration definition

Enumerator
CH9120_PARITY_EVEN 

even parity

CH9120_PARITY_ODD 

odd parity

CH9120_PARITY_MARK 

mark

CH9120_PARITY_SPACE 

space

CH9120_PARITY_NONE 

none

Definition at line 98 of file driver_ch9120.h.

◆ ch9120_status_t

ch9120 status enumeration definition

Enumerator
CH9120_STATUS_DISCONNECT 

disconnect

CH9120_STATUS_CONNECT 

connect

Definition at line 78 of file driver_ch9120.h.

Function Documentation

◆ ch9120_config_and_reset()

uint8_t ch9120_config_and_reset ( ch9120_handle_t * handle)

config and reset the chip

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

Definition at line 411 of file driver_ch9120.c.

◆ ch9120_deinit()

uint8_t ch9120_deinit ( ch9120_handle_t * handle)

close the chip

Parameters
[in]*handlepointer to a ch9120 handle structure
Returns
status code
  • 0 success
  • 1 uart deinit failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 reset failed
  • 5 reset gpio deinit failed
  • 6 cfg gpio deinit failed
Note
none

Definition at line 1695 of file driver_ch9120.c.

◆ ch9120_exit()

uint8_t ch9120_exit ( ch9120_handle_t * handle)

exit

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

Definition at line 445 of file driver_ch9120.c.

◆ ch9120_get_dest_ip()

uint8_t ch9120_get_dest_ip ( ch9120_handle_t * handle,
uint8_t ip[4] )

get dest ip

Parameters
[in]*handlepointer to a ch9120 handle structure
[out]*ippointer to an ip buffer
Returns
status code
  • 0 success
  • 1 get dest ip failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 877 of file driver_ch9120.c.

◆ ch9120_get_dest_port()

uint8_t ch9120_get_dest_port ( ch9120_handle_t * handle,
uint16_t * num )

get dest port

Parameters
[in]*handlepointer to a ch9120 handle structure
[out]*numpointer to a dest port buffer
Returns
status code
  • 0 success
  • 1 get dest port failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 948 of file driver_ch9120.c.

◆ ch9120_get_disconnect_with_no_rj45()

uint8_t ch9120_get_disconnect_with_no_rj45 ( ch9120_handle_t * handle,
ch9120_bool_t * enable )

get disconnect with no rj45 status

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

Definition at line 1480 of file driver_ch9120.c.

◆ ch9120_get_gateway()

uint8_t ch9120_get_gateway ( ch9120_handle_t * handle,
uint8_t ip[4] )

get gateway

Parameters
[in]*handlepointer to a ch9120 handle structure
[out]*ippointer to an ip buffer
Returns
status code
  • 0 success
  • 1 get gateway failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 732 of file driver_ch9120.c.

◆ ch9120_get_ip()

uint8_t ch9120_get_ip ( ch9120_handle_t * handle,
uint8_t ip[4] )

get ip address

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

Definition at line 588 of file driver_ch9120.c.

◆ ch9120_get_mode()

uint8_t ch9120_get_mode ( ch9120_handle_t * handle,
ch9120_mode_t * mode )

get mode

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

Definition at line 514 of file driver_ch9120.c.

◆ ch9120_get_source_port()

uint8_t ch9120_get_source_port ( ch9120_handle_t * handle,
uint16_t * num )

get source port

Parameters
[in]*handlepointer to a ch9120 handle structure
[out]*numpointer to a source port buffer
Returns
status code
  • 0 success
  • 1 get source port failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 802 of file driver_ch9120.c.

◆ ch9120_get_status()

uint8_t ch9120_get_status ( ch9120_handle_t * handle,
ch9120_status_t * status )

get status

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

Definition at line 343 of file driver_ch9120.c.

◆ ch9120_get_subnet_mask()

uint8_t ch9120_get_subnet_mask ( ch9120_handle_t * handle,
uint8_t mask[4] )

get subnet mask

Parameters
[in]*handlepointer to a ch9120 handle structure
[out]*maskpointer to a mask buffer
Returns
status code
  • 0 success
  • 1 get subnet mask failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 660 of file driver_ch9120.c.

◆ ch9120_get_uart_baud()

uint8_t ch9120_get_uart_baud ( ch9120_handle_t * handle,
uint32_t * baud )

get uart baud

Parameters
[in]*handlepointer to a ch9120 handle structure
[out]*baudpointer to a baud buffer
Returns
status code
  • 0 success
  • 1 get uart baud failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1022 of file driver_ch9120.c.

◆ ch9120_get_uart_buffer_length()

uint8_t ch9120_get_uart_buffer_length ( ch9120_handle_t * handle,
uint32_t * len )

get uart buffer length

Parameters
[in]*handlepointer to a ch9120 handle structure
[out]*lenpointer to a buffer length buffer
Returns
status code
  • 0 success
  • 1 get uart buffer length failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1337 of file driver_ch9120.c.

◆ ch9120_get_uart_config()

uint8_t ch9120_get_uart_config ( ch9120_handle_t * handle,
uint8_t * data_bit,
ch9120_parity_t * parity,
uint8_t * stop_bit )

get uart config

Parameters
[in]*handlepointer to a ch9120 handle structure
[out]*data_bitpointer to an uart data bit buffer
[out]*paritypointer to an uart parity buffer
[out]*stop_bitpointer to an uart stop bit buffer
Returns
status code
  • 0 success
  • 1 get uart config failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1100 of file driver_ch9120.c.

◆ ch9120_get_uart_flush()

uint8_t ch9120_get_uart_flush ( ch9120_handle_t * handle,
ch9120_bool_t * enable )

get uart auto flush status

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

Definition at line 1409 of file driver_ch9120.c.

◆ ch9120_get_uart_timeout()

uint8_t ch9120_get_uart_timeout ( ch9120_handle_t * handle,
uint8_t * timeout )

get uart timeout

Parameters
[in]*handlepointer to a ch9120 handle structure
[out]*timeoutpointer to an uart timeout buffer
Returns
status code
  • 0 success
  • 1 get uart timeout failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1176 of file driver_ch9120.c.

◆ ch9120_get_version()

uint8_t ch9120_get_version ( ch9120_handle_t * handle,
uint8_t * version )

get version

Parameters
[in]*handlepointer to a ch9120 handle structure
[out]*versionpointer to a version buffer
Returns
status code
  • 0 success
  • 1 get version failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 275 of file driver_ch9120.c.

◆ ch9120_info()

uint8_t ch9120_info ( ch9120_info_t * info)

get chip's information

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

Definition at line 1861 of file driver_ch9120.c.

◆ ch9120_init()

uint8_t ch9120_init ( ch9120_handle_t * handle)

initialize the chip

Parameters
[in]*handlepointer to a ch9120 handle structure
Returns
status code
  • 0 success
  • 1 uart initialization failed
  • 2 handle is NULL
  • 3 linked functions is NULL
  • 4 reset gpio init failed
  • 5 cfg gpio init failed
  • 6 reset failed
Note
none

Definition at line 1553 of file driver_ch9120.c.

◆ ch9120_read()

uint8_t ch9120_read ( ch9120_handle_t * handle,
uint8_t * buf,
uint16_t * len )

read data

Parameters
[in]*handlepointer to a ch9120 handle structure
[out]*bufpointer to a data buffer
[in,out]*lenpointer to a length buffer
Returns
status code
  • 0 success
  • 1 read failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1788 of file driver_ch9120.c.

◆ ch9120_reset()

uint8_t ch9120_reset ( ch9120_handle_t * handle)

reset the chip

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

Definition at line 308 of file driver_ch9120.c.

◆ ch9120_save_to_eeprom()

uint8_t ch9120_save_to_eeprom ( ch9120_handle_t * handle)

save to eeprom

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

Definition at line 378 of file driver_ch9120.c.

◆ ch9120_set_dest_ip()

uint8_t ch9120_set_dest_ip ( ch9120_handle_t * handle,
uint8_t ip[4] )

set dest ip

Parameters
[in]*handlepointer to a ch9120 handle structure
[in]*ippointer to an ip buffer
Returns
status code
  • 0 success
  • 1 set dest ip failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 839 of file driver_ch9120.c.

◆ ch9120_set_dest_port()

uint8_t ch9120_set_dest_port ( ch9120_handle_t * handle,
uint16_t num )

set dest port

Parameters
[in]*handlepointer to a ch9120 handle structure
[in]numdest port
Returns
status code
  • 0 success
  • 1 set dest port failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 912 of file driver_ch9120.c.

◆ ch9120_set_dhcp()

uint8_t ch9120_set_dhcp ( ch9120_handle_t * handle,
ch9120_bool_t enable )

enable or disable dhcp

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

Definition at line 1516 of file driver_ch9120.c.

◆ ch9120_set_disconnect_with_no_rj45()

uint8_t ch9120_set_disconnect_with_no_rj45 ( ch9120_handle_t * handle,
ch9120_bool_t enable )

enable or disable disconnect with no rj45

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

Definition at line 1445 of file driver_ch9120.c.

◆ ch9120_set_gateway()

uint8_t ch9120_set_gateway ( ch9120_handle_t * handle,
uint8_t ip[4] )

set gateway

Parameters
[in]*handlepointer to a ch9120 handle structure
[in]*ippointer to an ip buffer
Returns
status code
  • 0 success
  • 1 set gateway failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 694 of file driver_ch9120.c.

◆ ch9120_set_ip()

uint8_t ch9120_set_ip ( ch9120_handle_t * handle,
uint8_t ip[4] )

set ip address

Parameters
[in]*handlepointer to a ch9120 handle structure
[in]*ippointer to an ip buffer
Returns
status code
  • 0 success
  • 1 set ip failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 550 of file driver_ch9120.c.

◆ ch9120_set_mode()

uint8_t ch9120_set_mode ( ch9120_handle_t * handle,
ch9120_mode_t mode )

set mode

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

Definition at line 479 of file driver_ch9120.c.

◆ ch9120_set_source_port()

uint8_t ch9120_set_source_port ( ch9120_handle_t * handle,
uint16_t num )

set source port

Parameters
[in]*handlepointer to a ch9120 handle structure
[in]numsource port
Returns
status code
  • 0 success
  • 1 set source port failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 766 of file driver_ch9120.c.

◆ ch9120_set_source_port_random()

uint8_t ch9120_set_source_port_random ( ch9120_handle_t * handle,
ch9120_bool_t enable )

enable or disable random source port number

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

Definition at line 1264 of file driver_ch9120.c.

◆ ch9120_set_subnet_mask()

uint8_t ch9120_set_subnet_mask ( ch9120_handle_t * handle,
uint8_t mask[4] )

set subnet mask

Parameters
[in]*handlepointer to a ch9120 handle structure
[in]*maskpointer to a mask buffer
Returns
status code
  • 0 success
  • 1 set subnet mask failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 622 of file driver_ch9120.c.

◆ ch9120_set_uart_baud()

uint8_t ch9120_set_uart_baud ( ch9120_handle_t * handle,
uint32_t baud )

set uart baud

Parameters
[in]*handlepointer to a ch9120 handle structure
[in]baudchip baud
Returns
status code
  • 0 success
  • 1 set uart baud failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 984 of file driver_ch9120.c.

◆ ch9120_set_uart_buffer_length()

uint8_t ch9120_set_uart_buffer_length ( ch9120_handle_t * handle,
uint32_t len )

set uart buffer length

Parameters
[in]*handlepointer to a ch9120 handle structure
[in]lenbuffer length
Returns
status code
  • 0 success
  • 1 set uart buffer length failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1299 of file driver_ch9120.c.

◆ ch9120_set_uart_config()

uint8_t ch9120_set_uart_config ( ch9120_handle_t * handle,
uint8_t data_bit,
ch9120_parity_t parity,
uint8_t stop_bit )

set uart config

Parameters
[in]*handlepointer to a ch9120 handle structure
[in]data_bituart data bit
[in]parityuart parity
[in]stop_bituart stop bit
Returns
status code
  • 0 success
  • 1 set uart config failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1061 of file driver_ch9120.c.

◆ ch9120_set_uart_flush()

uint8_t ch9120_set_uart_flush ( ch9120_handle_t * handle,
ch9120_bool_t enable )

enable or disable uart auto flush

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

Definition at line 1374 of file driver_ch9120.c.

◆ ch9120_set_uart_timeout()

uint8_t ch9120_set_uart_timeout ( ch9120_handle_t * handle,
uint8_t timeout )

set uart timeout

Parameters
[in]*handlepointer to a ch9120 handle structure
[in]timeoutuart timeout
Returns
status code
  • 0 success
  • 1 set uart timeout failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 1138 of file driver_ch9120.c.

◆ ch9120_uart_timeout_convert_to_data()

uint8_t ch9120_uart_timeout_convert_to_data ( ch9120_handle_t * handle,
uint8_t reg,
uint16_t * ms )

convert the register raw data to the offset

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

Definition at line 1237 of file driver_ch9120.c.

◆ ch9120_uart_timeout_convert_to_register()

uint8_t ch9120_uart_timeout_convert_to_register ( ch9120_handle_t * handle,
uint16_t ms,
uint8_t * reg )

convert the uart timeout to the register raw data

Parameters
[in]*handlepointer to a ch9120 handle structure
[in]mstimeout
[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 1210 of file driver_ch9120.c.

◆ ch9120_write()

uint8_t ch9120_write ( ch9120_handle_t * handle,
uint8_t * buf,
uint16_t len )

write data

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

Definition at line 1749 of file driver_ch9120.c.