Librarie pour ecran 128x32 de MyLab
menu.cpp@13:337e207baca2, 2016-03-29 (annotated)
- Committer:
- lucas_favre
- Date:
- Tue Mar 29 20:29:20 2016 +0000
- Revision:
- 13:337e207baca2
- Parent:
- 12:00bbd42614c7
Modification des pins pour utilisations directes;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lucas_favre | 11:c00a727f140f | 1 | # include"C12832.h" |
lucas_favre | 11:c00a727f140f | 2 | |
lucas_favre | 11:c00a727f140f | 3 | #include "MyLab_Lib.h" |
lucas_favre | 11:c00a727f140f | 4 | |
lucas_favre | 11:c00a727f140f | 5 | bool connected = false; |
lucas_favre | 11:c00a727f140f | 6 | char* joystickPos = "CENTRE"; |
lucas_favre | 11:c00a727f140f | 7 | int blink_interval = 0; |
lucas_favre | 11:c00a727f140f | 8 | int select_app =0; |
lucas_favre | 11:c00a727f140f | 9 | static int menuItem =0; |
lucas_favre | 11:c00a727f140f | 10 | |
lucas_favre | 11:c00a727f140f | 11 | |
lucas_favre | 11:c00a727f140f | 12 | |
lucas_favre | 12:00bbd42614c7 | 13 | extern MyLab periph; |
lucas_favre | 11:c00a727f140f | 14 | void printMenu(int menuItem) |
lucas_favre | 11:c00a727f140f | 15 | { |
lucas_favre | 11:c00a727f140f | 16 | lcd.cls(); |
lucas_favre | 11:c00a727f140f | 17 | lcd.locate(0,0); |
lucas_favre | 11:c00a727f140f | 18 | switch (menuItem) |
lucas_favre | 11:c00a727f140f | 19 | { |
lucas_favre | 11:c00a727f140f | 20 | case 0: |
lucas_favre | 13:337e207baca2 | 21 | lcd.printf("mBed Librairie pour MyLab"); |
lucas_favre | 11:c00a727f140f | 22 | lcd.locate(0,16); |
lucas_favre | 11:c00a727f140f | 23 | lcd.printf("Scroll with joystick"); |
lucas_favre | 11:c00a727f140f | 24 | break; |
lucas_favre | 11:c00a727f140f | 25 | case 1: |
lucas_favre | 13:337e207baca2 | 26 | lcd.printf("Lecture de deux notes"); |
lucas_favre | 11:c00a727f140f | 27 | lcd.locate(0,16); |
lucas_favre | 13:337e207baca2 | 28 | lcd.printf("Click center to Start"); |
lucas_favre | 11:c00a727f140f | 29 | break; |
lucas_favre | 11:c00a727f140f | 30 | case 2: |
lucas_favre | 13:337e207baca2 | 31 | lcd.printf("Enregistrement audio"); |
lucas_favre | 11:c00a727f140f | 32 | lcd.locate(0,16); |
lucas_favre | 11:c00a727f140f | 33 | lcd.printf("Click center to Start"); |
lucas_favre | 11:c00a727f140f | 34 | break; |
lucas_favre | 11:c00a727f140f | 35 | case 3: |
lucas_favre | 13:337e207baca2 | 36 | lcd.printf("Lecture valeur x acc"); |
lucas_favre | 13:337e207baca2 | 37 | lcd.locate(0,16); |
lucas_favre | 13:337e207baca2 | 38 | lcd.printf("Click center to Start"); |
lucas_favre | 13:337e207baca2 | 39 | break; |
lucas_favre | 13:337e207baca2 | 40 | case 4: |
lucas_favre | 11:c00a727f140f | 41 | lcd.printf("Credits"); |
lucas_favre | 11:c00a727f140f | 42 | lcd.locate(0,16); |
lucas_favre | 11:c00a727f140f | 43 | lcd.printf("Favre Lucas ITI3 Hepia "); |
lucas_favre | 11:c00a727f140f | 44 | break; |
lucas_favre | 11:c00a727f140f | 45 | } |
lucas_favre | 11:c00a727f140f | 46 | } |
lucas_favre | 11:c00a727f140f | 47 | int setMenu() |
lucas_favre | 11:c00a727f140f | 48 | { |
lucas_favre | 12:00bbd42614c7 | 49 | char pos[6]; |
lucas_favre | 12:00bbd42614c7 | 50 | periph.JoyStick_Position(pos); |
lucas_favre | 11:c00a727f140f | 51 | |
lucas_favre | 12:00bbd42614c7 | 52 | if (strcmp(pos,"South") == 0) |
lucas_favre | 11:c00a727f140f | 53 | { |
lucas_favre | 11:c00a727f140f | 54 | joystickPos = "DOWN"; |
lucas_favre | 13:337e207baca2 | 55 | if (menuItem >= 0 && menuItem < 4) |
lucas_favre | 11:c00a727f140f | 56 | printMenu(++menuItem); |
lucas_favre | 11:c00a727f140f | 57 | } |
lucas_favre | 12:00bbd42614c7 | 58 | else if (strcmp(pos,"Center") == 0){ |
lucas_favre | 11:c00a727f140f | 59 | if (menuItem == 1) |
lucas_favre | 11:c00a727f140f | 60 | select_app = 1; |
lucas_favre | 11:c00a727f140f | 61 | else if(menuItem == 2) |
lucas_favre | 11:c00a727f140f | 62 | select_app = 2; |
lucas_favre | 13:337e207baca2 | 63 | else if(menuItem == 3) |
lucas_favre | 13:337e207baca2 | 64 | select_app = 3; |
lucas_favre | 11:c00a727f140f | 65 | joystickPos = "CLICK"; |
lucas_favre | 11:c00a727f140f | 66 | } |
lucas_favre | 12:00bbd42614c7 | 67 | else if (strcmp(pos,"North") == 0) |
lucas_favre | 11:c00a727f140f | 68 | { |
lucas_favre | 11:c00a727f140f | 69 | joystickPos = "UP"; |
lucas_favre | 13:337e207baca2 | 70 | if (menuItem <= 4 && menuItem > 0) |
lucas_favre | 11:c00a727f140f | 71 | printMenu(--menuItem); |
lucas_favre | 11:c00a727f140f | 72 | } |
lucas_favre | 11:c00a727f140f | 73 | return select_app; |
lucas_favre | 11:c00a727f140f | 74 | } |
lucas_favre | 11:c00a727f140f | 75 | |
lucas_favre | 11:c00a727f140f | 76 |