Bayley Wang
/
priustroller_3
temp repo
Fork of priustroller_2 by
core/motor.cpp@29:cb03760ba9ea, 2015-03-14 (annotated)
- Committer:
- nki
- Date:
- Sat Mar 14 23:42:46 2015 +0000
- Revision:
- 29:cb03760ba9ea
- Parent:
- 11:dccbaa9274c5
- Child:
- 30:2b6d426f3bfc
Cautionary commit, possibly works
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bwang | 0:54cf32d35f4d | 1 | #include "includes.h" |
bwang | 1:1f58bdcf2956 | 2 | #include "core.h" |
bwang | 1:1f58bdcf2956 | 3 | #include "sensors.h" |
bwang | 0:54cf32d35f4d | 4 | |
nki | 29:cb03760ba9ea | 5 | Motor::Motor(PositionSensor *sense_p, TempSensor *sense_t) { |
bwang | 0:54cf32d35f4d | 6 | _sense_p = sense_p; |
bwang | 0:54cf32d35f4d | 7 | _sense_t = sense_t; |
bwang | 0:54cf32d35f4d | 8 | } |
bwang | 0:54cf32d35f4d | 9 | |
bwang | 11:dccbaa9274c5 | 10 | float Motor::GetCurrentC() { |
nki | 29:cb03760ba9ea | 11 | return (float) global_ic / 4095.0f; |
bwang | 0:54cf32d35f4d | 12 | } |
bwang | 0:54cf32d35f4d | 13 | |
bwang | 11:dccbaa9274c5 | 14 | float Motor::GetCurrentB() { |
nki | 29:cb03760ba9ea | 15 | return (float) global_ib / 4095.0f; |
bwang | 0:54cf32d35f4d | 16 | } |
bwang | 0:54cf32d35f4d | 17 | |
bwang | 11:dccbaa9274c5 | 18 | float Motor::GetPosition() { |
bwang | 11:dccbaa9274c5 | 19 | return _sense_p->GetPosition(); |
bwang | 0:54cf32d35f4d | 20 | } |
bwang | 0:54cf32d35f4d | 21 | |
bwang | 11:dccbaa9274c5 | 22 | float Motor::GetTemp() { |
bwang | 11:dccbaa9274c5 | 23 | return _sense_t->GetTemp(); |
bwang | 0:54cf32d35f4d | 24 | } |
bwang | 0:54cf32d35f4d | 25 | |
bwang | 0:54cf32d35f4d | 26 | void Motor::Config(int num_poles, float kv) { |
bwang | 0:54cf32d35f4d | 27 | _num_poles = num_poles; |
bwang | 0:54cf32d35f4d | 28 | _kv = kv; |
bwang | 0:54cf32d35f4d | 29 | } |