/* USER CODE BEGIN Header */
/**
  ******************************************************************************
  * @file           : main.h
  * @brief          : Header for main.c file.
  *                   This file contains the common defines of the application.
  ******************************************************************************
  * @attention
  *
  * <h2><center>&copy; Copyright (c) 2021 STMicroelectronics.
  * All rights reserved.</center></h2>
  *
  * This software component is licensed by ST under Ultimate Liberty license
  * SLA0044, the "License"; You may not use this file except in compliance with
  * the License. You may obtain a copy of the License at:
  *                             www.st.com/SLA0044
  *
  ******************************************************************************
  */
/* USER CODE END Header */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H

#ifdef __cplusplus
extern "C" {
#endif

/* Includes ------------------------------------------------------------------*/
#include "stm32f1xx_hal.h"

extern void usbTIM(uint8_t OnOff);

extern uint16_t load_current;
extern uint16_t charge_current;
extern float float_current;
extern uint8_t load_switch_state;
extern uint8_t charge_switch_state;

extern uint16_t export_adc_average_res;

extern float export_real_capacity;

extern float cellVoltageHigh_Maximum;
extern float cellVoltageHigh_Maximum_Hyst;
extern float maxChargeCurrent;
extern float maxLoadCurrent;
extern float cellVoltageLow_Minimum;
extern float cellVoltageLow_Minimum_Hyst;
extern float currentZero_config;

extern float Brush_Minimum_SoC;
extern uint8_t Brush_Default_State;

extern float maxTemperature;
extern float maxTemperature_Hyst;


extern uint8_t Pilot_Status;
extern uint8_t Maximum_Charge_Current_Status;
extern uint8_t Maximum_Voltage_Status;
extern uint8_t Maximum_Temp_Status;
extern uint8_t Maximum_Load_Current_Status;
extern uint8_t Minimum_Voltage_Status;
extern uint8_t Deep_Discharge_Status;

/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */

/* USER CODE END Includes */

/* Exported types ------------------------------------------------------------*/
/* USER CODE BEGIN ET */

/* USER CODE END ET */

/* Exported constants --------------------------------------------------------*/
/* USER CODE BEGIN EC */

/* USER CODE END EC */

/* Exported macro ------------------------------------------------------------*/
/* USER CODE BEGIN EM */

/* USER CODE END EM */

/* Exported functions prototypes ---------------------------------------------*/
void Error_Handler(void);

void UpdateGSMParamsFromConfig();
/* USER CODE BEGIN EFP */

/* USER CODE END EFP */

/* Private defines -----------------------------------------------------------*/
#define Output_2_Pin GPIO_PIN_2
#define Output_2_GPIO_Port GPIOE
#define Output_3_Pin GPIO_PIN_3
#define Output_3_GPIO_Port GPIOE
#define Output_4_Pin GPIO_PIN_4
#define Output_4_GPIO_Port GPIOE
#define Output_5_Pin GPIO_PIN_5
#define Output_5_GPIO_Port GPIOE
#define SD_CD_Pin GPIO_PIN_10
#define SD_CD_GPIO_Port GPIOA
#define SPI3_CS_Pin GPIO_PIN_3
#define SPI3_CS_GPIO_Port GPIOC
#define Input_1_Pin GPIO_PIN_7
#define Input_1_GPIO_Port GPIOE
#define Input_2_Pin GPIO_PIN_8
#define Input_2_GPIO_Port GPIOE
#define Input_3_Pin GPIO_PIN_9
#define Input_3_GPIO_Port GPIOE
#define GSM_RST_Pin GPIO_PIN_10
#define GSM_RST_GPIO_Port GPIOE
#define HL5_Pin GPIO_PIN_12
#define HL5_GPIO_Port GPIOE
#define HL4_Pin GPIO_PIN_13
#define HL4_GPIO_Port GPIOE
#define HL3_Pin GPIO_PIN_14
#define HL3_GPIO_Port GPIOE
#define HL2_Pin GPIO_PIN_15
#define HL2_GPIO_Port GPIOE
#define SD_CS_Pin GPIO_PIN_8
#define SD_CS_GPIO_Port GPIOA
#define Charging_Pin GPIO_PIN_2
#define Charging_GPIO_Port GPIOD
#define Output_0_Pin GPIO_PIN_0
#define Output_0_GPIO_Port GPIOE
#define Output_1_Pin GPIO_PIN_1
#define Output_1_GPIO_Port GPIOE
/* USER CODE BEGIN Private defines */
#define SD_SPI_HANDLE hspi1
/* USER CODE END Private defines */

#ifdef __cplusplus
}
#endif

#endif /* __MAIN_H */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
