Changeset 87ab18e in avrstuff for kbd/xtk/code/main.c


Ignore:
Timestamp:
Jul 31, 2014, 11:00:37 PM (10 years ago)
Author:
Adrien Destugues <pulkomandy@…>
Branches:
main
Children:
0010058
Parents:
ea32107
Message:

Drop hacked "shift" handling from libps2.

  • It's up to clients to do that if they wish so (useful if you're converting

to ASCII, for example, but not for a regular keyboard adapter)

Improve callback system to handle release events.

  • The callback would only be called for pressed keys, not for releases, leading

to weird results. Things work much better now in XTK.

  • Also ignore the E0 byte for extended keys in XTK. This avoids apps going

crazy as the Turbo XT BIOS doesn't handle it right.

git-svn-id: svn://pulkomandy.tk/avrstuff@114 c6672c3c-f6b6-47f9-9001-1fd6b12fecbe

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kbd/xtk/code/main.c

    rea32107 r87ab18e  
    2424void callback()
    2525{
    26         uint8_t key_code = 0;
    27         key_code = read_char(); // TODO this function is blocking. Can it disturb main?
    28 
    29         key = pgm_read_byte(&(at2xt[key_code]));
    30         if(release)
    31                 key |= 0x80;
     26        // Ignore all keys above 0x80, and importantly ignore 0xE0 from extended keys.
     27        if (kbd_data < 0x80) {
     28                key = pgm_read_byte(&(at2xt[kbd_data]));
     29                if(release)
     30                        key |= 0x80;
     31        }
    3232}
    3333
     
    5252#endif
    5353
    54         static const int delay = 25;
     54        static const int delay = 12;
    5555
    5656        // XT init - configure pins directions
     
    5858        DDRXT &= ~(PCLK | PDAT); // both pins as inputs (floating)
    5959
    60         DDRB |= (1<<PB2); // LED
    61 
    6260        uint8_t k;
    6361        while(1) {
    64                 PORTB ^= (1<<PB2); // LED
    65 
    6662                while ((PINXT & (PDAT|PCLK)) != (PDAT|PCLK))
    6763                        ; // Wait for PC to be ready to receive data
Note: See TracChangeset for help on using the changeset viewer.