SysTick in C für das mySTM32 Board Light

//---------------------------------------------------------------------------
// Title     : simple SysTick Solution, ARM C application in SiSy
//---------------------------------------------------------------------------
// Function  : ...
// Wiring    : ...
//---------------------------------------------------------------------------
// Hardware  : ...
// Clock     : ... MHz
// Language  : ARM C
// Date      : ...
// Version   : ...
// Author    : ...
//---------------------------------------------------------------------------
#include <stddef.h>
#include <stdlib.h>
#include "hardware.h"

void initApplication()
{
    // config 10ms SystemTimer
    SysTick_Config(SystemCoreClock/100);
    // user initializations here
    RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB,ENABLE);
    GPIO_InitTypeDef led;
    led.GPIO_Mode  = GPIO_Mode_OUT;
 	led.GPIO_OType = GPIO_OType_PP;
 	led.GPIO_Pin   = GPIO_Pin_0;
 	led.GPIO_PuPd  = GPIO_PuPd_NOPULL;
 	led.GPIO_Speed = GPIO_Speed_2MHz;
 	GPIO_Init(GPIOB,&led);  
}
int main(void)
{
    SystemInit();
    initApplication();
    do{
    
		// empty main loop    
    
    } while (true);
    return 0;
}
extern "C" void SysTick_Handler(void)
{
    // Application SysTick default 10ms
    static uint8_t counter=0;
    counter++;
    if (counter==10)
    { 
    	GPIO_ToggleBits(GPIOB,GPIO_Pin_0);
    	counter=0;
    }
}
//------------------------------------------------------------------------------

Weiter mit