You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
KED/libraries/examples/timer2_Interrupt_Blinki_v2/main.c

43 lines
658 B

#include "delay.h"
#include "pin.h"
#include "deviceSetup.h"
#include "interrupt.h"
#include "timer.h"
void blinkiTask()
{
pinToggle(pinB3);
}
void declareInterrupts()
{
intDisableGlobal();
timerInitCounter(timer_2,(8E6/16E3)-1, 5000-1, upCounting);
timerEnableInterrupt(timer_2,TIM2_UPDATE);
timerStart(timer_2);
intInit(TIM2_UPDATE, blinkiTask, 1);
intEnable(TIM2_UPDATE);
intEnableGlobal();
}
int main(int argc, char *argv[])
{
uint8_t i = 0;
pinConfig(pinA0, input, def_stage, pullDown, def_speed);
pinConfig(pinB3, output, pushPull, def_res, def_speed);
pinWrite(pinB3, 0);
declareInterrupts();
while(1);
return 1;
}