t2:key_set

key_set


key_set — Set the status of a keyboard key

Description


void key_set(uint8 code, bool status);

Set the current status, pressed or not pressed, of the key specified by code.

Works only when the active output protocol is Multi Interface HID.

Parameters


  • code: Code of an keyboard key. Refer to keyboard.gph for the key codes definitions.
  • status: TRUE or FALSE, representing pressed and not pressed.

Return Value


No value is returned.

Examples


Example #1 key_set() example

#include <keyboard.gph>
 
main {
    combo_run(HelloTitanTwo);
}
 
combo HelloTitanTwo {
    static uint8 i;
    const uint8 msg[] = {
        KEY_H, KEY_E, KEY_L, KEY_L, KEY_O, KEY_SPACEBAR, 
        KEY_T, KEY_I, KEY_T, KEY_A, KEY_N, KEY_SPACEBAR, 
        KEY_T, KEY_W, KEY_O, KEY_RETURNORENTER
    };
 
    key_set(msg[i], TRUE);
    wait(10);
 
    key_set(msg[i], FALSE);
    wait(100);
 
    if(++i == sizeof(msg)) i = 0;
}

See Also

t2/key_set.txt · Last modified: 2018/02/20 07:01 by J2Kbr