Add spinbox for cpu frequency
authorduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Tue, 14 Apr 2009 13:51:41 +0000 (13:51 +0000)
committerduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Tue, 14 Apr 2009 13:51:41 +0000 (13:51 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2503 38d2e660-2303-0410-9eaa-f027e97ec537

wizard/BCpuPage.py
wizard/bertos_utils.py
wizard/const.py
wizard/mktemplates/template.mk
wizard/ui/cpu_select.ui

index b00c624c778074480e16db99c3e9ac39183b9cf9..68a9a912bd7ffdae8e5abc1708adac14a66c5a8c 100644 (file)
@@ -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("<br>".join(description))
         self.pageContent.descriptionLabel.setVisible(True)
+        self.pageContent.frequencySpinBox.setValue(long(frequency))
+        self.emit(SIGNAL("completeChanged()"))
+    
+    def freqChanged(self):
         self.emit(SIGNAL("completeChanged()"))
 
     ####
index 8b6c90724269d4aa77e62b05242cca532c52c9cc..91ab05ad0d99363d987de81d7b38b882bc0e98b8 100644 (file)
@@ -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"])
index 34873fdf7e27be8f8ebaf386f0ea40a1f61801e5..18ba3fe59d4bc58ed209faad853d31e174ec45a3 100644 (file)
@@ -34,7 +34,8 @@ CPU_DEF = {
     "C_SRC": [],
     "SUPPORTED_DRV" : [],
     "PC_SRC" : [],
-    "CPU_DESC" : []
+    "CPU_DESC" : [],
+    "CPU_DEFAULT_FREQ": "1"
 }
 
 TOOLCHAIN_ITEMS = ("ld", "as")
index c151ce155f72641cd42f9ee9f5164799d8db6e2b..f6b8e8501e95ac4c80b42b5ef0873d49bfc466a1 100644 (file)
@@ -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
index 7d8951f2434b636bbc908acf6b61f1722ae5a8b4..49a9b9e09b3f8d9a583e503de0c78af1b214bc5e 100644 (file)
@@ -1,34 +1,68 @@
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
  <class>Form</class>
- <widget class="QWidget" name="Form" >
-  <property name="geometry" >
+ <widget class="QWidget" name="Form">
+  <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>406</width>
-    <height>243</height>
+    <width>460</width>
+    <height>378</height>
    </rect>
   </property>
-  <property name="sizePolicy" >
-   <sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
     <horstretch>0</horstretch>
     <verstretch>0</verstretch>
    </sizepolicy>
   </property>
-  <property name="windowTitle" >
+  <property name="windowTitle">
    <string>Form</string>
   </property>
-  <layout class="QVBoxLayout" name="verticalLayout" >
+  <layout class="QVBoxLayout" name="verticalLayout">
    <item>
-    <widget class="QListWidget" name="cpuList" />
+    <widget class="QListWidget" name="cpuList"/>
    </item>
    <item>
-    <widget class="QLabel" name="descriptionLabel" >
-     <property name="text" >
+    <widget class="QLabel" name="descriptionLabel">
+     <property name="text">
       <string/>
      </property>
     </widget>
    </item>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout">
+     <item>
+      <widget class="QLabel" name="frequencyLabel">
+       <property name="text">
+        <string>CPU frequency</string>
+       </property>
+       <property name="buddy">
+        <cstring>frequencySpinBox</cstring>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QDoubleSpinBox" name="frequencySpinBox">
+       <property name="suffix">
+        <string>Hz</string>
+       </property>
+       <property name="decimals">
+        <number>0</number>
+       </property>
+       <property name="minimum">
+        <double>1.000000000000000</double>
+       </property>
+       <property name="maximum">
+        <double>1000000000.000000000000000</double>
+       </property>
+       <property name="singleStep">
+        <double>1000.000000000000000</double>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
   </layout>
  </widget>
  <resources/>