Changeset 87ab18e in avrstuff for libs/ps2_keyboard/ps2_keyboard.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
  • libs/ps2_keyboard/ps2_keyboard.c

    rea32107 r87ab18e  
    3030#endif
    3131
    32 static volatile uint8_t kbd_data;
    3332static volatile uint8_t char_waiting;
    3433static uint8_t started;
    3534static uint8_t bit_count;
    36 static uint8_t caps_lock;
    3735static uint8_t extended;
    3836
    39 uint8_t shift;
     37volatile uint8_t kbd_data;
    4038uint8_t release;
    4139
     
    7977    kbd_data = 0;
    8078    return;
    81   } else if (kbd_data == 0x12) { //hanlde shift key
    82     if(release == 0){
    83       shift = 1;
    84     } else {
    85       shift = 0;
    86       release = 0;
    87     }
    88     return;
    8979  } else { //not a special character
    90     if(release){ //we were in release mode - exit release mode
    91       release = 0;
    92       //ignore that character
    93     } else {
    94       char_waiting = 1;
    9580#ifdef CALLBACK
    9681          CALLBACK
    9782#endif
     83    if(release){ //we were in release mode - exit release mode
     84      release = 0;
     85    } else {
     86          // Notify callback that there's a new char waiting
     87      char_waiting = 1;
    9888    }
    9989  }
Note: See TracChangeset for help on using the changeset viewer.