ConOpSys V2970  P004.07
ANVILEX control operating system
System_LED_Base.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file System_LED_Base.h
3 //! @brief System LED base class header file.
4 //! @attention No special attention requered.
5 //! @copyright (C) 2015-2020 ANVILEX LLC
6 //! $HeadURL: https://192.168.3.4:8443/svn/P004_07/ConOpSys/Engine/System_LED_Base.h $
7 //! $Revision: 2336 $
8 //! $Date: 2021-01-07 17:24:37 +0500 (Do, 07 Jan 2021) $
9 //! $Author: minch $
10 //------------------------------------------------------------------------------
11 //
12 // Redistribution and use in source and binary forms, with or without
13 // modification, are permitted provided that the following conditions are met:
14 //
15 // 1. Redistributions of source code must retain the above copyright notice,
16 // this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright notice,
19 // this list of conditions and the following disclaimer in the documentation
20 // and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of ANVILEX nor the names of its contributors may be
23 // used to endorse or promote products derived from this software without
24 // specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
30 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 // POSSIBILITY OF SUCH DAMAGE.
37 //
38 //------------------------------------------------------------------------------
39 
40 #pragma once
41 
42 //------------------------------------------------------------------------------
43 // Include standard libraries header files
44 //------------------------------------------------------------------------------
45 
46 //------------------------------------------------------------------------------
47 // Include thrid party header files
48 //------------------------------------------------------------------------------
49 
50 //------------------------------------------------------------------------------
51 // Include ConOpSys header files
52 //------------------------------------------------------------------------------
53 
54 #include "Defines.h"
55 
56 //------------------------------------------------------------------------------
57 //Class definitions
58 //------------------------------------------------------------------------------
59 
60 //! @brief Base LED manager class
62 {
63 
64  //----------------------------------------------------------------------------
65  // Public defines, methods and variables
66  //----------------------------------------------------------------------------
67 
68  public:
69 
70  //--------------------------------------------------------------------------
71  // Public defines
72  //--------------------------------------------------------------------------
73 
74  //! @brief LED operating modes
75  typedef enum
76  {
77 
78  //! @brief LED off
80 
81  //! @brief LED on
83 
84  //! @brief Blinking LED (1 Hz)
86 
87  //! @brief Blinking LED (1 Hz)
89 
90  //! @brief Blinking LED (8 Hz)
92 
94 
95  //--------------------------------------------------------------------------
96  // Public methods
97  //--------------------------------------------------------------------------
98 
99  //!-------------------------------------------------------------------------
100  //! @brief System LED base initialisation method.
101  //! @note None
102  //! @return None
103  //! \par Override
104  //! Not allowed
105  //! @attention None
106  //--------------------------------------------------------------------------
107 
108  VOID Init();
109 
110  //!-------------------------------------------------------------------------
111  //! @brief System LED base finalisation method.
112  //! @note None
113  //! @return None
114  //! \par Override
115  //! Not allowed
116  //! @attention None
117  //--------------------------------------------------------------------------
118 
119  VOID Done();
120 
121  //!-------------------------------------------------------------------------
122  //! @brief 1 ms cyclic execution method
123  //! @note None
124  //! @return None
125  //! \par Override
126  //! Not allowed
127  //! @attention None
128  //--------------------------------------------------------------------------
129 
130  VOID Execute_1ms();
131 
132  //!-------------------------------------------------------------------------
133  //! @brief Set mode for alarm LED
134  //! @note None
135  //! @param [in] enum_New_Mode - Required mode for LED
136  //! @return None
137  //! \par Override
138  //! Not allowed
139  //! @attention None
140  //--------------------------------------------------------------------------
141 
142  VOID Set_Alarm_LED_Mode( TLED_Mode enum_New_Mode );
143 
144  //!-------------------------------------------------------------------------
145  //! @brief Set mode for run LED
146  //! @note None
147  //! @param [in] enum_New_Mode - Required mode for LED
148  //! @return None
149  //! \par Override
150  //! Not allowed
151  //! @attention None
152  //--------------------------------------------------------------------------
153 
154  VOID Set_Run_LED_Mode( TLED_Mode enum_New_Mode );
155 
156  //!-------------------------------------------------------------------------
157  //! @brief Set mode for ready LED
158  //! @note None
159  //! @param [in] enum_New_Mode - Required mode for LED
160  //! @return None
161  //! \par Override
162  //! Not allowed
163  //! @attention None
164  //--------------------------------------------------------------------------
165 
166  VOID Set_Ready_LED_Mode( TLED_Mode enum_New_Mode );
167 
168  //!-------------------------------------------------------------------------
169  //! @brief Set mode for error LED
170  //! @note None
171  //! @param [in] enum_New_Mode - Required mode for LED
172  //! @return None
173  //! \par Override
174  //! Not allowed
175  //! @attention None
176  //--------------------------------------------------------------------------
177 
178  VOID Set_Error_LED_Mode( TLED_Mode enum_New_Mode );
179 
180  //--------------------------------------------------------------------------
181  // Public variables
182  //--------------------------------------------------------------------------
183 
184  // Status ready for processing
186 
187  //----------------------------------------------------------------------------
188  // Protected defines, methods and variables
189  //----------------------------------------------------------------------------
190 
191  protected:
192 
193  //--------------------------------------------------------------------------
194  // Protected methods
195  //--------------------------------------------------------------------------
196 
197  //!-------------------------------------------------------------------------
198  //! @brief Method turns on the alarm LED
199  //! @note None
200  //! @return None
201  //! \par Override
202  //! Not allowed
203  //! @attention None
204  //--------------------------------------------------------------------------
205 
206  virtual VOID Alarm_On() = 0;
207 
208  //!-------------------------------------------------------------------------
209  //! @brief Method turns off the alarm LED
210  //! @note None
211  //! @return None
212  //! \par Override
213  //! Not allowed
214  //! @attention None
215  //--------------------------------------------------------------------------
216 
217  virtual VOID Alarm_Off() = 0;
218 
219  //!-------------------------------------------------------------------------
220  //! @brief Method toggle the alarm LED
221  //! @note None
222  //! @return None
223  //! \par Override
224  //! Not allowed
225  //! @attention None
226  //--------------------------------------------------------------------------
227 
228  virtual VOID Alarm_Toggle() = 0;
229 
230  //--------------------------------------------------------------------------
231  // Run LED control methods
232  //--------------------------------------------------------------------------
233 
234  //!-------------------------------------------------------------------------
235  //! @brief Method turns on the run LED
236  //! @note None
237  //! @return None
238  //! \par Override
239  //! Not allowed
240  //! @attention None
241  //--------------------------------------------------------------------------
242 
243  virtual VOID Run_On() = 0;
244 
245  //!-------------------------------------------------------------------------
246  //! @brief Method turns off the run LED
247  //! @note None
248  //! @return None
249  //! \par Override
250  //! Not allowed
251  //! @attention None
252  //--------------------------------------------------------------------------
253 
254  virtual VOID Run_Off() = 0;
255 
256  //!-------------------------------------------------------------------------
257  //! @brief Method toggle the run LED
258  //! @note None
259  //! @return None
260  //! \par Override
261  //! Not allowed
262  //! @attention None
263  //--------------------------------------------------------------------------
264 
265  virtual VOID Run_Toggle() = 0;
266 
267  //--------------------------------------------------------------------------
268  // Ready LED control methods
269  //--------------------------------------------------------------------------
270 
271  //!-------------------------------------------------------------------------
272  //! @brief Method turns on the ready LED
273  //! @note None
274  //! @return None
275  //! \par Override
276  //! Not allowed
277  //! @attention None
278  //--------------------------------------------------------------------------
279 
280  virtual VOID Ready_On() = 0;
281 
282  //!-------------------------------------------------------------------------
283  //! @brief Method turns off the ready LED
284  //! @note None
285  //! @return None
286  //! \par Override
287  //! Not allowed
288  //! @attention None
289  //--------------------------------------------------------------------------
290 
291  virtual VOID Ready_Off() = 0;
292 
293  //!-------------------------------------------------------------------------
294  //! @brief Method toggle the ready LED
295  //! @note None
296  //! @return None
297  //! \par Override
298  //! Not allowed
299  //! @attention None
300  //--------------------------------------------------------------------------
301 
302  virtual VOID Ready_Toggle() = 0;
303 
304  //--------------------------------------------------------------------------
305  // Error LED control methods
306  //--------------------------------------------------------------------------
307 
308  //!-------------------------------------------------------------------------
309  //! @brief Method turns on the error LED
310  //! @note None
311  //! @return None
312  //! \par Override
313  //! Not allowed
314  //! @attention None
315  //--------------------------------------------------------------------------
316 
317  virtual VOID Error_On() = 0;
318 
319  //!-------------------------------------------------------------------------
320  //! @brief Method turns off the error LED
321  //! @note None
322  //! @return None
323  //! \par Override
324  //! Not allowed
325  //! @attention None
326  //--------------------------------------------------------------------------
327 
328  virtual VOID Error_Off() = 0;
329 
330  //!-------------------------------------------------------------------------
331  //! @brief Method toggle the error LED
332  //! @note None
333  //! @return None
334  //! \par Override
335  //! Not allowed
336  //! @attention None
337  //--------------------------------------------------------------------------
338 
339  virtual VOID Error_Toggle() = 0;
340 
341  //!-------------------------------------------------------------------------
342  //! @brief Method return alarm LED state
343  //! @note None
344  //! @return BOOL - Alarm LED state
345  //! @retval false - Alarm LED is off
346  //! @retval true - Alarm LED is on
347  //! \par Override
348  //! Not allowed
349  //! @attention None
350  //--------------------------------------------------------------------------
351 
352  virtual BOOL Get_Alarm_LED_State() = 0;
353 
354  //!-------------------------------------------------------------------------
355  //! @brief Method return run LED state
356  //! @note None
357  //! @return BOOL - Run LED state
358  //! @retval false - Run LED is off
359  //! @retval true - Run LED is on
360  //! \par Override
361  //! Not allowed
362  //! @attention None
363  //--------------------------------------------------------------------------
364 
365  virtual BOOL Get_Run_LED_State() = 0;
366 
367  //!-------------------------------------------------------------------------
368  //! @brief Method return ready LED state
369  //! @note None
370  //! @return BOOL - Ready LED state
371  //! @retval false - Ready LED is off
372  //! @retval true - Ready LED is on
373  //! \par Override
374  //! Not allowed
375  //! @attention None
376  //--------------------------------------------------------------------------
377 
378  virtual BOOL Get_Ready_LED_State() = 0;
379 
380  //!-------------------------------------------------------------------------
381  //! @brief Method return error LED state
382  //! @note None
383  //! @return BOOL - Error LED state
384  //! @retval false - Error LED is off
385  //! @retval true - Error LED is on
386  //! \par Override
387  //! Not allowed
388  //! @attention None
389  //--------------------------------------------------------------------------
390 
391  virtual BOOL Get_Error_LED_State() = 0;
392 
393  //--------------------------------------------------------------------------
394  // Protected variables
395  //--------------------------------------------------------------------------
396 
397  //! @brief Contains alarm LED operation mode
399 
400  //! @brief Contains run LED operation mode
402 
403  //! @brief Contains ready LED operation mode
405 
406  //! @brief Contains error LED operation mode
408 
409  //! @brief Contains delay counter for alarm LED
411 
412  //! @brief Contains delay counter for run LED
414 
415  //! @brief Contains delay counter for ready LED
417 
418  //! @brief Contains delay counter for error LED
420 
421  //----------------------------------------------------------------------------
422  // Private defines, methods and variables
423  //----------------------------------------------------------------------------
424 
425  private:
426 
427  //--------------------------------------------------------------------------
428  // Private methods
429  //--------------------------------------------------------------------------
430 
431  //!-------------------------------------------------------------------------
432  //! @brief Decode LED states methood
433  //! @note None
434  //! @return None
435  //! \par Override
436  //! Not allowed
437  //! @attention None
438  //--------------------------------------------------------------------------
439 
440  VOID Decode();
441 
442  //!-------------------------------------------------------------------------
443  //! @brief Process LED operation method
444  //! @note None
445  //! @return None
446  //! \par Override
447  //! Not allowed
448  //! @attention None
449  //--------------------------------------------------------------------------
450 
451  VOID Process();
452 
453  //--------------------------------------------------------------------------
454  // Private variables
455  //--------------------------------------------------------------------------
456 
457  //! @brief Decode LED counter
459 
460 };
461 
462 //------------------------------------------------------------------------------
463 // End Of File
464 //------------------------------------------------------------------------------
ConOpSys data type definitions header file.
int BOOL
Boolean datatype definition.
Definition: Defines.h:124
void VOID
Datatypesess datatype definition.
Definition: Defines.h:105
unsigned long U32
Binary 32-Bit unsigned integer datatype defenition.
Definition: Defines.h:203
Base LED manager class.
Definition: System_LED_Base.h:62
virtual VOID Run_On()=0
Method turns on the run LED.
virtual VOID Error_On()=0
Method turns on the error LED.
TLED_Mode enum_Ready_LED_Mode
Contains ready LED operation mode.
Definition: System_LED_Base.h:404
U32 u32_Ready_LED_Delay_Counter
Contains delay counter for ready LED.
Definition: System_LED_Base.h:416
virtual BOOL Get_Alarm_LED_State()=0
Method return alarm LED state.
VOID Init()
System LED base initialisation method.
Definition: System_LED_Base.cpp:96
virtual VOID Error_Toggle()=0
Method toggle the error LED.
virtual VOID Ready_On()=0
Method turns on the ready LED.
U32 u32_Error_LED_Delay_Counter
Contains delay counter for error LED.
Definition: System_LED_Base.h:419
virtual VOID Alarm_Off()=0
Method turns off the alarm LED.
U32 u32_Alarm_LED_Delay_Counter
Contains delay counter for alarm LED.
Definition: System_LED_Base.h:410
TLED_Mode
LED operating modes.
Definition: System_LED_Base.h:76
@ enum_Off
LED off.
Definition: System_LED_Base.h:79
@ enum_Flash_1_Hz
Blinking LED (1 Hz)
Definition: System_LED_Base.h:85
@ enum_Flash_4_Hz
Blinking LED (1 Hz)
Definition: System_LED_Base.h:88
@ enum_Flash_8_Hz
Blinking LED (8 Hz)
Definition: System_LED_Base.h:91
@ enum_On
LED on.
Definition: System_LED_Base.h:82
virtual VOID Ready_Toggle()=0
Method toggle the ready LED.
virtual BOOL Get_Ready_LED_State()=0
Method return ready LED state.
TLED_Mode enum_Alarm_LED_Mode
Contains alarm LED operation mode.
Definition: System_LED_Base.h:398
virtual VOID Alarm_Toggle()=0
Method toggle the alarm LED.
virtual VOID Run_Off()=0
Method turns off the run LED.
virtual VOID Error_Off()=0
Method turns off the error LED.
virtual VOID Alarm_On()=0
Method turns on the alarm LED.
U32 u32_Decode_Counter
Decode LED counter.
Definition: System_LED_Base.h:458
virtual VOID Run_Toggle()=0
Method toggle the run LED.
VOID Process()
Process LED operation method.
Definition: System_LED_Base.cpp:564
VOID Set_Ready_LED_Mode(TLED_Mode enum_New_Mode)
Set mode for ready LED.
Definition: System_LED_Base.cpp:1312
virtual BOOL Get_Error_LED_State()=0
Method return error LED state.
VOID Decode()
Decode LED states methood.
Definition: System_LED_Base.cpp:165
VOID Set_Alarm_LED_Mode(TLED_Mode enum_New_Mode)
Set mode for alarm LED.
Definition: System_LED_Base.cpp:1262
VOID Execute_1ms()
1 ms cyclic execution method
Definition: System_LED_Base.cpp:126
U32 u32_Run_LED_Delay_Counter
Contains delay counter for run LED.
Definition: System_LED_Base.h:413
BOOL bool_Start_Procesing
Definition: System_LED_Base.h:185
VOID Set_Error_LED_Mode(TLED_Mode enum_New_Mode)
Set mode for error LED.
Definition: System_LED_Base.cpp:1337
virtual VOID Ready_Off()=0
Method turns off the ready LED.
TLED_Mode enum_Error_LED_Mode
Contains error LED operation mode.
Definition: System_LED_Base.h:407
virtual BOOL Get_Run_LED_State()=0
Method return run LED state.
VOID Done()
System LED base finalisation method.
Definition: System_LED_Base.cpp:111
TLED_Mode enum_Run_LED_Mode
Contains run LED operation mode.
Definition: System_LED_Base.h:401
VOID Set_Run_LED_Mode(TLED_Mode enum_New_Mode)
Set mode for run LED.
Definition: System_LED_Base.cpp:1287