#ifndef BOARD_CONFIG_H
#define BOARD_CONFIG_H

/* >>>>>>>>>>>>>>>>>>>>[RS485 PHY DEFINE]<<<<<<<<<<<<<<<<<<<< */

// #define RS485_MAX13487 // RS485 PHY : MAX13487 (AutoDir)
#undef  RS485_MAX13487 // RS485 PHY : SP3487 (no AutoDir)

/* >>>>>>>>>>>>>>>>>>>>[IIC TYPE DEFINE]<<<<<<<<<<<<<<<<<<<< */

#define POWER_SUPPLY_24V // Powwer Supplu : 24V
// #undef  POWER_SUPPLY_24V // Powwer Supplu : 12V

/* >>>>>>>>>>>>>>>>>>>>[DEBUG ASSERTIONS DEFINE]<<<<<<<<<<<<<<<<<<<< */

// #define DEBUG_VERBOSE // Debug Assertions Status : Debug Verbose Information
#undef  DEBUG_VERBOSE // Debug Assertions Status : No Debug Verbose Information

/******************************************************************************/

#define RCU_GPIO_I2C         RCU_GPIOF
#define RCU_I2C              RCU_I2C0
#define I2C_SCL_PORT         GPIOF
#define I2C_SCL_PIN          GPIO_PIN_1
#define I2C_SDA_PORT         GPIOF
#define I2C_SDA_PIN          GPIO_PIN_0
#define I2C_GPIO_AF          GPIO_AF_1

#define I2C_DEBUG_UART       USART0

/******************************************************************************/

#define LED_PORT             GPIOA
#define LED_PIN              GPIO_PIN_9
#define LED_RCU              RCU_GPIOA

/******************************************************************************/

#define RS485_RCU            RCU_USART1
#define RS485_GPIO_RCU       RCU_GPIOA
#define RS485_GPIO_PORT      GPIOA
#define RS485_TX_PIN         GPIO_PIN_2
#define RS485_RX_PIN         GPIO_PIN_3
#define RS485_PHY            USART1
#define RS485_BAUDRATE       115200U
#define RS485_EN_PIN         GPIO_PIN_1
#define RS485_IRQ            USART1_IRQn

/******************************************************************************/

#define US_TX_GPIO_RCU      RCU_GPIOB
#define US_TX_GPIO_PORT     GPIOB
#define US_TX_GPIO_PIN      GPIO_PIN_1
#define US_TX_GPIO_AF       GPIO_AF_0
#define US_TX_TIMER_RCU     RCU_TIMER13
#define US_TX_TIMER         TIMER13
#define US_TX_TIMER_CH      TIMER_CH_0

/******************************************************************************/

#define US_TX_DELAY_RCU     RCU_TIMER15
#define US_TX_DELAY_TIMER   TIMER15

/******************************************************************************/

#define US_RX_GPIO_RCU      RCU_GPIOB
#define US_RX_EXTI_RCU      RCU_CFGCMP
#define US_RX_GPIO_PORT     GPIOA
#define US_RX_GPIO_PIN      GPIO_PIN_0
#define US_RX_GPIO_EXTI     EXTI_0
#define US_RX_EXTI_LINE     EXTI_SOURCE_PIN0
#define US_RX_EXTI_IRQ      EXTI0_1_IRQn

/******************************************************************************/

#define US_ECHO_RCU         RCU_TIMER16
#define US_ECHO_TIMER       TIMER16
#define US_ECHO_CH          TIMER_CH_0

/******************************************************************************/

#define TIME_CORRECTION_US  230U
#define CAPTURE_VALUE_MAX   550U

/******************************************************************************/

#endif //BOARD_CONFIG_H
