Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of app-shield-joystick by
Revision 5:d879f538c159, committed 2021-10-10
- Comitter:
- rtk
- Date:
- Sun Oct 10 14:26:20 2021 +0000
- Parent:
- 4:dd6d3b44dcb9
- Commit message:
- BTS SNEC
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Oct 06 15:46:06 2015 +0000
+++ b/main.cpp Sun Oct 10 14:26:20 2021 +0000
@@ -1,16 +1,99 @@
#include "mbed.h"
#include "C12832.h"
-DigitalIn up(A2);
-
-int main()
-{
+DigitalIn up(A2);
+DigitalIn down(A3);
+DigitalIn left(A4);
+DigitalIn right(A5);
+DigitalIn center(D4);
+C12832 lcd(D11, D13, D12, D7, D10);
+enum {MATIN,MIDI,SOIR, PETIT, DEJ,DINER} etat = MATIN;
- while (1) {
-
+int menu_precedent = MIDI;
+char message_precedent[]=" ";
+void Afficher_Menu(int Menu)
+{
+ if (menu_precedent == Menu) return;
+ menu_precedent = Menu;
+ lcd.cls();
+ lcd.locate(0,8);
+ //wait(0.050);
+ switch(Menu) {
+ case MATIN :
+ lcd.printf("Matin");
+ break;
+ case MIDI :
+ lcd.printf("Midi");
+ break;
+ case SOIR :
+ lcd.printf("Soir");
+ break;
+ case PETIT :
+ lcd.printf("Petit dejeuner");
+ break;
+ case DEJ :
+ lcd.printf("Dejeuner");
+ break;
+ case DINER :
+ lcd.printf("Diner");
+ break;
}
}
+void Afficher_Message(char *Message)
+{
+ if (strcmp(message_precedent,Message) ==0) return;
+ lcd.cls();
+ lcd.locate(0,8);
+ lcd.printf(Message);
+}
+
+void Menu_Matin(int etat)
+{
+ bool Sortir = false; // On sort du sous-menu
+ while (!Sortir) {
+ Afficher_Menu(etat);
+ switch (etat) {
+ case PETIT :
+ // évèments
+ if (left) {
+ etat = MATIN;
+ Sortir=true;
+ }
+ if (right) etat=DEJ;
+ if (center)Afficher_Message("Ok");
+ break;
+ case DEJ :
+ // évèments
+ break;
+ case DINER :
+
+ }
+ wait(0.125);
+
+ }
+}
+
+int main()
+{
+ while (1) {
+ Afficher_Menu(etat);
+ switch (etat) {
+ case MATIN :
+ // évèments
+ if (down) etat = MIDI;
+ if (right) Menu_Matin(PETIT);
+ break;
+ case MIDI :
+ break;
+ case SOIR :
+ break;
+ }
+
+
+ }
+
+}
--- a/mbed.bld Tue Oct 06 15:46:06 2015 +0000 +++ b/mbed.bld Sun Oct 10 14:26:20 2021 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/6213f644d804 \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/34e6b704fe68 \ No newline at end of file
