Home |
RTKernel-32 Programming Manual Function WSetUserInput |
Function WSetUserInputIf any task needs user input, you must install an input routine with this function: typedef int (__cdecl * WUserInputFunction)(void); void WSetUserInput(WUserInputFunction GetInput); ParametersGetInputA function without parameters and an integer return value. It should return an ASCII value or a 0 followed by a scan code for extended keys. Most applications will use function KBGetCh to read from the keyboard. The following example shows how to read input from serial port COM2 instead of the keyboard: int RTKAPI UserKey(void) { COMData Data; RTKGet(COMReceiveBuffer[COM2], &Data); COMSendChar(COM2, Data); if (Data == '\r') COMSendChar(COM2, '\n'); return Data; } int main(void) { COMPortInit(COM2, 9600, PARITY_NONE, 1, 8); COMEnableInterrupt(COM2, 100); WSetUserInput(UserKey); ...
|