#ifndef __S08_KEYBOARD__
  #define __S08_KEYBOARD__
  
  #include "Derivative.h"
  #include "FslTypes.h"
  
  
  #define KB_EDGES_AND_LEVELS    1
  #define KB_INTERRUPT_ENABLED   2
  
  #define KB_PULLUPS              PTAPE
  #define KB_DDR                  PTADD
  #define KB_PORT                 PTAD
  
  typedef enum
  {
    KB_PIN0,
    KB_PIN1,
    KB_PIN2,
    KB_PIN3,
    KB_PIN4,
    KB_PIN5,
    KB_PIN6,
    KB_PIN7
  }__KB_MODULE_PINS;
  
  #define KB_PIN0_EVENT         !(gu8KB_Status & (1<<KB_PIN0))
  #define KB_PIN0_CLEAR_EVENT   gu8KB_Status |= (1<<KB_PIN0)
    
  #define KB_PIN1_EVENT         !(gu8KB_Status & (1<<KB_PIN1))
  #define KB_PIN1_CLEAR_EVENT   gu8KB_Status |= (1<<KB_PIN1)
  
  #define KB_PIN2_EVENT         !(gu8KB_Status & (1<<KB_PIN2))
  #define KB_PIN2_CLEAR_EVENT   gu8KB_Status |= (1<<KB_PIN2)
  
  #define KB_PIN3_EVENT         !(gu8KB_Status & (1<<KB_PIN3))
  #define KB_PIN3_CLEAR_EVENT   gu8KB_Status |= (1<<KB_PIN3)
  
  #define KB_PIN4_EVENT         !(gu8KB_Status & (1<<KB_PIN4))
  #define KB_PIN4_CLEAR_EVENT   gu8KB_Status |= (1<<KB_PIN4)
  
  #define KB_PIN5_EVENT         !(gu8KB_Status & (1<<KB_PIN5))
  #define KB_PIN5_CLEAR_EVENT   gu8KB_Status |= (1<<KB_PIN5)
  
  #define KB_PIN6_EVENT         !(gu8KB_Status & (1<<KB_PIN6))
  #define KB_PIN6_CLEAR_EVENT   gu8KB_Status |= (1<<KB_PIN6)
  
  #define KB_PIN7_EVENT         !(gu8KB_Status & (1<<KB_PIN7))
  #define KB_PIN7_CLEAR_EVENT   gu8KB_Status |= (1<<KB_PIN7)
  
  extern UINT8 gu8KB_Status;
  
  void vfnKeyboard_Init(UINT8 lu8KeyboardPinsUsed, UINT8 lu8KB_Configuration);
  
#endif