techpaul / PS2KeyAdvanced

Arduino PS2 Keyboard FULL keyboard protocol support and full keys to integer coding
GNU Lesser General Public License v2.1
140 stars 27 forks source link

Toggle typematic on/off entirely? #14

Closed inchoat3 closed 4 years ago

inchoat3 commented 4 years ago

Hi there, I'm new to using GitHub; hopefully I'm in the right spot.

I've been attempting to use your library as part of a MIDI controller, but the typematic repeat is problematic when it comes to controlling an instrument, so I set about trying to send a 0xF8 command to set it to make/break only. I'm just not sure how to get the keyboard to receive the command, as everywhere I've tried to edge the command in causes it to glitch out or does nothing.

I've added this at line 106 of PS2KeyCode.h:

define PS2_KC_MKBRK 0xF8

this at line 294 of PS2KeyAdvanced.h: void mkBrk( void );

and this at 967 of PS2KeyAdvanced.cpp: void PS2KeyAdvanced::mkBrk( ) { send_byte( PS2_KC_MKBRK ); // send command if ( ( send_byte( PS2_KEY_IGNORE ) ) ) // wait data PS2_KC_BAT or PS2_KC_ERROR send_next( ); // if idle start transmission }

When I try to pull that class either in setup or in the loop it still doesn't work. I also tried to inject a command into the resetKey command with no success.

If you take feature requests, I'd sure love to see it in there. You've done great work here; it's great for breathing new life in to old equipment.

Thanks for any info you might have.

techpaul commented 4 years ago

In the library folders there is a document PS2 Keyboard.pdf on page 4 there is anote at bottom of page

 The next six commands can be issued when the keyboard is in any
 mode, but it only effects the behavior of the keyboard when in
 "mode 3" (ie, set to scan code set 3.)

The library only works with Scan Code Set 2, the function you want if supported by the keyboard ONLY work in scan code set 3. It is rare for keyboards these days to work in scan code set 1 or 3.

Other alternative solutions

Set Typematic rate to

Delay 1 sec
repeat 2 cps

Values sent  0xF3, 0x7F

Realistically higher code should keep track of make/break status and handle how to denote changes to higher functions, so repeated SLOW rate of repeats are ignored, then clear current known key from list of keys in make state.

This is not a realistic feature to add at library level.

inchoat3 wrote:

Hi there, I'm new to using GitHub; hopefully I'm in the right spot.

I've been attempting to use your library as part of a MIDI controller, but the typematic repeat is problematic when it comes to controlling an instrument, so I set about trying to send a 0xF8 command to set it to make/break only. I'm just not sure how to get the keyboard to receive the command, as everywhere I've tried to edge the command in causes it to glitch out or does nothing.

I've added this at line 106 of PS2KeyCode.h:

define PS2_KC_MKBRK 0xF8

this at line 294 of PS2KeyAdvanced.h: void mkBrk( void );

and this at 967 of PS2KeyAdvanced.cpp: void PS2KeyAdvanced::mkBrk( ) { send_byte( PS2_KC_MKBRK ); // send command if ( ( send_byte( PS2_KEY_IGNORE ) ) ) // wait data PS2_KC_BAT or PS2_KC_ERROR send_next( ); // if idle start transmission }

When I try to pull that class either in setup or in the loop it still doesn't work. I also tried to inject a command into the resetKey command with no success.

If you take feature requests, I'd sure love to see it in there. You've done great work here; it's great for breathing new life in to old equipment.

Thanks for any info you might have.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/techpaul/PS2KeyAdvanced/issues/14, or unsubscribe https://github.com/notifications/unsubscribe-auth/AD7YO2H6Z4ZAAQIWFWAHA63SKF7J7ANCNFSM4SLVJCFQ.

-- Paul Carpenter | paul@pcserviceselectronics.co.uk http://www.pcserviceselectronics.co.uk/ PC Services http://www.pcserviceselectronics.co.uk/fonts/ Timing Diagram Font http://www.badweb.org.uk/ For those web sites you hate

inchoat3 commented 4 years ago

That makes a lot more sense, and clears up why another implementation I saw was running set 3. I appreciate your response and will be adjusting my approach.