Printf

From ElectroDragon Wiki
Revision as of 12:04, 24 May 2021 by Chao (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
  • printf("%#08x\n", i); // gives 0x000007
  • printf("addr:0x%x, data:0x%x\r\n", addr, flash_data); // ... 0xFF


  • printf("%02X \n", (UINT16)SPIdat); // hex data // 02 表示不足两位,前面补0输出;如果超过两位,则实际输出
30 30 20 20 0D 0A 
30 30 20 20 

Purchar STM32

PUTCHAR_PROTOTYPE
{
 /* Place your implementation of fputc here */
 /* e.g. write a character to the EVAL_COM1 and Loop until the end of transmission */
 HAL_UART_Transmit(&huart1, (uint8_t *)&ch, 1, 0xFFFF);

 return ch;
}