Serial Communication
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
StartBit DataBit ParityBit StopBit
<<<<<<<< <<<<<<<<<<<<<<<<<<<<<<< <<<<<<<<< <<<<<<<
00 D0 D1 D2 D3 D4 D5 D6 D7 P 01
<<<<<<<< << << << << << << << << <<<<<<<<< <<<<<<<
8, N, 1
+---+ +---+ +=--+ +---+ +----
| | | | | | | | |
TTL | | | | | | | | |
| | | | | | | | |
| | | | | | | | |
----+ +---+ +---+ +---+ +---+
0 1 2 3 4 5 6 7
--- - - - - - - - - ===
L H
--- - - - - - - - - ===
Recommend Standard
-------- ---------------- ---------------- -------- ----------------
RS 0:SPACE 1:MARK Duplex Approx. Distance
-------- ---------------- ---------------- -------- ----------------
TTL Vcc 0V Full 1m
232 +3V ~ +15V -15V ~ -3V Full 10m
485 -6V ~ -2V +2V ~ +6V Half 1200m
-------- ---------------- ---------------- -------- ----------------
EMC 电磁兼容性
├─ EMI 电磁干扰
│ ├─ RE 辐射发射
│ ├─ CE 传导发射
│ ├─ Harmonics 谐波电流
│ └─ Flicker 闪烁
└─ EMS 电磁敏感度
├─ RS 辐射抗扰度
├─ CS 传导抗扰度
├─ ESD 静电抗扰度
├─ EFT/B 电快速瞬变脉冲群
├─ DIP/i 电压跌落/短时中断
├─ PMS 工频磁场抗扰度
└─ Surge 浪涌抗扰度
UART-USB
------- ------- ------- ------------
DiP1 DiP2 SW1 Memo
------- ------- ------- ------------
ON OFF UP USB => TTL
ON OFF UP USB => 232
ON ON UP USB => 485
OFF OFF UP TTL => 232
OFF ON UP TTL => 485
OFF ON DOWN 232 => 485
------- ------- ------- ------------
COM-232
(1) (2) (3) (4) (5)
--- +++ +++ --- +++
DCD RXD TXD DTR GND
--- +++ +++ --- +++
(6) (7) (8) (9)
--- --- --- ---
DSR RTS CTS DEL
--- --- --- ---
Master Transmit-Transparently Comm MTTComm
Slave Transmit-Transparently Comm STTComm
Devices Tree
PC-Win11
├─ ...
└─ 端口 (COM 和 LPT)
├─ Silicon Labs CP210x USB to UART Bridge (COM3)
└─ Silicon Labs CP210x USB to UART Bridge (COM8)
Skin L.U.T
int lutSkin[][6] = {
{IDC_APPLICATION, 1027, 1415, 111, 75, 58},
{IDC_CREATE_DESKTOP, 1002, 1498, 111, 75, 58},
{IDC_CREATE_CAMERA, 1026, 1580, 111, 75, 58},
{IDC_STATIC_CAMERA, 1101, 259, 179, 256, 188},
{IDC_STATIC_STATE_FLOW, 1126, 1417, 180, 245, 176},
{IDC_STATIC_LEFT_RESULT, 1118, 266, 374, 242, 19},
{IDC_BUTTON_LEFT_HOLD_L, 1122, 266, 405, 79, 36},
{IDC_BUTTON_LEFT_HOLD, 1120, 348, 405, 79, 36},
{IDC_BUTTON_LEFT_HOLD_R, 1123, 430, 405, 79, 36},
{IDC_STATIC_RIGHT_RESULT, 1119, 1414, 374, 242, 19},
{IDC_BUTTON_RIGHT_ICSI_L, 1124, 1415, 405, 79, 36},
{IDC_BUTTON_RIGHT_ICSI, 1121, 1498, 405, 79, 36},
{IDC_BUTTON_RIGHT_ICSI_R, 1125, 1580, 405, 79, 36},
{IDC_BUTTON_LEFT_ARROW_L, 1127, 269, 604, 47, 43},
{IDC_BUTTON_LEFT_ARROW_R, 1128, 455, 604, 47, 43},
{IDC_BUTTON_LEFT_ARROW_U, 1129, 362, 460, 49, 43},
{IDC_BUTTON_LEFT_ARROW_D, 1130, 362, 749, 49, 43},
{IDC_SLIDER_LEFT_Z, 1137, 372, 557, 28, 139},
{IDC_SLIDER_LEFT, 1103, 264, 809, 247, 26},
{IDC_BUTTON_LEFT_FUNC1, 1105, 266, 844, 42, 38},
{IDC_BUTTON_LEFT_FUNC2, 1106, 316, 844, 42, 38},
{IDC_BUTTON_LEFT_FUNC3, 1107, 367, 844, 42, 38},
{IDC_BUTTON_LEFT_FUNC4, 1108, 416, 844, 42, 38},
{IDC_BUTTON_LEFT_FUNC5, 1113, 467, 844, 42, 38},
{IDC_BUTTON_RIGHT_ARROW_L, 1133, 1422, 604, 49, 43},
{IDC_BUTTON_RIGHT_ARROW_R, 1134, 1608, 604, 49, 43},
{IDC_BUTTON_RIGHT_ARROW_U, 1131, 1513, 460, 49, 43},
{IDC_BUTTON_RIGHT_ARROW_D, 1132, 1513, 749, 49, 43},
{IDC_SLIDER_RIGHT_Z, 1138, 1524, 557, 28, 139},
{IDC_SLIDER_RIGHT, 1104, 1415, 809, 247, 23},
{IDC_BUTTON_RIGHT_FUNC1, 1109, 1415, 844, 42, 38},
{IDC_BUTTON_RIGHT_FUNC2, 1110, 1466, 844, 42, 38},
{IDC_BUTTON_RIGHT_FUNC3, 1111, 1517, 844, 42, 38},
{IDC_BUTTON_RIGHT_FUNC4, 1112, 1568, 844, 42, 38},
{IDC_BUTTON_RIGHT_FUNC5, 1117, 1617, 844, 42, 38},
{IDC_STATIC_STATE_CENTER, 1116, 262, 904, 1150, 23},
{IDC_STATIC_STATE_RIGHT, 1114, 1414, 904, 247, 23},
};
##############################################################################
# PLEASE DO NOT EDIT THIS FILE !!!
# GB2312
##############################################################################
[system]
os = windows
mode = http
version = V20221226001
author = HC.Union
[time]
elapsed = 5
##############################################################################
# Network Abstraction Layer
##############################################################################
[nal]
server = 192.168.1.201
port = 61883
[watchdog]
channel = /hcunion/mid-linker/watchdog/uplink
##############################################################################
# Left Stick
##############################################################################
[left]
x-screw = 10
y-screw = 10
z-screw = 10
speed = 10
##############################################################################
# Right Stick
##############################################################################
[right]
x-screw = 10
y-screw = 10
z-screw = 10
speed = 10
##############################################################################
:: ===========================================================================
:: PLEASE DO NOT EDIT THIS FILE
:: ===========================================================================
@curl -o NUL -s -w "\n%1 \nConnect :\t%%{time_connect}\nTotal : \t%%{time_total}\nDownload : \t%%{speed_download}\n\n" %1
:: ===========================================================================
IDC_STATIC_CAMERA 8,51 144x92
IDC_STATIC_DESKTOP 160,51 467x314
#define STATE_HEADER (_T(" "))
#define SYSAPP ((CRemoteClientApp *)AfxGetApp())
CString CRemoteClientApp::GetHome()
{
CString strTmp;
GetModuleFileName(NULL, strTmp.GetBufferSetLength(MAX_PATH + 1), MAX_PATH);
strTmp.ReleaseBuffer();
int nPos = strTmp.ReverseFind('\\');
strTmp = strTmp.Left(nPos);
return strTmp;
}
void CRemoteClientApp::notifyMessage(CString context)
{
CString strTmp;
CWnd* pWnd = SYSAPP->m_pMainWnd->GetDlgItem(IDC_STATIC_STATE_CENTER);
strTmp = STATE_HEADER + context;
pWnd->SetWindowTextW(strTmp);
}
if (TRUE) {
RECT rect;
GetDlgItem(IDC_STATIC_CAMERA)->GetWindowRect(&rect);
ScreenToClient(&rect);
}
if (TRUE) {
RECT rect;
GetDlgItem(IDC_STATIC_DESKTOP)->GetWindowRect(&rect);
ScreenToClient(&rect);
}
if (TRUE) {
int cx, cy;
cx = GetSystemMetrics(SM_CXSCREEN);
cy = GetSystemMetrics(SM_CYSCREEN);
CRect rect;
rect.BottomRight() = CPoint(cx, cy);
rect.TopLeft() = CPoint(0, 0);
MoveWindow(&rect);
}
int64_t getTime(void)
{
FILETIME ft;
GetSystemTimeAsFileTime(&ft);
return ((((int64_t)ft.dwHighDateTime) << 8) + ft.dwLowDateTime) / 10000;
}
CString nowTime()
{
CString reuslt;
SYSTEMTIME st;
GetLocalTime(&st);
reuslt.Format(_T("%.4d-%.2d-%.2d %.2d:%.2d:%.2d.%.3d"), st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);
return reuslt;
}
CStringArray* SplitString(CString datum, char delimiter)
{
CStringArray* strArray = new CStringArray();
CString strTmp;
strTmp = datum;
int nPos = 0;
while (nPos != -1) {
nPos = strTmp.Find(delimiter);
if (nPos == -1) {
break;
}
strArray->Add(strTmp.Left(nPos));
strTmp = strTmp.Mid(nPos + 1, strTmp.GetLength());
}
strArray->Add(strTmp);
return strArray;
}
252x173 => 230x173 ==> 252x190
c:\dbin\comm>mode
设备状态 COM3:
----------
波特率: 1200
奇偶校验: None
数据位: 7
停止位: 1
超时: ON
XON/XOFF: OFF
CTS 握手: OFF
DSR 握手: OFF
DSR 敏感度: OFF
DTR 电路: ON
RTS 电路: ON
设备状态 COM8:
----------
波特率: 1200
奇偶校验: None
数据位: 7
停止位: 1
超时: OFF
XON/XOFF: OFF
CTS 握手: OFF
DSR 握手: OFF
DSR 敏感度: OFF
DTR 电路: OFF
RTS 电路: OFF
enum tt_side_def {
TT_UNKNOWN = 0,
TT_SIDE_LEFT = 10,
TT_SIDE_RIGHT = 100,
};
tt_side_def ttSide = TT_UNKNOWN;
if (strToken.CompareNoCase(_T("Left")) == 0) {
ttSide = TT_SIDE_LEFT;
}
if (strToken.CompareNoCase(_T("Right")) == 0) {
ttSide = TT_SIDE_RIGHT;
}
if (ttSide != TT_UNKNOWN) {
// TODO
}
mosquitto
/home/hclink>mosquitto --help
mosquitto version 1.6.10
mosquitto is an MQTT v3.1.1 broker.
Usage: mosquitto [-c config_file] [-d] [-h] [-p port]
-c : specify the broker config file.
-d : put the broker into the background after starting.
-h : display this help.
-p : start the broker listening on the specified port.
Not recommended in conjunction with the -c option.
-v : verbose mode - enable all logging types. This overrides
any logging options given in the config file.
See http://mosquitto.org/ for more information.
mosquitto
C:\Programs\mosquitto>mosquitto --help
mosquitto version 2.0.9
mosquitto is an MQTT v5.0/v3.1.1/v3.1 broker.
Usage: mosquitto [-c config_file] [-d] [-h] [-p port]
-c : specify the broker config file.
-d : put the broker into the background after starting.
-h : display this help.
-p : start the broker listening on the specified port.
Not recommended in conjunction with the -c option.
-v : verbose mode - enable all logging types. This overrides
any logging options given in the config file.
See https://mosquitto.org/ for more information.
mosquitto_pub
C:\Programs\mosquitto>mosquitto_pub --help
mosquitto_pub is a simple mqtt client that will publish a message on a single topic and exit.
mosquitto_pub version 2.0.9 running on libmosquitto 2.0.9.
Usage: mosquitto_pub {[-h host] [--unix path] [-p port] [-u username] [-P password] -t topic | -L URL}
{-f file | -l | -n | -m message}
[-c] [-k keepalive] [-q qos] [-r] [--repeat N] [--repeat-delay time] [-x session-expiry]
[-A bind_address] [--nodelay]
[-i id] [-I id_prefix]
[-d] [--quiet]
[-M max_inflight]
[-u username [-P password]]
[--will-topic [--will-payload payload] [--will-qos qos] [--will-retain]]
[{--cafile file | --capath dir} [--cert file] [--key file]
[--ciphers ciphers] [--insecure]
[--tls-alpn protocol]
[--tls-engine engine] [--keyform keyform] [--tls-engine-kpass-sha1]]
[--tls-use-os-certs]
[--psk hex-key --psk-identity identity [--ciphers ciphers]]
[--proxy socks-url]
[--property command identifier value]
[-D command identifier value]
mosquitto_pub --help
-A : bind the outgoing socket to this host/ip address. Use to control which interface
the client communicates over.
-d : enable debug messages.
-c : disable clean session/enable persistent client mode
When this argument is used, the broker will be instructed not to clean existing sessions
for the same client id when the client connects, and sessions will never expire when the
client disconnects. MQTT v5 clients can change their session expiry interval with the -x
argument.
-D : Define MQTT v5 properties. See the documentation for more details.
-f : send the contents of a file as the message.
-h : mqtt host to connect to. Defaults to localhost.
-i : id to use for this client. Defaults to mosquitto_pub_ appended with the process id.
-I : define the client id as id_prefix appended with the process id. Useful for when the
broker is using the clientid_prefixes option.
-k : keep alive in seconds for this client. Defaults to 60.
-L : specify user, password, hostname, port and topic as a URL in the form:
mqtt(s)://[username[:password]@]host[:port]/topic
-l : read messages from stdin, sending a separate message for each line.
-m : message payload to send.
-M : the maximum inflight messages for QoS 1/2..
-n : send a null (zero length) message.
-p : network port to connect to. Defaults to 1883 for plain MQTT and 8883 for MQTT over TLS.
-P : provide a password
-q : quality of service level to use for all messages. Defaults to 0.
-r : message should be retained.
-s : read message from stdin, sending the entire input as a message.
-t : mqtt topic to publish to.
-u : provide a username
-V : specify the version of the MQTT protocol to use when connecting.
Can be mqttv5, mqttv311 or mqttv31. Defaults to mqttv311.
-x : Set the session-expiry-interval property on the CONNECT packet. Applies to MQTT v5
clients only. Set to 0-4294967294 to specify the session will expire in that many
seconds after the client disconnects, or use -1, 4294967295, or 鈭?for a session
that does not expire. Defaults to -1 if -c is also given, or 0 if -c not given.
--help : display this message.
--nodelay : disable Nagle's algorithm, to reduce socket sending latency at the possible
expense of more packets being sent.
--quiet : don't print error messages.
--repeat : if publish mode is -f, -m, or -s, then repeat the publish N times.
--repeat-delay : if using --repeat, wait time seconds between publishes. Defaults to 0.
--unix : connect to a broker through a unix domain socket instead of a TCP socket,
e.g. /tmp/mosquitto.sock
--will-payload : payload for the client Will, which is sent by the broker in case of
unexpected disconnection. If not given and will-topic is set, a zero
length message will be sent.
--will-qos : QoS level for the client Will.
--will-retain : if given, make the client Will retained.
--will-topic : the topic on which to publish the client Will.
--cafile : path to a file containing trusted CA certificates to enable encrypted
communication.
--capath : path to a directory containing trusted CA certificates to enable encrypted
communication.
--cert : client certificate for authentication, if required by server.
--key : client private key for authentication, if required by server.
--keyform : keyfile type, can be either "pem" or "engine".
--ciphers : openssl compatible list of TLS ciphers to support.
--tls-version : TLS protocol version, can be one of tlsv1.3 tlsv1.2 or tlsv1.1.
Defaults to tlsv1.2 if available.
--insecure : do not check that the server certificate hostname matches the remote
hostname. Using this option means that you cannot be sure that the
remote host is the server you wish to connect to and so is insecure.
Do not use this option in a production environment.
--tls-engine : If set, enables the use of a TLS engine device.
--tls-engine-kpass-sha1 : SHA1 of the key password to be used with the selected SSL engine.
--tls-use-os-certs : Load and trust OS provided CA certificates.
--psk : pre-shared-key in hexadecimal (no leading 0x) to enable TLS-PSK mode.
--psk-identity : client identity string for TLS-PSK mode.
--proxy : SOCKS5 proxy URL of the form:
socks5h://[username[:password]@]hostname[:port]
Only "none" and "username" authentication is supported.
See https://mosquitto.org/ for more information.
mosquitto_sub
C:\Programs\mosquitto>mosquitto_sub --help
mosquitto_sub is a simple mqtt client that will subscribe to a set of topics and print all messages it receives.
mosquitto_sub version 2.0.9 running on libmosquitto 2.0.9.
Usage: mosquitto_sub {[-h host] [--unix path] [-p port] [-u username] [-P password] -t topic | -L URL [-t topic]}
[-c] [-k keepalive] [-q qos] [-x session-expiry-interval]
[-C msg_count] [-E] [-R] [--retained-only] [--remove-retained] [-T filter_out] [-U topic ...]
[-F format]
[-A bind_address] [--nodelay]
[-i id] [-I id_prefix]
[-d] [-N] [--quiet] [-v]
[--will-topic [--will-payload payload] [--will-qos qos] [--will-retain]]
[{--cafile file | --capath dir} [--cert file] [--key file]
[--ciphers ciphers] [--insecure]
[--tls-alpn protocol]
[--tls-engine engine] [--keyform keyform] [--tls-engine-kpass-sha1]]
[--tls-use-os-certs]
[--psk hex-key --psk-identity identity [--ciphers ciphers]]
[--proxy socks-url]
[-D command identifier value]
mosquitto_sub --help
-A : bind the outgoing socket to this host/ip address. Use to control which interface
the client communicates over.
-c : disable clean session/enable persistent client mode
When this argument is used, the broker will be instructed not to clean existing sessions
for the same client id when the client connects, and sessions will never expire when the
client disconnects. MQTT v5 clients can change their session expiry interval with the -x
argument.
-C : disconnect and exit after receiving the 'msg_count' messages.
-d : enable debug messages.
-D : Define MQTT v5 properties. See the documentation for more details.
-E : Exit once all subscriptions have been acknowledged by the broker.
-F : output format.
-h : mqtt host to connect to. Defaults to localhost.
-i : id to use for this client. Defaults to mosquitto_sub_ appended with the process id.
-I : define the client id as id_prefix appended with the process id. Useful for when the
broker is using the clientid_prefixes option.
-k : keep alive in seconds for this client. Defaults to 60.
-L : specify user, password, hostname, port and topic as a URL in the form:
mqtt(s)://[username[:password]@]host[:port]/topic
-N : do not add an end of line character when printing the payload.
-p : network port to connect to. Defaults to 1883 for plain MQTT and 8883 for MQTT over TLS.
-P : provide a password
-q : quality of service level to use for the subscription. Defaults to 0.
-R : do not print stale messages (those with retain set).
-t : mqtt topic to subscribe to. May be repeated multiple times.
-T : topic string to filter out of results. May be repeated.
-u : provide a username
-U : unsubscribe from a topic. May be repeated.
-v : print published messages verbosely.
-V : specify the version of the MQTT protocol to use when connecting.
Can be mqttv5, mqttv311 or mqttv31. Defaults to mqttv311.
-x : Set the session-expiry-interval property on the CONNECT packet. Applies to MQTT v5
clients only. Set to 0-4294967294 to specify the session will expire in that many
seconds after the client disconnects, or use -1, 4294967295, or 鈭?for a session
that does not expire. Defaults to -1 if -c is also given, or 0 if -c not given.
--help : display this message.
--nodelay : disable Nagle's algorithm, to reduce socket sending latency at the possible
expense of more packets being sent.
--pretty : print formatted output rather than minimised output when using the
JSON output format option.
--quiet : don't print error messages.
--random-filter : only print a percentage of received messages. Set to 100 to have all
messages printed, 50.0 to have half of the messages received on average
printed, and so on.
--retained-only : only handle messages with the retained flag set, and exit when the
first non-retained message is received.
--remove-retained : send a message to the server to clear any received retained messages
Use -T to filter out messages you do not want to be cleared.
--unix : connect to a broker through a unix domain socket instead of a TCP socket,
e.g. /tmp/mosquitto.sock
--will-payload : payload for the client Will, which is sent by the broker in case of
unexpected disconnection. If not given and will-topic is set, a zero
length message will be sent.
--will-qos : QoS level for the client Will.
--will-retain : if given, make the client Will retained.
--will-topic : the topic on which to publish the client Will.
--cafile : path to a file containing trusted CA certificates to enable encrypted
certificate based communication.
--capath : path to a directory containing trusted CA certificates to enable encrypted
communication.
--cert : client certificate for authentication, if required by server.
--key : client private key for authentication, if required by server.
--keyform : keyfile type, can be either "pem" or "engine".
--ciphers : openssl compatible list of TLS ciphers to support.
--tls-version : TLS protocol version, can be one of tlsv1.3 tlsv1.2 or tlsv1.1.
Defaults to tlsv1.2 if available.
--insecure : do not check that the server certificate hostname matches the remote
hostname. Using this option means that you cannot be sure that the
remote host is the server you wish to connect to and so is insecure.
Do not use this option in a production environment.
--tls-engine : If set, enables the use of a SSL engine device.
--tls-engine-kpass-sha1 : SHA1 of the key password to be used with the selected SSL engine.
--tls-use-os-certs : Load and trust OS provided CA certificates.
--psk : pre-shared-key in hexadecimal (no leading 0x) to enable TLS-PSK mode.
--psk-identity : client identity string for TLS-PSK mode.
--proxy : SOCKS5 proxy URL of the form:
socks5h://[username[:password]@]hostname[:port]
Only "none" and "username" authentication is supported.
See https://mosquitto.org/ for more information.