1 /* 2 * Copyright (c) 2022 Unionman Technology Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef _SERIAL_UART_H_ 17 #define _SERIAL_UART_H_ 18 19 #define UART_TTL_NAME "/dev/ttyS1" 20 #define FRAME_LEN 4 21 #define RECV_HEAD 0xaa 22 #define RECV_END 0x55 23 #define EVT_RIGHT 0x01 24 #define EVT_LEFT 0x02 25 #define EVT_BACK 0x03 26 #define EVT_FORWARD 0x04 27 #define EVT_PULLUP 0x05 28 #define EVT_PULLDOWN 0x06 29 #define EVT_PULLREMOVE 0x07 30 #define EVT_TOUCH1 0x21 31 #define EVT_TOUCH2 0x22 32 #define EVT_TOUCH3 0x23 33 #define EVT_TOUCH4 0x24 34 #define EVT_TOUCH5 0x25 35 #define OK 0 36 #define ERR (-1) 37 38 int uart_init(int fd, int uartBaud); 39 int data_proce(int *recv); 40 41 #endif 42