"THE ClubMate-WARE LICENSE" (Revision 42):
[hackover2013-badge-firmware.git] / drivers / displays / tft / hw / hx8347d.c
index 33dccf5..48da4d3 100644 (file)
@@ -1,42 +1,32 @@
 /**************************************************************************/\r
 /*!\r
     @file     hx8347d.c\r
-    @author   TauonTeilchen\r
+    @author   Tauon {TauonTeilchen} Jabber ID Tauon[at]jabber.ccc.de\r
 \r
     @section  DESCRIPTION\r
+       Driver for hx8347h 240x320 pixel TFT LCD displays.\r
     Is written for MI0283QT-2 LCD from watterott.com\r
     More infos: http://www.watterott.com/de/MI0283QT-2-Adapter\r
-    Based on Watterott C Lib for MI0283QT-2\r
     http://www.watterott.com/index.php?page=product&info=1597&dl_media=3202\r
 \r
     @section  LICENSE\r
 \r
     Software License Agreement (BSD License)\r
 \r
-    Copyright (c) 2010, microBuilder SARL\r
-    All rights reserved.\r
-\r
-    Redistribution and use in source and binary forms, with or without\r
-    modification, are permitted provided that the following conditions are met:\r
-    1. Redistributions of source code must retain the above copyright\r
-    notice, this list of conditions and the following disclaimer.\r
-    2. Redistributions in binary form must reproduce the above copyright\r
-    notice, this list of conditions and the following disclaimer in the\r
-    documentation and/or other materials provided with the distribution.\r
-    3. Neither the name of the copyright holders nor the\r
-    names of its contributors may be used to endorse or promote products\r
-    derived from this software without specific prior written permission.\r
-\r
-    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY\r
-    EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
-    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\r
-    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\r
-    DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r
-    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r
-    LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\r
-    ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
-    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
-    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+    Copyright (c) 2012, TauonTeilchen \r
+       ----------------------------------------------------------------------------\r
+       "THE ClubMate-WARE LICENSE" (Revision 42):\r
+       JID: <Tauon@jabber.ccc.de> wrote this file. As long as you retain this notice you\r
+       can do whatever you want with this stuff. If we meet some day, and you think\r
+       this stuff is worth it, you can buy me a ClubMate in return Tauon\r
+       ----------------------------------------------------------------------------\r
+       ----------------------------------------------------------------------------\r
+        "THE ClubMate-WARE LICENSE" (Revision 42):\r
+        JID: <Tauon@jabber.ccc.de> schrieb diese Datei. Solange Sie diesen Vermerk nicht entfernen, k�nnen\r
+        Sie mit dem Material machen, was Sie m�chten. Wenn wir uns eines Tages treffen und Sie\r
+        denken, das Material ist es wert, k�nnen Sie mir daf�r ein ClubMate ausgeben. Tauon\r
+       ----------------------------------------------------------------------------\r
+       \r
 */\r
 /**************************************************************************/\r
 #include "drivers/displays/tft/hw/hx8347d.h"\r
@@ -114,14 +104,14 @@ uint16_t offset;
 /* Private Methods                               */\r
 /*************************************************/\r
 void lcd_drawstart(void);\r
-void lcd_cmd(unsigned int reg, unsigned int param);\r
-void lcd_clear(unsigned int color);\r
-void lcd_draw(unsigned int color);\r
+void lcd_cmd(uint16_t reg, uint16_t param);\r
+void lcd_clear(uint16_t color);\r
+void lcd_draw(uint16_t color);\r
 void lcd_drawstart(void);\r
 void lcd_drawstop(void);\r
 void hx8347d_DisplayOnFlow(void);\r
 void hx8347d_DisplayOffFlow(void);\r
-void lcd_area(unsigned int x0, unsigned int y0, unsigned int x1, unsigned int y1);\r
+void lcd_area(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1);\r
 \r
 \r
 void hx8347d_Scroll(uint16_t tfa,uint16_t vsa,uint16_t bfa, uint16_t vsp)\r
@@ -153,7 +143,7 @@ void displayOffFlow(void)
        lcd_cmd(Display_Control_3, Display_Control_3_D0);\r
 }\r
 \r
-void lcd_cmd(unsigned int reg, unsigned int param)\r
+void lcd_cmd(uint16_t reg, uint16_t param)\r
 {\r
        uint8_t b_first[2];\r
        uint8_t b_sec[2];\r
@@ -174,7 +164,7 @@ void lcd_cmd(unsigned int reg, unsigned int param)
 \r
   return;\r
 }\r
-void lcd_clear(unsigned int color)\r
+void lcd_clear(uint16_t color)\r
 {\r
   unsigned int i;\r
 \r
@@ -197,7 +187,7 @@ void lcd_clear(unsigned int color)
   return;\r
 }\r
 \r
-void lcd_draw(unsigned int color)\r
+void lcd_draw(uint16_t color)\r
 {\r
        // Writing data in 16Bit mode for saving a lot of time\r
     /* Move on only if NOT busy and TX FIFO not full. */\r
@@ -247,10 +237,18 @@ void lcd_drawstart(void)
 }\r
 \r
 \r
-void lcd_area(unsigned int x0, unsigned int y0, unsigned int x1, unsigned int y1)\r
+void lcd_area(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1)\r
 {\r
-       y0 = ((320-offset)+ y0) % 320;\r
-       y1 = ((320-offset)+ y1) % 320;\r
+       if(hx8347dPOrientation == LCD_ORIENTATION_PORTRAIT)\r
+       {\r
+               y0 = ((320-offset)+ y0) % 320;\r
+               y1 = ((320-offset)+ y1) % 320;\r
+       }\r
+       else\r
+       {\r
+               x0 = ((320-offset)+ x0) % 320;\r
+               x1 = ((320-offset)+ x1) % 320;          \r
+       }\r
        lcd_cmd(Column_Address_Start_1, (x0>>0)); //set x0\r
        lcd_cmd(Column_Address_Start_2, (x0>>8)); //set x0\r
        lcd_cmd(Column_Address_End_1  , (x1>>0)); //set x1\r
@@ -262,12 +260,12 @@ void lcd_area(unsigned int x0, unsigned int y0, unsigned int x1, unsigned int y1
 \r
   return;\r
 }\r
-void lcd_cursor(unsigned int x, unsigned int y)\r
+void lcd_cursor(uint16_t x, uint16_t y)\r
 {\r
   lcd_area(x, y, x, y);\r
   return;\r
 }\r
-void lcd_data(unsigned int c)\r
+void lcd_data(uint16_t c)\r
 {\r
        LCD_CS_ENABLE();\r
        uint8_t b[3];\r
@@ -414,6 +412,7 @@ void lcdInit(void)
        lcd_cmd(0x28, 0x003C);\r
 \r
        lcdSetOrientation(hx8347dPOrientation);\r
+       offset = 0;\r
        return;\r
 }\r
 /**************************************************************************/\r
@@ -562,6 +561,7 @@ void lcdDrawVLine(uint16_t x, uint16_t y0, uint16_t y1, uint16_t color)
 /**************************************************************************/\r
 uint16_t lcdGetPixel(uint16_t x, uint16_t y)\r
 {\r
+       return 0;\r
 }\r
 \r
 /**************************************************************************/\r
This page took 0.02445 seconds and 4 git commands to generate.