Many changes: added commandhandler module, macro functions, toggle function and

speed settings. Removed key repetition (no idea why it was there).
This commit is contained in:
2009-02-14 21:11:43 +00:00
parent 68abf87a9c
commit ced5a39988
9 changed files with 263 additions and 19 deletions

View File

@ -41,6 +41,7 @@
uint8_t curmatrix[16]; ///< contains current state of the keyboard
uint8_t oldmatrix[16]; ///< contains old state of the keyboard
uint8_t ghostmatrix[16]; ///< contains pressed keys that belong to a ghost-key situation
uint8_t backlight = 0;
void hardwareInit(void) {
// column-port is input
@ -116,10 +117,22 @@ void printMatrix(void) {
sendString("---");
}
void toggle(void) {
// switch backlight on or off
if (backlight == 0) {
backlight = 1;
} else {
backlight = 0;
OCR1A = 0xffff;
OCR1B = 0xffff;
}
}
void setSpeed(uint8_t speed) {
uint16_t value = (speed + 1) * (speed + 1) - 1;
OCR1A = 0xffff - value;
OCR1B = value;
if (backlight == 1) {
OCR1A = 0xffff - ((256 - speed) * (256 - speed) - 1);
OCR1B = 0xffff - ((speed + 1) * (speed + 1) - 1);
}
}
void setLeds(uint8_t LEDstate) {