Hex Code for Keyboardkey "rmenu"?


hello.

i read https://forum.arduino.cc/index.php?topic=139358.0 in forum.
"amiga 500/1000/2000 keyboard interface"


i connect amiga 500 keyboard arduino leonardo.
all seems fine, on keyboard "right amiga key" dont work.
this key "rmenu" key normal windows keyboard.
can tell me right hex code key on keyboard?

here ist arduino code:
code: [select]

#include <keyboard.h>

#define bitmask_a500clk 0b00010000    // io 8
#define bitmask_a500sp  0b00100000    // io 9
#define bitmask_a500res 0b01000000    // io 10
#define synch_hi        0
#define synch_lo        1
#define handshake       2
#define read            3
#define wait_lo         4
#define wait_res        5
#define hid_sendreport(id,data,len) hid().sendreport(id,data,len) // ide 1.6.9

keyreport _keyreport;
uint32_t counter = 0;
uint8_t joy, memojoy1, memojoy2, state, bitn, key, fn,keydown, ktab[0x68]={
  // tilde, 1-9, 0, sz, accent, backslash, num 0 (00 - 0f)
  0x35, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x2d, 0x2e, 0x31,    0, 0x62,
  // q bis +, -, num 1, num 2, num3 (10 - 1f)
  0x14, 0x1a, 0x08, 0x15, 0x17, 0x1c, 0x18, 0x0c, 0x12, 0x13, 0x2f, 0x30, 0   , 0x59, 0x5a, 0x5b,
  // a-#, -, num 4, num 5, num 6 (20 - 2f)
  0x04, 0x16, 0x07, 0x09, 0x0a, 0x0b, 0x0d, 0x0e, 0x0f, 0x33, 0x34, 0x32, 0,    0x5c, 0x5d, 0x5e,
  // <>,y- -, -, num . , num 7, num 8, num 9 (30 - 3f)
  0x64, 0x1d, 0x1b, 0x06, 0x19, 0x05, 0x11, 0x10, 0x36, 0x37, 0x38,    0, 0x63, 0x5f, 0x60, 0x61,
  // space, bs, tab, enter, return, esc, del, -, -, -, num -, -, up, down, right, left (40 - 4f)
  0x2c, 0x2a, 0x2b, 0x58, 0x28, 0x29, 0x4c,    0,    0,    0, 0x56,    0, 0x52, 0x51, 0x4f, 0x50,
  // f1-f10, -, -, num /, num *, num +, - (50 - 5f)
  0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43,    0,    0, 0x54, 0x55, 0x57,    0,

 
  // modifiers: shift left, shift right, -, win left, ctrl left, ctrl right, alt left, alt right
0x02, //shift-links
0x20, //shift-rechts
0x00,
0x01, //links-ctrl
0x04, //rechts-alt
0x40, //links-amiga
0x08, //links-alt
0x10, //sollte die menü taste sein. geht aber nicht

    //0x02, 0x20, 0x00, 0x08, 0x01, 0x10, 0x04, 0x40

   
};

void setup() {
serial.begin(9600); 


  // keyboard (port b)
  ddrd = ~(bitmask_a500clk | bitmask_a500sp | bitmask_a500res);  // direction input
}


void loop() {
 
  // keyboard
    if (((pinb & bitmask_a500res)==0) && state!=wait_res) {   // reset
    interrupts();
    keystroke(0x4c,05);        // ctrl+alt+del
    fn=0;
    state=wait_res;
  }
 
  else if (state==wait_res) {   // waiting reset end
    if ((pinb & bitmask_a500res)!=0) state=synch_hi;
  }
 
  else if (state==synch_hi) {   // sync-pulse hi
    if ((pinb & bitmask_a500clk)==0) state=synch_lo;
  }

  else if (state==synch_lo) {   // sync-pulse low
    if ((pinb & bitmask_a500clk)!=0) state=handshake;
  }
 
  else if (state==handshake) {  // handshake
    if (counter==0) {
      ddrb |= bitmask_a500sp;   // set io direction output
      portb &= ~bitmask_a500sp; // set output low
      counter=millis();
    }
    else if (millis()-counter>10) {
      counter=0;
      ddrb &= ~bitmask_a500sp;   // set io direction input
      state=wait_lo;
      key=0;
      bitn=7;
    }
  }
 
  else if (state==read) {        // read key message (8 bits)
    if ((pinb & bitmask_a500clk)!=0) {
      if (bitn--){
        key+=((pinb & bitmask_a500sp)==0)<<(bitn); // key code (add bits 0...6)
        state=wait_lo;
      }
      else {  // read last bit (key down)   
        keydown=((pinb & bitmask_a500sp)!=0); // true if key down
        interrupts();
        state=handshake;
        if (key==0x5f)  fn=keydown;  // "help" key: special function on/off
        else if (key==0x62) keystroke(0x39,0x00);  // capslock
        else {
          if (keydown){
            // keydown message received
            if (fn) {
              // special function "help" key
              if (key==0x50) keystroke(0x44,0);  // f11
              else if (key==0x51) keystroke(0x45,0);  // f12
              else if (key==0x5a) keystroke(0x53,0);  // numlock
              else if (key==0x5b) keystroke(0x47,0);  // scrolllock
              else if (key==0x02) keystroke(0x14,0x40);  // @
              else if (key==0x04) keystroke(0x35,0x02);  // °
               
            }
            else {
              if ((key==0x2b) && (_keyreport.modifiers & 0x22)) keystroke(0x35,0x00);  // ^ (with shift)
              else if (key==0x00) if (_keyreport.modifiers & 0x22) keystroke(0x30,0x40); else keystroke(0x35,0x20); // ~,`
              else if (key==0x0d) if (_keyreport.modifiers & 0x22) keystroke(0x64,0x40); else keystroke(0x2d,0x40); // |,\
              else if (key==0x5a) if (_keyreport.modifiers & 0x22) keystroke(0x24,0x40); else keystroke(0x25,0x40); // {,[
              else if (key==0x5b) if (_keyreport.modifiers & 0x22) keystroke(0x27,0x40); else keystroke(0x26,0x40); // },]
              else if (key < 0x68) keypress(key);  // code table

           
             
            }
          }
          else {
            // keyrelease message received
            if (key < 0x68) keyrelease(key);  // code table
          }
        }
      }
    }
  }
 
  else if (state==wait_lo) {   // waiting next bit
    if ((pinb & bitmask_a500clk)==0) {
      nointerrupts();
      state=read;
    }
  }
}
   

void keypress(uint8_t k) {
 
  if (k > 0x5f) _keyreport.modifiers |= ktab[key];  // modifier
  else {
    (uint8_t i=0; i<6; i++) {
      if (_keyreport.keys[i] == 0) {
         _keyreport.keys[i] = ktab[key];
         break;
      }
    }
  }
  hid_sendreport(2,&_keyreport,8);
}


void keyrelease(uint8_t k) {

  if (k > 0x5f) _keyreport.modifiers &= ~ktab[key];  // modifier
  else {
    (uint8_t i=0; i<6; i++) {
      if (_keyreport.keys[i] == ktab[key]) _keyreport.keys[i] = 0;
    }
  }
  hid_sendreport(2,&_keyreport,8);
}


void keystroke(uint8_t k, uint8_t m) {
 
  unsigned short memomodifiers = _keyreport.modifiers; // save last modifier state
    (uint8_t i=0; i<6; i++) {
      if (_keyreport.keys[i] == 0) {
         _keyreport.keys[i] = k;
         _keyreport.modifiers = m;
         hid_sendreport(2,&_keyreport,8);
         _keyreport.keys[i] = 0;
         _keyreport.modifiers = memomodifiers; // recover modifier state
         hid_sendreport(2,&_keyreport,8);
         break;
      }
    }
}

the problem in row:

0x10, //sollte die menü taste sein. geht aber nicht

0x10 don't work. thin hex key 0x67, does't work.
can may have change keyboard.h?

please note following keys
0x02, // shift-links
0x20, // shift-rechts
0x00,
0x01, // links-ctrl
0x04, // rechts-alt
0x40, // links-amiga
0x08, // links-alt
works amiga emulator perfectly

can fix this?

greets markus



Arduino Forum > Community > Exhibition / Gallery > Hex Code for Keyboardkey "rmenu"?


arduino

Comments

Popular posts from this blog

DHT11 Time out error using v0.4.1library

Sketch upload fails with Java error (___REMOVE___/bin/avrdude)!

Arduino Uno + KTY81/210 temperature sensor