Keypad and sidebuttons are now initialized after the clock applet.

This commit is contained in:
Travis Goodspeed 2018-08-04 11:36:08 -04:00
parent 5b2b3d9f9b
commit 70181fb975
3 changed files with 19 additions and 21 deletions

View File

@ -67,8 +67,9 @@ void app_init(){
if(applet->init)
applet->init();
else if(!applet->name){
appindex=0; //Clock applet, not settime.
applet = &apps[appindex];
//Clock applet.
applet = &apps[appindex=0];
applet->init();
}
return;

View File

@ -189,7 +189,6 @@ void clock_draw(int forced){
void clock_init(){
lastchar=0;
lcd_zero();
redraw=5;
draw_time(1);
}
@ -267,8 +266,6 @@ int clock_keypress(char ch){
setperiod(5,1);
setperiod(2,1);
break;
}
return 1;
}

View File

@ -78,26 +78,20 @@ int main(void) {
lcd_string("RTC INIT");
rtc_init();
lcd_zero();
printf("key ");
lcd_string("KEY INIT");
key_init();
lcd_zero();
printf("but ");
lcd_string("BUT INIT");
sidebutton_init();
lcd_zero();
printf("osc ");
lcd_string("OSC INIT");
ucs_init();
//Recognize the CPU model.
descriptor_dump();
lcd_zero();
printf("buzz ");
lcd_string("BUZZINIT");
buzz_init();
/* Startup tones might kill the watch in low battery.
/* Startup tones kill the watch in low battery.
tone(NOTE_C7, 500);
tone(NOTE_E7, 500);
tone(NOTE_G7, 500);
@ -114,7 +108,6 @@ int main(void) {
lcd_string("CP INIT");
codeplug_init();
lcd_zero();
printf("rad ");
lcd_string("RAD INIT");
@ -125,12 +118,19 @@ int main(void) {
// Run the POST until it passes.
while(post());
//Finally we initialize the application.
lcd_zero();
lcd_string("APP INIT");
app_init();
//Keys and buttons are initialized *after* the application.
printf("key ");
key_init();
printf("but ");
sidebutton_init();
descriptor_dump();
// Setup and enable WDT 250ms, ACLK, interval timer
WDTCTL = WDT_ADLY_250;