drv_gpio.h 861 B

12345678910111213141516171819202122232425262728293031323334
  1. /**************************************************************************//**
  2. *
  3. * @copyright (C) 2020 Nuvoton Technology Corp. All rights reserved.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0
  6. *
  7. * Change Logs:
  8. * Date Author Notes
  9. * 2020-2-7 YCHuang12 First version
  10. *
  11. ******************************************************************************/
  12. #ifndef __DRV_GPIO_H__
  13. #define __DRV_GPIO_H__
  14. typedef enum
  15. {
  16. NU_PA,
  17. NU_PB,
  18. NU_PC,
  19. NU_PD,
  20. NU_PE,
  21. NU_PF,
  22. NU_PG,
  23. NU_PH,
  24. NU_PORT_CNT,
  25. } nu_gpio_port;
  26. #define NU_GET_PININDEX(port, pin) ((port)*16+(pin))
  27. #define NU_GET_PINS(rt_pin_index) ((rt_pin_index) & 0x0000000F)
  28. #define NU_GET_PORT(rt_pin_index) (((rt_pin_index)>>4) & 0x0000000F)
  29. #define NU_GET_PIN_MASK(nu_gpio_pin) (1 << (nu_gpio_pin))
  30. #endif //__DRV_GPIO_H__