📄 hello_led.c
字号:
#include "system.h"
#include "altera_avalon_pio_regs.h"
#include "alt_types.h"
#include "LCD.h"
#include "picture.h"
/*
* This is a freestanding application, so we want to use alt_main
* as the entry point. However, if the debugger is run on this
* application, it will try to set a breakpoint at main, which
* the application does not contain. The below line creates an
* alias so the debugger is able to set a breakpoint at main,
* yet the application retains alt_main as it's entry point.
*/
int main (void) __attribute__ ((weak, alias ("alt_main")));
/*
* Use alt_main as entry point for this free-standing application
*/
int alt_main (void)
{
IOWR_ALTERA_AVALON_PIO_DATA(SEG7_BASE,0x11111111 );
IOWR_ALTERA_AVALON_PIO_DATA(LEDR_BASE,0xfffffC00 );
IOWR_ALTERA_AVALON_PIO_DATA(RGB_BASE,0xf7ffffff );
Delayms(100000);
IOWR_ALTERA_AVALON_PIO_DATA(RGB_BASE,0xffffffff );
Delayms(120000);
while (1)
{
ILI9320_init();
IOWR_ALTERA_AVALON_PIO_DATA(LEDG_BASE,0x01 );
LCD_TEST_Color(0x7bef);
Delayms(100000);
WaitKey();
IOWR_ALTERA_AVALON_PIO_DATA(LEDG_BASE,0x03 );
LCD_TEST_Color(0xf800);
Delayms(100000);
WaitKey();
IOWR_ALTERA_AVALON_PIO_DATA(LEDG_BASE,0x07 );
LCD_TEST_Color(0x07e0);
Delayms(100000);
WaitKey();
IOWR_ALTERA_AVALON_PIO_DATA(LEDG_BASE,0x0f );
LCD_TEST_Color(0x001f);
Delayms(100000);
WaitKey();
IOWR_ALTERA_AVALON_PIO_DATA(LEDG_BASE,0x1f );
LCD_TEST_Color(0xffff);
Delayms(100000);
WaitKey();
IOWR_ALTERA_AVALON_PIO_DATA(LEDG_BASE,0x3f );
LCD_TEST_Color(0x0000);
Delayms(100000);
WaitKey();
IOWR_ALTERA_AVALON_PIO_DATA(LEDG_BASE,0x7f );
LCD_TEST_picture(picture1);
Delayms(100000);
WaitKey();
IOWR_ALTERA_AVALON_PIO_DATA(LEDG_BASE,0xff );
LCD_TEST_Color(0x7bef);
WaitKey();
Delayms(100000);
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -