/** * \file * * * \defgroup kbd Keyboard handling driver * \ingroup drivers * \{ * \brief Keyboard driver. * * Configuration file: cfg_kbd.h * * HAL files: hw_kbd.h, kbd_map.h * \author Bernie Innocenti * \author Stefano Fedrigo * \author Francesco Sacchi * * $WIZ$ module_name = "kbd" * $WIZ$ module_depends = "timer" * $WIZ$ module_configuration = "bertos/cfg/cfg_kbd.h" * $WIZ$ module_hw = "bertos/hw/hw_kbd.h", "bertos/hw/kbd_map.h" */ #ifndef DRV_KBD_H #define DRV_KBD_H #include "hw/kbd_map.h" #include "cfg/cfg_kbd.h" // CONFIG_KBD_OBSERVER #include #include /** * \name Keyboard polling modes. * * Define CONFIG_KBD_POLL to one of these. * * \{ */ #define KBD_POLL_SOFTINT 1 /* \} */ /** * Keyboard handler descriptor */ typedef struct KbdHandler { Node link; keymask_t (*hook)(keymask_t); /**< Hook function */ int8_t pri; /**< Priority in input queue */ uint8_t flags; /**< See below for definitions */ } KbdHandler; #define KHF_RAWKEYS BV(0) /**< Handler gets raw key events */ void kbd_init(void); keymask_t kbd_peek(void); keymask_t kbd_get(void); keymask_t kbd_get_timeout(mtime_t timeout); void kbd_addHandler(struct KbdHandler *handler); void kbd_remHandler(struct KbdHandler *handler); keymask_t kbd_setRepeatMask(keymask_t mask); #if CONFIG_KBD_OBSERVER struct Subject; /** Subject structure for keyboard observers. */ extern struct Subject kbd_subject; enum { /* Event for key presses. */ KBD_EVENT_KEY = 0x100 }; #endif /** \} */ //defgroup kbd #endif /* DRV_KBD_H */