3.9.12 UTIL_2DPlotInitialize

C


/* Initialize 2D plot */
 void UTIL_2DPlotInitialize( tUTIL_2DPlot_s * const p2DPlot, const uint8_t dataPoints,
                                            const tUTIL_2DPoints_s points[] )	

Summary

This function initializes a 2D plot structure.

Description

The function initializes a 2D plot structure with a specified number of data points. This function sets up the plot with the given data points and ensures that any remaining slots in the plot are zero-initialized.

Precondition

None.

Parameters

ParamDescription
p2DPlotPointer to the 2D plot structure that will be initialized.
dataPointsNumber of data points to be initialized in the plot structure.
pointsArray of 2D points that will be used to initialize the plot structure.

Returns

None

Example

// Define a structure for 2D points
typedef struct
{
    float32_t x;
    float32_t y;
}tUTIL_2DPoints_s;

// Define a structure for 2D plot
typedef struct
{
    uint8_t dataPoints;
    tUTIL_2DPoints_s  points[10u];
}tUTIL_2DPlot_s;

// Declare a structure for 2D plot
tUTIL_2DPlot_s 2DPlot;
tUTIL_2DPoints_s dataPoints[3] = {
    {1.0f, 2.0f},
    {3.0f, 4.0f},
    {5.0f, 6.0f}
};

/* Initialize 2D plot */
UTIL_2DPlotInitialize(&2DPlot, 3, dataPoints);
    

Remarks

None.