mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-09 22:49:53 +08:00
[ext][stm32] update libopencm3
to get updates from libopencm3 and remove our own workarounds for: - STM32F4 25Mhz clock: https://github.com/libopencm3/libopencm3/pull/311 - STM32 defines for TIM9-TIM17: https://github.com/libopencm3/libopencm3/pull/350 - STM32 set I2C address: https://github.com/libopencm3/libopencm3/pull/344 additionally get fixes: - STM32 safe gpio toggle: https://github.com/libopencm3/libopencm3/pull/337
This commit is contained in:
@@ -39,23 +39,6 @@
|
||||
|
||||
#include "std.h"
|
||||
|
||||
#if defined(STM32F4)
|
||||
/** 25MHz external clock to PLL it to 168MHz */
|
||||
const clock_scale_t hse_25mhz_3v3_168mhz = { /* 168MHz */
|
||||
.pllm = 25,
|
||||
.plln = 336,
|
||||
.pllp = 2,
|
||||
.pllq = 7,
|
||||
.hpre = RCC_CFGR_HPRE_DIV_NONE,
|
||||
.ppre1 = RCC_CFGR_PPRE_DIV_4,
|
||||
.ppre2 = RCC_CFGR_PPRE_DIV_2,
|
||||
.flash_config = FLASH_ACR_ICE | FLASH_ACR_DCE |
|
||||
FLASH_ACR_LATENCY_5WS,
|
||||
.apb1_frequency = 42000000,
|
||||
.apb2_frequency = 84000000,
|
||||
};
|
||||
#endif
|
||||
|
||||
void mcu_arch_init(void) {
|
||||
#if LUFTBOOT
|
||||
PRINT_CONFIG_MSG("We are running luftboot, the interrupt vector is being relocated.")
|
||||
@@ -85,7 +68,7 @@ PRINT_CONFIG_MSG("Using 16MHz external clock to PLL it to 168MHz.")
|
||||
#elif EXT_CLK == 25000000
|
||||
#if defined(STM32F4)
|
||||
PRINT_CONFIG_MSG("Using 25MHz external clock to PLL it to 168MHz.")
|
||||
rcc_clock_setup_hse_3v3(&hse_25mhz_3v3_168mhz);
|
||||
rcc_clock_setup_hse_3v3(&hse_25mhz_3v3[CLOCK_3V3_168MHZ]);
|
||||
#endif
|
||||
#else
|
||||
#error EXT_CLK is either set to an unsupported frequency or not defined at all. Please check!
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#define STM32_MCU_ARCH_H
|
||||
|
||||
#include "std.h"
|
||||
#include <libopencm3/stm32/timer.h>
|
||||
|
||||
extern void mcu_arch_init(void);
|
||||
|
||||
@@ -50,14 +49,6 @@ extern void mcu_arch_init(void);
|
||||
#define mcu_int_enable() {}
|
||||
#define mcu_int_disable() {}
|
||||
|
||||
/** @todo: these should go into libopencm3 */
|
||||
#ifdef TIM9_BASE
|
||||
#define TIM9 TIM9_BASE
|
||||
#endif
|
||||
#ifdef TIM12_BASE
|
||||
#define TIM12 TIM12_BASE
|
||||
#endif
|
||||
|
||||
uint32_t timer_get_frequency(uint32_t timer_peripheral);
|
||||
|
||||
#endif /* STM32_MCU_ARCH_H */
|
||||
|
||||
@@ -1003,12 +1003,7 @@ void i2c1_hw_init(void) {
|
||||
// enable peripheral
|
||||
i2c_peripheral_enable(I2C1);
|
||||
|
||||
/*
|
||||
* XXX: there is a function to do that already in libopencm3 but I am not
|
||||
* sure if it is correct, using direct register instead (esden)
|
||||
*/
|
||||
//i2c_set_own_7bit_slave_address(I2C1, 0);
|
||||
I2C_OAR1(I2C1) = 0 | 0x4000;
|
||||
i2c_set_own_7bit_slave_address(I2C1, 0);
|
||||
|
||||
// enable error interrupts
|
||||
i2c_enable_interrupt(I2C1, I2C_CR2_ITERREN);
|
||||
@@ -1078,12 +1073,7 @@ void i2c2_hw_init(void) {
|
||||
// enable peripheral
|
||||
i2c_peripheral_enable(I2C2);
|
||||
|
||||
/*
|
||||
* XXX: there is a function to do that already in libopencm3 but I am not
|
||||
* sure if it is correct, using direct register instead (esden)
|
||||
*/
|
||||
//i2c_set_own_7bit_slave_address(I2C2, 0);
|
||||
I2C_OAR1(I2C2) = 0 | 0x4000;
|
||||
i2c_set_own_7bit_slave_address(I2C2, 0);
|
||||
|
||||
// enable error interrupts
|
||||
i2c_enable_interrupt(I2C2, I2C_CR2_ITERREN);
|
||||
@@ -1153,12 +1143,7 @@ void i2c3_hw_init(void) {
|
||||
// enable peripheral
|
||||
i2c_peripheral_enable(I2C3);
|
||||
|
||||
/*
|
||||
* XXX: there is a function to do that already in libopencm3 but I am not
|
||||
* sure if it is correct, using direct register instead (esden)
|
||||
*/
|
||||
//i2c_set_own_7bit_slave_address(I2C3, 0);
|
||||
I2C_OAR1(I2C3) = 0 | 0x4000;
|
||||
i2c_set_own_7bit_slave_address(I2C3, 0);
|
||||
|
||||
// enable error interrupts
|
||||
i2c_enable_interrupt(I2C3, I2C_CR2_ITERREN);
|
||||
|
||||
@@ -23,10 +23,11 @@
|
||||
* STM32 PWM and dualPWM servos shared functions.
|
||||
*/
|
||||
|
||||
#include "subsystems/actuators/actuators_shared_arch.h"
|
||||
#include "arch/stm32/subsystems/actuators/actuators_shared_arch.h"
|
||||
|
||||
#include <libopencm3/stm32/timer.h>
|
||||
// for timer_get_frequency
|
||||
#include "mcu_arch.h"
|
||||
#include "arch/stm32/mcu_arch.h"
|
||||
|
||||
|
||||
/** Set PWM channel configuration
|
||||
|
||||
+1
-1
Submodule sw/ext/libopencm3 updated: 283d8cc7d2...1420be5577
Reference in New Issue
Block a user