main
Last change
on this file since c7cc629 was c7cc629, checked in by Adrien Destugues <pulkomandy@…>, 10 years ago |
Move the ASCII keymap out of ps2_keyboard.c.
It is used only by the serial converter, so save some flashspace for other projects.
git-svn-id: svn://pulkomandy.tk/avrstuff@112 c6672c3c-f6b6-47f9-9001-1fd6b12fecbe
|
-
Property mode
set to
100644
|
File size:
720 bytes
|
Line | |
---|
1 | #include <avr/io.h>
|
---|
2 |
|
---|
3 | #include "../../../libs/ps2_keyboard/ps2_keyboard.h"
|
---|
4 | #include "../../../libs/ps2_keyboard/keymap.h"
|
---|
5 | #include "../../../libs/usart/usart.h"
|
---|
6 |
|
---|
7 |
|
---|
8 | char render_scan_code(uint8_t data){
|
---|
9 | char to_ret = pgm_read_byte(&(keymap[data])); //grab character from array
|
---|
10 | if(shift) to_ret -= 0x20;
|
---|
11 | return to_ret;
|
---|
12 | }
|
---|
13 |
|
---|
14 |
|
---|
15 | int main() {
|
---|
16 |
|
---|
17 | USARTInit(8);
|
---|
18 | init_keyboard();
|
---|
19 |
|
---|
20 | USARTWriteChar('r');
|
---|
21 |
|
---|
22 | //debug LED - output
|
---|
23 | DDRD |= (1<<PD6);
|
---|
24 |
|
---|
25 | uint8_t key_code = 0;
|
---|
26 |
|
---|
27 | char str_buf[21];
|
---|
28 | uint8_t buf_pos = 0;
|
---|
29 |
|
---|
30 | str_buf[0] = str_buf[1] = 0x00;
|
---|
31 | USARTWriteChar('R');
|
---|
32 |
|
---|
33 | while(1) {
|
---|
34 | key_code = read_char();
|
---|
35 | USARTWriteChar(render_scan_code(key_code));
|
---|
36 | }
|
---|
37 |
|
---|
38 | return 0;
|
---|
39 | }
|
---|
40 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.