summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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.