Easy methods to set up Benewake TF SERIES on PixHawk(Take TF01 for instance)

// World Variables

u16 distance = zero;

// Variables utilized by serial

static u8 Usart1buf[USART1_BUF_SIZE];

static u8 pointer = zero;

// Serial Port 1 Operate Initialize

void USART1_Init(void)

GPIO_Pin_10;

         GPIO_InitStructure.GPIO_Speed = GPIO_High_Speed;

         GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF;

         GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;

         GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;

         GPIO_Init(GPIOA,&GPIO_InitStructure);

         // Different Operate Configuration

         GPIO_PinAFConfig(GPIOA,GPIO_PinSource9,GPIO_AF_USART1);

         GPIO_PinAFConfig(GPIOA,GPIO_PinSource10,GPIO_AF_USART1);

         // USART1 clock

         RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);

         // USART1 Interrupt Precedence

         NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;

         NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = zero;

         NVIC_InitStructure.NVIC_IRQChannelSubPriority = zero;

         NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;

         NVIC_Init(&NVIC_InitStructure);

         // USART1 Initialize

         USART_DeInit(USART1);

         USART1_InitStructure.USART_BaudRate = 115200;

         USART1_InitStructure.USART_WordLength = USART_WordLength_8b;

         USART1_InitStructure.USART_StopBits = USART_StopBits_1;

         USART1_InitStructure.USART_Parity = USART_Parity_No;

         USART1_InitStructure.USART_Mode = USART_Mode_Rx

// Serial Interrupt Operate

void USART1_IRQHandler(void)

{

         if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET

            || (USART_GetITStatus(USART1, USART_IT_ORE_RX) != RESET))

        

}