Rev 63 | Rev 66 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 63 | Rev 65 | ||
---|---|---|---|
Line 22... | Line 22... | ||
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 "stm32l1xx_hal.h" |
32 | #include "stm32l1xx_hal.h" |
32 | 33 | ||
33 | /* Private includes ----------------------------------------------------------*/ |
34 | /* Private includes ----------------------------------------------------------*/ |
34 | /* USER CODE BEGIN Includes */ |
35 | /* USER CODE BEGIN Includes */ |
35 | #include "display.h" |
36 | #include "display.h" |
- | 37 | #include "nvram.h" |
|
36 | 38 | ||
37 | #include "libPLX/plx.h" |
39 | #include "libPLX/plx.h" |
38 | 40 | ||
39 | /* USER CODE END Includes */ |
41 | /* USER CODE END Includes */ |
40 | 42 | ||
41 | /* Exported types ------------------------------------------------------------*/ |
43 | /* Exported types ------------------------------------------------------------*/ |
42 | /* USER CODE BEGIN ET */ |
44 | /* USER CODE BEGIN ET */ |
43 | 45 | ||
44 | #define TX_USART_BUFF_SIZ 512 |
46 | #define TX_USART_BUFF_SIZ 512 |
45 | #define RX_USART_BUFF_SIZ 512 |
47 | #define RX_USART_BUFF_SIZ 512 |
46 | 48 | ||
47 | - | ||
48 | #define MAXRDG 32 |
49 | #define MAXRDG 32 |
49 | - | ||
50 | - | ||
51 | - | ||
52 | 50 | ||
53 | extern const int DialTimeout; |
51 | extern const int DialTimeout; |
54 | 52 | ||
55 | /// \brief Sensor information as read in from serial port, and expressed as structures. |
53 | /// \brief Sensor information as read in from serial port, and expressed as structures. |
56 | typedef union |
54 | typedef union |
57 | { |
55 | { |
58 | PLX_SensorInfo Sensor[MAXRDG]; |
56 | PLX_SensorInfo Sensor[MAXRDG]; |
59 | char Bytes[MAXRDG * sizeof(PLX_SensorInfo)]; |
57 | char Bytes[MAXRDG * sizeof(PLX_SensorInfo)]; |
60 | } data_t; |
58 | } data_t; |
61 | 59 | ||
62 | ///\brief State of currently displayed item |
- | |
63 | typedef union |
- | |
64 | { |
- | |
65 | struct |
- | |
66 | { |
- | |
67 | enum PLX_Observations observation :8; |
- | |
68 | int instance :8; |
- | |
69 | } data; |
- | |
70 | uint32_t u32; |
- | |
71 | } nvram_info_t; |
- | |
72 | - | ||
73 | typedef struct |
60 | typedef struct |
74 | { |
61 | { |
75 | int Max; |
62 | int Max; |
76 | int Min; |
63 | int Min; |
77 | enum PLX_Observations observation; |
64 | enum PLX_Observations observation; |
78 | uint8_t instance; |
65 | uint8_t instance; |
79 | uint16_t data; |
66 | uint16_t data; |
80 | uint32_t sum; //< Sum of readings since last logged |
67 | uint32_t sum; //< Sum of readings since last logged |
81 | uint16_t count; //< Count of readings since last logged . |
68 | uint16_t count; //< Count of readings since last logged . |
82 | } info_t; |
69 | } info_t; |
83 | 70 | ||
84 | typedef struct |
71 | typedef struct |
85 | { |
72 | { |
86 | int8_t knobPos; ///< User interface knob position |
73 | int8_t knobPos; ///< User interface knob position |
87 | int16_t OldObservation; |
74 | int16_t OldObservation; |
88 | int16_t OldObservationIndex; |
75 | int16_t OldObservationIndex; |
89 | int16_t dial0; ///< Display needle position 0 |
76 | int16_t dial0; ///< Display needle position 0 |
90 | int16_t dial1; ///< Display needle position 1 |
77 | int16_t dial1; ///< Display needle position 1 |
91 | uint16_t dial_timer; |
78 | uint16_t dial_timer; |
92 | nvram_info_t info; ///< currently selected item |
79 | // nvram_info_t * info; ///< currently selected item |
93 | } context_t; |
80 | } context_t; |
94 | 81 | ||
95 | extern info_t Info[MAXRDG]; |
82 | extern info_t Info[MAXRDG]; |
96 | 83 | ||
97 | extern context_t contexts[MAX_DISPLAYS]; |
84 | extern context_t contexts[MAX_DISPLAYS]; |
98 | 85 | ||
99 | extern nvram_info_t dial_nvram[MAX_DISPLAYS]; |
- | |
100 | - | ||
101 | extern int PLXItems; |
86 | extern int PLXItems; |
102 | 87 | ||
103 | // declarations need to be visible elsewhere |
88 | // declarations need to be visible elsewhere |
104 | extern SPI_HandleTypeDef hspi1; |
89 | extern SPI_HandleTypeDef hspi1; |
105 | 90 | ||
106 | extern UART_HandleTypeDef huart1; |
91 | extern UART_HandleTypeDef huart1; |
107 | extern UART_HandleTypeDef huart2; |
92 | extern UART_HandleTypeDef huart2; |
108 | extern UART_HandleTypeDef huart3; |
93 | extern UART_HandleTypeDef huart3; |
109 | 94 | ||
110 | extern TIM_HandleTypeDef htim3; |
95 | extern TIM_HandleTypeDef htim3; |
111 | extern TIM_HandleTypeDef htim9; |
96 | extern TIM_HandleTypeDef htim9; |
112 | 97 | ||
113 | /* USER CODE END ET */ |
98 | /* USER CODE END ET */ |
114 | - | ||
115 | /* Exported constants --------------------------------------------------------*/ |
- | |
116 | /* USER CODE BEGIN EC */ |
- | |
117 | 99 | ||
- | 100 | /* Exported constants --------------------------------------------------------*/ |
|
118 | /* USER CODE END EC */ |
101 | /* USER CODE BEGIN EC */ |
119 | 102 | ||
120 | /* Exported macro ------------------------------------------------------------*/ |
- | |
121 | /* USER CODE BEGIN EM */ |
103 | /* USER CODE END EC */ |
122 | 104 | ||
- | 105 | /* Exported macro ------------------------------------------------------------*/ |
|
123 | /* USER CODE END EM */ |
106 | /* USER CODE BEGIN EM */ |
124 | 107 | ||
125 | /* Exported functions prototypes ---------------------------------------------*/ |
- | |
126 | void Error_Handler(void); |
108 | /* USER CODE END EM */ |
127 | 109 | ||
128 | /* true if the bluetooth module is connected */ |
110 | /* Exported functions prototypes ---------------------------------------------*/ |
129 | extern uint8_t btConnected(); |
111 | void Error_Handler(void); |
130 | 112 | ||
131 | /* USER CODE BEGIN EFP */ |
113 | /* USER CODE BEGIN EFP */ |
132 | extern context_t context[MAX_DISPLAYS]; |
114 | extern context_t context[MAX_DISPLAYS]; |
133 | 115 | ||
- | 116 | extern uint8_t btConnected(); |
|
134 | /* USER CODE END EFP */ |
117 | /* USER CODE END EFP */ |
135 | 118 | ||
136 | /* Private defines -----------------------------------------------------------*/ |
119 | /* Private defines -----------------------------------------------------------*/ |
137 | #define SPI_NSS1_Pin GPIO_PIN_4 |
120 | #define SPI_NSS1_Pin GPIO_PIN_4 |
138 | #define SPI_NSS1_GPIO_Port GPIOA |
121 | #define SPI_NSS1_GPIO_Port GPIOA |
Line 170... | Line 153... | ||
170 | #define PLX_TX_GPIO_Port GPIOA |
153 | #define PLX_TX_GPIO_Port GPIOA |
171 | #define PLX_RX_Pin GPIO_PIN_10 |
154 | #define PLX_RX_Pin GPIO_PIN_10 |
172 | #define PLX_RX_GPIO_Port GPIOA |
155 | #define PLX_RX_GPIO_Port GPIOA |
173 | #define USB_PWR_Pin GPIO_PIN_12 |
156 | #define USB_PWR_Pin GPIO_PIN_12 |
174 | #define USB_PWR_GPIO_Port GPIOC |
157 | #define USB_PWR_GPIO_Port GPIOC |
175 | /* USER CODE BEGIN Private defines */ |
158 | /* USER CODE BEGIN Private defines */ |
176 | 159 | ||
177 | /* USER CODE END Private defines */ |
160 | /* USER CODE END Private defines */ |
178 | 161 | ||
179 | #ifdef __cplusplus |
162 | #ifdef __cplusplus |
180 | } |
163 | } |
181 | #endif |
164 | #endif |
182 | 165 |