summaryrefslogtreecommitdiff
path: root/ucoo/hal
diff options
context:
space:
mode:
authorNicolas Schodet2015-04-20 16:31:13 +0200
committerNicolas Schodet2019-10-07 00:44:50 +0200
commit2b6317815bf86c80047c5d3b42602f81b8c21d01 (patch)
tree1dff127e53988fc781357400a024a8de853b9a7f /ucoo/hal
parent9901e49f990b7e1ab9646295999fc5544e388f1d (diff)
Update to new libopencm3 version
- remove f4/ from include directory - rename some SysTick registers - rename APB freq variables
Diffstat (limited to 'ucoo/hal')
-rw-r--r--ucoo/hal/adc/adc_hard.stm32f4.cc4
-rw-r--r--ucoo/hal/adc/test/test_adc.cc2
-rw-r--r--ucoo/hal/gpio/gpio.stm32f4.hh2
-rw-r--r--ucoo/hal/gpio/test/test_gpio.cc2
-rw-r--r--ucoo/hal/i2c/i2c_hard.stm32.cc4
-rw-r--r--ucoo/hal/i2c/test/test_i2c.cc2
-rw-r--r--ucoo/hal/spi/test/test_spi.cc2
-rw-r--r--ucoo/hal/uart/test/test_uart.cc2
-rw-r--r--ucoo/hal/uart/test/test_uart_disc.cc2
-rw-r--r--ucoo/hal/uart/uart.stm32.cc8
-rw-r--r--ucoo/hal/usb/usb.stm32.cc10
11 files changed, 22 insertions, 18 deletions
diff --git a/ucoo/hal/adc/adc_hard.stm32f4.cc b/ucoo/hal/adc/adc_hard.stm32f4.cc
index 38661e3..444117f 100644
--- a/ucoo/hal/adc/adc_hard.stm32f4.cc
+++ b/ucoo/hal/adc/adc_hard.stm32f4.cc
@@ -23,8 +23,8 @@
// }}}
#include "adc_hard.stm32f4.hh"
-#include <libopencm3/stm32/f4/adc.h>
-#include <libopencm3/stm32/f4/rcc.h>
+#include <libopencm3/stm32/adc.h>
+#include <libopencm3/stm32/rcc.h>
namespace ucoo {
diff --git a/ucoo/hal/adc/test/test_adc.cc b/ucoo/hal/adc/test/test_adc.cc
index eaaf44e..58cca96 100644
--- a/ucoo/hal/adc/test/test_adc.cc
+++ b/ucoo/hal/adc/test/test_adc.cc
@@ -27,7 +27,7 @@
#include "ucoo/base/test/test.hh"
#include "ucoo/utils/delay.hh"
-#include <libopencm3/stm32/f4/adc.h>
+#include <libopencm3/stm32/adc.h>
#include "ucoo/hal/gpio/gpio.hh"
#include <cstdio>
diff --git a/ucoo/hal/gpio/gpio.stm32f4.hh b/ucoo/hal/gpio/gpio.stm32f4.hh
index b2dfb16..325511e 100644
--- a/ucoo/hal/gpio/gpio.stm32f4.hh
+++ b/ucoo/hal/gpio/gpio.stm32f4.hh
@@ -25,7 +25,7 @@
// }}}
#include "ucoo/intf/io.hh"
-#include <libopencm3/stm32/f4/gpio.h>
+#include <libopencm3/stm32/gpio.h>
namespace ucoo {
diff --git a/ucoo/hal/gpio/test/test_gpio.cc b/ucoo/hal/gpio/test/test_gpio.cc
index a953505..8d70814 100644
--- a/ucoo/hal/gpio/test/test_gpio.cc
+++ b/ucoo/hal/gpio/test/test_gpio.cc
@@ -25,7 +25,7 @@
#include "ucoo/hal/gpio/gpio.hh"
#include "ucoo/utils/delay.hh"
-#include <libopencm3/stm32/f4/rcc.h>
+#include <libopencm3/stm32/rcc.h>
void
test (ucoo::Io &loop_out, ucoo::Io &loop_in, ucoo::Io &led3, ucoo::Io &led4,
diff --git a/ucoo/hal/i2c/i2c_hard.stm32.cc b/ucoo/hal/i2c/i2c_hard.stm32.cc
index 8122d15..a9e8f00 100644
--- a/ucoo/hal/i2c/i2c_hard.stm32.cc
+++ b/ucoo/hal/i2c/i2c_hard.stm32.cc
@@ -24,7 +24,7 @@
#include "i2c_hard.stm32.hh"
#include <libopencm3/stm32/i2c.h>
-#include <libopencm3/stm32/f4/rcc.h>
+#include <libopencm3/stm32/rcc.h>
#include <libopencm3/cm3/nvic.h>
#include "ucoo/utils/trace.hh"
@@ -105,7 +105,7 @@ I2cHard::enable (int speed)
// TODO: make sure the bus is free!!! How!
I2C_CR1 (base) = 0;
// Compute clock parameters.
- int pclk = rcc_ppre1_frequency;
+ int pclk = rcc_apb1_frequency;
int pclk_mhz = pclk / 1000000;
uint16_t ccr, tris;
if (speed <= 100000)
diff --git a/ucoo/hal/i2c/test/test_i2c.cc b/ucoo/hal/i2c/test/test_i2c.cc
index 9f619c2..440edea 100644
--- a/ucoo/hal/i2c/test/test_i2c.cc
+++ b/ucoo/hal/i2c/test/test_i2c.cc
@@ -27,7 +27,7 @@
#include "ucoo/base/test/test.hh"
#ifdef TARGET_stm32
-# include <libopencm3/stm32/f4/rcc.h>
+# include <libopencm3/stm32/rcc.h>
# include "ucoo/hal/gpio/gpio.hh"
#endif
diff --git a/ucoo/hal/spi/test/test_spi.cc b/ucoo/hal/spi/test/test_spi.cc
index 27ca659..188ff40 100644
--- a/ucoo/hal/spi/test/test_spi.cc
+++ b/ucoo/hal/spi/test/test_spi.cc
@@ -28,7 +28,7 @@
#include "ucoo/arch/arch.hh"
#include "ucoo/base/test/test.hh"
-#include <libopencm3/stm32/f4/rcc.h>
+#include <libopencm3/stm32/rcc.h>
#include <algorithm>
#include <cstdio>
diff --git a/ucoo/hal/uart/test/test_uart.cc b/ucoo/hal/uart/test/test_uart.cc
index 2c326f3..785d9f1 100644
--- a/ucoo/hal/uart/test/test_uart.cc
+++ b/ucoo/hal/uart/test/test_uart.cc
@@ -26,7 +26,7 @@
#include "ucoo/arch/arch.hh"
#if defined (TARGET_stm32)
-# include <libopencm3/stm32/f4/rcc.h>
+# include <libopencm3/stm32/rcc.h>
# include "ucoo/hal/gpio/gpio.hh"
#endif
diff --git a/ucoo/hal/uart/test/test_uart_disc.cc b/ucoo/hal/uart/test/test_uart_disc.cc
index e2d307a..b67894b 100644
--- a/ucoo/hal/uart/test/test_uart_disc.cc
+++ b/ucoo/hal/uart/test/test_uart_disc.cc
@@ -27,7 +27,7 @@
#include "ucoo/hal/gpio/gpio.hh"
#include "ucoo/base/test/test.hh"
-#include <libopencm3/stm32/f4/rcc.h>
+#include <libopencm3/stm32/rcc.h>
static void
check_act (ucoo::Stream &ts, ucoo::Stream &u, char n)
diff --git a/ucoo/hal/uart/uart.stm32.cc b/ucoo/hal/uart/uart.stm32.cc
index 14dc849..c62ccac 100644
--- a/ucoo/hal/uart/uart.stm32.cc
+++ b/ucoo/hal/uart/uart.stm32.cc
@@ -23,8 +23,8 @@
// }}}
#include "uart.stm32.hh"
-#include <libopencm3/stm32/f4/usart.h>
-#include <libopencm3/stm32/f4/rcc.h>
+#include <libopencm3/stm32/usart.h>
+#include <libopencm3/stm32/rcc.h>
#include <libopencm3/cm3/nvic.h>
#ifndef TARGET_stm32f4
@@ -107,8 +107,8 @@ Uart::enable (int speed, Parity parity, int stop_bits)
(uart_hardware[n_].apb == 1 ? &RCC_APB1ENR : &RCC_APB2ENR,
uart_hardware[n_].rcc_en);
// Set speed, rounded to nearest.
- int apb_freq = uart_hardware[n_].apb == 1 ? rcc_ppre1_frequency
- : rcc_ppre2_frequency;
+ int apb_freq = uart_hardware[n_].apb == 1 ? rcc_apb1_frequency
+ : rcc_apb2_frequency;
USART_BRR (base) = (2 * apb_freq + speed) / (2 * speed);
// Set parameters and enable.
if (stop_bits == 1)
diff --git a/ucoo/hal/usb/usb.stm32.cc b/ucoo/hal/usb/usb.stm32.cc
index 0410df5..70db92b 100644
--- a/ucoo/hal/usb/usb.stm32.cc
+++ b/ucoo/hal/usb/usb.stm32.cc
@@ -24,14 +24,17 @@
#include "usb.stm32.hh"
#include <algorithm>
-#include <libopencm3/stm32/f4/rcc.h>
-#include <libopencm3/stm32/f4/gpio.h>
+#include <libopencm3/stm32/rcc.h>
+#include <libopencm3/stm32/gpio.h>
#include <libopencm3/cm3/nvic.h>
#include "usb_desc.stm32.h"
static usbd_device *usbdev;
+// Buffer for control requests.
+static uint8_t usb_control_buffer[128];
+
extern "C" {
void
@@ -69,7 +72,8 @@ UsbStreamControl::UsbStreamControl (const char *vendor, const char *product)
GPIO9 | GPIO11 | GPIO12);
gpio_set_af (GPIOA, GPIO_AF10, GPIO9 | GPIO11 | GPIO12);
usbdev = usbd_init (&otgfs_usb_driver, &usb_desc_dev, &usb_desc_config,
- strings, lengthof (strings));
+ strings, lengthof (strings),
+ usb_control_buffer, sizeof (usb_control_buffer));
usbd_register_set_config_callback (usbdev, set_config);
nvic_enable_irq (NVIC_OTG_FS_IRQ);
}