summaryrefslogtreecommitdiff
path: root/Core
diff options
context:
space:
mode:
authorClyhtsuriva <aimeric@adjutor.xyz>2021-01-26 18:26:26 +0100
committerClyhtsuriva <aimeric@adjutor.xyz>2021-01-26 18:26:26 +0100
commitbc481107298791bf0efd984ecc53dc92b8719878 (patch)
tree332af7837f310af85b261611ed016e0e6312262c /Core
parent816804c9c114e20d2231258cc346c3714590b9ea (diff)
Insertion du projet dans sa totalité
Diffstat (limited to 'Core')
-rw-r--r--Core/Inc/button.h21
-rw-r--r--Core/Inc/gpio.h49
-rw-r--r--Core/Inc/lcd_1602.h28
-rw-r--r--Core/Inc/led.h18
-rw-r--r--Core/Inc/main.h97
-rw-r--r--Core/Inc/stm32l0xx_hal_conf.h330
-rw-r--r--Core/Inc/stm32l0xx_it.h65
-rw-r--r--Core/Inc/usart.h52
-rw-r--r--Core/Src/button.c33
-rw-r--r--Core/Src/gpio.c87
-rw-r--r--Core/Src/lcd_1602.c78
-rw-r--r--Core/Src/led.c44
-rw-r--r--Core/Src/main.c409
-rw-r--r--Core/Src/stm32l0xx_hal_msp.c84
-rw-r--r--Core/Src/stm32l0xx_it.c147
-rw-r--r--Core/Src/syscalls.c207
-rw-r--r--Core/Src/system_stm32l0xx.c275
-rw-r--r--Core/Src/usart.c108
18 files changed, 0 insertions, 2132 deletions
diff --git a/Core/Inc/button.h b/Core/Inc/button.h
deleted file mode 100644
index fff10b7..0000000
--- a/Core/Inc/button.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * button.h
- *
- * Created on: 2 déc. 2020
- * Author: root
- */
-
-#ifndef INC_BUTTON_H_
-#define INC_BUTTON_H_
-
-#include "stm32l053xx.h"
-
-typedef struct
-{
-GPIO_TypeDef * gpioPort;
-uint8_t pin;
-uint8_t pull;
-
-}BUTTON_TypeDef;
-
-#endif /* INC_BUTTON_H_ */
diff --git a/Core/Inc/gpio.h b/Core/Inc/gpio.h
deleted file mode 100644
index 5dd191b..0000000
--- a/Core/Inc/gpio.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- ******************************************************************************
- * @file gpio.h
- * @brief This file contains all the function prototypes for
- * the gpio.c file
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; Copyright (c) 2021 STMicroelectronics.
- * All rights reserved.</center></h2>
- *
- * 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 __GPIO_H__
-#define __GPIO_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Includes ------------------------------------------------------------------*/
-#include "main.h"
-
-/* USER CODE BEGIN Includes */
-
-/* USER CODE END Includes */
-
-/* USER CODE BEGIN Private defines */
-
-/* USER CODE END Private defines */
-
-void MX_GPIO_Init(void);
-
-/* USER CODE BEGIN Prototypes */
-
-/* USER CODE END Prototypes */
-
-#ifdef __cplusplus
-}
-#endif
-#endif /*__ GPIO_H__ */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/Core/Inc/lcd_1602.h b/Core/Inc/lcd_1602.h
deleted file mode 100644
index 5df49f3..0000000
--- a/Core/Inc/lcd_1602.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef __LCD_1602_H
-#define __LCD_1602_H
-#include "stm32l053xx.h"
-#include "main.h"
-
-#define rs(x) x?HAL_GPIO_WritePin(RS_GPIO_Port,RS_Pin,GPIO_PIN_SET):HAL_GPIO_WritePin(RS_GPIO_Port,RS_Pin,GPIO_PIN_RESET)
-#define rw(x) x?HAL_GPIO_WritePin(RW_GPIO_Port,RW_Pin,GPIO_PIN_SET):HAL_GPIO_WritePin(RW_GPIO_Port,RW_Pin,GPIO_PIN_RESET)
-#define en(x) x?HAL_GPIO_WritePin(E_GPIO_Port,E_Pin,GPIO_PIN_SET):HAL_GPIO_WritePin(E_GPIO_Port,E_Pin,GPIO_PIN_RESET)
-
-#define d4(x) x?HAL_GPIO_WritePin(D4_GPIO_Port,D4_Pin,GPIO_PIN_SET):HAL_GPIO_WritePin(D4_GPIO_Port,D4_Pin,GPIO_PIN_RESET)
-#define d5(x) x?HAL_GPIO_WritePin(D5_GPIO_Port,D5_Pin,GPIO_PIN_SET):HAL_GPIO_WritePin(D5_GPIO_Port,D5_Pin,GPIO_PIN_RESET)
-#define d6(x) x?HAL_GPIO_WritePin(D6_GPIO_Port,D6_Pin,GPIO_PIN_SET):HAL_GPIO_WritePin(D6_GPIO_Port,D6_Pin,GPIO_PIN_RESET)
-#define d7(x) x?HAL_GPIO_WritePin(D7_GPIO_Port,D7_Pin,GPIO_PIN_SET):HAL_GPIO_WritePin(D7_GPIO_Port,D7_Pin,GPIO_PIN_RESET)
-
-//#define bl(x) x?HAL_GPIO_WritePin(BL_GPIO_Port,BL_Pin,GPIO_PIN_SET):HAL_GPIO_WritePin(BL_GPIO_Port,BL_Pin,GPIO_PIN_RESET)
-
-static void lcd_send_4bit(uint8_t data);
-static void lcd_send(int8_t rs,uint8_t data);
-void lcd_cmd(uint8_t command);
-void lcd_data(char c);
-void lcd_init(void);
-void lcd_clr(void);
-void lcd_test(void);
-void lcd_displayOff(void);
-void lcd_gotoxy(char x, char y);
-void lcd_puts(char *text);
-
-#endif
diff --git a/Core/Inc/led.h b/Core/Inc/led.h
deleted file mode 100644
index 50c9084..0000000
--- a/Core/Inc/led.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * led.h
- *
- * Created on: 2 déc. 2020
- * Author: root
- */
-
-#ifndef INC_LED_H_
-#define INC_LED_H_
-
-#include "stm32l053xx.h"
-typedef struct
-{
-GPIO_TypeDef * gpioPort;
-uint16_t pin;
-}LED_TypeDef;
-
-#endif /* INC_LED_H_ */
diff --git a/Core/Inc/main.h b/Core/Inc/main.h
deleted file mode 100644
index 11c7476..0000000
--- a/Core/Inc/main.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* USER CODE BEGIN Header */
-/**
- ******************************************************************************
- * @file : main.h
- * @brief : Header for main.c file.
- * This file contains the common defines of the application.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; Copyright (c) 2021 STMicroelectronics.
- * All rights reserved.</center></h2>
- *
- * 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_hal.h"
-
-/* 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 Error_Handler(void);
-
-/* USER CODE BEGIN EFP */
-
-/* USER CODE END EFP */
-
-/* Private defines -----------------------------------------------------------*/
-#define B1_Pin GPIO_PIN_13
-#define B1_GPIO_Port GPIOC
-#define USART_TX_Pin GPIO_PIN_2
-#define USART_TX_GPIO_Port GPIOA
-#define USART_RX_Pin GPIO_PIN_3
-#define USART_RX_GPIO_Port GPIOA
-#define LD2_Pin GPIO_PIN_5
-#define LD2_GPIO_Port GPIOA
-#define RS_Pin GPIO_PIN_0
-#define RS_GPIO_Port GPIOB
-#define RW_Pin GPIO_PIN_1
-#define RW_GPIO_Port GPIOB
-#define E_Pin GPIO_PIN_2
-#define E_GPIO_Port GPIOB
-#define TMS_Pin GPIO_PIN_13
-#define TMS_GPIO_Port GPIOA
-#define TCK_Pin GPIO_PIN_14
-#define TCK_GPIO_Port GPIOA
-#define D4_Pin GPIO_PIN_4
-#define D4_GPIO_Port GPIOB
-#define D5_Pin GPIO_PIN_5
-#define D5_GPIO_Port GPIOB
-#define D6_Pin GPIO_PIN_6
-#define D6_GPIO_Port GPIOB
-#define D7_Pin GPIO_PIN_7
-#define D7_GPIO_Port GPIOB
-/* USER CODE BEGIN Private defines */
-
-/* USER CODE END Private defines */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __MAIN_H */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/Core/Inc/stm32l0xx_hal_conf.h b/Core/Inc/stm32l0xx_hal_conf.h
deleted file mode 100644
index 5252f0f..0000000
--- a/Core/Inc/stm32l0xx_hal_conf.h
+++ /dev/null
@@ -1,330 +0,0 @@
-/**
- ******************************************************************************
- * @file stm32l0xx_hal_conf.h
- * @author MCD Application Team
- * @brief HAL configuration template file.
- * This file should be copied to the application folder and renamed
- * to stm32l0xx_hal_conf.h.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
- * All rights reserved.</center></h2>
- *
- * 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_HAL_CONF_H
-#define __STM32L0xx_HAL_CONF_H
-
-#ifdef __cplusplus
- extern "C" {
-#endif
-
-/* Exported types ------------------------------------------------------------*/
-/* Exported constants --------------------------------------------------------*/
-
-/* ########################## Module Selection ############################## */
-/**
- * @brief This is the list of modules to be used in the HAL driver
- */
-
-#define HAL_MODULE_ENABLED
- /*#define HAL_ADC_MODULE_ENABLED */
-/*#define HAL_CRYP_MODULE_ENABLED */
-/*#define HAL_COMP_MODULE_ENABLED */
-/*#define HAL_CRC_MODULE_ENABLED */
-/*#define HAL_CRYP_MODULE_ENABLED */
-/*#define HAL_DAC_MODULE_ENABLED */
-/*#define HAL_FIREWALL_MODULE_ENABLED */
-/*#define HAL_I2S_MODULE_ENABLED */
-/*#define HAL_IWDG_MODULE_ENABLED */
-/*#define HAL_LCD_MODULE_ENABLED */
-/*#define HAL_LPTIM_MODULE_ENABLED */
-/*#define HAL_RNG_MODULE_ENABLED */
-/*#define HAL_RTC_MODULE_ENABLED */
-/*#define HAL_SPI_MODULE_ENABLED */
-/*#define HAL_TIM_MODULE_ENABLED */
-/*#define HAL_TSC_MODULE_ENABLED */
-#define HAL_UART_MODULE_ENABLED
-/*#define HAL_USART_MODULE_ENABLED */
-/*#define HAL_IRDA_MODULE_ENABLED */
-/*#define HAL_SMARTCARD_MODULE_ENABLED */
-/*#define HAL_SMBUS_MODULE_ENABLED */
-/*#define HAL_WWDG_MODULE_ENABLED */
-/*#define HAL_PCD_MODULE_ENABLED */
-#define HAL_GPIO_MODULE_ENABLED
-#define HAL_EXTI_MODULE_ENABLED
-#define HAL_DMA_MODULE_ENABLED
-#define HAL_I2C_MODULE_ENABLED
-#define HAL_RCC_MODULE_ENABLED
-#define HAL_FLASH_MODULE_ENABLED
-#define HAL_PWR_MODULE_ENABLED
-#define HAL_CORTEX_MODULE_ENABLED
-
-/* ########################## Oscillator Values adaptation ####################*/
-/**
- * @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
- * This value is used by the RCC HAL module to compute the system frequency
- * (when HSE is used as system clock source, directly or through the PLL).
- */
-#if !defined (HSE_VALUE)
- #define HSE_VALUE ((uint32_t)8000000U) /*!< Value of the External oscillator in Hz */
-#endif /* HSE_VALUE */
-
-#if !defined (HSE_STARTUP_TIMEOUT)
- #define HSE_STARTUP_TIMEOUT ((uint32_t)100U) /*!< Time out for HSE start up, in ms */
-#endif /* HSE_STARTUP_TIMEOUT */
-
-/**
- * @brief Internal Multiple Speed oscillator (MSI) default value.
- * This value is the default MSI range value after Reset.
- */
-#if !defined (MSI_VALUE)
- #define MSI_VALUE ((uint32_t)2097000U) /*!< Value of the Internal oscillator in Hz*/
-#endif /* MSI_VALUE */
-
-/**
- * @brief Internal High Speed oscillator (HSI) value.
- * This value is used by the RCC HAL module to compute the system frequency
- * (when HSI is used as system clock source, directly or through the PLL).
- */
-#if !defined (HSI_VALUE)
- #define HSI_VALUE ((uint32_t)16000000U) /*!< Value of the Internal oscillator in Hz*/
-#endif /* HSI_VALUE */
-
-/**
- * @brief Internal High Speed oscillator for USB (HSI48) value.
- */
-#if !defined (HSI48_VALUE)
-#define HSI48_VALUE ((uint32_t)48000000U) /*!< Value of the Internal High Speed oscillator for USB in Hz.
- The real value may vary depending on the variations
- in voltage and temperature. */
-#endif /* HSI48_VALUE */
-
-/**
- * @brief Internal Low Speed oscillator (LSI) value.
- */
-#if !defined (LSI_VALUE)
- #define LSI_VALUE ((uint32_t)37000U) /*!< LSI Typical Value in Hz*/
-#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz
- The real value may vary depending on the variations
- in voltage and temperature.*/
-/**
- * @brief External Low Speed oscillator (LSE) value.
- * This value is used by the UART, RTC HAL module to compute the system frequency
- */
-#if !defined (LSE_VALUE)
- #define LSE_VALUE ((uint32_t)32768U) /*!< Value of the External oscillator in Hz*/
-#endif /* LSE_VALUE */
-
-#if !defined (LSE_STARTUP_TIMEOUT)
- #define LSE_STARTUP_TIMEOUT ((uint32_t)5000U) /*!< Time out for LSE start up, in ms */
-#endif /* LSE_STARTUP_TIMEOUT */
-
-/* Tip: To avoid modifying this file each time you need to use different HSE,
- === you can define the HSE value in your toolchain compiler preprocessor. */
-
-/* ########################### System Configuration ######################### */
-/**
- * @brief This is the HAL system configuration section
- */
-#define VDD_VALUE ((uint32_t)3300U) /*!< Value of VDD in mv */
-#define TICK_INT_PRIORITY ((uint32_t)0U) /*!< tick interrupt priority */
-#define USE_RTOS 0U
-#define PREFETCH_ENABLE 0U
-#define PREREAD_ENABLE 1U
-#define BUFFER_CACHE_DISABLE 0U
-
-/* ########################## Assert Selection ############################## */
-/**
- * @brief Uncomment the line below to expanse the "assert_param" macro in the
- * HAL drivers code
- */
-/* #define USE_FULL_ASSERT 1U */
-
-/* ################## Register callback feature configuration ############### */
-/**
- * @brief Set below the peripheral configuration to "1U" to add the support
- * of HAL callback registration/deregistration feature for the HAL
- * driver(s). This allows user application to provide specific callback
- * functions thanks to HAL_PPP_RegisterCallback() rather than overwriting
- * the default weak callback functions (see each stm32l0xx_hal_ppp.h file
- * for possible callback identifiers defined in HAL_PPP_CallbackIDTypeDef
- * for each PPP peripheral).
- */
-#define USE_HAL_ADC_REGISTER_CALLBACKS 0U
-#define USE_HAL_COMP_REGISTER_CALLBACKS 0U
-#define USE_HAL_DAC_REGISTER_CALLBACKS 0U
-#define USE_HAL_I2C_REGISTER_CALLBACKS 0U
-#define USE_HAL_I2S_REGISTER_CALLBACKS 0U
-#define USE_HAL_IRDA_REGISTER_CALLBACKS 0U
-#define USE_HAL_LPTIM_REGISTER_CALLBACKS 0U
-#define USE_HAL_PCD_REGISTER_CALLBACKS 0U
-#define USE_HAL_RNG_REGISTER_CALLBACKS 0U
-#define USE_HAL_RTC_REGISTER_CALLBACKS 0U
-#define USE_HAL_SMARTCARD_REGISTER_CALLBACKS 0U
-#define USE_HAL_SMBUS_REGISTER_CALLBACKS 0U
-#define USE_HAL_SPI_REGISTER_CALLBACKS 0U
-#define USE_HAL_TIM_REGISTER_CALLBACKS 0U
-#define USE_HAL_TSC_REGISTER_CALLBACKS 0U
-#define USE_HAL_UART_REGISTER_CALLBACKS 0U
-#define USE_HAL_USART_REGISTER_CALLBACKS 0U
-#define USE_HAL_WWDG_REGISTER_CALLBACKS 0U
-
-/* Includes ------------------------------------------------------------------*/
-/**
- * @brief Include module's header file
- */
-
-#ifdef HAL_RCC_MODULE_ENABLED
- #include "stm32l0xx_hal_rcc.h"
-#endif /* HAL_RCC_MODULE_ENABLED */
-
-#ifdef HAL_EXTI_MODULE_ENABLED
- #include "stm32l0xx_hal_exti.h"
-#endif /* HAL_EXTI_MODULE_ENABLED */
-
-#ifdef HAL_GPIO_MODULE_ENABLED
- #include "stm32l0xx_hal_gpio.h"
-#endif /* HAL_GPIO_MODULE_ENABLED */
-
-#ifdef HAL_DMA_MODULE_ENABLED
- #include "stm32l0xx_hal_dma.h"
-#endif /* HAL_DMA_MODULE_ENABLED */
-
-#ifdef HAL_CORTEX_MODULE_ENABLED
- #include "stm32l0xx_hal_cortex.h"
-#endif /* HAL_CORTEX_MODULE_ENABLED */
-
-#ifdef HAL_ADC_MODULE_ENABLED
- #include "stm32l0xx_hal_adc.h"
-#endif /* HAL_ADC_MODULE_ENABLED */
-
-#ifdef HAL_COMP_MODULE_ENABLED
- #include "stm32l0xx_hal_comp.h"
-#endif /* HAL_COMP_MODULE_ENABLED */
-
-#ifdef HAL_CRC_MODULE_ENABLED
- #include "stm32l0xx_hal_crc.h"
-#endif /* HAL_CRC_MODULE_ENABLED */
-
-#ifdef HAL_CRYP_MODULE_ENABLED
- #include "stm32l0xx_hal_cryp.h"
-#endif /* HAL_CRYP_MODULE_ENABLED */
-
-#ifdef HAL_DAC_MODULE_ENABLED
- #include "stm32l0xx_hal_dac.h"
-#endif /* HAL_DAC_MODULE_ENABLED */
-
-#ifdef HAL_FIREWALL_MODULE_ENABLED
- #include "stm32l0xx_hal_firewall.h"
-#endif /* HAL_FIREWALL_MODULE_ENABLED */
-
-#ifdef HAL_FLASH_MODULE_ENABLED
- #include "stm32l0xx_hal_flash.h"
-#endif /* HAL_FLASH_MODULE_ENABLED */
-
-#ifdef HAL_I2C_MODULE_ENABLED
- #include "stm32l0xx_hal_i2c.h"
-#endif /* HAL_I2C_MODULE_ENABLED */
-
-#ifdef HAL_I2S_MODULE_ENABLED
- #include "stm32l0xx_hal_i2s.h"
-#endif /* HAL_I2S_MODULE_ENABLED */
-
-#ifdef HAL_IWDG_MODULE_ENABLED
- #include "stm32l0xx_hal_iwdg.h"
-#endif /* HAL_IWDG_MODULE_ENABLED */
-
-#ifdef HAL_LCD_MODULE_ENABLED
- #include "stm32l0xx_hal_lcd.h"
-#endif /* HAL_LCD_MODULE_ENABLED */
-
-#ifdef HAL_LPTIM_MODULE_ENABLED
-#include "stm32l0xx_hal_lptim.h"
-#endif /* HAL_LPTIM_MODULE_ENABLED */
-
-#ifdef HAL_PWR_MODULE_ENABLED
- #include "stm32l0xx_hal_pwr.h"
-#endif /* HAL_PWR_MODULE_ENABLED */
-
-#ifdef HAL_RNG_MODULE_ENABLED
- #include "stm32l0xx_hal_rng.h"
-#endif /* HAL_RNG_MODULE_ENABLED */
-
-#ifdef HAL_RTC_MODULE_ENABLED
- #include "stm32l0xx_hal_rtc.h"
-
-#endif /* HAL_RTC_MODULE_ENABLED */
-
-#ifdef HAL_SPI_MODULE_ENABLED
- #include "stm32l0xx_hal_spi.h"
-#endif /* HAL_SPI_MODULE_ENABLED */
-
-#ifdef HAL_TIM_MODULE_ENABLED
- #include "stm32l0xx_hal_tim.h"
-#endif /* HAL_TIM_MODULE_ENABLED */
-
-#ifdef HAL_TSC_MODULE_ENABLED
- #include "stm32l0xx_hal_tsc.h"
-#endif /* HAL_TSC_MODULE_ENABLED */
-
-#ifdef HAL_UART_MODULE_ENABLED
- #include "stm32l0xx_hal_uart.h"
-#endif /* HAL_UART_MODULE_ENABLED */
-
-#ifdef HAL_USART_MODULE_ENABLED
- #include "stm32l0xx_hal_usart.h"
-#endif /* HAL_USART_MODULE_ENABLED */
-
-#ifdef HAL_IRDA_MODULE_ENABLED
- #include "stm32l0xx_hal_irda.h"
-#endif /* HAL_IRDA_MODULE_ENABLED */
-
-#ifdef HAL_SMARTCARD_MODULE_ENABLED
- #include "stm32l0xx_hal_smartcard.h"
-#endif /* HAL_SMARTCARD_MODULE_ENABLED */
-
-#ifdef HAL_SMBUS_MODULE_ENABLED
- #include "stm32l0xx_hal_smbus.h"
-#endif /* HAL_SMBUS_MODULE_ENABLED */
-
-#ifdef HAL_WWDG_MODULE_ENABLED
- #include "stm32l0xx_hal_wwdg.h"
-#endif /* HAL_WWDG_MODULE_ENABLED */
-
-#ifdef HAL_PCD_MODULE_ENABLED
- #include "stm32l0xx_hal_pcd.h"
-#endif /* HAL_PCD_MODULE_ENABLED */
-
-/* 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 /* __STM32L0xx_HAL_CONF_H */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/Core/Inc/stm32l0xx_it.h b/Core/Inc/stm32l0xx_it.h
deleted file mode 100644
index 77cb7bd..0000000
--- a/Core/Inc/stm32l0xx_it.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* USER CODE BEGIN Header */
-/**
- ******************************************************************************
- * @file stm32l0xx_it.h
- * @brief This file contains the headers of the interrupt handlers.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; Copyright (c) 2021 STMicroelectronics.
- * All rights reserved.</center></h2>
- *
- * 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);
-/* USER CODE BEGIN EFP */
-
-/* USER CODE END EFP */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __STM32L0xx_IT_H */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/Core/Inc/usart.h b/Core/Inc/usart.h
deleted file mode 100644
index 953af0e..0000000
--- a/Core/Inc/usart.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- ******************************************************************************
- * @file usart.h
- * @brief This file contains all the function prototypes for
- * the usart.c file
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; Copyright (c) 2021 STMicroelectronics.
- * All rights reserved.</center></h2>
- *
- * 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 __USART_H__
-#define __USART_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Includes ------------------------------------------------------------------*/
-#include "main.h"
-
-/* USER CODE BEGIN Includes */
-
-/* USER CODE END Includes */
-
-extern UART_HandleTypeDef huart2;
-
-/* USER CODE BEGIN Private defines */
-
-/* USER CODE END Private defines */
-
-void MX_USART2_UART_Init(void);
-
-/* USER CODE BEGIN Prototypes */
-
-/* USER CODE END Prototypes */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __USART_H__ */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/Core/Src/button.c b/Core/Src/button.c
deleted file mode 100644
index a9333d9..0000000
--- a/Core/Src/button.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * button.c
- *
- * Created on: 2 déc. 2020
- * Author: root
- */
-
-#include "button.h"
-
-void Button_init(BUTTON_TypeDef *button, GPIO_TypeDef * port, uint8_t pn,uint8_t pl) {
-button->gpioPort = port;
-button->pin = pn;
-button->pull = pl;
-
-//Activation de l'horloge sur le port en question
-
-//déterminer le numéro du port 0--> GPIOA, 1-->GPIOB, etc.
-uint8_t nb_port;
-nb_port = ((uint32_t) port - IOPPERIPH_BASE) / 0x400;
-//activation de l'hologe
-RCC->IOPENR |= 1 << nb_port;
-//configuration de la pin en entrée
-button->gpioPort->MODER &= ~(0b11 << 2 * pn);
-//configuration du type de pull
-button->gpioPort->PUPDR &= ~(0b11 << 2 * pn);
-button->gpioPort->PUPDR |= (pl << 2 * pn);
-}
-
-uint8_t Button_State(BUTTON_TypeDef *button) {
-if ((button->gpioPort->IDR & (1 << button->pin)) != 0)
-return 1;
-return 0;
-}
diff --git a/Core/Src/gpio.c b/Core/Src/gpio.c
deleted file mode 100644
index b80c7b9..0000000
--- a/Core/Src/gpio.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- ******************************************************************************
- * @file gpio.c
- * @brief This file provides code for the configuration
- * of all used GPIO pins.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; Copyright (c) 2021 STMicroelectronics.
- * All rights reserved.</center></h2>
- *
- * 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 "gpio.h"
-
-/* USER CODE BEGIN 0 */
-
-/* USER CODE END 0 */
-
-/*----------------------------------------------------------------------------*/
-/* Configure GPIO */
-/*----------------------------------------------------------------------------*/
-/* USER CODE BEGIN 1 */
-
-/* USER CODE END 1 */
-
-/** Configure pins as
- * Analog
- * Input
- * Output
- * EVENT_OUT
- * EXTI
-*/
-void MX_GPIO_Init(void)
-{
-
- GPIO_InitTypeDef GPIO_InitStruct = {0};
-
- /* GPIO Ports Clock Enable */
- __HAL_RCC_GPIOC_CLK_ENABLE();
- __HAL_RCC_GPIOH_CLK_ENABLE();
- __HAL_RCC_GPIOA_CLK_ENABLE();
- __HAL_RCC_GPIOB_CLK_ENABLE();
-
- /*Configure GPIO pin Output Level */
- HAL_GPIO_WritePin(LD2_GPIO_Port, LD2_Pin, GPIO_PIN_RESET);
-
- /*Configure GPIO pin Output Level */
- HAL_GPIO_WritePin(GPIOB, RS_Pin|RW_Pin|E_Pin|D4_Pin
- |D5_Pin|D6_Pin|D7_Pin, GPIO_PIN_RESET);
-
- /*Configure GPIO pin : PtPin */
- GPIO_InitStruct.Pin = B1_Pin;
- GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- HAL_GPIO_Init(B1_GPIO_Port, &GPIO_InitStruct);
-
- /*Configure GPIO pin : PtPin */
- GPIO_InitStruct.Pin = LD2_Pin;
- GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_MEDIUM;
- HAL_GPIO_Init(LD2_GPIO_Port, &GPIO_InitStruct);
-
- /*Configure GPIO pins : PBPin PBPin PBPin PBPin
- PBPin PBPin PBPin */
- GPIO_InitStruct.Pin = RS_Pin|RW_Pin|E_Pin|D4_Pin
- |D5_Pin|D6_Pin|D7_Pin;
- GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_MEDIUM;
- HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
-
-}
-
-/* USER CODE BEGIN 2 */
-
-/* USER CODE END 2 */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/Core/Src/lcd_1602.c b/Core/Src/lcd_1602.c
deleted file mode 100644
index 4dc09b9..0000000
--- a/Core/Src/lcd_1602.c
+++ /dev/null
@@ -1,78 +0,0 @@
-#include "lcd_1602.h"
-
-static void delay_us(uint32_t delay){
- delay*=32;
- while(delay--);
-}
-
-static void lcd_send_4bit(uint8_t data) {
-
- if(data & 0x10) d4(1); else d4(0);
- if(data & 0x20) d5(1); else d5(0);
- if(data & 0x40) d6(1); else d6(0);
- if(data & 0x80) d7(1); else d7(0);
-
-}
-
-static void lcd_send(int8_t rs,uint8_t data){
- // rs : 1=data | 2=command
- // rw : 0=write | 1=read
- // en : 1=senddata | 0=donothing
-
- rs(rs);
- rw(0);
- lcd_send_4bit(data); //MSB
- en(1);
- delay_us(100);
- en(0);
- lcd_send_4bit(data<<4); //LSB
- en(1);
- delay_us(100);
- en(0);
-}
-
-void lcd_cmd(uint8_t command){
- lcd_send(1,command);
-}
-
-void lcd_data(char c){
- lcd_send(1,(uint8_t)c);
-
-}
-
-void lcd_init(void){
- //bl(1);
-
-// lcd_send(0x22);
-
- // 4 bit initialisation
- lcd_send(0,0x20); // 4bit mode
- HAL_Delay(10);
-
- // Display initialisation
- lcd_send(0,0x28); // Function set --> DL=0 (4 bit mode), N = 1 (2 line display) F = 0 (5x8 characters)
- HAL_Delay(1);
- lcd_send(0,0x08); //Display on/off control --> D=0,C=0, B=0 ---> display off
- HAL_Delay(1);
- lcd_send(0,0x01); // clear display
- HAL_Delay(2);
- lcd_send(0,0x06); //Entry mode set --> I/D = 1 (increment cursor) & S = 0 (no shift)
- HAL_Delay(1);
- lcd_send(0,0x0C); //Display on/off control --> D = 1, C and B = 0. (Cursor and blink, last two bits)
- HAL_Delay(2);
-}
-
-void lcd_clr(void){
- lcd_send(0,0x01);
- HAL_Delay(2);
-}
-
-
-void lcd_gotoxy(char x, char y){
- lcd_send(0,0x80+x+(y*0x40));
- HAL_Delay(2);
-}
-
-void lcd_puts(char *text){
- while (*text) lcd_data (*text++);
-}
diff --git a/Core/Src/led.c b/Core/Src/led.c
deleted file mode 100644
index 1a5c58f..0000000
--- a/Core/Src/led.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * led.c
- *
- * Created on: 2 déc. 2020
- * Author: root
- */
-
-#include "led.h"
-
-void Led_init(LED_TypeDef *led, GPIO_TypeDef * port, uint16_t pn){
-led->gpioPort=port;
-led->pin=pn;
-
-//Activation de l'horloge sur le port en question
-
-//déterminer le numéro du port 0--> GPIOA, 1-->GPIOB, etc.
-uint8_t nb_port;
-nb_port=(uint32_t)((uint32_t *)port - IOPPERIPH_BASE)/ (uint32_t)0x400;
-//activation de l'hologe
-RCC->IOPENR|=1<<nb_port;
-
-//configuration de la pin en sortie
-led->gpioPort->MODER&=~(0b11<<2*pn);
-led->gpioPort->MODER|=(0b01<<2*pn);
-}
-
-uint8_t Led_isOn(LED_TypeDef *led){
-return ((led->gpioPort->ODR&(1<<led->pin))!=0);
-}
-
-uint8_t Led_isOff(LED_TypeDef *led){
-return ((led->gpioPort->ODR&(1<<led->pin))==0);
-}
-void Led_turnOn(LED_TypeDef *led){
-led->gpioPort->ODR|=(1<<led->pin);
-}
-
-void Led_turnOff(LED_TypeDef *led){
-led->gpioPort->ODR&=~(1<<led->pin);
-}
-
-void Led_toggle(LED_TypeDef *led){
- led->gpioPort->ODR^=(1<<led->pin);
-}
diff --git a/Core/Src/main.c b/Core/Src/main.c
deleted file mode 100644
index 1001ae9..0000000
--- a/Core/Src/main.c
+++ /dev/null
@@ -1,409 +0,0 @@
-/* USER CODE BEGIN Header */
-/**
- ******************************************************************************
- * @file : main.c
- * @brief : Main program body
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; Copyright (c) 2020 STMicroelectronics.
- * All rights reserved.</center></h2>
- *
- * 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 "usart.h"
-#include "gpio.h"
-
-/* Private includes ----------------------------------------------------------*/
-/* USER CODE BEGIN Includes */
-#include "led.h"
-#include "button.h"
-#include "lcd_1602.h"
-#include <stdlib.h>
-#include <stdio.h>
-#include <time.h>
-#include <unistd.h>
-#include <string.h>
-/* 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 */
-
-/* USER CODE END PV */
-
-/* Private function prototypes -----------------------------------------------*/
-void SystemClock_Config(void);
-/* USER CODE BEGIN PFP */
-
-/* USER CODE END PFP */
-
-/* Private user code ---------------------------------------------------------*/
-
-/* USER CODE BEGIN 0 */
-//Declaration des leds et buttons
-LED_TypeDef led_rouge; //rouge
-LED_TypeDef led_verte; //verte
-LED_TypeDef led_jaune; //jaune
-LED_TypeDef led_system; //vert sur la carte
-
-BUTTON_TypeDef button_rouge; //rouge
-BUTTON_TypeDef button_vert; //vert
-BUTTON_TypeDef button_jaune; //jaune
-BUTTON_TypeDef button_deux_joueur; //gris
-BUTTON_TypeDef button_system; //bleu sur la carte
-
-// fonction pour allumer et eteindre les leds
-void fonction_led(char* couleur, int position) {
- if (strcmp(couleur,"R")==0 && (position==0)){ //eteind rouge
- Led_turnOff(&led_rouge);
- } else if (strcmp(couleur,"R")==0 && (position==1)){ //allume rouge
- Led_turnOn(&led_rouge);
- } else if (strcmp(couleur,"V")==0 && (position==0)){
- Led_turnOff(&led_verte);
- } else if (strcmp(couleur,"V")==0 && (position==1)){
- Led_turnOn(&led_verte);
- } else if (strcmp(couleur,"J")==0 && (position==0)){
- Led_turnOff(&led_jaune);
- } else if (strcmp(couleur,"J")==0 && (position==1)){
- Led_turnOn(&led_jaune);
- } else if (strcmp(couleur,"S")==0 && (position==0)){
- Led_turnOff(&led_system);
- } else if (strcmp(couleur,"S")==0 && (position==1)){
- Led_turnOn(&led_system);
- }
-}
-
-void affiche_lcd(char* contenu, int positiony, int clear) {
- if (clear==1){
- lcd_clr();
- }
- lcd_gotoxy(0,positiony);
- lcd_puts(contenu);
-}
-
-char* choix_aleatoire(void) {
- char* couleur_leds[3]={"R","V","J"}; //nos couleurs de led
- srand(time(0));
- int aleatoire = (rand() % (2 - 0 + 1)) + 0; //choix entre 0 et 2 pour avoir 3 valeurs differentes (3 couleurs/leds)
- char* choix = couleur_leds[aleatoire];
- return choix;
-}
-
-/* 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. */
- HAL_Init();
-
- /* USER CODE BEGIN Init */
-
- /* USER CODE END Init */
-
- /* Configure the system clock */
- SystemClock_Config();
-
- /* USER CODE BEGIN SysInit */
-
- /* USER CODE END SysInit */
-
- /* Initialize all configured peripherals */
- MX_GPIO_Init();
- MX_USART2_UART_Init();
- /* USER CODE BEGIN 2 */
-
-//
- //configuration de l'horloge du système en 16MHz
- RCC->CR|=1; //activer HSI
- RCC->CFGR&=~(0b11);
- RCC->CFGR|=01; //selection de HSI
- HAL_InitTick(16000000);
-//
-
-// Init de nos leds et buttons
- Led_init(&led_system, GPIOA,5); //led_system sur PA5
- Led_init(&led_rouge, GPIOA,6); //led_rouge sur PA6
- Led_init(&led_verte, GPIOA,7); //led_verte sur PA7
- Led_init(&led_jaune, GPIOB,6); //led_jaune sur PB6
-
- Button_init(&button_system, GPIOC, 13); //button_system sur PC13
- Button_init(&button_rouge, GPIOC, 14); //button_rouge sur PC13
- Button_init(&button_vert, GPIOC, 15); //button_vert sur PC13
- Button_init(&button_jaune, GPIOH, 0); //button_jaune sur PH0
- Button_init(&button_deux_joueur, GPIOH, 1); //button_deux_joueur sur PH1
-//
-
-/* EXEMPLE D'UTILISATION POUR LED ET BUTTON
- uint8_t last_button_state = 1; //button non appuyé
- uint8_t current_button_state = 1; //button non appuyé
-
- for (;;) {
- //lire l’état courant
- current_button_state = Button_State(&button_system);
- //si front descendant (bouton appuyé)
- if (last_button_state == 1 && (current_button_state == 0)) {
- Led_turnOn(&led_system); //allume
- //suppression des rebonds
- HAL_Delay(20);
- }
- //si front montant (bouton relâché)
- if (last_button_state == 0 && (current_button_state != 0)) {
- //suppression des rebonds
- HAL_Delay(20);
- Led_turnOff(&led_system); //eteind
- }
- //mise à jour de l’état précédent du bouton
- last_button_state = current_button_state;
- }
-*/
- affiche_lcd("SIMON_STM32",0,1);
-
- int score = 0; //pour le systeme de score
- int deuxieme_joueur_joue = 0; //pour check si le 2e joueur a joué
- int score_un=0; //pour store le score du j1
- int score_deux=0; //pour store le score du j1
- char* suite_de_leds[100]={}; //la suite de leds a faire cligoter
-
- /* USER CODE END 2 */
-
- /* Infinite loop */
-
- while (1)
- {
- /* USER CODE BEGIN WHILE */
- lcd_init();
-
-
-//gestion du mode 2joueurs
- uint8_t last_button_2j_state = 1;
- uint8_t current_button_2j_state = 1;
- int etat_bouton_deux_joueurs=0;
-
- //lire l’état courant
- current_button_2j_state = Button_State(&button_deux_joueur);
- //si front descendant (bouton appuyé)
- if (last_button_2j_state == 1 && (current_button_2j_state == 0) && (etat_bouton_deux_joueurs==0)) {
- etat_bouton_deux_joueurs = 1;
- fonction_led("S",1); //allume la led de la carte
- } else if (last_button_2j_state == 1 && (current_button_2j_state == 0) && (etat_bouton_deux_joueurs==1)) {
- etat_bouton_deux_joueurs = 0;
- fonction_led("S",0); //eteind la led de la carte
- }
- //mise à jour de l’état précédent du bouton
- last_button_2j_state = current_button_2j_state;
-
-
-//gestion du bouton start/system
- uint8_t last_button_system_state = 1; //button non appuyé
- uint8_t current_button_system_state = 1; //button non appuyé
- int etat_bouton_start=0;
-
- //lire l’état courant
- current_button_system_state = Button_State(&button_system);
- //si front descendant (bouton appuyé)
- if (last_button_system_state == 1 && (current_button_system_state == 0) && (etat_bouton_deux_joueurs==0)) {
- etat_bouton_start = 1;
- } else if (last_button_system_state == 1 && (current_button_system_state == 0) && (etat_bouton_deux_joueurs==1)) {
- etat_bouton_start = 0;
- }
- //mise à jour de l’état précédent du bouton
- last_button_system_state = current_button_system_state;
-
-
- int perdu = 0; //pour check si le j a perdu
-
- if (etat_bouton_start){
-//Sequence d'allumage
- affiche_lcd("LET'S GO !",0,1);
- fonction_led("R", 1);
- HAL_Delay(250);
- fonction_led("V", 1);
- HAL_Delay(250);
- fonction_led("J", 1);
- HAL_Delay(250);
- fonction_led("R", 0);
- HAL_Delay(250);
- fonction_led("V", 0);
- HAL_Delay(250);
- fonction_led("J", 0);
- HAL_Delay(250);
-
- if (etat_bouton_deux_joueurs && !deuxieme_joueur_joue){ //lancement du mode 2J
- affiche_lcd("MODE 2J",0,1);
- affiche_lcd("J1!",1,0);
- }
- else if (!etat_bouton_deux_joueurs && !deuxieme_joueur_joue) { //lancement du mode 1J
- affiche_lcd("MODE 1J",0,1);
- }
-
- while (perdu!= 1) { //ici on lance un niveau (suite de leds), tant qu'on a pas perdu
-
- suite_de_leds[score] = choix_aleatoire();
- score++;
- for (int i = 0; i<score; i++){ //allume et eteinds les leds une par une par rapport au niveau
- fonction_led(suite_de_leds[i], 1); //on
- HAL_Delay(500);
- fonction_led(suite_de_leds[i], 0); //off
- HAL_Delay(100);
- }
-
- affiche_lcd("A VOUS !",0,1);
- int iLed=0;
- do { //le joueur appuie sur les boutons
- char bouton[100];
- scanf("%s", bouton); //correspondance
- char* bouton_couleur = bouton; //boutons poussoirs
-
- if (*bouton_couleur!=*suite_de_leds[iLed]){ //le joueur se trompe
- affiche_lcd("GAME OVER !",0,1);
- affiche_lcd("SCORE :",0,1);
-
- char score_char[10];
- sprintf(score_char, "%d", score-1); //rendre un int en char
-
- affiche_lcd(score_char,1,0);
- perdu = 1;
- etat_bouton_start=0;
- } else {
- perdu = 0;
- }
- iLed++;
- } while (iLed<score && perdu!=1);
- //tant qu'on a des leds a faire allume et qu'on a pas perdu
- }
-
- if (etat_bouton_deux_joueurs && perdu==1 && !deuxieme_joueur_joue){ //si le premier joueur perd en mode 2J
- affiche_lcd("J2!",0,1);
- etat_bouton_deux_joueurs = 0;
- perdu = 0;
- etat_bouton_start=1;
- score_un = score;
- deuxieme_joueur_joue = 1;
- } else if (deuxieme_joueur_joue){ //si tout le monde a joue en mode 2 joueurs, on fait la comparaison des scores
- score_deux = score;
- if (score_un>score_deux){affiche_lcd("JOUEUR 1 GAGNE!",0,1);}
- else if (score_un<score_deux){affiche_lcd("JOUEUR 2 GAGNE!",0,1);}
- else {affiche_lcd("EGALITE...",0,1);}
- }
-
- }
- score=0;
-
- /* USER CODE END WHILE */
- }
- /* USER CODE BEGIN 3 */
-
- /* USER CODE END 3 */
-}
-
-/**
- * @brief System Clock Configuration
- * @retval None
- */
-void SystemClock_Config(void)
-{
- RCC_OscInitTypeDef RCC_OscInitStruct = {0};
- RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
- RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
-
- /** Configure the main internal regulator output voltage
- */
- __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
- /** Initializes the RCC Oscillators according to the specified parameters
- * in the RCC_OscInitTypeDef structure.
- */
- RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
- RCC_OscInitStruct.HSIState = RCC_HSI_ON;
- RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
- RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
- if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
- {
- Error_Handler();
- }
- /** Initializes the CPU, AHB and APB buses clocks
- */
- RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
- |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
- RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
- RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
- RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
- RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
-
- if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK)
- {
- Error_Handler();
- }
- PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART2;
- PeriphClkInit.Usart2ClockSelection = RCC_USART2CLKSOURCE_PCLK1;
- if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
- {
- Error_Handler();
- }
-}
-
-/* USER CODE BEGIN 4 */
-
-/* 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 */
-
- /* 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,
- tex: 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/Core/Src/stm32l0xx_hal_msp.c b/Core/Src/stm32l0xx_hal_msp.c
deleted file mode 100644
index f614d4a..0000000
--- a/Core/Src/stm32l0xx_hal_msp.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/* USER CODE BEGIN Header */
-/**
- ******************************************************************************
- * @file stm32l0xx_hal_msp.c
- * @brief This file provides code for the MSP Initialization
- * and de-Initialization codes.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; Copyright (c) 2021 STMicroelectronics.
- * All rights reserved.</center></h2>
- *
- * 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"
-/* USER CODE BEGIN Includes */
-
-/* USER CODE END Includes */
-
-/* Private typedef -----------------------------------------------------------*/
-/* USER CODE BEGIN TD */
-
-/* USER CODE END TD */
-
-/* Private define ------------------------------------------------------------*/
-/* USER CODE BEGIN Define */
-
-/* USER CODE END Define */
-
-/* Private macro -------------------------------------------------------------*/
-/* USER CODE BEGIN Macro */
-
-/* USER CODE END Macro */
-
-/* Private variables ---------------------------------------------------------*/
-/* USER CODE BEGIN PV */
-
-/* USER CODE END PV */
-
-/* Private function prototypes -----------------------------------------------*/
-/* USER CODE BEGIN PFP */
-
-/* USER CODE END PFP */
-
-/* External functions --------------------------------------------------------*/
-/* USER CODE BEGIN ExternalFunctions */
-
-/* USER CODE END ExternalFunctions */
-
-/* USER CODE BEGIN 0 */
-
-/* USER CODE END 0 */
-/**
- * Initializes the Global MSP.
- */
-void HAL_MspInit(void)
-{
- /* USER CODE BEGIN MspInit 0 */
-
- /* USER CODE END MspInit 0 */
-
- __HAL_RCC_SYSCFG_CLK_ENABLE();
- __HAL_RCC_PWR_CLK_ENABLE();
-
- /* System interrupt init*/
-
- /* USER CODE BEGIN MspInit 1 */
-
- /* USER CODE END MspInit 1 */
-}
-
-/* USER CODE BEGIN 1 */
-
-/* USER CODE END 1 */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/Core/Src/stm32l0xx_it.c b/Core/Src/stm32l0xx_it.c
deleted file mode 100644
index bf098ed..0000000
--- a/Core/Src/stm32l0xx_it.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/* USER CODE BEGIN Header */
-/**
- ******************************************************************************
- * @file stm32l0xx_it.c
- * @brief Interrupt Service Routines.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; Copyright (c) 2021 STMicroelectronics.
- * All rights reserved.</center></h2>
- *
- * 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 */
-/* 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 */
-
-/* USER CODE END PV */
-
-/* Private function prototypes -----------------------------------------------*/
-/* USER CODE BEGIN PFP */
-
-/* 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 */
- HAL_IncTick();
- /* 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). */
-/******************************************************************************/
-
-/* USER CODE BEGIN 1 */
-
-/* USER CODE END 1 */
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
diff --git a/Core/Src/syscalls.c b/Core/Src/syscalls.c
deleted file mode 100644
index 914f768..0000000
--- a/Core/Src/syscalls.c
+++ /dev/null
@@ -1,207 +0,0 @@
-/**
-*****************************************************************************
-**
-** File : syscalls.c
-**
-** Author : Auto-generated by System workbench for STM32
-**
-** Abstract : System Workbench Minimal System calls file
-**
-** For more information about which c-functions
-** need which of these lowlevel functions
-** please consult the Newlib libc-manual
-**
-** Target : STMicroelectronics STM32
-**
-** Distribution: The file is distributed “as is,” without any warranty
-** of any kind.
-**
-*****************************************************************************
-** @attention
-**
-** <h2><center>&copy; COPYRIGHT(c) 2019 STMicroelectronics</center></h2>
-**
-** Redistribution and use in source and binary forms, with or without modification,
-** are permitted provided that the following conditions are met:
-** 1. Redistributions of source code must retain the above copyright notice,
-** this list of conditions and the following disclaimer.
-** 2. Redistributions in binary form must reproduce the above copyright notice,
-** this list of conditions and the following disclaimer in the documentation
-** and/or other materials provided with the distribution.
-** 3. Neither the name of STMicroelectronics nor the names of its contributors
-** may be used to endorse or promote products derived from this software
-** without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-*****************************************************************************
-*/
-
-/* Includes */
-#include <sys/stat.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <stdio.h>
-#include <signal.h>
-#include <time.h>
-#include <sys/time.h>
-#include <sys/times.h>
-
-
-/* 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;
-}
-
-caddr_t _sbrk(int incr)
-{
- extern char end asm("end");
- static char *heap_end;
- char *prev_heap_end;
-
- if (heap_end == 0)
- heap_end = &end;
-
- prev_heap_end = heap_end;
- if (heap_end + incr > stack_ptr)
- {
-// write(1, "Heap and stack collision\n", 25);
-// abort();
- errno = ENOMEM;
- return (caddr_t) -1;
- }
-
- heap_end += incr;
-
- return (caddr_t) prev_heap_end;
-}
-
-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/Core/Src/system_stm32l0xx.c b/Core/Src/system_stm32l0xx.c
deleted file mode 100644
index 9189ed8..0000000
--- a/Core/Src/system_stm32l0xx.c
+++ /dev/null
@@ -1,275 +0,0 @@
-/**
- ******************************************************************************
- * @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
- *
- * <h2><center>&copy; Copyright(c) 2016 STMicroelectronics.
- * All rights reserved.</center></h2>
- *
- * 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/Core/Src/usart.c b/Core/Src/usart.c
deleted file mode 100644
index e6948fb..0000000
--- a/Core/Src/usart.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/**
- ******************************************************************************
- * @file usart.c
- * @brief This file provides code for the configuration
- * of the USART instances.
- ******************************************************************************
- * @attention
- *
- * <h2><center>&copy; Copyright (c) 2021 STMicroelectronics.
- * All rights reserved.</center></h2>
- *
- * 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 "usart.h"
-
-/* USER CODE BEGIN 0 */
-
-/* USER CODE END 0 */
-
-UART_HandleTypeDef huart2;
-
-/* USART2 init function */
-
-void MX_USART2_UART_Init(void)
-{
-
- huart2.Instance = USART2;
- huart2.Init.BaudRate = 115200;
- huart2.Init.WordLength = UART_WORDLENGTH_8B;
- huart2.Init.StopBits = UART_STOPBITS_1;
- huart2.Init.Parity = UART_PARITY_NONE;
- huart2.Init.Mode = UART_MODE_TX_RX;
- huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE;
- huart2.Init.OverSampling = UART_OVERSAMPLING_16;
- huart2.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
- huart2.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
- if (HAL_UART_Init(&huart2) != HAL_OK)
- {
- Error_Handler();
- }
-
-}
-
-void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
-{
-
- GPIO_InitTypeDef GPIO_InitStruct = {0};
- if(uartHandle->Instance==USART2)
- {
- /* USER CODE BEGIN USART2_MspInit 0 */
-
- /* USER CODE END USART2_MspInit 0 */
- /* USART2 clock enable */
- __HAL_RCC_USART2_CLK_ENABLE();
-
- __HAL_RCC_GPIOA_CLK_ENABLE();
- /**USART2 GPIO Configuration
- PA2 ------> USART2_TX
- PA3 ------> USART2_RX
- */
- GPIO_InitStruct.Pin = USART_TX_Pin|USART_RX_Pin;
- GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
- GPIO_InitStruct.Pull = GPIO_NOPULL;
- GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
- GPIO_InitStruct.Alternate = GPIO_AF4_USART2;
- HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
-
- /* USER CODE BEGIN USART2_MspInit 1 */
-
- /* USER CODE END USART2_MspInit 1 */
- }
-}
-
-void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle)
-{
-
- if(uartHandle->Instance==USART2)
- {
- /* USER CODE BEGIN USART2_MspDeInit 0 */
-
- /* USER CODE END USART2_MspDeInit 0 */
- /* Peripheral clock disable */
- __HAL_RCC_USART2_CLK_DISABLE();
-
- /**USART2 GPIO Configuration
- PA2 ------> USART2_TX
- PA3 ------> USART2_RX
- */
- HAL_GPIO_DeInit(GPIOA, USART_TX_Pin|USART_RX_Pin);
-
- /* USER CODE BEGIN USART2_MspDeInit 1 */
-
- /* USER CODE END USART2_MspDeInit 1 */
- }
-}
-
-/* USER CODE BEGIN 1 */
-
-/* USER CODE END 1 */
-
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/