FreeHIL
Loading...
Searching...
No Matches
FH_GeneralFunctions.h
Go to the documentation of this file.
1/**
2 * @file
3 * @brief
4 * <b>File Map:</b>\n
5 * <b>FH_Root</b>, Section <b>FH_General</b>, <b>FH_GeneralFunctions</b> \n
6 * All different possible general defines, unions, structures , ... utilized in different parts of the code, go here\n
7 *
8 *******************************************************************************
9 * SPDX-License-Identifier: Apache-2.0
10 *
11 * Copyright 2026 Vahid Hasirchi
12 *
13 * Licensed under the Apache License, Version 2.0 (the "License");
14 * you may not use this file except in compliance with the License.
15 * You may obtain a copy of the License at
16 *
17 * http://www.apache.org/licenses/LICENSE-2.0
18 *
19 * Unless required by applicable law or agreed to in writing, software
20 * distributed under the License is distributed on an "AS IS" BASIS,
21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 * See the License for the specific language governing permissions and
23 * limitations under the License.
24 ********************************************************************************
25
26 *
27 * <b>For more information refer to FreeHIL.com</b>
28 *
29*/
30/* Define to prevent recursive inclusion -------------------------------------*/
31#ifndef FH_GeneralFunctions_H
32#define FH_GeneralFunctions_H
33
34/* Includes ------------------------------------------------------------------*/
35#include "stdint.h"
36
37/*!
38 Null pointer to initialize different pointers in different parts of the code, if need be\n
39*/
40#define NULL_PTR ((void*)0)
41
42/*!
43 Union to convert two 8 bits data (uint8_t) to one 16 bits data (uint16_t) and vice verse
44*/
45typedef union
46{
47 /*!
48 Two 8 bits data (uint8_t)
49 */
50 uint8_t bytes[2];
51 /*!
52 One 16 bits data (uint16_t)
53 */
54 uint16_t value;
56
57/*!
58 Union to convert four 8 bits data (uint8_t) to one 32 bits data (uint32_t) and vice verse
59*/
60typedef union
61{
62 /*!
63 Four 8 bits data (uint8_t)
64 */
65 uint8_t bytes[4];
66 /*!
67 One 32 bits data (uint32_t)
68 */
69 uint32_t value;
71
72/* Function Prototypes -----------------------------------------------------*/
73uint16_t FH_ConvertUint8ToUint16(uint8_t* fh_Uint8);
74uint32_t FH_ConvertUint8ToUint32(uint8_t* fh_Uint8);
75
76#endif // FH_GeneralFunctions_H