simulavr  1.1.0
serialrx.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 SERIALRX_H_INCLUDED
27 #define SERIALRX_H_INCLUDED
28 
29 #include "systemclocktypes.h"
30 #include "ui.h"
31 #include "pinnotify.h"
32 
33 
35  protected:
37  std::map < std::string, Pin *> allPins;
38  unsigned long long baudrate;
39 
40  void PinStateHasChanged(Pin*);
41  virtual void CharReceived(unsigned char c)=0;
42 
43  int highCnt;
44 
45  int bitCnt;
46  int maxBitCnt;
47  int dataByte;
48 
49  enum T_RxState {
56  } ;
57 
59 
60  bool sendInHex;
61 
62  public:
63  void SetBaudRate(SystemClockOffset baud);
64  void SetHexOutput(bool newValue);
65  SerialRxBasic();
66  void Reset();
67  virtual Pin* GetPin(const char *name) ;
68  virtual ~SerialRxBasic(){};
69  virtual int Step(bool &trueHwStep, SystemClockOffset *timeToNextStepIn_ns=0);
70  };
71 
72 
75  protected:
76  std::vector<unsigned char> buffer;
77  virtual void CharReceived(unsigned char c);
78  public:
79  unsigned char Get();
80  long Size();
81  };
82 
83 
85 class SerialRx: public SerialRxBasic, public ExternalType{
86  protected:
88  std::string name;
89 
90  virtual void CharReceived(unsigned char c);
91  public:
92  SerialRx(UserInterface *_ui, const char *_name, const char *baseWindow);
93  virtual ~SerialRx(){};
94  virtual void SetNewValueFromUi(const std::string &);
95  };
96 
97 #endif
virtual ~SerialRx()
Definition: serialrx.h:93
Pin class, handles input and output to external parts.
Definition: pin.h:98
virtual Pin * GetPin(const char *name)
std::map< std::string, Pin * > allPins
Definition: serialrx.h:37
UserInterface * ui
Definition: serialrx.h:87
std::string name
Definition: serialrx.h:88
void PinStateHasChanged(Pin *)
virtual ~SerialRxBasic()
Definition: serialrx.h:68
std::vector< unsigned char > buffer
Definition: serialrx.h:76
int dataByte
Definition: serialrx.h:47
int maxBitCnt
Definition: serialrx.h:46
unsigned long long baudrate
Definition: serialrx.h:38
T_RxState rxState
Definition: serialrx.h:58
long long SystemClockOffset
void SetHexOutput(bool newValue)
void SetBaudRate(SystemClockOffset baud)
virtual void CharReceived(unsigned char c)=0
virtual int Step(bool &trueHwStep, SystemClockOffset *timeToNextStepIn_ns=0)
Return nonzero if a breakpoint was hit.
bool sendInHex
Definition: serialrx.h:60