PRGM GetKey

From WikiPrizm
Revision as of 19:01, 29 January 2012 by Ahelper (talk | contribs) (Finalizing the changes)
Jump to navigationJump to search

Synopsis

This is a routine that is non-blocking, goes through the OS, and returns one key value: the very last one pressed.

Definition

int PRGM_GetKey(void)
{
  unsigned char buffer[12];
  PRGM_GetKey_OS( buffer );
  return ( buffer[1] & 0x0F ) * 10 + ( ( buffer[2] & 0xF0 ) >> 4 );
}

Inputs

None

Outputs

Packed key code

Comments

This function will retrieve the last pressed key and continue returning it if it is still held. While it's slightly outdated, it is still commonly used for simple key checking.

The return is a packed 2 digit number, with the first digit being the row - 1 and the second digit being the column. For example, GetKeyWait_OS, when F1 is pressed, will give 7,10 as the col,row. This function returns 79 as the (col)(row-1). AC/ON returns 1,1 for GetKeyWait_OS and therefore returns 10 from PRGM_GetKey.