/************************************************************************************
*  Copyright (c), 2019, HelTec Automatic(TM) Technology co.,LTD.
*            All rights reserved.
*
* Http:    www.heltec.cn
* Email:   suppor@heltec.cn
* WebShop: heltec.taobao.com
*
* File name: main.c
* Processor: STM32F103VBT6
* Compiler : MDK fo ARM 5.26
* 
* Author : Aaron.Lee
* Version: 1.00
* Date   : 2019.3.6
* Email  : suppor@heltec.cn
* Modification: none
* 
* Description: Heltec UART debug printer via STM32 USART 1 exampled code
*
* Others: none;
*
* Function List:
*	1. void  DebugPrintf (char  *p_fmt, ...);
*
* History: none;
*
*************************************************************************************/

#include "function.h"

#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include "stm32f1xx_hal.h"
#include "stm32f1xx_hal_uart.h"

extern UART_HandleTypeDef huart1;

void  DebugPrintf (char  *p_fmt, ...)
{
	if(1)
	{
			char    str[200u];
			uint8_t  len;

			va_list     vArgs;

			va_start(vArgs, p_fmt);

			vsprintf((char       *)str,
							 (char const *)p_fmt,
														 vArgs);

			va_end(vArgs);
			len = strlen(str);
//			UartPutBuffer(&Uart1, (uint8_t *)str, len);

			HAL_UART_Transmit(&huart1, (uint8_t *)str, len, 10);
	}
}

