Do lcdWaitDmaEnd() in perMain()

This commit is contained in:
Damjan Adamic
2014-12-07 10:24:27 +01:00
parent f8203b72f7
commit 6f46ef23da
4 changed files with 7 additions and 12 deletions
-1
View File
@@ -47,7 +47,6 @@
void lcd_clear()
{
lcdWaitDmaEnd();
memset(displayBuf, 0, DISPLAY_BUFER_SIZE);
}
-7
View File
@@ -41,7 +41,6 @@
#if !defined(CPUARM)
void lcd_putcAtt(coord_t x, uint8_t y, const unsigned char c, LcdFlags flags)
{
lcdWaitDmaEnd();
uint8_t *p = &displayBuf[ y / 8 * LCD_W + x ];
const pm_uchar *q = &font_5x7[(c-0x20)*5];
@@ -205,7 +204,6 @@ void lcd_mask(uint8_t *p, uint8_t mask, LcdFlags att)
void lcd_plot(coord_t x, coord_t y, LcdFlags att)
{
lcdWaitDmaEnd();
uint8_t *p = &displayBuf[ y / 8 * LCD_W + x ];
if (p<DISPLAY_END)
lcd_mask(p, BITMASK(y%8), att);
@@ -216,7 +214,6 @@ void lcd_hlineStip(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlags att)
if (y >= LCD_H) return;
if (x+w > LCD_W) { w = LCD_W - x; }
lcdWaitDmaEnd();
uint8_t *p = &displayBuf[ y / 8 * LCD_W + x ];
uint8_t msk = BITMASK(y%8);
while (w--) {
@@ -242,7 +239,6 @@ void lcd_vlineStip(coord_t x, int8_t y, int8_t h, uint8_t pat)
if (pat==DOTTED && !(y%2))
pat = ~pat;
lcdWaitDmaEnd();
uint8_t *p = &displayBuf[ y / 8 * LCD_W + x ];
y = (y & 0x07);
if (y) {
@@ -281,7 +277,6 @@ void lcd_vlineStip(coord_t x, scoord_t y, scoord_t h, uint8_t pat, LcdFlags att)
if (pat==DOTTED && !(y%2))
pat = ~pat;
lcdWaitDmaEnd();
uint8_t *p = &displayBuf[ y / 8 * LCD_W + x ];
y = (y & 0x07);
if (y) {
@@ -308,7 +303,6 @@ void lcd_vlineStip(coord_t x, scoord_t y, scoord_t h, uint8_t pat, LcdFlags att)
void lcd_invert_line(int8_t y)
{
lcdWaitDmaEnd();
uint8_t *p = &displayBuf[y * LCD_W];
for (coord_t x=0; x<LCD_W; x++) {
ASSERT_IN_DISPLAY(p);
@@ -329,7 +323,6 @@ void lcd_img(coord_t x, coord_t y, const pm_uchar * img, uint8_t idx, LcdFlags a
uint8_t hb = (pgm_read_byte(q++)+7)/8;
bool inv = (att & INVERS) ? true : (att & BLINK ? BLINK_ON_PHASE : false);
q += idx*w*hb;
lcdWaitDmaEnd();
for (uint8_t yb = 0; yb < hb; yb++) {
uint8_t *p = &displayBuf[ (y / 8 + yb) * LCD_W + x ];
for (coord_t i=0; i<w; i++){
-4
View File
@@ -65,7 +65,6 @@ void lcd_mask(uint8_t *p, uint8_t mask, LcdFlags att)
void lcd_plot(coord_t x, coord_t y, LcdFlags att)
{
if (x<0 || x>=LCD_W || y<0 || y>=LCD_H) return;
lcdWaitDmaEnd();
uint8_t *p = &displayBuf[ y / 2 * LCD_W + x ];
uint8_t mask = PIXEL_GREY_MASK(y, att);
if (p<DISPLAY_END) {
@@ -81,7 +80,6 @@ void lcd_hlineStip(coord_t x, coord_t y, coord_t w, uint8_t pat, LcdFlags att)
w = LCD_W - x;
}
lcdWaitDmaEnd();
uint8_t *p = &displayBuf[ y / 2 * LCD_W + x ];
uint8_t mask = PIXEL_GREY_MASK(y, att);
while (w--) {
@@ -122,7 +120,6 @@ void lcd_vlineStip(coord_t x, scoord_t y, scoord_t h, uint8_t pat, LcdFlags att)
void lcd_invert_line(int8_t line)
{
lcdWaitDmaEnd();
uint8_t *p = &displayBuf[line * 4 * LCD_W];
for (coord_t x=0; x<LCD_W*4; x++) {
ASSERT_IN_DISPLAY(p);
@@ -164,7 +161,6 @@ void lcd_bmp(coord_t x, coord_t y, const uint8_t * img, coord_t offset, coord_t
}
uint8_t rows = (*q++ + 1) / 2;
lcdWaitDmaEnd();
for (uint8_t row=0; row<rows; row++) {
q = img + 2 + row*w + offset;
uint8_t *p = &displayBuf[(row + (y/2)) * LCD_W + x];
+7
View File
@@ -131,6 +131,13 @@ void perMain()
// run Lua scripts that don't use LCD (to use CPU time while LCD DMA is running)
luaRunNonGuiScripts();
// wait for LCD DMA to finish before continuing, because code from this point
// is allowed to change the contents of LCD buffer
//
// WARNING: make sure no code above this line does any change to the LCD display buffer!
//
lcdWaitDmaEnd();
// draw LCD from menus or from Lua script
if (luaRunGuiScripts(evt)) { // either stand-alone or telemetry scripts
// let Lua manage LCD fully