Subversion Repositories DashDisplay

Rev

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