不韋 呂 / Mbed 2 deprecated F746_ButtonGroup_Demo

Dependencies:   BSP_DISCO_F746NG BUTTON_GROUP LCD_DISCO_F746NG TS_DISCO_F746NG mbed

Files at this revision

API Documentation at this revision

Comitter:
MikamiUitOpen
Date:
Wed Dec 09 01:55:57 2015 +0000
Parent:
3:edc98882d63a
Child:
5:ab0913c1557a
Commit message:
5

Changed in this revision

BUTTON_GROUP.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
--- a/BUTTON_GROUP.lib	Tue Dec 08 14:20:25 2015 +0000
+++ b/BUTTON_GROUP.lib	Wed Dec 09 01:55:57 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/MikamiUitOpen/code/BUTTON_GROUP/#2cc388e91bde
+http://mbed.org/users/MikamiUitOpen/code/BUTTON_GROUP/#d268555e2f50
--- a/main.cpp	Tue Dec 08 14:20:25 2015 +0000
+++ b/main.cpp	Wed Dec 09 01:55:57 2015 +0000
@@ -1,7 +1,7 @@
 //---------------------------------------------------------------
 //  Demo program of Button class and ButtonGroup class
 //
-//  2015/12/05, Copyright (c) 2015 MIKAMI, Naoki
+//  2015/12/09, Copyright (c) 2015 MIKAMI, Naoki
 //---------------------------------------------------------------
 
 #include "button_group.hpp"
@@ -13,10 +13,9 @@
 
 int main()
 {
-    printf("\r\n23:13");
     const int Y0 = 5;
-    const int X1 = 50;
-    const int Y1 = 200;
+    const int X1 = 30;
+    const int Y1 = 100;
 
     uint32_t backColor = 0xFF006A6C;            // teal green
     uint32_t inActive = backColor & 0xE0FFFFFF; // color for inactive button
@@ -27,7 +26,11 @@
     ButtonGroup bGroup(lcd_, ts_, 10, Y0, 66, 40,
                        LCD_COLOR_BLUE, backColor, NUMBER_BUTTONS, STR, 5, 5, 3);
                        
-    Button Large(lcd_, ts_, 200, 100, 120, 60,
+    const string STR_SW[2] = {"ON", "OFF"};
+    ButtonGroup sw(lcd_, ts_, 10, 160, 66, 40,
+                   LCD_COLOR_GREEN, backColor, 2, STR_SW, 5, 0, 2);
+                       
+    Button Large(lcd_, ts_, 280, 100, 120, 60,
                  LCD_COLOR_GREEN, backColor, "LARGE", Font24);
     
     Button reset(lcd_, ts_, 410, Y0, 60, 40,
@@ -49,6 +52,11 @@
             reset.Redraw();
         }
         
+        if (sw.Touched(0, LCD_COLOR_DARKGREEN))
+            lcd_.DisplayStringAt(X1, 210, (uint8_t *)"ON ", LEFT_MODE);
+        if (sw.Touched(1, LCD_COLOR_DARKGREEN))
+            lcd_.DisplayStringAt(X1, 210, (uint8_t *)"OFF", LEFT_MODE);
+        
         if (reset.Touched())
         {
             bGroup.Redraw(num);