From 482fcc3ee5ea930a38e04c93341445b8a77f6123 Mon Sep 17 00:00:00 2001 From: bernie Date: Fri, 10 Feb 2006 12:31:03 +0000 Subject: [PATCH] Add templates for hw definitions. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@498 38d2e660-2303-0410-9eaa-f027e97ec537 --- hw/hw_buzzer.h | 32 +++++++++++++++++++++++ hw/hw_kbd.h | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++ hw/kbd_map.h | 49 +++++++++++++++++++++++++++++++++++ 3 files changed, 150 insertions(+) create mode 100755 hw/hw_buzzer.h create mode 100755 hw/hw_kbd.h create mode 100755 hw/kbd_map.h diff --git a/hw/hw_buzzer.h b/hw/hw_buzzer.h new file mode 100755 index 00000000..08d6bc54 --- /dev/null +++ b/hw/hw_buzzer.h @@ -0,0 +1,32 @@ +/*! + * \file + * + * + * \brief Buzzer hardware-specific definitions + * + * \version $Id$ + * + * \author Francesco Sacchi + */ + +/*#* + *#* $Log$ + *#* Revision 1.1 2006/02/10 12:31:03 bernie + *#* Add templates for hw definitions. + *#* + *#*/ + +#ifndef HW_BUZZER_H +#define HW_BUZZER_H + +#define BUZZER_BIT BV(1) +#define IS_BUZZER_ON 0 +#define BUZZER_HW_INIT do { } while (0) +#define BUZZER_ON do { } while (0) +#define BUZZER_OFF do { } while (0) + +#endif /* HW_BUZZER_H */ diff --git a/hw/hw_kbd.h b/hw/hw_kbd.h new file mode 100755 index 00000000..8908db27 --- /dev/null +++ b/hw/hw_kbd.h @@ -0,0 +1,69 @@ +/*! + * \file + * + * + * \brief Keyboard hardware-specific definitions + * + * \version $Id$ + * + * \author Francesco Sacchi + * \author Stefano Fedrigo + */ + +/*#* + *#* $Log$ + *#* Revision 1.1 2006/02/10 12:31:03 bernie + *#* Add templates for hw definitions. + *#* + *#*/ + +#ifndef HW_KBD_H +#define HW_KBD_H + + +#include "kbd_map.h" +#include +#include + + + /*! + * \name CPU ports <-> switches assignement + * @{ + */ + +#define K_RPT_MASK (K_UP | K_DOWN | K_OK | K_CANCEL) +/*@}*/ + + +#define KBD_HW_INIT \ + do { \ + } while (0) + + +/*! + * Read the keyboard ports and return the mask of + * depressed keys. + */ +INLINE keymask_t kbd_readkeys(void) +{ + keymask_t key = 0; + + uint32_t mask = 0xF; + + if (!(mask & 1)) + key |= K_OK; + if (!(mask & 2)) + key |= K_CANCEL; + if (!(mask & 4)) + key |= K_UP; + if (!(mask & 8)) + key |= K_DOWN; + + return key; +} + +#endif /* HW_KBD_H */ diff --git a/hw/kbd_map.h b/hw/kbd_map.h new file mode 100755 index 00000000..30969e53 --- /dev/null +++ b/hw/kbd_map.h @@ -0,0 +1,49 @@ +/*! + * \file + * + * + * \brief Keyboard map definitions. + * + * \version $Id$ + * + * \author Francesco Sacchi + * \author Stefano Fedrigo + */ + +/*#* + *#* $Log$ + *#* Revision 1.1 2006/02/10 12:31:03 bernie + *#* Add templates for hw definitions. + *#* + *#*/ + +#ifndef HW_KBD_MAP_H +#define HW_KBD_MAP_H + +#include + + +/*! + * Type for keyboard mask. + */ +typedef uint16_t keymask_t; + +/*! + * \name Keycodes. + */ +/*@{*/ +#define K_UP BV(0) +#define K_DOWN BV(1) +#define K_OK BV(2) +#define K_CANCEL BV(3) + +#define K_REPEAT BV(14) /*!< This is a repeated keyevent. */ +#define K_TIMEOUT BV(15) /*!< Fake key event for timeouts. */ +/*@}*/ + + +#endif /* HW_KBD_MAP_H */ -- 2.25.1