HAL library 3- DELAY for STM32Fxxx

Delay functions are needed in your program, no matter how optimized and fast program you wanna do.

Delay functions

I’ve updated my delay library to support milliseconds and microseconds delays. Milliseconds based delay is done using systick timer which makes interrupts every 1ms generated by HAL library. For microseconds based delay, DWT cycle counter is used to get maximal optimized delay.

DWT unit is for F4 and F7 only, F0 series does not have DWT, because of Cortex-M0.

Software timers

Library supports software timers generation. Software timer has resolution of 1ms and counts down. It can be used to generate events each X milliseconds in your project.

Library

Read more about new HAL libraries

Features

  • Delay for amount of milliseconds
  • Delay for amount of microseconds
  • Software timers with callback support

Dependencies

  • HAL
  • TM
    • STM32Fxxx HAL
    • defines.h

Functions and enumerations

Example 1

Example 2

Example 3

Projects are available on Github, download all libraries below.

tilz0R

Owner of this site. Application engineer, currently employed by STMicroelectronics. Exploring latest technologies and owner of different libraries posted on Github.

You may also like...

Read before commenting!

Before you make a new comment, make sure you agree with things listed below:

  • - Read post to make sure if it is already posted what you are asking for,
  • - Make sure you have the latest version of libraries used in your project,
  • - Make a clean and grammatically correct written message,
  • - Report as many details as possible, including what have you done so far,
  • - Do NOT post any code here. Use Pastebin,
  • - Do NOT post any error codes here. Use Pastebin,
  • - Specify STM32Fxxx family and used Discovery/EVAL/Nucleo or custom made board,
  • - Make sure your clock is set correct for PLL,
  • - If you are using my HAL drivers, please check this post how to start.
Comment will be deleted on breaking these rules without notification!