From bcf1030226d959ec8925ac9d3737b9facd329ec5 Mon Sep 17 00:00:00 2001
From: Kizarm <mrazik@volny.cz>
Date: Tue, 16 Jan 2024 20:23:10 +0100
Subject: [PATCH] correct constants

---
 io.cpp | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/io.cpp b/io.cpp
index d0e042b..9502f2c 100644
--- a/io.cpp
+++ b/io.cpp
@@ -4,7 +4,7 @@ export module io;
 
 /// Asociace port Adress a RCC clock
 struct GpioAssocPort {
-  GPIOA_Type * portAdr;
+  GPIOA_Type * const portAdr;
   uint32_t     clkMask;
 };
 
@@ -150,19 +150,19 @@ namespace io {
       const uint16_t num;
     
   };
-  #define RCC_AHB2ENR_GPIOAEN ((uint32_t)0x00000001u) /*!< Ofs=0 IO port A clock enable */
-  #define RCC_AHB2ENR_GPIOBEN ((uint32_t)0x00000002u) /*!< Ofs=1 IO port B clock enable */
-  #define RCC_AHB2ENR_GPIOCEN ((uint32_t)0x00000004u) /*!< Ofs=2 IO port C clock enable */
-  #define RCC_AHB2ENR_GPIODEN ((uint32_t)0x00000008u) /*!< Ofs=3 IO port D clock enable */
-  #define RCC_AHB2ENR_GPIOEEN ((uint32_t)0x00000010u) /*!< Ofs=4 IO port E clock enable */
-  #define RCC_AHB2ENR_GPIOHEN ((uint32_t)0x00000080u) /*!< Ofs=7 IO port H clock enable */
+  static constexpr uint32_t RCC_AHB2ENR_GPIOAEN = (0x00000001u); /*!< Ofs=0 IO port A clock enable */
+  static constexpr uint32_t RCC_AHB2ENR_GPIOBEN = (0x00000002u); /*!< Ofs=1 IO port B clock enable */
+  static constexpr uint32_t RCC_AHB2ENR_GPIOCEN = (0x00000004u); /*!< Ofs=2 IO port C clock enable */
+  static constexpr uint32_t RCC_AHB2ENR_GPIODEN = (0x00000008u); /*!< Ofs=3 IO port D clock enable */
+  static constexpr uint32_t RCC_AHB2ENR_GPIOEEN = (0x00000010u); /*!< Ofs=4 IO port E clock enable */
+  static constexpr uint32_t RCC_AHB2ENR_GPIOHEN = (0x00000080u); /*!< Ofs=7 IO port H clock enable */
 
-  #define pGPIOA ((GPIOA_Type * const) 0x48000000u) /*!< General-purpose I/Os */
-  #define pGPIOB ((GPIOA_Type * const) 0x48000400u) /*!< General-purpose I/Os */
-  #define pGPIOC ((GPIOA_Type * const) 0x48000800u) /*!< General-purpose I/Os */
-  #define pGPIOD ((GPIOA_Type * const) 0x48000C00u) /*!< General-purpose I/Os */
-  #define pGPIOE ((GPIOA_Type * const) 0x48001000u) /*!< General-purpose I/Os */
-  #define pGPIOH ((GPIOA_Type * const) 0x48001C00u) /*!< General-purpose I/Os */
+  static GPIOA_Type * const pGPIOA = ((GPIOA_Type * const) 0x48000000u); /*!< General-purpose I/Os */
+  static GPIOA_Type * const pGPIOB = ((GPIOA_Type * const) 0x48000400u); /*!< General-purpose I/Os */
+  static GPIOA_Type * const pGPIOC = ((GPIOA_Type * const) 0x48000800u); /*!< General-purpose I/Os */
+  static GPIOA_Type * const pGPIOD = ((GPIOA_Type * const) 0x48000C00u); /*!< General-purpose I/Os */
+  static GPIOA_Type * const pGPIOE = ((GPIOA_Type * const) 0x48001000u); /*!< General-purpose I/Os */
+  static GPIOA_Type * const pGPIOH = ((GPIOA_Type * const) 0x48001C00u); /*!< General-purpose I/Os */
 
   static const struct GpioAssocPort cPortTab[] = {
     {pGPIOA, RCC_AHB2ENR_GPIOAEN},