Skip to content
Snippets Groups Projects
Commit 77aee1a9 authored by schneider's avatar schneider
Browse files

feat(ips): Speed up display by using a buffer

parent 797d1763
No related branches found
No related tags found
No related merge requests found
......@@ -29,6 +29,7 @@ int main(void)
card10_diag();
Paint_DrawImage(Heart, 0, 0, 160, 80);
LCD_Update();
int h = 0;
while (1) {
......
......@@ -34,8 +34,9 @@ int main(void)
Paint_DrawCircle(85,25, 22, GREEN, DRAW_FILL_EMPTY, DOT_PIXEL_2X2);
Paint_DrawImage(gImage_40X40,120, 0,40, 40);
DEV_Delay_ms(10000);
Paint_DrawImage(gImage_160X80,0, 0, 160, 80);
LCD_Update();
DEV_Delay_ms(3000);
while (1) {
TMR_Delay(MXC_TMR0, MSEC(1000), 0);
......
#ifndef CARD10_H
#include "gpio.h"
#include <stdint.h>
void card10_init(void);
......
......@@ -36,26 +36,13 @@
//const gpio_cfg_t DEV_CS_PIN = {PORT_0, PIN_8, GPIO_FUNC_OUT, GPIO_PAD_NONE};
//const gpio_cfg_t DEV_BL_PIN = {PORT_0, PIN_8, GPIO_FUNC_OUT, GPIO_PAD_NONE};
static spi_req_t req = {.rx_data = NULL, .bits=8, .width = SPI17Y_WIDTH_1, .ssel = 0, .deass = 1, .ssel_pol = SPI17Y_POL_LOW, .tx_num = 0, .rx_num = 0};
/********************************************************************************/
void lcd_write(uint8_t *data, int size)
{
spi_req_t req;
//uint8_t tx_data[] = {data};
//uint8_t rx_data[] = {0};
//req.tx_data = tx_data;
req.tx_data = data;
//req.rx_data = rx_data;
req.rx_data = NULL;
req.len = size;
req.bits = 8;
req.width = SPI17Y_WIDTH_1;
req.ssel = 0;
req.deass = 1;
req.ssel_pol = SPI17Y_POL_LOW;
req.tx_num = 0;
req.rx_num = 0;
SPI_MasterTrans(SPI, &req);
}
......@@ -28,6 +28,7 @@
#
******************************************************************************/
#include "LCD_Driver.h"
static uint8_t screen[LCD_HEIGHT][LCD_WIDTH][2];
/*******************************************************************************
function:
......@@ -216,7 +217,7 @@ void LCD_SetCursor(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend)
LCD_WriteReg(0x2C);
}
#if 0
/******************************************************************************
function: Clear screen function, refresh the screen to a certain color
parameter :
......@@ -232,6 +233,7 @@ void LCD_Clear(UWORD Color)
}
}
}
#endif
/******************************************************************************
function: Refresh a certain area to the same color
......@@ -275,12 +277,29 @@ parameter :
Y : Set the Y coordinate
Color : Set the color
******************************************************************************/
#if 0
void LCD_SetUWORD(UWORD x, UWORD y, UWORD Color)
{
LCD_SetCursor(x,y,x,y);
LCD_WriteData_Word(Color);
}
#endif
void LCD_SetUWORD(UWORD x, UWORD y, UWORD Color)
{
screen[y][x][0] = (Color >> 8);
screen[y][x][1] = (Color & 0xFF);
}
void LCD_Clear(UWORD Color)
{
UWORD i,j;
for(i = 0; i < LCD_WIDTH; i++){
for(j = 0; j < LCD_HEIGHT; j++){
LCD_SetUWORD(i, j, Color);
}
}
}
void LCD_Set(uint8_t *data, int len)
{
......@@ -288,3 +307,9 @@ void LCD_Set(uint8_t *data, int len)
DEV_Digital_Write(DEV_DC_PIN,1);
lcd_write(data, len);
}
void LCD_Update(void)
{
LCD_Set((uint8_t*)screen, sizeof(screen));
}
......@@ -48,4 +48,7 @@ void LCD_SetBacklight(UWORD Value);
void LCD_Clear(UWORD Color);
void LCD_ClearWindow(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD UWORD);
void LCD_Set(uint8_t *data, int len);
void LCD_Update(void);
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment