simulavr  1.1.0
lcd.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 LCD_H_INCLUDED
27 #define LCD_H_INCLUDED
28 
29 
30 #include <fstream>
31 #include <string>
32 
33 #include "systemclocktypes.h"
34 #include "simulationmember.h"
35 //#include "hardware.h"
36 #include "ui.h"
37 #include "pin.h"
38 
39 typedef enum {
41  POWER_ON, // First State after Reset
42  PWR_AFTER_FS1,// After first Function Set Cmd no Busy Flag
43  PWR_AFTER_FS2,// After second Function Set Cmd no Busy Flag
44  PWR_ON_FINISH,// After third Function Set Cmd no Busy Flag. After the next CMD BF is valid
45  CMDEXEC // Executing any command after init
46  } t_myState;
47 
48 
52 class Lcd : public SimulationMember {
53  protected:
55  std::string name;
56  unsigned char myPortValue;
57  std::map<std::string, Pin*> allPins;
62 
66 
67  unsigned int CmdExecTime_ns; // Command Execution Time
68  t_myState myState; // LCD State-Event machine
69  char myd3; // internal D3
70 
71 
72  int merke_x;
73  int merke_y;
74 
75  void LcdWriteData(unsigned char data);
76  unsigned int LcdWriteCommand(unsigned char command);
77 
78  std::ofstream debugOut;
79  void SendCursorPosition();
80 
81  unsigned char lastPortValue;
82  int readLow;
83  unsigned char command;
84  int enableOld;
85 
86  public:
87  virtual int Step(bool &trueHwStep, SystemClockOffset *timeToNextStepIn_ns=0);
88  //Lcd(UserInterface *ui, const string &name, const string &baseWindow);
89  Lcd(UserInterface *ui, const char *name, const char *baseWindow);
90  virtual ~Lcd();
91  Pin *GetPin(const char *name);
92 };
93 
94 #endif
char myd3
Definition: lcd.h:69
Definition: lcd.h:45
void SendCursorPosition()
Pin class, handles input and output to external parts.
Definition: pin.h:98
std::map< std::string, Pin * > allPins
Definition: lcd.h:57
std::string name
Definition: lcd.h:55
Pin enable
Definition: lcd.h:63
t_myState myState
Definition: lcd.h:68
Definition: lcd.h:52
int readLow
Definition: lcd.h:82
std::ofstream debugOut
Definition: lcd.h:78
unsigned char lastPortValue
Definition: lcd.h:81
Pin readWrite
Definition: lcd.h:64
unsigned char myPortValue
Definition: lcd.h:56
Pin d2
Definition: lcd.h:60
int merke_y
Definition: lcd.h:73
Pin d3
Definition: lcd.h:61
Pin * GetPin(const char *name)
unsigned int LcdWriteCommand(unsigned char command)
Definition: lcd.h:41
Pin commandData
Definition: lcd.h:65
UserInterface * ui
Definition: lcd.h:54
int enableOld
Definition: lcd.h:84
long long SystemClockOffset
unsigned int CmdExecTime_ns
Definition: lcd.h:67
Lcd(UserInterface *ui, const char *name, const char *baseWindow)
Pin d0
Definition: lcd.h:58
Definition: lcd.h:40
virtual int Step(bool &trueHwStep, SystemClockOffset *timeToNextStepIn_ns=0)
Return nonzero if a breakpoint was hit.
t_myState
Definition: lcd.h:39
void LcdWriteData(unsigned char data)
int merke_x
Definition: lcd.h:72
Pin d1
Definition: lcd.h:59
unsigned char command
Definition: lcd.h:83
virtual ~Lcd()