xdev_out(xUSART2_putchar_n);

2019-08-19 17:36发布

F207串口2的例程里面有语句 xdev_out(xUSART2_putchar_n);
定义过去是#define xdev_out(func) xfunc_out = (void(*)(unsigned char))(func)
这是什么意思?没看懂


下面是原例程:
void xPrintfCom2_Init(void)
{
  USART_InitTypeDef USART_InitStructure;   

  /* USARTx configured as follow:
        - BaudRate = 115200 baud  
        - Word Length = 8 Bits
        - One Stop Bit
        - No parity
        - Hardware flow control disabled (RTS and CTS signals)
        - Receive and transmit enabled
  */
  USART_InitStructure.USART_BaudRate = 115200;
  USART_InitStructure.USART_WordLength = USART_WordLength_8b;
  USART_InitStructure.USART_StopBits = USART_StopBits_1;
  USART_InitStructure.USART_Parity = USART_Parity_No;
  USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
  USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;

  STM_EVAL_COMInit(COM2, &USART_InitStructure);
  xdev_out(xUSART2_putchar_n);
  xdev_in(xUSART2_getchar);  

  /* Output a message on Hyperterminal using printf function */
  //printf(" USART Printf Example: retarget the C library printf function to the USART ");
  xprintf(" WWW.ARMJISHU.COM神舟王STM32F207ZGT %s xprintf configured....", EVAL_COM2_STR);
  xprintf(" ############ WWW.ARMJISHU.COM! ############ ("__DATE__ " - " __TIME__ ")");

  xprintf("%s", STM32F2xx_STR);

  xprintf(" WWW.ARMJISHU.COM use __STM32F2XX_STDPERIPH_VERSION %d.%d.%d",
                        __STM32F2XX_STDPERIPH_VERSION_MAIN,
                        __STM32F2XX_STDPERIPH_VERSION_SUB1,
                        __STM32F2XX_STDPERIPH_VERSION_SUB2);
  xprintf(" 产品内部Flash大小为:1000K字节! www.armjishu.com");
  /*xprintf(" 产品内部Flash大小为:%dK字节! www.armjishu.com",
            *(__IO uint16_t*)(0x1FFFF7E0));*/
  SystemCoreClockUpdate();
  xprintf(" 系统内核时钟频率(SystemCoreClock)为:%dHz. ",
            SystemCoreClock);
}


0条回答

一周热门 更多>