lpc_pinsel.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540
  1. /**********************************************************************
  2. * $Id$ lpc_pinsel.c 2011-06-02
  3. *//**
  4. * @file lpc_pinsel.c
  5. * @brief Contains all functions support for Pin-connection block
  6. * firmware library on LPC
  7. * @version 1.0
  8. * @date 02. June. 2011
  9. * @author NXP MCU SW Application Team
  10. *
  11. * Copyright(C) 2011, NXP Semiconductor
  12. * All rights reserved.
  13. *
  14. ***********************************************************************
  15. * Software that is described herein is for illustrative purposes only
  16. * which provides customers with programming information regarding the
  17. * products. This software is supplied "AS IS" without any warranties.
  18. * NXP Semiconductors assumes no responsibility or liability for the
  19. * use of the software, conveys no license or title under any patent,
  20. * copyright, or mask work right to the product. NXP Semiconductors
  21. * reserves the right to make changes in the software without
  22. * notification. NXP Semiconductors also make no representation or
  23. * warranty that such application will be suitable for the specified
  24. * use without further testing or modification.
  25. * Permission to use, copy, modify, and distribute this software and its
  26. * documentation is hereby granted, under NXP Semiconductors'
  27. * relevant copyright in the software, without fee, provided that it
  28. * is used in conjunction with NXP Semiconductors microcontrollers. This
  29. * copyright, permission, and disclaimer notice must appear in all copies of
  30. * this code.
  31. **********************************************************************/
  32. /* Peripheral group ----------------------------------------------------------- */
  33. /** @addtogroup PINSEL
  34. * @{
  35. */
  36. #ifdef __BUILD_WITH_EXAMPLE__
  37. #include "lpc_libcfg.h"
  38. #else
  39. #include "lpc_libcfg_default.h"
  40. #endif /* __BUILD_WITH_EXAMPLE__ */
  41. #ifdef _PINSEL
  42. /* Includes ------------------------------------------------------------------- */
  43. #include "lpc_pinsel.h"
  44. /* Private Functions ---------------------------------------------------------- */
  45. /*********************************************************************//**
  46. * @brief Get pointer to GPIO peripheral due to GPIO port
  47. * @param[in] portnum Port Number value, should be in range from 0..3.
  48. * @param[in] pinnum Pin number value, should be in range from 0..31
  49. * @return Pointer to GPIO peripheral
  50. **********************************************************************/
  51. static uint32_t * PIN_GetPointer(uint8_t portnum, uint8_t pinnum)
  52. {
  53. uint32_t *pPIN = NULL;
  54. pPIN = (uint32_t *)(LPC_IOCON_BASE + ((portnum * 32 + pinnum)*sizeof(uint32_t)));
  55. return pPIN;
  56. }
  57. /* Public Functions ----------------------------------------------------------- */
  58. /** @addtogroup PINSEL_Public_Functions
  59. * @{
  60. */
  61. /*********************************************************************//**
  62. * @brief Get type of a pin.
  63. * @param[in] portnum PORT number, should be in range: 0..3
  64. * @param[in] pinnum Pin number, should be in range: 0..31
  65. * @return Port type:
  66. * - PINSEL_PIN_TYPE_D
  67. * - PINSEL_PIN_TYPE_A
  68. * - PINSEL_PIN_TYPE_I
  69. * - PINSEL_PIN_TYPE_W
  70. * - PINSEL_PIN_TYPE_U
  71. * - PINSEL_PIN_TYPE_UNKNOWN: Invalid pin
  72. **********************************************************************/
  73. PinSel_PinType PINSEL_GetPinType(uint8_t portnum, uint8_t pinnum)
  74. {
  75. PinSel_PinType Ret = PINSEL_PIN_TYPE_UNKNOWN;
  76. switch(portnum)
  77. {
  78. case 0:
  79. if((pinnum <=6)||
  80. ((pinnum >= 10)&&(pinnum <=11))||
  81. ((pinnum >= 14)&&(pinnum <=22)))
  82. Ret = PINSEL_PIN_TYPE_D;
  83. else if ((pinnum == 12)||(pinnum==13)||
  84. ((pinnum >= 23)&&(pinnum <=26)))
  85. Ret = PINSEL_PIN_TYPE_A;
  86. else if ((pinnum == 29) || (pinnum==30)|| (pinnum==31))
  87. Ret = PINSEL_PIN_TYPE_U;
  88. else if ((pinnum == 27) || (pinnum==28))
  89. Ret = PINSEL_PIN_TYPE_I;
  90. else if ((pinnum == 7) || (pinnum==8)|| (pinnum==9))
  91. Ret = PINSEL_PIN_TYPE_W;
  92. break;
  93. case 1:
  94. if(pinnum <=29)
  95. Ret = PINSEL_PIN_TYPE_D;
  96. else if ((pinnum == 30) || (pinnum==31))
  97. Ret = PINSEL_PIN_TYPE_A;
  98. break;
  99. case 2:
  100. case 3:
  101. case 4:
  102. Ret = PINSEL_PIN_TYPE_D;
  103. break;
  104. case 5:
  105. if((pinnum <=1)||
  106. (pinnum == 4))
  107. Ret = PINSEL_PIN_TYPE_D;
  108. else if ((pinnum == 2) || (pinnum==3))
  109. Ret = PINSEL_PIN_TYPE_I;
  110. break;
  111. default:
  112. break;
  113. }
  114. return Ret;
  115. }
  116. /*********************************************************************//**
  117. * @brief Setup the pin selection function
  118. * @param[in] portnum PORT number, should be in range: 0..3
  119. * @param[in] pinnum Pin number, should be in range: 0..31
  120. * @param[in] funcnum Function number, should be range: 0..7
  121. * - 0: Select GPIO (Default)
  122. * - 1: Selects the 1st alternate function
  123. * - 2: Selects the 2nd alternate function
  124. * ...
  125. * - 7: Selects the 7th alternate function
  126. * @return PINSEL Return Code
  127. * - PINSEL_RET_INVALID_PIN
  128. * - PINSEL_RET_OK
  129. **********************************************************************/
  130. PINSEL_RET_CODE PINSEL_ConfigPin ( uint8_t portnum, uint8_t pinnum, uint8_t funcnum)
  131. {
  132. uint32_t *pPIN = NULL;
  133. PinSel_PinType type = PINSEL_GetPinType(portnum,pinnum);
  134. if(type == PINSEL_PIN_TYPE_UNKNOWN)
  135. return PINSEL_RET_INVALID_PIN;
  136. pPIN = PIN_GetPointer(portnum, pinnum);
  137. *pPIN &= ~IOCON_FUNC_MASK;//Clear function bits
  138. *pPIN |= funcnum&IOCON_FUNC_MASK;
  139. return PINSEL_RET_OK;
  140. }
  141. /*********************************************************************//**
  142. * @brief Setup resistor mode for pin of type D,A,W
  143. * @param[in] portnum PORT number, should be in range: 0..3
  144. * @param[in] pinnum Pin number, should be in range: 0..31
  145. * @param[in] modenum: Mode number, should be in range: 0..3
  146. - PINSEL_BASICMODE_PLAINOUT: Plain output
  147. - PINSEL_BASICMODE_PULLDOWN: Pull-down enable
  148. - PINSEL_BASICMODE_PULLUP: Pull-up enable
  149. - PINSEL_BASICMODE_REPEATER: Repeater mode
  150. * @return PINSEL Return Code
  151. * - PINSEL_RET_INVALID_PIN
  152. * - PINSEL_RET_NOT_SUPPORT
  153. * - PINSEL_RET_OK
  154. **********************************************************************/
  155. PINSEL_RET_CODE PINSEL_SetPinMode ( uint8_t portnum, uint8_t pinnum, PinSel_BasicMode modenum)
  156. {
  157. uint32_t *pPIN = NULL;
  158. PinSel_PinType type = PINSEL_GetPinType(portnum,pinnum);
  159. if(type == PINSEL_PIN_TYPE_UNKNOWN)
  160. return PINSEL_RET_INVALID_PIN;
  161. if((type != PINSEL_PIN_TYPE_D )&&
  162. (type != PINSEL_PIN_TYPE_A )&&
  163. (type != PINSEL_PIN_TYPE_W))
  164. return PINSEL_RET_NOT_SUPPORT;
  165. pPIN = PIN_GetPointer(portnum, pinnum);
  166. *(uint32_t *)pPIN &= ~(IOCON_MODE_MASK);//Clear function bits
  167. *(uint32_t *)pPIN |= (modenum << IOCON_MODE_POS)&IOCON_MODE_MASK;
  168. return PINSEL_RET_OK;
  169. }
  170. /*********************************************************************//**
  171. * @brief Setup hysteresis for pin of type D, W
  172. * @param[in] portnum Port number, should be in range: 0..3
  173. * @param[in] pinnum Pin number, should be in range: 0..31
  174. * @param[in] NewState new state of Hysteresis mode, should be:
  175. * - ENABLE: Hysteresis enable
  176. * - DISABLE: Hysteresis disable
  177. * @return PINSEL Return Code
  178. * - PINSEL_RET_INVALID_PIN
  179. * - PINSEL_RET_NOT_SUPPORT
  180. * - PINSEL_RET_OK
  181. **********************************************************************/
  182. PINSEL_RET_CODE PINSEL_SetHysMode(uint8_t portnum, uint8_t pinnum, FunctionalState NewState)
  183. {
  184. uint32_t *pPIN = NULL;
  185. PinSel_PinType type = PINSEL_GetPinType(portnum,pinnum);
  186. if(type == PINSEL_PIN_TYPE_UNKNOWN)
  187. return PINSEL_RET_INVALID_PIN;
  188. if((type != PINSEL_PIN_TYPE_D )&&
  189. (type != PINSEL_PIN_TYPE_W))
  190. return PINSEL_RET_NOT_SUPPORT;
  191. pPIN = PIN_GetPointer(portnum, pinnum);
  192. if(NewState == DISABLE)
  193. {
  194. *(uint32_t *)pPIN &= ~IOCON_HYS_ENABLE;//Clear hys bits
  195. }
  196. else
  197. *(uint32_t *)pPIN |= IOCON_HYS_ENABLE;
  198. return PINSEL_RET_OK;
  199. }
  200. /*********************************************************************//**
  201. * @brief Setup input polarity for pin of type A,I,D,W
  202. * @param[in] portnum Port number, should be in range: 0..3
  203. * @param[in] pinnum Pin number, should be in range: 0..31
  204. * @param[in] NewState new state of Invert mode, should be:
  205. * - ENABLE: Input is inverted.
  206. * - DISABLE: Input isn't inverted.
  207. * @return PINSEL Return Code
  208. * - PINSEL_RET_INVALID_PIN
  209. * - PINSEL_RET_NOT_SUPPORT
  210. * - PINSEL_RET_OK
  211. **********************************************************************/
  212. PINSEL_RET_CODE PINSEL_SetInvertInput(uint8_t portnum, uint8_t pinnum, FunctionalState NewState)
  213. {
  214. uint32_t *pPIN = NULL;
  215. PinSel_PinType type = PINSEL_GetPinType(portnum,pinnum);
  216. if(type == PINSEL_PIN_TYPE_UNKNOWN)
  217. return PINSEL_RET_INVALID_PIN;
  218. if(type== PINSEL_PIN_TYPE_U)
  219. return PINSEL_RET_NOT_SUPPORT;
  220. pPIN = PIN_GetPointer(portnum, pinnum);
  221. if(NewState == DISABLE)
  222. {
  223. *(uint32_t *)pPIN &= ~IOCON_INVERT_INPUT;//Clear hys bits
  224. }
  225. else
  226. *(uint32_t *)pPIN |= IOCON_INVERT_INPUT;
  227. return PINSEL_RET_OK;
  228. }
  229. /*********************************************************************//**
  230. * @brief Setup Slew rate for pin of type D,W
  231. * @param[in] portnum Port number, should be in range: 0..3
  232. * @param[in] pinnum Pin number, should be in range: 0..31
  233. * @param[in] NewState new state of Slew rate control, should be:
  234. * - ENABLE: Output slew rate control is enable
  235. * - DISABLE: Output slew rate control is disable
  236. * @return PINSEL Return Code
  237. * - PINSEL_RET_INVALID_PIN
  238. * - PINSEL_RET_NOT_SUPPORT
  239. * - PINSEL_RET_OK
  240. **********************************************************************/
  241. PINSEL_RET_CODE PINSEL_SetSlewMode(uint8_t portnum, uint8_t pinnum, FunctionalState NewState)
  242. {
  243. uint32_t *pPIN = NULL;
  244. PinSel_PinType type = PINSEL_GetPinType(portnum,pinnum);
  245. if(type == PINSEL_PIN_TYPE_UNKNOWN)
  246. return PINSEL_RET_INVALID_PIN;
  247. if((type!= PINSEL_PIN_TYPE_D) &&
  248. (type!= PINSEL_PIN_TYPE_W))
  249. return PINSEL_RET_NOT_SUPPORT;
  250. pPIN = PIN_GetPointer(portnum, pinnum);
  251. if(NewState == DISABLE)
  252. {
  253. *(uint32_t *)pPIN &= ~IOCON_SLEW_ENABLE;//Clear hys bits
  254. }
  255. else
  256. *(uint32_t *)pPIN |= IOCON_SLEW_ENABLE;
  257. return PINSEL_RET_OK;
  258. }
  259. /*********************************************************************//**
  260. * @brief Setup I2CMode for only pins that provide special I2C functionality
  261. * @param[in] portnum Port number, should be in range: 0..3
  262. * @param[in] pinnum Pin number, should be in range: 0..31
  263. * @param[in] I2CMode I2C mode, should be:
  264. * - PINSEL_I2CMODE_FAST_STANDARD: Fast mode and standard I2C mode
  265. * - PINSEL_I2CMODE_OPENDRAINIO: Open drain I/O
  266. * - PINSEL_I2CMODE_FASTMODEPLUS: Fast Mode Plus I/O
  267. * @return PINSEL Return Code
  268. * - PINSEL_RET_INVALID_PIN
  269. * - PINSEL_RET_NOT_SUPPORT
  270. * - PINSEL_RET_OK
  271. **********************************************************************/
  272. PINSEL_RET_CODE PINSEL_SetI2CMode(uint8_t portnum, uint8_t pinnum, PinSel_I2cMode I2CMode)
  273. {
  274. uint32_t *pPIN = NULL;
  275. PinSel_PinType type = PINSEL_GetPinType(portnum,pinnum);
  276. if(type == PINSEL_PIN_TYPE_UNKNOWN)
  277. return PINSEL_RET_INVALID_PIN;
  278. if(type != PINSEL_PIN_TYPE_I )
  279. return PINSEL_RET_NOT_SUPPORT;
  280. pPIN = PIN_GetPointer(portnum, pinnum);
  281. switch(I2CMode)
  282. {
  283. // Standard/Fast Mode I2C: HS = HIDRIVE = 0
  284. case PINSEL_I2CMODE_FAST_STANDARD:
  285. PINSEL_SetI2CFilter(portnum,pinnum,ENABLE);
  286. *(uint32_t *)pPIN &= ~(IOCON_I2CMODE_FASTPLUS);
  287. break;
  288. // Non-I2C: HS = 1, HIDRIVE = 0
  289. case PINSEL_I2CMODE_OPENDRAINIO:
  290. PINSEL_SetI2CFilter(portnum,pinnum,DISABLE);
  291. *(uint32_t *)pPIN &= ~(IOCON_I2CMODE_FASTPLUS);
  292. break;
  293. // Fast Mode Plus I2C: HS = 0, HIDRIVE =1
  294. case PINSEL_I2CMODE_FASTMODEPLUS:
  295. PINSEL_SetI2CFilter(portnum,pinnum,ENABLE);
  296. *(uint32_t *)pPIN |= (IOCON_I2CMODE_FASTPLUS);
  297. break;
  298. default:
  299. return PINSEL_RET_ERR;
  300. }
  301. return PINSEL_RET_OK;
  302. }
  303. /*********************************************************************//**
  304. * @brief Setup Open-drain mode in pin of type D, A, W
  305. * @param[in] portnum Port number, should be in range: 0..3
  306. * @param[in] pinnum Pin number, should be in range: 0..31
  307. * @param[in] NewState new state of Open-drain mode:
  308. * - DISABLE: Normal pin I/O mode
  309. * - ENABLE: Open-drain enable
  310. * @return PINSEL Return Code
  311. * - PINSEL_RET_INVALID_PIN
  312. * - PINSEL_RET_NOT_SUPPORT
  313. * - PINSEL_RET_OK
  314. **********************************************************************/
  315. PINSEL_RET_CODE PINSEL_SetOpenDrainMode(uint8_t portnum, uint8_t pinnum, FunctionalState NewState)
  316. {
  317. uint32_t *pPIN = NULL;
  318. PinSel_PinType type = PINSEL_GetPinType(portnum,pinnum);
  319. if(type == PINSEL_PIN_TYPE_UNKNOWN)
  320. return PINSEL_RET_INVALID_PIN;
  321. if((type != PINSEL_PIN_TYPE_D ) &&
  322. (type != PINSEL_PIN_TYPE_A ) &&
  323. (type != PINSEL_PIN_TYPE_W ))
  324. return PINSEL_RET_NOT_SUPPORT;
  325. pPIN = PIN_GetPointer(portnum, pinnum);
  326. if(NewState == DISABLE)
  327. {
  328. *(uint32_t *)pPIN &= ~IOCON_OPENDRAIN_MODE;//Clear hys bits
  329. }
  330. else
  331. {
  332. *(uint32_t *)pPIN |= IOCON_OPENDRAIN_MODE;
  333. }
  334. return PINSEL_RET_OK;
  335. }
  336. /*********************************************************************//**
  337. * @brief Enable the Analog mode for each pin of Type A(default is as Digital pins)
  338. * @param[in] portnum PORT number, should be in range: 0..3
  339. * @param[in] pinnum Pin number, should be in range: 0..31
  340. * @param[in] enable: the state of the pin that is expected to run
  341. - ENABLE: Enable the DAC mode of the pin
  342. - DISABLE: Disable the DAC mode
  343. * @return PINSEL Return Code
  344. * - PINSEL_RET_INVALID_PIN
  345. * - PINSEL_RET_NOT_SUPPORT
  346. * - PINSEL_RET_OK
  347. **********************************************************************/
  348. PINSEL_RET_CODE PINSEL_SetAnalogPinMode (uint8_t portnum, uint8_t pinnum, uint8_t enable)
  349. {
  350. uint32_t *pPIN = NULL;
  351. PinSel_PinType type = PINSEL_GetPinType(portnum,pinnum);
  352. if(type == PINSEL_PIN_TYPE_UNKNOWN)
  353. return PINSEL_RET_INVALID_PIN;
  354. if(type != PINSEL_PIN_TYPE_A )
  355. return PINSEL_RET_NOT_SUPPORT;
  356. pPIN = PIN_GetPointer(portnum, pinnum);
  357. if(enable)
  358. {
  359. *(uint32_t *)pPIN &= ~(IOCON_DIGITIAL_MODE);
  360. }
  361. else
  362. {
  363. *(uint32_t *)pPIN |= IOCON_DIGITIAL_MODE;//Set 7th bit to one
  364. }
  365. return PINSEL_RET_OK;
  366. }
  367. /*********************************************************************//**
  368. * @brief Choose the DAC mode for pin P0.26
  369. * @param[in] portnum PORT number, should be in range: 0..3
  370. * @param[in] pinnum Pin number, should be in range: 0..31
  371. * @param[in] enable: the state of the pin that is expected to run
  372. - ENABLE: Enable the DAC mode of the pin
  373. - DISABLE: Disable the DAC mode
  374. * @return PINSEL Return Code
  375. * - PINSEL_RET_INVALID_PIN
  376. * - PINSEL_RET_NOT_SUPPORT
  377. * - PINSEL_RET_OK
  378. **********************************************************************/
  379. PINSEL_RET_CODE PINSEL_DacEnable (uint8_t portnum, uint8_t pinnum, uint8_t enable)
  380. {
  381. uint32_t *pPIN = NULL;
  382. PinSel_PinType type = PINSEL_GetPinType(portnum,pinnum);
  383. if(type == PINSEL_PIN_TYPE_UNKNOWN)
  384. return PINSEL_RET_INVALID_PIN;
  385. // This setting is only for DAC pin (output pin)
  386. if(!((portnum == 0) && (pinnum == 26)))
  387. {
  388. return PINSEL_RET_NOT_SUPPORT;
  389. }
  390. pPIN = PIN_GetPointer(portnum, pinnum);
  391. if(enable)
  392. {
  393. *(uint32_t *)pPIN |= IOCON_DAC_ENABLE;//Set 16th bit to one
  394. }
  395. else
  396. {
  397. *(uint32_t *)pPIN &= ~IOCON_DAC_ENABLE;//Set 16th bit to one
  398. }
  399. return PINSEL_RET_OK;
  400. }
  401. /*********************************************************************//**
  402. * @brief Control the 10ns glitch filter for pin of type A,W
  403. * @param[in] portnum PORT number, should be in range: 0..3
  404. * @param[in] pinnum Pin number, should be in range: 0..31
  405. * @param[in] enable: the state of the pin that is expected to run
  406. - ENABLE: The noise pulses below approximately 10ns are filtered out
  407. - DISABLE: No input filtering is done.
  408. * @return PINSEL Return Code
  409. * - PINSEL_RET_INVALID_PIN
  410. * - PINSEL_RET_NOT_SUPPORT
  411. * - PINSEL_RET_OK
  412. **********************************************************************/
  413. PINSEL_RET_CODE PINSEL_SetFilter (uint8_t portnum, uint8_t pinnum, uint8_t enable)
  414. {
  415. uint32_t *pPIN = NULL;
  416. PinSel_PinType type = PINSEL_GetPinType(portnum,pinnum);
  417. if(type == PINSEL_PIN_TYPE_UNKNOWN)
  418. return PINSEL_RET_INVALID_PIN;
  419. if((type != PINSEL_PIN_TYPE_A ) &&
  420. (type != PINSEL_PIN_TYPE_W ))
  421. return PINSEL_RET_NOT_SUPPORT;
  422. pPIN = PIN_GetPointer(portnum, pinnum);
  423. if(enable)
  424. {
  425. *(uint32_t *)pPIN &= ~(IOCON_10ns_FILTER_DISABLE);//Clear 8th bit to 0
  426. }
  427. else
  428. {
  429. *(uint32_t *)pPIN |= (IOCON_10ns_FILTER_DISABLE);//Set 8th bit to one
  430. }
  431. return PINSEL_RET_OK;
  432. }
  433. /*********************************************************************//**
  434. * @brief Control the 50ns glitch filter for I2C pins (type I)
  435. * @param[in] portnum PORT number, should be in range: 0..3
  436. * @param[in] pinnum Pin number, should be in range: 0..31
  437. * @param[in] enable: the state of the pin that is expected to run
  438. - ENABLE: The noise pulses below approximately 10ns are filtered out
  439. - DISABLE: No input filtering is done.
  440. * @return PINSEL Return Code
  441. * - PINSEL_RET_INVALID_PIN
  442. * - PINSEL_RET_NOT_SUPPORT
  443. * - PINSEL_RET_OK
  444. **********************************************************************/
  445. PINSEL_RET_CODE PINSEL_SetI2CFilter (uint8_t portnum, uint8_t pinnum, uint8_t enable)
  446. {
  447. uint32_t *pPIN = NULL;
  448. PinSel_PinType type = PINSEL_GetPinType(portnum,pinnum);
  449. if(type == PINSEL_PIN_TYPE_UNKNOWN)
  450. return PINSEL_RET_INVALID_PIN;
  451. if(type != PINSEL_PIN_TYPE_I)
  452. return PINSEL_RET_NOT_SUPPORT;
  453. pPIN = PIN_GetPointer(portnum, pinnum);
  454. if(enable)
  455. {
  456. *(uint32_t *)pPIN &= ~(IOCON_HS_MASK);//Clear 8th bit to 0
  457. }
  458. else
  459. {
  460. *(uint32_t *)pPIN |= (IOCON_I2C_FILTER_DISABLE);//Set 8th bit to one
  461. }
  462. return PINSEL_RET_OK;
  463. }
  464. /**
  465. * @}
  466. */
  467. #endif /*_PINSEL*/
  468. /**
  469. * @}
  470. */
  471. /* --------------------------------- End Of File ------------------------------ */