- Notifications
You must be signed in to change notification settings - Fork 7.6k
/
Copy pathesp32-hal-uart.h
81 lines (65 loc) · 2.26 KB
/
esp32-hal-uart.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndefMAIN_ESP32_HAL_UART_H_
#defineMAIN_ESP32_HAL_UART_H_
#ifdef__cplusplus
extern"C" {
#endif
#include<stdint.h>
#include<stdbool.h>
#include<stdlib.h>
#defineSERIAL_5N1 0x8000010
#defineSERIAL_6N1 0x8000014
#defineSERIAL_7N1 0x8000018
#defineSERIAL_8N1 0x800001c
#defineSERIAL_5N2 0x8000030
#defineSERIAL_6N2 0x8000034
#defineSERIAL_7N2 0x8000038
#defineSERIAL_8N2 0x800003c
#defineSERIAL_5E1 0x8000012
#defineSERIAL_6E1 0x8000016
#defineSERIAL_7E1 0x800001a
#defineSERIAL_8E1 0x800001e
#defineSERIAL_5E2 0x8000032
#defineSERIAL_6E2 0x8000036
#defineSERIAL_7E2 0x800003a
#defineSERIAL_8E2 0x800003e
#defineSERIAL_5O1 0x8000013
#defineSERIAL_6O1 0x8000017
#defineSERIAL_7O1 0x800001b
#defineSERIAL_8O1 0x800001f
#defineSERIAL_5O2 0x8000033
#defineSERIAL_6O2 0x8000037
#defineSERIAL_7O2 0x800003b
#defineSERIAL_8O2 0x800003f
structuart_struct_t;
typedefstructuart_struct_tuart_t;
uart_t*uartBegin(uint8_tuart_nr, uint32_tbaudrate, uint32_tconfig, int8_trxPin, int8_ttxPin, uint16_tqueueLen, boolinverted);
voiduartEnd(uart_t*uart);
uint32_tuartAvailable(uart_t*uart);
uint32_tuartAvailableForWrite(uart_t*uart);
uint8_tuartRead(uart_t*uart);
uint8_tuartPeek(uart_t*uart);
voiduartWrite(uart_t*uart, uint8_tc);
voiduartWriteBuf(uart_t*uart, constuint8_t*data, size_tlen);
voiduartFlush(uart_t*uart);
voiduartSetBaudRate(uart_t*uart, uint32_tbaud_rate);
uint32_tuartGetBaudRate(uart_t*uart);
size_tuartResizeRxBuffer(uart_t*uart, size_tnew_size);
voiduartSetDebug(uart_t*uart);
intuartGetDebug();
unsigned longuartDetectBaudrate(uart_t*uart);
#ifdef__cplusplus
}
#endif
#endif/* MAIN_ESP32_HAL_UART_H_ */