-
Notifications
You must be signed in to change notification settings - Fork 17
/
kserial_conf.h
91 lines (75 loc) · 2.67 KB
/
kserial_conf.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
82
83
84
85
86
87
88
89
90
91
/**
* __ ____
* / /__ _ __ / __/ __
* / //_/(_)/ /_ / / ___ ____ ___ __ __ / /_
* / ,< / // __/_\ \ / _ \ / __// _ \/ // // __/
* /_/|_|/_/ \__//___// .__//_/ \___/\_,_/ \__/
* /_/ github.com/KitSprout
*
* @file kserial_conf.h
* @author KitSprout
* @brief
*
*/
/* Define to prevent recursive inclusion ---------------------------------------------------*/
#ifndef __KSERIAL_CONF_H
#define __KSERIAL_CONF_H
#ifdef __cplusplus
extern "C" {
#endif
/* Define ----------------------------------------------------------------------------------*/
#ifndef KSERIAL_SEND_ENABLE
#define KSERIAL_SEND_ENABLE (1U)
#ifndef KS_MAX_SEND_BUFFER_SIZE
#define KS_MAX_SEND_BUFFER_SIZE (4096 + 32)
#endif
#endif
#ifndef KSERIAL_RECV_ENABLE
#define KSERIAL_RECV_ENABLE (1U)
#ifndef KS_MAX_RECV_BUFFER_SIZE
#define KS_MAX_RECV_BUFFER_SIZE (4096 + 1024 + 32)
#endif
#endif
#ifndef KSERIAL_RECV_TREAD_ENABLE
#define KSERIAL_RECV_TREAD_ENABLE (1U)
#define KSERIAL_MAX_PACKET_LENS (4096)
#define KSERIAL_RECV_PACKET_BUFFER_LENS (64 * 1024)
#endif
#ifndef KSERIAL_CMD_ENABLE
#define KSERIAL_CMD_ENABLE (1U)
#endif
#if KSERIAL_RECV_TREAD_ENABLE
#if !(KSERIAL_RECV_ENABLE)
#error "Need to enable recv"
#endif
#endif
#if KSERIAL_CMD_ENABLE
#if !(KSERIAL_SEND_ENABLE && KSERIAL_RECV_ENABLE)
#error "Need to enable send and recv"
#endif
#endif
#define KSERIAL_TYPE_LENS (16)
/* Includes --------------------------------------------------------------------------------*/
#if (KSERIAL_SEND_ENABLE || KSERIAL_RECV_ENABLE)
#include "serial.h"
#endif
/* Macro -----------------------------------------------------------------------------------*/
#if KSERIAL_SEND_ENABLE
#ifndef kserial_send
#define kserial_send(__DATA, __LENS) serial_send_data(&s, __DATA, __LENS)
#define kserial_sendbyte(__DATA) serial_send_byte(&s, __DATA)
#endif
#endif
#if KSERIAL_RECV_ENABLE
#define kserial_recv(__DATA, __LENS) serial_recv_data(&s, __DATA, __LENS)
#define kserial_recvbyte() serial_recv_byte(&s)
#define kserial_flush_recv() serial_flush(&s)
#endif
#if (KSERIAL_SEND_ENABLE || KSERIAL_RECV_ENABLE)
#define kserial_delay(__MS) serial_delay(__MS)
#endif
#ifdef __cplusplus
}
#endif
#endif
/*************************************** END OF FILE ****************************************/