Jump to main content

##

# 3.2.8 tmcCur_States_s Struct

## C

    /* Structure to hold the current measurement states: Floating point version */
    typedef struct
    {
        uint8_t  calibDone;             /* Flag indicating calibration status */
        uint16_t  adcSampleCounter;     /* Counter for ADC samples */
        float32_t iaOffset;             /* Offset for phase A current */
        float32_t ibOffset;             /* Offset for phase B current */
        float32_t adcToCurrentFactor;   /* Conversion factor from ADC to current */
    <#if MCPMSMFOC_OFFSET_OOR == true >
        float32_t minOffset;            /* Minimum allowable offset */
        float32_t maxOffset;            /* Maximum allowable offset */
    </#if>
        uint32_t iaOffsetBuffer;        /* Buffer for phase A offset */
        uint32_t ibOffsetBuffer;        /* Buffer for phase B offset */
    } tmcCur_States_s;

    /* Structure to hold the current measurement states: Fixed point version */
    typedef struct
    {
        uint8_t  calibDone;             /* Flag indicating calibration status */
        uint16_t adcSampleCounter;      /* Counter for ADC samples */
        int16_t  iaOffset;              /* Offset for phase A current */
        int16_t  ibOffset;              /* Offset for phase B current */
        int16_t  minOffset;             /* Minimum allowable offset */
        int16_t  maxOffset;             /* Maximum allowable offset */
        int16_t  convFactorValue;       /*  Coversion factor value */
        uint16_t  convFactorShift;      /*  Coversion factor shift */
        int32_t  iaOffsetBuffer;        /* Buffer for phase A offset */
        int32_t  ibOffsetBuffer;        /* Buffer for phase B offset */
    } tmcCur_States_s;

## Summary

Motor phase current calculation parameters.

## Description

This data structure defines the ADC current sensor offset calibration status and the parameter required for current calculation.

## Remarks

Refer the generated header file for the exact typedef signature.