From 2b6317815bf86c80047c5d3b42602f81b8c21d01 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Mon, 20 Apr 2015 16:31:13 +0200 Subject: Update to new libopencm3 version - remove f4/ from include directory - rename some SysTick registers - rename APB freq variables --- ucoo/hal/adc/adc_hard.stm32f4.cc | 4 ++-- ucoo/hal/adc/test/test_adc.cc | 2 +- ucoo/hal/gpio/gpio.stm32f4.hh | 2 +- ucoo/hal/gpio/test/test_gpio.cc | 2 +- ucoo/hal/i2c/i2c_hard.stm32.cc | 4 ++-- ucoo/hal/i2c/test/test_i2c.cc | 2 +- ucoo/hal/spi/test/test_spi.cc | 2 +- ucoo/hal/uart/test/test_uart.cc | 2 +- ucoo/hal/uart/test/test_uart_disc.cc | 2 +- ucoo/hal/uart/uart.stm32.cc | 8 ++++---- ucoo/hal/usb/usb.stm32.cc | 10 +++++++--- 11 files changed, 22 insertions(+), 18 deletions(-) (limited to 'ucoo/hal') 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 -#include +#include +#include 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 +#include #include "ucoo/hal/gpio/gpio.hh" #include 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 +#include 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 +#include 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 -#include +#include #include #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 +# include # 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 +#include #include #include 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 +# include # 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 +#include 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 -#include +#include +#include #include #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 -#include -#include +#include +#include #include #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); } -- cgit v1.2.3