FreeHIL
Loading...
Searching...
No Matches
FH_DO62.c
Go to the documentation of this file.
1/**
2 * @file
3 * @brief
4 * <b>File Map:</b>\n
5 * <b>FH_Functions</b>, Section <b>FH_DO</b> (Digital Output), Peripheral <b>FH_DO62</b> (Digital Output 62)\n
6 * (The <b>DO62 (Digital Output 62)</b> could be any interested digital output of the micro-controller on which <b>FH</b> source code is ported)\n
7 *
8 * @note To have a clean code, <b>FH</b> user should have the implementation of the initialization, set and reset functions of the <b>Digital Output 62</b> in a separate c file\n
9 * Then <b>FH</b> user should include the header file <b>(.h)</b> of the related source file <b>(.c)</b> here\n
10 * This header file shall include the following items:\n
11 * The declaration of the initialization function of the <b>Digital Output 62</b>\n
12 * The declaration of the set and reset functions of the <b>Digital Output 62</b>
13 *
14 * @attention There are a total number of <b>4 attentions</b> (<b>FH</b> user defined code) in this file where <b>FH</b> user shall insert some code\n
15 * Other parts could be left intact
16 *
17 *******************************************************************************
18 * SPDX-License-Identifier: Apache-2.0
19 *
20 * Copyright 2026 Vahid Hasirchi
21 *
22 * Licensed under the Apache License, Version 2.0 (the "License");
23 * you may not use this file except in compliance with the License.
24 * You may obtain a copy of the License at
25 *
26 * http://www.apache.org/licenses/LICENSE-2.0
27 *
28 * Unless required by applicable law or agreed to in writing, software
29 * distributed under the License is distributed on an "AS IS" BASIS,
30 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31 * See the License for the specific language governing permissions and
32 * limitations under the License.
33 ********************************************************************************
34
35 *
36 * <b>For more information refer to FreeHIL.com</b>
37 *
38*/
39/* Primary Includes ------------------------------------------------------------------*/
40// Attention 1: FH user defined code (include the mentioned header file here)
41
42//
44
45#ifdef FH_DO62 // It is configurable in FH_DO_Configs.h
46
47#if FH_DO_MaxPeripheralNumber > 0 // It is configurable in FH_DevicePeripherals.h
48
49/* Secondary Includes ------------------------------------------------------------------*/
53
54/**
55 * @brief This function initializes the <b>Digital Output 62</b>\n
56 * The <b>Digital Output 62</b> could be any interested digital output of the micro-controller on which <b>FH</b> source code is ported\n
57 * <b>FH</b> user should call the initialization function of the interested digital output here
58 *
59 * @param None
60 * @return FH_ErrorInfo is returned
61 *
62 * @note
63 * To have a clean code, just include the related header file\n
64 * Then just call the function here
65 *
66 * @verbatim
67 ==============================================================================
68 ##### RobotFramework Example #####
69 ==============================================================================
70 @{MessageData} = Create List ${DO62}
71 &{Message} = Create Dictionary DeviceAddress=${DeviceAddress_01} Function=${Function_DO} Command=${DO_Commands_Init} Data=@{MessageData}
72 ${Result} SendMessage &{Message}
73
74 Comments:
75
76 DO62 => It indicates the Digital Output 62
77 DeviceAddress_01 => It shall be equal to the address of the device: FH_RFCommunication_DeviceAddress
78 Function_DO => It is the function in the message frame
79 DO_Commands_Init => It is the command of the function in the message frame
80 @endverbatim
81 *
82 *
83 * @warning
84 * To be able to set or reset the <b>Digital Output 62</b> of the micro-controller on which <b>FH</b> source code is ported, this function shall be invoked once by <b>RobotFramework</b> firstly\n
85 * In other words, before invoking <b>FH_DO_SetStatus_DO62</b> function from <b>RobotFramework</b>, this function shall be invoked in order to initialize the digital output
86 *
87
88*/
90{
91 FH_ErrorInfo fh_ErrorInfo; // Error Information
92 FH_ResetErrorInfo(&fh_ErrorInfo); // Reset Error Information to default
93
94 // Attention 2: FH user defined code (call the initialization function of the Digital Output 62 here)
95
96 // YourInitializationFunctionName ();
97
98 //
99
100 return fh_ErrorInfo;
101}
102
103/**
104 * @brief This function sets or resets the <b>Digital Output 62</b>\n
105 * The <b>Digital Output 62</b> could be any interested digital output of the micro-controller on which <b>FH</b> source code is ported\n
106 * <b>FH</b> user should call the set and reset functions of the interested digital output here
107 *
108 * @param Status
109 * If Status is 1, the set function of the <b>Digital Output 62</b> shall be called\n
110 * If Status is 0, the reset function of the <b>Digital Output 62</b> shall be called
111 * @return FH_ErrorInfo is returned
112 *
113 * @note
114 * To have a clean code, just include the related header file\n
115 * Then just call the function here
116 *
117 * @verbatim
118 ==============================================================================
119 ##### RobotFramework Example #####
120 ==============================================================================
121 @{MessageData} = Create List ${DO62} ${DO_Set}
122 &{Message} = Create Dictionary DeviceAddress=${DeviceAddress_01} Function=${Function_DO} Command=${DO_Commands_SetStatus} Data=@{MessageData}
123 ${Result} SendMessage &{Message}
124
125 Comments:
126
127 DO62 => It indicates the Digital Output 62
128 DO_Set => It indicates the Digital Output 62 shall be Set (DO_Reset indicates the Digital Output 62 shall be Reset)
129 DeviceAddress_01 => It shall be equal to the address of the device: FH_RFCommunication_DeviceAddress
130 Function_DO => It is the function in the message frame
131 DO_Commands_SetStatus => It is the command of the function in the message frame
132 @endverbatim
133 *
134 *
135 * @warning
136 * To be able to set or reset the <b>Digital Output 62</b> of the micro-controller on which <b>FH</b> source code is ported, the <b>FH_DO_Init_DO62</b> function shall be invoked once by <b>RobotFramework</b> firstly\n
137 * In other words, before invoking <b>FH_DO_SetStatus_DO62</b> function from <b>RobotFramework</b>, <b>FH_DO_Init_DO62</b> function shall be invoked in order to initialize the digital output
138 *
139
140*/
142{
143 FH_ErrorInfo fh_ErrorInfo; // Error Information
144 FH_ResetErrorInfo(&fh_ErrorInfo); // Reset Error Information to default
145
146 if (Status == 1) // If Status is 1, the set function of the Digital Output 62 shall be called
147 {
148 // Attention 3: FH user defined code (call the set function the Digital Output 62 here)
149
150 // YourSetFunctionName();
151
152 //
153 }
154 else if (Status == 0) // If Status is 0, the reset function of the Digital Output 62 shall be called
155 {
156 // Attention 4: FH user defined code (call the reset function the Digital Output 62 here)
157
158 // YourResetFunctionName();
159
160 //
161 }
162 else
163 {
164 fh_ErrorInfo.error_code = FH_ERROR_MessageFrame;
165 }
166
167 return fh_ErrorInfo;
168}
169
170#endif
171
172#endif