Pull the medium-specific pieces out of the common code
Change-Id: I9cd1824a6bf535e285553fbe5f79f6d72919f048
diff --git a/motors/motor_controls.h b/motors/motor_controls.h
index e0fa28c..1f19e6d 100644
--- a/motors/motor_controls.h
+++ b/motors/motor_controls.h
@@ -20,6 +20,23 @@
MotorControlsImplementation();
~MotorControlsImplementation() override = default;
+ static constexpr int constant_counts_per_revolution() { return 1024; }
+
+ int mechanical_counts_per_revolution() const override {
+ return constant_counts_per_revolution();
+ }
+ int electrical_counts_per_revolution() const override {
+ return constant_counts_per_revolution();
+ }
+ float scale_current_reading(float reading) const override {
+ return reading *
+ static_cast<float>(1.0 / 4096.0 /* Full-scale ADC reading */ *
+ 3.3 /* ADC reference voltage */ /
+ (1.47 / (0.768 + 1.47)) /* 5V -> 3.3V divider */ /
+ 50.0 /* Current sense amplification */ /
+ 0.0003 /* Sense resistor */);
+ }
+
::std::array<uint32_t, 3> DoIteration(const float raw_currents[3],
uint32_t theta,
const float command_current) override;