scope.grc 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. options:
  2. parameters:
  3. author: ''
  4. category: '[GRC Hier Blocks]'
  5. cmake_opt: ''
  6. comment: ''
  7. copyright: ''
  8. description: ''
  9. gen_cmake: 'On'
  10. gen_linking: dynamic
  11. generate_options: qt_gui
  12. hier_block_src_path: '.:'
  13. id: scope
  14. max_nouts: '0'
  15. output_language: python
  16. placement: (0,0)
  17. qt_qss_theme: ''
  18. realtime_scheduling: ''
  19. run: 'True'
  20. run_command: '{python} -u {filename}'
  21. run_options: prompt
  22. sizing_mode: fixed
  23. thread_safe_setters: ''
  24. title: Arduino Voltmeter / Oscilloscope
  25. window_size: ''
  26. states:
  27. bus_sink: false
  28. bus_source: false
  29. bus_structure: null
  30. coordinate: [20, 20]
  31. rotation: 0
  32. state: enabled
  33. blocks:
  34. - name: sample_rate_hz
  35. id: variable
  36. parameters:
  37. comment: ''
  38. value: '11678.3'
  39. states:
  40. bus_sink: false
  41. bus_source: false
  42. bus_structure: null
  43. coordinate: [408, 37]
  44. rotation: 0
  45. state: enabled
  46. - name: blocks_message_debug_0
  47. id: blocks_message_debug
  48. parameters:
  49. affinity: ''
  50. alias: ''
  51. comment: ''
  52. states:
  53. bus_sink: false
  54. bus_source: false
  55. bus_structure: null
  56. coordinate: [1130, 378]
  57. rotation: 0
  58. state: true
  59. - name: blocks_probe_rate_0
  60. id: blocks_probe_rate
  61. parameters:
  62. affinity: ''
  63. alias: ''
  64. alpha: '0.15'
  65. comment: ''
  66. maxoutbuf: '0'
  67. minoutbuf: '0'
  68. mintime: '10000.0'
  69. type: byte
  70. vlen: '1'
  71. states:
  72. bus_sink: false
  73. bus_source: false
  74. bus_structure: null
  75. coordinate: [530, 342]
  76. rotation: 0
  77. state: true
  78. - name: qtgui_time_raster_sink_x_0
  79. id: qtgui_time_raster_sink_x
  80. parameters:
  81. affinity: ''
  82. alias: ''
  83. alpha1: '1.0'
  84. alpha10: '1.0'
  85. alpha2: '1.0'
  86. alpha3: '1.0'
  87. alpha4: '1.0'
  88. alpha5: '1.0'
  89. alpha6: '1.0'
  90. alpha7: '1.0'
  91. alpha8: '1.0'
  92. alpha9: '1.0'
  93. axislabels: 'True'
  94. color1: '2'
  95. color10: '0'
  96. color2: '0'
  97. color3: '0'
  98. color4: '0'
  99. color5: '0'
  100. color6: '0'
  101. color7: '0'
  102. color8: '0'
  103. color9: '0'
  104. comment: ''
  105. grid: 'True'
  106. gui_hint: ''
  107. label1: ''
  108. label10: ''
  109. label2: ''
  110. label3: ''
  111. label4: ''
  112. label5: ''
  113. label6: ''
  114. label7: ''
  115. label8: ''
  116. label9: ''
  117. mult: '[]'
  118. name: '""'
  119. ncols: int(sample_rate_hz)
  120. nconnections: '1'
  121. nrows: '60'
  122. offset: '[]'
  123. samp_rate: sample_rate_hz
  124. type: byte
  125. update_time: '0.10'
  126. zmax: '1'
  127. zmin: '0'
  128. states:
  129. bus_sink: false
  130. bus_source: false
  131. bus_structure: null
  132. coordinate: [555, 183]
  133. rotation: 0
  134. state: enabled
  135. - name: serial_source_block
  136. id: epy_block
  137. parameters:
  138. _source_code: "import gnuradio\nimport numpy\nimport serial\n\n\nclass SerialSourceBlock(gnuradio.gr.sync_block):\n\
  139. \ def __init__(\n self,\n port=\"/dev/ttyUSB0\",\n baud_rate=115200,\n\
  140. \ buffer_max_length=10,\n timeout=2,\n invert=False,\n\
  141. \ ):\n # pylint: disable=too-many-arguments\n gnuradio.gr.sync_block.__init__(\n\
  142. \ self, name=\"Serial Source Block\", in_sig=None, out_sig=[numpy.uint8]\n\
  143. \ )\n self._serial_port = serial.Serial(\n port=port,\
  144. \ baudrate=baud_rate, bytesize=serial.EIGHTBITS, timeout=timeout\n )\n\
  145. \ # remove first bytes that may have unexpected values > 1, unclear why\n\
  146. \ # seen [0b110000000, 0] and [0, 0b11111110] so far\n self._serial_port.read(2)\n\
  147. \ self._buffer_max_length = buffer_max_length\n self._invert =\
  148. \ invert\n\n def work(self, input_items, output_items):\n # pylint:\
  149. \ disable=unused-argument\n buffer = self._serial_port.read(\n \
  150. \ min(len(output_items[0]), self._buffer_max_length)\n )\n \
  151. \ output_items[0][: len(buffer)] = numpy.frombuffer(buffer, dtype=\"u1\")\n\
  152. \ if output_items[0][: len(buffer)].max() > 1:\n raise ValueError(output_items[0][:\
  153. \ len(buffer)])\n if self._invert:\n output_items[0] ^= 1\n\
  154. \ return len(buffer)\n"
  155. affinity: ''
  156. alias: ''
  157. baud_rate: '115200'
  158. buffer_max_length: int(sample_rate_hz/4)
  159. comment: ''
  160. invert: 'False'
  161. maxoutbuf: '0'
  162. minoutbuf: '0'
  163. port: '''/dev/ttyUSB0'''
  164. timeout: '2'
  165. states:
  166. _io_cache: ('Serial Source Block', 'SerialSourceBlock', [('port', "'/dev/ttyUSB0'"),
  167. ('baud_rate', '115200'), ('buffer_max_length', '10'), ('timeout', '2'), ('invert',
  168. 'False')], [], [('0', 'byte', 1)], '', [])
  169. bus_sink: false
  170. bus_source: false
  171. bus_structure: null
  172. coordinate: [28, 170]
  173. rotation: 0
  174. state: true
  175. connections:
  176. - [blocks_probe_rate_0, rate, blocks_message_debug_0, print]
  177. - [serial_source_block, '0', blocks_probe_rate_0, '0']
  178. - [serial_source_block, '0', qtgui_time_raster_sink_x_0, '0']
  179. metadata:
  180. file_format: 1