Yoshiyuki Uehara / Mbed 2 deprecated Maple

Dependencies:   mbed

Maple_alarm_clock.h

Committer:
uehara00
Date:
2011-09-25
Revision:
0:0be38b583cf7
Child:
1:aefa1992ce0f

File content as of revision 0:0be38b583cf7:

// MAPLE board[MARM01-BASE]
// sample application - 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 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 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 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 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

// 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();

#endif