From ada61ef06b019357aaa3cb9a2a1bc06fe6c5acef Mon Sep 17 00:00:00 2001 From: suiauthon Date: Mon, 15 Feb 2016 11:21:10 +0100 Subject: [PATCH] added support for FreeRTOS --- libuavcan_drivers/stm32/driver/src/uc_stm32_can.cpp | 7 +++++-- libuavcan_drivers/stm32/driver/src/uc_stm32_clock.cpp | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/libuavcan_drivers/stm32/driver/src/uc_stm32_can.cpp b/libuavcan_drivers/stm32/driver/src/uc_stm32_can.cpp index 5339748bc2..3a8c29f165 100644 --- a/libuavcan_drivers/stm32/driver/src/uc_stm32_can.cpp +++ b/libuavcan_drivers/stm32/driver/src/uc_stm32_can.cpp @@ -873,14 +873,17 @@ uavcan::int16_t CanDriver::select(uavcan::CanSelectMasks& inout_masks, static void nvicEnableVector(IRQn_Type irq, uint8_t prio) { - /*NVIC_InitTypeDef NVIC_InitStructure; + #if !defined (USE_HAL_DRIVER) + NVIC_InitTypeDef NVIC_InitStructure; NVIC_InitStructure.NVIC_IRQChannel = irq; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = prio; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; - NVIC_Init(&NVIC_InitStructure);*/ + NVIC_Init(&NVIC_InitStructure); + #else HAL_NVIC_SetPriority(irq, prio, 0); HAL_NVIC_EnableIRQ(irq); + #endif } #endif diff --git a/libuavcan_drivers/stm32/driver/src/uc_stm32_clock.cpp b/libuavcan_drivers/stm32/driver/src/uc_stm32_clock.cpp index ccce1a3536..d67f1c7c1f 100644 --- a/libuavcan_drivers/stm32/driver/src/uc_stm32_clock.cpp +++ b/libuavcan_drivers/stm32/driver/src/uc_stm32_clock.cpp @@ -85,14 +85,17 @@ uavcan::uint64_t time_utc = 0; static void nvicEnableVector(IRQn_Type irq, uint8_t prio) { - /*NVIC_InitTypeDef NVIC_InitStructure; + #if !defined (USE_HAL_DRIVER) + NVIC_InitTypeDef NVIC_InitStructure; NVIC_InitStructure.NVIC_IRQChannel = irq; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = prio; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; - NVIC_Init(&NVIC_InitStructure);*/ + NVIC_Init(&NVIC_InitStructure); + #else HAL_NVIC_SetPriority(irq, prio, 0); HAL_NVIC_EnableIRQ(irq); + #endif }