我使用的是IAR+F103+CUBE在写程序
最近想搞一下USB CDC虚拟串口,我想把虚拟串口的输出,重定义到printf上
首先参考了printf重定义到uart的方法,把uart发送函数改为虚拟串口发送函数
结果发送不出来东西,而使用虚拟串口发送函数直接发送的东西却能发送到电脑上
有没有搞过相关开发的大侠们,求各位指点
- #ifdef __GNUC__
- /* With GCC/RAISONANCE, small printf (option LD Linker->Libraries->Small printf
- set to 'Yes') calls __io_putchar() */
- #define PUTCHAR_PROTOTYPE int __io_putchar(int ch)
- #else
- #define PUTCHAR_PROTOTYPE int fputc(int ch, FILE *f)
- #endif /* __GNUC__ */
- PUTCHAR_PROTOTYPE
- {
- /* Place your implementation of fputc here */
- /* e.g. write a character to the USART1 and Loop until the end of transmission */
- CDC_Transmit_FS( (uint8_t*)ch, 1);
- return ch;
- }
|