Subversion Repositories EngineBay2

Rev

Rev 48 | Rev 53 | 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.     // code required to use libPlx/commsLib.h
  73.  
  74.     extern void libPLXcallbackResetSerialTimeout();
  75.  
  76.     extern void libPLXcallbackSendUserData();
  77.  
  78. // we are using timer 2 for the RPM counter
  79. #define RPMTIMER 2
  80.  
  81. // code to trigger timer 3 on rising edge of contact breaker pulse
  82. #define AUXILIARY_HIGH    \
  83.   if (tim3triggered == 0) \
  84.   {                       \
  85.     tim3triggered = 1;    \
  86.     triggerTim3();        \
  87.   }
  88.  
  89. // e.g indicate that there are contact breaker closures
  90. // code to trigger indicating falling edge of contact breaker pulse
  91. #define AUXILIARY_LOW periodPulse = 0;
  92.  
  93. #if defined __cplusplus
  94.   }
  95. #endif
  96.  
  97.   /* USER CODE END EM */
  98.  
  99.   /* Exported functions prototypes ---------------------------------------------*/
  100.   void Error_Handler(void);
  101.  
  102.   /* USER CODE BEGIN EFP */
  103.   // reset temperature SPI system
  104.   extern void resetTempCS(void);
  105.   // step onto next temperature SPI value
  106.   extern void nextTempCS(void);
  107.  
  108. /* USER CODE END EFP */
  109.  
  110. /* Private defines -----------------------------------------------------------*/
  111. #define LED_Blink_Pin GPIO_PIN_13
  112. #define LED_Blink_GPIO_Port GPIOC
  113. #define V_Batt1_Pin GPIO_PIN_0
  114. #define V_Batt1_GPIO_Port GPIOA
  115. #define V_Batt2_Pin GPIO_PIN_1
  116. #define V_Batt2_GPIO_Port GPIOA
  117. #define V_Map_Pin GPIO_PIN_2
  118. #define V_Map_GPIO_Port GPIOA
  119. #define V_Oil_Pin GPIO_PIN_3
  120. #define V_Oil_GPIO_Port GPIOA
  121. #define V_Oil_Temp_Pin GPIO_PIN_4
  122. #define V_Oil_Temp_GPIO_Port GPIOA
  123. #define SPI1_SCK_Pin GPIO_PIN_5
  124. #define SPI1_SCK_GPIO_Port GPIOA
  125. #define SPI1_MISO_Pin GPIO_PIN_6
  126. #define SPI1_MISO_GPIO_Port GPIOA
  127. #define SPI1_MOSI_Pin GPIO_PIN_7
  128. #define SPI1_MOSI_GPIO_Port GPIOA
  129. #define SPI_CS_Clk_Pin GPIO_PIN_0
  130. #define SPI_CS_Clk_GPIO_Port GPIOB
  131. #define SPI_CS_D_Pin GPIO_PIN_1
  132. #define SPI_CS_D_GPIO_Port GPIOB
  133. #define Uart1_TX_Pin GPIO_PIN_9
  134. #define Uart1_TX_GPIO_Port GPIOA
  135. #define Uart1_RX_Pin GPIO_PIN_10
  136. #define Uart1_RX_GPIO_Port GPIOA
  137. #define CB_Pulse_Pin GPIO_PIN_15
  138. #define CB_Pulse_GPIO_Port GPIOA
  139. #define STARTER_ON_Pin GPIO_PIN_3
  140. #define STARTER_ON_GPIO_Port GPIOB
  141. #define ENA_AUX_5V_Pin GPIO_PIN_7
  142. #define ENA_AUX_5V_GPIO_Port GPIOB
  143.   /* USER CODE BEGIN Private defines */
  144.  
  145.   /* USER CODE END Private defines */
  146.  
  147. #ifdef __cplusplus
  148. }
  149. #endif
  150.  
  151. #endif /* __MAIN_H */
  152.