temp repo

Dependencies:   mbed

Fork of priustroller_2 by N K

meta/modulators.cpp

Committer:
bwang
Date:
2015-03-09
Revision:
13:79e247e54d78
Parent:
11:dccbaa9274c5
Child:
14:1cc975207995

File content as of revision 13:79e247e54d78:

#include "includes.h"
#include "core.h"
#include "meta.h"
#include "sensors.h"
#include "lut.h"

void SinusoidalModulator::Update(float va, float vb) {
    //--hack to make duty cycles positive
    float dtcA = va;
    float dtcB = ((-va + sqrt(3.0f) * vb) / 2.0f);
    float dtcC = ((-va - sqrt(3.0f) * vb) / 2.0f);
    _inverter->SetDtcA(dtcA * 0.5f + 0.5f);
    _inverter->SetDtcB(dtcB * 0.5f + 0.5f);
    _inverter->SetDtcC(dtcC * 0.5f + 0.5f);
}