gpio.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /* Copyright Statement:
  2. *
  3. * This software/firmware and related documentation ("AutoChips Software") are
  4. * protected under relevant copyright laws. The information contained herein is
  5. * confidential and proprietary to AutoChips Inc. and/or its licensors. Without
  6. * the prior written permission of AutoChips inc. and/or its licensors, any
  7. * reproduction, modification, use or disclosure of AutoChips Software, and
  8. * information contained herein, in whole or in part, shall be strictly
  9. * prohibited.
  10. *
  11. * AutoChips Inc. (C) 2022. All rights reserved.
  12. *
  13. * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  14. * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("AUTOCHIPS SOFTWARE")
  15. * RECEIVED FROM AUTOCHIPS AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
  16. * ON AN "AS-IS" BASIS ONLY. AUTOCHIPS EXPRESSLY DISCLAIMS ANY AND ALL
  17. * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
  19. * NONINFRINGEMENT. NEITHER DOES AUTOCHIPS PROVIDE ANY WARRANTY WHATSOEVER WITH
  20. * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
  21. * INCORPORATED IN, OR SUPPLIED WITH THE AUTOCHIPS SOFTWARE, AND RECEIVER AGREES
  22. * TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
  23. * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
  24. * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN AUTOCHIPS
  25. * SOFTWARE. AUTOCHIPS SHALL ALSO NOT BE RESPONSIBLE FOR ANY AUTOCHIPS SOFTWARE
  26. * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
  27. * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND AUTOCHIPS'S
  28. * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE AUTOCHIPS SOFTWARE
  29. * RELEASED HEREUNDER WILL BE, AT AUTOCHIPS'S OPTION, TO REVISE OR REPLACE THE
  30. * AUTOCHIPS SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
  31. * CHARGE PAID BY RECEIVER TO AUTOCHIPS FOR SUCH AUTOCHIPS SOFTWARE AT ISSUE.
  32. */
  33. /******************************************************************************
  34. * @version: V2.0.1 AC7840x Demo
  35. ******************************************************************************/
  36. #ifndef _GPIO_H
  37. #define _GPIO_H
  38. /*!
  39. * @file gpio.h
  40. *
  41. * @brief gpio function definition.
  42. */
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif /* __cplusplus */
  46. /* =========================================== Includes =========================================== */
  47. #include <stdbool.h>
  48. #include <stdint.h>
  49. #include "ac7840x.h"
  50. #include "gpio_drv.h"
  51. #include "port_hw.h"
  52. /* ============================================ Define ============================================ */
  53. //电磁阀输出
  54. #define LED1_PORT (PORTD)
  55. #define LED1_GPIO (GPIOD)
  56. #define LED1_PIN (7)
  57. //433 语音播报输出
  58. #define LED2_PORT (PORTC)
  59. #define LED2_GPIO (GPIOC)
  60. #define LED2_PIN (5)
  61. //设备运行指示灯
  62. #define LED3_PORT (PORTC)
  63. #define LED3_GPIO (GPIOC)
  64. #define LED3_PIN (16)
  65. //底阀开关状态指示灯
  66. #define LED4_PORT (PORTC)
  67. #define LED4_GPIO (GPIOC)
  68. #define LED4_PIN (17)
  69. //底阀开关状态输入
  70. #define KEY3_PORT (PORTD)
  71. #define KEY3_GPIO (GPIOD)
  72. #define KEY3_PIN (6)
  73. //#define KEY4_PORT (PORTE)
  74. //#define KEY4_GPIO (GPIOE)
  75. //#define KEY4_PIN (7)
  76. //#define KEY4_IRQ (PORTE_IRQn)
  77. //#define KEY4_INSTANCE (4)
  78. #define LED1_ON do{GPIO_DRV_WritePin(LED1_GPIO , LED1_PIN, 1);}while(0)
  79. #define LED1_OFF do{GPIO_DRV_WritePin(LED1_GPIO, LED1_PIN, 0);}while(0)
  80. #define LED1_TOGGLE do{GPIO_DRV_TogglePins(LED1_GPIO, (1<<LED1_PIN));}while(0)
  81. #define LED2_ON do{GPIO_DRV_WritePin(LED2_GPIO , LED2_PIN, 1);}while(0)
  82. #define LED2_OFF do{GPIO_DRV_WritePin(LED2_GPIO, LED2_PIN, 0);}while(0)
  83. #define LED2_TOGGLE do{GPIO_DRV_TogglePins(LED2_GPIO, (1<<LED2_PIN));}while(0)
  84. #define LED3_ON do{GPIO_DRV_WritePin(LED3_GPIO , LED3_PIN, 0);}while(0)
  85. #define LED3_OFF do{GPIO_DRV_WritePin(LED3_GPIO, LED3_PIN, 1);}while(0)
  86. #define LED3_TOGGLE do{GPIO_DRV_TogglePins(LED3_GPIO, (1<<LED3_PIN));}while(0)
  87. #define LED4_ON do{GPIO_DRV_WritePin(LED4_GPIO, LED4_PIN, 0);}while(0)
  88. #define LED4_OFF do{GPIO_DRV_WritePin(LED4_GPIO, LED4_PIN, 1);}while(0)
  89. #define LED4_TOGGLE do{GPIO_DRV_TogglePins(LED4_GPIO, (1<<LED4_PIN));}while(0)
  90. #define GET_K3_STS() (GPIO_DRV_ReadPins(KEY3_GPIO)& (1<<KEY3_PIN))
  91. //#define GET_K4_STS() (GPIO_DRV_ReadPins(KEY4_GPIO)& (1<<KEY4_PIN))
  92. #define DIR_IN (0)
  93. #define DIR_OUT (1)
  94. #define LOW (0)
  95. #define HIGH (1)
  96. /* =========================================== Typedef ============================================ */
  97. /* ========================================== Variables =========================================== */
  98. //extern uint8_t g_key4PressDown_count;
  99. /* ==================================== Functions declaration ===================================== */
  100. extern void GPIO_LedInit(void);
  101. extern void GPIO_KeyInit(void);
  102. void GPIO_Init(void);
  103. /* ====================================== Functions define ======================================== */
  104. #ifdef __cplusplus
  105. }
  106. #endif
  107. #endif /* _GPIO_H */
  108. /* ============================================= EOF ============================================== */