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.

[参考译文] CODECOMPOSER:GUI Composer v3:如何在GCv3中实现自定义编解码器?

Guru**** 2583435 points


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

https://e2e.ti.com/support/tools/code-composer-studio-group/ccs/f/code-composer-studio-forum/1088548/codecomposer-gui-composer-v3-how-to-implement-custom-codec-in-gcv3

部件号:CODECOMPOSER

您好,专家,

在GCv2中,联机编辑器为实现自定义编解码器提供了样板文件

CustomCodec.prototype.encode = function(target, jsonObj) {
    this.txPktCtr++;

/* TODO: Rework the following example code as required for your app:
   // The following example code shows how to encode property values from the GUI into
   // a JSON formatted string.  You would use this if you wanted to intercept data from the GUI
   // and rework it before passing it on to the target device.
   try{
        this.txMsgCtr++;
        if (this.txMsgCtr % 256){
            gc.console.log("CustomCodec","Number of tx messages to target: "+this.txMsgCtr);
        }
        var strToSend = ""; //JSON.stringify(jsonObj) +"\n";
        // send the string to the target
        target(strToSend);
    }
    catch(ex){
        gc.console.log("CustomCodec","CustomCodec.encode (to target): exception="+ex);
    }

*/
};

我可以通过UART为我的自定义程序进行修改。

然而,GCv3中的内容似乎有所不同,也有 一个样板 ,但它是针对如下json数据, 我不清楚如何调整它。

我的问题是:

1.对于解码函数,我只需读取变量数据中的字符,打包所需的信息,然后通过调用“this.targetDecoder.decode"?”发送  对于数据绑定,是否应执行任何其他操作?

2.在UART流中,我将浮点数封装为四个字节,并且将有许多浮点数,因此我需要有效的解码方法来从这些字节恢复浮点数。 我注意到ArrayBuffer是一种很好的方式来将字节数转换为浮点,如C中的方法。 我可以 在   这里将变量数据更改为ArrayBuffer吗?

3.是否可以使用GUI编辑器处理~2Mbps UART流?

非常感谢!

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

    您好,

    是的,GCv3有许多不同之处。 我会将此主题提请GC专家注意,并在收到任何更新时将其传递给他们。

    谢谢

    KI

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

    只是想提到,可能会推迟答复。 感谢您的耐心等待。

    KI

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

    好的,非常感谢 ,Ki