BeRTOS
Data Structures | Defines | Functions
Keyboard handling driver
BeRTOS peripherals drivers

Keyboard driver. More...

Data Structures

struct  KbdHandler
 Keyboard handler descriptor. More...

Defines

#define KHF_RAWKEYS   BV(0)
 Handler gets raw key events.

Functions

void kbd_init (void)
 Initialize keyboard ports and softtimer.
keymask_t kbd_peek (void)
 Read a key from the keyboard buffer.
keymask_t kbd_get (void)
 Wait for a keypress and return the mask of depressed keys.
keymask_t kbd_get_timeout (mtime_t timeout)
 Wait up to timeout ms for a keypress and return the mask of depressed keys, or K_TIMEOUT if the timeout was reacked.
keymask_t kbd_setRepeatMask (keymask_t mask)
 Set current mask of repeatable keys.

Keyboard polling modes.

Define CONFIG_KBD_POLL to one of these.

#define KBD_POLL_SOFTINT   1

Detailed Description

Keyboard driver.

Configuration file: cfg_kbd.h

HAL files: hw_kbd.h, kbd_map.h

Author:
Bernie Innocenti <bernie@codewiz.org>
Stefano Fedrigo <aleph@develer.com>
Francesco Sacchi <batt@develer.com>

Function Documentation

keymask_t kbd_get ( void  )

Wait for a keypress and return the mask of depressed keys.

Note:
This function is not interrupt safe!

Definition at line 205 of file kbd.c.

keymask_t kbd_peek ( void  )

Read a key from the keyboard buffer.

When a key is kept depressed between calls of this function a value is returned only after the time specified with KBD_REPAT_DELAY to avoid too fast keyboard repeat.

Note:
Calls schedule() internally.
This function is not interrupt safe!
Returns:
The mask of depressed keys or 0 if no keys are depressed.

Definition at line 178 of file kbd.c.