diff options
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -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. |