diff --git a/fw/.cproject b/fw/.cproject
index 30a87ca..0005a9c 100644
--- a/fw/.cproject
+++ b/fw/.cproject
@@ -1,396 +1,191 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/fw/.mxproject b/fw/.mxproject
index 4d4db74..13a39f9 100644
--- a/fw/.mxproject
+++ b/fw/.mxproject
@@ -1,10 +1,10 @@
[PreviousLibFiles]
-LibFiles=Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_gpio.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_i2c.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_dma.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_bus.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_cortex.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_rcc.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_system.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_utils.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_exti.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_pwr.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_crs.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_lpuart.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_tim.h;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_gpio.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_i2c.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_dma.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rcc.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_utils.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_exti.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_lpuart.c;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_rcc.h;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_pwr.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_tim.c;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_gpio.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_i2c.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_dma.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_bus.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_cortex.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_rcc.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_system.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_utils.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_exti.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_pwr.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_crs.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_lpuart.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_tim.h;Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h;Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h;Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h;Drivers/CMSIS/Device/ST/STM32L0xx/Source/Templates/system_stm32l0xx.c;Drivers/CMSIS/Include/cmsis_iccarm.h;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/cmsis_armclang.h;Drivers/CMSIS/Include/core_cm1.h;Drivers/CMSIS/Include/core_armv8mbl.h;Drivers/CMSIS/Include/core_cm33.h;Drivers/CMSIS/Include/cmsis_version.h;Drivers/CMSIS/Include/cmsis_compiler.h;Drivers/CMSIS/Include/mpu_armv7.h;Drivers/CMSIS/Include/mpu_armv8.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/core_sc300.h;Drivers/CMSIS/Include/tz_context.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/core_cm23.h;Drivers/CMSIS/Include/core_armv8mml.h;Drivers/CMSIS/Include/core_cm4.h;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/core_cm3.h;
+LibFiles=Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_gpio.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_i2c.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_dma.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_bus.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_cortex.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_rcc.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_system.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_utils.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_exti.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_pwr.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_crs.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_tim.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_usart.h;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_gpio.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_i2c.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_dma.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rcc.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_utils.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_exti.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_pwr.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_tim.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_usart.c;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_gpio.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_i2c.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_dma.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_bus.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_cortex.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_rcc.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_system.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_utils.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_exti.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_pwr.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_crs.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_tim.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_usart.h;Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l031xx.h;Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h;Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h;Drivers/CMSIS/Device/ST/STM32L0xx/Source/Templates/system_stm32l0xx.c;Drivers/CMSIS/Include/cmsis_iccarm.h;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/cmsis_armclang.h;Drivers/CMSIS/Include/core_cm1.h;Drivers/CMSIS/Include/core_armv8mbl.h;Drivers/CMSIS/Include/core_cm33.h;Drivers/CMSIS/Include/cmsis_version.h;Drivers/CMSIS/Include/cmsis_compiler.h;Drivers/CMSIS/Include/mpu_armv7.h;Drivers/CMSIS/Include/mpu_armv8.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/core_sc300.h;Drivers/CMSIS/Include/tz_context.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/core_cm23.h;Drivers/CMSIS/Include/core_armv8mml.h;Drivers/CMSIS/Include/core_cm4.h;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/core_cm3.h;
[PreviousUsedCubeIDEFiles]
-SourceFiles=Core/Src/main.c;Core/Src/stm32l0xx_it.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_gpio.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_i2c.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_dma.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rcc.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_utils.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_exti.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_lpuart.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_pwr.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_tim.c;Core/Src/system_stm32l0xx.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_gpio.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_i2c.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_dma.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rcc.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_utils.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_exti.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_lpuart.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_pwr.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_tim.c;Core/Src/system_stm32l0xx.c;Drivers/CMSIS/Device/ST/STM32L0xx/Source/Templates/system_stm32l0xx.c;;
+SourceFiles=Core/Src/main.c;Core/Src/stm32l0xx_it.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_gpio.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_i2c.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_dma.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rcc.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_utils.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_exti.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_pwr.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_tim.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_usart.c;Drivers/CMSIS/Device/ST/STM32L0xx/Source/Templates/system_stm32l0xx.c;Core/Src/system_stm32l0xx.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_gpio.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_i2c.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_dma.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rcc.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_utils.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_exti.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_pwr.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_tim.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_usart.c;Drivers/CMSIS/Device/ST/STM32L0xx/Source/Templates/system_stm32l0xx.c;Core/Src/system_stm32l0xx.c;;;
HeaderPath=Drivers/STM32L0xx_HAL_Driver/Inc;Drivers/CMSIS/Device/ST/STM32L0xx/Include;Drivers/CMSIS/Include;Core/Inc;
-CDefines=USE_FULL_LL_DRIVER;HSE_VALUE:8000000;HSE_STARTUP_TIMEOUT:100;LSE_STARTUP_TIMEOUT:5000;LSE_VALUE:32768;MSI_VALUE:2097000;HSI_VALUE:16000000;LSI_VALUE:37000;VDD_VALUE:3300;PREFETCH_ENABLE:0;INSTRUCTION_CACHE_ENABLE:1;DATA_CACHE_ENABLE:1;STM32L011xx;USE_FULL_LL_DRIVER;HSE_VALUE:8000000;HSE_STARTUP_TIMEOUT:100;LSE_STARTUP_TIMEOUT:5000;LSE_VALUE:32768;MSI_VALUE:2097000;HSI_VALUE:16000000;LSI_VALUE:37000;VDD_VALUE:3300;PREFETCH_ENABLE:0;INSTRUCTION_CACHE_ENABLE:1;DATA_CACHE_ENABLE:1;
+CDefines=USE_FULL_LL_DRIVER;HSE_VALUE:8000000;HSE_STARTUP_TIMEOUT:100;LSE_STARTUP_TIMEOUT:5000;LSE_VALUE:32768;MSI_VALUE:2097000;HSI_VALUE:16000000;LSI_VALUE:37000;VDD_VALUE:3300;PREFETCH_ENABLE:0;INSTRUCTION_CACHE_ENABLE:1;DATA_CACHE_ENABLE:1;STM32L031xx;USE_FULL_LL_DRIVER;HSE_VALUE:8000000;HSE_STARTUP_TIMEOUT:100;LSE_STARTUP_TIMEOUT:5000;LSE_VALUE:32768;MSI_VALUE:2097000;HSI_VALUE:16000000;LSI_VALUE:37000;VDD_VALUE:3300;PREFETCH_ENABLE:0;INSTRUCTION_CACHE_ENABLE:1;DATA_CACHE_ENABLE:1;
[PreviousGenFiles]
AdvancedFolderStructure=true
diff --git a/fw/.project b/fw/.project
index 6232ccb..17919b4 100644
--- a/fw/.project
+++ b/fw/.project
@@ -24,7 +24,6 @@
org.eclipse.cdt.core.cnature
com.st.stm32cube.ide.mcu.MCUCubeIdeServicesRevAev2ProjectNature
com.st.stm32cube.ide.mcu.MCUAdvancedStructureProjectNature
- com.st.stm32cube.ide.mcu.MCUEndUserDisabledTrustZoneProjectNature
com.st.stm32cube.ide.mcu.MCUSingleCpuProjectNature
com.st.stm32cube.ide.mcu.MCURootProjectNature
org.eclipse.cdt.managedbuilder.core.managedBuildNature
diff --git a/fw/.settings/stm32cubeide.project.prefs b/fw/.settings/stm32cubeide.project.prefs
index ae186d6..2a751da 100644
--- a/fw/.settings/stm32cubeide.project.prefs
+++ b/fw/.settings/stm32cubeide.project.prefs
@@ -1,3 +1,4 @@
-8DF89ED150041C4CBC7CB9A9CAA90856=295E78E9D51884086204F31037537306
-DC22A860405A8BF2F2C095E5B6529F12=295E78E9D51884086204F31037537306
+66BE74F758C12D739921AEA421D593D3=11
+8DF89ED150041C4CBC7CB9A9CAA90856=807411C90E25B050C1E13646B7FEB5AA
+DC22A860405A8BF2F2C095E5B6529F12=807411C90E25B050C1E13646B7FEB5AA
eclipse.preferences.version=1
diff --git a/fw/Core/Inc/main.h b/fw/Core/Inc/main.h
index a144a49..dd3504d 100644
--- a/fw/Core/Inc/main.h
+++ b/fw/Core/Inc/main.h
@@ -29,9 +29,8 @@ extern "C" {
/* Includes ------------------------------------------------------------------*/
#include "stm32l0xx_ll_i2c.h"
-#include "stm32l0xx_ll_lpuart.h"
-#include "stm32l0xx_ll_rcc.h"
#include "stm32l0xx_ll_crs.h"
+#include "stm32l0xx_ll_rcc.h"
#include "stm32l0xx_ll_bus.h"
#include "stm32l0xx_ll_system.h"
#include "stm32l0xx_ll_exti.h"
@@ -40,6 +39,7 @@ extern "C" {
#include "stm32l0xx_ll_pwr.h"
#include "stm32l0xx_ll_dma.h"
#include "stm32l0xx_ll_tim.h"
+#include "stm32l0xx_ll_usart.h"
#include "stm32l0xx_ll_gpio.h"
#if defined(USE_FULL_ASSERT)
@@ -102,10 +102,10 @@ int8_t uart_enable_interrupts(void);
/* USER CODE BEGIN Private defines */
#define MEASUREMENT_PERIOD_MS 600000
-extern uint16_t lpuart1_rx_message_index;
-extern uint16_t lpuart1_rx_message_len;
-extern uint8_t lpuart1_rx_done;
-extern uint8_t lpuart1_rx_message_too_long;
+extern uint16_t usart2_rx_message_index;
+extern uint16_t usart2_rx_message_len;
+extern uint8_t usart2_rx_done;
+extern uint8_t usart2_rx_message_too_long;
extern uint8_t tim21_elapsed_period;
diff --git a/fw/Core/Inc/stm32l0xx_it.h b/fw/Core/Inc/stm32l0xx_it.h
index e4fecd6..c2f720d 100644
--- a/fw/Core/Inc/stm32l0xx_it.h
+++ b/fw/Core/Inc/stm32l0xx_it.h
@@ -52,7 +52,7 @@ void SVC_Handler(void);
void PendSV_Handler(void);
void SysTick_Handler(void);
void TIM21_IRQHandler(void);
-void LPUART1_IRQHandler(void);
+void USART2_IRQHandler(void);
/* USER CODE BEGIN EFP */
/* USER CODE END EFP */
diff --git a/fw/Core/Src/i2c.c b/fw/Core/Src/i2c.c
index 07aeaaf..b0991b8 100644
--- a/fw/Core/Src/i2c.c
+++ b/fw/Core/Src/i2c.c
@@ -6,7 +6,7 @@
*/
#include "i2c.h"
-#include "stm32l0xx_ll_lpuart.h"
+#include "stm32l0xx_ll_usart.h"
i2c_context_t *i2c_context;
diff --git a/fw/Core/Src/main.c b/fw/Core/Src/main.c
index 23f6270..930de14 100644
--- a/fw/Core/Src/main.c
+++ b/fw/Core/Src/main.c
@@ -118,10 +118,10 @@ uint8_t co2_valid = 0;
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_I2C1_Init(void);
-static void MX_LPUART1_UART_Init(void);
+static void MX_USART2_UART_Init(void);
static void MX_TIM21_Init(void);
/* USER CODE BEGIN PFP */
-void LPUART1_TX_Buffer(uint8_t* buffer_tx, uint16_t buffer_tx_len);
+void USART2_TX_Buffer(uint8_t* buffer_tx, uint16_t buffer_tx_len);
/* USER CODE END PFP */
/* Private user code ---------------------------------------------------------*/
@@ -147,6 +147,8 @@ int main(void)
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_PWR);
/* System interrupt init*/
+ /* SysTick_IRQn interrupt configuration */
+ NVIC_SetPriority(SysTick_IRQn, 3);
/* USER CODE BEGIN Init */
@@ -174,7 +176,7 @@ int main(void)
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_I2C1_Init();
- MX_LPUART1_UART_Init();
+ MX_USART2_UART_Init();
MX_TIM21_Init();
/* USER CODE BEGIN 2 */
@@ -191,7 +193,7 @@ int main(void)
modbus_slave_set_address(sensor_config.modbus_addr);
/* Enable UART for RS485 */
- LL_LPUART_Enable(LPUART1);
+ LL_USART_Enable(USART2);
/* Start the timer for measurement triggering */
LL_TIM_EnableCounter(TIM21);
@@ -202,6 +204,8 @@ int main(void)
i2c_context.i2c = I2C1;
i2c_init(&i2c_context);
+ LL_mDelay(2000);
+
scd4x_start_periodic_measurement();
uint8_t scd4x_is_connected = 1;
uint8_t sps30_is_connected = 0;
@@ -227,34 +231,34 @@ int main(void)
/* SHT4x Init Time: max 1 ms (datasheet pg. 8) */
/* SCD4x Init Time: max 1000 ms (datasheet pg. 6) */
/* SPS30 Init Time: max 30000 ms (datasheet pg. 2) */
- LL_mDelay(1000);
+ LL_mDelay(5000);
static uint32_t new_baud;
/* Enter the main loop */
while (1)
{
- if (lpuart1_rx_done == 1)
+ if (usart2_rx_done == 1)
{
/* Process the message */
- if (lpuart1_rx_message_too_long)
+ if (usart2_rx_message_too_long)
{
/* Do nothing, just delete the buffer and set the flag back to zero*/
- lpuart1_rx_message_too_long = 0;
+ usart2_rx_message_too_long = 0;
} else
{
/* Process the message:
* message is stored in modbus_buffer[], no copying necessary;
* but we need to make sure that modbus_buffer[] will not be used while
* processing the message: this can be done by disabling RX interrupt */
- LL_LPUART_DisableIT_RXNE(LPUART1);
- modbus_slave_process_msg(modbus_buffer, lpuart1_rx_message_len);
+ LL_USART_DisableIT_RXNE(USART2);
+ modbus_slave_process_msg(modbus_buffer, usart2_rx_message_len);
/* Reset the RX DONE flag */
- lpuart1_rx_done = 0;
- LL_LPUART_EnableIT_RXNE(LPUART1);
+ usart2_rx_done = 0;
+ LL_USART_EnableIT_RXNE(USART2);
}
/* Reset the RX DONE flag */
- lpuart1_rx_done = 0;
+ usart2_rx_done = 0;
}
/* if config changed (MODBUS write), reflect changes to EEPROM */
if (sensor_config_pending_write) {
@@ -268,23 +272,16 @@ int main(void)
}
if (baudrate_changed)
{
- while (!LL_LPUART_IsActiveFlag_TXE(LPUART1));
+ while (!LL_USART_IsActiveFlag_TXE(USART2));
uart_disable_interrupts();
-// LL_LPUART_Disable(LPUART1);
-// LL_LPUART_DisableIT_IDLE(LPUART1);
-// LL_LPUART_EnableIT_RXNE(LPUART1);
- LL_LPUART_SetBaudRate(LPUART1, SYSTICK_FREQ_HZ, config_baudrates[sensor_config.baudrate_index]);
-
-// LL_LPUART_Enable(LPUART1);
-// LL_LPUART_EnableIT_IDLE(LPUART1);
-// LL_LPUART_EnableIT_RXNE(LPUART1);
+ LL_USART_SetBaudRate(USART2, SYSTICK_FREQ_HZ, LL_USART_OVERSAMPLING_16, config_baudrates[sensor_config.baudrate_index]);
uart_enable_interrupts();
- LL_LPUART_EnableDirectionRx(LPUART1);
- LL_LPUART_EnableDirectionTx(LPUART1);
+ LL_USART_EnableDirectionRx(USART2);
+ LL_USART_EnableDirectionTx(USART2);
baudrate_changed = 0;
- new_baud = LL_LPUART_GetBaudRate(LPUART1, SYSTICK_FREQ_HZ);
+ new_baud = LL_USART_GetBaudRate(USART2, SYSTICK_FREQ_HZ, LL_USART_OVERSAMPLING_16);
}
/* It is time for measurement */
@@ -399,7 +396,7 @@ void SystemClock_Config(void)
LL_Init1msTick(12000000);
LL_SetSystemCoreClock(12000000);
- LL_RCC_SetLPUARTClockSource(LL_RCC_LPUART1_CLKSOURCE_PCLK1);
+ LL_RCC_SetUSARTClockSource(LL_RCC_USART2_CLKSOURCE_PCLK1);
LL_RCC_SetI2CClockSource(LL_RCC_I2C1_CLKSOURCE_PCLK1);
}
@@ -466,89 +463,6 @@ static void MX_I2C1_Init(void)
}
-/**
- * @brief LPUART1 Initialization Function
- * @param None
- * @retval None
- */
-static void MX_LPUART1_UART_Init(void)
-{
-
- /* USER CODE BEGIN LPUART1_Init 0 */
-
- /* USER CODE END LPUART1_Init 0 */
-
- LL_LPUART_InitTypeDef LPUART_InitStruct = {0};
-
- LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
-
- /* Peripheral clock enable */
- LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_LPUART1);
-
- LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOA);
- LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOB);
- /**LPUART1 GPIO Configuration
- PA0-CK_IN ------> LPUART1_RX
- PA1 ------> LPUART1_TX
- PB1 ------> LPUART1_DE
- */
- GPIO_InitStruct.Pin = LL_GPIO_PIN_0;
- GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
- GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_VERY_HIGH;
- GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
- GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
- GPIO_InitStruct.Alternate = LL_GPIO_AF_6;
- LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
-
- GPIO_InitStruct.Pin = LL_GPIO_PIN_1;
- GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
- GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_VERY_HIGH;
- GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
- GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
- GPIO_InitStruct.Alternate = LL_GPIO_AF_6;
- LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
-
- GPIO_InitStruct.Pin = LL_GPIO_PIN_1;
- GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
- GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_VERY_HIGH;
- GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
- GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
- GPIO_InitStruct.Alternate = LL_GPIO_AF_4;
- LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
-
- /* LPUART1 interrupt Init */
- NVIC_SetPriority(LPUART1_IRQn, 0);
- NVIC_EnableIRQ(LPUART1_IRQn);
-
- /* USER CODE BEGIN LPUART1_Init 1 */
-
- /* USER CODE END LPUART1_Init 1 */
- LPUART_InitStruct.BaudRate = config_baudrates[sensor_config.baudrate_index];
- LPUART_InitStruct.DataWidth = LL_LPUART_DATAWIDTH_9B;
- LPUART_InitStruct.StopBits = LL_LPUART_STOPBITS_1;
- LPUART_InitStruct.Parity = LL_LPUART_PARITY_EVEN;
- LPUART_InitStruct.TransferDirection = LL_LPUART_DIRECTION_TX_RX;
- LPUART_InitStruct.HardwareFlowControl = LL_LPUART_HWCONTROL_NONE;
- LL_LPUART_Init(LPUART1, &LPUART_InitStruct);
- LL_LPUART_EnableDEMode(LPUART1);
- LL_LPUART_SetDESignalPolarity(LPUART1, LL_LPUART_DE_POLARITY_HIGH);
- LL_LPUART_SetDEAssertionTime(LPUART1, 0);
- LL_LPUART_SetDEDeassertionTime(LPUART1, 0);
- /* USER CODE BEGIN LPUART1_Init 2 */
-
- /* Enable IDLE Interrupt */
- LL_LPUART_EnableIT_IDLE(LPUART1);
-
- /* Enable RX Not Empty Interrupt */
- LL_LPUART_EnableIT_RXNE(LPUART1);
-
- LL_LPUART_EnableDirectionRx(LPUART1);
- LL_LPUART_EnableDirectionTx(LPUART1);
- LL_LPUART_Enable(LPUART1);
- /* USER CODE END LPUART1_Init 2 */
-
-}
-
/**
* @brief TIM21 Initialization Function
* @param None
@@ -588,6 +502,91 @@ static void MX_TIM21_Init(void)
}
+/**
+ * @brief USART2 Initialization Function
+ * @param None
+ * @retval None
+ */
+static void MX_USART2_UART_Init(void)
+{
+
+ /* USER CODE BEGIN USART2_Init 0 */
+
+ /* USER CODE END USART2_Init 0 */
+
+ LL_USART_InitTypeDef USART_InitStruct = {0};
+
+ LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
+
+ /* Peripheral clock enable */
+ LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_USART2);
+
+ LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOA);
+ /**USART2 GPIO Configuration
+ PA1 ------> USART2_DE
+ PA2 ------> USART2_TX
+ PA3 ------> USART2_RX
+ */
+ GPIO_InitStruct.Pin = LL_GPIO_PIN_1;
+ GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
+ GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_VERY_HIGH;
+ GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
+ GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
+ GPIO_InitStruct.Alternate = LL_GPIO_AF_4;
+ LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+
+ GPIO_InitStruct.Pin = LL_GPIO_PIN_2;
+ GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
+ GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_VERY_HIGH;
+ GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
+ GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
+ GPIO_InitStruct.Alternate = LL_GPIO_AF_4;
+ LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+
+ GPIO_InitStruct.Pin = LL_GPIO_PIN_3;
+ GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
+ GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_VERY_HIGH;
+ GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
+ GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
+ GPIO_InitStruct.Alternate = LL_GPIO_AF_4;
+ LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+
+ /* USART2 interrupt Init */
+ NVIC_SetPriority(USART2_IRQn, 0);
+ NVIC_EnableIRQ(USART2_IRQn);
+
+ /* USER CODE BEGIN USART2_Init 1 */
+
+ /* USER CODE END USART2_Init 1 */
+ USART_InitStruct.BaudRate = config_baudrates[sensor_config.baudrate_index];
+ USART_InitStruct.DataWidth = LL_USART_DATAWIDTH_9B;
+ USART_InitStruct.StopBits = LL_USART_STOPBITS_1;
+ USART_InitStruct.Parity = LL_USART_PARITY_EVEN;
+ USART_InitStruct.TransferDirection = LL_USART_DIRECTION_TX_RX;
+ USART_InitStruct.HardwareFlowControl = LL_USART_HWCONTROL_NONE;
+ USART_InitStruct.OverSampling = LL_USART_OVERSAMPLING_16;
+ LL_USART_Init(USART2, &USART_InitStruct);
+ LL_USART_EnableDEMode(USART2);
+ LL_USART_SetDESignalPolarity(USART2, LL_USART_DE_POLARITY_HIGH);
+ LL_USART_SetDEAssertionTime(USART2, 0);
+ LL_USART_SetDEDeassertionTime(USART2, 0);
+ LL_USART_ConfigAsyncMode(USART2);
+ LL_USART_Enable(USART2);
+ /* USER CODE BEGIN USART2_Init 2 */
+
+ /* Enable IDLE Interrupt */
+ LL_USART_EnableIT_IDLE(USART2);
+
+ /* Enable RX Not Empty Interrupt */
+ LL_USART_EnableIT_RXNE(USART2);
+
+ LL_USART_EnableDirectionRx(USART2);
+ LL_USART_EnableDirectionTx(USART2);
+ LL_USART_Enable(USART2);
+ /* USER CODE END USART2_Init 2 */
+
+}
+
/**
* @brief GPIO Initialization Function
* @param None
@@ -601,13 +600,13 @@ static void MX_GPIO_Init(void)
LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOA);
/**/
- LL_GPIO_SetOutputPin(LED_B_GPIO_Port, LED_B_Pin);
+ LL_GPIO_ResetOutputPin(LED_B_GPIO_Port, LED_B_Pin);
/**/
- LL_GPIO_SetOutputPin(LED_G_GPIO_Port, LED_G_Pin);
+ LL_GPIO_ResetOutputPin(LED_G_GPIO_Port, LED_G_Pin);
/**/
- LL_GPIO_SetOutputPin(LED_R_GPIO_Port, LED_R_Pin);
+ LL_GPIO_ResetOutputPin(LED_R_GPIO_Port, LED_R_Pin);
/**/
GPIO_InitStruct.Pin = LED_B_Pin;
@@ -636,31 +635,31 @@ static void MX_GPIO_Init(void)
}
/* USER CODE BEGIN 4 */
-void LPUART1_TX_Buffer(uint8_t* buffer_tx, uint16_t buffer_tx_len)
+void USART2_TX_Buffer(uint8_t* buffer_tx, uint16_t buffer_tx_len)
{
__disable_irq();
for (uint16_t i = 0; i < buffer_tx_len; i++)
{
- LL_LPUART_TransmitData9(LPUART1, buffer_tx[i]);
- while (!LL_LPUART_IsActiveFlag_TXE(LPUART1));
+ LL_USART_TransmitData9(USART2, buffer_tx[i]);
+ while (!LL_USART_IsActiveFlag_TXE(USART2));
}
__enable_irq();
}
int8_t uart_disable_interrupts(void)
{
- LL_LPUART_Disable(LPUART1);
- LL_LPUART_DisableIT_IDLE(LPUART1);
- LL_LPUART_EnableIT_RXNE(LPUART1);
+ LL_USART_Disable(USART2);
+ LL_USART_DisableIT_IDLE(USART2);
+ LL_USART_EnableIT_RXNE(USART2);
return 0;
}
int8_t uart_enable_interrupts(void)
{
- LL_LPUART_Enable(LPUART1);
- LL_LPUART_EnableIT_IDLE(LPUART1);
- LL_LPUART_EnableIT_RXNE(LPUART1);
+ LL_USART_Enable(USART2);
+ LL_USART_EnableIT_IDLE(USART2);
+ LL_USART_EnableIT_RXNE(USART2);
return 0;
}
@@ -787,7 +786,7 @@ int8_t modbus_slave_callback(modbus_transaction_t *transaction)
int8_t modbus_transmit_function(uint8_t *buffer, uint16_t data_len)
{
/* TODO */
- LPUART1_TX_Buffer(buffer, data_len);
+ USART2_TX_Buffer(buffer, data_len);
return MODBUS_OK;
}
/* USER CODE END 4 */
diff --git a/fw/Core/Src/stm32l0xx_it.c b/fw/Core/Src/stm32l0xx_it.c
index 504a5a5..5eb65f3 100644
--- a/fw/Core/Src/stm32l0xx_it.c
+++ b/fw/Core/Src/stm32l0xx_it.c
@@ -43,17 +43,17 @@
/* Private variables ---------------------------------------------------------*/
/* USER CODE BEGIN PV */
-uint16_t lpuart1_rx_message_index = 0;
-uint16_t lpuart1_rx_message_len = 0;
-uint8_t lpuart1_rx_done = 0;
-uint8_t lpuart1_rx_message_too_long = 0;
+uint16_t usart2_rx_message_index = 0;
+uint16_t usart2_rx_message_len = 0;
+uint8_t usart2_rx_done = 0;
+uint8_t usart2_rx_message_too_long = 0;
uint8_t tim21_elapsed_period = 0;
/* USER CODE END PV */
/* Private function prototypes -----------------------------------------------*/
/* USER CODE BEGIN PFP */
-void LPUART1_CharReception_Callback( void );
+void USART2_CharReception_Callback( void );
/* USER CODE END PFP */
/* Private user code ---------------------------------------------------------*/
@@ -71,7 +71,7 @@ void LPUART1_CharReception_Callback( void );
/* Cortex-M0+ Processor Interruption and Exception Handlers */
/******************************************************************************/
/**
- * @brief This function handles Non maskable interrupt.
+ * @brief This function handles Non maskable Interrupt.
*/
void NMI_Handler(void)
{
@@ -154,7 +154,6 @@ void TIM21_IRQHandler(void)
/* USER CODE BEGIN TIM21_IRQn 0 */
LL_TIM_ClearFlag_UPDATE(TIM21);
tim21_elapsed_period = 1;
-
/* USER CODE END TIM21_IRQn 0 */
/* USER CODE BEGIN TIM21_IRQn 1 */
@@ -162,47 +161,47 @@ void TIM21_IRQHandler(void)
}
/**
- * @brief This function handles LPUART1 global interrupt / LPUART1 wake-up interrupt through EXTI line 28.
+ * @brief This function handles USART2 global interrupt / USART2 wake-up interrupt through EXTI line 26.
*/
-void LPUART1_IRQHandler(void)
+void USART2_IRQHandler(void)
{
- /* USER CODE BEGIN LPUART1_IRQn 0 */
+ /* USER CODE BEGIN USART2_IRQn 0 */
/* Check RXNE flag value in SR register */
- if(LL_LPUART_IsActiveFlag_RXNE(LPUART1) && LL_LPUART_IsEnabledIT_RXNE(LPUART1))
+ if(LL_USART_IsActiveFlag_RXNE(USART2) && LL_USART_IsEnabledIT_RXNE(USART2))
{
/* RXNE flag will be cleared by reading of DR register (done in call) */
/* Call function in charge of handling Character reception */
- LPUART1_CharReception_Callback();
+ USART2_CharReception_Callback();
}
- /* USER CODE END LPUART1_IRQn 0 */
- /* USER CODE BEGIN LPUART1_IRQn 1 */
+ /* USER CODE END USART2_IRQn 0 */
+ /* USER CODE BEGIN USART2_IRQn 1 */
/* If the IDLE flag is active */
- if (LL_LPUART_IsActiveFlag_IDLE(LPUART1) && LL_LPUART_IsEnabledIT_IDLE(LPUART1))
+ if (LL_USART_IsActiveFlag_IDLE(USART2) && LL_USART_IsEnabledIT_IDLE(USART2))
{
/* Clear the IDLE flag */
- LL_LPUART_ClearFlag_IDLE(LPUART1);
+ LL_USART_ClearFlag_IDLE(USART2);
/* Reset the buffer index */
- lpuart1_rx_message_len = lpuart1_rx_message_index;
- lpuart1_rx_message_index = 0;
- lpuart1_rx_done = 1;
- if (lpuart1_rx_message_len > MODBUS_MAX_RTU_FRAME_SIZE)
+ usart2_rx_message_len = usart2_rx_message_index;
+ usart2_rx_message_index = 0;
+ usart2_rx_done = 1;
+ if (usart2_rx_message_len > MODBUS_MAX_RTU_FRAME_SIZE)
{
- lpuart1_rx_message_too_long = 1;
+ usart2_rx_message_too_long = 1;
}
}
- /* USER CODE END LPUART1_IRQn 1 */
+ /* USER CODE END USART2_IRQn 1 */
}
/* USER CODE BEGIN 1 */
-void LPUART1_CharReception_Callback( void )
+void USART2_CharReception_Callback( void )
{
- uint16_t lpuart1_rx_bit = LL_LPUART_ReceiveData9(LPUART1);
- if (lpuart1_rx_message_index < MODBUS_MAX_RTU_FRAME_SIZE)
+ uint16_t usart2_rx_bit = LL_USART_ReceiveData9(USART2);
+ if (usart2_rx_message_index < MODBUS_MAX_RTU_FRAME_SIZE)
{
- modbus_buffer[lpuart1_rx_message_index] = (uint8_t)lpuart1_rx_bit;
+ modbus_buffer[usart2_rx_message_index] = (uint8_t)usart2_rx_bit;
}
- lpuart1_rx_message_index++;
+ usart2_rx_message_index++;
}
/* USER CODE END 1 */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/fw/Core/Startup/startup_stm32l031g6ux.s b/fw/Core/Startup/startup_stm32l031g6ux.s
new file mode 100644
index 0000000..62608af
--- /dev/null
+++ b/fw/Core/Startup/startup_stm32l031g6ux.s
@@ -0,0 +1,261 @@
+/**
+ ******************************************************************************
+ * @file startup_stm32l031xx.s
+ * @author MCD Application Team
+ * @brief STM32L031xx Devices vector table for GCC toolchain.
+ * This module performs:
+ * - Set the initial SP
+ * - Set the initial PC == Reset_Handler,
+ * - Set the vector table entries with the exceptions ISR address
+ * - Branches to main in the C library (which eventually
+ * calls main()).
+ * After Reset the Cortex-M0+ processor is in Thread mode,
+ * priority is Privileged, and the Stack is set to Main.
+ ******************************************************************************
+ * @attention
+ *
+ *
© Copyright (c) 2016 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software component is licensed by ST under BSD 3-Clause license,
+ * the "License"; You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ * opensource.org/licenses/BSD-3-Clause
+ *
+ ******************************************************************************
+ */
+
+ .syntax unified
+ .cpu cortex-m0plus
+ .fpu softvfp
+ .thumb
+
+.global g_pfnVectors
+.global Default_Handler
+
+/* start address for the initialization values of the .data section.
+defined in linker script */
+.word _sidata
+/* start address for the .data section. defined in linker script */
+.word _sdata
+/* end address for the .data section. defined in linker script */
+.word _edata
+/* start address for the .bss section. defined in linker script */
+.word _sbss
+/* end address for the .bss section. defined in linker script */
+.word _ebss
+
+ .section .text.Reset_Handler
+ .weak Reset_Handler
+ .type Reset_Handler, %function
+Reset_Handler:
+ ldr r0, =_estack
+ mov sp, r0 /* set stack pointer */
+
+/* Copy the data segment initializers from flash to SRAM */
+ ldr r0, =_sdata
+ ldr r1, =_edata
+ ldr r2, =_sidata
+ movs r3, #0
+ b LoopCopyDataInit
+
+CopyDataInit:
+ ldr r4, [r2, r3]
+ str r4, [r0, r3]
+ adds r3, r3, #4
+
+LoopCopyDataInit:
+ adds r4, r0, r3
+ cmp r4, r1
+ bcc CopyDataInit
+
+/* Zero fill the bss segment. */
+ ldr r2, =_sbss
+ ldr r4, =_ebss
+ movs r3, #0
+ b LoopFillZerobss
+
+FillZerobss:
+ str r3, [r2]
+ adds r2, r2, #4
+
+LoopFillZerobss:
+ cmp r2, r4
+ bcc FillZerobss
+
+/* Call the clock system intitialization function.*/
+ bl SystemInit
+/* Call static constructors */
+ bl __libc_init_array
+/* Call the application's entry point.*/
+ bl main
+
+LoopForever:
+ b LoopForever
+
+
+.size Reset_Handler, .-Reset_Handler
+
+/**
+ * @brief This is the code that gets called when the processor receives an
+ * unexpected interrupt. This simply enters an infinite loop, preserving
+ * the system state for examination by a debugger.
+ *
+ * @param None
+ * @retval : None
+*/
+ .section .text.Default_Handler,"ax",%progbits
+Default_Handler:
+Infinite_Loop:
+ b Infinite_Loop
+ .size Default_Handler, .-Default_Handler
+/******************************************************************************
+*
+* The minimal vector table for a Cortex M0. Note that the proper constructs
+* must be placed on this to ensure that it ends up at physical address
+* 0x0000.0000.
+*
+******************************************************************************/
+ .section .isr_vector,"a",%progbits
+ .type g_pfnVectors, %object
+ .size g_pfnVectors, .-g_pfnVectors
+
+
+g_pfnVectors:
+ .word _estack
+ .word Reset_Handler
+ .word NMI_Handler
+ .word HardFault_Handler
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word 0
+ .word SVC_Handler
+ .word 0
+ .word 0
+ .word PendSV_Handler
+ .word SysTick_Handler
+ .word WWDG_IRQHandler /* Window WatchDog */
+ .word PVD_IRQHandler /* PVD through EXTI Line detection */
+ .word RTC_IRQHandler /* RTC through the EXTI line */
+ .word FLASH_IRQHandler /* FLASH */
+ .word RCC_IRQHandler /* RCC */
+ .word EXTI0_1_IRQHandler /* EXTI Line 0 and 1 */
+ .word EXTI2_3_IRQHandler /* EXTI Line 2 and 3 */
+ .word EXTI4_15_IRQHandler /* EXTI Line 4 to 15 */
+ .word 0 /* Reserved */
+ .word DMA1_Channel1_IRQHandler /* DMA1 Channel 1 */
+ .word DMA1_Channel2_3_IRQHandler /* DMA1 Channel 2 and Channel 3 */
+ .word DMA1_Channel4_5_6_7_IRQHandler /* DMA1 Channel 4, Channel 5, Channel 6 and Channel 7*/
+ .word ADC1_COMP_IRQHandler /* ADC1, COMP1 and COMP2 */
+ .word LPTIM1_IRQHandler /* LPTIM1 */
+ .word 0 /* Reserved */
+ .word TIM2_IRQHandler /* TIM2 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word TIM21_IRQHandler /* TIM21 */
+ .word 0 /* Reserved */
+ .word TIM22_IRQHandler /* TIM22 */
+ .word I2C1_IRQHandler /* I2C1 */
+ .word 0 /* Reserved */
+ .word SPI1_IRQHandler /* SPI1 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+ .word USART2_IRQHandler /* USART2 */
+ .word LPUART1_IRQHandler /* LPUART1 */
+ .word 0 /* Reserved */
+ .word 0 /* Reserved */
+
+/*******************************************************************************
+*
+* Provide weak aliases for each Exception handler to the Default_Handler.
+* As they are weak aliases, any function with the same name will override
+* this definition.
+*
+*******************************************************************************/
+
+ .weak NMI_Handler
+ .thumb_set NMI_Handler,Default_Handler
+
+ .weak HardFault_Handler
+ .thumb_set HardFault_Handler,Default_Handler
+
+ .weak SVC_Handler
+ .thumb_set SVC_Handler,Default_Handler
+
+ .weak PendSV_Handler
+ .thumb_set PendSV_Handler,Default_Handler
+
+ .weak SysTick_Handler
+ .thumb_set SysTick_Handler,Default_Handler
+
+ .weak WWDG_IRQHandler
+ .thumb_set WWDG_IRQHandler,Default_Handler
+
+ .weak PVD_IRQHandler
+ .thumb_set PVD_IRQHandler,Default_Handler
+
+ .weak RTC_IRQHandler
+ .thumb_set RTC_IRQHandler,Default_Handler
+
+ .weak FLASH_IRQHandler
+ .thumb_set FLASH_IRQHandler,Default_Handler
+
+ .weak RCC_IRQHandler
+ .thumb_set RCC_IRQHandler,Default_Handler
+
+ .weak EXTI0_1_IRQHandler
+ .thumb_set EXTI0_1_IRQHandler,Default_Handler
+
+ .weak EXTI2_3_IRQHandler
+ .thumb_set EXTI2_3_IRQHandler,Default_Handler
+
+ .weak EXTI4_15_IRQHandler
+ .thumb_set EXTI4_15_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel1_IRQHandler
+ .thumb_set DMA1_Channel1_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel2_3_IRQHandler
+ .thumb_set DMA1_Channel2_3_IRQHandler,Default_Handler
+
+ .weak DMA1_Channel4_5_6_7_IRQHandler
+ .thumb_set DMA1_Channel4_5_6_7_IRQHandler,Default_Handler
+
+ .weak ADC1_COMP_IRQHandler
+ .thumb_set ADC1_COMP_IRQHandler,Default_Handler
+
+ .weak LPTIM1_IRQHandler
+ .thumb_set LPTIM1_IRQHandler,Default_Handler
+
+ .weak TIM2_IRQHandler
+ .thumb_set TIM2_IRQHandler,Default_Handler
+
+ .weak TIM21_IRQHandler
+ .thumb_set TIM21_IRQHandler,Default_Handler
+
+ .weak TIM22_IRQHandler
+ .thumb_set TIM22_IRQHandler,Default_Handler
+
+ .weak I2C1_IRQHandler
+ .thumb_set I2C1_IRQHandler,Default_Handler
+
+ .weak SPI1_IRQHandler
+ .thumb_set SPI1_IRQHandler,Default_Handler
+
+ .weak USART2_IRQHandler
+ .thumb_set USART2_IRQHandler,Default_Handler
+
+ .weak LPUART1_IRQHandler
+ .thumb_set LPUART1_IRQHandler,Default_Handler
+
+
+
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
+
diff --git a/fw/Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l031xx.h b/fw/Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l031xx.h
new file mode 100644
index 0000000..9ee7ac8
--- /dev/null
+++ b/fw/Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l031xx.h
@@ -0,0 +1,6094 @@
+/**
+ ******************************************************************************
+ * @file stm32l031xx.h
+ * @author MCD Application Team
+ * @brief CMSIS Cortex-M0+ Device Peripheral Access Layer Header File.
+ * This file contains all the peripheral register's definitions, bits
+ * definitions and memory mapping for stm32l031xx devices.
+ *
+ * This file contains:
+ * - Data structures and the address mapping for all peripherals
+ * - Peripheral's registers declarations and bits definition
+ * - Macros to access peripheral's registers hardware
+ *
+ ******************************************************************************
+ * @attention
+ *
+ * © Copyright(c) 2016 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software component is licensed by ST under BSD 3-Clause license,
+ * the "License"; You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ * opensource.org/licenses/BSD-3-Clause
+ *
+ ******************************************************************************
+ */
+
+/** @addtogroup CMSIS
+ * @{
+ */
+
+/** @addtogroup stm32l031xx
+ * @{
+ */
+
+#ifndef __STM32L031xx_H
+#define __STM32L031xx_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+
+/** @addtogroup Configuration_section_for_CMSIS
+ * @{
+ */
+/**
+ * @brief Configuration of the Cortex-M0+ Processor and Core Peripherals
+ */
+#define __CM0PLUS_REV 0U /*!< Core Revision r0p0 */
+#define __MPU_PRESENT 0U /*!< STM32L0xx provides no MPU */
+#define __VTOR_PRESENT 1U /*!< Vector Table Register supported */
+#define __NVIC_PRIO_BITS 2U /*!< STM32L0xx uses 2 Bits for the Priority Levels */
+#define __Vendor_SysTickConfig 0U /*!< Set to 1 if different SysTick Config is used */
+
+/**
+ * @}
+ */
+
+/** @addtogroup Peripheral_interrupt_number_definition
+ * @{
+ */
+
+/**
+ * @brief stm32l031xx Interrupt Number Definition, according to the selected device
+ * in @ref Library_configuration_section
+ */
+
+/*!< Interrupt Number Definition */
+typedef enum
+{
+/****** Cortex-M0 Processor Exceptions Numbers ******************************************************/
+ NonMaskableInt_IRQn = -14, /*!< 2 Non Maskable Interrupt */
+ HardFault_IRQn = -13, /*!< 3 Cortex-M0+ Hard Fault Interrupt */
+ SVC_IRQn = -5, /*!< 11 Cortex-M0+ SV Call Interrupt */
+ PendSV_IRQn = -2, /*!< 14 Cortex-M0+ Pend SV Interrupt */
+ SysTick_IRQn = -1, /*!< 15 Cortex-M0+ System Tick Interrupt */
+
+/****** STM32L-0 specific Interrupt Numbers *********************************************************/
+ WWDG_IRQn = 0, /*!< Window WatchDog Interrupt */
+ PVD_IRQn = 1, /*!< PVD through EXTI Line detect Interrupt */
+ RTC_IRQn = 2, /*!< RTC through EXTI Line Interrupt */
+ FLASH_IRQn = 3, /*!< FLASH Interrupt */
+ RCC_IRQn = 4, /*!< RCC Interrupt */
+ EXTI0_1_IRQn = 5, /*!< EXTI Line 0 and 1 Interrupts */
+ EXTI2_3_IRQn = 6, /*!< EXTI Line 2 and 3 Interrupts */
+ EXTI4_15_IRQn = 7, /*!< EXTI Line 4 to 15 Interrupts */
+ DMA1_Channel1_IRQn = 9, /*!< DMA1 Channel 1 Interrupt */
+ DMA1_Channel2_3_IRQn = 10, /*!< DMA1 Channel 2 and Channel 3 Interrupts */
+ DMA1_Channel4_5_6_7_IRQn = 11, /*!< DMA1 Channel 4, Channel 5, Channel 6 and Channel 7 Interrupts */
+ ADC1_COMP_IRQn = 12, /*!< ADC1, COMP1 and COMP2 Interrupts */
+ LPTIM1_IRQn = 13, /*!< LPTIM1 Interrupt */
+ TIM2_IRQn = 15, /*!< TIM2 Interrupt */
+ TIM21_IRQn = 20, /*!< TIM21 Interrupt */
+ TIM22_IRQn = 22, /*!< TIM22 Interrupt */
+ I2C1_IRQn = 23, /*!< I2C1 Interrupt */
+ SPI1_IRQn = 25, /*!< SPI1 Interrupt */
+ USART2_IRQn = 28, /*!< USART2 Interrupt */
+ LPUART1_IRQn = 29, /*!< LPUART1 Interrupt */
+} IRQn_Type;
+
+/**
+ * @}
+ */
+
+#include "core_cm0plus.h"
+#include "system_stm32l0xx.h"
+#include
+
+/** @addtogroup Peripheral_registers_structures
+ * @{
+ */
+
+/**
+ * @brief Analog to Digital Converter
+ */
+
+typedef struct
+{
+ __IO uint32_t ISR; /*!< ADC Interrupt and Status register, Address offset:0x00 */
+ __IO uint32_t IER; /*!< ADC Interrupt Enable register, Address offset:0x04 */
+ __IO uint32_t CR; /*!< ADC Control register, Address offset:0x08 */
+ __IO uint32_t CFGR1; /*!< ADC Configuration register 1, Address offset:0x0C */
+ __IO uint32_t CFGR2; /*!< ADC Configuration register 2, Address offset:0x10 */
+ __IO uint32_t SMPR; /*!< ADC Sampling time register, Address offset:0x14 */
+ uint32_t RESERVED1; /*!< Reserved, 0x18 */
+ uint32_t RESERVED2; /*!< Reserved, 0x1C */
+ __IO uint32_t TR; /*!< ADC watchdog threshold register, Address offset:0x20 */
+ uint32_t RESERVED3; /*!< Reserved, 0x24 */
+ __IO uint32_t CHSELR; /*!< ADC channel selection register, Address offset:0x28 */
+ uint32_t RESERVED4[5]; /*!< Reserved, 0x2C */
+ __IO uint32_t DR; /*!< ADC data register, Address offset:0x40 */
+ uint32_t RESERVED5[28]; /*!< Reserved, 0x44 - 0xB0 */
+ __IO uint32_t CALFACT; /*!< ADC data register, Address offset:0xB4 */
+} ADC_TypeDef;
+
+typedef struct
+{
+ __IO uint32_t CCR;
+} ADC_Common_TypeDef;
+
+
+/**
+ * @brief Comparator
+ */
+
+typedef struct
+{
+ __IO uint32_t CSR; /*!< COMP comparator control and status register, Address offset: 0x18 */
+} COMP_TypeDef;
+
+typedef struct
+{
+ __IO uint32_t CSR; /*!< COMP control and status register, used for bits common to several COMP instances, Address offset: 0x00 */
+} COMP_Common_TypeDef;
+
+
+/**
+* @brief CRC calculation unit
+*/
+
+typedef struct
+{
+__IO uint32_t DR; /*!< CRC Data register, Address offset: 0x00 */
+__IO uint8_t IDR; /*!< CRC Independent data register, Address offset: 0x04 */
+uint8_t RESERVED0; /*!< Reserved, 0x05 */
+uint16_t RESERVED1; /*!< Reserved, 0x06 */
+__IO uint32_t CR; /*!< CRC Control register, Address offset: 0x08 */
+uint32_t RESERVED2; /*!< Reserved, 0x0C */
+__IO uint32_t INIT; /*!< Initial CRC value register, Address offset: 0x10 */
+__IO uint32_t POL; /*!< CRC polynomial register, Address offset: 0x14 */
+} CRC_TypeDef;
+
+/**
+ * @brief Debug MCU
+ */
+
+typedef struct
+{
+ __IO uint32_t IDCODE; /*!< MCU device ID code, Address offset: 0x00 */
+ __IO uint32_t CR; /*!< Debug MCU configuration register, Address offset: 0x04 */
+ __IO uint32_t APB1FZ; /*!< Debug MCU APB1 freeze register, Address offset: 0x08 */
+ __IO uint32_t APB2FZ; /*!< Debug MCU APB2 freeze register, Address offset: 0x0C */
+}DBGMCU_TypeDef;
+
+/**
+ * @brief DMA Controller
+ */
+
+typedef struct
+{
+ __IO uint32_t CCR; /*!< DMA channel x configuration register */
+ __IO uint32_t CNDTR; /*!< DMA channel x number of data register */
+ __IO uint32_t CPAR; /*!< DMA channel x peripheral address register */
+ __IO uint32_t CMAR; /*!< DMA channel x memory address register */
+} DMA_Channel_TypeDef;
+
+typedef struct
+{
+ __IO uint32_t ISR; /*!< DMA interrupt status register, Address offset: 0x00 */
+ __IO uint32_t IFCR; /*!< DMA interrupt flag clear register, Address offset: 0x04 */
+} DMA_TypeDef;
+
+typedef struct
+{
+ __IO uint32_t CSELR; /*!< DMA channel selection register, Address offset: 0xA8 */
+} DMA_Request_TypeDef;
+
+/**
+ * @brief External Interrupt/Event Controller
+ */
+
+typedef struct
+{
+ __IO uint32_t IMR; /*!TIMEOUTR, (I2C_TIMEOUTR_TIMOUTEN | I2C_TIMEOUTR_TEXTEN)) == (ClockTimeout)) ? 1UL : 0UL);
+ return ((READ_BIT(I2Cx->TIMEOUTR, (I2C_TIMEOUTR_TIMOUTEN | I2C_TIMEOUTR_TEXTEN)) == \
+ (ClockTimeout)) ? 1UL : 0UL);
}
/**
@@ -1443,7 +1485,7 @@ __STATIC_INLINE uint32_t LL_I2C_IsEnabledIT_TC(I2C_TypeDef *I2Cx)
/**
* @brief Enable Error interrupts.
- * @note Macro IS_SMBUS_INSTANCE(I2Cx) can be used to check whether or not
+ * @note The macro IS_SMBUS_INSTANCE(I2Cx) can be used to check whether or not
* SMBus feature is supported by the I2Cx Instance.
* @note Any of these errors will generate interrupt :
* Arbitration Loss (ARLO)
@@ -1463,7 +1505,7 @@ __STATIC_INLINE void LL_I2C_EnableIT_ERR(I2C_TypeDef *I2Cx)
/**
* @brief Disable Error interrupts.
- * @note Macro IS_SMBUS_INSTANCE(I2Cx) can be used to check whether or not
+ * @note The macro IS_SMBUS_INSTANCE(I2Cx) can be used to check whether or not
* SMBus feature is supported by the I2Cx Instance.
* @note Any of these errors will generate interrupt :
* Arbitration Loss (ARLO)
@@ -1645,7 +1687,7 @@ __STATIC_INLINE uint32_t LL_I2C_IsActiveFlag_OVR(I2C_TypeDef *I2Cx)
/**
* @brief Indicate the status of SMBus PEC error flag in reception.
- * @note Macro IS_SMBUS_INSTANCE(I2Cx) can be used to check whether or not
+ * @note The macro IS_SMBUS_INSTANCE(I2Cx) can be used to check whether or not
* SMBus feature is supported by the I2Cx Instance.
* @note RESET: Clear default value.
* SET: When the received PEC does not match with the PEC register content.
@@ -1660,7 +1702,7 @@ __STATIC_INLINE uint32_t LL_I2C_IsActiveSMBusFlag_PECERR(I2C_TypeDef *I2Cx)
/**
* @brief Indicate the status of SMBus Timeout detection flag.
- * @note Macro IS_SMBUS_INSTANCE(I2Cx) can be used to check whether or not
+ * @note The macro IS_SMBUS_INSTANCE(I2Cx) can be used to check whether or not
* SMBus feature is supported by the I2Cx Instance.
* @note RESET: Clear default value.
* SET: When a timeout or extended clock timeout occurs.
@@ -1675,7 +1717,7 @@ __STATIC_INLINE uint32_t LL_I2C_IsActiveSMBusFlag_TIMEOUT(I2C_TypeDef *I2Cx)
/**
* @brief Indicate the status of SMBus alert flag.
- * @note Macro IS_SMBUS_INSTANCE(I2Cx) can be used to check whether or not
+ * @note The macro IS_SMBUS_INSTANCE(I2Cx) can be used to check whether or not
* SMBus feature is supported by the I2Cx Instance.
* @note RESET: Clear default value.
* SET: When SMBus host configuration, SMBus alert enabled and
@@ -1782,7 +1824,7 @@ __STATIC_INLINE void LL_I2C_ClearFlag_OVR(I2C_TypeDef *I2Cx)
/**
* @brief Clear SMBus PEC error flag.
- * @note Macro IS_SMBUS_INSTANCE(I2Cx) can be used to check whether or not
+ * @note The macro IS_SMBUS_INSTANCE(I2Cx) can be used to check whether or not
* SMBus feature is supported by the I2Cx Instance.
* @rmtoll ICR PECCF LL_I2C_ClearSMBusFlag_PECERR
* @param I2Cx I2C Instance.
@@ -1795,7 +1837,7 @@ __STATIC_INLINE void LL_I2C_ClearSMBusFlag_PECERR(I2C_TypeDef *I2Cx)
/**
* @brief Clear SMBus Timeout detection flag.
- * @note Macro IS_SMBUS_INSTANCE(I2Cx) can be used to check whether or not
+ * @note The macro IS_SMBUS_INSTANCE(I2Cx) can be used to check whether or not
* SMBus feature is supported by the I2Cx Instance.
* @rmtoll ICR TIMOUTCF LL_I2C_ClearSMBusFlag_TIMEOUT
* @param I2Cx I2C Instance.
@@ -1808,7 +1850,7 @@ __STATIC_INLINE void LL_I2C_ClearSMBusFlag_TIMEOUT(I2C_TypeDef *I2Cx)
/**
* @brief Clear SMBus Alert flag.
- * @note Macro IS_SMBUS_INSTANCE(I2Cx) can be used to check whether or not
+ * @note The macro IS_SMBUS_INSTANCE(I2Cx) can be used to check whether or not
* SMBus feature is supported by the I2Cx Instance.
* @rmtoll ICR ALERTCF LL_I2C_ClearSMBusFlag_ALERT
* @param I2Cx I2C Instance.
@@ -1923,7 +1965,8 @@ __STATIC_INLINE uint32_t LL_I2C_GetTransferSize(I2C_TypeDef *I2Cx)
}
/**
- * @brief Prepare the generation of a ACKnowledge or Non ACKnowledge condition after the address receive match code or next received byte.
+ * @brief Prepare the generation of a ACKnowledge or Non ACKnowledge condition after the address receive match code
+ or next received byte.
* @note Usage in Slave mode only.
* @rmtoll CR2 NACK LL_I2C_AcknowledgeNextData
* @param I2Cx I2C Instance.
@@ -1964,7 +2007,8 @@ __STATIC_INLINE void LL_I2C_GenerateStopCondition(I2C_TypeDef *I2Cx)
/**
* @brief Enable automatic RESTART Read request condition for 10bit address header (master mode).
* @note The master sends the complete 10bit slave address read sequence :
- * Start + 2 bytes 10bit address in Write direction + Restart + first 7 bits of 10bit address in Read direction.
+ * Start + 2 bytes 10bit address in Write direction + Restart + first 7 bits of 10bit address
+ in Read direction.
* @rmtoll CR2 HEAD10R LL_I2C_EnableAuto10BitRead
* @param I2Cx I2C Instance.
* @retval None
@@ -2125,9 +2169,10 @@ __STATIC_INLINE uint32_t LL_I2C_GetAddressMatchCode(I2C_TypeDef *I2Cx)
/**
* @brief Enable internal comparison of the SMBus Packet Error byte (transmission or reception mode).
- * @note Macro IS_SMBUS_INSTANCE(I2Cx) can be used to check whether or not
+ * @note The macro IS_SMBUS_INSTANCE(I2Cx) can be used to check whether or not
* SMBus feature is supported by the I2Cx Instance.
- * @note This feature is cleared by hardware when the PEC byte is transferred, or when a STOP condition or an Address Matched is received.
+ * @note This feature is cleared by hardware when the PEC byte is transferred, or when a STOP condition
+ or an Address Matched is received.
* This bit has no effect when RELOAD bit is set.
* This bit has no effect in device mode when SBC bit is not set.
* @rmtoll CR2 PECBYTE LL_I2C_EnableSMBusPECCompare
@@ -2141,7 +2186,7 @@ __STATIC_INLINE void LL_I2C_EnableSMBusPECCompare(I2C_TypeDef *I2Cx)
/**
* @brief Check if the SMBus Packet Error byte internal comparison is requested or not.
- * @note Macro IS_SMBUS_INSTANCE(I2Cx) can be used to check whether or not
+ * @note The macro IS_SMBUS_INSTANCE(I2Cx) can be used to check whether or not
* SMBus feature is supported by the I2Cx Instance.
* @rmtoll CR2 PECBYTE LL_I2C_IsEnabledSMBusPECCompare
* @param I2Cx I2C Instance.
@@ -2154,7 +2199,7 @@ __STATIC_INLINE uint32_t LL_I2C_IsEnabledSMBusPECCompare(I2C_TypeDef *I2Cx)
/**
* @brief Get the SMBus Packet Error byte calculated.
- * @note Macro IS_SMBUS_INSTANCE(I2Cx) can be used to check whether or not
+ * @note The macro IS_SMBUS_INSTANCE(I2Cx) can be used to check whether or not
* SMBus feature is supported by the I2Cx Instance.
* @rmtoll PECR PEC LL_I2C_GetSMBusPEC
* @param I2Cx I2C Instance.
diff --git a/fw/Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_tim.h b/fw/Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_tim.h
index 74d4271..1c4e241 100644
--- a/fw/Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_tim.h
+++ b/fw/Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_tim.h
@@ -150,24 +150,29 @@ typedef struct
uint16_t Prescaler; /*!< Specifies the prescaler value used to divide the TIM clock.
This parameter can be a number between Min_Data=0x0000 and Max_Data=0xFFFF.
- This feature can be modified afterwards using unitary function @ref LL_TIM_SetPrescaler().*/
+ This feature can be modified afterwards using unitary function
+ @ref LL_TIM_SetPrescaler().*/
uint32_t CounterMode; /*!< Specifies the counter mode.
This parameter can be a value of @ref TIM_LL_EC_COUNTERMODE.
- This feature can be modified afterwards using unitary function @ref LL_TIM_SetCounterMode().*/
+ This feature can be modified afterwards using unitary function
+ @ref LL_TIM_SetCounterMode().*/
uint32_t Autoreload; /*!< Specifies the auto reload value to be loaded into the active
Auto-Reload Register at the next update event.
This parameter must be a number between Min_Data=0x0000 and Max_Data=0xFFFF.
- Some timer instances may support 32 bits counters. In that case this parameter must be a number between 0x0000 and 0xFFFFFFFF.
+ Some timer instances may support 32 bits counters. In that case this parameter must
+ be a number between 0x0000 and 0xFFFFFFFF.
- This feature can be modified afterwards using unitary function @ref LL_TIM_SetAutoReload().*/
+ This feature can be modified afterwards using unitary function
+ @ref LL_TIM_SetAutoReload().*/
uint32_t ClockDivision; /*!< Specifies the clock division.
This parameter can be a value of @ref TIM_LL_EC_CLOCKDIVISION.
- This feature can be modified afterwards using unitary function @ref LL_TIM_SetClockDivision().*/
+ This feature can be modified afterwards using unitary function
+ @ref LL_TIM_SetClockDivision().*/
} LL_TIM_InitTypeDef;
/**
@@ -178,22 +183,26 @@ typedef struct
uint32_t OCMode; /*!< Specifies the output mode.
This parameter can be a value of @ref TIM_LL_EC_OCMODE.
- This feature can be modified afterwards using unitary function @ref LL_TIM_OC_SetMode().*/
+ This feature can be modified afterwards using unitary function
+ @ref LL_TIM_OC_SetMode().*/
uint32_t OCState; /*!< Specifies the TIM Output Compare state.
This parameter can be a value of @ref TIM_LL_EC_OCSTATE.
- This feature can be modified afterwards using unitary functions @ref LL_TIM_CC_EnableChannel() or @ref LL_TIM_CC_DisableChannel().*/
+ This feature can be modified afterwards using unitary functions
+ @ref LL_TIM_CC_EnableChannel() or @ref LL_TIM_CC_DisableChannel().*/
uint32_t CompareValue; /*!< Specifies the Compare value to be loaded into the Capture Compare Register.
This parameter can be a number between Min_Data=0x0000 and Max_Data=0xFFFF.
- This feature can be modified afterwards using unitary function LL_TIM_OC_SetCompareCHx (x=1..6).*/
+ This feature can be modified afterwards using unitary function
+ LL_TIM_OC_SetCompareCHx (x=1..6).*/
uint32_t OCPolarity; /*!< Specifies the output polarity.
This parameter can be a value of @ref TIM_LL_EC_OCPOLARITY.
- This feature can be modified afterwards using unitary function @ref LL_TIM_OC_SetPolarity().*/
+ This feature can be modified afterwards using unitary function
+ @ref LL_TIM_OC_SetPolarity().*/
} LL_TIM_OC_InitTypeDef;
@@ -208,22 +217,26 @@ typedef struct
uint32_t ICPolarity; /*!< Specifies the active edge of the input signal.
This parameter can be a value of @ref TIM_LL_EC_IC_POLARITY.
- This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetPolarity().*/
+ This feature can be modified afterwards using unitary function
+ @ref LL_TIM_IC_SetPolarity().*/
uint32_t ICActiveInput; /*!< Specifies the input.
This parameter can be a value of @ref TIM_LL_EC_ACTIVEINPUT.
- This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetActiveInput().*/
+ This feature can be modified afterwards using unitary function
+ @ref LL_TIM_IC_SetActiveInput().*/
uint32_t ICPrescaler; /*!< Specifies the Input Capture Prescaler.
This parameter can be a value of @ref TIM_LL_EC_ICPSC.
- This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetPrescaler().*/
+ This feature can be modified afterwards using unitary function
+ @ref LL_TIM_IC_SetPrescaler().*/
uint32_t ICFilter; /*!< Specifies the input capture filter.
This parameter can be a value of @ref TIM_LL_EC_IC_FILTER.
- This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetFilter().*/
+ This feature can be modified afterwards using unitary function
+ @ref LL_TIM_IC_SetFilter().*/
} LL_TIM_IC_InitTypeDef;
@@ -235,47 +248,56 @@ typedef struct
uint32_t EncoderMode; /*!< Specifies the encoder resolution (x2 or x4).
This parameter can be a value of @ref TIM_LL_EC_ENCODERMODE.
- This feature can be modified afterwards using unitary function @ref LL_TIM_SetEncoderMode().*/
+ This feature can be modified afterwards using unitary function
+ @ref LL_TIM_SetEncoderMode().*/
uint32_t IC1Polarity; /*!< Specifies the active edge of TI1 input.
This parameter can be a value of @ref TIM_LL_EC_IC_POLARITY.
- This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetPolarity().*/
+ This feature can be modified afterwards using unitary function
+ @ref LL_TIM_IC_SetPolarity().*/
uint32_t IC1ActiveInput; /*!< Specifies the TI1 input source
This parameter can be a value of @ref TIM_LL_EC_ACTIVEINPUT.
- This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetActiveInput().*/
+ This feature can be modified afterwards using unitary function
+ @ref LL_TIM_IC_SetActiveInput().*/
uint32_t IC1Prescaler; /*!< Specifies the TI1 input prescaler value.
This parameter can be a value of @ref TIM_LL_EC_ICPSC.
- This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetPrescaler().*/
+ This feature can be modified afterwards using unitary function
+ @ref LL_TIM_IC_SetPrescaler().*/
uint32_t IC1Filter; /*!< Specifies the TI1 input filter.
This parameter can be a value of @ref TIM_LL_EC_IC_FILTER.
- This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetFilter().*/
+ This feature can be modified afterwards using unitary function
+ @ref LL_TIM_IC_SetFilter().*/
uint32_t IC2Polarity; /*!< Specifies the active edge of TI2 input.
This parameter can be a value of @ref TIM_LL_EC_IC_POLARITY.
- This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetPolarity().*/
+ This feature can be modified afterwards using unitary function
+ @ref LL_TIM_IC_SetPolarity().*/
uint32_t IC2ActiveInput; /*!< Specifies the TI2 input source
This parameter can be a value of @ref TIM_LL_EC_ACTIVEINPUT.
- This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetActiveInput().*/
+ This feature can be modified afterwards using unitary function
+ @ref LL_TIM_IC_SetActiveInput().*/
uint32_t IC2Prescaler; /*!< Specifies the TI2 input prescaler value.
This parameter can be a value of @ref TIM_LL_EC_ICPSC.
- This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetPrescaler().*/
+ This feature can be modified afterwards using unitary function
+ @ref LL_TIM_IC_SetPrescaler().*/
uint32_t IC2Filter; /*!< Specifies the TI2 input filter.
This parameter can be a value of @ref TIM_LL_EC_IC_FILTER.
- This feature can be modified afterwards using unitary function @ref LL_TIM_IC_SetFilter().*/
+ This feature can be modified afterwards using unitary function
+ @ref LL_TIM_IC_SetFilter().*/
} LL_TIM_ENCODER_InitTypeDef;
@@ -334,8 +356,8 @@ typedef struct
/** @defgroup TIM_LL_EC_ONEPULSEMODE One Pulse Mode
* @{
*/
-#define LL_TIM_ONEPULSEMODE_SINGLE TIM_CR1_OPM /*!< Counter is not stopped at update event */
-#define LL_TIM_ONEPULSEMODE_REPETITIVE 0x00000000U /*!< Counter stops counting at the next update event */
+#define LL_TIM_ONEPULSEMODE_SINGLE TIM_CR1_OPM /*!< Counter stops counting at the next update event */
+#define LL_TIM_ONEPULSEMODE_REPETITIVE 0x00000000U /*!< Counter is not stopped at update event */
/**
* @}
*/
@@ -822,7 +844,8 @@ typedef struct
((((__TIMCLK__)/((__PSC__) + 1U)) >= (__FREQ__)) ? (((__TIMCLK__)/((__FREQ__) * ((__PSC__) + 1U))) - 1U) : 0U)
/**
- * @brief HELPER macro calculating the compare value required to achieve the required timer output compare active/inactive delay.
+ * @brief HELPER macro calculating the compare value required to achieve the required timer output compare
+ * active/inactive delay.
* @note ex: @ref __LL_TIM_CALC_DELAY (1000000, @ref LL_TIM_GetPrescaler (), 10);
* @param __TIMCLK__ timer input clock frequency (in Hz)
* @param __PSC__ prescaler
@@ -834,7 +857,8 @@ typedef struct
/ ((uint64_t)1000000U * (uint64_t)((__PSC__) + 1U))))
/**
- * @brief HELPER macro calculating the auto-reload value to achieve the required pulse duration (when the timer operates in one pulse mode).
+ * @brief HELPER macro calculating the auto-reload value to achieve the required pulse duration
+ * (when the timer operates in one pulse mode).
* @note ex: @ref __LL_TIM_CALC_PULSE (1000000, @ref LL_TIM_GetPrescaler (), 10, 20);
* @param __TIMCLK__ timer input clock frequency (in Hz)
* @param __PSC__ prescaler
@@ -1091,7 +1115,8 @@ __STATIC_INLINE uint32_t LL_TIM_IsEnabledARRPreload(TIM_TypeDef *TIMx)
}
/**
- * @brief Set the division ratio between the timer clock and the sampling clock used by the dead-time generators (when supported) and the digital filters.
+ * @brief Set the division ratio between the timer clock and the sampling clock used by the dead-time generators
+ * (when supported) and the digital filters.
* @note Macro IS_TIM_CLOCK_DIVISION_INSTANCE(TIMx) can be used to check
* whether or not the clock division feature is supported by the timer
* instance.
@@ -1109,7 +1134,8 @@ __STATIC_INLINE void LL_TIM_SetClockDivision(TIM_TypeDef *TIMx, uint32_t ClockDi
}
/**
- * @brief Get the actual division ratio between the timer clock and the sampling clock used by the dead-time generators (when supported) and the digital filters.
+ * @brief Get the actual division ratio between the timer clock and the sampling clock used by the dead-time
+ * generators (when supported) and the digital filters.
* @note Macro IS_TIM_CLOCK_DIVISION_INSTANCE(TIMx) can be used to check
* whether or not the clock division feature is supported by the timer
* instance.
@@ -1368,7 +1394,7 @@ __STATIC_INLINE void LL_TIM_OC_SetMode(TIM_TypeDef *TIMx, uint32_t Channel, uint
{
uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
__IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
- MODIFY_REG(*pReg, ((TIM_CCMR1_OC1M | TIM_CCMR1_CC1S) << SHIFT_TAB_OCxx[iChannel]), Mode << SHIFT_TAB_OCxx[iChannel]);
+ MODIFY_REG(*pReg, ((TIM_CCMR1_OC1M | TIM_CCMR1_CC1S) << SHIFT_TAB_OCxx[iChannel]), Mode << SHIFT_TAB_OCxx[iChannel]);
}
/**
@@ -1397,7 +1423,7 @@ __STATIC_INLINE uint32_t LL_TIM_OC_GetMode(TIM_TypeDef *TIMx, uint32_t Channel)
{
uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
const __IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
- return (READ_BIT(*pReg, ((TIM_CCMR1_OC1M | TIM_CCMR1_CC1S) << SHIFT_TAB_OCxx[iChannel])) >> SHIFT_TAB_OCxx[iChannel]);
+ return (READ_BIT(*pReg, ((TIM_CCMR1_OC1M | TIM_CCMR1_CC1S) << SHIFT_TAB_OCxx[iChannel])) >> SHIFT_TAB_OCxx[iChannel]);
}
/**
@@ -1804,7 +1830,8 @@ __STATIC_INLINE void LL_TIM_IC_Config(TIM_TypeDef *TIMx, uint32_t Channel, uint3
uint8_t iChannel = TIM_GET_CHANNEL_INDEX(Channel);
__IO uint32_t *pReg = (__IO uint32_t *)((uint32_t)((uint32_t)(&TIMx->CCMR1) + OFFSET_TAB_CCMRx[iChannel]));
MODIFY_REG(*pReg, ((TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC | TIM_CCMR1_CC1S) << SHIFT_TAB_ICxx[iChannel]),
- ((Configuration >> 16U) & (TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC | TIM_CCMR1_CC1S)) << SHIFT_TAB_ICxx[iChannel]);
+ ((Configuration >> 16U) & (TIM_CCMR1_IC1F | TIM_CCMR1_IC1PSC | TIM_CCMR1_CC1S)) \
+ << SHIFT_TAB_ICxx[iChannel]);
MODIFY_REG(TIMx->CCER, ((TIM_CCER_CC1NP | TIM_CCER_CC1P) << SHIFT_TAB_CCxP[iChannel]),
(Configuration & (TIM_CCER_CC1NP | TIM_CCER_CC1P)) << SHIFT_TAB_CCxP[iChannel]);
}
@@ -2685,7 +2712,8 @@ __STATIC_INLINE void LL_TIM_ClearFlag_CC1OVR(TIM_TypeDef *TIMx)
}
/**
- * @brief Indicate whether Capture/Compare 1 over-capture interrupt flag (CC1OF) is set (Capture/Compare 1 interrupt is pending).
+ * @brief Indicate whether Capture/Compare 1 over-capture interrupt flag (CC1OF) is set
+ * (Capture/Compare 1 interrupt is pending).
* @rmtoll SR CC1OF LL_TIM_IsActiveFlag_CC1OVR
* @param TIMx Timer instance
* @retval State of bit (1 or 0).
@@ -2707,7 +2735,8 @@ __STATIC_INLINE void LL_TIM_ClearFlag_CC2OVR(TIM_TypeDef *TIMx)
}
/**
- * @brief Indicate whether Capture/Compare 2 over-capture interrupt flag (CC2OF) is set (Capture/Compare 2 over-capture interrupt is pending).
+ * @brief Indicate whether Capture/Compare 2 over-capture interrupt flag (CC2OF) is set
+ * (Capture/Compare 2 over-capture interrupt is pending).
* @rmtoll SR CC2OF LL_TIM_IsActiveFlag_CC2OVR
* @param TIMx Timer instance
* @retval State of bit (1 or 0).
@@ -2729,7 +2758,8 @@ __STATIC_INLINE void LL_TIM_ClearFlag_CC3OVR(TIM_TypeDef *TIMx)
}
/**
- * @brief Indicate whether Capture/Compare 3 over-capture interrupt flag (CC3OF) is set (Capture/Compare 3 over-capture interrupt is pending).
+ * @brief Indicate whether Capture/Compare 3 over-capture interrupt flag (CC3OF) is set
+ * (Capture/Compare 3 over-capture interrupt is pending).
* @rmtoll SR CC3OF LL_TIM_IsActiveFlag_CC3OVR
* @param TIMx Timer instance
* @retval State of bit (1 or 0).
@@ -2751,7 +2781,8 @@ __STATIC_INLINE void LL_TIM_ClearFlag_CC4OVR(TIM_TypeDef *TIMx)
}
/**
- * @brief Indicate whether Capture/Compare 4 over-capture interrupt flag (CC4OF) is set (Capture/Compare 4 over-capture interrupt is pending).
+ * @brief Indicate whether Capture/Compare 4 over-capture interrupt flag (CC4OF) is set
+ * (Capture/Compare 4 over-capture interrupt is pending).
* @rmtoll SR CC4OF LL_TIM_IsActiveFlag_CC4OVR
* @param TIMx Timer instance
* @retval State of bit (1 or 0).
@@ -2970,7 +3001,7 @@ __STATIC_INLINE uint32_t LL_TIM_IsEnabledIT_TRIG(TIM_TypeDef *TIMx)
* @}
*/
-/** @defgroup TIM_LL_EF_DMA_Management DMA-Management
+/** @defgroup TIM_LL_EF_DMA_Management DMA Management
* @{
*/
/**
diff --git a/fw/Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_usart.h b/fw/Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_usart.h
new file mode 100644
index 0000000..c4887f5
--- /dev/null
+++ b/fw/Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_usart.h
@@ -0,0 +1,3751 @@
+/**
+ ******************************************************************************
+ * @file stm32l0xx_ll_usart.h
+ * @author MCD Application Team
+ * @brief Header file of USART LL module.
+ ******************************************************************************
+ * @attention
+ *
+ * © Copyright (c) 2016 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software component is licensed by ST under BSD 3-Clause license,
+ * the "License"; You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ * opensource.org/licenses/BSD-3-Clause
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef STM32L0xx_LL_USART_H
+#define STM32L0xx_LL_USART_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm32l0xx.h"
+
+/** @addtogroup STM32L0xx_LL_Driver
+ * @{
+ */
+
+#if defined (USART1) || defined (USART2) || defined (USART4) || defined (USART5)
+
+/** @defgroup USART_LL USART
+ * @{
+ */
+
+/* Private types -------------------------------------------------------------*/
+/* Private variables ---------------------------------------------------------*/
+
+/* Private constants ---------------------------------------------------------*/
+/* Private macros ------------------------------------------------------------*/
+#if defined(USE_FULL_LL_DRIVER)
+/** @defgroup USART_LL_Private_Macros USART Private Macros
+ * @{
+ */
+/**
+ * @}
+ */
+#endif /*USE_FULL_LL_DRIVER*/
+
+/* Exported types ------------------------------------------------------------*/
+#if defined(USE_FULL_LL_DRIVER)
+/** @defgroup USART_LL_ES_INIT USART Exported Init structures
+ * @{
+ */
+
+/**
+ * @brief LL USART Init Structure definition
+ */
+typedef struct
+{
+
+ uint32_t BaudRate; /*!< This field defines expected Usart communication baud rate.
+
+ This feature can be modified afterwards using unitary
+ function @ref LL_USART_SetBaudRate().*/
+
+ uint32_t DataWidth; /*!< Specifies the number of data bits transmitted or received in a frame.
+ This parameter can be a value of @ref USART_LL_EC_DATAWIDTH.
+
+ This feature can be modified afterwards using unitary
+ function @ref LL_USART_SetDataWidth().*/
+
+ uint32_t StopBits; /*!< Specifies the number of stop bits transmitted.
+ This parameter can be a value of @ref USART_LL_EC_STOPBITS.
+
+ This feature can be modified afterwards using unitary
+ function @ref LL_USART_SetStopBitsLength().*/
+
+ uint32_t Parity; /*!< Specifies the parity mode.
+ This parameter can be a value of @ref USART_LL_EC_PARITY.
+
+ This feature can be modified afterwards using unitary
+ function @ref LL_USART_SetParity().*/
+
+ uint32_t TransferDirection; /*!< Specifies whether the Receive and/or Transmit mode is enabled or disabled.
+ This parameter can be a value of @ref USART_LL_EC_DIRECTION.
+
+ This feature can be modified afterwards using unitary
+ function @ref LL_USART_SetTransferDirection().*/
+
+ uint32_t HardwareFlowControl; /*!< Specifies whether the hardware flow control mode is enabled or disabled.
+ This parameter can be a value of @ref USART_LL_EC_HWCONTROL.
+
+ This feature can be modified afterwards using unitary
+ function @ref LL_USART_SetHWFlowCtrl().*/
+
+ uint32_t OverSampling; /*!< Specifies whether USART oversampling mode is 16 or 8.
+ This parameter can be a value of @ref USART_LL_EC_OVERSAMPLING.
+
+ This feature can be modified afterwards using unitary
+ function @ref LL_USART_SetOverSampling().*/
+
+} LL_USART_InitTypeDef;
+
+/**
+ * @brief LL USART Clock Init Structure definition
+ */
+typedef struct
+{
+ uint32_t ClockOutput; /*!< Specifies whether the USART clock is enabled or disabled.
+ This parameter can be a value of @ref USART_LL_EC_CLOCK.
+
+ USART HW configuration can be modified afterwards using unitary functions
+ @ref LL_USART_EnableSCLKOutput() or @ref LL_USART_DisableSCLKOutput().
+ For more details, refer to description of this function. */
+
+ uint32_t ClockPolarity; /*!< Specifies the steady state of the serial clock.
+ This parameter can be a value of @ref USART_LL_EC_POLARITY.
+
+ USART HW configuration can be modified afterwards using unitary
+ functions @ref LL_USART_SetClockPolarity().
+ For more details, refer to description of this function. */
+
+ uint32_t ClockPhase; /*!< Specifies the clock transition on which the bit capture is made.
+ This parameter can be a value of @ref USART_LL_EC_PHASE.
+
+ USART HW configuration can be modified afterwards using unitary
+ functions @ref LL_USART_SetClockPhase().
+ For more details, refer to description of this function. */
+
+ uint32_t LastBitClockPulse; /*!< Specifies whether the clock pulse corresponding to the last transmitted
+ data bit (MSB) has to be output on the SCLK pin in synchronous mode.
+ This parameter can be a value of @ref USART_LL_EC_LASTCLKPULSE.
+
+ USART HW configuration can be modified afterwards using unitary
+ functions @ref LL_USART_SetLastClkPulseOutput().
+ For more details, refer to description of this function. */
+
+} LL_USART_ClockInitTypeDef;
+
+/**
+ * @}
+ */
+#endif /* USE_FULL_LL_DRIVER */
+
+/* Exported constants --------------------------------------------------------*/
+/** @defgroup USART_LL_Exported_Constants USART Exported Constants
+ * @{
+ */
+
+/** @defgroup USART_LL_EC_CLEAR_FLAG Clear Flags Defines
+ * @brief Flags defines which can be used with LL_USART_WriteReg function
+ * @{
+ */
+#define LL_USART_ICR_PECF USART_ICR_PECF /*!< Parity error clear flag */
+#define LL_USART_ICR_FECF USART_ICR_FECF /*!< Framing error clear flag */
+#define LL_USART_ICR_NCF USART_ICR_NCF /*!< Noise error detected clear flag */
+#define LL_USART_ICR_ORECF USART_ICR_ORECF /*!< Overrun error clear flag */
+#define LL_USART_ICR_IDLECF USART_ICR_IDLECF /*!< Idle line detected clear flag */
+#define LL_USART_ICR_TCCF USART_ICR_TCCF /*!< Transmission complete clear flag */
+#if defined(USART_TCBGT_SUPPORT)
+#define LL_USART_ICR_TCBGTCF USART_ICR_TCBGTCF /*!< Transmission completed before guard time clear flag */
+#endif /* USART_TCBGT_SUPPORT */
+#define LL_USART_ICR_LBDCF USART_ICR_LBDCF /*!< LIN break detection clear flag */
+#define LL_USART_ICR_CTSCF USART_ICR_CTSCF /*!< CTS clear flag */
+#define LL_USART_ICR_RTOCF USART_ICR_RTOCF /*!< Receiver timeout clear flag */
+#define LL_USART_ICR_EOBCF USART_ICR_EOBCF /*!< End of block clear flag */
+#define LL_USART_ICR_CMCF USART_ICR_CMCF /*!< Character match clear flag */
+#define LL_USART_ICR_WUCF USART_ICR_WUCF /*!< Wakeup from Stop mode clear flag */
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EC_GET_FLAG Get Flags Defines
+ * @brief Flags defines which can be used with LL_USART_ReadReg function
+ * @{
+ */
+#define LL_USART_ISR_PE USART_ISR_PE /*!< Parity error flag */
+#define LL_USART_ISR_FE USART_ISR_FE /*!< Framing error flag */
+#define LL_USART_ISR_NE USART_ISR_NE /*!< Noise detected flag */
+#define LL_USART_ISR_ORE USART_ISR_ORE /*!< Overrun error flag */
+#define LL_USART_ISR_IDLE USART_ISR_IDLE /*!< Idle line detected flag */
+#define LL_USART_ISR_RXNE USART_ISR_RXNE /*!< Read data register not empty flag */
+#define LL_USART_ISR_TC USART_ISR_TC /*!< Transmission complete flag */
+#define LL_USART_ISR_TXE USART_ISR_TXE /*!< Transmit data register empty flag */
+#define LL_USART_ISR_LBDF USART_ISR_LBDF /*!< LIN break detection flag */
+#define LL_USART_ISR_CTSIF USART_ISR_CTSIF /*!< CTS interrupt flag */
+#define LL_USART_ISR_CTS USART_ISR_CTS /*!< CTS flag */
+#define LL_USART_ISR_RTOF USART_ISR_RTOF /*!< Receiver timeout flag */
+#define LL_USART_ISR_EOBF USART_ISR_EOBF /*!< End of block flag */
+#define LL_USART_ISR_ABRE USART_ISR_ABRE /*!< Auto baud rate error flag */
+#define LL_USART_ISR_ABRF USART_ISR_ABRF /*!< Auto baud rate flag */
+#define LL_USART_ISR_BUSY USART_ISR_BUSY /*!< Busy flag */
+#define LL_USART_ISR_CMF USART_ISR_CMF /*!< Character match flag */
+#define LL_USART_ISR_SBKF USART_ISR_SBKF /*!< Send break flag */
+#define LL_USART_ISR_RWU USART_ISR_RWU /*!< Receiver wakeup from Mute mode flag */
+#define LL_USART_ISR_WUF USART_ISR_WUF /*!< Wakeup from Stop mode flag */
+#define LL_USART_ISR_TEACK USART_ISR_TEACK /*!< Transmit enable acknowledge flag */
+#define LL_USART_ISR_REACK USART_ISR_REACK /*!< Receive enable acknowledge flag */
+#if defined(USART_TCBGT_SUPPORT)
+#define LL_USART_ISR_TCBGT USART_ISR_TCBGT /*!< Transmission complete before guard time completion flag */
+#endif /* USART_TCBGT_SUPPORT */
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EC_IT IT Defines
+ * @brief IT defines which can be used with LL_USART_ReadReg and LL_USART_WriteReg functions
+ * @{
+ */
+#define LL_USART_CR1_IDLEIE USART_CR1_IDLEIE /*!< IDLE interrupt enable */
+#define LL_USART_CR1_RXNEIE USART_CR1_RXNEIE /*!< Read data register not empty interrupt enable */
+#define LL_USART_CR1_TCIE USART_CR1_TCIE /*!< Transmission complete interrupt enable */
+#define LL_USART_CR1_TXEIE USART_CR1_TXEIE /*!< Transmit data register empty interrupt enable */
+#define LL_USART_CR1_PEIE USART_CR1_PEIE /*!< Parity error */
+#define LL_USART_CR1_CMIE USART_CR1_CMIE /*!< Character match interrupt enable */
+#define LL_USART_CR1_RTOIE USART_CR1_RTOIE /*!< Receiver timeout interrupt enable */
+#define LL_USART_CR1_EOBIE USART_CR1_EOBIE /*!< End of Block interrupt enable */
+#define LL_USART_CR2_LBDIE USART_CR2_LBDIE /*!< LIN break detection interrupt enable */
+#define LL_USART_CR3_EIE USART_CR3_EIE /*!< Error interrupt enable */
+#define LL_USART_CR3_CTSIE USART_CR3_CTSIE /*!< CTS interrupt enable */
+#define LL_USART_CR3_WUFIE USART_CR3_WUFIE /*!< Wakeup from Stop mode interrupt enable */
+#if defined(USART_TCBGT_SUPPORT)
+#define LL_USART_CR3_TCBGTIE USART_CR3_TCBGTIE /*!< Transmission complete before guard time interrupt enable */
+#endif /* USART_TCBGT_SUPPORT */
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EC_DIRECTION Communication Direction
+ * @{
+ */
+#define LL_USART_DIRECTION_NONE 0x00000000U /*!< Transmitter and Receiver are disabled */
+#define LL_USART_DIRECTION_RX USART_CR1_RE /*!< Transmitter is disabled and Receiver is enabled */
+#define LL_USART_DIRECTION_TX USART_CR1_TE /*!< Transmitter is enabled and Receiver is disabled */
+#define LL_USART_DIRECTION_TX_RX (USART_CR1_TE |USART_CR1_RE) /*!< Transmitter and Receiver are enabled */
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EC_PARITY Parity Control
+ * @{
+ */
+#define LL_USART_PARITY_NONE 0x00000000U /*!< Parity control disabled */
+#define LL_USART_PARITY_EVEN USART_CR1_PCE /*!< Parity control enabled and Even Parity is selected */
+#define LL_USART_PARITY_ODD (USART_CR1_PCE | USART_CR1_PS) /*!< Parity control enabled and Odd Parity is selected */
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EC_WAKEUP Wakeup
+ * @{
+ */
+#define LL_USART_WAKEUP_IDLELINE 0x00000000U /*!< USART wake up from Mute mode on Idle Line */
+#define LL_USART_WAKEUP_ADDRESSMARK USART_CR1_WAKE /*!< USART wake up from Mute mode on Address Mark */
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EC_DATAWIDTH Datawidth
+ * @{
+ */
+#define LL_USART_DATAWIDTH_7B USART_CR1_M1 /*!< 7 bits word length : Start bit, 7 data bits, n stop bits */
+#define LL_USART_DATAWIDTH_8B 0x00000000U /*!< 8 bits word length : Start bit, 8 data bits, n stop bits */
+#define LL_USART_DATAWIDTH_9B USART_CR1_M0 /*!< 9 bits word length : Start bit, 9 data bits, n stop bits */
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EC_OVERSAMPLING Oversampling
+ * @{
+ */
+#define LL_USART_OVERSAMPLING_16 0x00000000U /*!< Oversampling by 16 */
+#define LL_USART_OVERSAMPLING_8 USART_CR1_OVER8 /*!< Oversampling by 8 */
+/**
+ * @}
+ */
+
+#if defined(USE_FULL_LL_DRIVER)
+/** @defgroup USART_LL_EC_CLOCK Clock Signal
+ * @{
+ */
+
+#define LL_USART_CLOCK_DISABLE 0x00000000U /*!< Clock signal not provided */
+#define LL_USART_CLOCK_ENABLE USART_CR2_CLKEN /*!< Clock signal provided */
+/**
+ * @}
+ */
+#endif /*USE_FULL_LL_DRIVER*/
+
+/** @defgroup USART_LL_EC_LASTCLKPULSE Last Clock Pulse
+ * @{
+ */
+#define LL_USART_LASTCLKPULSE_NO_OUTPUT 0x00000000U /*!< The clock pulse of the last data bit is not output to the SCLK pin */
+#define LL_USART_LASTCLKPULSE_OUTPUT USART_CR2_LBCL /*!< The clock pulse of the last data bit is output to the SCLK pin */
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EC_PHASE Clock Phase
+ * @{
+ */
+#define LL_USART_PHASE_1EDGE 0x00000000U /*!< The first clock transition is the first data capture edge */
+#define LL_USART_PHASE_2EDGE USART_CR2_CPHA /*!< The second clock transition is the first data capture edge */
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EC_POLARITY Clock Polarity
+ * @{
+ */
+#define LL_USART_POLARITY_LOW 0x00000000U /*!< Steady low value on SCLK pin outside transmission window*/
+#define LL_USART_POLARITY_HIGH USART_CR2_CPOL /*!< Steady high value on SCLK pin outside transmission window */
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EC_STOPBITS Stop Bits
+ * @{
+ */
+#define LL_USART_STOPBITS_0_5 USART_CR2_STOP_0 /*!< 0.5 stop bit */
+#define LL_USART_STOPBITS_1 0x00000000U /*!< 1 stop bit */
+#define LL_USART_STOPBITS_1_5 (USART_CR2_STOP_0 | USART_CR2_STOP_1) /*!< 1.5 stop bits */
+#define LL_USART_STOPBITS_2 USART_CR2_STOP_1 /*!< 2 stop bits */
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EC_TXRX TX RX Pins Swap
+ * @{
+ */
+#define LL_USART_TXRX_STANDARD 0x00000000U /*!< TX/RX pins are used as defined in standard pinout */
+#define LL_USART_TXRX_SWAPPED (USART_CR2_SWAP) /*!< TX and RX pins functions are swapped. */
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EC_RXPIN_LEVEL RX Pin Active Level Inversion
+ * @{
+ */
+#define LL_USART_RXPIN_LEVEL_STANDARD 0x00000000U /*!< RX pin signal works using the standard logic levels */
+#define LL_USART_RXPIN_LEVEL_INVERTED (USART_CR2_RXINV) /*!< RX pin signal values are inverted. */
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EC_TXPIN_LEVEL TX Pin Active Level Inversion
+ * @{
+ */
+#define LL_USART_TXPIN_LEVEL_STANDARD 0x00000000U /*!< TX pin signal works using the standard logic levels */
+#define LL_USART_TXPIN_LEVEL_INVERTED (USART_CR2_TXINV) /*!< TX pin signal values are inverted. */
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EC_BINARY_LOGIC Binary Data Inversion
+ * @{
+ */
+#define LL_USART_BINARY_LOGIC_POSITIVE 0x00000000U /*!< Logical data from the data register are send/received in positive/direct logic. (1=H, 0=L) */
+#define LL_USART_BINARY_LOGIC_NEGATIVE USART_CR2_DATAINV /*!< Logical data from the data register are send/received in negative/inverse logic. (1=L, 0=H). The parity bit is also inverted. */
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EC_BITORDER Bit Order
+ * @{
+ */
+#define LL_USART_BITORDER_LSBFIRST 0x00000000U /*!< data is transmitted/received with data bit 0 first, following the start bit */
+#define LL_USART_BITORDER_MSBFIRST USART_CR2_MSBFIRST /*!< data is transmitted/received with the MSB first, following the start bit */
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EC_AUTOBAUD_DETECT_ON Autobaud Detection
+ * @{
+ */
+#define LL_USART_AUTOBAUD_DETECT_ON_STARTBIT 0x00000000U /*!< Measurement of the start bit is used to detect the baud rate */
+#define LL_USART_AUTOBAUD_DETECT_ON_FALLINGEDGE USART_CR2_ABRMODE_0 /*!< Falling edge to falling edge measurement. Received frame must start with a single bit = 1 -> Frame = Start10xxxxxx */
+#define LL_USART_AUTOBAUD_DETECT_ON_7F_FRAME USART_CR2_ABRMODE_1 /*!< 0x7F frame detection */
+#define LL_USART_AUTOBAUD_DETECT_ON_55_FRAME (USART_CR2_ABRMODE_1 | USART_CR2_ABRMODE_0) /*!< 0x55 frame detection */
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EC_ADDRESS_DETECT Address Length Detection
+ * @{
+ */
+#define LL_USART_ADDRESS_DETECT_4B 0x00000000U /*!< 4-bit address detection method selected */
+#define LL_USART_ADDRESS_DETECT_7B USART_CR2_ADDM7 /*!< 7-bit address detection (in 8-bit data mode) method selected */
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EC_HWCONTROL Hardware Control
+ * @{
+ */
+#define LL_USART_HWCONTROL_NONE 0x00000000U /*!< CTS and RTS hardware flow control disabled */
+#define LL_USART_HWCONTROL_RTS USART_CR3_RTSE /*!< RTS output enabled, data is only requested when there is space in the receive buffer */
+#define LL_USART_HWCONTROL_CTS USART_CR3_CTSE /*!< CTS mode enabled, data is only transmitted when the nCTS input is asserted (tied to 0) */
+#define LL_USART_HWCONTROL_RTS_CTS (USART_CR3_RTSE | USART_CR3_CTSE) /*!< CTS and RTS hardware flow control enabled */
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EC_WAKEUP_ON Wakeup Activation
+ * @{
+ */
+#define LL_USART_WAKEUP_ON_ADDRESS 0x00000000U /*!< Wake up active on address match */
+#define LL_USART_WAKEUP_ON_STARTBIT USART_CR3_WUS_1 /*!< Wake up active on Start bit detection */
+#define LL_USART_WAKEUP_ON_RXNE (USART_CR3_WUS_0 | USART_CR3_WUS_1) /*!< Wake up active on RXNE */
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EC_IRDA_POWER IrDA Power
+ * @{
+ */
+#define LL_USART_IRDA_POWER_NORMAL 0x00000000U /*!< IrDA normal power mode */
+#define LL_USART_IRDA_POWER_LOW USART_CR3_IRLP /*!< IrDA low power mode */
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EC_LINBREAK_DETECT LIN Break Detection Length
+ * @{
+ */
+#define LL_USART_LINBREAK_DETECT_10B 0x00000000U /*!< 10-bit break detection method selected */
+#define LL_USART_LINBREAK_DETECT_11B USART_CR2_LBDL /*!< 11-bit break detection method selected */
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EC_DE_POLARITY Driver Enable Polarity
+ * @{
+ */
+#define LL_USART_DE_POLARITY_HIGH 0x00000000U /*!< DE signal is active high */
+#define LL_USART_DE_POLARITY_LOW USART_CR3_DEP /*!< DE signal is active low */
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EC_DMA_REG_DATA DMA Register Data
+ * @{
+ */
+#define LL_USART_DMA_REG_DATA_TRANSMIT 0x00000000U /*!< Get address of data register used for transmission */
+#define LL_USART_DMA_REG_DATA_RECEIVE 0x00000001U /*!< Get address of data register used for reception */
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/* Exported macro ------------------------------------------------------------*/
+/** @defgroup USART_LL_Exported_Macros USART Exported Macros
+ * @{
+ */
+
+/** @defgroup USART_LL_EM_WRITE_READ Common Write and read registers Macros
+ * @{
+ */
+
+/**
+ * @brief Write a value in USART register
+ * @param __INSTANCE__ USART Instance
+ * @param __REG__ Register to be written
+ * @param __VALUE__ Value to be written in the register
+ * @retval None
+ */
+#define LL_USART_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
+
+/**
+ * @brief Read a value in USART register
+ * @param __INSTANCE__ USART Instance
+ * @param __REG__ Register to be read
+ * @retval Register value
+ */
+#define LL_USART_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EM_Exported_Macros_Helper Exported_Macros_Helper
+ * @{
+ */
+
+/**
+ * @brief Compute USARTDIV value according to Peripheral Clock and
+ * expected Baud Rate in 8 bits sampling mode (32 bits value of USARTDIV is returned)
+ * @param __PERIPHCLK__ Peripheral Clock frequency used for USART instance
+ * @param __BAUDRATE__ Baud rate value to achieve
+ * @retval USARTDIV value to be used for BRR register filling in OverSampling_8 case
+ */
+#define __LL_USART_DIV_SAMPLING8(__PERIPHCLK__, __BAUDRATE__) ((((__PERIPHCLK__)*2U)\
+ + ((__BAUDRATE__)/2U))/(__BAUDRATE__))
+
+/**
+ * @brief Compute USARTDIV value according to Peripheral Clock and
+ * expected Baud Rate in 16 bits sampling mode (32 bits value of USARTDIV is returned)
+ * @param __PERIPHCLK__ Peripheral Clock frequency used for USART instance
+ * @param __BAUDRATE__ Baud rate value to achieve
+ * @retval USARTDIV value to be used for BRR register filling in OverSampling_16 case
+ */
+#define __LL_USART_DIV_SAMPLING16(__PERIPHCLK__, __BAUDRATE__) (((__PERIPHCLK__) + ((__BAUDRATE__)/2U))/(__BAUDRATE__))
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/* Exported functions --------------------------------------------------------*/
+
+/** @defgroup USART_LL_Exported_Functions USART Exported Functions
+ * @{
+ */
+
+/** @defgroup USART_LL_EF_Configuration Configuration functions
+ * @{
+ */
+
+/**
+ * @brief USART Enable
+ * @rmtoll CR1 UE LL_USART_Enable
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_Enable(USART_TypeDef *USARTx)
+{
+ SET_BIT(USARTx->CR1, USART_CR1_UE);
+}
+
+/**
+ * @brief USART Disable (all USART prescalers and outputs are disabled)
+ * @note When USART is disabled, USART prescalers and outputs are stopped immediately,
+ * and current operations are discarded. The configuration of the USART is kept, but all the status
+ * flags, in the USARTx_ISR are set to their default values.
+ * @rmtoll CR1 UE LL_USART_Disable
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_Disable(USART_TypeDef *USARTx)
+{
+ CLEAR_BIT(USARTx->CR1, USART_CR1_UE);
+}
+
+/**
+ * @brief Indicate if USART is enabled
+ * @rmtoll CR1 UE LL_USART_IsEnabled
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsEnabled(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->CR1, USART_CR1_UE) == (USART_CR1_UE)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief USART enabled in STOP Mode.
+ * @note When this function is enabled, USART is able to wake up the MCU from Stop mode, provided that
+ * USART clock selection is HSI or LSE in RCC.
+ * @note Macro IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not
+ * Wake-up from Stop mode feature is supported by the USARTx instance.
+ * @rmtoll CR1 UESM LL_USART_EnableInStopMode
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_EnableInStopMode(USART_TypeDef *USARTx)
+{
+ ATOMIC_SET_BIT(USARTx->CR1, USART_CR1_UESM);
+}
+
+/**
+ * @brief USART disabled in STOP Mode.
+ * @note When this function is disabled, USART is not able to wake up the MCU from Stop mode
+ * @note Macro IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not
+ * Wake-up from Stop mode feature is supported by the USARTx instance.
+ * @rmtoll CR1 UESM LL_USART_DisableInStopMode
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_DisableInStopMode(USART_TypeDef *USARTx)
+{
+ ATOMIC_CLEAR_BIT(USARTx->CR1, USART_CR1_UESM);
+}
+
+/**
+ * @brief Indicate if USART is enabled in STOP Mode (able to wake up MCU from Stop mode or not)
+ * @note Macro IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not
+ * Wake-up from Stop mode feature is supported by the USARTx instance.
+ * @rmtoll CR1 UESM LL_USART_IsEnabledInStopMode
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsEnabledInStopMode(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->CR1, USART_CR1_UESM) == (USART_CR1_UESM)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief USART Clock enabled in STOP Mode
+ * @note When this function is called, USART Clock is enabled while in STOP mode
+ * @rmtoll CR3 UCESM LL_USART_EnableClockInStopMode
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_EnableClockInStopMode(USART_TypeDef *USARTx)
+{
+ ATOMIC_SET_BIT(USARTx->CR3, USART_CR3_UCESM);
+}
+
+/**
+ * @brief USART clock disabled in STOP Mode
+ * @note When this function is called, USART Clock is disabled while in STOP mode
+ * @rmtoll CR3 UCESM LL_USART_DisableClockInStopMode
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_DisableClockInStopMode(USART_TypeDef *USARTx)
+{
+ ATOMIC_CLEAR_BIT(USARTx->CR3, USART_CR3_UCESM);
+}
+
+/**
+ * @brief Indicate if USART clock is enabled in STOP Mode
+ * @rmtoll CR3 UCESM LL_USART_IsClockEnabledInStopMode
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsClockEnabledInStopMode(USART_TypeDef *USARTx)
+{
+ return (READ_BIT(USARTx->CR3, USART_CR3_UCESM) == (USART_CR3_UCESM));
+}
+
+/**
+ * @brief Receiver Enable (Receiver is enabled and begins searching for a start bit)
+ * @rmtoll CR1 RE LL_USART_EnableDirectionRx
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_EnableDirectionRx(USART_TypeDef *USARTx)
+{
+ ATOMIC_SET_BIT(USARTx->CR1, USART_CR1_RE);
+}
+
+/**
+ * @brief Receiver Disable
+ * @rmtoll CR1 RE LL_USART_DisableDirectionRx
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_DisableDirectionRx(USART_TypeDef *USARTx)
+{
+ ATOMIC_CLEAR_BIT(USARTx->CR1, USART_CR1_RE);
+}
+
+/**
+ * @brief Transmitter Enable
+ * @rmtoll CR1 TE LL_USART_EnableDirectionTx
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_EnableDirectionTx(USART_TypeDef *USARTx)
+{
+ ATOMIC_SET_BIT(USARTx->CR1, USART_CR1_TE);
+}
+
+/**
+ * @brief Transmitter Disable
+ * @rmtoll CR1 TE LL_USART_DisableDirectionTx
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_DisableDirectionTx(USART_TypeDef *USARTx)
+{
+ ATOMIC_CLEAR_BIT(USARTx->CR1, USART_CR1_TE);
+}
+
+/**
+ * @brief Configure simultaneously enabled/disabled states
+ * of Transmitter and Receiver
+ * @rmtoll CR1 RE LL_USART_SetTransferDirection\n
+ * CR1 TE LL_USART_SetTransferDirection
+ * @param USARTx USART Instance
+ * @param TransferDirection This parameter can be one of the following values:
+ * @arg @ref LL_USART_DIRECTION_NONE
+ * @arg @ref LL_USART_DIRECTION_RX
+ * @arg @ref LL_USART_DIRECTION_TX
+ * @arg @ref LL_USART_DIRECTION_TX_RX
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_SetTransferDirection(USART_TypeDef *USARTx, uint32_t TransferDirection)
+{
+ ATOMIC_MODIFY_REG(USARTx->CR1, USART_CR1_RE | USART_CR1_TE, TransferDirection);
+}
+
+/**
+ * @brief Return enabled/disabled states of Transmitter and Receiver
+ * @rmtoll CR1 RE LL_USART_GetTransferDirection\n
+ * CR1 TE LL_USART_GetTransferDirection
+ * @param USARTx USART Instance
+ * @retval Returned value can be one of the following values:
+ * @arg @ref LL_USART_DIRECTION_NONE
+ * @arg @ref LL_USART_DIRECTION_RX
+ * @arg @ref LL_USART_DIRECTION_TX
+ * @arg @ref LL_USART_DIRECTION_TX_RX
+ */
+__STATIC_INLINE uint32_t LL_USART_GetTransferDirection(USART_TypeDef *USARTx)
+{
+ return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_RE | USART_CR1_TE));
+}
+
+/**
+ * @brief Configure Parity (enabled/disabled and parity mode if enabled).
+ * @note This function selects if hardware parity control (generation and detection) is enabled or disabled.
+ * When the parity control is enabled (Odd or Even), computed parity bit is inserted at the MSB position
+ * (9th or 8th bit depending on data width) and parity is checked on the received data.
+ * @rmtoll CR1 PS LL_USART_SetParity\n
+ * CR1 PCE LL_USART_SetParity
+ * @param USARTx USART Instance
+ * @param Parity This parameter can be one of the following values:
+ * @arg @ref LL_USART_PARITY_NONE
+ * @arg @ref LL_USART_PARITY_EVEN
+ * @arg @ref LL_USART_PARITY_ODD
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_SetParity(USART_TypeDef *USARTx, uint32_t Parity)
+{
+ MODIFY_REG(USARTx->CR1, USART_CR1_PS | USART_CR1_PCE, Parity);
+}
+
+/**
+ * @brief Return Parity configuration (enabled/disabled and parity mode if enabled)
+ * @rmtoll CR1 PS LL_USART_GetParity\n
+ * CR1 PCE LL_USART_GetParity
+ * @param USARTx USART Instance
+ * @retval Returned value can be one of the following values:
+ * @arg @ref LL_USART_PARITY_NONE
+ * @arg @ref LL_USART_PARITY_EVEN
+ * @arg @ref LL_USART_PARITY_ODD
+ */
+__STATIC_INLINE uint32_t LL_USART_GetParity(USART_TypeDef *USARTx)
+{
+ return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_PS | USART_CR1_PCE));
+}
+
+/**
+ * @brief Set Receiver Wake Up method from Mute mode.
+ * @rmtoll CR1 WAKE LL_USART_SetWakeUpMethod
+ * @param USARTx USART Instance
+ * @param Method This parameter can be one of the following values:
+ * @arg @ref LL_USART_WAKEUP_IDLELINE
+ * @arg @ref LL_USART_WAKEUP_ADDRESSMARK
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_SetWakeUpMethod(USART_TypeDef *USARTx, uint32_t Method)
+{
+ MODIFY_REG(USARTx->CR1, USART_CR1_WAKE, Method);
+}
+
+/**
+ * @brief Return Receiver Wake Up method from Mute mode
+ * @rmtoll CR1 WAKE LL_USART_GetWakeUpMethod
+ * @param USARTx USART Instance
+ * @retval Returned value can be one of the following values:
+ * @arg @ref LL_USART_WAKEUP_IDLELINE
+ * @arg @ref LL_USART_WAKEUP_ADDRESSMARK
+ */
+__STATIC_INLINE uint32_t LL_USART_GetWakeUpMethod(USART_TypeDef *USARTx)
+{
+ return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_WAKE));
+}
+
+/**
+ * @brief Set Word length (i.e. nb of data bits, excluding start and stop bits)
+ * @rmtoll CR1 M0 LL_USART_SetDataWidth\n
+ * CR1 M1 LL_USART_SetDataWidth
+ * @param USARTx USART Instance
+ * @param DataWidth This parameter can be one of the following values:
+ * @arg @ref LL_USART_DATAWIDTH_7B
+ * @arg @ref LL_USART_DATAWIDTH_8B
+ * @arg @ref LL_USART_DATAWIDTH_9B
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_SetDataWidth(USART_TypeDef *USARTx, uint32_t DataWidth)
+{
+ MODIFY_REG(USARTx->CR1, USART_CR1_M, DataWidth);
+}
+
+/**
+ * @brief Return Word length (i.e. nb of data bits, excluding start and stop bits)
+ * @rmtoll CR1 M0 LL_USART_GetDataWidth\n
+ * CR1 M1 LL_USART_GetDataWidth
+ * @param USARTx USART Instance
+ * @retval Returned value can be one of the following values:
+ * @arg @ref LL_USART_DATAWIDTH_7B
+ * @arg @ref LL_USART_DATAWIDTH_8B
+ * @arg @ref LL_USART_DATAWIDTH_9B
+ */
+__STATIC_INLINE uint32_t LL_USART_GetDataWidth(USART_TypeDef *USARTx)
+{
+ return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_M));
+}
+
+/**
+ * @brief Allow switch between Mute Mode and Active mode
+ * @rmtoll CR1 MME LL_USART_EnableMuteMode
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_EnableMuteMode(USART_TypeDef *USARTx)
+{
+ ATOMIC_SET_BIT(USARTx->CR1, USART_CR1_MME);
+}
+
+/**
+ * @brief Prevent Mute Mode use. Set Receiver in active mode permanently.
+ * @rmtoll CR1 MME LL_USART_DisableMuteMode
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_DisableMuteMode(USART_TypeDef *USARTx)
+{
+ ATOMIC_CLEAR_BIT(USARTx->CR1, USART_CR1_MME);
+}
+
+/**
+ * @brief Indicate if switch between Mute Mode and Active mode is allowed
+ * @rmtoll CR1 MME LL_USART_IsEnabledMuteMode
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsEnabledMuteMode(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->CR1, USART_CR1_MME) == (USART_CR1_MME)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Set Oversampling to 8-bit or 16-bit mode
+ * @rmtoll CR1 OVER8 LL_USART_SetOverSampling
+ * @param USARTx USART Instance
+ * @param OverSampling This parameter can be one of the following values:
+ * @arg @ref LL_USART_OVERSAMPLING_16
+ * @arg @ref LL_USART_OVERSAMPLING_8
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_SetOverSampling(USART_TypeDef *USARTx, uint32_t OverSampling)
+{
+ MODIFY_REG(USARTx->CR1, USART_CR1_OVER8, OverSampling);
+}
+
+/**
+ * @brief Return Oversampling mode
+ * @rmtoll CR1 OVER8 LL_USART_GetOverSampling
+ * @param USARTx USART Instance
+ * @retval Returned value can be one of the following values:
+ * @arg @ref LL_USART_OVERSAMPLING_16
+ * @arg @ref LL_USART_OVERSAMPLING_8
+ */
+__STATIC_INLINE uint32_t LL_USART_GetOverSampling(USART_TypeDef *USARTx)
+{
+ return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_OVER8));
+}
+
+/**
+ * @brief Configure if Clock pulse of the last data bit is output to the SCLK pin or not
+ * @note Macro IS_USART_INSTANCE(USARTx) can be used to check whether or not
+ * Synchronous mode is supported by the USARTx instance.
+ * @rmtoll CR2 LBCL LL_USART_SetLastClkPulseOutput
+ * @param USARTx USART Instance
+ * @param LastBitClockPulse This parameter can be one of the following values:
+ * @arg @ref LL_USART_LASTCLKPULSE_NO_OUTPUT
+ * @arg @ref LL_USART_LASTCLKPULSE_OUTPUT
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_SetLastClkPulseOutput(USART_TypeDef *USARTx, uint32_t LastBitClockPulse)
+{
+ MODIFY_REG(USARTx->CR2, USART_CR2_LBCL, LastBitClockPulse);
+}
+
+/**
+ * @brief Retrieve Clock pulse of the last data bit output configuration
+ * (Last bit Clock pulse output to the SCLK pin or not)
+ * @note Macro IS_USART_INSTANCE(USARTx) can be used to check whether or not
+ * Synchronous mode is supported by the USARTx instance.
+ * @rmtoll CR2 LBCL LL_USART_GetLastClkPulseOutput
+ * @param USARTx USART Instance
+ * @retval Returned value can be one of the following values:
+ * @arg @ref LL_USART_LASTCLKPULSE_NO_OUTPUT
+ * @arg @ref LL_USART_LASTCLKPULSE_OUTPUT
+ */
+__STATIC_INLINE uint32_t LL_USART_GetLastClkPulseOutput(USART_TypeDef *USARTx)
+{
+ return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_LBCL));
+}
+
+/**
+ * @brief Select the phase of the clock output on the SCLK pin in synchronous mode
+ * @note Macro IS_USART_INSTANCE(USARTx) can be used to check whether or not
+ * Synchronous mode is supported by the USARTx instance.
+ * @rmtoll CR2 CPHA LL_USART_SetClockPhase
+ * @param USARTx USART Instance
+ * @param ClockPhase This parameter can be one of the following values:
+ * @arg @ref LL_USART_PHASE_1EDGE
+ * @arg @ref LL_USART_PHASE_2EDGE
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_SetClockPhase(USART_TypeDef *USARTx, uint32_t ClockPhase)
+{
+ MODIFY_REG(USARTx->CR2, USART_CR2_CPHA, ClockPhase);
+}
+
+/**
+ * @brief Return phase of the clock output on the SCLK pin in synchronous mode
+ * @note Macro IS_USART_INSTANCE(USARTx) can be used to check whether or not
+ * Synchronous mode is supported by the USARTx instance.
+ * @rmtoll CR2 CPHA LL_USART_GetClockPhase
+ * @param USARTx USART Instance
+ * @retval Returned value can be one of the following values:
+ * @arg @ref LL_USART_PHASE_1EDGE
+ * @arg @ref LL_USART_PHASE_2EDGE
+ */
+__STATIC_INLINE uint32_t LL_USART_GetClockPhase(USART_TypeDef *USARTx)
+{
+ return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_CPHA));
+}
+
+/**
+ * @brief Select the polarity of the clock output on the SCLK pin in synchronous mode
+ * @note Macro IS_USART_INSTANCE(USARTx) can be used to check whether or not
+ * Synchronous mode is supported by the USARTx instance.
+ * @rmtoll CR2 CPOL LL_USART_SetClockPolarity
+ * @param USARTx USART Instance
+ * @param ClockPolarity This parameter can be one of the following values:
+ * @arg @ref LL_USART_POLARITY_LOW
+ * @arg @ref LL_USART_POLARITY_HIGH
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_SetClockPolarity(USART_TypeDef *USARTx, uint32_t ClockPolarity)
+{
+ MODIFY_REG(USARTx->CR2, USART_CR2_CPOL, ClockPolarity);
+}
+
+/**
+ * @brief Return polarity of the clock output on the SCLK pin in synchronous mode
+ * @note Macro IS_USART_INSTANCE(USARTx) can be used to check whether or not
+ * Synchronous mode is supported by the USARTx instance.
+ * @rmtoll CR2 CPOL LL_USART_GetClockPolarity
+ * @param USARTx USART Instance
+ * @retval Returned value can be one of the following values:
+ * @arg @ref LL_USART_POLARITY_LOW
+ * @arg @ref LL_USART_POLARITY_HIGH
+ */
+__STATIC_INLINE uint32_t LL_USART_GetClockPolarity(USART_TypeDef *USARTx)
+{
+ return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_CPOL));
+}
+
+/**
+ * @brief Configure Clock signal format (Phase Polarity and choice about output of last bit clock pulse)
+ * @note Macro IS_USART_INSTANCE(USARTx) can be used to check whether or not
+ * Synchronous mode is supported by the USARTx instance.
+ * @note Call of this function is equivalent to following function call sequence :
+ * - Clock Phase configuration using @ref LL_USART_SetClockPhase() function
+ * - Clock Polarity configuration using @ref LL_USART_SetClockPolarity() function
+ * - Output of Last bit Clock pulse configuration using @ref LL_USART_SetLastClkPulseOutput() function
+ * @rmtoll CR2 CPHA LL_USART_ConfigClock\n
+ * CR2 CPOL LL_USART_ConfigClock\n
+ * CR2 LBCL LL_USART_ConfigClock
+ * @param USARTx USART Instance
+ * @param Phase This parameter can be one of the following values:
+ * @arg @ref LL_USART_PHASE_1EDGE
+ * @arg @ref LL_USART_PHASE_2EDGE
+ * @param Polarity This parameter can be one of the following values:
+ * @arg @ref LL_USART_POLARITY_LOW
+ * @arg @ref LL_USART_POLARITY_HIGH
+ * @param LBCPOutput This parameter can be one of the following values:
+ * @arg @ref LL_USART_LASTCLKPULSE_NO_OUTPUT
+ * @arg @ref LL_USART_LASTCLKPULSE_OUTPUT
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_ConfigClock(USART_TypeDef *USARTx, uint32_t Phase, uint32_t Polarity, uint32_t LBCPOutput)
+{
+ MODIFY_REG(USARTx->CR2, USART_CR2_CPHA | USART_CR2_CPOL | USART_CR2_LBCL, Phase | Polarity | LBCPOutput);
+}
+
+/**
+ * @brief Enable Clock output on SCLK pin
+ * @note Macro IS_USART_INSTANCE(USARTx) can be used to check whether or not
+ * Synchronous mode is supported by the USARTx instance.
+ * @rmtoll CR2 CLKEN LL_USART_EnableSCLKOutput
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_EnableSCLKOutput(USART_TypeDef *USARTx)
+{
+ SET_BIT(USARTx->CR2, USART_CR2_CLKEN);
+}
+
+/**
+ * @brief Disable Clock output on SCLK pin
+ * @note Macro IS_USART_INSTANCE(USARTx) can be used to check whether or not
+ * Synchronous mode is supported by the USARTx instance.
+ * @rmtoll CR2 CLKEN LL_USART_DisableSCLKOutput
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_DisableSCLKOutput(USART_TypeDef *USARTx)
+{
+ CLEAR_BIT(USARTx->CR2, USART_CR2_CLKEN);
+}
+
+/**
+ * @brief Indicate if Clock output on SCLK pin is enabled
+ * @note Macro IS_USART_INSTANCE(USARTx) can be used to check whether or not
+ * Synchronous mode is supported by the USARTx instance.
+ * @rmtoll CR2 CLKEN LL_USART_IsEnabledSCLKOutput
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsEnabledSCLKOutput(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->CR2, USART_CR2_CLKEN) == (USART_CR2_CLKEN)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Set the length of the stop bits
+ * @rmtoll CR2 STOP LL_USART_SetStopBitsLength
+ * @param USARTx USART Instance
+ * @param StopBits This parameter can be one of the following values:
+ * @arg @ref LL_USART_STOPBITS_0_5
+ * @arg @ref LL_USART_STOPBITS_1
+ * @arg @ref LL_USART_STOPBITS_1_5
+ * @arg @ref LL_USART_STOPBITS_2
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_SetStopBitsLength(USART_TypeDef *USARTx, uint32_t StopBits)
+{
+ MODIFY_REG(USARTx->CR2, USART_CR2_STOP, StopBits);
+}
+
+/**
+ * @brief Retrieve the length of the stop bits
+ * @rmtoll CR2 STOP LL_USART_GetStopBitsLength
+ * @param USARTx USART Instance
+ * @retval Returned value can be one of the following values:
+ * @arg @ref LL_USART_STOPBITS_0_5
+ * @arg @ref LL_USART_STOPBITS_1
+ * @arg @ref LL_USART_STOPBITS_1_5
+ * @arg @ref LL_USART_STOPBITS_2
+ */
+__STATIC_INLINE uint32_t LL_USART_GetStopBitsLength(USART_TypeDef *USARTx)
+{
+ return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_STOP));
+}
+
+/**
+ * @brief Configure Character frame format (Datawidth, Parity control, Stop Bits)
+ * @note Call of this function is equivalent to following function call sequence :
+ * - Data Width configuration using @ref LL_USART_SetDataWidth() function
+ * - Parity Control and mode configuration using @ref LL_USART_SetParity() function
+ * - Stop bits configuration using @ref LL_USART_SetStopBitsLength() function
+ * @rmtoll CR1 PS LL_USART_ConfigCharacter\n
+ * CR1 PCE LL_USART_ConfigCharacter\n
+ * CR1 M0 LL_USART_ConfigCharacter\n
+ * CR1 M1 LL_USART_ConfigCharacter\n
+ * CR2 STOP LL_USART_ConfigCharacter
+ * @param USARTx USART Instance
+ * @param DataWidth This parameter can be one of the following values:
+ * @arg @ref LL_USART_DATAWIDTH_7B
+ * @arg @ref LL_USART_DATAWIDTH_8B
+ * @arg @ref LL_USART_DATAWIDTH_9B
+ * @param Parity This parameter can be one of the following values:
+ * @arg @ref LL_USART_PARITY_NONE
+ * @arg @ref LL_USART_PARITY_EVEN
+ * @arg @ref LL_USART_PARITY_ODD
+ * @param StopBits This parameter can be one of the following values:
+ * @arg @ref LL_USART_STOPBITS_0_5
+ * @arg @ref LL_USART_STOPBITS_1
+ * @arg @ref LL_USART_STOPBITS_1_5
+ * @arg @ref LL_USART_STOPBITS_2
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_ConfigCharacter(USART_TypeDef *USARTx, uint32_t DataWidth, uint32_t Parity,
+ uint32_t StopBits)
+{
+ MODIFY_REG(USARTx->CR1, USART_CR1_PS | USART_CR1_PCE | USART_CR1_M, Parity | DataWidth);
+ MODIFY_REG(USARTx->CR2, USART_CR2_STOP, StopBits);
+}
+
+/**
+ * @brief Configure TX/RX pins swapping setting.
+ * @rmtoll CR2 SWAP LL_USART_SetTXRXSwap
+ * @param USARTx USART Instance
+ * @param SwapConfig This parameter can be one of the following values:
+ * @arg @ref LL_USART_TXRX_STANDARD
+ * @arg @ref LL_USART_TXRX_SWAPPED
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_SetTXRXSwap(USART_TypeDef *USARTx, uint32_t SwapConfig)
+{
+ MODIFY_REG(USARTx->CR2, USART_CR2_SWAP, SwapConfig);
+}
+
+/**
+ * @brief Retrieve TX/RX pins swapping configuration.
+ * @rmtoll CR2 SWAP LL_USART_GetTXRXSwap
+ * @param USARTx USART Instance
+ * @retval Returned value can be one of the following values:
+ * @arg @ref LL_USART_TXRX_STANDARD
+ * @arg @ref LL_USART_TXRX_SWAPPED
+ */
+__STATIC_INLINE uint32_t LL_USART_GetTXRXSwap(USART_TypeDef *USARTx)
+{
+ return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_SWAP));
+}
+
+/**
+ * @brief Configure RX pin active level logic
+ * @rmtoll CR2 RXINV LL_USART_SetRXPinLevel
+ * @param USARTx USART Instance
+ * @param PinInvMethod This parameter can be one of the following values:
+ * @arg @ref LL_USART_RXPIN_LEVEL_STANDARD
+ * @arg @ref LL_USART_RXPIN_LEVEL_INVERTED
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_SetRXPinLevel(USART_TypeDef *USARTx, uint32_t PinInvMethod)
+{
+ MODIFY_REG(USARTx->CR2, USART_CR2_RXINV, PinInvMethod);
+}
+
+/**
+ * @brief Retrieve RX pin active level logic configuration
+ * @rmtoll CR2 RXINV LL_USART_GetRXPinLevel
+ * @param USARTx USART Instance
+ * @retval Returned value can be one of the following values:
+ * @arg @ref LL_USART_RXPIN_LEVEL_STANDARD
+ * @arg @ref LL_USART_RXPIN_LEVEL_INVERTED
+ */
+__STATIC_INLINE uint32_t LL_USART_GetRXPinLevel(USART_TypeDef *USARTx)
+{
+ return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_RXINV));
+}
+
+/**
+ * @brief Configure TX pin active level logic
+ * @rmtoll CR2 TXINV LL_USART_SetTXPinLevel
+ * @param USARTx USART Instance
+ * @param PinInvMethod This parameter can be one of the following values:
+ * @arg @ref LL_USART_TXPIN_LEVEL_STANDARD
+ * @arg @ref LL_USART_TXPIN_LEVEL_INVERTED
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_SetTXPinLevel(USART_TypeDef *USARTx, uint32_t PinInvMethod)
+{
+ MODIFY_REG(USARTx->CR2, USART_CR2_TXINV, PinInvMethod);
+}
+
+/**
+ * @brief Retrieve TX pin active level logic configuration
+ * @rmtoll CR2 TXINV LL_USART_GetTXPinLevel
+ * @param USARTx USART Instance
+ * @retval Returned value can be one of the following values:
+ * @arg @ref LL_USART_TXPIN_LEVEL_STANDARD
+ * @arg @ref LL_USART_TXPIN_LEVEL_INVERTED
+ */
+__STATIC_INLINE uint32_t LL_USART_GetTXPinLevel(USART_TypeDef *USARTx)
+{
+ return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_TXINV));
+}
+
+/**
+ * @brief Configure Binary data logic.
+ * @note Allow to define how Logical data from the data register are send/received :
+ * either in positive/direct logic (1=H, 0=L) or in negative/inverse logic (1=L, 0=H)
+ * @rmtoll CR2 DATAINV LL_USART_SetBinaryDataLogic
+ * @param USARTx USART Instance
+ * @param DataLogic This parameter can be one of the following values:
+ * @arg @ref LL_USART_BINARY_LOGIC_POSITIVE
+ * @arg @ref LL_USART_BINARY_LOGIC_NEGATIVE
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_SetBinaryDataLogic(USART_TypeDef *USARTx, uint32_t DataLogic)
+{
+ MODIFY_REG(USARTx->CR2, USART_CR2_DATAINV, DataLogic);
+}
+
+/**
+ * @brief Retrieve Binary data configuration
+ * @rmtoll CR2 DATAINV LL_USART_GetBinaryDataLogic
+ * @param USARTx USART Instance
+ * @retval Returned value can be one of the following values:
+ * @arg @ref LL_USART_BINARY_LOGIC_POSITIVE
+ * @arg @ref LL_USART_BINARY_LOGIC_NEGATIVE
+ */
+__STATIC_INLINE uint32_t LL_USART_GetBinaryDataLogic(USART_TypeDef *USARTx)
+{
+ return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_DATAINV));
+}
+
+/**
+ * @brief Configure transfer bit order (either Less or Most Significant Bit First)
+ * @note MSB First means data is transmitted/received with the MSB first, following the start bit.
+ * LSB First means data is transmitted/received with data bit 0 first, following the start bit.
+ * @rmtoll CR2 MSBFIRST LL_USART_SetTransferBitOrder
+ * @param USARTx USART Instance
+ * @param BitOrder This parameter can be one of the following values:
+ * @arg @ref LL_USART_BITORDER_LSBFIRST
+ * @arg @ref LL_USART_BITORDER_MSBFIRST
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_SetTransferBitOrder(USART_TypeDef *USARTx, uint32_t BitOrder)
+{
+ MODIFY_REG(USARTx->CR2, USART_CR2_MSBFIRST, BitOrder);
+}
+
+/**
+ * @brief Return transfer bit order (either Less or Most Significant Bit First)
+ * @note MSB First means data is transmitted/received with the MSB first, following the start bit.
+ * LSB First means data is transmitted/received with data bit 0 first, following the start bit.
+ * @rmtoll CR2 MSBFIRST LL_USART_GetTransferBitOrder
+ * @param USARTx USART Instance
+ * @retval Returned value can be one of the following values:
+ * @arg @ref LL_USART_BITORDER_LSBFIRST
+ * @arg @ref LL_USART_BITORDER_MSBFIRST
+ */
+__STATIC_INLINE uint32_t LL_USART_GetTransferBitOrder(USART_TypeDef *USARTx)
+{
+ return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_MSBFIRST));
+}
+
+/**
+ * @brief Enable Auto Baud-Rate Detection
+ * @note Macro IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(USARTx) can be used to check whether or not
+ * Auto Baud Rate detection feature is supported by the USARTx instance.
+ * @rmtoll CR2 ABREN LL_USART_EnableAutoBaudRate
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_EnableAutoBaudRate(USART_TypeDef *USARTx)
+{
+ SET_BIT(USARTx->CR2, USART_CR2_ABREN);
+}
+
+/**
+ * @brief Disable Auto Baud-Rate Detection
+ * @note Macro IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(USARTx) can be used to check whether or not
+ * Auto Baud Rate detection feature is supported by the USARTx instance.
+ * @rmtoll CR2 ABREN LL_USART_DisableAutoBaudRate
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_DisableAutoBaudRate(USART_TypeDef *USARTx)
+{
+ CLEAR_BIT(USARTx->CR2, USART_CR2_ABREN);
+}
+
+/**
+ * @brief Indicate if Auto Baud-Rate Detection mechanism is enabled
+ * @note Macro IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(USARTx) can be used to check whether or not
+ * Auto Baud Rate detection feature is supported by the USARTx instance.
+ * @rmtoll CR2 ABREN LL_USART_IsEnabledAutoBaud
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsEnabledAutoBaud(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->CR2, USART_CR2_ABREN) == (USART_CR2_ABREN)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Set Auto Baud-Rate mode bits
+ * @note Macro IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(USARTx) can be used to check whether or not
+ * Auto Baud Rate detection feature is supported by the USARTx instance.
+ * @rmtoll CR2 ABRMODE LL_USART_SetAutoBaudRateMode
+ * @param USARTx USART Instance
+ * @param AutoBaudRateMode This parameter can be one of the following values:
+ * @arg @ref LL_USART_AUTOBAUD_DETECT_ON_STARTBIT
+ * @arg @ref LL_USART_AUTOBAUD_DETECT_ON_FALLINGEDGE
+ * @arg @ref LL_USART_AUTOBAUD_DETECT_ON_7F_FRAME
+ * @arg @ref LL_USART_AUTOBAUD_DETECT_ON_55_FRAME
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_SetAutoBaudRateMode(USART_TypeDef *USARTx, uint32_t AutoBaudRateMode)
+{
+ MODIFY_REG(USARTx->CR2, USART_CR2_ABRMODE, AutoBaudRateMode);
+}
+
+/**
+ * @brief Return Auto Baud-Rate mode
+ * @note Macro IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(USARTx) can be used to check whether or not
+ * Auto Baud Rate detection feature is supported by the USARTx instance.
+ * @rmtoll CR2 ABRMODE LL_USART_GetAutoBaudRateMode
+ * @param USARTx USART Instance
+ * @retval Returned value can be one of the following values:
+ * @arg @ref LL_USART_AUTOBAUD_DETECT_ON_STARTBIT
+ * @arg @ref LL_USART_AUTOBAUD_DETECT_ON_FALLINGEDGE
+ * @arg @ref LL_USART_AUTOBAUD_DETECT_ON_7F_FRAME
+ * @arg @ref LL_USART_AUTOBAUD_DETECT_ON_55_FRAME
+ */
+__STATIC_INLINE uint32_t LL_USART_GetAutoBaudRateMode(USART_TypeDef *USARTx)
+{
+ return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_ABRMODE));
+}
+
+/**
+ * @brief Enable Receiver Timeout
+ * @rmtoll CR2 RTOEN LL_USART_EnableRxTimeout
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_EnableRxTimeout(USART_TypeDef *USARTx)
+{
+ SET_BIT(USARTx->CR2, USART_CR2_RTOEN);
+}
+
+/**
+ * @brief Disable Receiver Timeout
+ * @rmtoll CR2 RTOEN LL_USART_DisableRxTimeout
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_DisableRxTimeout(USART_TypeDef *USARTx)
+{
+ CLEAR_BIT(USARTx->CR2, USART_CR2_RTOEN);
+}
+
+/**
+ * @brief Indicate if Receiver Timeout feature is enabled
+ * @rmtoll CR2 RTOEN LL_USART_IsEnabledRxTimeout
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsEnabledRxTimeout(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->CR2, USART_CR2_RTOEN) == (USART_CR2_RTOEN)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Set Address of the USART node.
+ * @note This is used in multiprocessor communication during Mute mode or Stop mode,
+ * for wake up with address mark detection.
+ * @note 4bits address node is used when 4-bit Address Detection is selected in ADDM7.
+ * (b7-b4 should be set to 0)
+ * 8bits address node is used when 7-bit Address Detection is selected in ADDM7.
+ * (This is used in multiprocessor communication during Mute mode or Stop mode,
+ * for wake up with 7-bit address mark detection.
+ * The MSB of the character sent by the transmitter should be equal to 1.
+ * It may also be used for character detection during normal reception,
+ * Mute mode inactive (for example, end of block detection in ModBus protocol).
+ * In this case, the whole received character (8-bit) is compared to the ADD[7:0]
+ * value and CMF flag is set on match)
+ * @rmtoll CR2 ADD LL_USART_ConfigNodeAddress\n
+ * CR2 ADDM7 LL_USART_ConfigNodeAddress
+ * @param USARTx USART Instance
+ * @param AddressLen This parameter can be one of the following values:
+ * @arg @ref LL_USART_ADDRESS_DETECT_4B
+ * @arg @ref LL_USART_ADDRESS_DETECT_7B
+ * @param NodeAddress 4 or 7 bit Address of the USART node.
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_ConfigNodeAddress(USART_TypeDef *USARTx, uint32_t AddressLen, uint32_t NodeAddress)
+{
+ MODIFY_REG(USARTx->CR2, USART_CR2_ADD | USART_CR2_ADDM7,
+ (uint32_t)(AddressLen | (NodeAddress << USART_CR2_ADD_Pos)));
+}
+
+/**
+ * @brief Return 8 bit Address of the USART node as set in ADD field of CR2.
+ * @note If 4-bit Address Detection is selected in ADDM7,
+ * only 4bits (b3-b0) of returned value are relevant (b31-b4 are not relevant)
+ * If 7-bit Address Detection is selected in ADDM7,
+ * only 8bits (b7-b0) of returned value are relevant (b31-b8 are not relevant)
+ * @rmtoll CR2 ADD LL_USART_GetNodeAddress
+ * @param USARTx USART Instance
+ * @retval Address of the USART node (Value between Min_Data=0 and Max_Data=255)
+ */
+__STATIC_INLINE uint32_t LL_USART_GetNodeAddress(USART_TypeDef *USARTx)
+{
+ return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_ADD) >> USART_CR2_ADD_Pos);
+}
+
+/**
+ * @brief Return Length of Node Address used in Address Detection mode (7-bit or 4-bit)
+ * @rmtoll CR2 ADDM7 LL_USART_GetNodeAddressLen
+ * @param USARTx USART Instance
+ * @retval Returned value can be one of the following values:
+ * @arg @ref LL_USART_ADDRESS_DETECT_4B
+ * @arg @ref LL_USART_ADDRESS_DETECT_7B
+ */
+__STATIC_INLINE uint32_t LL_USART_GetNodeAddressLen(USART_TypeDef *USARTx)
+{
+ return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_ADDM7));
+}
+
+/**
+ * @brief Enable RTS HW Flow Control
+ * @note Macro IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
+ * Hardware Flow control feature is supported by the USARTx instance.
+ * @rmtoll CR3 RTSE LL_USART_EnableRTSHWFlowCtrl
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_EnableRTSHWFlowCtrl(USART_TypeDef *USARTx)
+{
+ SET_BIT(USARTx->CR3, USART_CR3_RTSE);
+}
+
+/**
+ * @brief Disable RTS HW Flow Control
+ * @note Macro IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
+ * Hardware Flow control feature is supported by the USARTx instance.
+ * @rmtoll CR3 RTSE LL_USART_DisableRTSHWFlowCtrl
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_DisableRTSHWFlowCtrl(USART_TypeDef *USARTx)
+{
+ CLEAR_BIT(USARTx->CR3, USART_CR3_RTSE);
+}
+
+/**
+ * @brief Enable CTS HW Flow Control
+ * @note Macro IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
+ * Hardware Flow control feature is supported by the USARTx instance.
+ * @rmtoll CR3 CTSE LL_USART_EnableCTSHWFlowCtrl
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_EnableCTSHWFlowCtrl(USART_TypeDef *USARTx)
+{
+ SET_BIT(USARTx->CR3, USART_CR3_CTSE);
+}
+
+/**
+ * @brief Disable CTS HW Flow Control
+ * @note Macro IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
+ * Hardware Flow control feature is supported by the USARTx instance.
+ * @rmtoll CR3 CTSE LL_USART_DisableCTSHWFlowCtrl
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_DisableCTSHWFlowCtrl(USART_TypeDef *USARTx)
+{
+ CLEAR_BIT(USARTx->CR3, USART_CR3_CTSE);
+}
+
+/**
+ * @brief Configure HW Flow Control mode (both CTS and RTS)
+ * @note Macro IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
+ * Hardware Flow control feature is supported by the USARTx instance.
+ * @rmtoll CR3 RTSE LL_USART_SetHWFlowCtrl\n
+ * CR3 CTSE LL_USART_SetHWFlowCtrl
+ * @param USARTx USART Instance
+ * @param HardwareFlowControl This parameter can be one of the following values:
+ * @arg @ref LL_USART_HWCONTROL_NONE
+ * @arg @ref LL_USART_HWCONTROL_RTS
+ * @arg @ref LL_USART_HWCONTROL_CTS
+ * @arg @ref LL_USART_HWCONTROL_RTS_CTS
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_SetHWFlowCtrl(USART_TypeDef *USARTx, uint32_t HardwareFlowControl)
+{
+ MODIFY_REG(USARTx->CR3, USART_CR3_RTSE | USART_CR3_CTSE, HardwareFlowControl);
+}
+
+/**
+ * @brief Return HW Flow Control configuration (both CTS and RTS)
+ * @note Macro IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
+ * Hardware Flow control feature is supported by the USARTx instance.
+ * @rmtoll CR3 RTSE LL_USART_GetHWFlowCtrl\n
+ * CR3 CTSE LL_USART_GetHWFlowCtrl
+ * @param USARTx USART Instance
+ * @retval Returned value can be one of the following values:
+ * @arg @ref LL_USART_HWCONTROL_NONE
+ * @arg @ref LL_USART_HWCONTROL_RTS
+ * @arg @ref LL_USART_HWCONTROL_CTS
+ * @arg @ref LL_USART_HWCONTROL_RTS_CTS
+ */
+__STATIC_INLINE uint32_t LL_USART_GetHWFlowCtrl(USART_TypeDef *USARTx)
+{
+ return (uint32_t)(READ_BIT(USARTx->CR3, USART_CR3_RTSE | USART_CR3_CTSE));
+}
+
+/**
+ * @brief Enable One bit sampling method
+ * @rmtoll CR3 ONEBIT LL_USART_EnableOneBitSamp
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_EnableOneBitSamp(USART_TypeDef *USARTx)
+{
+ SET_BIT(USARTx->CR3, USART_CR3_ONEBIT);
+}
+
+/**
+ * @brief Disable One bit sampling method
+ * @rmtoll CR3 ONEBIT LL_USART_DisableOneBitSamp
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_DisableOneBitSamp(USART_TypeDef *USARTx)
+{
+ CLEAR_BIT(USARTx->CR3, USART_CR3_ONEBIT);
+}
+
+/**
+ * @brief Indicate if One bit sampling method is enabled
+ * @rmtoll CR3 ONEBIT LL_USART_IsEnabledOneBitSamp
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsEnabledOneBitSamp(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->CR3, USART_CR3_ONEBIT) == (USART_CR3_ONEBIT)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Enable Overrun detection
+ * @rmtoll CR3 OVRDIS LL_USART_EnableOverrunDetect
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_EnableOverrunDetect(USART_TypeDef *USARTx)
+{
+ CLEAR_BIT(USARTx->CR3, USART_CR3_OVRDIS);
+}
+
+/**
+ * @brief Disable Overrun detection
+ * @rmtoll CR3 OVRDIS LL_USART_DisableOverrunDetect
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_DisableOverrunDetect(USART_TypeDef *USARTx)
+{
+ SET_BIT(USARTx->CR3, USART_CR3_OVRDIS);
+}
+
+/**
+ * @brief Indicate if Overrun detection is enabled
+ * @rmtoll CR3 OVRDIS LL_USART_IsEnabledOverrunDetect
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsEnabledOverrunDetect(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->CR3, USART_CR3_OVRDIS) != USART_CR3_OVRDIS) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Select event type for Wake UP Interrupt Flag (WUS[1:0] bits)
+ * @note Macro IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not
+ * Wake-up from Stop mode feature is supported by the USARTx instance.
+ * @rmtoll CR3 WUS LL_USART_SetWKUPType
+ * @param USARTx USART Instance
+ * @param Type This parameter can be one of the following values:
+ * @arg @ref LL_USART_WAKEUP_ON_ADDRESS
+ * @arg @ref LL_USART_WAKEUP_ON_STARTBIT
+ * @arg @ref LL_USART_WAKEUP_ON_RXNE
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_SetWKUPType(USART_TypeDef *USARTx, uint32_t Type)
+{
+ MODIFY_REG(USARTx->CR3, USART_CR3_WUS, Type);
+}
+
+/**
+ * @brief Return event type for Wake UP Interrupt Flag (WUS[1:0] bits)
+ * @note Macro IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not
+ * Wake-up from Stop mode feature is supported by the USARTx instance.
+ * @rmtoll CR3 WUS LL_USART_GetWKUPType
+ * @param USARTx USART Instance
+ * @retval Returned value can be one of the following values:
+ * @arg @ref LL_USART_WAKEUP_ON_ADDRESS
+ * @arg @ref LL_USART_WAKEUP_ON_STARTBIT
+ * @arg @ref LL_USART_WAKEUP_ON_RXNE
+ */
+__STATIC_INLINE uint32_t LL_USART_GetWKUPType(USART_TypeDef *USARTx)
+{
+ return (uint32_t)(READ_BIT(USARTx->CR3, USART_CR3_WUS));
+}
+
+/**
+ * @brief Configure USART BRR register for achieving expected Baud Rate value.
+ * @note Compute and set USARTDIV value in BRR Register (full BRR content)
+ * according to used Peripheral Clock, Oversampling mode, and expected Baud Rate values
+ * @note Peripheral clock and Baud rate values provided as function parameters should be valid
+ * (Baud rate value != 0)
+ * @note In case of oversampling by 16 and 8, BRR content must be greater than or equal to 16d.
+ * @rmtoll BRR BRR LL_USART_SetBaudRate
+ * @param USARTx USART Instance
+ * @param PeriphClk Peripheral Clock
+ * @param OverSampling This parameter can be one of the following values:
+ * @arg @ref LL_USART_OVERSAMPLING_16
+ * @arg @ref LL_USART_OVERSAMPLING_8
+ * @param BaudRate Baud Rate
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_SetBaudRate(USART_TypeDef *USARTx, uint32_t PeriphClk, uint32_t OverSampling,
+ uint32_t BaudRate)
+{
+ uint32_t usartdiv;
+ uint32_t brrtemp;
+
+ if (OverSampling == LL_USART_OVERSAMPLING_8)
+ {
+ usartdiv = (uint16_t)(__LL_USART_DIV_SAMPLING8(PeriphClk, BaudRate));
+ brrtemp = usartdiv & 0xFFF0U;
+ brrtemp |= (uint16_t)((usartdiv & (uint16_t)0x000FU) >> 1U);
+ USARTx->BRR = brrtemp;
+ }
+ else
+ {
+ USARTx->BRR = (uint16_t)(__LL_USART_DIV_SAMPLING16(PeriphClk, BaudRate));
+ }
+}
+
+/**
+ * @brief Return current Baud Rate value, according to USARTDIV present in BRR register
+ * (full BRR content), and to used Peripheral Clock and Oversampling mode values
+ * @note In case of non-initialized or invalid value stored in BRR register, value 0 will be returned.
+ * @note In case of oversampling by 16 and 8, BRR content must be greater than or equal to 16d.
+ * @rmtoll BRR BRR LL_USART_GetBaudRate
+ * @param USARTx USART Instance
+ * @param PeriphClk Peripheral Clock
+ * @param OverSampling This parameter can be one of the following values:
+ * @arg @ref LL_USART_OVERSAMPLING_16
+ * @arg @ref LL_USART_OVERSAMPLING_8
+ * @retval Baud Rate
+ */
+__STATIC_INLINE uint32_t LL_USART_GetBaudRate(USART_TypeDef *USARTx, uint32_t PeriphClk, uint32_t OverSampling)
+{
+ uint32_t usartdiv;
+ uint32_t brrresult = 0x0U;
+
+ usartdiv = USARTx->BRR;
+
+ if (usartdiv == 0U)
+ {
+ /* Do not perform a division by 0 */
+ }
+ else if (OverSampling == LL_USART_OVERSAMPLING_8)
+ {
+ usartdiv = (uint16_t)((usartdiv & 0xFFF0U) | ((usartdiv & 0x0007U) << 1U)) ;
+ if (usartdiv != 0U)
+ {
+ brrresult = (PeriphClk * 2U) / usartdiv;
+ }
+ }
+ else
+ {
+ if ((usartdiv & 0xFFFFU) != 0U)
+ {
+ brrresult = PeriphClk / usartdiv;
+ }
+ }
+ return (brrresult);
+}
+
+/**
+ * @brief Set Receiver Time Out Value (expressed in nb of bits duration)
+ * @rmtoll RTOR RTO LL_USART_SetRxTimeout
+ * @param USARTx USART Instance
+ * @param Timeout Value between Min_Data=0x00 and Max_Data=0x00FFFFFF
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_SetRxTimeout(USART_TypeDef *USARTx, uint32_t Timeout)
+{
+ MODIFY_REG(USARTx->RTOR, USART_RTOR_RTO, Timeout);
+}
+
+/**
+ * @brief Get Receiver Time Out Value (expressed in nb of bits duration)
+ * @rmtoll RTOR RTO LL_USART_GetRxTimeout
+ * @param USARTx USART Instance
+ * @retval Value between Min_Data=0x00 and Max_Data=0x00FFFFFF
+ */
+__STATIC_INLINE uint32_t LL_USART_GetRxTimeout(USART_TypeDef *USARTx)
+{
+ return (uint32_t)(READ_BIT(USARTx->RTOR, USART_RTOR_RTO));
+}
+
+/**
+ * @brief Set Block Length value in reception
+ * @rmtoll RTOR BLEN LL_USART_SetBlockLength
+ * @param USARTx USART Instance
+ * @param BlockLength Value between Min_Data=0x00 and Max_Data=0xFF
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_SetBlockLength(USART_TypeDef *USARTx, uint32_t BlockLength)
+{
+ MODIFY_REG(USARTx->RTOR, USART_RTOR_BLEN, BlockLength << USART_RTOR_BLEN_Pos);
+}
+
+/**
+ * @brief Get Block Length value in reception
+ * @rmtoll RTOR BLEN LL_USART_GetBlockLength
+ * @param USARTx USART Instance
+ * @retval Value between Min_Data=0x00 and Max_Data=0xFF
+ */
+__STATIC_INLINE uint32_t LL_USART_GetBlockLength(USART_TypeDef *USARTx)
+{
+ return (uint32_t)(READ_BIT(USARTx->RTOR, USART_RTOR_BLEN) >> USART_RTOR_BLEN_Pos);
+}
+
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EF_Configuration_IRDA Configuration functions related to Irda feature
+ * @{
+ */
+
+/**
+ * @brief Enable IrDA mode
+ * @note Macro IS_IRDA_INSTANCE(USARTx) can be used to check whether or not
+ * IrDA feature is supported by the USARTx instance.
+ * @rmtoll CR3 IREN LL_USART_EnableIrda
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_EnableIrda(USART_TypeDef *USARTx)
+{
+ SET_BIT(USARTx->CR3, USART_CR3_IREN);
+}
+
+/**
+ * @brief Disable IrDA mode
+ * @note Macro IS_IRDA_INSTANCE(USARTx) can be used to check whether or not
+ * IrDA feature is supported by the USARTx instance.
+ * @rmtoll CR3 IREN LL_USART_DisableIrda
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_DisableIrda(USART_TypeDef *USARTx)
+{
+ CLEAR_BIT(USARTx->CR3, USART_CR3_IREN);
+}
+
+/**
+ * @brief Indicate if IrDA mode is enabled
+ * @note Macro IS_IRDA_INSTANCE(USARTx) can be used to check whether or not
+ * IrDA feature is supported by the USARTx instance.
+ * @rmtoll CR3 IREN LL_USART_IsEnabledIrda
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsEnabledIrda(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->CR3, USART_CR3_IREN) == (USART_CR3_IREN)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Configure IrDA Power Mode (Normal or Low Power)
+ * @note Macro IS_IRDA_INSTANCE(USARTx) can be used to check whether or not
+ * IrDA feature is supported by the USARTx instance.
+ * @rmtoll CR3 IRLP LL_USART_SetIrdaPowerMode
+ * @param USARTx USART Instance
+ * @param PowerMode This parameter can be one of the following values:
+ * @arg @ref LL_USART_IRDA_POWER_NORMAL
+ * @arg @ref LL_USART_IRDA_POWER_LOW
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_SetIrdaPowerMode(USART_TypeDef *USARTx, uint32_t PowerMode)
+{
+ MODIFY_REG(USARTx->CR3, USART_CR3_IRLP, PowerMode);
+}
+
+/**
+ * @brief Retrieve IrDA Power Mode configuration (Normal or Low Power)
+ * @note Macro IS_IRDA_INSTANCE(USARTx) can be used to check whether or not
+ * IrDA feature is supported by the USARTx instance.
+ * @rmtoll CR3 IRLP LL_USART_GetIrdaPowerMode
+ * @param USARTx USART Instance
+ * @retval Returned value can be one of the following values:
+ * @arg @ref LL_USART_IRDA_POWER_NORMAL
+ * @arg @ref LL_USART_PHASE_2EDGE
+ */
+__STATIC_INLINE uint32_t LL_USART_GetIrdaPowerMode(USART_TypeDef *USARTx)
+{
+ return (uint32_t)(READ_BIT(USARTx->CR3, USART_CR3_IRLP));
+}
+
+/**
+ * @brief Set Irda prescaler value, used for dividing the USART clock source
+ * to achieve the Irda Low Power frequency (8 bits value)
+ * @note Macro IS_IRDA_INSTANCE(USARTx) can be used to check whether or not
+ * IrDA feature is supported by the USARTx instance.
+ * @rmtoll GTPR PSC LL_USART_SetIrdaPrescaler
+ * @param USARTx USART Instance
+ * @param PrescalerValue Value between Min_Data=0x00 and Max_Data=0xFF
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_SetIrdaPrescaler(USART_TypeDef *USARTx, uint32_t PrescalerValue)
+{
+ MODIFY_REG(USARTx->GTPR, (uint16_t)USART_GTPR_PSC, (uint16_t)PrescalerValue);
+}
+
+/**
+ * @brief Return Irda prescaler value, used for dividing the USART clock source
+ * to achieve the Irda Low Power frequency (8 bits value)
+ * @note Macro IS_IRDA_INSTANCE(USARTx) can be used to check whether or not
+ * IrDA feature is supported by the USARTx instance.
+ * @rmtoll GTPR PSC LL_USART_GetIrdaPrescaler
+ * @param USARTx USART Instance
+ * @retval Irda prescaler value (Value between Min_Data=0x00 and Max_Data=0xFF)
+ */
+__STATIC_INLINE uint32_t LL_USART_GetIrdaPrescaler(USART_TypeDef *USARTx)
+{
+ return (uint32_t)(READ_BIT(USARTx->GTPR, USART_GTPR_PSC));
+}
+
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EF_Configuration_Smartcard Configuration functions related to Smartcard feature
+ * @{
+ */
+
+/**
+ * @brief Enable Smartcard NACK transmission
+ * @note Macro IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
+ * Smartcard feature is supported by the USARTx instance.
+ * @rmtoll CR3 NACK LL_USART_EnableSmartcardNACK
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_EnableSmartcardNACK(USART_TypeDef *USARTx)
+{
+ SET_BIT(USARTx->CR3, USART_CR3_NACK);
+}
+
+/**
+ * @brief Disable Smartcard NACK transmission
+ * @note Macro IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
+ * Smartcard feature is supported by the USARTx instance.
+ * @rmtoll CR3 NACK LL_USART_DisableSmartcardNACK
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_DisableSmartcardNACK(USART_TypeDef *USARTx)
+{
+ CLEAR_BIT(USARTx->CR3, USART_CR3_NACK);
+}
+
+/**
+ * @brief Indicate if Smartcard NACK transmission is enabled
+ * @note Macro IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
+ * Smartcard feature is supported by the USARTx instance.
+ * @rmtoll CR3 NACK LL_USART_IsEnabledSmartcardNACK
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsEnabledSmartcardNACK(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->CR3, USART_CR3_NACK) == (USART_CR3_NACK)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Enable Smartcard mode
+ * @note Macro IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
+ * Smartcard feature is supported by the USARTx instance.
+ * @rmtoll CR3 SCEN LL_USART_EnableSmartcard
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_EnableSmartcard(USART_TypeDef *USARTx)
+{
+ SET_BIT(USARTx->CR3, USART_CR3_SCEN);
+}
+
+/**
+ * @brief Disable Smartcard mode
+ * @note Macro IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
+ * Smartcard feature is supported by the USARTx instance.
+ * @rmtoll CR3 SCEN LL_USART_DisableSmartcard
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_DisableSmartcard(USART_TypeDef *USARTx)
+{
+ CLEAR_BIT(USARTx->CR3, USART_CR3_SCEN);
+}
+
+/**
+ * @brief Indicate if Smartcard mode is enabled
+ * @note Macro IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
+ * Smartcard feature is supported by the USARTx instance.
+ * @rmtoll CR3 SCEN LL_USART_IsEnabledSmartcard
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsEnabledSmartcard(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->CR3, USART_CR3_SCEN) == (USART_CR3_SCEN)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Set Smartcard Auto-Retry Count value (SCARCNT[2:0] bits)
+ * @note Macro IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
+ * Smartcard feature is supported by the USARTx instance.
+ * @note This bit-field specifies the number of retries in transmit and receive, in Smartcard mode.
+ * In transmission mode, it specifies the number of automatic retransmission retries, before
+ * generating a transmission error (FE bit set).
+ * In reception mode, it specifies the number or erroneous reception trials, before generating a
+ * reception error (RXNE and PE bits set)
+ * @rmtoll CR3 SCARCNT LL_USART_SetSmartcardAutoRetryCount
+ * @param USARTx USART Instance
+ * @param AutoRetryCount Value between Min_Data=0 and Max_Data=7
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_SetSmartcardAutoRetryCount(USART_TypeDef *USARTx, uint32_t AutoRetryCount)
+{
+ MODIFY_REG(USARTx->CR3, USART_CR3_SCARCNT, AutoRetryCount << USART_CR3_SCARCNT_Pos);
+}
+
+/**
+ * @brief Return Smartcard Auto-Retry Count value (SCARCNT[2:0] bits)
+ * @note Macro IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
+ * Smartcard feature is supported by the USARTx instance.
+ * @rmtoll CR3 SCARCNT LL_USART_GetSmartcardAutoRetryCount
+ * @param USARTx USART Instance
+ * @retval Smartcard Auto-Retry Count value (Value between Min_Data=0 and Max_Data=7)
+ */
+__STATIC_INLINE uint32_t LL_USART_GetSmartcardAutoRetryCount(USART_TypeDef *USARTx)
+{
+ return (uint32_t)(READ_BIT(USARTx->CR3, USART_CR3_SCARCNT) >> USART_CR3_SCARCNT_Pos);
+}
+
+/**
+ * @brief Set Smartcard prescaler value, used for dividing the USART clock
+ * source to provide the SMARTCARD Clock (5 bits value)
+ * @note Macro IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
+ * Smartcard feature is supported by the USARTx instance.
+ * @rmtoll GTPR PSC LL_USART_SetSmartcardPrescaler
+ * @param USARTx USART Instance
+ * @param PrescalerValue Value between Min_Data=0 and Max_Data=31
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_SetSmartcardPrescaler(USART_TypeDef *USARTx, uint32_t PrescalerValue)
+{
+ MODIFY_REG(USARTx->GTPR, (uint16_t)USART_GTPR_PSC, (uint16_t)PrescalerValue);
+}
+
+/**
+ * @brief Return Smartcard prescaler value, used for dividing the USART clock
+ * source to provide the SMARTCARD Clock (5 bits value)
+ * @note Macro IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
+ * Smartcard feature is supported by the USARTx instance.
+ * @rmtoll GTPR PSC LL_USART_GetSmartcardPrescaler
+ * @param USARTx USART Instance
+ * @retval Smartcard prescaler value (Value between Min_Data=0 and Max_Data=31)
+ */
+__STATIC_INLINE uint32_t LL_USART_GetSmartcardPrescaler(USART_TypeDef *USARTx)
+{
+ return (uint32_t)(READ_BIT(USARTx->GTPR, USART_GTPR_PSC));
+}
+
+/**
+ * @brief Set Smartcard Guard time value, expressed in nb of baud clocks periods
+ * (GT[7:0] bits : Guard time value)
+ * @note Macro IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
+ * Smartcard feature is supported by the USARTx instance.
+ * @rmtoll GTPR GT LL_USART_SetSmartcardGuardTime
+ * @param USARTx USART Instance
+ * @param GuardTime Value between Min_Data=0x00 and Max_Data=0xFF
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_SetSmartcardGuardTime(USART_TypeDef *USARTx, uint32_t GuardTime)
+{
+ MODIFY_REG(USARTx->GTPR, (uint16_t)USART_GTPR_GT, (uint16_t)(GuardTime << USART_GTPR_GT_Pos));
+}
+
+/**
+ * @brief Return Smartcard Guard time value, expressed in nb of baud clocks periods
+ * (GT[7:0] bits : Guard time value)
+ * @note Macro IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
+ * Smartcard feature is supported by the USARTx instance.
+ * @rmtoll GTPR GT LL_USART_GetSmartcardGuardTime
+ * @param USARTx USART Instance
+ * @retval Smartcard Guard time value (Value between Min_Data=0x00 and Max_Data=0xFF)
+ */
+__STATIC_INLINE uint32_t LL_USART_GetSmartcardGuardTime(USART_TypeDef *USARTx)
+{
+ return (uint32_t)(READ_BIT(USARTx->GTPR, USART_GTPR_GT) >> USART_GTPR_GT_Pos);
+}
+
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EF_Configuration_HalfDuplex Configuration functions related to Half Duplex feature
+ * @{
+ */
+
+/**
+ * @brief Enable Single Wire Half-Duplex mode
+ * @note Macro IS_UART_HALFDUPLEX_INSTANCE(USARTx) can be used to check whether or not
+ * Half-Duplex mode is supported by the USARTx instance.
+ * @rmtoll CR3 HDSEL LL_USART_EnableHalfDuplex
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_EnableHalfDuplex(USART_TypeDef *USARTx)
+{
+ SET_BIT(USARTx->CR3, USART_CR3_HDSEL);
+}
+
+/**
+ * @brief Disable Single Wire Half-Duplex mode
+ * @note Macro IS_UART_HALFDUPLEX_INSTANCE(USARTx) can be used to check whether or not
+ * Half-Duplex mode is supported by the USARTx instance.
+ * @rmtoll CR3 HDSEL LL_USART_DisableHalfDuplex
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_DisableHalfDuplex(USART_TypeDef *USARTx)
+{
+ CLEAR_BIT(USARTx->CR3, USART_CR3_HDSEL);
+}
+
+/**
+ * @brief Indicate if Single Wire Half-Duplex mode is enabled
+ * @note Macro IS_UART_HALFDUPLEX_INSTANCE(USARTx) can be used to check whether or not
+ * Half-Duplex mode is supported by the USARTx instance.
+ * @rmtoll CR3 HDSEL LL_USART_IsEnabledHalfDuplex
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsEnabledHalfDuplex(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->CR3, USART_CR3_HDSEL) == (USART_CR3_HDSEL)) ? 1UL : 0UL);
+}
+
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EF_Configuration_LIN Configuration functions related to LIN feature
+ * @{
+ */
+
+/**
+ * @brief Set LIN Break Detection Length
+ * @note Macro IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
+ * LIN feature is supported by the USARTx instance.
+ * @rmtoll CR2 LBDL LL_USART_SetLINBrkDetectionLen
+ * @param USARTx USART Instance
+ * @param LINBDLength This parameter can be one of the following values:
+ * @arg @ref LL_USART_LINBREAK_DETECT_10B
+ * @arg @ref LL_USART_LINBREAK_DETECT_11B
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_SetLINBrkDetectionLen(USART_TypeDef *USARTx, uint32_t LINBDLength)
+{
+ MODIFY_REG(USARTx->CR2, USART_CR2_LBDL, LINBDLength);
+}
+
+/**
+ * @brief Return LIN Break Detection Length
+ * @note Macro IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
+ * LIN feature is supported by the USARTx instance.
+ * @rmtoll CR2 LBDL LL_USART_GetLINBrkDetectionLen
+ * @param USARTx USART Instance
+ * @retval Returned value can be one of the following values:
+ * @arg @ref LL_USART_LINBREAK_DETECT_10B
+ * @arg @ref LL_USART_LINBREAK_DETECT_11B
+ */
+__STATIC_INLINE uint32_t LL_USART_GetLINBrkDetectionLen(USART_TypeDef *USARTx)
+{
+ return (uint32_t)(READ_BIT(USARTx->CR2, USART_CR2_LBDL));
+}
+
+/**
+ * @brief Enable LIN mode
+ * @note Macro IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
+ * LIN feature is supported by the USARTx instance.
+ * @rmtoll CR2 LINEN LL_USART_EnableLIN
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_EnableLIN(USART_TypeDef *USARTx)
+{
+ SET_BIT(USARTx->CR2, USART_CR2_LINEN);
+}
+
+/**
+ * @brief Disable LIN mode
+ * @note Macro IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
+ * LIN feature is supported by the USARTx instance.
+ * @rmtoll CR2 LINEN LL_USART_DisableLIN
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_DisableLIN(USART_TypeDef *USARTx)
+{
+ CLEAR_BIT(USARTx->CR2, USART_CR2_LINEN);
+}
+
+/**
+ * @brief Indicate if LIN mode is enabled
+ * @note Macro IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
+ * LIN feature is supported by the USARTx instance.
+ * @rmtoll CR2 LINEN LL_USART_IsEnabledLIN
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsEnabledLIN(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->CR2, USART_CR2_LINEN) == (USART_CR2_LINEN)) ? 1UL : 0UL);
+}
+
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EF_Configuration_DE Configuration functions related to Driver Enable feature
+ * @{
+ */
+
+/**
+ * @brief Set DEDT (Driver Enable De-Assertion Time), Time value expressed on 5 bits ([4:0] bits).
+ * @note Macro IS_UART_DRIVER_ENABLE_INSTANCE(USARTx) can be used to check whether or not
+ * Driver Enable feature is supported by the USARTx instance.
+ * @rmtoll CR1 DEDT LL_USART_SetDEDeassertionTime
+ * @param USARTx USART Instance
+ * @param Time Value between Min_Data=0 and Max_Data=31
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_SetDEDeassertionTime(USART_TypeDef *USARTx, uint32_t Time)
+{
+ MODIFY_REG(USARTx->CR1, USART_CR1_DEDT, Time << USART_CR1_DEDT_Pos);
+}
+
+/**
+ * @brief Return DEDT (Driver Enable De-Assertion Time)
+ * @note Macro IS_UART_DRIVER_ENABLE_INSTANCE(USARTx) can be used to check whether or not
+ * Driver Enable feature is supported by the USARTx instance.
+ * @rmtoll CR1 DEDT LL_USART_GetDEDeassertionTime
+ * @param USARTx USART Instance
+ * @retval Time value expressed on 5 bits ([4:0] bits) : Value between Min_Data=0 and Max_Data=31
+ */
+__STATIC_INLINE uint32_t LL_USART_GetDEDeassertionTime(USART_TypeDef *USARTx)
+{
+ return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_DEDT) >> USART_CR1_DEDT_Pos);
+}
+
+/**
+ * @brief Set DEAT (Driver Enable Assertion Time), Time value expressed on 5 bits ([4:0] bits).
+ * @note Macro IS_UART_DRIVER_ENABLE_INSTANCE(USARTx) can be used to check whether or not
+ * Driver Enable feature is supported by the USARTx instance.
+ * @rmtoll CR1 DEAT LL_USART_SetDEAssertionTime
+ * @param USARTx USART Instance
+ * @param Time Value between Min_Data=0 and Max_Data=31
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_SetDEAssertionTime(USART_TypeDef *USARTx, uint32_t Time)
+{
+ MODIFY_REG(USARTx->CR1, USART_CR1_DEAT, Time << USART_CR1_DEAT_Pos);
+}
+
+/**
+ * @brief Return DEAT (Driver Enable Assertion Time)
+ * @note Macro IS_UART_DRIVER_ENABLE_INSTANCE(USARTx) can be used to check whether or not
+ * Driver Enable feature is supported by the USARTx instance.
+ * @rmtoll CR1 DEAT LL_USART_GetDEAssertionTime
+ * @param USARTx USART Instance
+ * @retval Time value expressed on 5 bits ([4:0] bits) : Value between Min_Data=0 and Max_Data=31
+ */
+__STATIC_INLINE uint32_t LL_USART_GetDEAssertionTime(USART_TypeDef *USARTx)
+{
+ return (uint32_t)(READ_BIT(USARTx->CR1, USART_CR1_DEAT) >> USART_CR1_DEAT_Pos);
+}
+
+/**
+ * @brief Enable Driver Enable (DE) Mode
+ * @note Macro IS_UART_DRIVER_ENABLE_INSTANCE(USARTx) can be used to check whether or not
+ * Driver Enable feature is supported by the USARTx instance.
+ * @rmtoll CR3 DEM LL_USART_EnableDEMode
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_EnableDEMode(USART_TypeDef *USARTx)
+{
+ SET_BIT(USARTx->CR3, USART_CR3_DEM);
+}
+
+/**
+ * @brief Disable Driver Enable (DE) Mode
+ * @note Macro IS_UART_DRIVER_ENABLE_INSTANCE(USARTx) can be used to check whether or not
+ * Driver Enable feature is supported by the USARTx instance.
+ * @rmtoll CR3 DEM LL_USART_DisableDEMode
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_DisableDEMode(USART_TypeDef *USARTx)
+{
+ CLEAR_BIT(USARTx->CR3, USART_CR3_DEM);
+}
+
+/**
+ * @brief Indicate if Driver Enable (DE) Mode is enabled
+ * @note Macro IS_UART_DRIVER_ENABLE_INSTANCE(USARTx) can be used to check whether or not
+ * Driver Enable feature is supported by the USARTx instance.
+ * @rmtoll CR3 DEM LL_USART_IsEnabledDEMode
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsEnabledDEMode(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->CR3, USART_CR3_DEM) == (USART_CR3_DEM)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Select Driver Enable Polarity
+ * @note Macro IS_UART_DRIVER_ENABLE_INSTANCE(USARTx) can be used to check whether or not
+ * Driver Enable feature is supported by the USARTx instance.
+ * @rmtoll CR3 DEP LL_USART_SetDESignalPolarity
+ * @param USARTx USART Instance
+ * @param Polarity This parameter can be one of the following values:
+ * @arg @ref LL_USART_DE_POLARITY_HIGH
+ * @arg @ref LL_USART_DE_POLARITY_LOW
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_SetDESignalPolarity(USART_TypeDef *USARTx, uint32_t Polarity)
+{
+ MODIFY_REG(USARTx->CR3, USART_CR3_DEP, Polarity);
+}
+
+/**
+ * @brief Return Driver Enable Polarity
+ * @note Macro IS_UART_DRIVER_ENABLE_INSTANCE(USARTx) can be used to check whether or not
+ * Driver Enable feature is supported by the USARTx instance.
+ * @rmtoll CR3 DEP LL_USART_GetDESignalPolarity
+ * @param USARTx USART Instance
+ * @retval Returned value can be one of the following values:
+ * @arg @ref LL_USART_DE_POLARITY_HIGH
+ * @arg @ref LL_USART_DE_POLARITY_LOW
+ */
+__STATIC_INLINE uint32_t LL_USART_GetDESignalPolarity(USART_TypeDef *USARTx)
+{
+ return (uint32_t)(READ_BIT(USARTx->CR3, USART_CR3_DEP));
+}
+
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EF_AdvancedConfiguration Advanced Configurations services
+ * @{
+ */
+
+/**
+ * @brief Perform basic configuration of USART for enabling use in Asynchronous Mode (UART)
+ * @note In UART mode, the following bits must be kept cleared:
+ * - LINEN bit in the USART_CR2 register,
+ * - CLKEN bit in the USART_CR2 register,
+ * - SCEN bit in the USART_CR3 register,
+ * - IREN bit in the USART_CR3 register,
+ * - HDSEL bit in the USART_CR3 register.
+ * @note Call of this function is equivalent to following function call sequence :
+ * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function
+ * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function
+ * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function
+ * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function
+ * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function
+ * @note Other remaining configurations items related to Asynchronous Mode
+ * (as Baud Rate, Word length, Parity, ...) should be set using
+ * dedicated functions
+ * @rmtoll CR2 LINEN LL_USART_ConfigAsyncMode\n
+ * CR2 CLKEN LL_USART_ConfigAsyncMode\n
+ * CR3 SCEN LL_USART_ConfigAsyncMode\n
+ * CR3 IREN LL_USART_ConfigAsyncMode\n
+ * CR3 HDSEL LL_USART_ConfigAsyncMode
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_ConfigAsyncMode(USART_TypeDef *USARTx)
+{
+ /* In Asynchronous mode, the following bits must be kept cleared:
+ - LINEN, CLKEN bits in the USART_CR2 register,
+ - SCEN, IREN and HDSEL bits in the USART_CR3 register.
+ */
+ CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN));
+ CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_IREN | USART_CR3_HDSEL));
+}
+
+/**
+ * @brief Perform basic configuration of USART for enabling use in Synchronous Mode
+ * @note In Synchronous mode, the following bits must be kept cleared:
+ * - LINEN bit in the USART_CR2 register,
+ * - SCEN bit in the USART_CR3 register,
+ * - IREN bit in the USART_CR3 register,
+ * - HDSEL bit in the USART_CR3 register.
+ * This function also sets the USART in Synchronous mode.
+ * @note Macro IS_USART_INSTANCE(USARTx) can be used to check whether or not
+ * Synchronous mode is supported by the USARTx instance.
+ * @note Call of this function is equivalent to following function call sequence :
+ * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function
+ * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function
+ * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function
+ * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function
+ * - Set CLKEN in CR2 using @ref LL_USART_EnableSCLKOutput() function
+ * @note Other remaining configurations items related to Synchronous Mode
+ * (as Baud Rate, Word length, Parity, Clock Polarity, ...) should be set using
+ * dedicated functions
+ * @rmtoll CR2 LINEN LL_USART_ConfigSyncMode\n
+ * CR2 CLKEN LL_USART_ConfigSyncMode\n
+ * CR3 SCEN LL_USART_ConfigSyncMode\n
+ * CR3 IREN LL_USART_ConfigSyncMode\n
+ * CR3 HDSEL LL_USART_ConfigSyncMode
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_ConfigSyncMode(USART_TypeDef *USARTx)
+{
+ /* In Synchronous mode, the following bits must be kept cleared:
+ - LINEN bit in the USART_CR2 register,
+ - SCEN, IREN and HDSEL bits in the USART_CR3 register.
+ */
+ CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN));
+ CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_IREN | USART_CR3_HDSEL));
+ /* set the UART/USART in Synchronous mode */
+ SET_BIT(USARTx->CR2, USART_CR2_CLKEN);
+}
+
+/**
+ * @brief Perform basic configuration of USART for enabling use in LIN Mode
+ * @note In LIN mode, the following bits must be kept cleared:
+ * - STOP and CLKEN bits in the USART_CR2 register,
+ * - SCEN bit in the USART_CR3 register,
+ * - IREN bit in the USART_CR3 register,
+ * - HDSEL bit in the USART_CR3 register.
+ * This function also set the UART/USART in LIN mode.
+ * @note Macro IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
+ * LIN feature is supported by the USARTx instance.
+ * @note Call of this function is equivalent to following function call sequence :
+ * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function
+ * - Clear STOP in CR2 using @ref LL_USART_SetStopBitsLength() function
+ * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function
+ * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function
+ * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function
+ * - Set LINEN in CR2 using @ref LL_USART_EnableLIN() function
+ * @note Other remaining configurations items related to LIN Mode
+ * (as Baud Rate, Word length, LIN Break Detection Length, ...) should be set using
+ * dedicated functions
+ * @rmtoll CR2 CLKEN LL_USART_ConfigLINMode\n
+ * CR2 STOP LL_USART_ConfigLINMode\n
+ * CR2 LINEN LL_USART_ConfigLINMode\n
+ * CR3 IREN LL_USART_ConfigLINMode\n
+ * CR3 SCEN LL_USART_ConfigLINMode\n
+ * CR3 HDSEL LL_USART_ConfigLINMode
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_ConfigLINMode(USART_TypeDef *USARTx)
+{
+ /* In LIN mode, the following bits must be kept cleared:
+ - STOP and CLKEN bits in the USART_CR2 register,
+ - IREN, SCEN and HDSEL bits in the USART_CR3 register.
+ */
+ CLEAR_BIT(USARTx->CR2, (USART_CR2_CLKEN | USART_CR2_STOP));
+ CLEAR_BIT(USARTx->CR3, (USART_CR3_IREN | USART_CR3_SCEN | USART_CR3_HDSEL));
+ /* Set the UART/USART in LIN mode */
+ SET_BIT(USARTx->CR2, USART_CR2_LINEN);
+}
+
+/**
+ * @brief Perform basic configuration of USART for enabling use in Half Duplex Mode
+ * @note In Half Duplex mode, the following bits must be kept cleared:
+ * - LINEN bit in the USART_CR2 register,
+ * - CLKEN bit in the USART_CR2 register,
+ * - SCEN bit in the USART_CR3 register,
+ * - IREN bit in the USART_CR3 register,
+ * This function also sets the UART/USART in Half Duplex mode.
+ * @note Macro IS_UART_HALFDUPLEX_INSTANCE(USARTx) can be used to check whether or not
+ * Half-Duplex mode is supported by the USARTx instance.
+ * @note Call of this function is equivalent to following function call sequence :
+ * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function
+ * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function
+ * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function
+ * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function
+ * - Set HDSEL in CR3 using @ref LL_USART_EnableHalfDuplex() function
+ * @note Other remaining configurations items related to Half Duplex Mode
+ * (as Baud Rate, Word length, Parity, ...) should be set using
+ * dedicated functions
+ * @rmtoll CR2 LINEN LL_USART_ConfigHalfDuplexMode\n
+ * CR2 CLKEN LL_USART_ConfigHalfDuplexMode\n
+ * CR3 HDSEL LL_USART_ConfigHalfDuplexMode\n
+ * CR3 SCEN LL_USART_ConfigHalfDuplexMode\n
+ * CR3 IREN LL_USART_ConfigHalfDuplexMode
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_ConfigHalfDuplexMode(USART_TypeDef *USARTx)
+{
+ /* In Half Duplex mode, the following bits must be kept cleared:
+ - LINEN and CLKEN bits in the USART_CR2 register,
+ - SCEN and IREN bits in the USART_CR3 register.
+ */
+ CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN));
+ CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_IREN));
+ /* set the UART/USART in Half Duplex mode */
+ SET_BIT(USARTx->CR3, USART_CR3_HDSEL);
+}
+
+/**
+ * @brief Perform basic configuration of USART for enabling use in Smartcard Mode
+ * @note In Smartcard mode, the following bits must be kept cleared:
+ * - LINEN bit in the USART_CR2 register,
+ * - IREN bit in the USART_CR3 register,
+ * - HDSEL bit in the USART_CR3 register.
+ * This function also configures Stop bits to 1.5 bits and
+ * sets the USART in Smartcard mode (SCEN bit).
+ * Clock Output is also enabled (CLKEN).
+ * @note Macro IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
+ * Smartcard feature is supported by the USARTx instance.
+ * @note Call of this function is equivalent to following function call sequence :
+ * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function
+ * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function
+ * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function
+ * - Configure STOP in CR2 using @ref LL_USART_SetStopBitsLength() function
+ * - Set CLKEN in CR2 using @ref LL_USART_EnableSCLKOutput() function
+ * - Set SCEN in CR3 using @ref LL_USART_EnableSmartcard() function
+ * @note Other remaining configurations items related to Smartcard Mode
+ * (as Baud Rate, Word length, Parity, ...) should be set using
+ * dedicated functions
+ * @rmtoll CR2 LINEN LL_USART_ConfigSmartcardMode\n
+ * CR2 STOP LL_USART_ConfigSmartcardMode\n
+ * CR2 CLKEN LL_USART_ConfigSmartcardMode\n
+ * CR3 HDSEL LL_USART_ConfigSmartcardMode\n
+ * CR3 SCEN LL_USART_ConfigSmartcardMode
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_ConfigSmartcardMode(USART_TypeDef *USARTx)
+{
+ /* In Smartcard mode, the following bits must be kept cleared:
+ - LINEN bit in the USART_CR2 register,
+ - IREN and HDSEL bits in the USART_CR3 register.
+ */
+ CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN));
+ CLEAR_BIT(USARTx->CR3, (USART_CR3_IREN | USART_CR3_HDSEL));
+ /* Configure Stop bits to 1.5 bits */
+ /* Synchronous mode is activated by default */
+ SET_BIT(USARTx->CR2, (USART_CR2_STOP_0 | USART_CR2_STOP_1 | USART_CR2_CLKEN));
+ /* set the UART/USART in Smartcard mode */
+ SET_BIT(USARTx->CR3, USART_CR3_SCEN);
+}
+
+/**
+ * @brief Perform basic configuration of USART for enabling use in Irda Mode
+ * @note In IRDA mode, the following bits must be kept cleared:
+ * - LINEN bit in the USART_CR2 register,
+ * - STOP and CLKEN bits in the USART_CR2 register,
+ * - SCEN bit in the USART_CR3 register,
+ * - HDSEL bit in the USART_CR3 register.
+ * This function also sets the UART/USART in IRDA mode (IREN bit).
+ * @note Macro IS_IRDA_INSTANCE(USARTx) can be used to check whether or not
+ * IrDA feature is supported by the USARTx instance.
+ * @note Call of this function is equivalent to following function call sequence :
+ * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function
+ * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function
+ * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function
+ * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function
+ * - Configure STOP in CR2 using @ref LL_USART_SetStopBitsLength() function
+ * - Set IREN in CR3 using @ref LL_USART_EnableIrda() function
+ * @note Other remaining configurations items related to Irda Mode
+ * (as Baud Rate, Word length, Power mode, ...) should be set using
+ * dedicated functions
+ * @rmtoll CR2 LINEN LL_USART_ConfigIrdaMode\n
+ * CR2 CLKEN LL_USART_ConfigIrdaMode\n
+ * CR2 STOP LL_USART_ConfigIrdaMode\n
+ * CR3 SCEN LL_USART_ConfigIrdaMode\n
+ * CR3 HDSEL LL_USART_ConfigIrdaMode\n
+ * CR3 IREN LL_USART_ConfigIrdaMode
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_ConfigIrdaMode(USART_TypeDef *USARTx)
+{
+ /* In IRDA mode, the following bits must be kept cleared:
+ - LINEN, STOP and CLKEN bits in the USART_CR2 register,
+ - SCEN and HDSEL bits in the USART_CR3 register.
+ */
+ CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN | USART_CR2_STOP));
+ CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_HDSEL));
+ /* set the UART/USART in IRDA mode */
+ SET_BIT(USARTx->CR3, USART_CR3_IREN);
+}
+
+/**
+ * @brief Perform basic configuration of USART for enabling use in Multi processor Mode
+ * (several USARTs connected in a network, one of the USARTs can be the master,
+ * its TX output connected to the RX inputs of the other slaves USARTs).
+ * @note In MultiProcessor mode, the following bits must be kept cleared:
+ * - LINEN bit in the USART_CR2 register,
+ * - CLKEN bit in the USART_CR2 register,
+ * - SCEN bit in the USART_CR3 register,
+ * - IREN bit in the USART_CR3 register,
+ * - HDSEL bit in the USART_CR3 register.
+ * @note Call of this function is equivalent to following function call sequence :
+ * - Clear LINEN in CR2 using @ref LL_USART_DisableLIN() function
+ * - Clear CLKEN in CR2 using @ref LL_USART_DisableSCLKOutput() function
+ * - Clear SCEN in CR3 using @ref LL_USART_DisableSmartcard() function
+ * - Clear IREN in CR3 using @ref LL_USART_DisableIrda() function
+ * - Clear HDSEL in CR3 using @ref LL_USART_DisableHalfDuplex() function
+ * @note Other remaining configurations items related to Multi processor Mode
+ * (as Baud Rate, Wake Up Method, Node address, ...) should be set using
+ * dedicated functions
+ * @rmtoll CR2 LINEN LL_USART_ConfigMultiProcessMode\n
+ * CR2 CLKEN LL_USART_ConfigMultiProcessMode\n
+ * CR3 SCEN LL_USART_ConfigMultiProcessMode\n
+ * CR3 HDSEL LL_USART_ConfigMultiProcessMode\n
+ * CR3 IREN LL_USART_ConfigMultiProcessMode
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_ConfigMultiProcessMode(USART_TypeDef *USARTx)
+{
+ /* In Multi Processor mode, the following bits must be kept cleared:
+ - LINEN and CLKEN bits in the USART_CR2 register,
+ - IREN, SCEN and HDSEL bits in the USART_CR3 register.
+ */
+ CLEAR_BIT(USARTx->CR2, (USART_CR2_LINEN | USART_CR2_CLKEN));
+ CLEAR_BIT(USARTx->CR3, (USART_CR3_SCEN | USART_CR3_HDSEL | USART_CR3_IREN));
+}
+
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EF_FLAG_Management FLAG_Management
+ * @{
+ */
+
+/**
+ * @brief Check if the USART Parity Error Flag is set or not
+ * @rmtoll ISR PE LL_USART_IsActiveFlag_PE
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_PE(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->ISR, USART_ISR_PE) == (USART_ISR_PE)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Check if the USART Framing Error Flag is set or not
+ * @rmtoll ISR FE LL_USART_IsActiveFlag_FE
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_FE(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->ISR, USART_ISR_FE) == (USART_ISR_FE)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Check if the USART Noise error detected Flag is set or not
+ * @rmtoll ISR NE LL_USART_IsActiveFlag_NE
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_NE(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->ISR, USART_ISR_NE) == (USART_ISR_NE)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Check if the USART OverRun Error Flag is set or not
+ * @rmtoll ISR ORE LL_USART_IsActiveFlag_ORE
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_ORE(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->ISR, USART_ISR_ORE) == (USART_ISR_ORE)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Check if the USART IDLE line detected Flag is set or not
+ * @rmtoll ISR IDLE LL_USART_IsActiveFlag_IDLE
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_IDLE(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->ISR, USART_ISR_IDLE) == (USART_ISR_IDLE)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Check if the USART Read Data Register Not Empty Flag is set or not
+ * @rmtoll ISR RXNE LL_USART_IsActiveFlag_RXNE
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_RXNE(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->ISR, USART_ISR_RXNE) == (USART_ISR_RXNE)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Check if the USART Transmission Complete Flag is set or not
+ * @rmtoll ISR TC LL_USART_IsActiveFlag_TC
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_TC(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->ISR, USART_ISR_TC) == (USART_ISR_TC)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Check if the USART Transmit Data Register Empty Flag is set or not
+ * @rmtoll ISR TXE LL_USART_IsActiveFlag_TXE
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_TXE(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->ISR, USART_ISR_TXE) == (USART_ISR_TXE)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Check if the USART LIN Break Detection Flag is set or not
+ * @note Macro IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
+ * LIN feature is supported by the USARTx instance.
+ * @rmtoll ISR LBDF LL_USART_IsActiveFlag_LBD
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_LBD(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->ISR, USART_ISR_LBDF) == (USART_ISR_LBDF)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Check if the USART CTS interrupt Flag is set or not
+ * @note Macro IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
+ * Hardware Flow control feature is supported by the USARTx instance.
+ * @rmtoll ISR CTSIF LL_USART_IsActiveFlag_nCTS
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_nCTS(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->ISR, USART_ISR_CTSIF) == (USART_ISR_CTSIF)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Check if the USART CTS Flag is set or not
+ * @note Macro IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
+ * Hardware Flow control feature is supported by the USARTx instance.
+ * @rmtoll ISR CTS LL_USART_IsActiveFlag_CTS
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_CTS(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->ISR, USART_ISR_CTS) == (USART_ISR_CTS)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Check if the USART Receiver Time Out Flag is set or not
+ * @rmtoll ISR RTOF LL_USART_IsActiveFlag_RTO
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_RTO(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->ISR, USART_ISR_RTOF) == (USART_ISR_RTOF)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Check if the USART End Of Block Flag is set or not
+ * @note Macro IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
+ * Smartcard feature is supported by the USARTx instance.
+ * @rmtoll ISR EOBF LL_USART_IsActiveFlag_EOB
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_EOB(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->ISR, USART_ISR_EOBF) == (USART_ISR_EOBF)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Check if the USART Auto-Baud Rate Error Flag is set or not
+ * @note Macro IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(USARTx) can be used to check whether or not
+ * Auto Baud Rate detection feature is supported by the USARTx instance.
+ * @rmtoll ISR ABRE LL_USART_IsActiveFlag_ABRE
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_ABRE(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->ISR, USART_ISR_ABRE) == (USART_ISR_ABRE)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Check if the USART Auto-Baud Rate Flag is set or not
+ * @note Macro IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(USARTx) can be used to check whether or not
+ * Auto Baud Rate detection feature is supported by the USARTx instance.
+ * @rmtoll ISR ABRF LL_USART_IsActiveFlag_ABR
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_ABR(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->ISR, USART_ISR_ABRF) == (USART_ISR_ABRF)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Check if the USART Busy Flag is set or not
+ * @rmtoll ISR BUSY LL_USART_IsActiveFlag_BUSY
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_BUSY(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->ISR, USART_ISR_BUSY) == (USART_ISR_BUSY)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Check if the USART Character Match Flag is set or not
+ * @rmtoll ISR CMF LL_USART_IsActiveFlag_CM
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_CM(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->ISR, USART_ISR_CMF) == (USART_ISR_CMF)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Check if the USART Send Break Flag is set or not
+ * @rmtoll ISR SBKF LL_USART_IsActiveFlag_SBK
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_SBK(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->ISR, USART_ISR_SBKF) == (USART_ISR_SBKF)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Check if the USART Receive Wake Up from mute mode Flag is set or not
+ * @rmtoll ISR RWU LL_USART_IsActiveFlag_RWU
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_RWU(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->ISR, USART_ISR_RWU) == (USART_ISR_RWU)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Check if the USART Wake Up from stop mode Flag is set or not
+ * @note Macro IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not
+ * Wake-up from Stop mode feature is supported by the USARTx instance.
+ * @rmtoll ISR WUF LL_USART_IsActiveFlag_WKUP
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_WKUP(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->ISR, USART_ISR_WUF) == (USART_ISR_WUF)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Check if the USART Transmit Enable Acknowledge Flag is set or not
+ * @rmtoll ISR TEACK LL_USART_IsActiveFlag_TEACK
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_TEACK(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->ISR, USART_ISR_TEACK) == (USART_ISR_TEACK)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Check if the USART Receive Enable Acknowledge Flag is set or not
+ * @rmtoll ISR REACK LL_USART_IsActiveFlag_REACK
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_REACK(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->ISR, USART_ISR_REACK) == (USART_ISR_REACK)) ? 1UL : 0UL);
+}
+
+#if defined(USART_TCBGT_SUPPORT)
+/* Function available only on devices supporting Transmit Complete before Guard Time feature */
+/**
+ * @brief Check if the Smartcard Transmission Complete Before Guard Time Flag is set or not
+ * @rmtoll ISR TCBGT LL_USART_IsActiveFlag_TCBGT
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsActiveFlag_TCBGT(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->ISR, USART_ISR_TCBGT) == (USART_ISR_TCBGT)) ? 1UL : 0UL);
+}
+
+#endif /* USART_TCBGT_SUPPORT */
+/**
+ * @brief Clear Parity Error Flag
+ * @rmtoll ICR PECF LL_USART_ClearFlag_PE
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_ClearFlag_PE(USART_TypeDef *USARTx)
+{
+ WRITE_REG(USARTx->ICR, USART_ICR_PECF);
+}
+
+/**
+ * @brief Clear Framing Error Flag
+ * @rmtoll ICR FECF LL_USART_ClearFlag_FE
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_ClearFlag_FE(USART_TypeDef *USARTx)
+{
+ WRITE_REG(USARTx->ICR, USART_ICR_FECF);
+}
+
+/**
+ * @brief Clear Noise Error detected Flag
+ * @rmtoll ICR NCF LL_USART_ClearFlag_NE
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_ClearFlag_NE(USART_TypeDef *USARTx)
+{
+ WRITE_REG(USARTx->ICR, USART_ICR_NCF);
+}
+
+/**
+ * @brief Clear OverRun Error Flag
+ * @rmtoll ICR ORECF LL_USART_ClearFlag_ORE
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_ClearFlag_ORE(USART_TypeDef *USARTx)
+{
+ WRITE_REG(USARTx->ICR, USART_ICR_ORECF);
+}
+
+/**
+ * @brief Clear IDLE line detected Flag
+ * @rmtoll ICR IDLECF LL_USART_ClearFlag_IDLE
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_ClearFlag_IDLE(USART_TypeDef *USARTx)
+{
+ WRITE_REG(USARTx->ICR, USART_ICR_IDLECF);
+}
+
+/**
+ * @brief Clear Transmission Complete Flag
+ * @rmtoll ICR TCCF LL_USART_ClearFlag_TC
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_ClearFlag_TC(USART_TypeDef *USARTx)
+{
+ WRITE_REG(USARTx->ICR, USART_ICR_TCCF);
+}
+
+#if defined(USART_TCBGT_SUPPORT)
+/* Function available only on devices supporting Transmit Complete before Guard Time feature */
+/**
+ * @brief Clear Smartcard Transmission Complete Before Guard Time Flag
+ * @rmtoll ICR TCBGTCF LL_USART_ClearFlag_TCBGT
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_ClearFlag_TCBGT(USART_TypeDef *USARTx)
+{
+ WRITE_REG(USARTx->ICR, USART_ICR_TCBGTCF);
+}
+#endif /* USART_TCBGT_SUPPORT */
+
+/**
+ * @brief Clear LIN Break Detection Flag
+ * @note Macro IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
+ * LIN feature is supported by the USARTx instance.
+ * @rmtoll ICR LBDCF LL_USART_ClearFlag_LBD
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_ClearFlag_LBD(USART_TypeDef *USARTx)
+{
+ WRITE_REG(USARTx->ICR, USART_ICR_LBDCF);
+}
+
+/**
+ * @brief Clear CTS Interrupt Flag
+ * @note Macro IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
+ * Hardware Flow control feature is supported by the USARTx instance.
+ * @rmtoll ICR CTSCF LL_USART_ClearFlag_nCTS
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_ClearFlag_nCTS(USART_TypeDef *USARTx)
+{
+ WRITE_REG(USARTx->ICR, USART_ICR_CTSCF);
+}
+
+/**
+ * @brief Clear Receiver Time Out Flag
+ * @rmtoll ICR RTOCF LL_USART_ClearFlag_RTO
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_ClearFlag_RTO(USART_TypeDef *USARTx)
+{
+ WRITE_REG(USARTx->ICR, USART_ICR_RTOCF);
+}
+
+/**
+ * @brief Clear End Of Block Flag
+ * @note Macro IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
+ * Smartcard feature is supported by the USARTx instance.
+ * @rmtoll ICR EOBCF LL_USART_ClearFlag_EOB
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_ClearFlag_EOB(USART_TypeDef *USARTx)
+{
+ WRITE_REG(USARTx->ICR, USART_ICR_EOBCF);
+}
+
+/**
+ * @brief Clear Character Match Flag
+ * @rmtoll ICR CMCF LL_USART_ClearFlag_CM
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_ClearFlag_CM(USART_TypeDef *USARTx)
+{
+ WRITE_REG(USARTx->ICR, USART_ICR_CMCF);
+}
+
+/**
+ * @brief Clear Wake Up from stop mode Flag
+ * @note Macro IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not
+ * Wake-up from Stop mode feature is supported by the USARTx instance.
+ * @rmtoll ICR WUCF LL_USART_ClearFlag_WKUP
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_ClearFlag_WKUP(USART_TypeDef *USARTx)
+{
+ WRITE_REG(USARTx->ICR, USART_ICR_WUCF);
+}
+
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EF_IT_Management IT_Management
+ * @{
+ */
+
+/**
+ * @brief Enable IDLE Interrupt
+ * @rmtoll CR1 IDLEIE LL_USART_EnableIT_IDLE
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_EnableIT_IDLE(USART_TypeDef *USARTx)
+{
+ ATOMIC_SET_BIT(USARTx->CR1, USART_CR1_IDLEIE);
+}
+
+/**
+ * @brief Enable RX Not Empty Interrupt
+ * @rmtoll CR1 RXNEIE LL_USART_EnableIT_RXNE
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_EnableIT_RXNE(USART_TypeDef *USARTx)
+{
+ ATOMIC_SET_BIT(USARTx->CR1, USART_CR1_RXNEIE);
+}
+
+/**
+ * @brief Enable Transmission Complete Interrupt
+ * @rmtoll CR1 TCIE LL_USART_EnableIT_TC
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_EnableIT_TC(USART_TypeDef *USARTx)
+{
+ ATOMIC_SET_BIT(USARTx->CR1, USART_CR1_TCIE);
+}
+
+/**
+ * @brief Enable TX Empty Interrupt
+ * @rmtoll CR1 TXEIE LL_USART_EnableIT_TXE
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_EnableIT_TXE(USART_TypeDef *USARTx)
+{
+ ATOMIC_SET_BIT(USARTx->CR1, USART_CR1_TXEIE);
+}
+
+/**
+ * @brief Enable Parity Error Interrupt
+ * @rmtoll CR1 PEIE LL_USART_EnableIT_PE
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_EnableIT_PE(USART_TypeDef *USARTx)
+{
+ ATOMIC_SET_BIT(USARTx->CR1, USART_CR1_PEIE);
+}
+
+/**
+ * @brief Enable Character Match Interrupt
+ * @rmtoll CR1 CMIE LL_USART_EnableIT_CM
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_EnableIT_CM(USART_TypeDef *USARTx)
+{
+ ATOMIC_SET_BIT(USARTx->CR1, USART_CR1_CMIE);
+}
+
+/**
+ * @brief Enable Receiver Timeout Interrupt
+ * @rmtoll CR1 RTOIE LL_USART_EnableIT_RTO
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_EnableIT_RTO(USART_TypeDef *USARTx)
+{
+ ATOMIC_SET_BIT(USARTx->CR1, USART_CR1_RTOIE);
+}
+
+/**
+ * @brief Enable End Of Block Interrupt
+ * @note Macro IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
+ * Smartcard feature is supported by the USARTx instance.
+ * @rmtoll CR1 EOBIE LL_USART_EnableIT_EOB
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_EnableIT_EOB(USART_TypeDef *USARTx)
+{
+ ATOMIC_SET_BIT(USARTx->CR1, USART_CR1_EOBIE);
+}
+
+/**
+ * @brief Enable LIN Break Detection Interrupt
+ * @note Macro IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
+ * LIN feature is supported by the USARTx instance.
+ * @rmtoll CR2 LBDIE LL_USART_EnableIT_LBD
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_EnableIT_LBD(USART_TypeDef *USARTx)
+{
+ SET_BIT(USARTx->CR2, USART_CR2_LBDIE);
+}
+
+/**
+ * @brief Enable Error Interrupt
+ * @note When set, Error Interrupt Enable Bit is enabling interrupt generation in case of a framing
+ * error, overrun error or noise flag (FE=1 or ORE=1 or NF=1 in the USARTx_ISR register).
+ * 0: Interrupt is inhibited
+ * 1: An interrupt is generated when FE=1 or ORE=1 or NF=1 in the USARTx_ISR register.
+ * @rmtoll CR3 EIE LL_USART_EnableIT_ERROR
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_EnableIT_ERROR(USART_TypeDef *USARTx)
+{
+ ATOMIC_SET_BIT(USARTx->CR3, USART_CR3_EIE);
+}
+
+/**
+ * @brief Enable CTS Interrupt
+ * @note Macro IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
+ * Hardware Flow control feature is supported by the USARTx instance.
+ * @rmtoll CR3 CTSIE LL_USART_EnableIT_CTS
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_EnableIT_CTS(USART_TypeDef *USARTx)
+{
+ ATOMIC_SET_BIT(USARTx->CR3, USART_CR3_CTSIE);
+}
+
+/**
+ * @brief Enable Wake Up from Stop Mode Interrupt
+ * @note Macro IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not
+ * Wake-up from Stop mode feature is supported by the USARTx instance.
+ * @rmtoll CR3 WUFIE LL_USART_EnableIT_WKUP
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_EnableIT_WKUP(USART_TypeDef *USARTx)
+{
+ ATOMIC_SET_BIT(USARTx->CR3, USART_CR3_WUFIE);
+}
+
+#if defined(USART_TCBGT_SUPPORT)
+/* Function available only on devices supporting Transmit Complete before Guard Time feature */
+/**
+ * @brief Enable Smartcard Transmission Complete Before Guard Time Interrupt
+ * @note Macro IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
+ * Smartcard feature is supported by the USARTx instance.
+ * @rmtoll CR3 TCBGTIE LL_USART_EnableIT_TCBGT
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_EnableIT_TCBGT(USART_TypeDef *USARTx)
+{
+ ATOMIC_SET_BIT(USARTx->CR3, USART_CR3_TCBGTIE);
+}
+#endif /* USART_TCBGT_SUPPORT */
+
+/**
+ * @brief Disable IDLE Interrupt
+ * @rmtoll CR1 IDLEIE LL_USART_DisableIT_IDLE
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_DisableIT_IDLE(USART_TypeDef *USARTx)
+{
+ ATOMIC_CLEAR_BIT(USARTx->CR1, USART_CR1_IDLEIE);
+}
+
+/**
+ * @brief Disable RX Not Empty Interrupt
+ * @rmtoll CR1 RXNEIE LL_USART_DisableIT_RXNE
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_DisableIT_RXNE(USART_TypeDef *USARTx)
+{
+ ATOMIC_CLEAR_BIT(USARTx->CR1, USART_CR1_RXNEIE);
+}
+
+/**
+ * @brief Disable Transmission Complete Interrupt
+ * @rmtoll CR1 TCIE LL_USART_DisableIT_TC
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_DisableIT_TC(USART_TypeDef *USARTx)
+{
+ ATOMIC_CLEAR_BIT(USARTx->CR1, USART_CR1_TCIE);
+}
+
+/**
+ * @brief Disable TX Empty Interrupt
+ * @rmtoll CR1 TXEIE LL_USART_DisableIT_TXE
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_DisableIT_TXE(USART_TypeDef *USARTx)
+{
+ ATOMIC_CLEAR_BIT(USARTx->CR1, USART_CR1_TXEIE);
+}
+
+/**
+ * @brief Disable Parity Error Interrupt
+ * @rmtoll CR1 PEIE LL_USART_DisableIT_PE
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_DisableIT_PE(USART_TypeDef *USARTx)
+{
+ ATOMIC_CLEAR_BIT(USARTx->CR1, USART_CR1_PEIE);
+}
+
+/**
+ * @brief Disable Character Match Interrupt
+ * @rmtoll CR1 CMIE LL_USART_DisableIT_CM
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_DisableIT_CM(USART_TypeDef *USARTx)
+{
+ ATOMIC_CLEAR_BIT(USARTx->CR1, USART_CR1_CMIE);
+}
+
+/**
+ * @brief Disable Receiver Timeout Interrupt
+ * @rmtoll CR1 RTOIE LL_USART_DisableIT_RTO
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_DisableIT_RTO(USART_TypeDef *USARTx)
+{
+ ATOMIC_CLEAR_BIT(USARTx->CR1, USART_CR1_RTOIE);
+}
+
+/**
+ * @brief Disable End Of Block Interrupt
+ * @note Macro IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
+ * Smartcard feature is supported by the USARTx instance.
+ * @rmtoll CR1 EOBIE LL_USART_DisableIT_EOB
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_DisableIT_EOB(USART_TypeDef *USARTx)
+{
+ ATOMIC_CLEAR_BIT(USARTx->CR1, USART_CR1_EOBIE);
+}
+
+/**
+ * @brief Disable LIN Break Detection Interrupt
+ * @note Macro IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
+ * LIN feature is supported by the USARTx instance.
+ * @rmtoll CR2 LBDIE LL_USART_DisableIT_LBD
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_DisableIT_LBD(USART_TypeDef *USARTx)
+{
+ CLEAR_BIT(USARTx->CR2, USART_CR2_LBDIE);
+}
+
+/**
+ * @brief Disable Error Interrupt
+ * @note When set, Error Interrupt Enable Bit is enabling interrupt generation in case of a framing
+ * error, overrun error or noise flag (FE=1 or ORE=1 or NF=1 in the USARTx_ISR register).
+ * 0: Interrupt is inhibited
+ * 1: An interrupt is generated when FE=1 or ORE=1 or NF=1 in the USARTx_ISR register.
+ * @rmtoll CR3 EIE LL_USART_DisableIT_ERROR
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_DisableIT_ERROR(USART_TypeDef *USARTx)
+{
+ ATOMIC_CLEAR_BIT(USARTx->CR3, USART_CR3_EIE);
+}
+
+/**
+ * @brief Disable CTS Interrupt
+ * @note Macro IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
+ * Hardware Flow control feature is supported by the USARTx instance.
+ * @rmtoll CR3 CTSIE LL_USART_DisableIT_CTS
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_DisableIT_CTS(USART_TypeDef *USARTx)
+{
+ ATOMIC_CLEAR_BIT(USARTx->CR3, USART_CR3_CTSIE);
+}
+
+/**
+ * @brief Disable Wake Up from Stop Mode Interrupt
+ * @note Macro IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not
+ * Wake-up from Stop mode feature is supported by the USARTx instance.
+ * @rmtoll CR3 WUFIE LL_USART_DisableIT_WKUP
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_DisableIT_WKUP(USART_TypeDef *USARTx)
+{
+ ATOMIC_CLEAR_BIT(USARTx->CR3, USART_CR3_WUFIE);
+}
+
+#if defined(USART_TCBGT_SUPPORT)
+/* Function available only on devices supporting Transmit Complete before Guard Time feature */
+/**
+ * @brief Disable Smartcard Transmission Complete Before Guard Time Interrupt
+ * @note Macro IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
+ * Smartcard feature is supported by the USARTx instance.
+ * @rmtoll CR3 TCBGTIE LL_USART_DisableIT_TCBGT
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_DisableIT_TCBGT(USART_TypeDef *USARTx)
+{
+ ATOMIC_CLEAR_BIT(USARTx->CR3, USART_CR3_TCBGTIE);
+}
+#endif /* USART_TCBGT_SUPPORT */
+
+/**
+ * @brief Check if the USART IDLE Interrupt source is enabled or disabled.
+ * @rmtoll CR1 IDLEIE LL_USART_IsEnabledIT_IDLE
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_IDLE(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->CR1, USART_CR1_IDLEIE) == (USART_CR1_IDLEIE)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Check if the USART RX Not Empty Interrupt is enabled or disabled.
+ * @rmtoll CR1 RXNEIE LL_USART_IsEnabledIT_RXNE
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_RXNE(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->CR1, USART_CR1_RXNEIE) == (USART_CR1_RXNEIE)) ? 1U : 0U);
+}
+
+/**
+ * @brief Check if the USART Transmission Complete Interrupt is enabled or disabled.
+ * @rmtoll CR1 TCIE LL_USART_IsEnabledIT_TC
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_TC(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->CR1, USART_CR1_TCIE) == (USART_CR1_TCIE)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Check if the USART TX Empty Interrupt is enabled or disabled.
+ * @rmtoll CR1 TXEIE LL_USART_IsEnabledIT_TXE
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_TXE(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->CR1, USART_CR1_TXEIE) == (USART_CR1_TXEIE)) ? 1U : 0U);
+}
+
+/**
+ * @brief Check if the USART Parity Error Interrupt is enabled or disabled.
+ * @rmtoll CR1 PEIE LL_USART_IsEnabledIT_PE
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_PE(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->CR1, USART_CR1_PEIE) == (USART_CR1_PEIE)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Check if the USART Character Match Interrupt is enabled or disabled.
+ * @rmtoll CR1 CMIE LL_USART_IsEnabledIT_CM
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_CM(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->CR1, USART_CR1_CMIE) == (USART_CR1_CMIE)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Check if the USART Receiver Timeout Interrupt is enabled or disabled.
+ * @rmtoll CR1 RTOIE LL_USART_IsEnabledIT_RTO
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_RTO(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->CR1, USART_CR1_RTOIE) == (USART_CR1_RTOIE)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Check if the USART End Of Block Interrupt is enabled or disabled.
+ * @note Macro IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
+ * Smartcard feature is supported by the USARTx instance.
+ * @rmtoll CR1 EOBIE LL_USART_IsEnabledIT_EOB
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_EOB(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->CR1, USART_CR1_EOBIE) == (USART_CR1_EOBIE)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Check if the USART LIN Break Detection Interrupt is enabled or disabled.
+ * @note Macro IS_UART_LIN_INSTANCE(USARTx) can be used to check whether or not
+ * LIN feature is supported by the USARTx instance.
+ * @rmtoll CR2 LBDIE LL_USART_IsEnabledIT_LBD
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_LBD(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->CR2, USART_CR2_LBDIE) == (USART_CR2_LBDIE)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Check if the USART Error Interrupt is enabled or disabled.
+ * @rmtoll CR3 EIE LL_USART_IsEnabledIT_ERROR
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_ERROR(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->CR3, USART_CR3_EIE) == (USART_CR3_EIE)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Check if the USART CTS Interrupt is enabled or disabled.
+ * @note Macro IS_UART_HWFLOW_INSTANCE(USARTx) can be used to check whether or not
+ * Hardware Flow control feature is supported by the USARTx instance.
+ * @rmtoll CR3 CTSIE LL_USART_IsEnabledIT_CTS
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_CTS(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->CR3, USART_CR3_CTSIE) == (USART_CR3_CTSIE)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Check if the USART Wake Up from Stop Mode Interrupt is enabled or disabled.
+ * @note Macro IS_UART_WAKEUP_FROMSTOP_INSTANCE(USARTx) can be used to check whether or not
+ * Wake-up from Stop mode feature is supported by the USARTx instance.
+ * @rmtoll CR3 WUFIE LL_USART_IsEnabledIT_WKUP
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_WKUP(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->CR3, USART_CR3_WUFIE) == (USART_CR3_WUFIE)) ? 1UL : 0UL);
+}
+
+#if defined(USART_TCBGT_SUPPORT)
+/* Function available only on devices supporting Transmit Complete before Guard Time feature */
+/**
+ * @brief Check if the Smartcard Transmission Complete Before Guard Time Interrupt is enabled or disabled.
+ * @note Macro IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
+ * Smartcard feature is supported by the USARTx instance.
+ * @rmtoll CR3 TCBGTIE LL_USART_IsEnabledIT_TCBGT
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsEnabledIT_TCBGT(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->CR3, USART_CR3_TCBGTIE) == (USART_CR3_TCBGTIE)) ? 1UL : 0UL);
+}
+#endif /* USART_TCBGT_SUPPORT */
+
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EF_DMA_Management DMA_Management
+ * @{
+ */
+
+/**
+ * @brief Enable DMA Mode for reception
+ * @rmtoll CR3 DMAR LL_USART_EnableDMAReq_RX
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_EnableDMAReq_RX(USART_TypeDef *USARTx)
+{
+ ATOMIC_SET_BIT(USARTx->CR3, USART_CR3_DMAR);
+}
+
+/**
+ * @brief Disable DMA Mode for reception
+ * @rmtoll CR3 DMAR LL_USART_DisableDMAReq_RX
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_DisableDMAReq_RX(USART_TypeDef *USARTx)
+{
+ ATOMIC_CLEAR_BIT(USARTx->CR3, USART_CR3_DMAR);
+}
+
+/**
+ * @brief Check if DMA Mode is enabled for reception
+ * @rmtoll CR3 DMAR LL_USART_IsEnabledDMAReq_RX
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsEnabledDMAReq_RX(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->CR3, USART_CR3_DMAR) == (USART_CR3_DMAR)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Enable DMA Mode for transmission
+ * @rmtoll CR3 DMAT LL_USART_EnableDMAReq_TX
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_EnableDMAReq_TX(USART_TypeDef *USARTx)
+{
+ ATOMIC_SET_BIT(USARTx->CR3, USART_CR3_DMAT);
+}
+
+/**
+ * @brief Disable DMA Mode for transmission
+ * @rmtoll CR3 DMAT LL_USART_DisableDMAReq_TX
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_DisableDMAReq_TX(USART_TypeDef *USARTx)
+{
+ ATOMIC_CLEAR_BIT(USARTx->CR3, USART_CR3_DMAT);
+}
+
+/**
+ * @brief Check if DMA Mode is enabled for transmission
+ * @rmtoll CR3 DMAT LL_USART_IsEnabledDMAReq_TX
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsEnabledDMAReq_TX(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->CR3, USART_CR3_DMAT) == (USART_CR3_DMAT)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Enable DMA Disabling on Reception Error
+ * @rmtoll CR3 DDRE LL_USART_EnableDMADeactOnRxErr
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_EnableDMADeactOnRxErr(USART_TypeDef *USARTx)
+{
+ SET_BIT(USARTx->CR3, USART_CR3_DDRE);
+}
+
+/**
+ * @brief Disable DMA Disabling on Reception Error
+ * @rmtoll CR3 DDRE LL_USART_DisableDMADeactOnRxErr
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_DisableDMADeactOnRxErr(USART_TypeDef *USARTx)
+{
+ CLEAR_BIT(USARTx->CR3, USART_CR3_DDRE);
+}
+
+/**
+ * @brief Indicate if DMA Disabling on Reception Error is disabled
+ * @rmtoll CR3 DDRE LL_USART_IsEnabledDMADeactOnRxErr
+ * @param USARTx USART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_USART_IsEnabledDMADeactOnRxErr(USART_TypeDef *USARTx)
+{
+ return ((READ_BIT(USARTx->CR3, USART_CR3_DDRE) == (USART_CR3_DDRE)) ? 1UL : 0UL);
+}
+
+/**
+ * @brief Get the data register address used for DMA transfer
+ * @rmtoll RDR RDR LL_USART_DMA_GetRegAddr\n
+ * @rmtoll TDR TDR LL_USART_DMA_GetRegAddr
+ * @param USARTx USART Instance
+ * @param Direction This parameter can be one of the following values:
+ * @arg @ref LL_USART_DMA_REG_DATA_TRANSMIT
+ * @arg @ref LL_USART_DMA_REG_DATA_RECEIVE
+ * @retval Address of data register
+ */
+__STATIC_INLINE uint32_t LL_USART_DMA_GetRegAddr(USART_TypeDef *USARTx, uint32_t Direction)
+{
+ uint32_t data_reg_addr;
+
+ if (Direction == LL_USART_DMA_REG_DATA_TRANSMIT)
+ {
+ /* return address of TDR register */
+ data_reg_addr = (uint32_t) &(USARTx->TDR);
+ }
+ else
+ {
+ /* return address of RDR register */
+ data_reg_addr = (uint32_t) &(USARTx->RDR);
+ }
+
+ return data_reg_addr;
+}
+
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EF_Data_Management Data_Management
+ * @{
+ */
+
+/**
+ * @brief Read Receiver Data register (Receive Data value, 8 bits)
+ * @rmtoll RDR RDR LL_USART_ReceiveData8
+ * @param USARTx USART Instance
+ * @retval Value between Min_Data=0x00 and Max_Data=0xFF
+ */
+__STATIC_INLINE uint8_t LL_USART_ReceiveData8(USART_TypeDef *USARTx)
+{
+ return (uint8_t)(READ_BIT(USARTx->RDR, USART_RDR_RDR) & 0xFFU);
+}
+
+/**
+ * @brief Read Receiver Data register (Receive Data value, 9 bits)
+ * @rmtoll RDR RDR LL_USART_ReceiveData9
+ * @param USARTx USART Instance
+ * @retval Value between Min_Data=0x00 and Max_Data=0x1FF
+ */
+__STATIC_INLINE uint16_t LL_USART_ReceiveData9(USART_TypeDef *USARTx)
+{
+ return (uint16_t)(READ_BIT(USARTx->RDR, USART_RDR_RDR));
+}
+
+/**
+ * @brief Write in Transmitter Data Register (Transmit Data value, 8 bits)
+ * @rmtoll TDR TDR LL_USART_TransmitData8
+ * @param USARTx USART Instance
+ * @param Value between Min_Data=0x00 and Max_Data=0xFF
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_TransmitData8(USART_TypeDef *USARTx, uint8_t Value)
+{
+ USARTx->TDR = Value;
+}
+
+/**
+ * @brief Write in Transmitter Data Register (Transmit Data value, 9 bits)
+ * @rmtoll TDR TDR LL_USART_TransmitData9
+ * @param USARTx USART Instance
+ * @param Value between Min_Data=0x00 and Max_Data=0x1FF
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_TransmitData9(USART_TypeDef *USARTx, uint16_t Value)
+{
+ USARTx->TDR = (uint16_t)(Value & 0x1FFUL);
+}
+
+/**
+ * @}
+ */
+
+/** @defgroup USART_LL_EF_Execution Execution
+ * @{
+ */
+
+/**
+ * @brief Request an Automatic Baud Rate measurement on next received data frame
+ * @note Macro IS_USART_AUTOBAUDRATE_DETECTION_INSTANCE(USARTx) can be used to check whether or not
+ * Auto Baud Rate detection feature is supported by the USARTx instance.
+ * @rmtoll RQR ABRRQ LL_USART_RequestAutoBaudRate
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_RequestAutoBaudRate(USART_TypeDef *USARTx)
+{
+ SET_BIT(USARTx->RQR, (uint16_t)USART_RQR_ABRRQ);
+}
+
+/**
+ * @brief Request Break sending
+ * @rmtoll RQR SBKRQ LL_USART_RequestBreakSending
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_RequestBreakSending(USART_TypeDef *USARTx)
+{
+ SET_BIT(USARTx->RQR, (uint16_t)USART_RQR_SBKRQ);
+}
+
+/**
+ * @brief Put USART in mute mode and set the RWU flag
+ * @rmtoll RQR MMRQ LL_USART_RequestEnterMuteMode
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_RequestEnterMuteMode(USART_TypeDef *USARTx)
+{
+ SET_BIT(USARTx->RQR, (uint16_t)USART_RQR_MMRQ);
+}
+
+/**
+ * @brief Request a Receive Data flush
+ * @note Allows to discard the received data without reading them, and avoid an overrun
+ * condition.
+ * @rmtoll RQR RXFRQ LL_USART_RequestRxDataFlush
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_RequestRxDataFlush(USART_TypeDef *USARTx)
+{
+ SET_BIT(USARTx->RQR, (uint16_t)USART_RQR_RXFRQ);
+}
+
+/**
+ * @brief Request a Transmit data flush
+ * @note Macro IS_SMARTCARD_INSTANCE(USARTx) can be used to check whether or not
+ * Smartcard feature is supported by the USARTx instance.
+ * @rmtoll RQR TXFRQ LL_USART_RequestTxDataFlush
+ * @param USARTx USART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_USART_RequestTxDataFlush(USART_TypeDef *USARTx)
+{
+ SET_BIT(USARTx->RQR, (uint16_t)USART_RQR_TXFRQ);
+}
+
+/**
+ * @}
+ */
+
+#if defined(USE_FULL_LL_DRIVER)
+/** @defgroup USART_LL_EF_Init Initialization and de-initialization functions
+ * @{
+ */
+ErrorStatus LL_USART_DeInit(USART_TypeDef *USARTx);
+ErrorStatus LL_USART_Init(USART_TypeDef *USARTx, LL_USART_InitTypeDef *USART_InitStruct);
+void LL_USART_StructInit(LL_USART_InitTypeDef *USART_InitStruct);
+ErrorStatus LL_USART_ClockInit(USART_TypeDef *USARTx, LL_USART_ClockInitTypeDef *USART_ClockInitStruct);
+void LL_USART_ClockStructInit(LL_USART_ClockInitTypeDef *USART_ClockInitStruct);
+/**
+ * @}
+ */
+#endif /* USE_FULL_LL_DRIVER */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+#endif /* USART1 || USART2 || USART4 || USART5 */
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* STM32L0xx_LL_USART_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/fw/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_i2c.c b/fw/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_i2c.c
index 58ccb6c..6d37773 100644
--- a/fw/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_i2c.c
+++ b/fw/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_i2c.c
@@ -25,7 +25,7 @@
#include "stm32_assert.h"
#else
#define assert_param(expr) ((void)0U)
-#endif
+#endif /* USE_FULL_ASSERT */
/** @addtogroup STM32L0xx_LL_Driver
* @{
@@ -109,7 +109,7 @@ ErrorStatus LL_I2C_DeInit(I2C_TypeDef *I2Cx)
LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_I2C2);
}
-#endif
+#endif /* I2C2 */
#if defined(I2C3)
else if (I2Cx == I2C3)
{
@@ -119,7 +119,7 @@ ErrorStatus LL_I2C_DeInit(I2C_TypeDef *I2Cx)
/* Release reset of I2C clock */
LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_I2C3);
}
-#endif
+#endif /* I2C3 */
else
{
status = ERROR;
diff --git a/fw/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rcc.c b/fw/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rcc.c
index 2bd1b44..ca9db9a 100644
--- a/fw/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rcc.c
+++ b/fw/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rcc.c
@@ -75,11 +75,11 @@
/** @defgroup RCC_LL_Private_Functions RCC Private functions
* @{
*/
-uint32_t RCC_GetSystemClockFreq(void);
-uint32_t RCC_GetHCLKClockFreq(uint32_t SYSCLK_Frequency);
-uint32_t RCC_GetPCLK1ClockFreq(uint32_t HCLK_Frequency);
-uint32_t RCC_GetPCLK2ClockFreq(uint32_t HCLK_Frequency);
-uint32_t RCC_PLL_GetFreqDomain_SYS(void);
+static uint32_t RCC_GetSystemClockFreq(void);
+static uint32_t RCC_GetHCLKClockFreq(uint32_t SYSCLK_Frequency);
+static uint32_t RCC_GetPCLK1ClockFreq(uint32_t HCLK_Frequency);
+static uint32_t RCC_GetPCLK2ClockFreq(uint32_t HCLK_Frequency);
+static uint32_t RCC_PLL_GetFreqDomain_SYS(void);
/**
* @}
*/
@@ -576,7 +576,7 @@ uint32_t LL_RCC_GetUSBClockFreq(uint32_t USBxSource)
* @brief Return SYSTEM clock frequency
* @retval SYSTEM clock frequency (in Hz)
*/
-uint32_t RCC_GetSystemClockFreq(void)
+static uint32_t RCC_GetSystemClockFreq(void)
{
uint32_t frequency;
@@ -619,7 +619,7 @@ uint32_t RCC_GetSystemClockFreq(void)
* @param SYSCLK_Frequency SYSCLK clock frequency
* @retval HCLK clock frequency (in Hz)
*/
-uint32_t RCC_GetHCLKClockFreq(uint32_t SYSCLK_Frequency)
+static uint32_t RCC_GetHCLKClockFreq(uint32_t SYSCLK_Frequency)
{
/* HCLK clock frequency */
return __LL_RCC_CALC_HCLK_FREQ(SYSCLK_Frequency, LL_RCC_GetAHBPrescaler());
@@ -630,7 +630,7 @@ uint32_t RCC_GetHCLKClockFreq(uint32_t SYSCLK_Frequency)
* @param HCLK_Frequency HCLK clock frequency
* @retval PCLK1 clock frequency (in Hz)
*/
-uint32_t RCC_GetPCLK1ClockFreq(uint32_t HCLK_Frequency)
+static uint32_t RCC_GetPCLK1ClockFreq(uint32_t HCLK_Frequency)
{
/* PCLK1 clock frequency */
return __LL_RCC_CALC_PCLK1_FREQ(HCLK_Frequency, LL_RCC_GetAPB1Prescaler());
@@ -641,7 +641,7 @@ uint32_t RCC_GetPCLK1ClockFreq(uint32_t HCLK_Frequency)
* @param HCLK_Frequency HCLK clock frequency
* @retval PCLK2 clock frequency (in Hz)
*/
-uint32_t RCC_GetPCLK2ClockFreq(uint32_t HCLK_Frequency)
+static uint32_t RCC_GetPCLK2ClockFreq(uint32_t HCLK_Frequency)
{
/* PCLK2 clock frequency */
return __LL_RCC_CALC_PCLK2_FREQ(HCLK_Frequency, LL_RCC_GetAPB2Prescaler());
@@ -651,7 +651,7 @@ uint32_t RCC_GetPCLK2ClockFreq(uint32_t HCLK_Frequency)
* @brief Return PLL clock frequency used for system domain
* @retval PLL clock frequency (in Hz)
*/
-uint32_t RCC_PLL_GetFreqDomain_SYS(void)
+static uint32_t RCC_PLL_GetFreqDomain_SYS(void)
{
uint32_t pllinputfreq, pllsource;
diff --git a/fw/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_tim.c b/fw/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_tim.c
index 08e5dca..dd5c015 100644
--- a/fw/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_tim.c
+++ b/fw/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_tim.c
@@ -214,7 +214,8 @@ void LL_TIM_StructInit(LL_TIM_InitTypeDef *TIM_InitStruct)
/**
* @brief Configure the TIMx time base unit.
* @param TIMx Timer Instance
- * @param TIM_InitStruct pointer to a @ref LL_TIM_InitTypeDef structure (TIMx time base unit configuration data structure)
+ * @param TIM_InitStruct pointer to a @ref LL_TIM_InitTypeDef structure
+ * (TIMx time base unit configuration data structure)
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx registers are de-initialized
* - ERROR: not applicable
@@ -260,7 +261,8 @@ ErrorStatus LL_TIM_Init(TIM_TypeDef *TIMx, LL_TIM_InitTypeDef *TIM_InitStruct)
/**
* @brief Set the fields of the TIMx output channel configuration data
* structure to their default values.
- * @param TIM_OC_InitStruct pointer to a @ref LL_TIM_OC_InitTypeDef structure (the output channel configuration data structure)
+ * @param TIM_OC_InitStruct pointer to a @ref LL_TIM_OC_InitTypeDef structure
+ * (the output channel configuration data structure)
* @retval None
*/
void LL_TIM_OC_StructInit(LL_TIM_OC_InitTypeDef *TIM_OC_InitStruct)
@@ -280,7 +282,8 @@ void LL_TIM_OC_StructInit(LL_TIM_OC_InitTypeDef *TIM_OC_InitStruct)
* @arg @ref LL_TIM_CHANNEL_CH2
* @arg @ref LL_TIM_CHANNEL_CH3
* @arg @ref LL_TIM_CHANNEL_CH4
- * @param TIM_OC_InitStruct pointer to a @ref LL_TIM_OC_InitTypeDef structure (TIMx output channel configuration data structure)
+ * @param TIM_OC_InitStruct pointer to a @ref LL_TIM_OC_InitTypeDef structure (TIMx output channel configuration
+ * data structure)
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx output channel is initialized
* - ERROR: TIMx output channel is not initialized
@@ -313,7 +316,8 @@ ErrorStatus LL_TIM_OC_Init(TIM_TypeDef *TIMx, uint32_t Channel, LL_TIM_OC_InitTy
/**
* @brief Set the fields of the TIMx input channel configuration data
* structure to their default values.
- * @param TIM_ICInitStruct pointer to a @ref LL_TIM_IC_InitTypeDef structure (the input channel configuration data structure)
+ * @param TIM_ICInitStruct pointer to a @ref LL_TIM_IC_InitTypeDef structure (the input channel configuration
+ * data structure)
* @retval None
*/
void LL_TIM_IC_StructInit(LL_TIM_IC_InitTypeDef *TIM_ICInitStruct)
@@ -333,7 +337,8 @@ void LL_TIM_IC_StructInit(LL_TIM_IC_InitTypeDef *TIM_ICInitStruct)
* @arg @ref LL_TIM_CHANNEL_CH2
* @arg @ref LL_TIM_CHANNEL_CH3
* @arg @ref LL_TIM_CHANNEL_CH4
- * @param TIM_IC_InitStruct pointer to a @ref LL_TIM_IC_InitTypeDef structure (TIMx input channel configuration data structure)
+ * @param TIM_IC_InitStruct pointer to a @ref LL_TIM_IC_InitTypeDef structure (TIMx input channel configuration data
+ * structure)
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx output channel is initialized
* - ERROR: TIMx output channel is not initialized
@@ -365,7 +370,8 @@ ErrorStatus LL_TIM_IC_Init(TIM_TypeDef *TIMx, uint32_t Channel, LL_TIM_IC_InitTy
/**
* @brief Fills each TIM_EncoderInitStruct field with its default value
- * @param TIM_EncoderInitStruct pointer to a @ref LL_TIM_ENCODER_InitTypeDef structure (encoder interface configuration data structure)
+ * @param TIM_EncoderInitStruct pointer to a @ref LL_TIM_ENCODER_InitTypeDef structure (encoder interface
+ * configuration data structure)
* @retval None
*/
void LL_TIM_ENCODER_StructInit(LL_TIM_ENCODER_InitTypeDef *TIM_EncoderInitStruct)
@@ -385,7 +391,8 @@ void LL_TIM_ENCODER_StructInit(LL_TIM_ENCODER_InitTypeDef *TIM_EncoderInitStruct
/**
* @brief Configure the encoder interface of the timer instance.
* @param TIMx Timer Instance
- * @param TIM_EncoderInitStruct pointer to a @ref LL_TIM_ENCODER_InitTypeDef structure (TIMx encoder interface configuration data structure)
+ * @param TIM_EncoderInitStruct pointer to a @ref LL_TIM_ENCODER_InitTypeDef structure (TIMx encoder interface
+ * configuration data structure)
* @retval An ErrorStatus enumeration value:
* - SUCCESS: TIMx registers are de-initialized
* - ERROR: not applicable
diff --git a/fw/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_usart.c b/fw/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_usart.c
new file mode 100644
index 0000000..47de09d
--- /dev/null
+++ b/fw/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_usart.c
@@ -0,0 +1,420 @@
+/**
+ ******************************************************************************
+ * @file stm32l0xx_ll_usart.c
+ * @author MCD Application Team
+ * @brief USART LL module driver.
+ ******************************************************************************
+ * @attention
+ *
+ * © Copyright (c) 2016 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software component is licensed by ST under BSD 3-Clause license,
+ * the "License"; You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ * opensource.org/licenses/BSD-3-Clause
+ *
+ ******************************************************************************
+ */
+#if defined(USE_FULL_LL_DRIVER)
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm32l0xx_ll_usart.h"
+#include "stm32l0xx_ll_rcc.h"
+#include "stm32l0xx_ll_bus.h"
+#ifdef USE_FULL_ASSERT
+#include "stm32_assert.h"
+#else
+#define assert_param(expr) ((void)0U)
+#endif /* USE_FULL_ASSERT */
+
+/** @addtogroup STM32L0xx_LL_Driver
+ * @{
+ */
+
+#if defined (USART1) || defined (USART2) || defined (USART4) || defined (USART5)
+
+/** @addtogroup USART_LL
+ * @{
+ */
+
+/* Private types -------------------------------------------------------------*/
+/* Private variables ---------------------------------------------------------*/
+/* Private constants ---------------------------------------------------------*/
+/* Private macros ------------------------------------------------------------*/
+/** @addtogroup USART_LL_Private_Macros
+ * @{
+ */
+
+/* __BAUDRATE__ The maximum Baud Rate is derived from the maximum clock available
+ * divided by the smallest oversampling used on the USART (i.e. 8) */
+#define IS_LL_USART_BAUDRATE(__BAUDRATE__) ((__BAUDRATE__) <= 4000000U)
+
+/* __VALUE__ In case of oversampling by 16 and 8, BRR content must be greater than or equal to 16d. */
+#define IS_LL_USART_BRR_MIN(__VALUE__) ((__VALUE__) >= 16U)
+
+#define IS_LL_USART_DIRECTION(__VALUE__) (((__VALUE__) == LL_USART_DIRECTION_NONE) \
+ || ((__VALUE__) == LL_USART_DIRECTION_RX) \
+ || ((__VALUE__) == LL_USART_DIRECTION_TX) \
+ || ((__VALUE__) == LL_USART_DIRECTION_TX_RX))
+
+#define IS_LL_USART_PARITY(__VALUE__) (((__VALUE__) == LL_USART_PARITY_NONE) \
+ || ((__VALUE__) == LL_USART_PARITY_EVEN) \
+ || ((__VALUE__) == LL_USART_PARITY_ODD))
+
+#define IS_LL_USART_DATAWIDTH(__VALUE__) (((__VALUE__) == LL_USART_DATAWIDTH_7B) \
+ || ((__VALUE__) == LL_USART_DATAWIDTH_8B) \
+ || ((__VALUE__) == LL_USART_DATAWIDTH_9B))
+
+#define IS_LL_USART_OVERSAMPLING(__VALUE__) (((__VALUE__) == LL_USART_OVERSAMPLING_16) \
+ || ((__VALUE__) == LL_USART_OVERSAMPLING_8))
+
+#define IS_LL_USART_LASTBITCLKOUTPUT(__VALUE__) (((__VALUE__) == LL_USART_LASTCLKPULSE_NO_OUTPUT) \
+ || ((__VALUE__) == LL_USART_LASTCLKPULSE_OUTPUT))
+
+#define IS_LL_USART_CLOCKPHASE(__VALUE__) (((__VALUE__) == LL_USART_PHASE_1EDGE) \
+ || ((__VALUE__) == LL_USART_PHASE_2EDGE))
+
+#define IS_LL_USART_CLOCKPOLARITY(__VALUE__) (((__VALUE__) == LL_USART_POLARITY_LOW) \
+ || ((__VALUE__) == LL_USART_POLARITY_HIGH))
+
+#define IS_LL_USART_CLOCKOUTPUT(__VALUE__) (((__VALUE__) == LL_USART_CLOCK_DISABLE) \
+ || ((__VALUE__) == LL_USART_CLOCK_ENABLE))
+
+#define IS_LL_USART_STOPBITS(__VALUE__) (((__VALUE__) == LL_USART_STOPBITS_0_5) \
+ || ((__VALUE__) == LL_USART_STOPBITS_1) \
+ || ((__VALUE__) == LL_USART_STOPBITS_1_5) \
+ || ((__VALUE__) == LL_USART_STOPBITS_2))
+
+#define IS_LL_USART_HWCONTROL(__VALUE__) (((__VALUE__) == LL_USART_HWCONTROL_NONE) \
+ || ((__VALUE__) == LL_USART_HWCONTROL_RTS) \
+ || ((__VALUE__) == LL_USART_HWCONTROL_CTS) \
+ || ((__VALUE__) == LL_USART_HWCONTROL_RTS_CTS))
+
+/**
+ * @}
+ */
+
+/* Private function prototypes -----------------------------------------------*/
+
+/* Exported functions --------------------------------------------------------*/
+/** @addtogroup USART_LL_Exported_Functions
+ * @{
+ */
+
+/** @addtogroup USART_LL_EF_Init
+ * @{
+ */
+
+/**
+ * @brief De-initialize USART registers (Registers restored to their default values).
+ * @param USARTx USART Instance
+ * @retval An ErrorStatus enumeration value:
+ * - SUCCESS: USART registers are de-initialized
+ * - ERROR: USART registers are not de-initialized
+ */
+ErrorStatus LL_USART_DeInit(USART_TypeDef *USARTx)
+{
+ ErrorStatus status = SUCCESS;
+
+ /* Check the parameters */
+ assert_param(IS_UART_INSTANCE(USARTx));
+
+#if defined(USART1)
+ if (USARTx == USART1)
+ {
+ /* Force reset of USART clock */
+ LL_APB2_GRP1_ForceReset(LL_APB2_GRP1_PERIPH_USART1);
+
+ /* Release reset of USART clock */
+ LL_APB2_GRP1_ReleaseReset(LL_APB2_GRP1_PERIPH_USART1);
+ }
+#endif /* USART1 */
+#if defined(USART1)
+ else if (USARTx == USART2)
+#else
+ if (USARTx == USART2)
+#endif /* USART1 */
+ {
+ /* Force reset of USART clock */
+ LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_USART2);
+
+ /* Release reset of USART clock */
+ LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_USART2);
+ }
+#if defined(USART4)
+ else if (USARTx == USART4)
+ {
+ /* Force reset of USART clock */
+ LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_USART4);
+
+ /* Release reset of USART clock */
+ LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_USART4);
+ }
+#endif /* USART4 */
+#if defined(USART5)
+ else if (USARTx == USART5)
+ {
+ /* Force reset of USART clock */
+ LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_USART5);
+
+ /* Release reset of USART clock */
+ LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_USART5);
+ }
+#endif /* USART5 */
+ else
+ {
+ status = ERROR;
+ }
+
+ return (status);
+}
+
+/**
+ * @brief Initialize USART registers according to the specified
+ * parameters in USART_InitStruct.
+ * @note As some bits in USART configuration registers can only be written when
+ * the USART is disabled (USART_CR1_UE bit =0), USART Peripheral should be in disabled state prior calling
+ * this function. Otherwise, ERROR result will be returned.
+ * @note Baud rate value stored in USART_InitStruct BaudRate field, should be valid (different from 0).
+ * @param USARTx USART Instance
+ * @param USART_InitStruct pointer to a LL_USART_InitTypeDef structure
+ * that contains the configuration information for the specified USART peripheral.
+ * @retval An ErrorStatus enumeration value:
+ * - SUCCESS: USART registers are initialized according to USART_InitStruct content
+ * - ERROR: Problem occurred during USART Registers initialization
+ */
+ErrorStatus LL_USART_Init(USART_TypeDef *USARTx, LL_USART_InitTypeDef *USART_InitStruct)
+{
+ ErrorStatus status = ERROR;
+ uint32_t periphclk = LL_RCC_PERIPH_FREQUENCY_NO;
+#if defined(USART4) || defined(USART5)
+ LL_RCC_ClocksTypeDef RCC_Clocks;
+#endif /* USART4 || USART5 */
+
+ /* Check the parameters */
+ assert_param(IS_UART_INSTANCE(USARTx));
+ assert_param(IS_LL_USART_BAUDRATE(USART_InitStruct->BaudRate));
+ assert_param(IS_LL_USART_DATAWIDTH(USART_InitStruct->DataWidth));
+ assert_param(IS_LL_USART_STOPBITS(USART_InitStruct->StopBits));
+ assert_param(IS_LL_USART_PARITY(USART_InitStruct->Parity));
+ assert_param(IS_LL_USART_DIRECTION(USART_InitStruct->TransferDirection));
+ assert_param(IS_LL_USART_HWCONTROL(USART_InitStruct->HardwareFlowControl));
+ assert_param(IS_LL_USART_OVERSAMPLING(USART_InitStruct->OverSampling));
+
+ /* USART needs to be in disabled state, in order to be able to configure some bits in
+ CRx registers */
+ if (LL_USART_IsEnabled(USARTx) == 0U)
+ {
+ /*---------------------------- USART CR1 Configuration ---------------------
+ * Configure USARTx CR1 (USART Word Length, Parity, Mode and Oversampling bits) with parameters:
+ * - DataWidth: USART_CR1_M bits according to USART_InitStruct->DataWidth value
+ * - Parity: USART_CR1_PCE, USART_CR1_PS bits according to USART_InitStruct->Parity value
+ * - TransferDirection: USART_CR1_TE, USART_CR1_RE bits according to USART_InitStruct->TransferDirection value
+ * - Oversampling: USART_CR1_OVER8 bit according to USART_InitStruct->OverSampling value.
+ */
+ MODIFY_REG(USARTx->CR1,
+ (USART_CR1_M | USART_CR1_PCE | USART_CR1_PS |
+ USART_CR1_TE | USART_CR1_RE | USART_CR1_OVER8),
+ (USART_InitStruct->DataWidth | USART_InitStruct->Parity |
+ USART_InitStruct->TransferDirection | USART_InitStruct->OverSampling));
+
+ /*---------------------------- USART CR2 Configuration ---------------------
+ * Configure USARTx CR2 (Stop bits) with parameters:
+ * - Stop Bits: USART_CR2_STOP bits according to USART_InitStruct->StopBits value.
+ * - CLKEN, CPOL, CPHA and LBCL bits are to be configured using LL_USART_ClockInit().
+ */
+ LL_USART_SetStopBitsLength(USARTx, USART_InitStruct->StopBits);
+
+ /*---------------------------- USART CR3 Configuration ---------------------
+ * Configure USARTx CR3 (Hardware Flow Control) with parameters:
+ * - HardwareFlowControl: USART_CR3_RTSE, USART_CR3_CTSE bits according to
+ * USART_InitStruct->HardwareFlowControl value.
+ */
+ LL_USART_SetHWFlowCtrl(USARTx, USART_InitStruct->HardwareFlowControl);
+
+ /*---------------------------- USART BRR Configuration ---------------------
+ * Retrieve Clock frequency used for USART Peripheral
+ */
+#if defined(USART1)
+ if (USARTx == USART1)
+ {
+ periphclk = LL_RCC_GetUSARTClockFreq(LL_RCC_USART1_CLKSOURCE);
+ }
+#endif /* USART1 */
+#if defined(USART1)
+ else if (USARTx == USART2)
+#else
+ if (USARTx == USART2)
+#endif /* USART1 */
+ {
+ periphclk = LL_RCC_GetUSARTClockFreq(LL_RCC_USART2_CLKSOURCE);
+ }
+#if defined(USART4)
+ else if (USARTx == USART4)
+ {
+ /* USART4 clock is PCLK1 */
+ LL_RCC_GetSystemClocksFreq(&RCC_Clocks);
+ periphclk = RCC_Clocks.PCLK1_Frequency;
+ }
+#endif /* USART4 */
+#if defined(USART5)
+ else if (USARTx == USART5)
+ {
+ /* USART5 clock is PCLK1 */
+ LL_RCC_GetSystemClocksFreq(&RCC_Clocks);
+ periphclk = RCC_Clocks.PCLK1_Frequency;
+ }
+#endif /* USART5 */
+ else
+ {
+ /* Nothing to do, as error code is already assigned to ERROR value */
+ }
+
+ /* Configure the USART Baud Rate :
+ - valid baud rate value (different from 0) is required
+ - Peripheral clock as returned by RCC service, should be valid (different from 0).
+ */
+ if ((periphclk != LL_RCC_PERIPH_FREQUENCY_NO)
+ && (USART_InitStruct->BaudRate != 0U))
+ {
+ status = SUCCESS;
+ LL_USART_SetBaudRate(USARTx,
+ periphclk,
+ USART_InitStruct->OverSampling,
+ USART_InitStruct->BaudRate);
+
+ /* Check BRR is greater than or equal to 16d */
+ assert_param(IS_LL_USART_BRR_MIN(USARTx->BRR));
+ }
+ }
+ /* Endif (=> USART not in Disabled state => return ERROR) */
+
+ return (status);
+}
+
+/**
+ * @brief Set each @ref LL_USART_InitTypeDef field to default value.
+ * @param USART_InitStruct pointer to a @ref LL_USART_InitTypeDef structure
+ * whose fields will be set to default values.
+ * @retval None
+ */
+
+void LL_USART_StructInit(LL_USART_InitTypeDef *USART_InitStruct)
+{
+ /* Set USART_InitStruct fields to default values */
+ USART_InitStruct->BaudRate = 9600U;
+ USART_InitStruct->DataWidth = LL_USART_DATAWIDTH_8B;
+ USART_InitStruct->StopBits = LL_USART_STOPBITS_1;
+ USART_InitStruct->Parity = LL_USART_PARITY_NONE ;
+ USART_InitStruct->TransferDirection = LL_USART_DIRECTION_TX_RX;
+ USART_InitStruct->HardwareFlowControl = LL_USART_HWCONTROL_NONE;
+ USART_InitStruct->OverSampling = LL_USART_OVERSAMPLING_16;
+}
+
+/**
+ * @brief Initialize USART Clock related settings according to the
+ * specified parameters in the USART_ClockInitStruct.
+ * @note As some bits in USART configuration registers can only be written when
+ * the USART is disabled (USART_CR1_UE bit =0), USART Peripheral should be in disabled state prior calling
+ * this function. Otherwise, ERROR result will be returned.
+ * @param USARTx USART Instance
+ * @param USART_ClockInitStruct pointer to a @ref LL_USART_ClockInitTypeDef structure
+ * that contains the Clock configuration information for the specified USART peripheral.
+ * @retval An ErrorStatus enumeration value:
+ * - SUCCESS: USART registers related to Clock settings are initialized according
+ * to USART_ClockInitStruct content
+ * - ERROR: Problem occurred during USART Registers initialization
+ */
+ErrorStatus LL_USART_ClockInit(USART_TypeDef *USARTx, LL_USART_ClockInitTypeDef *USART_ClockInitStruct)
+{
+ ErrorStatus status = SUCCESS;
+
+ /* Check USART Instance and Clock signal output parameters */
+ assert_param(IS_UART_INSTANCE(USARTx));
+ assert_param(IS_LL_USART_CLOCKOUTPUT(USART_ClockInitStruct->ClockOutput));
+
+ /* USART needs to be in disabled state, in order to be able to configure some bits in
+ CRx registers */
+ if (LL_USART_IsEnabled(USARTx) == 0U)
+ {
+ /* If USART Clock signal is disabled */
+ if (USART_ClockInitStruct->ClockOutput == LL_USART_CLOCK_DISABLE)
+ {
+ /* Deactivate Clock signal delivery :
+ * - Disable Clock Output: USART_CR2_CLKEN cleared
+ */
+ LL_USART_DisableSCLKOutput(USARTx);
+ }
+ else
+ {
+ /* Ensure USART instance is USART capable */
+ assert_param(IS_USART_INSTANCE(USARTx));
+
+ /* Check clock related parameters */
+ assert_param(IS_LL_USART_CLOCKPOLARITY(USART_ClockInitStruct->ClockPolarity));
+ assert_param(IS_LL_USART_CLOCKPHASE(USART_ClockInitStruct->ClockPhase));
+ assert_param(IS_LL_USART_LASTBITCLKOUTPUT(USART_ClockInitStruct->LastBitClockPulse));
+
+ /*---------------------------- USART CR2 Configuration -----------------------
+ * Configure USARTx CR2 (Clock signal related bits) with parameters:
+ * - Enable Clock Output: USART_CR2_CLKEN set
+ * - Clock Polarity: USART_CR2_CPOL bit according to USART_ClockInitStruct->ClockPolarity value
+ * - Clock Phase: USART_CR2_CPHA bit according to USART_ClockInitStruct->ClockPhase value
+ * - Last Bit Clock Pulse Output: USART_CR2_LBCL bit according to USART_ClockInitStruct->LastBitClockPulse value.
+ */
+ MODIFY_REG(USARTx->CR2,
+ USART_CR2_CLKEN | USART_CR2_CPHA | USART_CR2_CPOL | USART_CR2_LBCL,
+ USART_CR2_CLKEN | USART_ClockInitStruct->ClockPolarity |
+ USART_ClockInitStruct->ClockPhase | USART_ClockInitStruct->LastBitClockPulse);
+ }
+ }
+ /* Else (USART not in Disabled state => return ERROR */
+ else
+ {
+ status = ERROR;
+ }
+
+ return (status);
+}
+
+/**
+ * @brief Set each field of a @ref LL_USART_ClockInitTypeDef type structure to default value.
+ * @param USART_ClockInitStruct pointer to a @ref LL_USART_ClockInitTypeDef structure
+ * whose fields will be set to default values.
+ * @retval None
+ */
+void LL_USART_ClockStructInit(LL_USART_ClockInitTypeDef *USART_ClockInitStruct)
+{
+ /* Set LL_USART_ClockInitStruct fields with default values */
+ USART_ClockInitStruct->ClockOutput = LL_USART_CLOCK_DISABLE;
+ USART_ClockInitStruct->ClockPolarity = LL_USART_POLARITY_LOW; /* Not relevant when ClockOutput =
+ LL_USART_CLOCK_DISABLE */
+ USART_ClockInitStruct->ClockPhase = LL_USART_PHASE_1EDGE; /* Not relevant when ClockOutput =
+ LL_USART_CLOCK_DISABLE */
+ USART_ClockInitStruct->LastBitClockPulse = LL_USART_LASTCLKPULSE_NO_OUTPUT; /* Not relevant when ClockOutput =
+ LL_USART_CLOCK_DISABLE */
+}
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+#endif /* USART1 || USART2 || USART4 || USART5 */
+
+/**
+ * @}
+ */
+
+#endif /* USE_FULL_LL_DRIVER */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
+
diff --git a/fw/STM32L031G6UX_FLASH.ld b/fw/STM32L031G6UX_FLASH.ld
new file mode 100644
index 0000000..1c2e4da
--- /dev/null
+++ b/fw/STM32L031G6UX_FLASH.ld
@@ -0,0 +1,186 @@
+/*
+******************************************************************************
+**
+** @file : LinkerScript.ld
+**
+** @author : Auto-generated by STM32CubeIDE
+**
+** @brief : Linker script for STM32L031G6Ux Device from STM32L0 series
+** 32Kbytes FLASH
+** 8Kbytes RAM
+**
+** Set heap size, stack size and stack location according
+** to application requirements.
+**
+** Set memory bank area and size if external memory is used
+**
+** Target : STMicroelectronics STM32
+**
+** Distribution: The file is distributed as is, without any warranty
+** of any kind.
+**
+******************************************************************************
+** @attention
+**
+** © Copyright (c) 2021 STMicroelectronics.
+** All rights reserved.
+**
+** This software component is licensed by ST under BSD 3-Clause license,
+** the "License"; You may not use this file except in compliance with the
+** License. You may obtain a copy of the License at:
+** opensource.org/licenses/BSD-3-Clause
+**
+******************************************************************************
+*/
+
+/* Entry Point */
+ENTRY(Reset_Handler)
+
+/* Highest address of the user mode stack */
+_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */
+
+_Min_Heap_Size = 0x200 ; /* required amount of heap */
+_Min_Stack_Size = 0x400 ; /* required amount of stack */
+
+/* Memories definition */
+MEMORY
+{
+ RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 8K
+ FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 32K
+}
+
+/* Sections */
+SECTIONS
+{
+ /* The startup code into "FLASH" Rom type memory */
+ .isr_vector :
+ {
+ . = ALIGN(4);
+ KEEP(*(.isr_vector)) /* Startup code */
+ . = ALIGN(4);
+ } >FLASH
+
+ /* The program code and other data into "FLASH" Rom type memory */
+ .text :
+ {
+ . = ALIGN(4);
+ *(.text) /* .text sections (code) */
+ *(.text*) /* .text* sections (code) */
+ *(.glue_7) /* glue arm to thumb code */
+ *(.glue_7t) /* glue thumb to arm code */
+ *(.eh_frame)
+
+ KEEP (*(.init))
+ KEEP (*(.fini))
+
+ . = ALIGN(4);
+ _etext = .; /* define a global symbols at end of code */
+ } >FLASH
+
+ /* Constant data into "FLASH" Rom type memory */
+ .rodata :
+ {
+ . = ALIGN(4);
+ *(.rodata) /* .rodata sections (constants, strings, etc.) */
+ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
+ . = ALIGN(4);
+ } >FLASH
+
+ .ARM.extab : {
+ . = ALIGN(4);
+ *(.ARM.extab* .gnu.linkonce.armextab.*)
+ . = ALIGN(4);
+ } >FLASH
+
+ .ARM : {
+ . = ALIGN(4);
+ __exidx_start = .;
+ *(.ARM.exidx*)
+ __exidx_end = .;
+ . = ALIGN(4);
+ } >FLASH
+
+ .preinit_array :
+ {
+ . = ALIGN(4);
+ PROVIDE_HIDDEN (__preinit_array_start = .);
+ KEEP (*(.preinit_array*))
+ PROVIDE_HIDDEN (__preinit_array_end = .);
+ . = ALIGN(4);
+ } >FLASH
+
+ .init_array :
+ {
+ . = ALIGN(4);
+ PROVIDE_HIDDEN (__init_array_start = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array*))
+ PROVIDE_HIDDEN (__init_array_end = .);
+ . = ALIGN(4);
+ } >FLASH
+
+ .fini_array :
+ {
+ . = ALIGN(4);
+ PROVIDE_HIDDEN (__fini_array_start = .);
+ KEEP (*(SORT(.fini_array.*)))
+ KEEP (*(.fini_array*))
+ PROVIDE_HIDDEN (__fini_array_end = .);
+ . = ALIGN(4);
+ } >FLASH
+
+ /* Used by the startup to initialize data */
+ _sidata = LOADADDR(.data);
+
+ /* Initialized data sections into "RAM" Ram type memory */
+ .data :
+ {
+ . = ALIGN(4);
+ _sdata = .; /* create a global symbol at data start */
+ *(.data) /* .data sections */
+ *(.data*) /* .data* sections */
+ *(.RamFunc) /* .RamFunc sections */
+ *(.RamFunc*) /* .RamFunc* sections */
+
+ . = ALIGN(4);
+ _edata = .; /* define a global symbol at data end */
+
+ } >RAM AT> FLASH
+
+ /* Uninitialized data section into "RAM" Ram type memory */
+ . = ALIGN(4);
+ .bss :
+ {
+ /* This is used by the startup in order to initialize the .bss section */
+ _sbss = .; /* define a global symbol at bss start */
+ __bss_start__ = _sbss;
+ *(.bss)
+ *(.bss*)
+ *(COMMON)
+
+ . = ALIGN(4);
+ _ebss = .; /* define a global symbol at bss end */
+ __bss_end__ = _ebss;
+ } >RAM
+
+ /* User_heap_stack section, used to check that there is enough "RAM" Ram type memory left */
+ ._user_heap_stack :
+ {
+ . = ALIGN(8);
+ PROVIDE ( end = . );
+ PROVIDE ( _end = . );
+ . = . + _Min_Heap_Size;
+ . = . + _Min_Stack_Size;
+ . = ALIGN(8);
+ } >RAM
+
+ /* Remove information from the compiler libraries */
+ /DISCARD/ :
+ {
+ libc.a ( * )
+ libm.a ( * )
+ libgcc.a ( * )
+ }
+
+ .ARM.attributes 0 : { *(.ARM.attributes) }
+}
diff --git a/fw/iaq_wired_sensor Debug.launch b/fw/iaq_wired_sensor Debug.launch
index e9df78e..420a890 100644
--- a/fw/iaq_wired_sensor Debug.launch
+++ b/fw/iaq_wired_sensor Debug.launch
@@ -5,6 +5,8 @@
+
+
@@ -14,7 +16,6 @@
-
@@ -27,22 +28,28 @@
-
+
-
+
+
-
+
+
+
+
+
+
-
+
@@ -61,13 +68,13 @@
-
+
-
+
diff --git a/fw/iaq_wired_sensor.ioc b/fw/iaq_wired_sensor.ioc
index 1e11fd8..77b23fd 100644
--- a/fw/iaq_wired_sensor.ioc
+++ b/fw/iaq_wired_sensor.ioc
@@ -4,77 +4,70 @@ GPIO.groupedBy=Group By Peripherals
I2C1.IPParameters=Timing
I2C1.Timing=0x40000A0B
KeepUserPlacement=false
-LPUART1.BaudRate=115200
-LPUART1.IPParameters=BaudRate,SwapParam,OneBitSampling,WordLength,Parity
-LPUART1.OneBitSampling=UART_ONE_BIT_SAMPLE_ENABLE
-LPUART1.Parity=UART_PARITY_EVEN
-LPUART1.SwapParam=UART_ADVFEATURE_SWAP_ENABLE
-LPUART1.WordLength=UART_WORDLENGTH_9B
Mcu.Family=STM32L0
Mcu.IP0=I2C1
-Mcu.IP1=LPUART1
-Mcu.IP2=NVIC
-Mcu.IP3=RCC
-Mcu.IP4=SYS
-Mcu.IP5=TIM21
+Mcu.IP1=NVIC
+Mcu.IP2=RCC
+Mcu.IP3=SYS
+Mcu.IP4=TIM21
+Mcu.IP5=USART2
Mcu.IPNb=6
-Mcu.Name=STM32L011F(3-4)Ux
-Mcu.Package=UFQFPN20
-Mcu.Pin0=PA0-CK_IN
-Mcu.Pin1=PA1
-Mcu.Pin10=VP_TIM21_VS_ClockSourceINT
-Mcu.Pin2=PA5
-Mcu.Pin3=PA6
-Mcu.Pin4=PA7
-Mcu.Pin5=PA9
-Mcu.Pin6=PA10
-Mcu.Pin7=PA13
-Mcu.Pin8=PA14
-Mcu.Pin9=VP_SYS_VS_Systick
-Mcu.PinsNb=11
+Mcu.Name=STM32L031G(4-6)Ux
+Mcu.Package=UFQFPN28
+Mcu.Pin0=PA1
+Mcu.Pin1=PA2
+Mcu.Pin10=VP_SYS_VS_Systick
+Mcu.Pin11=VP_TIM21_VS_ClockSourceINT
+Mcu.Pin2=PA3
+Mcu.Pin3=PA5
+Mcu.Pin4=PA6
+Mcu.Pin5=PA7
+Mcu.Pin6=PA9
+Mcu.Pin7=PA10
+Mcu.Pin8=PA13
+Mcu.Pin9=PA14
+Mcu.PinsNb=12
Mcu.ThirdPartyNb=0
Mcu.UserConstants=
-Mcu.UserName=STM32L011F4Ux
-MxCube.Version=6.2.1
-MxDb.Version=DB.6.0.21
+Mcu.UserName=STM32L031G6Ux
+MxCube.Version=6.3.0
+MxDb.Version=DB.6.0.30
NVIC.ForceEnableDMAVector=true
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false
-NVIC.LPUART1_IRQn=true\:0\:0\:false\:false\:true\:true\:true
NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false
NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false
NVIC.SVC_IRQn=true\:0\:0\:false\:false\:true\:false\:false
-NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true\:false\:true
+NVIC.SysTick_IRQn=true\:3\:0\:false\:false\:true\:false\:true
NVIC.TIM21_IRQn=true\:0\:0\:false\:false\:true\:true\:true
-PA0-CK_IN.GPIOParameters=GPIO_PuPd
-PA0-CK_IN.GPIO_PuPd=GPIO_PULLUP
-PA0-CK_IN.Mode=Asynchronous
-PA0-CK_IN.Signal=LPUART1_RX
-PA1.GPIOParameters=GPIO_PuPd
-PA1.GPIO_PuPd=GPIO_PULLUP
-PA1.Mode=Asynchronous
-PA1.Signal=LPUART1_TX
+NVIC.USART2_IRQn=true\:0\:0\:false\:false\:true\:true\:true
+PA1.Mode=Hardware Flow Control (RS485)
+PA1.Signal=USART2_DE
+PA10.GPIOParameters=GPIO_Pu
+PA10.GPIO_Pu=GPIO_PULLUP
PA10.Mode=I2C
PA10.Signal=I2C1_SDA
PA13.Mode=Serial_Wire
PA13.Signal=SYS_SWDIO
PA14.Mode=Serial_Wire
PA14.Signal=SYS_SWCLK
-PA5.GPIOParameters=PinState,GPIO_Label
+PA2.Mode=Asynchronous
+PA2.Signal=USART2_TX
+PA3.Mode=Asynchronous
+PA3.Signal=USART2_RX
+PA5.GPIOParameters=GPIO_Label
PA5.GPIO_Label=LED_B
PA5.Locked=true
-PA5.PinState=GPIO_PIN_SET
PA5.Signal=GPIO_Output
-PA6.GPIOParameters=PinState,GPIO_Label
+PA6.GPIOParameters=GPIO_Label
PA6.GPIO_Label=LED_G
PA6.Locked=true
-PA6.PinState=GPIO_PIN_SET
PA6.Signal=GPIO_Output
-PA7.GPIOParameters=PinState,GPIO_Label
+PA7.GPIOParameters=GPIO_Label
PA7.GPIO_Label=LED_R
PA7.Locked=true
-PA7.PinState=GPIO_PIN_SET
PA7.Signal=GPIO_Output
-PA9.Locked=true
+PA9.GPIOParameters=GPIO_Pu
+PA9.GPIO_Pu=GPIO_PULLUP
PA9.Mode=I2C
PA9.Signal=I2C1_SCL
PinOutPanel.RotationAngle=0
@@ -86,8 +79,8 @@ ProjectManager.CoupleFile=false
ProjectManager.CustomerFirmwarePackage=
ProjectManager.DefaultFWLocation=true
ProjectManager.DeletePrevious=true
-ProjectManager.DeviceId=STM32L011F4Ux
-ProjectManager.FirmwarePackage=STM32Cube FW_L0 V1.12.0
+ProjectManager.DeviceId=STM32L031G6Ux
+ProjectManager.FirmwarePackage=STM32Cube FW_L0 V1.12.1
ProjectManager.FreePins=false
ProjectManager.HalAssertFull=false
ProjectManager.HeapSize=0x200
@@ -105,7 +98,7 @@ ProjectManager.StackSize=0x400
ProjectManager.TargetToolchain=STM32CubeIDE
ProjectManager.ToolChainLocation=
ProjectManager.UnderRoot=true
-ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-LL-true,2-SystemClock_Config-RCC-false-LL-false,3-MX_I2C1_Init-I2C1-false-LL-true,4-MX_LPUART1_UART_Init-LPUART1-false-LL-true,5-MX_TIM21_Init-TIM21-false-LL-true
+ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-LL-false,2-MX_GPIO_Init-GPIO-false-LL-true,3-MX_I2C1_Init-I2C1-false-LL-true,4-MX_USART2_UART_Init-USART2-false-LL-true,5-MX_TIM21_Init-TIM21-false-LL-true
RCC.AHBFreq_Value=12000000
RCC.APB1Freq_Value=12000000
RCC.APB1TimFreq_Value=12000000
@@ -138,13 +131,20 @@ RCC.USART2Freq_Value=12000000
RCC.VCOOutputFreq_Value=48000000
RCC.WatchDogFreq_Value=37000
TIM21.AutoReloadPreload=TIM_AUTORELOAD_PRELOAD_ENABLE
-TIM21.ClockDivision=TIM_CLOCKDIVISION_DIV1
-TIM21.IPParameters=Prescaler,Period,AutoReloadPreload,ClockDivision
+TIM21.IPParameters=Prescaler,Period,AutoReloadPreload
TIM21.IPParametersWithoutCheck=Prescaler,Period
TIM21.Period=tim21_period
TIM21.Prescaler=tim21_prescaler
+USART2.BaudRate=config_baudrates[sensor_config.baudrate_index]
+USART2.IPParameters=VirtualMode-Asynchronous,VirtualMode-Hardware Flow Control (RS485),BaudRate,WordLength,Parity
+USART2.IPParametersWithoutCheck=BaudRate
+USART2.Parity=PARITY_EVEN
+USART2.VirtualMode-Asynchronous=VM_ASYNC
+USART2.VirtualMode-Hardware\ Flow\ Control\ (RS485)=VM_ASYNC
+USART2.WordLength=WORDLENGTH_9B
VP_SYS_VS_Systick.Mode=SysTick
VP_SYS_VS_Systick.Signal=SYS_VS_Systick
VP_TIM21_VS_ClockSourceINT.Mode=Internal
VP_TIM21_VS_ClockSourceINT.Signal=TIM21_VS_ClockSourceINT
board=custom
+isbadioc=false
diff --git a/fw_old/.cproject b/fw_old/.cproject
new file mode 100644
index 0000000..30a87ca
--- /dev/null
+++ b/fw_old/.cproject
@@ -0,0 +1,396 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/fw_old/.mxproject b/fw_old/.mxproject
new file mode 100644
index 0000000..4d4db74
--- /dev/null
+++ b/fw_old/.mxproject
@@ -0,0 +1,24 @@
+[PreviousLibFiles]
+LibFiles=Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_gpio.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_i2c.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_dma.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_bus.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_cortex.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_rcc.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_system.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_utils.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_exti.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_pwr.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_crs.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_lpuart.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_tim.h;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_gpio.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_i2c.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_dma.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rcc.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_utils.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_exti.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_lpuart.c;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_rcc.h;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_pwr.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_tim.c;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_gpio.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_i2c.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_dma.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_bus.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_cortex.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_rcc.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_system.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_utils.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_exti.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_pwr.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_crs.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_lpuart.h;Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_tim.h;Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h;Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h;Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h;Drivers/CMSIS/Device/ST/STM32L0xx/Source/Templates/system_stm32l0xx.c;Drivers/CMSIS/Include/cmsis_iccarm.h;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/cmsis_armclang.h;Drivers/CMSIS/Include/core_cm1.h;Drivers/CMSIS/Include/core_armv8mbl.h;Drivers/CMSIS/Include/core_cm33.h;Drivers/CMSIS/Include/cmsis_version.h;Drivers/CMSIS/Include/cmsis_compiler.h;Drivers/CMSIS/Include/mpu_armv7.h;Drivers/CMSIS/Include/mpu_armv8.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/core_sc300.h;Drivers/CMSIS/Include/tz_context.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/core_cm23.h;Drivers/CMSIS/Include/core_armv8mml.h;Drivers/CMSIS/Include/core_cm4.h;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/core_cm3.h;
+
+[PreviousUsedCubeIDEFiles]
+SourceFiles=Core/Src/main.c;Core/Src/stm32l0xx_it.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_gpio.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_i2c.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_dma.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rcc.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_utils.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_exti.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_lpuart.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_pwr.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_tim.c;Core/Src/system_stm32l0xx.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_gpio.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_i2c.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_dma.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rcc.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_utils.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_exti.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_lpuart.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_pwr.c;Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_tim.c;Core/Src/system_stm32l0xx.c;Drivers/CMSIS/Device/ST/STM32L0xx/Source/Templates/system_stm32l0xx.c;;
+HeaderPath=Drivers/STM32L0xx_HAL_Driver/Inc;Drivers/CMSIS/Device/ST/STM32L0xx/Include;Drivers/CMSIS/Include;Core/Inc;
+CDefines=USE_FULL_LL_DRIVER;HSE_VALUE:8000000;HSE_STARTUP_TIMEOUT:100;LSE_STARTUP_TIMEOUT:5000;LSE_VALUE:32768;MSI_VALUE:2097000;HSI_VALUE:16000000;LSI_VALUE:37000;VDD_VALUE:3300;PREFETCH_ENABLE:0;INSTRUCTION_CACHE_ENABLE:1;DATA_CACHE_ENABLE:1;STM32L011xx;USE_FULL_LL_DRIVER;HSE_VALUE:8000000;HSE_STARTUP_TIMEOUT:100;LSE_STARTUP_TIMEOUT:5000;LSE_VALUE:32768;MSI_VALUE:2097000;HSI_VALUE:16000000;LSI_VALUE:37000;VDD_VALUE:3300;PREFETCH_ENABLE:0;INSTRUCTION_CACHE_ENABLE:1;DATA_CACHE_ENABLE:1;
+
+[PreviousGenFiles]
+AdvancedFolderStructure=true
+HeaderFileListSize=3
+HeaderFiles#0=/home/mrs/Personal/HDIoT/Smart_Household/iaq_wired_sensor/fw/Core/Inc/stm32l0xx_it.h
+HeaderFiles#1=/home/mrs/Personal/HDIoT/Smart_Household/iaq_wired_sensor/fw/Core/Inc/stm32_assert.h
+HeaderFiles#2=/home/mrs/Personal/HDIoT/Smart_Household/iaq_wired_sensor/fw/Core/Inc/main.h
+HeaderFolderListSize=1
+HeaderPath#0=/home/mrs/Personal/HDIoT/Smart_Household/iaq_wired_sensor/fw/Core/Inc
+HeaderFiles=;
+SourceFileListSize=2
+SourceFiles#0=/home/mrs/Personal/HDIoT/Smart_Household/iaq_wired_sensor/fw/Core/Src/stm32l0xx_it.c
+SourceFiles#1=/home/mrs/Personal/HDIoT/Smart_Household/iaq_wired_sensor/fw/Core/Src/main.c
+SourceFolderListSize=1
+SourcePath#0=/home/mrs/Personal/HDIoT/Smart_Household/iaq_wired_sensor/fw/Core/Src
+SourceFiles=;
+
diff --git a/fw_old/.project b/fw_old/.project
new file mode 100644
index 0000000..6232ccb
--- /dev/null
+++ b/fw_old/.project
@@ -0,0 +1,33 @@
+
+
+ iaq_wired_sensor
+
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.genmakebuilder
+ clean,full,incremental,
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
+ full,incremental,
+
+
+
+
+
+ com.st.stm32cube.ide.mcu.MCUProjectNature
+ com.st.stm32cube.ide.mcu.MCUCubeProjectNature
+ org.eclipse.cdt.core.cnature
+ com.st.stm32cube.ide.mcu.MCUCubeIdeServicesRevAev2ProjectNature
+ com.st.stm32cube.ide.mcu.MCUAdvancedStructureProjectNature
+ com.st.stm32cube.ide.mcu.MCUEndUserDisabledTrustZoneProjectNature
+ com.st.stm32cube.ide.mcu.MCUSingleCpuProjectNature
+ com.st.stm32cube.ide.mcu.MCURootProjectNature
+ org.eclipse.cdt.managedbuilder.core.managedBuildNature
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
+
+
diff --git a/fw_old/.settings/org.eclipse.cdt.codan.core.prefs b/fw_old/.settings/org.eclipse.cdt.codan.core.prefs
new file mode 100644
index 0000000..19f7155
--- /dev/null
+++ b/fw_old/.settings/org.eclipse.cdt.codan.core.prefs
@@ -0,0 +1,72 @@
+com.st.stm32cube.ide.mcu.ide.oss.source.checker.libnano.problem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Float formatting support\\")"}
+eclipse.preferences.version=1
+org.eclipse.cdt.codan.checkers.errnoreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"No return\\")",implicit\=>false}
+org.eclipse.cdt.codan.checkers.errreturnvalue.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused return value\\")"}
+org.eclipse.cdt.codan.checkers.localvarreturn=-Warning
+org.eclipse.cdt.codan.checkers.localvarreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Returning the address of a local variable\\")"}
+org.eclipse.cdt.codan.checkers.nocommentinside.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Nesting comments\\")"}
+org.eclipse.cdt.codan.checkers.nolinecomment.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Line comments\\")"}
+org.eclipse.cdt.codan.checkers.noreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"No return value\\")",implicit\=>false}
+org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Abstract class cannot be instantiated\\")"}
+org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Ambiguous problem\\")"}
+org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Assignment in condition\\")"}
+org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Assignment to itself\\")"}
+org.eclipse.cdt.codan.internal.checkers.BlacklistProblem=-Warning
+org.eclipse.cdt.codan.internal.checkers.BlacklistProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Function or method is blacklisted\\")",blacklist\=>()}
+org.eclipse.cdt.codan.internal.checkers.CStyleCastProblem=-Warning
+org.eclipse.cdt.codan.internal.checkers.CStyleCastProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"C-Style cast instead of C++ cast\\")",checkMacro\=>true}
+org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"No break at end of case\\")",no_break_comment\=>"no break",last_case_param\=>false,empty_case_param\=>false,enable_fallthrough_quickfix_param\=>false}
+org.eclipse.cdt.codan.internal.checkers.CatchByReference.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Catching by reference is recommended\\")",unknown\=>false,exceptions\=>()}
+org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Circular inheritance\\")"}
+org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Class members should be properly initialized\\")",skip\=>true}
+org.eclipse.cdt.codan.internal.checkers.CopyrightProblem=-Warning
+org.eclipse.cdt.codan.internal.checkers.CopyrightProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Lack of copyright information\\")",regex\=>".*Copyright.*"}
+org.eclipse.cdt.codan.internal.checkers.DecltypeAutoProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid 'decltype(auto)' specifier\\")"}
+org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Field cannot be resolved\\")"}
+org.eclipse.cdt.codan.internal.checkers.FloatCompareProblem=-Warning
+org.eclipse.cdt.codan.internal.checkers.FloatCompareProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Direct float comparison\\")"}
+org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Function cannot be resolved\\")"}
+org.eclipse.cdt.codan.internal.checkers.GotoStatementProblem=-Warning
+org.eclipse.cdt.codan.internal.checkers.GotoStatementProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Goto statement used\\")"}
+org.eclipse.cdt.codan.internal.checkers.InvalidArguments.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid arguments\\")"}
+org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid template argument\\")"}
+org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Label statement not found\\")"}
+org.eclipse.cdt.codan.internal.checkers.MagicNumberProblem=-Warning
+org.eclipse.cdt.codan.internal.checkers.MagicNumberProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Avoid magic numbers\\")",checkArray\=>true,checkOperatorParen\=>true,exceptions\=>(1,0,-1,2,1.0,0.0,-1.0)}
+org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Member declaration not found\\")"}
+org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Method cannot be resolved\\")"}
+org.eclipse.cdt.codan.internal.checkers.MissCaseProblem=-Warning
+org.eclipse.cdt.codan.internal.checkers.MissCaseProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Missing cases in switch\\")"}
+org.eclipse.cdt.codan.internal.checkers.MissDefaultProblem=-Warning
+org.eclipse.cdt.codan.internal.checkers.MissDefaultProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Missing default in switch\\")",defaultWithAllEnums\=>false}
+org.eclipse.cdt.codan.internal.checkers.MissReferenceProblem=-Warning
+org.eclipse.cdt.codan.internal.checkers.MissReferenceProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Missing reference return value in assignment operator\\")"}
+org.eclipse.cdt.codan.internal.checkers.MissSelfCheckProblem=-Warning
+org.eclipse.cdt.codan.internal.checkers.MissSelfCheckProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Missing self check in assignment operator\\")"}
+org.eclipse.cdt.codan.internal.checkers.MultipleDeclarationsProblem=-Warning
+org.eclipse.cdt.codan.internal.checkers.MultipleDeclarationsProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Multiple variable declaration\\")"}
+org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Name convention for function\\")",pattern\=>"^[a-z]",macro\=>true,exceptions\=>()}
+org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Class has a virtual method and non-virtual destructor\\")"}
+org.eclipse.cdt.codan.internal.checkers.OverloadProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid overload\\")"}
+org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid redeclaration\\")"}
+org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid redefinition\\")"}
+org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Return with parenthesis\\")"}
+org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Format String Vulnerability\\")"}
+org.eclipse.cdt.codan.internal.checkers.ShallowCopyProblem=-Warning
+org.eclipse.cdt.codan.internal.checkers.ShallowCopyProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Miss copy constructor or assignment operator\\")",onlynew\=>false}
+org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Statement has no effect\\")",macro\=>true,exceptions\=>()}
+org.eclipse.cdt.codan.internal.checkers.StaticVariableInHeaderProblem=-Warning
+org.eclipse.cdt.codan.internal.checkers.StaticVariableInHeaderProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Static variable in header file\\")"}
+org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Suggested parenthesis around expression\\")",paramNot\=>false}
+org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Suspicious semicolon\\")",else\=>false,afterelse\=>false}
+org.eclipse.cdt.codan.internal.checkers.SymbolShadowingProblem=-Warning
+org.eclipse.cdt.codan.internal.checkers.SymbolShadowingProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Symbol shadowing\\")",paramFuncParameters\=>true}
+org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Type cannot be resolved\\")"}
+org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused function declaration\\")",macro\=>true}
+org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused static function\\")",macro\=>true}
+org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused variable declaration in file scope\\")",macro\=>true,exceptions\=>("@(\#)","$Id")}
+org.eclipse.cdt.codan.internal.checkers.UsingInHeaderProblem=-Warning
+org.eclipse.cdt.codan.internal.checkers.UsingInHeaderProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Using directive in header\\")"}
+org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Symbol is not resolved\\")"}
+org.eclipse.cdt.codan.internal.checkers.VirtualMethodCallProblem=-Error
+org.eclipse.cdt.codan.internal.checkers.VirtualMethodCallProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Virtual method call in constructor/destructor\\")"}
diff --git a/fw_old/.settings/org.eclipse.cdt.core.prefs b/fw_old/.settings/org.eclipse.cdt.core.prefs
new file mode 100644
index 0000000..c8ec5df
--- /dev/null
+++ b/fw_old/.settings/org.eclipse.cdt.core.prefs
@@ -0,0 +1,6 @@
+doxygen/doxygen_new_line_after_brief=true
+doxygen/doxygen_use_brief_tag=false
+doxygen/doxygen_use_javadoc_tags=true
+doxygen/doxygen_use_pre_tag=false
+doxygen/doxygen_use_structural_commands=false
+eclipse.preferences.version=1
diff --git a/fw_old/.settings/stm32cubeide.project.prefs b/fw_old/.settings/stm32cubeide.project.prefs
new file mode 100644
index 0000000..ae186d6
--- /dev/null
+++ b/fw_old/.settings/stm32cubeide.project.prefs
@@ -0,0 +1,3 @@
+8DF89ED150041C4CBC7CB9A9CAA90856=295E78E9D51884086204F31037537306
+DC22A860405A8BF2F2C095E5B6529F12=295E78E9D51884086204F31037537306
+eclipse.preferences.version=1
diff --git a/fw_old/Core/Inc/config.h b/fw_old/Core/Inc/config.h
new file mode 100644
index 0000000..c512299
--- /dev/null
+++ b/fw_old/Core/Inc/config.h
@@ -0,0 +1,145 @@
+/*
+ * config.h
+ *
+ * Created on: Sep 5, 2021
+ * Author: david
+ */
+
+#ifndef INC_CONFIG_H_
+#define INC_CONFIG_H_
+
+/* TODO: add comments to everything */
+
+/* EXAMPLE of USAGE */
+/*
+config_t new_config;
+new_config.led_co2_alert_limit1 = 1000;
+new_config.led_co2_alert_limit2 = 2000;
+new_config.led_on = 1;
+new_config.modbus_addr = 0x11;
+config_write(&new_config);
+
+config_t config;
+config_read(&config);
+*/
+
+#include "stdint.h"
+#include "stm32l0xx.h"
+/* DESCRIPTION OF THE DATA STRUCTURE */
+/*
+ * Data are divided into two groups:
+ * A) DEVICE DESCRIPTION
+ * Can not be changed by the user.
+ * These data can be only read.
+ * These data are:
+ * * VENDOR NAME
+ * * PRODUCT CODE
+ * * PRODUCT NAME
+ * * REVISION
+ * * SERIAL NUMBER
+ * B) DEVICE CONFIGURATION
+ * Can be changed by the user.
+ * These data are:
+ * * MODBUS ADDRESS - Modbus Address of the device. Default is 254
+ * * LED ON - Whether the CO2 Level Indication LED should be on or off
+ * * LED CO2 ALERT LIMIT 1 - CO2 Level when the LED color changes Green<->Yellow
+ * * LED CO2 ALERT LIMIT 2 - CO2 Level when the LED color changes Yellow<->Red
+ *
+ * Device description data can be accessed using direct readout from the memory
+ * Device configuration data can be accessed using config_t struct.
+ */
+#define CONFIG_DEFAULT_LED_ON 1
+#define CONFIG_DEFAULT_LED_BRIGHTNESS 100 /* TODO: set according to the timers when this will be implemented */
+#define CONFIG_DEFAULT_LED_ALERT1_LIMIT 1500
+#define CONFIG_DEFAULT_LED_ALERT2_LIMIT 3000
+#define CONFIG_DEFAULT_LED_SMOOTH 0
+#define CONFIG_DEFAULT_SCD4x_T_OFFSET 0
+#define CONFIG_DEFAULT_BAUDRATE_INDEX 0
+
+#define CONFIG_MODBUS_ADDR_LENGTH 2
+#define CONFIG_BAUDRATE_INDEX_LENGTH 2
+#define CONFIG_LED_ON_LENGTH 2
+#define CONFIG_LED_BRIGHTNESS_LENGTH 2
+#define CONFIG_LED_SMOOTH_LENGTH 2
+#define CONFIG_LED_ALERT1_LENGTH 2
+#define CONFIG_LED_ALERT2_LENGTH 2
+#define CONFIG_LED_ALERT2_LENGTH 2
+#define CONFIG_SCD4x_T_OFFSET_LENGTH 2
+#define VENDOR_NAME_LENGTH 64
+#define PRODUCT_CODE_LENGTH 64
+#define PRODUCT_NAME_LENGTH 64
+#define REVISION_LENGTH 16
+#define SERIAL_NUMBER_LENGTH 64
+
+#define EEPROM_EMPTY_BYTE 0x00
+
+#define EEPROM_ADDR_START ((uint32_t)0x08080000)
+#define EEPROM_ADDR_END ((uint32_t)0x080801FF)
+
+#define CONFIG_EEPROM_ADDR_MODBUS_ADDR EEPROM_ADDR_START
+#define CONFIG_EEPROM_ADDR_BAUDRATE_INDEX (CONFIG_EEPROM_ADDR_MODBUS_ADDR + CONFIG_MODBUS_ADDR_LENGTH)
+#define CONFIG_EEPROM_ADDR_LED_ON (CONFIG_EEPROM_ADDR_BAUDRATE_INDEX + CONFIG_BAUDRATE_INDEX_LENGTH)
+#define CONFIG_EEPROM_ADDR_LED_BRIGHTNESS (CONFIG_EEPROM_ADDR_LED_ON + CONFIG_LED_ON_LENGTH)
+#define CONFIG_EEPROM_ADDR_LED_SMOOTH (CONFIG_EEPROM_ADDR_LED_BRIGHTNESS + CONFIG_LED_BRIGHTNESS_LENGTH)
+#define CONFIG_EEPROM_ADDR_LED_ALERT1 (CONFIG_EEPROM_ADDR_LED_SMOOTH + CONFIG_LED_SMOOTH_LENGTH)
+#define CONFIG_EEPROM_ADDR_LED_ALERT2 (CONFIG_EEPROM_ADDR_LED_ALERT1 + CONFIG_LED_ALERT1_LENGTH)
+#define CONFIG_EEPROM_ADDR_SCD4x_T_OFFSET (CONFIG_EEPROM_ADDR_LED_ALERT2 + CONFIG_LED_ALERT2_LENGTH)
+
+#define CONFIG_EEPROM_ADDR_VENDOR_NAME (CONFIG_EEPROM_ADDR_SCD4x_T_OFFSET + CONFIG_SCD4x_T_OFFSET_LENGTH)
+#define CONFIG_EEPROM_ADDR_PRODUCT_CODE (CONFIG_EEPROM_ADDR_VENDOR_NAME + VENDOR_NAME_LENGTH)
+#define CONFIG_EEPROM_ADDR_PRODUCT_NAME (CONFIG_EEPROM_ADDR_PRODUCT_CODE + PRODUCT_CODE_LENGTH)
+#define CONFIG_EEPROM_ADDR_REVISION (CONFIG_EEPROM_ADDR_PRODUCT_NAME + PRODUCT_NAME_LENGTH)
+#define CONFIG_EEPROM_ADDR_SERIAL_NUMBER (CONFIG_EEPROM_ADDR_REVISION + REVISION_LENGTH)
+
+#define FLASH_PEKEY1 ((uint32_t)0x89ABCDEF)
+#define FLASH_PEKEY2 ((uint32_t)0x02030405)
+
+#define CONFIG_OK 0
+#define CONFIG_ERROR -1
+
+#define EEPROM_OK 0
+#define EEPROM_ERROR -1
+#define EEPROM_UNLOCK_ERROR -2
+#define EEPROM_LOCK_ERROR -3
+#define EEPROM_WRITE_ERROR -4
+#define EEPROM_ADDR_ERROR -5
+
+#define SYSTICK_FREQ_HZ 12000000
+#define EEPROM_TIMEOUT_MAX_MS_INV 200
+
+/*
+ * Variables
+ */
+
+extern const uint32_t config_baudrates[];
+extern const uint8_t config_baudrates_length;
+
+/*
+ * Type definitions
+ */
+
+typedef struct
+{
+ /* LED CONFIG */
+ uint8_t led_on;
+ uint16_t led_brightness;
+ uint8_t led_smooth;
+ uint16_t led_co2_alert_limit1;
+ uint16_t led_co2_alert_limit2;
+
+ /* SCD4x Temperature sensor offset */
+ int16_t scd4x_t_offset;
+
+ /* MODBUS CONFIG */
+ uint16_t modbus_addr;
+ uint32_t baudrate_index;
+} config_t;
+
+
+/* const uint32_t baudrates [] = {19200, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, 76800, 115200}; */
+
+int8_t config_read(config_t *config);
+int8_t config_write(config_t *config);
+
+#endif /* INC_CONFIG_H_ */
+
diff --git a/fw_old/Core/Inc/crc8.h b/fw_old/Core/Inc/crc8.h
new file mode 100644
index 0000000..e799f7e
--- /dev/null
+++ b/fw_old/Core/Inc/crc8.h
@@ -0,0 +1,22 @@
+/*
+ * crc.h
+ *
+ * Created on: Jun 9, 2021
+ * Author: user
+ */
+
+#ifndef INC_CRC8_H_
+#define INC_CRC8_H_
+
+#include "stdint.h"
+
+/*
+ * Definitions & macros
+ */
+
+#define CRC8_POLYNOMIAL 0x31
+#define CRC8_INIT 0xFF
+
+uint8_t crc8_calculate(const uint8_t *data, uint16_t count);
+
+#endif /* INC_CRC8_H_ */
diff --git a/fw_old/Core/Inc/i2c.h b/fw_old/Core/Inc/i2c.h
new file mode 100644
index 0000000..f346e68
--- /dev/null
+++ b/fw_old/Core/Inc/i2c.h
@@ -0,0 +1,46 @@
+/*
+ * i2c.h
+ *
+ * Created on: Jun 8, 2021
+ * Author: user
+ */
+
+#ifndef INC_I2C_H_
+#define INC_I2C_H_
+
+#include "stdint.h"
+#include "stm32l0xx_ll_i2c.h"
+
+/*
+ * Defines & macros
+ */
+
+#define NULL 0
+
+/*
+ * Return values for I2C functions
+ */
+
+#define I2C_OK 0
+#define I2C_ERROR -1 // generic error
+#define I2C_ERROR_NACK -2 // NACK was received during transfer
+#define I2C_ERROR_TX_INCOMPLETE -3 // number of TXed bytes != buffer length
+#define I2C_ERROR_RX_INCOMPLETE -4 // number of RXed bytes != buffer length
+
+/*
+ * Type definitions
+ */
+
+typedef struct {
+ I2C_TypeDef *i2c;
+} i2c_context_t;
+
+/*
+ * Function declarations
+ */
+
+int i2c_init(i2c_context_t *context);
+int i2c_transmit(uint8_t address, uint8_t *buffer, int len);
+int i2c_receive(uint8_t address, uint8_t *buffer, int len);
+
+#endif /* INC_I2C_H_ */
diff --git a/fw_old/Core/Inc/main.h b/fw_old/Core/Inc/main.h
new file mode 100644
index 0000000..a144a49
--- /dev/null
+++ b/fw_old/Core/Inc/main.h
@@ -0,0 +1,120 @@
+/* USER CODE BEGIN Header */
+/**
+ ******************************************************************************
+ * @file : main.h
+ * @brief : Header for main.c file.
+ * This file contains the common defines of the application.
+ ******************************************************************************
+ * @attention
+ *
+ * © Copyright (c) 2021 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software component is licensed by ST under BSD 3-Clause license,
+ * the "License"; You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ * opensource.org/licenses/BSD-3-Clause
+ *
+ ******************************************************************************
+ */
+/* USER CODE END Header */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __MAIN_H
+#define __MAIN_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Includes ------------------------------------------------------------------*/
+#include "stm32l0xx_ll_i2c.h"
+#include "stm32l0xx_ll_lpuart.h"
+#include "stm32l0xx_ll_rcc.h"
+#include "stm32l0xx_ll_crs.h"
+#include "stm32l0xx_ll_bus.h"
+#include "stm32l0xx_ll_system.h"
+#include "stm32l0xx_ll_exti.h"
+#include "stm32l0xx_ll_cortex.h"
+#include "stm32l0xx_ll_utils.h"
+#include "stm32l0xx_ll_pwr.h"
+#include "stm32l0xx_ll_dma.h"
+#include "stm32l0xx_ll_tim.h"
+#include "stm32l0xx_ll_gpio.h"
+
+#if defined(USE_FULL_ASSERT)
+#include "stm32_assert.h"
+#endif /* USE_FULL_ASSERT */
+
+/* Private includes ----------------------------------------------------------*/
+/* USER CODE BEGIN Includes */
+#include "i2c.h"
+#include "scd4x.h"
+#include "sht4x.h"
+#include "sps30.h"
+#include "modbus.h"
+#include "config.h"
+/* USER CODE END Includes */
+
+/* Exported types ------------------------------------------------------------*/
+/* USER CODE BEGIN ET */
+
+/* USER CODE END ET */
+
+/* Exported constants --------------------------------------------------------*/
+/* USER CODE BEGIN EC */
+
+/* USER CODE END EC */
+
+/* Exported macro ------------------------------------------------------------*/
+/* USER CODE BEGIN EM */
+
+/* USER CODE END EM */
+
+/* Exported functions prototypes ---------------------------------------------*/
+void Error_Handler(void);
+
+/* USER CODE BEGIN EFP */
+int8_t uart_disable_interrupts(void);
+int8_t uart_enable_interrupts(void);
+
+/* USER CODE END EFP */
+
+/* Private defines -----------------------------------------------------------*/
+#define LED_B_Pin LL_GPIO_PIN_5
+#define LED_B_GPIO_Port GPIOA
+#define LED_G_Pin LL_GPIO_PIN_6
+#define LED_G_GPIO_Port GPIOA
+#define LED_R_Pin LL_GPIO_PIN_7
+#define LED_R_GPIO_Port GPIOA
+#ifndef NVIC_PRIORITYGROUP_0
+#define NVIC_PRIORITYGROUP_0 ((uint32_t)0x00000007) /*!< 0 bit for pre-emption priority,
+ 4 bits for subpriority */
+#define NVIC_PRIORITYGROUP_1 ((uint32_t)0x00000006) /*!< 1 bit for pre-emption priority,
+ 3 bits for subpriority */
+#define NVIC_PRIORITYGROUP_2 ((uint32_t)0x00000005) /*!< 2 bits for pre-emption priority,
+ 2 bits for subpriority */
+#define NVIC_PRIORITYGROUP_3 ((uint32_t)0x00000004) /*!< 3 bits for pre-emption priority,
+ 1 bit for subpriority */
+#define NVIC_PRIORITYGROUP_4 ((uint32_t)0x00000003) /*!< 4 bits for pre-emption priority,
+ 0 bit for subpriority */
+#endif
+/* USER CODE BEGIN Private defines */
+#define MEASUREMENT_PERIOD_MS 600000
+
+extern uint16_t lpuart1_rx_message_index;
+extern uint16_t lpuart1_rx_message_len;
+extern uint8_t lpuart1_rx_done;
+extern uint8_t lpuart1_rx_message_too_long;
+
+extern uint8_t tim21_elapsed_period;
+
+/* USER CODE END Private defines */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __MAIN_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/fw_old/Core/Inc/modbus.h b/fw_old/Core/Inc/modbus.h
new file mode 100644
index 0000000..a215328
--- /dev/null
+++ b/fw_old/Core/Inc/modbus.h
@@ -0,0 +1,181 @@
+/*
+ * modbus.h
+ *
+ * Created on: Jul 18, 2021
+ * Author: user
+ *
+ * Modbus slave RTU library (does NOT support ASCII and TCP)
+ *
+ * Useful links:
+ * https://www.picotech.com/library/oscilloscopes/modbus-serial-protocol-decoding
+ * https://ipc2u.com/articles/knowledge-base/modbus-rtu-made-simple-with-detailed-descriptions-and-examples/
+ * https://modbus.org/docs/Modbus_over_serial_line_V1_02.pdf
+ * https://www.modbus.org/docs/Modbus_Application_Protocol_V1_1b.pdf
+ *
+ * Note that byte order is big endian.
+ *
+ * USAGE:
+ *
+ * 1) Implement functions modbus_callback_function() and modbus_uart_transmit_function()
+ * - modbus_uart_transmit_function() sends data via UART
+ * - modbus_callback_function() does the real work: read sensors, set outputs...
+ * note that when filling buffers (e.g. input_registers[]) user must
+ * ensure that all data is big-endian
+ * These functions are implementation-specific.
+ * 2) Set device address (variable modbus_device_address); you can do this either
+ * - setting modbus_device_address directly (modbus.h needs to be included, duh)
+ * - using modbus_set_device_address(uint8_t address) function
+ * Or you can leave address as-is (MODBUS_DEFAULT_SLAVE_ADDRESS) and set it via
+ * Modbus during runtime
+ * 3) Call modbus_process_msg() after message reception; you need to observe Modbus RTU timing:
+ * - pauses between chars in frame are less or equal to 1.5 char
+ * - pauses between frames are at least 3.5 chars (of silence)
+ * For more information see section 2.5.1.1 (MODBUS Message RTU Framing)
+ * in "MODBUS over Serial Line: Specification and Implementation Guide"
+ *
+ */
+
+#ifndef SRC_MODBUS_H_
+#define SRC_MODBUS_H_
+
+#include "stdint.h"
+
+/*
+ * Defines & macros
+ */
+
+#define MODBUS_BROADCAST_ADDR 0
+#define MODBUS_DEFAULT_SLAVE_ADDRESS 254 /* 255 may be used for bridge device */
+/* minimal frame length is 4 bytes: 1 B slave address, 1 B function code, 2 B CRC */
+#define MODBUS_MINIMAL_FRAME_LEN 4
+#define MODBUS_MAX_RTU_FRAME_SIZE 256
+#define MODBUS_BUFFER_SIZE MODBUS_MAX_RTU_FRAME_SIZE /* alias */
+#define MODBUS_ERROR_FLAG 0x80
+#define MODBUS_MAX_REGISTERS 125
+
+/*
+ * Return values
+ */
+
+#define MODBUS_OK 0
+#define MODBUS_ERROR -1 // generic error
+#define MODBUS_ERROR_CRC -2 // checksum failed
+#define MODBUS_ERROR_FRAME_INVALID -3 // invalid frame format / length
+#define MODBUS_ERROR_OUT_OF_BOUNDS -4 // requested register is out of bounds
+#define MODBUS_ERROR_FUNCTION_NOT_IMPLEMENTED -5 // function not implemented in callback
+#define MODBUS_ERROR_REGISTER_NOT_IMPLEMENTED -6 // register not implemented in callback
+
+/*
+ * Data types
+ */
+
+/* Public functions codes (Modbus Application protocol specification, section 5.1) */
+typedef enum {
+ /* single bit access functions */
+ MODBUS_READ_COILS = 1,
+ MODBUS_READ_DO = 1, // alias
+ MODBUS_READ_DISCRETE_INPUTS = 2,
+ MODBUS_READ_DI = 2, // alias
+ MODBUS_WRITE_SINGLE_COIL = 5,
+ MODBUS_WRITE_SINGLE_DO = 5, // alias
+ MODBUS_WRITE_MULTIPLE_COILS = 15,
+ MODBUS_WRITE_MULTIPLE_DO = 15, // alias
+ /* 16-bit access functions */
+ MODBUS_READ_HOLDING_REGISTERS = 3,
+ MODBUS_READ_AO = 3, // alias
+ MODBUS_READ_INPUT_REGISTERS = 4,
+ MODBUS_READ_AI = 4, // alias
+ MODBUS_WRITE_SINGLE_REGISTER = 6,
+ MODBUS_WRITE_SINGLE_AO = 6, // alias
+ MODBUS_WRITE_MULTIPLE_REGISTERS = 16,
+ MODBUS_WRITE_MULTIPLE_AO = 16, // alias
+ MODBUS_MASK_WRITE_REGISTER = 22,
+ MODBUS_READ_WRITE_MULTIPLE_REGISTERS = 23,
+ MODBUS_READ_FIFO_QUEUE = 24,
+ /* file record access */
+ MODBUS_READ_FILE_RECORD = 20,
+ MODBUS_WRITE_FILE_RECORD = 21,
+ /* diagnostics */
+ MODBUS_READ_EXCEPTION_STATUS = 7,
+ MODBUS_DIAGNOSTIC = 8, /* sub codes: 00-18,20 */
+ MODBUS_GET_COM_EVENT_COUNTER = 11,
+ MODBUS_GET_COM_EVENT_LOG = 12,
+ MODBUS_REPORT_SLAVE_ID = 17,
+ MODBUS_READ_DEVICE_IDENTIFICATION = 43, /* sub codes: 14 */
+} modbus_function_code_t;
+
+typedef enum {
+ MODBUS_EXCEPTION_ILLEGAL_FUNCTION = 1,
+ MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS = 2,
+ MODBUS_EXCEPTION_ILLEGAL_REGISTER_QUANTITY = 2,
+ MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE = 3,
+ MODBUS_EXCEPTION_SLAVE_DEVICE_FAILURE = 4,
+ MODBUS_EXCEPTION_ACKNOWLEDGE = 5,
+ MODBUS_EXCEPTION_SLAVE_DEVICE_BUSY = 6,
+ MODBUS_EXCEPTION_MEMORY_PARITY_ERROR = 8,
+ MODBUS_EXCEPTION_GATEWAY_PATH_UNAVAILABLE = 10,
+ MODBUS_EXCEPTION_GATEWAY_TARGET_DEVICE_FAILED_TO_RESPOND = 11,
+} modbus_exception_code_t;
+
+typedef struct {
+ uint8_t exception_code;
+} exception_t;
+
+typedef struct {
+ modbus_function_code_t function_code : 8;
+ uint16_t register_address; // e.g. first register of A0: 0
+ uint16_t register_number; // e.g. first register of A0: 40001
+ uint8_t register_count; // number of registers to be read/written
+
+ exception_t exception;
+
+ union {
+ uint8_t buffer8b[MODBUS_MAX_RTU_FRAME_SIZE];
+ uint16_t buffer16b[MODBUS_MAX_RTU_FRAME_SIZE/2];
+ uint16_t input_registers[MODBUS_MAX_REGISTERS];
+ uint16_t holding_registers[MODBUS_MAX_REGISTERS];
+ int16_t input_registers_signed[MODBUS_MAX_REGISTERS];
+ int16_t holding_registers_signed[MODBUS_MAX_REGISTERS];
+ };
+} modbus_transaction_t;
+
+typedef enum {
+ MODBUS_DO_START_NUMBER = 1, // Discrete output coils
+ MODBUS_DO_END_NUMBER = 9999,
+ MODBUS_DI_START_NUMBER = 10001, // Discrete input contacts
+ MODBUS_DI_END_NUMBER = 19999,
+ MODBUS_AI_START_NUMBER = 30001, // Analog input registers
+ MODBUS_AI_END_NUMBER = 39999,
+ MODBUS_AO_START_NUMBER = 40001, // Analog output (holding registers)
+ MODBUS_AO_END_NUMBER = 49999
+} modbus_register_number_t;
+
+
+/*
+ * Global variables
+ */
+
+/* device address: declared in modbus.c */
+extern uint8_t modbus_slave_address;
+
+/* shared modbus buffer; defined in modbus.c; may be used elsewhere in code */
+extern uint8_t modbus_buffer[];
+
+/*
+ * Function prototypes
+ */
+
+/* process message: should be called in when modbus message was received (e.g. in main.c)
+ * modbus_process_msg() may call following functions:
+ * - modbus_callback_function() if data readout is requested
+ * - modbus_uart_transmit_function() if response is required
+ * Both functions have to be implemented by user.
+ */
+int8_t modbus_slave_process_msg(const uint8_t *buffer, int len);
+int8_t modbus_slave_set_address(uint8_t address);
+/* modbus callback function type - should be implemented by user (e.g. in main.c) */
+int8_t modbus_slave_callback(modbus_transaction_t *transaction);
+/* UART transmit function type - should be implemented by user (e.g. in main.c) */
+int8_t modbus_transmit_function(uint8_t *buffer, uint16_t data_len);
+
+#endif /* SRC_MODBUS_H_ */
diff --git a/fw_old/Core/Inc/scd4x.h b/fw_old/Core/Inc/scd4x.h
new file mode 100644
index 0000000..921f9ee
--- /dev/null
+++ b/fw_old/Core/Inc/scd4x.h
@@ -0,0 +1,57 @@
+/*
+ * sht4x.h
+ *
+ * Created on: Jun 8, 2021
+ * Author: user
+ */
+
+#ifndef INC_SCD4X_H_
+#define INC_SCD4X_H_
+
+#include "stdint.h"
+#include "stm32l0xx_ll_i2c.h"
+#include "stm32l0xx_ll_utils.h"
+#include "i2c.h"
+#include "crc8.h"
+
+/*
+ * Defines & macros
+ */
+
+#define SCD4X_I2C_ADDRESS 0x62
+
+/*
+ * Return values
+ */
+
+#define SCD4X_OK 0
+#define SCD4X_ERROR -1 // generic error
+#define SCD4X_CRC8_ERROR -2 // checksum failed
+
+/*
+ * Data types
+ */
+
+typedef enum {
+ SCD4X_START_PERIODIC_MEASUREMENT = 0x21B1,
+ SCD4X_READ_MEASUREMENT = 0xEC05,
+ SCD4X_STOP_PERIODIC_MEASUREMENT = 0x3F86,
+ SCD4X_GET_DATA_READY_STATUS = 0xe4b8,
+ SCD4X_PERFORM_FACTORY_RESET = 0x3632
+} scd4x_cmd_t;
+
+/*
+ * Function prototypes
+ */
+
+int8_t scd4x_send_cmd(scd4x_cmd_t cmd);
+int8_t scd4x_read_data(uint8_t *buffer, int len);
+
+int8_t scd4x_start_periodic_measurement( void );
+int8_t scd4x_stop_periodic_measurement( void );
+
+int8_t scd4x_perform_factory_reset( void );
+
+int8_t scd4x_read_measurement(uint16_t * co2, int16_t *temperature, uint16_t *relative_humidity);
+
+#endif /* INC_SCD4X_H_ */
diff --git a/fw_old/Core/Inc/sht4x.h b/fw_old/Core/Inc/sht4x.h
new file mode 100644
index 0000000..36c4351
--- /dev/null
+++ b/fw_old/Core/Inc/sht4x.h
@@ -0,0 +1,57 @@
+/*
+ * sht4x.h
+ *
+ * Created on: Jun 8, 2021
+ * Author: user
+ */
+
+#ifndef INC_SHT4X_H_
+#define INC_SHT4X_H_
+
+#include "stdint.h"
+#include "stm32l0xx_ll_i2c.h"
+#include "stm32l0xx_ll_utils.h"
+#include "i2c.h"
+#include "crc8.h"
+
+/*
+ * Defines & macros
+ */
+
+#define SHT4X_I2C_ADDRESS 0x44
+
+/*
+ * Return values
+ */
+
+#define SHT4X_OK 0
+#define SHT4X_ERROR -1 // generic error
+#define SHT4X_CRC8_ERROR -2 // checksum failed
+
+/*
+ * Data types
+ */
+
+typedef enum {
+ SHT4X_START_MEAS_HIGH_PRECISION = 0xFD,
+ SHT4X_START_MEAS_MEDIUM_PRECISION = 0xF6,
+ SHT4X_START_MEAS_LOW_PRECISION = 0xE0,
+ SHT4X_READ_SERIAL = 0x89,
+ SHT4X_SOFT_RESET = 0x94,
+ SHT4X_HEATER_200_mW_1_s = 0x39,
+ SHT4X_HEATER_200_mW_01_s = 0x32,
+ SHT4X_HEATER_110_mW_1_s = 0x2F,
+ SHT4X_HEATER_110_mW_01_s = 0x24,
+ SHT4X_HEATER_20_mW_1_s = 0x1E,
+ SHT4X_HEATER_20_mW_01_s = 0x15
+} sht4x_cmd_t;
+
+/*
+ * Function prototypes
+ */
+
+int8_t sht4x_send_cmd(sht4x_cmd_t cmd);
+int8_t sht4x_read_data(uint8_t *buffer, int len);
+int8_t sht4x_measure(int16_t *temperature, uint16_t *relative_humidity);
+
+#endif /* INC_SHT4X_H_ */
diff --git a/fw_old/Core/Inc/sps30.h b/fw_old/Core/Inc/sps30.h
new file mode 100644
index 0000000..9ca3c45
--- /dev/null
+++ b/fw_old/Core/Inc/sps30.h
@@ -0,0 +1,78 @@
+/*
+ * sps30.h
+ *
+ * Created on: Jul 18, 2021
+ * Author: mrs
+ */
+
+#ifndef INC_SPS30_H_
+#define INC_SPS30_H_
+
+#include "stdint.h"
+#include "stm32l0xx_ll_i2c.h"
+#include "stm32l0xx_ll_utils.h"
+#include "i2c.h"
+#include "crc8.h"
+
+/*
+ * Defines & macros
+ */
+
+#define SPS30_I2C_ADDRESS 0x69
+
+/*
+ * Return values
+ */
+
+#define SPS30_OK 0
+#define SPS30_ERROR -1 // generic error
+#define SPS30_CRC8_ERROR -2 // checksum failed
+
+/*
+ * Data types
+ */
+
+typedef enum {
+ SPS30_START_MEASUREMENT = 0x0010,
+ SPS30_STOP_MEASUREMENT = 0x0104,
+ SPS30_READ_DATA_READY_FLAG = 0x0202,
+ SPS30_READ_MEASURED_VALUES = 0x0300,
+ SPS30_SLEEP = 0x1001,
+ SPS30_WAKE_UP = 0x1103,
+ SPS30_START_FAN_CLEANING = 0x5607,
+ SPS30_READ_AUTO_CLEANING_INTERVAL = 0x8004,
+ SPS30_WRITE_AUTO_CLEANING_INTERVAL = 0x8004,
+ SPS30_READ_PRODUCT_TYPE = 0xD002,
+ SPS30_READ_SERIAL_NUMBER = 0xD033,
+ SPS30_READ_VERSION = 0xD100,
+ SPS30_READ_DEVICE_STATUS_REGISTER = 0xD206,
+ SPS30_CLEAR_DEVICE_STATUS_REGISTER = 0xD210,
+ SPS30_RESET = 0xD304
+
+} sps30_cmd_t;
+
+typedef enum {
+ SPS30_FLOAT_FORMAT = 0x03,
+ SPS30_UINT16_FORMAT = 0x05
+} sps30_data_format;
+
+int8_t sps30_send_cmd(sps30_cmd_t cmd);
+
+int8_t sps30_start_measurement( void );
+int8_t sps30_stop_measurement( void );
+int8_t sps30_read_measured_values(uint16_t *measured_values, uint8_t measured_values_len);
+
+int8_t sps30_sleep( void );
+int8_t sps30_wake_up( void );
+
+int8_t sps30_start_fan_cleaning( void );
+
+int8_t sps30_reset( void );
+
+int8_t sps30_read_status_register ( void );
+
+int8_t sps30_read_firmware_version ( uint8_t * fw_ver_hi, uint8_t * fw_ver_lo );
+
+uint8_t calculate_crc(uint8_t data[2]);
+
+#endif /* INC_SPS30_H_ */
diff --git a/fw_old/Core/Inc/stm32_assert.h b/fw_old/Core/Inc/stm32_assert.h
new file mode 100644
index 0000000..ca09699
--- /dev/null
+++ b/fw_old/Core/Inc/stm32_assert.h
@@ -0,0 +1,53 @@
+/**
+ ******************************************************************************
+ * @file stm32_assert.h
+ * @brief STM32 assert file.
+ ******************************************************************************
+ * @attention
+ *
+ * © Copyright (c) 2018 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software component is licensed by ST under BSD 3-Clause license,
+ * the "License"; You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ * opensource.org/licenses/BSD-3-Clause
+ *
+ ******************************************************************************
+ */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __STM32_ASSERT_H
+#define __STM32_ASSERT_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* Exported types ------------------------------------------------------------*/
+/* Exported constants --------------------------------------------------------*/
+/* Includes ------------------------------------------------------------------*/
+/* Exported macro ------------------------------------------------------------*/
+#ifdef USE_FULL_ASSERT
+/**
+ * @brief The assert_param macro is used for function's parameters check.
+ * @param expr: If expr is false, it calls assert_failed function
+ * which reports the name of the source file and the source
+ * line number of the call that failed.
+ * If expr is true, it returns no value.
+ * @retval None
+ */
+ #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
+/* Exported functions ------------------------------------------------------- */
+ void assert_failed(uint8_t* file, uint32_t line);
+#else
+ #define assert_param(expr) ((void)0U)
+#endif /* USE_FULL_ASSERT */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __STM32_ASSERT_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/fw_old/Core/Inc/stm32l0xx_it.h b/fw_old/Core/Inc/stm32l0xx_it.h
new file mode 100644
index 0000000..e4fecd6
--- /dev/null
+++ b/fw_old/Core/Inc/stm32l0xx_it.h
@@ -0,0 +1,65 @@
+/* USER CODE BEGIN Header */
+/**
+ ******************************************************************************
+ * @file stm32l0xx_it.h
+ * @brief This file contains the headers of the interrupt handlers.
+ ******************************************************************************
+ * @attention
+ *
+ * © Copyright (c) 2021 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software component is licensed by ST under BSD 3-Clause license,
+ * the "License"; You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ * opensource.org/licenses/BSD-3-Clause
+ *
+ ******************************************************************************
+ */
+/* USER CODE END Header */
+
+/* Define to prevent recursive inclusion -------------------------------------*/
+#ifndef __STM32L0xx_IT_H
+#define __STM32L0xx_IT_H
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/* Private includes ----------------------------------------------------------*/
+/* USER CODE BEGIN Includes */
+
+/* USER CODE END Includes */
+
+/* Exported types ------------------------------------------------------------*/
+/* USER CODE BEGIN ET */
+
+/* USER CODE END ET */
+
+/* Exported constants --------------------------------------------------------*/
+/* USER CODE BEGIN EC */
+/* USER CODE END EC */
+
+/* Exported macro ------------------------------------------------------------*/
+/* USER CODE BEGIN EM */
+
+/* USER CODE END EM */
+
+/* Exported functions prototypes ---------------------------------------------*/
+void NMI_Handler(void);
+void HardFault_Handler(void);
+void SVC_Handler(void);
+void PendSV_Handler(void);
+void SysTick_Handler(void);
+void TIM21_IRQHandler(void);
+void LPUART1_IRQHandler(void);
+/* USER CODE BEGIN EFP */
+/* USER CODE END EFP */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __STM32L0xx_IT_H */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/fw_old/Core/Src/config.c b/fw_old/Core/Src/config.c
new file mode 100644
index 0000000..08f6112
--- /dev/null
+++ b/fw_old/Core/Src/config.c
@@ -0,0 +1,243 @@
+/*
+ * config.c
+ *
+ * Created on: Sep 5, 2021
+ * Author: david
+ */
+
+#include "config.h"
+
+/*
+ * Variables
+ */
+/* Baudrates - STM32L0xx can do baudrates from 1200 to 115200
+ * - default value has index 0 */
+const uint32_t config_baudrates[] = {
+ 19200, // 0
+ 4800, // 1
+ 9600, // 2
+ 14400, // 3
+ 19200, // 4
+ 28800, // 5
+ 38400, // 6
+ 57600, // 7
+ 76800, // 8
+ 115200 // 9
+};
+const uint8_t config_baudrates_length = 10;
+
+/* Function to lock the EEPROM */
+static int8_t eeprom_lock(void);
+/* Function to unlock the EEPROM */
+static int8_t eeprom_unlock(void);
+/* Function to write one byte to the EEPROM */
+/* IMPORTANT: EEPROM must be unlocked first */
+static int8_t eeprom_program_byte(uint32_t addr, uint8_t ee_data);
+/* Function to write two bytes to the EEPROM */
+/* IMPORTANT: EEPROM must be unlocked first */
+static int8_t eeprom_program_halfword(uint32_t addr, uint16_t ee_data);
+/* Function to write four bytes to the EEPROM */
+/* IMPORTANT: EEPROM must be unlocked first */
+static int8_t eeprom_program_word(uint32_t addr, uint32_t ee_data);
+
+int8_t config_read(config_t *config)
+{
+ config->modbus_addr = *(uint16_t *) (CONFIG_EEPROM_ADDR_MODBUS_ADDR);
+ config->baudrate_index = *(uint16_t *) (CONFIG_EEPROM_ADDR_BAUDRATE_INDEX);
+ config->led_on = *(uint16_t *) (CONFIG_EEPROM_ADDR_LED_ON);
+ config->led_brightness = *(uint16_t *) (CONFIG_EEPROM_ADDR_LED_BRIGHTNESS);
+ config->led_smooth = *(uint16_t *) (CONFIG_EEPROM_ADDR_LED_SMOOTH);
+ config->led_co2_alert_limit1 = *(uint16_t *) (CONFIG_EEPROM_ADDR_LED_ALERT1);
+ config->led_co2_alert_limit2 = *(uint16_t *) (CONFIG_EEPROM_ADDR_LED_ALERT2);
+ config->scd4x_t_offset = *(int16_t *) (CONFIG_EEPROM_ADDR_SCD4x_T_OFFSET);
+
+ /* Check if the EEPROM is initialized - do not check:
+ * LED ON
+ * LED SMOOTH
+ * SCD4x T OFFSET
+ * BAUDRATE INDEX
+ * those can be 0 */
+ if ((config->modbus_addr == EEPROM_EMPTY_BYTE) ||
+ (config->led_co2_alert_limit1 == EEPROM_EMPTY_BYTE) ||
+ (config->led_co2_alert_limit2 == EEPROM_EMPTY_BYTE) ||
+ (config->led_brightness == EEPROM_EMPTY_BYTE))
+ {
+ return CONFIG_ERROR;
+ }
+ return CONFIG_OK;
+}
+
+int8_t config_write(config_t *config)
+{
+ /* Unlock the EEPROM */
+ if (eeprom_unlock() != EEPROM_OK)
+ {
+ return EEPROM_UNLOCK_ERROR;
+ }
+ /* Reset the ERASE and DATA bits in the FLASH_PECR register to disable any residual erase */
+ FLASH->PECR = FLASH->PECR & ~(FLASH_PECR_ERASE | FLASH_PECR_DATA);
+
+ /* Write MODBUS ADDRESS */
+ if (eeprom_program_halfword(CONFIG_EEPROM_ADDR_MODBUS_ADDR, config->modbus_addr) != EEPROM_OK)
+ {
+ return EEPROM_WRITE_ERROR;
+ }
+ /* Write BAUDRATE */
+ if (eeprom_program_halfword(CONFIG_EEPROM_ADDR_BAUDRATE_INDEX, config->baudrate_index) != EEPROM_OK)
+ {
+ return EEPROM_WRITE_ERROR;
+ }
+
+ /* Write LED ON */
+ if (eeprom_program_byte(CONFIG_EEPROM_ADDR_LED_ON, config->led_on) != EEPROM_OK)
+ {
+ return EEPROM_WRITE_ERROR;
+ }
+
+ /* Write LED BRIGHTNESS */
+ if (eeprom_program_halfword(CONFIG_EEPROM_ADDR_LED_BRIGHTNESS, config->led_brightness) != EEPROM_OK)
+ {
+ return EEPROM_WRITE_ERROR;
+ }
+
+ /* Write LED SMOOTH */
+ if (eeprom_program_byte(CONFIG_EEPROM_ADDR_LED_SMOOTH, config->led_smooth) != EEPROM_OK)
+ {
+ return EEPROM_WRITE_ERROR;
+ }
+
+ /* Write LED CO2 ALERT LIMIT 1 */
+ if (eeprom_program_halfword(CONFIG_EEPROM_ADDR_LED_ALERT1, config->led_co2_alert_limit1) != EEPROM_OK)
+ {
+ return EEPROM_WRITE_ERROR;
+ }
+
+ /* Write LED CO2 ALERT LIMIT 2 */
+ if (eeprom_program_halfword(CONFIG_EEPROM_ADDR_LED_ALERT2, config->led_co2_alert_limit2) != EEPROM_OK)
+ {
+ return EEPROM_WRITE_ERROR;
+ }
+
+ /* Write LED SCD4x TEMPERATURE OFFSET */
+ if (eeprom_program_halfword(CONFIG_EEPROM_ADDR_SCD4x_T_OFFSET, config->scd4x_t_offset) != EEPROM_OK)
+ {
+ return EEPROM_WRITE_ERROR;
+ }
+
+ /* Lock EEPROM*/
+ if (eeprom_lock() != EEPROM_OK)
+ {
+ return EEPROM_LOCK_ERROR;
+ }
+ return CONFIG_OK;
+}
+
+static int8_t eeprom_lock(void)
+{
+ uint32_t tick_start = SysTick->VAL;
+ while ((FLASH->SR & FLASH_SR_BSY) != 0) /* Wait for FLASH to be free */
+ {
+ /* Timeout test */
+ /* The maximum writing time is 3.94ms (half-word) */
+ uint32_t tick_last = SysTick->VAL;
+ uint32_t tick_diff;
+ if (tick_start <= tick_last)
+ {
+ tick_diff = tick_last - tick_start;
+ } else
+ {
+ tick_diff = (0xFFFFFFFF - tick_last) + tick_start;
+ }
+
+ /* If the time difference is more than 5ms */
+ if (tick_diff >= (uint32_t)((uint32_t)SYSTICK_FREQ_HZ*(uint32_t)EEPROM_TIMEOUT_MAX_MS_INV))
+ {
+ return EEPROM_LOCK_ERROR;
+ }
+ }
+
+ FLASH->PECR = FLASH->PECR & ~(FLASH_PECR_ERRIE | FLASH_PECR_EOPIE); /* disable flash interrupts */
+ FLASH->PECR = FLASH->PECR | FLASH_PECR_PELOCK; /* Lock memory with PELOCK */
+
+ return EEPROM_OK;
+}
+
+static int8_t eeprom_unlock(void)
+{
+ uint32_t tick_start = SysTick->VAL;
+ while ((FLASH->SR & FLASH_SR_BSY) != 0) /* Wait for FLASH to be free */
+ {
+ /* Timeout test */
+ /* The maximum writing time is 3.94ms (half-word) */
+ uint32_t tick_last = SysTick->VAL;
+ uint32_t tick_diff;
+ if (tick_start <= tick_last)
+ {
+ tick_diff = tick_last - tick_start;
+ } else
+ {
+ tick_diff = (0xFFFFFFFF - tick_last) + tick_start;
+ }
+
+ /* If the time difference is more than 5ms */
+ if (tick_diff >= (uint32_t)((uint32_t)SYSTICK_FREQ_HZ*(uint32_t)EEPROM_TIMEOUT_MAX_MS_INV))
+ {
+ return EEPROM_UNLOCK_ERROR;
+ }
+ }
+ if ((FLASH->PECR & FLASH_PECR_PELOCK) != 0) /* If PELOCK is locked */
+ {
+ /* Unlock PELOCK */
+ FLASH->PEKEYR = FLASH_PEKEY1; /* PEKEY1 */
+ FLASH->PEKEYR = FLASH_PEKEY2; /* PEKEY2 */
+ }
+ FLASH->PECR = FLASH->PECR | (FLASH_PECR_ERRIE | FLASH_PECR_EOPIE); /* enable flash interrupts */
+ return EEPROM_OK;
+}
+
+static int8_t eeprom_program_byte(uint32_t addr, uint8_t ee_data)
+{
+ if ((EEPROM_ADDR_START <= addr) && (addr <= EEPROM_ADDR_END - 1))
+ {
+ *(uint8_t *)(addr) = ee_data; /* write data to EEPROM */
+ if (*(uint8_t *)(addr) != ee_data)
+ {
+ return EEPROM_WRITE_ERROR;
+ }
+ return EEPROM_OK;
+ } else
+ {
+ return EEPROM_ADDR_ERROR;
+ }
+}
+static int8_t eeprom_program_halfword(uint32_t addr, uint16_t ee_data)
+{
+ if ((EEPROM_ADDR_START <= addr) && (addr <= EEPROM_ADDR_END - 2))
+ {
+ *(uint16_t *)(addr) = ee_data; /* write data to EEPROM */
+ if (*(uint16_t *)(addr) != ee_data)
+ {
+ return EEPROM_WRITE_ERROR;
+ }
+ return EEPROM_OK;
+ } else
+ {
+ return EEPROM_ADDR_ERROR;
+ }
+}
+
+static int8_t eeprom_program_word(uint32_t addr, uint32_t ee_data)
+{
+ if ((EEPROM_ADDR_START <= addr) && (addr <= EEPROM_ADDR_END - 4))
+ {
+ *(uint32_t *)(addr) = ee_data; /* write data to EEPROM */
+ if (*(uint32_t *)(addr) != ee_data)
+ {
+ return EEPROM_WRITE_ERROR;
+ }
+ return EEPROM_OK;
+ } else
+ {
+ return EEPROM_ADDR_ERROR;
+ }
+}
diff --git a/fw_old/Core/Src/crc8.c b/fw_old/Core/Src/crc8.c
new file mode 100644
index 0000000..312cdf4
--- /dev/null
+++ b/fw_old/Core/Src/crc8.c
@@ -0,0 +1,28 @@
+/*
+ * crc.c
+ *
+ * Created on: Jun 9, 2021
+ * Author: user
+ */
+
+#include "crc8.h"
+
+/* Stolen from Sensirion SCD4x datasheet, section 3.11 */
+uint8_t crc8_calculate(const uint8_t *data, uint16_t count)
+{
+ uint16_t current_byte;
+ uint8_t crc = CRC8_INIT;
+ uint8_t crc_bit;
+ /* calculates 8-Bit checksum with given polynomial */
+ for (current_byte = 0; current_byte < count; ++current_byte) {
+ crc ^= (data[current_byte]);
+ for(crc_bit = 8; crc_bit > 0; --crc_bit) {
+ if (crc & 0x80) {
+ crc =(crc << 1) ^ CRC8_POLYNOMIAL;
+ } else {
+ crc = (crc << 1);
+ }
+ }
+ }
+ return crc;
+}
diff --git a/fw_old/Core/Src/i2c.c b/fw_old/Core/Src/i2c.c
new file mode 100644
index 0000000..07aeaaf
--- /dev/null
+++ b/fw_old/Core/Src/i2c.c
@@ -0,0 +1,78 @@
+/*
+ * i2c.c
+ *
+ * Created on: Jun 8, 2021
+ * Author: user
+ */
+
+#include "i2c.h"
+#include "stm32l0xx_ll_lpuart.h"
+
+i2c_context_t *i2c_context;
+
+int i2c_init(i2c_context_t *context)
+{
+ if (context == NULL) {
+ return I2C_ERROR;
+ }
+ i2c_context = context;
+ return I2C_OK;
+}
+
+int i2c_transmit(uint8_t address, uint8_t *buffer, int len)
+{
+ /* prevent interrupts during I2C communication (e.g. collision with MODBUS) */
+// LL_LPUART_Disable(LPUART1);
+// LL_LPUART_DisableIT_RXNE(LPUART1);
+// __disable_irq();
+ LL_I2C_HandleTransfer(i2c_context->i2c, address, LL_I2C_ADDRSLAVE_7BIT, len,
+ LL_I2C_MODE_AUTOEND, LL_I2C_GENERATE_START_WRITE);
+ int i = 0;
+ // Autoend mode will raise STOP flag if NACK is detected
+ // (or if desired number of bytes is transmitted)
+ while (!LL_I2C_IsActiveFlag_STOP(i2c_context->i2c)) {
+ if (LL_I2C_IsActiveFlag_TXE(i2c_context->i2c)) {
+ if (i < len) {
+ LL_I2C_TransmitData8(i2c_context->i2c, buffer[i++]);
+ }
+ }
+ }
+ LL_I2C_ClearFlag_STOP(i2c_context->i2c);
+ if (LL_I2C_IsActiveFlag_NACK(i2c_context->i2c)) {
+ return I2C_ERROR_NACK;
+ }
+ if (len != i) {
+ // this will probably never happen, as NACK flag
+ // is raised everytime len != number of TXed bytes
+ return I2C_ERROR_TX_INCOMPLETE;
+ }
+// __enable_irq();
+// LL_LPUART_Enable(LPUART1);
+// LL_LPUART_EnableIT_RXNE(LPUART1);
+ return I2C_OK;
+}
+
+int i2c_receive(uint8_t address, uint8_t *buffer, int len)
+{
+// __disable_irq();
+// LL_LPUART_Disable(LPUART1);
+// LL_LPUART_DisableIT_RXNE(LPUART1);
+ LL_I2C_HandleTransfer(i2c_context->i2c, address, LL_I2C_ADDRSLAVE_7BIT, len,
+ LL_I2C_MODE_AUTOEND, LL_I2C_GENERATE_START_READ);
+ int i = 0;
+ while (!LL_I2C_IsActiveFlag_STOP(i2c_context->i2c)) {
+ if (LL_I2C_IsActiveFlag_RXNE(i2c_context->i2c)) {
+ if (i < len) {
+ buffer[i++] = LL_I2C_ReceiveData8(i2c_context->i2c);
+ }
+ }
+ }
+ LL_I2C_ClearFlag_STOP(i2c_context->i2c);
+ if (len != i) {
+ return I2C_ERROR_RX_INCOMPLETE;
+ }
+// __enable_irq();
+// LL_LPUART_Enable(LPUART1);
+// LL_LPUART_EnableIT_RXNE(LPUART1);
+ return I2C_OK; // TODO error detection
+}
diff --git a/fw_old/Core/Src/main.c b/fw_old/Core/Src/main.c
new file mode 100644
index 0000000..23f6270
--- /dev/null
+++ b/fw_old/Core/Src/main.c
@@ -0,0 +1,827 @@
+/* USER CODE BEGIN Header */
+/**
+ ******************************************************************************
+ * @file : main.c
+ * @brief : Main program body
+ ******************************************************************************
+ * @attention
+ *
+ * © Copyright (c) 2021 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software component is licensed by ST under BSD 3-Clause license,
+ * the "License"; You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ * opensource.org/licenses/BSD-3-Clause
+ *
+ ******************************************************************************
+ */
+/* USER CODE END Header */
+/* Includes ------------------------------------------------------------------*/
+#include "main.h"
+
+/* Private includes ----------------------------------------------------------*/
+/* USER CODE BEGIN Includes */
+
+/* USER CODE END Includes */
+
+/* Private typedef -----------------------------------------------------------*/
+/* USER CODE BEGIN PTD */
+
+/* USER CODE END PTD */
+
+/* Private define ------------------------------------------------------------*/
+/* USER CODE BEGIN PD */
+/* USER CODE END PD */
+
+/* Private macro -------------------------------------------------------------*/
+/* USER CODE BEGIN PM */
+
+/* USER CODE END PM */
+
+/* Private variables ---------------------------------------------------------*/
+
+/* USER CODE BEGIN PV */
+/*
+ * BASE CLOCK 12MHz
+ * Desired interrupt period 60s
+ */
+const uint16_t tim21_prescaler = 60000-1; // 100Hz
+//const uint16_t tim21_period = 12000-1; // 60s
+const uint16_t tim21_period = 1200-1; // 6s
+//const uint16_t tim21_period = 200-1; // 1s
+
+/* Input register memory map
+ * (All registers are 16-bit)
+ * -------------------------
+ *
+ * 30010 : CO2 [ppm] Unsigned value in range [0,40000]
+ * 30011 : T [deg_C * 10] From SHT4x; unsigned value in range [0; 1250]; e.g. 21.5 C => 215
+ * 30012 : RH [%] From SHT4x; unsigned value in range [0; 100]
+ *
+ * Backup T and RH sensor:
+ * 30013 : T [deg_C * 10] From SCD4x; unsigned value in range [0; 600]; e.g. 21.5 C => 215
+ * 30014 : RH [%] From SCD4x; unsigned value in range [0; 100]
+ *
+ * Extended temperature range (signed values):
+ * 30015 : T [deg_C * 10] From SHT4x; signed value (two's complement) in range [-400;1250]
+ * 30016 : T [deg_C * 10] From SCD4x; signed value (two's complement) in range [-100;600]; e.g. -12.3 C => -123
+ *
+ */
+/* Input registers memory map implementation */
+enum
+{
+ REGISTER_NUM_CO2 = 30010,
+ REGISTER_NUM_T_SHT4x = 30011,
+ REGISTER_NUM_RH_SHT4x = 30012,
+ REGISTER_NUM_T_SCD4x = 30013,
+ REGISTER_NUM_RH_SCD4x = 30014,
+ REGISTER_NUM_T_SHT4x_SIGNED = 30015,
+ REGISTER_NUM_T_SCD4x_SIGNED = 30016
+} data_registers_numbers;
+
+enum
+{
+ REGISTER_NUM_LED_ON = 40001,
+ REGISTER_NUM_LED_BRIGHTNESS = 40002,
+ REGISTER_NUM_LED_SMOOTH = 40003,
+ REGISTER_NUM_CO2_ALERT_LIMIT1 = 40004,
+ REGISTER_NUM_CO2_ALERT_LIMIT2 = 40005,
+ REGISTER_NUM_SCD4x_T_OFFSET = 40006,
+ REGISTER_NUM_MODBUS_ADDR = 40007,
+ REGISTER_NUM_BAUDRATE = 40008
+} config_registers_numbers;
+
+enum
+{
+ REGISTER_NUM_VENDOR_NAME = 30010,
+ REGISTER_NUM_PRODUCT_CODE = 30011,
+ REGISTER_NUM_REVISION = 30012,
+ REGISTER_NUM_PRODUCT_NAME = 30013,
+ REGISTER_NUM_SERIAL_NUMBER = 30014
+} identification_registers_numbers;
+
+/* Variables to store the measured data */
+int CO2, T_SCD4x, RH_SCD4x;
+int T_SHT4x, RH_SHT4x;
+uint16_t sps30_measured_data[10];
+
+/* Struct to store the sensor config */
+config_t sensor_config;
+uint8_t sensor_config_pending_write = 0;
+uint8_t baudrate_changed = 0;
+uint8_t modbus_address_changed = 0;
+uint8_t co2_valid = 0;
+/* USER CODE END PV */
+
+/* Private function prototypes -----------------------------------------------*/
+void SystemClock_Config(void);
+static void MX_GPIO_Init(void);
+static void MX_I2C1_Init(void);
+static void MX_LPUART1_UART_Init(void);
+static void MX_TIM21_Init(void);
+/* USER CODE BEGIN PFP */
+void LPUART1_TX_Buffer(uint8_t* buffer_tx, uint16_t buffer_tx_len);
+/* USER CODE END PFP */
+
+/* Private user code ---------------------------------------------------------*/
+/* USER CODE BEGIN 0 */
+
+/* USER CODE END 0 */
+
+/**
+ * @brief The application entry point.
+ * @retval int
+ */
+int main(void)
+{
+ /* USER CODE BEGIN 1 */
+
+ /* USER CODE END 1 */
+
+ /* MCU Configuration--------------------------------------------------------*/
+
+ /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
+
+ LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_SYSCFG);
+ LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_PWR);
+
+ /* System interrupt init*/
+
+ /* USER CODE BEGIN Init */
+
+ /* USER CODE END Init */
+
+ /* Configure the system clock */
+ SystemClock_Config();
+
+ /* USER CODE BEGIN SysInit */
+ /* Read config from EEPROM - if unsuccessful, set the default values*/
+ int8_t config_read_status = config_read(&sensor_config);
+ if (config_read_status != CONFIG_OK)
+ {
+ sensor_config.modbus_addr = MODBUS_DEFAULT_SLAVE_ADDRESS;
+ sensor_config.led_co2_alert_limit1 = CONFIG_DEFAULT_LED_ALERT1_LIMIT;
+ sensor_config.led_co2_alert_limit2 = CONFIG_DEFAULT_LED_ALERT2_LIMIT;
+ sensor_config.led_on = CONFIG_DEFAULT_LED_ON;
+ sensor_config.led_brightness = CONFIG_DEFAULT_LED_BRIGHTNESS;
+ sensor_config.led_smooth = CONFIG_DEFAULT_LED_SMOOTH;
+ sensor_config.scd4x_t_offset = CONFIG_DEFAULT_SCD4x_T_OFFSET;
+ sensor_config.baudrate_index = CONFIG_DEFAULT_BAUDRATE_INDEX;
+ }
+ /* USER CODE END SysInit */
+
+ /* Initialize all configured peripherals */
+ MX_GPIO_Init();
+ MX_I2C1_Init();
+ MX_LPUART1_UART_Init();
+ MX_TIM21_Init();
+ /* USER CODE BEGIN 2 */
+
+ /* Turn on MAGENTA LED to signal startup state */
+ LL_GPIO_ResetOutputPin(LED_R_GPIO_Port, LED_R_Pin);
+ LL_GPIO_ResetOutputPin(LED_G_GPIO_Port, LED_G_Pin);
+ LL_GPIO_ResetOutputPin(LED_B_GPIO_Port, LED_B_Pin);
+
+ /* Enable I2C for sensors */
+ LL_I2C_Enable(I2C1);
+
+
+ /* Set the modbus address */
+ modbus_slave_set_address(sensor_config.modbus_addr);
+
+ /* Enable UART for RS485 */
+ LL_LPUART_Enable(LPUART1);
+
+ /* Start the timer for measurement triggering */
+ LL_TIM_EnableCounter(TIM21);
+ LL_TIM_EnableIT_UPDATE(TIM21);
+
+ /* I2C context init (for SHT4x and SCD4x) */
+ i2c_context_t i2c_context;
+ i2c_context.i2c = I2C1;
+ i2c_init(&i2c_context);
+
+ scd4x_start_periodic_measurement();
+ uint8_t scd4x_is_connected = 1;
+ uint8_t sps30_is_connected = 0;
+ /* USER CODE END 2 */
+
+ /* Infinite loop */
+ /* USER CODE BEGIN WHILE */
+ /*uint8_t scd4x_is_connected = 0;
+ if (scd4x_start_periodic_measurement() == SCD4X_OK)
+ {
+ scd4x_is_connected = 1;
+ }*/
+
+ /* Attempt to start SPS30 measurement and check if it's connected */
+ /*sps30_reset();
+ uint8_t sps30_is_connected = 0;
+ if (sps30_start_measurement() == SPS30_OK)
+ {
+ sps30_is_connected = 1;
+ }*/
+
+ /* Wait 1000ms for sensors initialization */
+ /* SHT4x Init Time: max 1 ms (datasheet pg. 8) */
+ /* SCD4x Init Time: max 1000 ms (datasheet pg. 6) */
+ /* SPS30 Init Time: max 30000 ms (datasheet pg. 2) */
+ LL_mDelay(1000);
+
+ static uint32_t new_baud;
+
+ /* Enter the main loop */
+ while (1)
+ {
+ if (lpuart1_rx_done == 1)
+ {
+ /* Process the message */
+ if (lpuart1_rx_message_too_long)
+ {
+ /* Do nothing, just delete the buffer and set the flag back to zero*/
+ lpuart1_rx_message_too_long = 0;
+ } else
+ {
+ /* Process the message:
+ * message is stored in modbus_buffer[], no copying necessary;
+ * but we need to make sure that modbus_buffer[] will not be used while
+ * processing the message: this can be done by disabling RX interrupt */
+ LL_LPUART_DisableIT_RXNE(LPUART1);
+ modbus_slave_process_msg(modbus_buffer, lpuart1_rx_message_len);
+ /* Reset the RX DONE flag */
+ lpuart1_rx_done = 0;
+ LL_LPUART_EnableIT_RXNE(LPUART1);
+ }
+ /* Reset the RX DONE flag */
+ lpuart1_rx_done = 0;
+ }
+ /* if config changed (MODBUS write), reflect changes to EEPROM */
+ if (sensor_config_pending_write) {
+ config_write(&sensor_config);
+ sensor_config_pending_write = 0;
+ }
+ if (modbus_address_changed)
+ {
+ modbus_slave_set_address(sensor_config.modbus_addr);
+ modbus_address_changed = 0;
+ }
+ if (baudrate_changed)
+ {
+ while (!LL_LPUART_IsActiveFlag_TXE(LPUART1));
+ uart_disable_interrupts();
+// LL_LPUART_Disable(LPUART1);
+// LL_LPUART_DisableIT_IDLE(LPUART1);
+// LL_LPUART_EnableIT_RXNE(LPUART1);
+
+ LL_LPUART_SetBaudRate(LPUART1, SYSTICK_FREQ_HZ, config_baudrates[sensor_config.baudrate_index]);
+
+// LL_LPUART_Enable(LPUART1);
+// LL_LPUART_EnableIT_IDLE(LPUART1);
+// LL_LPUART_EnableIT_RXNE(LPUART1);
+ uart_enable_interrupts();
+ LL_LPUART_EnableDirectionRx(LPUART1);
+ LL_LPUART_EnableDirectionTx(LPUART1);
+ baudrate_changed = 0;
+
+ new_baud = LL_LPUART_GetBaudRate(LPUART1, SYSTICK_FREQ_HZ);
+ }
+
+ /* It is time for measurement */
+ if (tim21_elapsed_period == 1)
+ {
+ /* TODO: Check the data */
+ /* Read SHT4x data (always connected) */
+ sht4x_measure(&T_SHT4x, &RH_SHT4x);
+
+ /* Read SCD4x data (if connected) */
+ if (scd4x_is_connected == 1)
+ {
+ scd4x_read_measurement(&CO2,
+ &T_SCD4x,
+ &RH_SCD4x);
+ if (CO2 > 0) {
+ co2_valid = 1;
+ } else {
+ co2_valid = 0;
+ }
+ }
+
+ /* Read SPS30 data (if connected) */
+ if (sps30_is_connected == 1)
+ {
+ sps30_read_measured_values(sps30_measured_data, 10);
+ }
+ /* TODO: Process data and light a desired color of LED */
+ /* TODO: Add hystheresis */
+
+ /* Reset the TIM21 Elapsed Period Flag */
+ tim21_elapsed_period = 0;
+ }
+ /* TEST END */
+ if (sensor_config.led_on) {
+ if (co2_valid == 1) {
+ if (CO2 <= sensor_config.led_co2_alert_limit1) {
+ /* CO2 is OK -> GREEN */
+ LL_GPIO_SetOutputPin(LED_R_GPIO_Port, LED_R_Pin);
+ LL_GPIO_ResetOutputPin(LED_G_GPIO_Port, LED_G_Pin);
+ LL_GPIO_SetOutputPin(LED_B_GPIO_Port, LED_B_Pin);
+
+ } else if ((sensor_config.led_co2_alert_limit1 < CO2) && (CO2 <= sensor_config.led_co2_alert_limit2)) {
+ /* CO2 is NOT OK -> YELLOW */
+ LL_GPIO_ResetOutputPin(LED_R_GPIO_Port, LED_R_Pin);
+ LL_GPIO_ResetOutputPin(LED_G_GPIO_Port, LED_G_Pin);
+ LL_GPIO_SetOutputPin(LED_B_GPIO_Port, LED_B_Pin);
+
+ } else if (sensor_config.led_co2_alert_limit2 < CO2) {
+ /* CO2 is CRITICAL -> RED */
+ LL_GPIO_ResetOutputPin(LED_R_GPIO_Port, LED_R_Pin);
+ LL_GPIO_SetOutputPin(LED_G_GPIO_Port, LED_G_Pin);
+ LL_GPIO_SetOutputPin(LED_B_GPIO_Port, LED_B_Pin);
+ }
+ } else {
+
+ LL_GPIO_ResetOutputPin(LED_R_GPIO_Port, LED_R_Pin);
+ LL_GPIO_SetOutputPin(LED_G_GPIO_Port, LED_G_Pin);
+ LL_GPIO_ResetOutputPin(LED_B_GPIO_Port, LED_B_Pin);
+ }
+
+ } else {
+ LL_GPIO_SetOutputPin(LED_R_GPIO_Port, LED_R_Pin);
+ LL_GPIO_SetOutputPin(LED_G_GPIO_Port, LED_G_Pin);
+ LL_GPIO_SetOutputPin(LED_B_GPIO_Port, LED_B_Pin);
+ }
+ /* USER CODE END WHILE */
+
+ /* USER CODE BEGIN 3 */
+ }
+ /* USER CODE END 3 */
+}
+
+/**
+ * @brief System Clock Configuration
+ * @retval None
+ */
+void SystemClock_Config(void)
+{
+ LL_FLASH_SetLatency(LL_FLASH_LATENCY_0);
+ while(LL_FLASH_GetLatency()!= LL_FLASH_LATENCY_0)
+ {
+ }
+ LL_PWR_SetRegulVoltageScaling(LL_PWR_REGU_VOLTAGE_SCALE1);
+ LL_RCC_HSI_Enable();
+
+ /* Wait till HSI is ready */
+ while(LL_RCC_HSI_IsReady() != 1)
+ {
+
+ }
+ LL_RCC_HSI_SetCalibTrimming(16);
+ LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSI, LL_RCC_PLL_MUL_3, LL_RCC_PLL_DIV_4);
+ LL_RCC_PLL_Enable();
+
+ /* Wait till PLL is ready */
+ while(LL_RCC_PLL_IsReady() != 1)
+ {
+
+ }
+ LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1);
+ LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_1);
+ LL_RCC_SetAPB2Prescaler(LL_RCC_APB2_DIV_1);
+ LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL);
+
+ /* Wait till System clock is ready */
+ while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL)
+ {
+
+ }
+
+ LL_Init1msTick(12000000);
+
+ LL_SetSystemCoreClock(12000000);
+ LL_RCC_SetLPUARTClockSource(LL_RCC_LPUART1_CLKSOURCE_PCLK1);
+ LL_RCC_SetI2CClockSource(LL_RCC_I2C1_CLKSOURCE_PCLK1);
+}
+
+/**
+ * @brief I2C1 Initialization Function
+ * @param None
+ * @retval None
+ */
+static void MX_I2C1_Init(void)
+{
+
+ /* USER CODE BEGIN I2C1_Init 0 */
+
+ /* USER CODE END I2C1_Init 0 */
+
+ LL_I2C_InitTypeDef I2C_InitStruct = {0};
+
+ LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
+
+ LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOA);
+ /**I2C1 GPIO Configuration
+ PA9 ------> I2C1_SCL
+ PA10 ------> I2C1_SDA
+ */
+ GPIO_InitStruct.Pin = LL_GPIO_PIN_9;
+ GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
+ GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_VERY_HIGH;
+ GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_OPENDRAIN;
+ GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
+ GPIO_InitStruct.Alternate = LL_GPIO_AF_1;
+ LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+
+ GPIO_InitStruct.Pin = LL_GPIO_PIN_10;
+ GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
+ GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_VERY_HIGH;
+ GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_OPENDRAIN;
+ GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
+ GPIO_InitStruct.Alternate = LL_GPIO_AF_1;
+ LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+
+ /* Peripheral clock enable */
+ LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_I2C1);
+
+ /* USER CODE BEGIN I2C1_Init 1 */
+
+ /* USER CODE END I2C1_Init 1 */
+ /** I2C Initialization
+ */
+ LL_I2C_EnableAutoEndMode(I2C1);
+ LL_I2C_DisableOwnAddress2(I2C1);
+ LL_I2C_DisableGeneralCall(I2C1);
+ LL_I2C_EnableClockStretching(I2C1);
+ I2C_InitStruct.PeripheralMode = LL_I2C_MODE_I2C;
+ I2C_InitStruct.Timing = 0x40000A0B;
+ I2C_InitStruct.AnalogFilter = LL_I2C_ANALOGFILTER_ENABLE;
+ I2C_InitStruct.DigitalFilter = 0;
+ I2C_InitStruct.OwnAddress1 = 0;
+ I2C_InitStruct.TypeAcknowledge = LL_I2C_ACK;
+ I2C_InitStruct.OwnAddrSize = LL_I2C_OWNADDRESS1_7BIT;
+ LL_I2C_Init(I2C1, &I2C_InitStruct);
+ LL_I2C_SetOwnAddress2(I2C1, 0, LL_I2C_OWNADDRESS2_NOMASK);
+ /* USER CODE BEGIN I2C1_Init 2 */
+ /* USER CODE END I2C1_Init 2 */
+
+}
+
+/**
+ * @brief LPUART1 Initialization Function
+ * @param None
+ * @retval None
+ */
+static void MX_LPUART1_UART_Init(void)
+{
+
+ /* USER CODE BEGIN LPUART1_Init 0 */
+
+ /* USER CODE END LPUART1_Init 0 */
+
+ LL_LPUART_InitTypeDef LPUART_InitStruct = {0};
+
+ LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
+
+ /* Peripheral clock enable */
+ LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_LPUART1);
+
+ LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOA);
+ LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOB);
+ /**LPUART1 GPIO Configuration
+ PA0-CK_IN ------> LPUART1_RX
+ PA1 ------> LPUART1_TX
+ PB1 ------> LPUART1_DE
+ */
+ GPIO_InitStruct.Pin = LL_GPIO_PIN_0;
+ GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
+ GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_VERY_HIGH;
+ GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
+ GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
+ GPIO_InitStruct.Alternate = LL_GPIO_AF_6;
+ LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+
+ GPIO_InitStruct.Pin = LL_GPIO_PIN_1;
+ GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
+ GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_VERY_HIGH;
+ GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
+ GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
+ GPIO_InitStruct.Alternate = LL_GPIO_AF_6;
+ LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
+
+ GPIO_InitStruct.Pin = LL_GPIO_PIN_1;
+ GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
+ GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_VERY_HIGH;
+ GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
+ GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
+ GPIO_InitStruct.Alternate = LL_GPIO_AF_4;
+ LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
+
+ /* LPUART1 interrupt Init */
+ NVIC_SetPriority(LPUART1_IRQn, 0);
+ NVIC_EnableIRQ(LPUART1_IRQn);
+
+ /* USER CODE BEGIN LPUART1_Init 1 */
+
+ /* USER CODE END LPUART1_Init 1 */
+ LPUART_InitStruct.BaudRate = config_baudrates[sensor_config.baudrate_index];
+ LPUART_InitStruct.DataWidth = LL_LPUART_DATAWIDTH_9B;
+ LPUART_InitStruct.StopBits = LL_LPUART_STOPBITS_1;
+ LPUART_InitStruct.Parity = LL_LPUART_PARITY_EVEN;
+ LPUART_InitStruct.TransferDirection = LL_LPUART_DIRECTION_TX_RX;
+ LPUART_InitStruct.HardwareFlowControl = LL_LPUART_HWCONTROL_NONE;
+ LL_LPUART_Init(LPUART1, &LPUART_InitStruct);
+ LL_LPUART_EnableDEMode(LPUART1);
+ LL_LPUART_SetDESignalPolarity(LPUART1, LL_LPUART_DE_POLARITY_HIGH);
+ LL_LPUART_SetDEAssertionTime(LPUART1, 0);
+ LL_LPUART_SetDEDeassertionTime(LPUART1, 0);
+ /* USER CODE BEGIN LPUART1_Init 2 */
+
+ /* Enable IDLE Interrupt */
+ LL_LPUART_EnableIT_IDLE(LPUART1);
+
+ /* Enable RX Not Empty Interrupt */
+ LL_LPUART_EnableIT_RXNE(LPUART1);
+
+ LL_LPUART_EnableDirectionRx(LPUART1);
+ LL_LPUART_EnableDirectionTx(LPUART1);
+ LL_LPUART_Enable(LPUART1);
+ /* USER CODE END LPUART1_Init 2 */
+
+}
+
+/**
+ * @brief TIM21 Initialization Function
+ * @param None
+ * @retval None
+ */
+static void MX_TIM21_Init(void)
+{
+
+ /* USER CODE BEGIN TIM21_Init 0 */
+
+ /* USER CODE END TIM21_Init 0 */
+
+ LL_TIM_InitTypeDef TIM_InitStruct = {0};
+
+ /* Peripheral clock enable */
+ LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_TIM21);
+
+ /* TIM21 interrupt Init */
+ NVIC_SetPriority(TIM21_IRQn, 0);
+ NVIC_EnableIRQ(TIM21_IRQn);
+
+ /* USER CODE BEGIN TIM21_Init 1 */
+
+ /* USER CODE END TIM21_Init 1 */
+ TIM_InitStruct.Prescaler = tim21_prescaler;
+ TIM_InitStruct.CounterMode = LL_TIM_COUNTERMODE_UP;
+ TIM_InitStruct.Autoreload = tim21_period;
+ TIM_InitStruct.ClockDivision = LL_TIM_CLOCKDIVISION_DIV1;
+ LL_TIM_Init(TIM21, &TIM_InitStruct);
+ LL_TIM_EnableARRPreload(TIM21);
+ LL_TIM_SetClockSource(TIM21, LL_TIM_CLOCKSOURCE_INTERNAL);
+ LL_TIM_SetTriggerOutput(TIM21, LL_TIM_TRGO_RESET);
+ LL_TIM_DisableMasterSlaveMode(TIM21);
+ /* USER CODE BEGIN TIM21_Init 2 */
+
+ /* USER CODE END TIM21_Init 2 */
+
+}
+
+/**
+ * @brief GPIO Initialization Function
+ * @param None
+ * @retval None
+ */
+static void MX_GPIO_Init(void)
+{
+ LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
+
+ /* GPIO Ports Clock Enable */
+ LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOA);
+
+ /**/
+ LL_GPIO_SetOutputPin(LED_B_GPIO_Port, LED_B_Pin);
+
+ /**/
+ LL_GPIO_SetOutputPin(LED_G_GPIO_Port, LED_G_Pin);
+
+ /**/
+ LL_GPIO_SetOutputPin(LED_R_GPIO_Port, LED_R_Pin);
+
+ /**/
+ GPIO_InitStruct.Pin = LED_B_Pin;
+ GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
+ GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
+ GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
+ GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
+ LL_GPIO_Init(LED_B_GPIO_Port, &GPIO_InitStruct);
+
+ /**/
+ GPIO_InitStruct.Pin = LED_G_Pin;
+ GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
+ GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
+ GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
+ GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
+ LL_GPIO_Init(LED_G_GPIO_Port, &GPIO_InitStruct);
+
+ /**/
+ GPIO_InitStruct.Pin = LED_R_Pin;
+ GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
+ GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
+ GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
+ GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
+ LL_GPIO_Init(LED_R_GPIO_Port, &GPIO_InitStruct);
+
+}
+
+/* USER CODE BEGIN 4 */
+void LPUART1_TX_Buffer(uint8_t* buffer_tx, uint16_t buffer_tx_len)
+{
+ __disable_irq();
+ for (uint16_t i = 0; i < buffer_tx_len; i++)
+ {
+ LL_LPUART_TransmitData9(LPUART1, buffer_tx[i]);
+ while (!LL_LPUART_IsActiveFlag_TXE(LPUART1));
+ }
+ __enable_irq();
+}
+
+int8_t uart_disable_interrupts(void)
+{
+ LL_LPUART_Disable(LPUART1);
+ LL_LPUART_DisableIT_IDLE(LPUART1);
+ LL_LPUART_EnableIT_RXNE(LPUART1);
+
+ return 0;
+}
+
+int8_t uart_enable_interrupts(void)
+{
+ LL_LPUART_Enable(LPUART1);
+ LL_LPUART_EnableIT_IDLE(LPUART1);
+ LL_LPUART_EnableIT_RXNE(LPUART1);
+
+ return 0;
+}
+
+int8_t modbus_slave_callback(modbus_transaction_t *transaction)
+{
+ uint16_t register_number = transaction->register_number;
+ switch (transaction->function_code)
+ {
+ case MODBUS_READ_INPUT_REGISTERS:
+ for (int i = 0; i < transaction->register_count; i++, register_number++)
+ {
+ switch (register_number)
+ {
+ case REGISTER_NUM_CO2:
+ transaction->input_registers[i] = (uint16_t)CO2;
+ break;
+ case REGISTER_NUM_T_SHT4x:
+ transaction->input_registers[i] = (uint16_t)T_SHT4x;
+ break;
+ case REGISTER_NUM_RH_SHT4x:
+ transaction->input_registers[i] = (uint16_t)RH_SHT4x;
+ break;
+ case REGISTER_NUM_T_SCD4x:
+ transaction->input_registers[i] = (uint16_t)T_SCD4x;
+ break;
+ case REGISTER_NUM_RH_SCD4x:
+ transaction->input_registers[i] = (uint16_t)RH_SCD4x;
+ break;
+ case REGISTER_NUM_T_SHT4x_SIGNED:
+ transaction->input_registers_signed[i] = (int16_t)T_SHT4x;
+ break;
+ case REGISTER_NUM_T_SCD4x_SIGNED:
+ transaction->input_registers_signed[i] = (int16_t)T_SCD4x;
+ break;
+ default:
+ return MODBUS_ERROR_FUNCTION_NOT_IMPLEMENTED;
+ }
+ }
+ return MODBUS_OK;
+ case MODBUS_READ_HOLDING_REGISTERS:
+ for (int i = 0; i < transaction->register_count; i++, register_number++)
+ {
+ switch (register_number)
+ {
+ case REGISTER_NUM_LED_ON:
+ transaction->holding_registers[i] = (uint16_t)(sensor_config.led_on);
+ break;
+ case REGISTER_NUM_LED_BRIGHTNESS:
+ transaction->holding_registers[i] = (uint16_t)(sensor_config.led_brightness);
+ break;
+ case REGISTER_NUM_LED_SMOOTH:
+ transaction->holding_registers[i] = (uint16_t)(sensor_config.led_smooth);
+ break;
+ case REGISTER_NUM_CO2_ALERT_LIMIT1:
+ transaction->holding_registers[i] = (uint16_t)(sensor_config.led_co2_alert_limit1);
+ break;
+ case REGISTER_NUM_CO2_ALERT_LIMIT2:
+ transaction->holding_registers[i] = (uint16_t)(sensor_config.led_co2_alert_limit2);
+ break;
+ case REGISTER_NUM_SCD4x_T_OFFSET:
+ transaction->holding_registers[i] = (uint16_t)(sensor_config.scd4x_t_offset);
+ break;
+ case REGISTER_NUM_MODBUS_ADDR:
+ transaction->holding_registers[i] = (uint16_t)(sensor_config.modbus_addr);
+ break;
+ case REGISTER_NUM_BAUDRATE:
+ transaction->holding_registers[i] = (uint16_t)(sensor_config.baudrate_index);
+ break;
+ default:
+ return MODBUS_ERROR_FUNCTION_NOT_IMPLEMENTED;
+ }
+ }
+ return MODBUS_OK;
+ case MODBUS_WRITE_SINGLE_REGISTER:
+ transaction->register_count = 1;
+ case MODBUS_WRITE_MULTIPLE_REGISTERS:
+ for (int i = 0; i < transaction->register_count; i++, register_number++)
+ {
+ switch (register_number)
+ {
+ case REGISTER_NUM_LED_ON:
+ sensor_config.led_on = (uint8_t) transaction->holding_registers[i];
+ break;
+ case REGISTER_NUM_LED_BRIGHTNESS:
+ sensor_config.led_brightness = (uint16_t) transaction->holding_registers[i];
+ break;
+ case REGISTER_NUM_LED_SMOOTH:
+ sensor_config.led_smooth = (uint16_t) transaction->holding_registers[i];
+ break;
+ case REGISTER_NUM_CO2_ALERT_LIMIT1:
+ sensor_config.led_co2_alert_limit1 = (uint16_t) transaction->holding_registers[i];
+ break;
+ case REGISTER_NUM_CO2_ALERT_LIMIT2:
+ sensor_config.led_co2_alert_limit2 = (uint16_t) transaction->holding_registers[i];
+ break;
+ case REGISTER_NUM_SCD4x_T_OFFSET:
+ sensor_config.scd4x_t_offset = (int16_t) transaction->holding_registers[i];
+ break;
+ case REGISTER_NUM_MODBUS_ADDR:
+ sensor_config.modbus_addr = (uint16_t) transaction->holding_registers[i];
+ modbus_address_changed = 1;
+ break;
+ case REGISTER_NUM_BAUDRATE:
+ if (transaction->holding_registers[0] < config_baudrates_length)
+ {
+ sensor_config.baudrate_index = (uint16_t) (transaction->holding_registers[i]);
+ baudrate_changed = 1;
+ }
+ break;
+ default:
+ return MODBUS_ERROR_FUNCTION_NOT_IMPLEMENTED;
+ }
+ }
+ sensor_config_pending_write = 1;
+ return MODBUS_OK;
+ default:
+ return MODBUS_ERROR_FUNCTION_NOT_IMPLEMENTED;
+ }
+ /* Catch-all error */
+ return MODBUS_ERROR_FUNCTION_NOT_IMPLEMENTED; /* nothing implemented yet! TODO */
+}
+
+int8_t modbus_transmit_function(uint8_t *buffer, uint16_t data_len)
+{
+ /* TODO */
+ LPUART1_TX_Buffer(buffer, data_len);
+ return MODBUS_OK;
+}
+/* USER CODE END 4 */
+
+/**
+ * @brief This function is executed in case of error occurrence.
+ * @retval None
+ */
+void Error_Handler(void)
+{
+ /* USER CODE BEGIN Error_Handler_Debug */
+ /* User can add his own implementation to report the HAL error return state */
+ __disable_irq();
+ while (1)
+ {
+ }
+ /* USER CODE END Error_Handler_Debug */
+}
+
+#ifdef USE_FULL_ASSERT
+/**
+ * @brief Reports the name of the source file and the source line number
+ * where the assert_param error has occurred.
+ * @param file: pointer to the source file name
+ * @param line: assert_param error line source number
+ * @retval None
+ */
+void assert_failed(uint8_t *file, uint32_t line)
+{
+ /* USER CODE BEGIN 6 */
+ /* User can add his own implementation to report the file name and line number,
+ ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
+ /* USER CODE END 6 */
+}
+#endif /* USE_FULL_ASSERT */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/fw_old/Core/Src/modbus.c b/fw_old/Core/Src/modbus.c
new file mode 100644
index 0000000..4ec6e09
--- /dev/null
+++ b/fw_old/Core/Src/modbus.c
@@ -0,0 +1,265 @@
+/*
+ * modbus.c
+ *
+ * Created on: Jul 18, 2021
+ * Author: user
+ */
+
+#include "modbus.h"
+
+/*
+ * Global variables
+ */
+
+/* Modbus TX buffer; can be also used for RX in memory constrained systems (e.g. in main.c);
+ * NOTE if shared buffer is used for TX/RX, care must be taken to prevent writing into buffer
+ * during execution of modbus_process_message() */
+uint8_t modbus_buffer[MODBUS_MAX_RTU_FRAME_SIZE];
+
+/* device address: declared */
+uint8_t modbus_slave_address = MODBUS_DEFAULT_SLAVE_ADDRESS;
+
+/*
+ * CRC16 functions
+ * see https://modbus.org/docs/Modbus_over_serial_line_V1_02.pdf
+ * section 6.2.2
+ */
+
+/* CRC16 (without memory mapped values)
+ * taken from https://ctlsys.com/support/how_to_compute_the_modbus_rtu_message_crc/ */
+uint16_t modbus_CRC16(const uint8_t *buf, int len)
+{
+ uint16_t crc = 0xFFFF;
+
+ for (int pos = 0; pos < len; pos++) {
+ crc ^= (uint16_t)buf[pos]; // XOR byte into least sig. byte of crc
+
+ for (int i = 8; i != 0; i--) { // Loop over each bit
+ if ((crc & 0x0001) != 0) { // If the LSB is set
+ crc >>= 1; // Shift right and XOR 0xA001
+ crc ^= 0xA001;
+ } else { // Else LSB is not set
+ crc >>= 1; // Just shift right
+ }
+ }
+ }
+ // Note, this number has low and high bytes swapped, so use it accordingly (or swap bytes)
+ return crc;
+}
+
+/*
+ * Private functions
+ */
+
+/* here we assume buffer has minimal size of MODBUS_MAX_RTU_FRAME_SIZE;
+ * this function is private, so hopefully it's going to be ok */
+int8_t modbus_copy_reply_to_buffer(uint8_t *buffer, uint8_t *msg_len, modbus_transaction_t *transaction)
+{
+ uint16_t crc16;
+ uint8_t byte_count;
+
+ // TODO use relative indices (increments) instead of absolute
+ buffer[0] = modbus_slave_address;
+ buffer[1] = transaction->function_code;
+ *msg_len = 5;
+
+ if (transaction->function_code & MODBUS_ERROR_FLAG) {
+ /* sending error reply */
+ buffer[2] = transaction->exception.exception_code;
+ } else {
+ switch (transaction->function_code) {
+ case MODBUS_READ_HOLDING_REGISTERS:
+ case MODBUS_READ_INPUT_REGISTERS:
+ byte_count = transaction->register_count * 2;
+ buffer[2] = byte_count;
+ *msg_len = byte_count + 5;
+ for (int i = 0; i < transaction->register_count; i++) {
+ // TODO endianness handling
+ /* buffer16b is alias for both holding and input register buffers */
+ buffer[3 + 2*i] = transaction->buffer16b[i] >> 8;
+ buffer[4 + 2*i] = transaction->buffer16b[i] & 0xff;
+ }
+ break;
+ case MODBUS_WRITE_SINGLE_REGISTER:
+ buffer[2] = (uint8_t) (transaction->register_address >> 8);
+ buffer[3] = (uint8_t) transaction->register_address;
+ buffer[4] = (uint8_t) (transaction->holding_registers[0] >> 8);
+ buffer[5] = (uint8_t) transaction->holding_registers[0];
+ *msg_len = 8;
+ break;
+ case MODBUS_WRITE_MULTIPLE_REGISTERS:
+ buffer[2] = (uint8_t) (transaction->register_address >> 8);
+ buffer[3] = (uint8_t) transaction->register_address;
+ buffer[4] = (uint8_t) (transaction->register_count >> 8);
+ buffer[5] = (uint8_t) transaction->register_count;
+ *msg_len = 8;
+ break;
+ }
+ }
+ crc16 = modbus_CRC16(buffer, *msg_len - 2); /* last two bytes is the checksum itself */
+ buffer[*msg_len - 2] = crc16 & 0xff;
+ buffer[*msg_len - 1] = crc16 >> 8;
+}
+
+/*
+ * Public function definitions
+ */
+
+int8_t modbus_slave_set_address(uint8_t address)
+{
+ if (address == 0) {
+ /* address 0 is broadcast address */
+ return MODBUS_ERROR;
+ }
+ modbus_slave_address = address;
+ return MODBUS_OK;
+}
+
+int8_t modbus_slave_process_msg(const uint8_t *buffer, int len)
+{
+ /*
+ * TODO list:
+ *
+ * 1) check that errors and exceptions are handled according to Modbus_Application_Protocol_V1_1b.pdf
+ * 2) buffer overflow prevention: for each function code, check that buffer is long enough
+ */
+ /* transaction holds message context and content:
+ * it wraps all necessary buffers and variables */
+ modbus_transaction_t transaction;
+ int8_t callback_result;
+ uint8_t buffer_pos = 0;
+ uint8_t byte_count;
+
+ if (len < MODBUS_MINIMAL_FRAME_LEN) {
+ /* frame too short; return error */
+ return MODBUS_ERROR_FRAME_INVALID;
+ }
+ /* check CRC first */
+ uint16_t crc_received = (buffer[len - 1] << 8) | buffer[len - 2];
+ uint16_t crc_calculated = modbus_CRC16(buffer, len - 2);
+ if (crc_received != crc_calculated) {
+ /* CRC mismatch, return error */
+ //printf("crc mismatch: received 0x%x, calculated 0x%x\n", crc_received, crc_calculated);
+ return MODBUS_ERROR_CRC;
+ }
+ /* check if address matches ours */
+ uint8_t address = buffer[buffer_pos++];
+ if (address != modbus_slave_address && address != MODBUS_BROADCAST_ADDR) {
+ /* Message is not for us */
+ return MODBUS_OK;
+ }
+ /* get function code */
+ transaction.function_code = buffer[buffer_pos++];
+ transaction.exception.exception_code = 0;
+
+ if (transaction.function_code == MODBUS_READ_DEVICE_IDENTIFICATION) {
+ // TODO
+ goto modbus_send;
+ }
+
+ /* set starting register number */
+ switch (transaction.function_code) {
+ /* coils */
+ case MODBUS_READ_DO:
+ case MODBUS_WRITE_SINGLE_DO:
+ case MODBUS_WRITE_MULTIPLE_DO:
+ transaction.register_number = MODBUS_DO_START_NUMBER;
+ break;
+ /* discrete inputs */
+ case MODBUS_READ_DI:
+ transaction.register_number = MODBUS_DI_START_NUMBER;
+ break;
+ /* input registers */
+ case MODBUS_READ_AI:
+ transaction.register_number = MODBUS_AI_START_NUMBER;
+ break;
+ /* holding registers */
+ case MODBUS_READ_AO:
+ case MODBUS_WRITE_SINGLE_AO:
+ case MODBUS_WRITE_MULTIPLE_AO:
+ case MODBUS_READ_WRITE_MULTIPLE_REGISTERS:
+ transaction.register_number = MODBUS_AO_START_NUMBER;
+ break;
+ }
+
+ #define MODBUS_FLAG_WRITE 0x01
+ #define MODBUS_FLAG_SINGLE 0x02
+ uint8_t flags = 0x00;
+
+ /* process message */
+ switch (transaction.function_code) {
+ case MODBUS_WRITE_SINGLE_COIL:
+ case MODBUS_WRITE_SINGLE_REGISTER: /* holding register */
+ flags |= MODBUS_FLAG_SINGLE;
+ case MODBUS_WRITE_MULTIPLE_COILS:
+ case MODBUS_WRITE_MULTIPLE_REGISTERS:
+ flags |= MODBUS_FLAG_WRITE;
+ case MODBUS_READ_DISCRETE_INPUTS:
+ case MODBUS_READ_COILS:
+ case MODBUS_READ_INPUT_REGISTERS:
+ case MODBUS_READ_HOLDING_REGISTERS:
+ if (len < (MODBUS_MINIMAL_FRAME_LEN + 4)) {
+ /* buffer too short to contain everything we need */
+ return MODBUS_ERROR;
+ }
+ transaction.register_address = (buffer[buffer_pos++] << 8) | buffer[buffer_pos++];
+ // TODO check length!
+ if (flags & MODBUS_FLAG_WRITE) {
+ if (flags & MODBUS_FLAG_SINGLE) {
+ transaction.holding_registers[0] = (buffer[buffer_pos++] << 8) | buffer[buffer_pos++];
+ } else {
+ /* Write multiple registers */
+ transaction.register_count = (buffer[buffer_pos++] << 8) | buffer[buffer_pos++];
+ byte_count = buffer[buffer_pos++];
+ if (transaction.register_count > 123 || 2*transaction.register_count != byte_count) {
+ /* Max number of register is defined by Modbus_Application_Protocol_V1_1b, section 6.12 */
+ transaction.exception.exception_code = MODBUS_EXCEPTION_ILLEGAL_REGISTER_QUANTITY;
+ } else {
+ for (uint8_t i = 0; i < transaction.register_count; i++) {
+ transaction.holding_registers[i] = (buffer[buffer_pos++] << 8) | buffer[buffer_pos++];
+ }
+ }
+ }
+ } else {
+ transaction.register_count = (buffer[buffer_pos++] << 8) | buffer[buffer_pos++];
+ if (
+ transaction.register_count < 1 ||
+ transaction.register_count > MODBUS_MAX_REGISTERS
+ ) {
+ transaction.exception.exception_code = MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE;
+ }
+ }
+ // add offset to register number
+ transaction.register_number += transaction.register_address;
+ break;
+ default:
+ /* function code not known / not implemented, reply with
+ * ExceptionCode 1 */
+ transaction.exception.exception_code = MODBUS_EXCEPTION_ILLEGAL_FUNCTION;
+ break;
+ }
+ /* data in modbus_buffer have been processed and buffer can be re-used for TX */
+ /* handle reply */
+ if (transaction.exception.exception_code != 0) {
+ /* indicate error */
+ transaction.function_code |= MODBUS_ERROR_FLAG;
+ } else {
+ callback_result = modbus_slave_callback(&transaction);
+ /* error handling */
+ if (callback_result != MODBUS_OK) {
+ transaction.function_code |= MODBUS_ERROR_FLAG;
+ if (callback_result == MODBUS_ERROR_FUNCTION_NOT_IMPLEMENTED) {
+ transaction.exception.exception_code = MODBUS_EXCEPTION_ILLEGAL_FUNCTION;
+ } else if (callback_result == MODBUS_ERROR_REGISTER_NOT_IMPLEMENTED) {
+ transaction.exception.exception_code = MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS;
+ }
+ }
+ }
+ uint8_t msg_len = 0;
+modbus_send:
+ if (address != MODBUS_BROADCAST_ADDR) {
+ /* send only if master request was not broadcast */
+ modbus_copy_reply_to_buffer(modbus_buffer, &msg_len, &transaction);
+ modbus_transmit_function(modbus_buffer, msg_len);
+ }
+}
diff --git a/fw_old/Core/Src/scd4x.c b/fw_old/Core/Src/scd4x.c
new file mode 100644
index 0000000..1fc96ec
--- /dev/null
+++ b/fw_old/Core/Src/scd4x.c
@@ -0,0 +1,106 @@
+/*
+ * sht4x.c
+ *
+ * Created on: Jun 8, 2021
+ * Author: user
+ */
+
+#include "scd4x.h"
+#include "main.h" /* for uart_disable_interrupts() */
+
+int8_t scd4x_send_cmd(scd4x_cmd_t cmd)
+{
+ uint8_t buffer[32];
+ int result;
+
+ // start measurement
+ buffer[0] = cmd >> 8;
+ buffer[1] = cmd & 0x00ff;
+ result = i2c_transmit(SCD4X_I2C_ADDRESS<<1, buffer, 2);
+ if (result != I2C_OK) {
+ return SCD4X_ERROR;
+ }
+
+ return SCD4X_OK;
+}
+
+int8_t scd4x_read_data(uint8_t *buffer, int len)
+{
+ return SCD4X_OK;
+}
+
+int8_t scd4x_start_periodic_measurement( void )
+{
+ return scd4x_send_cmd(SCD4X_START_PERIODIC_MEASUREMENT);
+}
+
+int8_t scd4x_stop_periodic_measurement( void )
+{
+ return scd4x_send_cmd(SCD4X_STOP_PERIODIC_MEASUREMENT);
+}
+
+int8_t scd4x_perform_factory_reset( void )
+{
+ return scd4x_send_cmd(SCD4X_PERFORM_FACTORY_RESET);
+}
+
+int8_t scd4x_read_measurement(uint16_t * co2, int16_t *temperature, uint16_t *relative_humidity)
+{
+ uint8_t buffer[32];
+ int result;
+
+ // start measurement
+ // TODO: Check for data ready
+ /*
+ buffer[0] = GET_DATA_READY_STATUS >> 8;
+ buffer[1] = GET_DATA_READY_STATUS & 0x00ff;
+ result = i2c_transmit(SCD4X_I2C_ADDRESS<<1, buffer, 2);
+ if (result != I2C_OK) {
+ return SCD4X_ERROR;
+ }
+ LL_mDelay(100); // 10 ms should be enough
+ // read out
+ result = i2c_receive(SCD4X_I2C_ADDRESS<<1, buffer, 6);
+ if (result != I2C_OK) {
+ return SCD4X_ERROR;
+ }*/
+
+
+ // start measurement
+ buffer[0] = SCD4X_READ_MEASUREMENT >> 8;
+ buffer[1] = SCD4X_READ_MEASUREMENT & 0x00ff;
+ result = i2c_transmit(SCD4X_I2C_ADDRESS<<1, buffer, 2);
+
+ // TODO: Proc to vraci NACK? Vyresit.
+ /*if (result != I2C_OK) {
+ return SCD4X_ERROR;
+ }*/
+ uart_disable_interrupts();
+ LL_mDelay(1); // 10 ms should be enough
+ uart_enable_interrupts();
+ // read out
+ result = i2c_receive(SCD4X_I2C_ADDRESS<<1, buffer, 9);
+ if (result != I2C_OK)
+ {
+ return SCD4X_ERROR;
+ }
+
+ // TODO checksum
+ // Convert to T and RH; taken directly from pseudocode in SHT4x datasheet, page 3
+ uint32_t co2_ticks = (buffer[0] << 8) + buffer[1];
+ uint32_t t_ticks = (buffer[3] << 8) + buffer[4];
+ uint32_t rh_ticks = (buffer[6] << 8) + buffer[7];
+ int t_degC = -450 + 10 * 175 * t_ticks / 65535;
+ int rh_pRH = 100 * rh_ticks / 65535;
+ if (rh_pRH > 100) {
+ rh_pRH = 100;
+ }
+ if (rh_pRH < 0) {
+ rh_pRH = 0;
+ }
+ *co2 = co2_ticks;
+ *temperature = t_degC;
+ *relative_humidity = rh_pRH;
+
+ return SCD4X_OK;
+}
diff --git a/fw_old/Core/Src/sht4x.c b/fw_old/Core/Src/sht4x.c
new file mode 100644
index 0000000..af6c23b
--- /dev/null
+++ b/fw_old/Core/Src/sht4x.c
@@ -0,0 +1,58 @@
+/*
+ * sht4x.c
+ *
+ * Created on: Jun 8, 2021
+ * Author: user
+ */
+
+#include "sht4x.h"
+#include "main.h" /* for uart_disable_interrupts() */
+
+int8_t sht4x_send_cmd(sht4x_cmd_t cmd)
+{
+ return SHT4X_OK;
+}
+
+int8_t sht4x_read_data(uint8_t *buffer, int len)
+{
+ return SHT4X_OK;
+}
+
+int8_t sht4x_measure(int16_t *temperature, uint16_t *relative_humidity)
+{
+ uint8_t buffer[32];
+ int result;
+
+ // start measurement
+ buffer[0] = SHT4X_START_MEAS_HIGH_PRECISION;
+ result = i2c_transmit(SHT4X_I2C_ADDRESS<<1, buffer, 1);
+ // TODO: Proc to vraci NACK? Vyresit.
+ /*
+ if (result != I2C_OK) {
+ return SHT4X_ERROR;
+ }*/
+ uart_disable_interrupts();
+ LL_mDelay(10); // 10 ms should be enough
+ uart_enable_interrupts();
+ // read out
+ result = i2c_receive(SHT4X_I2C_ADDRESS<<1, buffer, 6);
+ if (result != I2C_OK) {
+ return SHT4X_ERROR;
+ }
+ // TODO checksum
+ // Convert to T and RH; taken directly from pseudocode in SHT4x datasheet, page 3
+ uint32_t t_ticks = (buffer[0] << 8) + buffer[1];
+ uint32_t rh_ticks = (buffer[3] << 8) + buffer[4];
+ int t_degC = -450 + 10 * 175 * t_ticks / 65535; /* temperature * 10 */
+ int rh_pRH = -6 + 125 * rh_ticks / 65535;
+ if (rh_pRH > 100) {
+ rh_pRH = 100;
+ }
+ if (rh_pRH < 0) {
+ rh_pRH = 0;
+ }
+ *temperature = t_degC;
+ *relative_humidity = rh_pRH;
+
+ return SHT4X_OK;
+}
diff --git a/fw_old/Core/Src/sps30.c b/fw_old/Core/Src/sps30.c
new file mode 100644
index 0000000..c05a273
--- /dev/null
+++ b/fw_old/Core/Src/sps30.c
@@ -0,0 +1,193 @@
+/*
+ * sps30.c
+ *
+ * Created on: Jul 18, 2021
+ * Author: david
+ */
+
+#include "sps30.h"
+
+int8_t sps30_send_cmd(sps30_cmd_t cmd)
+{
+ uint8_t buffer[32];
+ uint8_t result;
+
+ // start measurement
+ buffer[0] = cmd >> 8;
+ buffer[1] = cmd & 0x00ff;
+ result = i2c_transmit(SPS30_I2C_ADDRESS<<1, buffer, 2);
+ // TODO: Proc to vraci NACK? Vyresit.
+ if (result != I2C_OK) {
+ return SPS30_ERROR;
+ }
+
+ return SPS30_OK;
+}
+
+int8_t sps30_start_measurement( void )
+{
+ uint8_t i2c_tx_buffer[5];
+ uint8_t data_for_crc = {SPS30_UINT16_FORMAT, 0x00};
+
+ uint8_t result;
+
+ i2c_tx_buffer[0] = SPS30_START_MEASUREMENT >> 8;
+ i2c_tx_buffer[1] = SPS30_START_MEASUREMENT & 0x00ff;
+ i2c_tx_buffer[2] = SPS30_UINT16_FORMAT;
+ i2c_tx_buffer[3] = 0x00;
+ i2c_tx_buffer[4] = calculate_crc(data_for_crc);
+
+ result = i2c_transmit(SPS30_I2C_ADDRESS<<1, i2c_tx_buffer, 5);
+
+ // TODO: Proc to vraci NACK? Vyresit.
+ if (result != I2C_OK) {
+ return SPS30_ERROR;
+ }
+ return SPS30_OK;
+}
+
+int8_t sps30_stop_measurement( void )
+{
+ return sps30_send_cmd(SPS30_STOP_MEASUREMENT);
+}
+
+int8_t sps30_read_measured_values(uint16_t *measured_values, uint8_t measured_values_len)
+{
+
+ if (measured_values_len != 10)
+ {
+ return -5;
+ }
+
+ uint8_t i2c_tx_buffer[2];
+ uint8_t i2c_rx_buffer[30];
+
+ uint8_t result;
+
+ // start measurement
+ i2c_tx_buffer[0] = SPS30_READ_MEASURED_VALUES >> 8;
+ i2c_tx_buffer[1] = SPS30_READ_MEASURED_VALUES & 0x00ff;
+ result = i2c_transmit(SPS30_I2C_ADDRESS<<1, i2c_tx_buffer, 2);
+
+ // TODO: Proc to vraci NACK? Vyresit.
+ /*if (result != I2C_OK) {
+ return SPS30_ERROR;
+ }
+ return SPS30_OK;*/
+
+ LL_mDelay(1); // 10 ms should be enough
+ // read out
+ result = i2c_receive(SPS30_I2C_ADDRESS<<1, i2c_rx_buffer, 30);
+ if (result != I2C_OK)
+ {
+ return SPS30_ERROR;
+ }
+
+ uint8_t checksums[10];
+
+ uint8_t j = 0;
+ for (uint8_t i = 0; i < 10; i++)
+ {
+
+ measured_values[i] = (i2c_rx_buffer[j++] << 8) + i2c_rx_buffer[j++];
+ checksums[i] = i2c_rx_buffer[j++];
+ }
+
+ return SPS30_OK;
+}
+
+int8_t sps30_sleep( void )
+{
+ return sps30_send_cmd(SPS30_SLEEP);
+}
+
+int8_t sps30_wake_up( void )
+{
+ return sps30_send_cmd(SPS30_WAKE_UP);
+ return sps30_send_cmd(SPS30_WAKE_UP);
+}
+
+int8_t sps30_start_fan_cleaning( void )
+{
+ return sps30_send_cmd(SPS30_START_FAN_CLEANING);
+}
+
+int8_t sps30_reset( void )
+{
+ return sps30_send_cmd(SPS30_RESET);
+}
+
+
+int8_t sps30_read_status_register ( void )
+{
+ uint8_t i2c_tx_buffer[2];
+ uint8_t i2c_rx_buffer[6];
+
+ uint8_t result;
+
+ // start measurement
+ i2c_tx_buffer[0] = SPS30_READ_DEVICE_STATUS_REGISTER >> 8;
+ i2c_tx_buffer[1] = SPS30_READ_DEVICE_STATUS_REGISTER & 0x00ff;
+ result = i2c_transmit(SPS30_I2C_ADDRESS<<1, i2c_tx_buffer, 2);
+
+ // TODO: Proc to vraci NACK? Vyresit.
+ /*if (result != I2C_OK) {
+ return SPS30_ERROR;
+ }
+ return SPS30_OK;*/
+
+ LL_mDelay(1); // 10 ms should be enough
+ // read out
+ result = i2c_receive(SPS30_I2C_ADDRESS<<1, i2c_rx_buffer, 6);
+
+ return 0;
+}
+
+int8_t sps30_read_firmware_version ( uint8_t * fw_ver_hi, uint8_t * fw_ver_lo )
+{
+ uint8_t i2c_tx_buffer[2];
+ uint8_t i2c_rx_buffer[3];
+
+ uint8_t result;
+
+ // start measurement
+ i2c_tx_buffer[0] = SPS30_READ_VERSION >> 8;
+ i2c_tx_buffer[1] = SPS30_READ_VERSION & 0x00ff;
+ result = i2c_transmit(SPS30_I2C_ADDRESS<<1, i2c_tx_buffer, 2);
+
+ // TODO: Proc to vraci NACK? Vyresit.
+ /*if (result != I2C_OK) {
+ return SPS30_ERROR;
+ }
+ return SPS30_OK;*/
+
+ LL_mDelay(1); // 10 ms should be enough
+ // read out
+ result = i2c_receive(SPS30_I2C_ADDRESS<<1, i2c_rx_buffer, 3);
+ /*if (result != I2C_OK)
+ {
+ return SPS30_ERROR;
+ }*/
+
+ *fw_ver_hi = i2c_rx_buffer[0];
+ *fw_ver_lo = i2c_rx_buffer[1];
+
+ return SPS30_OK;
+}
+
+
+uint8_t calculate_crc(uint8_t data[2])
+{
+ uint8_t crc = 0xFF;
+ for(uint8_t i = 0; i < 2; i++) {
+ crc ^= data[i];
+ for(uint8_t bit = 8; bit > 0; --bit) {
+ if(crc & 0x80) {
+ crc = (crc << 1) ^ 0x31u;
+ } else {
+ crc = (crc << 1);
+ }
+ }
+ }
+ return crc;
+}
diff --git a/fw_old/Core/Src/stm32l0xx_it.c b/fw_old/Core/Src/stm32l0xx_it.c
new file mode 100644
index 0000000..504a5a5
--- /dev/null
+++ b/fw_old/Core/Src/stm32l0xx_it.c
@@ -0,0 +1,208 @@
+/* USER CODE BEGIN Header */
+/**
+ ******************************************************************************
+ * @file stm32l0xx_it.c
+ * @brief Interrupt Service Routines.
+ ******************************************************************************
+ * @attention
+ *
+ * © Copyright (c) 2021 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software component is licensed by ST under BSD 3-Clause license,
+ * the "License"; You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ * opensource.org/licenses/BSD-3-Clause
+ *
+ ******************************************************************************
+ */
+/* USER CODE END Header */
+
+/* Includes ------------------------------------------------------------------*/
+#include "main.h"
+#include "stm32l0xx_it.h"
+/* Private includes ----------------------------------------------------------*/
+/* USER CODE BEGIN Includes */
+#include "modbus.h"
+/* USER CODE END Includes */
+
+/* Private typedef -----------------------------------------------------------*/
+/* USER CODE BEGIN TD */
+
+/* USER CODE END TD */
+
+/* Private define ------------------------------------------------------------*/
+/* USER CODE BEGIN PD */
+
+/* USER CODE END PD */
+
+/* Private macro -------------------------------------------------------------*/
+/* USER CODE BEGIN PM */
+
+/* USER CODE END PM */
+
+/* Private variables ---------------------------------------------------------*/
+/* USER CODE BEGIN PV */
+uint16_t lpuart1_rx_message_index = 0;
+uint16_t lpuart1_rx_message_len = 0;
+uint8_t lpuart1_rx_done = 0;
+uint8_t lpuart1_rx_message_too_long = 0;
+
+uint8_t tim21_elapsed_period = 0;
+/* USER CODE END PV */
+
+/* Private function prototypes -----------------------------------------------*/
+/* USER CODE BEGIN PFP */
+void LPUART1_CharReception_Callback( void );
+/* USER CODE END PFP */
+
+/* Private user code ---------------------------------------------------------*/
+/* USER CODE BEGIN 0 */
+
+/* USER CODE END 0 */
+
+/* External variables --------------------------------------------------------*/
+
+/* USER CODE BEGIN EV */
+
+/* USER CODE END EV */
+
+/******************************************************************************/
+/* Cortex-M0+ Processor Interruption and Exception Handlers */
+/******************************************************************************/
+/**
+ * @brief This function handles Non maskable interrupt.
+ */
+void NMI_Handler(void)
+{
+ /* USER CODE BEGIN NonMaskableInt_IRQn 0 */
+
+ /* USER CODE END NonMaskableInt_IRQn 0 */
+ /* USER CODE BEGIN NonMaskableInt_IRQn 1 */
+ while (1)
+ {
+ }
+ /* USER CODE END NonMaskableInt_IRQn 1 */
+}
+
+/**
+ * @brief This function handles Hard fault interrupt.
+ */
+void HardFault_Handler(void)
+{
+ /* USER CODE BEGIN HardFault_IRQn 0 */
+
+ /* USER CODE END HardFault_IRQn 0 */
+ while (1)
+ {
+ /* USER CODE BEGIN W1_HardFault_IRQn 0 */
+ /* USER CODE END W1_HardFault_IRQn 0 */
+ }
+}
+
+/**
+ * @brief This function handles System service call via SWI instruction.
+ */
+void SVC_Handler(void)
+{
+ /* USER CODE BEGIN SVC_IRQn 0 */
+
+ /* USER CODE END SVC_IRQn 0 */
+ /* USER CODE BEGIN SVC_IRQn 1 */
+
+ /* USER CODE END SVC_IRQn 1 */
+}
+
+/**
+ * @brief This function handles Pendable request for system service.
+ */
+void PendSV_Handler(void)
+{
+ /* USER CODE BEGIN PendSV_IRQn 0 */
+
+ /* USER CODE END PendSV_IRQn 0 */
+ /* USER CODE BEGIN PendSV_IRQn 1 */
+
+ /* USER CODE END PendSV_IRQn 1 */
+}
+
+/**
+ * @brief This function handles System tick timer.
+ */
+void SysTick_Handler(void)
+{
+ /* USER CODE BEGIN SysTick_IRQn 0 */
+
+ /* USER CODE END SysTick_IRQn 0 */
+
+ /* USER CODE BEGIN SysTick_IRQn 1 */
+ /* USER CODE END SysTick_IRQn 1 */
+}
+
+/******************************************************************************/
+/* STM32L0xx Peripheral Interrupt Handlers */
+/* Add here the Interrupt Handlers for the used peripherals. */
+/* For the available peripheral interrupt handler names, */
+/* please refer to the startup file (startup_stm32l0xx.s). */
+/******************************************************************************/
+
+/**
+ * @brief This function handles TIM21 global interrupt.
+ */
+void TIM21_IRQHandler(void)
+{
+ /* USER CODE BEGIN TIM21_IRQn 0 */
+ LL_TIM_ClearFlag_UPDATE(TIM21);
+ tim21_elapsed_period = 1;
+
+ /* USER CODE END TIM21_IRQn 0 */
+ /* USER CODE BEGIN TIM21_IRQn 1 */
+
+ /* USER CODE END TIM21_IRQn 1 */
+}
+
+/**
+ * @brief This function handles LPUART1 global interrupt / LPUART1 wake-up interrupt through EXTI line 28.
+ */
+void LPUART1_IRQHandler(void)
+{
+ /* USER CODE BEGIN LPUART1_IRQn 0 */
+ /* Check RXNE flag value in SR register */
+ if(LL_LPUART_IsActiveFlag_RXNE(LPUART1) && LL_LPUART_IsEnabledIT_RXNE(LPUART1))
+ {
+ /* RXNE flag will be cleared by reading of DR register (done in call) */
+ /* Call function in charge of handling Character reception */
+ LPUART1_CharReception_Callback();
+ }
+ /* USER CODE END LPUART1_IRQn 0 */
+ /* USER CODE BEGIN LPUART1_IRQn 1 */
+ /* If the IDLE flag is active */
+ if (LL_LPUART_IsActiveFlag_IDLE(LPUART1) && LL_LPUART_IsEnabledIT_IDLE(LPUART1))
+ {
+ /* Clear the IDLE flag */
+ LL_LPUART_ClearFlag_IDLE(LPUART1);
+
+ /* Reset the buffer index */
+ lpuart1_rx_message_len = lpuart1_rx_message_index;
+ lpuart1_rx_message_index = 0;
+ lpuart1_rx_done = 1;
+ if (lpuart1_rx_message_len > MODBUS_MAX_RTU_FRAME_SIZE)
+ {
+ lpuart1_rx_message_too_long = 1;
+ }
+ }
+ /* USER CODE END LPUART1_IRQn 1 */
+}
+
+/* USER CODE BEGIN 1 */
+void LPUART1_CharReception_Callback( void )
+{
+ uint16_t lpuart1_rx_bit = LL_LPUART_ReceiveData9(LPUART1);
+ if (lpuart1_rx_message_index < MODBUS_MAX_RTU_FRAME_SIZE)
+ {
+ modbus_buffer[lpuart1_rx_message_index] = (uint8_t)lpuart1_rx_bit;
+ }
+ lpuart1_rx_message_index++;
+}
+/* USER CODE END 1 */
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/fw_old/Core/Src/syscalls.c b/fw_old/Core/Src/syscalls.c
new file mode 100644
index 0000000..4ec9584
--- /dev/null
+++ b/fw_old/Core/Src/syscalls.c
@@ -0,0 +1,159 @@
+/**
+ ******************************************************************************
+ * @file syscalls.c
+ * @author Auto-generated by STM32CubeIDE
+ * @brief STM32CubeIDE Minimal System calls file
+ *
+ * For more information about which c-functions
+ * need which of these lowlevel functions
+ * please consult the Newlib libc-manual
+ ******************************************************************************
+ * @attention
+ *
+ * © Copyright (c) 2020 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software component is licensed by ST under BSD 3-Clause license,
+ * the "License"; You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ * opensource.org/licenses/BSD-3-Clause
+ *
+ ******************************************************************************
+ */
+
+/* Includes */
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+/* Variables */
+//#undef errno
+extern int errno;
+extern int __io_putchar(int ch) __attribute__((weak));
+extern int __io_getchar(void) __attribute__((weak));
+
+register char * stack_ptr asm("sp");
+
+char *__env[1] = { 0 };
+char **environ = __env;
+
+
+/* Functions */
+void initialise_monitor_handles()
+{
+}
+
+int _getpid(void)
+{
+ return 1;
+}
+
+int _kill(int pid, int sig)
+{
+ errno = EINVAL;
+ return -1;
+}
+
+void _exit (int status)
+{
+ _kill(status, -1);
+ while (1) {} /* Make sure we hang here */
+}
+
+__attribute__((weak)) int _read(int file, char *ptr, int len)
+{
+ int DataIdx;
+
+ for (DataIdx = 0; DataIdx < len; DataIdx++)
+ {
+ *ptr++ = __io_getchar();
+ }
+
+return len;
+}
+
+__attribute__((weak)) int _write(int file, char *ptr, int len)
+{
+ int DataIdx;
+
+ for (DataIdx = 0; DataIdx < len; DataIdx++)
+ {
+ __io_putchar(*ptr++);
+ }
+ return len;
+}
+
+int _close(int file)
+{
+ return -1;
+}
+
+
+int _fstat(int file, struct stat *st)
+{
+ st->st_mode = S_IFCHR;
+ return 0;
+}
+
+int _isatty(int file)
+{
+ return 1;
+}
+
+int _lseek(int file, int ptr, int dir)
+{
+ return 0;
+}
+
+int _open(char *path, int flags, ...)
+{
+ /* Pretend like we always fail */
+ return -1;
+}
+
+int _wait(int *status)
+{
+ errno = ECHILD;
+ return -1;
+}
+
+int _unlink(char *name)
+{
+ errno = ENOENT;
+ return -1;
+}
+
+int _times(struct tms *buf)
+{
+ return -1;
+}
+
+int _stat(char *file, struct stat *st)
+{
+ st->st_mode = S_IFCHR;
+ return 0;
+}
+
+int _link(char *old, char *new)
+{
+ errno = EMLINK;
+ return -1;
+}
+
+int _fork(void)
+{
+ errno = EAGAIN;
+ return -1;
+}
+
+int _execve(char *name, char **argv, char **env)
+{
+ errno = ENOMEM;
+ return -1;
+}
diff --git a/fw_old/Core/Src/sysmem.c b/fw_old/Core/Src/sysmem.c
new file mode 100644
index 0000000..d7cc52c
--- /dev/null
+++ b/fw_old/Core/Src/sysmem.c
@@ -0,0 +1,80 @@
+/**
+ ******************************************************************************
+ * @file sysmem.c
+ * @author Generated by STM32CubeIDE
+ * @brief STM32CubeIDE System Memory calls file
+ *
+ * For more information about which C functions
+ * need which of these lowlevel functions
+ * please consult the newlib libc manual
+ ******************************************************************************
+ * @attention
+ *
+ * © Copyright (c) 2020 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software component is licensed by ST under BSD 3-Clause license,
+ * the "License"; You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ * opensource.org/licenses/BSD-3-Clause
+ *
+ ******************************************************************************
+ */
+
+/* Includes */
+#include
+#include
+
+/**
+ * Pointer to the current high watermark of the heap usage
+ */
+static uint8_t *__sbrk_heap_end = NULL;
+
+/**
+ * @brief _sbrk() allocates memory to the newlib heap and is used by malloc
+ * and others from the C library
+ *
+ * @verbatim
+ * ############################################################################
+ * # .data # .bss # newlib heap # MSP stack #
+ * # # # # Reserved by _Min_Stack_Size #
+ * ############################################################################
+ * ^-- RAM start ^-- _end _estack, RAM end --^
+ * @endverbatim
+ *
+ * This implementation starts allocating at the '_end' linker symbol
+ * The '_Min_Stack_Size' linker symbol reserves a memory for the MSP stack
+ * The implementation considers '_estack' linker symbol to be RAM end
+ * NOTE: If the MSP stack, at any point during execution, grows larger than the
+ * reserved size, please increase the '_Min_Stack_Size'.
+ *
+ * @param incr Memory size
+ * @return Pointer to allocated memory
+ */
+void *_sbrk(ptrdiff_t incr)
+{
+ extern uint8_t _end; /* Symbol defined in the linker script */
+ extern uint8_t _estack; /* Symbol defined in the linker script */
+ extern uint32_t _Min_Stack_Size; /* Symbol defined in the linker script */
+ const uint32_t stack_limit = (uint32_t)&_estack - (uint32_t)&_Min_Stack_Size;
+ const uint8_t *max_heap = (uint8_t *)stack_limit;
+ uint8_t *prev_heap_end;
+
+ /* Initialize heap end at first call */
+ if (NULL == __sbrk_heap_end)
+ {
+ __sbrk_heap_end = &_end;
+ }
+
+ /* Protect heap from growing into the reserved MSP stack */
+ if (__sbrk_heap_end + incr > max_heap)
+ {
+ errno = ENOMEM;
+ return (void *)-1;
+ }
+
+ prev_heap_end = __sbrk_heap_end;
+ __sbrk_heap_end += incr;
+
+ return (void *)prev_heap_end;
+}
diff --git a/fw_old/Core/Src/system_stm32l0xx.c b/fw_old/Core/Src/system_stm32l0xx.c
new file mode 100644
index 0000000..9189ed8
--- /dev/null
+++ b/fw_old/Core/Src/system_stm32l0xx.c
@@ -0,0 +1,275 @@
+/**
+ ******************************************************************************
+ * @file system_stm32l0xx.c
+ * @author MCD Application Team
+ * @brief CMSIS Cortex-M0+ Device Peripheral Access Layer System Source File.
+ *
+ * This file provides two functions and one global variable to be called from
+ * user application:
+ * - SystemInit(): This function is called at startup just after reset and
+ * before branch to main program. This call is made inside
+ * the "startup_stm32l0xx.s" file.
+ *
+ * - SystemCoreClock variable: Contains the core clock (HCLK), it can be used
+ * by the user application to setup the SysTick
+ * timer or configure other parameters.
+ *
+ * - SystemCoreClockUpdate(): Updates the variable SystemCoreClock and must
+ * be called whenever the core clock is changed
+ * during program execution.
+ *
+ *
+ ******************************************************************************
+ * @attention
+ *
+ * © Copyright(c) 2016 STMicroelectronics.
+ * All rights reserved.
+ *
+ * This software component is licensed by ST under BSD 3-Clause license,
+ * the "License"; You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ * opensource.org/licenses/BSD-3-Clause
+ *
+ ******************************************************************************
+ */
+
+/** @addtogroup CMSIS
+ * @{
+ */
+
+/** @addtogroup stm32l0xx_system
+ * @{
+ */
+
+/** @addtogroup STM32L0xx_System_Private_Includes
+ * @{
+ */
+
+#include "stm32l0xx.h"
+
+#if !defined (HSE_VALUE)
+ #define HSE_VALUE ((uint32_t)8000000U) /*!< Value of the External oscillator in Hz */
+#endif /* HSE_VALUE */
+
+#if !defined (MSI_VALUE)
+ #define MSI_VALUE ((uint32_t)2097152U) /*!< Value of the Internal oscillator in Hz*/
+#endif /* MSI_VALUE */
+
+#if !defined (HSI_VALUE)
+ #define HSI_VALUE ((uint32_t)16000000U) /*!< Value of the Internal oscillator in Hz*/
+#endif /* HSI_VALUE */
+
+
+/**
+ * @}
+ */
+
+/** @addtogroup STM32L0xx_System_Private_TypesDefinitions
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @addtogroup STM32L0xx_System_Private_Defines
+ * @{
+ */
+/************************* Miscellaneous Configuration ************************/
+
+/* Note: Following vector table addresses must be defined in line with linker
+ configuration. */
+/*!< Uncomment the following line if you need to relocate the vector table
+ anywhere in Flash or Sram, else the vector table is kept at the automatic
+ remap of boot address selected */
+/* #define USER_VECT_TAB_ADDRESS */
+
+#if defined(USER_VECT_TAB_ADDRESS)
+/*!< Uncomment the following line if you need to relocate your vector Table
+ in Sram else user remap will be done in Flash. */
+/* #define VECT_TAB_SRAM */
+#if defined(VECT_TAB_SRAM)
+#define VECT_TAB_BASE_ADDRESS SRAM_BASE /*!< Vector Table base address field.
+ This value must be a multiple of 0x200. */
+#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
+ This value must be a multiple of 0x200. */
+#else
+#define VECT_TAB_BASE_ADDRESS FLASH_BASE /*!< Vector Table base address field.
+ This value must be a multiple of 0x200. */
+#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
+ This value must be a multiple of 0x200. */
+#endif /* VECT_TAB_SRAM */
+#endif /* USER_VECT_TAB_ADDRESS */
+
+/******************************************************************************/
+/**
+ * @}
+ */
+
+/** @addtogroup STM32L0xx_System_Private_Macros
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @addtogroup STM32L0xx_System_Private_Variables
+ * @{
+ */
+ /* This variable is updated in three ways:
+ 1) by calling CMSIS function SystemCoreClockUpdate()
+ 2) by calling HAL API function HAL_RCC_GetHCLKFreq()
+ 3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
+ Note: If you use this function to configure the system clock; then there
+ is no need to call the 2 first functions listed above, since SystemCoreClock
+ variable is updated automatically.
+ */
+ uint32_t SystemCoreClock = 2097152U; /* 32.768 kHz * 2^6 */
+ const uint8_t AHBPrescTable[16] = {0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 1U, 2U, 3U, 4U, 6U, 7U, 8U, 9U};
+ const uint8_t APBPrescTable[8] = {0U, 0U, 0U, 0U, 1U, 2U, 3U, 4U};
+ const uint8_t PLLMulTable[9] = {3U, 4U, 6U, 8U, 12U, 16U, 24U, 32U, 48U};
+
+/**
+ * @}
+ */
+
+/** @addtogroup STM32L0xx_System_Private_FunctionPrototypes
+ * @{
+ */
+
+/**
+ * @}
+ */
+
+/** @addtogroup STM32L0xx_System_Private_Functions
+ * @{
+ */
+
+/**
+ * @brief Setup the microcontroller system.
+ * @param None
+ * @retval None
+ */
+void SystemInit (void)
+{
+ /* Configure the Vector Table location add offset address ------------------*/
+#if defined (USER_VECT_TAB_ADDRESS)
+ SCB->VTOR = VECT_TAB_BASE_ADDRESS | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
+#endif /* USER_VECT_TAB_ADDRESS */
+}
+
+/**
+ * @brief Update SystemCoreClock variable according to Clock Register Values.
+ * The SystemCoreClock variable contains the core clock (HCLK), it can
+ * be used by the user application to setup the SysTick timer or configure
+ * other parameters.
+ *
+ * @note Each time the core clock (HCLK) changes, this function must be called
+ * to update SystemCoreClock variable value. Otherwise, any configuration
+ * based on this variable will be incorrect.
+ *
+ * @note - The system frequency computed by this function is not the real
+ * frequency in the chip. It is calculated based on the predefined
+ * constant and the selected clock source:
+ *
+ * - If SYSCLK source is MSI, SystemCoreClock will contain the MSI
+ * value as defined by the MSI range.
+ *
+ * - If SYSCLK source is HSI, SystemCoreClock will contain the HSI_VALUE(*)
+ *
+ * - If SYSCLK source is HSE, SystemCoreClock will contain the HSE_VALUE(**)
+ *
+ * - If SYSCLK source is PLL, SystemCoreClock will contain the HSE_VALUE(**)
+ * or HSI_VALUE(*) multiplied/divided by the PLL factors.
+ *
+ * (*) HSI_VALUE is a constant defined in stm32l0xx_hal.h file (default value
+ * 16 MHz) but the real value may vary depending on the variations
+ * in voltage and temperature.
+ *
+ * (**) HSE_VALUE is a constant defined in stm32l0xx_hal.h file (default value
+ * 8 MHz), user has to ensure that HSE_VALUE is same as the real
+ * frequency of the crystal used. Otherwise, this function may
+ * have wrong result.
+ *
+ * - The result of this function could be not correct when using fractional
+ * value for HSE crystal.
+ * @param None
+ * @retval None
+ */
+void SystemCoreClockUpdate (void)
+{
+ uint32_t tmp = 0U, pllmul = 0U, plldiv = 0U, pllsource = 0U, msirange = 0U;
+
+ /* Get SYSCLK source -------------------------------------------------------*/
+ tmp = RCC->CFGR & RCC_CFGR_SWS;
+
+ switch (tmp)
+ {
+ case 0x00U: /* MSI used as system clock */
+ msirange = (RCC->ICSCR & RCC_ICSCR_MSIRANGE) >> RCC_ICSCR_MSIRANGE_Pos;
+ SystemCoreClock = (32768U * (1U << (msirange + 1U)));
+ break;
+ case 0x04U: /* HSI used as system clock */
+ if ((RCC->CR & RCC_CR_HSIDIVF) != 0U)
+ {
+ SystemCoreClock = HSI_VALUE / 4U;
+ }
+ else
+ {
+ SystemCoreClock = HSI_VALUE;
+ }
+ break;
+ case 0x08U: /* HSE used as system clock */
+ SystemCoreClock = HSE_VALUE;
+ break;
+ default: /* PLL used as system clock */
+ /* Get PLL clock source and multiplication factor ----------------------*/
+ pllmul = RCC->CFGR & RCC_CFGR_PLLMUL;
+ plldiv = RCC->CFGR & RCC_CFGR_PLLDIV;
+ pllmul = PLLMulTable[(pllmul >> RCC_CFGR_PLLMUL_Pos)];
+ plldiv = (plldiv >> RCC_CFGR_PLLDIV_Pos) + 1U;
+
+ pllsource = RCC->CFGR & RCC_CFGR_PLLSRC;
+
+ if (pllsource == 0x00U)
+ {
+ /* HSI oscillator clock selected as PLL clock entry */
+ if ((RCC->CR & RCC_CR_HSIDIVF) != 0U)
+ {
+ SystemCoreClock = (((HSI_VALUE / 4U) * pllmul) / plldiv);
+ }
+ else
+ {
+ SystemCoreClock = (((HSI_VALUE) * pllmul) / plldiv);
+ }
+ }
+ else
+ {
+ /* HSE selected as PLL clock entry */
+ SystemCoreClock = (((HSE_VALUE) * pllmul) / plldiv);
+ }
+ break;
+ }
+ /* Compute HCLK clock frequency --------------------------------------------*/
+ /* Get HCLK prescaler */
+ tmp = AHBPrescTable[((RCC->CFGR & RCC_CFGR_HPRE) >> RCC_CFGR_HPRE_Pos)];
+ /* HCLK clock frequency */
+ SystemCoreClock >>= tmp;
+}
+
+
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/**
+ * @}
+ */
+
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/fw/Core/Startup/startup_stm32l011f4ux.s b/fw_old/Core/Startup/startup_stm32l011f4ux.s
similarity index 100%
rename from fw/Core/Startup/startup_stm32l011f4ux.s
rename to fw_old/Core/Startup/startup_stm32l011f4ux.s
diff --git a/fw_old/Debug/Core/Src/config.d b/fw_old/Debug/Core/Src/config.d
new file mode 100644
index 0000000..b31ca43
--- /dev/null
+++ b/fw_old/Debug/Core/Src/config.d
@@ -0,0 +1,24 @@
+Core/Src/config.o: ../Core/Src/config.c ../Core/Inc/config.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h \
+ ../Drivers/CMSIS/Include/core_cm0plus.h \
+ ../Drivers/CMSIS/Include/cmsis_version.h \
+ ../Drivers/CMSIS/Include/cmsis_compiler.h \
+ ../Drivers/CMSIS/Include/cmsis_gcc.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h
+
+../Core/Inc/config.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h:
+
+../Drivers/CMSIS/Include/core_cm0plus.h:
+
+../Drivers/CMSIS/Include/cmsis_version.h:
+
+../Drivers/CMSIS/Include/cmsis_compiler.h:
+
+../Drivers/CMSIS/Include/cmsis_gcc.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h:
diff --git a/fw_old/Debug/Core/Src/config.o b/fw_old/Debug/Core/Src/config.o
new file mode 100644
index 0000000..fbc3e9c
Binary files /dev/null and b/fw_old/Debug/Core/Src/config.o differ
diff --git a/fw_old/Debug/Core/Src/config.su b/fw_old/Debug/Core/Src/config.su
new file mode 100644
index 0000000..48bcb7f
--- /dev/null
+++ b/fw_old/Debug/Core/Src/config.su
@@ -0,0 +1,7 @@
+config.c:43:8:config_read 16 static
+config.c:70:8:config_write 16 static
+config.c:135:15:eeprom_lock 24 static
+config.c:165:15:eeprom_unlock 24 static
+config.c:198:15:eeprom_program_byte 16 static
+config.c:213:15:eeprom_program_halfword 16 static
+config.c:229:15:eeprom_program_word 16 static
diff --git a/fw_old/Debug/Core/Src/crc8.d b/fw_old/Debug/Core/Src/crc8.d
new file mode 100644
index 0000000..8c3a7ee
--- /dev/null
+++ b/fw_old/Debug/Core/Src/crc8.d
@@ -0,0 +1,3 @@
+Core/Src/crc8.o: ../Core/Src/crc8.c ../Core/Inc/crc8.h
+
+../Core/Inc/crc8.h:
diff --git a/fw_old/Debug/Core/Src/crc8.o b/fw_old/Debug/Core/Src/crc8.o
new file mode 100644
index 0000000..e5faa1e
Binary files /dev/null and b/fw_old/Debug/Core/Src/crc8.o differ
diff --git a/fw_old/Debug/Core/Src/crc8.su b/fw_old/Debug/Core/Src/crc8.su
new file mode 100644
index 0000000..d2e1e30
--- /dev/null
+++ b/fw_old/Debug/Core/Src/crc8.su
@@ -0,0 +1 @@
+crc8.c:11:9:crc8_calculate 24 static
diff --git a/fw_old/Debug/Core/Src/i2c.d b/fw_old/Debug/Core/Src/i2c.d
new file mode 100644
index 0000000..82b3267
--- /dev/null
+++ b/fw_old/Debug/Core/Src/i2c.d
@@ -0,0 +1,30 @@
+Core/Src/i2c.o: ../Core/Src/i2c.c ../Core/Inc/i2c.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_i2c.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h \
+ ../Drivers/CMSIS/Include/core_cm0plus.h \
+ ../Drivers/CMSIS/Include/cmsis_version.h \
+ ../Drivers/CMSIS/Include/cmsis_compiler.h \
+ ../Drivers/CMSIS/Include/cmsis_gcc.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_lpuart.h
+
+../Core/Inc/i2c.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_i2c.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h:
+
+../Drivers/CMSIS/Include/core_cm0plus.h:
+
+../Drivers/CMSIS/Include/cmsis_version.h:
+
+../Drivers/CMSIS/Include/cmsis_compiler.h:
+
+../Drivers/CMSIS/Include/cmsis_gcc.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_lpuart.h:
diff --git a/fw_old/Debug/Core/Src/i2c.o b/fw_old/Debug/Core/Src/i2c.o
new file mode 100644
index 0000000..1e1b60c
Binary files /dev/null and b/fw_old/Debug/Core/Src/i2c.o differ
diff --git a/fw_old/Debug/Core/Src/i2c.su b/fw_old/Debug/Core/Src/i2c.su
new file mode 100644
index 0000000..f334535
--- /dev/null
+++ b/fw_old/Debug/Core/Src/i2c.su
@@ -0,0 +1,11 @@
+stm32l0xx_ll_i2c.h:1511:26:LL_I2C_IsActiveFlag_TXE 16 static
+stm32l0xx_ll_i2c.h:1537:26:LL_I2C_IsActiveFlag_RXNE 16 static
+stm32l0xx_ll_i2c.h:1563:26:LL_I2C_IsActiveFlag_NACK 16 static
+stm32l0xx_ll_i2c.h:1576:26:LL_I2C_IsActiveFlag_STOP 16 static
+stm32l0xx_ll_i2c.h:1733:22:LL_I2C_ClearFlag_STOP 16 static
+stm32l0xx_ll_i2c.h:2090:22:LL_I2C_HandleTransfer 24 static
+stm32l0xx_ll_i2c.h:2174:25:LL_I2C_ReceiveData8 16 static
+stm32l0xx_ll_i2c.h:2186:22:LL_I2C_TransmitData8 16 static
+i2c.c:13:5:i2c_init 16 static
+i2c.c:22:5:i2c_transmit 40 static
+i2c.c:55:5:i2c_receive 48 static
diff --git a/fw_old/Debug/Core/Src/main.d b/fw_old/Debug/Core/Src/main.d
new file mode 100644
index 0000000..a63139f
--- /dev/null
+++ b/fw_old/Debug/Core/Src/main.d
@@ -0,0 +1,80 @@
+Core/Src/main.o: ../Core/Src/main.c ../Core/Inc/main.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_i2c.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h \
+ ../Drivers/CMSIS/Include/core_cm0plus.h \
+ ../Drivers/CMSIS/Include/cmsis_version.h \
+ ../Drivers/CMSIS/Include/cmsis_compiler.h \
+ ../Drivers/CMSIS/Include/cmsis_gcc.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_lpuart.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_rcc.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_crs.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_bus.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_system.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_exti.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_cortex.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_utils.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_pwr.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_dma.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_tim.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_gpio.h \
+ ../Core/Inc/i2c.h ../Core/Inc/scd4x.h ../Core/Inc/crc8.h \
+ ../Core/Inc/sht4x.h ../Core/Inc/sps30.h ../Core/Inc/modbus.h \
+ ../Core/Inc/config.h
+
+../Core/Inc/main.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_i2c.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h:
+
+../Drivers/CMSIS/Include/core_cm0plus.h:
+
+../Drivers/CMSIS/Include/cmsis_version.h:
+
+../Drivers/CMSIS/Include/cmsis_compiler.h:
+
+../Drivers/CMSIS/Include/cmsis_gcc.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_lpuart.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_rcc.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_crs.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_bus.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_system.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_exti.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_cortex.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_utils.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_pwr.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_dma.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_tim.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_gpio.h:
+
+../Core/Inc/i2c.h:
+
+../Core/Inc/scd4x.h:
+
+../Core/Inc/crc8.h:
+
+../Core/Inc/sht4x.h:
+
+../Core/Inc/sps30.h:
+
+../Core/Inc/modbus.h:
+
+../Core/Inc/config.h:
diff --git a/fw_old/Debug/Core/Src/main.o b/fw_old/Debug/Core/Src/main.o
new file mode 100644
index 0000000..56c087c
Binary files /dev/null and b/fw_old/Debug/Core/Src/main.o differ
diff --git a/fw_old/Debug/Core/Src/main.su b/fw_old/Debug/Core/Src/main.su
new file mode 100644
index 0000000..a096d40
--- /dev/null
+++ b/fw_old/Debug/Core/Src/main.su
@@ -0,0 +1,63 @@
+core_cm0plus.h:741:22:__NVIC_EnableIRQ 16 static
+core_cm0plus.h:848:22:__NVIC_SetPriority 24 static
+stm32l0xx_ll_i2c.h:391:22:LL_I2C_Enable 16 static
+stm32l0xx_ll_i2c.h:604:22:LL_I2C_EnableClockStretching 16 static
+stm32l0xx_ll_i2c.h:724:22:LL_I2C_DisableGeneralCall 16 static
+stm32l0xx_ll_i2c.h:835:22:LL_I2C_SetOwnAddress2 24 static
+stm32l0xx_ll_i2c.h:857:22:LL_I2C_DisableOwnAddress2 16 static
+stm32l0xx_ll_i2c.h:1838:22:LL_I2C_EnableAutoEndMode 16 static
+stm32l0xx_ll_lpuart.h:396:22:LL_LPUART_Enable 16 static
+stm32l0xx_ll_lpuart.h:415:22:LL_LPUART_Disable 16 static
+stm32l0xx_ll_lpuart.h:510:22:LL_LPUART_EnableDirectionRx 16 static
+stm32l0xx_ll_lpuart.h:532:22:LL_LPUART_EnableDirectionTx 16 static
+stm32l0xx_ll_lpuart.h:1118:22:LL_LPUART_SetBaudRate 56 static
+stm32l0xx_ll_lpuart.h:1135:26:LL_LPUART_GetBaudRate 40 static
+stm32l0xx_ll_lpuart.h:1210:22:LL_LPUART_SetDEDeassertionTime 16 static
+stm32l0xx_ll_lpuart.h:1233:22:LL_LPUART_SetDEAssertionTime 16 static
+stm32l0xx_ll_lpuart.h:1255:22:LL_LPUART_EnableDEMode 16 static
+stm32l0xx_ll_lpuart.h:1291:22:LL_LPUART_SetDESignalPolarity 16 static
+stm32l0xx_ll_lpuart.h:1400:26:LL_LPUART_IsActiveFlag_TXE 16 static
+stm32l0xx_ll_lpuart.h:1619:22:LL_LPUART_EnableIT_IDLE 16 static
+stm32l0xx_ll_lpuart.h:1631:22:LL_LPUART_EnableIT_RXNE 16 static
+stm32l0xx_ll_lpuart.h:1726:22:LL_LPUART_DisableIT_IDLE 16 static
+stm32l0xx_ll_lpuart.h:1738:22:LL_LPUART_DisableIT_RXNE 16 static
+stm32l0xx_ll_lpuart.h:2114:22:LL_LPUART_TransmitData9 16 static
+stm32l0xx_ll_rcc.h:782:22:LL_RCC_HSI_Enable 8 static
+stm32l0xx_ll_rcc.h:802:26:LL_RCC_HSI_IsReady 8 static
+stm32l0xx_ll_rcc.h:893:22:LL_RCC_HSI_SetCalibTrimming 16 static
+stm32l0xx_ll_rcc.h:1275:22:LL_RCC_SetSysClkSource 16 static
+stm32l0xx_ll_rcc.h:1289:26:LL_RCC_GetSysClkSource 8 static
+stm32l0xx_ll_rcc.h:1309:22:LL_RCC_SetAHBPrescaler 16 static
+stm32l0xx_ll_rcc.h:1325:22:LL_RCC_SetAPB1Prescaler 16 static
+stm32l0xx_ll_rcc.h:1341:22:LL_RCC_SetAPB2Prescaler 16 static
+stm32l0xx_ll_rcc.h:1496:22:LL_RCC_SetLPUARTClockSource 16 static
+stm32l0xx_ll_rcc.h:1515:22:LL_RCC_SetI2CClockSource 16 static
+stm32l0xx_ll_rcc.h:1784:22:LL_RCC_PLL_Enable 8 static
+stm32l0xx_ll_rcc.h:1805:26:LL_RCC_PLL_IsReady 8 static
+stm32l0xx_ll_rcc.h:1834:22:LL_RCC_PLL_ConfigDomain_SYS 24 static
+stm32l0xx_ll_bus.h:440:22:LL_APB1_GRP1_EnableClock 24 static
+stm32l0xx_ll_bus.h:786:22:LL_APB2_GRP1_EnableClock 24 static
+stm32l0xx_ll_bus.h:987:22:LL_IOP_GRP1_EnableClock 24 static
+stm32l0xx_ll_system.h:912:22:LL_FLASH_SetLatency 16 static
+stm32l0xx_ll_system.h:924:26:LL_FLASH_GetLatency 8 static
+stm32l0xx_ll_pwr.h:272:22:LL_PWR_SetRegulVoltageScaling 16 static
+stm32l0xx_ll_tim.h:886:22:LL_TIM_EnableCounter 16 static
+stm32l0xx_ll_tim.h:1066:22:LL_TIM_EnableARRPreload 16 static
+stm32l0xx_ll_tim.h:2201:22:LL_TIM_SetClockSource 16 static
+stm32l0xx_ll_tim.h:2247:22:LL_TIM_SetTriggerOutput 16 static
+stm32l0xx_ll_tim.h:2313:22:LL_TIM_DisableMasterSlaveMode 16 static
+stm32l0xx_ll_tim.h:2777:22:LL_TIM_EnableIT_UPDATE 16 static
+stm32l0xx_ll_gpio.h:844:22:LL_GPIO_SetOutputPin 16 static
+stm32l0xx_ll_gpio.h:873:22:LL_GPIO_ResetOutputPin 16 static
+main.c:136:5:main 24 static
+main.c:365:6:SystemClock_Config 8 static
+main.c:411:13:MX_I2C1_Init 72 static
+main.c:474:13:MX_LPUART1_UART_Init 64 static
+main.c:557:13:MX_TIM21_Init 24 static
+main.c:596:13:MX_GPIO_Init 32 static
+main.c:639:6:LPUART1_TX_Buffer 24 static,ignoring_inline_asm
+main.c:650:8:uart_disable_interrupts 8 static
+main.c:659:8:uart_enable_interrupts 8 static
+main.c:668:8:modbus_slave_callback 32 static
+main.c:787:8:modbus_transmit_function 16 static
+main.c:799:6:Error_Handler 8 static,ignoring_inline_asm
diff --git a/fw_old/Debug/Core/Src/modbus.d b/fw_old/Debug/Core/Src/modbus.d
new file mode 100644
index 0000000..0071433
--- /dev/null
+++ b/fw_old/Debug/Core/Src/modbus.d
@@ -0,0 +1,3 @@
+Core/Src/modbus.o: ../Core/Src/modbus.c ../Core/Inc/modbus.h
+
+../Core/Inc/modbus.h:
diff --git a/fw_old/Debug/Core/Src/modbus.o b/fw_old/Debug/Core/Src/modbus.o
new file mode 100644
index 0000000..26787ca
Binary files /dev/null and b/fw_old/Debug/Core/Src/modbus.o differ
diff --git a/fw_old/Debug/Core/Src/modbus.su b/fw_old/Debug/Core/Src/modbus.su
new file mode 100644
index 0000000..4cd2b0a
--- /dev/null
+++ b/fw_old/Debug/Core/Src/modbus.su
@@ -0,0 +1,4 @@
+modbus.c:30:10:modbus_CRC16 32 static
+modbus.c:56:8:modbus_copy_reply_to_buffer 40 static
+modbus.c:108:8:modbus_slave_set_address 16 static
+modbus.c:118:8:modbus_slave_process_msg 312 static
diff --git a/fw_old/Debug/Core/Src/scd4x.d b/fw_old/Debug/Core/Src/scd4x.d
new file mode 100644
index 0000000..f1f1738
--- /dev/null
+++ b/fw_old/Debug/Core/Src/scd4x.d
@@ -0,0 +1,82 @@
+Core/Src/scd4x.o: ../Core/Src/scd4x.c ../Core/Inc/scd4x.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_i2c.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h \
+ ../Drivers/CMSIS/Include/core_cm0plus.h \
+ ../Drivers/CMSIS/Include/cmsis_version.h \
+ ../Drivers/CMSIS/Include/cmsis_compiler.h \
+ ../Drivers/CMSIS/Include/cmsis_gcc.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_utils.h \
+ ../Core/Inc/i2c.h ../Core/Inc/crc8.h ../Core/Inc/main.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_lpuart.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_rcc.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_crs.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_bus.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_system.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_exti.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_cortex.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_pwr.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_dma.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_tim.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_gpio.h \
+ ../Core/Inc/scd4x.h ../Core/Inc/sht4x.h ../Core/Inc/sps30.h \
+ ../Core/Inc/modbus.h ../Core/Inc/config.h
+
+../Core/Inc/scd4x.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_i2c.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h:
+
+../Drivers/CMSIS/Include/core_cm0plus.h:
+
+../Drivers/CMSIS/Include/cmsis_version.h:
+
+../Drivers/CMSIS/Include/cmsis_compiler.h:
+
+../Drivers/CMSIS/Include/cmsis_gcc.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_utils.h:
+
+../Core/Inc/i2c.h:
+
+../Core/Inc/crc8.h:
+
+../Core/Inc/main.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_lpuart.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_rcc.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_crs.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_bus.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_system.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_exti.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_cortex.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_pwr.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_dma.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_tim.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_gpio.h:
+
+../Core/Inc/scd4x.h:
+
+../Core/Inc/sht4x.h:
+
+../Core/Inc/sps30.h:
+
+../Core/Inc/modbus.h:
+
+../Core/Inc/config.h:
diff --git a/fw_old/Debug/Core/Src/scd4x.o b/fw_old/Debug/Core/Src/scd4x.o
new file mode 100644
index 0000000..235b75e
Binary files /dev/null and b/fw_old/Debug/Core/Src/scd4x.o differ
diff --git a/fw_old/Debug/Core/Src/scd4x.su b/fw_old/Debug/Core/Src/scd4x.su
new file mode 100644
index 0000000..ef218a4
--- /dev/null
+++ b/fw_old/Debug/Core/Src/scd4x.su
@@ -0,0 +1,6 @@
+scd4x.c:11:8:scd4x_send_cmd 56 static
+scd4x.c:27:8:scd4x_read_data 16 static
+scd4x.c:32:8:scd4x_start_periodic_measurement 8 static
+scd4x.c:37:8:scd4x_stop_periodic_measurement 8 static
+scd4x.c:42:8:scd4x_perform_factory_reset 8 static
+scd4x.c:47:8:scd4x_read_measurement 88 static
diff --git a/fw_old/Debug/Core/Src/sht4x.d b/fw_old/Debug/Core/Src/sht4x.d
new file mode 100644
index 0000000..e233714
--- /dev/null
+++ b/fw_old/Debug/Core/Src/sht4x.d
@@ -0,0 +1,82 @@
+Core/Src/sht4x.o: ../Core/Src/sht4x.c ../Core/Inc/sht4x.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_i2c.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h \
+ ../Drivers/CMSIS/Include/core_cm0plus.h \
+ ../Drivers/CMSIS/Include/cmsis_version.h \
+ ../Drivers/CMSIS/Include/cmsis_compiler.h \
+ ../Drivers/CMSIS/Include/cmsis_gcc.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_utils.h \
+ ../Core/Inc/i2c.h ../Core/Inc/crc8.h ../Core/Inc/main.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_lpuart.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_rcc.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_crs.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_bus.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_system.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_exti.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_cortex.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_pwr.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_dma.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_tim.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_gpio.h \
+ ../Core/Inc/scd4x.h ../Core/Inc/sht4x.h ../Core/Inc/sps30.h \
+ ../Core/Inc/modbus.h ../Core/Inc/config.h
+
+../Core/Inc/sht4x.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_i2c.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h:
+
+../Drivers/CMSIS/Include/core_cm0plus.h:
+
+../Drivers/CMSIS/Include/cmsis_version.h:
+
+../Drivers/CMSIS/Include/cmsis_compiler.h:
+
+../Drivers/CMSIS/Include/cmsis_gcc.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_utils.h:
+
+../Core/Inc/i2c.h:
+
+../Core/Inc/crc8.h:
+
+../Core/Inc/main.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_lpuart.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_rcc.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_crs.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_bus.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_system.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_exti.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_cortex.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_pwr.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_dma.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_tim.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_gpio.h:
+
+../Core/Inc/scd4x.h:
+
+../Core/Inc/sht4x.h:
+
+../Core/Inc/sps30.h:
+
+../Core/Inc/modbus.h:
+
+../Core/Inc/config.h:
diff --git a/fw_old/Debug/Core/Src/sht4x.o b/fw_old/Debug/Core/Src/sht4x.o
new file mode 100644
index 0000000..6547f66
Binary files /dev/null and b/fw_old/Debug/Core/Src/sht4x.o differ
diff --git a/fw_old/Debug/Core/Src/sht4x.su b/fw_old/Debug/Core/Src/sht4x.su
new file mode 100644
index 0000000..71c97c2
--- /dev/null
+++ b/fw_old/Debug/Core/Src/sht4x.su
@@ -0,0 +1,3 @@
+sht4x.c:11:8:sht4x_send_cmd 16 static
+sht4x.c:16:8:sht4x_read_data 16 static
+sht4x.c:21:8:sht4x_measure 80 static
diff --git a/fw_old/Debug/Core/Src/sps30.d b/fw_old/Debug/Core/Src/sps30.d
new file mode 100644
index 0000000..741ba07
--- /dev/null
+++ b/fw_old/Debug/Core/Src/sps30.d
@@ -0,0 +1,35 @@
+Core/Src/sps30.o: ../Core/Src/sps30.c ../Core/Inc/sps30.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_i2c.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h \
+ ../Drivers/CMSIS/Include/core_cm0plus.h \
+ ../Drivers/CMSIS/Include/cmsis_version.h \
+ ../Drivers/CMSIS/Include/cmsis_compiler.h \
+ ../Drivers/CMSIS/Include/cmsis_gcc.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_utils.h \
+ ../Core/Inc/i2c.h ../Core/Inc/crc8.h
+
+../Core/Inc/sps30.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_i2c.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h:
+
+../Drivers/CMSIS/Include/core_cm0plus.h:
+
+../Drivers/CMSIS/Include/cmsis_version.h:
+
+../Drivers/CMSIS/Include/cmsis_compiler.h:
+
+../Drivers/CMSIS/Include/cmsis_gcc.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_utils.h:
+
+../Core/Inc/i2c.h:
+
+../Core/Inc/crc8.h:
diff --git a/fw_old/Debug/Core/Src/sps30.o b/fw_old/Debug/Core/Src/sps30.o
new file mode 100644
index 0000000..26510c8
Binary files /dev/null and b/fw_old/Debug/Core/Src/sps30.o differ
diff --git a/fw_old/Debug/Core/Src/sps30.su b/fw_old/Debug/Core/Src/sps30.su
new file mode 100644
index 0000000..2129e9d
--- /dev/null
+++ b/fw_old/Debug/Core/Src/sps30.su
@@ -0,0 +1,11 @@
+sps30.c:10:8:sps30_send_cmd 56 static
+sps30.c:27:8:sps30_start_measurement 16 static
+sps30.c:49:8:sps30_stop_measurement 8 static
+sps30.c:54:8:sps30_read_measured_values 88 static
+sps30.c:99:8:sps30_sleep 8 static
+sps30.c:104:8:sps30_wake_up 8 static
+sps30.c:110:8:sps30_start_fan_cleaning 8 static
+sps30.c:115:8:sps30_reset 8 static
+sps30.c:121:8:sps30_read_status_register 32 static
+sps30.c:146:8:sps30_read_firmware_version 32 static
+sps30.c:179:9:calculate_crc 24 static
diff --git a/fw_old/Debug/Core/Src/stm32l0xx_it.d b/fw_old/Debug/Core/Src/stm32l0xx_it.d
new file mode 100644
index 0000000..112a494
--- /dev/null
+++ b/fw_old/Debug/Core/Src/stm32l0xx_it.d
@@ -0,0 +1,84 @@
+Core/Src/stm32l0xx_it.o: ../Core/Src/stm32l0xx_it.c ../Core/Inc/main.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_i2c.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h \
+ ../Drivers/CMSIS/Include/core_cm0plus.h \
+ ../Drivers/CMSIS/Include/cmsis_version.h \
+ ../Drivers/CMSIS/Include/cmsis_compiler.h \
+ ../Drivers/CMSIS/Include/cmsis_gcc.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_lpuart.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_rcc.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_crs.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_bus.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_system.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_exti.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_cortex.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_utils.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_pwr.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_dma.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_tim.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_gpio.h \
+ ../Core/Inc/i2c.h ../Core/Inc/scd4x.h ../Core/Inc/crc8.h \
+ ../Core/Inc/sht4x.h ../Core/Inc/sps30.h ../Core/Inc/modbus.h \
+ ../Core/Inc/config.h ../Core/Inc/stm32l0xx_it.h ../Core/Inc/modbus.h
+
+../Core/Inc/main.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_i2c.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h:
+
+../Drivers/CMSIS/Include/core_cm0plus.h:
+
+../Drivers/CMSIS/Include/cmsis_version.h:
+
+../Drivers/CMSIS/Include/cmsis_compiler.h:
+
+../Drivers/CMSIS/Include/cmsis_gcc.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_lpuart.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_rcc.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_crs.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_bus.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_system.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_exti.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_cortex.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_utils.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_pwr.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_dma.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_tim.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_gpio.h:
+
+../Core/Inc/i2c.h:
+
+../Core/Inc/scd4x.h:
+
+../Core/Inc/crc8.h:
+
+../Core/Inc/sht4x.h:
+
+../Core/Inc/sps30.h:
+
+../Core/Inc/modbus.h:
+
+../Core/Inc/config.h:
+
+../Core/Inc/stm32l0xx_it.h:
+
+../Core/Inc/modbus.h:
diff --git a/fw_old/Debug/Core/Src/stm32l0xx_it.o b/fw_old/Debug/Core/Src/stm32l0xx_it.o
new file mode 100644
index 0000000..9a8a2b5
Binary files /dev/null and b/fw_old/Debug/Core/Src/stm32l0xx_it.o differ
diff --git a/fw_old/Debug/Core/Src/stm32l0xx_it.su b/fw_old/Debug/Core/Src/stm32l0xx_it.su
new file mode 100644
index 0000000..b431f6f
--- /dev/null
+++ b/fw_old/Debug/Core/Src/stm32l0xx_it.su
@@ -0,0 +1,15 @@
+stm32l0xx_ll_lpuart.h:1367:26:LL_LPUART_IsActiveFlag_IDLE 16 static
+stm32l0xx_ll_lpuart.h:1378:26:LL_LPUART_IsActiveFlag_RXNE 16 static
+stm32l0xx_ll_lpuart.h:1555:22:LL_LPUART_ClearFlag_IDLE 16 static
+stm32l0xx_ll_lpuart.h:1833:26:LL_LPUART_IsEnabledIT_IDLE 16 static
+stm32l0xx_ll_lpuart.h:1845:26:LL_LPUART_IsEnabledIT_RXNE 16 static
+stm32l0xx_ll_lpuart.h:2090:26:LL_LPUART_ReceiveData9 16 static
+stm32l0xx_ll_tim.h:2550:22:LL_TIM_ClearFlag_UPDATE 16 static
+stm32l0xx_it.c:76:6:NMI_Handler 8 static
+stm32l0xx_it.c:91:6:HardFault_Handler 8 static
+stm32l0xx_it.c:106:6:SVC_Handler 8 static
+stm32l0xx_it.c:119:6:PendSV_Handler 8 static
+stm32l0xx_it.c:132:6:SysTick_Handler 8 static
+stm32l0xx_it.c:152:6:TIM21_IRQHandler 8 static
+stm32l0xx_it.c:167:6:LPUART1_IRQHandler 8 static
+stm32l0xx_it.c:198:6:LPUART1_CharReception_Callback 24 static
diff --git a/fw_old/Debug/Core/Src/subdir.mk b/fw_old/Debug/Core/Src/subdir.mk
new file mode 100644
index 0000000..cc7e696
--- /dev/null
+++ b/fw_old/Debug/Core/Src/subdir.mk
@@ -0,0 +1,53 @@
+################################################################################
+# Automatically-generated file. Do not edit!
+# Toolchain: GNU Tools for STM32 (9-2020-q2-update)
+################################################################################
+
+# Add inputs and outputs from these tool invocations to the build variables
+C_SRCS += \
+../Core/Src/config.c \
+../Core/Src/crc8.c \
+../Core/Src/i2c.c \
+../Core/Src/main.c \
+../Core/Src/modbus.c \
+../Core/Src/scd4x.c \
+../Core/Src/sht4x.c \
+../Core/Src/sps30.c \
+../Core/Src/stm32l0xx_it.c \
+../Core/Src/syscalls.c \
+../Core/Src/sysmem.c \
+../Core/Src/system_stm32l0xx.c
+
+OBJS += \
+./Core/Src/config.o \
+./Core/Src/crc8.o \
+./Core/Src/i2c.o \
+./Core/Src/main.o \
+./Core/Src/modbus.o \
+./Core/Src/scd4x.o \
+./Core/Src/sht4x.o \
+./Core/Src/sps30.o \
+./Core/Src/stm32l0xx_it.o \
+./Core/Src/syscalls.o \
+./Core/Src/sysmem.o \
+./Core/Src/system_stm32l0xx.o
+
+C_DEPS += \
+./Core/Src/config.d \
+./Core/Src/crc8.d \
+./Core/Src/i2c.d \
+./Core/Src/main.d \
+./Core/Src/modbus.d \
+./Core/Src/scd4x.d \
+./Core/Src/sht4x.d \
+./Core/Src/sps30.d \
+./Core/Src/stm32l0xx_it.d \
+./Core/Src/syscalls.d \
+./Core/Src/sysmem.d \
+./Core/Src/system_stm32l0xx.d
+
+
+# Each subdirectory must supply rules for building sources it contributes
+Core/Src/%.o: ../Core/Src/%.c Core/Src/subdir.mk
+ arm-none-eabi-gcc "$<" -mcpu=cortex-m0plus -std=gnu11 -g3 -DSTM32L011xx -DDEBUG -DUSE_FULL_LL_DRIVER -DHSE_VALUE=8000000 -DHSE_STARTUP_TIMEOUT=100 -DLSE_STARTUP_TIMEOUT=5000 -DLSE_VALUE=32768 -DMSI_VALUE=2097000 -DHSI_VALUE=16000000 -DLSI_VALUE=37000 -DVDD_VALUE=3300 -DPREFETCH_ENABLE=0 -DINSTRUCTION_CACHE_ENABLE=1 -DDATA_CACHE_ENABLE=1 -c -I../Core/Inc -I../Drivers/STM32L0xx_HAL_Driver/Inc -I../Drivers/CMSIS/Device/ST/STM32L0xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@"
+
diff --git a/fw_old/Debug/Core/Src/syscalls.d b/fw_old/Debug/Core/Src/syscalls.d
new file mode 100644
index 0000000..8667c70
--- /dev/null
+++ b/fw_old/Debug/Core/Src/syscalls.d
@@ -0,0 +1 @@
+Core/Src/syscalls.o: ../Core/Src/syscalls.c
diff --git a/fw_old/Debug/Core/Src/syscalls.o b/fw_old/Debug/Core/Src/syscalls.o
new file mode 100644
index 0000000..6db9b9f
Binary files /dev/null and b/fw_old/Debug/Core/Src/syscalls.o differ
diff --git a/fw_old/Debug/Core/Src/syscalls.su b/fw_old/Debug/Core/Src/syscalls.su
new file mode 100644
index 0000000..2a6e0d7
--- /dev/null
+++ b/fw_old/Debug/Core/Src/syscalls.su
@@ -0,0 +1,18 @@
+syscalls.c:48:6:initialise_monitor_handles 8 static
+syscalls.c:52:5:_getpid 8 static
+syscalls.c:57:5:_kill 16 static
+syscalls.c:63:6:_exit 16 static
+syscalls.c:69:27:_read 32 static
+syscalls.c:81:27:_write 32 static
+syscalls.c:92:5:_close 16 static
+syscalls.c:98:5:_fstat 16 static
+syscalls.c:104:5:_isatty 16 static
+syscalls.c:109:5:_lseek 24 static
+syscalls.c:114:5:_open 20 static
+syscalls.c:120:5:_wait 16 static
+syscalls.c:126:5:_unlink 16 static
+syscalls.c:132:5:_times 16 static
+syscalls.c:137:5:_stat 16 static
+syscalls.c:143:5:_link 16 static
+syscalls.c:149:5:_fork 8 static
+syscalls.c:155:5:_execve 24 static
diff --git a/fw_old/Debug/Core/Src/sysmem.d b/fw_old/Debug/Core/Src/sysmem.d
new file mode 100644
index 0000000..74fecf9
--- /dev/null
+++ b/fw_old/Debug/Core/Src/sysmem.d
@@ -0,0 +1 @@
+Core/Src/sysmem.o: ../Core/Src/sysmem.c
diff --git a/fw_old/Debug/Core/Src/sysmem.o b/fw_old/Debug/Core/Src/sysmem.o
new file mode 100644
index 0000000..0fffafb
Binary files /dev/null and b/fw_old/Debug/Core/Src/sysmem.o differ
diff --git a/fw_old/Debug/Core/Src/sysmem.su b/fw_old/Debug/Core/Src/sysmem.su
new file mode 100644
index 0000000..4474c68
--- /dev/null
+++ b/fw_old/Debug/Core/Src/sysmem.su
@@ -0,0 +1 @@
+sysmem.c:54:7:_sbrk 32 static
diff --git a/fw_old/Debug/Core/Src/system_stm32l0xx.d b/fw_old/Debug/Core/Src/system_stm32l0xx.d
new file mode 100644
index 0000000..92dd183
--- /dev/null
+++ b/fw_old/Debug/Core/Src/system_stm32l0xx.d
@@ -0,0 +1,22 @@
+Core/Src/system_stm32l0xx.o: ../Core/Src/system_stm32l0xx.c \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h \
+ ../Drivers/CMSIS/Include/core_cm0plus.h \
+ ../Drivers/CMSIS/Include/cmsis_version.h \
+ ../Drivers/CMSIS/Include/cmsis_compiler.h \
+ ../Drivers/CMSIS/Include/cmsis_gcc.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h:
+
+../Drivers/CMSIS/Include/core_cm0plus.h:
+
+../Drivers/CMSIS/Include/cmsis_version.h:
+
+../Drivers/CMSIS/Include/cmsis_compiler.h:
+
+../Drivers/CMSIS/Include/cmsis_gcc.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h:
diff --git a/fw_old/Debug/Core/Src/system_stm32l0xx.o b/fw_old/Debug/Core/Src/system_stm32l0xx.o
new file mode 100644
index 0000000..8cbfec1
Binary files /dev/null and b/fw_old/Debug/Core/Src/system_stm32l0xx.o differ
diff --git a/fw_old/Debug/Core/Src/system_stm32l0xx.su b/fw_old/Debug/Core/Src/system_stm32l0xx.su
new file mode 100644
index 0000000..abf8ac4
--- /dev/null
+++ b/fw_old/Debug/Core/Src/system_stm32l0xx.su
@@ -0,0 +1,2 @@
+system_stm32l0xx.c:154:6:SystemInit 8 static
+system_stm32l0xx.c:200:6:SystemCoreClockUpdate 32 static
diff --git a/fw_old/Debug/Core/Startup/startup_stm32l011f4ux.d b/fw_old/Debug/Core/Startup/startup_stm32l011f4ux.d
new file mode 100644
index 0000000..7f6eea2
--- /dev/null
+++ b/fw_old/Debug/Core/Startup/startup_stm32l011f4ux.d
@@ -0,0 +1,2 @@
+Core/Startup/startup_stm32l011f4ux.o: \
+ ../Core/Startup/startup_stm32l011f4ux.s
diff --git a/fw_old/Debug/Core/Startup/startup_stm32l011f4ux.o b/fw_old/Debug/Core/Startup/startup_stm32l011f4ux.o
new file mode 100644
index 0000000..32ecc20
Binary files /dev/null and b/fw_old/Debug/Core/Startup/startup_stm32l011f4ux.o differ
diff --git a/fw_old/Debug/Core/Startup/subdir.mk b/fw_old/Debug/Core/Startup/subdir.mk
new file mode 100644
index 0000000..08b98d0
--- /dev/null
+++ b/fw_old/Debug/Core/Startup/subdir.mk
@@ -0,0 +1,20 @@
+################################################################################
+# Automatically-generated file. Do not edit!
+# Toolchain: GNU Tools for STM32 (9-2020-q2-update)
+################################################################################
+
+# Add inputs and outputs from these tool invocations to the build variables
+S_SRCS += \
+../Core/Startup/startup_stm32l011f4ux.s
+
+OBJS += \
+./Core/Startup/startup_stm32l011f4ux.o
+
+S_DEPS += \
+./Core/Startup/startup_stm32l011f4ux.d
+
+
+# Each subdirectory must supply rules for building sources it contributes
+Core/Startup/%.o: ../Core/Startup/%.s Core/Startup/subdir.mk
+ arm-none-eabi-gcc -mcpu=cortex-m0plus -g3 -c -x assembler-with-cpp -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@" "$<"
+
diff --git a/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_dma.d b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_dma.d
new file mode 100644
index 0000000..737ad9a
--- /dev/null
+++ b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_dma.d
@@ -0,0 +1,29 @@
+Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_dma.o: \
+ ../Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_dma.c \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_dma.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h \
+ ../Drivers/CMSIS/Include/core_cm0plus.h \
+ ../Drivers/CMSIS/Include/cmsis_version.h \
+ ../Drivers/CMSIS/Include/cmsis_compiler.h \
+ ../Drivers/CMSIS/Include/cmsis_gcc.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_bus.h
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_dma.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h:
+
+../Drivers/CMSIS/Include/core_cm0plus.h:
+
+../Drivers/CMSIS/Include/cmsis_version.h:
+
+../Drivers/CMSIS/Include/cmsis_compiler.h:
+
+../Drivers/CMSIS/Include/cmsis_gcc.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_bus.h:
diff --git a/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_dma.o b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_dma.o
new file mode 100644
index 0000000..cd66dc0
Binary files /dev/null and b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_dma.o differ
diff --git a/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_dma.su b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_dma.su
new file mode 100644
index 0000000..da292ac
--- /dev/null
+++ b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_dma.su
@@ -0,0 +1,15 @@
+stm32l0xx_ll_dma.h:580:22:LL_DMA_ConfigTransfer 24 static
+stm32l0xx_ll_dma.h:933:22:LL_DMA_SetDataLength 24 static
+stm32l0xx_ll_dma.h:1018:22:LL_DMA_SetMemoryAddress 24 static
+stm32l0xx_ll_dma.h:1040:22:LL_DMA_SetPeriphAddress 24 static
+stm32l0xx_ll_dma.h:1207:22:LL_DMA_SetPeriphRequest 24 static
+stm32l0xx_ll_dma.h:1593:22:LL_DMA_ClearFlag_GI1 16 static
+stm32l0xx_ll_dma.h:1604:22:LL_DMA_ClearFlag_GI2 16 static
+stm32l0xx_ll_dma.h:1615:22:LL_DMA_ClearFlag_GI3 16 static
+stm32l0xx_ll_dma.h:1626:22:LL_DMA_ClearFlag_GI4 16 static
+stm32l0xx_ll_dma.h:1637:22:LL_DMA_ClearFlag_GI5 16 static
+stm32l0xx_ll_bus.h:301:22:LL_AHB1_GRP1_ForceReset 16 static
+stm32l0xx_ll_bus.h:326:22:LL_AHB1_GRP1_ReleaseReset 16 static
+stm32l0xx_ll_dma.c:150:13:LL_DMA_DeInit 24 static
+stm32l0xx_ll_dma.c:275:13:LL_DMA_Init 24 static
+stm32l0xx_ll_dma.c:343:6:LL_DMA_StructInit 16 static
diff --git a/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_exti.d b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_exti.d
new file mode 100644
index 0000000..2cc017f
--- /dev/null
+++ b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_exti.d
@@ -0,0 +1,26 @@
+Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_exti.o: \
+ ../Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_exti.c \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_exti.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h \
+ ../Drivers/CMSIS/Include/core_cm0plus.h \
+ ../Drivers/CMSIS/Include/cmsis_version.h \
+ ../Drivers/CMSIS/Include/cmsis_compiler.h \
+ ../Drivers/CMSIS/Include/cmsis_gcc.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_exti.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h:
+
+../Drivers/CMSIS/Include/core_cm0plus.h:
+
+../Drivers/CMSIS/Include/cmsis_version.h:
+
+../Drivers/CMSIS/Include/cmsis_compiler.h:
+
+../Drivers/CMSIS/Include/cmsis_gcc.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h:
diff --git a/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_exti.o b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_exti.o
new file mode 100644
index 0000000..0b9bbda
Binary files /dev/null and b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_exti.o differ
diff --git a/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_exti.su b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_exti.su
new file mode 100644
index 0000000..bad8ae9
--- /dev/null
+++ b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_exti.su
@@ -0,0 +1,11 @@
+stm32l0xx_ll_exti.h:274:22:LL_EXTI_EnableIT_0_31 16 static
+stm32l0xx_ll_exti.h:322:22:LL_EXTI_DisableIT_0_31 16 static
+stm32l0xx_ll_exti.h:425:22:LL_EXTI_EnableEvent_0_31 16 static
+stm32l0xx_ll_exti.h:472:22:LL_EXTI_DisableEvent_0_31 16 static
+stm32l0xx_ll_exti.h:572:22:LL_EXTI_EnableRisingTrig_0_31 16 static
+stm32l0xx_ll_exti.h:618:22:LL_EXTI_DisableRisingTrig_0_31 16 static
+stm32l0xx_ll_exti.h:710:22:LL_EXTI_EnableFallingTrig_0_31 16 static
+stm32l0xx_ll_exti.h:754:22:LL_EXTI_DisableFallingTrig_0_31 16 static
+stm32l0xx_ll_exti.c:80:10:LL_EXTI_DeInit 8 static
+stm32l0xx_ll_exti.c:105:10:LL_EXTI_Init 24 static
+stm32l0xx_ll_exti.c:186:6:LL_EXTI_StructInit 16 static
diff --git a/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_gpio.d b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_gpio.d
new file mode 100644
index 0000000..84a1bfe
--- /dev/null
+++ b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_gpio.d
@@ -0,0 +1,29 @@
+Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_gpio.o: \
+ ../Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_gpio.c \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_gpio.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h \
+ ../Drivers/CMSIS/Include/core_cm0plus.h \
+ ../Drivers/CMSIS/Include/cmsis_version.h \
+ ../Drivers/CMSIS/Include/cmsis_compiler.h \
+ ../Drivers/CMSIS/Include/cmsis_gcc.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_bus.h
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_gpio.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h:
+
+../Drivers/CMSIS/Include/core_cm0plus.h:
+
+../Drivers/CMSIS/Include/cmsis_version.h:
+
+../Drivers/CMSIS/Include/cmsis_compiler.h:
+
+../Drivers/CMSIS/Include/cmsis_gcc.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_bus.h:
diff --git a/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_gpio.o b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_gpio.o
new file mode 100644
index 0000000..d500515
Binary files /dev/null and b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_gpio.o differ
diff --git a/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_gpio.su b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_gpio.su
new file mode 100644
index 0000000..85319e8
--- /dev/null
+++ b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_gpio.su
@@ -0,0 +1,11 @@
+stm32l0xx_ll_gpio.h:270:22:LL_GPIO_SetPinMode 24 static
+stm32l0xx_ll_gpio.h:338:22:LL_GPIO_SetPinOutputType 24 static
+stm32l0xx_ll_gpio.h:409:22:LL_GPIO_SetPinSpeed 24 static
+stm32l0xx_ll_gpio.h:478:22:LL_GPIO_SetPinPull 24 static
+stm32l0xx_ll_gpio.h:541:22:LL_GPIO_SetAFPin_0_7 24 static
+stm32l0xx_ll_gpio.h:602:22:LL_GPIO_SetAFPin_8_15 24 static
+stm32l0xx_ll_bus.h:1064:22:LL_IOP_GRP1_ForceReset 16 static
+stm32l0xx_ll_bus.h:1089:22:LL_IOP_GRP1_ReleaseReset 16 static
+stm32l0xx_ll_gpio.c:96:13:LL_GPIO_DeInit 24 static
+stm32l0xx_ll_gpio.c:157:13:LL_GPIO_Init 24 static
+stm32l0xx_ll_gpio.c:231:6:LL_GPIO_StructInit 16 static
diff --git a/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_i2c.d b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_i2c.d
new file mode 100644
index 0000000..94e870b
--- /dev/null
+++ b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_i2c.d
@@ -0,0 +1,29 @@
+Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_i2c.o: \
+ ../Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_i2c.c \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_i2c.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h \
+ ../Drivers/CMSIS/Include/core_cm0plus.h \
+ ../Drivers/CMSIS/Include/cmsis_version.h \
+ ../Drivers/CMSIS/Include/cmsis_compiler.h \
+ ../Drivers/CMSIS/Include/cmsis_gcc.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_bus.h
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_i2c.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h:
+
+../Drivers/CMSIS/Include/core_cm0plus.h:
+
+../Drivers/CMSIS/Include/cmsis_version.h:
+
+../Drivers/CMSIS/Include/cmsis_compiler.h:
+
+../Drivers/CMSIS/Include/cmsis_gcc.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_bus.h:
diff --git a/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_i2c.o b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_i2c.o
new file mode 100644
index 0000000..2dad507
Binary files /dev/null and b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_i2c.o differ
diff --git a/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_i2c.su b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_i2c.su
new file mode 100644
index 0000000..9e7d505
--- /dev/null
+++ b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_i2c.su
@@ -0,0 +1,14 @@
+stm32l0xx_ll_i2c.h:391:22:LL_I2C_Enable 16 static
+stm32l0xx_ll_i2c.h:405:22:LL_I2C_Disable 16 static
+stm32l0xx_ll_i2c.h:436:22:LL_I2C_ConfigFilters 24 static
+stm32l0xx_ll_i2c.h:779:22:LL_I2C_SetOwnAddress1 24 static
+stm32l0xx_ll_i2c.h:790:22:LL_I2C_EnableOwnAddress1 16 static
+stm32l0xx_ll_i2c.h:801:22:LL_I2C_DisableOwnAddress1 16 static
+stm32l0xx_ll_i2c.h:882:22:LL_I2C_SetTiming 16 static
+stm32l0xx_ll_i2c.h:956:22:LL_I2C_SetMode 16 static
+stm32l0xx_ll_i2c.h:1935:22:LL_I2C_AcknowledgeNextData 16 static
+stm32l0xx_ll_bus.h:595:22:LL_APB1_GRP1_ForceReset 16 static
+stm32l0xx_ll_bus.h:646:22:LL_APB1_GRP1_ReleaseReset 16 static
+stm32l0xx_ll_i2c.c:87:13:LL_I2C_DeInit 24 static
+stm32l0xx_ll_i2c.c:139:13:LL_I2C_Init 16 static
+stm32l0xx_ll_i2c.c:207:6:LL_I2C_StructInit 16 static
diff --git a/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_lpuart.d b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_lpuart.d
new file mode 100644
index 0000000..45688ed
--- /dev/null
+++ b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_lpuart.d
@@ -0,0 +1,32 @@
+Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_lpuart.o: \
+ ../Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_lpuart.c \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_lpuart.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h \
+ ../Drivers/CMSIS/Include/core_cm0plus.h \
+ ../Drivers/CMSIS/Include/cmsis_version.h \
+ ../Drivers/CMSIS/Include/cmsis_compiler.h \
+ ../Drivers/CMSIS/Include/cmsis_gcc.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_rcc.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_bus.h
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_lpuart.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h:
+
+../Drivers/CMSIS/Include/core_cm0plus.h:
+
+../Drivers/CMSIS/Include/cmsis_version.h:
+
+../Drivers/CMSIS/Include/cmsis_compiler.h:
+
+../Drivers/CMSIS/Include/cmsis_gcc.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_rcc.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_bus.h:
diff --git a/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_lpuart.o b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_lpuart.o
new file mode 100644
index 0000000..81748bd
Binary files /dev/null and b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_lpuart.o differ
diff --git a/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_lpuart.su b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_lpuart.su
new file mode 100644
index 0000000..c33c786
--- /dev/null
+++ b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_lpuart.su
@@ -0,0 +1,9 @@
+stm32l0xx_ll_lpuart.h:426:26:LL_LPUART_IsEnabled 16 static
+stm32l0xx_ll_lpuart.h:715:22:LL_LPUART_SetStopBitsLength 16 static
+stm32l0xx_ll_lpuart.h:1019:22:LL_LPUART_SetHWFlowCtrl 16 static
+stm32l0xx_ll_lpuart.h:1118:22:LL_LPUART_SetBaudRate 56 static
+stm32l0xx_ll_bus.h:595:22:LL_APB1_GRP1_ForceReset 16 static
+stm32l0xx_ll_bus.h:646:22:LL_APB1_GRP1_ReleaseReset 16 static
+stm32l0xx_ll_lpuart.c:117:13:LL_LPUART_DeInit 24 static
+stm32l0xx_ll_lpuart.c:155:13:LL_LPUART_Init 32 static
+stm32l0xx_ll_lpuart.c:232:6:LL_LPUART_StructInit 16 static
diff --git a/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_pwr.d b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_pwr.d
new file mode 100644
index 0000000..b22a85d
--- /dev/null
+++ b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_pwr.d
@@ -0,0 +1,29 @@
+Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_pwr.o: \
+ ../Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_pwr.c \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_pwr.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h \
+ ../Drivers/CMSIS/Include/core_cm0plus.h \
+ ../Drivers/CMSIS/Include/cmsis_version.h \
+ ../Drivers/CMSIS/Include/cmsis_compiler.h \
+ ../Drivers/CMSIS/Include/cmsis_gcc.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_bus.h
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_pwr.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h:
+
+../Drivers/CMSIS/Include/core_cm0plus.h:
+
+../Drivers/CMSIS/Include/cmsis_version.h:
+
+../Drivers/CMSIS/Include/cmsis_compiler.h:
+
+../Drivers/CMSIS/Include/cmsis_gcc.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_bus.h:
diff --git a/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_pwr.o b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_pwr.o
new file mode 100644
index 0000000..2fddb2b
Binary files /dev/null and b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_pwr.o differ
diff --git a/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_pwr.su b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_pwr.su
new file mode 100644
index 0000000..c2f6d7c
--- /dev/null
+++ b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_pwr.su
@@ -0,0 +1,3 @@
+stm32l0xx_ll_bus.h:595:22:LL_APB1_GRP1_ForceReset 16 static
+stm32l0xx_ll_bus.h:646:22:LL_APB1_GRP1_ReleaseReset 16 static
+stm32l0xx_ll_pwr.c:56:13:LL_PWR_DeInit 8 static
diff --git a/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rcc.d b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rcc.d
new file mode 100644
index 0000000..748ea46
--- /dev/null
+++ b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rcc.d
@@ -0,0 +1,26 @@
+Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rcc.o: \
+ ../Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rcc.c \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_rcc.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h \
+ ../Drivers/CMSIS/Include/core_cm0plus.h \
+ ../Drivers/CMSIS/Include/cmsis_version.h \
+ ../Drivers/CMSIS/Include/cmsis_compiler.h \
+ ../Drivers/CMSIS/Include/cmsis_gcc.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_rcc.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h:
+
+../Drivers/CMSIS/Include/core_cm0plus.h:
+
+../Drivers/CMSIS/Include/cmsis_version.h:
+
+../Drivers/CMSIS/Include/cmsis_compiler.h:
+
+../Drivers/CMSIS/Include/cmsis_gcc.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h:
diff --git a/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rcc.o b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rcc.o
new file mode 100644
index 0000000..7b2205d
Binary files /dev/null and b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rcc.o differ
diff --git a/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rcc.su b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rcc.su
new file mode 100644
index 0000000..8b7b4b2
--- /dev/null
+++ b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rcc.su
@@ -0,0 +1,35 @@
+stm32l0xx_ll_rcc.h:705:22:LL_RCC_HSE_DisableBypass 8 static
+stm32l0xx_ll_rcc.h:802:26:LL_RCC_HSI_IsReady 8 static
+stm32l0xx_ll_rcc.h:893:22:LL_RCC_HSI_SetCalibTrimming 16 static
+stm32l0xx_ll_rcc.h:1097:26:LL_RCC_LSE_IsReady 8 static
+stm32l0xx_ll_rcc.h:1145:26:LL_RCC_LSI_IsReady 8 static
+stm32l0xx_ll_rcc.h:1163:22:LL_RCC_MSI_Enable 8 static
+stm32l0xx_ll_rcc.h:1183:26:LL_RCC_MSI_IsReady 8 static
+stm32l0xx_ll_rcc.h:1201:22:LL_RCC_MSI_SetRange 16 static
+stm32l0xx_ll_rcc.h:1218:26:LL_RCC_MSI_GetRange 8 static
+stm32l0xx_ll_rcc.h:1242:22:LL_RCC_MSI_SetCalibTrimming 16 static
+stm32l0xx_ll_rcc.h:1289:26:LL_RCC_GetSysClkSource 8 static
+stm32l0xx_ll_rcc.h:1360:26:LL_RCC_GetAHBPrescaler 8 static
+stm32l0xx_ll_rcc.h:1375:26:LL_RCC_GetAPB1Prescaler 8 static
+stm32l0xx_ll_rcc.h:1390:26:LL_RCC_GetAPB2Prescaler 8 static
+stm32l0xx_ll_rcc.h:1586:26:LL_RCC_GetUSARTClockSource 16 static
+stm32l0xx_ll_rcc.h:1604:26:LL_RCC_GetLPUARTClockSource 16 static
+stm32l0xx_ll_rcc.h:1625:26:LL_RCC_GetI2CClockSource 16 static
+stm32l0xx_ll_rcc.h:1641:26:LL_RCC_GetLPTIMClockSource 16 static
+stm32l0xx_ll_rcc.h:1805:26:LL_RCC_PLL_IsReady 8 static
+stm32l0xx_ll_rcc.h:1859:26:LL_RCC_PLL_GetMainSource 8 static
+stm32l0xx_ll_rcc.h:1878:26:LL_RCC_PLL_GetMultiplicator 8 static
+stm32l0xx_ll_rcc.h:1891:26:LL_RCC_PLL_GetDivider 8 static
+stm32l0xx_ll_rcc.h:2097:26:LL_RCC_IsActiveFlag_HSIDIV 8 static
+stm32l0xx_ll_rcc.h:2189:22:LL_RCC_ClearResetFlags 8 static
+stm32l0xx_ll_rcc.c:112:13:LL_RCC_DeInit 16 static,ignoring_inline_asm
+stm32l0xx_ll_rcc.c:222:6:LL_RCC_GetSystemClocksFreq 16 static
+stm32l0xx_ll_rcc.c:247:10:LL_RCC_GetUSARTClockFreq 24 static
+stm32l0xx_ll_rcc.c:344:10:LL_RCC_GetI2CClockFreq 24 static
+stm32l0xx_ll_rcc.c:423:10:LL_RCC_GetLPUARTClockFreq 24 static
+stm32l0xx_ll_rcc.c:474:10:LL_RCC_GetLPTIMClockFreq 24 static
+stm32l0xx_ll_rcc.c:579:10:RCC_GetSystemClockFreq 16 static
+stm32l0xx_ll_rcc.c:622:10:RCC_GetHCLKClockFreq 16 static
+stm32l0xx_ll_rcc.c:633:10:RCC_GetPCLK1ClockFreq 16 static
+stm32l0xx_ll_rcc.c:644:10:RCC_GetPCLK2ClockFreq 16 static
+stm32l0xx_ll_rcc.c:654:10:RCC_PLL_GetFreqDomain_SYS 24 static
diff --git a/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_tim.d b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_tim.d
new file mode 100644
index 0000000..d5b46ce
--- /dev/null
+++ b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_tim.d
@@ -0,0 +1,29 @@
+Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_tim.o: \
+ ../Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_tim.c \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_tim.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h \
+ ../Drivers/CMSIS/Include/core_cm0plus.h \
+ ../Drivers/CMSIS/Include/cmsis_version.h \
+ ../Drivers/CMSIS/Include/cmsis_compiler.h \
+ ../Drivers/CMSIS/Include/cmsis_gcc.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_bus.h
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_tim.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h:
+
+../Drivers/CMSIS/Include/core_cm0plus.h:
+
+../Drivers/CMSIS/Include/cmsis_version.h:
+
+../Drivers/CMSIS/Include/cmsis_compiler.h:
+
+../Drivers/CMSIS/Include/cmsis_gcc.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_bus.h:
diff --git a/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_tim.o b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_tim.o
new file mode 100644
index 0000000..eff5fb2
Binary files /dev/null and b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_tim.o differ
diff --git a/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_tim.su b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_tim.su
new file mode 100644
index 0000000..c7de931
--- /dev/null
+++ b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_tim.su
@@ -0,0 +1,29 @@
+stm32l0xx_ll_tim.h:1175:22:LL_TIM_SetPrescaler 16 static
+stm32l0xx_ll_tim.h:1200:22:LL_TIM_SetAutoReload 16 static
+stm32l0xx_ll_tim.h:1661:22:LL_TIM_OC_SetCompareCH1 16 static
+stm32l0xx_ll_tim.h:1675:22:LL_TIM_OC_SetCompareCH2 16 static
+stm32l0xx_ll_tim.h:1689:22:LL_TIM_OC_SetCompareCH3 16 static
+stm32l0xx_ll_tim.h:1703:22:LL_TIM_OC_SetCompareCH4 16 static
+stm32l0xx_ll_tim.h:2218:22:LL_TIM_SetEncoderMode 16 static
+stm32l0xx_ll_tim.h:3187:22:LL_TIM_GenerateEvent_UPDATE 16 static
+stm32l0xx_ll_bus.h:595:22:LL_APB1_GRP1_ForceReset 16 static
+stm32l0xx_ll_bus.h:646:22:LL_APB1_GRP1_ReleaseReset 16 static
+stm32l0xx_ll_bus.h:873:22:LL_APB2_GRP1_ForceReset 16 static
+stm32l0xx_ll_bus.h:900:22:LL_APB2_GRP1_ReleaseReset 16 static
+stm32l0xx_ll_tim.c:146:13:LL_TIM_DeInit 24 static
+stm32l0xx_ll_tim.c:205:6:LL_TIM_StructInit 16 static
+stm32l0xx_ll_tim.c:222:13:LL_TIM_Init 24 static
+stm32l0xx_ll_tim.c:266:6:LL_TIM_OC_StructInit 16 static
+stm32l0xx_ll_tim.c:288:13:LL_TIM_OC_Init 40 static
+stm32l0xx_ll_tim.c:319:6:LL_TIM_IC_StructInit 16 static
+stm32l0xx_ll_tim.c:341:13:LL_TIM_IC_Init 40 static
+stm32l0xx_ll_tim.c:371:6:LL_TIM_ENCODER_StructInit 16 static
+stm32l0xx_ll_tim.c:393:13:LL_TIM_ENCODER_Init 24 static
+stm32l0xx_ll_tim.c:469:20:OC1Config 32 static
+stm32l0xx_ll_tim.c:528:20:OC2Config 32 static
+stm32l0xx_ll_tim.c:587:20:OC3Config 32 static
+stm32l0xx_ll_tim.c:646:20:OC4Config 32 static
+stm32l0xx_ll_tim.c:706:20:IC1Config 16 static
+stm32l0xx_ll_tim.c:739:20:IC2Config 16 static
+stm32l0xx_ll_tim.c:772:20:IC3Config 16 static
+stm32l0xx_ll_tim.c:805:20:IC4Config 16 static
diff --git a/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_utils.d b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_utils.d
new file mode 100644
index 0000000..577cc36
--- /dev/null
+++ b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_utils.d
@@ -0,0 +1,35 @@
+Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_utils.o: \
+ ../Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_utils.c \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_rcc.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h \
+ ../Drivers/CMSIS/Include/core_cm0plus.h \
+ ../Drivers/CMSIS/Include/cmsis_version.h \
+ ../Drivers/CMSIS/Include/cmsis_compiler.h \
+ ../Drivers/CMSIS/Include/cmsis_gcc.h \
+ ../Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_utils.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_system.h \
+ ../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_pwr.h
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_rcc.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/stm32l011xx.h:
+
+../Drivers/CMSIS/Include/core_cm0plus.h:
+
+../Drivers/CMSIS/Include/cmsis_version.h:
+
+../Drivers/CMSIS/Include/cmsis_compiler.h:
+
+../Drivers/CMSIS/Include/cmsis_gcc.h:
+
+../Drivers/CMSIS/Device/ST/STM32L0xx/Include/system_stm32l0xx.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_utils.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_system.h:
+
+../Drivers/STM32L0xx_HAL_Driver/Inc/stm32l0xx_ll_pwr.h:
diff --git a/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_utils.o b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_utils.o
new file mode 100644
index 0000000..cf50b04
Binary files /dev/null and b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_utils.o differ
diff --git a/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_utils.su b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_utils.su
new file mode 100644
index 0000000..77b5e99
--- /dev/null
+++ b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_utils.su
@@ -0,0 +1,27 @@
+stm32l0xx_ll_rcc.h:695:22:LL_RCC_HSE_EnableBypass 8 static
+stm32l0xx_ll_rcc.h:705:22:LL_RCC_HSE_DisableBypass 8 static
+stm32l0xx_ll_rcc.h:715:22:LL_RCC_HSE_Enable 8 static
+stm32l0xx_ll_rcc.h:735:26:LL_RCC_HSE_IsReady 8 static
+stm32l0xx_ll_rcc.h:782:22:LL_RCC_HSI_Enable 8 static
+stm32l0xx_ll_rcc.h:802:26:LL_RCC_HSI_IsReady 8 static
+stm32l0xx_ll_rcc.h:1275:22:LL_RCC_SetSysClkSource 16 static
+stm32l0xx_ll_rcc.h:1289:26:LL_RCC_GetSysClkSource 8 static
+stm32l0xx_ll_rcc.h:1309:22:LL_RCC_SetAHBPrescaler 16 static
+stm32l0xx_ll_rcc.h:1325:22:LL_RCC_SetAPB1Prescaler 16 static
+stm32l0xx_ll_rcc.h:1341:22:LL_RCC_SetAPB2Prescaler 16 static
+stm32l0xx_ll_rcc.h:1784:22:LL_RCC_PLL_Enable 8 static
+stm32l0xx_ll_rcc.h:1805:26:LL_RCC_PLL_IsReady 8 static
+stm32l0xx_ll_rcc.h:1834:22:LL_RCC_PLL_ConfigDomain_SYS 24 static
+stm32l0xx_ll_utils.h:220:22:LL_InitTick 16 static
+stm32l0xx_ll_system.h:912:22:LL_FLASH_SetLatency 16 static
+stm32l0xx_ll_system.h:924:26:LL_FLASH_GetLatency 8 static
+stm32l0xx_ll_pwr.h:285:26:LL_PWR_GetRegulVoltageScaling 8 static
+stm32l0xx_ll_utils.c:147:6:LL_Init1msTick 16 static
+stm32l0xx_ll_utils.c:163:6:LL_mDelay 24 static
+stm32l0xx_ll_utils.c:225:6:LL_SetSystemCoreClock 16 static
+stm32l0xx_ll_utils.c:239:13:LL_SetFlashLatency 32 static
+stm32l0xx_ll_utils.c:338:13:LL_PLL_ConfigSystemClock_HSI 32 static
+stm32l0xx_ll_utils.c:397:13:LL_PLL_ConfigSystemClock_HSE 40 static
+stm32l0xx_ll_utils.c:467:17:UTILS_GetPLLOutputFrequency 24 static
+stm32l0xx_ll_utils.c:497:20:UTILS_PLL_IsBusy 16 static
+stm32l0xx_ll_utils.c:521:20:UTILS_EnablePLLAndSwitchSystem 32 static
diff --git a/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/subdir.mk b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/subdir.mk
new file mode 100644
index 0000000..210dabd
--- /dev/null
+++ b/fw_old/Debug/Drivers/STM32L0xx_HAL_Driver/Src/subdir.mk
@@ -0,0 +1,44 @@
+################################################################################
+# Automatically-generated file. Do not edit!
+# Toolchain: GNU Tools for STM32 (9-2020-q2-update)
+################################################################################
+
+# Add inputs and outputs from these tool invocations to the build variables
+C_SRCS += \
+../Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_dma.c \
+../Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_exti.c \
+../Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_gpio.c \
+../Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_i2c.c \
+../Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_lpuart.c \
+../Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_pwr.c \
+../Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rcc.c \
+../Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_tim.c \
+../Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_utils.c
+
+OBJS += \
+./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_dma.o \
+./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_exti.o \
+./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_gpio.o \
+./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_i2c.o \
+./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_lpuart.o \
+./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_pwr.o \
+./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rcc.o \
+./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_tim.o \
+./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_utils.o
+
+C_DEPS += \
+./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_dma.d \
+./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_exti.d \
+./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_gpio.d \
+./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_i2c.d \
+./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_lpuart.d \
+./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_pwr.d \
+./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_rcc.d \
+./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_tim.d \
+./Drivers/STM32L0xx_HAL_Driver/Src/stm32l0xx_ll_utils.d
+
+
+# Each subdirectory must supply rules for building sources it contributes
+Drivers/STM32L0xx_HAL_Driver/Src/%.o: ../Drivers/STM32L0xx_HAL_Driver/Src/%.c Drivers/STM32L0xx_HAL_Driver/Src/subdir.mk
+ arm-none-eabi-gcc "$<" -mcpu=cortex-m0plus -std=gnu11 -g3 -DSTM32L011xx -DDEBUG -DUSE_FULL_LL_DRIVER -DHSE_VALUE=8000000 -DHSE_STARTUP_TIMEOUT=100 -DLSE_STARTUP_TIMEOUT=5000 -DLSE_VALUE=32768 -DMSI_VALUE=2097000 -DHSI_VALUE=16000000 -DLSI_VALUE=37000 -DVDD_VALUE=3300 -DPREFETCH_ENABLE=0 -DINSTRUCTION_CACHE_ENABLE=1 -DDATA_CACHE_ENABLE=1 -c -I../Core/Inc -I../Drivers/STM32L0xx_HAL_Driver/Inc -I../Drivers/CMSIS/Device/ST/STM32L0xx/Include -I../Drivers/CMSIS/Include -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" --specs=nano.specs -mfloat-abi=soft -mthumb -o "$@"
+
diff --git a/fw_old/Debug/iaq_wired_sensor.bin b/fw_old/Debug/iaq_wired_sensor.bin
new file mode 100755
index 0000000..f1482c6
Binary files /dev/null and b/fw_old/Debug/iaq_wired_sensor.bin differ
diff --git a/fw_old/Debug/iaq_wired_sensor.elf b/fw_old/Debug/iaq_wired_sensor.elf
new file mode 100755
index 0000000..5c1750f
Binary files /dev/null and b/fw_old/Debug/iaq_wired_sensor.elf differ
diff --git a/fw_old/Debug/iaq_wired_sensor.list b/fw_old/Debug/iaq_wired_sensor.list
new file mode 100644
index 0000000..4f9f563
--- /dev/null
+++ b/fw_old/Debug/iaq_wired_sensor.list
@@ -0,0 +1,9342 @@
+
+iaq_wired_sensor.elf: file format elf32-littlearm
+
+Sections:
+Idx Name Size VMA LMA File off Algn
+ 0 .isr_vector 000000c0 08000000 08000000 00010000 2**0
+ CONTENTS, ALLOC, LOAD, READONLY, DATA
+ 1 .text 00003578 080000c0 080000c0 000100c0 2**2
+ CONTENTS, ALLOC, LOAD, READONLY, CODE
+ 2 .rodata 0000010c 08003638 08003638 00013638 2**2
+ CONTENTS, ALLOC, LOAD, READONLY, DATA
+ 3 .ARM.extab 00000000 08003744 08003744 00020008 2**0
+ CONTENTS
+ 4 .ARM 00000008 08003744 08003744 00013744 2**2
+ CONTENTS, ALLOC, LOAD, READONLY, DATA
+ 5 .preinit_array 00000000 0800374c 0800374c 00020008 2**0
+ CONTENTS, ALLOC, LOAD, DATA
+ 6 .init_array 00000004 0800374c 0800374c 0001374c 2**2
+ CONTENTS, ALLOC, LOAD, DATA
+ 7 .fini_array 00000004 08003750 08003750 00013750 2**2
+ CONTENTS, ALLOC, LOAD, DATA
+ 8 .data 00000008 20000000 08003754 00020000 2**2
+ CONTENTS, ALLOC, LOAD, DATA
+ 9 .bss 00000174 20000008 0800375c 00020008 2**2
+ ALLOC
+ 10 ._user_heap_stack 00000604 2000017c 0800375c 0002017c 2**0
+ ALLOC
+ 11 .ARM.attributes 00000028 00000000 00000000 00020008 2**0
+ CONTENTS, READONLY
+ 12 .debug_info 00007101 00000000 00000000 00020030 2**0
+ CONTENTS, READONLY, DEBUGGING, OCTETS
+ 13 .debug_abbrev 00001a58 00000000 00000000 00027131 2**0
+ CONTENTS, READONLY, DEBUGGING, OCTETS
+ 14 .debug_aranges 00000948 00000000 00000000 00028b90 2**3
+ CONTENTS, READONLY, DEBUGGING, OCTETS
+ 15 .debug_ranges 00000850 00000000 00000000 000294d8 2**3
+ CONTENTS, READONLY, DEBUGGING, OCTETS
+ 16 .debug_macro 0000c631 00000000 00000000 00029d28 2**0
+ CONTENTS, READONLY, DEBUGGING, OCTETS
+ 17 .debug_line 00007500 00000000 00000000 00036359 2**0
+ CONTENTS, READONLY, DEBUGGING, OCTETS
+ 18 .debug_str 0003eae4 00000000 00000000 0003d859 2**0
+ CONTENTS, READONLY, DEBUGGING, OCTETS
+ 19 .comment 00000053 00000000 00000000 0007c33d 2**0
+ CONTENTS, READONLY
+ 20 .debug_frame 00001fbc 00000000 00000000 0007c390 2**2
+ CONTENTS, READONLY, DEBUGGING, OCTETS
+
+Disassembly of section .text:
+
+080000c0 <__do_global_dtors_aux>:
+ 80000c0: b510 push {r4, lr}
+ 80000c2: 4c06 ldr r4, [pc, #24] ; (80000dc <__do_global_dtors_aux+0x1c>)
+ 80000c4: 7823 ldrb r3, [r4, #0]
+ 80000c6: 2b00 cmp r3, #0
+ 80000c8: d107 bne.n 80000da <__do_global_dtors_aux+0x1a>
+ 80000ca: 4b05 ldr r3, [pc, #20] ; (80000e0 <__do_global_dtors_aux+0x20>)
+ 80000cc: 2b00 cmp r3, #0
+ 80000ce: d002 beq.n 80000d6 <__do_global_dtors_aux+0x16>
+ 80000d0: 4804 ldr r0, [pc, #16] ; (80000e4 <__do_global_dtors_aux+0x24>)
+ 80000d2: e000 b.n 80000d6 <__do_global_dtors_aux+0x16>
+ 80000d4: bf00 nop
+ 80000d6: 2301 movs r3, #1
+ 80000d8: 7023 strb r3, [r4, #0]
+ 80000da: bd10 pop {r4, pc}
+ 80000dc: 20000008 .word 0x20000008
+ 80000e0: 00000000 .word 0x00000000
+ 80000e4: 08003620 .word 0x08003620
+
+080000e8 :
+ 80000e8: 4b04 ldr r3, [pc, #16] ; (80000fc )
+ 80000ea: b510 push {r4, lr}
+ 80000ec: 2b00 cmp r3, #0
+ 80000ee: d003 beq.n 80000f8
+ 80000f0: 4903 ldr r1, [pc, #12] ; (8000100 )
+ 80000f2: 4804 ldr r0, [pc, #16] ; (8000104 )
+ 80000f4: e000 b.n 80000f8
+ 80000f6: bf00 nop
+ 80000f8: bd10 pop {r4, pc}
+ 80000fa: 46c0 nop ; (mov r8, r8)
+ 80000fc: 00000000 .word 0x00000000
+ 8000100: 2000000c .word 0x2000000c
+ 8000104: 08003620 .word 0x08003620
+
+08000108 <__udivsi3>:
+ 8000108: 2200 movs r2, #0
+ 800010a: 0843 lsrs r3, r0, #1
+ 800010c: 428b cmp r3, r1
+ 800010e: d374 bcc.n 80001fa <__udivsi3+0xf2>
+ 8000110: 0903 lsrs r3, r0, #4
+ 8000112: 428b cmp r3, r1
+ 8000114: d35f bcc.n 80001d6 <__udivsi3+0xce>
+ 8000116: 0a03 lsrs r3, r0, #8
+ 8000118: 428b cmp r3, r1
+ 800011a: d344 bcc.n 80001a6 <__udivsi3+0x9e>
+ 800011c: 0b03 lsrs r3, r0, #12
+ 800011e: 428b cmp r3, r1
+ 8000120: d328 bcc.n 8000174 <__udivsi3+0x6c>
+ 8000122: 0c03 lsrs r3, r0, #16
+ 8000124: 428b cmp r3, r1
+ 8000126: d30d bcc.n 8000144 <__udivsi3+0x3c>
+ 8000128: 22ff movs r2, #255 ; 0xff
+ 800012a: 0209 lsls r1, r1, #8
+ 800012c: ba12 rev r2, r2
+ 800012e: 0c03 lsrs r3, r0, #16
+ 8000130: 428b cmp r3, r1
+ 8000132: d302 bcc.n 800013a <__udivsi3+0x32>
+ 8000134: 1212 asrs r2, r2, #8
+ 8000136: 0209 lsls r1, r1, #8
+ 8000138: d065 beq.n 8000206 <__udivsi3+0xfe>
+ 800013a: 0b03 lsrs r3, r0, #12
+ 800013c: 428b cmp r3, r1
+ 800013e: d319 bcc.n 8000174 <__udivsi3+0x6c>
+ 8000140: e000 b.n 8000144 <__udivsi3+0x3c>
+ 8000142: 0a09 lsrs r1, r1, #8
+ 8000144: 0bc3 lsrs r3, r0, #15
+ 8000146: 428b cmp r3, r1
+ 8000148: d301 bcc.n 800014e <__udivsi3+0x46>
+ 800014a: 03cb lsls r3, r1, #15
+ 800014c: 1ac0 subs r0, r0, r3
+ 800014e: 4152 adcs r2, r2
+ 8000150: 0b83 lsrs r3, r0, #14
+ 8000152: 428b cmp r3, r1
+ 8000154: d301 bcc.n 800015a <__udivsi3+0x52>
+ 8000156: 038b lsls r3, r1, #14
+ 8000158: 1ac0 subs r0, r0, r3
+ 800015a: 4152 adcs r2, r2
+ 800015c: 0b43 lsrs r3, r0, #13
+ 800015e: 428b cmp r3, r1
+ 8000160: d301 bcc.n 8000166 <__udivsi3+0x5e>
+ 8000162: 034b lsls r3, r1, #13
+ 8000164: 1ac0 subs r0, r0, r3
+ 8000166: 4152 adcs r2, r2
+ 8000168: 0b03 lsrs r3, r0, #12
+ 800016a: 428b cmp r3, r1
+ 800016c: d301 bcc.n 8000172 <__udivsi3+0x6a>
+ 800016e: 030b lsls r3, r1, #12
+ 8000170: 1ac0 subs r0, r0, r3
+ 8000172: 4152 adcs r2, r2
+ 8000174: 0ac3 lsrs r3, r0, #11
+ 8000176: 428b cmp r3, r1
+ 8000178: d301 bcc.n 800017e <__udivsi3+0x76>
+ 800017a: 02cb lsls r3, r1, #11
+ 800017c: 1ac0 subs r0, r0, r3
+ 800017e: 4152 adcs r2, r2
+ 8000180: 0a83 lsrs r3, r0, #10
+ 8000182: 428b cmp r3, r1
+ 8000184: d301 bcc.n 800018a <__udivsi3+0x82>
+ 8000186: 028b lsls r3, r1, #10
+ 8000188: 1ac0 subs r0, r0, r3
+ 800018a: 4152 adcs r2, r2
+ 800018c: 0a43 lsrs r3, r0, #9
+ 800018e: 428b cmp r3, r1
+ 8000190: d301 bcc.n 8000196 <__udivsi3+0x8e>
+ 8000192: 024b lsls r3, r1, #9
+ 8000194: 1ac0 subs r0, r0, r3
+ 8000196: 4152 adcs r2, r2
+ 8000198: 0a03 lsrs r3, r0, #8
+ 800019a: 428b cmp r3, r1
+ 800019c: d301 bcc.n 80001a2 <__udivsi3+0x9a>
+ 800019e: 020b lsls r3, r1, #8
+ 80001a0: 1ac0 subs r0, r0, r3
+ 80001a2: 4152 adcs r2, r2
+ 80001a4: d2cd bcs.n 8000142 <__udivsi3+0x3a>
+ 80001a6: 09c3 lsrs r3, r0, #7
+ 80001a8: 428b cmp r3, r1
+ 80001aa: d301 bcc.n 80001b0 <__udivsi3+0xa8>
+ 80001ac: 01cb lsls r3, r1, #7
+ 80001ae: 1ac0 subs r0, r0, r3
+ 80001b0: 4152 adcs r2, r2
+ 80001b2: 0983 lsrs r3, r0, #6
+ 80001b4: 428b cmp r3, r1
+ 80001b6: d301 bcc.n 80001bc <__udivsi3+0xb4>
+ 80001b8: 018b lsls r3, r1, #6
+ 80001ba: 1ac0 subs r0, r0, r3
+ 80001bc: 4152 adcs r2, r2
+ 80001be: 0943 lsrs r3, r0, #5
+ 80001c0: 428b cmp r3, r1
+ 80001c2: d301 bcc.n 80001c8 <__udivsi3+0xc0>
+ 80001c4: 014b lsls r3, r1, #5
+ 80001c6: 1ac0 subs r0, r0, r3
+ 80001c8: 4152 adcs r2, r2
+ 80001ca: 0903 lsrs r3, r0, #4
+ 80001cc: 428b cmp r3, r1
+ 80001ce: d301 bcc.n 80001d4 <__udivsi3+0xcc>
+ 80001d0: 010b lsls r3, r1, #4
+ 80001d2: 1ac0 subs r0, r0, r3
+ 80001d4: 4152 adcs r2, r2
+ 80001d6: 08c3 lsrs r3, r0, #3
+ 80001d8: 428b cmp r3, r1
+ 80001da: d301 bcc.n 80001e0 <__udivsi3+0xd8>
+ 80001dc: 00cb lsls r3, r1, #3
+ 80001de: 1ac0 subs r0, r0, r3
+ 80001e0: 4152 adcs r2, r2
+ 80001e2: 0883 lsrs r3, r0, #2
+ 80001e4: 428b cmp r3, r1
+ 80001e6: d301 bcc.n 80001ec <__udivsi3+0xe4>
+ 80001e8: 008b lsls r3, r1, #2
+ 80001ea: 1ac0 subs r0, r0, r3
+ 80001ec: 4152 adcs r2, r2
+ 80001ee: 0843 lsrs r3, r0, #1
+ 80001f0: 428b cmp r3, r1
+ 80001f2: d301 bcc.n 80001f8 <__udivsi3+0xf0>
+ 80001f4: 004b lsls r3, r1, #1
+ 80001f6: 1ac0 subs r0, r0, r3
+ 80001f8: 4152 adcs r2, r2
+ 80001fa: 1a41 subs r1, r0, r1
+ 80001fc: d200 bcs.n 8000200 <__udivsi3+0xf8>
+ 80001fe: 4601 mov r1, r0
+ 8000200: 4152 adcs r2, r2
+ 8000202: 4610 mov r0, r2
+ 8000204: 4770 bx lr
+ 8000206: e7ff b.n 8000208 <__udivsi3+0x100>
+ 8000208: b501 push {r0, lr}
+ 800020a: 2000 movs r0, #0
+ 800020c: f000 f806 bl 800021c <__aeabi_idiv0>
+ 8000210: bd02 pop {r1, pc}
+ 8000212: 46c0 nop ; (mov r8, r8)
+
+08000214 <__aeabi_uidivmod>:
+ 8000214: 2900 cmp r1, #0
+ 8000216: d0f7 beq.n 8000208 <__udivsi3+0x100>
+ 8000218: e776 b.n 8000108 <__udivsi3>
+ 800021a: 4770 bx lr
+
+0800021c <__aeabi_idiv0>:
+ 800021c: 4770 bx lr
+ 800021e: 46c0 nop ; (mov r8, r8)
+
+08000220 <__aeabi_uldivmod>:
+ 8000220: 2b00 cmp r3, #0
+ 8000222: d111 bne.n 8000248 <__aeabi_uldivmod+0x28>
+ 8000224: 2a00 cmp r2, #0
+ 8000226: d10f bne.n 8000248 <__aeabi_uldivmod+0x28>
+ 8000228: 2900 cmp r1, #0
+ 800022a: d100 bne.n 800022e <__aeabi_uldivmod+0xe>
+ 800022c: 2800 cmp r0, #0
+ 800022e: d002 beq.n 8000236 <__aeabi_uldivmod+0x16>
+ 8000230: 2100 movs r1, #0
+ 8000232: 43c9 mvns r1, r1
+ 8000234: 1c08 adds r0, r1, #0
+ 8000236: b407 push {r0, r1, r2}
+ 8000238: 4802 ldr r0, [pc, #8] ; (8000244 <__aeabi_uldivmod+0x24>)
+ 800023a: a102 add r1, pc, #8 ; (adr r1, 8000244 <__aeabi_uldivmod+0x24>)
+ 800023c: 1840 adds r0, r0, r1
+ 800023e: 9002 str r0, [sp, #8]
+ 8000240: bd03 pop {r0, r1, pc}
+ 8000242: 46c0 nop ; (mov r8, r8)
+ 8000244: ffffffd9 .word 0xffffffd9
+ 8000248: b403 push {r0, r1}
+ 800024a: 4668 mov r0, sp
+ 800024c: b501 push {r0, lr}
+ 800024e: 9802 ldr r0, [sp, #8]
+ 8000250: f000 f806 bl 8000260 <__udivmoddi4>
+ 8000254: 9b01 ldr r3, [sp, #4]
+ 8000256: 469e mov lr, r3
+ 8000258: b002 add sp, #8
+ 800025a: bc0c pop {r2, r3}
+ 800025c: 4770 bx lr
+ 800025e: 46c0 nop ; (mov r8, r8)
+
+08000260 <__udivmoddi4>:
+ 8000260: b5f0 push {r4, r5, r6, r7, lr}
+ 8000262: 4657 mov r7, sl
+ 8000264: 464e mov r6, r9
+ 8000266: 4645 mov r5, r8
+ 8000268: 46de mov lr, fp
+ 800026a: b5e0 push {r5, r6, r7, lr}
+ 800026c: 0004 movs r4, r0
+ 800026e: 000d movs r5, r1
+ 8000270: 4692 mov sl, r2
+ 8000272: 4699 mov r9, r3
+ 8000274: b083 sub sp, #12
+ 8000276: 428b cmp r3, r1
+ 8000278: d830 bhi.n 80002dc <__udivmoddi4+0x7c>
+ 800027a: d02d beq.n 80002d8 <__udivmoddi4+0x78>
+ 800027c: 4649 mov r1, r9
+ 800027e: 4650 mov r0, sl
+ 8000280: f000 f8ba bl 80003f8 <__clzdi2>
+ 8000284: 0029 movs r1, r5
+ 8000286: 0006 movs r6, r0
+ 8000288: 0020 movs r0, r4
+ 800028a: f000 f8b5 bl 80003f8 <__clzdi2>
+ 800028e: 1a33 subs r3, r6, r0
+ 8000290: 4698 mov r8, r3
+ 8000292: 3b20 subs r3, #32
+ 8000294: 469b mov fp, r3
+ 8000296: d433 bmi.n 8000300 <__udivmoddi4+0xa0>
+ 8000298: 465a mov r2, fp
+ 800029a: 4653 mov r3, sl
+ 800029c: 4093 lsls r3, r2
+ 800029e: 4642 mov r2, r8
+ 80002a0: 001f movs r7, r3
+ 80002a2: 4653 mov r3, sl
+ 80002a4: 4093 lsls r3, r2
+ 80002a6: 001e movs r6, r3
+ 80002a8: 42af cmp r7, r5
+ 80002aa: d83a bhi.n 8000322 <__udivmoddi4+0xc2>
+ 80002ac: 42af cmp r7, r5
+ 80002ae: d100 bne.n 80002b2 <__udivmoddi4+0x52>
+ 80002b0: e078 b.n 80003a4 <__udivmoddi4+0x144>
+ 80002b2: 465b mov r3, fp
+ 80002b4: 1ba4 subs r4, r4, r6
+ 80002b6: 41bd sbcs r5, r7
+ 80002b8: 2b00 cmp r3, #0
+ 80002ba: da00 bge.n 80002be <__udivmoddi4+0x5e>
+ 80002bc: e075 b.n 80003aa <__udivmoddi4+0x14a>
+ 80002be: 2200 movs r2, #0
+ 80002c0: 2300 movs r3, #0
+ 80002c2: 9200 str r2, [sp, #0]
+ 80002c4: 9301 str r3, [sp, #4]
+ 80002c6: 2301 movs r3, #1
+ 80002c8: 465a mov r2, fp
+ 80002ca: 4093 lsls r3, r2
+ 80002cc: 9301 str r3, [sp, #4]
+ 80002ce: 2301 movs r3, #1
+ 80002d0: 4642 mov r2, r8
+ 80002d2: 4093 lsls r3, r2
+ 80002d4: 9300 str r3, [sp, #0]
+ 80002d6: e028 b.n 800032a <__udivmoddi4+0xca>
+ 80002d8: 4282 cmp r2, r0
+ 80002da: d9cf bls.n 800027c <__udivmoddi4+0x1c>
+ 80002dc: 2200 movs r2, #0
+ 80002de: 2300 movs r3, #0
+ 80002e0: 9200 str r2, [sp, #0]
+ 80002e2: 9301 str r3, [sp, #4]
+ 80002e4: 9b0c ldr r3, [sp, #48] ; 0x30
+ 80002e6: 2b00 cmp r3, #0
+ 80002e8: d001 beq.n 80002ee <__udivmoddi4+0x8e>
+ 80002ea: 601c str r4, [r3, #0]
+ 80002ec: 605d str r5, [r3, #4]
+ 80002ee: 9800 ldr r0, [sp, #0]
+ 80002f0: 9901 ldr r1, [sp, #4]
+ 80002f2: b003 add sp, #12
+ 80002f4: bcf0 pop {r4, r5, r6, r7}
+ 80002f6: 46bb mov fp, r7
+ 80002f8: 46b2 mov sl, r6
+ 80002fa: 46a9 mov r9, r5
+ 80002fc: 46a0 mov r8, r4
+ 80002fe: bdf0 pop {r4, r5, r6, r7, pc}
+ 8000300: 4642 mov r2, r8
+ 8000302: 2320 movs r3, #32
+ 8000304: 1a9b subs r3, r3, r2
+ 8000306: 4652 mov r2, sl
+ 8000308: 40da lsrs r2, r3
+ 800030a: 4641 mov r1, r8
+ 800030c: 0013 movs r3, r2
+ 800030e: 464a mov r2, r9
+ 8000310: 408a lsls r2, r1
+ 8000312: 0017 movs r7, r2
+ 8000314: 4642 mov r2, r8
+ 8000316: 431f orrs r7, r3
+ 8000318: 4653 mov r3, sl
+ 800031a: 4093 lsls r3, r2
+ 800031c: 001e movs r6, r3
+ 800031e: 42af cmp r7, r5
+ 8000320: d9c4 bls.n 80002ac <__udivmoddi4+0x4c>
+ 8000322: 2200 movs r2, #0
+ 8000324: 2300 movs r3, #0
+ 8000326: 9200 str r2, [sp, #0]
+ 8000328: 9301 str r3, [sp, #4]
+ 800032a: 4643 mov r3, r8
+ 800032c: 2b00 cmp r3, #0
+ 800032e: d0d9 beq.n 80002e4 <__udivmoddi4+0x84>
+ 8000330: 07fb lsls r3, r7, #31
+ 8000332: 0872 lsrs r2, r6, #1
+ 8000334: 431a orrs r2, r3
+ 8000336: 4646 mov r6, r8
+ 8000338: 087b lsrs r3, r7, #1
+ 800033a: e00e b.n 800035a <__udivmoddi4+0xfa>
+ 800033c: 42ab cmp r3, r5
+ 800033e: d101 bne.n 8000344 <__udivmoddi4+0xe4>
+ 8000340: 42a2 cmp r2, r4
+ 8000342: d80c bhi.n 800035e <__udivmoddi4+0xfe>
+ 8000344: 1aa4 subs r4, r4, r2
+ 8000346: 419d sbcs r5, r3
+ 8000348: 2001 movs r0, #1
+ 800034a: 1924 adds r4, r4, r4
+ 800034c: 416d adcs r5, r5
+ 800034e: 2100 movs r1, #0
+ 8000350: 3e01 subs r6, #1
+ 8000352: 1824 adds r4, r4, r0
+ 8000354: 414d adcs r5, r1
+ 8000356: 2e00 cmp r6, #0
+ 8000358: d006 beq.n 8000368 <__udivmoddi4+0x108>
+ 800035a: 42ab cmp r3, r5
+ 800035c: d9ee bls.n 800033c <__udivmoddi4+0xdc>
+ 800035e: 3e01 subs r6, #1
+ 8000360: 1924 adds r4, r4, r4
+ 8000362: 416d adcs r5, r5
+ 8000364: 2e00 cmp r6, #0
+ 8000366: d1f8 bne.n 800035a <__udivmoddi4+0xfa>
+ 8000368: 9800 ldr r0, [sp, #0]
+ 800036a: 9901 ldr r1, [sp, #4]
+ 800036c: 465b mov r3, fp
+ 800036e: 1900 adds r0, r0, r4
+ 8000370: 4169 adcs r1, r5
+ 8000372: 2b00 cmp r3, #0
+ 8000374: db24 blt.n 80003c0 <__udivmoddi4+0x160>
+ 8000376: 002b movs r3, r5
+ 8000378: 465a mov r2, fp
+ 800037a: 4644 mov r4, r8
+ 800037c: 40d3 lsrs r3, r2
+ 800037e: 002a movs r2, r5
+ 8000380: 40e2 lsrs r2, r4
+ 8000382: 001c movs r4, r3
+ 8000384: 465b mov r3, fp
+ 8000386: 0015 movs r5, r2
+ 8000388: 2b00 cmp r3, #0
+ 800038a: db2a blt.n 80003e2 <__udivmoddi4+0x182>
+ 800038c: 0026 movs r6, r4
+ 800038e: 409e lsls r6, r3
+ 8000390: 0033 movs r3, r6
+ 8000392: 0026 movs r6, r4
+ 8000394: 4647 mov r7, r8
+ 8000396: 40be lsls r6, r7
+ 8000398: 0032 movs r2, r6
+ 800039a: 1a80 subs r0, r0, r2
+ 800039c: 4199 sbcs r1, r3
+ 800039e: 9000 str r0, [sp, #0]
+ 80003a0: 9101 str r1, [sp, #4]
+ 80003a2: e79f b.n 80002e4 <__udivmoddi4+0x84>
+ 80003a4: 42a3 cmp r3, r4
+ 80003a6: d8bc bhi.n 8000322 <__udivmoddi4+0xc2>
+ 80003a8: e783 b.n 80002b2 <__udivmoddi4+0x52>
+ 80003aa: 4642 mov r2, r8
+ 80003ac: 2320 movs r3, #32
+ 80003ae: 2100 movs r1, #0
+ 80003b0: 1a9b subs r3, r3, r2
+ 80003b2: 2200 movs r2, #0
+ 80003b4: 9100 str r1, [sp, #0]
+ 80003b6: 9201 str r2, [sp, #4]
+ 80003b8: 2201 movs r2, #1
+ 80003ba: 40da lsrs r2, r3
+ 80003bc: 9201 str r2, [sp, #4]
+ 80003be: e786 b.n 80002ce <__udivmoddi4+0x6e>
+ 80003c0: 4642 mov r2, r8
+ 80003c2: 2320 movs r3, #32
+ 80003c4: 1a9b subs r3, r3, r2
+ 80003c6: 002a movs r2, r5
+ 80003c8: 4646 mov r6, r8
+ 80003ca: 409a lsls r2, r3
+ 80003cc: 0023 movs r3, r4
+ 80003ce: 40f3 lsrs r3, r6
+ 80003d0: 4644 mov r4, r8
+ 80003d2: 4313 orrs r3, r2
+ 80003d4: 002a movs r2, r5
+ 80003d6: 40e2 lsrs r2, r4
+ 80003d8: 001c movs r4, r3
+ 80003da: 465b mov r3, fp
+ 80003dc: 0015 movs r5, r2
+ 80003de: 2b00 cmp r3, #0
+ 80003e0: dad4 bge.n 800038c <__udivmoddi4+0x12c>
+ 80003e2: 4642 mov r2, r8
+ 80003e4: 002f movs r7, r5
+ 80003e6: 2320 movs r3, #32
+ 80003e8: 0026 movs r6, r4
+ 80003ea: 4097 lsls r7, r2
+ 80003ec: 1a9b subs r3, r3, r2
+ 80003ee: 40de lsrs r6, r3
+ 80003f0: 003b movs r3, r7
+ 80003f2: 4333 orrs r3, r6
+ 80003f4: e7cd b.n 8000392 <__udivmoddi4+0x132>
+ 80003f6: 46c0 nop ; (mov r8, r8)
+
+080003f8 <__clzdi2>:
+ 80003f8: b510 push {r4, lr}
+ 80003fa: 2900 cmp r1, #0
+ 80003fc: d103 bne.n 8000406 <__clzdi2+0xe>
+ 80003fe: f000 f807 bl 8000410 <__clzsi2>
+ 8000402: 3020 adds r0, #32
+ 8000404: e002 b.n 800040c <__clzdi2+0x14>
+ 8000406: 1c08 adds r0, r1, #0
+ 8000408: f000 f802 bl 8000410 <__clzsi2>
+ 800040c: bd10 pop {r4, pc}
+ 800040e: 46c0 nop ; (mov r8, r8)
+
+08000410 <__clzsi2>:
+ 8000410: 211c movs r1, #28
+ 8000412: 2301 movs r3, #1
+ 8000414: 041b lsls r3, r3, #16
+ 8000416: 4298 cmp r0, r3
+ 8000418: d301 bcc.n 800041e <__clzsi2+0xe>
+ 800041a: 0c00 lsrs r0, r0, #16
+ 800041c: 3910 subs r1, #16
+ 800041e: 0a1b lsrs r3, r3, #8
+ 8000420: 4298 cmp r0, r3
+ 8000422: d301 bcc.n 8000428 <__clzsi2+0x18>
+ 8000424: 0a00 lsrs r0, r0, #8
+ 8000426: 3908 subs r1, #8
+ 8000428: 091b lsrs r3, r3, #4
+ 800042a: 4298 cmp r0, r3
+ 800042c: d301 bcc.n 8000432 <__clzsi2+0x22>
+ 800042e: 0900 lsrs r0, r0, #4
+ 8000430: 3904 subs r1, #4
+ 8000432: a202 add r2, pc, #8 ; (adr r2, 800043c <__clzsi2+0x2c>)
+ 8000434: 5c10 ldrb r0, [r2, r0]
+ 8000436: 1840 adds r0, r0, r1
+ 8000438: 4770 bx lr
+ 800043a: 46c0 nop ; (mov r8, r8)
+ 800043c: 02020304 .word 0x02020304
+ 8000440: 01010101 .word 0x01010101
+ ...
+
+0800044c :
+/* Function to write four bytes to the EEPROM */
+/* IMPORTANT: EEPROM must be unlocked first */
+static int8_t eeprom_program_word(uint32_t addr, uint32_t ee_data);
+
+int8_t config_read(config_t *config)
+{
+ 800044c: b580 push {r7, lr}
+ 800044e: b082 sub sp, #8
+ 8000450: af00 add r7, sp, #0
+ 8000452: 6078 str r0, [r7, #4]
+ config->modbus_addr = *(uint16_t *) (CONFIG_EEPROM_ADDR_MODBUS_ADDR);
+ 8000454: 4b1d ldr r3, [pc, #116] ; (80004cc )
+ 8000456: 881a ldrh r2, [r3, #0]
+ 8000458: 687b ldr r3, [r7, #4]
+ 800045a: 819a strh r2, [r3, #12]
+ config->baudrate_index = *(uint16_t *) (CONFIG_EEPROM_ADDR_BAUDRATE_INDEX);
+ 800045c: 4b1c ldr r3, [pc, #112] ; (80004d0 )
+ 800045e: 881b ldrh r3, [r3, #0]
+ 8000460: 001a movs r2, r3
+ 8000462: 687b ldr r3, [r7, #4]
+ 8000464: 611a str r2, [r3, #16]
+ config->led_on = *(uint16_t *) (CONFIG_EEPROM_ADDR_LED_ON);
+ 8000466: 4b1b ldr r3, [pc, #108] ; (80004d4 )
+ 8000468: 881b ldrh r3, [r3, #0]
+ 800046a: b2da uxtb r2, r3
+ 800046c: 687b ldr r3, [r7, #4]
+ 800046e: 701a strb r2, [r3, #0]
+ config->led_brightness = *(uint16_t *) (CONFIG_EEPROM_ADDR_LED_BRIGHTNESS);
+ 8000470: 4b19 ldr r3, [pc, #100] ; (80004d8 )
+ 8000472: 881a ldrh r2, [r3, #0]
+ 8000474: 687b ldr r3, [r7, #4]
+ 8000476: 805a strh r2, [r3, #2]
+ config->led_smooth = *(uint16_t *) (CONFIG_EEPROM_ADDR_LED_SMOOTH);
+ 8000478: 4b18 ldr r3, [pc, #96] ; (80004dc )
+ 800047a: 881b ldrh r3, [r3, #0]
+ 800047c: b2da uxtb r2, r3
+ 800047e: 687b ldr r3, [r7, #4]
+ 8000480: 711a strb r2, [r3, #4]
+ config->led_co2_alert_limit1 = *(uint16_t *) (CONFIG_EEPROM_ADDR_LED_ALERT1);
+ 8000482: 4b17 ldr r3, [pc, #92] ; (80004e0 )
+ 8000484: 881a ldrh r2, [r3, #0]
+ 8000486: 687b ldr r3, [r7, #4]
+ 8000488: 80da strh r2, [r3, #6]
+ config->led_co2_alert_limit2 = *(uint16_t *) (CONFIG_EEPROM_ADDR_LED_ALERT2);
+ 800048a: 4b16 ldr r3, [pc, #88] ; (80004e4 )
+ 800048c: 881a ldrh r2, [r3, #0]
+ 800048e: 687b ldr r3, [r7, #4]
+ 8000490: 811a strh r2, [r3, #8]
+ config->scd4x_t_offset = *(int16_t *) (CONFIG_EEPROM_ADDR_SCD4x_T_OFFSET);
+ 8000492: 4b15 ldr r3, [pc, #84] ; (80004e8 )
+ 8000494: 2200 movs r2, #0
+ 8000496: 5e9a ldrsh r2, [r3, r2]
+ 8000498: 687b ldr r3, [r7, #4]
+ 800049a: 815a strh r2, [r3, #10]
+ * LED ON
+ * LED SMOOTH
+ * SCD4x T OFFSET
+ * BAUDRATE INDEX
+ * those can be 0 */
+ if ((config->modbus_addr == EEPROM_EMPTY_BYTE) ||
+ 800049c: 687b ldr r3, [r7, #4]
+ 800049e: 899b ldrh r3, [r3, #12]
+ 80004a0: 2b00 cmp r3, #0
+ 80004a2: d00b beq.n 80004bc
+ (config->led_co2_alert_limit1 == EEPROM_EMPTY_BYTE) ||
+ 80004a4: 687b ldr r3, [r7, #4]
+ 80004a6: 88db ldrh r3, [r3, #6]
+ if ((config->modbus_addr == EEPROM_EMPTY_BYTE) ||
+ 80004a8: 2b00 cmp r3, #0
+ 80004aa: d007 beq.n 80004bc
+ (config->led_co2_alert_limit2 == EEPROM_EMPTY_BYTE) ||
+ 80004ac: 687b ldr r3, [r7, #4]
+ 80004ae: 891b ldrh r3, [r3, #8]
+ (config->led_co2_alert_limit1 == EEPROM_EMPTY_BYTE) ||
+ 80004b0: 2b00 cmp r3, #0
+ 80004b2: d003 beq.n 80004bc
+ (config->led_brightness == EEPROM_EMPTY_BYTE))
+ 80004b4: 687b ldr r3, [r7, #4]
+ 80004b6: 885b ldrh r3, [r3, #2]
+ (config->led_co2_alert_limit2 == EEPROM_EMPTY_BYTE) ||
+ 80004b8: 2b00 cmp r3, #0
+ 80004ba: d102 bne.n 80004c2
+ {
+ return CONFIG_ERROR;
+ 80004bc: 2301 movs r3, #1
+ 80004be: 425b negs r3, r3
+ 80004c0: e000 b.n 80004c4
+ }
+ return CONFIG_OK;
+ 80004c2: 2300 movs r3, #0
+}
+ 80004c4: 0018 movs r0, r3
+ 80004c6: 46bd mov sp, r7
+ 80004c8: b002 add sp, #8
+ 80004ca: bd80 pop {r7, pc}
+ 80004cc: 08080000 .word 0x08080000
+ 80004d0: 08080002 .word 0x08080002
+ 80004d4: 08080004 .word 0x08080004
+ 80004d8: 08080006 .word 0x08080006
+ 80004dc: 08080008 .word 0x08080008
+ 80004e0: 0808000a .word 0x0808000a
+ 80004e4: 0808000c .word 0x0808000c
+ 80004e8: 0808000e .word 0x0808000e
+
+080004ec :
+
+int8_t config_write(config_t *config)
+{
+ 80004ec: b580 push {r7, lr}
+ 80004ee: b082 sub sp, #8
+ 80004f0: af00 add r7, sp, #0
+ 80004f2: 6078 str r0, [r7, #4]
+ /* Unlock the EEPROM */
+ if (eeprom_unlock() != EEPROM_OK)
+ 80004f4: f000 f8cc bl 8000690
+ 80004f8: 1e03 subs r3, r0, #0
+ 80004fa: d002 beq.n 8000502
+ {
+ return EEPROM_UNLOCK_ERROR;
+ 80004fc: 2302 movs r3, #2
+ 80004fe: 425b negs r3, r3
+ 8000500: e070 b.n 80005e4
+ }
+ /* Reset the ERASE and DATA bits in the FLASH_PECR register to disable any residual erase */
+ FLASH->PECR = FLASH->PECR & ~(FLASH_PECR_ERASE | FLASH_PECR_DATA);
+ 8000502: 4b3a ldr r3, [pc, #232] ; (80005ec )
+ 8000504: 685a ldr r2, [r3, #4]
+ 8000506: 4b39 ldr r3, [pc, #228] ; (80005ec )
+ 8000508: 4939 ldr r1, [pc, #228] ; (80005f0 )
+ 800050a: 400a ands r2, r1
+ 800050c: 605a str r2, [r3, #4]
+
+ /* Write MODBUS ADDRESS */
+ if (eeprom_program_halfword(CONFIG_EEPROM_ADDR_MODBUS_ADDR, config->modbus_addr) != EEPROM_OK)
+ 800050e: 687b ldr r3, [r7, #4]
+ 8000510: 899b ldrh r3, [r3, #12]
+ 8000512: 4a38 ldr r2, [pc, #224] ; (80005f4 )
+ 8000514: 0019 movs r1, r3
+ 8000516: 0010 movs r0, r2
+ 8000518: f000 f928 bl 800076c
+ 800051c: 1e03 subs r3, r0, #0
+ 800051e: d002 beq.n 8000526
+ {
+ return EEPROM_WRITE_ERROR;
+ 8000520: 2304 movs r3, #4
+ 8000522: 425b negs r3, r3
+ 8000524: e05e b.n 80005e4
+ }
+ /* Write BAUDRATE */
+ if (eeprom_program_halfword(CONFIG_EEPROM_ADDR_BAUDRATE_INDEX, config->baudrate_index) != EEPROM_OK)
+ 8000526: 687b ldr r3, [r7, #4]
+ 8000528: 691b ldr r3, [r3, #16]
+ 800052a: b29b uxth r3, r3
+ 800052c: 4a32 ldr r2, [pc, #200] ; (80005f8 )
+ 800052e: 0019 movs r1, r3
+ 8000530: 0010 movs r0, r2
+ 8000532: f000 f91b bl 800076c
+ 8000536: 1e03 subs r3, r0, #0
+ 8000538: d002 beq.n 8000540
+ {
+ return EEPROM_WRITE_ERROR;
+ 800053a: 2304 movs r3, #4
+ 800053c: 425b negs r3, r3
+ 800053e: e051 b.n 80005e4
+ }
+
+ /* Write LED ON */
+ if (eeprom_program_byte(CONFIG_EEPROM_ADDR_LED_ON, config->led_on) != EEPROM_OK)
+ 8000540: 687b ldr r3, [r7, #4]
+ 8000542: 781b ldrb r3, [r3, #0]
+ 8000544: 4a2d ldr r2, [pc, #180] ; (80005fc )
+ 8000546: 0019 movs r1, r3
+ 8000548: 0010 movs r0, r2
+ 800054a: f000 f8e7 bl 800071c
+ 800054e: 1e03 subs r3, r0, #0
+ 8000550: d002 beq.n 8000558
+ {
+ return EEPROM_WRITE_ERROR;
+ 8000552: 2304 movs r3, #4
+ 8000554: 425b negs r3, r3
+ 8000556: e045 b.n 80005e4
+ }
+
+ /* Write LED BRIGHTNESS */
+ if (eeprom_program_halfword(CONFIG_EEPROM_ADDR_LED_BRIGHTNESS, config->led_brightness) != EEPROM_OK)
+ 8000558: 687b ldr r3, [r7, #4]
+ 800055a: 885b ldrh r3, [r3, #2]
+ 800055c: 4a28 ldr r2, [pc, #160] ; (8000600 )
+ 800055e: 0019 movs r1, r3
+ 8000560: 0010 movs r0, r2
+ 8000562: f000 f903 bl 800076c
+ 8000566: 1e03 subs r3, r0, #0
+ 8000568: d002 beq.n 8000570
+ {
+ return EEPROM_WRITE_ERROR;
+ 800056a: 2304 movs r3, #4
+ 800056c: 425b negs r3, r3
+ 800056e: e039 b.n 80005e4
+ }
+
+ /* Write LED SMOOTH */
+ if (eeprom_program_byte(CONFIG_EEPROM_ADDR_LED_SMOOTH, config->led_smooth) != EEPROM_OK)
+ 8000570: 687b ldr r3, [r7, #4]
+ 8000572: 791b ldrb r3, [r3, #4]
+ 8000574: 4a23 ldr r2, [pc, #140] ; (8000604 )
+ 8000576: 0019 movs r1, r3
+ 8000578: 0010 movs r0, r2
+ 800057a: f000 f8cf bl 800071c
+ 800057e: 1e03 subs r3, r0, #0
+ 8000580: d002 beq.n 8000588
+ {
+ return EEPROM_WRITE_ERROR;
+ 8000582: 2304 movs r3, #4
+ 8000584: 425b negs r3, r3
+ 8000586: e02d b.n 80005e4
+ }
+
+ /* Write LED CO2 ALERT LIMIT 1 */
+ if (eeprom_program_halfword(CONFIG_EEPROM_ADDR_LED_ALERT1, config->led_co2_alert_limit1) != EEPROM_OK)
+ 8000588: 687b ldr r3, [r7, #4]
+ 800058a: 88db ldrh r3, [r3, #6]
+ 800058c: 4a1e ldr r2, [pc, #120] ; (8000608 )
+ 800058e: 0019 movs r1, r3
+ 8000590: 0010 movs r0, r2
+ 8000592: f000 f8eb bl 800076c
+ 8000596: 1e03 subs r3, r0, #0
+ 8000598: d002 beq.n 80005a0
+ {
+ return EEPROM_WRITE_ERROR;
+ 800059a: 2304 movs r3, #4
+ 800059c: 425b negs r3, r3
+ 800059e: e021 b.n 80005e4
+ }
+
+ /* Write LED CO2 ALERT LIMIT 2 */
+ if (eeprom_program_halfword(CONFIG_EEPROM_ADDR_LED_ALERT2, config->led_co2_alert_limit2) != EEPROM_OK)
+ 80005a0: 687b ldr r3, [r7, #4]
+ 80005a2: 891b ldrh r3, [r3, #8]
+ 80005a4: 4a19 ldr r2, [pc, #100] ; (800060c )
+ 80005a6: 0019 movs r1, r3
+ 80005a8: 0010 movs r0, r2
+ 80005aa: f000 f8df bl 800076c
+ 80005ae: 1e03 subs r3, r0, #0
+ 80005b0: d002 beq.n 80005b8
+ {
+ return EEPROM_WRITE_ERROR;
+ 80005b2: 2304 movs r3, #4
+ 80005b4: 425b negs r3, r3
+ 80005b6: e015 b.n 80005e4
+ }
+
+ /* Write LED SCD4x TEMPERATURE OFFSET */
+ if (eeprom_program_halfword(CONFIG_EEPROM_ADDR_SCD4x_T_OFFSET, config->scd4x_t_offset) != EEPROM_OK)
+ 80005b8: 687b ldr r3, [r7, #4]
+ 80005ba: 220a movs r2, #10
+ 80005bc: 5e9b ldrsh r3, [r3, r2]
+ 80005be: b29b uxth r3, r3
+ 80005c0: 4a13 ldr r2, [pc, #76] ; (8000610 )
+ 80005c2: 0019 movs r1, r3
+ 80005c4: 0010 movs r0, r2
+ 80005c6: f000 f8d1 bl 800076c
+ 80005ca: 1e03 subs r3, r0, #0
+ 80005cc: d002 beq.n 80005d4
+ {
+ return EEPROM_WRITE_ERROR;
+ 80005ce: 2304 movs r3, #4
+ 80005d0: 425b negs r3, r3
+ 80005d2: e007 b.n 80005e4
+ }
+
+ /* Lock EEPROM*/
+ if (eeprom_lock() != EEPROM_OK)
+ 80005d4: f000 f81e bl 8000614
+ 80005d8: 1e03 subs r3, r0, #0
+ 80005da: d002 beq.n 80005e2
+ {
+ return EEPROM_LOCK_ERROR;
+ 80005dc: 2303 movs r3, #3
+ 80005de: 425b negs r3, r3
+ 80005e0: e000 b.n 80005e4
+ }
+ return CONFIG_OK;
+ 80005e2: 2300 movs r3, #0
+}
+ 80005e4: 0018 movs r0, r3
+ 80005e6: 46bd mov sp, r7
+ 80005e8: b002 add sp, #8
+ 80005ea: bd80 pop {r7, pc}
+ 80005ec: 40022000 .word 0x40022000
+ 80005f0: fffffdef .word 0xfffffdef
+ 80005f4: 08080000 .word 0x08080000
+ 80005f8: 08080002 .word 0x08080002
+ 80005fc: 08080004 .word 0x08080004
+ 8000600: 08080006 .word 0x08080006
+ 8000604: 08080008 .word 0x08080008
+ 8000608: 0808000a .word 0x0808000a
+ 800060c: 0808000c .word 0x0808000c
+ 8000610: 0808000e .word 0x0808000e
+
+08000614 :
+
+static int8_t eeprom_lock(void)
+{
+ 8000614: b580 push {r7, lr}
+ 8000616: b084 sub sp, #16
+ 8000618: af00 add r7, sp, #0
+ uint32_t tick_start = SysTick->VAL;
+ 800061a: 4b19 ldr r3, [pc, #100] ; (8000680 )
+ 800061c: 689b ldr r3, [r3, #8]
+ 800061e: 60bb str r3, [r7, #8]
+ while ((FLASH->SR & FLASH_SR_BSY) != 0) /* Wait for FLASH to be free */
+ 8000620: e017 b.n 8000652
+ {
+ /* Timeout test */
+ /* The maximum writing time is 3.94ms (half-word) */
+ uint32_t tick_last = SysTick->VAL;
+ 8000622: 4b17 ldr r3, [pc, #92] ; (8000680 )
+ 8000624: 689b ldr r3, [r3, #8]
+ 8000626: 607b str r3, [r7, #4]
+ uint32_t tick_diff;
+ if (tick_start <= tick_last)
+ 8000628: 68ba ldr r2, [r7, #8]
+ 800062a: 687b ldr r3, [r7, #4]
+ 800062c: 429a cmp r2, r3
+ 800062e: d804 bhi.n 800063a
+ {
+ tick_diff = tick_last - tick_start;
+ 8000630: 687a ldr r2, [r7, #4]
+ 8000632: 68bb ldr r3, [r7, #8]
+ 8000634: 1ad3 subs r3, r2, r3
+ 8000636: 60fb str r3, [r7, #12]
+ 8000638: e004 b.n 8000644
+ } else
+ {
+ tick_diff = (0xFFFFFFFF - tick_last) + tick_start;
+ 800063a: 68ba ldr r2, [r7, #8]
+ 800063c: 687b ldr r3, [r7, #4]
+ 800063e: 1ad3 subs r3, r2, r3
+ 8000640: 3b01 subs r3, #1
+ 8000642: 60fb str r3, [r7, #12]
+ }
+
+ /* If the time difference is more than 5ms */
+ if (tick_diff >= (uint32_t)((uint32_t)SYSTICK_FREQ_HZ*(uint32_t)EEPROM_TIMEOUT_MAX_MS_INV))
+ 8000644: 68fb ldr r3, [r7, #12]
+ 8000646: 4a0f ldr r2, [pc, #60] ; (8000684 )
+ 8000648: 4293 cmp r3, r2
+ 800064a: d902 bls.n 8000652
+ {
+ return EEPROM_LOCK_ERROR;
+ 800064c: 2303 movs r3, #3
+ 800064e: 425b negs r3, r3
+ 8000650: e011 b.n 8000676
+ while ((FLASH->SR & FLASH_SR_BSY) != 0) /* Wait for FLASH to be free */
+ 8000652: 4b0d ldr r3, [pc, #52] ; (8000688 )
+ 8000654: 699b ldr r3, [r3, #24]
+ 8000656: 2201 movs r2, #1
+ 8000658: 4013 ands r3, r2
+ 800065a: d1e2 bne.n 8000622
+ }
+ }
+
+ FLASH->PECR = FLASH->PECR & ~(FLASH_PECR_ERRIE | FLASH_PECR_EOPIE); /* disable flash interrupts */
+ 800065c: 4b0a ldr r3, [pc, #40] ; (8000688 )
+ 800065e: 685a ldr r2, [r3, #4]
+ 8000660: 4b09 ldr r3, [pc, #36] ; (8000688 )
+ 8000662: 490a ldr r1, [pc, #40] ; (800068c )
+ 8000664: 400a ands r2, r1
+ 8000666: 605a str r2, [r3, #4]
+ FLASH->PECR = FLASH->PECR | FLASH_PECR_PELOCK; /* Lock memory with PELOCK */
+ 8000668: 4b07 ldr r3, [pc, #28] ; (8000688 )
+ 800066a: 685a ldr r2, [r3, #4]
+ 800066c: 4b06 ldr r3, [pc, #24] ; (8000688 )
+ 800066e: 2101 movs r1, #1
+ 8000670: 430a orrs r2, r1
+ 8000672: 605a str r2, [r3, #4]
+
+ return EEPROM_OK;
+ 8000674: 2300 movs r3, #0
+}
+ 8000676: 0018 movs r0, r3
+ 8000678: 46bd mov sp, r7
+ 800067a: b004 add sp, #16
+ 800067c: bd80 pop {r7, pc}
+ 800067e: 46c0 nop ; (mov r8, r8)
+ 8000680: e000e010 .word 0xe000e010
+ 8000684: 8f0d17ff .word 0x8f0d17ff
+ 8000688: 40022000 .word 0x40022000
+ 800068c: fffcffff .word 0xfffcffff
+
+08000690 :
+
+static int8_t eeprom_unlock(void)
+{
+ 8000690: b580 push {r7, lr}
+ 8000692: b084 sub sp, #16
+ 8000694: af00 add r7, sp, #0
+ uint32_t tick_start = SysTick->VAL;
+ 8000696: 4b1c ldr r3, [pc, #112] ; (8000708 )
+ 8000698: 689b ldr r3, [r3, #8]
+ 800069a: 60bb str r3, [r7, #8]
+ while ((FLASH->SR & FLASH_SR_BSY) != 0) /* Wait for FLASH to be free */
+ 800069c: e017 b.n 80006ce
+ {
+ /* Timeout test */
+ /* The maximum writing time is 3.94ms (half-word) */
+ uint32_t tick_last = SysTick->VAL;
+ 800069e: 4b1a ldr r3, [pc, #104] ; (8000708 )
+ 80006a0: 689b ldr r3, [r3, #8]
+ 80006a2: 607b str r3, [r7, #4]
+ uint32_t tick_diff;
+ if (tick_start <= tick_last)
+ 80006a4: 68ba ldr r2, [r7, #8]
+ 80006a6: 687b ldr r3, [r7, #4]
+ 80006a8: 429a cmp r2, r3
+ 80006aa: d804 bhi.n 80006b6
+ {
+ tick_diff = tick_last - tick_start;
+ 80006ac: 687a ldr r2, [r7, #4]
+ 80006ae: 68bb ldr r3, [r7, #8]
+ 80006b0: 1ad3 subs r3, r2, r3
+ 80006b2: 60fb str r3, [r7, #12]
+ 80006b4: e004 b.n 80006c0
+ } else
+ {
+ tick_diff = (0xFFFFFFFF - tick_last) + tick_start;
+ 80006b6: 68ba ldr r2, [r7, #8]
+ 80006b8: 687b ldr r3, [r7, #4]
+ 80006ba: 1ad3 subs r3, r2, r3
+ 80006bc: 3b01 subs r3, #1
+ 80006be: 60fb str r3, [r7, #12]
+ }
+
+ /* If the time difference is more than 5ms */
+ if (tick_diff >= (uint32_t)((uint32_t)SYSTICK_FREQ_HZ*(uint32_t)EEPROM_TIMEOUT_MAX_MS_INV))
+ 80006c0: 68fb ldr r3, [r7, #12]
+ 80006c2: 4a12 ldr r2, [pc, #72] ; (800070c )
+ 80006c4: 4293 cmp r3, r2
+ 80006c6: d902 bls.n 80006ce
+ {
+ return EEPROM_UNLOCK_ERROR;
+ 80006c8: 2302 movs r3, #2
+ 80006ca: 425b negs r3, r3
+ 80006cc: e017 b.n 80006fe
+ while ((FLASH->SR & FLASH_SR_BSY) != 0) /* Wait for FLASH to be free */
+ 80006ce: 4b10 ldr r3, [pc, #64] ; (8000710 )
+ 80006d0: 699b ldr r3, [r3, #24]
+ 80006d2: 2201 movs r2, #1
+ 80006d4: 4013 ands r3, r2
+ 80006d6: d1e2 bne.n 800069e
+ }
+ }
+ if ((FLASH->PECR & FLASH_PECR_PELOCK) != 0) /* If PELOCK is locked */
+ 80006d8: 4b0d ldr r3, [pc, #52] ; (8000710 )
+ 80006da: 685b ldr r3, [r3, #4]
+ 80006dc: 2201 movs r2, #1
+ 80006de: 4013 ands r3, r2
+ 80006e0: d005 beq.n 80006ee
+ {
+ /* Unlock PELOCK */
+ FLASH->PEKEYR = FLASH_PEKEY1; /* PEKEY1 */
+ 80006e2: 4b0b ldr r3, [pc, #44] ; (8000710 )
+ 80006e4: 4a0b ldr r2, [pc, #44] ; (8000714 )
+ 80006e6: 60da str r2, [r3, #12]
+ FLASH->PEKEYR = FLASH_PEKEY2; /* PEKEY2 */
+ 80006e8: 4b09 ldr r3, [pc, #36] ; (8000710 )
+ 80006ea: 4a0b ldr r2, [pc, #44] ; (8000718 )
+ 80006ec: 60da str r2, [r3, #12]
+ }
+ FLASH->PECR = FLASH->PECR | (FLASH_PECR_ERRIE | FLASH_PECR_EOPIE); /* enable flash interrupts */
+ 80006ee: 4b08 ldr r3, [pc, #32] ; (8000710 )
+ 80006f0: 685a ldr r2, [r3, #4]
+ 80006f2: 4b07 ldr r3, [pc, #28] ; (8000710 )
+ 80006f4: 21c0 movs r1, #192 ; 0xc0
+ 80006f6: 0289 lsls r1, r1, #10
+ 80006f8: 430a orrs r2, r1
+ 80006fa: 605a str r2, [r3, #4]
+ return EEPROM_OK;
+ 80006fc: 2300 movs r3, #0
+}
+ 80006fe: 0018 movs r0, r3
+ 8000700: 46bd mov sp, r7
+ 8000702: b004 add sp, #16
+ 8000704: bd80 pop {r7, pc}
+ 8000706: 46c0 nop ; (mov r8, r8)
+ 8000708: e000e010 .word 0xe000e010
+ 800070c: 8f0d17ff .word 0x8f0d17ff
+ 8000710: 40022000 .word 0x40022000
+ 8000714: 89abcdef .word 0x89abcdef
+ 8000718: 02030405 .word 0x02030405
+
+0800071c :
+
+static int8_t eeprom_program_byte(uint32_t addr, uint8_t ee_data)
+{
+ 800071c: b580 push {r7, lr}
+ 800071e: b082 sub sp, #8
+ 8000720: af00 add r7, sp, #0
+ 8000722: 6078 str r0, [r7, #4]
+ 8000724: 000a movs r2, r1
+ 8000726: 1cfb adds r3, r7, #3
+ 8000728: 701a strb r2, [r3, #0]
+ if ((EEPROM_ADDR_START <= addr) && (addr <= EEPROM_ADDR_END - 1))
+ 800072a: 687b ldr r3, [r7, #4]
+ 800072c: 4a0d ldr r2, [pc, #52] ; (8000764 )
+ 800072e: 4293 cmp r3, r2
+ 8000730: d912 bls.n 8000758
+ 8000732: 687b ldr r3, [r7, #4]
+ 8000734: 4a0c ldr r2, [pc, #48] ; (8000768 )
+ 8000736: 4293 cmp r3, r2
+ 8000738: d80e bhi.n 8000758
+ {
+ *(uint8_t *)(addr) = ee_data; /* write data to EEPROM */
+ 800073a: 687b ldr r3, [r7, #4]
+ 800073c: 1cfa adds r2, r7, #3
+ 800073e: 7812 ldrb r2, [r2, #0]
+ 8000740: 701a strb r2, [r3, #0]
+ if (*(uint8_t *)(addr) != ee_data)
+ 8000742: 687b ldr r3, [r7, #4]
+ 8000744: 781b ldrb r3, [r3, #0]
+ 8000746: 1cfa adds r2, r7, #3
+ 8000748: 7812 ldrb r2, [r2, #0]
+ 800074a: 429a cmp r2, r3
+ 800074c: d002 beq.n 8000754
+ {
+ return EEPROM_WRITE_ERROR;
+ 800074e: 2304 movs r3, #4
+ 8000750: 425b negs r3, r3
+ 8000752: e003 b.n 800075c
+ }
+ return EEPROM_OK;
+ 8000754: 2300 movs r3, #0
+ 8000756: e001 b.n 800075c
+ } else
+ {
+ return EEPROM_ADDR_ERROR;
+ 8000758: 2305 movs r3, #5
+ 800075a: 425b negs r3, r3
+ }
+}
+ 800075c: 0018 movs r0, r3
+ 800075e: 46bd mov sp, r7
+ 8000760: b002 add sp, #8
+ 8000762: bd80 pop {r7, pc}
+ 8000764: 0807ffff .word 0x0807ffff
+ 8000768: 080801fe .word 0x080801fe
+
+0800076c :
+static int8_t eeprom_program_halfword(uint32_t addr, uint16_t ee_data)
+{
+ 800076c: b580 push {r7, lr}
+ 800076e: b082 sub sp, #8
+ 8000770: af00 add r7, sp, #0
+ 8000772: 6078 str r0, [r7, #4]
+ 8000774: 000a movs r2, r1
+ 8000776: 1cbb adds r3, r7, #2
+ 8000778: 801a strh r2, [r3, #0]
+ if ((EEPROM_ADDR_START <= addr) && (addr <= EEPROM_ADDR_END - 2))
+ 800077a: 687b ldr r3, [r7, #4]
+ 800077c: 4a0d ldr r2, [pc, #52] ; (80007b4 )
+ 800077e: 4293 cmp r3, r2
+ 8000780: d912 bls.n 80007a8
+ 8000782: 687b ldr r3, [r7, #4]
+ 8000784: 4a0c ldr r2, [pc, #48] ; (80007b8 )
+ 8000786: 4293 cmp r3, r2
+ 8000788: d80e bhi.n 80007a8
+ {
+ *(uint16_t *)(addr) = ee_data; /* write data to EEPROM */
+ 800078a: 687b ldr r3, [r7, #4]
+ 800078c: 1cba adds r2, r7, #2
+ 800078e: 8812 ldrh r2, [r2, #0]
+ 8000790: 801a strh r2, [r3, #0]
+ if (*(uint16_t *)(addr) != ee_data)
+ 8000792: 687b ldr r3, [r7, #4]
+ 8000794: 881b ldrh r3, [r3, #0]
+ 8000796: 1cba adds r2, r7, #2
+ 8000798: 8812 ldrh r2, [r2, #0]
+ 800079a: 429a cmp r2, r3
+ 800079c: d002 beq.n 80007a4
+ {
+ return EEPROM_WRITE_ERROR;
+ 800079e: 2304 movs r3, #4
+ 80007a0: 425b negs r3, r3
+ 80007a2: e003 b.n 80007ac
+ }
+ return EEPROM_OK;
+ 80007a4: 2300 movs r3, #0
+ 80007a6: e001 b.n 80007ac
+ } else
+ {
+ return EEPROM_ADDR_ERROR;
+ 80007a8: 2305 movs r3, #5
+ 80007aa: 425b negs r3, r3
+ }
+}
+ 80007ac: 0018 movs r0, r3
+ 80007ae: 46bd mov sp, r7
+ 80007b0: b002 add sp, #8
+ 80007b2: bd80 pop {r7, pc}
+ 80007b4: 0807ffff .word 0x0807ffff
+ 80007b8: 080801fd .word 0x080801fd
+
+080007bc :
+ * @rmtoll ISR TXE LL_I2C_IsActiveFlag_TXE
+ * @param I2Cx I2C Instance.
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_I2C_IsActiveFlag_TXE(I2C_TypeDef *I2Cx)
+{
+ 80007bc: b580 push {r7, lr}
+ 80007be: b082 sub sp, #8
+ 80007c0: af00 add r7, sp, #0
+ 80007c2: 6078 str r0, [r7, #4]
+ return ((READ_BIT(I2Cx->ISR, I2C_ISR_TXE) == (I2C_ISR_TXE)) ? 1UL : 0UL);
+ 80007c4: 687b ldr r3, [r7, #4]
+ 80007c6: 699b ldr r3, [r3, #24]
+ 80007c8: 2201 movs r2, #1
+ 80007ca: 4013 ands r3, r2
+ 80007cc: 2b01 cmp r3, #1
+ 80007ce: d101 bne.n 80007d4
+ 80007d0: 2301 movs r3, #1
+ 80007d2: e000 b.n 80007d6
+ 80007d4: 2300 movs r3, #0
+}
+ 80007d6: 0018 movs r0, r3
+ 80007d8: 46bd mov sp, r7
+ 80007da: b002 add sp, #8
+ 80007dc: bd80 pop {r7, pc}
+
+080007de :
+ * @rmtoll ISR RXNE LL_I2C_IsActiveFlag_RXNE
+ * @param I2Cx I2C Instance.
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_I2C_IsActiveFlag_RXNE(I2C_TypeDef *I2Cx)
+{
+ 80007de: b580 push {r7, lr}
+ 80007e0: b082 sub sp, #8
+ 80007e2: af00 add r7, sp, #0
+ 80007e4: 6078 str r0, [r7, #4]
+ return ((READ_BIT(I2Cx->ISR, I2C_ISR_RXNE) == (I2C_ISR_RXNE)) ? 1UL : 0UL);
+ 80007e6: 687b ldr r3, [r7, #4]
+ 80007e8: 699b ldr r3, [r3, #24]
+ 80007ea: 2204 movs r2, #4
+ 80007ec: 4013 ands r3, r2
+ 80007ee: 2b04 cmp r3, #4
+ 80007f0: d101 bne.n 80007f6
+ 80007f2: 2301 movs r3, #1
+ 80007f4: e000 b.n 80007f8
+ 80007f6: 2300 movs r3, #0
+}
+ 80007f8: 0018 movs r0, r3
+ 80007fa: 46bd mov sp, r7
+ 80007fc: b002 add sp, #8
+ 80007fe: bd80 pop {r7, pc}
+
+08000800 :
+ * @rmtoll ISR NACKF LL_I2C_IsActiveFlag_NACK
+ * @param I2Cx I2C Instance.
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_I2C_IsActiveFlag_NACK(I2C_TypeDef *I2Cx)
+{
+ 8000800: b580 push {r7, lr}
+ 8000802: b082 sub sp, #8
+ 8000804: af00 add r7, sp, #0
+ 8000806: 6078 str r0, [r7, #4]
+ return ((READ_BIT(I2Cx->ISR, I2C_ISR_NACKF) == (I2C_ISR_NACKF)) ? 1UL : 0UL);
+ 8000808: 687b ldr r3, [r7, #4]
+ 800080a: 699b ldr r3, [r3, #24]
+ 800080c: 2210 movs r2, #16
+ 800080e: 4013 ands r3, r2
+ 8000810: 2b10 cmp r3, #16
+ 8000812: d101 bne.n 8000818
+ 8000814: 2301 movs r3, #1
+ 8000816: e000 b.n 800081a
+ 8000818: 2300 movs r3, #0
+}
+ 800081a: 0018 movs r0, r3
+ 800081c: 46bd mov sp, r7
+ 800081e: b002 add sp, #8
+ 8000820: bd80 pop {r7, pc}
+
+08000822 :
+ * @rmtoll ISR STOPF LL_I2C_IsActiveFlag_STOP
+ * @param I2Cx I2C Instance.
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_I2C_IsActiveFlag_STOP(I2C_TypeDef *I2Cx)
+{
+ 8000822: b580 push {r7, lr}
+ 8000824: b082 sub sp, #8
+ 8000826: af00 add r7, sp, #0
+ 8000828: 6078 str r0, [r7, #4]
+ return ((READ_BIT(I2Cx->ISR, I2C_ISR_STOPF) == (I2C_ISR_STOPF)) ? 1UL : 0UL);
+ 800082a: 687b ldr r3, [r7, #4]
+ 800082c: 699b ldr r3, [r3, #24]
+ 800082e: 2220 movs r2, #32
+ 8000830: 4013 ands r3, r2
+ 8000832: 2b20 cmp r3, #32
+ 8000834: d101 bne.n 800083a
+ 8000836: 2301 movs r3, #1
+ 8000838: e000 b.n 800083c
+ 800083a: 2300 movs r3, #0
+}
+ 800083c: 0018 movs r0, r3
+ 800083e: 46bd mov sp, r7
+ 8000840: b002 add sp, #8
+ 8000842: bd80 pop {r7, pc}
+
+08000844 :
+ * @rmtoll ICR STOPCF LL_I2C_ClearFlag_STOP
+ * @param I2Cx I2C Instance.
+ * @retval None
+ */
+__STATIC_INLINE void LL_I2C_ClearFlag_STOP(I2C_TypeDef *I2Cx)
+{
+ 8000844: b580 push {r7, lr}
+ 8000846: b082 sub sp, #8
+ 8000848: af00 add r7, sp, #0
+ 800084a: 6078 str r0, [r7, #4]
+ SET_BIT(I2Cx->ICR, I2C_ICR_STOPCF);
+ 800084c: 687b ldr r3, [r7, #4]
+ 800084e: 69db ldr r3, [r3, #28]
+ 8000850: 2220 movs r2, #32
+ 8000852: 431a orrs r2, r3
+ 8000854: 687b ldr r3, [r7, #4]
+ 8000856: 61da str r2, [r3, #28]
+}
+ 8000858: 46c0 nop ; (mov r8, r8)
+ 800085a: 46bd mov sp, r7
+ 800085c: b002 add sp, #8
+ 800085e: bd80 pop {r7, pc}
+
+08000860 :
+ * @arg @ref LL_I2C_GENERATE_RESTART_10BIT_WRITE
+ * @retval None
+ */
+__STATIC_INLINE void LL_I2C_HandleTransfer(I2C_TypeDef *I2Cx, uint32_t SlaveAddr, uint32_t SlaveAddrSize,
+ uint32_t TransferSize, uint32_t EndMode, uint32_t Request)
+{
+ 8000860: b580 push {r7, lr}
+ 8000862: b084 sub sp, #16
+ 8000864: af00 add r7, sp, #0
+ 8000866: 60f8 str r0, [r7, #12]
+ 8000868: 60b9 str r1, [r7, #8]
+ 800086a: 607a str r2, [r7, #4]
+ 800086c: 603b str r3, [r7, #0]
+ MODIFY_REG(I2Cx->CR2, I2C_CR2_SADD | I2C_CR2_ADD10 |
+ 800086e: 68fb ldr r3, [r7, #12]
+ 8000870: 685b ldr r3, [r3, #4]
+ 8000872: 69fa ldr r2, [r7, #28]
+ 8000874: 0d51 lsrs r1, r2, #21
+ 8000876: 2280 movs r2, #128 ; 0x80
+ 8000878: 00d2 lsls r2, r2, #3
+ 800087a: 400a ands r2, r1
+ 800087c: 490a ldr r1, [pc, #40] ; (80008a8 )
+ 800087e: 430a orrs r2, r1
+ 8000880: 43d2 mvns r2, r2
+ 8000882: 401a ands r2, r3
+ 8000884: 68b9 ldr r1, [r7, #8]
+ 8000886: 687b ldr r3, [r7, #4]
+ 8000888: 4319 orrs r1, r3
+ 800088a: 683b ldr r3, [r7, #0]
+ 800088c: 041b lsls r3, r3, #16
+ 800088e: 4319 orrs r1, r3
+ 8000890: 69bb ldr r3, [r7, #24]
+ 8000892: 4319 orrs r1, r3
+ 8000894: 69fb ldr r3, [r7, #28]
+ 8000896: 430b orrs r3, r1
+ 8000898: 431a orrs r2, r3
+ 800089a: 68fb ldr r3, [r7, #12]
+ 800089c: 605a str r2, [r3, #4]
+ (I2C_CR2_RD_WRN & (uint32_t)(Request >> (31U - I2C_CR2_RD_WRN_Pos))) |
+ I2C_CR2_START | I2C_CR2_STOP | I2C_CR2_RELOAD |
+ I2C_CR2_NBYTES | I2C_CR2_AUTOEND | I2C_CR2_HEAD10R,
+ SlaveAddr | SlaveAddrSize | (TransferSize << I2C_CR2_NBYTES_Pos) | EndMode | Request);
+}
+ 800089e: 46c0 nop ; (mov r8, r8)
+ 80008a0: 46bd mov sp, r7
+ 80008a2: b004 add sp, #16
+ 80008a4: bd80 pop {r7, pc}
+ 80008a6: 46c0 nop ; (mov r8, r8)
+ 80008a8: 03ff7bff .word 0x03ff7bff
+
+080008ac :
+ * @rmtoll RXDR RXDATA LL_I2C_ReceiveData8
+ * @param I2Cx I2C Instance.
+ * @retval Value between Min_Data=0x00 and Max_Data=0xFF
+ */
+__STATIC_INLINE uint8_t LL_I2C_ReceiveData8(I2C_TypeDef *I2Cx)
+{
+ 80008ac: b580 push {r7, lr}
+ 80008ae: b082 sub sp, #8
+ 80008b0: af00 add r7, sp, #0
+ 80008b2: 6078 str r0, [r7, #4]
+ return (uint8_t)(READ_BIT(I2Cx->RXDR, I2C_RXDR_RXDATA));
+ 80008b4: 687b ldr r3, [r7, #4]
+ 80008b6: 6a5b ldr r3, [r3, #36] ; 0x24
+ 80008b8: b2db uxtb r3, r3
+}
+ 80008ba: 0018 movs r0, r3
+ 80008bc: 46bd mov sp, r7
+ 80008be: b002 add sp, #8
+ 80008c0: bd80 pop {r7, pc}
+
+080008c2 :
+ * @param I2Cx I2C Instance.
+ * @param Data Value between Min_Data=0x00 and Max_Data=0xFF
+ * @retval None
+ */
+__STATIC_INLINE void LL_I2C_TransmitData8(I2C_TypeDef *I2Cx, uint8_t Data)
+{
+ 80008c2: b580 push {r7, lr}
+ 80008c4: b082 sub sp, #8
+ 80008c6: af00 add r7, sp, #0
+ 80008c8: 6078 str r0, [r7, #4]
+ 80008ca: 000a movs r2, r1
+ 80008cc: 1cfb adds r3, r7, #3
+ 80008ce: 701a strb r2, [r3, #0]
+ WRITE_REG(I2Cx->TXDR, Data);
+ 80008d0: 1cfb adds r3, r7, #3
+ 80008d2: 781a ldrb r2, [r3, #0]
+ 80008d4: 687b ldr r3, [r7, #4]
+ 80008d6: 629a str r2, [r3, #40] ; 0x28
+}
+ 80008d8: 46c0 nop ; (mov r8, r8)
+ 80008da: 46bd mov sp, r7
+ 80008dc: b002 add sp, #8
+ 80008de: bd80 pop {r7, pc}
+
+080008e0 :
+#include "stm32l0xx_ll_lpuart.h"
+
+i2c_context_t *i2c_context;
+
+int i2c_init(i2c_context_t *context)
+{
+ 80008e0: b580 push {r7, lr}
+ 80008e2: b082 sub sp, #8
+ 80008e4: af00 add r7, sp, #0
+ 80008e6: 6078 str r0, [r7, #4]
+ if (context == NULL) {
+ 80008e8: 687b ldr r3, [r7, #4]
+ 80008ea: 2b00 cmp r3, #0
+ 80008ec: d102 bne.n 80008f4
+ return I2C_ERROR;
+ 80008ee: 2301 movs r3, #1
+ 80008f0: 425b negs r3, r3
+ 80008f2: e003 b.n 80008fc
+ }
+ i2c_context = context;
+ 80008f4: 4b03 ldr r3, [pc, #12] ; (8000904 )
+ 80008f6: 687a ldr r2, [r7, #4]
+ 80008f8: 601a str r2, [r3, #0]
+ return I2C_OK;
+ 80008fa: 2300 movs r3, #0
+}
+ 80008fc: 0018 movs r0, r3
+ 80008fe: 46bd mov sp, r7
+ 8000900: b002 add sp, #8
+ 8000902: bd80 pop {r7, pc}
+ 8000904: 20000034 .word 0x20000034
+
+08000908 :
+
+int i2c_transmit(uint8_t address, uint8_t *buffer, int len)
+{
+ 8000908: b580 push {r7, lr}
+ 800090a: b088 sub sp, #32
+ 800090c: af02 add r7, sp, #8
+ 800090e: 60b9 str r1, [r7, #8]
+ 8000910: 607a str r2, [r7, #4]
+ 8000912: 210f movs r1, #15
+ 8000914: 187b adds r3, r7, r1
+ 8000916: 1c02 adds r2, r0, #0
+ 8000918: 701a strb r2, [r3, #0]
+ /* prevent interrupts during I2C communication (e.g. collision with MODBUS) */
+// LL_LPUART_Disable(LPUART1);
+// LL_LPUART_DisableIT_RXNE(LPUART1);
+// __disable_irq();
+ LL_I2C_HandleTransfer(i2c_context->i2c, address, LL_I2C_ADDRSLAVE_7BIT, len,
+ 800091a: 4b28 ldr r3, [pc, #160] ; (80009bc )
+ 800091c: 681b ldr r3, [r3, #0]
+ 800091e: 6818 ldr r0, [r3, #0]
+ 8000920: 187b adds r3, r7, r1
+ 8000922: 7819 ldrb r1, [r3, #0]
+ 8000924: 687a ldr r2, [r7, #4]
+ 8000926: 4b26 ldr r3, [pc, #152] ; (80009c0 )
+ 8000928: 9301 str r3, [sp, #4]
+ 800092a: 2380 movs r3, #128 ; 0x80
+ 800092c: 049b lsls r3, r3, #18
+ 800092e: 9300 str r3, [sp, #0]
+ 8000930: 0013 movs r3, r2
+ 8000932: 2200 movs r2, #0
+ 8000934: f7ff ff94 bl 8000860
+ LL_I2C_MODE_AUTOEND, LL_I2C_GENERATE_START_WRITE);
+ int i = 0;
+ 8000938: 2300 movs r3, #0
+ 800093a: 617b str r3, [r7, #20]
+ // Autoend mode will raise STOP flag if NACK is detected
+ // (or if desired number of bytes is transmitted)
+ while (!LL_I2C_IsActiveFlag_STOP(i2c_context->i2c)) {
+ 800093c: e018 b.n 8000970
+ if (LL_I2C_IsActiveFlag_TXE(i2c_context->i2c)) {
+ 800093e: 4b1f ldr r3, [pc, #124] ; (80009bc )
+ 8000940: 681b ldr r3, [r3, #0]
+ 8000942: 681b ldr r3, [r3, #0]
+ 8000944: 0018 movs r0, r3
+ 8000946: f7ff ff39 bl 80007bc
+ 800094a: 1e03 subs r3, r0, #0
+ 800094c: d010 beq.n 8000970
+ if (i < len) {
+ 800094e: 697a ldr r2, [r7, #20]
+ 8000950: 687b ldr r3, [r7, #4]
+ 8000952: 429a cmp r2, r3
+ 8000954: da0c bge.n 8000970
+ LL_I2C_TransmitData8(i2c_context->i2c, buffer[i++]);
+ 8000956: 4b19 ldr r3, [pc, #100] ; (80009bc )
+ 8000958: 681b ldr r3, [r3, #0]
+ 800095a: 6818 ldr r0, [r3, #0]
+ 800095c: 697b ldr r3, [r7, #20]
+ 800095e: 1c5a adds r2, r3, #1
+ 8000960: 617a str r2, [r7, #20]
+ 8000962: 001a movs r2, r3
+ 8000964: 68bb ldr r3, [r7, #8]
+ 8000966: 189b adds r3, r3, r2
+ 8000968: 781b ldrb r3, [r3, #0]
+ 800096a: 0019 movs r1, r3
+ 800096c: f7ff ffa9 bl 80008c2
+ while (!LL_I2C_IsActiveFlag_STOP(i2c_context->i2c)) {
+ 8000970: 4b12 ldr r3, [pc, #72] ; (80009bc )
+ 8000972: 681b ldr r3, [r3, #0]
+ 8000974: 681b ldr r3, [r3, #0]
+ 8000976: 0018 movs r0, r3
+ 8000978: f7ff ff53 bl 8000822
+ 800097c: 1e03 subs r3, r0, #0
+ 800097e: d0de beq.n 800093e
+ }
+ }
+ }
+ LL_I2C_ClearFlag_STOP(i2c_context->i2c);
+ 8000980: 4b0e ldr r3, [pc, #56] ; (80009bc )
+ 8000982: 681b ldr r3, [r3, #0]
+ 8000984: 681b ldr r3, [r3, #0]
+ 8000986: 0018 movs r0, r3
+ 8000988: f7ff ff5c bl 8000844
+ if (LL_I2C_IsActiveFlag_NACK(i2c_context->i2c)) {
+ 800098c: 4b0b ldr r3, [pc, #44] ; (80009bc )
+ 800098e: 681b ldr r3, [r3, #0]
+ 8000990: 681b ldr r3, [r3, #0]
+ 8000992: 0018 movs r0, r3
+ 8000994: f7ff ff34 bl 8000800
+ 8000998: 1e03 subs r3, r0, #0
+ 800099a: d002 beq.n 80009a2
+ return I2C_ERROR_NACK;
+ 800099c: 2302 movs r3, #2
+ 800099e: 425b negs r3, r3
+ 80009a0: e007 b.n 80009b2
+ }
+ if (len != i) {
+ 80009a2: 687a ldr r2, [r7, #4]
+ 80009a4: 697b ldr r3, [r7, #20]
+ 80009a6: 429a cmp r2, r3
+ 80009a8: d002 beq.n 80009b0
+ // this will probably never happen, as NACK flag
+ // is raised everytime len != number of TXed bytes
+ return I2C_ERROR_TX_INCOMPLETE;
+ 80009aa: 2303 movs r3, #3
+ 80009ac: 425b negs r3, r3
+ 80009ae: e000 b.n 80009b2
+ }
+// __enable_irq();
+// LL_LPUART_Enable(LPUART1);
+// LL_LPUART_EnableIT_RXNE(LPUART1);
+ return I2C_OK;
+ 80009b0: 2300 movs r3, #0
+}
+ 80009b2: 0018 movs r0, r3
+ 80009b4: 46bd mov sp, r7
+ 80009b6: b006 add sp, #24
+ 80009b8: bd80 pop {r7, pc}
+ 80009ba: 46c0 nop ; (mov r8, r8)
+ 80009bc: 20000034 .word 0x20000034
+ 80009c0: 80002000 .word 0x80002000
+
+080009c4 :
+
+int i2c_receive(uint8_t address, uint8_t *buffer, int len)
+{
+ 80009c4: b590 push {r4, r7, lr}
+ 80009c6: b089 sub sp, #36 ; 0x24
+ 80009c8: af02 add r7, sp, #8
+ 80009ca: 60b9 str r1, [r7, #8]
+ 80009cc: 607a str r2, [r7, #4]
+ 80009ce: 210f movs r1, #15
+ 80009d0: 187b adds r3, r7, r1
+ 80009d2: 1c02 adds r2, r0, #0
+ 80009d4: 701a strb r2, [r3, #0]
+// __disable_irq();
+// LL_LPUART_Disable(LPUART1);
+// LL_LPUART_DisableIT_RXNE(LPUART1);
+ LL_I2C_HandleTransfer(i2c_context->i2c, address, LL_I2C_ADDRSLAVE_7BIT, len,
+ 80009d6: 4b23 ldr r3, [pc, #140] ; (8000a64 )
+ 80009d8: 681b ldr r3, [r3, #0]
+ 80009da: 6818 ldr r0, [r3, #0]
+ 80009dc: 187b adds r3, r7, r1
+ 80009de: 7819 ldrb r1, [r3, #0]
+ 80009e0: 687a ldr r2, [r7, #4]
+ 80009e2: 4b21 ldr r3, [pc, #132] ; (8000a68 )
+ 80009e4: 9301 str r3, [sp, #4]
+ 80009e6: 2380 movs r3, #128 ; 0x80
+ 80009e8: 049b lsls r3, r3, #18
+ 80009ea: 9300 str r3, [sp, #0]
+ 80009ec: 0013 movs r3, r2
+ 80009ee: 2200 movs r2, #0
+ 80009f0: f7ff ff36 bl 8000860
+ LL_I2C_MODE_AUTOEND, LL_I2C_GENERATE_START_READ);
+ int i = 0;
+ 80009f4: 2300 movs r3, #0
+ 80009f6: 617b str r3, [r7, #20]
+ while (!LL_I2C_IsActiveFlag_STOP(i2c_context->i2c)) {
+ 80009f8: e019 b.n 8000a2e
+ if (LL_I2C_IsActiveFlag_RXNE(i2c_context->i2c)) {
+ 80009fa: 4b1a ldr r3, [pc, #104] ; (8000a64 )
+ 80009fc: 681b ldr r3, [r3, #0]
+ 80009fe: 681b ldr r3, [r3, #0]
+ 8000a00: 0018 movs r0, r3
+ 8000a02: f7ff feec bl 80007de
+ 8000a06: 1e03 subs r3, r0, #0
+ 8000a08: d011 beq.n 8000a2e
+ if (i < len) {
+ 8000a0a: 697a ldr r2, [r7, #20]
+ 8000a0c: 687b ldr r3, [r7, #4]
+ 8000a0e: 429a cmp r2, r3
+ 8000a10: da0d bge.n 8000a2e
+ buffer[i++] = LL_I2C_ReceiveData8(i2c_context->i2c);
+ 8000a12: 4b14 ldr r3, [pc, #80] ; (8000a64 )
+ 8000a14: 681b ldr r3, [r3, #0]
+ 8000a16: 6819 ldr r1, [r3, #0]
+ 8000a18: 697b ldr r3, [r7, #20]
+ 8000a1a: 1c5a adds r2, r3, #1
+ 8000a1c: 617a str r2, [r7, #20]
+ 8000a1e: 001a movs r2, r3
+ 8000a20: 68bb ldr r3, [r7, #8]
+ 8000a22: 189c adds r4, r3, r2
+ 8000a24: 0008 movs r0, r1
+ 8000a26: f7ff ff41 bl 80008ac
+ 8000a2a: 0003 movs r3, r0
+ 8000a2c: 7023 strb r3, [r4, #0]
+ while (!LL_I2C_IsActiveFlag_STOP(i2c_context->i2c)) {
+ 8000a2e: 4b0d ldr r3, [pc, #52] ; (8000a64 )
+ 8000a30: 681b ldr r3, [r3, #0]
+ 8000a32: 681b ldr r3, [r3, #0]
+ 8000a34: 0018 movs r0, r3
+ 8000a36: f7ff fef4 bl 8000822
+ 8000a3a: 1e03 subs r3, r0, #0
+ 8000a3c: d0dd beq.n 80009fa
+ }
+ }
+ }
+ LL_I2C_ClearFlag_STOP(i2c_context->i2c);
+ 8000a3e: 4b09 ldr r3, [pc, #36] ; (8000a64 )
+ 8000a40: 681b ldr r3, [r3, #0]
+ 8000a42: 681b ldr r3, [r3, #0]
+ 8000a44: 0018 movs r0, r3
+ 8000a46: f7ff fefd bl 8000844
+ if (len != i) {
+ 8000a4a: 687a ldr r2, [r7, #4]
+ 8000a4c: 697b ldr r3, [r7, #20]
+ 8000a4e: 429a cmp r2, r3
+ 8000a50: d002 beq.n 8000a58
+ return I2C_ERROR_RX_INCOMPLETE;
+ 8000a52: 2304 movs r3, #4
+ 8000a54: 425b negs r3, r3
+ 8000a56: e000 b.n 8000a5a
+ }
+// __enable_irq();
+// LL_LPUART_Enable(LPUART1);
+// LL_LPUART_EnableIT_RXNE(LPUART1);
+ return I2C_OK; // TODO error detection
+ 8000a58: 2300 movs r3, #0
+}
+ 8000a5a: 0018 movs r0, r3
+ 8000a5c: 46bd mov sp, r7
+ 8000a5e: b007 add sp, #28
+ 8000a60: bd90 pop {r4, r7, pc}
+ 8000a62: 46c0 nop ; (mov r8, r8)
+ 8000a64: 20000034 .word 0x20000034
+ 8000a68: 80002400 .word 0x80002400
+
+08000a6c <__NVIC_EnableIRQ>:
+ \details Enables a device specific interrupt in the NVIC interrupt controller.
+ \param [in] IRQn Device specific interrupt number.
+ \note IRQn must not be negative.
+ */
+__STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
+{
+ 8000a6c: b580 push {r7, lr}
+ 8000a6e: b082 sub sp, #8
+ 8000a70: af00 add r7, sp, #0
+ 8000a72: 0002 movs r2, r0
+ 8000a74: 1dfb adds r3, r7, #7
+ 8000a76: 701a strb r2, [r3, #0]
+ if ((int32_t)(IRQn) >= 0)
+ 8000a78: 1dfb adds r3, r7, #7
+ 8000a7a: 781b ldrb r3, [r3, #0]
+ 8000a7c: 2b7f cmp r3, #127 ; 0x7f
+ 8000a7e: d809 bhi.n 8000a94 <__NVIC_EnableIRQ+0x28>
+ {
+ NVIC->ISER[0U] = (uint32_t)(1UL << (((uint32_t)IRQn) & 0x1FUL));
+ 8000a80: 1dfb adds r3, r7, #7
+ 8000a82: 781b ldrb r3, [r3, #0]
+ 8000a84: 001a movs r2, r3
+ 8000a86: 231f movs r3, #31
+ 8000a88: 401a ands r2, r3
+ 8000a8a: 4b04 ldr r3, [pc, #16] ; (8000a9c <__NVIC_EnableIRQ+0x30>)
+ 8000a8c: 2101 movs r1, #1
+ 8000a8e: 4091 lsls r1, r2
+ 8000a90: 000a movs r2, r1
+ 8000a92: 601a str r2, [r3, #0]
+ }
+}
+ 8000a94: 46c0 nop ; (mov r8, r8)
+ 8000a96: 46bd mov sp, r7
+ 8000a98: b002 add sp, #8
+ 8000a9a: bd80 pop {r7, pc}
+ 8000a9c: e000e100 .word 0xe000e100
+
+08000aa0 <__NVIC_SetPriority>:
+ \param [in] IRQn Interrupt number.
+ \param [in] priority Priority to set.
+ \note The priority cannot be set for every processor exception.
+ */
+__STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
+{
+ 8000aa0: b590 push {r4, r7, lr}
+ 8000aa2: b083 sub sp, #12
+ 8000aa4: af00 add r7, sp, #0
+ 8000aa6: 0002 movs r2, r0
+ 8000aa8: 6039 str r1, [r7, #0]
+ 8000aaa: 1dfb adds r3, r7, #7
+ 8000aac: 701a strb r2, [r3, #0]
+ if ((int32_t)(IRQn) >= 0)
+ 8000aae: 1dfb adds r3, r7, #7
+ 8000ab0: 781b ldrb r3, [r3, #0]
+ 8000ab2: 2b7f cmp r3, #127 ; 0x7f
+ 8000ab4: d828 bhi.n 8000b08 <__NVIC_SetPriority+0x68>
+ {
+ NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ 8000ab6: 4a2f ldr r2, [pc, #188] ; (8000b74 <__NVIC_SetPriority+0xd4>)
+ 8000ab8: 1dfb adds r3, r7, #7
+ 8000aba: 781b ldrb r3, [r3, #0]
+ 8000abc: b25b sxtb r3, r3
+ 8000abe: 089b lsrs r3, r3, #2
+ 8000ac0: 33c0 adds r3, #192 ; 0xc0
+ 8000ac2: 009b lsls r3, r3, #2
+ 8000ac4: 589b ldr r3, [r3, r2]
+ 8000ac6: 1dfa adds r2, r7, #7
+ 8000ac8: 7812 ldrb r2, [r2, #0]
+ 8000aca: 0011 movs r1, r2
+ 8000acc: 2203 movs r2, #3
+ 8000ace: 400a ands r2, r1
+ 8000ad0: 00d2 lsls r2, r2, #3
+ 8000ad2: 21ff movs r1, #255 ; 0xff
+ 8000ad4: 4091 lsls r1, r2
+ 8000ad6: 000a movs r2, r1
+ 8000ad8: 43d2 mvns r2, r2
+ 8000ada: 401a ands r2, r3
+ 8000adc: 0011 movs r1, r2
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
+ 8000ade: 683b ldr r3, [r7, #0]
+ 8000ae0: 019b lsls r3, r3, #6
+ 8000ae2: 22ff movs r2, #255 ; 0xff
+ 8000ae4: 401a ands r2, r3
+ 8000ae6: 1dfb adds r3, r7, #7
+ 8000ae8: 781b ldrb r3, [r3, #0]
+ 8000aea: 0018 movs r0, r3
+ 8000aec: 2303 movs r3, #3
+ 8000aee: 4003 ands r3, r0
+ 8000af0: 00db lsls r3, r3, #3
+ 8000af2: 409a lsls r2, r3
+ NVIC->IP[_IP_IDX(IRQn)] = ((uint32_t)(NVIC->IP[_IP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ 8000af4: 481f ldr r0, [pc, #124] ; (8000b74 <__NVIC_SetPriority+0xd4>)
+ 8000af6: 1dfb adds r3, r7, #7
+ 8000af8: 781b ldrb r3, [r3, #0]
+ 8000afa: b25b sxtb r3, r3
+ 8000afc: 089b lsrs r3, r3, #2
+ 8000afe: 430a orrs r2, r1
+ 8000b00: 33c0 adds r3, #192 ; 0xc0
+ 8000b02: 009b lsls r3, r3, #2
+ 8000b04: 501a str r2, [r3, r0]
+ else
+ {
+ SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
+ }
+}
+ 8000b06: e031 b.n 8000b6c <__NVIC_SetPriority+0xcc>
+ SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ 8000b08: 4a1b ldr r2, [pc, #108] ; (8000b78 <__NVIC_SetPriority+0xd8>)
+ 8000b0a: 1dfb adds r3, r7, #7
+ 8000b0c: 781b ldrb r3, [r3, #0]
+ 8000b0e: 0019 movs r1, r3
+ 8000b10: 230f movs r3, #15
+ 8000b12: 400b ands r3, r1
+ 8000b14: 3b08 subs r3, #8
+ 8000b16: 089b lsrs r3, r3, #2
+ 8000b18: 3306 adds r3, #6
+ 8000b1a: 009b lsls r3, r3, #2
+ 8000b1c: 18d3 adds r3, r2, r3
+ 8000b1e: 3304 adds r3, #4
+ 8000b20: 681b ldr r3, [r3, #0]
+ 8000b22: 1dfa adds r2, r7, #7
+ 8000b24: 7812 ldrb r2, [r2, #0]
+ 8000b26: 0011 movs r1, r2
+ 8000b28: 2203 movs r2, #3
+ 8000b2a: 400a ands r2, r1
+ 8000b2c: 00d2 lsls r2, r2, #3
+ 8000b2e: 21ff movs r1, #255 ; 0xff
+ 8000b30: 4091 lsls r1, r2
+ 8000b32: 000a movs r2, r1
+ 8000b34: 43d2 mvns r2, r2
+ 8000b36: 401a ands r2, r3
+ 8000b38: 0011 movs r1, r2
+ (((priority << (8U - __NVIC_PRIO_BITS)) & (uint32_t)0xFFUL) << _BIT_SHIFT(IRQn)));
+ 8000b3a: 683b ldr r3, [r7, #0]
+ 8000b3c: 019b lsls r3, r3, #6
+ 8000b3e: 22ff movs r2, #255 ; 0xff
+ 8000b40: 401a ands r2, r3
+ 8000b42: 1dfb adds r3, r7, #7
+ 8000b44: 781b ldrb r3, [r3, #0]
+ 8000b46: 0018 movs r0, r3
+ 8000b48: 2303 movs r3, #3
+ 8000b4a: 4003 ands r3, r0
+ 8000b4c: 00db lsls r3, r3, #3
+ 8000b4e: 409a lsls r2, r3
+ SCB->SHP[_SHP_IDX(IRQn)] = ((uint32_t)(SCB->SHP[_SHP_IDX(IRQn)] & ~(0xFFUL << _BIT_SHIFT(IRQn))) |
+ 8000b50: 4809 ldr r0, [pc, #36] ; (8000b78 <__NVIC_SetPriority+0xd8>)
+ 8000b52: 1dfb adds r3, r7, #7
+ 8000b54: 781b ldrb r3, [r3, #0]
+ 8000b56: 001c movs r4, r3
+ 8000b58: 230f movs r3, #15
+ 8000b5a: 4023 ands r3, r4
+ 8000b5c: 3b08 subs r3, #8
+ 8000b5e: 089b lsrs r3, r3, #2
+ 8000b60: 430a orrs r2, r1
+ 8000b62: 3306 adds r3, #6
+ 8000b64: 009b lsls r3, r3, #2
+ 8000b66: 18c3 adds r3, r0, r3
+ 8000b68: 3304 adds r3, #4
+ 8000b6a: 601a str r2, [r3, #0]
+}
+ 8000b6c: 46c0 nop ; (mov r8, r8)
+ 8000b6e: 46bd mov sp, r7
+ 8000b70: b003 add sp, #12
+ 8000b72: bd90 pop {r4, r7, pc}
+ 8000b74: e000e100 .word 0xe000e100
+ 8000b78: e000ed00 .word 0xe000ed00
+
+08000b7c :
+{
+ 8000b7c: b580 push {r7, lr}
+ 8000b7e: b082 sub sp, #8
+ 8000b80: af00 add r7, sp, #0
+ 8000b82: 6078 str r0, [r7, #4]
+ SET_BIT(I2Cx->CR1, I2C_CR1_PE);
+ 8000b84: 687b ldr r3, [r7, #4]
+ 8000b86: 681b ldr r3, [r3, #0]
+ 8000b88: 2201 movs r2, #1
+ 8000b8a: 431a orrs r2, r3
+ 8000b8c: 687b ldr r3, [r7, #4]
+ 8000b8e: 601a str r2, [r3, #0]
+}
+ 8000b90: 46c0 nop ; (mov r8, r8)
+ 8000b92: 46bd mov sp, r7
+ 8000b94: b002 add sp, #8
+ 8000b96: bd80 pop {r7, pc}
+
+08000b98 :
+{
+ 8000b98: b580 push {r7, lr}
+ 8000b9a: b082 sub sp, #8
+ 8000b9c: af00 add r7, sp, #0
+ 8000b9e: 6078 str r0, [r7, #4]
+ CLEAR_BIT(I2Cx->CR1, I2C_CR1_NOSTRETCH);
+ 8000ba0: 687b ldr r3, [r7, #4]
+ 8000ba2: 681b ldr r3, [r3, #0]
+ 8000ba4: 4a03 ldr r2, [pc, #12] ; (8000bb4 )
+ 8000ba6: 401a ands r2, r3
+ 8000ba8: 687b ldr r3, [r7, #4]
+ 8000baa: 601a str r2, [r3, #0]
+}
+ 8000bac: 46c0 nop ; (mov r8, r8)
+ 8000bae: 46bd mov sp, r7
+ 8000bb0: b002 add sp, #8
+ 8000bb2: bd80 pop {r7, pc}
+ 8000bb4: fffdffff .word 0xfffdffff
+
+08000bb8 :
+{
+ 8000bb8: b580 push {r7, lr}
+ 8000bba: b082 sub sp, #8
+ 8000bbc: af00 add r7, sp, #0
+ 8000bbe: 6078 str r0, [r7, #4]
+ CLEAR_BIT(I2Cx->CR1, I2C_CR1_GCEN);
+ 8000bc0: 687b ldr r3, [r7, #4]
+ 8000bc2: 681b ldr r3, [r3, #0]
+ 8000bc4: 4a03 ldr r2, [pc, #12] ; (8000bd4 )
+ 8000bc6: 401a ands r2, r3
+ 8000bc8: 687b ldr r3, [r7, #4]
+ 8000bca: 601a str r2, [r3, #0]
+}
+ 8000bcc: 46c0 nop ; (mov r8, r8)
+ 8000bce: 46bd mov sp, r7
+ 8000bd0: b002 add sp, #8
+ 8000bd2: bd80 pop {r7, pc}
+ 8000bd4: fff7ffff .word 0xfff7ffff
+
+08000bd8 :
+{
+ 8000bd8: b580 push {r7, lr}
+ 8000bda: b084 sub sp, #16
+ 8000bdc: af00 add r7, sp, #0
+ 8000bde: 60f8 str r0, [r7, #12]
+ 8000be0: 60b9 str r1, [r7, #8]
+ 8000be2: 607a str r2, [r7, #4]
+ MODIFY_REG(I2Cx->OAR2, I2C_OAR2_OA2 | I2C_OAR2_OA2MSK, OwnAddress2 | OwnAddrMask);
+ 8000be4: 68fb ldr r3, [r7, #12]
+ 8000be6: 68db ldr r3, [r3, #12]
+ 8000be8: 4a05 ldr r2, [pc, #20] ; (8000c00 )
+ 8000bea: 401a ands r2, r3
+ 8000bec: 68b9 ldr r1, [r7, #8]
+ 8000bee: 687b ldr r3, [r7, #4]
+ 8000bf0: 430b orrs r3, r1
+ 8000bf2: 431a orrs r2, r3
+ 8000bf4: 68fb ldr r3, [r7, #12]
+ 8000bf6: 60da str r2, [r3, #12]
+}
+ 8000bf8: 46c0 nop ; (mov r8, r8)
+ 8000bfa: 46bd mov sp, r7
+ 8000bfc: b004 add sp, #16
+ 8000bfe: bd80 pop {r7, pc}
+ 8000c00: fffff801 .word 0xfffff801
+
+08000c04 :
+{
+ 8000c04: b580 push {r7, lr}
+ 8000c06: b082 sub sp, #8
+ 8000c08: af00 add r7, sp, #0
+ 8000c0a: 6078 str r0, [r7, #4]
+ CLEAR_BIT(I2Cx->OAR2, I2C_OAR2_OA2EN);
+ 8000c0c: 687b ldr r3, [r7, #4]
+ 8000c0e: 68db ldr r3, [r3, #12]
+ 8000c10: 4a03 ldr r2, [pc, #12] ; (8000c20 )
+ 8000c12: 401a ands r2, r3
+ 8000c14: 687b ldr r3, [r7, #4]
+ 8000c16: 60da str r2, [r3, #12]
+}
+ 8000c18: 46c0 nop ; (mov r8, r8)
+ 8000c1a: 46bd mov sp, r7
+ 8000c1c: b002 add sp, #8
+ 8000c1e: bd80 pop {r7, pc}
+ 8000c20: ffff7fff .word 0xffff7fff
+
+08000c24 :
+{
+ 8000c24: b580 push {r7, lr}
+ 8000c26: b082 sub sp, #8
+ 8000c28: af00 add r7, sp, #0
+ 8000c2a: 6078 str r0, [r7, #4]
+ SET_BIT(I2Cx->CR2, I2C_CR2_AUTOEND);
+ 8000c2c: 687b ldr r3, [r7, #4]
+ 8000c2e: 685b ldr r3, [r3, #4]
+ 8000c30: 2280 movs r2, #128 ; 0x80
+ 8000c32: 0492 lsls r2, r2, #18
+ 8000c34: 431a orrs r2, r3
+ 8000c36: 687b ldr r3, [r7, #4]
+ 8000c38: 605a str r2, [r3, #4]
+}
+ 8000c3a: 46c0 nop ; (mov r8, r8)
+ 8000c3c: 46bd mov sp, r7
+ 8000c3e: b002 add sp, #8
+ 8000c40: bd80 pop {r7, pc}
+
+08000c42 :
+ * @rmtoll CR1 UE LL_LPUART_Enable
+ * @param LPUARTx LPUART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_LPUART_Enable(USART_TypeDef *LPUARTx)
+{
+ 8000c42: b580 push {r7, lr}
+ 8000c44: b082 sub sp, #8
+ 8000c46: af00 add r7, sp, #0
+ 8000c48: 6078 str r0, [r7, #4]
+ SET_BIT(LPUARTx->CR1, USART_CR1_UE);
+ 8000c4a: 687b ldr r3, [r7, #4]
+ 8000c4c: 681b ldr r3, [r3, #0]
+ 8000c4e: 2201 movs r2, #1
+ 8000c50: 431a orrs r2, r3
+ 8000c52: 687b ldr r3, [r7, #4]
+ 8000c54: 601a str r2, [r3, #0]
+}
+ 8000c56: 46c0 nop ; (mov r8, r8)
+ 8000c58: 46bd mov sp, r7
+ 8000c5a: b002 add sp, #8
+ 8000c5c: bd80 pop {r7, pc}
+
+08000c5e :
+ * @rmtoll CR1 UE LL_LPUART_Disable
+ * @param LPUARTx LPUART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_LPUART_Disable(USART_TypeDef *LPUARTx)
+{
+ 8000c5e: b580 push {r7, lr}
+ 8000c60: b082 sub sp, #8
+ 8000c62: af00 add r7, sp, #0
+ 8000c64: 6078 str r0, [r7, #4]
+ CLEAR_BIT(LPUARTx->CR1, USART_CR1_UE);
+ 8000c66: 687b ldr r3, [r7, #4]
+ 8000c68: 681b ldr r3, [r3, #0]
+ 8000c6a: 2201 movs r2, #1
+ 8000c6c: 4393 bics r3, r2
+ 8000c6e: 001a movs r2, r3
+ 8000c70: 687b ldr r3, [r7, #4]
+ 8000c72: 601a str r2, [r3, #0]
+}
+ 8000c74: 46c0 nop ; (mov r8, r8)
+ 8000c76: 46bd mov sp, r7
+ 8000c78: b002 add sp, #8
+ 8000c7a: bd80 pop {r7, pc}
+
+08000c7c :
+ * @rmtoll CR1 RE LL_LPUART_EnableDirectionRx
+ * @param LPUARTx LPUART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_LPUART_EnableDirectionRx(USART_TypeDef *LPUARTx)
+{
+ 8000c7c: b580 push {r7, lr}
+ 8000c7e: b082 sub sp, #8
+ 8000c80: af00 add r7, sp, #0
+ 8000c82: 6078 str r0, [r7, #4]
+ SET_BIT(LPUARTx->CR1, USART_CR1_RE);
+ 8000c84: 687b ldr r3, [r7, #4]
+ 8000c86: 681b ldr r3, [r3, #0]
+ 8000c88: 2204 movs r2, #4
+ 8000c8a: 431a orrs r2, r3
+ 8000c8c: 687b ldr r3, [r7, #4]
+ 8000c8e: 601a str r2, [r3, #0]
+}
+ 8000c90: 46c0 nop ; (mov r8, r8)
+ 8000c92: 46bd mov sp, r7
+ 8000c94: b002 add sp, #8
+ 8000c96: bd80 pop {r7, pc}
+
+08000c98 :
+ * @rmtoll CR1 TE LL_LPUART_EnableDirectionTx
+ * @param LPUARTx LPUART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_LPUART_EnableDirectionTx(USART_TypeDef *LPUARTx)
+{
+ 8000c98: b580 push {r7, lr}
+ 8000c9a: b082 sub sp, #8
+ 8000c9c: af00 add r7, sp, #0
+ 8000c9e: 6078 str r0, [r7, #4]
+ SET_BIT(LPUARTx->CR1, USART_CR1_TE);
+ 8000ca0: 687b ldr r3, [r7, #4]
+ 8000ca2: 681b ldr r3, [r3, #0]
+ 8000ca4: 2208 movs r2, #8
+ 8000ca6: 431a orrs r2, r3
+ 8000ca8: 687b ldr r3, [r7, #4]
+ 8000caa: 601a str r2, [r3, #0]
+}
+ 8000cac: 46c0 nop ; (mov r8, r8)
+ 8000cae: 46bd mov sp, r7
+ 8000cb0: b002 add sp, #8
+ 8000cb2: bd80 pop {r7, pc}
+
+08000cb4 :
+ * @param PeriphClk Peripheral Clock
+ * @param BaudRate Baud Rate
+ * @retval None
+ */
+__STATIC_INLINE void LL_LPUART_SetBaudRate(USART_TypeDef *LPUARTx, uint32_t PeriphClk, uint32_t BaudRate)
+{
+ 8000cb4: b5b0 push {r4, r5, r7, lr}
+ 8000cb6: b08a sub sp, #40 ; 0x28
+ 8000cb8: af00 add r7, sp, #0
+ 8000cba: 6278 str r0, [r7, #36] ; 0x24
+ 8000cbc: 6239 str r1, [r7, #32]
+ 8000cbe: 61fa str r2, [r7, #28]
+ if (BaudRate != 0U)
+ 8000cc0: 69fb ldr r3, [r7, #28]
+ 8000cc2: 2b00 cmp r3, #0
+ 8000cc4: d024 beq.n 8000d10
+ {
+ LPUARTx->BRR = __LL_LPUART_DIV(PeriphClk, BaudRate);
+ 8000cc6: 6a3b ldr r3, [r7, #32]
+ 8000cc8: 613b str r3, [r7, #16]
+ 8000cca: 2300 movs r3, #0
+ 8000ccc: 617b str r3, [r7, #20]
+ 8000cce: 6939 ldr r1, [r7, #16]
+ 8000cd0: 697a ldr r2, [r7, #20]
+ 8000cd2: 000b movs r3, r1
+ 8000cd4: 0e1b lsrs r3, r3, #24
+ 8000cd6: 0010 movs r0, r2
+ 8000cd8: 0205 lsls r5, r0, #8
+ 8000cda: 431d orrs r5, r3
+ 8000cdc: 000b movs r3, r1
+ 8000cde: 021c lsls r4, r3, #8
+ 8000ce0: 69fb ldr r3, [r7, #28]
+ 8000ce2: 085b lsrs r3, r3, #1
+ 8000ce4: 60bb str r3, [r7, #8]
+ 8000ce6: 2300 movs r3, #0
+ 8000ce8: 60fb str r3, [r7, #12]
+ 8000cea: 68b8 ldr r0, [r7, #8]
+ 8000cec: 68f9 ldr r1, [r7, #12]
+ 8000cee: 1900 adds r0, r0, r4
+ 8000cf0: 4169 adcs r1, r5
+ 8000cf2: 69fb ldr r3, [r7, #28]
+ 8000cf4: 603b str r3, [r7, #0]
+ 8000cf6: 2300 movs r3, #0
+ 8000cf8: 607b str r3, [r7, #4]
+ 8000cfa: 683a ldr r2, [r7, #0]
+ 8000cfc: 687b ldr r3, [r7, #4]
+ 8000cfe: f7ff fa8f bl 8000220 <__aeabi_uldivmod>
+ 8000d02: 0002 movs r2, r0
+ 8000d04: 000b movs r3, r1
+ 8000d06: 0013 movs r3, r2
+ 8000d08: 031b lsls r3, r3, #12
+ 8000d0a: 0b1a lsrs r2, r3, #12
+ 8000d0c: 6a7b ldr r3, [r7, #36] ; 0x24
+ 8000d0e: 60da str r2, [r3, #12]
+ }
+}
+ 8000d10: 46c0 nop ; (mov r8, r8)
+ 8000d12: 46bd mov sp, r7
+ 8000d14: b00a add sp, #40 ; 0x28
+ 8000d16: bdb0 pop {r4, r5, r7, pc}
+
+08000d18 :
+ * @param LPUARTx LPUART Instance
+ * @param PeriphClk Peripheral Clock
+ * @retval Baud Rate
+ */
+__STATIC_INLINE uint32_t LL_LPUART_GetBaudRate(USART_TypeDef *LPUARTx, uint32_t PeriphClk)
+{
+ 8000d18: b5b0 push {r4, r5, r7, lr}
+ 8000d1a: b086 sub sp, #24
+ 8000d1c: af00 add r7, sp, #0
+ 8000d1e: 60f8 str r0, [r7, #12]
+ 8000d20: 60b9 str r1, [r7, #8]
+ uint32_t lpuartdiv;
+ uint32_t brrresult;
+
+ lpuartdiv = LPUARTx->BRR & LPUART_BRR_MASK;
+ 8000d22: 68f9 ldr r1, [r7, #12]
+ 8000d24: 68c9 ldr r1, [r1, #12]
+ 8000d26: 0309 lsls r1, r1, #12
+ 8000d28: 0b09 lsrs r1, r1, #12
+ 8000d2a: 6139 str r1, [r7, #16]
+
+ if (lpuartdiv >= LPUART_BRR_MIN_VALUE)
+ 8000d2c: 6938 ldr r0, [r7, #16]
+ 8000d2e: 21c0 movs r1, #192 ; 0xc0
+ 8000d30: 0089 lsls r1, r1, #2
+ 8000d32: 4288 cmp r0, r1
+ 8000d34: d316 bcc.n 8000d64
+ {
+ brrresult = (uint32_t)(((uint64_t)(PeriphClk) * LPUART_LPUARTDIV_FREQ_MUL) / lpuartdiv);
+ 8000d36: 68b9 ldr r1, [r7, #8]
+ 8000d38: 000a movs r2, r1
+ 8000d3a: 2100 movs r1, #0
+ 8000d3c: 000b movs r3, r1
+ 8000d3e: 0e11 lsrs r1, r2, #24
+ 8000d40: 021d lsls r5, r3, #8
+ 8000d42: 430d orrs r5, r1
+ 8000d44: 0214 lsls r4, r2, #8
+ 8000d46: 693b ldr r3, [r7, #16]
+ 8000d48: 603b str r3, [r7, #0]
+ 8000d4a: 2300 movs r3, #0
+ 8000d4c: 607b str r3, [r7, #4]
+ 8000d4e: 683a ldr r2, [r7, #0]
+ 8000d50: 687b ldr r3, [r7, #4]
+ 8000d52: 0020 movs r0, r4
+ 8000d54: 0029 movs r1, r5
+ 8000d56: f7ff fa63 bl 8000220 <__aeabi_uldivmod>
+ 8000d5a: 0002 movs r2, r0
+ 8000d5c: 000b movs r3, r1
+ 8000d5e: 0013 movs r3, r2
+ 8000d60: 617b str r3, [r7, #20]
+ 8000d62: e001 b.n 8000d68
+ }
+ else
+ {
+ brrresult = 0x0UL;
+ 8000d64: 2300 movs r3, #0
+ 8000d66: 617b str r3, [r7, #20]
+ }
+
+ return (brrresult);
+ 8000d68: 697b ldr r3, [r7, #20]
+}
+ 8000d6a: 0018 movs r0, r3
+ 8000d6c: 46bd mov sp, r7
+ 8000d6e: b006 add sp, #24
+ 8000d70: bdb0 pop {r4, r5, r7, pc}
+ ...
+
+08000d74 :
+ * @param LPUARTx LPUART Instance
+ * @param Time Value between Min_Data=0 and Max_Data=31
+ * @retval None
+ */
+__STATIC_INLINE void LL_LPUART_SetDEDeassertionTime(USART_TypeDef *LPUARTx, uint32_t Time)
+{
+ 8000d74: b580 push {r7, lr}
+ 8000d76: b082 sub sp, #8
+ 8000d78: af00 add r7, sp, #0
+ 8000d7a: 6078 str r0, [r7, #4]
+ 8000d7c: 6039 str r1, [r7, #0]
+ MODIFY_REG(LPUARTx->CR1, USART_CR1_DEDT, Time << USART_CR1_DEDT_Pos);
+ 8000d7e: 687b ldr r3, [r7, #4]
+ 8000d80: 681b ldr r3, [r3, #0]
+ 8000d82: 4a05 ldr r2, [pc, #20] ; (8000d98 )
+ 8000d84: 401a ands r2, r3
+ 8000d86: 683b ldr r3, [r7, #0]
+ 8000d88: 041b lsls r3, r3, #16
+ 8000d8a: 431a orrs r2, r3
+ 8000d8c: 687b ldr r3, [r7, #4]
+ 8000d8e: 601a str r2, [r3, #0]
+}
+ 8000d90: 46c0 nop ; (mov r8, r8)
+ 8000d92: 46bd mov sp, r7
+ 8000d94: b002 add sp, #8
+ 8000d96: bd80 pop {r7, pc}
+ 8000d98: ffe0ffff .word 0xffe0ffff
+
+08000d9c :
+ * @param LPUARTx LPUART Instance
+ * @param Time Value between Min_Data=0 and Max_Data=31
+ * @retval None
+ */
+__STATIC_INLINE void LL_LPUART_SetDEAssertionTime(USART_TypeDef *LPUARTx, uint32_t Time)
+{
+ 8000d9c: b580 push {r7, lr}
+ 8000d9e: b082 sub sp, #8
+ 8000da0: af00 add r7, sp, #0
+ 8000da2: 6078 str r0, [r7, #4]
+ 8000da4: 6039 str r1, [r7, #0]
+ MODIFY_REG(LPUARTx->CR1, USART_CR1_DEAT, Time << USART_CR1_DEAT_Pos);
+ 8000da6: 687b ldr r3, [r7, #4]
+ 8000da8: 681b ldr r3, [r3, #0]
+ 8000daa: 4a05 ldr r2, [pc, #20] ; (8000dc0 )
+ 8000dac: 401a ands r2, r3
+ 8000dae: 683b ldr r3, [r7, #0]
+ 8000db0: 055b lsls r3, r3, #21
+ 8000db2: 431a orrs r2, r3
+ 8000db4: 687b ldr r3, [r7, #4]
+ 8000db6: 601a str r2, [r3, #0]
+}
+ 8000db8: 46c0 nop ; (mov r8, r8)
+ 8000dba: 46bd mov sp, r7
+ 8000dbc: b002 add sp, #8
+ 8000dbe: bd80 pop {r7, pc}
+ 8000dc0: fc1fffff .word 0xfc1fffff
+
+08000dc4 :
+ * @rmtoll CR3 DEM LL_LPUART_EnableDEMode
+ * @param LPUARTx LPUART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_LPUART_EnableDEMode(USART_TypeDef *LPUARTx)
+{
+ 8000dc4: b580 push {r7, lr}
+ 8000dc6: b082 sub sp, #8
+ 8000dc8: af00 add r7, sp, #0
+ 8000dca: 6078 str r0, [r7, #4]
+ SET_BIT(LPUARTx->CR3, USART_CR3_DEM);
+ 8000dcc: 687b ldr r3, [r7, #4]
+ 8000dce: 689b ldr r3, [r3, #8]
+ 8000dd0: 2280 movs r2, #128 ; 0x80
+ 8000dd2: 01d2 lsls r2, r2, #7
+ 8000dd4: 431a orrs r2, r3
+ 8000dd6: 687b ldr r3, [r7, #4]
+ 8000dd8: 609a str r2, [r3, #8]
+}
+ 8000dda: 46c0 nop ; (mov r8, r8)
+ 8000ddc: 46bd mov sp, r7
+ 8000dde: b002 add sp, #8
+ 8000de0: bd80 pop {r7, pc}
+ ...
+
+08000de4 :
+ * @arg @ref LL_LPUART_DE_POLARITY_HIGH
+ * @arg @ref LL_LPUART_DE_POLARITY_LOW
+ * @retval None
+ */
+__STATIC_INLINE void LL_LPUART_SetDESignalPolarity(USART_TypeDef *LPUARTx, uint32_t Polarity)
+{
+ 8000de4: b580 push {r7, lr}
+ 8000de6: b082 sub sp, #8
+ 8000de8: af00 add r7, sp, #0
+ 8000dea: 6078 str r0, [r7, #4]
+ 8000dec: 6039 str r1, [r7, #0]
+ MODIFY_REG(LPUARTx->CR3, USART_CR3_DEP, Polarity);
+ 8000dee: 687b ldr r3, [r7, #4]
+ 8000df0: 689b ldr r3, [r3, #8]
+ 8000df2: 4a05 ldr r2, [pc, #20] ; (8000e08 )
+ 8000df4: 401a ands r2, r3
+ 8000df6: 683b ldr r3, [r7, #0]
+ 8000df8: 431a orrs r2, r3
+ 8000dfa: 687b ldr r3, [r7, #4]
+ 8000dfc: 609a str r2, [r3, #8]
+}
+ 8000dfe: 46c0 nop ; (mov r8, r8)
+ 8000e00: 46bd mov sp, r7
+ 8000e02: b002 add sp, #8
+ 8000e04: bd80 pop {r7, pc}
+ 8000e06: 46c0 nop ; (mov r8, r8)
+ 8000e08: ffff7fff .word 0xffff7fff
+
+08000e0c :
+ * @rmtoll ISR TXE LL_LPUART_IsActiveFlag_TXE
+ * @param LPUARTx LPUART Instance
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_LPUART_IsActiveFlag_TXE(USART_TypeDef *LPUARTx)
+{
+ 8000e0c: b580 push {r7, lr}
+ 8000e0e: b082 sub sp, #8
+ 8000e10: af00 add r7, sp, #0
+ 8000e12: 6078 str r0, [r7, #4]
+ return ((READ_BIT(LPUARTx->ISR, USART_ISR_TXE) == (USART_ISR_TXE)) ? 1UL : 0UL);
+ 8000e14: 687b ldr r3, [r7, #4]
+ 8000e16: 69db ldr r3, [r3, #28]
+ 8000e18: 2280 movs r2, #128 ; 0x80
+ 8000e1a: 4013 ands r3, r2
+ 8000e1c: 2b80 cmp r3, #128 ; 0x80
+ 8000e1e: d101 bne.n 8000e24
+ 8000e20: 2301 movs r3, #1
+ 8000e22: e000 b.n 8000e26
+ 8000e24: 2300 movs r3, #0
+}
+ 8000e26: 0018 movs r0, r3
+ 8000e28: 46bd mov sp, r7
+ 8000e2a: b002 add sp, #8
+ 8000e2c: bd80 pop {r7, pc}
+
+08000e2e :
+ * @rmtoll CR1 IDLEIE LL_LPUART_EnableIT_IDLE
+ * @param LPUARTx LPUART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_LPUART_EnableIT_IDLE(USART_TypeDef *LPUARTx)
+{
+ 8000e2e: b580 push {r7, lr}
+ 8000e30: b082 sub sp, #8
+ 8000e32: af00 add r7, sp, #0
+ 8000e34: 6078 str r0, [r7, #4]
+ SET_BIT(LPUARTx->CR1, USART_CR1_IDLEIE);
+ 8000e36: 687b ldr r3, [r7, #4]
+ 8000e38: 681b ldr r3, [r3, #0]
+ 8000e3a: 2210 movs r2, #16
+ 8000e3c: 431a orrs r2, r3
+ 8000e3e: 687b ldr r3, [r7, #4]
+ 8000e40: 601a str r2, [r3, #0]
+}
+ 8000e42: 46c0 nop ; (mov r8, r8)
+ 8000e44: 46bd mov sp, r7
+ 8000e46: b002 add sp, #8
+ 8000e48: bd80 pop {r7, pc}
+
+08000e4a :
+ * @rmtoll CR1 RXNEIE LL_LPUART_EnableIT_RXNE
+ * @param LPUARTx LPUART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_LPUART_EnableIT_RXNE(USART_TypeDef *LPUARTx)
+{
+ 8000e4a: b580 push {r7, lr}
+ 8000e4c: b082 sub sp, #8
+ 8000e4e: af00 add r7, sp, #0
+ 8000e50: 6078 str r0, [r7, #4]
+ SET_BIT(LPUARTx->CR1, USART_CR1_RXNEIE);
+ 8000e52: 687b ldr r3, [r7, #4]
+ 8000e54: 681b ldr r3, [r3, #0]
+ 8000e56: 2220 movs r2, #32
+ 8000e58: 431a orrs r2, r3
+ 8000e5a: 687b ldr r3, [r7, #4]
+ 8000e5c: 601a str r2, [r3, #0]
+}
+ 8000e5e: 46c0 nop ; (mov r8, r8)
+ 8000e60: 46bd mov sp, r7
+ 8000e62: b002 add sp, #8
+ 8000e64: bd80 pop {r7, pc}
+
+08000e66 :
+ * @rmtoll CR1 IDLEIE LL_LPUART_DisableIT_IDLE
+ * @param LPUARTx LPUART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_LPUART_DisableIT_IDLE(USART_TypeDef *LPUARTx)
+{
+ 8000e66: b580 push {r7, lr}
+ 8000e68: b082 sub sp, #8
+ 8000e6a: af00 add r7, sp, #0
+ 8000e6c: 6078 str r0, [r7, #4]
+ CLEAR_BIT(LPUARTx->CR1, USART_CR1_IDLEIE);
+ 8000e6e: 687b ldr r3, [r7, #4]
+ 8000e70: 681b ldr r3, [r3, #0]
+ 8000e72: 2210 movs r2, #16
+ 8000e74: 4393 bics r3, r2
+ 8000e76: 001a movs r2, r3
+ 8000e78: 687b ldr r3, [r7, #4]
+ 8000e7a: 601a str r2, [r3, #0]
+}
+ 8000e7c: 46c0 nop ; (mov r8, r8)
+ 8000e7e: 46bd mov sp, r7
+ 8000e80: b002 add sp, #8
+ 8000e82: bd80 pop {r7, pc}
+
+08000e84 :
+ * @rmtoll CR1 RXNEIE LL_LPUART_DisableIT_RXNE
+ * @param LPUARTx LPUART Instance
+ * @retval None
+ */
+__STATIC_INLINE void LL_LPUART_DisableIT_RXNE(USART_TypeDef *LPUARTx)
+{
+ 8000e84: b580 push {r7, lr}
+ 8000e86: b082 sub sp, #8
+ 8000e88: af00 add r7, sp, #0
+ 8000e8a: 6078 str r0, [r7, #4]
+ CLEAR_BIT(LPUARTx->CR1, USART_CR1_RXNEIE);
+ 8000e8c: 687b ldr r3, [r7, #4]
+ 8000e8e: 681b ldr r3, [r3, #0]
+ 8000e90: 2220 movs r2, #32
+ 8000e92: 4393 bics r3, r2
+ 8000e94: 001a movs r2, r3
+ 8000e96: 687b ldr r3, [r7, #4]
+ 8000e98: 601a str r2, [r3, #0]
+}
+ 8000e9a: 46c0 nop ; (mov r8, r8)
+ 8000e9c: 46bd mov sp, r7
+ 8000e9e: b002 add sp, #8
+ 8000ea0: bd80 pop {r7, pc}
+
+08000ea2 :
+ * @param LPUARTx LPUART Instance
+ * @param Value between Min_Data=0x00 and Max_Data=0x1FF
+ * @retval None
+ */
+__STATIC_INLINE void LL_LPUART_TransmitData9(USART_TypeDef *LPUARTx, uint16_t Value)
+{
+ 8000ea2: b580 push {r7, lr}
+ 8000ea4: b082 sub sp, #8
+ 8000ea6: af00 add r7, sp, #0
+ 8000ea8: 6078 str r0, [r7, #4]
+ 8000eaa: 000a movs r2, r1
+ 8000eac: 1cbb adds r3, r7, #2
+ 8000eae: 801a strh r2, [r3, #0]
+ LPUARTx->TDR = Value & 0x1FFUL;
+ 8000eb0: 1cbb adds r3, r7, #2
+ 8000eb2: 881b ldrh r3, [r3, #0]
+ 8000eb4: 05db lsls r3, r3, #23
+ 8000eb6: 0dda lsrs r2, r3, #23
+ 8000eb8: 687b ldr r3, [r7, #4]
+ 8000eba: 629a str r2, [r3, #40] ; 0x28
+}
+ 8000ebc: 46c0 nop ; (mov r8, r8)
+ 8000ebe: 46bd mov sp, r7
+ 8000ec0: b002 add sp, #8
+ 8000ec2: bd80 pop {r7, pc}
+
+08000ec4 :
+ * @brief Enable HSI oscillator
+ * @rmtoll CR HSION LL_RCC_HSI_Enable
+ * @retval None
+ */
+__STATIC_INLINE void LL_RCC_HSI_Enable(void)
+{
+ 8000ec4: b580 push {r7, lr}
+ 8000ec6: af00 add r7, sp, #0
+ SET_BIT(RCC->CR, RCC_CR_HSION);
+ 8000ec8: 4b04 ldr r3, [pc, #16] ; (8000edc )
+ 8000eca: 681a ldr r2, [r3, #0]
+ 8000ecc: 4b03 ldr r3, [pc, #12] ; (8000edc )
+ 8000ece: 2101 movs r1, #1
+ 8000ed0: 430a orrs r2, r1
+ 8000ed2: 601a str r2, [r3, #0]
+}
+ 8000ed4: 46c0 nop ; (mov r8, r8)
+ 8000ed6: 46bd mov sp, r7
+ 8000ed8: bd80 pop {r7, pc}
+ 8000eda: 46c0 nop ; (mov r8, r8)
+ 8000edc: 40021000 .word 0x40021000
+
+08000ee0 :
+ * @brief Check if HSI clock is ready
+ * @rmtoll CR HSIRDY LL_RCC_HSI_IsReady
+ * @retval State of bit (1 or 0).
+ */
+__STATIC_INLINE uint32_t LL_RCC_HSI_IsReady(void)
+{
+ 8000ee0: b580 push {r7, lr}
+ 8000ee2: af00 add r7, sp, #0
+ return ((READ_BIT(RCC->CR, RCC_CR_HSIRDY) == RCC_CR_HSIRDY) ? 1UL : 0UL);
+ 8000ee4: 4b05 ldr r3, [pc, #20] ; (8000efc )
+ 8000ee6: 681b ldr r3, [r3, #0]
+ 8000ee8: 2204 movs r2, #4
+ 8000eea: 4013 ands r3, r2
+ 8000eec: 2b04 cmp r3, #4
+ 8000eee: d101 bne.n 8000ef4
+ 8000ef0: 2301 movs r3, #1
+ 8000ef2: e000 b.n 8000ef6
+ 8000ef4: 2300 movs r3, #0
+}
+ 8000ef6: 0018 movs r0, r3
+ 8000ef8: 46bd mov sp, r7
+ 8000efa: bd80 pop {r7, pc}
+ 8000efc: 40021000 .word 0x40021000
+
+08000f00 :
+ * @rmtoll ICSCR HSITRIM LL_RCC_HSI_SetCalibTrimming
+ * @param Value between Min_Data = 0x00 and Max_Data = 0x1F
+ * @retval None
+ */
+__STATIC_INLINE void LL_RCC_HSI_SetCalibTrimming(uint32_t Value)
+{
+ 8000f00: b580 push {r7, lr}
+ 8000f02: b082 sub sp, #8
+ 8000f04: af00 add r7, sp, #0
+ 8000f06: 6078 str r0, [r7, #4]
+ MODIFY_REG(RCC->ICSCR, RCC_ICSCR_HSITRIM, Value << RCC_ICSCR_HSITRIM_Pos);
+ 8000f08: 4b06 ldr r3, [pc, #24] ; (8000f24 )
+ 8000f0a: 685b ldr r3, [r3, #4]
+ 8000f0c: 4a06 ldr r2, [pc, #24] ; (8000f28 )
+ 8000f0e: 4013 ands r3, r2
+ 8000f10: 0019 movs r1, r3
+ 8000f12: 687b ldr r3, [r7, #4]
+ 8000f14: 021a lsls r2, r3, #8
+ 8000f16: 4b03 ldr r3, [pc, #12] ; (8000f24 )
+ 8000f18: 430a orrs r2, r1
+ 8000f1a: 605a str r2, [r3, #4]
+}
+ 8000f1c: 46c0 nop ; (mov r8, r8)
+ 8000f1e: 46bd mov sp, r7
+ 8000f20: b002 add sp, #8
+ 8000f22: bd80 pop {r7, pc}
+ 8000f24: 40021000 .word 0x40021000
+ 8000f28: ffffe0ff .word 0xffffe0ff
+
+08000f2c :
+ * @arg @ref LL_RCC_SYS_CLKSOURCE_HSE
+ * @arg @ref LL_RCC_SYS_CLKSOURCE_PLL
+ * @retval None
+ */
+__STATIC_INLINE void LL_RCC_SetSysClkSource(uint32_t Source)
+{
+ 8000f2c: b580 push {r7, lr}
+ 8000f2e: b082 sub sp, #8
+ 8000f30: af00 add r7, sp, #0
+ 8000f32: 6078 str r0, [r7, #4]
+ MODIFY_REG(RCC->CFGR, RCC_CFGR_SW, Source);
+ 8000f34: 4b06 ldr r3, [pc, #24] ; (8000f50 )
+ 8000f36: 68db ldr r3, [r3, #12]
+ 8000f38: 2203 movs r2, #3
+ 8000f3a: 4393 bics r3, r2
+ 8000f3c: 0019 movs r1, r3
+ 8000f3e: 4b04 ldr r3, [pc, #16] ; (8000f50 )
+ 8000f40: 687a ldr r2, [r7, #4]
+ 8000f42: 430a orrs r2, r1
+ 8000f44: 60da str r2, [r3, #12]
+}
+ 8000f46: 46c0 nop ; (mov r8, r8)
+ 8000f48: 46bd mov sp, r7
+ 8000f4a: b002 add sp, #8
+ 8000f4c: bd80 pop {r7, pc}
+ 8000f4e: 46c0 nop ; (mov r8, r8)
+ 8000f50: 40021000 .word 0x40021000
+
+08000f54 :
+ * @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_HSI
+ * @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_HSE
+ * @arg @ref LL_RCC_SYS_CLKSOURCE_STATUS_PLL
+ */
+__STATIC_INLINE uint32_t LL_RCC_GetSysClkSource(void)
+{
+ 8000f54: b580 push {r7, lr}
+ 8000f56: af00 add r7, sp, #0
+ return (uint32_t)(READ_BIT(RCC->CFGR, RCC_CFGR_SWS));
+ 8000f58: 4b03 ldr r3, [pc, #12] ; (8000f68 )
+ 8000f5a: 68db ldr r3, [r3, #12]
+ 8000f5c: 220c movs r2, #12
+ 8000f5e: 4013 ands r3, r2
+}
+ 8000f60: 0018 movs r0, r3
+ 8000f62: 46bd mov sp, r7
+ 8000f64: bd80 pop {r7, pc}
+ 8000f66: 46c0 nop ; (mov r8, r8)
+ 8000f68: 40021000 .word 0x40021000
+
+08000f6c :
+ * @arg @ref LL_RCC_SYSCLK_DIV_256
+ * @arg @ref LL_RCC_SYSCLK_DIV_512
+ * @retval None
+ */
+__STATIC_INLINE void LL_RCC_SetAHBPrescaler(uint32_t Prescaler)
+{
+ 8000f6c: b580 push {r7, lr}
+ 8000f6e: b082 sub sp, #8
+ 8000f70: af00 add r7, sp, #0
+ 8000f72: 6078 str r0, [r7, #4]
+ MODIFY_REG(RCC->CFGR, RCC_CFGR_HPRE, Prescaler);
+ 8000f74: 4b06 ldr r3, [pc, #24] ; (8000f90 )
+ 8000f76: 68db ldr r3, [r3, #12]
+ 8000f78: 22f0 movs r2, #240 ; 0xf0
+ 8000f7a: 4393 bics r3, r2
+ 8000f7c: 0019 movs r1, r3
+ 8000f7e: 4b04 ldr r3, [pc, #16] ; (8000f90 )
+ 8000f80: 687a ldr r2, [r7, #4]
+ 8000f82: 430a orrs r2, r1
+ 8000f84: 60da str r2, [r3, #12]
+}
+ 8000f86: 46c0 nop ; (mov r8, r8)
+ 8000f88: 46bd mov sp, r7
+ 8000f8a: b002 add sp, #8
+ 8000f8c: bd80 pop {r7, pc}
+ 8000f8e: 46c0 nop ; (mov r8, r8)
+ 8000f90: 40021000 .word 0x40021000
+
+08000f94 :
+ * @arg @ref LL_RCC_APB1_DIV_8
+ * @arg @ref LL_RCC_APB1_DIV_16
+ * @retval None
+ */
+__STATIC_INLINE void LL_RCC_SetAPB1Prescaler(uint32_t Prescaler)
+{
+ 8000f94: b580 push {r7, lr}
+ 8000f96: b082 sub sp, #8
+ 8000f98: af00 add r7, sp, #0
+ 8000f9a: 6078 str r0, [r7, #4]
+ MODIFY_REG(RCC->CFGR, RCC_CFGR_PPRE1, Prescaler);
+ 8000f9c: 4b06 ldr r3, [pc, #24] ; (8000fb8 )
+ 8000f9e: 68db ldr r3, [r3, #12]
+ 8000fa0: 4a06 ldr r2, [pc, #24] ; (8000fbc )
+ 8000fa2: 4013 ands r3, r2
+ 8000fa4: 0019 movs r1, r3
+ 8000fa6: 4b04 ldr r3, [pc, #16] ; (8000fb8 )
+ 8000fa8: 687a ldr r2, [r7, #4]
+ 8000faa: 430a orrs r2, r1
+ 8000fac: 60da str r2, [r3, #12]
+}
+ 8000fae: 46c0 nop ; (mov r8, r8)
+ 8000fb0: 46bd mov sp, r7
+ 8000fb2: b002 add sp, #8
+ 8000fb4: bd80 pop {r7, pc}
+ 8000fb6: 46c0 nop ; (mov r8, r8)
+ 8000fb8: 40021000 .word 0x40021000
+ 8000fbc: fffff8ff .word 0xfffff8ff
+
+08000fc0 :
+ * @arg @ref LL_RCC_APB2_DIV_8
+ * @arg @ref LL_RCC_APB2_DIV_16
+ * @retval None
+ */
+__STATIC_INLINE void LL_RCC_SetAPB2Prescaler(uint32_t Prescaler)
+{
+ 8000fc0: b580 push {r7, lr}
+ 8000fc2: b082 sub sp, #8
+ 8000fc4: af00 add r7, sp, #0
+ 8000fc6: 6078 str r0, [r7, #4]
+ MODIFY_REG(RCC->CFGR, RCC_CFGR_PPRE2, Prescaler);
+ 8000fc8: 4b06 ldr r3, [pc, #24] ; (8000fe4 )
+ 8000fca: 68db ldr r3, [r3, #12]
+ 8000fcc: 4a06 ldr r2, [pc, #24] ; (8000fe8 )
+ 8000fce: 4013 ands r3, r2
+ 8000fd0: 0019 movs r1, r3
+ 8000fd2: 4b04 ldr r3, [pc, #16] ; (8000fe4 )
+ 8000fd4: 687a ldr r2, [r7, #4]
+ 8000fd6: 430a orrs r2, r1
+ 8000fd8: 60da str r2, [r3, #12]
+}
+ 8000fda: 46c0 nop ; (mov r8, r8)
+ 8000fdc: 46bd mov sp, r7
+ 8000fde: b002 add sp, #8
+ 8000fe0: bd80 pop {r7, pc}
+ 8000fe2: 46c0 nop ; (mov r8, r8)
+ 8000fe4: 40021000 .word 0x40021000
+ 8000fe8: ffffc7ff .word 0xffffc7ff
+
+08000fec :
+ * @arg @ref LL_RCC_LPUART1_CLKSOURCE_HSI
+ * @arg @ref LL_RCC_LPUART1_CLKSOURCE_LSE
+ * @retval None
+ */
+__STATIC_INLINE void LL_RCC_SetLPUARTClockSource(uint32_t LPUARTxSource)
+{
+ 8000fec: b580 push {r7, lr}
+ 8000fee: b082 sub sp, #8
+ 8000ff0: af00 add r7, sp, #0
+ 8000ff2: 6078 str r0, [r7, #4]
+ MODIFY_REG(RCC->CCIPR, RCC_CCIPR_LPUART1SEL, LPUARTxSource);
+ 8000ff4: 4b06 ldr r3, [pc, #24] ; (8001010 )
+ 8000ff6: 6cdb ldr r3, [r3, #76] ; 0x4c
+ 8000ff8: 4a06 ldr r2, [pc, #24] ; (8001014 )
+ 8000ffa: 4013 ands r3, r2
+ 8000ffc: 0019 movs r1, r3
+ 8000ffe: 4b04 ldr r3, [pc, #16] ; (8001010 )
+ 8001000: 687a ldr r2, [r7, #4]
+ 8001002: 430a orrs r2, r1
+ 8001004: 64da str r2, [r3, #76] ; 0x4c
+}
+ 8001006: 46c0 nop ; (mov r8, r8)
+ 8001008: 46bd mov sp, r7
+ 800100a: b002 add sp, #8
+ 800100c: bd80 pop {r7, pc}
+ 800100e: 46c0 nop ; (mov r8, r8)
+ 8001010: 40021000 .word 0x40021000
+ 8001014: fffff3ff .word 0xfffff3ff
+
+08001018 :
+ *
+ * (*) value not defined in all devices.
+ * @retval None
+ */
+__STATIC_INLINE void LL_RCC_SetI2CClockSource(uint32_t I2CxSource)
+{
+ 8001018: b580 push {r7, lr}
+ 800101a: b082 sub sp, #8
+ 800101c: af00 add r7, sp, #0
+ 800101e: 6078 str r0, [r7, #4]
+ MODIFY_REG(RCC->CCIPR, ((I2CxSource >> 4U) & 0x000FF000U), ((I2CxSource << 4U) & 0x000FF000U));
+ 8001020: 4b0a ldr r3, [pc, #40] ; (800104c )
+ 8001022: 6cdb ldr r3, [r3, #76] ; 0x4c
+ 8001024: 687a ldr r2, [r7, #4]
+ 8001026: 0911 lsrs r1, r2, #4
+ 8001028: 22ff movs r2, #255 ; 0xff
+ 800102a: 0312 lsls r2, r2, #12
+ 800102c: 400a ands r2, r1
+ 800102e: 43d2 mvns r2, r2
+ 8001030: 401a ands r2, r3
+ 8001032: 0011 movs r1, r2
+ 8001034: 687b ldr r3, [r7, #4]
+ 8001036: 011a lsls r2, r3, #4
+ 8001038: 23ff movs r3, #255 ; 0xff
+ 800103a: 031b lsls r3, r3, #12
+ 800103c: 401a ands r2, r3
+ 800103e: 4b03 ldr r3, [pc, #12] ; (800104c