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.
 
 
 

37 lines
1.3 KiB

#include "zport.h"
#include <stdint.h>
#include <stdio.h>
#include "zboard.h"
static uint32_t sys_haspassedms(uint32_t ticket)
{
uint32_t nowticket = HAL_GetTick();
if (nowticket >= ticket)
{
return nowticket - ticket;
}
return UINT32_MAX - ticket + nowticket;
}
///**********************************************************************************************************************
// * ===================================================printf重定向=================================================== *
// **********************************************************************************************************************/
int fputc(int ch, FILE *stream)
{
uint8_t c = ch;
HAL_UART_Transmit(&DEBUG_UART, &c, 1, 100);
return ch;
}
///***********************************************************************************************************************
// * ====================================================调试指示灯===================================================== *
// ***********************************************************************************************************************/
void port_do_debug_light_state(void)
{
static uint32_t lastprocess = 0;
if (sys_haspassedms(lastprocess) > 300)
{
lastprocess = HAL_GetTick();
HAL_GPIO_TogglePin(DEBUG_LIGHT_PORT, DEBUG_LIGHT_PIN);
}
}