不韋 呂 / 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:
Mon Nov 23 01:27:04 2015 +0000
Child:
1:83147f0d63ea
Commit message:
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.bld 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 Nov 23 01:27:04 2015 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/ST/code/BSP_DISCO_F746NG/#c9112f0c67e3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BUTTON_GROUP.lib	Mon Nov 23 01:27:04 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/MikamiUitOpen/code/BUTTON_GROUP/#682475aae171
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LCD_DISCO_F746NG.lib	Mon Nov 23 01:27:04 2015 +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 Nov 23 01:27:04 2015 +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 Nov 23 01:27:04 2015 +0000
@@ -0,0 +1,58 @@
+//---------------------------------------------------------------
+//  Demo program of Button class and ButtonGroup class
+//
+//  2015/11/23, Copyright (c) 2015 MIKAMI, Naoki
+//---------------------------------------------------------------
+
+#include "button_group.hpp"
+
+using namespace Mikami;
+
+TS_DISCO_F746NG ts_;
+LCD_DISCO_F746NG lcd_;
+
+int main()
+{
+    const int Y0 = 5;
+    const int X1 = 50;
+    const int Y1 = 200;
+
+    uint32_t backColor = 0xFF006A6C;            // teal green
+    uint32_t inActive = backColor & 0xE0FFFFFF; // color for inactive button
+    lcd_.Clear(backColor);
+       
+    const int NUMBER_BUTTONS = 4;
+    string str[NUMBER_BUTTONS] = {"Button1", "Button2", "Button3", "Button4"};
+    ButtonGroup bGroup(lcd_, ts_, 10, Y0, 66, 40,
+                       LCD_COLOR_BLUE, backColor, NUMBER_BUTTONS, str, 5, 5, 3);
+                       
+    Button reset(lcd_, ts_, 410, Y0, 60, 40,
+                 LCD_COLOR_BLUE, backColor, "Reset", Font12);
+    reset.Draw(inActive, LCD_COLOR_GRAY);
+
+    lcd_.SetTextColor(LCD_COLOR_WHITE);
+    while (true)
+    {
+        int num;
+        if (bGroup.GetTouchedNumber(num, LCD_COLOR_DARKBLUE))
+        {
+            char str[20];
+            lcd_.SetFont(&Font16);
+            lcd_.SetTextColor(LCD_COLOR_WHITE);
+            sprintf(str, "Button%d pressed", num+1);
+            lcd_.DisplayStringAt(X1, Y1, (uint8_t *)str, LEFT_MODE);
+            
+            reset.Redraw();
+        }
+        
+        if (reset.Touched())
+        {
+            bGroup.Redraw(num);
+            reset.Draw(inActive, LCD_COLOR_GRAY);
+            lcd_.SetFont(&Font16);
+            lcd_.DisplayStringAt(X1, Y1, (uint8_t *)"               ", LEFT_MODE);
+        }
+        wait(0.5f);
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Nov 23 01:27:04 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9296ab0bfc11
\ No newline at end of file