Tip / ログイン to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

ModusToolbox 2.0でEZI2Cを介したPSoC 6の CapSenseのデータ出力 – KBA229699 - Community Translated (JA)

ModusToolbox 2.0でEZI2Cを介したPSoC 6の CapSenseのデータ出力 – KBA229699 - Community Translated (JA)

GeethaP_31
Employee
Employee
50 questions asked 10 questions asked 5 questions asked

Community Translated by  NoTa_4591161 Expert       Version: **

Translation - English: Output PSoC 6 CapSense Data Through EZI2C in ModusToolbox 2.0 – KBA229699

質問
ModusToolbox® 2.0EZI2Cを介してどのようにPSoC® 6CapSense®のデータを出力すればよいのでしょうか?

回答
CapSense Tunerツールを使用する代わりに、以下を実行してEZI2Cを使用してCapSenseデータをI2Cマスターに出力します。

1. カスタマイズされたI2Cデータバッファを定義します。バッファタイプは、配列または構造体になります。

2. バッファ内の各シフトレジスタを定義して、各レジスタにロードされるCapSenseパラメーターを指定します。例えば:

struct

{

uint16 rawcount[2];

uint16 baseline[2];

uint16 diffcount[2];

uint8 idac[2];

uint8 compidac[2];

}csd_param;

3. 以下のAPIを使用して、プライマリスレーブアドレス要求でI2Cマスターに認識されるようI2Cデータバッファーを設定します。

            void Cy_SCB_EZI2C_SetBuffer1(CySCB_Type const *base, uint8_t *buffer, uint32_t size, uint32_t rwBoundary,

  cy_stc_scb_ezi2c_context_t

*context)

4. 実行中にI2CのデータバッファにCapSenseデータを手動でロードします。

rawcountbaselinediffcountmodulation IDACCompensation IDACなどのセンサーパラメーターを取得する手順を実装すとためのコードを使用します。以下は、rawcountIDACを取得する2つのコードスニペットです。

Sensor Rawcounttの取得

uint32_t Cy_CapSense_getraw(

uint32_t widgetId,

uint32_t sensorId,

const cy_stc_capsense_context_t * context)

{

    uint32_t result = 0uL;

    if (widgetId < context->ptrCommonConfig->numWd)

    {

        if (sensorId < context->ptrWdConfig[widgetId].numSns)

        {

            result = context->ptrWdConfig[widgetId].ptrSnsContext[sensorId].raw;

        }

    }

    return result;

}

ウィジェットIDACの取得

uint32_t Cy_CapSense_getidac(

uint32_t widgetId,

uint32_t sensorId,

const cy_stc_capsense_context_t * context)

{

    uint32_t result = 0uL;

    if (widgetId < context->ptrCommonConfig->numWd)

    {

        if (sensorId < context->ptrWdConfig[widgetId].numSns)

        {

            result = context->ptrWdConfig[widgetId].ptrWdContext[widgetId].idacMod[0];

        }

    }

    return result;

}

0 件の賞賛
143 件の閲覧回数
寄稿者