ConOpSys V2970  P004.07
ANVILEX control operating system
RTC_STM32F410CBU6.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file RTC_STM32F410CBU6.h
3 //! @brief STM32F410CBU6 on-chip RTC module 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/Targets/STM32F410CBU6/RTC_STM32F410CBU6.h $
7 //! $Revision: 2278 $
8 //! $Date: 2020-12-12 05:47:21 +0500 (Sa, 12 Dez 2020) $
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 //------------------------------------------------------------------------------
41 // Protecting header files from mutual, recursive inclusion.
42 //------------------------------------------------------------------------------
43 
44 #pragma once
45 
46 //------------------------------------------------------------------------------
47 // Include standard libraries header files
48 //------------------------------------------------------------------------------
49 
50 //------------------------------------------------------------------------------
51 // Include thrid party header files
52 //------------------------------------------------------------------------------
53 
54 //------------------------------------------------------------------------------
55 // Include ConOpSys header files
56 //------------------------------------------------------------------------------
57 
58 #include "System_Date.h"
59 #include "Protocol_Base.h"
60 
61 //------------------------------------------------------------------------------
62 // Include ConOpSys application header files
63 //------------------------------------------------------------------------------
64 
65 //------------------------------------------------------------------------------
66 // Class definitions
67 //------------------------------------------------------------------------------
68 
69 //! @brief STM32F410CBU6 RTC class
71 {
72 
73  //----------------------------------------------------------------------------
74  // Public defines, methods and variables
75  //----------------------------------------------------------------------------
76 
77  public:
78 
79  //--------------------------------------------------------------------------
80  // Public methods
81  //--------------------------------------------------------------------------
82 
83  //!-------------------------------------------------------------------------
84  //! @brief Class constructor method.
85  //! @note None
86  //! \par Override
87  //! Not allowed
88  //! @attention Don't call this method directly.
89  //--------------------------------------------------------------------------
90 
92 
93  //!-------------------------------------------------------------------------
94  //! @brief Class destructor method.
95  //! @note None
96  //! \par Override
97  //! Not allowed
98  //! @attention Don't call this method directly.
99  //--------------------------------------------------------------------------
100 
102 
103  //!-------------------------------------------------------------------------
104  //! @brief RTC initialisation method.
105  //! @note None
106  //! @return None
107  //! \par Override
108  //! Not allowed
109  //! @attention None
110  //--------------------------------------------------------------------------
111 
112  VOID Init();
113 
114  //!-------------------------------------------------------------------------
115  //! @brief RTC finalisation method.
116  //! @note None
117  //! @return None
118  //! \par Override
119  //! Not allowed
120  //! @attention None
121  //--------------------------------------------------------------------------
122 
123  VOID Done();
124 
125  //!-------------------------------------------------------------------------
126  //! @brief RTC 1ms cyclic processing method.
127  //! @note None
128  //! @return None
129  //! \par Override
130  //! Not allowed
131  //! @attention None
132  //--------------------------------------------------------------------------
133 
134  VOID Execute_1ms();
135 
136  //!-------------------------------------------------------------------------
137  //! @brief RTC background cyclic processing method.
138  //! @note None
139  //! @return None
140  //! \par Override
141  //! Not allowed
142  //! @attention None
143  //--------------------------------------------------------------------------
144 
146 
147  // Control methods
148  VOID Set_DateTime( TDateTime::TDateTime_Structure *object_DateTime );
149  VOID Get_DateTime( TDateTime::TDateTime_Structure *object_DateTime );
150 
151  VOID Set_Hardware_RTC( TDateTime::TDateTime_Structure *object_DateTime );
152  BOOL Get_Hardware_RTC( TDateTime::TDateTime_Structure *object_DateTime );
153  BOOL Get_Hardware_RTC( TDateTime *object_DateTime );
154 
155  VOID Set_Software_RTC( TDateTime::TDateTime_Structure *object_DateTime );
156  VOID Get_Software_RTC( TDateTime::TDateTime_Structure *object_DateTime );
157 
161 
162  U64 RND( TDateTime::TDateTime_Structure *object_DateTime );
163  U64 RND( U32 y, U32 m, U32 d );
164 
165  //!-------------------------------------------------------------------------
166  //! @brief Synchronise virtual RTC method.
167  //! @note None
168  //! @return None
169  //! \par Override
170  //! Not allowed
171  //! @attention None
172  //--------------------------------------------------------------------------
173 
175 
176  //!-------------------------------------------------------------------------
177  //! @brief Send information about RTC hardware driver over communication link protocol
178  //! @note This method sends information about RTC hardware driver over specified communication link protocol.
179  //! @param [in] *object_Protocol - Pointer to the communication link protocol
180  //! @return None
181  //! \par Override
182  //! Not allowed
183  //! @attention None
184  //--------------------------------------------------------------------------
185 
186  VOID Send_Information( TProtocol_Base *object_Protocol );
187 
188  //----------------------------------------------------------------------------
189  // Protected defines, methods and variables
190  //----------------------------------------------------------------------------
191 
192  protected:
193 
194  //----------------------------------------------------------------------------
195  // Private defines, methods and variables
196  //----------------------------------------------------------------------------
197 
198  private:
199 
200  //--------------------------------------------------------------------------
201  // Private methods
202  //--------------------------------------------------------------------------
203 
204  //!-------------------------------------------------------------------------
205  //! @brief Increment hardware RTC read data ready error counter method.
206  //! @note None
207  //! @return None
208  //! \par Override
209  //! Not allowed
210  //! @attention None
211  //--------------------------------------------------------------------------
212 
214 
215  //!-------------------------------------------------------------------------
216  //! @brief Take runtime date ant time snapshoot method.
217  //! @note None
218  //! @return None
219  //! \par Override
220  //! Not allowed
221  //! @attention None
222  //--------------------------------------------------------------------------
223 
225 
226  //!-------------------------------------------------------------------------
227  //! @brief Recall last runtime date and time snapshoot method.
228  //! @note None
229  //! @return None
230  //! \par Override
231  //! Not allowed
232  //! @attention None
233  //--------------------------------------------------------------------------
234 
236 
237  //!-------------------------------------------------------------------------
238  //! @brief Take system startup date and time snapshoot method.
239  //! @note None
240  //! @return None
241  //! \par Override
242  //! Not allowed
243  //! @attention None
244  //--------------------------------------------------------------------------
245 
247 
248  //!-------------------------------------------------------------------------
249  //! @brief Debug method.
250  //! @note None
251  //! @return None
252  //! \par Override
253  //! Not allowed
254  //! @attention None
255  //--------------------------------------------------------------------------
256 
257  U64 RND();
258 
259  //--------------------------------------------------------------------------
260  // Private variables
261  //--------------------------------------------------------------------------
262 
263  //! @brief Virtual software RTC
265 
266  //! @brief System startup data and time snapshoot
268 
269  //! @brief Last runtime data and time snapshoot
271 
272  //! @brief Actual runtime data and time snapshoot
274 
275  //! @brief Virtual RTC synchronisation request
277 
278  //! @brief Software RTC update locked
280 
281  //! @brief RTC initialisation error flag
283 
284  //! @brief Hardware RTC data lost error flag
286 
287  //! @brief RTC data read ready error counter
289 
290 };
291 
292 //------------------------------------------------------------------------------
293 // End Of File
294 //------------------------------------------------------------------------------
int BOOL
Boolean datatype definition.
Definition: Defines.h:124
unsigned long long U64
Binary 64-Bit unsigned integer datatype defenition.
Definition: Defines.h:213
void VOID
Datatypesess datatype definition.
Definition: Defines.h:105
unsigned long U32
Binary 32-Bit unsigned integer datatype defenition.
Definition: Defines.h:203
Communication protocol base class header file.
System date and time calss implementation.
Definition: Protocol_Base.h:57
STM32F410CBU6 RTC class.
Definition: RTC_STM32F410CBU6.h:71
VOID Send_Information(TProtocol_Base *object_Protocol)
Send information about RTC hardware driver over communication link protocol.
Definition: RTC_STM32F410CBU6.cpp:666
VOID Sync_Virtual_RTC()
Synchronise virtual RTC method.
Definition: RTC_STM32F410CBU6.cpp:588
BOOL bool_Vitrual_RTC_Sync_Request
Virtual RTC synchronisation request.
Definition: RTC_STM32F410CBU6.h:276
VOID Execute_Background()
RTC background cyclic processing method.
Definition: RTC_STM32F410CBU6.cpp:645
TRTC_STM32F410CBU6()
Class constructor method.
Definition: RTC_STM32F410CBU6.cpp:68
TDateTime object_Software_RTC_DateTime
Virtual software RTC.
Definition: RTC_STM32F410CBU6.h:264
VOID Done()
RTC finalisation method.
Definition: RTC_STM32F410CBU6.cpp:190
U64 Get_Last_System_Shootdown_Duration_in_s()
Definition: RTC_STM32F410CBU6.cpp:551
U64 u64_Actual_Runtime_Snapshoot
Actual runtime data and time snapshoot.
Definition: RTC_STM32F410CBU6.h:273
~TRTC_STM32F410CBU6()
Class destructor method.
Definition: RTC_STM32F410CBU6.cpp:83
U64 RND()
Debug method.
VOID Get_DateTime(TDateTime::TDateTime_Structure *object_DateTime)
Definition: RTC_STM32F410CBU6.cpp:216
BOOL Get_Hardware_RTC(TDateTime::TDateTime_Structure *object_DateTime)
Definition: RTC_STM32F410CBU6.cpp:309
VOID Set_Hardware_RTC(TDateTime::TDateTime_Structure *object_DateTime)
Definition: RTC_STM32F410CBU6.cpp:238
U64 Get_Last_System_Shootdown_Duration_in_ms()
Definition: RTC_STM32F410CBU6.cpp:528
VOID Take_Startup_Snapshoot()
Take system startup date and time snapshoot method.
Definition: RTC_STM32F410CBU6.cpp:849
VOID Recall_Runtime_Snapshoot()
Recall last runtime date and time snapshoot method.
Definition: RTC_STM32F410CBU6.cpp:817
VOID Execute_1ms()
RTC 1ms cyclic processing method.
Definition: RTC_STM32F410CBU6.cpp:615
VOID Take_Runtime_Snapshoot()
Take runtime date ant time snapshoot method.
Definition: RTC_STM32F410CBU6.cpp:765
U64 RND(U32 y, U32 m, U32 d)
BOOL bool_Software_RTC_Update_Locked
Software RTC update locked.
Definition: RTC_STM32F410CBU6.h:279
VOID Init()
RTC initialisation method.
Definition: RTC_STM32F410CBU6.cpp:91
U64 Get_Actual_System_Runtime_Duration_in_ms()
Definition: RTC_STM32F410CBU6.cpp:566
BOOL bool_Hardware_RTC_Data_Lost_Error
Hardware RTC data lost error flag.
Definition: RTC_STM32F410CBU6.h:285
BOOL bool_Initialisation_Error
RTC initialisation error flag.
Definition: RTC_STM32F410CBU6.h:282
VOID Get_Software_RTC(TDateTime::TDateTime_Structure *object_DateTime)
Definition: RTC_STM32F410CBU6.cpp:510
VOID Set_Software_RTC(TDateTime::TDateTime_Structure *object_DateTime)
Definition: RTC_STM32F410CBU6.cpp:492
VOID Set_DateTime(TDateTime::TDateTime_Structure *object_DateTime)
Definition: RTC_STM32F410CBU6.cpp:201
U64 u64_Startup_Snapshoot
System startup data and time snapshoot.
Definition: RTC_STM32F410CBU6.h:267
U32 u32_RTC_Data_Read_Ready_Error_Counter
RTC data read ready error counter.
Definition: RTC_STM32F410CBU6.h:288
U64 u64_Last_Runtime_Snapshoot
Last runtime data and time snapshoot.
Definition: RTC_STM32F410CBU6.h:270
VOID Increment_RTC_Data_Read_Ready_Error_Counter()
Increment hardware RTC read data ready error counter method.
Definition: RTC_STM32F410CBU6.cpp:744