summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2012-11-19 20:14:16 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2012-11-19 20:14:16 +0100
commit0ee93edf61060ce9b593bae03062508c7a2acf35 (patch)
tree7de1e88625ebc2a1528bcf5bf0df41709ec937e5
parenta4d31776b23a8517a7493390ab82a714a211f7f7 (diff)
Added F3 support.
-rw-r--r--SConstruct3
m---------laks0
-rw-r--r--main.cpp23
3 files changed, 25 insertions, 1 deletions
diff --git a/SConstruct b/SConstruct
index 574f656..de0f014 100644
--- a/SConstruct
+++ b/SConstruct
@@ -7,6 +7,7 @@ env = Environment(
SConscript('laks/build_rules')
#env.SelectMCU('stm32f103cb')
-env.SelectMCU('stm32f407zg')
+env.SelectMCU('stm32f303vc')
+#env.SelectMCU('stm32f407zg')
env.Firmware('demo.elf', Glob('*.cpp'))
diff --git a/laks b/laks
-Subproject fca86554077f380c639409331c10a3dd4680d8a
+Subproject f836b288b019f58c0d0a7e2dcbf56972e42ce4f
diff --git a/main.cpp b/main.cpp
index 1f4ea91..ca2f97a 100644
--- a/main.cpp
+++ b/main.cpp
@@ -35,6 +35,16 @@ Pin& led1 = PB1;
USB_f1 usb(USB, dev_desc_p, conf_desc_p);
+#elif defined(STM32F3)
+// STM32F3DISCOVERY.
+
+Pin& usb_dm = PA11;
+Pin& usb_dp = PA12;
+
+Pin& led1 = PA15; // FIXME
+
+USB_f1 usb(USB, dev_desc_p, conf_desc_p);
+
#elif defined(STM32F4)
// Generic F4.
@@ -114,6 +124,19 @@ int main() {
usb_disc.off();
RCC.enable(RCC.USB);
+ #elif defined(STM32F3)
+ // Initialize system timer.
+ STK.LOAD = 72000000 / 8 / 1000; // 1000 Hz.
+ STK.CTRL = 0x03;
+
+ RCC.enable(RCC.GPIOA);
+
+ usb_dm.set_mode(Pin::AF);
+ usb_dm.set_af(14);
+ usb_dp.set_mode(Pin::AF);
+ usb_dp.set_af(14);
+
+ RCC.enable(RCC.USB);
#elif defined(STM32F4)
// Initialize system timer.
STK.LOAD = 168000000 / 8 / 1000; // 1000 Hz.