You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
522 B
30 lines
522 B
#include <stdint.h>
|
|
#include <stdio.h>
|
|
|
|
#include "board.h"
|
|
#include "main.h"
|
|
#include "usart.h"
|
|
/**
|
|
* @brief printf 重定向
|
|
*
|
|
* @param ch
|
|
* @param stream
|
|
* @return int
|
|
*/
|
|
int fputc(int ch, FILE* stream) {
|
|
uint8_t c = ch;
|
|
HAL_UART_Transmit(&DEBUG_UART, &c, 1, 100);
|
|
return ch;
|
|
}
|
|
|
|
/**
|
|
* @brief ticket辅助方法
|
|
*/
|
|
|
|
uint32_t port_haspassedms(uint32_t ticket) {
|
|
uint32_t nowticket = HAL_GetTick();
|
|
if (nowticket >= ticket) {
|
|
return nowticket - ticket;
|
|
}
|
|
return UINT32_MAX - ticket + nowticket;
|
|
}
|