Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
50 | mjames | 1 | /* USER CODE BEGIN Header */ |
2 | /** |
||
56 | 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) 2020 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 | */ |
||
50 | 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 |
||
56 | mjames | 27 | extern "C" |
28 | { |
||
50 | mjames | 29 | #endif |
30 | |||
56 | mjames | 31 | /* Includes ------------------------------------------------------------------*/ |
50 | mjames | 32 | #include "stm32l1xx_hal.h" |
33 | |||
56 | mjames | 34 | /* Private includes ----------------------------------------------------------*/ |
35 | /* USER CODE BEGIN Includes */ |
||
50 | mjames | 36 | #include "display.h" |
37 | |||
38 | #include "libPLX/plx.h" |
||
39 | |||
56 | mjames | 40 | /* USER CODE END Includes */ |
50 | mjames | 41 | |
56 | mjames | 42 | /* Exported types ------------------------------------------------------------*/ |
43 | /* USER CODE BEGIN ET */ |
||
50 | mjames | 44 | #define MAXRDG 32 |
45 | |||
56 | mjames | 46 | extern const int DialTimeout; |
50 | mjames | 47 | |
56 | mjames | 48 | /// \brief Sensor information as read in from serial port, and expressed as structures. |
49 | typedef union |
||
50 | mjames | 50 | { |
56 | mjames | 51 | PLX_SensorInfo Sensor[MAXRDG]; |
52 | char Bytes[MAXRDG * sizeof(PLX_SensorInfo)]; |
||
53 | } data_t; |
||
50 | mjames | 54 | |
56 | mjames | 55 | ///\brief State of currently displayed item |
50 | mjames | 56 | typedef union |
57 | { |
||
56 | mjames | 58 | struct |
59 | { |
||
60 | enum PLX_Observations observation :8; |
||
61 | int instance :8; |
||
62 | } data; |
||
63 | uint16_t u32; |
||
64 | } nvram_info_t; |
||
50 | mjames | 65 | |
56 | mjames | 66 | typedef struct |
67 | { |
||
68 | int Max; |
||
69 | int Min; |
||
70 | enum PLX_Observations observation; |
||
71 | uint8_t instance; |
||
72 | uint16_t data; |
||
73 | } info_t; |
||
50 | mjames | 74 | |
56 | mjames | 75 | typedef struct |
76 | { |
||
77 | int OldObservation; |
||
78 | int OldObservationIndex; |
||
79 | int16_t dial0; ///< Dial position 0 |
||
80 | int16_t dial1; ///< Dial position 1 |
||
81 | int16_t dial_timer; |
||
82 | nvram_info_t info; ///< currently selected item |
||
83 | } context_t; |
||
50 | mjames | 84 | |
56 | mjames | 85 | extern info_t Info[MAXRDG]; |
50 | mjames | 86 | |
56 | mjames | 87 | extern context_t contexts[MAX_DISPLAYS]; |
50 | mjames | 88 | |
56 | mjames | 89 | extern nvram_info_t dial_nvram[MAX_DISPLAYS]; |
50 | mjames | 90 | |
56 | mjames | 91 | extern int PLXItems; |
50 | mjames | 92 | |
93 | // declarations need to be visible elsewhere |
||
56 | mjames | 94 | extern SPI_HandleTypeDef hspi1; |
50 | mjames | 95 | |
56 | mjames | 96 | extern UART_HandleTypeDef huart1; |
97 | extern UART_HandleTypeDef huart2; |
||
98 | extern UART_HandleTypeDef huart3; |
||
50 | mjames | 99 | |
56 | mjames | 100 | extern TIM_HandleTypeDef htim3; |
101 | extern TIM_HandleTypeDef htim9; |
||
50 | mjames | 102 | |
56 | mjames | 103 | /* USER CODE END ET */ |
50 | mjames | 104 | |
56 | mjames | 105 | /* Exported constants --------------------------------------------------------*/ |
106 | /* USER CODE BEGIN EC */ |
||
50 | mjames | 107 | |
56 | mjames | 108 | /* USER CODE END EC */ |
50 | mjames | 109 | |
56 | mjames | 110 | /* Exported macro ------------------------------------------------------------*/ |
111 | /* USER CODE BEGIN EM */ |
||
50 | mjames | 112 | |
56 | mjames | 113 | /* USER CODE END EM */ |
50 | mjames | 114 | |
56 | mjames | 115 | /* Exported functions prototypes ---------------------------------------------*/ |
116 | void |
||
117 | Error_Handler (void); |
||
50 | mjames | 118 | |
56 | mjames | 119 | /* USER CODE BEGIN EFP */ |
120 | extern context_t context[MAX_DISPLAYS]; |
||
50 | mjames | 121 | |
122 | /* USER CODE END EFP */ |
||
123 | |||
124 | /* Private defines -----------------------------------------------------------*/ |
||
125 | #define SPI_NSS1_Pin GPIO_PIN_4 |
||
126 | #define SPI_NSS1_GPIO_Port GPIOA |
||
127 | #define SPI_SCK_Pin GPIO_PIN_5 |
||
128 | #define SPI_SCK_GPIO_Port GPIOA |
||
129 | #define SPI_CD_Pin GPIO_PIN_6 |
||
130 | #define SPI_CD_GPIO_Port GPIOA |
||
131 | #define SPI_MOSI_Pin GPIO_PIN_7 |
||
132 | #define SPI_MOSI_GPIO_Port GPIOA |
||
133 | #define SPI_RESET_Pin GPIO_PIN_4 |
||
134 | #define SPI_RESET_GPIO_Port GPIOC |
||
135 | #define SPI_NSS2_Pin GPIO_PIN_5 |
||
136 | #define SPI_NSS2_GPIO_Port GPIOC |
||
137 | #define SW1_PUSH_Pin GPIO_PIN_12 |
||
138 | #define SW1_PUSH_GPIO_Port GPIOB |
||
139 | #define SW1_I_Pin GPIO_PIN_13 |
||
140 | #define SW1_I_GPIO_Port GPIOB |
||
141 | #define SW1_Q_Pin GPIO_PIN_14 |
||
142 | #define SW1_Q_GPIO_Port GPIOB |
||
143 | #define SW2_PUSH_Pin GPIO_PIN_15 |
||
144 | #define SW2_PUSH_GPIO_Port GPIOB |
||
145 | #define SW2_I_Pin GPIO_PIN_6 |
||
146 | #define SW2_I_GPIO_Port GPIOC |
||
147 | #define SW2_Q_Pin GPIO_PIN_7 |
||
148 | #define SW2_Q_GPIO_Port GPIOC |
||
149 | #define POWER_LATCH_Pin GPIO_PIN_8 |
||
150 | #define POWER_LATCH_GPIO_Port GPIOC |
||
151 | #define IGNITION_Pin GPIO_PIN_9 |
||
152 | #define IGNITION_GPIO_Port GPIOC |
||
153 | #define BT_BUTTON_Pin GPIO_PIN_8 |
||
154 | #define BT_BUTTON_GPIO_Port GPIOA |
||
155 | #define PLX_TX_Pin GPIO_PIN_9 |
||
156 | #define PLX_TX_GPIO_Port GPIOA |
||
157 | #define PLX_RX_Pin GPIO_PIN_10 |
||
158 | #define PLX_RX_GPIO_Port GPIOA |
||
159 | #define USB_PWR_Pin GPIO_PIN_12 |
||
160 | #define USB_PWR_GPIO_Port GPIOC |
||
161 | /* USER CODE BEGIN Private defines */ |
||
162 | |||
163 | /* USER CODE END Private defines */ |
||
164 | |||
165 | #ifdef __cplusplus |
||
166 | } |
||
167 | #endif |
||
168 | |||
169 | #endif /* __MAIN_H */ |
||
170 | |||
171 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |