• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  * Copyright (c) 2022 Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK")
3  * All rights reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *****************************************************************************/
18 #ifndef DRIVERS_CMPT_H_
19 #define DRIVERS_CMPT_H_
20 #include "../gpio.h"
21 #include "../stimer.h"
22 
23 /**********************************************************************************************************************
24  *                                         global constants                                                           *
25  *********************************************************************************************************************/
26 
27 /**********************************************************************************************************************
28  *                                           global macro                                                             *
29  *********************************************************************************************************************/
30 
31 /**********************************************************************************************************************
32  *                                         global data type                                                           *
33  *********************************************************************************************************************/
34 
35 /**********************************************************************************************************************
36  *                                     global variable declaration                                                    *
37  *********************************************************************************************************************/
38 
39 /**********************************************************************************************************************
40  *                                      global function prototype                                                     *
41  *********************************************************************************************************************/
42 
43 /**********************************************************************************************************************
44  *                                     gpio  compatibility                                                  		  *
45  *********************************************************************************************************************/
46 
47 /**
48  * @brief     This function set the pin's output level.
49  * @param[in] pin - the pin needs to set its output level
50  * @param[in] value - value of the output level(1: high 0: low)
51  * @author	  BLE group .
52  * @return    none
53  */
54 #define gpio_write(pin, value) gpio_set_level(pin, value)
55 
56 /**
57  * @brief      This function enable the output function of a pin.
58  * @param[in]  pin - the pin needs to set the output function(1: enable,0: disable)
59  * @author	   BLE group .
60  * @return     none
61  */
62 #define gpio_set_output_en(pin, value) gpio_set_output(pin, value)
63 
64 /**
65  * @brief     This function read the pin's input/output level.
66  * @param[in] pin - the pin needs to read its level
67  * @author	  BLE group .
68  * @return    the pin's level(1: high 0: low)
69  */
70 #define gpio_read(pin) gpio_get_level(pin)
71 
72 /**
73  * @brief      This function servers to enable gpio function.
74  * @param[in]  pin - the selected pin.
75  * @author	   BLE group .
76  * @return     none
77  */
78 #define gpio_set_gpio_en(pin) gpio_function_en(pin)
79 
80 /**
81  * @brief      This function set the input function of a pin.
82  * @param[in]  pin - the pin needs to set the input function
83  * @param[in]  value - enable or disable the pin's input function(1: enable,0: disable )
84  * @author	   BLE group .
85  * @return     none
86  */
87 #define gpio_set_input_en(pin, value) gpio_set_input(pin, value)
88 
89 /**********************************************************************************************************************
90  *                                     stimer  compatibility                                                  		  *
91  *********************************************************************************************************************/
92 
93 /*
94  * @brief     This function performs to get system timer tick.
95  * @return    system timer tick value.
96  * @author	  BLE group .
97  */
98 #define clock_time stimer_get_tick
99 
100 #endif
101