![]() |
LibDriver CH9120
|
driver ch9120 source file More...
#include "driver_ch9120.h"Go to the source code of this file.
Functions | |
| 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 | |
| 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_write (ch9120_handle_t *handle, uint8_t *buf, uint16_t len) |
| write data | |
| uint8_t | ch9120_read (ch9120_handle_t *handle, uint8_t *buf, uint16_t *len) |
| read data | |
| uint8_t | ch9120_set_command (ch9120_handle_t *handle, uint8_t *param, uint16_t len, uint8_t *out, uint16_t out_len, uint16_t pre_delay, uint16_t timeout) |
| set command | |
| uint8_t | ch9120_info (ch9120_info_t *info) |
| get chip's information | |
driver ch9120 source file
Copyright (c) 2015 - present LibDriver All rights reserved
The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
| Date | Version | Author | Description |
|---|---|---|---|
| 2025/09/15 | 1.0 | Shifeng Li | first upload |
Definition in file driver_ch9120.c.
| #define CH9120_CMD_CHIP_VERSION 0x01 |
| #define CH9120_CMD_DHCP 0x33 |
dhcp command
Definition at line 74 of file driver_ch9120.c.
| #define CH9120_CMD_EXIT 0x5E |
exit command
Definition at line 59 of file driver_ch9120.c.
| #define CH9120_CMD_GET_BAUD 0x71 |
get baud command
Definition at line 82 of file driver_ch9120.c.
| #define CH9120_CMD_GET_CONFIG 0x72 |
get config command
Definition at line 83 of file driver_ch9120.c.
| #define CH9120_CMD_GET_DISCONNECT 0x74 |
get disconnect command
Definition at line 85 of file driver_ch9120.c.
| #define CH9120_CMD_GET_DST_IP 0x65 |
get dest ip command
Definition at line 80 of file driver_ch9120.c.
| #define CH9120_CMD_GET_DST_PORT 0x66 |
get dest port command
Definition at line 81 of file driver_ch9120.c.
| #define CH9120_CMD_GET_FLUSH 0x76 |
get flush command
Definition at line 87 of file driver_ch9120.c.
| #define CH9120_CMD_GET_GATEWAY 0x63 |
get gateway command
Definition at line 78 of file driver_ch9120.c.
| #define CH9120_CMD_GET_IP 0x61 |
get ip command
Definition at line 76 of file driver_ch9120.c.
| #define CH9120_CMD_GET_LEN 0x75 |
get package length command
Definition at line 86 of file driver_ch9120.c.
| #define CH9120_CMD_GET_MODE 0x60 |
get mode command
Definition at line 75 of file driver_ch9120.c.
| #define CH9120_CMD_GET_NETMASK 0x62 |
get netmask command
Definition at line 77 of file driver_ch9120.c.
| #define CH9120_CMD_GET_PORT 0x64 |
get port command
Definition at line 79 of file driver_ch9120.c.
| #define CH9120_CMD_GET_STATUS 0x03 |
check status command
Definition at line 56 of file driver_ch9120.c.
| #define CH9120_CMD_GET_TIMEOUT 0x73 |
get timeout command
Definition at line 84 of file driver_ch9120.c.
| #define CH9120_CMD_RANDOM_PORT 0x17 |
set random port command
Definition at line 67 of file driver_ch9120.c.
| #define CH9120_CMD_RESET 0x02 |
reset chip command
Definition at line 55 of file driver_ch9120.c.
| #define CH9120_CMD_RUN_AND_RESET 0x0E |
run the config and reset command
Definition at line 58 of file driver_ch9120.c.
| #define CH9120_CMD_SAVE_TO_EEPROM 0x0D |
save to eeprom command
Definition at line 57 of file driver_ch9120.c.
| #define CH9120_CMD_SET_BAUD 0x21 |
set baud command
Definition at line 68 of file driver_ch9120.c.
| #define CH9120_CMD_SET_CONFIG 0x22 |
set config command
Definition at line 69 of file driver_ch9120.c.
| #define CH9120_CMD_SET_DISCONNECT 0x24 |
set disconnect command
Definition at line 71 of file driver_ch9120.c.
| #define CH9120_CMD_SET_DST_IP 0x15 |
set dest ip command
Definition at line 65 of file driver_ch9120.c.
| #define CH9120_CMD_SET_DST_PORT 0x16 |
set dest port command
Definition at line 66 of file driver_ch9120.c.
| #define CH9120_CMD_SET_FLUSH 0x26 |
set flush command
Definition at line 73 of file driver_ch9120.c.
| #define CH9120_CMD_SET_GATEWAY 0x13 |
set gateway command
Definition at line 63 of file driver_ch9120.c.
| #define CH9120_CMD_SET_IP 0x11 |
set ip command
Definition at line 61 of file driver_ch9120.c.
| #define CH9120_CMD_SET_LEN 0x25 |
set package length command
Definition at line 72 of file driver_ch9120.c.
| #define CH9120_CMD_SET_MODE 0x10 |
set mode command
Definition at line 60 of file driver_ch9120.c.
| #define CH9120_CMD_SET_NETMASK 0x12 |
set netmask command
Definition at line 62 of file driver_ch9120.c.
| #define CH9120_CMD_SET_PORT 0x14 |
set port command
Definition at line 64 of file driver_ch9120.c.
| #define CH9120_CMD_SET_TIMEOUT 0x23 |
set timeout command
Definition at line 70 of file driver_ch9120.c.
| #define CHIP_NAME "WCH CH9120" |
| #define DRIVER_VERSION 1000 |
driver version
Definition at line 49 of file driver_ch9120.c.
| #define MANUFACTURER_NAME "WCH" |
manufacturer name
Definition at line 43 of file driver_ch9120.c.
| #define MAX_CURRENT 100.0f |
chip max current
Definition at line 46 of file driver_ch9120.c.
| #define SUPPLY_VOLTAGE_MAX 3.6f |
chip max supply voltage
Definition at line 45 of file driver_ch9120.c.
| #define SUPPLY_VOLTAGE_MIN 2.1f |
chip min supply voltage
Definition at line 44 of file driver_ch9120.c.
| #define TEMPERATURE_MAX 85.0f |
chip max operating temperature
Definition at line 48 of file driver_ch9120.c.
| #define TEMPERATURE_MIN -40.0f |
chip min operating temperature
Definition at line 47 of file driver_ch9120.c.