first and working ethernet
This commit is contained in:
42
ch9120.h
Normal file
42
ch9120.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#ifndef _CH9120_H_
|
||||
#define _CH9120_H_
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "pico/stdlib.h"
|
||||
#include "hardware/uart.h"
|
||||
#include "hardware/irq.h"
|
||||
|
||||
#define UART_ID1 uart1
|
||||
#define INIT_BAUD_RATE 9600
|
||||
#define TRANSPORT_BAUD_RATE 115200
|
||||
#define DATA_BITS 8
|
||||
#define STOP_BITS 1
|
||||
#define PARITY UART_PARITY_NONE
|
||||
|
||||
#define UART_TX_PIN1 20
|
||||
#define UART_RX_PIN1 21
|
||||
|
||||
#define CFG_PIN 18
|
||||
#define RES_PIN 19
|
||||
|
||||
#define TCP_SERVER 0
|
||||
#define TCP_CLIENT 1
|
||||
#define UDP_SERVER 2
|
||||
#define UDP_CLIENT 3
|
||||
|
||||
#define Mode1 0x10
|
||||
#define LOCAL_IP 0x11
|
||||
#define SUBNET_MASK 0x12
|
||||
#define GATEWAY 0x13
|
||||
#define LOCAL_PORT1 0X14
|
||||
#define TARGET_IP1 0x15
|
||||
#define TARGET_PORT1 0x16
|
||||
#define UART1_BAUD1 0x21
|
||||
|
||||
void CH9120_init(void);
|
||||
void CH9120_send_data(const char *data, size_t len);
|
||||
int CH9120_receive_data(char *buffer, size_t max_len);
|
||||
void CH9120_process(void);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user