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.

[参考译文] CC3220S-LAUNCHXL:如何编辑和重新构建 SDK

Guru**** 2538930 points


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

https://e2e.ti.com/support/wireless-connectivity/wi-fi-group/wifi/f/wi-fi-forum/988296/cc3220s-launchxl-how-to-edit-and-rebuild-sdk

器件型号:CC3220S-LAUNCHXL

我想使用 Display_vprintf (...) 而不是在末尾自动插入新行

  1. 我希望能够打印从串行接收到的单个十六进制值、并在一行上查看它们。
  2. 我想将调试级别添加到每个日志的前面。

当我尝试编辑 DisplayUart2Min_vprintf (...)时 在 DisplayUart2.c 中、它看起来不起作用、我尝试清理和重建项目。 如何通过编辑 SDK 文件或使用其他函数来实现我的目标? 注意:我知道我可以 直接调用 UART2_write(),但我不想冒险 使用 DisplayUart2Min_vprintf (...)的信标。

// An examaple adding the log level to the debug log.
void log_debug(const char *format, ...) {
  va_list args;
  va_start(args, format);
  Display_printf(display_vcom_handle, 0, 0, "Debug:   ");
  Display_vprintf(display_vcom_handle, 0, 0, message, args);
  va_end(args);
}

// SDK file I want to change. I tried commenting out '\r' anad '\n' but it didn't work
// hwAttrs->strBuf[strSize++] = '\r';
// hwAttrs->strBuf[strSize++] = '\n';
void DisplayUart2Min_vprintf(Display_Handle hDisplay, uint8_t line,
                             uint8_t column, const char *fmt, va_list va)
{
    DisplayUart2_Object  *object  = (DisplayUart2_Object  *)hDisplay->object;
    DisplayUart2_HWAttrs *hwAttrs = (DisplayUart2_HWAttrs *)hDisplay->hwAttrs;

    uint32_t strSize = 0;

    if (SemaphoreP_pend(object->mutex, hwAttrs->mutexTimeout) == SemaphoreP_OK)
    {
        SystemP_vsnprintf(hwAttrs->strBuf, hwAttrs->strBufLen - 2, fmt, va);

        strSize = strlen(hwAttrs->strBuf);
        hwAttrs->strBuf[strSize++] = '\r';
        hwAttrs->strBuf[strSize++] = '\n';

        UART2_write(object->hUart, hwAttrs->strBuf, strSize, NULL);
        SemaphoreP_post(object->mutex);
    }
}

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

    您好、Collin、

    在 CCS 中、要覆盖 DisplayUart2Min_vprintf()的链接库符号、请将编辑后的源文件(DisplayUart2.c)直接添加 到项目中。

    此致、

    Sarah

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

    Sarah、

    这比我想象的要简单得多。 谢谢!