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-15
Revision:
13:ffeff9b5e513
Parent:
7:6723f6887d00
Child:
17:0dbcbd8587fd

File content as of revision 13:ffeff9b5e513:

#include "mbed.h"

#include "MeasureBuf.h"



SafeCircBuf<MeasureGroup, MeasureBufSize, uint32_t> MeasureBuf;

void MeasureGroup::SetMeasure(NodeMeasure mId, time_t created, int numParts, float vals[])
{
    MeasId = mId;
    Created = created;
    
    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;
    Created = rhs.Created;
    NumVals = rhs.NumVals;
    for (int ix = 0; ix < NUMJOINTS; ix++)
    {
        MeasVals[ix] = rhs.MeasVals[ix];
    }
    return *this;
}