Subversion Repositories DashDisplay

Rev

Rev 56 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. /* USER CODE BEGIN Header */
  2. /**
  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.   */
  20. /* USER CODE END Header */
  21.  
  22. /* Define to prevent recursive inclusion -------------------------------------*/
  23. #ifndef __MAIN_H
  24. #define __MAIN_H
  25.  
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29.  
  30. /* Includes ------------------------------------------------------------------*/
  31. #include "stm32l1xx_hal.h"
  32.  
  33. /* Private includes ----------------------------------------------------------*/
  34. /* USER CODE BEGIN Includes */
  35. #include "display.h"
  36.  
  37. #include "libPLX/plx.h"
  38.  
  39. /* USER CODE END Includes */
  40.  
  41. /* Exported types ------------------------------------------------------------*/
  42. /* USER CODE BEGIN ET */
  43. #define MAXRDG 32
  44.  
  45. extern  const int DialTimeout;
  46.  
  47.  
  48.   typedef struct
  49.   {
  50.         int OldObservation;
  51.         int OldObservationIndex;
  52.         int16_t dial0;
  53.         int16_t dial1;
  54.         int16_t dial_timer;
  55.   } context_t;
  56.  
  57.   typedef union
  58.   {
  59.         PLX_SensorInfo Sensor[MAXRDG];
  60.         char Bytes[MAXRDG * sizeof(PLX_SensorInfo)];
  61.   } data_t;
  62.  
  63. extern context_t contexts[MAX_DISPLAYS];
  64.  
  65. extern data_t Data;
  66.  
  67. extern uint16_t dial_nvram[MAX_DISPLAYS];
  68.  
  69. extern int Max[MAXRDG];
  70. extern int Min[MAXRDG];
  71. extern int PLXItems;
  72.  
  73.  
  74.  
  75. // declarations need to be visible elsewhere
  76. 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.  
  86.  
  87.  
  88. /* USER CODE END ET */
  89.  
  90. /* Exported constants --------------------------------------------------------*/
  91. /* USER CODE BEGIN EC */
  92.  
  93. /* USER CODE END EC */
  94.  
  95. /* Exported macro ------------------------------------------------------------*/
  96. /* USER CODE BEGIN EM */
  97.  
  98. /* USER CODE END EM */
  99.  
  100. /* Exported functions prototypes ---------------------------------------------*/
  101. void Error_Handler(void);
  102.  
  103. /* USER CODE BEGIN EFP */
  104. extern context_t context[MAX_DISPLAYS];
  105.  
  106. /* USER CODE END EFP */
  107.  
  108. /* Private defines -----------------------------------------------------------*/
  109. #define SPI_NSS1_Pin GPIO_PIN_4
  110. #define SPI_NSS1_GPIO_Port GPIOA
  111. #define SPI_SCK_Pin GPIO_PIN_5
  112. #define SPI_SCK_GPIO_Port GPIOA
  113. #define SPI_CD_Pin GPIO_PIN_6
  114. #define SPI_CD_GPIO_Port GPIOA
  115. #define SPI_MOSI_Pin GPIO_PIN_7
  116. #define SPI_MOSI_GPIO_Port GPIOA
  117. #define SPI_RESET_Pin GPIO_PIN_4
  118. #define SPI_RESET_GPIO_Port GPIOC
  119. #define SPI_NSS2_Pin GPIO_PIN_5
  120. #define SPI_NSS2_GPIO_Port GPIOC
  121. #define SW1_PUSH_Pin GPIO_PIN_12
  122. #define SW1_PUSH_GPIO_Port GPIOB
  123. #define SW1_I_Pin GPIO_PIN_13
  124. #define SW1_I_GPIO_Port GPIOB
  125. #define SW1_Q_Pin GPIO_PIN_14
  126. #define SW1_Q_GPIO_Port GPIOB
  127. #define SW2_PUSH_Pin GPIO_PIN_15
  128. #define SW2_PUSH_GPIO_Port GPIOB
  129. #define SW2_I_Pin GPIO_PIN_6
  130. #define SW2_I_GPIO_Port GPIOC
  131. #define SW2_Q_Pin GPIO_PIN_7
  132. #define SW2_Q_GPIO_Port GPIOC
  133. #define POWER_LATCH_Pin GPIO_PIN_8
  134. #define POWER_LATCH_GPIO_Port GPIOC
  135. #define IGNITION_Pin GPIO_PIN_9
  136. #define IGNITION_GPIO_Port GPIOC
  137. #define BT_BUTTON_Pin GPIO_PIN_8
  138. #define BT_BUTTON_GPIO_Port GPIOA
  139. #define PLX_TX_Pin GPIO_PIN_9
  140. #define PLX_TX_GPIO_Port GPIOA
  141. #define PLX_RX_Pin GPIO_PIN_10
  142. #define PLX_RX_GPIO_Port GPIOA
  143. #define USB_PWR_Pin GPIO_PIN_12
  144. #define USB_PWR_GPIO_Port GPIOC
  145. /* USER CODE BEGIN Private defines */
  146.  
  147. /* USER CODE END Private defines */
  148.  
  149. #ifdef __cplusplus
  150. }
  151. #endif
  152.  
  153. #endif /* __MAIN_H */
  154.  
  155. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
  156.