Subversion Repositories EngineBay2

Rev

Rev 45 | Rev 50 | 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.  * <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.  
  22. /* Define to prevent recursive inclusion -------------------------------------*/
  23. #ifndef __MAIN_H
  24. #define __MAIN_H
  25.  
  26. #ifdef __cplusplus
  27. extern "C"
  28. {
  29. #endif
  30.  
  31. /* Includes ------------------------------------------------------------------*/
  32. #include "stm32f1xx_hal.h"
  33.  
  34. /* Private includes ----------------------------------------------------------*/
  35. /* USER CODE BEGIN Includes */
  36. #include "main_export.h"
  37.   /* USER CODE END Includes */
  38.  
  39.   /* Exported types ------------------------------------------------------------*/
  40.   /* USER CODE BEGIN ET */
  41.  
  42.   /* USER CODE END ET */
  43.  
  44.   /* Exported constants --------------------------------------------------------*/
  45.   /* USER CODE BEGIN EC */
  46.  
  47. // scale for filtered samples
  48. #define Scale 1024.0
  49. // USART buffer sizes
  50. #define TX_USART_BUFF_SIZ 512
  51.  
  52. #define RX_USART_BUFF_SIZ 512
  53.  
  54. // Number of SPI temperature sensors
  55. #define NUM_SPI_TEMP_SENS 4
  56.  
  57. /* USER CODE END EC */
  58.  
  59. /* Exported macro ------------------------------------------------------------*/
  60. /* USER CODE BEGIN EM */
  61. #if defined __cplusplus
  62.   extern "C"
  63.   {
  64. #endif
  65.  
  66.     // code required to use libIgnTiming/rpm.h
  67.     extern unsigned char volatile periodPulse;
  68.  
  69.     extern unsigned char volatile tim3triggered;
  70.     extern void triggerTim3(void);
  71.  
  72. // we are using timer 2 for the RPM counter
  73. #define RPMTIMER 2
  74.  
  75. // code to trigger timer 3 on rising edge of contact breaker pulse
  76. #define AUXILIARY_HIGH    \
  77.   if (tim3triggered == 0) \
  78.   {                       \
  79.     tim3triggered = 1;    \
  80.     triggerTim3();        \
  81.   }
  82.  
  83. // e.g indicate that there are contact breaker closures
  84. // code to trigger indicating falling edge of contact breaker pulse
  85. #define AUXILIARY_LOW periodPulse = 0;
  86.  
  87. #if defined __cplusplus
  88.   }
  89. #endif
  90.  
  91.   /* USER CODE END EM */
  92.  
  93.   /* Exported functions prototypes ---------------------------------------------*/
  94.   void Error_Handler(void);
  95.  
  96.   /* USER CODE BEGIN EFP */
  97.   // reset temperature SPI system
  98.   extern void resetTempCS(void);
  99.   // step onto next temperature SPI value
  100.   extern void nextTempCS(void);
  101.  
  102. /* USER CODE END EFP */
  103.  
  104. /* Private defines -----------------------------------------------------------*/
  105. #define LED_Blink_Pin GPIO_PIN_13
  106. #define LED_Blink_GPIO_Port GPIOC
  107. #define V_Batt1_Pin GPIO_PIN_0
  108. #define V_Batt1_GPIO_Port GPIOA
  109. #define V_Batt2_Pin GPIO_PIN_1
  110. #define V_Batt2_GPIO_Port GPIOA
  111. #define V_Map_Pin GPIO_PIN_2
  112. #define V_Map_GPIO_Port GPIOA
  113. #define V_Oil_Pin GPIO_PIN_3
  114. #define V_Oil_GPIO_Port GPIOA
  115. #define V_Oil_Temp_Pin GPIO_PIN_4
  116. #define V_Oil_Temp_GPIO_Port GPIOA
  117. #define SPI1_SCK_Pin GPIO_PIN_5
  118. #define SPI1_SCK_GPIO_Port GPIOA
  119. #define SPI1_MISO_Pin GPIO_PIN_6
  120. #define SPI1_MISO_GPIO_Port GPIOA
  121. #define SPI1_MOSI_Pin GPIO_PIN_7
  122. #define SPI1_MOSI_GPIO_Port GPIOA
  123. #define SPI_CS_Clk_Pin GPIO_PIN_0
  124. #define SPI_CS_Clk_GPIO_Port GPIOB
  125. #define SPI_CS_D_Pin GPIO_PIN_1
  126. #define SPI_CS_D_GPIO_Port GPIOB
  127. #define Uart1_TX_Pin GPIO_PIN_9
  128. #define Uart1_TX_GPIO_Port GPIOA
  129. #define Uart1_RX_Pin GPIO_PIN_10
  130. #define Uart1_RX_GPIO_Port GPIOA
  131. #define CB_Pulse_Pin GPIO_PIN_15
  132. #define CB_Pulse_GPIO_Port GPIOA
  133. #define STARTER_ON_Pin GPIO_PIN_3
  134. #define STARTER_ON_GPIO_Port GPIOB
  135. #define ENA_AUX_5V_Pin GPIO_PIN_7
  136. #define ENA_AUX_5V_GPIO_Port GPIOB
  137.   /* USER CODE BEGIN Private defines */
  138.  
  139.   /* USER CODE END Private defines */
  140.  
  141. #ifdef __cplusplus
  142. }
  143. #endif
  144.  
  145. #endif /* __MAIN_H */
  146.