Librarie pour ecran 128x32 de MyLab

Dependents:   MyLab_Lib

Revision:
11:c00a727f140f
Child:
12:00bbd42614c7
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/menu.cpp	Tue Mar 29 18:26:15 2016 +0000
@@ -0,0 +1,69 @@
+# include"C12832.h"
+
+#include "MyLab_Lib.h"
+
+ bool connected = false;
+ char* joystickPos = "CENTRE";
+ int blink_interval = 0;
+ int select_app =0;
+ static int menuItem =0;
+
+
+
+
+ void printMenu(int menuItem)
+   {
+       lcd.cls();
+       lcd.locate(0,0);
+       switch (menuItem)
+       {
+           case 0:
+               lcd.printf("ARM mBed IoT App");
+               lcd.locate(0,16);
+               lcd.printf("Scroll with joystick");
+               break;
+           case 1:
+               lcd.printf("Websocket App");
+               lcd.locate(0,16);
+               lcd.printf("Click center to Start Snake");
+               break;
+           case 2:
+               lcd.printf("MQTT App:");
+               lcd.locate(0,16);
+               lcd.printf("Click center to Start");
+               break;
+           case 3:
+          	 lcd.printf("Credits");
+          	 lcd.locate(0,16);
+          	 lcd.printf("Favre Lucas ITI3 Hepia ");
+          	 break;
+       }
+  }
+ int setMenu()
+ {
+
+     if (!joy_s)
+     {
+         joystickPos = "DOWN";
+         if (menuItem >= 0 && menuItem < 3)
+             printMenu(++menuItem);
+     }
+     else if (!joy_c){
+    	 if (menuItem == 1)
+    		 select_app = 1;
+    	 else if(menuItem == 2)
+    		 select_app = 2;
+         joystickPos = "CLICK";
+     }
+     else if (!joy_n)
+     {
+         joystickPos = "UP";
+         if (menuItem <= 3 && menuItem > 0)
+             printMenu(--menuItem);
+     }
+     else
+         joystickPos = "CENTRE";
+     return select_app;
+ }
+
+