Rev 70 | Rev 75 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 70 | Rev 74 | ||
|---|---|---|---|
| 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 | ||
| Line 35... | Line 36... | ||
| 35 | #include "display.h" |
36 | #include "display.h" |
| 36 | #include "nvram.h" |
37 | #include "nvram.h" |
| 37 | 38 | ||
| 38 | #include "libPLX/plx.h" |
39 | #include "libPLX/plx.h" |
| 39 | 40 | ||
| 40 | /* USER CODE END Includes */ |
41 | /* USER CODE END Includes */ |
| 41 | 42 | ||
| 42 | /* Exported types ------------------------------------------------------------*/ |
43 | /* Exported types ------------------------------------------------------------*/ |
| 43 | /* USER CODE BEGIN ET */ |
44 | /* USER CODE BEGIN ET */ |
| 44 | 45 | ||
| 45 | #define TX_USART_BUFF_SIZ 512 |
46 | #define TX_USART_BUFF_SIZ 512 |
| 46 | #define RX_USART_BUFF_SIZ 512 |
47 | #define RX_USART_BUFF_SIZ 512 |
| 47 | 48 | ||
| 48 | #define MAXRDG 32 |
49 | #define MAXRDG 32 |
| Line 56... | Line 57... | ||
| 56 | char Bytes[MAXRDG * sizeof(PLX_SensorInfo)]; |
57 | char Bytes[MAXRDG * sizeof(PLX_SensorInfo)]; |
| 57 | } data_t; |
58 | } data_t; |
| 58 | 59 | ||
| 59 | typedef struct |
60 | typedef struct |
| 60 | { |
61 | { |
| - | 62 | enum PLX_Observations Obs; ///< Previous item observed |
|
| - | 63 | int8_t Instance; ///< |
|
| - | 64 | ||
| - | 65 | } uniqueObs_t; |
|
| - | 66 | ||
| - | 67 | typedef struct |
|
| - | 68 | { |
|
| 61 | int Max; |
69 | int Max; |
| 62 | int Min; |
70 | int Min; |
| 63 | enum PLX_Observations observation; |
71 | uniqueObs_t observation; //< observation identifier |
| 64 | uint8_t instance; |
- | |
| 65 | uint16_t data; |
72 | uint16_t data; ///< Data value |
| 66 | uint32_t sum; //< Sum of readings since last logged |
73 | uint32_t sum; ///< Sum of readings since last logged |
| 67 | uint32_t lastUpdated; ///< Time of last update |
74 | uint32_t lastUpdated; ///< Time of last update |
| 68 | uint16_t count; //< Count of readings since last logged . |
75 | uint16_t count; ///< Count of readings since last logged . |
| 69 | uint8_t updated; ///< Set when updated |
76 | uint8_t updated; ///< Set when updated |
| 70 | } info_t; |
77 | } info_t; |
| 71 | 78 | ||
| 72 | typedef struct |
79 | typedef struct |
| 73 | { |
80 | { |
| 74 | int8_t knobPos; ///< User interface knob position |
81 | int8_t knobPos; ///< User interface knob position |
| 75 | int16_t OldObservation; |
- | |
| 76 | int16_t OldObservationIndex; |
82 | uniqueObs_t OldObservation; ///< Previous item observed |
| 77 | int16_t dial0; ///< Display needle position 0 |
83 | int16_t dial0; ///< Display needle position 0 |
| 78 | int16_t dial1; ///< Display needle position 1 |
84 | int16_t dial1; ///< Display needle position 1 |
| 79 | uint16_t dial_timer; |
- | |
| 80 | // nvram_info_t * info; ///< currently selected item |
85 | uint16_t dial_timer; ///< Time of last NVRAM store |
| 81 | } context_t; |
86 | } context_t; |
| 82 | 87 | ||
| 83 | extern info_t Info[MAXRDG]; |
88 | extern info_t Info[MAXRDG]; |
| 84 | 89 | ||
| 85 | extern context_t contexts[MAX_DISPLAYS]; |
90 | extern context_t contexts[MAX_DISPLAYS]; |
| Line 92... | Line 97... | ||
| 92 | extern UART_HandleTypeDef huart3; |
97 | extern UART_HandleTypeDef huart3; |
| 93 | 98 | ||
| 94 | extern TIM_HandleTypeDef htim3; |
99 | extern TIM_HandleTypeDef htim3; |
| 95 | extern TIM_HandleTypeDef htim9; |
100 | extern TIM_HandleTypeDef htim9; |
| 96 | 101 | ||
| 97 | /* USER CODE END ET */ |
102 | /* USER CODE END ET */ |
| 98 | 103 | ||
| 99 | /* Exported constants --------------------------------------------------------*/ |
104 | /* Exported constants --------------------------------------------------------*/ |
| 100 | /* USER CODE BEGIN EC */ |
105 | /* USER CODE BEGIN EC */ |
| 101 | 106 | ||
| 102 | /* USER CODE END EC */ |
107 | /* USER CODE END EC */ |
| 103 | 108 | ||
| 104 | /* Exported macro ------------------------------------------------------------*/ |
109 | /* Exported macro ------------------------------------------------------------*/ |
| 105 | /* USER CODE BEGIN EM */ |
110 | /* USER CODE BEGIN EM */ |
| 106 | 111 | ||
| 107 | /* USER CODE END EM */ |
112 | /* USER CODE END EM */ |
| 108 | 113 | ||
| 109 | /* Exported functions prototypes ---------------------------------------------*/ |
114 | /* Exported functions prototypes ---------------------------------------------*/ |
| 110 | void Error_Handler(void); |
115 | void Error_Handler(void); |
| 111 | 116 | ||
| 112 | /* USER CODE BEGIN EFP */ |
117 | /* USER CODE BEGIN EFP */ |
| 113 | extern context_t context[MAX_DISPLAYS]; |
118 | extern context_t context[MAX_DISPLAYS]; |
| 114 | 119 | ||
| 115 | extern uint8_t btConnected(); |
120 | extern uint8_t btConnected(); |
| 116 | 121 | ||
| 117 | extern uint8_t isValid(int i); |
122 | extern uint8_t isValid(int i); |
| Line 156... | Line 161... | ||
| 156 | #define PLX_RX_GPIO_Port GPIOA |
161 | #define PLX_RX_GPIO_Port GPIOA |
| 157 | #define BT_RESET_Pin GPIO_PIN_11 |
162 | #define BT_RESET_Pin GPIO_PIN_11 |
| 158 | #define BT_RESET_GPIO_Port GPIOA |
163 | #define BT_RESET_GPIO_Port GPIOA |
| 159 | #define USB_PWR_Pin GPIO_PIN_12 |
164 | #define USB_PWR_Pin GPIO_PIN_12 |
| 160 | #define USB_PWR_GPIO_Port GPIOC |
165 | #define USB_PWR_GPIO_Port GPIOC |
| 161 | /* USER CODE BEGIN Private defines */ |
166 | /* USER CODE BEGIN Private defines */ |
| 162 | 167 | ||
| 163 | /* USER CODE END Private defines */ |
168 | /* USER CODE END Private defines */ |
| 164 | 169 | ||
| 165 | #ifdef __cplusplus |
170 | #ifdef __cplusplus |
| 166 | } |
171 | } |
| 167 | #endif |
172 | #endif |
| 168 | 173 | ||