1 /** 2 * @file hi_io.h 3 * 4 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 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 * @defgroup iot_io IO 20 * @ingroup drivers 21 */ 22 23 #ifndef __HI_IO_H__ 24 #define __HI_IO_H__ 25 26 #include <hi_types_base.h> 27 28 /** 29 * @ingroup iot_io 30 * 31 * GPIO pin ID. CNcomment:IO硬件管脚编号。CNend 32 */ 33 typedef enum { 34 HI_IO_NAME_GPIO_0, /**< GPIO0 */ 35 HI_IO_NAME_GPIO_1, /**< GPIO1 */ 36 HI_IO_NAME_GPIO_2, /**< GPIO2 */ 37 HI_IO_NAME_GPIO_3, /**< GPIO3 */ 38 HI_IO_NAME_GPIO_4, /**< GPIO4 */ 39 HI_IO_NAME_GPIO_5, /**< GPIO5 */ 40 HI_IO_NAME_GPIO_6, /**< GPIO6 */ 41 HI_IO_NAME_GPIO_7, /**< GPIO7 */ 42 HI_IO_NAME_GPIO_8, /**< GPIO8 */ 43 HI_IO_NAME_GPIO_9, /**< GPIO9 */ 44 HI_IO_NAME_GPIO_10, /**< GPIO10 */ 45 HI_IO_NAME_GPIO_11, /**< GPIO11 */ 46 HI_IO_NAME_GPIO_12, /**< GPIO12 */ 47 HI_IO_NAME_GPIO_13, /**< GPIO13 */ 48 HI_IO_NAME_GPIO_14, /**< GPIO14 */ 49 HI_IO_NAME_SFC_CSN, /**< SFC_CSN */ 50 HI_IO_NAME_SFC_IO1, /**< SFC_IO1 */ 51 HI_IO_NAME_SFC_IO2, /**< SFC_IO2 */ 52 HI_IO_NAME_SFC_IO0, /**< SFC_IO0 */ 53 HI_IO_NAME_SFC_CLK, /**< SFC_CLK */ 54 HI_IO_NAME_SFC_IO3, /**< SFC_IO3 */ 55 HI_IO_NAME_MAX, 56 } hi_io_name; 57 58 /** 59 * @ingroup iot_io 60 * 61 * GPIO_0 pin function.CNcomment:GPIO_0管脚功能。CNend 62 */ 63 typedef enum { 64 HI_IO_FUNC_GPIO_0_GPIO, 65 HI_IO_FUNC_GPIO_0_UART1_TXD = 2, 66 HI_IO_FUNC_GPIO_0_SPI1_CK, 67 HI_IO_FUNC_GPIO_0_JTAG_TDO, 68 HI_IO_FUNC_GPIO_0_PWM3_OUT, 69 HI_IO_FUNC_GPIO_0_I2C1_SDA, 70 } hi_io_func_gpio_0; 71 72 /** 73 * @ingroup iot_io 74 * 75 * GPIO_1 pin function.CNcomment:GPIO_1管脚功能。CNend 76 */ 77 typedef enum { 78 HI_IO_FUNC_GPIO_1_GPIO, 79 HI_IO_FUNC_GPIO_1_UART1_RXD = 2, 80 HI_IO_FUNC_GPIO_1_SPI1_RXD, 81 HI_IO_FUNC_GPIO_1_JTAG_TCK, 82 HI_IO_FUNC_GPIO_1_PWM4_OUT, 83 HI_IO_FUNC_GPIO_1_I2C1_SCL, 84 HI_IO_FUNC_GPIO_1_BT_FREQ, 85 } hi_io_func_gpio_1; 86 87 /** 88 * @ingroup iot_io 89 * 90 * GPIO_2 pin function.CNcomment:GPIO_2管脚功能。CNend 91 */ 92 typedef enum { 93 HI_IO_FUNC_GPIO_2_GPIO, 94 HI_IO_FUNC_GPIO_2_UART1_RTS_N = 2, 95 HI_IO_FUNC_GPIO_2_SPI1_TXD, 96 HI_IO_FUNC_GPIO_2_JTAG_TRSTN, 97 HI_IO_FUNC_GPIO_2_PWM2_OUT, 98 HI_IO_FUNC_GPIO_2_SSI_CLK = 7, 99 } hi_io_func_gpio_2; 100 101 /** 102 * @ingroup iot_io 103 * 104 * GPIO_3 pin function.CNcomment:GPIO_3管脚功能。CNend 105 */ 106 typedef enum { 107 HI_IO_FUNC_GPIO_3_GPIO, 108 HI_IO_FUNC_GPIO_3_UART0_TXD, 109 HI_IO_FUNC_GPIO_3_UART1_CTS_N, 110 HI_IO_FUNC_GPIO_3_SPI1_CSN, 111 HI_IO_FUNC_GPIO_3_JTAG_TDI, 112 HI_IO_FUNC_GPIO_3_PWM5_OUT, 113 HI_IO_FUNC_GPIO_3_I2C1_SDA, 114 HI_IO_FUNC_GPIO_3_SSI_DATA, 115 } hi_io_func_gpio_3; 116 117 /** 118 * @ingroup iot_io 119 * 120 * GPIO_4 pin function.CNcomment:GPIO_4管脚功能。CNend 121 */ 122 typedef enum { 123 HI_IO_FUNC_GPIO_4_GPIO, 124 HI_IO_FUNC_GPIO_4_UART0_RXD = 2, 125 HI_IO_FUNC_GPIO_4_JTAG_TMS = 4, 126 HI_IO_FUNC_GPIO_4_PWM1_OUT, 127 HI_IO_FUNC_GPIO_4_I2C1_SCL, 128 } hi_io_func_gpio_4; 129 130 /** 131 * @ingroup iot_io 132 * 133 * GPIO_5 pin function.CNcomment:GPIO_5管脚功能。CNend 134 */ 135 typedef enum { 136 HI_IO_FUNC_GPIO_5_GPIO, 137 HI_IO_FUNC_GPIO_5_UART1_RXD = 2, 138 HI_IO_FUNC_GPIO_5_SPI0_CSN, 139 HI_IO_FUNC_GPIO_5_PWM2_OUT = 5, 140 HI_IO_FUNC_GPIO_5_I2S0_MCLK, 141 HI_IO_FUNC_GPIO_5_BT_STATUS, 142 } hi_io_func_gpio_5; 143 144 /** 145 * @ingroup iot_io 146 * 147 * GPIO_6 pin function.CNcomment:GPIO_6管脚功能。CNend 148 */ 149 typedef enum { 150 HI_IO_FUNC_GPIO_6_GPIO, 151 HI_IO_FUNC_GPIO_6_UART1_TXD = 2, 152 HI_IO_FUNC_GPIO_6_SPI0_CK, 153 HI_IO_FUNC_GPIO_6_PWM3_OUT = 5, 154 HI_IO_FUNC_GPIO_6_I2S0_TX, 155 HI_IO_FUNC_GPIO_6_COEX_SWITCH, 156 } hi_io_func_gpio_6; 157 158 /** 159 * @ingroup iot_io 160 * 161 * GPIO_7 pin function.CNcomment:GPIO_7管脚功能。CNend 162 */ 163 typedef enum { 164 HI_IO_FUNC_GPIO_7_GPIO, 165 HI_IO_FUNC_GPIO_7_UART1_CTS_N = 2, 166 HI_IO_FUNC_GPIO_7_SPI0_RXD, 167 HI_IO_FUNC_GPIO_7_PWM0_OUT = 5, 168 HI_IO_FUNC_GPIO_7_I2S0_BCLK, 169 HI_IO_FUNC_GPIO_7_BT_ACTIVE, 170 } hi_io_func_gpio_7; 171 172 /** 173 * @ingroup iot_io 174 * 175 * GPIO_8 pin function.CNcomment:GPIO_8管脚功能。CNend 176 */ 177 typedef enum { 178 HI_IO_FUNC_GPIO_8_GPIO, 179 HI_IO_FUNC_GPIO_8_UART1_RTS_N = 2, 180 HI_IO_FUNC_GPIO_8_SPI0_TXD, 181 HI_IO_FUNC_GPIO_8_PWM1_OUT = 5, 182 HI_IO_FUNC_GPIO_8_I2S0_WS, 183 HI_IO_FUNC_GPIO_8_WLAN_ACTIVE, 184 } hi_io_func_gpio_8; 185 186 /** 187 * @ingroup iot_io 188 * 189 * GPIO_9 pin function.CNcomment:GPIO_9管脚功能。CNend 190 */ 191 typedef enum { 192 HI_IO_FUNC_GPIO_9_GPIO, 193 HI_IO_FUNC_GPIO_9_I2C0_SCL, 194 HI_IO_FUNC_GPIO_9_UART2_RTS_N, 195 HI_IO_FUNC_GPIO_9_SDIO_D2, 196 HI_IO_FUNC_GPIO_9_SPI0_TXD, 197 HI_IO_FUNC_GPIO_9_PWM0_OUT, 198 HI_IO_FUNC_GPIO_9_I2S0_MCLK = 7, 199 } hi_io_func_gpio_9; 200 201 /** 202 * @ingroup iot_io 203 * 204 * GPIO_10 pin function.CNcomment:GPIO_10管脚功能。CNend 205 */ 206 typedef enum { 207 HI_IO_FUNC_GPIO_10_GPIO, 208 HI_IO_FUNC_GPIO_10_I2C0_SDA, 209 HI_IO_FUNC_GPIO_10_UART2_CTS_N, 210 HI_IO_FUNC_GPIO_10_SDIO_D3, 211 HI_IO_FUNC_GPIO_10_SPI0_CK, 212 HI_IO_FUNC_GPIO_10_PWM1_OUT, 213 HI_IO_FUNC_GPIO_10_I2S0_TX = 7, 214 } hi_io_func_gpio_10; 215 216 /** 217 * @ingroup iot_io 218 * 219 * GPIO_11 pin function.CNcomment:GPIO_11管脚功能。CNend 220 */ 221 typedef enum { 222 HI_IO_FUNC_GPIO_11_GPIO, 223 HI_IO_FUNC_GPIO_11_UART2_TXD = 2, 224 HI_IO_FUNC_GPIO_11_SDIO_CMD, 225 HI_IO_FUNC_GPIO_11_SPI0_RXD, 226 HI_IO_FUNC_GPIO_11_PWM2_OUT, 227 HI_IO_FUNC_GPIO_11_RF_TX_EN_EXT, 228 HI_IO_FUNC_GPIO_11_I2S0_RX, 229 } hi_io_func_gpio_11; 230 231 /** 232 * @ingroup iot_io 233 * 234 * GPIO_12 pin function.CNcomment:GPIO_12管脚功能。CNend 235 */ 236 typedef enum { 237 HI_IO_FUNC_GPIO_12_GPIO, 238 HI_IO_FUNC_GPIO_12_UART2_RXD = 2, 239 HI_IO_FUNC_GPIO_12_SDIO_CLK, 240 HI_IO_FUNC_GPIO_12_SPI0_CSN, 241 HI_IO_FUNC_GPIO_12_PWM3_OUT, 242 HI_IO_FUNC_GPIO_12_RF_RX_EN_EXT, 243 HI_IO_FUNC_GPIO_12_I2S0_BCLK, 244 } hi_io_func_gpio_12; 245 246 /** 247 * @ingroup iot_io 248 * 249 * GPIO_13 pin function.CNcomment:GPIO_13管脚功能。CNend 250 */ 251 typedef enum { 252 HI_IO_FUNC_GPIO_13_SSI_DATA, 253 HI_IO_FUNC_GPIO_13_UART0_TXD, 254 HI_IO_FUNC_GPIO_13_UART2_RTS_N, 255 HI_IO_FUNC_GPIO_13_SDIO_D0, 256 HI_IO_FUNC_GPIO_13_GPIO, 257 HI_IO_FUNC_GPIO_13_PWM4_OUT, 258 HI_IO_FUNC_GPIO_13_I2C0_SDA, 259 HI_IO_FUNC_GPIO_13_I2S0_WS, 260 } hi_io_func_gpio_13; 261 262 /** 263 * @ingroup iot_io 264 * 265 * GPIO_14 pin function.CNcomment:GPIO_14管脚功能。CNend 266 */ 267 typedef enum { 268 HI_IO_FUNC_GPIO_14_SSI_CLK, 269 HI_IO_FUNC_GPIO_14_UART0_RXD, 270 HI_IO_FUNC_GPIO_14_UART2_CTS_N, 271 HI_IO_FUNC_GPIO_14_SDIO_D1, 272 HI_IO_FUNC_GPIO_14_GPIO, 273 HI_IO_FUNC_GPIO_14_PWM5_OUT, 274 HI_IO_FUNC_GPIO_14_I2C0_SCL, 275 } hi_io_func_gpio_14; 276 277 /** 278 * @ingroup iot_io 279 * 280 * SFC_CSN pin function.CNcomment:SFC_CSN管脚功能。CNend 281 */ 282 typedef enum { 283 HI_IO_FUNC_SFC_CSN_SFC_CSN, 284 HI_IO_FUNC_SFC_CSN_SDIO_D2, 285 HI_IO_FUNC_SFC_CSN_GPIO9, 286 HI_IO_FUNC_SFC_CSN_SPI0_TXD = 4, 287 } hi_io_func_sfc_csn; 288 289 /** 290 * @ingroup iot_io 291 * 292 * SFC_DO pin function.CNcomment:SFC_DO管脚功能。CNend 293 */ 294 typedef enum { 295 HI_IO_FUNC_SFC_IO_1_SFC_DO, 296 HI_IO_FUNC_SFC_IO_1_SDIO_D3, 297 HI_IO_FUNC_SFC_IO_1_GPIO10, 298 HI_IO_FUNC_SFC_IO_1_SPI0_CK = 4, 299 } hi_io_func_sfc_io_1; 300 301 /** 302 * @ingroup iot_io 303 * 304 * SFC_WPN pin function.CNcomment:SFC_WPN管脚功能。CNend 305 */ 306 typedef enum { 307 HI_IO_FUNC_SFC_IO_2_SFC_WPN, 308 HI_IO_FUNC_SFC_IO_2_SDIO_CMD, 309 HI_IO_FUNC_SFC_IO_2_GPIO11, 310 HI_IO_FUNC_SFC_IO_2_RF_TX_EN_EXT, 311 HI_IO_FUNC_SFC_IO_2_SPI0_RXD, 312 } hi_io_func_sfc_io_2; 313 314 /** 315 * @ingroup iot_io 316 * 317 * SFC_DI pin function.CNcomment:SFC_DI管脚功能。CNend 318 */ 319 typedef enum { 320 HI_IO_FUNC_SFC_IO_0_SFC_DI, 321 HI_IO_FUNC_SFC_IO_0_SDIO_CLK, 322 HI_IO_FUNC_SFC_IO_0_GPIO12, 323 HI_IO_FUNC_SFC_IO_0_RF_RX_EN_EXT, 324 HI_IO_FUNC_SFC_IO_0_SPI0_CSN, 325 } hi_io_func_sfc_io_0; 326 327 /** 328 * @ingroup iot_io 329 * 330 * SFC_CLK pin function.CNcomment:SFC_CLK管脚功能。CNend 331 */ 332 typedef enum { 333 HI_IO_FUNC_SFC_CLK_SFC_CLK, 334 HI_IO_FUNC_SFC_CLK_SDIO_D0, 335 HI_IO_FUNC_SFC_CLK_GPIO13, 336 HI_IO_FUNC_SFC_CLK_SSI_DATA = 4, 337 } hi_io_func_sfc_clk; 338 339 /** 340 * @ingroup iot_io 341 * 342 * SFC_HOLDN pin function.CNcomment:SFC_HOLDN管脚功能。CNend 343 */ 344 typedef enum { 345 HI_IO_FUNC_SFC_IO_3_SFC_HOLDN, 346 HI_IO_FUNC_SFC_IO_3_SDIO_D1, 347 HI_IO_FUNC_SFC_IO_3_GPIO14, 348 HI_IO_FUNC_SFC_IO_3_SSI_CLK = 4, 349 } hi_io_func_sfc_io_3; 350 351 /** 352 * @ingroup iot_io 353 * 354 * I/O drive capability.CNcomment:IO驱动能力。CNend 355 * Note: The HI_IO_NAME_GPIO_0~HI_IO_NAME_GPIO_11 and HI_IO_NAME_GPIO_13~HI_IO_NAME_GPIO_14 driver capabilities are 356 * optional.The value range is HI_IO_DRIVER_STRENGTH_0~HI_IO_DRIVER_STRENGTH_3, and the other I/O ranges are 357 * HI_IO_DRIVER_STRENGTH_0~HI_IO_DRIVER_STRENGTH_7.CNcomment:注意:HI_IO_NAME_GPIO_0~HI_IO_NAME_GPIO_11、 358 * HI_IO_NAME_GPIO_13~HI_IO_NAME_GPIO_14驱动能力可选范围是HI_IO_DRIVER_STRENGTH_0~HI_IO_DRIVER_STRENGTH_3, 359 * 其余IO范围是HI_IO_DRIVER_STRENGTH_0~HI_IO_DRIVER_STRENGTH_7。CNend 360 */ 361 typedef enum { 362 HI_IO_DRIVER_STRENGTH_0 = 0, /**< Drive strength level 0 (highest). 363 CNcomment:驱动能力0级,驱动能力最高CNend */ 364 HI_IO_DRIVER_STRENGTH_1, /**< Drive strength level 1.CNcomment:驱动能力1级CNend */ 365 HI_IO_DRIVER_STRENGTH_2, /**< Drive strength level 2.CNcomment:驱动能力2级CNend */ 366 HI_IO_DRIVER_STRENGTH_3, /**< Drive strength level 3.CNcomment:驱动能力3级CNend */ 367 HI_IO_DRIVER_STRENGTH_4, /**< Drive strength level 4.CNcomment:驱动能力4级CNend */ 368 HI_IO_DRIVER_STRENGTH_5, /**< Drive strength level 5.CNcomment:驱动能力5级CNend */ 369 HI_IO_DRIVER_STRENGTH_6, /**< Drive strength level 6.CNcomment:驱动能力6级CNend */ 370 HI_IO_DRIVER_STRENGTH_7, /**< Drive strength level 7 (lowest). 371 CNcomment:驱动能力7级,驱动能力最低CNend */ 372 HI_IO_DRIVER_STRENGTH_MAX, 373 } hi_io_driver_strength; 374 375 /** 376 * @ingroup iot_io 377 * 378 * GPIO pull-up configuration.CNcomment:IO上下拉功能CNend 379 */ 380 typedef enum { 381 HI_IO_PULL_NONE, /**< Disabled.CNcomment:无拉CNend */ 382 HI_IO_PULL_UP, /**< Pull-up enabled.CNcomment:上拉CNend */ 383 HI_IO_PULL_DOWN, /**< Pull-down enabled.CNcomment:下拉CNend */ 384 HI_IO_PULL_MAX, /**< Invalid.CNcomment:无效值CNend */ 385 } hi_io_pull; 386 387 /** 388 * @ingroup iot_io 389 * @brief Enables the I/O pull-up.CNcomment:设置某个IO上下拉功能。CNend 390 * 391 * @par 描述: 392 * Enables the I/O pull-up.CNcomment:设置某个IO上下拉功能。CNend 393 * 394 * @attention None 395 * @param id [IN] type #hi_io_name,I/O index.CNcomment:硬件管脚。CNend 396 * @param val [IN] type #hi_io_pull,I/O pull-up enable.CNcomment:待设置的上下拉状态。CNend 397 * 398 * @retval 0 Success 399 * @retval #HI_ERR_GPIO_INVALID_PARAMETER Failure. Input invalid. 400 * @par 依赖: 401 * @li hi_io.h:Describes I/O APIs.CNcomment:文件用于描述IO相关接口。CNend 402 * @see hi_io_get_pull。 403 */ 404 hi_u32 hi_io_set_pull(hi_io_name id, hi_io_pull val); 405 406 /** 407 * @ingroup iot_io 408 * @brief Obtains the GPIO pull-up status.CNcomment:获取某个GPIO上下拉状态。CNend 409 * 410 * @par 描述: 411 * Obtains the GPIO pull-up status.CNcomment:获取某个GPIO上下拉状态。CNend 412 * 413 * @attention None 414 * @param id [IN] type #hi_io_name,I/O index.CNcomment:硬件管脚。CNend 415 * @param val [OUT] type #hi_io_pull*,pull-up status.CNcomment:获取到的上下拉状态。CNend. 416 * 417 * @retval 0 Success 418 * @retval #HI_ERR_GPIO_INVALID_PARAMETER Failure. Input invalid. 419 * @par 依赖: 420 * @li hi_io.h:Describes I/O APIs.CNcomment:文件用于描述IO相关接口。CNend 421 * @see hi_io_set_pull。 422 */ 423 hi_u32 hi_io_get_pull(hi_io_name id, hi_io_pull *val); 424 425 /** 426 * @ingroup iot_io 427 * @brief Sets the I/O multiplexing.CNcomment:配置某个IO的复用功能。CNend 428 * 429 * @par 描述: 430 * Sets the I/O multiplexing.CNcomment:配置某个IO的复用功能。CNend 431 * 432 * @attention None 433 * @param id [IN] type #hi_io_name,I/O index.CNcomment:硬件管脚。CNend 434 * @param val [IN] type #hi_u8,I/O multiplexing.See the functions below: CNcomment:IO复用功能。 435 根据待设置的硬件管脚,从如下枚举中选择相应功能。CNend 436 hi_io_func_gpio_0, 437 hi_io_func_gpio_1, 438 hi_io_func_gpio_2, 439 hi_io_func_gpio_3, 440 hi_io_func_gpio_4, 441 hi_io_func_gpio_5, 442 hi_io_func_gpio_6, 443 hi_io_func_gpio_7, 444 hi_io_func_gpio_8, 445 hi_io_func_gpio_9, 446 hi_io_func_gpio_10, 447 hi_io_func_gpio_11, 448 hi_io_func_gpio_12, 449 hi_io_func_gpio_13, 450 hi_io_func_gpio_14, 451 hi_io_func_sfc_csn, 452 hi_io_func_sfc_io_1, 453 hi_io_func_sfc_io_2, 454 hi_io_func_sfc_io_0, 455 hi_io_func_sfc_clk, 456 hi_io_func_sfc_io_3 457 * 458 * @retval 0 Success 459 * @retval #HI_ERR_GPIO_INVALID_PARAMETER Failure. Input invalid. 460 * @par 依赖: 461 * @li hi_io.h:Describes I/O APIs.CNcomment:文件用于描述IO相关接口。CNend 462 * @see hi_io_get_func。 463 */ 464 hi_u32 hi_io_set_func(hi_io_name id, hi_u8 val); 465 466 /** 467 * @ingroup iot_io 468 * @brief Obtains the I/O multiplexing.CNcomment:获取某个IO复用功能。CNend 469 * 470 * @par 描述: 471 * Obtains the I/O multiplexing.CNcomment:获取某个IO复用功能。CNend 472 * 473 * @attention None 474 * @param id [IN] type #hi_io_name,I/O index.CNcomment:硬件管脚。CNend 475 * @param val [OUT] type #hi_u8*,I/O multiplexing.CNcomment:IO复用功能。CNend 476 * 477 * @retval 0 Success 478 * @retval #HI_ERR_GPIO_INVALID_PARAMETER Failure. Input invalid. 479 * @par 依赖: 480 * @li hi_io.h:Describes I/O APIs.CNcomment:文件用于描述IO相关接口。CNend 481 * @see hi_io_set_func。 482 */ 483 hi_u32 hi_io_get_func(hi_io_name id, hi_u8 *val); 484 485 /** 486 * @ingroup iot_io 487 * @brief Sets the I/O drive strength.CNcomment:设置某个IO驱动能力。CNend 488 * 489 * @par 描述: 490 * The I/O drive strength is closely related to hardware design. For details, see SoC data sheet. 491 CNcomment:设置某个IO驱动能力,与硬件设计强相关,详细配置参考芯片手册。CNend 492 * 493 * @attention None 494 * @param id [IN] type #hi_io_name,I/O index.CNcomment:硬件管脚。CNend 495 * @param level [IN] type #hi_io_driver_strength,I/O drive strength level.CNcomment:IO驱动能力级别。CNend 496 * 497 * @retval #0 Success. 498 * @retval #Other Failure. For details, see hi_errno.h. 499 * @par 依赖: 500 * @li hi_io.h:Describes I/O APIs.CNcomment:文件用于描述IO相关接口。CNend 501 * @see None 502 */ 503 hi_u32 hi_io_set_driver_strength(hi_io_name id, hi_io_driver_strength val); 504 505 /** 506 * @ingroup iot_io 507 * @brief Obtains the I/O drive strength.CNcomment:获取某个IO驱动能力。CNend 508 * 509 * @par 描述: 510 * Obtains the I/O drive strength.CNcomment:获取某个IO驱动能力。CNend 511 * 512 * @attention None 513 * @param id [IN] type #hi_io_name,I/O index.CNcomment:硬件管脚。CNend 514 * @param val [OUT] type #hi_io_driver_strength*,I/O drive strength level.CNcomment:IO驱动能力级别。CNend 515 * 516 * @retval #0 Success. 517 * @retval #Other Failure. For details, see hi_errno.h. 518 * @par 依赖: 519 * @li hi_io.h:Describes I/O APIs.CNcomment:文件用于描述IO相关接口。CNend 520 * @see None 521 */ 522 hi_u32 hi_io_get_driver_strength(hi_io_name id, hi_io_driver_strength *val); 523 524 /** 525 * @ingroup iot_io 526 * @brief Set the I/O input enable status.CNcomment:设置某个IO输入使能的状态。CNend 527 * 528 * @par 描述: 529 * Set the I/O input enable status.CNcomment:设置某个IO输入使能的状态。CNend 530 * 531 * @attention If the input enable status of an IO is set to FALSE in the input state, the CPU can't read the IO changes. 532 CNcomment:如果某个IO的输入使能设置为FALSE,CPU将读取不到该IO的变化。CNend 533 * @param id [IN] type #hi_io_name,I/O index.CNcomment:硬件管脚。CNend 534 * @param state [IN] type #hi_bool,IO input enable state.CNcomment:要设置的输入使能状态。CNend 535 * 536 * @retval #0 Success. 537 * @retval #Other Failure. For details, see hi_errno.h. 538 * @par 依赖: 539 * @li hi_io.h:Describes I/O APIs.CNcomment:文件用于描述IO相关接口。CNend 540 * @see None 541 */ 542 hi_u32 hi_io_set_input_enable(hi_io_name id, hi_bool state); 543 544 /** 545 * @ingroup iot_io 546 * @brief Get the I/O input enable status.CNcomment:获取某个IO输入使能的状态。CNend 547 * 548 * @par 描述: 549 * Get the I/O input enable status.CNcomment:获取某个IO输入使能的状态。CNend 550 * 551 * @attention None 552 * @param id [IN] type #hi_io_name,I/O index.CNcomment:硬件管脚。CNend 553 * @param state [OUT] type #hi_bool *,IO input enable state.CNcomment:IO的输入使能状态。CNend 554 * 555 * @retval #0 Success. 556 * @retval #Other Failure. For details, see hi_errno.h. 557 * @par 依赖: 558 * @li hi_io.h:Describes I/O APIs.CNcomment:文件用于描述IO相关接口。CNend 559 * @see None 560 */ 561 hi_u32 hi_io_get_input_enable(hi_io_name id, hi_bool *state); 562 563 /** 564 * @ingroup iot_io 565 * @brief Set the I/O schmitt trigger enable status.CNcomment:设置某个IO斯密特触发器的使能状态。CNend 566 * 567 * @par 描述: 568 * Set the I/O schmitt trigger enable status.CNcomment:设置某个IO斯密特触发器的使能状态。CNend 569 * 570 * @attention Advise to enable schmitt trigger in scenarios that need to debounce. 571 CNcomment:建议在按键等需要消除抖动的场景开启斯密特触发器。CNend 572 * @param id [IN] type #hi_io_name,I/O index.CNcomment:硬件管脚。CNend 573 * @param is_enable [IN] type #hi_bool,Schmitt trigger enable status.CNcomment:斯密特触发器的使能状态。CNend 574 * @li HI_FALSE:No Schmitt.CNcomment:关闭斯密特触发器。CNend 575 * @li HI_TRUE: Schmitt enable.CNcomment:使能斯密特触发器。CNend 576 * 577 * @retval #0 Success. 578 * @retval #Other Failure. For details, see hi_errno.h. 579 * @par 依赖: 580 * @li hi_io.h:Describes I/O APIs.CNcomment:文件用于描述IO相关接口。CNend 581 * @see hi_io_get_schmitt 582 */ 583 hi_u32 hi_io_set_schmitt(hi_io_name id, hi_bool is_enable); 584 585 /** 586 * @ingroup iot_io 587 * @brief Get the I/O schmitt trigger enable status.CNcomment:获取某个IO斯密特触发器的使能状态。CNend 588 * 589 * @par 描述: 590 * Get the I/O schmitt trigger enable status.CNcomment:获取某个IO斯密特触发器的使能状态。CNend 591 * 592 * @attention None 593 * @param id [IN] type #hi_io_name,I/O index.CNcomment:硬件管脚。CNend 594 * @param is_enable [OUT] type #hi_bool *,Schmitt trigger enable status.CNcomment:斯密特触发器的使能状态。CNend 595 * @li HI_FALSE:No Schmitt.CNcomment:关闭斯密特触发器。CNend 596 * @li HI_TRUE: Schmitt enable.CNcomment:使能斯密特触发器。CNend 597 * 598 * @retval #0 Success. 599 * @retval #Other Failure. For details, see hi_errno.h. 600 * @par 依赖: 601 * @li hi_io.h:Describes I/O APIs.CNcomment:文件用于描述IO相关接口。CNend 602 * @see hi_io_set_schmitt 603 */ 604 hi_u32 hi_io_get_schmitt(hi_io_name id, hi_bool *is_enable); 605 606 #endif 607