PlantUML 绘图

官网

示例

绘制时序图

USB 枚举过程 PlantUML 源码

c 复制代码
@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 源码

c 复制代码
@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

效果

相关推荐
lipengxs8 天前
写 README/技术方案时被 Ai 生成的 PlantUml/Mermaid 折腾烦了,做了个 预览小工具
ai·预览·plantuml·设计图
吴声子夜歌13 天前
PlantUML——思维导图
思维导图·plantuml
吴声子夜歌13 天前
PlantUML——实体关系图
plantuml·实体关系图
吴声子夜歌14 天前
PlantUML——通用命令
plantuml
吴声子夜歌14 天前
PlantUML——部署图
plantuml·部署图
吴声子夜歌14 天前
PlantUML——活动图新语法
plantuml·活动图
吴声子夜歌14 天前
PlantUML——组件图
plantuml·组件图
吴声子夜歌15 天前
PlantUML——定时图
plantuml·定时图
吴声子夜歌15 天前
PlantUML——状态图
uml·plantuml·状态图
吴声子夜歌16 天前
PlantUML——序列图
uml·plantuml·序列图