uC chip interface arduino  0.9.0
A interface for async and neuromrphic IC testing
Loading...
Searching...
No Matches
header.py
Go to the documentation of this file.
2# This file is part of the Firmware project to interface with small Async or Neuromorphic chips
3# Copyright (C) 2022-2023 Ole Richter - University of Groningen
4# Copyright (C) 2024 Vincent Jassies - University of Groningen
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 3 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 <https://www.gnu.org/licenses/>.
18
19
20import enum
21"""
22 the packet header are byte that identifies the instruction to be executed by the uC
23 order is as follows
24 - general commands
25 - write to interface PIN, AER, SPI
26 - configure Interfaces
27"""
28
29
30"""
31for simplisity Commands use the Data32bitPacket class
32with value field empty
33"""
34
35@enum.unique
36class Data32bitHeader(enum.IntEnum) :
37 """Data32bitHeader are all command headers used in Data32bitPacket.
38
39 the description explains the function of the individual commands.
40 some commands ignore the value.
41 """
42
43 def __new__(cls, value, doc=None):
44 """
45 overwrite to enable __doc__ strings for enum elements as second argument.
46 """
47 self = int.__new__(cls, value) # calling super().__new__(value) here would fail
48 self._value_ = value
49 if doc is not None:
50 self.__doc__ = doc
51 return self
52
53 UC_CLOSE_CONNECTION = 255, """
54 this packet tells the PC buffer to close the connection to the uC
55 """
56
57 IN_RESET = 254, """
58 this packet is used to software reset the uC (clear the config), no harware reset is performed
59 """
60
61 IN_READ = 0, """
62 read all availiable output packets out of the output buffer, and clear the buffer afterwards
63 uses data:
64 - value is ignored
65 """
66
67 IN_READ_LAST = 4, """
68 read only the last package, does not remove this package from the ring buffer
69 - value is ignored
70 """
71
72 IN_READ_TIME = 2, """
73 return the current execution time to the output buffer
74 uses data
75 - value is ignored
76 """
77
78 IN_READ_INSTRUCTIONS = 3, """
79 read all availiable input packets out of the input buffer that have not been processed
80 uses data
81 - value is ignored
82 """
83
84 OUT_BUFFER_LAST_READ = 250, """
85 this packet is used to destinguish between an empty and a full buffer
86 uses data
87 - value is 1 so ignore
88 """
89
90 IN_FREE_INSTRUCTION_SPOTS = 5, """
91 this packet is used to request how many free spots there are in the instruction ring buffer
92 """
93
94 OUT_FREE_INSTRUCTION_SPOTS = 101, """
95 this packet is used to report how many free spots there are in the instruction ring buffer
96 """
97
98 IN_CONF_READ_ON_REQUEST = 6, """
99 legacy mode: turn off automatic sending of the output buffer
100 uses config
101 - value 1 for read on request (legacy)
102 - value 0 for continous read (default)
103 @todo move to sub config
104 """
105
106 IN_SET_TIME = 1, """
107 set the execution time, if set to 0 recording and exec are halted
108 if set to 1 (or bigger) exec and recoding will be started from timestep 1 (or bigger)
109 uses data
110 - value is the time current to be set, maximum experiment time is 2^32 usec
111 """
112
113 OUT_TIME = 100, """
114 responce to the READ_TIME packet
115 uses data
116 - exec_time the current run time
117 - value the system_time (without run time offset)
118 """
119
120
121 IN_SPI0 = 20, """
122 sends an 32bit word on the SPI0 interface
123 uses data32
124 - value is the 32bit to be send
125 """
126
127
128 IN_SPI1 = 21, """
129 sends an 32bit word on the SPI1 interface
130 uses data32
131 - value is the 32bit to be send
132 """
133
134 IN_SPI2 = 22, """
135 sends an 32bit word on the SPI2 interface
136 uses data32
137 - value is the 32bit to be send
138 """
139
140 OUT_SPI0 = 120, """
141 responce to the IN_SPI0_32 packet
142 uses data32
143 - exec_time the current run time
144 - value the 32bit word that was read on the SPI
145 """
146
147 OUT_SPI1 = 121, """
148 responce to the IN_SPI1_32 packet
149 uses data32
150 - exec_time the current run time
151 - value the 32bit word that was read on the SPI
152 """
153
154 OUT_SPI2 = 122, """
155 responce to the IN_SPI2_32 packet
156 uses data32
157 - exec_time the current run time
158 - value the 32bit word that was read on the SPI
159 """
160
161 IN_ASYNC_TO_CHIP0 = 30, """
162 sends an 0-32bit word on the ASYNC_TO_CHIP0 interface
163 uses data
164 - value is the word to be send, if the width is configured to >32 the MS bits are ignored
165 """
166
167 IN_ASYNC_TO_CHIP1 = 31 , """
168 sends an 0-32bit word on the ASYNC_TO_CHIP1 interface
169 uses data
170 - value is the word to be send, if the width is configured to >32 the MS bits are ignored
171 """
172
173 IN_ASYNC_TO_CHIP2 = 32, """
174 sends an 0-32bit word on the ASYNC_TO_CHIP2 interface
175 uses data
176 - value is the word to be send, if the width is configured to >32 the MS bits are ignored
177 """
178
179 IN_ASYNC_TO_CHIP3 = 33, """
180 sends an 0-32bit word on the ASYNC_TO_CHIP3 interface
181 uses data
182 - value is the word to be send, if the width is configured to >32 the MS bits are ignored
183 """
184
185 IN_ASYNC_TO_CHIP4 = 34, """
186 sends an 0-32bit word on the ASYNC_TO_CHIP4 interface
187 uses data
188 - value is the word to be send, if the width is configured to >32 the MS bits are ignored
189 """
190
191 IN_ASYNC_TO_CHIP5 = 35, """
192 sends an 0-32bit word on the ASYNC_TO_CHIP5 interface
193 uses data
194 - value is the word to be send, if the width is configured to >32 the MS bits are ignored
195 """
196
197 IN_ASYNC_TO_CHIP6 = 36, """
198 sends an 0-32bit word on the ASYNC_TO_CHIP6 interface
199 uses data
200 - value is the word to be send, if the width is configured to >32 the MS bits are ignored
201 """
202
203 IN_ASYNC_TO_CHIP7 = 37, """
204 sends an 0-32bit word on the ASYNC_TO_CHIP7 interface
205 uses data
206 - value is the word to be send, if the width is configured to >32 the MS bits are ignored
207 """
208
209
210 OUT_ASYNC_FROM_CHIP0 = 130, """
211 a event was reseved on ASYNC_FROM_CHIP0
212 uses data
213 - exec_time the current run time
214 - value the 0-32bit word that was read on the AER
215 """
216
217 OUT_ASYNC_FROM_CHIP1 = 131, """
218 a event was reseved on ASYNC_FROM_CHIP1
219 uses data
220 - exec_time the current run time
221 - value the 0-32bit word that was read on the AER
222 """
223
224 OUT_ASYNC_FROM_CHIP2 = 132, """
225 a event was reseved on ASYNC_FROM_CHIP2
226 uses data
227 - exec_time the current run time
228 - value the 0-32bit word that was read on the AER
229 """
230
231 OUT_ASYNC_FROM_CHIP3 = 133, """
232 a event was reseved on ASYNC_FROM_CHIP3
233 uses data
234 - exec_time the current run time
235 - value the 0-32bit word that was read on the AER
236 """
237
238 OUT_ASYNC_FROM_CHIP4 = 134, """
239 a event was reseved on ASYNC_FROM_CHIP4
240 uses data
241 - exec_time the current run time
242 - value the 0-32bit word that was read on the AER
243 """
244
245 OUT_ASYNC_FROM_CHIP5 = 135, """
246 a event was reseved on ASYNC_FROM_CHIP5
247 uses data
248 - exec_time the current run time
249 - value the 0-32bit word that was read on the AER
250 """
251
252 OUT_ASYNC_FROM_CHIP6 = 136, """
253 a event was reseved on ASYNC_FROM_CHIP6
254 uses data
255 - exec_time the current run time
256 - value the 0-32bit word that was read on the AER
257 """
258
259 OUT_ASYNC_FROM_CHIP7 = 137, """
260 a event was reseved on ASYNC_FROM_CHIP7
261 uses data
262 - exec_time the current run time
263 - value the 0-32bit word that was read on the AER
264 """
265
266 IN_MAPPER_KEY = 190, """
267 in mapper key switches into sequence transmission mode,
268 the next packet is considered the key all subsequent packages
269 are considdered values until IN_MAPPER_END.
270 """
271
272 IN_MAPPER_END = 191, """
273 In mapper end switches back to normal packet exec mode.
274 """
275
276@enum.unique
277class PinHeader(enum.IntEnum) :
278 """PinHeader are all command headers used in PinPacket.
279
280 the description explains the function of the individual commands.
281 """
282
283 def __new__(cls, value, doc=None):
284 """
285 overwrite to enable __doc__ strings for enum elements as second argument.
286 """
287 self = int.__new__(cls, value) # calling super().__new__(value) here would fail
288 self._value_ = value
289 if doc is not None:
290 self.__doc__ = doc
291 return self
292
293 IN_PIN = 10, """
294 send a modify output pin command
295 uses pin
296 - pin is the pin number
297 - value is 0 or 1 for low or high
298 """
299
300 IN_PIN_READ = 11, """
301 send a read input pin command
302 uses pin
303 - pin is the pin number
304 - value is ignored
305 """
306
307 OUT_PIN_LOW = 110, """
308 After a input pin change this records the change
309 uses pin
310 - exec_time the time the change occured
311 - pin the pin id
312 - value the new state
313 """
314
315 OUT_PIN_HIGH = 111, """
316 After a input pin change this records the change
317 uses pin
318 - exec_time the time the change occured
319 - pin the pin id
320 - value the new state
321 """
322
323@enum.unique
324class DataI2CHeader(enum.IntEnum) :
325 """DataI2CHeader are all command headers used in DataI2CPacket.
326
327 the description explains the function of the individual commands.
328 """
329
330 def __new__(cls, value, doc=None):
331 """
332 overwrite to enable __doc__ strings for enum elements as second argument.
333 """
334 self = int.__new__(cls, value) # calling super().__new__(value) here would fail
335 self._value_ = value
336 if doc is not None:
337 self.__doc__ = doc
338 return self
339
340 IN_I2C0 = 25, """
341 sends an 8 or 16 bit word or recives a specified number of bytes on the I2C interface
342 uses data_i2c
343 - device_address is the 7bit (MS) address of the device and the LSB indicates Read(1)/Write(0) following the i2c standard
344 - register_address is the 8bit register address
345 - value_ms is the MS 8bit to be send
346 - value_ls is the LS 8bit to be send or the number of bytes to read
347 """
348
349 IN_I2C1 = 26, """
350 sends an 8 or 16 bit word or recives a specified number of bytes on the I2C interface
351 uses data_i2c
352 - device_address is the 7bit (MS) address of the device and the LSB indicates Read(1)/Write(0) following the i2c standard
353 - register_address is the 8bit register address
354 - value_ms is the MS 8bit to be send
355 - value_ls is the LS 8bit to be send or the number of bytes to read
356 """
357
358 IN_I2C2 = 27, """
359 sends an 8 or 16 bit word or recives a specified number of bytes on the I2C interface
360 uses data_i2c
361 - device_address is the 7bit (MS) address of the device and the LSB indicates Read(1)/Write(0) following the i2c standard
362 - register_address is the 8bit register address
363 - value_ms is the MS 8bit to be send
364 - value_ls is the LS 8bit to be send or the number of bytes to read
365 """
366
367 OUT_I2C0 = 125, """
368 responce to the IN_SPI0 packet
369 uses data_i2c
370 - exec_time the current run time
371 - value the 8bit word that was read on the SPI
372 """
373
374 OUT_I2C1 = 126, """
375 responce to the IN_SPI1 packet
376 uses data_i2c
377 - exec_time the current run time
378 - value the 8bit word that was read on the SPI
379 """
380
381 OUT_I2C2 = 127, """
382 responce to the IN_SPI2 packet
383 uses data_i2c
384 - exec_time the current run time
385 - value the 8bit word that was read on the SPI
386 """
387
388@enum.unique
389class ConfigMainHeader(enum.IntEnum) :
390 """
391 ConfigMainHeader are all command headers used in ConfigPacket in conjunction with ConfigSubHeader.
392
393 The description explains the function of the individual commands.
394 The main header specifies the interface to be configured and the sub header the property
395 which should be configured.
396 """
397
398 def __new__(cls, value, doc=None):
399 """
400 overwrite to enable __doc__ strings for enum elements as second argument.
401 """
402 self = int.__new__(cls, value) # calling super().__new__(value) here would fail
403 self._value_ = value
404 if doc is not None:
405 self.__doc__ = doc
406 return self
407
408
409 IN_CONF_READ_ON_REQUEST = 6, """
410 legacy mode: turn off automatic sending of the output buffer
411 - value 1 for read on request (legacy)
412 - value 0 for continous read (default)
413 """
414
415 IN_CONF_PIN = 50, """
416 sets the pin configuration
417 uses config
418 - config/sub header is the config state to be applied the pin
419 - value is the pin id
420 """
421
422 IN_CONF_SPI0 = 60, """
423 sets the spi0 configuration
424 uses config
425 - config/sub header is the config state to be applied the spi
426 - value is used according to the config sub header
427 """
428
429 IN_CONF_SPI1 = 61, """
430 sets the spi1 configuration
431 uses config
432 - config/sub header is the config state to be applied the spi
433 - value is used according to the config sub header
434 """
435
436 IN_CONF_SPI2 = 62, """
437 sets the spi2 configuration
438 uses config
439 - config/sub header is the config state to be applied the spi
440 - value is used according to the config sub header
441 """
442
443 IN_CONF_I2C0 = 65, """
444 sets the i2c0 configuration
445 uses config
446 - config/sub header is the config state to be applied the spi
447 - value is used according to the config sub header
448 """
449
450 IN_CONF_I2C1 = 66, """
451 sets the i2c1 configuration
452 uses config
453 - config/sub header is the config state to be applied the spi
454 - value is used according to the config sub header
455 """
456
457 IN_CONF_I2C2 = 67, """
458 sets the i2c2 configuration
459 uses config
460 - config/sub header is the config state to be applied the spi
461 - value is used according to the config sub header
462 """
463
464 IN_CONF_ASYNC_TO_CHIP0 = 70, """
465 sets the ASYNC_TO_CHIP0 configuration
466 uses config
467 - config/sub header is the config state to be applied the aer interface
468 - value is used according to the config sub header
469 """
470
471 IN_CONF_ASYNC_TO_CHIP1 = 71, """
472 sets the ASYNC_TO_CHIP1 configuration
473 uses config
474 - config/sub header is the config state to be applied the aer interface
475 - value is used according to the config sub header
476 """
477
478 IN_CONF_ASYNC_TO_CHIP2 = 72, """
479 sets the ASYNC_TO_CHIP2 configuration
480 uses config
481 - config/sub header is the config state to be applied the aer interface
482 - value is used according to the config sub header
483 """
484
485 IN_CONF_ASYNC_TO_CHIP3 = 73, """
486 sets the ASYNC_TO_CHIP3 configuration
487 uses config
488 - config/sub header is the config state to be applied the aer interface
489 - value is used according to the config sub header
490 """
491
492 IN_CONF_ASYNC_TO_CHIP4 = 74, """
493 sets the ASYNC_TO_CHIP4 configuration
494 uses config
495 - config/sub header is the config state to be applied the aer interface
496 - value is used according to the config sub header
497 """
498
499 IN_CONF_ASYNC_TO_CHIP5 = 75, """
500 sets the ASYNC_TO_CHIP5 configuration
501 uses config
502 - config/sub header is the config state to be applied the aer interface
503 - value is used according to the config sub header
504 """
505
506 IN_CONF_ASYNC_TO_CHIP6 = 76, """
507 sets the ASYNC_TO_CHIP6 configuration
508 uses config
509 - config/sub header is the config state to be applied the aer interface
510 - value is used according to the config sub header
511 """
512
513 IN_CONF_ASYNC_TO_CHIP7 = 77, """
514 sets the ASYNC_TO_CHIP7 configuration
515 uses config
516 - config/sub header is the config state to be applied the aer interface
517 - value is used according to the config sub header
518 """
519
520 IN_CONF_ASYNC_FROM_CHIP0 = 80, """
521 sets the ASYNC_FROM_CHIP0 configuration
522 uses config
523 - config/sub header is the config state to be applied the aer interface
524 - value is used according to the config sub header
525 """
526
527 IN_CONF_ASYNC_FROM_CHIP1 = 81, """
528 sets the ASYNC_FROM_CHIP1 configuration
529 uses config
530 - config/sub header is the config state to be applied the aer interface
531 - value is used according to the config sub header
532 """
533
534 IN_CONF_ASYNC_FROM_CHIP2 = 82, """
535 sets the ASYNC_FROM_CHIP2 configuration
536 uses config
537 - config/sub header is the config state to be applied the aer interface
538 - value is used according to the config sub header
539 """
540
541 IN_CONF_ASYNC_FROM_CHIP3 = 83, """
542 sets the ASYNC_FROM_CHIP3 configuration
543 uses config
544 - config/sub header is the config state to be applied the aer interface
545 - value is used according to the config sub header
546 """
547
548 IN_CONF_ASYNC_FROM_CHIP4 = 84, """
549 sets the ASYNC_FROM_CHIP4 configuration
550 uses config
551 - config/sub header is the config state to be applied the aer interface
552 - value is used according to the config sub header
553 """
554
555 IN_CONF_ASYNC_FROM_CHIP5 = 85, """
556 sets the ASYNC_FROM_CHIP5 configuration
557 uses config
558 - config/sub header is the config state to be applied the aer interface
559 - value is used according to the config sub header
560 """
561
562 IN_CONF_ASYNC_FROM_CHIP6 = 86, """
563 sets the ASYNC_FROM_CHIP6 configuration
564 uses config
565 - config/sub header is the config state to be applied the aer interface
566 - value is used according to the config sub header
567 """
568
569 IN_CONF_ASYNC_FROM_CHIP7 = 87, """
570 sets the ASYNC_FROM_CHIP7 configuration
571 uses config
572 - config/sub header is the config state to be applied the aer interface
573 - value is used according to the config sub header
574 """
575
576
577"""
578@TODO some of them use other formates but did not had time to sort them yet
579"""
580@enum.unique
581class ErrorHeader(enum.IntEnum) :
582 """
583 ErrorHeader are all command headers used in ErrorPacket.
584
585 Errors are issued by the uC to tell the user what went wrong.
586 The description explains the meaning of the individual errors.
587
588 the causing errors can be found in org_header and org_sub_header
589 the causeing valuse is stored in value, if a value does not make sense
590 for that error class it is the current timestamp of the uC.
591 """
592
593 def __new__(cls, value, doc=None):
594 """
595 overwrite to enable __doc__ strings for enum elements as second argument.
596 """
597 self = int.__new__(cls, value) # calling super().__new__(value) here would fail
598 self._value_ = value
599 if doc is not None:
600 self.__doc__ = doc
601 return self
602
603 OUT_ERROR = 200, """
604 Unspecified error. Something went wrong, and the microcontroller doesn't know why.
605 """
606
607 OUT_ERROR_PIN_ALREADY_INUSE = 201, """
608 The pin or interface you’re trying to activate is already in use or was previously configured. To reset,
609 call close_connection() on the uC_api, then create a new uC_api instance to reconnect after the microcontroller resets.
610 """
611
612 OUT_ERROR_PIN_NOT_CONFIGURED = 202, """
613 The pin you’re attempting to use isn’t configured. Please initialize it first by calling pin[X].activate(<options>)
614 or sending the necessary configuration packets.
615 """
616
617 OUT_ERROR_INPUT_FULL = 203, """
618 The timed instruction buffer is full, so new instructions cannot be stored and will be discarded.
619 """
620
621 OUT_ERROR_OUTPUT_FULL = 204, """
622 The output buffer is full, causing packets to be dropped. The value shown is the count of dropped packets.
623 """
624
625 OUT_ERROR_INTERFACE_ALREADY_ACTIVE = 205, """
626 The interface you’re trying to activate is already configured and active. To reconfigure, call close_connection()
627 on the uC_api, then create a new uC_api instance to reconnect after the microcontroller resets.
628 """
629
630 OUT_ERROR_UNKNOWN_INSTRUCTION = 206, """
631 The instruction header sent is unrecognized or invalid for the microcontroller,
632 possibly due to an API and firmware version mismatch.
633 """
634
635 OUT_ERROR_INTERFACE_NOT_ACTIVE = 207, """
636 The interface you're trying to use is not yet configured. Please initialize it by calling
637 <interface>[X].activate(<options>) or sending the necessary configuration packets.
638 """
639
640 OUT_ERROR_UNKNOWN_CONFIGURATION = 208, """
641 The configuration header sent is unrecognized or invalid for the microcontroller,
642 possibly due to an API and firmware version mismatch.
643 """
644
645 OUT_ERROR_ASYNC_HS_TIMEOUT = 209, """
646 The asynchronous sending interface has not received an acknowledgment for some time and
647 has reset the request. Please restart or reset the Device Under Test (DuT).
648 """
649
650 OUT_ERROR_PERIPHERAL_INTERFACE_NOT_READY = 210, """
651 This error occurs when a peripheral interface is not ready, such as when the I2C for the MCP23017 is not available.
652 """
653
654 OUT_ERROR_CONFIGURATION_OUT_OF_BOUNDS = 211, """
655 The configuration ID sent exceeds the available microcontroller resources. Please check the ID, as it is invalid.
656 """
657
658 OUT_ERROR_DATA_OUT_OF_BOUNDS = 212, """
659 The data sent exceeds the configured bit/byte word length of the interface. Please check the data, as it is invalid.
660 """
661
662 OUT_WARNING_DATA_COLLECTION_SQUEUED = 213, """
663 Data collection is taking too long due to excessive requests, preventing the microcontroller from transmitting data to the PC.
664 Consequently, the uC will temporarily pause data collection to send approximately 10 packets to the PC before resuming data collection.
665 This warning will be issued only once.
666 """
667
668 OUT_ALIGN_SUCCESS_VERSION = 253, """
669 This response to the alignment request confirms the connection with the microcontroller and includes the
670 firmware version to verify the correct version is running. The format is as follows (uses the error_package struct):
671 - org_header: major version (8-bit)
672 - sub_header: minor version (8-bit)
673 - value: patch version (32-bit)
674 """
675
676
677
678"""
679to make sure that all headers are unique, and to access all of them independen of thier class
680"""
681"""
682@enum.unique
683class AllHeaders(Data32bitHeader, PinHeader, Data8bitHeader, ConfigMainHeader, ErrorHeader):
684 pass
685"""
686
687
688class ConfigSubHeader(enum.IntEnum):
689 """
690 ConfigSubHeader are all command headers used in ConfigPacket in conjunction with ConfigMainHeader.
691
692 The description explains the function of the individual commands.
693 The main header specifies the interface to be configured and the sub header the property
694 which should be configured.
695 """
696
697 def __new__(cls, value, doc=None):
698 """
699 overwrite to enable __doc__ strings for enum elements as second argument.
700 """
701 self = int.__new__(cls, value) # calling super().__new__(value) here would fail
702 self._value_ = value
703 if doc is not None:
704 self.__doc__ = doc
705 return self
706
707 CONF_ACTIVE = 60, """
708 set an interface to active, after activation the pins/width cant be changed anymore
709 works for spi and aer, activation will fail if pins are already used for other interfaces
710 @TODO deactivation not implemented yet sould be new header for compatebility
711 uses config
712 - value is ignored
713 """
714
715 CONF_OUTPUT = 61, """
716 set a pin to output to be able to write on it
717 uses config
718 - value is ID of pin
719 """
720
721 CONF_INPUT = 62, """
722 set a pin to input, it registers an interupt service
723 to record all incomming changes
724 uses config
725 - value is ID of pin
726 """
727
728 CONF_REQ = 70, """
729 sets the Req pin for the given AER interface
730 uses config
731 - value is ID of pin
732 """
733
734 CONF_ACK = 71, """
735 sets the Ack pin for the given AER interface
736 uses config
737 - value is ID of pin
738 """
739
740 CONF_WIDTH = 72, """
741 sets the bit width of the given AER interface
742 uses config
743 - value is width 0-32
744 """
745
746 CONF_REQ_DELAY = 73, """
747 set the delay on the request line
748 uses config
749 - value the delay in multiple of 20ns
750 """
751
752 CONF_BYTE_ORDER = 74, """
753 interface_order
754 - value LSFIRST = 0 and MSFIRST = 1 - default is 0
755 """
756
757 CONF_SPEED_CLASS = 75, """
758 interface speed class se interface doc
759 """
760
761 CONF_TYPE = 76, """
762 interface_type
763 - value type id (see interface doc) - default is 0
764 """
765
766 CONF_NONE = 255, "indication of no sub category"
767
768 CONF_CHANNEL0 = 0, "setting the pin for Async data channel"
769 CONF_CHANNEL1 = 1, "setting the pin for Async data channel"
770 CONF_CHANNEL2 = 2, "setting the pin for Async data channel"
771 CONF_CHANNEL3 = 3, "setting the pin for Async data channel"
772 CONF_CHANNEL4 = 4, "setting the pin for Async data channel"
773 CONF_CHANNEL5 = 5, "setting the pin for Async data channel"
774 CONF_CHANNEL6 = 6, "setting the pin for Async data channel"
775 CONF_CHANNEL7 = 7, "setting the pin for Async data channel"
776 CONF_CHANNEL8 = 8, "setting the pin for Async data channel"
777 CONF_CHANNEL9 = 9, "setting the pin for Async data channel"
778 CONF_CHANNEL10 = 10, "setting the pin for Async data channel"
779 CONF_CHANNEL11 = 11, "setting the pin for Async data channel"
780 CONF_CHANNEL12 = 12, "setting the pin for Async data channel"
781 CONF_CHANNEL13 = 13, "setting the pin for Async data channel"
782 CONF_CHANNEL14 = 14, "setting the pin for Async data channel"
783 CONF_CHANNEL15 = 15, "setting the pin for Async data channel"
784 CONF_CHANNEL16 = 16, "setting the pin for Async data channel"
785 CONF_CHANNEL17 = 17, "setting the pin for Async data channel"
786 CONF_CHANNEL18 = 18, "setting the pin for Async data channel"
787 CONF_CHANNEL19 = 19, "setting the pin for Async data channel"
788 CONF_CHANNEL20 = 20, "setting the pin for Async data channel"
789 CONF_CHANNEL21 = 21, "setting the pin for Async data channel"
790 CONF_CHANNEL22 = 22, "setting the pin for Async data channel"
791 CONF_CHANNEL23 = 23, "setting the pin for Async data channel"
792 CONF_CHANNEL24 = 24, "setting the pin for Async data channel"
793 CONF_CHANNEL25 = 25, "setting the pin for Async data channel"
794 CONF_CHANNEL26 = 26, "setting the pin for Async data channel"
795 CONF_CHANNEL27 = 27, "setting the pin for Async data channel"
796 CONF_CHANNEL28 = 28, "setting the pin for Async data channel"
797 CONF_CHANNEL29 = 29, "setting the pin for Async data channel"
798 CONF_CHANNEL30 = 30, "setting the pin for Async data channel"
799 CONF_CHANNEL31 = 31, "setting the pin for Async data channel"
800
801
802"""
803the 2 packets are used to align the communication between the PC and the uC
804"""
805ALIGN_BYTEARRAY = b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfd\x00\x00\x00\x00\x00\x00\x00\x00'
806
807"""
808list of headers that should be logged on arrival
809errors are logged by default
810"""
811LOGGING_WARNING_LIST = [Data32bitHeader.IN_RESET]
812LOGGING_INFO_LIST = []
813
815 """
816 add a header to the list of logged warnings
817 """
818 LOGGING_WARNING_LIST.append(header)
819
821 """
822 remove a header from the list of logged warnings
823 """
824 LOGGING_WARNING_LIST.remove(header)
825
826def subscribe_info(header):
827 """
828 add a header to the list of logged info
829 """
830 LOGGING_INFO_LIST.append(header)
831
833 """
834 remove a header from the list of logged info
835 """
836 LOGGING_INFO_LIST.remove(header)
ConfigMainHeader are all command headers used in ConfigPacket in conjunction with ConfigSubHeader.
Definition: header.py:389
def __new__(cls, value, doc=None)
overwrite to enable doc strings for enum elements as second argument.
Definition: header.py:398
def __new__(cls, value, doc=None)
overwrite to enable doc strings for enum elements as second argument.
Definition: header.py:697
Data32bitHeader are all command headers used in Data32bitPacket.
Definition: header.py:36
def __new__(cls, value, doc=None)
overwrite to enable doc strings for enum elements as second argument.
Definition: header.py:43
def __new__(cls, value, doc=None)
overwrite to enable doc strings for enum elements as second argument.
Definition: header.py:330
ErrorHeader are all command headers used in ErrorPacket.
Definition: header.py:581
def __new__(cls, value, doc=None)
overwrite to enable doc strings for enum elements as second argument.
Definition: header.py:593
PinHeader are all command headers used in PinPacket.
Definition: header.py:277
def __new__(cls, value, doc=None)
overwrite to enable doc strings for enum elements as second argument.
Definition: header.py:283
def subscribe_info(header)
add a header to the list of logged info
Definition: header.py:826
def unsubscribe_info(header)
remove a header from the list of logged info
Definition: header.py:832
def unsubscribe_warning(header)
remove a header from the list of logged warnings
Definition: header.py:820
def subscribe_warning(header)
add a header to the list of logged warnings
Definition: header.py:814