Move all the motors stuff into a saner namespace
Letting the mechanical engineers name software is never a good idea...
Change-Id: I5d0e43d84a8f45693435472cc0e5e288f6190b14
diff --git a/motors/algorithms.cc b/motors/algorithms.cc
index 1d655ef..6edb532 100644
--- a/motors/algorithms.cc
+++ b/motors/algorithms.cc
@@ -1,7 +1,7 @@
#include "motors/algorithms.h"
namespace frc971 {
-namespace salsa {
+namespace motors {
BalancedReadings BalanceReadings(const ReadingsToBalance to_balance) {
// TODO(Brian): Get rid of the floating point divides.
@@ -46,5 +46,5 @@
return result;
}
-} // namespace salsa
+} // namespace motors
} // namespace frc971
diff --git a/motors/algorithms.h b/motors/algorithms.h
index 8b397f8..63d6d19 100644
--- a/motors/algorithms.h
+++ b/motors/algorithms.h
@@ -4,7 +4,7 @@
#include <stdint.h>
namespace frc971 {
-namespace salsa {
+namespace motors {
struct ReadingsToBalance {
// Adds a single reading at index.
@@ -39,7 +39,7 @@
return r;
}
-} // namespace salsa
+} // namespace motors
} // namespace frc971
#endif // MOTORS_ALGORITHMS_H_
diff --git a/motors/algorithms_test.cc b/motors/algorithms_test.cc
index 32ca8b7..18b89c3 100644
--- a/motors/algorithms_test.cc
+++ b/motors/algorithms_test.cc
@@ -6,7 +6,7 @@
#include "gtest/gtest.h"
namespace frc971 {
-namespace salsa {
+namespace motors {
namespace testing {
class BalanceReadingsTest : public ::testing::Test {
@@ -97,5 +97,5 @@
}
} // namespace testing
-} // namespace salsa
+} // namespace motors
} // namespace frc971
diff --git a/motors/big/medium_salsa.cc b/motors/big/medium_salsa.cc
index dc9d0a8..0bd4489 100644
--- a/motors/big/medium_salsa.cc
+++ b/motors/big/medium_salsa.cc
@@ -13,7 +13,7 @@
#include "motors/util.h"
namespace frc971 {
-namespace salsa {
+namespace motors {
namespace {
::std::atomic<Motor *> global_motor{nullptr};
@@ -269,5 +269,5 @@
return 0;
}
-} // namespace salsa
+} // namespace motors
} // namespace frc971
diff --git a/motors/big/motor_controls.cc b/motors/big/motor_controls.cc
index 6a625bf..82dcc0b 100644
--- a/motors/big/motor_controls.cc
+++ b/motors/big/motor_controls.cc
@@ -3,7 +3,7 @@
#include "motors/peripheral/configuration.h"
namespace frc971 {
-namespace salsa {
+namespace motors {
namespace {
template <int kRows, int kCols>
@@ -239,5 +239,5 @@
return debug_[theta];
}
-} // namespace salsa
+} // namespace motors
} // namespace frc971
diff --git a/motors/big/motor_controls.h b/motors/big/motor_controls.h
index 1f19e6d..b9514fd 100644
--- a/motors/big/motor_controls.h
+++ b/motors/big/motor_controls.h
@@ -10,7 +10,7 @@
#include "Eigen/Dense"
namespace frc971 {
-namespace salsa {
+namespace motors {
class MotorControlsImplementation : public MotorControls {
public:
@@ -56,7 +56,7 @@
int16_t debug_[9];
};
-} // namespace salsa
+} // namespace motors
} // namespace frc971
#endif // MOTORS_MOTOR_CONTROLS_H_
diff --git a/motors/button_board.cc b/motors/button_board.cc
index 7e4a43c..6d5d11e 100644
--- a/motors/button_board.cc
+++ b/motors/button_board.cc
@@ -69,12 +69,12 @@
teensy::HidFunction *joystick1) {
uint32_t start = micros();
while (true) {
- salsa::JoystickAdcReadings adc;
+ JoystickAdcReadings adc;
char report0[report_size()];
char report1[report_size()];
{
DisableInterrupts disable_interrupts;
- adc = salsa::AdcReadJoystick(disable_interrupts);
+ adc = AdcReadJoystick(disable_interrupts);
}
FTM0->C1V = adc.analog0 / 4;
@@ -334,7 +334,7 @@
usb_device.Initialize();
can_init(0, 1);
- salsa::AdcInitJoystick();
+ AdcInitJoystick();
SetupLedFtm(FTM0);
SetupLedFtm(FTM3);
diff --git a/motors/math.cc b/motors/math.cc
index 291ca43..8441e97 100644
--- a/motors/math.cc
+++ b/motors/math.cc
@@ -3,7 +3,7 @@
#include <math.h>
namespace frc971 {
-namespace salsa {
+namespace motors {
namespace math_internal {
float sin_int_table[SinCosTableSize()];
@@ -33,5 +33,5 @@
}
}
-} // namespace salsa
+} // namespace motors
} // namespace frc971
diff --git a/motors/math.h b/motors/math.h
index fce3a56..16cdf92 100644
--- a/motors/math.h
+++ b/motors/math.h
@@ -10,7 +10,7 @@
// controls in a minimal number of cycles.
namespace frc971 {
-namespace salsa {
+namespace motors {
inline constexpr unsigned int Log2RoundUp(unsigned int x) {
return (x < 2) ? x : (1 + Log2RoundUp(x / 2));
@@ -126,7 +126,7 @@
void MathInit();
-} // namespace salsa
+} // namespace motors
} // namespace frc971
#endif // MOTORS_MATH_H_
diff --git a/motors/math_test.cc b/motors/math_test.cc
index 1c7708e..06f168f 100644
--- a/motors/math_test.cc
+++ b/motors/math_test.cc
@@ -4,7 +4,7 @@
#include "gmock/gmock.h"
namespace frc971 {
-namespace salsa {
+namespace motors {
namespace testing {
class SinCosIntTest : public ::testing::Test {
@@ -76,5 +76,5 @@
}
} // namespace testing
-} // namespace salsa
+} // namespace motors
} // namespace frc971
diff --git a/motors/motor.cc b/motors/motor.cc
index af7a3c7..93f2a4d 100644
--- a/motors/motor.cc
+++ b/motors/motor.cc
@@ -13,7 +13,7 @@
extern "C" float absolute_wheel(uint16_t reading);
namespace frc971 {
-namespace salsa {
+namespace motors {
Motor::Motor(BigFTM *pwm_ftm, LittleFTM *encoder_ftm, MotorControls *controls,
const ::std::array<volatile uint32_t *, 3> &output_registers)
@@ -451,5 +451,5 @@
return (counts_per_cycle() + width) / 2;
}
-} // namespace salsa
+} // namespace motors
} // namespace frc971
diff --git a/motors/motor.h b/motors/motor.h
index c59458c..f657d13 100644
--- a/motors/motor.h
+++ b/motors/motor.h
@@ -14,7 +14,7 @@
#include "motors/core/time.h"
namespace frc971 {
-namespace salsa {
+namespace motors {
class MotorControls {
public:
@@ -182,7 +182,7 @@
teensy::AcmTty *debug_tty_ = nullptr;
};
-} // namespace salsa
+} // namespace motors
} // namespace frc971
#endif // MOTORS_MOTOR_H_
diff --git a/motors/peripheral/adc.cc b/motors/peripheral/adc.cc
index 90b1d0d..6249392 100644
--- a/motors/peripheral/adc.cc
+++ b/motors/peripheral/adc.cc
@@ -3,7 +3,7 @@
#include "motors/core/kinetis.h"
namespace frc971 {
-namespace salsa {
+namespace motors {
namespace {
#define ADC_SC2_BASE (ADC_SC2_REFSEL(0) /* Use the external reference pins. */)
@@ -270,5 +270,5 @@
return r;
}
-} // namespace salsa
+} // namespace motors
} // namespace frc971
diff --git a/motors/peripheral/adc.h b/motors/peripheral/adc.h
index 04caff7..677fa18 100644
--- a/motors/peripheral/adc.h
+++ b/motors/peripheral/adc.h
@@ -9,7 +9,7 @@
// single file like this.
namespace frc971 {
-namespace salsa {
+namespace motors {
struct MediumAdcReadings {
uint16_t motor_currents[3][2];
@@ -47,7 +47,7 @@
JoystickAdcReadings AdcReadJoystick(const DisableInterrupts &);
SimpleAdcReadings AdcReadSimple(const DisableInterrupts &);
-} // namespace salsa
+} // namespace motors
} // namespace frc971
#endif // MOTORS_PERIPHERAL_ADC_H_
diff --git a/motors/pistol_grip/controller.cc b/motors/pistol_grip/controller.cc
index 162ac2f..28e1503 100644
--- a/motors/pistol_grip/controller.cc
+++ b/motors/pistol_grip/controller.cc
@@ -26,7 +26,7 @@
extern const float kTriggerCoggingTorque[4096];
namespace frc971 {
-namespace salsa {
+namespace motors {
namespace {
using ::frc971::control_loops::drivetrain::MakeIntegralHapticTriggerPlant;
@@ -870,5 +870,5 @@
return 0;
}
-} // namespace salsa
+} // namespace motors
} // namespace frc971
diff --git a/motors/pistol_grip/motor_controls.cc b/motors/pistol_grip/motor_controls.cc
index b123378..2f4f00f 100644
--- a/motors/pistol_grip/motor_controls.cc
+++ b/motors/pistol_grip/motor_controls.cc
@@ -3,7 +3,7 @@
#include "motors/peripheral/configuration.h"
namespace frc971 {
-namespace salsa {
+namespace motors {
namespace {
template <int kRows, int kCols>
@@ -208,5 +208,5 @@
return debug_[theta];
}
-} // namespace salsa
+} // namespace motors
} // namespace frc971
diff --git a/motors/pistol_grip/motor_controls.h b/motors/pistol_grip/motor_controls.h
index ca965d0..88ef8a2 100644
--- a/motors/pistol_grip/motor_controls.h
+++ b/motors/pistol_grip/motor_controls.h
@@ -10,7 +10,7 @@
#include "Eigen/Dense"
namespace frc971 {
-namespace salsa {
+namespace motors {
class LittleMotorControlsImplementation : public MotorControls {
public:
@@ -57,7 +57,7 @@
int16_t debug_[9];
};
-} // namespace salsa
+} // namespace motors
} // namespace frc971
#endif // MOTORS_PISTOL_GRIP_MOTOR_CONTROLS_H_
diff --git a/motors/simple_receiver.cc b/motors/simple_receiver.cc
index 910d2ae..49f5ecb 100644
--- a/motors/simple_receiver.cc
+++ b/motors/simple_receiver.cc
@@ -468,7 +468,7 @@
}
struct EncoderReading {
- EncoderReading(const salsa::SimpleAdcReadings &adc_readings) {
+ EncoderReading(const SimpleAdcReadings &adc_readings) {
const float sin = ConvertEncoderChannel(adc_readings.sin);
const float cos = ConvertEncoderChannel(adc_readings.cos);
@@ -491,10 +491,10 @@
global_polydrivetrain.load(::std::memory_order_acquire);
Spring *spring = global_spring.load(::std::memory_order_acquire);
- salsa::SimpleAdcReadings adc_readings;
+ SimpleAdcReadings adc_readings;
{
DisableInterrupts disable_interrupts;
- adc_readings = salsa::AdcReadSimple(disable_interrupts);
+ adc_readings = AdcReadSimple(disable_interrupts);
}
EncoderReading encoder(adc_readings);
@@ -724,7 +724,7 @@
PIT_TCTRL3 = PIT_TCTRL_TIE | PIT_TCTRL_TEN;
can_init(0, 1);
- salsa::AdcInitSimple();
+ AdcInitSimple();
SetupPwmFtm(FTM0);
SetupPwmFtm(FTM3);