Subversion Repositories DashDisplay

Rev

Rev 50 | Rev 57 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 50 Rev 56
Line 1... Line 1...
1
/* USER CODE BEGIN Header */
1
/* USER CODE BEGIN Header */
2
/**
2
/**
3
  ******************************************************************************
3
 ******************************************************************************
4
  * @file           : main.h
4
 * @file           : main.h
5
  * @brief          : Header for main.c file.
5
 * @brief          : Header for main.c file.
6
  *                   This file contains the common defines of the application.
6
 *                   This file contains the common defines of the application.
7
  ******************************************************************************
7
 ******************************************************************************
8
  * @attention
8
 * @attention
9
  *
9
 *
10
  * <h2><center>&copy; Copyright (c) 2020 STMicroelectronics.
10
 * <h2><center>&copy; Copyright (c) 2020 STMicroelectronics.
11
  * All rights reserved.</center></h2>
11
 * All rights reserved.</center></h2>
12
  *
12
 *
13
  * This software component is licensed by ST under BSD 3-Clause license,
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
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:
15
 * License. You may obtain a copy of the License at:
16
  *                        opensource.org/licenses/BSD-3-Clause
16
 *                        opensource.org/licenses/BSD-3-Clause
17
  *
17
 *
18
  ******************************************************************************
18
 ******************************************************************************
19
  */
19
 */
20
/* USER CODE END Header */
20
/* USER CODE END Header */
21
 
21
 
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"
36
 
37
 
37
#include "libPLX/plx.h"
38
#include "libPLX/plx.h"
38
 
39
 
39
/* USER CODE END Includes */
40
  /* USER CODE END Includes */
40
 
41
 
41
/* Exported types ------------------------------------------------------------*/
42
  /* Exported types ------------------------------------------------------------*/
42
/* USER CODE BEGIN ET */
43
  /* USER CODE BEGIN ET */
43
#define MAXRDG 32
44
#define MAXRDG 32
44
 
45
 
45
extern  const int DialTimeout;
46
  extern const int DialTimeout;
46
 
47
 
47
 
-
 
-
 
48
  /// \brief Sensor information as read in from serial port, and expressed as structures.
48
  typedef struct
49
  typedef union
49
  {
50
  {
50
        int OldObservation;
51
    PLX_SensorInfo Sensor[MAXRDG];
51
        int OldObservationIndex;
52
    char Bytes[MAXRDG * sizeof(PLX_SensorInfo)];
52
        int16_t dial0;
-
 
53
        int16_t dial1;
-
 
54
        int16_t dial_timer;
-
 
55
  } context_t;
53
  } data_t;
56
 
54
 
-
 
55
  ///\brief State of currently displayed item
57
  typedef union
56
  typedef union
58
  {
57
  {
-
 
58
    struct
-
 
59
    {
59
        PLX_SensorInfo Sensor[MAXRDG];
60
      enum PLX_Observations observation :8;
60
        char Bytes[MAXRDG * sizeof(PLX_SensorInfo)];
61
      int instance :8;
61
  } data_t;
62
    } data;
-
 
63
    uint16_t u32;
-
 
64
  } nvram_info_t;
62
 
65
 
-
 
66
  typedef struct
-
 
67
  {
-
 
68
    int Max;
-
 
69
    int Min;
63
extern context_t contexts[MAX_DISPLAYS];
70
    enum PLX_Observations observation;
-
 
71
    uint8_t instance;
-
 
72
    uint16_t data;
-
 
73
  } info_t;
64
 
74
 
65
extern data_t Data;
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;
66
 
84
 
67
extern uint16_t dial_nvram[MAX_DISPLAYS];
85
  extern info_t Info[MAXRDG];
68
 
86
 
69
extern int Max[MAXRDG];
-
 
70
extern int Min[MAXRDG];
87
  extern context_t contexts[MAX_DISPLAYS];
71
extern int PLXItems;
-
 
72
 
88
 
-
 
89
  extern nvram_info_t dial_nvram[MAX_DISPLAYS];
73
 
90
 
-
 
91
  extern int PLXItems;
74
 
92
 
75
// declarations need to be visible elsewhere
93
// declarations need to be visible elsewhere
76
extern SPI_HandleTypeDef hspi1;
94
  extern SPI_HandleTypeDef hspi1;
77
 
-
 
78
extern UART_HandleTypeDef huart1;
-
 
79
extern UART_HandleTypeDef huart2;
-
 
80
extern UART_HandleTypeDef huart3;
-
 
81
 
-
 
82
 
-
 
83
extern TIM_HandleTypeDef htim3;
-
 
84
extern TIM_HandleTypeDef htim9;
-
 
85
 
95
 
-
 
96
  extern UART_HandleTypeDef huart1;
-
 
97
  extern UART_HandleTypeDef huart2;
-
 
98
  extern UART_HandleTypeDef huart3;
86
 
99
 
-
 
100
  extern TIM_HandleTypeDef htim3;
-
 
101
  extern TIM_HandleTypeDef htim9;
87
 
102
 
88
/* USER CODE END ET */
103
  /* USER CODE END ET */
89
 
104
 
90
/* Exported constants --------------------------------------------------------*/
105
  /* Exported constants --------------------------------------------------------*/
91
/* USER CODE BEGIN EC */
106
  /* USER CODE BEGIN EC */
92
 
107
 
93
/* USER CODE END EC */
108
  /* USER CODE END EC */
94
 
109
 
95
/* Exported macro ------------------------------------------------------------*/
110
  /* Exported macro ------------------------------------------------------------*/
96
/* USER CODE BEGIN EM */
111
  /* USER CODE BEGIN EM */
97
 
112
 
98
/* USER CODE END EM */
113
  /* USER CODE END EM */
99
 
114
 
100
/* Exported functions prototypes ---------------------------------------------*/
115
  /* Exported functions prototypes ---------------------------------------------*/
-
 
116
  void
101
void Error_Handler(void);
117
  Error_Handler (void);
102
 
118
 
103
/* USER CODE BEGIN EFP */
119
  /* USER CODE BEGIN EFP */
104
extern context_t context[MAX_DISPLAYS];
120
  extern context_t context[MAX_DISPLAYS];
105
 
121
 
106
/* USER CODE END EFP */
122
/* USER CODE END EFP */
107
 
123
 
108
/* Private defines -----------------------------------------------------------*/
124
/* Private defines -----------------------------------------------------------*/
109
#define SPI_NSS1_Pin GPIO_PIN_4
125
#define SPI_NSS1_Pin GPIO_PIN_4