Changeset ff4dbfd in avrstuff for aktousb/code/main.c
- Timestamp:
- Aug 30, 2010, 7:39:44 PM (14 years ago)
- Branches:
- main
- Children:
- aeff83b
- Parents:
- 49fd394
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
aktousb/code/main.c
r49fd394 rff4dbfd 45 45 else 46 46 modifier = MOD_NONE; 47 47 48 if (key != KEY_Reserved && reportIndex < 8) { 48 49 reportBuffer[reportIndex] = key; // set next available entry … … 64 65 else 65 66 modifier = MOD_NONE; 66 if (key != KEY_Reserved) { 67 68 if (key == KEY_capslock) { 69 if (reportIndex < 8) { 70 reportBuffer[reportIndex] = key; // set next available entry 71 reportIndex++; 72 pressingCaps = 1; 73 } 74 } else if (key != KEY_Reserved) { 67 75 for (i = 2; i < reportIndex; i++) { 68 76 if (reportBuffer[i] == key) { … … 91 99 uint8_t idleCounter = 0; 92 100 uint8_t updateNeeded = 0; 101 int capsDelay = 16; 93 102 94 103 wdt_enable(WDTO_2S); … … 97 106 98 107 //debug LED - output 99 DDRC |= (1<<PC5); 100 DDRC |= (1<<PC4); 108 DDRD |= (1<<PD6); 101 109 102 110 // Keyboard … … 117 125 if (char_waiting) { 118 126 key_code = ak_read_scancode(); 119 PORTC ^= (1<<PC4);120 PORTC ^= (1<<PC5);121 127 // if an update is needed, send the report 122 128 if ((key_code & 1) == 0) … … 128 134 } 129 135 136 130 137 // check timer if we need periodic reports 131 138 if (TIFR & (1 << TOV0)) { 132 139 TIFR = (1 << TOV0); // reset flag 140 141 // PORTD ^= (1<<PD6); // blink del : we are alive ! 142 if (pressingCaps) 143 PORTD |= 1<<PD6; 144 else 145 PORTD &= ~(1<<PD6); 146 147 if (pressingCaps) { 148 if (--capsDelay == 0) { 149 capsDelay = 16; 150 pressingCaps = 0; 151 152 int i; 153 for (i = 2; i < reportIndex; i++) { 154 if (reportBuffer[i] == KEY_capslock) { 155 for (; i < 7; i++) 156 reportBuffer[i] = reportBuffer[i+1]; 157 reportBuffer[7] = 0; 158 reportIndex--; 159 } 160 } 161 } 162 } 163 133 164 if (idleRate != 0) { // do we need periodic reports? 134 165 if(idleCounter > 4){ // yes, but not yet
Note:
See TracChangeset
for help on using the changeset viewer.