hal_gpio.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * BSD 2-Clause License
  3. * Copyright (c) 2022, LiteEMF
  4. * All rights reserved.
  5. * This software component is licensed by LiteEMF under BSD 2-Clause license,
  6. * the "License"; You may not use this file except in compliance with the
  7. * License. You may obtain a copy of the License at:
  8. * opensource.org/licenses/BSD-2-Clause
  9. *
  10. */
  11. #ifndef _hal_gpio_h
  12. #define _hal_gpio_h
  13. #include "emf_typedef.h"
  14. #include "py32f002b_ll_gpio.h"
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. /******************************************************************************************************
  19. ** Defined
  20. *******************************************************************************************************/
  21. #define HW_PORTA_BASE 0x00
  22. #define HW_PORTB_BASE 0x10
  23. #define HW_PORTC_BASE 0x20
  24. #define HW_PORTD_BASE 0x30
  25. #define HW_PIN_MASK 0x0F
  26. #define HW_PORT_MASK 0xF0
  27. /******************************************************************************************************
  28. ** Parameters
  29. *******************************************************************************************************/
  30. GPIO_TypeDef * get_gpio_port(pin_t io);
  31. uint32_t get_gpio_rcc(pin_t io);
  32. uint32_t get_gpio_pin(pin_t io);
  33. /*****************************************************************************************************
  34. ** Function
  35. ******************************************************************************************************/
  36. #ifdef __cplusplus
  37. }
  38. #endif
  39. #endif