#Diagram demonstrating how to build a command link for an I2C master to send n bytes to a slave blockdiag i2c-command-link-master-write { # global properties span_width = 5; span_height = 5; node_height = 25; default_group_color = lightgrey; class spacer [shape=none, width=10]; class cmdlink [colwidth=2, width=180]; class cjoint [shape=none, width=40]; # all the rows 0 -- a0 -- f0 [style=none]; 1 -- a1 -- b1 -- c1 -- d1 -- e1 -- f1 -- g1 -- h1 [style=none]; 2 -- a2 -- b2 -- c2 -- d2 -- e2 -- f2 -- g2 [style=none]; 3 -- a3 -- d3 -- f3 [style=none]; 4 -- a4 [style=none]; 5 -- a5 [style=none]; 6 -- a6 -- c6 [style=none]; 7 -- a7 -- c7 -- d7 [style=none]; 8 -- a8 -- c8 -- f8 [style=none]; 9 -- a9 -- c9 -- h9 [style=none]; 10 -- a10 [style=none]; 11 -- a11 [style=none]; # separator row 3, a3, d3, f3 [shape=none, height=5]; # tuning node properties and connections 0 [class=spacer]; a0 [shape=none, colwidth=5]; f0 [shape=note, colwidth=2]; 1 [class=spacer]; a1 [shape=none]; b1; c1 [width=40]; e1 [shape=none, width=30]; g1 [shape=none, width=30]; h1 [width=40]; 2 [class=spacer]; a2 [shape=none]; b2; c2 [class=cjoint]; d2 [shape=none]; e2 [width=30]; f2 [shape=none]; g2 [width=30]; 3 [class=spacer]; a3 [shape=none, colwidth=3]; d3 [colwidth=2]; f3 [colwidth=2]; 4 [class=spacer]; a4 [class=cmdlink] 5 [class=spacer]; a5 [class=cmdlink]; 6 [class=spacer]; a6 [class=cmdlink]; c6 [class=cjoint]; a6 -- c6 [style=solid]; c6 -- c2 -> c1 [folded]; 7 [class=spacer]; a7 [class=cmdlink]; c7 [class=cjoint]; d7 [shape=none, colwidth=2]; a7 -- c7 -- d7 [style=solid]; d7 -> d3 [folded]; 8 [class=spacer]; a8 [class=cmdlink]; c8 [class=cjoint, colwidth=3]; f8 [shape=none, colwidth=2]; a8 -- c8 -- f8 [style=solid]; f8 -> f3 [folded]; 9 [class=spacer]; a9 [class=cmdlink]; c9 [class=cjoint, colwidth=5]; h9 [shape=none, width=40]; a9 -- c9 -- h9 [style=solid]; h9 -> h1 [folded]; 10 [class=spacer]; a10 [class=cmdlink]; 11 [class=spacer]; a11 [class=cmdlink]; # labels f0 [label="Data n times", shape=note, color=yellow]; b1 [label=Master, shape=note, color=lightyellow]; c1 [label=START]; d1 [label="Slave Address"]; f1 [label=Data]; h1 [label=STOP]; b2 [label=Slave, shape=note, color=lightyellow]; e2 [label=ACK]; g2 [label=ACK]; a4 [shape=note, label=Commands, color=yellow]; a5 [label="cmd = i2c_cmd_link_create()", numbered = 1]; a6 [label="i2c_master_start(cmd)", numbered = 2]; a7 [label="i2c_master_write_byte(cmd, Address, ACK)", numbered = 3]; a8 [label="i2c_master_write(Data, n, ACK)", numbered = 4]; a9 [label="i2c_master_stop(cmd)", numbered = 5]; a10 [label="i2c_master_cmd_begin(I2c_port, cmd, wait)", numbered = 6]; a11 [label="i2c_cmd_link_delete(cmd)", numbered = 7]; # Slave Address group { d1; e1; } group { d2; e2; d3; } # Data x n times group { f1; g1;} group { f2; g2; f3; } }