main.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /* USER CODE BEGIN Header */
  2. /**
  3. ******************************************************************************
  4. * @file : main.h
  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) 2021 STMicroelectronics.
  11. * All rights reserved.</center></h2>
  12. *
  13. * This software component is licensed by ST 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. */
  20. /* USER CODE END Header */
  21. /* Define to prevent recursive inclusion -------------------------------------*/
  22. #ifndef __MAIN_H
  23. #define __MAIN_H
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. /* Includes ------------------------------------------------------------------*/
  28. #include "stm32g0xx_ll_dma.h"
  29. #include "stm32g0xx.h"
  30. #include "stm32g0xx_ll_i2c.h"
  31. #include "stm32g0xx_ll_rcc.h"
  32. #include "stm32g0xx_ll_bus.h"
  33. #include "stm32g0xx_ll_system.h"
  34. #include "stm32g0xx_ll_exti.h"
  35. #include "stm32g0xx_ll_cortex.h"
  36. #include "stm32g0xx_ll_utils.h"
  37. #include "stm32g0xx_ll_pwr.h"
  38. #include "stm32g0xx_ll_spi.h"
  39. #include "stm32g0xx_ll_tim.h"
  40. #include "stm32g0xx_ll_gpio.h"
  41. #if defined(USE_FULL_ASSERT)
  42. #include "stm32_assert.h"
  43. #endif /* USE_FULL_ASSERT */
  44. /* Private includes ----------------------------------------------------------*/
  45. /* USER CODE BEGIN Includes */
  46. #include "gpio.h"
  47. /* USER CODE END Includes */
  48. /* Exported types ------------------------------------------------------------*/
  49. /* USER CODE BEGIN ET */
  50. typedef enum {
  51. DOWN = 0,
  52. UP = 1
  53. } updown_t;
  54. typedef enum {
  55. OFF = 0,
  56. ON = 1
  57. } onoff_t;
  58. /* USER CODE END ET */
  59. /* Exported constants --------------------------------------------------------*/
  60. /* USER CODE BEGIN EC */
  61. /* USER CODE END EC */
  62. /* Exported macro ------------------------------------------------------------*/
  63. /* USER CODE BEGIN EM */
  64. #define LATCH_DOWN GPIOB->BRR = 0x10
  65. #define LATCH_UP GPIOB->BSRR = 0x10
  66. #define SHDN_OFF GPIOA->BRR = 0x10
  67. #define SHDN_ON GPIOA->BSRR = 0x10
  68. #define IN15_P GPIOA->BSRR = 0x1
  69. #define IN15_Plus GPIOA->BSRR = 0x2
  70. #define IN15_Minus GPIOA->BSRR = 0x4
  71. #define IN15_Percent GPIOA->BSRR = 0x8
  72. #define IN15_OFF GPIOA->BRR = 0xF
  73. #define COLOR_R(x) TIM3->CCR1 = x
  74. #define COLOR_B(x) TIM3->CCR2 = x
  75. #define COLOR_G(x) TIM3->CCR3 = x
  76. #define COLOR_RGB(r, g, b) TIM3->CCR1 = r; TIM3->CCR3 = g; TIM3->CCR2 = b
  77. /* USER CODE END EM */
  78. /* Exported functions prototypes ---------------------------------------------*/
  79. void Error_Handler(void);
  80. /* USER CODE BEGIN EFP */
  81. /* USER CODE END EFP */
  82. /* Private defines -----------------------------------------------------------*/
  83. #define LC0_Pin LL_GPIO_PIN_0
  84. #define LC0_GPIO_Port GPIOA
  85. #define LC1_Pin LL_GPIO_PIN_1
  86. #define LC1_GPIO_Port GPIOA
  87. #define LC2_Pin LL_GPIO_PIN_2
  88. #define LC2_GPIO_Port GPIOA
  89. #define LC3_Pin LL_GPIO_PIN_3
  90. #define LC3_GPIO_Port GPIOA
  91. #define SHDN_Pin LL_GPIO_PIN_4
  92. #define SHDN_GPIO_Port GPIOA
  93. #define PWM_R_Pin LL_GPIO_PIN_6
  94. #define PWM_R_GPIO_Port GPIOA
  95. #define PWM_G_Pin LL_GPIO_PIN_7
  96. #define PWM_G_GPIO_Port GPIOA
  97. #define PWM_B_Pin LL_GPIO_PIN_0
  98. #define PWM_B_GPIO_Port GPIOB
  99. #define PWM_T_Pin LL_GPIO_PIN_1
  100. #define PWM_T_GPIO_Port GPIOB
  101. #define BTN1_Pin LL_GPIO_PIN_8
  102. #define BTN1_GPIO_Port GPIOA
  103. #define BTN2_Pin LL_GPIO_PIN_9
  104. #define BTN2_GPIO_Port GPIOA
  105. #define BTN3_Pin LL_GPIO_PIN_10
  106. #define BTN3_GPIO_Port GPIOA
  107. #define BTN4_Pin LL_GPIO_PIN_11
  108. #define BTN4_GPIO_Port GPIOA
  109. #define Latch_Pin LL_GPIO_PIN_4
  110. #define Latch_GPIO_Port GPIOB
  111. #define IRQ_Pin LL_GPIO_PIN_8
  112. #define IRQ_GPIO_Port GPIOB
  113. #define IRQ_EXTI_IRQn EXTI4_15_IRQn
  114. /* USER CODE BEGIN Private defines */
  115. /* USER CODE END Private defines */
  116. #ifdef __cplusplus
  117. }
  118. #endif
  119. #endif /* __MAIN_H */
  120. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/