landtiger with ili9325 lcd controller based on the TFTLCD libary from Todor Todorov
Diff: lcd_base.cpp
- Revision:
- 1:1a3dd94e13cf
- Parent:
- 0:0099ad246127
--- a/lcd_base.cpp Tue May 12 19:13:04 2015 +0000
+++ b/lcd_base.cpp Mon Jun 08 09:59:17 2015 +0000
@@ -22,9 +22,6 @@
#include "lcd_base.h"
#include "helpers.h"
-// Task GUI und Restbus greifen auf den LCD zu, daher müssen die Funktionen durch ein Mutex geschützt werden
-Mutex lcd_mutex;
-
LCD::LCD( unsigned short width, unsigned short height, PinName CS, PinName RS, PinName DIR, PinName EN, PinName LE, PinName BL, backlight_t blType, float defaultBacklight )
: _disp_width( width ), _disp_height( height ), _lcd_pin_cs( CS ), _lcd_pin_rs( RS ), _lcd_pin_dir(DIR), _lcd_pin_en(EN), _lcd_pin_le(LE), _bl_type( blType )
{
@@ -142,19 +139,12 @@
void LCD::FillScreen( int color )
{
-
- //////////////////////
- lcd_mutex.lock();
- //////////////////////
unsigned int rgb = color == -1 ? _background : color == -2 ? _foreground : ( unsigned int ) color;
Activate();
ClearXY();
for ( int i = 0; i < ( ( _disp_width ) * ( _disp_height ) ); i++ )
SetPixelColor( rgb );
- Deactivate();
- ///////////////////////////////
- lcd_mutex.unlock();
- ///////////////////////////////
+ Deactivate();
}
inline
@@ -165,25 +155,14 @@
void LCD::DrawPixel( unsigned short x, unsigned short y, int color )
{
- //////////////////////
- lcd_mutex.lock();
- //////////////////////
Activate();
SetXY( x, y, x, y );
SetPixelColor( color == -1 ? _background :
color == -2 ? _foreground : color );
- Deactivate();
- //////////////////////
- lcd_mutex.unlock();
- //////////////////////
}
void LCD::DrawLine( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, int color )
{
-
- //////////////////////
- lcd_mutex.lock();
- //////////////////////
double delta, tx, ty;
if ( ( ( x2 - x1 ) < 0 ) )
@@ -261,17 +240,10 @@
}
Deactivate();
}
- ///////////////////////////////
- lcd_mutex.unlock();
- ///////////////////////////////
}
void LCD::DrawRect( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, int color )
{
- //////////////////////
- lcd_mutex.lock();
- //////////////////////
-
if ( x1 > x2 ) swap( ushort, x1, x2 )
if ( y1 > y2 ) swap( ushort, y1, y2 )
@@ -279,10 +251,6 @@
DrawHLine( x1, y2, x2 - x1, color );
DrawVLine( x1, y1, y2 - y1, color );
DrawVLine( x2, y1, y2 - y1, color );
-
- ///////////////////////////////
- lcd_mutex.unlock();
- ///////////////////////////////
}
void LCD::DrawRoundRect( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, int color )
@@ -305,10 +273,6 @@
void LCD::FillRect( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, int color )
{
- //////////////////////
- lcd_mutex.lock();
- //////////////////////
-
if ( x1 > x2 ) swap( ushort, x1, x2 );
if ( y1 > y2 ) swap( ushort, y1, y2 );
@@ -316,10 +280,7 @@
{
DrawHLine( x1, y1 + i, x2 - x1, color );
DrawHLine( x1, y2 - i, x2 - x1, color );
- }
- ///////////////////////////////
- lcd_mutex.unlock();
- ///////////////////////////////
+ }
}
void LCD::FillRoundRect( unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, int color )
@@ -418,10 +379,6 @@
void LCD::Print( const char *str, unsigned short x, unsigned short y, int fgColor, int bgColor, unsigned short deg )
{
- //////////////////////
- lcd_mutex.lock();
- //////////////////////
-
int stl, i;
stl = strlen( str );
@@ -435,18 +392,11 @@
if ( deg == 0 )
PrintChar( *str++, x + ( i * ( _font->Width ) ), y, fgColor, bgColor );
else
- RotateChar( *str++, x, y, i, fgColor, bgColor, deg );
- ///////////////////////////////
- lcd_mutex.unlock();
- ///////////////////////////////
+ RotateChar( *str++, x, y, i, fgColor, bgColor, deg );
}
void LCD::DrawBitmap( unsigned short x, unsigned short y, const bitmap_t* img, unsigned char scale )
{
- //////////////////////
- lcd_mutex.lock();
- //////////////////////
-
int tx, ty, tc, tsx, tsy;
Activate();
@@ -504,18 +454,11 @@
}
}
}
- Deactivate();
- ///////////////////////////////
- lcd_mutex.unlock();
- ///////////////////////////////
+ Deactivate();
}
void LCD::DrawBitmap( unsigned short x, unsigned short y, const bitmap_t* img, unsigned short deg, unsigned short rox, unsigned short roy )
{
- //////////////////////
- lcd_mutex.lock();
- //////////////////////
-
int tx, ty, newx, newy;
double radian;
radian = deg * 0.0175;
@@ -556,9 +499,6 @@
}
Deactivate();
}
- //////////////////////
- lcd_mutex.unlock();
- //////////////////////
}
inline