added printf _ioput function

This commit is contained in:
Charlez Kwan 2020-01-21 15:19:49 +01:00
parent b9d03c7a7f
commit e70abcd005

View file

@ -469,6 +469,20 @@ static void MX_GPIO_Init(void)
/* USER CODE BEGIN 4 */
int __io_putchar(int ch){
uint8_t c[1];
c[0] = ch & 0x00FF;
HAL_UART_Transmit(&huart1, &*c, 1, 10);
return ch;
}
int _write(int file, char *ptr, int len){
int DataIdx;
for (DataIdx = 0; DataIdx < len; DataIdx++){
__io_putchar(*ptr++);
}
return len;
}
/* USER CODE END 4 */
/**