This is the Official SmartGPU 2 processor board library to use with MBED boards!!!

Dependents:   BounceBall_SG2 BounceBalls_SG2 EEPROM_SG2 Ellipses_SG2 ... more

Revision:
1:0bf6fac21233
Parent:
0:210b5ba62803
Child:
2:3ae3f28ae9fe
--- a/SMARTGPU2.h	Tue Jul 09 08:18:07 2013 +0000
+++ b/SMARTGPU2.h	Thu Apr 17 20:36:42 2014 +0000
@@ -1,5 +1,5 @@
 /*********************************************************
-VIZIC TECHNOLOGIES. COPYRIGHT 2013.
+VIZIC TECHNOLOGIES. COPYRIGHT 2014.
 THE DATASHEETS, SOFTWARE AND LIBRARIES ARE PROVIDED "AS IS." 
 VIZIC EXPRESSLY DISCLAIM ANY WARRANTY OF ANY KIND, WHETHER 
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, THE IMPLIED 
@@ -12,29 +12,64 @@
 ANY DEFENCE THEREOF), ANY CLAIMS FOR INDEMNITY OR CONTRIBUTION,
 OR OTHER SIMILAR COSTS.
 *********************************************************/
-
+ 
 /********************************************************
- MBED SMARTGPU2 LIBRARY VERSION V1.0
+ MBED SMARTGPU2 LIBRARY VERSION V2.0
  IMPORTANT : This library is created for the MBED Software IDE
 ********************************************************/
-
+ 
 #ifndef SMARTGPU2_h
 #define SMARTGPU2_h
-
+ 
 #include <mbed.h>
+ 
+/*******************USER MODIFABLE**********************/
+//-Uncomment your preferred smartGPU2 board(only 1 at time)----------------
+//#define LCD160X128   //SmartGPU2 1.8" connected via SmartSHIELD
+//#define LCD320X240   //SmartGPU2 2.4" connected via SmartSHIELD
+//#define LCD480X320   //SmartGPU2 3.5" connected via SmartSHIELD
+//#define LCD480X272   //SmartGPU2 4.3" connected via SmartSHIELD
+//#define LCD800X480   //SmartGPU2 7.0" connected via SmartSHIELD
 
 //General MBED pinout defines
 #define TXPIN    p13
 #define RXPIN    p14
-#define RESETPIN p15
+//-SmartGPU2-MBED RESET PIN definition 
+#define RESETPIN p15   //Define for the smartGPU2 RESET pin connected to the MBED board
+
+//delay word compatibility for mbed
+#define delay wait_ms
+
+/****************END OF USER MODIFABLE******************/
 
-//defines for SmartGPU2 LCD320x240 ONLY
+/**************DON'T MODIFY UP FROM HERE****************/
+#ifdef  LCD160X128          //defines for SmartGPU2 LCD160x128 1.8" ONLY
+#define LCD_WIDTH  160
+#define LCD_HEIGHT 128
+#elif defined  LCD320X240   //defines for SmartGPU2 LCD320x240 2.4" ONLY
+#define LCD_WIDTH  320
+#define LCD_HEIGHT 240
+#elif defined  LCD320X240SH //defines for SmartGPU2 LCD320x240SH 2.4" ONLY
 #define LCD_WIDTH  320
 #define LCD_HEIGHT 240
-#define MAX_X_LANDSCAPE 319
-#define MAX_Y_LANDSCAPE 239
-#define MAX_X_PORTRAIT  239
-#define MAX_Y_PORTRAIT  319
+#elif defined  LCD480X320   //defines for SmartGPU2 LCD480x320 3.5" ONLY
+#define LCD_WIDTH  480
+#define LCD_HEIGHT 320
+#elif defined  LCD480X272   //defines for SmartGPU2 LCD480x272 4.3" ONLY
+#define LCD_WIDTH  480
+#define LCD_HEIGHT 272
+#elif defined  LCD800X480   //defines for SmartGPU2 LCD800x480 7.0" ONLY
+#define LCD_WIDTH  800
+#define LCD_HEIGHT 480
+#else
+#error "No smartGPU2 LCDXXXxXXX board defined in smartGPU2.h file"
+#endif
+
+//Max X, Y values depending on orientation definitions
+#define MAX_X_LANDSCAPE LCD_WIDTH-1
+#define MAX_Y_LANDSCAPE LCD_HEIGHT-1
+#define MAX_X_PORTRAIT  LCD_HEIGHT-1
+#define MAX_Y_PORTRAIT  LCD_WIDTH-1
 
 //General definitions
 #define OFF 0
@@ -50,7 +85,7 @@
 typedef unsigned int ADDRESS;
 typedef unsigned long POINTERPOSITION;
 typedef char FILENAME[];
-
+ 
 typedef enum {
     DISABLE, //0
     ENABLE   //1
@@ -171,12 +206,12 @@
 //SMARTGPU2 Command Execution responses definitions
 typedef enum {
     F_OK = 0,               /* (0) Succeeded */
-    F_DISK_ERR,         /* (1) A hard error occurred in the low level disk I/O layer */
+    F_DISK_ERR,             /* (1) A hard error occurred in the low level disk I/O layer */
     F_INT_ERR,              /* (2) Assertion failed */
     F_NOT_READY,            /* (3) The physical drive cannot work */
     F_NO_FILE,              /* (4) Could not find the file */
     F_NO_PATH,              /* (5) Could not find the path */
-    F_INVALID_NAME,     /* (6) The path name format is invalid */
+    F_INVALID_NAME,         /* (6) The path name format is invalid */
     F_DENIED,               /* (7) Access denied due to prohibited access or directory full */
     F_EXIST,                /* (8) Access denied due to prohibited access */
     F_INVALID_OBJECT,       /* (9) The file/directory object is invalid */
@@ -184,13 +219,13 @@
     F_INVALID_DRIVE,        /* (11) The logical drive number is invalid */
     F_NOT_ENABLED,          /* (12) The volume has no work area */
     F_NO_FILESYSTEM,        /* (13) There is no valid FAT volume */
-    F_MKFS_ABORTED,     /* (14) The f_mkfs() aborted due to any parameter error */
+    F_MKFS_ABORTED,         /* (14) The f_mkfs() aborted due to any parameter error */
     F_TIMEOUT,              /* (15) Could not get a grant to access the volume within defined period */
     F_LOCKED,               /* (16) The operation is rejected according to the file sharing policy */
     F_NOT_ENOUGH_CORE,      /* (17) LFN working buffer could not be allocated */
     F_TOO_MANY_OPEN_FILES,  /* (18) Number of open files > _FS_SHARE */
-    F_INVALID_PARAMETER /* (19) Given parameter is invalid */
-} FILERESULT;              //to get all FAT related functions responses
+    F_INVALID_PARAMETER     /* (19) Given parameter is invalid */
+} FILERESULT;               //Gets all FAT functions related responses
 
 //SMARTGPU2 WorkSpaces definitions
 typedef enum {
@@ -230,7 +265,7 @@
     SCALE1_8       // 1 to 8
 } JPGSCALEFACTOR; //to set the desired JPG image decompression scale factor
 
-//Recommended(but not limited to) MBED-SmartGPU Baud rate definitions
+//Recommended(but not limited to) Arduino-SmartGPU Baud rate definitions
 typedef enum{
     BAUD0 = 9600,
     BAUD1 = 19200,
@@ -241,10 +276,10 @@
     BAUD6 = 1000000,
     BAUD7 = 2000000
 } BAUDRATE;
-
+ 
 //**************************************************************************
 // class SMARTGPU2 SMARTGPU2.h
-// This is the main class. It shoud be used like this : SMARTGPU2 lcd(p13,p14,p15);
+// This is the main class. It should be used like this : SMARTGPU2 lcd(p13,p14,p15);
 //***************************************************************************
 class SMARTGPU2{
     
@@ -406,8 +441,11 @@
 //Those next Touch Functions return valid or invalid touch coordinates status(TOUCHREPLY) instead of ACK 'O' or NAK 'F'(SMARTGPUREPLY)
 /****************************************************************/  
     TOUCHREPLY touchScreen(POINT*);
-    
+#ifdef  LCD320X240 //define function only for the SmartGPU2 LCD320x240 2.4" is selected, as it is the only board with touch icons
     TOUCHREPLY touchIcon(ICON*);
+#elif defined  LCD320X240SH //define function only for the SmartGPU2 LCD320x240SH 2.4" is selected, as it is the only board with touch icons
+    TOUCHREPLY touchIcon(ICON*);
+#endif
     
 /****************************************************************/
 //SD FAT management Functions
@@ -465,5 +503,5 @@
     DigitalOut _resetPin;   
      
 };
-
-#endif
+ 
+#endif
\ No newline at end of file