main.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 "stm32f4xx_hal.h"
  29. /* Private includes ----------------------------------------------------------*/
  30. /* USER CODE BEGIN Includes */
  31. #include "st7735.h"
  32. /* USER CODE END Includes */
  33. /* Exported types ------------------------------------------------------------*/
  34. /* USER CODE BEGIN ET */
  35. /* USER CODE END ET */
  36. /* Exported constants --------------------------------------------------------*/
  37. /* USER CODE BEGIN EC */
  38. /* USER CODE END EC */
  39. /* Exported macro ------------------------------------------------------------*/
  40. /* USER CODE BEGIN EM */
  41. /* USER CODE END EM */
  42. /* Exported functions prototypes ---------------------------------------------*/
  43. void Error_Handler(void);
  44. /* USER CODE BEGIN EFP */
  45. void LED_TurnOn(uint8_t);
  46. void LED_TurnOff(uint8_t);
  47. void LED_Toggle(uint8_t);
  48. static inline void ResetPeakDetector() { HAL_GPIO_WritePin(GPIOB, GPIO_PIN_2, GPIO_PIN_SET); }
  49. static inline void SetPeakDetector() { HAL_GPIO_WritePin(GPIOB, GPIO_PIN_2, GPIO_PIN_RESET); }
  50. static inline void DisableHV() { HAL_GPIO_WritePin(GPIOC, GPIO_PIN_1, GPIO_PIN_RESET); }
  51. static inline void EnableHV() { HAL_GPIO_WritePin(GPIOC, GPIO_PIN_1, GPIO_PIN_SET); }
  52. static inline void DisableBatSupply() { HAL_GPIO_WritePin(GPIOC, GPIO_PIN_0, GPIO_PIN_RESET); }
  53. static inline void EnableBatSupply() { HAL_GPIO_WritePin(GPIOC, GPIO_PIN_0, GPIO_PIN_SET); }
  54. /* USER CODE END EFP */
  55. /* Private defines -----------------------------------------------------------*/
  56. /* USER CODE BEGIN Private defines */
  57. enum LED_Colors { LED_BLUE=0, LED_GREEN, LED_YELLOW };
  58. enum BTN_Positions { BTN_LEFT, BTN_RIGHT, BTN_UP, BTN_DOWN, BTN_CENTER };
  59. #define LM73_I2C_ADDR 0x92
  60. #define SIPM_VBR 24650
  61. #define SIPM_OVER_MIN 1000
  62. #define SIPM_OVER_MAX 5000
  63. /* USER CODE END Private defines */
  64. #ifdef __cplusplus
  65. }
  66. #endif
  67. #endif /* __MAIN_H */
  68. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/