drv_gpio.h 592 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * Copyright (c) 2006-2024, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2024-04-08 QT-one first version
  9. */
  10. #ifndef __DRV_GPIO_H__
  11. #define __DRV_GPIO_H__
  12. #include <rthw.h>
  13. #include <rtdevice.h>
  14. #include "drv_common.h"
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #define __HT32_PORT(port) HT_GPIO##port##_BASE
  19. #define GET_PIN(PORTx,PIN) (rt_base_t)((16 * ( ((rt_base_t)__HT32_PORT(PORTx) - (rt_base_t)HT_GPIOA_BASE)/(0x2000UL) )) + PIN)
  20. #ifdef __cplusplus
  21. }
  22. #endif
  23. #endif /* __DRV_GPIO_H__ */