官网
- https://plantuml.com/zh/
示例
绘制时序图
USB 枚举过程 PlantUML 源码
@startuml
host <-- device : device insert host
note right : step 1
host -> device : get speed, reset, speed check
note right : step 2
host -> device : get device descriptors
note right : step 3
device --> host : return device descriptors
note right : step 4
host -> device : reset again
note right : step 5
host -> device : set device address
note right : step 6
host -> device : use new address get device descriptors(real get)
note right : step 7
device --> host : return device descriptors
note right : step 8
host -> device : get config descriptors or get config descriptors sets
note right : step 9
device --> host : return config descriptors or config descriptors sets
note right : step 10
host -> device : get string descriptors
note right : step 11
device --> host : return string descriptors
note right : step 12
host -> device : get class special descriptors
note right : step 13
device --> host : return class special descriptors
note right : step 14
@enduml
效果
绘制定时图片
USB 字节序 PlantUML 源码
@startuml
header Page 1
footer Page 1 of 1
<style>
timingDiagram {
.red
{
Linecolor red
}
.blue
{
Linecolor blue
}
}
</style>
concise "status" as status
concise "DATA" as data
binary "DP" as DP <<red>>
binary "DM" as DM <<blue>>
@0
data is "SE0"
DP is low
DM is low
@2
data is "idle"
DP is high
DM is low
@6
data is "0"
status is "SYNC 0x80"
DP is low
DM is high
@7
data is "0"
DP is high
DM is low
@8
data is "0"
DP is low
DM is high
@9
data is "0"
DP is high
DM is low
@10
data is "0"
DP is low
DM is high
@11
data is "0"
DP is high
DM is low
@12
data is "0"
DP is low
DM is high
@13
data is "1"
DP is low
DM is high
@14
data is "1"
status is "PID SETUP 0x2D"
DP is low
DM is high
@15
data is "0"
DP is high
DM is low
@16
data is "1"
DP is high
DM is low
@17
data is "1"
DP is high
DM is low
@18
data is "0"
DP is low
DM is high
@19
data is "1"
DP is low
DM is high
@20
data is "0"
DP is high
DM is low
@21
data is "0"
DP is low
DM is high
@22
data is "0"
status is "other"
DP is high
DM is low
@enduml
效果