From 094015bf6e081959c584335af8f25924ac92a2d8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20Foucher?= <cfoucher@laas.fr>
Date: Mon, 3 Apr 2023 08:57:45 +0000
Subject: [PATCH] Hw config reorganization

Reorganize Hardware Configuration module to be fully C++ object-based, instead of using C-style functions that add an unnecessary level of function calls.
---
 .../zephyr/CMakeLists.txt                     |  20 +-
 .../public_api/HardwareConfiguration.cpp      | 468 ------------------
 .../zephyr/public_api/HardwareConfiguration.h | 406 ++++++++++++---
 .../zephyr/src/adc_configuration.cpp          |  52 +-
 .../zephyr/src/adc_configuration.h            | 107 ----
 ...nfiguration.h => common_configuration.cpp} |  41 +-
 .../zephyr/src/comparator_configuration.cpp   |  11 +-
 .../zephyr/src/comparator_configuration.h     |  32 --
 .../zephyr/src/dac_configuration.cpp          |  19 +-
 .../zephyr/src/hrtim_configuration.cpp        | 417 +++++++++++-----
 .../zephyr/src/hrtim_configuration.h          | 270 ----------
 .../zephyr/src/led_configuration.cpp          |  32 +-
 .../zephyr/src/led_configuration.h            |  35 --
 .../zephyr/src/ngnd_configuration.cpp         |  13 +-
 .../zephyr/src/ngnd_configuration.h           |  34 --
 .../zephyr/src/power_driver_configuration.cpp |  50 +-
 .../zephyr/src/power_driver_configuration.h   |  39 --
 .../zephyr/src/timer_configuration.cpp        |  21 +-
 .../zephyr/src/timer_configuration.h          |  45 --
 .../zephyr/src/uart_configuration.cpp         |  16 +-
 .../zephyr/src/uart_configuration.h           |  57 ---
 21 files changed, 784 insertions(+), 1401 deletions(-)
 delete mode 100644 zephyr/modules/owntech_hardware_configuration/zephyr/public_api/HardwareConfiguration.cpp
 delete mode 100644 zephyr/modules/owntech_hardware_configuration/zephyr/src/adc_configuration.h
 rename zephyr/modules/owntech_hardware_configuration/zephyr/src/{dac_configuration.h => common_configuration.cpp} (52%)
 delete mode 100644 zephyr/modules/owntech_hardware_configuration/zephyr/src/comparator_configuration.h
 delete mode 100644 zephyr/modules/owntech_hardware_configuration/zephyr/src/hrtim_configuration.h
 delete mode 100644 zephyr/modules/owntech_hardware_configuration/zephyr/src/led_configuration.h
 delete mode 100644 zephyr/modules/owntech_hardware_configuration/zephyr/src/ngnd_configuration.h
 delete mode 100644 zephyr/modules/owntech_hardware_configuration/zephyr/src/power_driver_configuration.h
 delete mode 100644 zephyr/modules/owntech_hardware_configuration/zephyr/src/timer_configuration.h
 delete mode 100644 zephyr/modules/owntech_hardware_configuration/zephyr/src/uart_configuration.h

diff --git a/zephyr/modules/owntech_hardware_configuration/zephyr/CMakeLists.txt b/zephyr/modules/owntech_hardware_configuration/zephyr/CMakeLists.txt
index f335a34..709b1fe 100644
--- a/zephyr/modules/owntech_hardware_configuration/zephyr/CMakeLists.txt
+++ b/zephyr/modules/owntech_hardware_configuration/zephyr/CMakeLists.txt
@@ -8,15 +8,15 @@ if(CONFIG_OWNTECH_HARDWARE_CONFIGURATION)
   # Select source files to be compiled
   zephyr_library_sources(
     src/hardware_auto_configuration.cpp
-	src/dac_configuration.cpp
-	src/ngnd_configuration.cpp
-	src/led_configuration.cpp
-	src/timer_configuration.cpp
-	src/hrtim_configuration.cpp
-	src/uart_configuration.cpp
-	src/adc_configuration.cpp
-	src/power_driver_configuration.cpp
-	public_api/HardwareConfiguration.cpp
-	src/comparator_configuration.cpp
+    src/dac_configuration.cpp
+    src/ngnd_configuration.cpp
+    src/led_configuration.cpp
+    src/timer_configuration.cpp
+    src/hrtim_configuration.cpp
+    src/uart_configuration.cpp
+    src/adc_configuration.cpp
+    src/power_driver_configuration.cpp
+    src/comparator_configuration.cpp
+    src/common_configuration.cpp
     )
 endif()
diff --git a/zephyr/modules/owntech_hardware_configuration/zephyr/public_api/HardwareConfiguration.cpp b/zephyr/modules/owntech_hardware_configuration/zephyr/public_api/HardwareConfiguration.cpp
deleted file mode 100644
index 9e92a40..0000000
--- a/zephyr/modules/owntech_hardware_configuration/zephyr/public_api/HardwareConfiguration.cpp
+++ /dev/null
@@ -1,468 +0,0 @@
-/*
- * Copyright (c) 2022-2023 LAAS-CNRS
- *
- *   This program is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU Lesser General Public License as published by
- *   the Free Software Foundation, either version 2.1 of the License, or
- *   (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU Lesser General Public License for more details.
- *
- *   You should have received a copy of the GNU Lesser General Public License
- *   along with this program.  If not, see <https://www.gnu.org/licenses/>.
- *
- * SPDX-License-Identifier: LGLPV2.1
- */
-
-/**
- * @date   2023
- *
- * @author Clément Foucher <clement.foucher@laas.fr>
- * @author Luiz Villa <luiz.villa@laas.fr>
- * @author Ayoub Farah Hassan <ayoub.farah-hassan@laas.fr>
- */
-
-
-// Current module private functions
-#include "../src/dac_configuration.h"
-#include "../src/ngnd_configuration.h"
-#include "../src/led_configuration.h"
-#include "../src/timer_configuration.h"
-#include "../src/hrtim_configuration.h"
-#include "../src/uart_configuration.h"
-#include "../src/adc_configuration.h"
-#include "../src/power_driver_configuration.h"
-#include "../src/comparator_configuration.h"
-
-// Current class header
-#include "HardwareConfiguration.h"
-
-// Include public header
-#include "hrtim.h"
-
-
-/////
-// Public object to interact with the class
-
-HardwareConfiguration hwConfig;
-
-/////
-// Static class members
-
-hardware_version_t HardwareConfiguration::hardware_version = nucleo_G474RE;
-
-/////
-// Public static configuration functions
-
-
-/////
-// Common
-
-/**
- * @brief Sets the version of the underlying hardware.
- *        Depending on the hardware version, some software
- *        configuration, such as pinout, has to be tweaked.
- * @param hardware_version Enum representing the hardware version.
- */
-void HardwareConfiguration::setBoardVersion(hardware_version_t hardware_version)
-{
-	HardwareConfiguration::hardware_version = hardware_version;
-
-	if (hardware_version == O2_v_1_1_2 || hardware_version == O2_v_0_9)
-	{
-		uart_lpuart1_swap_rx_tx();
-		hrtim_leg_tu(TIMA, TIMB);
-	}else if(hardware_version == SPIN_v_0_1){
-		uart_lpuart1_swap_rx_tx();
-		hrtim_leg_tu(TIMA, TIMC);
-	}else if(hardware_version == SPIN_v_0_9 || hardware_version == TWIST_v_1_1_2){
-		hrtim_leg_tu(TIMA, TIMC);
-	}else if(hardware_version == nucleo_G474RE){
-		hrtim_leg_tu(TIMA, TIMB);
-	}
-
-}
-
-
-/////
-// DAC
-
-void HardwareConfiguration::initDacConstValue(uint8_t dac_number)
-{
-	dac_config_const_value_init(dac_number);
-}
-
-void HardwareConfiguration::setDacConstValue(uint8_t dac_number, uint8_t channel, uint32_t const_value)
-{
-	dac_set_const_value(dac_number, channel, const_value);
-}
-
-void HardwareConfiguration::slopeCompensationLeg1(float32_t peak_voltage, float32_t low_voltage)
-{
-	set_satwtooth_DAC3(peak_voltage, low_voltage);
-}
-
-void HardwareConfiguration::slopeCompensationLeg2(float32_t peak_voltage, float32_t low_voltage)
-{
-	set_satwtooth_DAC1(peak_voltage, low_voltage);
-}
-
-
-/////
-// NGND
-
-void HardwareConfiguration::setNgndOn()
-{
-	ngnd_config_on();
-}
-
-void HardwareConfiguration::setNgndOff()
-{
-	ngnd_config_off();
-}
-
-
-/////
-// LED
-
-void HardwareConfiguration::setLedOn()
-{
-	led_config_on();
-}
-
-void HardwareConfiguration::setLedOff()
-{
-	led_config_off();
-}
-
-void HardwareConfiguration::setLedToggle()
-{
-	led_config_toggle();
-}
-
-
-/////
-// Incremental encoder
-
-void HardwareConfiguration::startLoggingIncrementalEncoder()
-{
-	timer_incremental_encoder_tim4_start();
-}
-
-uint32_t HardwareConfiguration::getIncrementalEncoderValue()
-{
-	return timer_incremental_encoder_tim4_get_step();
-}
-
-
-/////
-// Power converter
-
-void HardwareConfiguration::initInterleavedBuckMode()
-{
-	if(HardwareConfiguration::hardware_version == TWIST_v_1_1_2){
-		hrtim_init_independent_mode(false, true); //patch for the TWIST v0.9 - the second leg is inverted
-	}else{
-		hrtim_init_interleaved_buck_mode();
-	}
-}
-
-void HardwareConfiguration::initInterleavedBuckModeCenterAligned()
-{
-	if(HardwareConfiguration::hardware_version == TWIST_v_1_1_2){
-		hrtim_init_independent_mode_center_aligned(false, true); //patch for the TWIST v0.9 - the second leg is inverted
-	}else{
-		hrtim_init_interleaved_buck_mode_center_aligned();
-	}
-}
-
-void HardwareConfiguration::initInterleavedBoostMode()
-{
-	if(HardwareConfiguration::hardware_version == TWIST_v_1_1_2){
-		hrtim_init_independent_mode(true, false); //patch for the TWIST v0.9 - the second leg is inverted
-	}else{
-		hrtim_init_interleaved_boost_mode();
-	}
-}
-
-void HardwareConfiguration::initInterleavedBoostModeCenterAligned()
-{
-	if(HardwareConfiguration::hardware_version == TWIST_v_1_1_2){
-		hrtim_init_independent_mode_center_aligned(true, false); //patch for the TWIST v0.9 - the second leg is inverted
-	}else{
-		hrtim_init_interleaved_boost_mode_center_aligned();
-	}
-}
-
-void HardwareConfiguration::initFullBridgeBuckMode()
-{
-	if(HardwareConfiguration::hardware_version == TWIST_v_1_1_2){
-		hrtim_init_full_bridge_buck_mode(true); //patch for the TWIST v0.9 - the second leg is inverted
-	}else{
-		hrtim_init_full_bridge_buck_mode(false);
-	}
-
-}
-
-void HardwareConfiguration::initFullBridgeBuckModeCenterAligned(inverter_modulation_t inverter_modulation_type)
-{
-	bool bipolar_mode;
-	if (inverter_modulation_type == bipolar) bipolar_mode = true; else bipolar_mode = false;
-
-	if(HardwareConfiguration::hardware_version == TWIST_v_1_1_2){
-		hrtim_init_full_bridge_buck_mode_center_aligned(bipolar_mode,true); //patch for the TWIST v0.9 - the first leg is inverted
-	}else{
-		hrtim_init_full_bridge_buck_mode_center_aligned(bipolar_mode,false);
-	}
-
-}
-
-void HardwareConfiguration::initFullBridgeBoostMode()
-{
-	if(HardwareConfiguration::hardware_version == TWIST_v_1_1_2){
-		hrtim_init_independent_mode(true, false); //patch for the TWIST v1.2 - the first leg is inverted
-	}else{
-		hrtim_init_interleaved_boost_mode();
-	}
-}
-
-void HardwareConfiguration::initFullBridgeBoostModeCenterAligned()
-{
-	if(HardwareConfiguration::hardware_version == TWIST_v_1_1_2){
-		hrtim_init_independent_mode_center_aligned(true, false); //patch for the TWIST v0.9 - the first leg is inverted
-	}else{
-		hrtim_init_interleaved_boost_mode_center_aligned();
-	}
-}
-
-void HardwareConfiguration::initIndependentMode(leg_operation_t leg1_operation_type, leg_operation_t leg2_operation_type)
-{
-	bool leg1_mode, leg2_mode;
-	if (HardwareConfiguration::hardware_version == TWIST_v_1_1_2){										//patch for the TWIST v0.9 - the second leg is inverted
-		if (leg1_operation_type == buck) leg1_mode = false; else leg1_mode = true;
-	}else{
-		if (leg1_operation_type == buck) leg1_mode = true; else leg1_mode = false;
-	}
-
-	if (leg2_operation_type == buck) leg2_mode = true; else leg2_mode = false;
-
-	hrtim_init_independent_mode(leg1_mode, leg2_mode);
-}
-
-void HardwareConfiguration::initIndependentModeCenterAligned(leg_operation_t leg1_operation_type, leg_operation_t leg2_operation_type)
-{
-	bool leg1_mode, leg2_mode;
-	if (HardwareConfiguration::hardware_version == TWIST_v_1_1_2){										//patch for the TWIST v0.9 - the second leg is inverted
-		if (leg1_operation_type == buck) leg1_mode = false; else leg1_mode = true;
-	}else{
-		if (leg1_operation_type == buck) leg1_mode = true; else leg1_mode = false;
-	}
-
-	if (leg2_operation_type == buck) leg2_mode = true; else leg2_mode = false;
-
-	hrtim_init_independent_mode_center_aligned(leg1_mode, leg2_mode);
-}
-
-void HardwareConfiguration::initBuckCurrentMode()
-{
-	if(HardwareConfiguration::hardware_version == TWIST_v_1_1_2)
-	{
-		hrtim_init_CurrentMode(false,true,TIMA,TIMC);
-		dac_config_dac3_current_mode_init(TIMA);
-		dac_config_dac1_current_mode_init(TIMC);
-	}
-	else
-	{
-		hrtim_init_CurrentMode(true,true,TIMA,TIMB);
-		dac_config_dac3_current_mode_init(TIMA);
-		dac_config_dac1_current_mode_init(TIMB);
-	}
-
-	comparator_initialization();
-}
-
-void HardwareConfiguration::setInterleavedDutyCycle(float32_t duty_cycle)
-{
-	hrtim_interleaved_pwm_update(duty_cycle);
-}
-
-void HardwareConfiguration::setFullBridgeBuckDutyCycle(float32_t duty_cycle)
-{
-	hrtim_full_bridge_buck_pwm_update(duty_cycle);
-}
-
-void HardwareConfiguration::setLeg1DutyCycle(float32_t duty_cycle)
-{
-	hrtim_leg1_pwm_update(duty_cycle);
-}
-
-void HardwareConfiguration::setLeg2DutyCycle(float32_t duty_cycle)
-{
-	hrtim_leg2_pwm_update(duty_cycle);
-}
-
-void HardwareConfiguration::setLeg1PhaseShift(float32_t phase_shift)
-{
-	hrtim_leg1_phase_shift_update(phase_shift);
-}
-
-void HardwareConfiguration::setLeg2PhaseShift(float32_t phase_shift)
-{
-	hrtim_leg2_phase_shift_update(phase_shift);
-}
-
-void HardwareConfiguration::setLeg1PhaseShiftCenterAligned(float32_t phase_shift)
-{
-	hrtim_leg1_phase_shift_update_center_aligned(phase_shift);
-}
-
-void HardwareConfiguration::setLeg2PhaseShiftCenterAligned(float32_t phase_shift)
-{
-	hrtim_leg2_phase_shift_update_center_aligned(phase_shift);
-}
-
-
-void HardwareConfiguration::setHrtimFrequency(uint32_t frequency_Hz)
-{
-	hrtim_set_frequency(frequency_Hz);
-}
-
-uint32_t HardwareConfiguration::getHrtimFrequency()
-{
-	return hrtim_get_frequency();
-}
-
-void HardwareConfiguration::setHrtimMinDutyCycle(float32_t duty_cycle)
-{
-	hrtim_set_min_duty_cycle(duty_cycle);
-}
-
-void HardwareConfiguration::setHrtimMaxDutyCycle(float32_t duty_cycle)
-{
-	hrtim_set_max_duty_cycle(duty_cycle);
-}
-
-void HardwareConfiguration::setInterleavedOn()
-{
-	power_driver_interleaved_on();
-	hrtim_start_interleaved();
-}
-
-void HardwareConfiguration::setFullBridgeBuckOn()
-{
-	power_driver_interleaved_on();
-	hrtim_start_full_bridge_buck();
-}
-
-void HardwareConfiguration::setLeg1On()
-{
-	power_driver_leg1_on();
-	hrtim_start_leg1();
-}
-
-void HardwareConfiguration::setLeg2On()
-{
-	power_driver_leg2_on();
-	hrtim_start_leg2();
-}
-
-void HardwareConfiguration::setInterleavedOff()
-{
-	power_driver_interleaved_off();
-	hrtim_stop_interleaved();
-}
-
-void HardwareConfiguration::setFullBridgeBuckOff()
-{
-	power_driver_interleaved_off();
-	hrtim_stop_full_bridge_buck();
-}
-
-void HardwareConfiguration::setLeg1Off()
-{
-	power_driver_leg1_off();
-	hrtim_stop_leg1();
-}
-
-void HardwareConfiguration::setLeg2Off()
-{
-	power_driver_leg2_off();
-	hrtim_stop_leg2();
-}
-
-void HardwareConfiguration::setHrtimAdcTrigInterleaved(float32_t new_trig)
-{
-	set_adc_trig_interleaved(new_trig);
-}
-
-/////
-// Extra UART
-
-void HardwareConfiguration::extraUartInit()
-{
-	uart_usart1_init();
-}
-
-char HardwareConfiguration::extraUartReadChar()
-{
-	return uart_usart1_get_data();
-}
-
-void HardwareConfiguration::extraUartWriteChar(char data)
-{
-	uart_usart1_write_single(data);
-}
-
-
-/////
-// ADC
-
-void HardwareConfiguration::adcConfigureTriggerSource(uint8_t adc_number, adc_ev_src_t trigger_source)
-{
-	configure_adc_trigger_source(adc_number, trigger_source);
-}
-
-void HardwareConfiguration::adcConfigureDiscontinuousMode(uint8_t adc_number, uint32_t dicontinuous_count)
-{
-	configure_adc_discontinuous_mode(adc_number, dicontinuous_count);
-}
-
-void HardwareConfiguration::adcAddChannel(uint8_t adc_number, uint8_t channel)
-{
-	configure_adc_add_channel(adc_number, channel);
-}
-
-void HardwareConfiguration::adcRemoveChannel(uint8_t adc_number, uint8_t channel)
-{
-	configure_adc_remove_channel(adc_number, channel);
-}
-
-void HardwareConfiguration::adcConfigureDma(uint8_t adc_number, bool use_dma)
-{
-	configure_adc_dma_mode(adc_number, use_dma);
-}
-
-void HardwareConfiguration::adcStart()
-{
-	start_adcs();
-}
-
-void HardwareConfiguration::adcStop()
-{
-	stop_adcs();
-}
-
-
-
-void HardwareConfiguration::setLeg1DeadTime(uint16_t rise_ns, uint16_t fall_ns)
-{
-	hrtim_set_dead_time_leg1(rise_ns, fall_ns);
-}
-
-void HardwareConfiguration::setLeg2DeadTime(uint16_t rise_ns, uint16_t fall_ns)
-{
-	hrtim_set_dead_time_leg2(rise_ns, fall_ns);
-}
diff --git a/zephyr/modules/owntech_hardware_configuration/zephyr/public_api/HardwareConfiguration.h b/zephyr/modules/owntech_hardware_configuration/zephyr/public_api/HardwareConfiguration.h
index b43ca86..3d5e20b 100644
--- a/zephyr/modules/owntech_hardware_configuration/zephyr/public_api/HardwareConfiguration.h
+++ b/zephyr/modules/owntech_hardware_configuration/zephyr/public_api/HardwareConfiguration.h
@@ -37,6 +37,7 @@
 
 // OwnTech API
 #include "adc.h"
+#include "hrtim.h"
 
 
 /** Hardware version. See
@@ -75,89 +76,362 @@ typedef enum
 
 class HardwareConfiguration
 {
-
 public:
+
+	/////
 	// Common
-	static void setBoardVersion(hardware_version_t hardware_version);
 
+	/**
+	 * @brief Sets the version of the underlying hardware.
+	 *        Depending on the hardware version, some software
+	 *        configuration, such as pinout, has to be tweaked.
+	 * @param hardware_version Enum representing the hardware version.
+	 */
+	void setBoardVersion(hardware_version_t hardware_version);
+
+	/////
 	// DAC
-	static void initDacConstValue(uint8_t dac_number);
-	static void setDacConstValue(uint8_t dac_number, uint8_t channel, uint32_t const_value);
-	static void slopeCompensationLeg1(float32_t peak_voltage, float32_t low_voltage);
-	static void slopeCompensationLeg2(float32_t peak_voltage, float32_t low_voltage);
 
+	void initDacConstValue(uint8_t dac_number);
+	void setDacConstValue(uint8_t dac_number, uint8_t channel, uint32_t const_value);
+	void slopeCompensationLeg1(float32_t peak_voltage, float32_t low_voltage);
+	void slopeCompensationLeg2(float32_t peak_voltage, float32_t low_voltage);
+
+	/////
 	// NGND
-	static void setNgndOn();
-	static void setNgndOff();
 
+	void setNgndOn();
+	void setNgndOff();
+
+	/////
 	// LED
-	static void setLedOn();
-	static void setLedOff();
-	static void setLedToggle();
 
-	// Incremental encoder
-	static void startLoggingIncrementalEncoder();
-	static uint32_t getIncrementalEncoderValue();
+	void setLedOn();
+	void setLedOff();
+	void setLedToggle();
+
+	/////
+	// Timer
+
+	/**
+	 * @brief Launches the timer4 which is adapted for reading an encoder.
+	 */
+	void startLoggingIncrementalEncoder();
 
+	/**
+	 * @brief Gets the encoder step value.
+	 * @return An uint32 value of the counter which corresponds to the step of the system.
+	 */
+	uint32_t getIncrementalEncoderValue();
+
+	/////
 	// Power converter
-	static void initInterleavedBuckMode();
-	static void initInterleavedBuckModeCenterAligned();
-	static void initInterleavedBoostMode();
-	static void initInterleavedBoostModeCenterAligned();
-	static void initFullBridgeBuckMode();
-	static void initFullBridgeBuckModeCenterAligned(inverter_modulation_t inverter_modulation_type);
-	static void initFullBridgeBoostMode();
-	static void initFullBridgeBoostModeCenterAligned();
-	static void initIndependentMode(leg_operation_t leg1_operation_type, leg_operation_t leg2_operation_type);
-	static void initIndependentModeCenterAligned(leg_operation_t leg1_operation_type, leg_operation_t leg2_operation_type);
-	static void initBuckCurrentMode();
-
-	static void setInterleavedDutyCycle(float32_t duty_cycle);
-	static void setFullBridgeBuckDutyCycle(float32_t duty_cycle);
-
-	static void setLeg1DutyCycle(float32_t duty_cycle);
-	static void setLeg2DutyCycle(float32_t duty_cycle);
-	static void setLeg1PhaseShift(float32_t phase_shift);
-	static void setLeg2PhaseShift(float32_t phase_shift);
-	static void setLeg1PhaseShiftCenterAligned(float32_t phase_shift);
-	static void setLeg2PhaseShiftCenterAligned(float32_t phase_shift);
-	static void setLeg1DeadTime(uint16_t rise_ns, uint16_t fall_ns);
-	static void setLeg2DeadTime(uint16_t rise_ns, uint16_t fall_ns);
-
-	static void setHrtimFrequency(uint32_t frequency_Hz);
-	static uint32_t getHrtimFrequency();
-	static void setHrtimMinDutyCycle(float32_t duty_cycle);
-	static void setHrtimMaxDutyCycle(float32_t duty_cycle);
-
-	static void setInterleavedOn();
-	static void setFullBridgeBuckOn();
-	static void setLeg1On();
-	static void setLeg2On();
-
-	static void setInterleavedOff();
-	static void setFullBridgeBuckOff();
-	static void setLeg1Off();
-	static void setLeg2Off();
-
-	static void setHrtimAdcTrigInterleaved(float32_t new_trig);
-
-	// Extra UART
-	static void extraUartInit();
-	static char extraUartReadChar();
-	static void extraUartWriteChar(char data);
+
+	void initInterleavedBuckMode();
+	void initInterleavedBuckModeCenterAligned();
+	void initInterleavedBoostMode();
+	void initInterleavedBoostModeCenterAligned();
+	void initFullBridgeBuckMode();
+	void initFullBridgeBuckModeCenterAligned(inverter_modulation_t inverter_modulation_type);
+	void initFullBridgeBoostMode();
+	void initFullBridgeBoostModeCenterAligned();
+	void initIndependentMode(leg_operation_t leg1_operation_type, leg_operation_t leg2_operation_type);
+	void initIndependentModeCenterAligned(leg_operation_t leg1_operation_type, leg_operation_t leg2_operation_type);
+	void initBuckCurrentMode();
+
+	/**
+	 * @brief     This function transfer the calculated PWM value to the
+	 * HRTIM peripheral and make sure it is between saturation
+	 * bounds with a phase shift compatible with the interleaved application.
+	 *
+	 * @param[in] duty_cycle    floating point duty cycle comprised between 0 and 1.
+	 */
+	void setInterleavedDutyCycle(float32_t duty_cycle);
+
+	/**
+	 * @brief     This function transfer the calculated PWM value to the
+	 * HRTIM peripheral and make sure it is between saturation
+	 * bounds with a complementary approach to the duty cycles compatible with the HBridge application.
+	 *
+	 * @param[in] duty_cycle    floating point duty cycle comprised between 0 and 1.
+	 */
+	void setFullBridgeBuckDutyCycle(float32_t duty_cycle);
+
+	/**
+	 * @brief     This function transfer the calculated PWM value of leg_1 to the
+	 * HRTIM peripheral and make sure it is between saturation
+	 * bounds.
+	 *
+	 * @param[in] duty_cycle    floating point duty cycle of leg_1 comprised between 0 and 1.
+	 */
+	void setLeg1DutyCycle(float32_t duty_cycle);
+
+	/**
+	 * @brief     This function transfer the calculated PWM value of leg_2 to the
+	 * HRTIM peripheral and make sure it is between saturation
+	 * bounds.
+	 *
+	 * @param[in] duty_cycle    floating point duty cycle of leg_2 comprised between 0 and 1.
+	 */
+	void setLeg2DutyCycle(float32_t duty_cycle);
+
+	/**
+	 * @brief     This function updates the phase shift between the leg 1 and the master hrtim
+	 *
+	 * @param[in] phase_shift    floating point phase shift of leg_1 in degrees
+	 */
+	void setLeg1PhaseShift(float32_t phase_shift);
+
+	/**
+	 * @brief     This function updates the phase shift between the leg 1 and the master hrtim
+	 *
+	 * @param[in] phase_shift    floating point phase shift of leg_2 in degrees
+	 */
+	void setLeg2PhaseShift(float32_t phase_shift);
+
+	/**
+	 * @brief     This function updates the phase shift between the leg 1 and the master hrtim for the center aligned
+	 *
+	 * @param[in] phase_shift    floating point phase shift of leg_1 in degrees
+	 */
+	void setLeg1PhaseShiftCenterAligned(float32_t phase_shift);
+
+	/**
+	 * @brief     This function updates the phase shift between the leg 1 and the master hrtim for the center aligned
+	 *
+	 * @param[in] phase_shift    floating point phase shift of leg_2 in degrees
+	 */
+	void setLeg2PhaseShiftCenterAligned(float32_t phase_shift);
+
+	/**
+	 * @brief This function sets the dead time of the leg 1
+	 */
+	void setLeg1DeadTime(uint16_t rise_ns, uint16_t fall_ns);
+
+	/**
+	 * @brief This function sets the dead time of the leg 2
+	 */
+	void setLeg2DeadTime(uint16_t rise_ns, uint16_t fall_ns);
+
+	/**
+	 * @brief Sets the frequency of the HRTIMER
+	 */
+	void setHrtimFrequency(uint32_t frequency_Hz);
+
+	/**
+	 * @brief Gets the frequency of the HRTIMER
+	 */
+	uint32_t getHrtimFrequency();
+
+	/**
+	 * @brief Updates the minimum duty cycle of both legs
+	 */
+	void setHrtimMinDutyCycle(float32_t duty_cycle);
+
+	/**
+	 * @brief This updates the minimum duty cycle of both legs
+	 */
+	void setHrtimMaxDutyCycle(float32_t duty_cycle);
+
+	void setInterleavedOn();
+	void setFullBridgeBuckOn();
+	void setLeg1On();
+	void setLeg2On();
+
+	void setInterleavedOff();
+	void setFullBridgeBuckOff();
+	void setLeg1Off();
+	void setLeg2Off();
+
+	/**
+	 * @brief     Updates the adc trigger moment
+	 *
+	 * @param[in] new_trig    defines the triggering moment
+	 */
+	void setHrtimAdcTrigInterleaved(float32_t new_trig);
+
+	/////
+	// UART
+
+	/**
+	 * @brief Library initialization function for the usart communication.
+	 *        This function is declared on the private section of the .c file
+	 */
+	void extraUartInit();
+
+	/**
+	 * @brief This function sends back a single character waiting to be treated from the usart1
+	 *
+	 * @return This function returns a single char which is waiting to be treated
+	 *          if no char is waiting it returns an 'x' which should be treated as an error
+	 */
+	char extraUartReadChar();
+
+	/**
+	 * @brief This function transmits a single character through the usart 1
+	 *
+	 * @param data single char to be sent out
+	 */
+	void extraUartWriteChar(char data);
+
+	/////
+	// ADC
+
+	/**
+	 * @brief Change the trigger source of an ADC.
+	 *        By default, triggger source for ADC 1/2 is on HRTIM1,
+	 *        and ADC 3/4 is software-triggered.
+	 *
+	 *        Applied configuration will only be set when ADC is started.
+	 *        If ADC is already started, it must be stopped then started again.
+	 *
+	 * @param  adc_number Number of the ADC to configure
+	 * @param  trigger_source Source of the trigger
+	 */
+	void adcConfigureTriggerSource(uint8_t adc_number, adc_ev_src_t trigger_source);
+
+	/**
+	 * @brief Set the discontinuous count for an ADC.
+	 *        By default, ADC 1/2 ard in discontinuous mode, while
+	 *        ADC 3/4 aren't.
+	 *
+	 *        Applied configuration will only be set when ADC is started.
+	 *        If ADC is already started, it must be stopped then started again.
+	 *
+	 * @param adc_number Number of the ADC to configure.
+	 * @param discontinuous_count Number of channels to acquire on each
+	 *        trigger event. 0 to disable discontinuous mode (default).
+	 */
+	void adcConfigureDiscontinuousMode(uint8_t adc_number, uint32_t dicontinuous_count);
+
+	/**
+	 * @brief ADC DMA mode configuration.
+	 *        Enables DMA and circular mode on an ADC.
+	 *
+	 *        Applied configuration will only be set when ADC is started.
+	 *        If ADC is already started, it must be stopped then started again.
+	 *
+	 * @param adc_num Number of the ADC on which to enable DMA.
+	 * @param use_dma Set to true to use DMA for this ADC,
+	 *        false to not use it (default).
+	 */
+	void adcConfigureDma(uint8_t adc_number, bool use_dma);
+
+	/**
+	 * @brief Add a channel to the list of channels to be acquired
+	 *        for an ADC.
+	 *        The order in which channels are added determine
+	 *        the order in which they will be acquired.
+	 *
+	 *        Applied configuration will only be set when ADC is started.
+	 *        If ADC is already started, it must be stopped then started again.
+	 *
+	 * @param adc_number Number of the ADC to configure.
+	 * @param channel Number of the channel to to be acquired.
+	 */
+	void adcAddChannel(uint8_t adc_number, uint8_t channel);
+
+	/**
+	 * @brief Removes a channel from the list of channels
+	 *        that are acquired by an ADC.
+	 *        If a channel has been added multiple times,
+	 *        then only the first occurence in the list
+	 *        will be removed.
+	 *
+	 *        Applied configuration will only be set when ADC is started.
+	 *        If ADC is already started, it must be stopped then started again.
+	 *
+	 * @param adc_number Number of the ADC to configure.
+	 * @param channel Number of the channel to to no longer be acquired.
+	 */
+	void adcRemoveChannel(uint8_t adc_number, uint8_t channel);
+
+	/**
+	 * @brief Start all configured ADCs.
+	 */
+	void adcStart();
+
+	/**
+	 * @brief Stop all configured ADCs.
+	 */
+	void adcStop();
+
+private:
+	// LED
+	void ledInitialize();
+
+	// Timer
+	void timerInitialize();
+
+	// UART
+	void uart1SwapRxTx();
+
+	// Power driver
+	void powerDriverInitialize();
+	void powerDriverLeg1On();
+	void powerDriverLeg2On();
+	void powerDriverLeg1Off();
+	void powerDriverLeg2Off();
+	void powerDriverInterleavedOn();
+	void powerDriverInterleavedOff();
+
+	// HRTIM
+	void hrtimLegTu(hrtim_tu_t tu1, hrtim_tu_t tu2);
+	void hrtimInitInterleavedBuckMode();
+	void hrtimInitInterleavedBuckModeCenterAligned();
+	void hrtimInitInterleavedBoostMode();
+	void hrtimInitInterleavedBoostModeCenterAligned();
+	void hrtimInitIndependentMode(bool leg1_buck_mode, bool leg2_buck_mode);
+	void hrtimInitIndependentModeCenterAligned(bool leg1_buck_mode, bool leg2_buck_mode);
+	void hrtimInitFullBridgeBuckMode(bool SPIN_board_V_1_1_2);
+	void hrtimInitFullBridgeBuckModeCenterAligned(bool bipolar_mode,bool SPIN_board_V_1_1_2);
+	void hrtimInitCurrentMode(bool leg1_buck, bool leg2_buck, hrtim_tu_t leg1_tu, hrtim_tu_t leg2_tu);
+	void hrtimStopInterleaved();
+	void hrtimStopFullBridgeBuck();
+	void hrtimStopLeg1();
+	void hrtimStopLeg2();
+	void hrtimStartInterleaved();
+	void hrtimStartFullBridgeBuck();
+	void hrtimStartLeg1();
+	void hrtimStartLeg2();
 
 	// ADC
-	static void adcConfigureTriggerSource(uint8_t adc_number, adc_ev_src_t trigger_source);
-	static void adcConfigureDiscontinuousMode(uint8_t adc_number, uint32_t dicontinuous_count);
-	static void adcConfigureDma(uint8_t adc_number, bool use_dma);
-	static void adcAddChannel(uint8_t adc_number, uint8_t channel);
-	static void adcRemoveChannel(uint8_t adc_number, uint8_t channel);
-	static void adcStart();
-	static void adcStop();
+	void adcInitialize();
+
+	// DAC
+	void dacConfigDac1CurrentmodeInit(hrtim_tu_t tu_src);
+	void dacConfigDac3CurrentmodeInit(hrtim_tu_t tu_src);
+
+	// Comparator
+	void comparatorInitialize();
 
 private:
+	// Common
 	static hardware_version_t hardware_version;
 
+	// LED
+	static bool ledInitialized;
+
+	// Timer
+	static bool timer4init;
+	static bool timer4started;
+
+	// Power driver
+	static bool powerDriverInitialized;
+
+	// HRTIM
+	static uint16_t hrtimPwmPeriod;
+	static uint16_t hrtimPwmPhaseShift;
+	static uint16_t hrtimPwmPhaseShiftLeg1;
+	static uint16_t hrtimPwmPhaseShiftLeg2;
+	static bool     hrtimFullBridgeBipolarMode;
+
+	static hrtim_tu_t hrtimLeg1Tu;
+	static hrtim_tu_t hrtimLeg2Tu;
+
+	// ADC
+	static bool adcInitialized;
+
 };
 
 
diff --git a/zephyr/modules/owntech_hardware_configuration/zephyr/src/adc_configuration.cpp b/zephyr/modules/owntech_hardware_configuration/zephyr/src/adc_configuration.cpp
index d5bdd27..933d7e7 100644
--- a/zephyr/modules/owntech_hardware_configuration/zephyr/src/adc_configuration.cpp
+++ b/zephyr/modules/owntech_hardware_configuration/zephyr/src/adc_configuration.cpp
@@ -29,15 +29,15 @@
 #include "adc.h"
 
 // Current file header
-#include "adc_configuration.h"
+#include "HardwareConfiguration.h"
 
 
-static uint8_t initialized = 0;
+bool HardwareConfiguration::adcInitialized = false;
 
 
-static void _initialize()
+void HardwareConfiguration::adcInitialize()
 {
-	if (initialized == 0)
+	if (adcInitialized == false)
 	{
 		// Perform default configuration
 		adc_configure_trigger_source(1, hrtim_ev1);
@@ -48,18 +48,18 @@ static void _initialize()
 		adc_configure_discontinuous_mode(1, 1);
 		adc_configure_discontinuous_mode(2, 1);
 
-		initialized = 1;
+		adcInitialized = 1;
 	}
 }
 
-void configure_adc_trigger_source(uint8_t adc_number, adc_ev_src_t trigger_source)
+void HardwareConfiguration::adcConfigureTriggerSource(uint8_t adc_number, adc_ev_src_t trigger_source)
 {
 	/////
 	// Make sure module is initialized
 
-	if (initialized == 0)
+	if (adcInitialized == false)
 	{
-		_initialize();
+		adcInitialize();
 	}
 
 	/////
@@ -68,14 +68,14 @@ void configure_adc_trigger_source(uint8_t adc_number, adc_ev_src_t trigger_sourc
 	adc_configure_trigger_source(adc_number, trigger_source);
 }
 
-void configure_adc_discontinuous_mode(uint8_t adc_number, uint32_t discontinuous_count)
+void HardwareConfiguration::adcConfigureDiscontinuousMode(uint8_t adc_number, uint32_t discontinuous_count)
 {
 	/////
 	// Make sure module is initialized
 
-	if (initialized == 0)
+	if (adcInitialized == false)
 	{
-		_initialize();
+		adcInitialize();
 	}
 
 	/////
@@ -84,14 +84,14 @@ void configure_adc_discontinuous_mode(uint8_t adc_number, uint32_t discontinuous
 	adc_configure_discontinuous_mode(adc_number, discontinuous_count);
 }
 
-void configure_adc_add_channel(uint8_t adc_num, uint8_t channel)
+void HardwareConfiguration::adcAddChannel(uint8_t adc_num, uint8_t channel)
 {
 	/////
 	// Make sure module is initialized
 
-	if (initialized == 0)
+	if (adcInitialized == false)
 	{
-		_initialize();
+		adcInitialize();
 	}
 
 	/////
@@ -100,14 +100,14 @@ void configure_adc_add_channel(uint8_t adc_num, uint8_t channel)
 	adc_add_channel(adc_num, channel);
 }
 
-void configure_adc_remove_channel(uint8_t adc_num, uint8_t channel)
+void HardwareConfiguration::adcRemoveChannel(uint8_t adc_num, uint8_t channel)
 {
 	/////
 	// Make sure module is initialized
 
-	if (initialized == 0)
+	if (adcInitialized == false)
 	{
-		_initialize();
+		adcInitialize();
 	}
 
 	/////
@@ -116,14 +116,14 @@ void configure_adc_remove_channel(uint8_t adc_num, uint8_t channel)
 	adc_remove_channel(adc_num, channel);
 }
 
-void configure_adc_dma_mode(uint8_t adc_num, bool use_dma)
+void HardwareConfiguration::adcConfigureDma(uint8_t adc_num, bool use_dma)
 {
 	/////
 	// Make sure module is initialized
 
-	if (initialized == 0)
+	if (adcInitialized == false)
 	{
-		_initialize();
+		adcInitialize();
 	}
 
 	/////
@@ -132,14 +132,14 @@ void configure_adc_dma_mode(uint8_t adc_num, bool use_dma)
 	adc_configure_use_dma(adc_num, use_dma);
 }
 
-void start_adcs()
+void HardwareConfiguration::adcStart()
 {
 	/////
 	// Make sure module is initialized
 
-	if (initialized == 0)
+	if (adcInitialized == false)
 	{
-		_initialize();
+		adcInitialize();
 	}
 
 	/////
@@ -148,14 +148,14 @@ void start_adcs()
 	adc_start();
 }
 
-void stop_adcs()
+void HardwareConfiguration::adcStop()
 {
 	/////
 	// Make sure module is initialized
 
-	if (initialized == 0)
+	if (adcInitialized == false)
 	{
-		_initialize();
+		adcInitialize();
 	}
 
 	/////
diff --git a/zephyr/modules/owntech_hardware_configuration/zephyr/src/adc_configuration.h b/zephyr/modules/owntech_hardware_configuration/zephyr/src/adc_configuration.h
deleted file mode 100644
index 43c1aff..0000000
--- a/zephyr/modules/owntech_hardware_configuration/zephyr/src/adc_configuration.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2022-2023 LAAS-CNRS
- *
- *   This program is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU Lesser General Public License as published by
- *   the Free Software Foundation, either version 2.1 of the License, or
- *   (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU Lesser General Public License for more details.
- *
- *   You should have received a copy of the GNU Lesser General Public License
- *   along with this program.  If not, see <https://www.gnu.org/licenses/>.
- *
- * SPDX-License-Identifier: LGLPV2.1
- */
-
-/**
- * @date   2023
- *
- * @author Clément Foucher <clement.foucher@laas.fr>
- */
-
-
-#ifndef ADC_CONFIGURATION_H_
-#define ADC_CONFIGURATION_H_
-
-
-// Stdlib
-#include <stdint.h>
-
-// OwnTech API
-#include "adc.h"
-
-
-/////
-// Public API
-
-/**
- * @brief This function is used to change the trigger source of an ADC.
- *        By default, triggger source for ADC 1 and ADC 2 is on HRTIM1,
- *        and ADC 3 is software-triggered.
- *
- *        This function must be called BEFORE ADC is started.
- *
- * @param  adc_number Number of the ADC to configure
- * @param  trigger_source Source of the trigger
- */
-void configure_adc_trigger_source(uint8_t adc_number, adc_ev_src_t trigger_source);
-
-/**
- * @brief Register the discontinuous count for an ADC.
- *        It will be applied when ADC is started.
- *
- * @param adc_number Number of the ADC to configure.
- * @param discontinuous_count Number of channels to acquire on each
- *        trigger event. 0 to disable discontinuous mode (default).
- */
-void configure_adc_discontinuous_mode(uint8_t adc_number, uint32_t discontinuous_count);
-
-/**
- * @brief Adds a channel to the list of channels to be acquired
- *        for an ADC.
- *        The order in which channels are added determine
- *        the order in which they will be acquired.
- *
- * @param adc_number Number of the ADC to configure.
- * @param channel Number of the channel to to be acquired.
- */
-void configure_adc_add_channel(uint8_t adc_num, uint8_t channel);
-
-/**
- * @brief Removes a channel from the list of channels
- *        that are acquired by an ADC.
- *        If a channel has been added multiple times,
- *        then only the first occurence in the list
- *        will be removed.
- *
- * @param adc_number Number of the ADC to configure.
- * @param channel Number of the channel to to no longer be acquired.
- */
-void configure_adc_remove_channel(uint8_t adc_num, uint8_t channel);
-
-/**
- * @brief ADC DMA mode configuration.
- *        Enables DMA and circular mode on an ADC.
- *
- * @param adc_num Number of the ADC on which to enable DMA.
- * @param use_dma Set to true to use DMA for this ADC,
- *        false to not use it (default).
- */
-void configure_adc_dma_mode(uint8_t adc_num, bool use_dma);
-
-/**
- * @brief Starts all configured ADCs.
- */
-void start_adcs();
-
-/**
- * @brief Stops all configured ADCs.
- */
-void stop_adcs();
-
-
-#endif // ADC_CONFIGURATION_H_
diff --git a/zephyr/modules/owntech_hardware_configuration/zephyr/src/dac_configuration.h b/zephyr/modules/owntech_hardware_configuration/zephyr/src/common_configuration.cpp
similarity index 52%
rename from zephyr/modules/owntech_hardware_configuration/zephyr/src/dac_configuration.h
rename to zephyr/modules/owntech_hardware_configuration/zephyr/src/common_configuration.cpp
index 66e6618..a44b072 100644
--- a/zephyr/modules/owntech_hardware_configuration/zephyr/src/dac_configuration.h
+++ b/zephyr/modules/owntech_hardware_configuration/zephyr/src/common_configuration.cpp
@@ -19,30 +19,37 @@
 
 /**
  * @date   2023
+ *
  * @author Clément Foucher <clement.foucher@laas.fr>
- * @author Luiz Villa <luiz.villa@laas.fr>
- * @author Ayoub Farah Hassan <ayoub.farah-hassan@laas.fr>
  */
 
 
-#ifndef DAC_CONFIGURATION_H_
-#define DAC_CONFIGURATION_H_
+// Current file header
+#include "HardwareConfiguration.h"
+
 
-// Stdlib
-#include <stdint.h>
+// Public object to interact with the class
+HardwareConfiguration hwConfig;
 
-//ARM_MATH
-#include <arm_math.h>
+// Static class member
+hardware_version_t HardwareConfiguration::hardware_version = nucleo_G474RE;
 
-// hrtim.h is important to configure the DAC for current mode
-#include "hrtim.h"
 
+void HardwareConfiguration::setBoardVersion(hardware_version_t hardware_version)
+{
+	HardwareConfiguration::hardware_version = hardware_version;
 
-void dac_config_const_value_init(uint8_t dac_number);
-void dac_set_const_value(uint8_t dac_number, uint8_t channel, uint32_t const_value);
-void dac_config_dac3_current_mode_init(hrtim_tu_t tu_src);
-void dac_config_dac1_current_mode_init(hrtim_tu_t tu_src);
-void set_satwtooth_DAC3(float32_t set_voltage, float32_t reset_voltage);
-void set_satwtooth_DAC1(float32_t set_voltage, float32_t reset_voltage);
+	if (hardware_version == O2_v_1_1_2 || hardware_version == O2_v_0_9)
+	{
+		uart1SwapRxTx();
+		hrtimLegTu(TIMA, TIMB);
+	}else if(hardware_version == SPIN_v_0_1){
+		uart1SwapRxTx();
+		hrtimLegTu(TIMA, TIMC);
+	}else if(hardware_version == SPIN_v_0_9 || hardware_version == TWIST_v_1_1_2){
+		hrtimLegTu(TIMA, TIMC);
+	}else if(hardware_version == nucleo_G474RE){
+		hrtimLegTu(TIMA, TIMB);
+	}
 
-#endif // DAC_CONFIGURATION_H_
+}
diff --git a/zephyr/modules/owntech_hardware_configuration/zephyr/src/comparator_configuration.cpp b/zephyr/modules/owntech_hardware_configuration/zephyr/src/comparator_configuration.cpp
index d546b4d..19b0993 100644
--- a/zephyr/modules/owntech_hardware_configuration/zephyr/src/comparator_configuration.cpp
+++ b/zephyr/modules/owntech_hardware_configuration/zephyr/src/comparator_configuration.cpp
@@ -21,13 +21,16 @@
  * @date   2023
  *
  * @author Ayoub Farah Hassan <ayoub.farah-hassan@laas.fr>
+ * @author Clément Foucher <clement.foucher@laas.fr>
  */
 
-// OwnTech api
-
+// OwnTech API
 #include "comparator.h"
-#include "comparator_configuration.h"
 
-void comparator_initialization(){
+// Current file header
+#include "HardwareConfiguration.h"
+
+
+void HardwareConfiguration::comparatorInitialize(){
 	comparator_init();
 }
diff --git a/zephyr/modules/owntech_hardware_configuration/zephyr/src/comparator_configuration.h b/zephyr/modules/owntech_hardware_configuration/zephyr/src/comparator_configuration.h
deleted file mode 100644
index 2d2b94f..0000000
--- a/zephyr/modules/owntech_hardware_configuration/zephyr/src/comparator_configuration.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2023 LAAS-CNRS
- *
- *   This program is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU Lesser General Public License as published by
- *   the Free Software Foundation, either version 2.1 of the License, or
- *   (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU Lesser General Public License for more details.
- *
- *   You should have received a copy of the GNU Lesser General Public License
- *   along with this program.  If not, see <https://www.gnu.org/licenses/>.
- *
- * SPDX-License-Identifier: LGLPV2.1
- */
-
-/**
- * @date   2023
- *
- * @author Ayoub Farah Hassan <ayoub.farah-hassan@laas.fr>
- */
-
-#ifndef COMPARATOR_CONFIGURATION_H_
-#define COMPARATOR_CONFIGURATION_H_
-
-void comparator_initialization();
-
-
-#endif // COMPARATOR_CONFIGURATION_H_
diff --git a/zephyr/modules/owntech_hardware_configuration/zephyr/src/dac_configuration.cpp b/zephyr/modules/owntech_hardware_configuration/zephyr/src/dac_configuration.cpp
index 179ae48..407cf0a 100644
--- a/zephyr/modules/owntech_hardware_configuration/zephyr/src/dac_configuration.cpp
+++ b/zephyr/modules/owntech_hardware_configuration/zephyr/src/dac_configuration.cpp
@@ -28,11 +28,12 @@
 // Zephyr
 #include <zephyr.h>
 
-// Owntech driver
+// Owntech drivers
 #include "dac.h"
+#include "hrtim.h"
 
-// Header
-#include "dac_configuration.h"
+// Current file header
+#include "HardwareConfiguration.h"
 
 // Define the voltage reference used for ADC.
 // It depends on the board used (On nucleo, choose Vref = 2.48V).
@@ -43,7 +44,7 @@ static const struct device* dac1 = DEVICE_DT_GET(DAC1_DEVICE);
 static const struct device* dac2 = DEVICE_DT_GET(DAC2_DEVICE);
 static const struct device* dac3 = DEVICE_DT_GET(DAC3_DEVICE);
 
-void dac_config_const_value_init(uint8_t dac_number)
+void HardwareConfiguration::initDacConstValue(uint8_t dac_number)
 {
 	const struct device* dac_dev;
 
@@ -68,7 +69,7 @@ void dac_config_const_value_init(uint8_t dac_number)
 	}
 }
 
-void dac_set_const_value(uint8_t dac_number, uint8_t channel, uint32_t const_value)
+void HardwareConfiguration::setDacConstValue(uint8_t dac_number, uint8_t channel, uint32_t const_value)
 {
 	const struct device* dac_dev;
 
@@ -91,7 +92,7 @@ void dac_set_const_value(uint8_t dac_number, uint8_t channel, uint32_t const_val
 	}
 }
 
-void dac_config_dac1_current_mode_init(hrtim_tu_t tu_src)
+void HardwareConfiguration::dacConfigDac1CurrentmodeInit(hrtim_tu_t tu_src)
 {
 	// DAC 1
 	dac_function_config_t function_config =
@@ -139,7 +140,7 @@ void dac_config_dac1_current_mode_init(hrtim_tu_t tu_src)
 	dac_start(dac1, 1);
 }
 
-void dac_config_dac3_current_mode_init(hrtim_tu_t tu_src)
+void HardwareConfiguration::dacConfigDac3CurrentmodeInit(hrtim_tu_t tu_src)
 {
 	// DAC 3
 	dac_function_config_t function_config =
@@ -187,7 +188,7 @@ void dac_config_dac3_current_mode_init(hrtim_tu_t tu_src)
 	dac_start(dac3, 1);
 }
 
-void set_satwtooth_DAC3(float32_t set_voltage, float32_t reset_voltage)
+void HardwareConfiguration::slopeCompensationLeg1(float32_t set_voltage, float32_t reset_voltage)
 {
 	float32_t Dv = set_voltage - reset_voltage;
 
@@ -213,7 +214,7 @@ void set_satwtooth_DAC3(float32_t set_voltage, float32_t reset_voltage)
 	dac_function_update_step(dac3, 1, reset_data);
 }
 
-void set_satwtooth_DAC1(float32_t set_voltage, float32_t reset_voltage)
+void HardwareConfiguration::slopeCompensationLeg2(float32_t set_voltage, float32_t reset_voltage)
 {
 	float32_t Dv = set_voltage - reset_voltage;
 
diff --git a/zephyr/modules/owntech_hardware_configuration/zephyr/src/hrtim_configuration.cpp b/zephyr/modules/owntech_hardware_configuration/zephyr/src/hrtim_configuration.cpp
index 675a414..6415447 100644
--- a/zephyr/modules/owntech_hardware_configuration/zephyr/src/hrtim_configuration.cpp
+++ b/zephyr/modules/owntech_hardware_configuration/zephyr/src/hrtim_configuration.cpp
@@ -28,162 +28,325 @@
 // OwnTech Power API
 #include "leg.h"    // PWM management layer by inverter leg interface
 
-
 // Current file header
-#include "hrtim_configuration.h"
+#include "HardwareConfiguration.h"
 
 
-/////
-// Defines
+uint16_t HardwareConfiguration::hrtimPwmPeriod;
+uint16_t HardwareConfiguration::hrtimPwmPhaseShift;
+uint16_t HardwareConfiguration::hrtimPwmPhaseShiftLeg1;
+uint16_t HardwareConfiguration::hrtimPwmPhaseShiftLeg2;
+bool     HardwareConfiguration::hrtimFullBridgeBipolarMode;
 
-/////
-// Local variables
-static uint16_t pwm_period;
-static uint16_t pwm_phase_shift;
-static uint16_t pwm_phase_shift_leg1;
-static uint16_t pwm_phase_shift_leg2;
-static bool     full_bridge_bipolar_mode;
+hrtim_tu_t HardwareConfiguration::hrtimLeg1Tu;
+hrtim_tu_t HardwareConfiguration::hrtimLeg2Tu;
 
-static hrtim_tu_t leg1_tu;
-static hrtim_tu_t leg2_tu;
 
 
-/**
- * This function initializes the timer managing each leg
- */
+void HardwareConfiguration::hrtimLegTu(hrtim_tu_t tu1, hrtim_tu_t tu2)
+{
+	hrtimLeg1Tu = tu1;
+	hrtimLeg2Tu = tu2;
+}
+
+void HardwareConfiguration::initInterleavedBuckMode()
+{
+	if(HardwareConfiguration::hardware_version == TWIST_v_1_1_2){
+		hrtimInitIndependentMode(false, true); //patch for the TWIST v0.9 - the second leg is inverted
+	}else{
+		hrtimInitInterleavedBuckMode();
+	}
+}
+
+void HardwareConfiguration::initInterleavedBuckModeCenterAligned()
+{
+	if(HardwareConfiguration::hardware_version == TWIST_v_1_1_2){
+		hrtimInitIndependentModeCenterAligned(false, true); //patch for the TWIST v0.9 - the second leg is inverted
+	}else{
+		hrtimInitInterleavedBuckModeCenterAligned();
+	}
+}
+
+void HardwareConfiguration::initInterleavedBoostMode()
+{
+	if(HardwareConfiguration::hardware_version == TWIST_v_1_1_2){
+		hrtimInitIndependentMode(true, false); //patch for the TWIST v0.9 - the second leg is inverted
+	}else{
+		hrtimInitInterleavedBoostMode();
+	}
+}
 
-void hrtim_leg_tu(hrtim_tu_t tu1, hrtim_tu_t tu2)
+void HardwareConfiguration::initInterleavedBoostModeCenterAligned()
 {
-	leg1_tu = tu1;
-	leg2_tu = tu2;
+	if(HardwareConfiguration::hardware_version == TWIST_v_1_1_2){
+		hrtimInitIndependentModeCenterAligned(true, false); //patch for the TWIST v0.9 - the second leg is inverted
+	}else{
+		hrtimInitInterleavedBoostModeCenterAligned();
+	}
 }
 
+void HardwareConfiguration::initFullBridgeBuckMode()
+{
+	if(HardwareConfiguration::hardware_version == TWIST_v_1_1_2){
+		hrtimInitFullBridgeBuckMode(true); //patch for the TWIST v0.9 - the second leg is inverted
+	}else{
+		hrtimInitFullBridgeBuckMode(false);
+	}
+
+}
+
+void HardwareConfiguration::initFullBridgeBuckModeCenterAligned(inverter_modulation_t inverter_modulation_type)
+{
+	bool bipolar_mode;
+	if (inverter_modulation_type == bipolar) bipolar_mode = true; else bipolar_mode = false;
+
+	if(HardwareConfiguration::hardware_version == TWIST_v_1_1_2){
+		hrtimInitFullBridgeBuckModeCenterAligned(bipolar_mode,true); //patch for the TWIST v0.9 - the first leg is inverted
+	}else{
+		hrtimInitFullBridgeBuckModeCenterAligned(bipolar_mode,false);
+	}
+
+}
+
+void HardwareConfiguration::initFullBridgeBoostMode()
+{
+	if(HardwareConfiguration::hardware_version == TWIST_v_1_1_2){
+		hrtimInitIndependentMode(true, false); //patch for the TWIST v1.2 - the first leg is inverted
+	}else{
+		hrtimInitInterleavedBoostMode();
+	}
+}
+
+void HardwareConfiguration::initFullBridgeBoostModeCenterAligned()
+{
+	if(HardwareConfiguration::hardware_version == TWIST_v_1_1_2){
+		hrtimInitIndependentModeCenterAligned(true, false); //patch for the TWIST v0.9 - the first leg is inverted
+	}else{
+		hrtimInitInterleavedBoostModeCenterAligned();
+	}
+}
+
+void HardwareConfiguration::initBuckCurrentMode()
+{
+	if(HardwareConfiguration::hardware_version == TWIST_v_1_1_2)
+	{
+		hrtimInitCurrentMode(false,true,TIMA,TIMC);
+		dacConfigDac3CurrentmodeInit(TIMA);
+		dacConfigDac1CurrentmodeInit(TIMC);
+	}
+	else
+	{
+		hrtimInitCurrentMode(true,true,TIMA,TIMB);
+		dacConfigDac3CurrentmodeInit(TIMA);
+		dacConfigDac1CurrentmodeInit(TIMB);
+	}
+
+	comparatorInitialize();
+}
+
+void HardwareConfiguration::initIndependentMode(leg_operation_t leg1_operation_type, leg_operation_t leg2_operation_type)
+{
+	bool leg1_mode, leg2_mode;
+	if (HardwareConfiguration::hardware_version == TWIST_v_1_1_2){										//patch for the TWIST v0.9 - the second leg is inverted
+		if (leg1_operation_type == buck) leg1_mode = false; else leg1_mode = true;
+	}else{
+		if (leg1_operation_type == buck) leg1_mode = true; else leg1_mode = false;
+	}
+
+	if (leg2_operation_type == buck) leg2_mode = true; else leg2_mode = false;
+
+	hrtimInitIndependentMode(leg1_mode, leg2_mode);
+}
+
+void HardwareConfiguration::initIndependentModeCenterAligned(leg_operation_t leg1_operation_type, leg_operation_t leg2_operation_type)
+{
+	bool leg1_mode, leg2_mode;
+	if (HardwareConfiguration::hardware_version == TWIST_v_1_1_2){										//patch for the TWIST v0.9 - the second leg is inverted
+		if (leg1_operation_type == buck) leg1_mode = false; else leg1_mode = true;
+	}else{
+		if (leg1_operation_type == buck) leg1_mode = true; else leg1_mode = false;
+	}
+
+	if (leg2_operation_type == buck) leg2_mode = true; else leg2_mode = false;
+
+	hrtimInitIndependentModeCenterAligned(leg1_mode, leg2_mode);
+}
+
+void HardwareConfiguration::setInterleavedOn()
+{
+	powerDriverInterleavedOn();
+	hrtimStartInterleaved();
+}
+
+void HardwareConfiguration::setFullBridgeBuckOn()
+{
+	powerDriverInterleavedOn();
+	hrtimStartFullBridgeBuck();
+}
+
+void HardwareConfiguration::setLeg1On()
+{
+	powerDriverLeg1On();
+	hrtimStartLeg1();
+}
+
+void HardwareConfiguration::setLeg2On()
+{
+	powerDriverLeg2On();
+	hrtimStartLeg2();
+}
+
+void HardwareConfiguration::setInterleavedOff()
+{
+	powerDriverInterleavedOff();
+	hrtimStopInterleaved();
+}
+
+void HardwareConfiguration::setFullBridgeBuckOff()
+{
+	powerDriverInterleavedOff();
+	hrtimStopFullBridgeBuck();
+}
+
+void HardwareConfiguration::setLeg1Off()
+{
+	powerDriverLeg1Off();
+	hrtimStopLeg1();
+}
+
+void HardwareConfiguration::setLeg2Off()
+{
+	powerDriverLeg2Off();
+	hrtimStopLeg2();
+}
+
+
 /**
  * This function initializes both legs in buck mode
  */
-void hrtim_init_interleaved_buck_mode()
+void HardwareConfiguration::hrtimInitInterleavedBuckMode()
 {
-	hrtim_init_voltage_buck(leg1_tu,leg2_tu);
+	hrtim_init_voltage_buck(hrtimLeg1Tu, hrtimLeg2Tu);
 
-	pwm_period = leg_period();
-	pwm_phase_shift = pwm_period / 2;
+	hrtimPwmPeriod = leg_period();
+	hrtimPwmPhaseShift = hrtimPwmPeriod / 2;
 }
 
 /**
  * This function initializes both legs in buck mode in up-down mode
  */
-void hrtim_init_interleaved_buck_mode_center_aligned()
+void HardwareConfiguration::hrtimInitInterleavedBuckModeCenterAligned()
 {
-	hrtim_init_voltage_buck_center_aligned(leg1_tu, leg2_tu);
+	hrtim_init_voltage_buck_center_aligned(hrtimLeg1Tu, hrtimLeg2Tu);
 
-	pwm_period = leg_period();
-	pwm_phase_shift = pwm_period;
+	hrtimPwmPeriod = leg_period();
+	hrtimPwmPhaseShift = hrtimPwmPeriod;
 }
 
 /**
  * This function initializes both legs in boost mode
  */
-void hrtim_init_interleaved_boost_mode()
+void HardwareConfiguration::hrtimInitInterleavedBoostMode()
 {
-	hrtim_init_voltage_boost(leg1_tu, leg2_tu);
+	hrtim_init_voltage_boost(hrtimLeg1Tu, hrtimLeg2Tu);
 
-	pwm_period = leg_period();
-	pwm_phase_shift = pwm_period / 2;
+	hrtimPwmPeriod = leg_period();
+	hrtimPwmPhaseShift = hrtimPwmPeriod / 2;
 }
 
-void hrtim_init_interleaved_boost_mode_center_aligned()
+void HardwareConfiguration::hrtimInitInterleavedBoostModeCenterAligned()
 {
-	hrtim_init_voltage_boost_center_aligned(leg1_tu, leg2_tu);
+	hrtim_init_voltage_boost_center_aligned(hrtimLeg1Tu, hrtimLeg2Tu);
 
-	pwm_period = leg_period();
-	pwm_phase_shift = pwm_period;
+	hrtimPwmPeriod = leg_period();
+	hrtimPwmPhaseShift = hrtimPwmPeriod;
 }
 
 /**
  * This leg initializes each leg independently. It receives the modes of each leg and triggers them accordingly.
  */
-void hrtim_init_independent_mode(bool leg1_buck_mode, bool leg2_buck_mode)
+void HardwareConfiguration::hrtimInitIndependentMode(bool leg1_buck_mode, bool leg2_buck_mode)
 {
 	// High resolution timer initialization
 	if (leg1_buck_mode && !leg2_buck_mode){
-		hrtim_init_voltage_leg1_buck_leg2_boost(leg1_tu, leg2_tu);
+		hrtim_init_voltage_leg1_buck_leg2_boost(hrtimLeg1Tu, hrtimLeg2Tu);
 	}
 	else if (!leg1_buck_mode && leg2_buck_mode){
-		hrtim_init_voltage_leg1_boost_leg2_buck(leg1_tu, leg2_tu);
+		hrtim_init_voltage_leg1_boost_leg2_buck(hrtimLeg1Tu, hrtimLeg2Tu);
 	}
 	else if (leg1_buck_mode && leg2_buck_mode){
-		hrtim_init_voltage_buck(leg1_tu, leg2_tu);
+		hrtim_init_voltage_buck(hrtimLeg1Tu, hrtimLeg2Tu);
 	}
 	else if (!leg1_buck_mode && !leg2_buck_mode){
-		hrtim_init_voltage_boost(leg1_tu, leg2_tu);
+		hrtim_init_voltage_boost(hrtimLeg1Tu, hrtimLeg2Tu);
 	}
 
-	pwm_period = leg_period();
-	pwm_phase_shift_leg1 = 0;
-	pwm_phase_shift_leg2 = pwm_period / 2;
-	pwm_phase_shift = pwm_period/2;
+	hrtimPwmPeriod = leg_period();
+	hrtimPwmPhaseShiftLeg1 = 0;
+	hrtimPwmPhaseShiftLeg2 = hrtimPwmPeriod / 2;
+	hrtimPwmPhaseShift = hrtimPwmPeriod/2;
 }
 
 /**
  * This leg initializes each leg independently. It receives the modes of each leg and triggers them accordingly.
  * The counting mode is set to up-down (center aligned).
  */
-void hrtim_init_independent_mode_center_aligned(bool leg1_buck_mode, bool leg2_buck_mode)
+void HardwareConfiguration::hrtimInitIndependentModeCenterAligned(bool leg1_buck_mode, bool leg2_buck_mode)
 {
 	// High resolution timer initialization
 	if (leg1_buck_mode && !leg2_buck_mode){
-		hrtim_init_voltage_leg1_buck_leg2_boost_center_aligned(leg1_tu, leg2_tu);
+		hrtim_init_voltage_leg1_buck_leg2_boost_center_aligned(hrtimLeg1Tu, hrtimLeg2Tu);
 	}
 	else if (!leg1_buck_mode && leg2_buck_mode){
-		hrtim_init_voltage_leg1_boost_leg2_buck_center_aligned(leg1_tu,leg2_tu);
+		hrtim_init_voltage_leg1_boost_leg2_buck_center_aligned(hrtimLeg1Tu, hrtimLeg2Tu);
 	}
 	else if (leg1_buck_mode && leg2_buck_mode){
-		hrtim_init_voltage_buck_center_aligned(leg1_tu, leg2_tu);
+		hrtim_init_voltage_buck_center_aligned(hrtimLeg1Tu, hrtimLeg2Tu);
 	}
 	else if (!leg1_buck_mode && !leg2_buck_mode){
-		hrtim_init_voltage_boost_center_aligned(leg1_tu, leg2_tu);
+		hrtim_init_voltage_boost_center_aligned(hrtimLeg1Tu, hrtimLeg2Tu);
 	}
 
-	pwm_period = leg_period();
-	pwm_phase_shift = pwm_period;
+	hrtimPwmPeriod = leg_period();
+	hrtimPwmPhaseShift = hrtimPwmPeriod;
 }
 
 /**
  * This function initializes both legs in full-bridge mode
  */
-void hrtim_init_full_bridge_buck_mode(bool SPIN_board_V_1_1_2)
+void HardwareConfiguration::hrtimInitFullBridgeBuckMode(bool SPIN_board_V_1_1_2)
 {
 	if(SPIN_board_V_1_1_2){
-		hrtim_init_voltage_leg1_boost_leg2_buck(leg1_tu, leg2_tu); //patch for the spin v0.9 - the second leg is inverted
+		hrtim_init_voltage_leg1_boost_leg2_buck(hrtimLeg1Tu, hrtimLeg2Tu); //patch for the spin v0.9 - the second leg is inverted
 	}else{
-		hrtim_init_voltage_buck(leg1_tu, leg2_tu);
+		hrtim_init_voltage_buck(hrtimLeg1Tu, hrtimLeg2Tu);
 	}
-	full_bridge_bipolar_mode = false; //left-aligned inverter is always on unipolar mode
+	hrtimFullBridgeBipolarMode = false; //left-aligned inverter is always on unipolar mode
 
-	pwm_period = leg_period();
-	pwm_phase_shift = pwm_period / 2;
+	hrtimPwmPeriod = leg_period();
+	hrtimPwmPhaseShift = hrtimPwmPeriod / 2;
 
 }
 
 /**
  * This function initializes both legs in full-bridge mode
  */
-void hrtim_init_full_bridge_buck_mode_center_aligned(bool bipolar_mode,bool SPIN_board_V_1_1_2)
+void HardwareConfiguration::hrtimInitFullBridgeBuckModeCenterAligned(bool bipolar_mode,bool SPIN_board_V_1_1_2)
 {
 	if(SPIN_board_V_1_1_2){
-		hrtim_init_voltage_leg1_boost_leg2_buck_center_aligned(leg1_tu, leg2_tu); //patch for the spin v0.9 - the second leg is inverted
+		hrtim_init_voltage_leg1_boost_leg2_buck_center_aligned(hrtimLeg1Tu, hrtimLeg2Tu); //patch for the spin v0.9 - the second leg is inverted
 	}else{
-		hrtim_init_voltage_buck_center_aligned(leg1_tu, leg2_tu);
+		hrtim_init_voltage_buck_center_aligned(hrtimLeg1Tu, hrtimLeg2Tu);
 	}
 
-	full_bridge_bipolar_mode = bipolar_mode;
+	hrtimFullBridgeBipolarMode = bipolar_mode;
 
-	pwm_period = leg_period();
+	hrtimPwmPeriod = leg_period();
 
 	if (bipolar_mode){
-		pwm_phase_shift = 0;
+		hrtimPwmPhaseShift = 0;
 	}else{
-		pwm_phase_shift = pwm_period;
+		hrtimPwmPhaseShift = hrtimPwmPeriod;
 	}
 
 }
@@ -191,13 +354,13 @@ void hrtim_init_full_bridge_buck_mode_center_aligned(bool bipolar_mode,bool SPIN
 /**
  * This function initializes both legs in Current Mode configuration
  */
-void hrtim_init_CurrentMode(bool leg1_buck, bool leg2_buck, hrtim_tu_t leg1_tu, hrtim_tu_t leg2_tu)
+void HardwareConfiguration::hrtimInitCurrentMode(bool leg1_buck, bool leg2_buck, hrtim_tu_t leg1_tu, hrtim_tu_t leg2_tu)
 {
 	hrtim_init_current(leg1_buck, leg2_buck, leg1_tu, leg2_tu);
-	pwm_period = leg_period();
-	pwm_phase_shift = 0;
+	hrtimPwmPeriod = leg_period();
+	hrtimPwmPhaseShift = 0;
 	CM_leg_set(leg1_tu, 0);
-	CM_leg_set(leg2_tu, pwm_phase_shift);
+	CM_leg_set(leg2_tu, hrtimPwmPhaseShift);
 }
 
 
@@ -207,13 +370,13 @@ void hrtim_init_CurrentMode(bool leg1_buck, bool leg2_buck, hrtim_tu_t leg1_tu,
  * bounds
  */
 
-void hrtim_interleaved_pwm_update(float32_t pwm_duty_cycle)
+void HardwareConfiguration::setInterleavedDutyCycle(float32_t pwm_duty_cycle)
 {
 	uint16_t pwm_pulse_width;
 
-	pwm_pulse_width = (pwm_duty_cycle * pwm_period);
-	leg_set(leg1_tu, pwm_pulse_width, 0);
-	leg_set(leg2_tu, pwm_pulse_width, pwm_phase_shift);
+	pwm_pulse_width = (pwm_duty_cycle * hrtimPwmPeriod);
+	leg_set(hrtimLeg1Tu, pwm_pulse_width, 0);
+	leg_set(hrtimLeg2Tu, pwm_pulse_width, hrtimPwmPhaseShift);
 
 }
 
@@ -223,25 +386,25 @@ void hrtim_interleaved_pwm_update(float32_t pwm_duty_cycle)
  * bounds
  */
 
-void hrtim_full_bridge_buck_pwm_update(float32_t pwm_duty_cycle)
+void HardwareConfiguration::setFullBridgeBuckDutyCycle(float32_t pwm_duty_cycle)
 {
 	uint16_t pwm_pulse_width;
 	uint16_t pwm_reverse_pulse_width;
 
 	// TESTING PWM VALUE TO AVOID OVERFLOW AND PWM UPDATE//
-	if(full_bridge_bipolar_mode)
+	if(hrtimFullBridgeBipolarMode)
 	{
-		pwm_pulse_width = (pwm_duty_cycle * pwm_period);
-		pwm_reverse_pulse_width = (1-pwm_duty_cycle) * pwm_period;
-		leg_set(leg1_tu, pwm_pulse_width, 0);
-		leg_set(leg2_tu, pwm_reverse_pulse_width, pwm_period*pwm_duty_cycle);
+		pwm_pulse_width = (pwm_duty_cycle * hrtimPwmPeriod);
+		pwm_reverse_pulse_width = (1-pwm_duty_cycle) * hrtimPwmPeriod;
+		leg_set(hrtimLeg1Tu, pwm_pulse_width, 0);
+		leg_set(hrtimLeg2Tu, pwm_reverse_pulse_width, hrtimPwmPeriod*pwm_duty_cycle);
 	}
 	else
 	{
-		pwm_pulse_width = (pwm_duty_cycle * pwm_period);
-		pwm_reverse_pulse_width = (1-pwm_duty_cycle) * pwm_period;
-		leg_set(leg1_tu, pwm_pulse_width, 0);
-		leg_set(leg2_tu, pwm_reverse_pulse_width, pwm_phase_shift);
+		pwm_pulse_width = (pwm_duty_cycle * hrtimPwmPeriod);
+		pwm_reverse_pulse_width = (1-pwm_duty_cycle) * hrtimPwmPeriod;
+		leg_set(hrtimLeg1Tu, pwm_pulse_width, 0);
+		leg_set(hrtimLeg2Tu, pwm_reverse_pulse_width, hrtimPwmPhaseShift);
 	}
 }
 
@@ -250,12 +413,12 @@ void hrtim_full_bridge_buck_pwm_update(float32_t pwm_duty_cycle)
  * HRTIM peripheral and make sure it is between saturation
  * bounds
  */
-void hrtim_leg1_pwm_update(float32_t pwm_duty_cycle)
+void HardwareConfiguration::setLeg1DutyCycle(float32_t pwm_duty_cycle)
 {
 	uint16_t pwm_pulse_width;
 
-	pwm_pulse_width = (pwm_duty_cycle * pwm_period);
-	leg_set(leg1_tu, pwm_pulse_width, pwm_phase_shift_leg1);
+	pwm_pulse_width = (pwm_duty_cycle * hrtimPwmPeriod);
+	leg_set(hrtimLeg1Tu, pwm_pulse_width, hrtimPwmPhaseShiftLeg1);
 }
 
 /**
@@ -263,157 +426,157 @@ void hrtim_leg1_pwm_update(float32_t pwm_duty_cycle)
  * HRTIM peripheral and make sure it is between saturation
  * bounds
  */
-void hrtim_leg2_pwm_update(float32_t pwm_duty_cycle)
+void HardwareConfiguration::setLeg2DutyCycle(float32_t pwm_duty_cycle)
 {
 	uint16_t pwm_pulse_width;
 
-	pwm_pulse_width = (pwm_duty_cycle * pwm_period);
-	leg_set(leg2_tu, pwm_pulse_width, pwm_phase_shift_leg2);
+	pwm_pulse_width = (pwm_duty_cycle * hrtimPwmPeriod);
+	leg_set(hrtimLeg2Tu, pwm_pulse_width, hrtimPwmPhaseShiftLeg2);
 }
 
 /**
  * This function updates the phase shift between leg 1 and hrtim master
  */
-void hrtim_leg1_phase_shift_update(float32_t phase_shift)
+void HardwareConfiguration::setLeg1PhaseShift(float32_t phase_shift)
 {
 	phase_shift = int(phase_shift)%360; // modulo
 	if(phase_shift<0) phase_shift = phase_shift + 360; // case of negative phase
-	pwm_phase_shift_leg1 = (uint16_t)(pwm_period * (phase_shift/360) );
+	hrtimPwmPhaseShiftLeg1 = (uint16_t)(hrtimPwmPeriod * (phase_shift/360) );
 }
 
 /**
  * This function updates the phase shift between leg 2 and hrtim master
  */
-void hrtim_leg2_phase_shift_update(float32_t phase_shift)
+void HardwareConfiguration::setLeg2PhaseShift(float32_t phase_shift)
 {
 	phase_shift = int(phase_shift)%360; // modulo
 	if(phase_shift<0) phase_shift = phase_shift + 360; // case of negative phase
-	pwm_phase_shift_leg2 = (uint16_t)(pwm_period * (phase_shift/360) );
+	hrtimPwmPhaseShiftLeg2 = (uint16_t)(hrtimPwmPeriod * (phase_shift/360) );
 }
 
 /**
  * This function updates the phase shift between leg 1 and hrtim master for the center aligned application.
  * In center aligned, the master timer has a frequency 2 times higher than the timers.
  */
-void hrtim_leg1_phase_shift_update_center_aligned(float32_t phase_shift)
+void HardwareConfiguration::setLeg1PhaseShiftCenterAligned(float32_t phase_shift)
 {
 	phase_shift = int(phase_shift)%360; // modulo
 	if(phase_shift<0) phase_shift = phase_shift + 360; // case of negative phase
-	pwm_phase_shift_leg1 = (uint16_t)(2*pwm_period * (phase_shift/360) );
+	hrtimPwmPhaseShiftLeg1 = (uint16_t)(2*hrtimPwmPeriod * (phase_shift/360) );
 }
 
 /**
  * This function updates the phase shift between leg 2 and hrtim master for the center aligned application
  * In center aligned, the master timer has a frequency 2 times higher than the timers.
  */
-void hrtim_leg2_phase_shift_update_center_aligned(float32_t phase_shift)
+void HardwareConfiguration::setLeg2PhaseShiftCenterAligned(float32_t phase_shift)
 {
 	phase_shift = int(phase_shift)%360; // modulo
 	if(phase_shift<0) phase_shift = phase_shift + 360; // case of negative phase
-	pwm_phase_shift_leg2 = (uint16_t)(2*pwm_period * (phase_shift/360) );
+	hrtimPwmPhaseShiftLeg2 = (uint16_t)(2*hrtimPwmPeriod * (phase_shift/360) );
 }
 
 /**
  * This stops the converter by putting both timing
  * units outputs low
  */
-void hrtim_stop_interleaved()
+void HardwareConfiguration::hrtimStopInterleaved()
 {
-	leg_stop(leg1_tu);
-	leg_stop(leg2_tu);
+	leg_stop(hrtimLeg1Tu);
+	leg_stop(hrtimLeg2Tu);
 }
 
 /**
  * This stops the converter by putting both timing
  * units outputs low
  */
-void hrtim_stop_full_bridge_buck()
+void HardwareConfiguration::hrtimStopFullBridgeBuck()
 {
-	leg_stop(leg1_tu);
-	leg_stop(leg2_tu);
+	leg_stop(hrtimLeg1Tu);
+	leg_stop(hrtimLeg2Tu);
 }
 
 /**
  * This stops only leg 1
  */
-void hrtim_stop_leg1()
+void HardwareConfiguration::hrtimStopLeg1()
 {
-	leg_stop(leg1_tu);
+	leg_stop(hrtimLeg1Tu);
 }
 
 /**
  * This stops only leg 2
  */
-void hrtim_stop_leg2()
+void HardwareConfiguration::hrtimStopLeg2()
 {
-	leg_stop(leg2_tu);
+	leg_stop(hrtimLeg2Tu);
 }
 
 /**
  * This stops the converter by putting both timing
  * units outputs low
  */
-void hrtim_start_interleaved()
+void HardwareConfiguration::hrtimStartInterleaved()
 {
-	leg_start(leg1_tu);
-	leg_start(leg2_tu);
+	leg_start(hrtimLeg1Tu);
+	leg_start(hrtimLeg2Tu);
 }
 
 /**
  * This stops the converter by putting both timing
  * units outputs low
  */
-void hrtim_start_full_bridge_buck()
+void HardwareConfiguration::hrtimStartFullBridgeBuck()
 {
-	leg_start(leg1_tu);
-	leg_start(leg2_tu);
+	leg_start(hrtimLeg1Tu);
+	leg_start(hrtimLeg2Tu);
 }
 
 /**
  * This stops the converter by putting both timing
  * units outputs low
  */
-void hrtim_start_leg1()
+void HardwareConfiguration::hrtimStartLeg1()
 {
-	leg_start(leg1_tu);
+	leg_start(hrtimLeg1Tu);
 }
 
 /**
  * This stops the converter by putting both timing
  * units outputs low
  */
-void hrtim_start_leg2()
+void HardwareConfiguration::hrtimStartLeg2()
 {
-	leg_start(leg2_tu);
+	leg_start(hrtimLeg2Tu);
 }
 
-void set_adc_trig_interleaved(float32_t new_trig)
+void HardwareConfiguration::setHrtimAdcTrigInterleaved(float32_t new_trig)
 {
-	uint16_t new_trig_int = new_trig * pwm_period;
-	hrtim_update_adc_trig_interleaved(new_trig_int, leg1_tu, leg2_tu);
+	uint16_t new_trig_int = new_trig * hrtimPwmPeriod;
+	hrtim_update_adc_trig_interleaved(new_trig_int, hrtimLeg1Tu, hrtimLeg2Tu);
 }
 
 /**
  * This updates the dead time of the leg 1
 
  */
-void hrtim_set_dead_time_leg1(uint16_t rise_ns, uint16_t fall_ns)
+void HardwareConfiguration::setLeg1DeadTime(uint16_t rise_ns, uint16_t fall_ns)
 {
-	leg_set_dt(leg1_tu, rise_ns, fall_ns);
+	leg_set_dt(hrtimLeg1Tu, rise_ns, fall_ns);
 }
 
 /**
  * This updates the dead time of the leg 2
  */
-void hrtim_set_dead_time_leg2(uint16_t rise_ns, uint16_t fall_ns)
+void HardwareConfiguration::setLeg2DeadTime(uint16_t rise_ns, uint16_t fall_ns)
 {
-	leg_set_dt(leg2_tu, rise_ns, fall_ns);
+	leg_set_dt(hrtimLeg2Tu, rise_ns, fall_ns);
 }
 
 /**
  * This sets the frequency of the HRTIMER
  */
-void hrtim_set_frequency(uint32_t frequency_Hz)
+void HardwareConfiguration::setHrtimFrequency(uint32_t frequency_Hz)
 {
 	leg_set_freq(frequency_Hz);
 }
@@ -421,7 +584,7 @@ void hrtim_set_frequency(uint32_t frequency_Hz)
 /**
  * This gets the frequency of the HRTIMER
  */
-uint32_t hrtim_get_frequency()
+uint32_t HardwareConfiguration::getHrtimFrequency()
 {
 	return leg_get_freq();
 }
@@ -429,7 +592,7 @@ uint32_t hrtim_get_frequency()
 /**
  * This updates the minimum duty cycle of both legs
  */
-void hrtim_set_min_duty_cycle(float32_t duty_cycle)
+void HardwareConfiguration::setHrtimMinDutyCycle(float32_t duty_cycle)
 {
 	leg_set_min_duty_cycle(duty_cycle);
 }
@@ -437,7 +600,7 @@ void hrtim_set_min_duty_cycle(float32_t duty_cycle)
 /**
  * This updates the minimum duty cycle of both legs
  */
-void hrtim_set_max_duty_cycle(float32_t duty_cycle)
+void HardwareConfiguration::setHrtimMaxDutyCycle(float32_t duty_cycle)
 {
 	leg_set_max_duty_cycle(duty_cycle);
 }
diff --git a/zephyr/modules/owntech_hardware_configuration/zephyr/src/hrtim_configuration.h b/zephyr/modules/owntech_hardware_configuration/zephyr/src/hrtim_configuration.h
deleted file mode 100644
index 595c316..0000000
--- a/zephyr/modules/owntech_hardware_configuration/zephyr/src/hrtim_configuration.h
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * Copyright (c) 2021-2023 LAAS-CNRS
- *
- *   This program is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU Lesser General Public License as published by
- *   the Free Software Foundation, either version 2.1 of the License, or
- *   (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU Lesser General Public License for more details.
- *
- *   You should have received a copy of the GNU Lesser General Public License
- *   along with this program.  If not, see <https://www.gnu.org/licenses/>.
- *
- * SPDX-License-Identifier: LGLPV2.1
- */
-
-/**
- * @date   2023
- * @author Luiz Villa <luiz.villa@laas.fr>
- * @author Clément Foucher <clement.foucher@laas.fr>
- * @author Ayoub Farah Hassan <ayoub.farah-hassan@laas.fr>
- */
-
-#ifndef HRTIM_CONFIGURATION_H_
-#define HRTIM_CONFIGURATION_H_
-
-
-#include <arm_math.h>
-#include "hrtim.h"
-
-
-/**
- * @brief     This function initializes the timer managing the legs
- * 
- * @param[in] tu1 timer unit for leg 1
- * @param[in] tu2 timer unit for leg 2
- */
-
-void hrtim_leg_tu(hrtim_tu_t tu1, hrtim_tu_t tu2);
-
-/**
- * @brief     This function initializes the converter in interleaved buck mode
- * with the input on the high side and the output on the low side
- */
-void hrtim_init_interleaved_buck_mode();
-
-/**
- * @brief     This function initializes the converter in interleaved buck mode
- * with the input on the high side and the output on the low side. The counting mode
- * is set to up-down (center aligned).
- */
-void hrtim_init_interleaved_buck_mode_center_aligned();
-
-/**
- * @brief     This function initializes the converter in interleaved boost mode
- * with the input on the low side and the output on the high side
- */
-void hrtim_init_interleaved_boost_mode();
-
-/**
- * @brief     This function initializes the converter in full bridge mode
- * with the input on the high side and the output on the low side with the HRTIM on left aligned
- * @param[in] SPIN_board_V_1_1_2 boolean to treat the case of the spin board V 0.9 -- Patch
-*/
-void hrtim_init_full_bridge_buck_mode(bool SPIN_board_V_1_1_2);
-
-/**
- * @brief     This function initializes the converter in full bridge mode
- * with the input on the high side and the output on the low side with the HRTIM as center aligned
- * @param[in] SPIN_board_V_1_1_2 boolean to treat the case of the spin board V 0.9 -- Patch
- */
-void hrtim_init_full_bridge_buck_mode_center_aligned(bool bipolar_mode, bool SPIN_board_V_1_1_2);
-
-
-/**
- * @brief     This function initializes the converter in interleaved boost mode
- * with the input on the low side and the output on the high side. The counting mode
- * is set to up-down (center aligned).
- */
-void hrtim_init_interleaved_boost_mode_center_aligned();
-
-/**
- * @brief     This function initializes the converter in independent mode
- * the user must define the mode for each leg separetely
- */
-void hrtim_init_independent_mode(bool leg1_buck_mode, bool leg2_buck_mode);
-
-/**
- * @brief     This function initializes the converter in independent mode
- * the user must define the mode for each leg separetely. The counting mode
- * is set to up-down (center aligned).
- */
-void hrtim_init_independent_mode_center_aligned(bool leg1_buck_mode, bool leg2_buck_mode);
-
-
-/**
- * @brief initialize the converter in current mode
- * @param[in] leg1_buck  bool parameter, 0->leg1 in boost mode 1->leg1 in buck mode
- * @param[in] leg2_buck  bool parameter, 0->leg2 in boost mode 1->leg2 in buck mode
- * @param[in] leg1_tu    one of the timing unit, from TIMA to TIMF :
- *            @arg @ref   TIMA
- *            @arg @ref   TIMB
- *            @arg @ref   TIMC
- *            @arg @ref   TIMD
- *            @arg @ref   TIME
- *            @arg @ref   TIMF
- * @param[in] leg2_tu    one of the timing unit, from TIMA to TIMF :
- *            @arg @ref   TIMA
- *            @arg @ref   TIMB
- *            @arg @ref   TIMC
- *            @arg @ref   TIMD
- *            @arg @ref   TIME
- *            @arg @ref   TIMF             
-*/
-void hrtim_init_CurrentMode(bool leg1_buck, bool leg2_buck, hrtim_tu_t leg1_tu, hrtim_tu_t leg2_tu);
-
-
-/**
- * @brief     This function transfer the calculated PWM value to the
- * HRTIM peripheral and make sure it is between saturation
- * bounds with a phase shift compatible with the interleaved application.
- *
- * @param[in] duty_cycle    floating point duty cycle comprised between 0 and 1.
- */
-
-void hrtim_interleaved_pwm_update(float32_t duty_cycle);
-
-/**
- * @brief     This function transfer the calculated PWM value to the
- * HRTIM peripheral and make sure it is between saturation
- * bounds with a complementary approach to the duty cycles compatible with the HBridge application.
- *
- * @param[in] duty_cycle    floating point duty cycle comprised between 0 and 1.
- */
-void hrtim_full_bridge_buck_pwm_update(float32_t duty_cycle);
-
-/**
- * @brief     This function transfer the calculated PWM value of leg_1 to the
- * HRTIM peripheral and make sure it is between saturation
- * bounds.
- *
- * @param[in] duty_cycle    floating point duty cycle of leg_1 comprised between 0 and 1.
- */
-
-void hrtim_leg1_pwm_update(float32_t duty_cycle);
-/**
- * @brief     This function transfer the calculated PWM value of leg_2 to the
- * HRTIM peripheral and make sure it is between saturation
- * bounds.
- *
- * @param[in] duty_cycle    floating point duty cycle of leg_2 comprised between 0 and 1.
- */
-
-void hrtim_leg2_pwm_update(float32_t duty_cycle);
-
-/**
- * @brief     This function updates the phase shift between the leg 1 and the master hrtim
- *
- * @param[in] phase_shift    floating point phase shift of leg_1 in degrees
- */
-
-void hrtim_leg1_phase_shift_update(float32_t phase_shift);
-/**
- * @brief     This function updates the phase shift between the leg 1 and the master hrtim
- *
- * @param[in] phase_shift    floating point phase shift of leg_2 in degrees
- */
-
-void hrtim_leg2_phase_shift_update(float32_t phase_shift);
-
-/**
- * @brief     This function updates the phase shift between the leg 1 and the master hrtim for the center aligned
- *
- * @param[in] phase_shift    floating point phase shift of leg_1 in degrees
- */
-
-void hrtim_leg1_phase_shift_update_center_aligned(float32_t phase_shift);
-
-/**
- * @brief     This function updates the phase shift between the leg 1 and the master hrtim for the center aligned
- *
- * @param[in] phase_shift    floating point phase shift of leg_2 in degrees
- */
-
-void hrtim_leg2_phase_shift_update_center_aligned(float32_t phase_shift);
-
-/**
- * @brief This function stops the converter by putting both timing
- * units outputs low
- */
-void hrtim_stop_interleaved();
-
-/**
- * @brief This function stops the inverter
- */
-void hrtim_stop_full_bridge_buck();
-
-/**
- * @brief This function stops only leg 1
- */
-void hrtim_stop_leg1();
-
-/**
- * @brief This function stops only leg 2
- */
-void hrtim_stop_leg2();
-
-/**
- * @brief This function starts both legs
- */
-void hrtim_start_interleaved();
-
-/**
- * @brief This function starts the inverter
- */
-void hrtim_start_full_bridge_buck();
-
-/**
- * @brief This function starts only leg 1
- */
-void hrtim_start_leg1();
-
-/**
- * @brief This function starts only leg 2
- */
-void hrtim_start_leg2();
-
-/**
- * @brief     Updates the adc trigger moment
- *
- * @param[in] new_trig    defines the triggering moment
- */
-void set_adc_trig_interleaved(float32_t new_trig);
-
-/**
- * @brief This function sets the dead time of the leg 1
- */
-void hrtim_set_dead_time_leg1(uint16_t rise_ns, uint16_t fall_ns);
-
-/**
- * @brief This function sets the dead time of the leg 2
- */
-void hrtim_set_dead_time_leg2(uint16_t rise_ns, uint16_t fall_ns);
-
-/**
- * @brief Sets the frequency of the HRTIMER
- */
-void hrtim_set_frequency(uint32_t frequency_Hz);
-
-/**
- * @brief Gets the frequency of the HRTIMER
- */
-uint32_t hrtim_get_frequency();
-
-/**
- * @brief Updates the minimum duty cycle of both legs
- */
-void hrtim_set_min_duty_cycle(float32_t duty_cycle);
-
-/**
- * @brief This updates the minimum duty cycle of both legs
- */
-void hrtim_set_max_duty_cycle(float32_t duty_cycle);
-
-
-
-#endif // HRTIM_CONFIGURATION_H_
diff --git a/zephyr/modules/owntech_hardware_configuration/zephyr/src/led_configuration.cpp b/zephyr/modules/owntech_hardware_configuration/zephyr/src/led_configuration.cpp
index cc637d8..1921ea0 100644
--- a/zephyr/modules/owntech_hardware_configuration/zephyr/src/led_configuration.cpp
+++ b/zephyr/modules/owntech_hardware_configuration/zephyr/src/led_configuration.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 LAAS-CNRS
+ * Copyright (c) 2022-2023 LAAS-CNRS
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU Lesser General Public License as published by
@@ -18,7 +18,7 @@
  */
 
 /**
- * @date   2022
+ * @date   2023
  * @author Clément Foucher <clement.foucher@laas.fr>
  */
 
@@ -27,42 +27,46 @@
 #include "zephyr.h"
 #include "drivers/gpio.h"
 
+// Current file header
+#include "HardwareConfiguration.h"
+
+
+bool HardwareConfiguration::ledInitialized = false;
 
 static struct gpio_dt_spec led_pin_spec = GPIO_DT_SPEC_GET(DT_ALIAS(led0), gpios);
-static bool init = false;
 
 
-void led_config_init()
+void HardwareConfiguration::ledInitialize()
 {
 	gpio_pin_configure_dt(&led_pin_spec, GPIO_OUTPUT_ACTIVE);
-	init = true;
+	ledInitialized = true;
 }
 
-void led_config_on()
+void HardwareConfiguration::setLedOn()
 {
-	if (init == false)
+	if (ledInitialized == false)
 	{
-		led_config_init();
+		ledInitialize();
 	}
 
 	gpio_pin_set_dt(&led_pin_spec, 1);
 }
 
-void led_config_off()
+void HardwareConfiguration::setLedOff()
 {
-	if (init == false)
+	if (ledInitialized == false)
 	{
-		led_config_init();
+		ledInitialize();
 	}
 
 	gpio_pin_set_dt(&led_pin_spec, 0);
 }
 
-void led_config_toggle()
+void HardwareConfiguration::setLedToggle()
 {
-	if (init == false)
+	if (ledInitialized == false)
 	{
-		led_config_init();
+		ledInitialize();
 	}
 
 	gpio_pin_toggle_dt(&led_pin_spec);
diff --git a/zephyr/modules/owntech_hardware_configuration/zephyr/src/led_configuration.h b/zephyr/modules/owntech_hardware_configuration/zephyr/src/led_configuration.h
deleted file mode 100644
index 17e65a7..0000000
--- a/zephyr/modules/owntech_hardware_configuration/zephyr/src/led_configuration.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2022 LAAS-CNRS
- *
- *   This program is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU Lesser General Public License as published by
- *   the Free Software Foundation, either version 2.1 of the License, or
- *   (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU Lesser General Public License for more details.
- *
- *   You should have received a copy of the GNU Lesser General Public License
- *   along with this program.  If not, see <https://www.gnu.org/licenses/>.
- *
- * SPDX-License-Identifier: LGLPV2.1
- */
-
-/**
- * @date   2022
- * @author Clément Foucher <clement.foucher@laas.fr>
- */
-
-
-#ifndef LED_CONFIGURATION_H_
-#define LED_CONFIGURATION_H_
-
-
-void led_config_on();
-void led_config_off();
-void led_config_toggle();
-
-
-#endif // LED_CONFIGURATION_H_
diff --git a/zephyr/modules/owntech_hardware_configuration/zephyr/src/ngnd_configuration.cpp b/zephyr/modules/owntech_hardware_configuration/zephyr/src/ngnd_configuration.cpp
index 3012880..1242c66 100644
--- a/zephyr/modules/owntech_hardware_configuration/zephyr/src/ngnd_configuration.cpp
+++ b/zephyr/modules/owntech_hardware_configuration/zephyr/src/ngnd_configuration.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 LAAS-CNRS
+ * Copyright (c) 2022-2023 LAAS-CNRS
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU Lesser General Public License as published by
@@ -18,17 +18,22 @@
  */
 
 /**
- * @date   2022
+ * @date   2023
  * @author Clément Foucher <clement.foucher@laas.fr>
  */
 
 
+// Owntech driver
 #include "ngnd.h"
 
+// Current file header
+#include "HardwareConfiguration.h"
+
+
 static const struct device* ngnd_switch = DEVICE_DT_GET(NGND_DEVICE);
 
 
-void ngnd_config_on()
+void HardwareConfiguration::setNgndOn()
 {
 	if (device_is_ready(ngnd_switch) == true)
 	{
@@ -36,7 +41,7 @@ void ngnd_config_on()
 	}
 }
 
-void ngnd_config_off()
+void HardwareConfiguration::setNgndOff()
 {
 	if (device_is_ready(ngnd_switch) == true)
 	{
diff --git a/zephyr/modules/owntech_hardware_configuration/zephyr/src/ngnd_configuration.h b/zephyr/modules/owntech_hardware_configuration/zephyr/src/ngnd_configuration.h
deleted file mode 100644
index 4fb2726..0000000
--- a/zephyr/modules/owntech_hardware_configuration/zephyr/src/ngnd_configuration.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2022 LAAS-CNRS
- *
- *   This program is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU Lesser General Public License as published by
- *   the Free Software Foundation, either version 2.1 of the License, or
- *   (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU Lesser General Public License for more details.
- *
- *   You should have received a copy of the GNU Lesser General Public License
- *   along with this program.  If not, see <https://www.gnu.org/licenses/>.
- *
- * SPDX-License-Identifier: LGLPV2.1
- */
-
-/**
- * @date   2022
- * @author Clément Foucher <clement.foucher@laas.fr>
- */
-
-
-#ifndef NGND_CONFIGURATION_H_
-#define NGND_CONFIGURATION_H_
-
-
-void ngnd_config_on();
-void ngnd_config_off();
-
-
-#endif // NGND_CONFIGURATION_H_
diff --git a/zephyr/modules/owntech_hardware_configuration/zephyr/src/power_driver_configuration.cpp b/zephyr/modules/owntech_hardware_configuration/zephyr/src/power_driver_configuration.cpp
index bd13668..c60ed15 100644
--- a/zephyr/modules/owntech_hardware_configuration/zephyr/src/power_driver_configuration.cpp
+++ b/zephyr/modules/owntech_hardware_configuration/zephyr/src/power_driver_configuration.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 LAAS-CNRS
+ * Copyright (c) 2022-2023 LAAS-CNRS
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU Lesser General Public License as published by
@@ -18,7 +18,7 @@
  */
 
 /**
- * @date   2022
+ * @date   2023
  * @author Clément Foucher <clement.foucher@laas.fr>
  * @author Luiz Villa <luiz.villa@laas.fr>
  */
@@ -28,72 +28,76 @@
 #include "zephyr.h"
 #include "GpioApi.h"
 
-static bool init = false;
+// Current file header
+#include "HardwareConfiguration.h"
 
 
-void power_driver_config_init()
+bool HardwareConfiguration::powerDriverInitialized = false;
+
+
+void HardwareConfiguration::powerDriverInitialize()
 {
 	gpio.configurePin(PC12,OUTPUT); //configures the pin of leg 1 mosfet high
 	gpio.configurePin(PC13,OUTPUT); //configures the pin of leg 2 mosfet high
-	init = true;
+	powerDriverInitialized = true;
 }
 
-void power_driver_leg1_on()
+void HardwareConfiguration::powerDriverLeg1On()
 {
-	if (init == false)
+	if (powerDriverInitialized == false)
 	{
-		power_driver_config_init(); //calls the config automatically during the first execution
+		powerDriverInitialize(); //calls the config automatically during the first execution
 	}
 
 	gpio.setPin(PC12);
 }
 
-void power_driver_leg2_on()
+void HardwareConfiguration::powerDriverLeg2On()
 {
-	if (init == false)
+	if (powerDriverInitialized == false)
 	{
-		power_driver_config_init(); //calls the config automatically during the first execution
+		powerDriverInitialize(); //calls the config automatically during the first execution
 	}
 
 	gpio.setPin(PC13);
 }
 
-void power_driver_leg1_off()
+void HardwareConfiguration::powerDriverLeg1Off()
 {
-	if (init == false)
+	if (powerDriverInitialized == false)
 	{
-		power_driver_config_init(); //calls the config automatically during the first execution
+		powerDriverInitialize(); //calls the config automatically during the first execution
 	}
 
 	gpio.resetPin(PC12);
 }
 
-void power_driver_leg2_off()
+void HardwareConfiguration::powerDriverLeg2Off()
 {
-	if (init == false)
+	if (powerDriverInitialized == false)
 	{
-		power_driver_config_init(); //calls the config automatically during the first execution
+		powerDriverInitialize(); //calls the config automatically during the first execution
 	}
 
 	gpio.resetPin(PC12);
 }
 
-void power_driver_interleaved_on()
+void HardwareConfiguration::powerDriverInterleavedOn()
 {
-	if (init == false)
+	if (powerDriverInitialized == false)
 	{
-		power_driver_config_init(); //calls the config automatically during the first execution
+		powerDriverInitialize(); //calls the config automatically during the first execution
 	}
 
 	gpio.setPin(PC12);
 	gpio.setPin(PC13);
 }
 
-void power_driver_interleaved_off()
+void HardwareConfiguration::powerDriverInterleavedOff()
 {
-	if (init == false)
+	if (powerDriverInitialized == false)
 	{
-		power_driver_config_init(); //calls the config automatically during the first execution
+		powerDriverInitialize(); //calls the config automatically during the first execution
 	}
 
 	gpio.resetPin(PC12);
diff --git a/zephyr/modules/owntech_hardware_configuration/zephyr/src/power_driver_configuration.h b/zephyr/modules/owntech_hardware_configuration/zephyr/src/power_driver_configuration.h
deleted file mode 100644
index 609919e..0000000
--- a/zephyr/modules/owntech_hardware_configuration/zephyr/src/power_driver_configuration.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2022 LAAS-CNRS
- *
- *   This program is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU Lesser General Public License as published by
- *   the Free Software Foundation, either version 2.1 of the License, or
- *   (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU Lesser General Public License for more details.
- *
- *   You should have received a copy of the GNU Lesser General Public License
- *   along with this program.  If not, see <https://www.gnu.org/licenses/>.
- *
- * SPDX-License-Identifier: LGLPV2.1
- */
-
-/**
- * @date   2022
- * @author Clément Foucher <clement.foucher@laas.fr>
- * @author Luiz Villa <luiz.villa@laas.fr>
- */
-
-
-#ifndef POWER_DRIVER_CONFIGURATION_H_
-#define POWER_DRIVER_CONFIGURATION_H_
-
-
-void power_driver_leg1_on();
-void power_driver_leg1_off();
-void power_driver_leg2_on();
-void power_driver_leg2_off();
-void power_driver_interleaved_on();
-void power_driver_interleaved_off();
-
-
-#endif // POWER_DRIVER_CONFIGURATION_H_
diff --git a/zephyr/modules/owntech_hardware_configuration/zephyr/src/timer_configuration.cpp b/zephyr/modules/owntech_hardware_configuration/zephyr/src/timer_configuration.cpp
index e0cbd8a..3c896c3 100644
--- a/zephyr/modules/owntech_hardware_configuration/zephyr/src/timer_configuration.cpp
+++ b/zephyr/modules/owntech_hardware_configuration/zephyr/src/timer_configuration.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 LAAS-CNRS
+ * Copyright (c) 2022-2023 LAAS-CNRS
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU Lesser General Public License as published by
@@ -18,20 +18,25 @@
  */
 
 /**
- * @date   2022
+ * @date   2023
  * @author Clément Foucher <clement.foucher@laas.fr>
  */
 
+
+// OwnTech Power API
 #include "timer.h"
 
+// Current file header
+#include "HardwareConfiguration.h"
+
 
 static const struct device* timer4 = DEVICE_DT_GET(TIMER4_DEVICE);
 
-static bool timer4init    = false;
-static bool timer4started = false;
+bool HardwareConfiguration::timer4init    = false;
+bool HardwareConfiguration::timer4started = false;
 
 
-static void _timer_incremental_encoder_tim4_init()
+void HardwareConfiguration::timerInitialize()
 {
 	if (device_is_ready(timer4) == true)
 	{
@@ -48,11 +53,11 @@ static void _timer_incremental_encoder_tim4_init()
 	}
 }
 
-void timer_incremental_encoder_tim4_start()
+void HardwareConfiguration::startLoggingIncrementalEncoder()
 {
 	if (timer4init == false)
 	{
-		_timer_incremental_encoder_tim4_init();
+		timerInitialize();
 	}
 
 	if (timer4started == false)
@@ -65,7 +70,7 @@ void timer_incremental_encoder_tim4_start()
 	}
 }
 
-uint32_t timer_incremental_encoder_tim4_get_step()
+uint32_t HardwareConfiguration::getIncrementalEncoderValue()
 {
 	if (timer4started == true)
 	{
diff --git a/zephyr/modules/owntech_hardware_configuration/zephyr/src/timer_configuration.h b/zephyr/modules/owntech_hardware_configuration/zephyr/src/timer_configuration.h
deleted file mode 100644
index f29360d..0000000
--- a/zephyr/modules/owntech_hardware_configuration/zephyr/src/timer_configuration.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2022 LAAS-CNRS
- *
- *   This program is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU Lesser General Public License as published by
- *   the Free Software Foundation, either version 2.1 of the License, or
- *   (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU Lesser General Public License for more details.
- *
- *   You should have received a copy of the GNU Lesser General Public License
- *   along with this program.  If not, see <https://www.gnu.org/licenses/>.
- *
- * SPDX-License-Identifier: LGLPV2.1
- */
-
-/**
- * @date   2022
- * @author Clément Foucher <clement.foucher@laas.fr>
- */
-
-
-#ifndef TIMER_CONFIGURATION_H_
-#define TIMER_CONFIGURATION_H_
-
-
-#include <stdint.h>
-
-
-/**
- * @brief Launches the timer4 which is adapted for reading an encoder.
- */
-void timer_incremental_encoder_tim4_start();
-
-/**
- * @brief Gets the encoder step value.
- * @return An uint32 value of the counter which corresponds to the step of the system.
- */
-uint32_t timer_incremental_encoder_tim4_get_step();
-
-
-#endif // TIMER_CONFIGURATION_H_
diff --git a/zephyr/modules/owntech_hardware_configuration/zephyr/src/uart_configuration.cpp b/zephyr/modules/owntech_hardware_configuration/zephyr/src/uart_configuration.cpp
index 2c0fe7f..1cf8a85 100644
--- a/zephyr/modules/owntech_hardware_configuration/zephyr/src/uart_configuration.cpp
+++ b/zephyr/modules/owntech_hardware_configuration/zephyr/src/uart_configuration.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 LAAS-CNRS
+ * Copyright (c) 2022-2023 LAAS-CNRS
  *
  *   This program is free software: you can redistribute it and/or modify
  *   it under the terms of the GNU Lesser General Public License as published by
@@ -18,7 +18,7 @@
  */
 
 /**
- * @date   2022
+ * @date   2023
  * @author Luiz Villa <luiz.villa@laas.fr>
  * @author Clément Foucher <clement.foucher@laas.fr>
  */
@@ -30,6 +30,9 @@
 // Zephyr
 #include <drivers/uart.h>
 
+// Current file header
+#include "HardwareConfiguration.h"
+
 
 /////
 // USART 1 defines
@@ -42,6 +45,7 @@ static const struct device* uart_dev = DEVICE_DT_GET(DT_NODELABEL(usart1));
 static char buf_req[CONFIG_OWNTECH_SERIAL_RX_BUF_SIZE];
 static bool command_flag = false;
 
+
 /////
 // USART 1 private functions
 
@@ -65,7 +69,7 @@ static void _uart_usart1_process_input(const struct device *dev, void* user_data
 /////
 // USART 1 public functions
 
-void uart_usart1_init()
+void HardwareConfiguration::extraUartInit()
 {
 	const struct uart_config usart1_config =
 	{
@@ -84,7 +88,7 @@ void uart_usart1_init()
 	}
 }
 
-char uart_usart1_get_data()
+char HardwareConfiguration::extraUartReadChar()
 {
 	if (command_flag){
 		command_flag = false;
@@ -94,7 +98,7 @@ char uart_usart1_get_data()
 	}
 }
 
-void uart_usart1_write_single(char data)
+void HardwareConfiguration::extraUartWriteChar(char data)
 {
 	if (device_is_ready(uart_dev) == true)
 	{
@@ -102,7 +106,7 @@ void uart_usart1_write_single(char data)
 	}
 }
 
-void uart_lpuart1_swap_rx_tx()
+void HardwareConfiguration::uart1SwapRxTx()
 {
 	LL_LPUART_Disable(LPUART1);
 	LL_LPUART_SetTXRXSwap(LPUART1, LL_LPUART_TXRX_SWAPPED);
diff --git a/zephyr/modules/owntech_hardware_configuration/zephyr/src/uart_configuration.h b/zephyr/modules/owntech_hardware_configuration/zephyr/src/uart_configuration.h
deleted file mode 100644
index 6eb4e61..0000000
--- a/zephyr/modules/owntech_hardware_configuration/zephyr/src/uart_configuration.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2022 LAAS-CNRS
- *
- *   This program is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU Lesser General Public License as published by
- *   the Free Software Foundation, either version 2.1 of the License, or
- *   (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU Lesser General Public License for more details.
- *
- *   You should have received a copy of the GNU Lesser General Public License
- *   along with this program.  If not, see <https://www.gnu.org/licenses/>.
- *
- * SPDX-License-Identifier: LGLPV2.1
- */
-
-/**
- * @date   2022
- * @author Luiz Villa <luiz.villa@laas.fr>
- * @author Clément Foucher <clement.foucher@laas.fr>
- */
-
-#ifndef UART_CONFIGURATION_H_
-#define UART_CONFIGURATION_H_
-
-
-/**
- * @brief Library initialization function for the usart communication.
- *        This function is declared on the private section of the .c file
- */
-void uart_usart1_init();
-
-/**
- * @brief This function sends back a single character waiting to be treated from the usart1
- *
- * @return This function returns a single char which is waiting to be treated
- *          if no char is waiting it returns an 'x' which should be treated as an error
- */
-char uart_usart1_get_data();
-
-/**
- * @brief This function transmits a single character through the usart 1
- *
- * @param data single char to be sent out
- */
-void uart_usart1_write_single(char data);
-
-
-/**
- * Swap RX and TX to correct hardware mistake.
- */
-void uart_lpuart1_swap_rx_tx();
-
-#endif // UART_CONFIGURATION_H_
-- 
GitLab