main.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /**
  2. ******************************************************************************
  3. * @file main.h
  4. * @author MCU Application Team
  5. * @brief Header for main.c file.
  6. * This file contains the common defines of the application.
  7. ******************************************************************************
  8. * @attention
  9. *
  10. * <h2><center>&copy; Copyright (c) 2023 Puya Semiconductor Co.
  11. * All rights reserved.</center></h2>
  12. *
  13. * This software component is licensed by Puya under BSD 3-Clause license,
  14. * the "License"; You may not use this file except in compliance with the
  15. * License. You may obtain a copy of the License at:
  16. * opensource.org/licenses/BSD-3-Clause
  17. *
  18. ******************************************************************************
  19. * @attention
  20. *
  21. * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
  22. * All rights reserved.</center></h2>
  23. *
  24. * This software component is licensed by ST under BSD 3-Clause license,
  25. * the "License"; You may not use this file except in compliance with the
  26. * License. You may obtain a copy of the License at:
  27. * opensource.org/licenses/BSD-3-Clause
  28. *
  29. ******************************************************************************
  30. */
  31. /* Define to prevent recursive inclusion -------------------------------------*/
  32. #ifndef __MAIN_H
  33. #define __MAIN_H
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37. /* Includes ------------------------------------------------------------------*/
  38. #include "py32f002b_ll_rcc.h"
  39. #include "py32f002b_ll_bus.h"
  40. #include "py32f002b_ll_system.h"
  41. #include "py32f002b_ll_cortex.h"
  42. #include "py32f002b_ll_utils.h"
  43. #include "py32f002b_ll_pwr.h"
  44. #include "py32f002b_ll_gpio.h"
  45. #include "py32f002b_ll_adc.h"
  46. #include "py32f002b_ll_tim.h"
  47. #include "py32f002b_ll_i2c.h"
  48. #include "py32f002b_ll_spi.h"
  49. #include "py32f002b_ll_exti.h"
  50. #include "py32f0xx_hal.h"
  51. #if defined(USE_FULL_ASSERT)
  52. #include "py32_assert.h"
  53. #endif /* USE_FULL_ASSERT */
  54. /* Private includes ----------------------------------------------------------*/
  55. /* Private defines -----------------------------------------------------------*/
  56. // #define I2C_ADDRESS 0xA0 /* Master\Slave Address */
  57. // #define I2C_SPEEDCLOCK 400000 /* Communication frequency:400K */
  58. // #define I2C_STATE_READY 0 /* Ready state */
  59. // #define I2C_STATE_BUSY_TX 1 /* Send state */
  60. // #define I2C_STATE_BUSY_RX 2 /* Receive state */
  61. #define HW_KEY_NULL ( 0)
  62. #define HW_KEY_A ( 1UL<<0)
  63. #define HW_KEY_B ( 1UL<<1)
  64. #define HW_KEY_C ( 1UL<<2)
  65. #define HW_KEY_X ( 1UL<<3)
  66. #define HW_KEY_Y ( 1UL<<4)
  67. #define HW_KEY_Z ( 1UL<<5)
  68. #define HW_KEY_L1 ( 1UL<<6)
  69. #define HW_KEY_R1 ( 1UL<<7)
  70. #define HW_KEY_L2 ( 1UL<<8)
  71. #define HW_KEY_R2 ( 1UL<<9)
  72. #define HW_KEY_SELECT ( 1UL<<10)
  73. #define HW_KEY_START ( 1UL<<11)
  74. #define HW_KEY_HOME ( 1UL<<12)
  75. #define HW_KEY_L3 ( 1UL<<13)
  76. #define HW_KEY_R3 ( 1UL<<14)
  77. #define HW_KEY_CAPTURE ( 1UL<<15) //截图/返回/touchkey
  78. #define HW_KEY_UP ( 1UL<<16)
  79. #define HW_KEY_DOWN ( 1UL<<17)
  80. #define HW_KEY_LEFT ( 1UL<<18)
  81. #define HW_KEY_RIGHT ( 1UL<<19)
  82. #define HW_KEY_BACK ( 1UL<<20) //功能按键
  83. #define HW_KEY_MODE ( 1UL<<21) //功能按键
  84. #define HW_KEY_MENU ( 1UL<<22) //功能按键
  85. #define HW_KEY_M1 ( 1UL<<23)
  86. #define HW_KEY_M2 ( 1UL<<24)
  87. #define HW_KEY_M3 ( 1UL<<25)
  88. #define HW_KEY_M4 ( 1UL<<26)
  89. #define HW_KEY_M5 ( 1UL<<27)
  90. #define HW_KEY_M6 ( 1UL<<28)
  91. #define HW_KEY_M7 ( 1UL<<29)
  92. #define HW_KEY_M8 ( 1UL<<30)
  93. #define HW_KEY_POWER ( 1UL<<31) //POWER
  94. /* Exported variables prototypes ---------------------------------------------*/
  95. /* Exported functions prototypes ---------------------------------------------*/
  96. void APP_ErrorHandler(void);
  97. void APP_SpiRxCallback(void);
  98. void APP_SpiTxCallback(void);
  99. void APP_SpiTransferErrorCallback(void);
  100. void APP_Spi_CS_EN(uint8_t en);
  101. #ifdef __cplusplus
  102. }
  103. #endif
  104. #endif /* __MAIN_H */
  105. /************************ (C) COPYRIGHT Puya *****END OF FILE******************/