A typical example for using the CMSIS layer is provided below. The example is based on a STM32F10x Device.
#include <stm32f10x.h>
uint32_t volatile msTicks;
void SysTick_Handler (void) {
msTicks++;
}
void WaitForTick (void) {
uint32_t curTicks;
curTicks = msTicks;
while (msTicks == curTicks) {
}
}
void TIM1_UP_IRQHandler (void) {
;
}
void timer1_init(int frequency) {
}
void Device_Initialization (void) {
:
}
timer1_init ();
}
void main (void) {
Device_Initialization ();
while (1) {
Get_InputValues ();
Calculation_Response ();
Output_Response ();
WaitForTick ();
}
}
void __enable_irq(void)
Globally enables interrupts and configurable fault handlers.
void __disable_irq(void)
Globally disables interrupts and configurable fault handlers.
void NVIC_EnableIRQ(IRQn_Type IRQn)
Enable a device specific interrupt.
void NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
Set the priority for an interrupt.
uint32_t SysTick_Config(uint32_t ticks)
System Tick Timer Configuration.
void __WFE(void)
Wait For Event.
uint32_t SystemCoreClock
Variable to hold the system core clock value.
Definition: Ref_SystemAndClock.txt:68
CMSIS-Pack provides the #define CMSIS_header_file in RTE_Components.h which gives you access to the device.h file of a project. This allows you to generate generic software components that use the device selected in a project.
#include "RTE_Components.h"
#include CMSIS_device_header