Yoshiyuki Uehara / Mbed 2 deprecated Maple

Dependencies:   mbed

Revision:
1:aefa1992ce0f
Parent:
0:0be38b583cf7
Child:
3:eec13a411e94
--- a/Maple_alarm_clock.h	Sun Sep 25 11:37:21 2011 +0000
+++ b/Maple_alarm_clock.h	Mon Oct 10 11:45:51 2011 +0000
@@ -1,60 +1,94 @@
+//copyright 2011 Uehara Yoshiyuki
+//====================================================================
+//The author provide the programs without any guarantees or warranty.
+//The author is not responsible for any damage or losses of any kind 
+//caused by using or misusing of the programs.
+//The author is under no obligation to provide support, service, 
+//corrections, or upgrades to the programs.
+//====================================================================
 // MAPLE board[MARM01-BASE]
-// sample application - clock
-//
+// alarm clock
 #ifndef MAPLE_ALARM_CLOCK_H_
 #define MAPLE_ALARM_CLOCK_H_
 
 // constants
 #define ALARM_CLOCK_REFRESH_RATE    0.1 // 100ms
 
-#define DISPLAY_MODE_DATE_TIME          0
-#define DISPLAY_MODE_DATE_TIME_ADJUST   1
+#define MODE_NORMAL 0
+#define MODE_ADJUST 1
+#define MODE_ALARM  2
+#define MODE_TIMER  3
+
+#define CURSOR_NORMAL_TIMER_FLAG    0
+#define CURSOR_NORMAL_ALARM_FLAG    1
+#define CURSOR_NORMAL_MAX           1
 
-#define CURSOR_DATE_TIME_CENTURY    0
-#define CURSOR_DATE_TIME_YEAR       1
-#define CURSOR_DATE_TIME_MONTH      2
-#define CURSOR_DATE_TIME_DAY        3
-#define CURSOR_DATE_TIME_HOUR       4
-#define CURSOR_DATE_TIME_MINUTE     5
-#define CURSOR_DATE_TIME_SECOND     6
-
-#define BTN_A       0
-#define BTN_B       1
-#define BTN_LEFT    2
-#define BTN_DOWN    3
-#define BTN_RIGHT   4
-#define BTN_UP      5
+#define CURSOR_ADJUST_CENTURY   0
+#define CURSOR_ADJUST_YEAR      1
+#define CURSOR_ADJUST_MONTH     2
+#define CURSOR_ADJUST_DAY       3
+#define CURSOR_ADJUST_HOUR      4
+#define CURSOR_ADJUST_MINUTE    5
+#define CURSOR_ADJUST_SECOND    6
+#define CURSOR_ADJUST_MAX       6
 
-#define BTN_MASK_A      0x01
-#define BTN_MASK_B      0x02
-#define BTN_MASK_LEFT   0x04
-#define BTN_MASK_DOWN   0x08
-#define BTN_MASK_RIGHT  0x10
-#define BTN_MASK_UP     0x20
-
-#define BTN_ON      0
-#define BTN_OFF     1
+#define CURSOR_ALARM_DAY_DISABLE        0
+#define CURSOR_ALARM_DAY                1
+#define CURSOR_ALARM_WEEKDAY_DISABLE    2
+#define CURSOR_ALARM_WEEKDAY            3
+#define CURSOR_ALARM_INTERRUPT          4
+#define CURSOR_ALARM_FLAG               5
+#define CURSOR_ALARM_HOUR_DISABLE       6
+#define CURSOR_ALARM_HOUR               7
+#define CURSOR_ALARM_MINUTE_DISABLE     8
+#define CURSOR_ALARM_MINUTE             9
+#define CURSOR_ALARM_MAX                9
 
-#define BTN_THRESHOLD           0   // 0 x 100ms
-#define BTN_REPEAT              10  // 1s
-#define BTN_REPEAT_FAST         40  // 4s
-#define BTN_REPEAT_PERIOD       3   // 300ms
-#define BTN_REPEAT_PERIOD_FAST  1   // 100ms
+#define CURSOR_TIMER_SELECT     0
+#define CURSOR_TIMER_COUNT      1
+#define CURSOR_CLKOUT_ENABLE    2
+#define CURSOR_TIMER_PERIODIC   3
+#define CURSOR_TIMER_ENABLE     4
+#define CURSOR_TIMER_INTERRUPT  5
+#define CURSOR_TIMER_FLAG       6
+#define CURSOR_CLKOUT_FREQUENCY 7
+#define CURSOR_TIMER_MAX        7
 
-#define BTN_IDLE 0   // button status not active
-#define BTN_BUSY 1   // button status active once and repeat
-#define BTN_FAST 2   // button status repeat fast
+#define BUTTON_A       0
+#define BUTTON_B       1
+#define BUTTON_LEFT    2
+#define BUTTON_DOWN    3
+#define BUTTON_RIGHT   4
+#define BUTTON_UP      5
+
+#define BUTTON_ON      0
+#define BUTTON_OFF     1
+
+#define BUTTON_THRESHOLD        0   // 0 x 100ms
+#define BUTTON_REPEAT           10  // 1s
+#define BUTTON_FAST             40  // 4s
+#define BUTTON_PERIOD_REPEAT    3   // 300ms
+#define BUTTON_PERIOD_FAST      1   // 100ms
+
+#define BUTTON_IDLE 0   // button status not active
+#define BUTTON_BUSY 1   // button status active once and repeat
 
 // prototypes
 void alarm_clock_initialize();
 void alarm_clock_refresh();
 
-static void BTN_check(int count[], int status[]);
-static void BTN_A_action();
-static void BTN_B_action();
-static void BTN_LEFT_action();
-static void BTN_DOWN_action();
-static void BTN_RIGHT_action();
-static void BTN_UP_action();
+static void alarm_clock_refresh_display();
+static void button_check();
+static void button_on_check(int read_data, int button_numer);
+static bool button_trigger(int button_numer, int repeat_enable, int fast_repeat_enable);
+static void button_exit();
+static void button_function();
+static void button_cursor_move(int flag);
+static void button_xxcrement(int flag);
+static void button_xxcrement_normal(int flag);
+static void button_xxcrement_adjust(int flag);
+static void button_xxcrement_adjust_date(int flag);
+static void button_xxcrement_alarm(int flag);
+static void button_xxcrement_timer(int flag);
 
 #endif