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