/* 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 BSD 3-Clause license,
  * the "License"; You may not use this file except in compliance with the
  * License. You may obtain a copy of the License at:
  *                        opensource.org/licenses/BSD-3-Clause
  *
  ******************************************************************************
  */
/* USER CODE END Header */

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

#ifdef __cplusplus
extern "C" {
#endif

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

/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "hci_tl_interface.h"
#include "stm32_adv_trace.h"
#include "utilities_conf.h"
///#include "stm32f4xx_nucleo.h"

/* USER CODE END Includes */

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

/* USER CODE END ET */

/* Exported constants --------------------------------------------------------*/
/* USER CODE BEGIN EC */
/**
  * @brief  Verbose level for all trace logs
  */
#define VERBOSE_LEVEL               VLEVEL_H

/**
  * @brief Enable trace logs
  */
#define APP_LOG_ENABLED             1

/* USER CODE END EC */

/* Exported macro ------------------------------------------------------------*/
/* USER CODE BEGIN EM */
#define APP_PPRINTF(...)  do{ } while( UTIL_ADV_TRACE_OK \
                              != UTIL_ADV_TRACE_COND_FSend(VLEVEL_ALWAYS, T_REG_OFF, TS_OFF, __VA_ARGS__) ) /* Polling Mode */
#define APP_TPRINTF(...)   do{ {UTIL_ADV_TRACE_COND_FSend(VLEVEL_ALWAYS, T_REG_OFF, TS_ON, __VA_ARGS__);} }while(0); /* with timestamp */
#define APP_PRINTF(...)   do{ {UTIL_ADV_TRACE_COND_FSend(VLEVEL_ALWAYS, T_REG_OFF, TS_OFF, __VA_ARGS__);} }while(0);

#if defined (APP_LOG_ENABLED) && (APP_LOG_ENABLED == 1)
#define APP_LOG(TS,VL,...)   do{ {UTIL_ADV_TRACE_COND_FSend(VL, T_REG_OFF, TS, __VA_ARGS__);} }while(0);
#elif defined (APP_LOG_ENABLED) && (APP_LOG_ENABLED == 0) /* APP_LOG disabled */
#define APP_LOG(TS,VL,...)
#else
#error "APP_LOG_ENABLED not defined or out of range <0,1>"
#endif /* APP_LOG_ENABLED */

/* USER CODE END EM */

void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim);

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

/* USER CODE BEGIN EFP */

/* USER CODE END EFP */

/* Private defines -----------------------------------------------------------*/
#define USR_BTN_Pin GPIO_PIN_13
#define USR_BTN_GPIO_Port GPIOC
#define USR_BTN_EXTI_IRQn EXTI15_10_IRQn
#define RADIO_LED0_Pin GPIO_PIN_0
#define RADIO_LED0_GPIO_Port GPIOC
#define RADIO_LED1_Pin GPIO_PIN_1
#define RADIO_LED1_GPIO_Port GPIOC
#define AIN_I_Drives_Pin GPIO_PIN_2
#define AIN_I_Drives_GPIO_Port GPIOC
#define AIN_I_Valves_Pin GPIO_PIN_3
#define AIN_I_Valves_GPIO_Port GPIOC
#define VCC_ON_Pin GPIO_PIN_0
#define VCC_ON_GPIO_Port GPIOA
#define VCC_ON_EXTI_IRQn EXTI0_IRQn
#define RADIO_RESET_Pin GPIO_PIN_1
#define RADIO_RESET_GPIO_Port GPIOA
#define LD2_Pin GPIO_PIN_5
#define LD2_GPIO_Port GPIOA
#define RADIO_NSS_Pin GPIO_PIN_7
#define RADIO_NSS_GPIO_Port GPIOA
#define PWR_EN_Pin GPIO_PIN_4
#define PWR_EN_GPIO_Port GPIOC
#define LATCH_OUT_Pin GPIO_PIN_5
#define LATCH_OUT_GPIO_Port GPIOC
#define RADIO_LED2_Pin GPIO_PIN_0
#define RADIO_LED2_GPIO_Port GPIOB
#define DBG1_Pin GPIO_PIN_1
#define DBG1_GPIO_Port GPIOB
#define BLE_INT_Pin GPIO_PIN_2
#define BLE_INT_GPIO_Port GPIOB
#define BLE_INT_EXTI_IRQn EXTI2_IRQn
#define DBG5_Pin GPIO_PIN_10
#define DBG5_GPIO_Port GPIOB
#define BLE_CS_Pin GPIO_PIN_13
#define BLE_CS_GPIO_Port GPIOB
#define BLE_RST_Pin GPIO_PIN_14
#define BLE_RST_GPIO_Port GPIOB
#define ZeroCrossing_Pin GPIO_PIN_6
#define ZeroCrossing_GPIO_Port GPIOC
#define AC_MOTOR_DRIVE_Pin GPIO_PIN_7
#define AC_MOTOR_DRIVE_GPIO_Port GPIOC
#define CLK_OUT_Pin GPIO_PIN_8
#define CLK_OUT_GPIO_Port GPIOC
#define DATA_OUT_Pin GPIO_PIN_9
#define DATA_OUT_GPIO_Port GPIOC
#define OE_Pin GPIO_PIN_8
#define OE_GPIO_Port GPIOA
#define RADIO_DIO0_Pin GPIO_PIN_10
#define RADIO_DIO0_GPIO_Port GPIOA
#define RADIO_DIO0_EXTI_IRQn EXTI15_10_IRQn
#define CAN_LED_Pin GPIO_PIN_15
#define CAN_LED_GPIO_Port GPIOA
#define ERR_LED_Pin GPIO_PIN_2
#define ERR_LED_GPIO_Port GPIOD
#define RADIO_DIO1_Pin GPIO_PIN_3
#define RADIO_DIO1_GPIO_Port GPIOB
#define RADIO_DIO1_EXTI_IRQn EXTI3_IRQn
#define RADIO_DIO3_Pin GPIO_PIN_4
#define RADIO_DIO3_GPIO_Port GPIOB
#define RADIO_DIO3_EXTI_IRQn EXTI4_IRQn
#define RADIO_DIO2_Pin GPIO_PIN_5
#define RADIO_DIO2_GPIO_Port GPIOB
#define RADIO_DIO2_EXTI_IRQn EXTI9_5_IRQn

/* USER CODE BEGIN Private defines */
/* USER CODE END Private defines */

#ifdef __cplusplus
}
#endif

#endif /* __MAIN_H */
