Compare commits

..

No commits in common. "9a9d13f7bab728c1d1286e405c20324a0e6d8e89" and "25cd595d66d2498e9855ffb1d8637fd316502321" have entirely different histories.

View File

@ -3,15 +3,11 @@
#include <errno.h> #include <errno.h>
#include <signal.h> #include <signal.h>
#include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stm32f1xx_hal_uart.h> #include <stm32f1xx_hal_uart.h>
#include <time.h> #include <time.h>
#define HUART1 (&huart1)
#define HUART2 (&huart2)
extern UART_HandleTypeDef huart2; extern UART_HandleTypeDef huart2;
extern int __io_putchar(int ch) __attribute__((weak)); extern int __io_putchar(int ch) __attribute__((weak));
@ -80,23 +76,4 @@ void delay_us(uint16_t us) {
uint32_t delay = (HAL_RCC_GetHCLKFreq() / 4000000 * us); uint32_t delay = (HAL_RCC_GetHCLKFreq() / 4000000 * us);
while (delay--); while (delay--);
} }
/**
* @brief printf
* @param huart, buf
* @return void
*
* @usage my_printf(HUART1, "USART1_Target:\r\n");
*/
void my_printf(UART_HandleTypeDef *huart, const char *buf, ...) {
const char *p = buf;
char str[255] = {0};
va_list v;
va_start(v, buf);
vsprintf(str, buf, v);
HAL_UART_Transmit(huart, str, strlen(str), 0xff);
va_end(v);
}
#endif #endif