Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of analoghalls5_5 by
Diff: loopdriver.cpp
- Revision:
- 4:fdadf4a3577a
- Parent:
- 3:0a2396597e0d
- Child:
- 5:ee1e6c84c302
--- a/loopdriver.cpp Mon Mar 02 01:24:37 2015 +0000
+++ b/loopdriver.cpp Mon Mar 02 11:17:15 2015 +0000
@@ -11,6 +11,7 @@
PidController* LoopDriver::_pid_q;
ReferenceSynthesizer* LoopDriver::_reference;
Modulator* LoopDriver::_modulator;
+int LoopDriver::_blinky_toggle;
LoopDriver::LoopDriver(Inverter *inverter, Motor *motor, User *user, PidController *pid_d,
PidController *pid_q, Modulator *modulator, float max_phase_current, int update_frequency) {
@@ -59,6 +60,12 @@
}
void LoopDriver::update() {
+ _blinky_toggle = !_blinky_toggle;
+
+ _inverter->SetDtcA(LutSin(_motor->angle));
+ _inverter->SetDtcB(LutSin(_motor->angle - 120.0f));
+ _inverter->SetDtcC(LutSin(_motor->angle + 120.0f));
+
float alpha, beta, d, q, ref_d, ref_q, valpha, vbeta;
Clarke(_motor->I_a, _motor->I_b, &alpha, &beta);
Parke(alpha, beta, _motor->angle, &d, &q);
