Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define LCDSTAT *((uint32_t*)0x3830001C)
- #define LCDCMD *((uint32_t*)0x38300004)
- #define LCDDATA *((uint32_t*)0x38300040)
- void waitlcd()
- {
- while (LCDSTAT & 0x10);
- }
- void sendlcdc(uint32_t cmd)
- {
- waitlcd();
- LCDCMD = cmd;
- }
- void sendlcdd(uint32_t data)
- {
- waitlcd();
- LCDDATA = data;
- }
- void displaylcd(uint32_t startcol, uint32_t endcol, uint32_t startrow,
- uint32_t endrow, uint16_t* buffer, uint32_t color)
- {
- uint32_t pixels = (endcol - startcol + 1) * (endrow - startrow + 1);
- if (endrow & 0x100) endrow ^= 0x300; // WTF... But the LCD needs it.
- sendlcdc(0x2A);
- sendlcdd(startcol);
- sendlcdd(endcol);
- sendlcdc(0x2B);
- sendlcdd(startrow);
- sendlcdd(endrow);
- sendlcdc(0x2C);
- while (pixels--)
- {
- if ((uint32_t)buffer == 0x40000000) sendlcdd(color);
- else
- {
- sendlcdd(*buffer);
- buffer = &buffer[1];
- }
- }
- }
Add Comment
Please, Sign In to add comment