Beispiel #1
0
 def read_ucan_config():  # type: () -> UCANCommandSpec
     """ Reads the full uCAN config """
     return UCANCommandSpec(
         sid=SID.NORMAL_COMMAND,
         identifier=AddressField('ucan_address', 3),
         instructions=[Instruction(instruction=[0, 199])],
         response_instructions=[
             Instruction(instruction=[i, 199], checksum_byte=7)
             for i in range(1, 14)
         ],
         response_fields=[
             ByteField('input_link_0'),
             ByteField('input_link_1'),
             ByteField('input_link_2'),
             ByteField('input_link_3'),
             ByteField('input_link_4'),
             ByteField('input_link_5'),
             ByteField('sensor_link_0'),
             ByteField('sensor_link_1'),
             ByteField('sensor_type'),
             VersionField('firmware_version'),
             ByteField('bootloader'),
             ByteField('new_indicator'),
             ByteField('min_led_brightness'),
             ByteField('max_led_brightness'),
             WordField('adc_input_2'),
             WordField('adc_input_3'),
             WordField('adc_input_4'),
             WordField('adc_input_5'),
             WordField('adc_dc_input')
         ])
Beispiel #2
0
 def get_firmware_version():  # type: () -> CoreCommandSpec
     """ Receives the Core firmware version """
     return CoreCommandSpec(
         instruction='ST',
         request_fields=[LiteralBytesField(1)],
         response_fields=[ByteField('info_type'),
                          VersionField('version')])
Beispiel #3
0
 def get_firmware_version():  # type: () -> SlaveCommandSpec
     """ Gets a slave firmware version """
     return SlaveCommandSpec(instruction=Instruction(instruction='FV',
                                                     padding=9),
                             response_fields=[
                                 ByteField('return_code'),
                                 ByteField('hardware_version'),
                                 VersionField('version'),
                                 ByteField('status')
                             ])
Beispiel #4
0
 def ucan_module_information():  # type: () -> CoreCommandSpec
     """ Receives information from a uCAN module """
     return CoreCommandSpec(instruction='CD',
                            response_fields=[
                                AddressField('ucan_address', 3),
                                WordArrayField('input_links', 6),
                                ByteArrayField('sensor_links', 2),
                                ByteField('sensor_type'),
                                VersionField('version'),
                                ByteField('bootloader'),
                                CharField('new_indicator'),
                                ByteField('min_led_brightness'),
                                ByteField('max_led_brightness')
                            ])
Beispiel #5
0
 def get_version():  # type: () -> UCANCommandSpec
     """ Gets a uCAN version """
     return UCANCommandSpec(sid=SID.NORMAL_COMMAND,
                            identifier=AddressField('ucan_address', 3),
                            instructions=[
                                Instruction(instruction=[0, 198]),
                                Instruction(instruction=[0, 198])
                            ],
                            request_fields=[[LiteralBytesField(5)],
                                            [LiteralBytesField(6)]],
                            response_instructions=[
                                Instruction(instruction=[5, 199],
                                            checksum_byte=7),
                                Instruction(instruction=[6, 199],
                                            checksum_byte=7)
                            ],
                            response_fields=[
                                ByteField('sensor_type'),
                                VersionField('firmware_version')
                            ])
Beispiel #6
0
 def set_firmware_version():  # type: () -> SlaveCommandSpec
     """ Sets the version of the firmware version to flash """
     return SlaveCommandSpec(instruction=Instruction(instruction='FN',
                                                     padding=6),
                             request_fields=[VersionField('version')],
                             response_fields=[ByteField('return_code')])
Beispiel #7
0
 def firmware_information():  # type: () -> CoreCommandSpec
     """ Firmware information """
     return CoreCommandSpec(
         instruction='FW',
         response_fields=[AddressField('address'),
                          VersionField('version')])