i2c-command-link-master-write-blockdiag.diag 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #Diagram demonstrating how to build a command link for an I2C master to send n bytes to a slave
  2. blockdiag i2c-command-link-master-write {
  3. # global properties
  4. span_width = 5;
  5. span_height = 5;
  6. node_height = 25;
  7. default_group_color = lightgrey;
  8. class spacer [shape=none, width=10];
  9. class cmdlink [colwidth=2, width=180];
  10. class cjoint [shape=none, width=40];
  11. # all the rows
  12. 0 -- a0 -- f0 [style=none];
  13. 1 -- a1 -- b1 -- c1 -- d1 -- e1 -- f1 -- g1 -- h1 [style=none];
  14. 2 -- a2 -- b2 -- c2 -- d2 -- e2 -- f2 -- g2 [style=none];
  15. 3 -- a3 -- d3 -- f3 [style=none];
  16. 4 -- a4 [style=none];
  17. 5 -- a5 [style=none];
  18. 6 -- a6 -- c6 [style=none];
  19. 7 -- a7 -- c7 -- d7 [style=none];
  20. 8 -- a8 -- c8 -- f8 [style=none];
  21. 9 -- a9 -- c9 -- h9 [style=none];
  22. 10 -- a10 [style=none];
  23. 11 -- a11 [style=none];
  24. # separator row
  25. 3, a3, d3, f3 [shape=none, height=5];
  26. # tuning node properties and connections
  27. 0 [class=spacer]; a0 [shape=none, colwidth=5]; f0 [shape=note, colwidth=2];
  28. 1 [class=spacer]; a1 [shape=none]; b1; c1 [width=40]; e1 [shape=none, width=30]; g1 [shape=none, width=30]; h1 [width=40];
  29. 2 [class=spacer]; a2 [shape=none]; b2; c2 [class=cjoint]; d2 [shape=none]; e2 [width=30]; f2 [shape=none]; g2 [width=30];
  30. 3 [class=spacer]; a3 [shape=none, colwidth=3]; d3 [colwidth=2]; f3 [colwidth=2];
  31. 4 [class=spacer]; a4 [class=cmdlink]
  32. 5 [class=spacer]; a5 [class=cmdlink];
  33. 6 [class=spacer]; a6 [class=cmdlink]; c6 [class=cjoint]; a6 -- c6 [style=solid]; c6 -- c2 -> c1 [folded];
  34. 7 [class=spacer]; a7 [class=cmdlink]; c7 [class=cjoint]; d7 [shape=none, colwidth=2]; a7 -- c7 -- d7 [style=solid]; d7 -> d3 [folded];
  35. 8 [class=spacer]; a8 [class=cmdlink]; c8 [class=cjoint, colwidth=3]; f8 [shape=none, colwidth=2]; a8 -- c8 -- f8 [style=solid]; f8 -> f3 [folded];
  36. 9 [class=spacer]; a9 [class=cmdlink]; c9 [class=cjoint, colwidth=5]; h9 [shape=none, width=40]; a9 -- c9 -- h9 [style=solid]; h9 -> h1 [folded];
  37. 10 [class=spacer]; a10 [class=cmdlink];
  38. 11 [class=spacer]; a11 [class=cmdlink];
  39. # labels
  40. f0 [label="Data n times", shape=note, color=yellow];
  41. b1 [label=Master, shape=note, color=lightyellow]; c1 [label=START]; d1 [label="Slave Address"]; f1 [label=Data]; h1 [label=STOP];
  42. b2 [label=Slave, shape=note, color=lightyellow]; e2 [label=ACK]; g2 [label=ACK];
  43. a4 [shape=note, label=Commands, color=yellow];
  44. a5 [label="cmd = i2c_cmd_link_create()", numbered = 1];
  45. a6 [label="i2c_master_start(cmd)", numbered = 2];
  46. a7 [label="i2c_master_write_byte(cmd, Address, ACK)", numbered = 3];
  47. a8 [label="i2c_master_write(Data, n, ACK)", numbered = 4];
  48. a9 [label="i2c_master_stop(cmd)", numbered = 5];
  49. a10 [label="i2c_master_cmd_begin(I2c_port, cmd, wait)", numbered = 6];
  50. a11 [label="i2c_cmd_link_delete(cmd)", numbered = 7];
  51. # Slave Address
  52. group { d1; e1; }
  53. group { d2; e2; d3; }
  54. # Data x n times
  55. group { f1; g1;}
  56. group { f2; g2; f3; }
  57. }