Rev 45 | Rev 50 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 45 | Rev 48 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 | /* USER CODE BEGIN Header */ |
1 | /* USER CODE BEGIN Header */ |
| 2 | /** |
2 | /** |
| 3 | ****************************************************************************** |
3 | ****************************************************************************** |
| 4 | * @file : main.h |
4 | * @file : main.h |
| 5 | * @brief : Header for main.c file. |
5 | * @brief : Header for main.c file. |
| 6 | * This file contains the common defines of the application. |
6 | * This file contains the common defines of the application. |
| 7 | ****************************************************************************** |
7 | ****************************************************************************** |
| 8 | * @attention |
8 | * @attention |
| 9 | * |
9 | * |
| 10 | * <h2><center>© Copyright (c) 2021 STMicroelectronics. |
10 | * <h2><center>© Copyright (c) 2021 STMicroelectronics. |
| 11 | * All rights reserved.</center></h2> |
11 | * All rights reserved.</center></h2> |
| 12 | * |
12 | * |
| 13 | * This software component is licensed by ST under BSD 3-Clause license, |
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 |
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: |
15 | * License. You may obtain a copy of the License at: |
| 16 | * opensource.org/licenses/BSD-3-Clause |
16 | * opensource.org/licenses/BSD-3-Clause |
| 17 | * |
17 | * |
| 18 | ****************************************************************************** |
18 | ****************************************************************************** |
| 19 | */ |
19 | */ |
| 20 | /* USER CODE END Header */ |
20 | /* USER CODE END Header */ |
| 21 | 21 | ||
| 22 | /* Define to prevent recursive inclusion -------------------------------------*/ |
22 | /* Define to prevent recursive inclusion -------------------------------------*/ |
| 23 | #ifndef __MAIN_H |
23 | #ifndef __MAIN_H |
| 24 | #define __MAIN_H |
24 | #define __MAIN_H |
| 25 | 25 | ||
| 26 | #ifdef __cplusplus |
26 | #ifdef __cplusplus |
| 27 | extern "C" { |
27 | extern "C" |
| - | 28 | { |
|
| 28 | #endif |
29 | #endif |
| 29 | 30 | ||
| 30 | /* Includes ------------------------------------------------------------------*/ |
31 | /* Includes ------------------------------------------------------------------*/ |
| 31 | #include "stm32f1xx_hal.h" |
32 | #include "stm32f1xx_hal.h" |
| 32 | 33 | ||
| 33 | /* Private includes ----------------------------------------------------------*/ |
34 | /* Private includes ----------------------------------------------------------*/ |
| 34 | /* USER CODE BEGIN Includes */ |
35 | /* USER CODE BEGIN Includes */ |
| 35 | #include "main_export.h" |
36 | #include "main_export.h" |
| 36 | /* USER CODE END Includes */ |
37 | /* USER CODE END Includes */ |
| 37 | 38 | ||
| 38 | /* Exported types ------------------------------------------------------------*/ |
39 | /* Exported types ------------------------------------------------------------*/ |
| 39 | /* USER CODE BEGIN ET */ |
40 | /* USER CODE BEGIN ET */ |
| 40 | 41 | ||
| 41 | /* USER CODE END ET */ |
42 | /* USER CODE END ET */ |
| 42 | 43 | ||
| 43 | /* Exported constants --------------------------------------------------------*/ |
44 | /* Exported constants --------------------------------------------------------*/ |
| 44 | /* USER CODE BEGIN EC */ |
45 | /* USER CODE BEGIN EC */ |
| 45 | 46 | ||
| - | 47 | // scale for filtered samples |
|
| - | 48 | #define Scale 1024.0 |
|
| - | 49 | // USART buffer sizes |
|
| 46 | #define TX_USART_BUFF_SIZ 512 |
50 | #define TX_USART_BUFF_SIZ 512 |
| 47 | 51 | ||
| 48 | #define RX_USART_BUFF_SIZ 512 |
52 | #define RX_USART_BUFF_SIZ 512 |
| 49 | 53 | ||
| - | 54 | // Number of SPI temperature sensors |
|
| 50 | #define NUM_SPI_TEMP_SENS 4 |
55 | #define NUM_SPI_TEMP_SENS 4 |
| 51 | 56 | ||
| 52 | - | ||
| 53 | /* USER CODE END EC */ |
57 | /* USER CODE END EC */ |
| 54 | 58 | ||
| 55 | /* Exported macro ------------------------------------------------------------*/ |
59 | /* Exported macro ------------------------------------------------------------*/ |
| 56 | /* USER CODE BEGIN EM */ |
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 |
|
| 57 | 90 | ||
| 58 | /* USER CODE END EM */ |
91 | /* USER CODE END EM */ |
| 59 | 92 | ||
| 60 | /* Exported functions prototypes ---------------------------------------------*/ |
93 | /* Exported functions prototypes ---------------------------------------------*/ |
| 61 | void Error_Handler(void); |
94 | void Error_Handler(void); |
| 62 | 95 | ||
| 63 | /* USER CODE BEGIN EFP */ |
96 | /* USER CODE BEGIN EFP */ |
| 64 | // reset temperature SPI system |
97 | // reset temperature SPI system |
| 65 | extern void resetTempCS(void); |
98 | extern void resetTempCS(void); |
| 66 | // step onto next temperature SPI value |
99 | // step onto next temperature SPI value |
| 67 | extern void nextTempCS(void); |
100 | extern void nextTempCS(void); |
| 68 | 101 | ||
| 69 | /* USER CODE END EFP */ |
102 | /* USER CODE END EFP */ |
| 70 | 103 | ||
| 71 | /* Private defines -----------------------------------------------------------*/ |
104 | /* Private defines -----------------------------------------------------------*/ |
| 72 | #define LED_Blink_Pin GPIO_PIN_13 |
105 | #define LED_Blink_Pin GPIO_PIN_13 |
| Line 99... | Line 132... | ||
| 99 | #define CB_Pulse_GPIO_Port GPIOA |
132 | #define CB_Pulse_GPIO_Port GPIOA |
| 100 | #define STARTER_ON_Pin GPIO_PIN_3 |
133 | #define STARTER_ON_Pin GPIO_PIN_3 |
| 101 | #define STARTER_ON_GPIO_Port GPIOB |
134 | #define STARTER_ON_GPIO_Port GPIOB |
| 102 | #define ENA_AUX_5V_Pin GPIO_PIN_7 |
135 | #define ENA_AUX_5V_Pin GPIO_PIN_7 |
| 103 | #define ENA_AUX_5V_GPIO_Port GPIOB |
136 | #define ENA_AUX_5V_GPIO_Port GPIOB |
| 104 | /* USER CODE BEGIN Private defines */ |
137 | /* USER CODE BEGIN Private defines */ |
| 105 | 138 | ||
| 106 | /* USER CODE END Private defines */ |
139 | /* USER CODE END Private defines */ |
| 107 | 140 | ||
| 108 | #ifdef __cplusplus |
141 | #ifdef __cplusplus |
| 109 | } |
142 | } |
| 110 | #endif |
143 | #endif |
| 111 | 144 | ||