From: duplo Date: Tue, 14 Apr 2009 13:51:41 +0000 (+0000) Subject: Add spinbox for cpu frequency X-Git-Tag: 2.1.0~179 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=4ac9b7fcfcf4c765b05a9db68edf154c020f0af4;p=bertos.git Add spinbox for cpu frequency git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2503 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/wizard/BCpuPage.py b/wizard/BCpuPage.py index b00c624c..68a9a912 100644 --- a/wizard/BCpuPage.py +++ b/wizard/BCpuPage.py @@ -32,6 +32,8 @@ class BCpuPage(BWizardPage): Overload of the QWizardPage isComplete method. """ if self.pageContent.cpuList.currentRow() != -1: + self.pageContent.frequencyLabel.setVisible(True) + self.pageContent.frequencySpinBox.setVisible(True) infos = qvariant_converter.getDict(self.pageContent.cpuList.currentItem().data(Qt.UserRole)) for key, value in infos.items(): if type(CPU_DEF[key]) == list: @@ -40,6 +42,7 @@ class BCpuPage(BWizardPage): infos[key] = qvariant_converter.getString(value) self.setProjectInfo("CPU_INFOS", infos) self.setProjectInfo("CPU_NAME", unicode(self.pageContent.cpuList.currentItem().text())) + self.setProjectInfo("SELECTED_FREQ", unicode(long(self.pageContent.frequencySpinBox.value()))) return True else: return False @@ -55,12 +58,15 @@ class BCpuPage(BWizardPage): self.pageContent.cpuList.setSortingEnabled(True) self.pageContent.descriptionLabel.setVisible(False) self.pageContent.descriptionLabel.setText("") + self.pageContent.frequencyLabel.setVisible(False) + self.pageContent.frequencySpinBox.setVisible(False) def connectSignals(self): """ Overload of the BWizardPage connectSignals method. """ self.connect(self.pageContent.cpuList, SIGNAL("itemSelectionChanged()"), self.rowChanged) + self.connect(self.pageContent.frequencySpinBox, SIGNAL("valueChanged(double)"), self.freqChanged) def reloadData(self): """ @@ -86,8 +92,15 @@ class BCpuPage(BWizardPage): """ description = qvariant_converter.getDict(self.pageContent.cpuList.currentItem().data(Qt.UserRole))["CPU_DESC"] description = qvariant_converter.getStringList(description) + frequency = qvariant_converter.getDict(self.pageContent.cpuList.currentItem().data(Qt.UserRole))["CPU_DEFAULT_FREQ"] + frequency = qvariant_converter.getString(frequency) + frequency = frequency.replace("U", "").replace("L", "") self.pageContent.descriptionLabel.setText("
".join(description)) self.pageContent.descriptionLabel.setVisible(True) + self.pageContent.frequencySpinBox.setValue(long(frequency)) + self.emit(SIGNAL("completeChanged()")) + + def freqChanged(self): self.emit(SIGNAL("completeChanged()")) #### diff --git a/wizard/bertos_utils.py b/wizard/bertos_utils.py index 8b6c9072..91ab05ad 100644 --- a/wizard/bertos_utils.py +++ b/wizard/bertos_utils.py @@ -95,6 +95,7 @@ def mkGenerator(project_info, makefile): mk_data["$pname"] = os.path.basename(project_info.info("PROJECT_PATH")) mk_data["$cpuflag"] = project_info.info("CPU_INFOS")["CPU_FLAG_NAME"] mk_data["$cpuname"] = project_info.info("CPU_INFOS")["CORE_CPU"] + mk_data["$cpuclockfreq"] = project_info.info("SELECTED_FREQ") mk_data["$cflags"] = " ".join(project_info.info("CPU_INFOS")["C_FLAGS"]) mk_data["$ldflags"] = " ".join(project_info.info("CPU_INFOS")["LD_FLAGS"]) mk_data["$cppflags"] = " ".join(project_info.info("CPU_INFOS")["CPP_FLAGS"]) diff --git a/wizard/const.py b/wizard/const.py index 34873fdf..18ba3fe5 100644 --- a/wizard/const.py +++ b/wizard/const.py @@ -34,7 +34,8 @@ CPU_DEF = { "C_SRC": [], "SUPPORTED_DRV" : [], "PC_SRC" : [], - "CPU_DESC" : [] + "CPU_DESC" : [], + "CPU_DEFAULT_FREQ": "1" } TOOLCHAIN_ITEMS = ("ld", "as") diff --git a/wizard/mktemplates/template.mk b/wizard/mktemplates/template.mk index c151ce15..f6b8e850 100644 --- a/wizard/mktemplates/template.mk +++ b/wizard/mktemplates/template.mk @@ -83,7 +83,7 @@ $pname_ASRC = $($pname_WIZARD_ASRC) $($pname_USER_ASRC) $pname_CFLAGS = $cflags $pname_LDFLAGS = $ldflags -$pname_CPPFLAGS = -D'CPU_FREQ=($cpuclockfreq)' $cppflags +$pname_CPPFLAGS = -D'CPU_FREQ=($cpuclockfreqUL)' $cppflags $pname_CPPAFLAGS = $cppaflags $pname_CXXFLAGS = $cxxflags $pname_ASFLAGS = $asflags diff --git a/wizard/ui/cpu_select.ui b/wizard/ui/cpu_select.ui index 7d8951f2..49a9b9e0 100644 --- a/wizard/ui/cpu_select.ui +++ b/wizard/ui/cpu_select.ui @@ -1,34 +1,68 @@ - + + Form - - + + 0 0 - 406 - 243 + 460 + 378 - - + + 0 0 - + Form - + - + - - + + + + + + + + CPU frequency + + + frequencySpinBox + + + + + + + Hz + + + 0 + + + 1.000000000000000 + + + 1000000000.000000000000000 + + + 1000.000000000000000 + + + + +