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 by
motor.cpp
00001 #include "includes.h" 00002 #include "core.h" 00003 #include "sensors.h" 00004 00005 Motor::Motor(CurrentSensor *sense_c, CurrentSensor *sense_b, PositionSensor *sense_p, TempSensor *sense_t) { 00006 _sense_c = sense_c; 00007 _sense_b = sense_b; 00008 _sense_p = sense_p; 00009 _sense_t = sense_t; 00010 UpdateState(); 00011 } 00012 00013 float Motor::UpdateCurrentC() { 00014 return I_c = _sense_c->GetCurrent(); 00015 } 00016 00017 float Motor::UpdateCurrentB() { 00018 return I_b = _sense_b->GetCurrent(); 00019 } 00020 00021 float Motor::UpdatePosition() { 00022 return angle = _sense_p->GetPosition(); 00023 } 00024 00025 float Motor::UpdateTemp() { 00026 return temp = _sense_t->GetTemp(); 00027 } 00028 00029 void Motor::UpdateState() { 00030 UpdateCurrentC(); 00031 UpdateCurrentB(); 00032 UpdatePosition(); 00033 } 00034 00035 void Motor::Config(int num_poles, float kv) { 00036 _num_poles = num_poles; 00037 _kv = kv; 00038 }
Generated on Fri Jul 15 2022 12:15:05 by
