예제 #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')
         ])
예제 #2
0
파일: core_api.py 프로젝트: rolaya/gateway
 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')])
예제 #3
0
파일: slave_api.py 프로젝트: rolaya/gateway
 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')
                             ])
예제 #4
0
파일: core_api.py 프로젝트: rolaya/gateway
 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')
                            ])
예제 #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')
                            ])
예제 #6
0
파일: slave_api.py 프로젝트: rolaya/gateway
 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')])
예제 #7
0
 def firmware_information():  # type: () -> CoreCommandSpec
     """ Firmware information """
     return CoreCommandSpec(
         instruction='FW',
         response_fields=[AddressField('address'),
                          VersionField('version')])