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 19 /******************************************************************************************************** 20 * @file cmpt.h 21 * 22 * @brief This is the header file for B91 23 * 24 * @author Driver Group 25 * 26 *******************************************************************************************************/ 27 #ifndef DRIVERS_CMPT_H_ 28 #define DRIVERS_CMPT_H_ 29 #include "../gpio.h" 30 #include "../stimer.h" 31 32 /********************************************************************************************************************** 33 * global constants * 34 *********************************************************************************************************************/ 35 36 /********************************************************************************************************************** 37 * global macro * 38 *********************************************************************************************************************/ 39 40 41 /********************************************************************************************************************** 42 * global data type * 43 *********************************************************************************************************************/ 44 45 /********************************************************************************************************************** 46 * global variable declaration * 47 *********************************************************************************************************************/ 48 49 /********************************************************************************************************************** 50 * global function prototype * 51 *********************************************************************************************************************/ 52 53 54 /********************************************************************************************************************** 55 * gpio compatibility * 56 *********************************************************************************************************************/ 57 58 /** 59 * @brief This function set the pin's output level. 60 * @param[in] pin - the pin needs to set its output level 61 * @param[in] value - value of the output level(1: high 0: low) 62 * @author BLE group . 63 * @return none 64 */ 65 #define gpio_write(pin,value) gpio_set_level(pin,value) 66 67 68 /** 69 * @brief This function enable the output function of a pin. 70 * @param[in] pin - the pin needs to set the output function(1: enable,0: disable) 71 * @author BLE group . 72 * @return none 73 */ 74 #define gpio_set_output_en(pin,value) gpio_set_output(pin,value) 75 76 77 /** 78 * @brief This function read the pin's input/output level. 79 * @param[in] pin - the pin needs to read its level 80 * @author BLE group . 81 * @return the pin's level(1: high 0: low) 82 */ 83 #define gpio_read(pin) gpio_get_level(pin) 84 85 86 /** 87 * @brief This function servers to enable gpio function. 88 * @param[in] pin - the selected pin. 89 * @author BLE group . 90 * @return none 91 */ 92 #define gpio_set_gpio_en(pin) gpio_function_en(pin) 93 94 /** 95 * @brief This function set the input function of a pin. 96 * @param[in] pin - the pin needs to set the input function 97 * @param[in] value - enable or disable the pin's input function(1: enable,0: disable ) 98 * @author BLE group . 99 * @return none 100 */ 101 #define gpio_set_input_en(pin,value) gpio_set_input (pin,value) 102 103 104 /********************************************************************************************************************** 105 * stimer compatibility * 106 *********************************************************************************************************************/ 107 108 /* 109 * @brief This function performs to get system timer tick. 110 * @return system timer tick value. 111 * @author BLE group . 112 */ 113 #define clock_time stimer_get_tick 114 115 116 #endif 117