printf绑定
首先先设置好串口,不论用中断的,或者不用也可以,只要能用
UARTCharPut这个函数在串口输出东西就可以了
然后在文件中加入
1 2 3 4 5 6 7 8 9 10 11 12 | #include “stdio.h” int fputc ( int ch, FILE *f) { UARTCharPut(UART0_BASE, (unsigned char ) ch); while (UARTBusy(UART0_BASE) == true ); return ch; } |
这样就能绑定printf到串口函数了
然后想在那个文件中调用串口输入
只要加入
1 | #include “stdio.h” |
就能输出了
1 | printf (“test”); |