demo project

Dependencies:   AX-12A Dynamixel mbed iothub_client EthernetInterface NTPClient ConfigFile SDFileSystem iothub_amqp_transport mbed-rtos proton-c-mbed wolfSSL

MeasureBuf.cpp

Committer:
henryrawas
Date:
2016-01-22
Revision:
17:0dbcbd8587fd
Parent:
13:ffeff9b5e513

File content as of revision 17:0dbcbd8587fd:

#include "mbed.h"

#include "MeasureBuf.h"



SafeCircBuf<MeasureSnapshot, MeasureBufSize, uint32_t> MeasureBuf;

void MeasureGroup::SetMeasure(NodeMeasure mId, int numParts, float vals[])
{
    MeasId = mId;
    
    NumVals = NUMJOINTS < numParts ? NUMJOINTS : numParts;
    
    for (int ix = 0; ix < NumVals; ix++)
    {
        MeasVals[ix] = vals[ix];
    }
}

MeasureGroup& MeasureGroup::operator=(const MeasureGroup& rhs)
{
    MeasId = rhs.MeasId;
    NumVals = rhs.NumVals;
    for (int ix = 0; ix < NUMJOINTS; ix++)
    {
        MeasVals[ix] = rhs.MeasVals[ix];
    }
    return *this;
}