drv_gpio.h 676 B

1234567891011121314151617181920212223242526
  1. /*
  2. *
  3. * SPDX-License-Identifier: Apache-2.0
  4. *
  5. * Change Logs:
  6. * Date Author Notes
  7. * 2020-09-05 DongBowen first version
  8. */
  9. #ifndef __DRV_GPIO_H__
  10. #define __DRV_GPIO_H__
  11. #include <rtdevice.h>
  12. #include "hc32l196_ddl.h"
  13. #include "hc32l196_gpio.h"
  14. #ifdef RT_USING_PIN
  15. #define __HC_PORT(port) GpioPort##port
  16. #define __HC_PORT_ADJUST(port) ((port) <= GpioPortD ? (port) : ((port) & 0xff) + 0x100)
  17. #define GET_PIN(PORT, PIN) (((rt_uint16_t)__HC_PORT_ADJUST(__HC_PORT(PORT)) / 4) + PIN)
  18. #define __GET_PIN(PORT, PIN) (((rt_uint16_t)__HC_PORT_ADJUST(PORT) / 4) + PIN)
  19. #endif
  20. #endif /* __DRV_GPIO_H__ */