Subversion Repositories EDIS_Ignition

Rev

Rev 4 | Rev 11 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  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.   * Copyright (c) 2023 STMicroelectronics.
  11.   * All rights reserved.
  12.   *
  13.   * This software is licensed under terms that can be found in the LICENSE file
  14.   * in the root directory of this software component.
  15.   * If no LICENSE file comes with this software, it is provided AS-IS.
  16.   *
  17.   ******************************************************************************
  18.   */
  19. /* USER CODE END Header */
  20.  
  21. /* Define to prevent recursive inclusion -------------------------------------*/
  22. #ifndef __MAIN_H
  23. #define __MAIN_H
  24.  
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28.  
  29. /* Includes ------------------------------------------------------------------*/
  30. #include "stm32f1xx_hal.h"
  31.  
  32. /* Private includes ----------------------------------------------------------*/
  33. /* USER CODE BEGIN Includes */
  34.  
  35. /* USER CODE END Includes */
  36.  
  37. /* Exported types ------------------------------------------------------------*/
  38. /* USER CODE BEGIN ET */
  39.  
  40. /* USER CODE END ET */
  41.  
  42. /* Exported constants --------------------------------------------------------*/
  43. /* USER CODE BEGIN EC */
  44. extern  SPI_HandleTypeDef hspi1;
  45. extern  TIM_HandleTypeDef htim2; // using Timer 2 for RPM counting via PIP signal
  46. /* USER CODE END EC */
  47.  
  48. /* Exported macro ------------------------------------------------------------*/
  49. /* USER CODE BEGIN EM */
  50. #define RPMTIMER 2 // define the timer
  51. #define AUXILIARY_HIGH {};
  52. #define AUXILIARY_LOW triggerSAW();
  53. // scale for filtered RPM samples
  54. static const float Scale = 2.0;
  55. /* USER CODE END EM */
  56.  
  57. void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim);
  58.  
  59. /* Exported functions prototypes ---------------------------------------------*/
  60. void Error_Handler(void);
  61.  
  62. /* USER CODE BEGIN EFP */
  63. void triggerSAW(); // Generate a SAW pulse
  64. /* USER CODE END EFP */
  65.  
  66. /* Private defines -----------------------------------------------------------*/
  67. #define SAW_DELAY 5
  68. #define PIP_Pin GPIO_PIN_0
  69. #define PIP_GPIO_Port GPIOA
  70. #define SPI1_NSS_Pin GPIO_PIN_4
  71. #define SPI1_NSS_GPIO_Port GPIOA
  72. #define SPI1_RESET_Pin GPIO_PIN_6
  73. #define SPI1_RESET_GPIO_Port GPIOA
  74. #define SPI1_CD_Pin GPIO_PIN_0
  75. #define SPI1_CD_GPIO_Port GPIOB
  76. #define PUSHBUTTON_Pin GPIO_PIN_12
  77. #define PUSHBUTTON_GPIO_Port GPIOB
  78. #define SAW_Pin GPIO_PIN_8
  79. #define SAW_GPIO_Port GPIOA
  80. #define dualSpark_Pin GPIO_PIN_9
  81. #define dualSpark_GPIO_Port GPIOA
  82. /* USER CODE BEGIN Private defines */
  83.  
  84. /* USER CODE END Private defines */
  85.  
  86. #ifdef __cplusplus
  87. }
  88. #endif
  89.  
  90. #endif /* __MAIN_H */
  91.