//
// Created by dell on 24-9-23.
//

#ifndef ULTRASONIC_DRIVER_H
#define ULTRASONIC_DRIVER_H

#include "gd32e23x.h"

#define LED_PORT            GPIOA
#define LED_PIN             GPIO_PIN_9
#define LED_RCU             RCU_GPIOA
#define LED_TIMER           TIMER13
#define LED_IRQ             TIMER13_IRQn

#define USART_RCU           RCU_USART0
#define USART_GPIO_RCU      RCU_GPIOA
#define USARET_GPIO_PORT    GPIOA
#define USART_TX_PIN        GPIO_PIN_2
#define USART_RX_PIN        GPIO_PIN_3
#define USART0_PHY          USART0
#define USART_BAUDRATE      115200U

#define US_TRAN_GPIO_RCU    RCU_GPIOB
#define US_TRAN_GPIO_PORT   GPIOB
#define US_TRAN_PIN         GPIO_PIN_1

#define US_TRAN_RCU         RCU_TIMER2
#define US_TRAN_TIMER       TIMER2
#define US_TRAN_CH          TIMER_CH_3

void led_config(void);
void usart_config(void);
void ultrasonic_config(void);
void ultrasonic_peripheral_config(void);
void ultrasonic_pwm_out_cycles(uint8_t cycles);

#endif //ULTRASONIC_DRIVER_H
