main.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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) 2020 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. /* Private includes ----------------------------------------------------------*/
  29. /* USER CODE BEGIN Includes */
  30. #include "board.h"
  31. #include <stdio.h>
  32. #include <stdint.h>
  33. #include <stdbool.h>
  34. #include <stdlib.h>
  35. #include <string.h>
  36. /* USER CODE END Includes */
  37. /* Exported types ------------------------------------------------------------*/
  38. /* USER CODE BEGIN ET */
  39. extern IWDG_HandleTypeDef hiwdg;
  40. extern CRC_HandleTypeDef hcrc;
  41. /* USER CODE END ET */
  42. /* Exported constants --------------------------------------------------------*/
  43. /* USER CODE BEGIN EC */
  44. // This is left here just to have it handy for copying when debugging a specific function
  45. // Don't uncomment!!
  46. // __attribute__((optimize("O0")))
  47. #define DEBUG_ERROR
  48. /* USER CODE END EC */
  49. /* Exported macro ------------------------------------------------------------*/
  50. /* USER CODE BEGIN EM */
  51. // STM32CUBE IDE removed line printing in Error Handler. This macro restores it.
  52. // Credits: https://community.st.com/s/question/0D50X00009XkffVSAR/stm32cubemx-v421-errorhandler-definition-issues-in-mainh
  53. #ifdef DEBUG_ERROR
  54. #define GET_MACRO( _0, _1, NAME, ... ) NAME
  55. #define Error_Handler(...) GET_MACRO( _0, ##__VA_ARGS__, Error_Handler1, Error_Handler0 )()
  56. #define Error_Handler0() _Error_Handler(__BASE_FILE__, __LINE__ )
  57. #define Error_Handler1(unused) _Error_Handler( char * file, int line )
  58. void _Error_Handler(char *, int);
  59. #endif
  60. /* USER CODE END EM */
  61. void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim);
  62. /* Exported functions prototypes ---------------------------------------------*/
  63. void Error_Handler(void);
  64. /* USER CODE BEGIN EFP */
  65. void Program_Handler(void);
  66. /* USER CODE END EFP */
  67. /* Private defines -----------------------------------------------------------*/
  68. /* USER CODE BEGIN Private defines */
  69. #define WAKE_input() HAL_GPIO_ReadPin(WAKE_GPIO_Port, WAKE_Pin)
  70. #define BUTTON_input() HAL_GPIO_ReadPin(ENC_SW_GPIO_Port, ENC_SW_Pin)
  71. /* USER CODE END Private defines */
  72. #ifdef __cplusplus
  73. }
  74. #endif
  75. #endif /* __MAIN_H */
  76. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/