TCMIA B / Mbed OS Lezione_1

Dependencies:   TS_DISCO_F746NG LCD_DISCO_F746NG BSP_DISCO_F746NG BUTTON_GROUP

Files at this revision

API Documentation at this revision

Comitter:
gscuttari
Date:
Mon Jan 28 08:16:44 2019 +0000
Child:
1:f5a3a0a28be5
Commit message:
Lezione 1

Changed in this revision

BSP_DISCO_F746NG.lib Show annotated file Show diff for this revision Revisions of this file
BUTTON_GROUP.lib Show annotated file Show diff for this revision Revisions of this file
LCD_DISCO_F746NG.lib Show annotated file Show diff for this revision Revisions of this file
TS_DISCO_F746NG.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BSP_DISCO_F746NG.lib	Mon Jan 28 08:16:44 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/SQC-Systems-Mbed/code/BSP_DISCO_F746NG/#c21db1971fd0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BUTTON_GROUP.lib	Mon Jan 28 08:16:44 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/SQC-Systems-Mbed/code/BUTTON_GROUP/#742da8cc7e07
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LCD_DISCO_F746NG.lib	Mon Jan 28 08:16:44 2019 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/ST/code/LCD_DISCO_F746NG/#d44525b1de98
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TS_DISCO_F746NG.lib	Mon Jan 28 08:16:44 2019 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/ST/code/TS_DISCO_F746NG/#fe0cf5e2960f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Jan 28 08:16:44 2019 +0000
@@ -0,0 +1,128 @@
+
+//-----------------------------------------------------------------------
+//  LEZIONE 1
+//
+//
+//  28/01/2019, Copyright (c) 2019 SCUOLA PROFESSIONALE l. EINAUDI
+//  Beta
+//-----------------------------------------------------------------------
+
+#include "mbed.h"
+#include "button_group.hpp"
+#include "TS_DISCO_F746NG.h"
+#include "LCD_DISCO_F746NG.h"
+
+Serial pc(USBTX, USBRX);
+
+void init_lcd(void)
+{
+    lcd_.Clear(LCD_COLOR_WHITE);
+    printf("********** start INIT_LCD *********\n");
+    lcd_.SetBackColor(LCD_COLOR_WHITE);
+    lcd_.SetTextColor(LCD_COLOR_BLACK);
+    lcd_.DisplayStringAt(0, LINE(1), (uint8_t *)"LEZIONE 1", CENTER_MODE);
+
+    wait(1.5);
+
+    lcd_.Clear(LCD_COLOR_BLACK);
+    lcd_.SetBackColor(LCD_COLOR_BLACK);
+    lcd_.SetTextColor(LCD_COLOR_WHITE);
+    lcd_.SetFont(&Font16);
+    lcd_.DisplayStringAt(0, LINE(5), (uint8_t *)"TOUCHSCREEN INIT OK", CENTER_MODE);
+
+    wait(0.5);
+    lcd_.SetFont(&Font16);
+    screen_setup_menu(void)
+}
+
+
+void screen_setup_menu(void)
+{
+    using namespace Mikami;
+    lcd_.Clear(LCD_COLOR_DARKBLUE);
+    const string FIRST_CHOICE[9] = {"DISPLAY PARAMETERS","WiFi", "MACHINE NUMBER","BASE PRESSURE","SCREEN SUSPENSION","SETUP LITERS","WATER PRESSURE","SETUP ALARMS","RETURN"};
+    const string FIRST_CHOICE1[9] = {" ", " ", " "," "," "," "," "," "," "};
+    ButtonGroup menu_schadow(lcd_, ts_, 18, 17, 220, 40,
+                             LCD_COLOR_BLACK, LCD_COLOR_DARKBLUE, 9, FIRST_CHOICE1, 10, 10, 2, Font16);
+    ButtonGroup menu(lcd_, ts_, 16, 15, 220, 40,
+                     BACK_COLOR, LCD_COLOR_DARKBLUE, 9, FIRST_CHOICE, 10, 10, 2, Font16);
+
+
+
+    bool exitFromLoop = false;
+    while (!exitFromLoop) {
+        if (menu.Touched(8, LCD_COLOR_GREEN)) {
+            Thread::wait(200);
+            lcd_.Clear(BACK_COLOR);
+            mode = mode_prec;
+            //writeFlash();
+            
+            exitFromLoop=true;
+        } else if (menu.Touched(0, LCD_COLOR_GREEN)) {
+            screen_setup_display_parameters();
+            exitFromLoop=true;
+        } else if (menu.Touched(1, LCD_COLOR_GREEN)) {
+            screen_setup_wifi();
+            exitFromLoop=true;
+        } else if (menu.Touched(2, LCD_COLOR_GREEN)) {
+            screen_setup_Machine_Number();
+            exitFromLoop=true;
+        } else if (menu.Touched(3, LCD_COLOR_GREEN)) {
+            screen_setup_pressure();
+            exitFromLoop=true;
+        } else if (menu.Touched(4, LCD_COLOR_GREEN)) {
+            screen_setup_screen_suspended();
+            exitFromLoop=true;
+        } else if (menu.Touched(5, LCD_COLOR_GREEN)) {
+            screen_setup_liters();
+            exitFromLoop=true;
+        } else if (menu.Touched(6, LCD_COLOR_GREEN)) {
+            screen_setup_water_pressure();
+            exitFromLoop=true;
+        }
+        
+        
+        
+        Thread::wait(100);
+
+    }
+    return;
+}
+
+
+
+
+
+int main()
+{
+    pc.baud(115200);
+    printf("START...\n");
+    Thread::wait(2000);
+    init_lcd();   // inizializzazione lcd e touch screen
+    lcd_.SetFont(&Font16);
+    Thread::wait(2000);
+}
+
+
+void init_lcd(void)
+{
+    lcd_.Clear(LCD_COLOR_WHITE);
+    printf("********** start INIT_LCD *********\n");
+    lcd_.SetBackColor(LCD_COLOR_WHITE);
+    lcd_.SetTextColor(LCD_COLOR_BLACK);
+    lcd_.DisplayStringAt(0, LINE(1), (uint8_t *)"LEZIONE 1", CENTER_MODE);
+
+    wait(1.5);
+
+    lcd_.Clear(LCD_COLOR_BLACK);
+    lcd_.SetBackColor(LCD_COLOR_BLACK);
+    lcd_.SetTextColor(LCD_COLOR_WHITE);
+    lcd_.SetFont(&Font16);
+    lcd_.DisplayStringAt(0, LINE(5), (uint8_t *)"TOUCHSCREEN INIT OK", CENTER_MODE);
+
+    wait(0.5);
+    lcd_.SetFont(&Font16);
+    screen_setup_menu(void)
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os.lib	Mon Jan 28 08:16:44 2019 +0000
@@ -0,0 +1,1 @@
+https://github.com/armmbed/mbed-os/#0fdfcf7350896a9c0b57c4a18237677abfe25f1a