summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Palsson <karlp@tweak.net.au>2016-08-11 14:59:44 +0200
committerKarl Palsson <karlp@tweak.net.au>2016-08-25 01:25:01 +0200
commit06e20b7243488f022deeb295dbd04969f35b8c92 (patch)
tree62a1d48c5d670fa8a6eb1208f274cf265a5bdf1c
parent0ee93edf61060ce9b593bae03062508c7a2acf35 (diff)
update to match latest laksusb_cdc_acm
Compile tested for f1. Runtime tested on f3/f4
m---------laks0
-rw-r--r--main.cpp27
2 files changed, 15 insertions, 12 deletions
diff --git a/laks b/laks
-Subproject f836b288b019f58c0d0a7e2dcbf56972e42ce4f
+Subproject 29d8f1b4e89f31e2f3b448c4d40c6c251862968
diff --git a/main.cpp b/main.cpp
index ca2f97a..50a3eaa 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1,5 +1,5 @@
#include <rcc/rcc.h>
-#include <gpio/pin.h>
+#include <gpio/gpio.h>
#include <os/time.h>
#include <usb/usb.h>
#include <usb/descriptor.h>
@@ -24,35 +24,37 @@ auto conf_desc = configuration_desc(2, 1, 0, 0xc0, 0,
desc_t dev_desc_p = {sizeof(dev_desc), (void*)&dev_desc};
desc_t conf_desc_p = {sizeof(conf_desc), (void*)&conf_desc};
+typedef GPIO_t::Pin Pin;
+
#if defined(STM32F1)
// Maple mini.
-Pin& usb_disc = PB9;
-Pin& usb_dm = PA11;
-Pin& usb_dp = PA12;
+Pin usb_disc = GPIOB[9];
+Pin usb_dm = GPIOA[11];
+Pin usb_dp = GPIOA[12];
-Pin& led1 = PB1;
+Pin led1 = GPIOB[1];
USB_f1 usb(USB, dev_desc_p, conf_desc_p);
#elif defined(STM32F3)
// STM32F3DISCOVERY.
-Pin& usb_dm = PA11;
-Pin& usb_dp = PA12;
+Pin usb_dm = GPIOA[11];
+Pin usb_dp = GPIOA[12];
-Pin& led1 = PA15; // FIXME
+Pin led1 = GPIOA[15];
USB_f1 usb(USB, dev_desc_p, conf_desc_p);
#elif defined(STM32F4)
// Generic F4.
-Pin& usb_vbus = PA9;
-Pin& usb_dm = PA11;
-Pin& usb_dp = PA12;
+Pin usb_vbus = GPIOA[9];
+Pin usb_dm = GPIOA[11];
+Pin usb_dp = GPIOA[12];
-Pin& led1 = PA4;
+Pin led1 = GPIOA[4];
USB_otg usb(OTG_FS, dev_desc_p, conf_desc_p);
@@ -107,6 +109,7 @@ class USB_CDC_ACM : public USB_class_driver {
USB_CDC_ACM usb_cdc_acm(usb);
int main() {
+ rcc_init();
#if defined(STM32F1)
// Initialize system timer.
STK.LOAD = 72000000 / 8 / 1000; // 1000 Hz.