This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] CC2642R:调用 Display_printf 时、如何禁用"\r\n"

Guru**** 2538955 points
Other Parts Discussed in Thread: CC2642R, CC2652R7

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/1326510/cc2642r-how-to-disable-r-n-while-calling-display_printf

器件型号:CC2642R
主题中讨论的其他器件: CC2652R7

您好、TI!

我使用 Display_printf()来打印一些消息。

但是,它也会打印出转义和新行(即"\r\n")。

如何禁用 转义和新行?

我参考了下面的 E2E:

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/1082695/lp-cc2652r7-ble-display_printf-usage-as-the-log-record

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好,王正品

    我希望你们做得好。 看一下附加的 E2E 线程以及 syscfg Display 设置中的"禁用 ANSI"、它会在 ti_drivers_config.c 文件中更改以下内容:  

    并在 display.syscfg 文件中删除 Display.enableANSI = true;  

    您可以通过显示生成的文件(syscfg 右上角的"<>"按钮)并查看在 syscfg 中更改设置时指示更改的文件来查看这些更改; 不过、以上设置适用于 CC2652R7、因此对于 CC2642R 器件、它们可能采用不同的格式。   

    谢谢。
    A·F

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Alex ***:

    感谢您的快速重播。

    我已按照您的建议查看启用和禁用之间的区别,我展示了下面的 pic :

    配置 使能 ANSI:  

    启用  ANSI 打印:  

    配置 禁用 ANSI:

    打印退出禁用 ANSI:  

    我看到了配置的打印格式的差异。 但这不是我要找的结果。

    让我澄清一下我的问题:  

    是否有任何 API 或方法可以打印出数据,但它不自动打印转义和新行(\r\n )?

    我想手动打印"\r\n"。 (例如 printf ("Hello world \r\n"),\r\n 由自己添加)。

    我所预测的格式是下面的 pic (demo by none-TI launchpad):

    但是如果我使用 Display_printf 函数、它将打印出如下内容:  

    并发布我的部分源代码:

    Display_Handle    display;
    Display_Params    params;
    uint8_t idx ;
    const unsigned char printBuff[] = {0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A};
    
    Display_init();
    Display_Params_init(&params);
    params.lineClearMode = DISPLAY_CLEAR_BOTH ;
    
    display = Display_open(Display_Type_UART, &params);
    Display_printf(display,0,0,"Hello CC2652R1");
    Display_printf(display,0,0,"Buffer Data : ");
    for(idx=0 ; idx< sizeof(printBuff); idx++)
    {
        Display_printf(display,0,0,"0x%x ", printBuff[idx]);
    }
    
     

     当需要打印出大容量缓冲区的数据时、调试或记录变得容易得多。   

    这是我的主要问题,谢谢,等待你的建议。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好,王正品

    如果您使用 UART 驱动程序,则应该能够在不使用\r\n 的情况下打印数据。 有关如何设置和使用 UART 的详细信息、请参阅 SDK 中的 uartecho 示例。  

    谢谢。
    A·F