Subversion Repositories EngineBay2

Rev

Rev 48 | Rev 53 | 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>&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
 */
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
48 mjames 27
extern "C"
28
{
38 mjames 29
#endif
30
 
31
/* Includes ------------------------------------------------------------------*/
32
#include "stm32f1xx_hal.h"
33
 
34
/* Private includes ----------------------------------------------------------*/
35
/* USER CODE BEGIN Includes */
36
#include "main_export.h"
48 mjames 37
  /* USER CODE END Includes */
38 mjames 38
 
48 mjames 39
  /* Exported types ------------------------------------------------------------*/
40
  /* USER CODE BEGIN ET */
38 mjames 41
 
48 mjames 42
  /* USER CODE END ET */
38 mjames 43
 
48 mjames 44
  /* Exported constants --------------------------------------------------------*/
45
  /* USER CODE BEGIN EC */
38 mjames 46
 
48 mjames 47
// scale for filtered samples
48
#define Scale 1024.0
49
// USART buffer sizes
42 mjames 50
#define TX_USART_BUFF_SIZ 512
51
 
52
#define RX_USART_BUFF_SIZ 512
53
 
50 mjames 54
// Number of SPI temperature sensors
42 mjames 55
#define NUM_SPI_TEMP_SENS 4
56
 
38 mjames 57
/* USER CODE END EC */
58
 
59
/* Exported macro ------------------------------------------------------------*/
60
/* USER CODE BEGIN EM */
48 mjames 61
#if defined __cplusplus
62
  extern "C"
63
  {
64
#endif
38 mjames 65
 
48 mjames 66
    // code required to use libIgnTiming/rpm.h
67
    extern unsigned char volatile periodPulse;
38 mjames 68
 
48 mjames 69
    extern unsigned char volatile tim3triggered;
70
    extern void triggerTim3(void);
38 mjames 71
 
50 mjames 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
48 mjames 79
#define RPMTIMER 2
38 mjames 80
 
50 mjames 81
// code to trigger timer 3 on rising edge of contact breaker pulse
48 mjames 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
50 mjames 90
// code to trigger indicating falling edge of contact breaker pulse
48 mjames 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
 
38 mjames 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
40 mjames 117
#define V_Map_Pin GPIO_PIN_2
118
#define V_Map_GPIO_Port GPIOA
119
#define V_Oil_Pin GPIO_PIN_3
38 mjames 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
43 mjames 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
42 mjames 132
#define SPI_CS_D_GPIO_Port GPIOB
38 mjames 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
48 mjames 143
  /* USER CODE BEGIN Private defines */
38 mjames 144
 
48 mjames 145
  /* USER CODE END Private defines */
38 mjames 146
 
147
#ifdef __cplusplus
148
}
149
#endif
150
 
151
#endif /* __MAIN_H */