From 801dee9a8fc70dee29d8555d1e574b87ea4e8fd3 Mon Sep 17 00:00:00 2001
From: Charles De Lafontaine <charles.de-lafontaine@polymtl.ca>
Date: Mon, 2 Aug 2021 18:07:08 +0000
Subject: [PATCH] Feature/refactoring gpio

---
 .../gpio/abstract-gpio/abstract-gpio-init.hpp |  7 +++--
 .../gpio/abstract-gpio/abstract-gpio.cpp      | 17 ++++++++++--
 .../gpio/abstract-gpio/abstract-gpio.hpp      | 21 ++++++++-------
 .../alternate-gpio/alternate-gpio-init.hpp    |  8 ++++--
 .../gpio/alternate-gpio/alternate-gpio.hpp    | 14 +++++++---
 .../gpio/gpio-register/gpio-afr.hpp           |  4 ++-
 .../gpio/gpio-register/gpio-moder.hpp         |  6 +++--
 .../gpio/gpio-register/gpio-ospeedr.hpp       |  9 ++++---
 .../gpio/gpio-register/gpio-otyper.hpp        |  9 ++++---
 .../gpio/gpio-register/gpio-pin.hpp           |  6 +++--
 .../gpio/gpio-register/gpio-port.hpp          |  6 +++--
 .../gpio/gpio-register/gpio-pupdr.hpp         |  5 ++--
 .../gpio/gpio-register/gpio-register.hpp      |  1 +
 library/stm32f072xb/gpio/gpio.cpp             | 12 ++++-----
 library/stm32f072xb/gpio/gpio.hpp             | 26 +++++++++----------
 .../gpio/input-gpio/input-gpio-init.hpp       |  6 ++++-
 .../gpio/input-gpio/input-gpio.hpp            | 13 +++++-----
 .../gpio/output-gpio/output-gpio-init.hpp     |  4 ++-
 .../gpio/output-gpio/output-gpio.hpp          |  7 +++--
 .../gpio/uart-gpio/uart-gpio-type.hpp         |  4 ++-
 .../stm32f072xb/gpio/uart-gpio/uart-gpio.hpp  | 21 ++-------------
 21 files changed, 118 insertions(+), 88 deletions(-)

diff --git a/library/stm32f072xb/gpio/abstract-gpio/abstract-gpio-init.hpp b/library/stm32f072xb/gpio/abstract-gpio/abstract-gpio-init.hpp
index 262c5a6..01e45c2 100644
--- a/library/stm32f072xb/gpio/abstract-gpio/abstract-gpio-init.hpp
+++ b/library/stm32f072xb/gpio/abstract-gpio/abstract-gpio-init.hpp
@@ -1,12 +1,15 @@
 #include "gpio-register.hpp"
+
 #ifndef ABSTRACT_GPIO_INIT_H
 #define ABSTRACT_GPIO_INIT_H
 
 namespace stm32f072xb {
 
 struct AbstractGpioInit {
-	GpioPin pin;
-	Pupdr pullMode;
+	const GpioPin pin;
+	const Pupdr pullMode;
 };
+
 }  // namespace stm32f072xb
+
 #endif
diff --git a/library/stm32f072xb/gpio/abstract-gpio/abstract-gpio.cpp b/library/stm32f072xb/gpio/abstract-gpio/abstract-gpio.cpp
index 2d77468..75ece45 100644
--- a/library/stm32f072xb/gpio/abstract-gpio/abstract-gpio.cpp
+++ b/library/stm32f072xb/gpio/abstract-gpio/abstract-gpio.cpp
@@ -1,13 +1,26 @@
 #include "abstract-gpio.hpp"
 
 using namespace stm32f072xb;
-AbstractGpio::AbstractGpio(GPIO_TypeDef* gpio, AbstractGpioInit gpioInit) : _gpio(gpio), _gpioInit(gpioInit) {}
+
+AbstractGpio::AbstractGpio(GPIO_TypeDef* gpio, const AbstractGpioInit& gpioInit) : _gpio(gpio), _gpioInit(gpioInit) {}
 
 AbstractGpio::~AbstractGpio() {
 	CLEAR_BIT(_gpio->PUPDR, 3 << (getPin() * 2));
 }
 
-void AbstractGpio::setupRegister() {
+uint8_t AbstractGpio::getPin() const {
+	return uint8_t(_gpioInit.pin);
+}
+
+uint8_t AbstractGpio::getPullMode() const {
+	return uint8_t(_gpioInit.pullMode);
+}
+
+GPIO_TypeDef* AbstractGpio::getGpio() const {
+	return _gpio;
+}
+
+void AbstractGpio::setupRegister() const {
 	CLEAR_BIT(_gpio->PUPDR, 3 << (getPin() * 2));
 	SET_BIT(_gpio->PUPDR, getPullMode() << (getPin() * 2));
 }
diff --git a/library/stm32f072xb/gpio/abstract-gpio/abstract-gpio.hpp b/library/stm32f072xb/gpio/abstract-gpio/abstract-gpio.hpp
index 2fc9b77..6e28237 100644
--- a/library/stm32f072xb/gpio/abstract-gpio/abstract-gpio.hpp
+++ b/library/stm32f072xb/gpio/abstract-gpio/abstract-gpio.hpp
@@ -5,20 +5,21 @@
 #define ABSTRACT_GPIO_H
 
 namespace stm32f072xb {
+
 class AbstractGpio {
-   public:
-	AbstractGpio(GPIO_TypeDef* gpio, AbstractGpioInit gpioInit);
-	GPIO_TypeDef* getGpio() { return _gpio; };
-	uint8_t getPin() { return (uint8_t)_gpioInit.pin; }
-	uint8_t getPullMode() { return (uint8_t)_gpioInit.pullMode; }
-	~AbstractGpio();
+   private:
+	GPIO_TypeDef* _gpio;
+	const AbstractGpioInit _gpioInit;
 
    protected:
-	void setupRegister();
+	void setupRegister() const;
 
-   private:
-	GPIO_TypeDef* _gpio;
-	AbstractGpioInit _gpioInit;
+   public:
+	AbstractGpio(GPIO_TypeDef* gpio, const AbstractGpioInit& gpioInit);
+	~AbstractGpio();
+	GPIO_TypeDef* getGpio() const;
+	uint8_t getPin() const;
+	uint8_t getPullMode() const;
 };
 
 }  // namespace stm32f072xb
diff --git a/library/stm32f072xb/gpio/alternate-gpio/alternate-gpio-init.hpp b/library/stm32f072xb/gpio/alternate-gpio/alternate-gpio-init.hpp
index 75e5564..62fe798 100644
--- a/library/stm32f072xb/gpio/alternate-gpio/alternate-gpio-init.hpp
+++ b/library/stm32f072xb/gpio/alternate-gpio/alternate-gpio-init.hpp
@@ -3,9 +3,13 @@
 
 #ifndef ALTERNATE_GPIO_INIT_H
 #define ALTERNATE_GPIO_INIT_H
+
 namespace stm32f072xb {
-struct AlternateGpioInit : AbstractGpioInit {
-	AlternateFunction alternateFunction;
+
+struct AlternateGpioInit : public AbstractGpioInit {
+	const AlternateFunction alternateFunction;
 };
+
 }  // namespace stm32f072xb
+
 #endif
diff --git a/library/stm32f072xb/gpio/alternate-gpio/alternate-gpio.hpp b/library/stm32f072xb/gpio/alternate-gpio/alternate-gpio.hpp
index 0907665..3bf4d1b 100644
--- a/library/stm32f072xb/gpio/alternate-gpio/alternate-gpio.hpp
+++ b/library/stm32f072xb/gpio/alternate-gpio/alternate-gpio.hpp
@@ -8,23 +8,29 @@ namespace stm32f072xb {
 
 template <Port T>
 class AlternateGpio : public Gpio<T> {
-   private:
    public:
-	AlternateGpio(AlternateGpioInit gpioInit) : Gpio<T>(gpioInit) {
+	AlternateGpio(const AlternateGpioInit& gpioInit) : Gpio<T>(gpioInit) {
 		CLEAR_BIT(this->getGpio()->OTYPER, 1 << (this->getPin()));
 		CLEAR_BIT(this->getGpio()->MODER, 0x3UL << (this->getPin() * 2));
 		SET_BIT(this->getGpio()->MODER, 0x2UL << (this->getPin() * 2));
+
 		uint32_t position = 0;
 		uint8_t level = 0;
-		if ((int)gpioInit.pin < (int)GpioPin::P8) {
+
+		if (int(gpioInit.pin) < (int)GpioPin::P8) {
 			position = 4 * (int)gpioInit.pin;
 			level = 0;
-		} else {
+		}
+
+		else {
 			position = 4 * (((int)gpioInit.pin) % 8);
 			level = 1;
 		}
+
 		SET_BIT(this->getGpio()->AFR[level], (int)gpioInit.alternateFunction << position);
 	}
 };
+
 }  // namespace stm32f072xb
+
 #endif
diff --git a/library/stm32f072xb/gpio/gpio-register/gpio-afr.hpp b/library/stm32f072xb/gpio/gpio-register/gpio-afr.hpp
index a63c469..b8f023a 100644
--- a/library/stm32f072xb/gpio/gpio-register/gpio-afr.hpp
+++ b/library/stm32f072xb/gpio/gpio-register/gpio-afr.hpp
@@ -2,7 +2,9 @@
 #define AFR_H
 
 namespace stm32f072xb {
+
 enum class AlternateFunction { AF0, AF1, AF2, AF3, AF4, AF5, AF6, AF7 };
-}
+
+}  // namespace stm32f072xb
 
 #endif
diff --git a/library/stm32f072xb/gpio/gpio-register/gpio-moder.hpp b/library/stm32f072xb/gpio/gpio-register/gpio-moder.hpp
index 23c6989..48991ce 100644
--- a/library/stm32f072xb/gpio/gpio-register/gpio-moder.hpp
+++ b/library/stm32f072xb/gpio/gpio-register/gpio-moder.hpp
@@ -1,8 +1,10 @@
-#include <stm32f0xx.h>
 #ifndef MODER_H
 #define MODER_H
+
 namespace stm32f072xb {
+
 enum class Moder { INPUT, OUPUT, ALTERNATE, ANALOG };
-}
+
+}  // namespace stm32f072xb
 
 #endif
diff --git a/library/stm32f072xb/gpio/gpio-register/gpio-ospeedr.hpp b/library/stm32f072xb/gpio/gpio-register/gpio-ospeedr.hpp
index 4863693..9042635 100644
--- a/library/stm32f072xb/gpio/gpio-register/gpio-ospeedr.hpp
+++ b/library/stm32f072xb/gpio/gpio-register/gpio-ospeedr.hpp
@@ -1,7 +1,10 @@
-#include <stm32f0xx.h>
 #ifndef SPEED_R_H
 #define SPEED_R_H
+
 namespace stm32f072xb {
-enum class SpeedR { LOW, MEDIUM, HIGH };
-}
+
+enum class Speedr { LOW, MEDIUM, HIGH };
+
+}  // namespace stm32f072xb
+
 #endif
diff --git a/library/stm32f072xb/gpio/gpio-register/gpio-otyper.hpp b/library/stm32f072xb/gpio/gpio-register/gpio-otyper.hpp
index 41301ba..9b05b08 100644
--- a/library/stm32f072xb/gpio/gpio-register/gpio-otyper.hpp
+++ b/library/stm32f072xb/gpio/gpio-register/gpio-otyper.hpp
@@ -1,7 +1,10 @@
-#include <stm32f0xx.h>
 #ifndef OTYPER_H
 #define OTYPER_H
+
 namespace stm32f072xb {
-enum class Otyper { PUSH_PULL, OPEN_DRAIN };
-}
+
+enum class OTyper { PUSH_PULL, OPEN_DRAIN };
+
+}  // namespace stm32f072xb
+
 #endif
diff --git a/library/stm32f072xb/gpio/gpio-register/gpio-pin.hpp b/library/stm32f072xb/gpio/gpio-register/gpio-pin.hpp
index 85170df..3b940f7 100644
--- a/library/stm32f072xb/gpio/gpio-register/gpio-pin.hpp
+++ b/library/stm32f072xb/gpio/gpio-register/gpio-pin.hpp
@@ -1,8 +1,10 @@
-#include <stm32f0xx.h>
 #ifndef GPIO_PIN_H
 #define GPIO_PIN_H
+
 namespace stm32f072xb {
+
 enum class GpioPin : uint8_t { P0, P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, P14, P15 };
-}
+
+}  // namespace stm32f072xb
 
 #endif
diff --git a/library/stm32f072xb/gpio/gpio-register/gpio-port.hpp b/library/stm32f072xb/gpio/gpio-register/gpio-port.hpp
index 181f32b..11cd9f5 100644
--- a/library/stm32f072xb/gpio/gpio-register/gpio-port.hpp
+++ b/library/stm32f072xb/gpio/gpio-register/gpio-port.hpp
@@ -1,8 +1,10 @@
-#include <stm32f0xx.h>
 #ifndef PORT_H
 #define PORT_H
 
 namespace stm32f072xb {
+
 enum class Port { A, B, C, D, E, F };
-}
+
+}  // namespace stm32f072xb
+
 #endif
diff --git a/library/stm32f072xb/gpio/gpio-register/gpio-pupdr.hpp b/library/stm32f072xb/gpio/gpio-register/gpio-pupdr.hpp
index c4d20c6..f0ac6b1 100644
--- a/library/stm32f072xb/gpio/gpio-register/gpio-pupdr.hpp
+++ b/library/stm32f072xb/gpio/gpio-register/gpio-pupdr.hpp
@@ -1,9 +1,10 @@
-#include <stm32f0xx.h>
 #ifndef PUPDR_H
 #define PUPDR_H
 
 namespace stm32f072xb {
+
 enum class Pupdr { NONE, PULL_UP, PULL_DOWN };
-}
+
+}  // namespace stm32f072xb
 
 #endif
diff --git a/library/stm32f072xb/gpio/gpio-register/gpio-register.hpp b/library/stm32f072xb/gpio/gpio-register/gpio-register.hpp
index 8e8a042..4d9be27 100644
--- a/library/stm32f072xb/gpio/gpio-register/gpio-register.hpp
+++ b/library/stm32f072xb/gpio/gpio-register/gpio-register.hpp
@@ -1,3 +1,4 @@
+#include <stm32f0xx.h>
 #include "gpio-afr.hpp"
 #include "gpio-moder.hpp"
 #include "gpio-ospeedr.hpp"
diff --git a/library/stm32f072xb/gpio/gpio.cpp b/library/stm32f072xb/gpio/gpio.cpp
index df1222c..ecc2500 100644
--- a/library/stm32f072xb/gpio/gpio.cpp
+++ b/library/stm32f072xb/gpio/gpio.cpp
@@ -2,30 +2,30 @@
 
 using namespace stm32f072xb;
 
-Gpio<Port::A>::Gpio(AbstractGpioInit gpioInit) : AbstractGpio(GPIOA, gpioInit) {
+Gpio<Port::A>::Gpio(const AbstractGpioInit& gpioInit) : AbstractGpio(GPIOA, gpioInit) {
 	SET_BIT(RCC->AHBENR, RCC_AHBENR_GPIOAEN);  // enable GPIOA (p.120)
 	this->setupRegister();
 }
 
-Gpio<Port::B>::Gpio(AbstractGpioInit gpioInit) : AbstractGpio(GPIOB, gpioInit) {
+Gpio<Port::B>::Gpio(const AbstractGpioInit& gpioInit) : AbstractGpio(GPIOB, gpioInit) {
 	SET_BIT(RCC->AHBENR, RCC_AHBENR_GPIOBEN);
 	this->setupRegister();
 }
-Gpio<Port::C>::Gpio(AbstractGpioInit gpioInit) : AbstractGpio(GPIOC, gpioInit) {
+Gpio<Port::C>::Gpio(const AbstractGpioInit& gpioInit) : AbstractGpio(GPIOC, gpioInit) {
 	SET_BIT(RCC->AHBENR, RCC_AHBENR_GPIOCEN);
 	this->setupRegister();
 }
 
-Gpio<Port::D>::Gpio(AbstractGpioInit gpioInit) : AbstractGpio(GPIOD, gpioInit) {
+Gpio<Port::D>::Gpio(const AbstractGpioInit& gpioInit) : AbstractGpio(GPIOD, gpioInit) {
 	SET_BIT(RCC->AHBENR, RCC_AHBENR_GPIODEN);
 	this->setupRegister();
 }
-Gpio<Port::E>::Gpio(AbstractGpioInit gpioInit) : AbstractGpio(GPIOE, gpioInit) {
+Gpio<Port::E>::Gpio(const AbstractGpioInit& gpioInit) : AbstractGpio(GPIOE, gpioInit) {
 	SET_BIT(RCC->AHBENR, RCC_AHBENR_GPIOEEN);
 	this->setupRegister();
 }
 
-Gpio<Port::F>::Gpio(AbstractGpioInit gpioInit) : AbstractGpio(GPIOF, gpioInit) {
+Gpio<Port::F>::Gpio(const AbstractGpioInit& gpioInit) : AbstractGpio(GPIOF, gpioInit) {
 	SET_BIT(RCC->AHBENR, RCC_AHBENR_GPIOFEN);
 	this->setupRegister();
 }
diff --git a/library/stm32f072xb/gpio/gpio.hpp b/library/stm32f072xb/gpio/gpio.hpp
index e708baa..0ce60e3 100644
--- a/library/stm32f072xb/gpio/gpio.hpp
+++ b/library/stm32f072xb/gpio/gpio.hpp
@@ -1,53 +1,51 @@
 #include "abstract-gpio-init.hpp"
 #include "abstract-gpio.hpp"
+
 #ifndef GPIO_H
 #define GPIO_H
 
 namespace stm32f072xb {
+
 template <Port T>
 class Gpio : public AbstractGpio {
-   private:
    public:
-	Gpio(AbstractGpioInit gpioInit);
+	Gpio(const AbstractGpioInit& gpioInit);
 };
 
 template <>
 class Gpio<Port::A> : public AbstractGpio {
-   private:
    public:
-	Gpio(AbstractGpioInit gpioInit);
+	Gpio(const AbstractGpioInit& gpioInit);
 };
 
 template <>
 class Gpio<Port::B> : public AbstractGpio {
-   private:
    public:
-	Gpio(AbstractGpioInit gpioInit);
+	Gpio(const AbstractGpioInit& gpioInit);
 };
+
 template <>
 class Gpio<Port::C> : public AbstractGpio {
-   private:
    public:
-	Gpio(AbstractGpioInit gpioInit);
+	Gpio(const AbstractGpioInit& gpioInit);
 };
 
 template <>
 class Gpio<Port::D> : public AbstractGpio {
-   private:
    public:
-	Gpio(AbstractGpioInit gpioInit);
+	Gpio(const AbstractGpioInit& gpioInit);
 };
+
 template <>
 class Gpio<Port::E> : public AbstractGpio {
-   private:
    public:
-	Gpio(AbstractGpioInit gpioInit);
+	Gpio(const AbstractGpioInit& gpioInit);
 };
+
 template <>
 class Gpio<Port::F> : public AbstractGpio {
-   private:
    public:
-	Gpio(AbstractGpioInit gpioInit);
+	Gpio(const AbstractGpioInit& gpioInit);
 };
 
 }  // namespace stm32f072xb
diff --git a/library/stm32f072xb/gpio/input-gpio/input-gpio-init.hpp b/library/stm32f072xb/gpio/input-gpio/input-gpio-init.hpp
index 676ee3c..0e82428 100644
--- a/library/stm32f072xb/gpio/input-gpio/input-gpio-init.hpp
+++ b/library/stm32f072xb/gpio/input-gpio/input-gpio-init.hpp
@@ -3,7 +3,11 @@
 
 #ifndef INPUT_GPIO_INIT_H
 #define INPUT_GPIO_INIT_H
+
 namespace stm32f072xb {
-struct InputGpioInit : AbstractGpioInit {};
+
+struct InputGpioInit : public AbstractGpioInit {};
+
 }  // namespace stm32f072xb
+
 #endif
diff --git a/library/stm32f072xb/gpio/input-gpio/input-gpio.hpp b/library/stm32f072xb/gpio/input-gpio/input-gpio.hpp
index 1550fe4..dda9da8 100644
--- a/library/stm32f072xb/gpio/input-gpio/input-gpio.hpp
+++ b/library/stm32f072xb/gpio/input-gpio/input-gpio.hpp
@@ -8,21 +8,20 @@ namespace stm32f072xb {
 
 template <Port T>
 class InputGpio : public Gpio<T> {
-   private:
    public:
-	InputGpio(InputGpioInit gpioInit) : Gpio<T>(gpioInit) {
+	InputGpio(const InputGpioInit& gpioInit) : Gpio<T>(gpioInit) {
 		CLEAR_BIT(this->getGpio()->MODER, 0x3UL << (this->getPin() * 2));
 	}
 
-	~InputGpio();
-
-	FlagStatus readPin() {
+	FlagStatus readPin() const {
 		return READ_BIT(this->getGpio()->IDR, 1 << this->getPin()) ? FlagStatus::SET : FlagStatus::RESET;
 	}
 
-	bool isHigh() { return READ_BIT(this->getGpio()->IDR, 1 << this->getPin()); }
+	bool isHigh() const { return READ_BIT(this->getGpio()->IDR, 1 << this->getPin()); }
 
-	bool isLow() { return !READ_BIT(this->getGpio()->IDR, 1 << this->getPin()); }
+	bool isLow() const { return !READ_BIT(this->getGpio()->IDR, 1 << this->getPin()); }
 };
+
 }  // namespace stm32f072xb
+
 #endif
diff --git a/library/stm32f072xb/gpio/output-gpio/output-gpio-init.hpp b/library/stm32f072xb/gpio/output-gpio/output-gpio-init.hpp
index 47b0073..79f1c10 100644
--- a/library/stm32f072xb/gpio/output-gpio/output-gpio-init.hpp
+++ b/library/stm32f072xb/gpio/output-gpio/output-gpio-init.hpp
@@ -6,6 +6,8 @@
 
 namespace stm32f072xb {
 
-struct OutputGpioInit : AbstractGpioInit {};
+struct OutputGpioInit : public AbstractGpioInit {};
+
 }  // namespace stm32f072xb
+
 #endif
diff --git a/library/stm32f072xb/gpio/output-gpio/output-gpio.hpp b/library/stm32f072xb/gpio/output-gpio/output-gpio.hpp
index a0f439d..edee15f 100644
--- a/library/stm32f072xb/gpio/output-gpio/output-gpio.hpp
+++ b/library/stm32f072xb/gpio/output-gpio/output-gpio.hpp
@@ -12,15 +12,13 @@ class OutputGpio : public Gpio<T> {
 	FlagStatus _status;
 
    public:
-	OutputGpio(OutputGpioInit gpioInit) : Gpio<T>(gpioInit) {
+	OutputGpio(const OutputGpioInit& gpioInit) : Gpio<T>(gpioInit) {
 		CLEAR_BIT(this->getGpio()->MODER, 0x3UL << (this->getPin() * 2));
 		SET_BIT(this->getGpio()->MODER, 0x1UL << (this->getPin() * 2));
 		CLEAR_BIT(this->getGpio()->OTYPER, 0x1UL << (this->getPin()));
 	}
 
-	~OutputGpio();
-
-	void setPin(FlagStatus status) {
+	void setPin(const FlagStatus& status) {
 		_status = status;
 		(status == FlagStatus::SET) ? SET_BIT(this->getGpio()->ODR, 1 << this->getPin())
 		                            : CLEAR_BIT(this->getGpio()->ODR, 1 << this->getPin());
@@ -33,4 +31,5 @@ class OutputGpio : public Gpio<T> {
 };
 
 }  // namespace stm32f072xb
+
 #endif
diff --git a/library/stm32f072xb/gpio/uart-gpio/uart-gpio-type.hpp b/library/stm32f072xb/gpio/uart-gpio/uart-gpio-type.hpp
index ef33e3d..6c705de 100644
--- a/library/stm32f072xb/gpio/uart-gpio/uart-gpio-type.hpp
+++ b/library/stm32f072xb/gpio/uart-gpio/uart-gpio-type.hpp
@@ -2,7 +2,9 @@
 #define UART_GPIO_TYPE_H
 
 namespace stm32f072xb {
+
 enum class UartGpioType { RX, TX };
-}
+
+}  // namespace stm32f072xb
 
 #endif
diff --git a/library/stm32f072xb/gpio/uart-gpio/uart-gpio.hpp b/library/stm32f072xb/gpio/uart-gpio/uart-gpio.hpp
index fb63168..e145295 100644
--- a/library/stm32f072xb/gpio/uart-gpio/uart-gpio.hpp
+++ b/library/stm32f072xb/gpio/uart-gpio/uart-gpio.hpp
@@ -6,138 +6,121 @@
 #include "uart-register.hpp"
 
 namespace stm32f072xb {
+
 template <UartRegister T, UartGpioType V, Port U>
 class UartGpio : public AlternateGpio<U> {
-   private:
    public:
 	UartGpio();
 };
 
 template <>
 class UartGpio<UartRegister::UART1, UartGpioType::TX, Port::A> : public AlternateGpio<Port::A> {
-   private:
    public:
 	UartGpio();
 };
 
 template <>
 class UartGpio<UartRegister::UART1, UartGpioType::RX, Port::A> : public AlternateGpio<Port::A> {
-   private:
    public:
 	UartGpio();
 };
 
 template <>
 class UartGpio<UartRegister::UART1, UartGpioType::TX, Port::B> : public AlternateGpio<Port::B> {
-   private:
    public:
 	UartGpio();
 };
 
 template <>
 class UartGpio<UartRegister::UART1, UartGpioType::RX, Port::B> : public AlternateGpio<Port::B> {
-   private:
    public:
 	UartGpio();
 };
 
 template <>
 class UartGpio<UartRegister::UART2, UartGpioType::TX, Port::A> : public AlternateGpio<Port::A> {
-   private:
    public:
 	UartGpio();
 };
 
 template <>
 class UartGpio<UartRegister::UART2, UartGpioType::RX, Port::A> : public AlternateGpio<Port::A> {
-   private:
    public:
 	UartGpio();
 };
 
 template <>
 class UartGpio<UartRegister::UART2, UartGpioType::TX, Port::D> : public AlternateGpio<Port::D> {
-   private:
    public:
 	UartGpio();
 };
 
 template <>
 class UartGpio<UartRegister::UART2, UartGpioType::RX, Port::D> : public AlternateGpio<Port::D> {
-   private:
    public:
 	UartGpio();
 };
 
 template <>
 class UartGpio<UartRegister::UART3, UartGpioType::TX, Port::B> : public AlternateGpio<Port::B> {
-   private:
    public:
 	UartGpio();
 };
 
 template <>
 class UartGpio<UartRegister::UART3, UartGpioType::RX, Port::B> : public AlternateGpio<Port::B> {
-   private:
    public:
 	UartGpio();
 };
 
 template <>
 class UartGpio<UartRegister::UART3, UartGpioType::TX, Port::C> : public AlternateGpio<Port::C> {
-   private:
    public:
 	UartGpio();
 };
 
 template <>
 class UartGpio<UartRegister::UART3, UartGpioType::RX, Port::C> : public AlternateGpio<Port::C> {
-   private:
    public:
 	UartGpio();
 };
 
 template <>
 class UartGpio<UartRegister::UART3, UartGpioType::TX, Port::D> : public AlternateGpio<Port::D> {
-   private:
    public:
 	UartGpio();
 };
 
 template <>
 class UartGpio<UartRegister::UART3, UartGpioType::RX, Port::D> : public AlternateGpio<Port::D> {
-   private:
    public:
 	UartGpio();
 };
 
 template <>
 class UartGpio<UartRegister::UART4, UartGpioType::TX, Port::A> : public AlternateGpio<Port::A> {
-   private:
    public:
 	UartGpio();
 };
 
 template <>
 class UartGpio<UartRegister::UART4, UartGpioType::RX, Port::A> : public AlternateGpio<Port::A> {
-   private:
    public:
 	UartGpio();
 };
 
 template <>
 class UartGpio<UartRegister::UART4, UartGpioType::TX, Port::C> : public AlternateGpio<Port::C> {
-   private:
    public:
 	UartGpio();
 };
 
 template <>
 class UartGpio<UartRegister::UART4, UartGpioType::RX, Port::C> : public AlternateGpio<Port::C> {
-   private:
    public:
 	UartGpio();
 };
 
 }  // namespace stm32f072xb
+
 #endif
-- 
GitLab