/* USER CODE BEGIN Header */
/**
  ******************************************************************************
  * @file           : main.h
  * @brief          : Header for main.c file.
  *                   This file contains the common defines of the application.
  ******************************************************************************
  * @attention
  *
  * Copyright (c) 2025 STMicroelectronics.
  * All rights reserved.
  *
  * This software is licensed under terms that can be found in the LICENSE file
  * in the root directory of this software component.
  * If no LICENSE file comes with this software, it is provided AS-IS.
  *
  ******************************************************************************
  */
/* USER CODE END Header */

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

#ifdef __cplusplus
extern "C" {
#endif

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

/* 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 */
#define R2D_NONE 0x00
#define R2D_TSMS 0x01
#define R2D_TS_ACTIVE 0x02
#define R2D_RESETTING_NODES 0x03
#define R2D_RESETTING_COMMS 0x04
#define R2D_WAITING_INIT 0x05
#define R2D_INIT_STAGE1 0x06
#define R2D_INIT_STAGE2 0x07
#define R2D_INIT_SUCCESS 0x0F

#define TS_INACTIVE 0x00
#define TS_ACTIVE 0x01
#define TS_PRECHARGE 0x02
#define TS_DISCHARGE 0x03
#define TS_ERROR 0x04
/* USER CODE END EM */

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

/* USER CODE BEGIN EFP */

/* USER CODE END EFP */

/* Private defines -----------------------------------------------------------*/
#define TSON_R_Pin GPIO_PIN_0
#define TSON_R_GPIO_Port GPIOA
#define TSON_G_Pin GPIO_PIN_1
#define TSON_G_GPIO_Port GPIOA
#define TSON_B_Pin GPIO_PIN_2
#define TSON_B_GPIO_Port GPIOA
#define IMD_LED_Pin GPIO_PIN_3
#define IMD_LED_GPIO_Port GPIOA
#define AMS_LED_Pin GPIO_PIN_4
#define AMS_LED_GPIO_Port GPIOA
#define TSOFF_LED_Pin GPIO_PIN_5
#define TSOFF_LED_GPIO_Port GPIOA
#define R2D_R_Pin GPIO_PIN_7
#define R2D_R_GPIO_Port GPIOA
#define R2D_G_Pin GPIO_PIN_0
#define R2D_G_GPIO_Port GPIOB
#define R2D_B_Pin GPIO_PIN_1
#define R2D_B_GPIO_Port GPIOB
#define TSON_BTN_Pin GPIO_PIN_15
#define TSON_BTN_GPIO_Port GPIOB
#define SDC_Out_3V3_Pin GPIO_PIN_3
#define SDC_Out_3V3_GPIO_Port GPIOB
#define SDC_In_3V3_Pin GPIO_PIN_4
#define SDC_In_3V3_GPIO_Port GPIOB
#define R2D_BTN_Pin GPIO_PIN_5
#define R2D_BTN_GPIO_Port GPIOB
#define RMode_Out_3V3_Pin GPIO_PIN_8
#define RMode_Out_3V3_GPIO_Port GPIOB

/* USER CODE BEGIN Private defines */

/* USER CODE END Private defines */

#ifdef __cplusplus
}
#endif

#endif /* __MAIN_H */
