You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
601 B
C

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include "SWM221.h"
int main(void)
{
SystemInit();
GPIO_Init(GPIOA, PIN4, 1, 0, 0, 0); //输出接LED
GPIO_Init(GPIOA, PIN5, 1, 0, 0, 0); //输出接LED
TIMR_Init(TIMR0, TIMR_MODE_TIMER, CyclesPerUs, 500000, 1); //每0.5秒钟触发一次中断
TIMR_Start(TIMR0);
TIMR_Init(BTIMR0, TIMR_MODE_TIMER, CyclesPerUs, 500000, 1); //每0.5秒钟触发一次中断
TIMR_Start(BTIMR0);
while(1==1)
{
}
}
void TIMR0_Handler(void)
{
TIMR_INTClr(TIMR0);
GPIO_InvBit(GPIOA, PIN4); //反转LED亮灭状态
}
void BTIMR0_Handler(void)
{
TIMR_INTClr(BTIMR0);
GPIO_InvBit(GPIOA, PIN5); //反转LED亮灭状态
}