-
Book Overview & Buying
-
Table Of Contents
ARM?? Cortex?? M4 Cookbook
By :
The idea of this recipe, which we'll call timerISR_c5v0, is to use a general purpose timer (TIM2) to generate an interrupt every 100 ms (that is, 10 Hz). The interrupt handler maintains a counter that, in turn, sets the global variables, LEDOn, LEDOff, which are used within main () to flash the LEDs.
Follow the steps to configure general purpose timers:
Create a new recipe (folder) named timerISR_c5v0. Invoke uVision5 and create a new project named timerISR.uvprojx.
Select the LED (API) driver from the RTE Board Support drop-down menu and configure CMSIS and Device options as in previous projects.
Create a new file, name it timerISR.c, and enter the following statements. Remember to include the boilerplate:
#include ""stm32f4xx_hal.h"" #include ""Board_LED.h"" #include <stdbool.h> #include ""timer.h"" /* Globals */ uint32_t tic = 0; #ifdef __RTX ______________________________________________________ /* Function Prototypes */ void SystemClock_Config...