|
本帖最后由 Mcuzone_TKN 于 2020-5-15 09:16 编辑
关键词:Microchip Atmel SAM4E SAM4E-EK SAM4E16E 芯片 LCD ILI93XX
概述:在LCD上绘制文本 图案 和基本形状
这个例子演示了如何配置LCD控制器ili9325或ili9341控制面板上的LCD
打开产品光盘SAM4E16E-EK/SAM4E16E-EK中文资料/softpack软件包/Atmel Studio 7,打开11a_ILI193XX_EXAMPLE例子。
//smc_lcd示例的简单应用程序入口点 返回未使用的(ANSI-C兼容性)
int main(void)
{
sysclk_init();
board_init();
configure_console();
//启用外围时钟
pmc_enable_periph_clk(ID_SMC);
//为LCD配置SMC接口
smc_set_setup_timing(SMC, ILI93XX_LCD_CS, SMC_SETUP_NWE_SETUP(2)
| SMC_SETUP_NCS_WR_SETUP(2)
| SMC_SETUP_NRD_SETUP(2)
| SMC_SETUP_NCS_RD_SETUP(2));
smc_set_pulse_timing(SMC, ILI93XX_LCD_CS, SMC_PULSE_NWE_PULSE(4)
| SMC_PULSE_NCS_WR_PULSE(4)
| SMC_PULSE_NRD_PULSE(10)
| SMC_PULSE_NCS_RD_PULSE(10));
smc_set_cycle_timing(SMC, ILI93XX_LCD_CS, SMC_CYCLE_NWE_CYCLE(10)
| SMC_CYCLE_NRD_CYCLE(22));
#if ((!defined(SAM4S)) && (!defined(SAM4E)))
smc_set_mode(SMC, ILI93XX_LCD_CS, SMC_MODE_READ_MODE
| SMC_MODE_WRITE_MODE
| SMC_MODE_DBW_8_BIT);
#else
smc_set_mode(SMC, ILI93XX_LCD_CS, SMC_MODE_READ_MODE
| SMC_MODE_WRITE_MODE);
#endif
//初始化显示参数
g_ili93xx_display_opt.ul_width = ILI93XX_LCD_WIDTH;
g_ili93xx_display_opt.ul_height = ILI93XX_LCD_HEIGHT;
g_ili93xx_display_opt.foreground_color = COLOR_BLACK;
g_ili93xx_display_opt.background_color = COLOR_WHITE;
//关闭背光
aat31xx_disable_backlight();
//初始化LCD
ili93xx_init(&g_ili93xx_display_opt);
//设置背光等级
aat31xx_set_backlight(AAT31XX_AVG_BACKLIGHT_LEVEL);
ili93xx_set_foreground_color(COLOR_WHITE);
ili93xx_draw_filled_rectangle(0, 0, ILI93XX_LCD_WIDTH,
ILI93XX_LCD_HEIGHT);
//打开LCD
ili93xx_display_on();
ili93xx_set_cursor_position(0, 0);
//在LCD上绘制文本 图案 和基本形状
ili93xx_set_foreground_color(COLOR_BLACK);
ili93xx_draw_string(10, 20, (uint8_t *)"ili93xx_lcd example");
ili93xx_set_foreground_color(COLOR_RED);
ili93xx_draw_circle(60, 160, 40);
ili93xx_set_foreground_color(COLOR_GREEN);
ili93xx_draw_circle(120, 160, 40);
ili93xx_set_foreground_color(COLOR_BLUE);
ili93xx_draw_circle(180, 160, 40);
ili93xx_set_foreground_color(COLOR_VIOLET);
ili93xx_draw_line(0, 0, 240, 320);
while (1) {
}
}
|
|