def errors(self): ''' :rtype: (Studio._private.StudioClasses.com_silabs_ide_halconf_core_client_IPropertyReference, str) :return: A list of property/error message tuples ''' if self.__getNumAssignments() > 1: for route in self.routes: conflictinglabels = self.__getAssignmentList() conflictinglabels.remove(route.getLabel()) yield (route.getPropRef(), '{0} pin assignment conflicts with {1}'.format( route.getLabel(), ', '.join(conflictinglabels))) if self.__isReserved(): conflictinglabels = self.__getAssignmentList() conflictinglabels.remove(self.__getReservedLabel()) yield (self.getPin().ref(PORT_PINS.ports_settings_reserve.S), '{0} pin assignment conflicts with {1}'.format( self.__getReservedLabel(), ', '.join(conflictinglabels))) if self.__getNumHalAssignments() + self.__getNumAssignments() > 1: for label in self.__getHalAssignmentList(): conflictinglabels = self.__getHalAssignmentList( ) + self.__getAssignmentList() # We don't conflict with ourselves conflictinglabels.remove(label) for conflicting in Metadata.allowed_route_conflicts(label): conflictinglabels = [ l for l in conflictinglabels if not l.startswith(conflicting) ] # We don't conflict with HAL labels with the same prefix (only difference in ending digits) nonconflictinglabels = [ l for l in conflictinglabels if l.rstrip("0123456789") == label.rstrip("0123456789") ] for nlabel in nonconflictinglabels: conflictinglabels.remove(nlabel) # Yield a warning if we still conflict if conflictinglabels: yield (self.getPin().ref( PORT_PINS.ports_settings_halpinname.S), '{0} pin assignment conflicts with {1}'.format( label, ', '.join(conflictinglabels)))
def onLoad(state): # Prevent changed properties from enabling parent peripheral try: hal.registerDeviceOverride(hal.OVERRIDE_PERIPHERAL_AUTO_ENABLE, True) except: # Fall back to misspelled version of the function argument try: hal.registerDeviceOverride(hal.OVERRIDE_PERIPHRAL_AUTO_ENABLE, True) except: pass available_modules = Metadata.get_available_modules_for_family() if PROFILE: start = time.time() familyobj = dep.Family(state.device.name) modules = [] module_instance = ACMP_behavior.ACMP('ACMP0') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('ACMP0', module_instance) modules.append(module_instance) module_instance = ACMP_behavior.ACMP('ACMP1') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('ACMP1', module_instance) modules.append(module_instance) module_instance = ADC_behavior.ADC('ADC0') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('ADC0', module_instance) modules.append(module_instance) module_instance = ANTDIV_behavior.ANTDIV('ANTDIV') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('ANTDIV', module_instance) modules.append(module_instance) module_instance = BATTERYMON_behavior.BATTERYMON('BATTERYMON') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('BATTERYMON', module_instance) modules.append(module_instance) module_instance = BTL_BUTTON_behavior.BTL_BUTTON('BTL_BUTTON') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('BTL_BUTTON', module_instance) modules.append(module_instance) module_instance = BULBPWM_behavior.BULBPWM('BULBPWM') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('BULBPWM', module_instance) modules.append(module_instance) module_instance = BULBPWM_COLOR_behavior.BULBPWM_COLOR('BULBPWM_COLOR') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('BULBPWM_COLOR', module_instance) modules.append(module_instance) module_instance = BUTTON_behavior.BUTTON('BUTTON') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('BUTTON', module_instance) modules.append(module_instance) module_instance = CMU_behavior.CMU('CMU') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('CMU', module_instance) modules.append(module_instance) module_instance = COEX_behavior.COEX('COEX') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('COEX', module_instance) modules.append(module_instance) module_instance = CS5463_behavior.CS5463('CS5463') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('CS5463', module_instance) modules.append(module_instance) module_instance = CSEN_behavior.CSEN('CSEN') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('CSEN', module_instance) modules.append(module_instance) module_instance = DCDC_behavior.DCDC('DCDC') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('DCDC', module_instance) modules.append(module_instance) module_instance = EMU_behavior.EMU('EMU') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('EMU', module_instance) modules.append(module_instance) module_instance = EXTFLASH_behavior.EXTFLASH('EXTFLASH') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('EXTFLASH', module_instance) modules.append(module_instance) module_instance = EZRADIOPRO_behavior.EZRADIOPRO('EZRADIOPRO') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('EZRADIOPRO', module_instance) modules.append(module_instance) module_instance = FEM_behavior.FEM('FEM') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('FEM', module_instance) modules.append(module_instance) module_instance = GPIO_behavior.GPIO('GPIO') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('GPIO', module_instance) modules.append(module_instance) module_instance = I2C_behavior.I2C('I2C0') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('I2C0', module_instance) modules.append(module_instance) module_instance = I2C_behavior.I2C('I2C1') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('I2C1', module_instance) modules.append(module_instance) module_instance = I2CSENSOR_behavior.I2CSENSOR('I2CSENSOR') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('I2CSENSOR', module_instance) modules.append(module_instance) module_instance = IDAC_behavior.IDAC('IDAC0') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('IDAC0', module_instance) modules.append(module_instance) module_instance = IOEXP_behavior.IOEXP('IOEXP') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('IOEXP', module_instance) modules.append(module_instance) module_instance = LED_behavior.LED('LED') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('LED', module_instance) modules.append(module_instance) module_instance = LEUART_behavior.LEUART('LEUART0') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('LEUART0', module_instance) modules.append(module_instance) module_instance = MODEM_behavior.MODEM('MODEM') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('MODEM', module_instance) modules.append(module_instance) module_instance = PA_behavior.PA('PA') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('PA', module_instance) modules.append(module_instance) module_instance = PRS_behavior.PRS('PRS') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('PRS', module_instance) modules.append(module_instance) module_instance = PTI_behavior.PTI('PTI') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('PTI', module_instance) modules.append(module_instance) module_instance = PYD1698_behavior.PYD1698('PYD1698') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('PYD1698', module_instance) modules.append(module_instance) module_instance = SERIAL_behavior.SERIAL('SERIAL') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('SERIAL', module_instance) modules.append(module_instance) module_instance = SPIDISPLAY_behavior.SPIDISPLAY('SPIDISPLAY') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('SPIDISPLAY', module_instance) modules.append(module_instance) module_instance = SPINCP_behavior.SPINCP('SPINCP') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('SPINCP', module_instance) modules.append(module_instance) module_instance = TIMER_behavior.TIMER('TIMER0') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('TIMER0', module_instance) modules.append(module_instance) module_instance = TIMER_behavior.TIMER('TIMER1') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('TIMER1', module_instance) modules.append(module_instance) module_instance = UARTNCP_behavior.UARTNCP('UARTNCP') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('UARTNCP', module_instance) modules.append(module_instance) module_instance = USART_behavior.USART('USART0') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('USART0', module_instance) modules.append(module_instance) module_instance = USART_behavior.USART('USART1') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('USART1', module_instance) modules.append(module_instance) module_instance = USART_behavior.USART('USART2') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('USART2', module_instance) modules.append(module_instance) module_instance = VCOM_behavior.VCOM('VCOM') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('VCOM', module_instance) modules.append(module_instance) module_instance = VDAC_behavior.VDAC('VDAC0') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('VDAC0', module_instance) modules.append(module_instance) module_instance = VUART_behavior.VUART('VUART') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('VUART', module_instance) modules.append(module_instance) module_instance = WDOG_behavior.WDOG('WDOG') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('WDOG', module_instance) modules.append(module_instance) module_instance = WTIMER_behavior.WTIMER('WTIMER0') module_instance.load_halconfig_model(available_modules, familyobj) state.set_module_object('WTIMER0', module_instance) modules.append(module_instance) if PROFILE: stop = time.time() print(" construction of all modules completed in {:.3f} ms".format( (stop - start) * 1000)) start = time.time() # Do the hook installing after all modules have initialized PIN_Snippets.activate_runtime() PORTIO_Snippets.activate_runtime() for module_instance in modules: module_instance.activate_runtime(state) force_enable_module = RuntimeModel.get_property_value( module_instance.get_property('forceenable'), RuntimeModel.get_studio_module_by_name(module_instance.name, state.mode), False) if force_enable_module == '1': RuntimeModel.set_module_checked( RuntimeModel.get_studio_module_by_name(module_instance.name, state.mode), True, state, readonly=True) PORTIO_Snippets.onLoad(state) if PROFILE: stop = time.time() print(" activate_runtime() for all modules completed in {:.3f} ms". format((stop - start) * 1000))
def generate(context): """ Generates the relevant defines for hwconf setup to hal-config/hal-config.h """ root = initSession(context) # Get output directory from config or fall back to 'hal-config' directory output_dir = getVariable('output_dir') if not output_dir: output_dir = 'hal-config' # Get output filename from config or fall back to 'hal-config.h' output_file = getVariable('output_file') if not output_file: output_file = 'hal-config.h' hal_conf_dir = newDirectory(root, output_dir) hal_conf_h = newFile(hal_conf_dir, output_file) define_guard = output_file.upper().replace('-', '_').replace('.', '_') # Generate header and start of cloaking text = "" text += "#ifndef {}\n".format(define_guard) text += "#define {}\n".format(define_guard) text += "\n" text += "#include \"em_device.h\"\n" text += "#include \"hal-config-types.h\"\n" text += "\n" text += "// This file is auto-generated by Hardware Configurator in Simplicity Studio.\n" text += "// Any content between $[ and ]$ will be replaced whenever the file is regenerated.\n" text += "// Content outside these regions will be preserved.\n" # Push location for eval'd text pushContext(location=hal_conf_h) newContribution(hal_conf_h, text) # Initializing lists define_list = [] region_list = [] module_list = [] # Generate regions in file for transition in modeTransitions(): # Get region names from transition.modules for module in transition.modules: module_type = module.obj.object.getComponentId().split(".")[2] if not (module_type == "port" or module_type == "pin"): region_list.append(module.name) # Generate regions alphabetically in file region_list.sort() for region in region_list: if not getLocation(region): startRegion(region) endRegion() # Adding portio defines to define_list portio = transition.getModule("PORTIO").obj.object routes = add_portio_defines(portio, define_list) available_modules = Metadata.get_available_modules_for_family() familyobj = dep.Family('bgm13') # Generate a module list from '_behaviour' files mod_inst = ACMP_behavior.ACMP('ACMP0') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = ACMP_behavior.ACMP('ACMP1') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = ADC_behavior.ADC('ADC0') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = ANTDIV_behavior.ANTDIV('ANTDIV') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = BATTERYMON_behavior.BATTERYMON('BATTERYMON') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = BTL_BUTTON_behavior.BTL_BUTTON('BTL_BUTTON') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = BULBPWM_behavior.BULBPWM('BULBPWM') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = BULBPWM_COLOR_behavior.BULBPWM_COLOR('BULBPWM_COLOR') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = BUTTON_behavior.BUTTON('BUTTON') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = CMU_behavior.CMU('CMU') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = COEX_behavior.COEX('COEX') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = CS5463_behavior.CS5463('CS5463') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = CSEN_behavior.CSEN('CSEN') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = DCDC_behavior.DCDC('DCDC') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = EMU_behavior.EMU('EMU') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = EXTFLASH_behavior.EXTFLASH('EXTFLASH') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = EZRADIOPRO_behavior.EZRADIOPRO('EZRADIOPRO') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = FEM_behavior.FEM('FEM') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = GPIO_behavior.GPIO('GPIO') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = I2C_behavior.I2C('I2C0') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = I2C_behavior.I2C('I2C1') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = I2CSENSOR_behavior.I2CSENSOR('I2CSENSOR') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = IDAC_behavior.IDAC('IDAC0') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = IOEXP_behavior.IOEXP('IOEXP') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = LED_behavior.LED('LED') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = LEUART_behavior.LEUART('LEUART0') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = MODEM_behavior.MODEM('MODEM') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = PA_behavior.PA('PA') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = PRS_behavior.PRS('PRS') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = PTI_behavior.PTI('PTI') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = PYD1698_behavior.PYD1698('PYD1698') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = SERIAL_behavior.SERIAL('SERIAL') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = SPIDISPLAY_behavior.SPIDISPLAY('SPIDISPLAY') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = SPINCP_behavior.SPINCP('SPINCP') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = TIMER_behavior.TIMER('TIMER0') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = TIMER_behavior.TIMER('TIMER1') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = UARTNCP_behavior.UARTNCP('UARTNCP') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = USART_behavior.USART('USART0') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = USART_behavior.USART('USART1') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = USART_behavior.USART('USART2') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = VCOM_behavior.VCOM('VCOM') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = VDAC_behavior.VDAC('VDAC0') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = VUART_behavior.VUART('VUART') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = WDOG_behavior.WDOG('WDOG') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) mod_inst = WTIMER_behavior.WTIMER('WTIMER0') mod_inst.load_halconfig_model(available_modules, familyobj) module_list.append(mod_inst) # Adding peripheral defines to list add_peripheral_defines(module_list, transition, define_list, routes) # Printing the list to hal-config.h print_defines_from_list(define_list) # Add module include text = "" text += "#if defined(_SILICON_LABS_MODULE)\n" text += "#include \"sl_module.h\"\n" text += "#endif\n" text += "\n" newContribution(hal_conf_h, text) # Ending the #ifndef newContribution(hal_conf_h, "#endif /* {} */".format(define_guard)) popContext() # Sync project modules try: framework = detect_framework(context) refresh_studio_modules(framework, module_list) except: print("project module sync failed")
def generate_peripheral(exp_module, studio_module, define_list, routes, mode, def_region, output_prefix, custom_name=None, prevent_override=False): peripheral_pins = [] peripheral_props = [] peripheral_custom_props = [] inherited_props = [] override_props = [] inherit_prop_list = [] # This peripheral has overridden configuration options (e.g. internal SPI flash) overrides = {} if hasattr(exp_module, "generate_define_override"): for prop in exp_module.generate_define_override(studio_module): overrides[prop['label']] = prop override_props.append(prop) common_routes = [] show_advanced = studio_module.ref( exp_module.get_property('showadvanced').id).get() == '1' for prop in exp_module.get_properties(): if prop.mode: # Make sure property exists in the active mode if isinstance(prop.mode, list): if mode not in prop.mode: continue elif prop.mode != mode: continue # Only create #defines from uppercase properties if not prop.name.isupper(): continue # Only generate hidden properties if they should be generated when hidden if not prop.generate_if_hidden and studio_module.ref( prop.id).isHidden(): continue # Only print advanced properties if we are in advanced mode if not show_advanced and prop.is_advanced: continue def_label = prop.define_name.replace(prop.parent.namespace, output_prefix) if custom_name: custom_label = prop.define_name.replace( prop.parent.namespace, custom_name).replace('HAL_', '').replace('BSP_', '') prop_value = studio_module.ref(prop.id).get() # Filter out disabled/none values if prop_value == "Disabled" or prop_value == "None": continue if def_label in overrides: # Don't generate native defines for properties that will be overridden continue if prevent_override: # Prevent this define generation from overriding an existing one already_defined = False for define in define_list: if define['region'] == def_region and define[ 'label'] == def_label: already_defined = True if already_defined: continue # If property is a pin if isinstance(prop, ExporterModel.PinProperty): if not prop.mode and studio_module.ref(prop.id).isHidden(): # Don't generate defines for hidden pin properties unless they are in the active mode continue pin_name = prop_value pin_obj = { "region": def_region, "label": def_label, "pin_name": pin_name } common_route_obj = None # If prop has a referenced route to portio custom_route = None if prop.referenced_route: route = routes.get( "{}_{}".format(prop.referenced_module, prop.referenced_route), None) if route: if route['common_route']: if route['common_route'] not in common_routes: common_routes.append(route['common_route']) def_label = "{}_{}".format( def_label.rsplit('_', 1)[0], route['common_route']) common_route_obj = { "region": def_region, "label": def_label, "loc": route['location'] } else: pin_obj['loc'] = route['location'] else: print("Error: referenced route, but no route found for " + prop.name) peripheral_pins.append(pin_obj) if common_route_obj: peripheral_pins.append(common_route_obj) # If pin has em4 attribute True if prop.em4: peripheral_pins.append({ "region": def_region, "label": def_label + "_EM4WU", "def_value": Metadata.em4_pin_to_loc(pin_name)["define"] }) # If peripheral has a non-empty custom name if custom_name: custom_pin_obj = copy.deepcopy(pin_obj) custom_pin_obj['label'] = custom_label peripheral_pins.append(custom_pin_obj) if common_route_obj: custom_route_obj = copy.deepcopy(common_route_obj) custom_route_obj['label'] = custom_route_obj[ 'label'].replace(output_prefix, custom_name).replace( 'HAL_', '').replace('BSP_', '') peripheral_pins.append(custom_route_obj) if prop.em4: peripheral_pins.append({ "region": def_region, "label": custom_label + "_EM4WU", "def_value": Metadata.em4_pin_to_loc(pin_name)["define"] }) peripheral_pins.append({ "region": def_region, "label": "", "def_value": "newline" }) elif isinstance(prop, ExporterModel.AportBusProperty): def_value = prop_value for value in prop.values.values(): if value.value == studio_module.ref(prop.id).get(): def_value = value.define_value if def_value.startswith("APORT"): route = routes.get( "{}_{}".format(prop.parent.name, prop.signal), None) if not route: # APORT selected but no channel output enabled. Skip this property continue ch = "CH{}".format(route['aport_location']) def_value = def_value + ch # Handle prefix if hasattr(prop, "define_value_prefix"): def_value = prop.define_value_prefix + def_value # Putting the define strings into define_list peripheral_props.append({ "region": def_region, "label": def_label, "def_value": str(def_value), "is_array": False, "is_str_prop": False }) if custom_name: peripheral_custom_props.append({ "region": def_region, "label": custom_label, "def_value": str(def_value), "is_array": False, "is_str_prop": False }) else: def_value = prop_value if isinstance(prop, ExporterModel.IntegerProperty): if prop.format: # Format integer def_value = prop.format.format(def_value) else: # Handle integer properties that should have literal suffixes if prop.min >= 0: def_value = str(def_value) + 'U' if prop.max >= 65535: def_value = str(def_value) + 'L' if isinstance(prop, ExporterModel.EnumProperty): for value in prop.values.values(): if value.value == studio_module.ref(prop.id).get(): def_value = value.define_value # Handle prefix if hasattr(prop, "define_value_prefix"): def_value = prop.define_value_prefix + str(def_value) # Handle array properties that should print {} rather than () if isinstance(prop, ExporterModel.ArrayProperty): is_array = True else: is_array = False # Handle string properties that should not print () if isinstance(prop, ExporterModel.StringProperty): is_str_prop = True else: is_str_prop = False # Putting the define strings into define_list peripheral_props.append({ "region": def_region, "label": def_label, "def_value": str(def_value), "is_array": is_array, "is_str_prop": is_str_prop }) if custom_name: peripheral_custom_props.append({ "region": def_region, "label": custom_label, "def_value": str(def_value), "is_array": is_array, "is_str_prop": is_str_prop }) if hasattr(prop, "inherit_options"): if prop.inherit_options: inherit_prop_list.append( (prop, studio_module.ref(prop.id).get())) define_list += peripheral_pins define_list += peripheral_props define_list += peripheral_custom_props define_list += override_props return inherit_prop_list