drv_gpio.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Copyright (c) 2006-2025, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2025-08-20 kurisaw first version
  9. */
  10. #ifndef __DRV_GPIO_H__
  11. #define __DRV_GPIO_H__
  12. #include <rtdef.h>
  13. #include <hal_data.h>
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. #define PIN_LOW 0x00
  18. #define PIN_HIGH 0x01
  19. #define PIN_MODE_OUTPUT 0x00
  20. #define PIN_MODE_INPUT 0x01
  21. #define PIN_MODE_INPUT_PULLUP 0x02
  22. #define PIN_MODE_INPUT_PULLDOWN 0x03
  23. #define PIN_MODE_OUTPUT_OD 0x04
  24. #ifdef SOC_SERIES_R9A07G0
  25. #define RA_MIN_PIN_VALUE BSP_IO_PORT_00_PIN_0
  26. #define RA_MAX_PIN_VALUE BSP_IO_PORT_24_PIN_7
  27. #else
  28. #define RA_MIN_PIN_VALUE BSP_IO_PORT_00_PIN_00
  29. #define RA_MAX_PIN_VALUE BSP_IO_PORT_11_PIN_15
  30. #endif
  31. void rt_pin_mode(rt_uint64_t pin, rt_uint8_t mode);
  32. void rt_pin_write(rt_uint64_t pin, rt_uint8_t value);
  33. rt_int8_t rt_pin_read(rt_uint64_t pin);
  34. #ifdef __cplusplus
  35. }
  36. #endif
  37. #endif /* __DRV_GPIO_H__ */