Cat
ICPhaser.h
Go to the documentation of this file.
1 //$Id: ICPhaser.h,v 1.3 2006/09/28 13:02:23 fmachefe Exp $
2 //------------------------------------------------------------------------------
3 //
4 // Package : ICPhaser
5 //
6 // Description:
7 //
8 // Author(s) :
9 // Date :
10 //
11 //------------------------------------------------------------------------------
12 
13 #ifndef __ICPHASER_H_
14 #define __ICPHASER_H_
15 
16 #include "Element.h"
17 #include "Register.h"
18 
19 class ICPhaser : public Element {
20 public:
21  typedef unsigned long U32;
22  typedef unsigned short U16;
23  typedef unsigned char U8;
25  setType("ICPhaser");
26  setId(0);
27 
29  debug("ICPhaser built.","ICPhaser::ICPhaser");
30 
31  m_phase[0]=99;
32  m_phase[1]=99;
33  m_phase[2]=99;
34  m_phase[3]=99;
35 
36  m_regConfig=new Register();
37  m_regStatus=new Register();
38 
39  m_regConfig->setName("ConfigRegister");
40  m_regStatus->setName("StatusRegister");
41 
44 
45  m_regConfig->io()->defDataU8(3);
46  m_regStatus->io()->defDataU8(2);
47 
50 
53  }
54 
56  }
57 
58  void setPhase(unsigned char channel, unsigned char value){
59  info("Set Phase "+itos(channel)+" to "
60  +itos(value),"ICPhaser::setPhase");
61  m_phase[channel]=value;
62  write();
63  }
64 
65  void setPhase(
66  unsigned char ch0,
67  unsigned char ch1,
68  unsigned char ch2,
69  unsigned char ch3
70  ){
71  m_phase[0]=ch0;
72  m_phase[1]=ch1;
73  m_phase[2]=ch2;
74  m_phase[3]=ch3;
75  info("Set Phases to "+itos(ch0)+" "+itos(ch1)+" "
76  +itos(ch2)+" "+itos(ch3));
77  write();
78  }
79 
80  unsigned int phase(unsigned int ch){
81  read() ;
82  return m_phase[ch];
83  }
84 
85  void read();
86  void write();
87  void status();
88 
92  void help() { info("ICPhaser "+name()+". No help.","ICPhaser::help"); };
93 
100  return StatusCode::SUCCESS;
101  };
102 
110  void reset();
111 
115  void update () {
116  read();
117  };
118 
120  return m_regConfig;
121  }
122 
124  return m_regStatus;
125  }
126 
127  void setAddress(U8 address){
131  }
132 
133  U8 address(){
134  return m_address;
135  }
136 
137 private:
139  unsigned char m_phase[4];
142 };
143 
144 #endif
145 
void info(std::string mymsg)
Definition: Object.h:38
std::string itos(int)
Definition: Tools.cpp:46
void reset()
Definition: ICPhaser.cpp:49
void read()
Definition: ICPhaser.cpp:16
ICPhaser()
Definition: ICPhaser.h:24
void status()
Definition: ICPhaser.cpp:38
~ICPhaser()
Definition: ICPhaser.h:55
unsigned int phase(unsigned int ch)
Definition: ICPhaser.h:80
unsigned long U32
Definition: ICPhaser.h:21
void update()
Definition: ICPhaser.h:115
unsigned char m_phase[4]
Definition: ICPhaser.h:139
void add(int attribut)
Definition: Attrib.h:67
void setName(std::string name)
Definition: Object.h:51
void setAddress(U8 address)
Definition: ICPhaser.h:127
void write()
Definition: ICPhaser.cpp:60
U8 m_address
Definition: ICPhaser.h:138
void help()
Definition: ICPhaser.h:92
void setPhase(unsigned char ch0, unsigned char ch1, unsigned char ch2, unsigned char ch3)
Definition: ICPhaser.h:65
StatusCode init()
Definition: ICPhaser.h:99
void setType(std::string type)
Definition: Object.h:52
void setId(unsigned char id)
Definition: Object.h:53
void setPhase(unsigned char channel, unsigned char value)
Definition: ICPhaser.h:58
void debug(std::string mymsg)
Definition: Object.h:37
unsigned char U8
Definition: ICPhaser.h:23
Register * regConfig()
Definition: ICPhaser.h:119
StatusCode setSubAddress(U32 subAddress)
Definition: IOdata.h:81
void setAddress(U32 address)
Definition: IOobject.h:84
std::string name() const
Definition: Object.h:28
virtual void addChild(Hierarchy *element)
Definition: Hierarchy.cpp:83
StatusCode setWordSize(IOdata::WordSize wordSize)
Definition: IOdata.h:126
U8 address()
Definition: ICPhaser.h:133
Register * m_regConfig
Definition: ICPhaser.h:140
void defDataU8(unsigned long size)
Definition: IOdata.h:179
Register * regStatus()
Definition: ICPhaser.h:123
unsigned short U16
Definition: ICPhaser.h:22
Register * m_regStatus
Definition: ICPhaser.h:141
IOdata * io()
Definition: IOobject.h:66