Skip to content

Commit

Permalink
clock: clean up printTime()
Browse files Browse the repository at this point in the history
  • Loading branch information
lynxeye-dev committed Apr 12, 2011
1 parent 940bb8e commit aeff905
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
20 changes: 15 additions & 5 deletions clock/clock.c
Expand Up @@ -166,11 +166,21 @@ inline uint8_t getMode() {
return currentMode; return currentMode;
} }


void printTime(bitmap_t destination) { void printTime(bitmap_t destination, const enum CLOCK_THEME theme) {
//simpleBinary(destination, time.hours, time.minutes, time.seconds, currentMode); switch(theme) {
raisingBars(destination, time.hours, time.minutes, time.seconds, currentMode); case THEME_ANALOG:
//analogClock(destination, time.hours, time.minutes, time.seconds, currentMode); analogClock(destination, time.hours, time.minutes, time.seconds, currentMode);
//dices(destination, time.hours, time.minutes, time.seconds, currentMode); break;
case THEME_BARS:
raisingBars(destination, time.hours, time.minutes, time.seconds, currentMode);
break;
case THEME_BINARY:
simpleBinary(destination, time.hours, time.minutes, time.seconds, currentMode);
break;
case THEME_DICES:
dices(destination, time.hours, time.minutes, time.seconds, currentMode);
break;
}
} }


// Interupt service routine for clock overflow // Interupt service routine for clock overflow
Expand Down
12 changes: 11 additions & 1 deletion clock/clock.h
Expand Up @@ -29,6 +29,16 @@ enum CLOCK_MODE {
MODE_SECOND // modify seconds MODE_SECOND // modify seconds
}; };


/**
* enum CLOCK_THEME specifies the printTime() design
*/
enum CLOCK_THEME {
THEME_ANALOG,
THEME_DICES,
THEME_BARS,
THEME_BINARY
};

/** /**
* struct timeval_t holds all time related values * struct timeval_t holds all time related values
*/ */
Expand Down Expand Up @@ -70,6 +80,6 @@ uint8_t getMode();
/** /**
* Used to generate a bitmap based on the given time. * Used to generate a bitmap based on the given time.
*/ */
void printTime(bitmap_t destination); void printTime(bitmap_t destination, const enum CLOCK_THEME theme);


#endif // CLOCK_H_INCLUDED #endif // CLOCK_H_INCLUDED
3 changes: 2 additions & 1 deletion main.c
Expand Up @@ -34,7 +34,8 @@ int main(void)
while(1) { while(1) {
handleKeyInput(); handleKeyInput();


printTime(bitmap); // XXX: this should only be called if there is actually something new
printTime(bitmap, THEME_BARS);
scanout(bitmap); scanout(bitmap);
} }


Expand Down

0 comments on commit aeff905

Please sign in to comment.