1 /*
2  * Copyright (c) 2023 HPMicro
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #ifndef HPM_ENC_POS_COMMON_H
9 #define HPM_ENC_POS_COMMON_H
10 
11 #include "hpm_common.h"
12 
13 /**
14  *
15  * @brief enc pos driver APIs
16  * @defgroup enc_pos_interface Encode Position driver APIs
17  * @ingroup io_interface
18  * @{
19  */
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 /**
26  * @brief caculate degree of angle from pos
27  *
28  * @param[in] pos position value
29  * @return degree of angle.
30  */
31 float encoder_position_to_deg(uint32_t pos);
32 
33 /**
34  * @brief caculate posistion from degree of angle
35  *
36  * @param[in] deg degree of angle
37  * @return position value.
38  */
39 uint32_t encoder_deg_to_position(float deg);
40 
41 /**
42  * @brief caculate radian of angle from pos
43  *
44  * @param[in] pos position value
45  * @return radian of angle.
46  */
47 float encoder_position_to_rad(uint32_t pos);
48 
49 /**
50  * @brief caculate posistion from radian of angle
51  *
52  * @param[in] rad radian of angle
53  * @return position value.
54  */
55 uint32_t encoder_rad_to_position(float rad);
56 
57 #ifdef __cplusplus
58 }
59 #endif
60 
61 /**
62  * @}
63  */
64 
65 #endif /* HPM_ENC_POS_COMMON_H */
66