Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Maple_alarm_clock.cpp@2:299a1c9a5795, 2011-10-16 (annotated)
- Committer:
- uehara00
- Date:
- Sun Oct 16 01:27:35 2011 +0000
- Revision:
- 2:299a1c9a5795
- Parent:
- 1:aefa1992ce0f
- Child:
- 3:eec13a411e94
minor bug fix
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| uehara00 | 1:aefa1992ce0f | 1 | //copyright 2011 Uehara Yoshiyuki |
| uehara00 | 1:aefa1992ce0f | 2 | //==================================================================== |
| uehara00 | 1:aefa1992ce0f | 3 | //The author provide the programs without any guarantees or warranty. |
| uehara00 | 1:aefa1992ce0f | 4 | //The author is not responsible for any damage or losses of any kind |
| uehara00 | 1:aefa1992ce0f | 5 | //caused by using or misusing of the programs. |
| uehara00 | 1:aefa1992ce0f | 6 | //The author is under no obligation to provide support, service, |
| uehara00 | 1:aefa1992ce0f | 7 | //corrections, or upgrades to the programs. |
| uehara00 | 1:aefa1992ce0f | 8 | //==================================================================== |
| uehara00 | 0:0be38b583cf7 | 9 | // MAPLE board[MARM01-BASE] |
| uehara00 | 1:aefa1992ce0f | 10 | // alarm clock |
| uehara00 | 0:0be38b583cf7 | 11 | #include "Maple_alarm_clock.h" |
| uehara00 | 0:0be38b583cf7 | 12 | #include "Maple_RTC.h" |
| uehara00 | 0:0be38b583cf7 | 13 | #include "Maple_I2C.h" |
| uehara00 | 0:0be38b583cf7 | 14 | #include "Maple_LCD.h" |
| uehara00 | 0:0be38b583cf7 | 15 | #include "Maple.h" |
| uehara00 | 0:0be38b583cf7 | 16 | #include "mbed.h" |
| uehara00 | 0:0be38b583cf7 | 17 | |
| uehara00 | 0:0be38b583cf7 | 18 | // timer interrupt to refresh display |
| uehara00 | 0:0be38b583cf7 | 19 | Ticker alarm_clock_refresh_tick; |
| uehara00 | 0:0be38b583cf7 | 20 | |
| uehara00 | 0:0be38b583cf7 | 21 | // global variables |
| uehara00 | 1:aefa1992ce0f | 22 | int alarm_clock_mode; |
| uehara00 | 1:aefa1992ce0f | 23 | int alarm_clock_cursor; |
| uehara00 | 1:aefa1992ce0f | 24 | int button_count[6]; |
| uehara00 | 1:aefa1992ce0f | 25 | int button_status[6]; |
| uehara00 | 0:0be38b583cf7 | 26 | |
| uehara00 | 0:0be38b583cf7 | 27 | // alarm_clock_initialize |
| uehara00 | 0:0be38b583cf7 | 28 | void alarm_clock_initialize() { |
| uehara00 | 0:0be38b583cf7 | 29 | alarm_clock_refresh_tick.attach(&alarm_clock_refresh, ALARM_CLOCK_REFRESH_RATE); |
| uehara00 | 1:aefa1992ce0f | 30 | alarm_clock_mode = MODE_NORMAL; |
| uehara00 | 1:aefa1992ce0f | 31 | alarm_clock_cursor = CURSOR_NORMAL_ALARM_FLAG; |
| uehara00 | 1:aefa1992ce0f | 32 | for (int i = 0; i < 6; ++i) { |
| uehara00 | 1:aefa1992ce0f | 33 | button_count[i] = 0; |
| uehara00 | 1:aefa1992ce0f | 34 | button_status[i] = BUTTON_IDLE; |
| uehara00 | 1:aefa1992ce0f | 35 | } |
| uehara00 | 0:0be38b583cf7 | 36 | } |
| uehara00 | 0:0be38b583cf7 | 37 | |
| uehara00 | 0:0be38b583cf7 | 38 | // refresh display, called by a ticker |
| uehara00 | 0:0be38b583cf7 | 39 | void alarm_clock_refresh() { |
| uehara00 | 1:aefa1992ce0f | 40 | alarm_clock_refresh_display(); |
| uehara00 | 1:aefa1992ce0f | 41 | button_check(); |
| uehara00 | 0:0be38b583cf7 | 42 | } |
| uehara00 | 0:0be38b583cf7 | 43 | |
| uehara00 | 1:aefa1992ce0f | 44 | // read RTC and print to LCD |
| uehara00 | 1:aefa1992ce0f | 45 | static void alarm_clock_refresh_display() { |
| uehara00 | 1:aefa1992ce0f | 46 | const int cursor_row[4][10] = { |
| uehara00 | 1:aefa1992ce0f | 47 | { 1, 1, 16, 16, 16, 16, 16, 16, 16, 16}, // MODE_NORMAL |
| uehara00 | 1:aefa1992ce0f | 48 | { 0, 0, 0, 0, 1, 1, 1, 16, 16, 16}, // MODE_ADJUST |
| uehara00 | 1:aefa1992ce0f | 49 | { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1}, // MODE_ALARM |
| uehara00 | 1:aefa1992ce0f | 50 | { 0, 0, 0, 0, 0, 0, 0, 1, 16, 16}, // MODE_TIMER |
| uehara00 | 1:aefa1992ce0f | 51 | }; |
| uehara00 | 1:aefa1992ce0f | 52 | const int cursor_column[4][10] = { |
| uehara00 | 1:aefa1992ce0f | 53 | {12, 15, 16, 16, 16, 16, 16, 16, 16, 16}, // NODE_NORMAL |
| uehara00 | 1:aefa1992ce0f | 54 | { 1, 3, 6, 9, 1, 4, 7, 16, 16, 16}, // MODE_ADJUST |
| uehara00 | 1:aefa1992ce0f | 55 | { 4, 6, 8, 11, 14, 15, 0, 2, 4, 6}, // MODE_ALARM |
| uehara00 | 1:aefa1992ce0f | 56 | { 3, 8, 11, 12, 13, 14, 15, 6, 16, 16}, // MODE_TIMER |
| uehara00 | 1:aefa1992ce0f | 57 | }; |
| uehara00 | 1:aefa1992ce0f | 58 | const char frequency_select[4][6] = { "32768", " 1024", " 32", " 1" }; |
| uehara00 | 1:aefa1992ce0f | 59 | const char timer_select[4][5] = { "4096", " 64", " 1", "1/60" }; |
| uehara00 | 1:aefa1992ce0f | 60 | char row0[17], row1[17], d[17], s[4]; |
| uehara00 | 1:aefa1992ce0f | 61 | |
| uehara00 | 1:aefa1992ce0f | 62 | i2c_RTC_read(RTC_REG_CONTROL1, d, 16); |
| uehara00 | 0:0be38b583cf7 | 63 | |
| uehara00 | 1:aefa1992ce0f | 64 | switch(alarm_clock_mode) { |
| uehara00 | 1:aefa1992ce0f | 65 | case MODE_NORMAL: |
| uehara00 | 1:aefa1992ce0f | 66 | copy_string(row0, 0, 17, "XXXX.XX.XX XXX "); |
| uehara00 | 1:aefa1992ce0f | 67 | copy_string(row1, 0, 17, "XX:XX:XX XXXXXXX"); |
| uehara00 | 1:aefa1992ce0f | 68 | if((d[RTC_REG_SECOND] & RTC_VOLTAGE_LOW) == 0) { // when RTC registers are valid: |
| uehara00 | 1:aefa1992ce0f | 69 | copy_string(row0, 0, 2, "20"); |
| uehara00 | 1:aefa1992ce0f | 70 | if((d[RTC_REG_MONTH_CENTURY ] & RTC_CENTURY ) != 0) { row0[ 1] = '1'; } |
| uehara00 | 1:aefa1992ce0f | 71 | copy_string(row0, 2, 2, int_to_hex2(d[RTC_REG_YEAR ] , s)); |
| uehara00 | 1:aefa1992ce0f | 72 | copy_string(row0, 5, 2, int_to_hex2(d[RTC_REG_MONTH_CENTURY] & 0x1f, s)); |
| uehara00 | 1:aefa1992ce0f | 73 | copy_string(row0, 8, 2, int_to_hex2(d[RTC_REG_DAY ] & 0x3f, s)); |
| uehara00 | 1:aefa1992ce0f | 74 | copy_string(row0, 11, 3, weekday_to_string(d[RTC_REG_WEEKDAY] & 0x07, s)); |
| uehara00 | 1:aefa1992ce0f | 75 | copy_string(row1, 0, 2, int_to_hex2(d[RTC_REG_HOUR ] & 0x3f, s)); |
| uehara00 | 1:aefa1992ce0f | 76 | copy_string(row1, 3, 2, int_to_hex2(d[RTC_REG_MINUTE ] & 0x7f, s)); |
| uehara00 | 1:aefa1992ce0f | 77 | copy_string(row1, 6, 2, int_to_hex2(d[RTC_REG_SECOND ] & 0x7f, s)); |
| uehara00 | 2:299a1c9a5795 | 78 | copy_string(row1, 9, 7, "-------"); |
| uehara00 | 1:aefa1992ce0f | 79 | if((d[RTC_REG_CONTROL2 ] & RTC_TIMER_PERIODIC ) != 0) { row1[ 9] = 'p'; } |
| uehara00 | 1:aefa1992ce0f | 80 | if((d[RTC_REG_TIMER_CONTROL ] & RTC_TIMER_ENABLE ) != 0) { row1[10] = 't'; } |
| uehara00 | 1:aefa1992ce0f | 81 | if((d[RTC_REG_CONTROL2 ] & RTC_TIMER_INTERRUPT_ENABLE) != 0) { row1[11] = 'i'; } |
| uehara00 | 1:aefa1992ce0f | 82 | if((d[RTC_REG_CONTROL2 ] & RTC_TIMER_FLAG ) != 0) { row1[12] = 'T'; } |
| uehara00 | 1:aefa1992ce0f | 83 | if((d[RTC_REG_ALARM_MINUTE ] & RTC_ALARM_DISABLE ) == 0) { row1[13] = 'a'; } |
| uehara00 | 1:aefa1992ce0f | 84 | if((d[RTC_REG_ALARM_HOUR ] & RTC_ALARM_DISABLE ) == 0) { row1[13] = 'a'; } |
| uehara00 | 1:aefa1992ce0f | 85 | if((d[RTC_REG_ALARM_DAY ] & RTC_ALARM_DISABLE ) == 0) { row1[13] = 'a'; } |
| uehara00 | 1:aefa1992ce0f | 86 | if((d[RTC_REG_ALARM_WEEKDAY ] & RTC_ALARM_DISABLE ) == 0) { row1[13] = 'a'; } |
| uehara00 | 1:aefa1992ce0f | 87 | if((d[RTC_REG_CONTROL2 ] & RTC_ALARM_INTERRUPT_ENABLE) != 0) { row1[14] = 'i'; } |
| uehara00 | 1:aefa1992ce0f | 88 | if((d[RTC_REG_CONTROL2 ] & RTC_ALARM_FLAG ) != 0) { row1[15] = 'A'; } |
| uehara00 | 1:aefa1992ce0f | 89 | } |
| uehara00 | 1:aefa1992ce0f | 90 | break; |
| uehara00 | 1:aefa1992ce0f | 91 | |
| uehara00 | 1:aefa1992ce0f | 92 | case MODE_ADJUST: |
| uehara00 | 1:aefa1992ce0f | 93 | copy_string(row0, 0, 17, "XXXX.XX.XX XXX "); |
| uehara00 | 1:aefa1992ce0f | 94 | copy_string(row1, 0, 17, "XX:XX:XX adjust"); |
| uehara00 | 1:aefa1992ce0f | 95 | if((d[RTC_REG_SECOND] & RTC_VOLTAGE_LOW) == 0) { // when RTC registers are valid: |
| uehara00 | 1:aefa1992ce0f | 96 | copy_string(row0, 0, 2, "20"); |
| uehara00 | 1:aefa1992ce0f | 97 | if((d[RTC_REG_MONTH_CENTURY ] & RTC_CENTURY ) != 0) { row0[ 1] = '1'; } |
| uehara00 | 1:aefa1992ce0f | 98 | copy_string(row0, 2, 2, int_to_hex2(d[RTC_REG_YEAR ] , s)); |
| uehara00 | 1:aefa1992ce0f | 99 | copy_string(row0, 5, 2, int_to_hex2(d[RTC_REG_MONTH_CENTURY] & 0x1f, s)); |
| uehara00 | 1:aefa1992ce0f | 100 | copy_string(row0, 8, 2, int_to_hex2(d[RTC_REG_DAY ] & 0x3f, s)); |
| uehara00 | 1:aefa1992ce0f | 101 | copy_string(row0, 11, 3, weekday_to_string(d[RTC_REG_WEEKDAY] & 0x07, s)); |
| uehara00 | 1:aefa1992ce0f | 102 | copy_string(row1, 0, 2, int_to_hex2(d[RTC_REG_HOUR ] & 0x3f, s)); |
| uehara00 | 1:aefa1992ce0f | 103 | copy_string(row1, 3, 2, int_to_hex2(d[RTC_REG_MINUTE ] & 0x7f, s)); |
| uehara00 | 1:aefa1992ce0f | 104 | copy_string(row1, 6, 2, int_to_hex2(d[RTC_REG_SECOND ] & 0x7f, s)); |
| uehara00 | 1:aefa1992ce0f | 105 | } |
| uehara00 | 1:aefa1992ce0f | 106 | break; |
| uehara00 | 0:0be38b583cf7 | 107 | |
| uehara00 | 1:aefa1992ce0f | 108 | case MODE_ALARM: |
| uehara00 | 1:aefa1992ce0f | 109 | copy_string(row0, 0, 17, "day:XXX XXXX XXX"); |
| uehara00 | 1:aefa1992ce0f | 110 | copy_string(row1, 0, 17, "XXX:XXX alarm"); |
| uehara00 | 1:aefa1992ce0f | 111 | if((d[RTC_REG_SECOND] & RTC_VOLTAGE_LOW) == 0) { // when RTC registers are valid: |
| uehara00 | 1:aefa1992ce0f | 112 | row0[ 4] = '-'; |
| uehara00 | 1:aefa1992ce0f | 113 | row0[ 8] = '-'; |
| uehara00 | 1:aefa1992ce0f | 114 | copy_string(row0, 13, 3, "---"); |
| uehara00 | 1:aefa1992ce0f | 115 | row1[ 0] = '-'; |
| uehara00 | 1:aefa1992ce0f | 116 | row1[ 4] = '-'; |
| uehara00 | 1:aefa1992ce0f | 117 | copy_string(row0, 5, 2, int_to_hex2(d[RTC_REG_ALARM_DAY ] & 0x3f, s)); |
| uehara00 | 1:aefa1992ce0f | 118 | copy_string(row0, 9, 3, weekday_to_string(d[RTC_REG_ALARM_WEEKDAY] & 0x07, s)); |
| uehara00 | 1:aefa1992ce0f | 119 | copy_string(row1, 1, 2, int_to_hex2(d[RTC_REG_ALARM_HOUR ] & 0x3f, s)); |
| uehara00 | 1:aefa1992ce0f | 120 | copy_string(row1, 5, 2, int_to_hex2(d[RTC_REG_ALARM_MINUTE ] & 0x7f, s)); |
| uehara00 | 1:aefa1992ce0f | 121 | if((d[RTC_REG_ALARM_DAY ] & RTC_ALARM_DISABLE ) == 0) { row0[13] = 'a'; row0[ 4] = '*'; } |
| uehara00 | 1:aefa1992ce0f | 122 | if((d[RTC_REG_ALARM_WEEKDAY] & RTC_ALARM_DISABLE ) == 0) { row0[13] = 'a'; row0[ 8] = '*'; } |
| uehara00 | 1:aefa1992ce0f | 123 | if((d[RTC_REG_ALARM_HOUR ] & RTC_ALARM_DISABLE ) == 0) { row0[13] = 'a'; row1[ 0] = '*'; } |
| uehara00 | 1:aefa1992ce0f | 124 | if((d[RTC_REG_ALARM_MINUTE ] & RTC_ALARM_DISABLE ) == 0) { row0[13] = 'a'; row1[ 4] = '*'; } |
| uehara00 | 1:aefa1992ce0f | 125 | if((d[RTC_REG_CONTROL2 ] & RTC_ALARM_INTERRUPT_ENABLE) != 0) { row0[14] = 'i'; } |
| uehara00 | 1:aefa1992ce0f | 126 | if((d[RTC_REG_CONTROL2 ] & RTC_ALARM_FLAG ) != 0) { row0[15] = 'A'; } |
| uehara00 | 1:aefa1992ce0f | 127 | } |
| uehara00 | 1:aefa1992ce0f | 128 | break; |
| uehara00 | 0:0be38b583cf7 | 129 | |
| uehara00 | 1:aefa1992ce0f | 130 | case MODE_TIMER: |
| uehara00 | 1:aefa1992ce0f | 131 | copy_string(row0, 0, 17, "XXXXHz XX XXXXX"); |
| uehara00 | 1:aefa1992ce0f | 132 | copy_string(row1, 0, 17, "f=XXXXXHz timer"); |
| uehara00 | 1:aefa1992ce0f | 133 | if((d[RTC_REG_SECOND] & RTC_VOLTAGE_LOW) == 0) { // when RTC registers are valid: |
| uehara00 | 1:aefa1992ce0f | 134 | copy_string(row0, 0, 4, timer_select[d[RTC_REG_TIMER_CONTROL] & 0x03]); |
| uehara00 | 1:aefa1992ce0f | 135 | copy_string(row0, 7, 2, int_to_hex2(d[RTC_REG_TIMER], s)); |
| uehara00 | 1:aefa1992ce0f | 136 | copy_string(row1, 2, 5, frequency_select[d[RTC_REG_CLKOUT_FREQUENCY] & 0x03]); |
| uehara00 | 1:aefa1992ce0f | 137 | copy_string(row0, 11, 5, "-----"); |
| uehara00 | 1:aefa1992ce0f | 138 | if((d[RTC_REG_CLKOUT_FREQUENCY] & RTC_CLKOUT_ENABLE ) != 0) { row0[11] = 'f'; } |
| uehara00 | 1:aefa1992ce0f | 139 | if((d[RTC_REG_CONTROL2 ] & RTC_TIMER_PERIODIC ) != 0) { row0[12] = 'p'; } |
| uehara00 | 1:aefa1992ce0f | 140 | if((d[RTC_REG_TIMER_CONTROL ] & RTC_TIMER_ENABLE ) != 0) { row0[13] = 't'; } |
| uehara00 | 1:aefa1992ce0f | 141 | if((d[RTC_REG_CONTROL2 ] & RTC_TIMER_INTERRUPT_ENABLE) != 0) { row0[14] = 'i'; } |
| uehara00 | 1:aefa1992ce0f | 142 | if((d[RTC_REG_CONTROL2 ] & RTC_TIMER_FLAG ) != 0) { row0[15] = 'T'; } |
| uehara00 | 1:aefa1992ce0f | 143 | } |
| uehara00 | 1:aefa1992ce0f | 144 | break; |
| uehara00 | 1:aefa1992ce0f | 145 | } |
| uehara00 | 0:0be38b583cf7 | 146 | |
| uehara00 | 1:aefa1992ce0f | 147 | LCD_cursor(LCD_CURSOR_OFF); |
| uehara00 | 1:aefa1992ce0f | 148 | LCD_locate(0, 0); |
| uehara00 | 1:aefa1992ce0f | 149 | LCD_print_string(row0); |
| uehara00 | 1:aefa1992ce0f | 150 | LCD_locate(1, 0); |
| uehara00 | 1:aefa1992ce0f | 151 | LCD_print_string(row1); |
| uehara00 | 1:aefa1992ce0f | 152 | LCD_locate(cursor_row[alarm_clock_mode][alarm_clock_cursor], cursor_column[alarm_clock_mode][alarm_clock_cursor]); |
| uehara00 | 1:aefa1992ce0f | 153 | LCD_cursor(LCD_CURSOR_ON); |
| uehara00 | 1:aefa1992ce0f | 154 | } |
| uehara00 | 1:aefa1992ce0f | 155 | |
| uehara00 | 1:aefa1992ce0f | 156 | // read button and update button_on_count[i] |
| uehara00 | 1:aefa1992ce0f | 157 | // called by timer tick interrupt |
| uehara00 | 1:aefa1992ce0f | 158 | static void button_check() { |
| uehara00 | 1:aefa1992ce0f | 159 | char r = i2c_BTN_read(); |
| uehara00 | 1:aefa1992ce0f | 160 | button_on_check(r, BUTTON_A ); |
| uehara00 | 1:aefa1992ce0f | 161 | button_on_check(r, BUTTON_B ); |
| uehara00 | 1:aefa1992ce0f | 162 | button_on_check(r, BUTTON_LEFT ); |
| uehara00 | 1:aefa1992ce0f | 163 | button_on_check(r, BUTTON_DOWN ); |
| uehara00 | 1:aefa1992ce0f | 164 | button_on_check(r, BUTTON_RIGHT); |
| uehara00 | 1:aefa1992ce0f | 165 | button_on_check(r, BUTTON_UP ); |
| uehara00 | 1:aefa1992ce0f | 166 | if(button_trigger(BUTTON_A, 0, 0)) { button_exit(); } |
| uehara00 | 1:aefa1992ce0f | 167 | if(button_trigger(BUTTON_B, 0, 0)) { button_function(); } |
| uehara00 | 1:aefa1992ce0f | 168 | if(button_trigger(BUTTON_LEFT, 1, 0)) { button_cursor_move(0); } |
| uehara00 | 1:aefa1992ce0f | 169 | if(button_trigger(BUTTON_RIGHT, 1, 0)) { button_cursor_move(1); } |
| uehara00 | 1:aefa1992ce0f | 170 | if(button_trigger(BUTTON_DOWN, 1, 1)) { button_xxcrement(0); } |
| uehara00 | 1:aefa1992ce0f | 171 | if(button_trigger(BUTTON_UP, 1, 1)) { button_xxcrement(1); } |
| uehara00 | 1:aefa1992ce0f | 172 | } |
| uehara00 | 1:aefa1992ce0f | 173 | |
| uehara00 | 1:aefa1992ce0f | 174 | // button on check |
| uehara00 | 1:aefa1992ce0f | 175 | static void button_on_check(int read_data, int button_number) { |
| uehara00 | 1:aefa1992ce0f | 176 | if((read_data & (0x01 << button_number)) == BUTTON_ON) { |
| uehara00 | 1:aefa1992ce0f | 177 | ++button_count[button_number]; |
| uehara00 | 0:0be38b583cf7 | 178 | } |
| uehara00 | 1:aefa1992ce0f | 179 | else { |
| uehara00 | 1:aefa1992ce0f | 180 | button_count[button_number] = 0; |
| uehara00 | 1:aefa1992ce0f | 181 | button_status[button_number] = BUTTON_IDLE; |
| uehara00 | 0:0be38b583cf7 | 182 | } |
| uehara00 | 0:0be38b583cf7 | 183 | } |
| uehara00 | 0:0be38b583cf7 | 184 | |
| uehara00 | 1:aefa1992ce0f | 185 | // button action trigger check |
| uehara00 | 1:aefa1992ce0f | 186 | // b: button number |
| uehara00 | 1:aefa1992ce0f | 187 | // r: repeat enable |
| uehara00 | 1:aefa1992ce0f | 188 | // f: fast-repeat enable |
| uehara00 | 1:aefa1992ce0f | 189 | static bool button_trigger(int b, int r, int f) { |
| uehara00 | 1:aefa1992ce0f | 190 | if((button_status[b] == BUTTON_IDLE) && (button_count[b] > BUTTON_THRESHOLD)) { |
| uehara00 | 1:aefa1992ce0f | 191 | button_status[b] = BUTTON_BUSY; |
| uehara00 | 1:aefa1992ce0f | 192 | return true; // one shot |
| uehara00 | 1:aefa1992ce0f | 193 | } |
| uehara00 | 1:aefa1992ce0f | 194 | else if((f != 0) && (button_count[b] > BUTTON_FAST) && (button_count[b] % BUTTON_PERIOD_FAST == 0)) { |
| uehara00 | 1:aefa1992ce0f | 195 | return true; // repeat fast |
| uehara00 | 1:aefa1992ce0f | 196 | } |
| uehara00 | 1:aefa1992ce0f | 197 | else if((r != 0) && (button_count[b] > BUTTON_REPEAT) && (button_count[b] % BUTTON_PERIOD_REPEAT == 0)) { |
| uehara00 | 1:aefa1992ce0f | 198 | return true; // repeat |
| uehara00 | 1:aefa1992ce0f | 199 | } |
| uehara00 | 1:aefa1992ce0f | 200 | else { |
| uehara00 | 1:aefa1992ce0f | 201 | return false; |
| uehara00 | 0:0be38b583cf7 | 202 | } |
| uehara00 | 0:0be38b583cf7 | 203 | } |
| uehara00 | 0:0be38b583cf7 | 204 | |
| uehara00 | 1:aefa1992ce0f | 205 | // exit to normal mode |
| uehara00 | 1:aefa1992ce0f | 206 | static void button_exit() { |
| uehara00 | 1:aefa1992ce0f | 207 | alarm_clock_mode = MODE_NORMAL; |
| uehara00 | 1:aefa1992ce0f | 208 | alarm_clock_cursor = CURSOR_NORMAL_ALARM_FLAG; |
| uehara00 | 0:0be38b583cf7 | 209 | } |
| uehara00 | 0:0be38b583cf7 | 210 | |
| uehara00 | 1:aefa1992ce0f | 211 | // select a function |
| uehara00 | 1:aefa1992ce0f | 212 | static void button_function() { |
| uehara00 | 1:aefa1992ce0f | 213 | switch(alarm_clock_mode) { |
| uehara00 | 1:aefa1992ce0f | 214 | case MODE_NORMAL: |
| uehara00 | 1:aefa1992ce0f | 215 | alarm_clock_mode = MODE_ADJUST; |
| uehara00 | 1:aefa1992ce0f | 216 | alarm_clock_cursor = CURSOR_ADJUST_SECOND; |
| uehara00 | 1:aefa1992ce0f | 217 | break; |
| uehara00 | 1:aefa1992ce0f | 218 | case MODE_ADJUST: |
| uehara00 | 1:aefa1992ce0f | 219 | alarm_clock_mode = MODE_ALARM; |
| uehara00 | 1:aefa1992ce0f | 220 | alarm_clock_cursor = CURSOR_ALARM_FLAG; |
| uehara00 | 1:aefa1992ce0f | 221 | break; |
| uehara00 | 1:aefa1992ce0f | 222 | case MODE_ALARM: |
| uehara00 | 1:aefa1992ce0f | 223 | alarm_clock_mode = MODE_TIMER; |
| uehara00 | 1:aefa1992ce0f | 224 | alarm_clock_cursor = CURSOR_TIMER_FLAG; |
| uehara00 | 1:aefa1992ce0f | 225 | break; |
| uehara00 | 1:aefa1992ce0f | 226 | case MODE_TIMER: |
| uehara00 | 1:aefa1992ce0f | 227 | alarm_clock_mode = MODE_NORMAL; |
| uehara00 | 1:aefa1992ce0f | 228 | alarm_clock_cursor = CURSOR_NORMAL_ALARM_FLAG; |
| uehara00 | 1:aefa1992ce0f | 229 | break; |
| uehara00 | 0:0be38b583cf7 | 230 | } |
| uehara00 | 0:0be38b583cf7 | 231 | } |
| uehara00 | 0:0be38b583cf7 | 232 | |
| uehara00 | 1:aefa1992ce0f | 233 | // move cursor |
| uehara00 | 1:aefa1992ce0f | 234 | // flag 0:left, 1:right |
| uehara00 | 1:aefa1992ce0f | 235 | static void button_cursor_move(int flag) { |
| uehara00 | 1:aefa1992ce0f | 236 | const int max[4] = { CURSOR_NORMAL_MAX, CURSOR_ADJUST_MAX, CURSOR_ALARM_MAX, CURSOR_TIMER_MAX }; |
| uehara00 | 0:0be38b583cf7 | 237 | |
| uehara00 | 1:aefa1992ce0f | 238 | switch(flag) { |
| uehara00 | 1:aefa1992ce0f | 239 | case 0: // move left .. decrement |
| uehara00 | 1:aefa1992ce0f | 240 | if(alarm_clock_cursor > 0) { |
| uehara00 | 1:aefa1992ce0f | 241 | --alarm_clock_cursor; |
| uehara00 | 1:aefa1992ce0f | 242 | } |
| uehara00 | 1:aefa1992ce0f | 243 | else { |
| uehara00 | 1:aefa1992ce0f | 244 | alarm_clock_cursor = max[alarm_clock_mode]; |
| uehara00 | 1:aefa1992ce0f | 245 | } |
| uehara00 | 1:aefa1992ce0f | 246 | break; |
| uehara00 | 1:aefa1992ce0f | 247 | case 1: // move right .. increment |
| uehara00 | 1:aefa1992ce0f | 248 | ++alarm_clock_cursor; |
| uehara00 | 1:aefa1992ce0f | 249 | if(alarm_clock_cursor > max[alarm_clock_mode]) { |
| uehara00 | 1:aefa1992ce0f | 250 | alarm_clock_cursor = 0; |
| uehara00 | 1:aefa1992ce0f | 251 | } |
| uehara00 | 1:aefa1992ce0f | 252 | break; |
| uehara00 | 1:aefa1992ce0f | 253 | } |
| uehara00 | 1:aefa1992ce0f | 254 | } |
| uehara00 | 0:0be38b583cf7 | 255 | |
| uehara00 | 1:aefa1992ce0f | 256 | // increment/decrement |
| uehara00 | 1:aefa1992ce0f | 257 | // flag 0:decrement, 1:increment |
| uehara00 | 1:aefa1992ce0f | 258 | static void button_xxcrement(int flag) { |
| uehara00 | 1:aefa1992ce0f | 259 | switch(alarm_clock_mode) { |
| uehara00 | 1:aefa1992ce0f | 260 | case MODE_NORMAL: |
| uehara00 | 1:aefa1992ce0f | 261 | button_xxcrement_normal(flag); |
| uehara00 | 1:aefa1992ce0f | 262 | break; |
| uehara00 | 1:aefa1992ce0f | 263 | case MODE_ADJUST: |
| uehara00 | 1:aefa1992ce0f | 264 | button_xxcrement_adjust(flag); |
| uehara00 | 1:aefa1992ce0f | 265 | break; |
| uehara00 | 1:aefa1992ce0f | 266 | case MODE_ALARM: |
| uehara00 | 1:aefa1992ce0f | 267 | button_xxcrement_alarm(flag); |
| uehara00 | 1:aefa1992ce0f | 268 | break; |
| uehara00 | 1:aefa1992ce0f | 269 | case MODE_TIMER: |
| uehara00 | 1:aefa1992ce0f | 270 | button_xxcrement_timer(flag); |
| uehara00 | 1:aefa1992ce0f | 271 | break; |
| uehara00 | 1:aefa1992ce0f | 272 | } |
| uehara00 | 1:aefa1992ce0f | 273 | } |
| uehara00 | 0:0be38b583cf7 | 274 | |
| uehara00 | 1:aefa1992ce0f | 275 | // increment/decrement for NORMAL |
| uehara00 | 1:aefa1992ce0f | 276 | // flag 0:decrement, 1:increment |
| uehara00 | 1:aefa1992ce0f | 277 | static void button_xxcrement_normal(int flag) { |
| uehara00 | 1:aefa1992ce0f | 278 | char d; |
| uehara00 | 0:0be38b583cf7 | 279 | |
| uehara00 | 1:aefa1992ce0f | 280 | d = RTC_read1(RTC_REG_CONTROL2); |
| uehara00 | 1:aefa1992ce0f | 281 | switch(alarm_clock_cursor) { |
| uehara00 | 1:aefa1992ce0f | 282 | case CURSOR_NORMAL_TIMER_FLAG: |
| uehara00 | 1:aefa1992ce0f | 283 | d = d & 0x1b | (flag == 0 ? 0x00 : 0x04); |
| uehara00 | 1:aefa1992ce0f | 284 | break; |
| uehara00 | 1:aefa1992ce0f | 285 | case CURSOR_NORMAL_ALARM_FLAG: |
| uehara00 | 1:aefa1992ce0f | 286 | d = d & 0x17 | (flag == 0 ? 0x00 : 0x08); |
| uehara00 | 1:aefa1992ce0f | 287 | break; |
| uehara00 | 1:aefa1992ce0f | 288 | } |
| uehara00 | 1:aefa1992ce0f | 289 | RTC_write1(RTC_REG_CONTROL2, d); |
| uehara00 | 1:aefa1992ce0f | 290 | } |
| uehara00 | 1:aefa1992ce0f | 291 | |
| uehara00 | 1:aefa1992ce0f | 292 | // increment/decrement for ADJUST |
| uehara00 | 1:aefa1992ce0f | 293 | // flag 0:decrement, 1:increment |
| uehara00 | 1:aefa1992ce0f | 294 | static void button_xxcrement_adjust(int flag) { |
| uehara00 | 1:aefa1992ce0f | 295 | char d; |
| uehara00 | 0:0be38b583cf7 | 296 | |
| uehara00 | 1:aefa1992ce0f | 297 | switch(alarm_clock_cursor) { |
| uehara00 | 1:aefa1992ce0f | 298 | case CURSOR_ADJUST_HOUR: |
| uehara00 | 1:aefa1992ce0f | 299 | d = RTC_stop_read1(RTC_REG_HOUR) & 0x3F; |
| uehara00 | 1:aefa1992ce0f | 300 | d = xxcrement_bcd(flag, d, 0x00, 0x23); |
| uehara00 | 1:aefa1992ce0f | 301 | RTC_write1_start(RTC_REG_HOUR, d); |
| uehara00 | 1:aefa1992ce0f | 302 | break; |
| uehara00 | 1:aefa1992ce0f | 303 | case CURSOR_ADJUST_MINUTE: |
| uehara00 | 1:aefa1992ce0f | 304 | d = RTC_stop_read1(RTC_REG_MINUTE) & 0x7F; |
| uehara00 | 1:aefa1992ce0f | 305 | d = xxcrement_bcd(flag, d, 0x00, 0x59); |
| uehara00 | 1:aefa1992ce0f | 306 | RTC_write1_start(RTC_REG_MINUTE, d); |
| uehara00 | 1:aefa1992ce0f | 307 | break; |
| uehara00 | 1:aefa1992ce0f | 308 | case CURSOR_ADJUST_SECOND: |
| uehara00 | 1:aefa1992ce0f | 309 | d = RTC_stop_read1(RTC_REG_SECOND) & 0x7f; |
| uehara00 | 1:aefa1992ce0f | 310 | d = (flag == 0 ? 0x30 : 0x00); |
| uehara00 | 1:aefa1992ce0f | 311 | RTC_write1_start(RTC_REG_SECOND, d); |
| uehara00 | 1:aefa1992ce0f | 312 | break; |
| uehara00 | 1:aefa1992ce0f | 313 | default: |
| uehara00 | 1:aefa1992ce0f | 314 | button_xxcrement_adjust_date(flag); |
| uehara00 | 0:0be38b583cf7 | 315 | } |
| uehara00 | 0:0be38b583cf7 | 316 | } |
| uehara00 | 0:0be38b583cf7 | 317 | |
| uehara00 | 1:aefa1992ce0f | 318 | // increment/decrement century, year, month, day |
| uehara00 | 1:aefa1992ce0f | 319 | // flag 0:decrement, 1:increment |
| uehara00 | 1:aefa1992ce0f | 320 | static void button_xxcrement_adjust_date(int flag) { |
| uehara00 | 1:aefa1992ce0f | 321 | char century, bcd_year, bcd_month, bcd_day, weekday, d; |
| uehara00 | 1:aefa1992ce0f | 322 | |
| uehara00 | 1:aefa1992ce0f | 323 | RTC_stop_read_date(century, bcd_year, bcd_month, bcd_day); |
| uehara00 | 1:aefa1992ce0f | 324 | switch(alarm_clock_cursor) { |
| uehara00 | 1:aefa1992ce0f | 325 | case CURSOR_ADJUST_CENTURY: |
| uehara00 | 1:aefa1992ce0f | 326 | century = xxcrement_bcd(flag, century, 0x00, 0x01); |
| uehara00 | 1:aefa1992ce0f | 327 | break; |
| uehara00 | 1:aefa1992ce0f | 328 | case CURSOR_ADJUST_YEAR: |
| uehara00 | 1:aefa1992ce0f | 329 | bcd_year = xxcrement_bcd(flag, bcd_year, 0x00, 0x99); |
| uehara00 | 1:aefa1992ce0f | 330 | break; |
| uehara00 | 1:aefa1992ce0f | 331 | case CURSOR_ADJUST_MONTH: |
| uehara00 | 1:aefa1992ce0f | 332 | bcd_month = xxcrement_bcd(flag, bcd_month, 0x01, 0x12); |
| uehara00 | 1:aefa1992ce0f | 333 | break; |
| uehara00 | 1:aefa1992ce0f | 334 | case CURSOR_ADJUST_DAY: |
| uehara00 | 1:aefa1992ce0f | 335 | bcd_day = xxcrement_bcd(flag, bcd_day, 0x01, bcd_days_in_month(century, bcd_year, bcd_month)); |
| uehara00 | 1:aefa1992ce0f | 336 | break; |
| uehara00 | 1:aefa1992ce0f | 337 | } |
| uehara00 | 1:aefa1992ce0f | 338 | d = bcd_days_in_month(century, bcd_year, bcd_month); |
| uehara00 | 1:aefa1992ce0f | 339 | if(bcd_day > d) { |
| uehara00 | 1:aefa1992ce0f | 340 | bcd_day = d; |
| uehara00 | 1:aefa1992ce0f | 341 | } |
| uehara00 | 1:aefa1992ce0f | 342 | weekday = bcd_date_to_weekday(century, bcd_year, bcd_month, bcd_day); |
| uehara00 | 1:aefa1992ce0f | 343 | RTC_write_date_start(century, bcd_year, bcd_month, bcd_day, weekday); |
| uehara00 | 1:aefa1992ce0f | 344 | } |
| uehara00 | 1:aefa1992ce0f | 345 | |
| uehara00 | 1:aefa1992ce0f | 346 | // increment/decrement for ALARM |
| uehara00 | 1:aefa1992ce0f | 347 | // flag 0:decrement, 1:increment |
| uehara00 | 1:aefa1992ce0f | 348 | static void button_xxcrement_alarm(int flag) { |
| uehara00 | 1:aefa1992ce0f | 349 | char d; |
| uehara00 | 1:aefa1992ce0f | 350 | |
| uehara00 | 1:aefa1992ce0f | 351 | switch(alarm_clock_cursor) { |
| uehara00 | 1:aefa1992ce0f | 352 | case CURSOR_ALARM_DAY_DISABLE: |
| uehara00 | 1:aefa1992ce0f | 353 | d = RTC_read1(RTC_REG_ALARM_DAY) & 0x3f | (flag == 0 ? 0x80 : 0x00); |
| uehara00 | 1:aefa1992ce0f | 354 | RTC_write1(RTC_REG_ALARM_DAY, d); |
| uehara00 | 1:aefa1992ce0f | 355 | break; |
| uehara00 | 1:aefa1992ce0f | 356 | case CURSOR_ALARM_DAY: |
| uehara00 | 1:aefa1992ce0f | 357 | d = RTC_read1(RTC_REG_ALARM_DAY); |
| uehara00 | 1:aefa1992ce0f | 358 | d = xxcrement_bcd(flag, d & 0x3f, 0x00, 0x31) | d & 0x80; |
| uehara00 | 1:aefa1992ce0f | 359 | RTC_write1(RTC_REG_ALARM_DAY, d); |
| uehara00 | 1:aefa1992ce0f | 360 | break; |
| uehara00 | 1:aefa1992ce0f | 361 | case CURSOR_ALARM_WEEKDAY_DISABLE: |
| uehara00 | 1:aefa1992ce0f | 362 | d = RTC_read1(RTC_REG_ALARM_WEEKDAY) & 0x07 | (flag == 0 ? 0x80 : 0x00); |
| uehara00 | 1:aefa1992ce0f | 363 | RTC_write1(RTC_REG_ALARM_WEEKDAY, d); |
| uehara00 | 1:aefa1992ce0f | 364 | break; |
| uehara00 | 1:aefa1992ce0f | 365 | case CURSOR_ALARM_WEEKDAY: |
| uehara00 | 1:aefa1992ce0f | 366 | d = RTC_read1(RTC_REG_ALARM_WEEKDAY); |
| uehara00 | 1:aefa1992ce0f | 367 | d = xxcrement_bcd(flag, d & 0x07, 0x00, 0x06) | d & 0x80; |
| uehara00 | 1:aefa1992ce0f | 368 | RTC_write1(RTC_REG_ALARM_WEEKDAY, d); |
| uehara00 | 1:aefa1992ce0f | 369 | break; |
| uehara00 | 1:aefa1992ce0f | 370 | case CURSOR_ALARM_INTERRUPT: |
| uehara00 | 1:aefa1992ce0f | 371 | d = RTC_read1(RTC_REG_CONTROL2) & 0x1d | (flag == 0 ? 0x00 : 0x02); |
| uehara00 | 1:aefa1992ce0f | 372 | RTC_write1(RTC_REG_CONTROL2, d); |
| uehara00 | 1:aefa1992ce0f | 373 | break; |
| uehara00 | 1:aefa1992ce0f | 374 | case CURSOR_ALARM_FLAG: |
| uehara00 | 1:aefa1992ce0f | 375 | d = RTC_read1(RTC_REG_CONTROL2) & 0x17 | (flag == 0 ? 0x00 : 0x08); |
| uehara00 | 1:aefa1992ce0f | 376 | RTC_write1(RTC_REG_CONTROL2, d); |
| uehara00 | 1:aefa1992ce0f | 377 | break; |
| uehara00 | 1:aefa1992ce0f | 378 | case CURSOR_ALARM_HOUR_DISABLE: |
| uehara00 | 1:aefa1992ce0f | 379 | d = RTC_read1(RTC_REG_ALARM_HOUR) & 0x3f | (flag == 0 ? 0x80 : 0x00); |
| uehara00 | 1:aefa1992ce0f | 380 | RTC_write1(RTC_REG_ALARM_HOUR, d); |
| uehara00 | 1:aefa1992ce0f | 381 | break; |
| uehara00 | 1:aefa1992ce0f | 382 | case CURSOR_ALARM_HOUR: |
| uehara00 | 1:aefa1992ce0f | 383 | d = RTC_read1(RTC_REG_ALARM_HOUR); |
| uehara00 | 1:aefa1992ce0f | 384 | d = xxcrement_bcd(flag, d & 0x3f, 0x00, 0x23) | d & 0x80; |
| uehara00 | 1:aefa1992ce0f | 385 | RTC_write1(RTC_REG_ALARM_HOUR, d); |
| uehara00 | 1:aefa1992ce0f | 386 | break; |
| uehara00 | 1:aefa1992ce0f | 387 | case CURSOR_ALARM_MINUTE_DISABLE: |
| uehara00 | 1:aefa1992ce0f | 388 | d = RTC_read1(RTC_REG_ALARM_MINUTE) & 0x7f | (flag == 0 ? 0x80 : 0x00); |
| uehara00 | 1:aefa1992ce0f | 389 | RTC_write1(RTC_REG_ALARM_MINUTE, d); |
| uehara00 | 1:aefa1992ce0f | 390 | break; |
| uehara00 | 1:aefa1992ce0f | 391 | case CURSOR_ALARM_MINUTE: |
| uehara00 | 1:aefa1992ce0f | 392 | d = RTC_read1(RTC_REG_ALARM_MINUTE); |
| uehara00 | 1:aefa1992ce0f | 393 | d = xxcrement_bcd(flag, d & 0x7f, 0x00, 0x59) | d & 0x80; |
| uehara00 | 1:aefa1992ce0f | 394 | RTC_write1(RTC_REG_ALARM_MINUTE, d); |
| uehara00 | 1:aefa1992ce0f | 395 | break; |
| uehara00 | 0:0be38b583cf7 | 396 | } |
| uehara00 | 0:0be38b583cf7 | 397 | } |
| uehara00 | 0:0be38b583cf7 | 398 | |
| uehara00 | 1:aefa1992ce0f | 399 | // increment/decrement for TIMER |
| uehara00 | 1:aefa1992ce0f | 400 | // flag 0:decrement, 1:increment |
| uehara00 | 1:aefa1992ce0f | 401 | static void button_xxcrement_timer(int flag) { |
| uehara00 | 1:aefa1992ce0f | 402 | char d; |
| uehara00 | 0:0be38b583cf7 | 403 | |
| uehara00 | 1:aefa1992ce0f | 404 | switch(alarm_clock_cursor) { |
| uehara00 | 1:aefa1992ce0f | 405 | case CURSOR_TIMER_SELECT: |
| uehara00 | 1:aefa1992ce0f | 406 | d = RTC_read1(RTC_REG_TIMER_CONTROL); |
| uehara00 | 1:aefa1992ce0f | 407 | d = xxcrement_bcd(flag, d & 0x03, 0x00, 0x03) | d & 0x80; |
| uehara00 | 1:aefa1992ce0f | 408 | RTC_write1(RTC_REG_TIMER_CONTROL, d); |
| uehara00 | 1:aefa1992ce0f | 409 | break; |
| uehara00 | 1:aefa1992ce0f | 410 | case CURSOR_TIMER_COUNT: |
| uehara00 | 1:aefa1992ce0f | 411 | d = RTC_read1(RTC_REG_TIMER); |
| uehara00 | 1:aefa1992ce0f | 412 | switch(flag) { |
| uehara00 | 1:aefa1992ce0f | 413 | case 0: --d; break; |
| uehara00 | 1:aefa1992ce0f | 414 | case 1: ++d; break; |
| uehara00 | 0:0be38b583cf7 | 415 | } |
| uehara00 | 1:aefa1992ce0f | 416 | RTC_write1(RTC_REG_TIMER, d); |
| uehara00 | 1:aefa1992ce0f | 417 | break; |
| uehara00 | 1:aefa1992ce0f | 418 | case CURSOR_CLKOUT_ENABLE: |
| uehara00 | 1:aefa1992ce0f | 419 | d = RTC_read1(RTC_REG_CLKOUT_FREQUENCY) & 0x03 | (flag == 0 ? 0x00 : 0x80); |
| uehara00 | 1:aefa1992ce0f | 420 | RTC_write1(RTC_REG_CLKOUT_FREQUENCY, d); |
| uehara00 | 1:aefa1992ce0f | 421 | break; |
| uehara00 | 1:aefa1992ce0f | 422 | case CURSOR_TIMER_PERIODIC: |
| uehara00 | 1:aefa1992ce0f | 423 | d = RTC_read1(RTC_REG_CONTROL2) & 0x0f | (flag == 0 ? 0x00 : 0x10); |
| uehara00 | 1:aefa1992ce0f | 424 | RTC_write1(RTC_REG_CONTROL2, d); |
| uehara00 | 1:aefa1992ce0f | 425 | break; |
| uehara00 | 1:aefa1992ce0f | 426 | case CURSOR_TIMER_ENABLE: |
| uehara00 | 1:aefa1992ce0f | 427 | d = RTC_read1(RTC_REG_TIMER_CONTROL) & 0x03 | (flag == 0 ? 0x00 : 0x80); |
| uehara00 | 1:aefa1992ce0f | 428 | RTC_write1(RTC_REG_TIMER_CONTROL, d); |
| uehara00 | 1:aefa1992ce0f | 429 | break; |
| uehara00 | 1:aefa1992ce0f | 430 | case CURSOR_TIMER_INTERRUPT: |
| uehara00 | 1:aefa1992ce0f | 431 | d = RTC_read1(RTC_REG_CONTROL2) & 0x1e | (flag == 0 ? 0x00 : 0x01); |
| uehara00 | 1:aefa1992ce0f | 432 | RTC_write1(RTC_REG_CONTROL2, d); |
| uehara00 | 1:aefa1992ce0f | 433 | break; |
| uehara00 | 1:aefa1992ce0f | 434 | case CURSOR_TIMER_FLAG: |
| uehara00 | 1:aefa1992ce0f | 435 | d = RTC_read1(RTC_REG_CONTROL2) & 0x1b | (flag == 0 ? 0x00 : 0x04); |
| uehara00 | 1:aefa1992ce0f | 436 | RTC_write1(RTC_REG_CONTROL2, d); |
| uehara00 | 1:aefa1992ce0f | 437 | break; |
| uehara00 | 1:aefa1992ce0f | 438 | case CURSOR_CLKOUT_FREQUENCY: |
| uehara00 | 1:aefa1992ce0f | 439 | d = RTC_read1(RTC_REG_CLKOUT_FREQUENCY); |
| uehara00 | 1:aefa1992ce0f | 440 | d = xxcrement_bcd(flag, d & 0x03, 0x00, 0x03) | d & 0x80; |
| uehara00 | 1:aefa1992ce0f | 441 | RTC_write1(RTC_REG_CLKOUT_FREQUENCY, d); |
| uehara00 | 1:aefa1992ce0f | 442 | break; |
| uehara00 | 0:0be38b583cf7 | 443 | } |
| uehara00 | 0:0be38b583cf7 | 444 | } |