LCD ExtSDRAM

Source code can be downloaded from source:/Examples/LCD_ExtSDRAM

Description
This demo example shows the operating of LCD Extension board with external SDRAM.

From the main.c source file:

Initialization
1     SystemInit();
2     CGU_Init();
Init SysTick to 1ms
1     SysTick_Config(CGU_GetPCLKFrequency(CGU_PERIPHERAL_M4CORE) / 1000);
Configure external flash
1     MemoryPinInit();
2     EMCSRDRAMInit();
3     EMCFlashInit();
Create color bars
 1     for (x = 0; x < LCD_WIDTH; x++)
 2     {
 3         uint8_t n = x * 8 / LCD_WIDTH; // 8 colorbars
 4         uint32_t color = 0;
 5
 6         if (n & 0x01) color |= 0x0000FF; // +blue
 7         if (n & 0x02) color |= 0x00FF00; // +green
 8         if (n & 0x04) color |= 0xFF0000; // +red
 9
10         for (y = 0; y < LCD_HEIGHT; y++)
11         {
12             framebuffer[y * LCD_WIDTH + x] = color;
13         }
14     }
Execution
 1     while (1)
 2     {
 3         uint32_t color0 = framebuffer[0];
 4
 5         // Slide color bars
 6         for (x = 0; x < LCD_WIDTH; x++)
 7         {
 8             uint32_t color = (x < (LCD_WIDTH)) ? framebuffer[x + 1] : color0;
 9
10             for (y = 0; y < LCD_HEIGHT; y++)
11             {
12                 framebuffer[y * LCD_WIDTH + x] = color;
13             }
14         }
15
16         DelayMs(5 * 1000 / LCD_WIDTH);  // 5 sec cycle
17     }

Indéfini