INOS
cinosbit.h
Go to the documentation of this file.
1//******************************************************************************
27//******************************************************************************
28
29#ifndef INC_CINOSBIT_H
30#define INC_CINOSBIT_H
31
32//
33//------------------------------------------------------------------------------
34// defines
35//------------------------------------------------------------------------------
36//
37//
38//------------------------------------------------------------------------------
39// includes
40//------------------------------------------------------------------------------
41//
42// system
43//
44// C++
45//
46// project
48//
49//------------------------------------------------------------------------------
50// class definition
51//------------------------------------------------------------------------------
52//
54{
55 //--- user interface ---------------------------------------------------
56
57 // public member functions
58 public :
59 ICACHE virtual void Set(real64 arValue) override;
60 //; set channel to arValue
61 ICACHE virtual void SetControl(real64 arValue) override;
62 //; set channel to arValue
63 ICACHE virtual real64 Get() override;
64 //; get value of channel
65 #if defined(INOS_PROCESSIMAGE_OVERWRITE)
66 bool Set(bool abOverwrite = false);
67 //; set bit and return the value before ('Test and Set')
68 //; (abOverwrite=true -> bit always set, abOverwrite=false -> bit set
69 //; if channel is NOT in overwrite mode)
70 bool Clear(bool abOverwrite = false);
71 //; clear bit and return the value before
72 //; (abOverwrite=true -> bit always cleared, abOverwrite=false ->
73 //; bit cleared if channel is NOT in overwrite mode)
74 #else
75 bool Set();
76 //; set bit and return the value before ('Test and Set')
77 bool Clear();
78 //; clear bit and return the value before
79 #endif
80 bool SetEx(uint16 auIndex);
81 //; set array based bit and return value before (no fancy things like
82 //; overwrite, sync objects, ... available)
83 bool SetLatched();
84 //; set latched bit and return the value before ('Test and Set')
85 bool ClearEx(uint16 auIndex);
86 //; clear array based bit and return value before (no fancy things like
87 //; overwrite, sync objects, ... available)
88 bool ClearLatched();
89 //; clear latched bit and return the value before ('Test and Set')
90 bool Test();
91 //; test bit
92 bool TestEx(uint16 auIndex);
93 //; test array based bit
94 bool TestLatched();
95 //; test latched bit
96 uint32 WaitForSet(uint32 aTimeout=INOS_WAIT_FOREVER);
97 //; wait max. aTimeout usec for bit set
98 //; return value == 0 -> timeout, != 0 -> time waited for bit (in usec)
99 uint32 WaitForCleared(uint32 aTimeout=INOS_WAIT_FOREVER);
100 //; wait max. aTimeout usec for bit cleared
101 //; return value == 0 -> timeout, != 0 -> time waited for bit (in usec)
102 void SetFilter(uint16 auFilter);
103 //; set filter value (ticks) -> only valid for digital inputs
104 uint16 GetFilter()
105 //; get filter value -> only valid for digital inputs
106 { return dat.inp.m_uFilter;};
107 void SetInverted(bool abInverted);
108 //; set filter value (ticks) -> only valid for digital inputs
109 bool GetInverted();
110 //; get filter value -> only valid for digital inputs
111 virtual uint8 GetBusId() override;
112 //; return bus id the channel belongs to
113 void ConvertToReal(uint16 auNewNumber);
114 // convert bit from simulated to real
115 virtual CINOSBusPortHandler* GetBusPortHandler() override;
116 //; return pointer to the according bus port (or 0 if not available)
117 virtual void IwasMoved(uint32 auToNumber) override;
118 //; called whenever a channel was moved to a new number
119 virtual uint32 GetArrayLength() override;
120 //; get channel array length
121 virtual uint16 GetCycleId() override;
122 //; return bus cycle id the channel is updated (needed to be
123 //; able to register bus hook in the correct cycle/core)
124
125 //--- internals --------------------------------------------------------
126
127 friend class CINOSBits;
128 friend class CINOSBitSetEvent;
129 friend class CINOSBitClearedEvent;
130 friend class CINOSOutPwm;
131
132 // constructor / destructor
133 public:
134 CINOSBit (const char* apName, uint16 auNumber, uint8 auParent,
135 uint16 auArrayLength=1);
136 //; object constructor
137
138 virtual void SetBusPortHandler(CINOSBusPortHandler* apBusPortHandler);
139 //; set pointer to the according bus port handler
140
141 // protected members
142 protected:
143#ifndef DOXYGEN_USER_BUILD
144 #ifndef INOS_NO_BIT_EVENT_SUPPORT
145 CINOSEvent* m_pSetEvent;
146 //; pointer to set event
147 CINOSEvent* m_pClrEvent;
148 //; pointer to clear event
149 uint8 m_uSetEvents;
150 //; set events counter
151 uint8 m_uClrEvents;
152 //; clear events counter
153 #endif
154 CINOSBusPortHandler* m_pBusPortHandler;
155 //; pointer to bus port handler. May be NULL.
156 union {
157 struct {
158 uint16 m_uFilter;
159 //; filter value (ticks)
160 uint16 m_uCount;
161 //; actual filter counter
162 } inp;
163 struct {
164 float m_rValue;
165 } out;
166 } dat;
167#endif
168};
169
170//
171//------------------------------------------------------------------------------
172// class CINCOProcessImageBit
173//------------------------------------------------------------------------------
174
175class CINCOProcessImageBit : public CINCObit
176{
177 // constructor
178 public:
180 const char* apName, uint16 auNumber, uint8 auParent
181 );
182
183 // public member functions
184 public:
185 virtual long Put(void* aSource, long aIndex=0, long aOffset=0);
186 virtual long Get(void* aDest, long& maxLength, long aIndex=0, long aOffset=0);
187 virtual long GetProperty(void* aDest, char* aName, long aIndex,
188 long aOffset, long* apMaxLength, CINCOObject* apParent);
189
190 // protected members
191 protected :
192 uint8 m_uParent;
193 // index of parent image
194
195 // allow dynamic object handling (new/delete)
197};
198
199
200//
201//------------------------------------------------------------------------------
202// class CINCOProcessImageBitInverted
203//------------------------------------------------------------------------------
204
205class CINCOProcessImageBitInverted : public CINCObit
206{
207 // constructor
208 public:
210 const char* apName, void* apData, uint16 auNumber, uint8 auParent);
211
212 // public member functions
213 public:
214 virtual long Put(void* aSource, long aIndex=0, long aOffset=0);
215 virtual long Get(void* aDest, long& maxLength, long aIndex=0, long aOffset=0);
216
217 private:
218 const uint8 m_uParent;
219
220 // allow dynamic object handling (new/delete)
222};
223
224//------------------------------------------------------------------------------
225// end of file
226//------------------------------------------------------------------------------
227
228#endif // INC_CINOSBIT_H
#define DECLARE_DYNAMIC(aClass)
Definition cinospartitionmemory.h:328
Definition cinosbit.h:206
Definition cinosbit.h:176
Definition inos_syn.h:766
Definition inos_syn.h:709
Definition cinosbit.h:54
Definition cinosbits.h:73
Definition inos_syn.h:681
Definition cinosprocessimagechannel.h:111