yc11xx_gpio.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /**
  2. * Copyright 2016, yichip Semiconductor(shenzhen office)
  3. * All Rights Reserved.
  4. *
  5. * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Yichip Semiconductor;
  6. * the contents of this file may not be disclosed to third parties, copied
  7. * or duplicated in any form, in whole or in part, without the prior
  8. * written permission of Yichip Semiconductor.
  9. */
  10. /**
  11. *@file gpio.h
  12. *@brief GPIO support for application.
  13. */
  14. #ifndef _GPIO_H_
  15. #define _GPIO_H_
  16. #include <stdio.h>
  17. #include <stdint.h>
  18. #include "yc11xx.h"
  19. #include "type.h"
  20. #define GPIO_NUM_MASK 0x1f
  21. #define GPIO_WAKEUP_LOW_REG mem_gpio_wakeup_low
  22. #define GPIO_WAKEUP_HIGH_REG mem_gpio_wakeup_high
  23. typedef enum
  24. {
  25. GPIO_Mode_IN_FLOATING = 0x01,
  26. GPIO_Mode_IPU = 0x02,
  27. GPIO_Mode_IPD = 0x03,
  28. GPIO_Mode_AIN = 0x04,
  29. }GPIO_InputTypeDef;
  30. /**
  31. * @brief gpio output enumeration
  32. */
  33. typedef enum
  34. {
  35. OUT_LOW = 0,
  36. OUT_HIGH = 1
  37. }GPIO_OutputTypeDef;
  38. typedef enum
  39. {
  40. LOW_AWAKEN = 0,
  41. HIGH_AWAKEN = 1
  42. }GPIO_AwakenTypeDef;
  43. void GPIO_SetOut(GPIO_NUM gpio,GPIO_OutputTypeDef GPIO_OUT);
  44. void GPIO_SetInput(GPIO_NUM gpio,GPIO_InputTypeDef GPIO_InputMode);
  45. void GPIO_ClearWakeup(GPIO_NUM gpio);
  46. void GPIO_SetGpioMultFunction(GPIO_NUM gpio, uint8_t Func);
  47. BOOL gpioGetBit(uint8_t Num, uint32_t regBase);
  48. BOOL GPIO_GetInputStatus(GPIO_NUM gpio);
  49. void GPIO_SetWakeup(GPIO_NUM gpio, GPIO_AwakenTypeDef AWAKEN);
  50. void GPIO_SetWakeupByCurrentState(GPIO_NUM gpio);
  51. #endif