FreeHIL
Loading...
Searching...
No Matches
FH_PWMI11.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_PWMI</b> (PWM Input), Peripheral <b>FH_PWMI11</b> (PWM Input 11)\n
6 * (The <b>PWMI11 (PWM Input 11)</b> could be any interested PWM Input 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 and read functions of the <b>PWM Input 11</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>PWM Input 11</b>\n
12 * The declaration of the read function of the <b>PWM Input 11</b>
13 *
14 * @attention There are a total number of <b>3 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_PWMI11 // It is configurable in FH_PWMI_Configs.h
46
47#if FH_PWMI_MaxPeripheralNumber > 0 // It is configurable in FH_DevicePeripherals.h
48
49/* Secondary Includes ------------------------------------------------------------------*/
53
54/**
55 * @brief This function initializes the <b>PWM Input 11</b>\n
56 * The <b>PWM Input 11</b> could be any interested PWM Input 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 PWM Input 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 ${PWMI11}
71 &{Message} = Create Dictionary DeviceAddress=${DeviceAddress_01} Function=${Function_PWMI} Command=${PWMI_Commands_Init} Data=@{MessageData}
72 ${Result} SendMessage &{Message}
73
74 Comments:
75
76 PWMI11 => It indicates the PWM Input 11
77 DeviceAddress_01 => It shall be equal to the address of the device: FH_RFCommunication_DeviceAddress
78 Function_PWMI => It is the function in the message frame
79 PWMI_Commands_Init => It is the command of the function in the message frame
80 @endverbatim
81 *
82 *
83 * @warning
84 * To be able to read the <b>PWM Input 11</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_PWMI_GetStatus_PWMI11</b> function from <b>RobotFramework</b>, this function shall be invoked in order to initialize the PWM Input
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 PWM Input 11 here)
95
96 // YourInitializationFunctionName ();
97
98 //
99
100 return fh_ErrorInfo;
101}
102
103/**
104 * @brief This function reads the <b>PWM Input 11</b>\n
105 * The <b>PWM Input 11</b> could be any interested PWM Input of the micro-controller on which <b>FH</b> source code is ported\n
106 * <b>FH</b> user should call the read function of the interested PWM Input here
107 *
108 * @param Data
109 * *Data will be set with the value of <b>PWM Input 11</b>\n
110 *
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 ${PWMI11}
122 &{Message} = Create Dictionary DeviceAddress=${DeviceAddress_01} Function=${Function_PWMI} Command=${PWMI_Commands_GetStatus} Data=@{MessageData}
123 ${Result} SendMessage &{Message}
124
125 Comments:
126
127 PWMI11 => It indicates the PWM Input 11
128 DeviceAddress_01 => It shall be equal to the address of the device: FH_RFCommunication_DeviceAddress
129 Function_PWMI => It is the function in the message frame
130 PWMI_Commands_GetStatus => It is the command of the function in the message frame
131 @endverbatim
132 *
133 *
134 * @warning
135 * To be able to read the <b>PWM Input 11</b> of the micro-controller on which <b>FH</b> source code is ported, the <b>FH_PWMI_Init_PWMI11</b> function shall be invoked once by <b>RobotFramework</b> firstly\n
136 * In other words, before invoking <b>FH_PWMI_GetStatus_PWMI11</b> function from <b>RobotFramework</b>, <b>FH_PWMI_Init_PWMI11</b> function shall be invoked in order to initialize the PWM Input
137 *
138
139*/
141{
142 FH_ErrorInfo fh_ErrorInfo; // Error Information
143 FH_ResetErrorInfo(&fh_ErrorInfo); // Reset Error Information to default
144
145 // Attention 3: FH user defined code (call the read function the PWM Input 11 here)
146 // Hint: The prototype of the get function should be something like YourGetFunctionName(uint32_t* Frequency, uint8_t* DutyCycle);
147 // Then *Frequency and *DutyCycle shall be set with the frequency and the duty cycle of the PWM input
148
149 //YourGetFunctionName(fh_Frequency,fh_DutyCycle);
150
151 //
152
153 return fh_ErrorInfo;
154}
155
156#endif
157
158#endif