mikroSDK Reference Manual
cp210x.h
1
/*
2
* The MIT License (MIT)
3
*
4
* Copyright (c) 2023 Ha Thach (thach@tinyusb.org) for Adafruit Industries
5
*
6
* Permission is hereby granted, free of charge, to any person obtaining a copy
7
* of this software and associated documentation files (the "Software"), to deal
8
* in the Software without restriction, including without limitation the rights
9
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
* copies of the Software, and to permit persons to whom the Software is
11
* furnished to do so, subject to the following conditions:
12
*
13
* The above copyright notice and this permission notice shall be included in
14
* all copies or substantial portions of the Software.
15
*
16
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
* THE SOFTWARE.
23
*/
24
25
#ifndef TUSB_CP210X_H
26
#define TUSB_CP210X_H
27
28
// Protocol details can be found at AN571: CP210x Virtual COM Port Interface
29
// https://www.silabs.com/documents/public/application-notes/AN571.pdf
30
31
#define TU_CP210X_VID 0x10C4
32
#define TU_CP210X_PID_LIST \
33
0xEA60, 0xEA70
34
35
/* Config request codes */
36
#define CP210X_IFC_ENABLE 0x00
37
#define CP210X_SET_BAUDDIV 0x01
38
#define CP210X_GET_BAUDDIV 0x02
39
#define CP210X_SET_LINE_CTL 0x03
// Set parity, data bits, stop bits
40
#define CP210X_GET_LINE_CTL 0x04
41
#define CP210X_SET_BREAK 0x05
42
#define CP210X_IMM_CHAR 0x06
43
#define CP210X_SET_MHS 0x07
// Set DTR, RTS
44
#define CP210X_GET_MDMSTS 0x08
// Get modem status (DTR, RTS, CTS, DSR, RI, DCD)
45
#define CP210X_SET_XON 0x09
46
#define CP210X_SET_XOFF 0x0A
47
#define CP210X_SET_EVENTMASK 0x0B
48
#define CP210X_GET_EVENTMASK 0x0C
49
#define CP210X_SET_CHAR 0x0D
50
#define CP210X_GET_CHARS 0x0E
51
#define CP210X_GET_PROPS 0x0F
52
#define CP210X_GET_COMM_STATUS 0x10
53
#define CP210X_RESET 0x11
54
#define CP210X_PURGE 0x12
55
#define CP210X_SET_FLOW 0x13
56
#define CP210X_GET_FLOW 0x14
57
#define CP210X_EMBED_EVENTS 0x15
58
#define CP210X_GET_EVENTSTATE 0x16
59
#define CP210X_SET_CHARS 0x19
60
#define CP210X_GET_BAUDRATE 0x1D
61
#define CP210X_SET_BAUDRATE 0x1E
62
#define CP210X_VENDOR_SPECIFIC 0xFF
// GPIO, Recipient must be Device
63
64
#endif
//TUSB_CP210X_H