chore: delays driver cleanup (#5295)

This commit is contained in:
Raphael Coeffic
2024-07-18 11:45:56 +10:00
committed by GitHub
parent ddc69a590c
commit 3430f3de55
3 changed files with 5 additions and 174 deletions
@@ -30,9 +30,10 @@
#include "stm32h7xx.h"
#elif defined(STM32F4)
#include "stm32f4xx.h"
#else
#elif defined(STM32F2)
#include "stm32f2xx.h"
#include "dwt.h" // the old ST library that we use does not define DWT register for STM32F2xx
#else
#error "Unknown MCU family"
#endif
#endif
@@ -41,12 +42,6 @@
#include "../simu/simpgmspace.h"
#endif
#if !defined(SIMU) && !defined(BACKUP)
#define ticksNow() ((uint32_t)(DWT->CYCCNT))
#else
#define ticksNow() ((uint32_t)(0UL))
#endif
#include "delays_driver.h"
#endif
@@ -26,10 +26,11 @@
#define SYSTEM_TICKS_1US ((CPU_FREQ + 500000) / 1000000)
#define SYSTEM_TICKS_01US ((CPU_FREQ + 5000000) / 10000000)
#define ticksNow() ((uint32_t)(DWT->CYCCNT))
void delaysInit()
{
CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
DWT->CYCCNT = 0;
DWT->CTRL |= DWT_CTRL_CYCCNTENA_Msk;
}