logic-agent-mcp 0.0.0-stage → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (449) hide show
  1. package/API.cmd +5 -0
  2. package/CAPTURE.cmd +8 -0
  3. package/CHECK.cmd +7 -0
  4. package/FIRMWARE-RECOVER.cmd +6 -0
  5. package/FIRMWARE-STATUS.cmd +8 -0
  6. package/INSTALL-DRIVER.cmd +6 -0
  7. package/INSTALL-MCP.cmd +16 -0
  8. package/LICENSE +31 -0
  9. package/MCP.cmd +5 -0
  10. package/README.md +127 -2
  11. package/SELF-TEST.cmd +6 -0
  12. package/THIRD-PARTY-NOTICES.md +32 -0
  13. package/VERIFY-FILES.cmd +6 -0
  14. package/VERSION.txt +17 -0
  15. package/VIEW.cmd +16 -0
  16. package/checksums.sha256 +449 -0
  17. package/docs/DRIVER.md +54 -0
  18. package/docs/DSLOGIC-PLUS.md +180 -0
  19. package/docs/FIRMWARE.md +53 -0
  20. package/docs/INSTALL.md +74 -0
  21. package/docs/MCP-CLIENTS.md +200 -0
  22. package/docs/PROTOCOLS.md +200 -0
  23. package/docs/TROUBLESHOOTING.md +41 -0
  24. package/docs/UPSTREAM-SYNC.md +141 -0
  25. package/docs/WAVEFORM-VIEWER.md +48 -0
  26. package/firmware/DSLogicPlus.fw +0 -0
  27. package/firmware/LICENSE-DreamSourceLab.txt +20 -0
  28. package/launcher/logic-agent-mcp.mjs +106 -0
  29. package/package.json +56 -6
  30. package/runtime/app/logic_agent/__init__.py +4 -0
  31. package/runtime/app/logic_agent/analysis.py +84 -0
  32. package/runtime/app/logic_agent/backends/__init__.py +7 -0
  33. package/runtime/app/logic_agent/backends/base.py +37 -0
  34. package/runtime/app/logic_agent/backends/dslab.py +278 -0
  35. package/runtime/app/logic_agent/backends/mock.py +101 -0
  36. package/runtime/app/logic_agent/backends/sigrok.py +252 -0
  37. package/runtime/app/logic_agent/cli.py +387 -0
  38. package/runtime/app/logic_agent/decoders.py +868 -0
  39. package/runtime/app/logic_agent/errors.py +50 -0
  40. package/runtime/app/logic_agent/importer.py +129 -0
  41. package/runtime/app/logic_agent/mcp_clients.py +956 -0
  42. package/runtime/app/logic_agent/mcp_server.py +345 -0
  43. package/runtime/app/logic_agent/models.py +150 -0
  44. package/runtime/app/logic_agent/protocols.py +233 -0
  45. package/runtime/app/logic_agent/service.py +378 -0
  46. package/runtime/app/logic_agent/signal.py +206 -0
  47. package/runtime/app/logic_agent/store.py +197 -0
  48. package/runtime/bin/_bz2.pyd +0 -0
  49. package/runtime/bin/_ctypes.pyd +0 -0
  50. package/runtime/bin/_decimal.pyd +0 -0
  51. package/runtime/bin/_elementtree.pyd +0 -0
  52. package/runtime/bin/_hashlib.pyd +0 -0
  53. package/runtime/bin/_lzma.pyd +0 -0
  54. package/runtime/bin/_multiprocessing.pyd +0 -0
  55. package/runtime/bin/_socket.pyd +0 -0
  56. package/runtime/bin/_sqlite3.pyd +0 -0
  57. package/runtime/bin/_ssl.pyd +0 -0
  58. package/runtime/bin/dslab.exe +0 -0
  59. package/runtime/bin/libglib-2.0-0.dll +0 -0
  60. package/runtime/bin/libiconv-2.dll +0 -0
  61. package/runtime/bin/libintl-8.dll +0 -0
  62. package/runtime/bin/libpcre2-8-0.dll +0 -0
  63. package/runtime/bin/libusb-1.0.dll +0 -0
  64. package/runtime/bin/libwinpthread-1.dll +0 -0
  65. package/runtime/bin/msvcp100.dll +0 -0
  66. package/runtime/bin/msvcr100.dll +0 -0
  67. package/runtime/bin/pyexpat.pyd +0 -0
  68. package/runtime/bin/python34.dll +0 -0
  69. package/runtime/bin/python34.zip +0 -0
  70. package/runtime/bin/res/DSCope.bin +0 -0
  71. package/runtime/bin/res/DSCope.fw +0 -0
  72. package/runtime/bin/res/DSCope1.def.dsc +88 -0
  73. package/runtime/bin/res/DSCope2.def.dsc +54 -0
  74. package/runtime/bin/res/DSCope20.bin +0 -0
  75. package/runtime/bin/res/DSCope20.fw +0 -0
  76. package/runtime/bin/res/DSCopeC20B.bin +0 -0
  77. package/runtime/bin/res/DSCopeC20P.bin +0 -0
  78. package/runtime/bin/res/DSCopeU2B100.bin +0 -0
  79. package/runtime/bin/res/DSCopeU2B20.bin +0 -0
  80. package/runtime/bin/res/DSCopeU2P20.bin +0 -0
  81. package/runtime/bin/res/DSCopeU3P100.bin +0 -0
  82. package/runtime/bin/res/DSLogic.fw +0 -0
  83. package/runtime/bin/res/DSLogic0.def.dsc +297 -0
  84. package/runtime/bin/res/DSLogic1.def.dsc +82 -0
  85. package/runtime/bin/res/DSLogic2.def.dsc +52 -0
  86. package/runtime/bin/res/DSLogic33.bin +0 -0
  87. package/runtime/bin/res/DSLogic50.bin +0 -0
  88. package/runtime/bin/res/DSLogicBasic.bin +0 -0
  89. package/runtime/bin/res/DSLogicPlus-pgl12-2.bin +0 -0
  90. package/runtime/bin/res/DSLogicPlus-pgl12.bin +0 -0
  91. package/runtime/bin/res/DSLogicPlus.bin +0 -0
  92. package/runtime/bin/res/DSLogicPlus.fw +0 -0
  93. package/runtime/bin/res/DSLogicPro.bin +0 -0
  94. package/runtime/bin/res/DSLogicPro.fw +0 -0
  95. package/runtime/bin/res/DSLogicU2Basic-pgl12-2.bin +0 -0
  96. package/runtime/bin/res/DSLogicU2Basic-pgl12.bin +0 -0
  97. package/runtime/bin/res/DSLogicU2Basic.bin +0 -0
  98. package/runtime/bin/res/DSLogicU2Pro16.bin +0 -0
  99. package/runtime/bin/res/DSLogicU3Pro16.bin +0 -0
  100. package/runtime/bin/res/DSLogicU3Pro32.bin +0 -0
  101. package/runtime/bin/res/license.txt +20 -0
  102. package/runtime/bin/res/virtual-demo1.dsc +68 -0
  103. package/runtime/bin/select.pyd +0 -0
  104. package/runtime/bin/sigrok-cli.exe +0 -0
  105. package/runtime/bin/unicodedata.pyd +0 -0
  106. package/runtime/bin/winsound.pyd +0 -0
  107. package/runtime/bin/zlib1.dll +0 -0
  108. package/runtime/decoders/ac97/__init__.py +38 -0
  109. package/runtime/decoders/ac97/pd.py +477 -0
  110. package/runtime/decoders/ad5626/__init__.py +25 -0
  111. package/runtime/decoders/ad5626/pd.py +62 -0
  112. package/runtime/decoders/ad79x0/__init__.py +25 -0
  113. package/runtime/decoders/ad79x0/pd.py +137 -0
  114. package/runtime/decoders/ade77xx/__init__.py +31 -0
  115. package/runtime/decoders/ade77xx/lists.py +102 -0
  116. package/runtime/decoders/ade77xx/pd.py +131 -0
  117. package/runtime/decoders/adf435x/__init__.py +29 -0
  118. package/runtime/decoders/adf435x/pd.py +230 -0
  119. package/runtime/decoders/adns5020/__init__.py +27 -0
  120. package/runtime/decoders/adns5020/pd.py +116 -0
  121. package/runtime/decoders/adxl345/__init__.py +26 -0
  122. package/runtime/decoders/adxl345/lists.py +96 -0
  123. package/runtime/decoders/adxl345/pd.py +453 -0
  124. package/runtime/decoders/am230x/__init__.py +36 -0
  125. package/runtime/decoders/am230x/pd.py +229 -0
  126. package/runtime/decoders/amulet_ascii/__init__.py +28 -0
  127. package/runtime/decoders/amulet_ascii/lists.py +73 -0
  128. package/runtime/decoders/amulet_ascii/pd.py +699 -0
  129. package/runtime/decoders/arm_etmv3/__init__.py +25 -0
  130. package/runtime/decoders/arm_etmv3/pd.py +567 -0
  131. package/runtime/decoders/arm_itm/__init__.py +25 -0
  132. package/runtime/decoders/arm_itm/pd.py +373 -0
  133. package/runtime/decoders/arm_tpiu/__init__.py +28 -0
  134. package/runtime/decoders/arm_tpiu/pd.py +131 -0
  135. package/runtime/decoders/atsha204a/__init__.py +30 -0
  136. package/runtime/decoders/atsha204a/pd.py +323 -0
  137. package/runtime/decoders/aud/__init__.py +31 -0
  138. package/runtime/decoders/aud/pd.py +108 -0
  139. package/runtime/decoders/avr_isp/__init__.py +25 -0
  140. package/runtime/decoders/avr_isp/parts.py +163 -0
  141. package/runtime/decoders/avr_isp/pd.py +278 -0
  142. package/runtime/decoders/avr_pdi/__init__.py +42 -0
  143. package/runtime/decoders/avr_pdi/pd.py +574 -0
  144. package/runtime/decoders/caliper/__init__.py +36 -0
  145. package/runtime/decoders/caliper/pd.py +146 -0
  146. package/runtime/decoders/can/__init__.py +31 -0
  147. package/runtime/decoders/can/pd.py +519 -0
  148. package/runtime/decoders/cc1101/__init__.py +28 -0
  149. package/runtime/decoders/cc1101/lists.py +115 -0
  150. package/runtime/decoders/cc1101/pd.py +294 -0
  151. package/runtime/decoders/cec/__init__.py +25 -0
  152. package/runtime/decoders/cec/pd.py +311 -0
  153. package/runtime/decoders/cec/protocoldata.py +117 -0
  154. package/runtime/decoders/cfp/__init__.py +34 -0
  155. package/runtime/decoders/cfp/pd.py +110 -0
  156. package/runtime/decoders/cjtag/__init__.py +36 -0
  157. package/runtime/decoders/cjtag/pd.py +323 -0
  158. package/runtime/decoders/common/__init__.py +19 -0
  159. package/runtime/decoders/common/plugtrx/__init__.py +20 -0
  160. package/runtime/decoders/common/plugtrx/mod.py +192 -0
  161. package/runtime/decoders/common/sdcard/__init__.py +20 -0
  162. package/runtime/decoders/common/sdcard/mod.py +150 -0
  163. package/runtime/decoders/common/srdhelper/__init__.py +20 -0
  164. package/runtime/decoders/common/srdhelper/mod.py +98 -0
  165. package/runtime/decoders/counter/__init__.py +28 -0
  166. package/runtime/decoders/counter/pd.py +145 -0
  167. package/runtime/decoders/dali/__init__.py +24 -0
  168. package/runtime/decoders/dali/lists.py +98 -0
  169. package/runtime/decoders/dali/pd.py +244 -0
  170. package/runtime/decoders/dcf77/__init__.py +28 -0
  171. package/runtime/decoders/dcf77/pd.py +311 -0
  172. package/runtime/decoders/dmx512/__init__.py +25 -0
  173. package/runtime/decoders/dmx512/pd.py +361 -0
  174. package/runtime/decoders/ds1307/__init__.py +25 -0
  175. package/runtime/decoders/ds1307/pd.py +270 -0
  176. package/runtime/decoders/ds2408/__init__.py +25 -0
  177. package/runtime/decoders/ds2408/pd.py +129 -0
  178. package/runtime/decoders/ds243x/__init__.py +25 -0
  179. package/runtime/decoders/ds243x/pd.py +270 -0
  180. package/runtime/decoders/ds28ea00/__init__.py +25 -0
  181. package/runtime/decoders/ds28ea00/pd.py +93 -0
  182. package/runtime/decoders/dsi/__init__.py +24 -0
  183. package/runtime/decoders/dsi/pd.py +157 -0
  184. package/runtime/decoders/edid/__init__.py +35 -0
  185. package/runtime/decoders/edid/pd.py +671 -0
  186. package/runtime/decoders/edid/pnpids.txt +2135 -0
  187. package/runtime/decoders/eeprom24xx/__init__.py +25 -0
  188. package/runtime/decoders/eeprom24xx/lists.py +214 -0
  189. package/runtime/decoders/eeprom24xx/pd.py +443 -0
  190. package/runtime/decoders/eeprom93xx/__init__.py +32 -0
  191. package/runtime/decoders/eeprom93xx/pd.py +163 -0
  192. package/runtime/decoders/em4100/__init__.py +24 -0
  193. package/runtime/decoders/em4100/pd.py +238 -0
  194. package/runtime/decoders/em4305/__init__.py +24 -0
  195. package/runtime/decoders/em4305/pd.py +394 -0
  196. package/runtime/decoders/enc28j60/__init__.py +32 -0
  197. package/runtime/decoders/enc28j60/lists.py +161 -0
  198. package/runtime/decoders/enc28j60/pd.py +294 -0
  199. package/runtime/decoders/flexray/__init__.py +32 -0
  200. package/runtime/decoders/flexray/pd.py +413 -0
  201. package/runtime/decoders/graycode/__init__.py +24 -0
  202. package/runtime/decoders/graycode/pd.py +197 -0
  203. package/runtime/decoders/guess_bitrate/__init__.py +40 -0
  204. package/runtime/decoders/guess_bitrate/pd.py +79 -0
  205. package/runtime/decoders/hdcp/__init__.py +27 -0
  206. package/runtime/decoders/hdcp/pd.py +191 -0
  207. package/runtime/decoders/i2c/__init__.py +25 -0
  208. package/runtime/decoders/i2c/pd.py +364 -0
  209. package/runtime/decoders/i2cdemux/__init__.py +27 -0
  210. package/runtime/decoders/i2cdemux/pd.py +80 -0
  211. package/runtime/decoders/i2cfilter/__init__.py +37 -0
  212. package/runtime/decoders/i2cfilter/pd.py +106 -0
  213. package/runtime/decoders/i2s/__init__.py +29 -0
  214. package/runtime/decoders/i2s/pd.py +179 -0
  215. package/runtime/decoders/ieee488/__init__.py +26 -0
  216. package/runtime/decoders/ieee488/pd.py +849 -0
  217. package/runtime/decoders/ir_irmp/__init__.py +25 -0
  218. package/runtime/decoders/ir_irmp/irmp_library.py +168 -0
  219. package/runtime/decoders/ir_irmp/pd.py +139 -0
  220. package/runtime/decoders/ir_nec/__init__.py +25 -0
  221. package/runtime/decoders/ir_nec/lists.py +93 -0
  222. package/runtime/decoders/ir_nec/pd.py +300 -0
  223. package/runtime/decoders/ir_rc5/__init__.py +24 -0
  224. package/runtime/decoders/ir_rc5/lists.py +93 -0
  225. package/runtime/decoders/ir_rc5/pd.py +182 -0
  226. package/runtime/decoders/ir_rc6/__init__.py +24 -0
  227. package/runtime/decoders/ir_rc6/pd.py +205 -0
  228. package/runtime/decoders/ir_sirc/__init__.py +26 -0
  229. package/runtime/decoders/ir_sirc/lists.py +201 -0
  230. package/runtime/decoders/ir_sirc/pd.py +215 -0
  231. package/runtime/decoders/jitter/__init__.py +29 -0
  232. package/runtime/decoders/jitter/pd.py +198 -0
  233. package/runtime/decoders/jtag/__init__.py +30 -0
  234. package/runtime/decoders/jtag/pd.py +235 -0
  235. package/runtime/decoders/jtag_ejtag/__init__.py +25 -0
  236. package/runtime/decoders/jtag_ejtag/pd.py +408 -0
  237. package/runtime/decoders/jtag_stm32/__init__.py +29 -0
  238. package/runtime/decoders/jtag_stm32/pd.py +269 -0
  239. package/runtime/decoders/lfast/__init__.py +35 -0
  240. package/runtime/decoders/lfast/pd.py +335 -0
  241. package/runtime/decoders/lin/__init__.py +28 -0
  242. package/runtime/decoders/lin/pd.py +247 -0
  243. package/runtime/decoders/lm75/__init__.py +25 -0
  244. package/runtime/decoders/lm75/pd.py +186 -0
  245. package/runtime/decoders/lpc/__init__.py +25 -0
  246. package/runtime/decoders/lpc/pd.py +365 -0
  247. package/runtime/decoders/ltc242x/__init__.py +25 -0
  248. package/runtime/decoders/ltc242x/pd.py +86 -0
  249. package/runtime/decoders/ltc26x7/__init__.py +25 -0
  250. package/runtime/decoders/ltc26x7/pd.py +187 -0
  251. package/runtime/decoders/maple_bus/__init__.py +25 -0
  252. package/runtime/decoders/maple_bus/pd.py +222 -0
  253. package/runtime/decoders/max72xx/__init__.py +25 -0
  254. package/runtime/decoders/max72xx/pd.py +130 -0
  255. package/runtime/decoders/mcp230xx/__init__.py +25 -0
  256. package/runtime/decoders/mcp230xx/pd.py +143 -0
  257. package/runtime/decoders/mcs48/__init__.py +31 -0
  258. package/runtime/decoders/mcs48/pd.py +126 -0
  259. package/runtime/decoders/mdio/__init__.py +39 -0
  260. package/runtime/decoders/mdio/pd.py +325 -0
  261. package/runtime/decoders/microwire/__init__.py +40 -0
  262. package/runtime/decoders/microwire/pd.py +194 -0
  263. package/runtime/decoders/midi/__init__.py +28 -0
  264. package/runtime/decoders/midi/lists.py +840 -0
  265. package/runtime/decoders/midi/pd.py +627 -0
  266. package/runtime/decoders/miller/__init__.py +26 -0
  267. package/runtime/decoders/miller/pd.py +190 -0
  268. package/runtime/decoders/mlx90614/__init__.py +25 -0
  269. package/runtime/decoders/mlx90614/pd.py +82 -0
  270. package/runtime/decoders/modbus/__init__.py +28 -0
  271. package/runtime/decoders/modbus/pd.py +941 -0
  272. package/runtime/decoders/morse/__init__.py +28 -0
  273. package/runtime/decoders/morse/pd.py +250 -0
  274. package/runtime/decoders/mrf24j40/__init__.py +25 -0
  275. package/runtime/decoders/mrf24j40/lists.py +165 -0
  276. package/runtime/decoders/mrf24j40/pd.py +188 -0
  277. package/runtime/decoders/mxc6225xu/__init__.py +28 -0
  278. package/runtime/decoders/mxc6225xu/pd.py +217 -0
  279. package/runtime/decoders/nes_gamepad/__init__.py +54 -0
  280. package/runtime/decoders/nes_gamepad/pd.py +92 -0
  281. package/runtime/decoders/nrf24l01/__init__.py +29 -0
  282. package/runtime/decoders/nrf24l01/pd.py +332 -0
  283. package/runtime/decoders/nrf905/__init__.py +26 -0
  284. package/runtime/decoders/nrf905/pd.py +301 -0
  285. package/runtime/decoders/numbers_and_state/__init__.py +41 -0
  286. package/runtime/decoders/numbers_and_state/pd.py +377 -0
  287. package/runtime/decoders/nunchuk/__init__.py +30 -0
  288. package/runtime/decoders/nunchuk/pd.py +207 -0
  289. package/runtime/decoders/onewire_link/__init__.py +56 -0
  290. package/runtime/decoders/onewire_link/pd.py +347 -0
  291. package/runtime/decoders/onewire_network/__init__.py +56 -0
  292. package/runtime/decoders/onewire_network/pd.py +185 -0
  293. package/runtime/decoders/ook/__init__.py +36 -0
  294. package/runtime/decoders/ook/pd.py +484 -0
  295. package/runtime/decoders/ook_oregon/__init__.py +25 -0
  296. package/runtime/decoders/ook_oregon/lists.py +75 -0
  297. package/runtime/decoders/ook_oregon/pd.py +389 -0
  298. package/runtime/decoders/ook_vis/__init__.py +25 -0
  299. package/runtime/decoders/ook_vis/pd.py +194 -0
  300. package/runtime/decoders/pan1321/__init__.py +25 -0
  301. package/runtime/decoders/pan1321/pd.py +164 -0
  302. package/runtime/decoders/parallel/__init__.py +45 -0
  303. package/runtime/decoders/parallel/pd.py +285 -0
  304. package/runtime/decoders/pca9571/__init__.py +25 -0
  305. package/runtime/decoders/pca9571/pd.py +122 -0
  306. package/runtime/decoders/pjdl/__init__.py +27 -0
  307. package/runtime/decoders/pjdl/pd.py +723 -0
  308. package/runtime/decoders/pjon/__init__.py +25 -0
  309. package/runtime/decoders/pjon/pd.py +603 -0
  310. package/runtime/decoders/ps2/__init__.py +26 -0
  311. package/runtime/decoders/ps2/pd.py +126 -0
  312. package/runtime/decoders/pwm/__init__.py +24 -0
  313. package/runtime/decoders/pwm/pd.py +167 -0
  314. package/runtime/decoders/qi/__init__.py +25 -0
  315. package/runtime/decoders/qi/pd.py +244 -0
  316. package/runtime/decoders/rc_encode/__init__.py +40 -0
  317. package/runtime/decoders/rc_encode/pd.py +215 -0
  318. package/runtime/decoders/rfm12/__init__.py +25 -0
  319. package/runtime/decoders/rfm12/pd.py +497 -0
  320. package/runtime/decoders/rgb_led_spi/__init__.py +25 -0
  321. package/runtime/decoders/rgb_led_spi/pd.py +72 -0
  322. package/runtime/decoders/rgb_led_ws281x/__init__.py +27 -0
  323. package/runtime/decoders/rgb_led_ws281x/pd.py +267 -0
  324. package/runtime/decoders/rtc8564/__init__.py +25 -0
  325. package/runtime/decoders/rtc8564/pd.py +254 -0
  326. package/runtime/decoders/sae_j1850_vpw/__init__.py +24 -0
  327. package/runtime/decoders/sae_j1850_vpw/pd.py +296 -0
  328. package/runtime/decoders/sbus_futaba/__init__.py +35 -0
  329. package/runtime/decoders/sbus_futaba/pd.py +273 -0
  330. package/runtime/decoders/sda2506/__init__.py +24 -0
  331. package/runtime/decoders/sda2506/pd.py +146 -0
  332. package/runtime/decoders/sdcard_sd/__init__.py +24 -0
  333. package/runtime/decoders/sdcard_sd/pd.py +554 -0
  334. package/runtime/decoders/sdcard_spi/__init__.py +68 -0
  335. package/runtime/decoders/sdcard_spi/pd.py +518 -0
  336. package/runtime/decoders/sdq/__init__.py +28 -0
  337. package/runtime/decoders/sdq/pd.py +131 -0
  338. package/runtime/decoders/seven_segment/__init__.py +24 -0
  339. package/runtime/decoders/seven_segment/pd.py +186 -0
  340. package/runtime/decoders/signature/__init__.py +25 -0
  341. package/runtime/decoders/signature/pd.py +142 -0
  342. package/runtime/decoders/sipi/__init__.py +30 -0
  343. package/runtime/decoders/sipi/pd.py +181 -0
  344. package/runtime/decoders/sle44xx/__init__.py +26 -0
  345. package/runtime/decoders/sle44xx/pd.py +541 -0
  346. package/runtime/decoders/smart_qspi/PORTING.md +22 -0
  347. package/runtime/decoders/smart_qspi/__init__.py +1 -0
  348. package/runtime/decoders/smart_qspi/pd.py +826 -0
  349. package/runtime/decoders/spdif/__init__.py +25 -0
  350. package/runtime/decoders/spdif/pd.py +295 -0
  351. package/runtime/decoders/spi/__init__.py +32 -0
  352. package/runtime/decoders/spi/pd.py +347 -0
  353. package/runtime/decoders/spiflash/__init__.py +30 -0
  354. package/runtime/decoders/spiflash/lists.py +178 -0
  355. package/runtime/decoders/spiflash/pd.py +537 -0
  356. package/runtime/decoders/ssi32/__init__.py +28 -0
  357. package/runtime/decoders/ssi32/pd.py +127 -0
  358. package/runtime/decoders/st25r39xx_spi/__init__.py +31 -0
  359. package/runtime/decoders/st25r39xx_spi/lists.py +231 -0
  360. package/runtime/decoders/st25r39xx_spi/pd.py +360 -0
  361. package/runtime/decoders/st7735/__init__.py +27 -0
  362. package/runtime/decoders/st7735/pd.py +173 -0
  363. package/runtime/decoders/stepper_motor/__init__.py +25 -0
  364. package/runtime/decoders/stepper_motor/pd.py +95 -0
  365. package/runtime/decoders/swd/__init__.py +34 -0
  366. package/runtime/decoders/swd/pd.py +350 -0
  367. package/runtime/decoders/swim/__init__.py +28 -0
  368. package/runtime/decoders/swim/pd.py +303 -0
  369. package/runtime/decoders/t55xx/__init__.py +25 -0
  370. package/runtime/decoders/t55xx/pd.py +326 -0
  371. package/runtime/decoders/tca6408a/__init__.py +25 -0
  372. package/runtime/decoders/tca6408a/pd.py +157 -0
  373. package/runtime/decoders/tdm_audio/__init__.py +25 -0
  374. package/runtime/decoders/tdm_audio/pd.py +116 -0
  375. package/runtime/decoders/timing/__init__.py +24 -0
  376. package/runtime/decoders/timing/pd.py +194 -0
  377. package/runtime/decoders/tlc5620/__init__.py +24 -0
  378. package/runtime/decoders/tlc5620/pd.py +212 -0
  379. package/runtime/decoders/uart/__init__.py +40 -0
  380. package/runtime/decoders/uart/pd.py +635 -0
  381. package/runtime/decoders/usb_packet/__init__.py +43 -0
  382. package/runtime/decoders/usb_packet/pd.py +401 -0
  383. package/runtime/decoders/usb_power_delivery/__init__.py +24 -0
  384. package/runtime/decoders/usb_power_delivery/pd.py +642 -0
  385. package/runtime/decoders/usb_request/__init__.py +49 -0
  386. package/runtime/decoders/usb_request/pd.py +386 -0
  387. package/runtime/decoders/usb_signalling/__init__.py +50 -0
  388. package/runtime/decoders/usb_signalling/pd.py +348 -0
  389. package/runtime/decoders/wiegand/__init__.py +28 -0
  390. package/runtime/decoders/wiegand/pd.py +148 -0
  391. package/runtime/decoders/x2444m/__init__.py +25 -0
  392. package/runtime/decoders/x2444m/pd.py +111 -0
  393. package/runtime/decoders/xfp/__init__.py +38 -0
  394. package/runtime/decoders/xfp/pd.py +486 -0
  395. package/runtime/decoders/xy2-100/__init__.py +28 -0
  396. package/runtime/decoders/xy2-100/pd.py +242 -0
  397. package/runtime/decoders/z80/__init__.py +36 -0
  398. package/runtime/decoders/z80/pd.py +358 -0
  399. package/runtime/decoders/z80/tables.py +1083 -0
  400. package/runtime/dslab.cmd +5 -0
  401. package/runtime/licenses/DreamSourceLab-res-MIT.txt +20 -0
  402. package/runtime/licenses/dslab-GPL-3.0.txt +674 -0
  403. package/runtime/licenses/logic-agent-MIT.txt +31 -0
  404. package/runtime/licenses/python-PSF.txt +645 -0
  405. package/runtime/licenses/sigrok-cli-GPL-3.0.txt +674 -0
  406. package/runtime/licenses/smart_qspi-PORTING.md +22 -0
  407. package/runtime/licenses/source/patches/dsview-v1.3.2-dslab.patch +124 -0
  408. package/runtime/logic-agent-mcp.cmd +9 -0
  409. package/runtime/logic-agent.cmd +9 -0
  410. package/runtime/python/LICENSE.txt +645 -0
  411. package/runtime/python/_asyncio.pyd +0 -0
  412. package/runtime/python/_bz2.pyd +0 -0
  413. package/runtime/python/_ctypes.pyd +0 -0
  414. package/runtime/python/_decimal.pyd +0 -0
  415. package/runtime/python/_elementtree.pyd +0 -0
  416. package/runtime/python/_hashlib.pyd +0 -0
  417. package/runtime/python/_lzma.pyd +0 -0
  418. package/runtime/python/_multiprocessing.pyd +0 -0
  419. package/runtime/python/_overlapped.pyd +0 -0
  420. package/runtime/python/_queue.pyd +0 -0
  421. package/runtime/python/_socket.pyd +0 -0
  422. package/runtime/python/_sqlite3.pyd +0 -0
  423. package/runtime/python/_ssl.pyd +0 -0
  424. package/runtime/python/_uuid.pyd +0 -0
  425. package/runtime/python/_wmi.pyd +0 -0
  426. package/runtime/python/_zoneinfo.pyd +0 -0
  427. package/runtime/python/libcrypto-3.dll +0 -0
  428. package/runtime/python/libffi-8.dll +0 -0
  429. package/runtime/python/libssl-3.dll +0 -0
  430. package/runtime/python/pyexpat.pyd +0 -0
  431. package/runtime/python/python.cat +0 -0
  432. package/runtime/python/python.exe +0 -0
  433. package/runtime/python/python3.dll +0 -0
  434. package/runtime/python/python313._pth +3 -0
  435. package/runtime/python/python313.dll +0 -0
  436. package/runtime/python/python313.zip +0 -0
  437. package/runtime/python/pythonw.exe +0 -0
  438. package/runtime/python/select.pyd +0 -0
  439. package/runtime/python/sqlite3.dll +0 -0
  440. package/runtime/python/unicodedata.pyd +0 -0
  441. package/runtime/python/vcruntime140.dll +0 -0
  442. package/runtime/python/vcruntime140_1.dll +0 -0
  443. package/runtime/python/winsound.pyd +0 -0
  444. package/runtime/scripts/deploy-check.ps1 +171 -0
  445. package/scripts/check.ps1 +14 -0
  446. package/scripts/firmware-recover.ps1 +27 -0
  447. package/scripts/install-driver.ps1 +30 -0
  448. package/scripts/self-test.ps1 +14 -0
  449. package/scripts/verify-files.py +39 -0
@@ -0,0 +1,244 @@
1
+ ##
2
+ ## This file is part of the libsigrokdecode project.
3
+ ##
4
+ ## Copyright (C) 2015 Jeremy Swanson <jeremy@rakocontrols.com>
5
+ ##
6
+ ## This program is free software; you can redistribute it and/or modify
7
+ ## it under the terms of the GNU General Public License as published by
8
+ ## the Free Software Foundation; either version 2 of the License, or
9
+ ## (at your option) any later version.
10
+ ##
11
+ ## This program is distributed in the hope that it will be useful,
12
+ ## but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ ## GNU General Public License for more details.
15
+ ##
16
+ ## You should have received a copy of the GNU General Public License
17
+ ## along with this program. If not, see <http://www.gnu.org/licenses/>.
18
+ ##
19
+
20
+ import sigrokdecode as srd
21
+ from .lists import *
22
+
23
+ class SamplerateError(Exception):
24
+ pass
25
+
26
+ class Decoder(srd.Decoder):
27
+ api_version = 3
28
+ id = 'dali'
29
+ name = 'DALI'
30
+ longname = 'Digital Addressable Lighting Interface'
31
+ desc = 'Digital Addressable Lighting Interface (DALI) protocol.'
32
+ license = 'gplv2+'
33
+ inputs = ['logic']
34
+ outputs = []
35
+ tags = ['Embedded/industrial', 'Lighting']
36
+ channels = (
37
+ {'id': 'dali', 'name': 'DALI', 'desc': 'DALI data line'},
38
+ )
39
+ options = (
40
+ {'id': 'polarity', 'desc': 'Polarity', 'default': 'active-low',
41
+ 'values': ('active-low', 'active-high')},
42
+ )
43
+ annotations = (
44
+ ('bit', 'Bit'),
45
+ ('startbit', 'Start bit'),
46
+ ('sbit', 'Select bit'),
47
+ ('ybit', 'Individual or group'),
48
+ ('address', 'Address'),
49
+ ('command', 'Command'),
50
+ ('reply', 'Reply data'),
51
+ ('raw', 'Raw data'),
52
+ )
53
+ annotation_rows = (
54
+ ('bits', 'Bits', (0,)),
55
+ ('raw-data', 'Raw data', (7,)),
56
+ ('fields', 'Fields', (1, 2, 3, 4, 5, 6)),
57
+ )
58
+
59
+ def __init__(self):
60
+ self.reset()
61
+
62
+ def reset(self):
63
+ self.samplerate = None
64
+ self.edges, self.bits, self.ss_es_bits = [], [], []
65
+ self.state = 'IDLE'
66
+ self.dev_type = None
67
+
68
+ def start(self):
69
+ self.out_ann = self.register(srd.OUTPUT_ANN)
70
+ self.old_dali = 1 if self.options['polarity'] == 'active-low' else 0
71
+
72
+ def metadata(self, key, value):
73
+ if key == srd.SRD_CONF_SAMPLERATE:
74
+ self.samplerate = value
75
+ # One bit: 833.33us (one half low, one half high).
76
+ # This is how may samples are in 1TE.
77
+ self.halfbit = int((self.samplerate * 0.0008333) / 2.0)
78
+
79
+ def putb(self, bit1, bit2, data):
80
+ ss, es = self.ss_es_bits[bit1][0], self.ss_es_bits[bit2][1]
81
+ self.put(ss, es, self.out_ann, data)
82
+
83
+ def handle_bits(self, length):
84
+ a, c, f, g, b = 0, 0, 0, 0, self.bits
85
+ # Individual raw bits.
86
+ for i in range(length):
87
+ if i == 0:
88
+ ss = max(0, self.bits[0][0])
89
+ else:
90
+ ss = self.ss_es_bits[i - 1][1]
91
+ es = self.bits[i][0] + (self.halfbit * 2)
92
+ self.ss_es_bits.append([ss, es])
93
+ self.putb(i, i, [0, ['%d' % self.bits[i][1]]])
94
+ # Bits[0:0]: Startbit
95
+ s = ['Startbit: %d' % b[0][1], 'ST: %d' % b[0][1], 'ST', 'S', 'S']
96
+ self.putb(0, 0, [1, s])
97
+ self.putb(0, 0, [7, s])
98
+ # Bits[1:8]
99
+ for i in range(8):
100
+ f |= (b[1 + i][1] << (7 - i))
101
+ if length == 9: # BACKWARD Frame
102
+ s = ['Reply: %02X' % f, 'Rply: %02X' % f,
103
+ 'Rep: %02X' % f, 'R: %02X' % f, 'R']
104
+ self.putb(1, 8, [7, s])
105
+ s = ['Reply: %d' % f, 'Rply: %d' % f,
106
+ 'Rep: %d' % f, 'R: %d' % f, 'R']
107
+ self.putb(1, 8, [6, s])
108
+ return
109
+
110
+ # FORWARD FRAME
111
+ # Bits[9:16]: Command/data (MSB-first)
112
+ for i in range(8):
113
+ c |= (b[9 + i][1] << (7 - i))
114
+ # Raw output
115
+ s = ['Raw data: %02X' % f, 'Raw: %02X' % f,
116
+ 'Raw: %02X' % f, 'R: %02X' % f, 'R']
117
+ self.putb(1, 8, [7, s])
118
+ s = ['Raw data: %02X' % c, 'Raw: %02X' % c,
119
+ 'Raw: %02X' % c, 'R: %02X' % c, 'R']
120
+ self.putb(9, 16, [7, s])
121
+
122
+ # Bits[8:8]: Select bit
123
+ # s = ['Selectbit: %d' % b[8][1], 'SEL: %d' % b[8][1], 'SEL', 'SE', 'S']
124
+ if b[8][1] == 1:
125
+ s = ['Command', 'Comd', 'COM', 'CO', 'C']
126
+ else:
127
+ s = ['Arc Power Level', 'Arc Pwr', 'ARC', 'AC', 'A']
128
+ self.putb(8, 8, [1, s])
129
+
130
+ # f &= 254 # Clear the select bit.
131
+ if f >= 254: # BROADCAST
132
+ s = ['BROADCAST', 'Brdcast', 'BC', 'B', 'B']
133
+ self.putb(1, 7, [5, s])
134
+ elif f >= 160: # Extended command 0b10100000
135
+ if f == 0xC1: # DALI_ENABLE_DEVICE_TYPE_X
136
+ self.dev_type = -1
137
+ x = extended_commands.get(f, ['Unknown', 'Unk'])
138
+ s = ['Extended Command: %02X (%s)' % (f, x[0]),
139
+ 'XC: %02X (%s)' % (f, x[1]),
140
+ 'XC: %02X' % f, 'X: %02X' % f, 'X']
141
+ self.putb(1, 8, [5, s])
142
+ elif f >= 128: # Group
143
+ # Bits[1:1]: Ybit
144
+ s = ['YBit: %d' % b[1][1], 'YB: %d' % b[1][1], 'YB', 'Y', 'Y']
145
+ self.putb(1, 1, [3, s])
146
+ g = (f & 127) >> 1
147
+ s = ['Group address: %d' % g, 'Group: %d' % g,
148
+ 'GP: %d' % g, 'G: %d' % g, 'G']
149
+ self.putb(2,7, [4, s])
150
+ else: # Short address
151
+ # Bits[1:1]: Ybit
152
+ s = ['YBit: %d' % b[1][1], 'YB: %d' % b[1][1], 'YB', 'Y', 'Y']
153
+ self.putb(1, 1, [3, s])
154
+ a = f >> 1
155
+ s = ['Short address: %d' % a, 'Addr: %d' % a,
156
+ 'Addr: %d' % a, 'A: %d' % a, 'A']
157
+ self.putb(2, 7, [4, s])
158
+
159
+ # Bits[9:16]: Command/data (MSB-first)
160
+ if f >= 160 and f < 254:
161
+ if self.dev_type == -1:
162
+ self.dev_type = c
163
+ s = ['Type: %d' % c, 'Typ: %d' % c,
164
+ 'Typ: %d' % c, 'T: %d' % c, 'D']
165
+ else:
166
+ self.dev_type = None
167
+ s = ['Data: %d' % c, 'Dat: %d' % c,
168
+ 'Dat: %d' % c, 'D: %d' % c, 'D']
169
+ elif b[8][1] == 1:
170
+ un = c & 0xF0
171
+ ln = c & 0x0F
172
+ if un == 0x10: # Set scene command
173
+ x = ['Recall Scene %d' % ln, 'SC %d' % ln]
174
+ elif un == 0x40:
175
+ x = ['Store DTR as Scene %d' % ln, 'SC %d = DTR' % ln]
176
+ elif un == 0x50:
177
+ x = ['Delete Scene %d' % ln, 'DEL SC %d' % ln]
178
+ elif un == 0x60:
179
+ x = ['Add to Group %d' % ln, 'Grp %d Add' % ln]
180
+ elif un == 0x70:
181
+ x = ['Remove from Group %d' % ln, 'Grp %d Del' % ln]
182
+ elif un == 0xB0:
183
+ x = ['Query Scene %d Level' % ln, 'Sc %d Level' % ln]
184
+ elif c >= 224: # Application specific commands
185
+ if self.dev_type == 8:
186
+ x = dali_device_type8.get(c, ['Unknown App', 'Unk'])
187
+ else:
188
+ x = ['Application Specific Command %d' % c, 'App Cmd %d' % c]
189
+ else:
190
+ x = dali_commands.get(c, ['Unknown', 'Unk'])
191
+ s = ['Command: %d (%s)' % (c, x[0]), 'Com: %d (%s)' % (c, x[1]),
192
+ 'Com: %d' % c, 'C: %d' % c, 'C']
193
+ else:
194
+ s = ['Arc Power Level: %d' % c, 'Level: %d' % c,
195
+ 'Lev: %d' % c, 'L: %d' % c, 'L']
196
+ self.putb(9, 16, [5, s])
197
+
198
+ def reset_decoder_state(self):
199
+ self.edges, self.bits, self.ss_es_bits = [], [], []
200
+ self.state = 'IDLE'
201
+
202
+ def decode(self):
203
+ if not self.samplerate:
204
+ raise SamplerateError('Cannot decode without samplerate.')
205
+ bit = 0
206
+ while True:
207
+ # TODO: Come up with more appropriate self.wait() conditions.
208
+ (dali,) = self.wait()
209
+ if self.options['polarity'] == 'active-high':
210
+ dali ^= 1 # Invert.
211
+
212
+ # State machine.
213
+ if self.state == 'IDLE':
214
+ # Wait for any edge (rising or falling).
215
+ if self.old_dali == dali:
216
+ continue
217
+ self.edges.append(self.samplenum)
218
+ self.state = 'PHASE0'
219
+ self.old_dali = dali
220
+ continue
221
+
222
+ if self.old_dali != dali:
223
+ self.edges.append(self.samplenum)
224
+ elif self.samplenum == (self.edges[-1] + int(self.halfbit * 1.5)):
225
+ self.edges.append(self.samplenum - int(self.halfbit * 0.5))
226
+ else:
227
+ continue
228
+
229
+ bit = self.old_dali
230
+ if self.state == 'PHASE0':
231
+ self.phase0 = bit
232
+ self.state = 'PHASE1'
233
+ elif self.state == 'PHASE1':
234
+ if (bit == 1) and (self.phase0 == 1): # Stop bit.
235
+ if len(self.bits) == 17 or len(self.bits) == 9:
236
+ # Forward or Backward.
237
+ self.handle_bits(len(self.bits))
238
+ self.reset_decoder_state() # Reset upon errors.
239
+ continue
240
+ else:
241
+ self.bits.append([self.edges[-3], bit])
242
+ self.state = 'PHASE0'
243
+
244
+ self.old_dali = dali
@@ -0,0 +1,28 @@
1
+ ##
2
+ ## This file is part of the libsigrokdecode project.
3
+ ##
4
+ ## Copyright (C) 2012 Uwe Hermann <uwe@hermann-uwe.de>
5
+ ##
6
+ ## This program is free software; you can redistribute it and/or modify
7
+ ## it under the terms of the GNU General Public License as published by
8
+ ## the Free Software Foundation; either version 2 of the License, or
9
+ ## (at your option) any later version.
10
+ ##
11
+ ## This program is distributed in the hope that it will be useful,
12
+ ## but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ ## GNU General Public License for more details.
15
+ ##
16
+ ## You should have received a copy of the GNU General Public License
17
+ ## along with this program; if not, see <http://www.gnu.org/licenses/>.
18
+ ##
19
+
20
+ '''
21
+ This PD decodes the DCF77 protocol (a European long-wave time signal that
22
+ uses a 77.5kHz carrier frequency).
23
+
24
+ Details:
25
+ http://en.wikipedia.org/wiki/DCF77
26
+ '''
27
+
28
+ from .pd import Decoder
@@ -0,0 +1,311 @@
1
+ ##
2
+ ## This file is part of the libsigrokdecode project.
3
+ ##
4
+ ## Copyright (C) 2012-2016 Uwe Hermann <uwe@hermann-uwe.de>
5
+ ##
6
+ ## This program is free software; you can redistribute it and/or modify
7
+ ## it under the terms of the GNU General Public License as published by
8
+ ## the Free Software Foundation; either version 2 of the License, or
9
+ ## (at your option) any later version.
10
+ ##
11
+ ## This program is distributed in the hope that it will be useful,
12
+ ## but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ ## GNU General Public License for more details.
15
+ ##
16
+ ## You should have received a copy of the GNU General Public License
17
+ ## along with this program; if not, see <http://www.gnu.org/licenses/>.
18
+ ##
19
+
20
+ import sigrokdecode as srd
21
+ import calendar
22
+ from common.srdhelper import bcd2int
23
+
24
+ class SamplerateError(Exception):
25
+ pass
26
+
27
+ class Decoder(srd.Decoder):
28
+ api_version = 3
29
+ id = 'dcf77'
30
+ name = 'DCF77'
31
+ longname = 'DCF77 time protocol'
32
+ desc = 'European longwave time signal (77.5kHz carrier signal).'
33
+ license = 'gplv2+'
34
+ inputs = ['logic']
35
+ outputs = []
36
+ tags = ['Clock/timing']
37
+ channels = (
38
+ {'id': 'data', 'name': 'DATA', 'desc': 'DATA line'},
39
+ )
40
+ annotations = (
41
+ ('start-of-minute', 'Start of minute'),
42
+ ('special-bit', 'Special bit (civil warnings, weather forecast)'),
43
+ ('call-bit', 'Call bit'),
44
+ ('summer-time', 'Summer time announcement'),
45
+ ('cest', 'CEST bit'),
46
+ ('cet', 'CET bit'),
47
+ ('leap-second', 'Leap second bit'),
48
+ ('start-of-time', 'Start of encoded time'),
49
+ ('minute', 'Minute'),
50
+ ('minute-parity', 'Minute parity bit'),
51
+ ('hour', 'Hour'),
52
+ ('hour-parity', 'Hour parity bit'),
53
+ ('day', 'Day of month'),
54
+ ('day-of-week', 'Day of week'),
55
+ ('month', 'Month'),
56
+ ('year', 'Year'),
57
+ ('date-parity', 'Date parity bit'),
58
+ ('raw-bit', 'Raw bit'),
59
+ ('unknown-bit', 'Unknown bit'),
60
+ ('warning', 'Warning'),
61
+ )
62
+ annotation_rows = (
63
+ ('bits', 'Bits', (17, 18)),
64
+ ('fields', 'Fields', tuple(range(0, 16 + 1))),
65
+ ('warnings', 'Warnings', (19,)),
66
+ )
67
+
68
+ def __init__(self):
69
+ self.reset()
70
+
71
+ def reset(self):
72
+ self.samplerate = None
73
+ self.state = 'WAIT FOR RISING EDGE'
74
+ self.ss_bit = self.ss_bit_old = self.es_bit = self.ss_block = 0
75
+ self.datebits = []
76
+ self.bitcount = 0 # Counter for the DCF77 bits (0..58)
77
+ self.dcf77_bitnumber_is_known = 0
78
+
79
+ def start(self):
80
+ self.out_ann = self.register(srd.OUTPUT_ANN)
81
+
82
+ def metadata(self, key, value):
83
+ if key == srd.SRD_CONF_SAMPLERATE:
84
+ self.samplerate = value
85
+
86
+ def putx(self, data):
87
+ # Annotation for a single DCF77 bit.
88
+ self.put(self.ss_bit, self.es_bit, self.out_ann, data)
89
+
90
+ def putb(self, data):
91
+ # Annotation for a multi-bit DCF77 field.
92
+ self.put(self.ss_block, self.samplenum, self.out_ann, data)
93
+
94
+ # TODO: Which range to use? Only the 100ms/200ms or full second?
95
+ def handle_dcf77_bit(self, bit):
96
+ c = self.bitcount
97
+
98
+ # Create one annotation for each DCF77 bit (containing the 0/1 value).
99
+ # Use 'Unknown DCF77 bit x: val' if we're not sure yet which of the
100
+ # 0..58 bits it is (because we haven't seen a 'new minute' marker yet).
101
+ # Otherwise, use 'DCF77 bit x: val'.
102
+ s = 'B' if self.dcf77_bitnumber_is_known else 'Unknown b'
103
+ ann = 17 if self.dcf77_bitnumber_is_known else 18
104
+ self.putx([ann, ['%sit %d: %d' % (s, c, bit), '%d' % bit]])
105
+
106
+ # If we're not sure yet which of the 0..58 DCF77 bits we have, return.
107
+ # We don't want to decode bogus data.
108
+ if not self.dcf77_bitnumber_is_known:
109
+ return
110
+
111
+ # Collect bits 36-58, we'll need them for a parity check later.
112
+ if c in range(36, 58 + 1):
113
+ self.datebits.append(bit)
114
+
115
+ # Output specific "decoded" annotations for the respective DCF77 bits.
116
+ if c == 0:
117
+ # Start of minute: DCF bit 0.
118
+ if bit == 0:
119
+ self.putx([0, ['Start of minute (always 0)',
120
+ 'Start of minute', 'SoM']])
121
+ else:
122
+ self.putx([19, ['Start of minute != 0', 'SoM != 0']])
123
+ elif c in range(1, 14 + 1):
124
+ # Special bits (civil warnings, weather forecast): DCF77 bits 1-14.
125
+ if c == 1:
126
+ self.tmp = bit
127
+ self.ss_block = self.ss_bit
128
+ else:
129
+ self.tmp |= (bit << (c - 1))
130
+ if c == 14:
131
+ s = '{:014b}'.format(self.tmp)
132
+ self.putb([1, ['Special bits: %s' % s, 'SB: %s' % s]])
133
+ elif c == 15:
134
+ s = '' if (bit == 1) else 'not '
135
+ self.putx([2, ['Call bit: %sset' % s, 'CB: %sset' % s]])
136
+ # TODO: Previously this bit indicated use of the backup antenna.
137
+ elif c == 16:
138
+ s = '' if (bit == 1) else 'not '
139
+ x = 'yes' if (bit == 1) else 'no'
140
+ self.putx([3, ['Summer time announcement: %sactive' % s,
141
+ 'Summer time: %sactive' % s,
142
+ 'Summer time: %s' % x, 'ST: %s' % x]])
143
+ elif c == 17:
144
+ s = '' if (bit == 1) else 'not '
145
+ x = 'yes' if (bit == 1) else 'no'
146
+ self.putx([4, ['CEST: %sin effect' % s, 'CEST: %s' % x]])
147
+ elif c == 18:
148
+ s = '' if (bit == 1) else 'not '
149
+ x = 'yes' if (bit == 1) else 'no'
150
+ self.putx([5, ['CET: %sin effect' % s, 'CET: %s' % x]])
151
+ elif c == 19:
152
+ s = '' if (bit == 1) else 'not '
153
+ x = 'yes' if (bit == 1) else 'no'
154
+ self.putx([6, ['Leap second announcement: %sactive' % s,
155
+ 'Leap second: %sactive' % s,
156
+ 'Leap second: %s' % x, 'LS: %s' % x]])
157
+ elif c == 20:
158
+ # Start of encoded time: DCF bit 20.
159
+ if bit == 1:
160
+ self.putx([7, ['Start of encoded time (always 1)',
161
+ 'Start of encoded time', 'SoeT']])
162
+ else:
163
+ self.putx([19, ['Start of encoded time != 1', 'SoeT != 1']])
164
+ elif c in range(21, 27 + 1):
165
+ # Minutes (0-59): DCF77 bits 21-27 (BCD format).
166
+ if c == 21:
167
+ self.tmp = bit
168
+ self.ss_block = self.ss_bit
169
+ else:
170
+ self.tmp |= (bit << (c - 21))
171
+ if c == 27:
172
+ m = bcd2int(self.tmp)
173
+ self.putb([8, ['Minutes: %d' % m, 'Min: %d' % m]])
174
+ elif c == 28:
175
+ # Even parity over minute bits (21-28): DCF77 bit 28.
176
+ self.tmp |= (bit << (c - 21))
177
+ parity = bin(self.tmp).count('1')
178
+ s = 'OK' if ((parity % 2) == 0) else 'INVALID!'
179
+ self.putx([9, ['Minute parity: %s' % s, 'Min parity: %s' % s]])
180
+ elif c in range(29, 34 + 1):
181
+ # Hours (0-23): DCF77 bits 29-34 (BCD format).
182
+ if c == 29:
183
+ self.tmp = bit
184
+ self.ss_block = self.ss_bit
185
+ else:
186
+ self.tmp |= (bit << (c - 29))
187
+ if c == 34:
188
+ self.putb([10, ['Hours: %d' % bcd2int(self.tmp)]])
189
+ elif c == 35:
190
+ # Even parity over hour bits (29-35): DCF77 bit 35.
191
+ self.tmp |= (bit << (c - 29))
192
+ parity = bin(self.tmp).count('1')
193
+ s = 'OK' if ((parity % 2) == 0) else 'INVALID!'
194
+ self.putx([11, ['Hour parity: %s' % s]])
195
+ elif c in range(36, 41 + 1):
196
+ # Day of month (1-31): DCF77 bits 36-41 (BCD format).
197
+ if c == 36:
198
+ self.tmp = bit
199
+ self.ss_block = self.ss_bit
200
+ else:
201
+ self.tmp |= (bit << (c - 36))
202
+ if c == 41:
203
+ self.putb([12, ['Day: %d' % bcd2int(self.tmp)]])
204
+ elif c in range(42, 44 + 1):
205
+ # Day of week (1-7): DCF77 bits 42-44 (BCD format).
206
+ # A value of 1 means Monday, 7 means Sunday.
207
+ if c == 42:
208
+ self.tmp = bit
209
+ self.ss_block = self.ss_bit
210
+ else:
211
+ self.tmp |= (bit << (c - 42))
212
+ if c == 44:
213
+ d = bcd2int(self.tmp)
214
+ try:
215
+ dn = calendar.day_name[d - 1] # day_name[0] == Monday
216
+ self.putb([13, ['Day of week: %d (%s)' % (d, dn),
217
+ 'DoW: %d (%s)' % (d, dn)]])
218
+ except IndexError:
219
+ self.putb([19, ['Day of week: %d (%s)' % (d, 'invalid'),
220
+ 'DoW: %d (%s)' % (d, 'inv')]])
221
+ elif c in range(45, 49 + 1):
222
+ # Month (1-12): DCF77 bits 45-49 (BCD format).
223
+ if c == 45:
224
+ self.tmp = bit
225
+ self.ss_block = self.ss_bit
226
+ else:
227
+ self.tmp |= (bit << (c - 45))
228
+ if c == 49:
229
+ m = bcd2int(self.tmp)
230
+ try:
231
+ mn = calendar.month_name[m] # month_name[1] == January
232
+ self.putb([14, ['Month: %d (%s)' % (m, mn),
233
+ 'Mon: %d (%s)' % (m, mn)]])
234
+ except IndexError:
235
+ self.putb([19, ['Month: %d (%s)' % (m, 'invalid'),
236
+ 'Mon: %d (%s)' % (m, 'inv')]])
237
+ elif c in range(50, 57 + 1):
238
+ # Year (0-99): DCF77 bits 50-57 (BCD format).
239
+ if c == 50:
240
+ self.tmp = bit
241
+ self.ss_block = self.ss_bit
242
+ else:
243
+ self.tmp |= (bit << (c - 50))
244
+ if c == 57:
245
+ self.putb([15, ['Year: %d' % bcd2int(self.tmp)]])
246
+ elif c == 58:
247
+ # Even parity over date bits (36-58): DCF77 bit 58.
248
+ parity = self.datebits.count(1)
249
+ s = 'OK' if ((parity % 2) == 0) else 'INVALID!'
250
+ self.putx([16, ['Date parity: %s' % s, 'DP: %s' % s]])
251
+ self.datebits = []
252
+ else:
253
+ self.putx([19, ['Invalid DCF77 bit: %d' % c,
254
+ 'Invalid bit: %d' % c, 'Inv: %d' % c]])
255
+
256
+ def decode(self):
257
+ if not self.samplerate:
258
+ raise SamplerateError('Cannot decode without samplerate.')
259
+ while True:
260
+ if self.state == 'WAIT FOR RISING EDGE':
261
+ # Wait until the next rising edge occurs.
262
+ self.wait({0: 'r'})
263
+
264
+ # Save the sample number where the DCF77 bit begins.
265
+ self.ss_bit = self.samplenum
266
+
267
+ # Calculate the length (in ms) between two rising edges.
268
+ len_edges = self.ss_bit - self.ss_bit_old
269
+ len_edges_ms = int((len_edges / self.samplerate) * 1000)
270
+
271
+ # The time between two rising edges is usually around 1000ms.
272
+ # For DCF77 bit 59, there is no rising edge at all, i.e. the
273
+ # time between DCF77 bit 59 and DCF77 bit 0 (of the next
274
+ # minute) is around 2000ms. Thus, if we see an edge with a
275
+ # 2000ms distance to the last one, this edge marks the
276
+ # beginning of a new minute (and DCF77 bit 0 of that minute).
277
+ if len_edges_ms in range(1600, 2400 + 1):
278
+ self.bitcount = 0
279
+ self.ss_bit_old = self.ss_bit
280
+ self.dcf77_bitnumber_is_known = 1
281
+
282
+ self.ss_bit_old = self.ss_bit
283
+ self.state = 'GET BIT'
284
+
285
+ elif self.state == 'GET BIT':
286
+ # Wait until the next falling edge occurs.
287
+ self.wait({0: 'f'})
288
+
289
+ # Save the sample number where the DCF77 bit ends.
290
+ self.es_bit = self.samplenum
291
+
292
+ # Calculate the length (in ms) of the current high period.
293
+ len_high = self.samplenum - self.ss_bit
294
+ len_high_ms = int((len_high / self.samplerate) * 1000)
295
+
296
+ # If the high signal was 100ms long, that encodes a 0 bit.
297
+ # If it was 200ms long, that encodes a 1 bit.
298
+ if len_high_ms in range(40, 160 + 1):
299
+ bit = 0
300
+ elif len_high_ms in range(161, 260 + 1):
301
+ bit = 1
302
+ else:
303
+ bit = -1
304
+
305
+ if bit in (0, 1):
306
+ self.handle_dcf77_bit(bit)
307
+ self.bitcount += 1
308
+ else:
309
+ self.putx([19, ['Invalid bit timing', 'Inv timing', 'Inv']])
310
+
311
+ self.state = 'WAIT FOR RISING EDGE'
@@ -0,0 +1,25 @@
1
+ ##
2
+ ## This file is part of the libsigrokdecode project.
3
+ ##
4
+ ## Copyright (C) 2019 Gerhard Sittig <gerhard.sittig@gmx.net>
5
+ ##
6
+ ## This program is free software; you can redistribute it and/or modify
7
+ ## it under the terms of the GNU General Public License as published by
8
+ ## the Free Software Foundation; either version 2 of the License, or
9
+ ## (at your option) any later version.
10
+ ##
11
+ ## This program is distributed in the hope that it will be useful,
12
+ ## but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ ## GNU General Public License for more details.
15
+ ##
16
+ ## You should have received a copy of the GNU General Public License
17
+ ## along with this program; if not, see <http://www.gnu.org/licenses/>.
18
+ ##
19
+
20
+ '''
21
+ DMX512 (Digital MultipleX 512) is a protocol based on RS485, used to control
22
+ professional lighting fixtures.
23
+ '''
24
+
25
+ from .pd import Decoder