gpio.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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) 2018. 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. /*************<start>******************/
  34. #ifndef __GPIO_H__
  35. #define __GPIO_H__
  36. #ifdef __cplusplus
  37. extern "C" {
  38. #endif
  39. /*************<include>****************/
  40. #include "ac780x_gpio.h"
  41. /*************<macro>******************/
  42. /* define key gpio */
  43. //#define GPIO_CLOSE_KEY GPIOA,GPIO_PIN15
  44. //#define GPIO_OPEN_KEY GPIOA,GPIO_PIN0
  45. //#define GPIO_COVER_KEY GPIOA,GPIO_PIN1
  46. #define RS485CTRL_PORT (GPIOB)
  47. #define RS485CTRL_PIN (GPIO_PIN3)
  48. #define RS485_TX_EN do{GPIO_SetPinLevel(RS485CTRL_PORT, RS485CTRL_PIN, GPIO_LEVEL_HIGH);}while(0)
  49. #define RS485_RX_EN do{GPIO_SetPinLevel(RS485CTRL_PORT, RS485CTRL_PIN, GPIO_LEVEL_LOW);}while(0)
  50. #define RUNLED_PORT (GPIOA)
  51. #define RUNLED_PIN (GPIO_PIN0)
  52. /*RUNLED¶¯×÷¶¨Òå.*/
  53. #define RUNLED_ON do{GPIO_SetPinLevel(RUNLED_PORT, RUNLED_PIN, GPIO_LEVEL_HIGH);}while(0)
  54. #define RUNLED_OFF do{GPIO_SetPinLevel(RUNLED_PORT, RUNLED_PIN, GPIO_LEVEL_LOW);}while(0)
  55. #define RUNLED_TOGGLE do{if(GPIO_GetPinLevel(RUNLED_PORT, RUNLED_PIN)){RUNLED_OFF;}else{RUNLED_ON;}}while(0)
  56. #define SV1_PORT (GPIOC)
  57. #define SV1_PIN (GPIO_PIN8)
  58. #define SV2_PORT (GPIOC)
  59. #define SV2_PIN (GPIO_PIN7)
  60. #define SV3_PORT (GPIOC)
  61. #define SV3_PIN (GPIO_PIN6)
  62. #define SV4_PORT (GPIOA)
  63. #define SV4_PIN (GPIO_PIN11)
  64. #define SV_OPEN (1)
  65. #define SV_CLOSE (0)
  66. /*************<enum>*******************/
  67. enum SV_ID {
  68. SV_01 = 0,
  69. SV_02,
  70. SV_03,
  71. SV_04,
  72. SV_ALL
  73. };
  74. /*************<union>******************/
  75. /*************<struct>*****************/
  76. /*************<extern>*****************/
  77. extern uint8_t g_svstatus;
  78. /*************<prototype>**************/
  79. void GPIO_PortInit(void);
  80. void Sv_Control(uint8_t id, uint8_t action);
  81. #ifdef __cplusplus
  82. }
  83. #endif
  84. #endif /* __GPIO_H__ */
  85. /*************<end>********************/