Nest some more namespaces

Did someone previously suggest that all namespace had been
nested?  Silly.

Signed-off-by: Stephan Pleines <pleines.stephan@gmail.com>
Change-Id: I22278c1caaeba8b47dc46fb2ed3078c20a11e190
diff --git a/motors/algorithms.h b/motors/algorithms.h
index 20dcbe8..95fa772 100644
--- a/motors/algorithms.h
+++ b/motors/algorithms.h
@@ -5,8 +5,7 @@
 
 #include <array>
 
-namespace frc971 {
-namespace motors {
+namespace frc971::motors {
 
 struct ReadingsToBalance {
   // Adds a single reading at index.
@@ -57,7 +56,6 @@
   return r;
 }
 
-}  // namespace motors
-}  // namespace frc971
+}  // namespace frc971::motors
 
 #endif  // MOTORS_ALGORITHMS_H_
diff --git a/motors/big/motor_controls.h b/motors/big/motor_controls.h
index 8aae5d1..6644ea4 100644
--- a/motors/big/motor_controls.h
+++ b/motors/big/motor_controls.h
@@ -9,8 +9,7 @@
 #include "motors/math.h"
 #include "motors/motor.h"
 
-namespace frc971 {
-namespace motors {
+namespace frc971::motors {
 
 class MotorControlsImplementation : public MotorControls {
  public:
@@ -67,7 +66,6 @@
   int16_t debug_[9];
 };
 
-}  // namespace motors
-}  // namespace frc971
+}  // namespace frc971::motors
 
 #endif  // MOTORS_MOTOR_CONTROLS_H_
diff --git a/motors/core/semihosting.h b/motors/core/semihosting.h
index 3b7ba46..57af6e7 100644
--- a/motors/core/semihosting.h
+++ b/motors/core/semihosting.h
@@ -5,9 +5,7 @@
 
 #include "absl/types/span.h"
 
-namespace frc971 {
-namespace motors {
-namespace semihosting {
+namespace frc971::motors::semihosting {
 
 inline uint32_t integer_operation(const uint32_t operation, void *const block) {
   register uint32_t operation_register asm("r0") = operation;
@@ -165,8 +163,6 @@
   }
 };
 
-}  // namespace semihosting
-}  // namespace motors
-}  // namespace frc971
+}  // namespace frc971::motors::semihosting
 
 #endif  // MOTORS_CORE_SEMIHOSTING_H_
diff --git a/motors/fet12/motor_controls.h b/motors/fet12/motor_controls.h
index 482eeaf..7f495f1 100644
--- a/motors/fet12/motor_controls.h
+++ b/motors/fet12/motor_controls.h
@@ -9,8 +9,7 @@
 #include "motors/math.h"
 #include "motors/motor.h"
 
-namespace frc971 {
-namespace motors {
+namespace frc971::motors {
 
 class MotorControlsImplementation : public MotorControls {
  public:
@@ -62,7 +61,6 @@
   int16_t debug_[9];
 };
 
-}  // namespace motors
-}  // namespace frc971
+}  // namespace frc971::motors
 
 #endif  // MOTORS_MOTOR_CONTROLS_H_
diff --git a/motors/math.h b/motors/math.h
index 5151714..b9aba4a 100644
--- a/motors/math.h
+++ b/motors/math.h
@@ -10,8 +10,7 @@
 // This file has some specialized math functions useful for implementing our
 // controls in a minimal number of cycles.
 
-namespace frc971 {
-namespace motors {
+namespace frc971::motors {
 
 inline constexpr unsigned int Log2RoundUp(unsigned int x) {
   return (x < 2) ? x : (1 + Log2RoundUp(x / 2));
@@ -213,7 +212,6 @@
 // This must be called before any of the other functions.
 void MathInit();
 
-}  // namespace motors
-}  // namespace frc971
+}  // namespace frc971::motors
 
 #endif  // MOTORS_MATH_H_
diff --git a/motors/motor.h b/motors/motor.h
index 3f7b132..20f60fc 100644
--- a/motors/motor.h
+++ b/motors/motor.h
@@ -13,8 +13,7 @@
 #include "motors/print/print.h"
 #include "motors/util.h"
 
-namespace frc971 {
-namespace motors {
+namespace frc971::motors {
 
 class MotorControls {
  public:
@@ -189,7 +188,6 @@
   PrintingImplementation *printing_implementation_ = nullptr;
 };
 
-}  // namespace motors
-}  // namespace frc971
+}  // namespace frc971::motors
 
 #endif  // MOTORS_MOTOR_H_
diff --git a/motors/peripheral/adc.h b/motors/peripheral/adc.h
index c22a856..22db93a 100644
--- a/motors/peripheral/adc.h
+++ b/motors/peripheral/adc.h
@@ -5,8 +5,7 @@
 
 #include "motors/util.h"
 
-namespace frc971 {
-namespace motors {
+namespace frc971::motors {
 
 enum class AdcChannels {
   kA,
@@ -15,7 +14,6 @@
 void AdcInitCommon(AdcChannels adc0_channels = AdcChannels::kB,
                    AdcChannels adc1_channels = AdcChannels::kB);
 
-}  // namespace motors
-}  // namespace frc971
+}  // namespace frc971::motors
 
 #endif  // MOTORS_PERIPHERAL_ADC_H_
diff --git a/motors/peripheral/adc_dma.h b/motors/peripheral/adc_dma.h
index a00b730..f04f5ce 100644
--- a/motors/peripheral/adc_dma.h
+++ b/motors/peripheral/adc_dma.h
@@ -9,8 +9,7 @@
 #include "motors/peripheral/configuration.h"
 #include "motors/util.h"
 
-namespace frc971 {
-namespace teensy {
+namespace frc971::teensy {
 
 // This class manages configuring the hardware to automatically capture various
 // sensor values periodically with tight timing. Currently it's only 4 samples
@@ -108,7 +107,6 @@
   ::std::array<volatile uint32_t *, 2> ftm_delays_{nullptr, nullptr};
 };
 
-}  // namespace teensy
-}  // namespace frc971
+}  // namespace frc971::teensy
 
 #endif  // MOTORS_PERIPHERAL_ADC_DMA_H_
diff --git a/motors/peripheral/spi.h b/motors/peripheral/spi.h
index f865703..c5a1b64 100644
--- a/motors/peripheral/spi.h
+++ b/motors/peripheral/spi.h
@@ -7,8 +7,7 @@
 #include "motors/peripheral/uart_buffer.h"
 #include "motors/util.h"
 
-namespace frc971 {
-namespace teensy {
+namespace frc971::teensy {
 
 // Simple synchronous interface to a SPI peripheral.
 class Spi {
@@ -112,7 +111,6 @@
   int frames_to_receive_ = 0;
 };
 
-}  // namespace teensy
-}  // namespace frc971
+}  // namespace frc971::teensy
 
 #endif  // MOTORS_PERIPHERAL_SPI_H_
diff --git a/motors/peripheral/uart.h b/motors/peripheral/uart.h
index bfd630b..f8e7e7e 100644
--- a/motors/peripheral/uart.h
+++ b/motors/peripheral/uart.h
@@ -8,8 +8,7 @@
 #include "motors/peripheral/uart_buffer.h"
 #include "motors/util.h"
 
-namespace frc971 {
-namespace teensy {
+namespace frc971::teensy {
 
 // Simple synchronous interface to a UART.
 class Uart {
@@ -121,7 +120,6 @@
   UartBuffer<1024> transmit_buffer_, receive_buffer_;
 };
 
-}  // namespace teensy
-}  // namespace frc971
+}  // namespace frc971::teensy
 
 #endif  // MOTORS_PERIPHERAL_UART_H_
diff --git a/motors/peripheral/uart_buffer.h b/motors/peripheral/uart_buffer.h
index 9266465..714cfe8 100644
--- a/motors/peripheral/uart_buffer.h
+++ b/motors/peripheral/uart_buffer.h
@@ -6,8 +6,7 @@
 
 #include "absl/types/span.h"
 
-namespace frc971 {
-namespace teensy {
+namespace frc971::teensy {
 
 // Manages a circular buffer of data to send out.
 template <int kSize>
@@ -90,7 +89,6 @@
   ++size_;
 }
 
-}  // namespace teensy
-}  // namespace frc971
+}  // namespace frc971::teensy
 
 #endif  // MOTORS_PERIPHERAL_UART_BUFFER_H_
diff --git a/motors/pistol_grip/controller_adc.h b/motors/pistol_grip/controller_adc.h
index 867807c..b29bbcf 100644
--- a/motors/pistol_grip/controller_adc.h
+++ b/motors/pistol_grip/controller_adc.h
@@ -3,8 +3,7 @@
 
 #include "motors/util.h"
 
-namespace frc971 {
-namespace motors {
+namespace frc971::motors {
 
 struct SmallAdcReadings {
   uint16_t currents[3];
@@ -28,7 +27,6 @@
 // Reads the absolute encoder values for initialization.
 SmallInitReadings AdcReadSmallInit(const DisableInterrupts &);
 
-}  // namespace motors
-}  // namespace frc971
+}  // namespace frc971::motors
 
 #endif  // MOTORS_PISTOL_GRIP_CONTROLLER_ADC_H_
diff --git a/motors/pistol_grip/motor_controls.h b/motors/pistol_grip/motor_controls.h
index 253da4b..63d2c12 100644
--- a/motors/pistol_grip/motor_controls.h
+++ b/motors/pistol_grip/motor_controls.h
@@ -9,8 +9,7 @@
 #include "motors/math.h"
 #include "motors/motor.h"
 
-namespace frc971 {
-namespace motors {
+namespace frc971::motors {
 
 class LittleMotorControlsImplementation : public MotorControls {
  public:
@@ -68,7 +67,6 @@
   int16_t debug_[9];
 };
 
-}  // namespace motors
-}  // namespace frc971
+}  // namespace frc971::motors
 
 #endif  // MOTORS_PISTOL_GRIP_MOTOR_CONTROLS_H_
diff --git a/motors/print/itm.h b/motors/print/itm.h
index 64e3092..05ffb2c 100644
--- a/motors/print/itm.h
+++ b/motors/print/itm.h
@@ -5,8 +5,7 @@
 
 #include "motors/print/print.h"
 
-namespace frc971 {
-namespace motors {
+namespace frc971::motors {
 
 // A printing implementation via the SWO (trace output) pin. This requires an
 // attached debugger which is in SWD (Single Wire Debug) mode, has the SWO
@@ -28,7 +27,6 @@
   int WriteDebug(absl::Span<const char> buffer) override;
 };
 
-}  // namespace motors
-}  // namespace frc971
+}  // namespace frc971::motors
 
 #endif  // MOTORS_PRINT_ITM_
diff --git a/motors/print/semihosting.h b/motors/print/semihosting.h
index 6094a67..e04a4e5 100644
--- a/motors/print/semihosting.h
+++ b/motors/print/semihosting.h
@@ -5,8 +5,7 @@
 
 #include "motors/print/print.h"
 
-namespace frc971 {
-namespace motors {
+namespace frc971::motors {
 
 // A printing implementation which uses the ARM semihosting interface. This
 // requries an attached debugger with software support.
@@ -31,7 +30,6 @@
   // file if the name is filled out in the parameters.
 };
 
-}  // namespace motors
-}  // namespace frc971
+}  // namespace frc971::motors
 
 #endif  // MOTORS_PRINT_SEMIHOSTING_H_
diff --git a/motors/print/uart.h b/motors/print/uart.h
index 7d81577..e223ae7 100644
--- a/motors/print/uart.h
+++ b/motors/print/uart.h
@@ -4,8 +4,7 @@
 #include "motors/peripheral/uart.h"
 #include "motors/print/print.h"
 
-namespace frc971 {
-namespace motors {
+namespace frc971::motors {
 
 // A printing implementation using a hardware UART. This has a reasonably sized
 // buffer in memory and uses interrupts to keep the hardware busy. It could
@@ -28,7 +27,6 @@
 // Could easily create a subclass of UartPrinting that also implements
 // WriteDebug on a second UART, and conditionally instantiate that.
 
-}  // namespace motors
-}  // namespace frc971
+}  // namespace frc971::motors
 
 #endif  // MOTORS_PRINT_UART_H_
diff --git a/motors/print/usb.h b/motors/print/usb.h
index c2224d2..5e811b3 100644
--- a/motors/print/usb.h
+++ b/motors/print/usb.h
@@ -5,8 +5,7 @@
 #include "motors/usb/cdc.h"
 #include "motors/usb/usb.h"
 
-namespace frc971 {
-namespace motors {
+namespace frc971::motors {
 
 // A printing implementation which uses externally-created functions. The stdout
 // one is required, while the debug one is optional.
@@ -68,7 +67,6 @@
   teensy::AcmTty debug_tty_;
 };
 
-}  // namespace motors
-}  // namespace frc971
+}  // namespace frc971::motors
 
 #endif  // MOTORS_PRINT_USB_H_
diff --git a/motors/seems_reasonable/spring.h b/motors/seems_reasonable/spring.h
index 90c9cd1..0847b3c 100644
--- a/motors/seems_reasonable/spring.h
+++ b/motors/seems_reasonable/spring.h
@@ -3,8 +3,7 @@
 
 #include <cmath>
 
-namespace motors {
-namespace seems_reasonable {
+namespace motors::seems_reasonable {
 
 float NextGoal(float current_goal, float goal);
 float PreviousGoal(float current_goal, float goal);
@@ -104,7 +103,6 @@
   float last_error_ = 0.0f;
 };
 
-}  // namespace seems_reasonable
-}  // namespace motors
+}  // namespace motors::seems_reasonable
 
 #endif  //  MOTORS_SEEMS_REASONABLE_SPRING_H_
diff --git a/motors/usb/cdc.h b/motors/usb/cdc.h
index f8f084b..e10dbf0 100644
--- a/motors/usb/cdc.h
+++ b/motors/usb/cdc.h
@@ -13,8 +13,7 @@
 // lot of formats. The only commonality across the "class" seems to be some
 // constants and a few descriptors.
 
-namespace frc971 {
-namespace teensy {
+namespace frc971::teensy {
 
 struct CdcLineCoding {
   static constexpr uint8_t stop_bits_1() { return 0; }
@@ -129,7 +128,6 @@
   uint16_t control_line_state_ = 0;
 };
 
-}  // namespace teensy
-}  // namespace frc971
+}  // namespace frc971::teensy
 
 #endif  // MOTORS_USB_CDC_H_
diff --git a/motors/usb/hid.h b/motors/usb/hid.h
index 924cf37..b1d843c 100644
--- a/motors/usb/hid.h
+++ b/motors/usb/hid.h
@@ -9,8 +9,7 @@
 #include "motors/usb/usb.h"
 #include "motors/util.h"
 
-namespace frc971 {
-namespace teensy {
+namespace frc971::teensy {
 
 // Implements an HID class device.
 // TODO(Brian): Make this way more generic.
@@ -95,7 +94,6 @@
   UsbDescriptorList hid_descriptor_list_;
 };
 
-}  // namespace teensy
-}  // namespace frc971
+}  // namespace frc971::teensy
 
 #endif  // MOTORS_USB_HID_H_
diff --git a/motors/usb/interrupt_out.h b/motors/usb/interrupt_out.h
index 31852f9..96409b0 100644
--- a/motors/usb/interrupt_out.h
+++ b/motors/usb/interrupt_out.h
@@ -7,8 +7,7 @@
 #include "motors/usb/usb.h"
 #include "motors/util.h"
 
-namespace frc971 {
-namespace teensy {
+namespace frc971::teensy {
 
 // A simple function that just has an interrupt out endpoint and exposes the
 // data received.
@@ -58,7 +57,6 @@
   const ::std::string name_;
 };
 
-}  // namespace teensy
-}  // namespace frc971
+}  // namespace frc971::teensy
 
 #endif  // MOTORS_USB_INTERRUPT_OUT_H_
diff --git a/motors/usb/queue.h b/motors/usb/queue.h
index f7a7e77..2142213 100644
--- a/motors/usb/queue.h
+++ b/motors/usb/queue.h
@@ -4,8 +4,7 @@
 #include <atomic>
 #include <memory>
 
-namespace frc971 {
-namespace teensy {
+namespace frc971::teensy {
 
 // A FIFO queue which reads/writes variable-sized chunks.
 //
@@ -61,7 +60,6 @@
   ::std::atomic<size_t> write_cursor_{0};
 };
 
-}  // namespace teensy
-}  // namespace frc971
+}  // namespace frc971::teensy
 
 #endif  // MOTORS_USB_QUEUE_H_
diff --git a/motors/usb/usb.h b/motors/usb/usb.h
index 2475220..2b0cf17 100644
--- a/motors/usb/usb.h
+++ b/motors/usb/usb.h
@@ -13,8 +13,7 @@
 #include "motors/usb/constants.h"
 #include "motors/util.h"
 
-namespace frc971 {
-namespace teensy {
+namespace frc971::teensy {
 
 // A sufficient memory barrier between writing some data and telling the USB
 // hardware to read it or having the USB hardware say some data is readable and
@@ -584,7 +583,6 @@
   friend class UsbDevice;
 };
 
-}  // namespace teensy
-}  // namespace frc971
+}  // namespace frc971::teensy
 
 #endif  // MOTORS_USB_USB_H_