simulavr  1.1.0
keyboard.h
Go to the documentation of this file.
1  /*
2  ****************************************************************************
3  *
4  * simulavr - A simulator for the Atmel AVR family of microcontrollers.
5  * Copyright (C) 2001, 2002, 2003 Klaus Rudolph
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  ****************************************************************************
22  *
23  * $Id$
24  */
25 
26 #ifndef KEYBDOARD_H_INCLUDED
27 #define KEYBDOARD_H_INCLUDED
28 
29 #define KBD_BUFFER_SIZE 128
30 
31 
32 #include <iostream>
33 
34 #include "systemclocktypes.h"
35 #include "simulationmember.h"
36 #include "hardware.h"
37 #include "pin.h"
38 
39 
41 class Keyboard : public SimulationMember, public ExternalType {
42  protected:
43  unsigned char myPortValue;
46 
47  unsigned int bitCnt;
48 
49  //ofstream debugOut;
51 
52  unsigned int buffer[KBD_BUFFER_SIZE];
53  unsigned int bufferWriteIndex;
54  unsigned int bufferReadIndex;
55 
56  void InsertMakeCodeToBuffer(int);
57  void InsertBreakCodeToBuffer(int);
58  int InsertScanCodeToBuffer( unsigned char scan);
59 
60  unsigned char actualChar;
61  unsigned char lastPortValue;
62 
63  public:
64  void SetNewValueFromUi(const std::string &);
65  virtual int Step(bool &trueHwStep, SystemClockOffset *timeToNextStepIn_ns=0);
66  Keyboard(UserInterface *, const char *name, const char *baseWindow);
68  virtual ~Keyboard();
69 };
70 
71 #endif
Pin data
Definition: keyboard.h:45
void InsertMakeCodeToBuffer(int)
unsigned char lastPortValue
Definition: keyboard.h:61
void SetNewValueFromUi(const std::string &)
Pin class, handles input and output to external parts.
Definition: pin.h:98
void InsertBreakCodeToBuffer(int)
unsigned int bufferReadIndex
Definition: keyboard.h:54
Pin clk
Definition: keyboard.h:44
int InsertScanCodeToBuffer(unsigned char scan)
unsigned int bitCnt
Definition: keyboard.h:47
virtual ~Keyboard()
unsigned int buffer[KBD_BUFFER_SIZE]
Definition: keyboard.h:52
long long SystemClockOffset
unsigned int bufferWriteIndex
Definition: keyboard.h:53
unsigned char actualChar
Definition: keyboard.h:60
SystemClockOffset myClockFreq
Definition: keyboard.h:50
virtual int Step(bool &trueHwStep, SystemClockOffset *timeToNextStepIn_ns=0)
Return nonzero if a breakpoint was hit.
unsigned char myPortValue
Definition: keyboard.h:43
#define KBD_BUFFER_SIZE
Definition: keyboard.h:29
Keyboard(UserInterface *, const char *name, const char *baseWindow)
void SetClockFreq(SystemClockOffset f)