📄 main.c
字号:
/*
Animate a simple sindot.
FC
*/
#include <s1sdk.h>
#include <math.h>
#include <drivers/lcdtarget.h>
#include "sintableX.c"
#include "sintableY.c"
int Pos_X;
int Pos_Y;
int Pos_X2;
int Pos_Y2;
int Off_X;
int Off_Y;
extern unsigned char *Screen;
extern unsigned char Mod_Table[];
extern unsigned char Div_Table[];
/* Timer interrupt */
void My_RTC_ISR(void) {
int i;
LCD_ClearScreen();
Pos_X += 1;
Pos_X &= 0x3ff;
Pos_Y += 2;
Pos_Y &= 0x3ff;
Pos_X2 = Pos_X;
Pos_Y2 = Pos_Y;
for(i = 0; i < 30; i++) {
Off_X = SINTABLE_DatsX[Pos_X2];
Off_Y = SINTABLE_DatsY[Pos_Y2];
Screen[Div_Table[Off_Y] + (Off_X << 2)] |= Mod_Table[Off_Y];
Pos_X2 += 18;
Pos_X2 &= 0x3ff;
Pos_Y2 += 16;
Pos_Y2 &= 0x3ff;
}
LCD_UpdateScreen();
#asm
in a, (RTC_IRQSTATUS_REG)
out (RTC_IRQSTATUS_REG), a
#endasm
}
int main() {
WATCHDOG_Enable(WD_5_6s);
MCU_Initialise(MCU_CLK_DIV_NONE);
LCD_Initialise(16);
ISR_Initialise();
RTC_Initialise();
ISR_Install(ISR_HANDLER_RTC, My_RTC_ISR);
while(1) {
WATCHDOG_Reset();
}
return(0);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -