├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── other-issue.md └── PULL_REQUEST_TEMPLATE.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Inc ├── Legacy │ └── stm32_hal_legacy.h ├── stm32_assert_template.h ├── stm32l0xx_hal.h ├── stm32l0xx_hal_adc.h ├── stm32l0xx_hal_adc_ex.h ├── stm32l0xx_hal_comp.h ├── stm32l0xx_hal_comp_ex.h ├── stm32l0xx_hal_conf_template.h ├── stm32l0xx_hal_cortex.h ├── stm32l0xx_hal_crc.h ├── stm32l0xx_hal_crc_ex.h ├── stm32l0xx_hal_cryp.h ├── stm32l0xx_hal_cryp_ex.h ├── stm32l0xx_hal_dac.h ├── stm32l0xx_hal_dac_ex.h ├── stm32l0xx_hal_def.h ├── stm32l0xx_hal_dma.h ├── stm32l0xx_hal_exti.h ├── stm32l0xx_hal_firewall.h ├── stm32l0xx_hal_flash.h ├── stm32l0xx_hal_flash_ex.h ├── stm32l0xx_hal_flash_ramfunc.h ├── stm32l0xx_hal_gpio.h ├── stm32l0xx_hal_gpio_ex.h ├── stm32l0xx_hal_i2c.h ├── stm32l0xx_hal_i2c_ex.h ├── stm32l0xx_hal_i2s.h ├── stm32l0xx_hal_irda.h ├── stm32l0xx_hal_irda_ex.h ├── stm32l0xx_hal_iwdg.h ├── stm32l0xx_hal_lcd.h ├── stm32l0xx_hal_lptim.h ├── stm32l0xx_hal_pcd.h ├── stm32l0xx_hal_pcd_ex.h ├── stm32l0xx_hal_pwr.h ├── stm32l0xx_hal_pwr_ex.h ├── stm32l0xx_hal_rcc.h ├── stm32l0xx_hal_rcc_ex.h ├── stm32l0xx_hal_rng.h ├── stm32l0xx_hal_rtc.h ├── stm32l0xx_hal_rtc_ex.h ├── stm32l0xx_hal_smartcard.h ├── stm32l0xx_hal_smartcard_ex.h ├── stm32l0xx_hal_smbus.h ├── stm32l0xx_hal_smbus_ex.h ├── stm32l0xx_hal_spi.h ├── stm32l0xx_hal_tim.h ├── stm32l0xx_hal_tim_ex.h ├── stm32l0xx_hal_tsc.h ├── stm32l0xx_hal_uart.h ├── stm32l0xx_hal_uart_ex.h ├── stm32l0xx_hal_usart.h ├── stm32l0xx_hal_usart_ex.h ├── stm32l0xx_hal_wwdg.h ├── stm32l0xx_ll_adc.h ├── stm32l0xx_ll_bus.h ├── stm32l0xx_ll_comp.h ├── stm32l0xx_ll_cortex.h ├── stm32l0xx_ll_crc.h ├── stm32l0xx_ll_crs.h ├── stm32l0xx_ll_dac.h ├── stm32l0xx_ll_dma.h ├── stm32l0xx_ll_exti.h ├── stm32l0xx_ll_gpio.h ├── stm32l0xx_ll_i2c.h ├── stm32l0xx_ll_iwdg.h ├── stm32l0xx_ll_lptim.h ├── stm32l0xx_ll_lpuart.h ├── stm32l0xx_ll_pwr.h ├── stm32l0xx_ll_rcc.h ├── stm32l0xx_ll_rng.h ├── stm32l0xx_ll_rtc.h ├── stm32l0xx_ll_spi.h ├── stm32l0xx_ll_system.h ├── stm32l0xx_ll_tim.h ├── stm32l0xx_ll_usart.h ├── stm32l0xx_ll_usb.h ├── stm32l0xx_ll_utils.h └── stm32l0xx_ll_wwdg.h ├── LICENSE.md ├── README.md ├── Release_Notes.html ├── SECURITY.md ├── Src ├── stm32l0xx_hal.c ├── stm32l0xx_hal_adc.c ├── stm32l0xx_hal_adc_ex.c ├── stm32l0xx_hal_comp.c ├── stm32l0xx_hal_comp_ex.c ├── stm32l0xx_hal_cortex.c ├── stm32l0xx_hal_crc.c ├── stm32l0xx_hal_crc_ex.c ├── stm32l0xx_hal_cryp.c ├── stm32l0xx_hal_cryp_ex.c ├── stm32l0xx_hal_dac.c ├── stm32l0xx_hal_dac_ex.c ├── stm32l0xx_hal_dma.c ├── stm32l0xx_hal_exti.c ├── stm32l0xx_hal_firewall.c ├── stm32l0xx_hal_flash.c ├── stm32l0xx_hal_flash_ex.c ├── stm32l0xx_hal_flash_ramfunc.c ├── stm32l0xx_hal_gpio.c ├── stm32l0xx_hal_i2c.c ├── stm32l0xx_hal_i2c_ex.c ├── stm32l0xx_hal_i2s.c ├── stm32l0xx_hal_irda.c ├── stm32l0xx_hal_iwdg.c ├── stm32l0xx_hal_lcd.c ├── stm32l0xx_hal_lptim.c ├── stm32l0xx_hal_msp_template.c ├── stm32l0xx_hal_pcd.c ├── stm32l0xx_hal_pcd_ex.c ├── stm32l0xx_hal_pwr.c ├── stm32l0xx_hal_pwr_ex.c ├── stm32l0xx_hal_rcc.c ├── stm32l0xx_hal_rcc_ex.c ├── stm32l0xx_hal_rng.c ├── stm32l0xx_hal_rtc.c ├── stm32l0xx_hal_rtc_ex.c ├── stm32l0xx_hal_smartcard.c ├── stm32l0xx_hal_smartcard_ex.c ├── stm32l0xx_hal_smbus.c ├── stm32l0xx_hal_smbus_ex.c ├── stm32l0xx_hal_spi.c ├── stm32l0xx_hal_tim.c ├── stm32l0xx_hal_tim_ex.c ├── stm32l0xx_hal_timebase_tim_template.c ├── stm32l0xx_hal_tsc.c ├── stm32l0xx_hal_uart.c ├── stm32l0xx_hal_uart_ex.c ├── stm32l0xx_hal_usart.c ├── stm32l0xx_hal_wwdg.c ├── stm32l0xx_ll_adc.c ├── stm32l0xx_ll_comp.c ├── stm32l0xx_ll_crc.c ├── stm32l0xx_ll_crs.c ├── stm32l0xx_ll_dac.c ├── stm32l0xx_ll_dma.c ├── stm32l0xx_ll_exti.c ├── stm32l0xx_ll_gpio.c ├── stm32l0xx_ll_i2c.c ├── stm32l0xx_ll_lptim.c ├── stm32l0xx_ll_lpuart.c ├── stm32l0xx_ll_pwr.c ├── stm32l0xx_ll_rcc.c ├── stm32l0xx_ll_rng.c ├── stm32l0xx_ll_rtc.c ├── stm32l0xx_ll_spi.c ├── stm32l0xx_ll_tim.c ├── stm32l0xx_ll_usart.c ├── stm32l0xx_ll_usb.c └── stm32l0xx_ll_utils.c └── _htmresc ├── favicon.png ├── mini-st_2020.css └── st_logo_2020.png /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Caution** 11 | The Issues are strictly limited for the reporting of problem encountered with the software provided in this project. 12 | For any other problem related to the STM32 product, the performance, the hardware characteristics and boards, the tools the environment in general, please post a topic in the [ST Community/STM32 MCUs forum](https://community.st.com/s/group/0F90X000000AXsASAW/stm32-mcus) 13 | 14 | **Describe the set-up** 15 | * The board (either ST RPN reference or your custom board) 16 | * IDE or at least the compiler and its version 17 | 18 | **Describe the bug** 19 | A clear and concise description of what the bug is. 20 | 21 | **How To Reproduce** 22 | 1. Indicate the global behavior of your application project 23 | 24 | 2. The modules that you suspect to be the cause of the problem (Driver, BSP, MW ...) 25 | 26 | 3. The use case that generates the problem 27 | 28 | 4. How we can reproduce the problem 29 | 30 | 31 | **Additional context** 32 | If you have a first analysis or patch correction, thank you to share your proposal. 33 | 34 | **Screenshots** 35 | If applicable, add screenshots to help explain your problem. 36 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/other-issue.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 'Other Issue ' 3 | about: Generic issue description 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Caution** 11 | The Issues are strictly limited for the reporting of problem encountered with the software provided in this project. 12 | For any other problem related to the STM32 product, the performance, the hardware characteristics and boards, the tools the environment in general, please post a topic in the [ST Community/STM32 MCUs forum](https://community.st.com/s/group/0F90X000000AXsASAW/stm32-mcus) 13 | 14 | **Describe the set-up** 15 | * The board (either ST RPN reference or your custom board) 16 | * IDE or at least the compiler and its version 17 | 18 | **Additional context** 19 | If you have a first analysis or a patch proposal, thank you to share your proposal. 20 | 21 | **Screenshots** 22 | If applicable, add screenshots to help explain your problem. 23 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## IMPORTANT INFORMATION 2 | 3 | ### Contributor License Agreement (CLA) 4 | * The Pull Request feature will be considered by STMicroelectronics after the signature of a **Contributor License Agreement (CLA)** by the submitter. 5 | * If you did not sign such agreement, please follow the steps mentioned in the CONTRIBUTING.md file. 6 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at https://www.st.com/content/st_com/en/contact-us.html. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available [here](https://www.contributor-covenant.org/version/1/4/code-of-conduct.html). 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, refer to the FAQ section [here](https://www.contributor-covenant.org/faq). 76 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing guide 2 | 3 | This guide serves as a checklist before contributing to this repository. It mainly focuses on the steps to follow to submit an issue or a pull-request. 4 | 5 | ## 1. Issues 6 | 7 | ### 1.1 Before opening an issue 8 | 9 | Please check the following points before posting an issue: 10 | * Make sure you are using the latest commit (major releases are tagged, but corrections are available as new commits). 11 | * Make sure your issue is a question/feedback/suggestions **related to** the software provided in this repository. Otherwise, please refer to section [3](CONTRIBUTING.md#3-support-requests-and-questions) below. 12 | * Make sure your issue is not already reported/fixed on GitHub or discussed on a previous issue. Do not forget to browse into the **closed** issues. 13 | 14 | ### 1.2 Posting the issue 15 | 16 | When you have checked the previous points, create a new report from the **Issues** tab of this repository. A template is available [here](../../issues/new/choose) to help you report the issue you are facing or the enhancement you would like to propose. 17 | 18 | ## 2. Pull Requests 19 | 20 | ### 2.1 Before opening a pull-request 21 | 22 | STMicrolectronics is happy to receive contributions from the community, based on an initial Contributor License Agreement (CLA) procedure. 23 | 24 | * If you are an individual writing original source code and you are sure **you own the intellectual property**, then you need to sign an Individual [CLA](https://cla.st.com). 25 | * If you work for a company that wants also to allow you to contribute with your work, your company needs to provide a Corporate [CLA](https://cla.st.com) mentioning your GitHub account name. 26 | * If you are not sure that a CLA (Individual or Corporate) has been signed for your GitHub account you can check the [CLA](https://cla.st.com) dedicated page. 27 | 28 | Please note that: 29 | * The Corporate CLA will always take precedence over the Individual CLA. 30 | * One CLA submission is sufficient, for any project proposed by STMicroelectronics. 31 | 32 | ### 2.2 How to proceed 33 | 34 | * We recommend to engage first a communication thru an issue, in order to present your proposal, just to confirm that it corresponds to STMicroelectronics' domain or scope. 35 | * Then fork the project to your GitHub account to further develop your contribution. Please use the latest commit version. 36 | * Please, submit one pull-request per new feature or proposal. This will ease the analysis and the final merge if accepted. 37 | 38 | ## 3. Support requests and questions 39 | 40 | For support requests or any other question related to the product, the tools, the environment, you can submit a post to the **ST Community** on the appropriate topic [page](https://community.st.com/s/topiccatalog). 41 | -------------------------------------------------------------------------------- /Inc/stm32_assert_template.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32_assert.h 4 | * @author MCD Application Team 5 | * @brief STM32 assert template file. 6 | * This file should be copied to the application folder and renamed 7 | * to stm32_assert.h. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * Copyright (c) 2016 STMicroelectronics. 12 | * All rights reserved. 13 | * 14 | * This software is licensed under terms that can be found in the LICENSE file 15 | * in the root directory of this software component. 16 | * If no LICENSE file comes with this software, it is provided AS-IS. 17 | * 18 | ****************************************************************************** 19 | */ 20 | 21 | /* Define to prevent recursive inclusion -------------------------------------*/ 22 | #ifndef __STM32_ASSERT_H 23 | #define __STM32_ASSERT_H 24 | 25 | #ifdef __cplusplus 26 | extern "C" { 27 | #endif 28 | 29 | /* Exported types ------------------------------------------------------------*/ 30 | /* Exported constants --------------------------------------------------------*/ 31 | /* Includes ------------------------------------------------------------------*/ 32 | /* Exported macro ------------------------------------------------------------*/ 33 | #ifdef USE_FULL_ASSERT 34 | /** 35 | * @brief The assert_param macro is used for function's parameters check. 36 | * @param expr If expr is false, it calls assert_failed function 37 | * which reports the name of the source file and the source 38 | * line number of the call that failed. 39 | * If expr is true, it returns no value. 40 | * @retval None 41 | */ 42 | #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__)) 43 | /* Exported functions ------------------------------------------------------- */ 44 | void assert_failed(uint8_t* file, uint32_t line); 45 | #else 46 | #define assert_param(expr) ((void)0U) 47 | #endif /* USE_FULL_ASSERT */ 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif /* __STM32_ASSERT_H */ 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /Inc/stm32l0xx_hal_adc_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_hal_adc_ex.h 4 | * @author MCD Application Team 5 | * @brief Header file of ADC HAL extended module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2016 STMicroelectronics. 10 | * All rights reserved. 11 | * 12 | * This software is licensed under terms that can be found in the LICENSE file 13 | * in the root directory of this software component. 14 | * If no LICENSE file comes with this software, it is provided AS-IS. 15 | * 16 | ****************************************************************************** 17 | */ 18 | 19 | /* Define to prevent recursive inclusion -------------------------------------*/ 20 | #ifndef __STM32L0xx_HAL_ADC_EX_H 21 | #define __STM32L0xx_HAL_ADC_EX_H 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | /* Includes ------------------------------------------------------------------*/ 28 | #include "stm32l0xx_hal_def.h" 29 | 30 | /** @addtogroup STM32L0xx_HAL_Driver 31 | * @{ 32 | */ 33 | 34 | /** @addtogroup ADCEx 35 | * @{ 36 | */ 37 | 38 | /* Exported types ------------------------------------------------------------*/ 39 | /* Exported constants --------------------------------------------------------*/ 40 | 41 | /** @defgroup ADCEx_Exported_Constants ADC Extended Exported Constants 42 | * @{ 43 | */ 44 | 45 | /** @defgroup ADCEx_Channel_Mode ADC Single Ended 46 | * @{ 47 | */ 48 | #define ADC_SINGLE_ENDED 0x00000000U /* dummy value */ 49 | /** 50 | * @} 51 | */ 52 | 53 | /** @defgroup ADC_regular_external_trigger_source ADC External Trigger Source 54 | * @{ 55 | */ 56 | #define ADC_EXTERNALTRIGCONV_T6_TRGO (0x00000000U) 57 | #define ADC_EXTERNALTRIGCONV_T21_CC2 (ADC_CFGR1_EXTSEL_0) 58 | #define ADC_EXTERNALTRIGCONV_T2_TRGO (ADC_CFGR1_EXTSEL_1) 59 | #define ADC_EXTERNALTRIGCONV_T2_CC4 (ADC_CFGR1_EXTSEL_1 | ADC_CFGR1_EXTSEL_0) 60 | #define ADC_EXTERNALTRIGCONV_T22_TRGO (ADC_CFGR1_EXTSEL_2) 61 | #define ADC_EXTERNALTRIGCONV_T3_TRGO (ADC_CFGR1_EXTSEL_2 | ADC_CFGR1_EXTSEL_1) 62 | #define ADC_EXTERNALTRIGCONV_EXT_IT11 (ADC_CFGR1_EXTSEL_2 | ADC_CFGR1_EXTSEL_1 | ADC_CFGR1_EXTSEL_0) 63 | #define ADC_SOFTWARE_START (ADC_CFGR1_EXTSEL + 1U) 64 | 65 | /* ADC group regular external trigger TIM21_TRGO available only on */ 66 | /* STM32L0 devices categories: Cat.2, Cat.3, Cat.5 */ 67 | #if defined (STM32L031xx) || defined (STM32L041xx) || \ 68 | defined (STM32L051xx) || defined (STM32L052xx) || defined (STM32L053xx) || \ 69 | defined (STM32L062xx) || defined (STM32L063xx) || \ 70 | defined (STM32L071xx) || defined (STM32L072xx) || defined (STM32L073xx) || \ 71 | defined (STM32L081xx) || defined (STM32L082xx) || defined (STM32L083xx) || \ 72 | defined (STM32L010x6) || defined (STM32L010x8) || defined (STM32L010xB) 73 | #define ADC_EXTERNALTRIGCONV_T21_TRGO (ADC_EXTERNALTRIGCONV_T22_TRGO) 74 | #endif 75 | 76 | /* ADC group regular external trigger TIM2_CC3 available only on */ 77 | /* STM32L0 devices categories: Cat.1, Cat.2, Cat.5 */ 78 | #if defined (STM32L011xx) || defined (STM32L021xx) || \ 79 | defined (STM32L031xx) || defined (STM32L041xx) || \ 80 | defined (STM32L071xx) || defined (STM32L072xx) || defined (STM32L073xx) || \ 81 | defined (STM32L081xx) || defined (STM32L082xx) || defined (STM32L083xx) || \ 82 | defined (STM32L010x4) || defined (STM32L010x6) || defined (STM32L010x8) || defined (STM32L010xB) 83 | #define ADC_EXTERNALTRIGCONV_T2_CC3 (ADC_CFGR1_EXTSEL_2 | ADC_CFGR1_EXTSEL_0) 84 | #endif 85 | 86 | /** 87 | * @} 88 | */ 89 | 90 | /** @defgroup ADC_SYSCFG_internal_paths_flags_definition ADC SYSCFG internal paths Flags Definition 91 | * @{ 92 | */ 93 | #define ADC_FLAG_SENSOR SYSCFG_CFGR3_VREFINT_RDYF 94 | #define ADC_FLAG_VREFINT SYSCFG_VREFINT_ADC_RDYF 95 | /** 96 | * @} 97 | */ 98 | 99 | /** 100 | * @} 101 | */ 102 | 103 | /* Private macros ------------------------------------------------------------*/ 104 | 105 | /** @defgroup ADCEx_Private_Macros ADCEx Private Macros 106 | * @{ 107 | */ 108 | 109 | #define IS_ADC_SINGLE_DIFFERENTIAL(SING_DIFF) ((SING_DIFF) == ADC_SINGLE_ENDED) 110 | 111 | /** @defgroup ADCEx_calibration_factor_length_verification ADC Calibration Factor Length Verification 112 | * @{ 113 | */ 114 | /** 115 | * @brief Calibration factor length verification (7 bits maximum) 116 | * @param _Calibration_Factor_: Calibration factor value 117 | * @retval None 118 | */ 119 | #define IS_ADC_CALFACT(_Calibration_Factor_) ((_Calibration_Factor_) <= (0x7FU)) 120 | /** 121 | * @} 122 | */ 123 | 124 | /** @defgroup ADC_External_trigger_Source ADC External Trigger Source 125 | * @{ 126 | */ 127 | #if defined (STM32L031xx) || defined (STM32L041xx) || \ 128 | defined (STM32L071xx) || defined (STM32L072xx) || defined (STM32L073xx) || \ 129 | defined (STM32L081xx) || defined (STM32L082xx) || defined (STM32L083xx) || \ 130 | defined (STM32L010x6) || defined (STM32L010x8) || defined (STM32L010xB) 131 | #define IS_ADC_EXTTRIG(CONV) (((CONV) == ADC_EXTERNALTRIGCONV_T6_TRGO ) || \ 132 | ((CONV) == ADC_EXTERNALTRIGCONV_T21_CC2 ) || \ 133 | ((CONV) == ADC_EXTERNALTRIGCONV_T2_TRGO ) || \ 134 | ((CONV) == ADC_EXTERNALTRIGCONV_T2_CC4 ) || \ 135 | ((CONV) == ADC_EXTERNALTRIGCONV_T22_TRGO ) || \ 136 | ((CONV) == ADC_EXTERNALTRIGCONV_T21_TRGO ) || \ 137 | ((CONV) == ADC_EXTERNALTRIGCONV_T2_CC3 ) || \ 138 | ((CONV) == ADC_EXTERNALTRIGCONV_T3_TRGO ) || \ 139 | ((CONV) == ADC_EXTERNALTRIGCONV_EXT_IT11 ) || \ 140 | ((CONV) == ADC_SOFTWARE_START)) 141 | #elif defined (STM32L010x4) || defined (STM32L011xx) || defined (STM32L021xx) 142 | #define IS_ADC_EXTTRIG(CONV) (((CONV) == ADC_EXTERNALTRIGCONV_T6_TRGO ) || \ 143 | ((CONV) == ADC_EXTERNALTRIGCONV_T21_CC2 ) || \ 144 | ((CONV) == ADC_EXTERNALTRIGCONV_T2_TRGO ) || \ 145 | ((CONV) == ADC_EXTERNALTRIGCONV_T2_CC4 ) || \ 146 | ((CONV) == ADC_EXTERNALTRIGCONV_T22_TRGO ) || \ 147 | ((CONV) == ADC_EXTERNALTRIGCONV_T2_CC3 ) || \ 148 | ((CONV) == ADC_EXTERNALTRIGCONV_T3_TRGO ) || \ 149 | ((CONV) == ADC_EXTERNALTRIGCONV_EXT_IT11 ) || \ 150 | ((CONV) == ADC_SOFTWARE_START)) 151 | #elif defined (STM32L051xx) || defined (STM32L052xx) || defined (STM32L053xx) || \ 152 | defined (STM32L062xx) || defined (STM32L063xx) 153 | #define IS_ADC_EXTTRIG(CONV) (((CONV) == ADC_EXTERNALTRIGCONV_T6_TRGO ) || \ 154 | ((CONV) == ADC_EXTERNALTRIGCONV_T21_CC2 ) || \ 155 | ((CONV) == ADC_EXTERNALTRIGCONV_T2_TRGO ) || \ 156 | ((CONV) == ADC_EXTERNALTRIGCONV_T2_CC4 ) || \ 157 | ((CONV) == ADC_EXTERNALTRIGCONV_T22_TRGO ) || \ 158 | ((CONV) == ADC_EXTERNALTRIGCONV_T21_TRGO ) || \ 159 | ((CONV) == ADC_EXTERNALTRIGCONV_T3_TRGO ) || \ 160 | ((CONV) == ADC_EXTERNALTRIGCONV_EXT_IT11 ) || \ 161 | ((CONV) == ADC_SOFTWARE_START)) 162 | #endif 163 | /** 164 | * @} 165 | */ 166 | 167 | /** 168 | * @} 169 | */ 170 | 171 | /* Exported functions --------------------------------------------------------*/ 172 | /** @addtogroup ADCEx_Exported_Functions 173 | * @{ 174 | */ 175 | 176 | /** @addtogroup ADCEx_Exported_Functions_Group1 177 | * @{ 178 | */ 179 | /* IO operation functions *****************************************************/ 180 | 181 | /* ADC calibration */ 182 | HAL_StatusTypeDef HAL_ADCEx_Calibration_Start(ADC_HandleTypeDef *hadc, uint32_t SingleDiff); 183 | uint32_t HAL_ADCEx_Calibration_GetValue(ADC_HandleTypeDef *hadc, uint32_t SingleDiff); 184 | HAL_StatusTypeDef HAL_ADCEx_Calibration_SetValue(ADC_HandleTypeDef *hadc, uint32_t SingleDiff, uint32_t CalibrationFactor); 185 | 186 | /* ADC VrefInt and Temperature sensor functions specific to this STM32 series */ 187 | HAL_StatusTypeDef HAL_ADCEx_EnableVREFINT(void); 188 | void HAL_ADCEx_DisableVREFINT(void); 189 | HAL_StatusTypeDef HAL_ADCEx_EnableVREFINTTempSensor(void); 190 | void HAL_ADCEx_DisableVREFINTTempSensor(void); 191 | /** 192 | * @} 193 | */ 194 | 195 | /** 196 | * @} 197 | */ 198 | 199 | 200 | /** 201 | * @} 202 | */ 203 | 204 | /** 205 | * @} 206 | */ 207 | 208 | #ifdef __cplusplus 209 | } 210 | #endif 211 | 212 | #endif /*__STM32L0xx_HAL_ADC_EX_H */ 213 | 214 | -------------------------------------------------------------------------------- /Inc/stm32l0xx_hal_comp_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_hal_comp_ex.h 4 | * @author MCD Application Team 5 | * @brief Header file of COMP HAL Extended module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2016 STMicroelectronics. 10 | * All rights reserved. 11 | * 12 | * This software is licensed under terms that can be found in the LICENSE file 13 | * in the root directory of this software component. 14 | * If no LICENSE file comes with this software, it is provided AS-IS. 15 | * 16 | ****************************************************************************** 17 | */ 18 | 19 | /* Define to prevent recursive inclusion -------------------------------------*/ 20 | #ifndef __STM32L0xx_HAL_COMP_EX_H 21 | #define __STM32L0xx_HAL_COMP_EX_H 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | #if !defined(STM32L010xB) && !defined (STM32L010x8) && !defined (STM32L010x6) && !defined (STM32L010x4) 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "stm32l0xx_hal_def.h" 30 | 31 | /** @addtogroup STM32L0xx_HAL_Driver 32 | * @{ 33 | */ 34 | 35 | /** @defgroup COMPEx COMPEx 36 | * @{ 37 | */ 38 | 39 | /* Exported functions --------------------------------------------------------*/ 40 | /** @defgroup COMPEx_Exported_Functions COMPEx Exported Functions 41 | * @{ 42 | */ 43 | 44 | /** @defgroup COMPEx_Exported_Functions_Group1 Extended COMP VREFINT setup functions 45 | * @{ 46 | */ 47 | /* COMP specific functions to manage VREFINT *************************************/ 48 | void HAL_COMPEx_EnableVREFINT(void); 49 | void HAL_COMPEx_DisableVREFINT(void); 50 | 51 | /** 52 | * @} 53 | */ 54 | 55 | /** 56 | * @} 57 | */ 58 | 59 | /** 60 | * @} 61 | */ 62 | 63 | /** 64 | * @} 65 | */ 66 | #endif /* #if !defined(STM32L010xB) && !defined (STM32L010x8) && !defined (STM32L010x6) && !defined (STM32L010x4) */ 67 | 68 | #ifdef __cplusplus 69 | } 70 | #endif 71 | 72 | #endif /* __STM32L0xx_HAL_COMP_EX_H */ 73 | 74 | 75 | -------------------------------------------------------------------------------- /Inc/stm32l0xx_hal_crc_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_hal_crc_ex.h 4 | * @author MCD Application Team 5 | * @brief Header file of CRC HAL extended module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2016 STMicroelectronics. 10 | * All rights reserved. 11 | * 12 | * This software is licensed under terms that can be found in the LICENSE file 13 | * in the root directory of this software component. 14 | * If no LICENSE file comes with this software, it is provided AS-IS. 15 | * 16 | ****************************************************************************** 17 | */ 18 | 19 | /* Define to prevent recursive inclusion -------------------------------------*/ 20 | #ifndef STM32L0xx_HAL_CRC_EX_H 21 | #define STM32L0xx_HAL_CRC_EX_H 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | /* Includes ------------------------------------------------------------------*/ 28 | #include "stm32l0xx_hal_def.h" 29 | 30 | /** @addtogroup STM32L0xx_HAL_Driver 31 | * @{ 32 | */ 33 | 34 | /** @addtogroup CRCEx 35 | * @{ 36 | */ 37 | 38 | /* Exported types ------------------------------------------------------------*/ 39 | /* Exported constants --------------------------------------------------------*/ 40 | /** @defgroup CRCEx_Exported_Constants CRC Extended Exported Constants 41 | * @{ 42 | */ 43 | 44 | /** @defgroup CRCEx_Input_Data_Inversion Input Data Inversion Modes 45 | * @{ 46 | */ 47 | #define CRC_INPUTDATA_INVERSION_NONE 0x00000000U /*!< No input data inversion */ 48 | #define CRC_INPUTDATA_INVERSION_BYTE CRC_CR_REV_IN_0 /*!< Byte-wise input data inversion */ 49 | #define CRC_INPUTDATA_INVERSION_HALFWORD CRC_CR_REV_IN_1 /*!< HalfWord-wise input data inversion */ 50 | #define CRC_INPUTDATA_INVERSION_WORD CRC_CR_REV_IN /*!< Word-wise input data inversion */ 51 | /** 52 | * @} 53 | */ 54 | 55 | /** @defgroup CRCEx_Output_Data_Inversion Output Data Inversion Modes 56 | * @{ 57 | */ 58 | #define CRC_OUTPUTDATA_INVERSION_DISABLE 0x00000000U /*!< No output data inversion */ 59 | #define CRC_OUTPUTDATA_INVERSION_ENABLE CRC_CR_REV_OUT /*!< Bit-wise output data inversion */ 60 | /** 61 | * @} 62 | */ 63 | 64 | /** 65 | * @} 66 | */ 67 | 68 | /* Exported macro ------------------------------------------------------------*/ 69 | /** @defgroup CRCEx_Exported_Macros CRC Extended Exported Macros 70 | * @{ 71 | */ 72 | 73 | /** 74 | * @brief Set CRC output reversal 75 | * @param __HANDLE__ CRC handle 76 | * @retval None 77 | */ 78 | #define __HAL_CRC_OUTPUTREVERSAL_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= CRC_CR_REV_OUT) 79 | 80 | /** 81 | * @brief Unset CRC output reversal 82 | * @param __HANDLE__ CRC handle 83 | * @retval None 84 | */ 85 | #define __HAL_CRC_OUTPUTREVERSAL_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(CRC_CR_REV_OUT)) 86 | 87 | /** 88 | * @brief Set CRC non-default polynomial 89 | * @param __HANDLE__ CRC handle 90 | * @param __POLYNOMIAL__ 7, 8, 16 or 32-bit polynomial 91 | * @retval None 92 | */ 93 | #define __HAL_CRC_POLYNOMIAL_CONFIG(__HANDLE__, __POLYNOMIAL__) ((__HANDLE__)->Instance->POL = (__POLYNOMIAL__)) 94 | 95 | /** 96 | * @} 97 | */ 98 | 99 | /* Private macros --------------------------------------------------------*/ 100 | /** @defgroup CRCEx_Private_Macros CRC Extended Private Macros 101 | * @{ 102 | */ 103 | 104 | #define IS_CRC_INPUTDATA_INVERSION_MODE(MODE) (((MODE) == CRC_INPUTDATA_INVERSION_NONE) || \ 105 | ((MODE) == CRC_INPUTDATA_INVERSION_BYTE) || \ 106 | ((MODE) == CRC_INPUTDATA_INVERSION_HALFWORD) || \ 107 | ((MODE) == CRC_INPUTDATA_INVERSION_WORD)) 108 | 109 | #define IS_CRC_OUTPUTDATA_INVERSION_MODE(MODE) (((MODE) == CRC_OUTPUTDATA_INVERSION_DISABLE) || \ 110 | ((MODE) == CRC_OUTPUTDATA_INVERSION_ENABLE)) 111 | 112 | /** 113 | * @} 114 | */ 115 | 116 | /* Exported functions --------------------------------------------------------*/ 117 | 118 | /** @addtogroup CRCEx_Exported_Functions 119 | * @{ 120 | */ 121 | 122 | /** @addtogroup CRCEx_Exported_Functions_Group1 123 | * @{ 124 | */ 125 | /* Initialization and de-initialization functions ****************************/ 126 | HAL_StatusTypeDef HAL_CRCEx_Polynomial_Set(CRC_HandleTypeDef *hcrc, uint32_t Pol, uint32_t PolyLength); 127 | HAL_StatusTypeDef HAL_CRCEx_Input_Data_Reverse(CRC_HandleTypeDef *hcrc, uint32_t InputReverseMode); 128 | HAL_StatusTypeDef HAL_CRCEx_Output_Data_Reverse(CRC_HandleTypeDef *hcrc, uint32_t OutputReverseMode); 129 | 130 | /** 131 | * @} 132 | */ 133 | 134 | /** 135 | * @} 136 | */ 137 | 138 | /** 139 | * @} 140 | */ 141 | 142 | /** 143 | * @} 144 | */ 145 | 146 | #ifdef __cplusplus 147 | } 148 | #endif 149 | 150 | #endif /* STM32L0xx_HAL_CRC_EX_H */ 151 | -------------------------------------------------------------------------------- /Inc/stm32l0xx_hal_cryp_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_hal_cryp_ex.h 4 | * @author MCD Application Team 5 | * @brief Header file of CRYPEx HAL module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2016 STMicroelectronics. 10 | * All rights reserved. 11 | * 12 | * This software is licensed under terms that can be found in the LICENSE file 13 | * in the root directory of this software component. 14 | * If no LICENSE file comes with this software, it is provided AS-IS. 15 | * 16 | ****************************************************************************** 17 | */ 18 | 19 | /* Define to prevent recursive inclusion -------------------------------------*/ 20 | #ifndef __STM32L0xx_HAL_CRYP_EX_H 21 | #define __STM32L0xx_HAL_CRYP_EX_H 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | #if defined (STM32L021xx) || defined (STM32L041xx) || defined (STM32L062xx) || defined (STM32L063xx) || (STM32L081xx) || defined (STM32L082xx) || defined (STM32L083xx) 28 | 29 | /* Includes ------------------------------------------------------------------*/ 30 | #include "stm32l0xx_hal_def.h" 31 | 32 | /** @addtogroup STM32L0xx_HAL_Driver 33 | * @{ 34 | */ 35 | 36 | /** @defgroup CRYPEx CRYPEx 37 | * @{ 38 | */ 39 | 40 | /* Exported types ------------------------------------------------------------*/ 41 | /* Exported constants --------------------------------------------------------*/ 42 | /* Exported functions --------------------------------------------------------*/ 43 | 44 | /** @defgroup CRYPEx_Exported_Functions CRYPEx Exported Functions 45 | * @{ 46 | */ 47 | 48 | /** @defgroup CRYPEx_Exported_Functions_Group1 Extended features functions 49 | * @{ 50 | */ 51 | 52 | /* CallBack functions ********************************************************/ 53 | void HAL_CRYPEx_ComputationCpltCallback(CRYP_HandleTypeDef *hcryp); 54 | 55 | /** 56 | * @} 57 | */ 58 | 59 | /** 60 | * @} 61 | */ 62 | 63 | /** 64 | * @} 65 | */ 66 | 67 | /** 68 | * @} 69 | */ 70 | 71 | #endif /* STM32L021xx || STM32L041xx || STM32L062xx || STM32L063xx || STM32L081xx || STM32L082xx || STM32L083xx */ 72 | 73 | #ifdef __cplusplus 74 | } 75 | #endif 76 | 77 | #endif /* __STM32L0xx_HAL_CRYP_EX_H */ 78 | -------------------------------------------------------------------------------- /Inc/stm32l0xx_hal_dac_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_hal_dac_ex.h 4 | * @author MCD Application Team 5 | * @brief Header file of DAC HAL Extension module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2016 STMicroelectronics. 10 | * All rights reserved. 11 | * 12 | * This software is licensed under terms that can be found in the LICENSE file 13 | * in the root directory of this software component. 14 | * If no LICENSE file comes with this software, it is provided AS-IS. 15 | * 16 | ****************************************************************************** 17 | */ 18 | 19 | /* Define to prevent recursive inclusion -------------------------------------*/ 20 | #ifndef __STM32L0xx_HAL_DAC_EX_H 21 | #define __STM32L0xx_HAL_DAC_EX_H 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | #if !defined(STM32L010xB) && !defined (STM32L010x8) && !defined (STM32L010x6) && !defined (STM32L010x4) && !defined (STM32L011xx) && !defined (STM32L021xx) && !defined (STM32L031xx) && !defined (STM32L041xx) && !defined (STM32L051xx) && !defined (STM32L071xx) && !defined (STM32L081xx) 28 | 29 | /* Includes ------------------------------------------------------------------*/ 30 | #include "stm32l0xx_hal_def.h" 31 | 32 | /** @addtogroup STM32L0xx_HAL_Driver 33 | * @{ 34 | */ 35 | 36 | /** @defgroup DACEx DACEx 37 | * @{ 38 | */ 39 | 40 | /* Exported types ------------------------------------------------------------*/ 41 | 42 | /* Exported constants --------------------------------------------------------*/ 43 | 44 | /** @defgroup DACEx_Exported_Constants DACEx Exported Constants 45 | * @{ 46 | */ 47 | 48 | /** @defgroup DACEx_lfsrunmask_triangleamplitude DACEx lfsrunmask triangleamplitude 49 | * @{ 50 | */ 51 | #define DAC_LFSRUNMASK_BIT0 (0x00000000U) /*!< Unmask DAC channel LFSR bit0 for noise wave generation */ 52 | #define DAC_LFSRUNMASK_BITS1_0 (DAC_CR_MAMP1_0) /*!< Unmask DAC channel LFSR bit[1:0] for noise wave generation */ 53 | #define DAC_LFSRUNMASK_BITS2_0 (DAC_CR_MAMP1_1) /*!< Unmask DAC channel LFSR bit[2:0] for noise wave generation */ 54 | #define DAC_LFSRUNMASK_BITS3_0 ((uint32_t)DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0)/*!< Unmask DAC channel LFSR bit[3:0] for noise wave generation */ 55 | #define DAC_LFSRUNMASK_BITS4_0 (DAC_CR_MAMP1_2) /*!< Unmask DAC channel LFSR bit[4:0] for noise wave generation */ 56 | #define DAC_LFSRUNMASK_BITS5_0 ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_0) /*!< Unmask DAC channel LFSR bit[5:0] for noise wave generation */ 57 | #define DAC_LFSRUNMASK_BITS6_0 ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1) /*!< Unmask DAC channel LFSR bit[6:0] for noise wave generation */ 58 | #define DAC_LFSRUNMASK_BITS7_0 ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Unmask DAC channel LFSR bit[7:0] for noise wave generation */ 59 | #define DAC_LFSRUNMASK_BITS8_0 (DAC_CR_MAMP1_3) /*!< Unmask DAC channel LFSR bit[8:0] for noise wave generation */ 60 | #define DAC_LFSRUNMASK_BITS9_0 ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_0) /*!< Unmask DAC channel LFSR bit[9:0] for noise wave generation */ 61 | #define DAC_LFSRUNMASK_BITS10_0 ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1) /*!< Unmask DAC channel LFSR bit[10:0] for noise wave generation */ 62 | #define DAC_LFSRUNMASK_BITS11_0 ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Unmask DAC channel LFSR bit[11:0] for noise wave generation */ 63 | #define DAC_TRIANGLEAMPLITUDE_1 (0x00000000U) /*!< Select max triangle amplitude of 1 */ 64 | #define DAC_TRIANGLEAMPLITUDE_3 (DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 3 */ 65 | #define DAC_TRIANGLEAMPLITUDE_7 (DAC_CR_MAMP1_1) /*!< Select max triangle amplitude of 7 */ 66 | #define DAC_TRIANGLEAMPLITUDE_15 ((uint32_t)DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 15 */ 67 | #define DAC_TRIANGLEAMPLITUDE_31 (DAC_CR_MAMP1_2) /*!< Select max triangle amplitude of 31 */ 68 | #define DAC_TRIANGLEAMPLITUDE_63 ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 63 */ 69 | #define DAC_TRIANGLEAMPLITUDE_127 ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1) /*!< Select max triangle amplitude of 127 */ 70 | #define DAC_TRIANGLEAMPLITUDE_255 ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 255 */ 71 | #define DAC_TRIANGLEAMPLITUDE_511 (DAC_CR_MAMP1_3) /*!< Select max triangle amplitude of 511 */ 72 | #define DAC_TRIANGLEAMPLITUDE_1023 ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 1023 */ 73 | #define DAC_TRIANGLEAMPLITUDE_2047 ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1) /*!< Select max triangle amplitude of 2047 */ 74 | #define DAC_TRIANGLEAMPLITUDE_4095 ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 4095 */ 75 | 76 | #define IS_DAC_LFSR_UNMASK_TRIANGLE_AMPLITUDE(VALUE) (((VALUE) == DAC_LFSRUNMASK_BIT0) || \ 77 | ((VALUE) == DAC_LFSRUNMASK_BITS1_0) || \ 78 | ((VALUE) == DAC_LFSRUNMASK_BITS2_0) || \ 79 | ((VALUE) == DAC_LFSRUNMASK_BITS3_0) || \ 80 | ((VALUE) == DAC_LFSRUNMASK_BITS4_0) || \ 81 | ((VALUE) == DAC_LFSRUNMASK_BITS5_0) || \ 82 | ((VALUE) == DAC_LFSRUNMASK_BITS6_0) || \ 83 | ((VALUE) == DAC_LFSRUNMASK_BITS7_0) || \ 84 | ((VALUE) == DAC_LFSRUNMASK_BITS8_0) || \ 85 | ((VALUE) == DAC_LFSRUNMASK_BITS9_0) || \ 86 | ((VALUE) == DAC_LFSRUNMASK_BITS10_0) || \ 87 | ((VALUE) == DAC_LFSRUNMASK_BITS11_0) || \ 88 | ((VALUE) == DAC_TRIANGLEAMPLITUDE_1) || \ 89 | ((VALUE) == DAC_TRIANGLEAMPLITUDE_3) || \ 90 | ((VALUE) == DAC_TRIANGLEAMPLITUDE_7) || \ 91 | ((VALUE) == DAC_TRIANGLEAMPLITUDE_15) || \ 92 | ((VALUE) == DAC_TRIANGLEAMPLITUDE_31) || \ 93 | ((VALUE) == DAC_TRIANGLEAMPLITUDE_63) || \ 94 | ((VALUE) == DAC_TRIANGLEAMPLITUDE_127) || \ 95 | ((VALUE) == DAC_TRIANGLEAMPLITUDE_255) || \ 96 | ((VALUE) == DAC_TRIANGLEAMPLITUDE_511) || \ 97 | ((VALUE) == DAC_TRIANGLEAMPLITUDE_1023) || \ 98 | ((VALUE) == DAC_TRIANGLEAMPLITUDE_2047) || \ 99 | ((VALUE) == DAC_TRIANGLEAMPLITUDE_4095)) 100 | /** 101 | * @} 102 | */ 103 | 104 | 105 | /** 106 | * @} 107 | */ 108 | 109 | /* Exported macro ------------------------------------------------------------*/ 110 | 111 | /* Exported functions --------------------------------------------------------*/ 112 | 113 | /** @defgroup DACEx_Exported_Functions DACEx Exported Functions 114 | * @{ 115 | */ 116 | 117 | /** @defgroup DACEx_Exported_Functions_Group1 Extended features functions 118 | * @{ 119 | */ 120 | /* Extension features functions ***********************************************/ 121 | HAL_StatusTypeDef HAL_DACEx_TriangleWaveGenerate(DAC_HandleTypeDef* hdac, uint32_t Channel, uint32_t Amplitude); 122 | HAL_StatusTypeDef HAL_DACEx_NoiseWaveGenerate(DAC_HandleTypeDef* hdac, uint32_t Channel, uint32_t Amplitude); 123 | 124 | #if defined (DAC_CHANNEL2_SUPPORT) 125 | uint32_t HAL_DACEx_DualGetValue(DAC_HandleTypeDef* hdac); 126 | HAL_StatusTypeDef HAL_DACEx_DualSetValue(DAC_HandleTypeDef* hdac, uint32_t Alignment, uint32_t Data1, uint32_t Data2); 127 | void HAL_DACEx_ConvCpltCallbackCh2(DAC_HandleTypeDef* hdac); 128 | void HAL_DACEx_ConvHalfCpltCallbackCh2(DAC_HandleTypeDef* hdac); 129 | void HAL_DACEx_ErrorCallbackCh2(DAC_HandleTypeDef* hdac); 130 | void HAL_DACEx_DMAUnderrunCallbackCh2(DAC_HandleTypeDef* hdac); 131 | #endif 132 | 133 | /** 134 | * @} 135 | */ 136 | 137 | /** 138 | * @} 139 | */ 140 | /* Define the private group ***********************************/ 141 | /**************************************************************/ 142 | /** @defgroup DACEx_Private DACEx Private 143 | * @{ 144 | */ 145 | /** 146 | * @} 147 | */ 148 | /**************************************************************/ 149 | 150 | /** 151 | * @} 152 | */ 153 | 154 | /** 155 | * @} 156 | */ 157 | #endif /* !STM32L010xB && !STM32L010x8 && !STM32L010x6 && !STM32L010x4 && !STM32L011xx && !STM32L021xx && !STM32L031xx && !STM32L041xx && !STM32L051xx && !STM32L071xx && !STM32L081xx*/ 158 | 159 | #ifdef __cplusplus 160 | } 161 | #endif 162 | 163 | #endif /*__STM32L0xx_HAL_DAC_EX_H */ 164 | 165 | 166 | -------------------------------------------------------------------------------- /Inc/stm32l0xx_hal_def.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_hal_def.h 4 | * @author MCD Application Team 5 | * @brief This file contains HAL common defines, enumeration, macros and 6 | * structures definitions. 7 | ****************************************************************************** 8 | * @attention 9 | * 10 | * Copyright (c) 2016 STMicroelectronics. 11 | * All rights reserved. 12 | * 13 | * This software is licensed under terms that can be found in the LICENSE file 14 | * in the root directory of this software component. 15 | * If no LICENSE file comes with this software, it is provided AS-IS. 16 | * 17 | ****************************************************************************** 18 | */ 19 | 20 | /* Define to prevent recursive inclusion -------------------------------------*/ 21 | #ifndef __STM32L0xx_HAL_DEF 22 | #define __STM32L0xx_HAL_DEF 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "stm32l0xx.h" 30 | #include "Legacy/stm32_hal_legacy.h" 31 | #include 32 | 33 | /* Exported types ------------------------------------------------------------*/ 34 | 35 | /** 36 | * @brief HAL Status structures definition 37 | */ 38 | typedef enum 39 | { 40 | HAL_OK = 0x00U, 41 | HAL_ERROR = 0x01U, 42 | HAL_BUSY = 0x02U, 43 | HAL_TIMEOUT = 0x03U 44 | } HAL_StatusTypeDef; 45 | 46 | /** 47 | * @brief HAL Lock structures definition 48 | */ 49 | typedef enum 50 | { 51 | HAL_UNLOCKED = 0x00U, 52 | HAL_LOCKED = 0x01U 53 | } HAL_LockTypeDef; 54 | 55 | /* Exported macro ------------------------------------------------------------*/ 56 | 57 | #if !defined(UNUSED) 58 | #define UNUSED(X) (void)X /* To avoid gcc/g++ warnings */ 59 | #endif /* UNUSED */ 60 | 61 | #define HAL_MAX_DELAY 0xFFFFFFFFU 62 | 63 | #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) == (BIT)) 64 | #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == 0U) 65 | 66 | #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \ 67 | do{ \ 68 | (__HANDLE__)->__PPP_DMA_FIELD__ = &(__DMA_HANDLE__); \ 69 | (__DMA_HANDLE__).Parent = (__HANDLE__); \ 70 | } while(0) 71 | 72 | /** @brief Reset the Handle's State field. 73 | * @param __HANDLE__: specifies the Peripheral Handle. 74 | * @note This macro can be used for the following purpose: 75 | * - When the Handle is declared as local variable; before passing it as parameter 76 | * to HAL_PPP_Init() for the first time, it is mandatory to use this macro 77 | * to set to 0 the Handle's "State" field. 78 | * Otherwise, "State" field may have any random value and the first time the function 79 | * HAL_PPP_Init() is called, the low level hardware initialization will be missed 80 | * (i.e. HAL_PPP_MspInit() will not be executed). 81 | * - When there is a need to reconfigure the low level hardware: instead of calling 82 | * HAL_PPP_DeInit() then HAL_PPP_Init(), user can make a call to this macro then HAL_PPP_Init(). 83 | * In this later function, when the Handle's "State" field is set to 0, it will execute the function 84 | * HAL_PPP_MspInit() which will reconfigure the low level hardware. 85 | * @retval None 86 | */ 87 | #define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0U) 88 | 89 | #if (USE_RTOS == 1) 90 | 91 | /* Reserved for future use */ 92 | #error "USE_RTOS should be 0 in the current HAL release" 93 | 94 | #else 95 | #define __HAL_LOCK(__HANDLE__) \ 96 | do{ \ 97 | if((__HANDLE__)->Lock == HAL_LOCKED) \ 98 | { \ 99 | return HAL_BUSY; \ 100 | } \ 101 | else \ 102 | { \ 103 | (__HANDLE__)->Lock = HAL_LOCKED; \ 104 | } \ 105 | }while (0) 106 | 107 | #define __HAL_UNLOCK(__HANDLE__) \ 108 | do{ \ 109 | (__HANDLE__)->Lock = HAL_UNLOCKED; \ 110 | }while (0) 111 | #endif /* USE_RTOS */ 112 | 113 | #if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) /* ARM Compiler V6 */ 114 | #ifndef __weak 115 | #define __weak __attribute__((weak)) 116 | #endif 117 | #ifndef __packed 118 | #define __packed __attribute__((packed)) 119 | #endif 120 | #elif defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */ 121 | #ifndef __weak 122 | #define __weak __attribute__((weak)) 123 | #endif /* __weak */ 124 | #ifndef __packed 125 | #define __packed __attribute__((__packed__)) 126 | #endif /* __packed */ 127 | 128 | #define __NOINLINE __attribute__ ( (noinline) ) 129 | 130 | #endif /* __GNUC__ */ 131 | 132 | 133 | /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */ 134 | #if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) /* ARM Compiler V6 */ 135 | #ifndef __ALIGN_BEGIN 136 | #define __ALIGN_BEGIN 137 | #endif 138 | #ifndef __ALIGN_END 139 | #define __ALIGN_END __attribute__ ((aligned (4))) 140 | #endif 141 | #elif defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */ 142 | #ifndef __ALIGN_END 143 | #define __ALIGN_END __attribute__ ((aligned (4))) 144 | #endif /* __ALIGN_END */ 145 | #ifndef __ALIGN_BEGIN 146 | #define __ALIGN_BEGIN 147 | #endif /* __ALIGN_BEGIN */ 148 | #else 149 | #ifndef __ALIGN_END 150 | #define __ALIGN_END 151 | #endif /* __ALIGN_END */ 152 | #ifndef __ALIGN_BEGIN 153 | #if defined (__CC_ARM) /* ARM Compiler V5*/ 154 | #define __ALIGN_BEGIN __align(4) 155 | #elif defined (__ICCARM__) /* IAR Compiler */ 156 | #define __ALIGN_BEGIN 157 | #endif /* __CC_ARM */ 158 | #endif /* __ALIGN_BEGIN */ 159 | #endif /* __GNUC__ */ 160 | 161 | /** 162 | * @brief __RAM_FUNC definition 163 | */ 164 | #if defined ( __CC_ARM ) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) 165 | /* ARM Compiler V4/V5 and V6 166 | -------------------------- 167 | RAM functions are defined using the toolchain options. 168 | Functions that are executed in RAM should reside in a separate source module. 169 | Using the 'Options for File' dialog you can simply change the 'Code / Const' 170 | area of a module to a memory space in physical RAM. 171 | Available memory areas are declared in the 'Target' tab of the 'Options for Target' 172 | dialog. 173 | */ 174 | #define __RAM_FUNC 175 | 176 | #define __NOINLINE __attribute__ ( (noinline) ) 177 | 178 | 179 | #elif defined ( __ICCARM__ ) 180 | /* ICCARM Compiler 181 | --------------- 182 | RAM functions are defined using a specific toolchain keyword "__ramfunc". 183 | */ 184 | #define __RAM_FUNC __ramfunc 185 | 186 | #define __NOINLINE _Pragma("optimize = no_inline") 187 | 188 | #elif defined ( __GNUC__ ) 189 | /* GNU Compiler 190 | ------------ 191 | RAM functions are defined using a specific toolchain attribute 192 | "__attribute__((section(".RamFunc")))". 193 | */ 194 | #define __RAM_FUNC __attribute__((section(".RamFunc"))) 195 | 196 | #endif 197 | 198 | #ifdef __cplusplus 199 | } 200 | #endif 201 | 202 | #endif /* ___STM32L0xx_HAL_DEF */ 203 | 204 | 205 | 206 | -------------------------------------------------------------------------------- /Inc/stm32l0xx_hal_flash_ramfunc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_hal_flash_ramfunc.h 4 | * @author MCD Application Team 5 | * @brief Header file of FLASH RAMFUNC driver. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2016 STMicroelectronics. 10 | * All rights reserved. 11 | * 12 | * This software is licensed under terms that can be found in the LICENSE file in 13 | * the root directory of this software component. 14 | * If no LICENSE file comes with this software, it is provided AS-IS. 15 | ****************************************************************************** 16 | */ 17 | 18 | /* Define to prevent recursive inclusion -------------------------------------*/ 19 | #ifndef __STM32L0xx_FLASH_RAMFUNC_H 20 | #define __STM32L0xx_FLASH_RAMFUNC_H 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "stm32l0xx_hal_def.h" 28 | 29 | /** @addtogroup STM32L0xx_HAL_Driver 30 | * @{ 31 | */ 32 | 33 | /** @addtogroup FLASH_RAMFUNC 34 | * @{ 35 | */ 36 | 37 | /* Exported types ------------------------------------------------------------*/ 38 | 39 | 40 | /* Exported functions --------------------------------------------------------*/ 41 | 42 | /** @addtogroup FLASH_RAMFUNC_Exported_Functions 43 | * @{ 44 | */ 45 | 46 | /* 47 | * @brief FLASH memory functions that should be executed from internal SRAM. 48 | * These functions are defined inside the "stm32l0xx_hal_flash_ramfunc.c" 49 | * file. 50 | */ 51 | 52 | /** @addtogroup FLASH_RAMFUNC_Exported_Functions_Group1 53 | * @{ 54 | */ 55 | 56 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_EnableRunPowerDown(void); 57 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_DisableRunPowerDown(void); 58 | 59 | /** 60 | * @} 61 | */ 62 | 63 | /** @addtogroup FLASH_RAMFUNC_Exported_Functions_Group2 64 | * @{ 65 | */ 66 | 67 | #if defined(FLASH_PECR_PARALLBANK) 68 | 69 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_EraseParallelPage(uint32_t Page_Address1, uint32_t Page_Address2); 70 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_ProgramParallelHalfPage(uint32_t Address1, uint32_t* pBuffer1, uint32_t Address2, uint32_t* pBuffer2); 71 | 72 | #endif /* FLASH_PECR_PARALLBANK */ 73 | 74 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_HalfPageProgram(uint32_t Address, uint32_t* pBuffer); 75 | 76 | /** 77 | * @} 78 | */ 79 | 80 | /** @addtogroup FLASH_RAMFUNC_Exported_Functions_Group3 81 | * @{ 82 | */ 83 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_GetError(uint32_t *Error); 84 | /** 85 | * @} 86 | */ 87 | 88 | /** 89 | * @} 90 | */ 91 | 92 | /** 93 | * @} 94 | */ 95 | 96 | /** 97 | * @} 98 | */ 99 | 100 | #ifdef __cplusplus 101 | } 102 | #endif 103 | 104 | #endif /* __STM32L0xx_FLASH_RAMFUNC_H */ 105 | 106 | -------------------------------------------------------------------------------- /Inc/stm32l0xx_hal_i2c_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_hal_i2c_ex.h 4 | * @author MCD Application Team 5 | * @brief Header file of I2C HAL Extended module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2016 STMicroelectronics. 10 | * All rights reserved. 11 | * 12 | * This software is licensed under terms that can be found in the LICENSE file 13 | * in the root directory of this software component. 14 | * If no LICENSE file comes with this software, it is provided AS-IS. 15 | * 16 | ****************************************************************************** 17 | */ 18 | 19 | /* Define to prevent recursive inclusion -------------------------------------*/ 20 | #ifndef STM32L0xx_HAL_I2C_EX_H 21 | #define STM32L0xx_HAL_I2C_EX_H 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | /* Includes ------------------------------------------------------------------*/ 28 | #include "stm32l0xx_hal_def.h" 29 | 30 | /** @addtogroup STM32L0xx_HAL_Driver 31 | * @{ 32 | */ 33 | 34 | /** @addtogroup I2CEx 35 | * @{ 36 | */ 37 | 38 | /* Exported types ------------------------------------------------------------*/ 39 | /* Exported constants --------------------------------------------------------*/ 40 | /** @defgroup I2CEx_Exported_Constants I2C Extended Exported Constants 41 | * @{ 42 | */ 43 | 44 | /** @defgroup I2CEx_Analog_Filter I2C Extended Analog Filter 45 | * @{ 46 | */ 47 | #define I2C_ANALOGFILTER_ENABLE 0x00000000U 48 | #define I2C_ANALOGFILTER_DISABLE I2C_CR1_ANFOFF 49 | /** 50 | * @} 51 | */ 52 | 53 | /** @defgroup I2CEx_FastModePlus I2C Extended Fast Mode Plus 54 | * @{ 55 | */ 56 | #define I2C_FMP_NOT_SUPPORTED 0xAAAA0000U /*!< Fast Mode Plus not supported */ 57 | #if defined(SYSCFG_CFGR2_I2C_PB6_FMP) 58 | #define I2C_FASTMODEPLUS_PB6 SYSCFG_CFGR2_I2C_PB6_FMP /*!< Enable Fast Mode Plus on PB6 */ 59 | #define I2C_FASTMODEPLUS_PB7 SYSCFG_CFGR2_I2C_PB7_FMP /*!< Enable Fast Mode Plus on PB7 */ 60 | #else 61 | #define I2C_FASTMODEPLUS_PB6 (uint32_t)(0x00000004U | I2C_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus PB6 not supported */ 62 | #define I2C_FASTMODEPLUS_PB7 (uint32_t)(0x00000008U | I2C_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus PB7 not supported */ 63 | #endif /* SYSCFG_CFGR2_I2C_PB6_FMP */ 64 | #if defined(SYSCFG_CFGR2_I2C_PB8_FMP) 65 | #define I2C_FASTMODEPLUS_PB8 SYSCFG_CFGR2_I2C_PB8_FMP /*!< Enable Fast Mode Plus on PB8 */ 66 | #define I2C_FASTMODEPLUS_PB9 SYSCFG_CFGR2_I2C_PB9_FMP /*!< Enable Fast Mode Plus on PB9 */ 67 | #else 68 | #define I2C_FASTMODEPLUS_PB8 (uint32_t)(0x00000010U | I2C_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus PB8 not supported */ 69 | #define I2C_FASTMODEPLUS_PB9 (uint32_t)(0x00000012U | I2C_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus PB9 not supported */ 70 | #endif /* SYSCFG_CFGR2_I2C_PB8_FMP */ 71 | #if defined(SYSCFG_CFGR2_I2C1_FMP) 72 | #define I2C_FASTMODEPLUS_I2C1 SYSCFG_CFGR2_I2C1_FMP /*!< Enable Fast Mode Plus on I2C1 pins */ 73 | #else 74 | #define I2C_FASTMODEPLUS_I2C1 (uint32_t)(0x00000100U | I2C_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus I2C1 not supported */ 75 | #endif /* SYSCFG_CFGR2_I2C1_FMP */ 76 | #if defined(SYSCFG_CFGR2_I2C2_FMP) 77 | #define I2C_FASTMODEPLUS_I2C2 SYSCFG_CFGR2_I2C2_FMP /*!< Enable Fast Mode Plus on I2C2 pins */ 78 | #else 79 | #define I2C_FASTMODEPLUS_I2C2 (uint32_t)(0x00000200U | I2C_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus I2C2 not supported */ 80 | #endif /* SYSCFG_CFGR2_I2C2_FMP */ 81 | #if defined(SYSCFG_CFGR2_I2C3_FMP) 82 | #define I2C_FASTMODEPLUS_I2C3 SYSCFG_CFGR2_I2C3_FMP /*!< Enable Fast Mode Plus on I2C3 pins */ 83 | #else 84 | #define I2C_FASTMODEPLUS_I2C3 (uint32_t)(0x00000400U | I2C_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus I2C3 not supported */ 85 | #endif /* SYSCFG_CFGR2_I2C3_FMP */ 86 | /** 87 | * @} 88 | */ 89 | 90 | /** 91 | * @} 92 | */ 93 | 94 | /* Exported macro ------------------------------------------------------------*/ 95 | /** @defgroup I2CEx_Exported_Macros I2C Extended Exported Macros 96 | * @{ 97 | */ 98 | 99 | /** 100 | * @} 101 | */ 102 | 103 | /* Exported functions --------------------------------------------------------*/ 104 | /** @addtogroup I2CEx_Exported_Functions I2C Extended Exported Functions 105 | * @{ 106 | */ 107 | 108 | /** @addtogroup I2CEx_Exported_Functions_Group1 Filter Mode Functions 109 | * @{ 110 | */ 111 | /* Peripheral Control functions ************************************************/ 112 | HAL_StatusTypeDef HAL_I2CEx_ConfigAnalogFilter(I2C_HandleTypeDef *hi2c, uint32_t AnalogFilter); 113 | HAL_StatusTypeDef HAL_I2CEx_ConfigDigitalFilter(I2C_HandleTypeDef *hi2c, uint32_t DigitalFilter); 114 | /** 115 | * @} 116 | */ 117 | 118 | /** @addtogroup I2CEx_Exported_Functions_Group2 WakeUp Mode Functions 119 | * @{ 120 | */ 121 | HAL_StatusTypeDef HAL_I2CEx_EnableWakeUp(I2C_HandleTypeDef *hi2c); 122 | HAL_StatusTypeDef HAL_I2CEx_DisableWakeUp(I2C_HandleTypeDef *hi2c); 123 | /** 124 | * @} 125 | */ 126 | #if (defined(SYSCFG_CFGR2_I2C_PB6_FMP) || defined(SYSCFG_CFGR2_I2C_PB7_FMP)) || (defined(SYSCFG_CFGR2_I2C_PB8_FMP) || defined(SYSCFG_CFGR2_I2C_PB9_FMP)) || (defined(SYSCFG_CFGR2_I2C1_FMP)) || defined(SYSCFG_CFGR2_I2C2_FMP) || defined(SYSCFG_CFGR2_I2C3_FMP) 127 | 128 | /** @addtogroup I2CEx_Exported_Functions_Group3 Fast Mode Plus Functions 129 | * @{ 130 | */ 131 | void HAL_I2CEx_EnableFastModePlus(uint32_t ConfigFastModePlus); 132 | void HAL_I2CEx_DisableFastModePlus(uint32_t ConfigFastModePlus); 133 | /** 134 | * @} 135 | */ 136 | #endif /* Fast Mode Plus Availability */ 137 | 138 | /** 139 | * @} 140 | */ 141 | 142 | /* Private constants ---------------------------------------------------------*/ 143 | /** @defgroup I2CEx_Private_Constants I2C Extended Private Constants 144 | * @{ 145 | */ 146 | 147 | /** 148 | * @} 149 | */ 150 | 151 | /* Private macros ------------------------------------------------------------*/ 152 | /** @defgroup I2CEx_Private_Macro I2C Extended Private Macros 153 | * @{ 154 | */ 155 | #define IS_I2C_ANALOG_FILTER(FILTER) (((FILTER) == I2C_ANALOGFILTER_ENABLE) || \ 156 | ((FILTER) == I2C_ANALOGFILTER_DISABLE)) 157 | 158 | #define IS_I2C_DIGITAL_FILTER(FILTER) ((FILTER) <= 0x0000000FU) 159 | 160 | #define IS_I2C_FASTMODEPLUS(__CONFIG__) ((((__CONFIG__) & I2C_FMP_NOT_SUPPORTED) != I2C_FMP_NOT_SUPPORTED) && \ 161 | ((((__CONFIG__) & (I2C_FASTMODEPLUS_PB6)) == I2C_FASTMODEPLUS_PB6) || \ 162 | (((__CONFIG__) & (I2C_FASTMODEPLUS_PB7)) == I2C_FASTMODEPLUS_PB7) || \ 163 | (((__CONFIG__) & (I2C_FASTMODEPLUS_PB8)) == I2C_FASTMODEPLUS_PB8) || \ 164 | (((__CONFIG__) & (I2C_FASTMODEPLUS_PB9)) == I2C_FASTMODEPLUS_PB9) || \ 165 | (((__CONFIG__) & (I2C_FASTMODEPLUS_I2C1)) == I2C_FASTMODEPLUS_I2C1) || \ 166 | (((__CONFIG__) & (I2C_FASTMODEPLUS_I2C2)) == I2C_FASTMODEPLUS_I2C2) || \ 167 | (((__CONFIG__) & (I2C_FASTMODEPLUS_I2C3)) == I2C_FASTMODEPLUS_I2C3))) 168 | /** 169 | * @} 170 | */ 171 | 172 | /* Private Functions ---------------------------------------------------------*/ 173 | /** @defgroup I2CEx_Private_Functions I2C Extended Private Functions 174 | * @{ 175 | */ 176 | /* Private functions are defined in stm32l0xx_hal_i2c_ex.c file */ 177 | /** 178 | * @} 179 | */ 180 | 181 | /** 182 | * @} 183 | */ 184 | 185 | /** 186 | * @} 187 | */ 188 | 189 | #ifdef __cplusplus 190 | } 191 | #endif 192 | 193 | #endif /* STM32L0xx_HAL_I2C_EX_H */ 194 | -------------------------------------------------------------------------------- /Inc/stm32l0xx_hal_iwdg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_hal_iwdg.h 4 | * @author MCD Application Team 5 | * @brief Header file of IWDG HAL module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2016 STMicroelectronics. 10 | * All rights reserved. 11 | * 12 | * This software is licensed under terms that can be found in the LICENSE file 13 | * in the root directory of this software component. 14 | * If no LICENSE file comes with this software, it is provided AS-IS. 15 | * 16 | ****************************************************************************** 17 | */ 18 | 19 | /* Define to prevent recursive inclusion -------------------------------------*/ 20 | #ifndef STM32L0xx_HAL_IWDG_H 21 | #define STM32L0xx_HAL_IWDG_H 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | /* Includes ------------------------------------------------------------------*/ 28 | #include "stm32l0xx_hal_def.h" 29 | 30 | /** @addtogroup STM32L0xx_HAL_Driver 31 | * @{ 32 | */ 33 | 34 | /** @defgroup IWDG IWDG 35 | * @{ 36 | */ 37 | 38 | /* Exported types ------------------------------------------------------------*/ 39 | /** @defgroup IWDG_Exported_Types IWDG Exported Types 40 | * @{ 41 | */ 42 | 43 | /** 44 | * @brief IWDG Init structure definition 45 | */ 46 | typedef struct 47 | { 48 | uint32_t Prescaler; /*!< Select the prescaler of the IWDG. 49 | This parameter can be a value of @ref IWDG_Prescaler */ 50 | 51 | uint32_t Reload; /*!< Specifies the IWDG down-counter reload value. 52 | This parameter must be a number between Min_Data = 0 and Max_Data = 0x0FFF */ 53 | 54 | uint32_t Window; /*!< Specifies the window value to be compared to the down-counter. 55 | This parameter must be a number between Min_Data = 0 and Max_Data = 0x0FFF */ 56 | 57 | } IWDG_InitTypeDef; 58 | 59 | /** 60 | * @brief IWDG Handle Structure definition 61 | */ 62 | typedef struct 63 | { 64 | IWDG_TypeDef *Instance; /*!< Register base address */ 65 | 66 | IWDG_InitTypeDef Init; /*!< IWDG required parameters */ 67 | } IWDG_HandleTypeDef; 68 | 69 | 70 | /** 71 | * @} 72 | */ 73 | 74 | /* Exported constants --------------------------------------------------------*/ 75 | /** @defgroup IWDG_Exported_Constants IWDG Exported Constants 76 | * @{ 77 | */ 78 | 79 | /** @defgroup IWDG_Prescaler IWDG Prescaler 80 | * @{ 81 | */ 82 | #define IWDG_PRESCALER_4 0x00000000u /*!< IWDG prescaler set to 4 */ 83 | #define IWDG_PRESCALER_8 IWDG_PR_PR_0 /*!< IWDG prescaler set to 8 */ 84 | #define IWDG_PRESCALER_16 IWDG_PR_PR_1 /*!< IWDG prescaler set to 16 */ 85 | #define IWDG_PRESCALER_32 (IWDG_PR_PR_1 | IWDG_PR_PR_0) /*!< IWDG prescaler set to 32 */ 86 | #define IWDG_PRESCALER_64 IWDG_PR_PR_2 /*!< IWDG prescaler set to 64 */ 87 | #define IWDG_PRESCALER_128 (IWDG_PR_PR_2 | IWDG_PR_PR_0) /*!< IWDG prescaler set to 128 */ 88 | #define IWDG_PRESCALER_256 (IWDG_PR_PR_2 | IWDG_PR_PR_1) /*!< IWDG prescaler set to 256 */ 89 | /** 90 | * @} 91 | */ 92 | 93 | /** @defgroup IWDG_Window_option IWDG Window option 94 | * @{ 95 | */ 96 | #define IWDG_WINDOW_DISABLE IWDG_WINR_WIN 97 | /** 98 | * @} 99 | */ 100 | 101 | /** 102 | * @} 103 | */ 104 | 105 | /* Exported macros -----------------------------------------------------------*/ 106 | /** @defgroup IWDG_Exported_Macros IWDG Exported Macros 107 | * @{ 108 | */ 109 | 110 | /** 111 | * @brief Enable the IWDG peripheral. 112 | * @param __HANDLE__ IWDG handle 113 | * @retval None 114 | */ 115 | #define __HAL_IWDG_START(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_ENABLE) 116 | 117 | /** 118 | * @brief Reload IWDG counter with value defined in the reload register 119 | * (write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers disabled). 120 | * @param __HANDLE__ IWDG handle 121 | * @retval None 122 | */ 123 | #define __HAL_IWDG_RELOAD_COUNTER(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_RELOAD) 124 | 125 | /** 126 | * @} 127 | */ 128 | 129 | /* Exported functions --------------------------------------------------------*/ 130 | /** @defgroup IWDG_Exported_Functions IWDG Exported Functions 131 | * @{ 132 | */ 133 | 134 | /** @defgroup IWDG_Exported_Functions_Group1 Initialization and Start functions 135 | * @{ 136 | */ 137 | /* Initialization/Start functions ********************************************/ 138 | HAL_StatusTypeDef HAL_IWDG_Init(IWDG_HandleTypeDef *hiwdg); 139 | /** 140 | * @} 141 | */ 142 | 143 | /** @defgroup IWDG_Exported_Functions_Group2 IO operation functions 144 | * @{ 145 | */ 146 | /* I/O operation functions ****************************************************/ 147 | HAL_StatusTypeDef HAL_IWDG_Refresh(IWDG_HandleTypeDef *hiwdg); 148 | /** 149 | * @} 150 | */ 151 | 152 | /** 153 | * @} 154 | */ 155 | 156 | /* Private constants ---------------------------------------------------------*/ 157 | /** @defgroup IWDG_Private_Constants IWDG Private Constants 158 | * @{ 159 | */ 160 | 161 | /** 162 | * @brief IWDG Key Register BitMask 163 | */ 164 | #define IWDG_KEY_RELOAD 0x0000AAAAu /*!< IWDG Reload Counter Enable */ 165 | #define IWDG_KEY_ENABLE 0x0000CCCCu /*!< IWDG Peripheral Enable */ 166 | #define IWDG_KEY_WRITE_ACCESS_ENABLE 0x00005555u /*!< IWDG KR Write Access Enable */ 167 | #define IWDG_KEY_WRITE_ACCESS_DISABLE 0x00000000u /*!< IWDG KR Write Access Disable */ 168 | 169 | /** 170 | * @} 171 | */ 172 | 173 | /* Private macros ------------------------------------------------------------*/ 174 | /** @defgroup IWDG_Private_Macros IWDG Private Macros 175 | * @{ 176 | */ 177 | 178 | /** 179 | * @brief Enable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers. 180 | * @param __HANDLE__ IWDG handle 181 | * @retval None 182 | */ 183 | #define IWDG_ENABLE_WRITE_ACCESS(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_WRITE_ACCESS_ENABLE) 184 | 185 | /** 186 | * @brief Disable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers. 187 | * @param __HANDLE__ IWDG handle 188 | * @retval None 189 | */ 190 | #define IWDG_DISABLE_WRITE_ACCESS(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_WRITE_ACCESS_DISABLE) 191 | 192 | /** 193 | * @brief Check IWDG prescaler value. 194 | * @param __PRESCALER__ IWDG prescaler value 195 | * @retval None 196 | */ 197 | #define IS_IWDG_PRESCALER(__PRESCALER__) (((__PRESCALER__) == IWDG_PRESCALER_4) || \ 198 | ((__PRESCALER__) == IWDG_PRESCALER_8) || \ 199 | ((__PRESCALER__) == IWDG_PRESCALER_16) || \ 200 | ((__PRESCALER__) == IWDG_PRESCALER_32) || \ 201 | ((__PRESCALER__) == IWDG_PRESCALER_64) || \ 202 | ((__PRESCALER__) == IWDG_PRESCALER_128)|| \ 203 | ((__PRESCALER__) == IWDG_PRESCALER_256)) 204 | 205 | /** 206 | * @brief Check IWDG reload value. 207 | * @param __RELOAD__ IWDG reload value 208 | * @retval None 209 | */ 210 | #define IS_IWDG_RELOAD(__RELOAD__) ((__RELOAD__) <= IWDG_RLR_RL) 211 | 212 | /** 213 | * @brief Check IWDG window value. 214 | * @param __WINDOW__ IWDG window value 215 | * @retval None 216 | */ 217 | #define IS_IWDG_WINDOW(__WINDOW__) ((__WINDOW__) <= IWDG_WINR_WIN) 218 | 219 | 220 | /** 221 | * @} 222 | */ 223 | 224 | /** 225 | * @} 226 | */ 227 | 228 | /** 229 | * @} 230 | */ 231 | 232 | 233 | #ifdef __cplusplus 234 | } 235 | #endif 236 | 237 | #endif /* STM32L0xx_HAL_IWDG_H */ 238 | -------------------------------------------------------------------------------- /Inc/stm32l0xx_hal_pcd_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_hal_pcd_ex.h 4 | * @author MCD Application Team 5 | * @brief Header file of PCD HAL Extension module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2016 STMicroelectronics. 10 | * All rights reserved. 11 | * 12 | * This software is licensed under terms that can be found in the LICENSE file 13 | * in the root directory of this software component. 14 | * If no LICENSE file comes with this software, it is provided AS-IS. 15 | * 16 | ****************************************************************************** 17 | */ 18 | 19 | /* Define to prevent recursive inclusion -------------------------------------*/ 20 | #ifndef STM32L0xx_HAL_PCD_EX_H 21 | #define STM32L0xx_HAL_PCD_EX_H 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif /* __cplusplus */ 26 | 27 | /* Includes ------------------------------------------------------------------*/ 28 | #include "stm32l0xx_hal_def.h" 29 | 30 | #if defined (USB) 31 | /** @addtogroup STM32L0xx_HAL_Driver 32 | * @{ 33 | */ 34 | 35 | /** @addtogroup PCDEx 36 | * @{ 37 | */ 38 | /* Exported types ------------------------------------------------------------*/ 39 | /* Exported constants --------------------------------------------------------*/ 40 | /* Exported macros -----------------------------------------------------------*/ 41 | /* Exported functions --------------------------------------------------------*/ 42 | /** @addtogroup PCDEx_Exported_Functions PCDEx Exported Functions 43 | * @{ 44 | */ 45 | /** @addtogroup PCDEx_Exported_Functions_Group1 Peripheral Control functions 46 | * @{ 47 | */ 48 | 49 | 50 | HAL_StatusTypeDef HAL_PCDEx_PMAConfig(PCD_HandleTypeDef *hpcd, uint16_t ep_addr, 51 | uint16_t ep_kind, uint32_t pmaadress); 52 | 53 | 54 | HAL_StatusTypeDef HAL_PCDEx_ActivateLPM(PCD_HandleTypeDef *hpcd); 55 | HAL_StatusTypeDef HAL_PCDEx_DeActivateLPM(PCD_HandleTypeDef *hpcd); 56 | 57 | 58 | HAL_StatusTypeDef HAL_PCDEx_ActivateBCD(PCD_HandleTypeDef *hpcd); 59 | HAL_StatusTypeDef HAL_PCDEx_DeActivateBCD(PCD_HandleTypeDef *hpcd); 60 | void HAL_PCDEx_BCD_VBUSDetect(PCD_HandleTypeDef *hpcd); 61 | 62 | void HAL_PCDEx_LPM_Callback(PCD_HandleTypeDef *hpcd, PCD_LPM_MsgTypeDef msg); 63 | void HAL_PCDEx_BCD_Callback(PCD_HandleTypeDef *hpcd, PCD_BCD_MsgTypeDef msg); 64 | 65 | /** 66 | * @} 67 | */ 68 | 69 | /** 70 | * @} 71 | */ 72 | 73 | /** 74 | * @} 75 | */ 76 | 77 | /** 78 | * @} 79 | */ 80 | #endif /* defined (USB) */ 81 | 82 | #ifdef __cplusplus 83 | } 84 | #endif /* __cplusplus */ 85 | 86 | 87 | #endif /* STM32L0xx_HAL_PCD_EX_H */ 88 | -------------------------------------------------------------------------------- /Inc/stm32l0xx_hal_pwr_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_hal_pwr_ex.h 4 | * @author MCD Application Team 5 | * @brief Header file of PWR HAL Extension module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2016 STMicroelectronics. 10 | * All rights reserved. 11 | * 12 | * This software is licensed under terms that can be found in the LICENSE file 13 | * in the root directory of this software component. 14 | * If no LICENSE file comes with this software, it is provided AS-IS. 15 | * 16 | ****************************************************************************** 17 | */ 18 | 19 | /* Define to prevent recursive inclusion -------------------------------------*/ 20 | #ifndef __STM32L0xx_HAL_PWR_EX_H 21 | #define __STM32L0xx_HAL_PWR_EX_H 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | /* Includes ------------------------------------------------------------------*/ 28 | #include "stm32l0xx_hal_def.h" 29 | 30 | /** @addtogroup STM32L0xx_HAL_Driver 31 | * @{ 32 | */ 33 | 34 | /** @defgroup PWREx PWREx 35 | * @{ 36 | */ 37 | 38 | /** @defgroup PWREx_Exported_Macros PWREx Exported Macros 39 | * @{ 40 | */ 41 | 42 | /** @brief Macros to enable the Deep-sleep mode with Flash memory kept off. 43 | * @note When entering low power mode (stop or standby only), if DS_EE_KOFF and RUN_PD of 44 | * FLASH_ACR register are both set , the Flash memory will not be woken up 45 | * when exiting from deep-sleep mode. 46 | */ 47 | #define __HAL_PWR_FLASHWAKEUP_ENABLE() CLEAR_BIT(PWR->CR, PWR_CR_DSEEKOFF) 48 | 49 | /** @brief Macros to disable the Deep-sleep mode with Flash memory kept off. 50 | * @note When entering low power mode (stop or standby only), if DS_EE_KOFF and RUN_PD of 51 | * FLASH_ACR register are both set , the Flash memory will not be woken up 52 | * when exiting from deep-sleep mode. 53 | */ 54 | #define __HAL_PWR_FLASHWAKEUP_DISABLE() SET_BIT(PWR->CR, PWR_CR_DSEEKOFF) 55 | /** 56 | * @} 57 | */ 58 | 59 | /** @defgroup PWREx_Exported_Functions PWREx Exported Functions 60 | * @{ 61 | */ 62 | uint32_t HAL_PWREx_GetVoltageRange(void); 63 | void HAL_PWREx_EnableFastWakeUp(void); 64 | void HAL_PWREx_DisableFastWakeUp(void); 65 | void HAL_PWREx_EnableUltraLowPower(void); 66 | void HAL_PWREx_DisableUltraLowPower(void); 67 | void HAL_PWREx_EnableLowPowerRunMode(void); 68 | HAL_StatusTypeDef HAL_PWREx_DisableLowPowerRunMode(void); 69 | /** 70 | * @} 71 | */ 72 | 73 | /* Define the private group ***********************************/ 74 | /**************************************************************/ 75 | /** @defgroup PWREx_Private PWREx Private 76 | * @{ 77 | */ 78 | /** 79 | * @} 80 | */ 81 | /**************************************************************/ 82 | 83 | /** 84 | * @} 85 | */ 86 | 87 | /** 88 | * @} 89 | */ 90 | 91 | #ifdef __cplusplus 92 | } 93 | #endif 94 | 95 | #endif /* __STM32L0xx_HAL_PWR_EX_H */ 96 | -------------------------------------------------------------------------------- /Inc/stm32l0xx_hal_smbus_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_hal_smbus_ex.h 4 | * @author MCD Application Team 5 | * @brief Header file of SMBUS HAL Extended module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2016 STMicroelectronics. 10 | * All rights reserved. 11 | * 12 | * This software is licensed under terms that can be found in the LICENSE file 13 | * in the root directory of this software component. 14 | * If no LICENSE file comes with this software, it is provided AS-IS. 15 | * 16 | ****************************************************************************** 17 | */ 18 | 19 | /* Define to prevent recursive inclusion -------------------------------------*/ 20 | #ifndef STM32L0xx_HAL_SMBUS_EX_H 21 | #define STM32L0xx_HAL_SMBUS_EX_H 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | /* Includes ------------------------------------------------------------------*/ 28 | #include "stm32l0xx_hal_def.h" 29 | 30 | /** @addtogroup STM32L0xx_HAL_Driver 31 | * @{ 32 | */ 33 | 34 | /** @addtogroup SMBUSEx 35 | * @{ 36 | */ 37 | 38 | /* Exported types ------------------------------------------------------------*/ 39 | /* Exported constants --------------------------------------------------------*/ 40 | /** @defgroup SMBUSEx_Exported_Constants SMBUS Extended Exported Constants 41 | * @{ 42 | */ 43 | 44 | /** @defgroup SMBUSEx_FastModePlus SMBUS Extended Fast Mode Plus 45 | * @{ 46 | */ 47 | #define SMBUS_FMP_NOT_SUPPORTED 0xAAAA0000U /*!< Fast Mode Plus not supported */ 48 | #if defined(SYSCFG_CFGR2_I2C_PB6_FMP) 49 | #define SMBUS_FASTMODEPLUS_PB6 SYSCFG_CFGR2_I2C_PB6_FMP /*!< Enable Fast Mode Plus on PB6 */ 50 | #define SMBUS_FASTMODEPLUS_PB7 SYSCFG_CFGR2_I2C_PB7_FMP /*!< Enable Fast Mode Plus on PB7 */ 51 | #else 52 | #define SMBUS_FASTMODEPLUS_PB6 (uint32_t)(0x00000004U | SMBUS_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus PB6 not supported */ 53 | #define SMBUS_FASTMODEPLUS_PB7 (uint32_t)(0x00000008U | SMBUS_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus PB7 not supported */ 54 | #endif /* SYSCFG_CFGR2_I2C_PB6_FMP */ 55 | #if defined(SYSCFG_CFGR2_I2C_PB8_FMP) 56 | #define SMBUS_FASTMODEPLUS_PB8 SYSCFG_CFGR2_I2C_PB8_FMP /*!< Enable Fast Mode Plus on PB8 */ 57 | #define SMBUS_FASTMODEPLUS_PB9 SYSCFG_CFGR2_I2C_PB9_FMP /*!< Enable Fast Mode Plus on PB9 */ 58 | #else 59 | #define SMBUS_FASTMODEPLUS_PB8 (uint32_t)(0x00000010U | SMBUS_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus PB8 not supported */ 60 | #define SMBUS_FASTMODEPLUS_PB9 (uint32_t)(0x00000012U | SMBUS_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus PB9 not supported */ 61 | #endif /* SYSCFG_CFGR2_I2C_PB8_FMP */ 62 | #if defined(SYSCFG_CFGR2_I2C1_FMP) 63 | #define SMBUS_FASTMODEPLUS_I2C1 SYSCFG_CFGR2_I2C1_FMP /*!< Enable Fast Mode Plus on I2C1 pins */ 64 | #else 65 | #define SMBUS_FASTMODEPLUS_I2C1 (uint32_t)(0x00000100U | SMBUS_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus I2C1 not supported */ 66 | #endif /* SYSCFG_CFGR2_I2C1_FMP */ 67 | #if defined(SYSCFG_CFGR2_I2C2_FMP) 68 | #define SMBUS_FASTMODEPLUS_I2C2 SYSCFG_CFGR2_I2C2_FMP /*!< Enable Fast Mode Plus on I2C2 pins */ 69 | #else 70 | #define SMBUS_FASTMODEPLUS_I2C2 (uint32_t)(0x00000200U | SMBUS_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus I2C2 not supported */ 71 | #endif /* SYSCFG_CFGR2_I2C2_FMP */ 72 | #if defined(SYSCFG_CFGR2_I2C3_FMP) 73 | #define SMBUS_FASTMODEPLUS_I2C3 SYSCFG_CFGR2_I2C3_FMP /*!< Enable Fast Mode Plus on I2C3 pins */ 74 | #else 75 | #define SMBUS_FASTMODEPLUS_I2C3 (uint32_t)(0x00000400U | SMBUS_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus I2C3 not supported */ 76 | #endif /* SYSCFG_CFGR2_I2C3_FMP */ 77 | /** 78 | * @} 79 | */ 80 | 81 | /** 82 | * @} 83 | */ 84 | 85 | /* Exported macro ------------------------------------------------------------*/ 86 | /** @defgroup SMBUSEx_Exported_Macros SMBUS Extended Exported Macros 87 | * @{ 88 | */ 89 | 90 | /** 91 | * @} 92 | */ 93 | 94 | /* Exported functions --------------------------------------------------------*/ 95 | /** @addtogroup SMBUSEx_Exported_Functions SMBUS Extended Exported Functions 96 | * @{ 97 | */ 98 | 99 | /** @addtogroup SMBUSEx_Exported_Functions_Group2 WakeUp Mode Functions 100 | * @{ 101 | */ 102 | /* Peripheral Control functions ************************************************/ 103 | HAL_StatusTypeDef HAL_SMBUSEx_EnableWakeUp(SMBUS_HandleTypeDef *hsmbus); 104 | HAL_StatusTypeDef HAL_SMBUSEx_DisableWakeUp(SMBUS_HandleTypeDef *hsmbus); 105 | /** 106 | * @} 107 | */ 108 | 109 | /** @addtogroup SMBUSEx_Exported_Functions_Group3 Fast Mode Plus Functions 110 | * @{ 111 | */ 112 | #if (defined(SYSCFG_CFGR2_I2C_PB6_FMP) || defined(SYSCFG_CFGR2_I2C_PB7_FMP)) || (defined(SYSCFG_CFGR2_I2C_PB8_FMP) || defined(SYSCFG_CFGR2_I2C_PB9_FMP)) || (defined(SYSCFG_CFGR2_I2C1_FMP)) || defined(SYSCFG_CFGR2_I2C2_FMP) || defined(SYSCFG_CFGR2_I2C3_FMP) 113 | void HAL_SMBUSEx_EnableFastModePlus(uint32_t ConfigFastModePlus); 114 | void HAL_SMBUSEx_DisableFastModePlus(uint32_t ConfigFastModePlus); 115 | #endif /* Fast Mode Plus Availability */ 116 | /** 117 | * @} 118 | */ 119 | 120 | /** 121 | * @} 122 | */ 123 | 124 | /* Private constants ---------------------------------------------------------*/ 125 | /** @defgroup SMBUSEx_Private_Constants SMBUS Extended Private Constants 126 | * @{ 127 | */ 128 | 129 | /** 130 | * @} 131 | */ 132 | 133 | /* Private macros ------------------------------------------------------------*/ 134 | /** @defgroup SMBUSEx_Private_Macro SMBUS Extended Private Macros 135 | * @{ 136 | */ 137 | #define IS_SMBUS_FASTMODEPLUS(__CONFIG__) ((((__CONFIG__) & SMBUS_FMP_NOT_SUPPORTED) != SMBUS_FMP_NOT_SUPPORTED) && \ 138 | ((((__CONFIG__) & (SMBUS_FASTMODEPLUS_PB6)) == SMBUS_FASTMODEPLUS_PB6) || \ 139 | (((__CONFIG__) & (SMBUS_FASTMODEPLUS_PB7)) == SMBUS_FASTMODEPLUS_PB7) || \ 140 | (((__CONFIG__) & (SMBUS_FASTMODEPLUS_PB8)) == SMBUS_FASTMODEPLUS_PB8) || \ 141 | (((__CONFIG__) & (SMBUS_FASTMODEPLUS_PB9)) == SMBUS_FASTMODEPLUS_PB9) || \ 142 | (((__CONFIG__) & (SMBUS_FASTMODEPLUS_I2C1)) == SMBUS_FASTMODEPLUS_I2C1) || \ 143 | (((__CONFIG__) & (SMBUS_FASTMODEPLUS_I2C2)) == SMBUS_FASTMODEPLUS_I2C2) || \ 144 | (((__CONFIG__) & (SMBUS_FASTMODEPLUS_I2C3)) == SMBUS_FASTMODEPLUS_I2C3))) 145 | /** 146 | * @} 147 | */ 148 | 149 | /* Private Functions ---------------------------------------------------------*/ 150 | /** @defgroup SMBUSEx_Private_Functions SMBUS Extended Private Functions 151 | * @{ 152 | */ 153 | /* Private functions are defined in stm32l0xx_hal_smbus_ex.c file */ 154 | /** 155 | * @} 156 | */ 157 | 158 | /** 159 | * @} 160 | */ 161 | 162 | /** 163 | * @} 164 | */ 165 | 166 | #ifdef __cplusplus 167 | } 168 | #endif 169 | 170 | #endif /* STM32L0xx_HAL_SMBUS_EX_H */ 171 | -------------------------------------------------------------------------------- /Inc/stm32l0xx_ll_rng.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_ll_rng.h 4 | * @author MCD Application Team 5 | * @brief Header file of RNG LL module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2016 STMicroelectronics. 10 | * All rights reserved. 11 | * 12 | * This software is licensed under terms that can be found in the LICENSE file 13 | * in the root directory of this software component. 14 | * If no LICENSE file comes with this software, it is provided AS-IS. 15 | * 16 | ****************************************************************************** 17 | */ 18 | 19 | /* Define to prevent recursive inclusion -------------------------------------*/ 20 | #ifndef STM32L0xx_LL_RNG_H 21 | #define STM32L0xx_LL_RNG_H 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | /* Includes ------------------------------------------------------------------*/ 28 | #include "stm32l0xx.h" 29 | 30 | /** @addtogroup STM32L0xx_LL_Driver 31 | * @{ 32 | */ 33 | 34 | #if defined (RNG) 35 | 36 | /** @defgroup RNG_LL RNG 37 | * @{ 38 | */ 39 | 40 | /* Private types -------------------------------------------------------------*/ 41 | /* Private defines -----------------------------------------------------------*/ 42 | /* Private variables ---------------------------------------------------------*/ 43 | /* Private constants ---------------------------------------------------------*/ 44 | /* Private macros ------------------------------------------------------------*/ 45 | 46 | /* Exported types ------------------------------------------------------------*/ 47 | /* Exported constants --------------------------------------------------------*/ 48 | /** @defgroup RNG_LL_Exported_Constants RNG Exported Constants 49 | * @{ 50 | */ 51 | 52 | 53 | /** @defgroup RNG_LL_EC_GET_FLAG Get Flags Defines 54 | * @brief Flags defines which can be used with LL_RNG_ReadReg function 55 | * @{ 56 | */ 57 | #define LL_RNG_SR_DRDY RNG_SR_DRDY /*!< Register contains valid random data */ 58 | #define LL_RNG_SR_CECS RNG_SR_CECS /*!< Clock error current status */ 59 | #define LL_RNG_SR_SECS RNG_SR_SECS /*!< Seed error current status */ 60 | #define LL_RNG_SR_CEIS RNG_SR_CEIS /*!< Clock error interrupt status */ 61 | #define LL_RNG_SR_SEIS RNG_SR_SEIS /*!< Seed error interrupt status */ 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @defgroup RNG_LL_EC_IT IT Defines 67 | * @brief IT defines which can be used with LL_RNG_ReadReg and LL_RNG_WriteReg macros 68 | * @{ 69 | */ 70 | #define LL_RNG_CR_IE RNG_CR_IE /*!< RNG Interrupt enable */ 71 | /** 72 | * @} 73 | */ 74 | 75 | /** 76 | * @} 77 | */ 78 | 79 | /* Exported macro ------------------------------------------------------------*/ 80 | /** @defgroup RNG_LL_Exported_Macros RNG Exported Macros 81 | * @{ 82 | */ 83 | 84 | /** @defgroup RNG_LL_EM_WRITE_READ Common Write and read registers Macros 85 | * @{ 86 | */ 87 | 88 | /** 89 | * @brief Write a value in RNG register 90 | * @param __INSTANCE__ RNG Instance 91 | * @param __REG__ Register to be written 92 | * @param __VALUE__ Value to be written in the register 93 | * @retval None 94 | */ 95 | #define LL_RNG_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) 96 | 97 | /** 98 | * @brief Read a value in RNG register 99 | * @param __INSTANCE__ RNG Instance 100 | * @param __REG__ Register to be read 101 | * @retval Register value 102 | */ 103 | #define LL_RNG_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) 104 | /** 105 | * @} 106 | */ 107 | 108 | /** 109 | * @} 110 | */ 111 | 112 | 113 | /* Exported functions --------------------------------------------------------*/ 114 | /** @defgroup RNG_LL_Exported_Functions RNG Exported Functions 115 | * @{ 116 | */ 117 | /** @defgroup RNG_LL_EF_Configuration RNG Configuration functions 118 | * @{ 119 | */ 120 | 121 | /** 122 | * @brief Enable Random Number Generation 123 | * @rmtoll CR RNGEN LL_RNG_Enable 124 | * @param RNGx RNG Instance 125 | * @retval None 126 | */ 127 | __STATIC_INLINE void LL_RNG_Enable(RNG_TypeDef *RNGx) 128 | { 129 | SET_BIT(RNGx->CR, RNG_CR_RNGEN); 130 | } 131 | 132 | /** 133 | * @brief Disable Random Number Generation 134 | * @rmtoll CR RNGEN LL_RNG_Disable 135 | * @param RNGx RNG Instance 136 | * @retval None 137 | */ 138 | __STATIC_INLINE void LL_RNG_Disable(RNG_TypeDef *RNGx) 139 | { 140 | CLEAR_BIT(RNGx->CR, RNG_CR_RNGEN); 141 | } 142 | 143 | /** 144 | * @brief Check if Random Number Generator is enabled 145 | * @rmtoll CR RNGEN LL_RNG_IsEnabled 146 | * @param RNGx RNG Instance 147 | * @retval State of bit (1 or 0). 148 | */ 149 | __STATIC_INLINE uint32_t LL_RNG_IsEnabled(const RNG_TypeDef *RNGx) 150 | { 151 | return ((READ_BIT(RNGx->CR, RNG_CR_RNGEN) == (RNG_CR_RNGEN)) ? 1UL : 0UL); 152 | } 153 | 154 | /** 155 | * @} 156 | */ 157 | 158 | /** @defgroup RNG_LL_EF_FLAG_Management FLAG Management 159 | * @{ 160 | */ 161 | 162 | /** 163 | * @brief Indicate if the RNG Data ready Flag is set or not 164 | * @rmtoll SR DRDY LL_RNG_IsActiveFlag_DRDY 165 | * @param RNGx RNG Instance 166 | * @retval State of bit (1 or 0). 167 | */ 168 | __STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_DRDY(const RNG_TypeDef *RNGx) 169 | { 170 | return ((READ_BIT(RNGx->SR, RNG_SR_DRDY) == (RNG_SR_DRDY)) ? 1UL : 0UL); 171 | } 172 | 173 | /** 174 | * @brief Indicate if the Clock Error Current Status Flag is set or not 175 | * @rmtoll SR CECS LL_RNG_IsActiveFlag_CECS 176 | * @param RNGx RNG Instance 177 | * @retval State of bit (1 or 0). 178 | */ 179 | __STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_CECS(const RNG_TypeDef *RNGx) 180 | { 181 | return ((READ_BIT(RNGx->SR, RNG_SR_CECS) == (RNG_SR_CECS)) ? 1UL : 0UL); 182 | } 183 | 184 | /** 185 | * @brief Indicate if the Seed Error Current Status Flag is set or not 186 | * @rmtoll SR SECS LL_RNG_IsActiveFlag_SECS 187 | * @param RNGx RNG Instance 188 | * @retval State of bit (1 or 0). 189 | */ 190 | __STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_SECS(const RNG_TypeDef *RNGx) 191 | { 192 | return ((READ_BIT(RNGx->SR, RNG_SR_SECS) == (RNG_SR_SECS)) ? 1UL : 0UL); 193 | } 194 | 195 | /** 196 | * @brief Indicate if the Clock Error Interrupt Status Flag is set or not 197 | * @rmtoll SR CEIS LL_RNG_IsActiveFlag_CEIS 198 | * @param RNGx RNG Instance 199 | * @retval State of bit (1 or 0). 200 | */ 201 | __STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_CEIS(const RNG_TypeDef *RNGx) 202 | { 203 | return ((READ_BIT(RNGx->SR, RNG_SR_CEIS) == (RNG_SR_CEIS)) ? 1UL : 0UL); 204 | } 205 | 206 | /** 207 | * @brief Indicate if the Seed Error Interrupt Status Flag is set or not 208 | * @rmtoll SR SEIS LL_RNG_IsActiveFlag_SEIS 209 | * @param RNGx RNG Instance 210 | * @retval State of bit (1 or 0). 211 | */ 212 | __STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_SEIS(const RNG_TypeDef *RNGx) 213 | { 214 | return ((READ_BIT(RNGx->SR, RNG_SR_SEIS) == (RNG_SR_SEIS)) ? 1UL : 0UL); 215 | } 216 | 217 | /** 218 | * @brief Clear Clock Error interrupt Status (CEIS) Flag 219 | * @rmtoll SR CEIS LL_RNG_ClearFlag_CEIS 220 | * @param RNGx RNG Instance 221 | * @retval None 222 | */ 223 | __STATIC_INLINE void LL_RNG_ClearFlag_CEIS(RNG_TypeDef *RNGx) 224 | { 225 | WRITE_REG(RNGx->SR, ~RNG_SR_CEIS); 226 | } 227 | 228 | /** 229 | * @brief Clear Seed Error interrupt Status (SEIS) Flag 230 | * @rmtoll SR SEIS LL_RNG_ClearFlag_SEIS 231 | * @param RNGx RNG Instance 232 | * @retval None 233 | */ 234 | __STATIC_INLINE void LL_RNG_ClearFlag_SEIS(RNG_TypeDef *RNGx) 235 | { 236 | WRITE_REG(RNGx->SR, ~RNG_SR_SEIS); 237 | } 238 | 239 | /** 240 | * @} 241 | */ 242 | 243 | /** @defgroup RNG_LL_EF_IT_Management IT Management 244 | * @{ 245 | */ 246 | 247 | /** 248 | * @brief Enable Random Number Generator Interrupt 249 | * (applies for either Seed error, Clock Error or Data ready interrupts) 250 | * @rmtoll CR IE LL_RNG_EnableIT 251 | * @param RNGx RNG Instance 252 | * @retval None 253 | */ 254 | __STATIC_INLINE void LL_RNG_EnableIT(RNG_TypeDef *RNGx) 255 | { 256 | SET_BIT(RNGx->CR, RNG_CR_IE); 257 | } 258 | 259 | /** 260 | * @brief Disable Random Number Generator Interrupt 261 | * (applies for either Seed error, Clock Error or Data ready interrupts) 262 | * @rmtoll CR IE LL_RNG_DisableIT 263 | * @param RNGx RNG Instance 264 | * @retval None 265 | */ 266 | __STATIC_INLINE void LL_RNG_DisableIT(RNG_TypeDef *RNGx) 267 | { 268 | CLEAR_BIT(RNGx->CR, RNG_CR_IE); 269 | } 270 | 271 | /** 272 | * @brief Check if Random Number Generator Interrupt is enabled 273 | * (applies for either Seed error, Clock Error or Data ready interrupts) 274 | * @rmtoll CR IE LL_RNG_IsEnabledIT 275 | * @param RNGx RNG Instance 276 | * @retval State of bit (1 or 0). 277 | */ 278 | __STATIC_INLINE uint32_t LL_RNG_IsEnabledIT(const RNG_TypeDef *RNGx) 279 | { 280 | return ((READ_BIT(RNGx->CR, RNG_CR_IE) == (RNG_CR_IE)) ? 1UL : 0UL); 281 | } 282 | 283 | /** 284 | * @} 285 | */ 286 | 287 | /** @defgroup RNG_LL_EF_Data_Management Data Management 288 | * @{ 289 | */ 290 | 291 | /** 292 | * @brief Return32-bit Random Number value 293 | * @rmtoll DR RNDATA LL_RNG_ReadRandData32 294 | * @param RNGx RNG Instance 295 | * @retval Generated 32-bit random value 296 | */ 297 | __STATIC_INLINE uint32_t LL_RNG_ReadRandData32(const RNG_TypeDef *RNGx) 298 | { 299 | return (uint32_t)(READ_REG(RNGx->DR)); 300 | } 301 | 302 | /** 303 | * @} 304 | */ 305 | 306 | #if defined(USE_FULL_LL_DRIVER) 307 | /** @defgroup RNG_LL_EF_Init Initialization and de-initialization functions 308 | * @{ 309 | */ 310 | ErrorStatus LL_RNG_DeInit(const RNG_TypeDef *RNGx); 311 | 312 | /** 313 | * @} 314 | */ 315 | #endif /* USE_FULL_LL_DRIVER */ 316 | 317 | /** 318 | * @} 319 | */ 320 | 321 | /** 322 | * @} 323 | */ 324 | 325 | #endif /* RNG */ 326 | 327 | /** 328 | * @} 329 | */ 330 | 331 | #ifdef __cplusplus 332 | } 333 | #endif 334 | 335 | #endif /* __STM32L0xx_LL_RNG_H */ 336 | 337 | -------------------------------------------------------------------------------- /Inc/stm32l0xx_ll_usb.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_ll_usb.h 4 | * @author MCD Application Team 5 | * @brief Header file of USB Low Layer HAL module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2016 STMicroelectronics. 10 | * All rights reserved. 11 | * 12 | * This software is licensed under terms that can be found in the LICENSE file 13 | * in the root directory of this software component. 14 | * If no LICENSE file comes with this software, it is provided AS-IS. 15 | * 16 | ****************************************************************************** 17 | */ 18 | 19 | /* Define to prevent recursive inclusion -------------------------------------*/ 20 | #ifndef STM32L0xx_LL_USB_H 21 | #define STM32L0xx_LL_USB_H 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif /* __cplusplus */ 26 | 27 | /* Includes ------------------------------------------------------------------*/ 28 | #include "stm32l0xx_hal_def.h" 29 | 30 | #if defined (USB) 31 | /** @addtogroup STM32L0xx_HAL_Driver 32 | * @{ 33 | */ 34 | 35 | /** @addtogroup USB_LL 36 | * @{ 37 | */ 38 | 39 | /* Exported types ------------------------------------------------------------*/ 40 | 41 | /** 42 | * @brief USB Mode definition 43 | */ 44 | 45 | typedef enum 46 | { 47 | USB_DEVICE_MODE = 0 48 | } USB_ModeTypeDef; 49 | 50 | 51 | /** 52 | * @brief USB Instance Initialization Structure definition 53 | */ 54 | typedef struct 55 | { 56 | uint8_t dev_endpoints; /*!< Device Endpoints number. 57 | This parameter depends on the used USB core. 58 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ 59 | 60 | uint8_t speed; /*!< USB Core speed. 61 | This parameter can be any value of @ref PCD_Speed/HCD_Speed 62 | (HCD_SPEED_xxx, HCD_SPEED_xxx) */ 63 | 64 | uint8_t ep0_mps; /*!< Set the Endpoint 0 Max Packet size. */ 65 | 66 | uint8_t phy_itface; /*!< Select the used PHY interface. 67 | This parameter can be any value of @ref PCD_PHY_Module/HCD_PHY_Module */ 68 | 69 | uint8_t Sof_enable; /*!< Enable or disable the output of the SOF signal. */ 70 | 71 | uint8_t low_power_enable; /*!< Enable or disable the low Power Mode. */ 72 | 73 | uint8_t lpm_enable; /*!< Enable or disable Link Power Management. */ 74 | 75 | uint8_t battery_charging_enable; /*!< Enable or disable Battery charging. */ 76 | } USB_CfgTypeDef; 77 | 78 | typedef struct 79 | { 80 | uint8_t num; /*!< Endpoint number 81 | This parameter must be a number between Min_Data = 1 and Max_Data = 15 */ 82 | 83 | uint8_t is_in; /*!< Endpoint direction 84 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ 85 | 86 | uint8_t is_stall; /*!< Endpoint stall condition 87 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ 88 | 89 | uint8_t type; /*!< Endpoint type 90 | This parameter can be any value of @ref USB_LL_EP_Type */ 91 | 92 | uint8_t data_pid_start; /*!< Initial data PID 93 | This parameter must be a number between Min_Data = 0 and Max_Data = 1 */ 94 | 95 | 96 | uint16_t pmaadress; /*!< PMA Address 97 | This parameter can be any value between Min_addr = 0 and Max_addr = 1K */ 98 | 99 | uint16_t pmaaddr0; /*!< PMA Address0 100 | This parameter can be any value between Min_addr = 0 and Max_addr = 1K */ 101 | 102 | uint16_t pmaaddr1; /*!< PMA Address1 103 | This parameter can be any value between Min_addr = 0 and Max_addr = 1K */ 104 | 105 | uint8_t doublebuffer; /*!< Double buffer enable 106 | This parameter can be 0 or 1 */ 107 | 108 | 109 | uint32_t maxpacket; /*!< Endpoint Max packet size 110 | This parameter must be a number between Min_Data = 0 and Max_Data = 64KB */ 111 | 112 | uint8_t *xfer_buff; /*!< Pointer to transfer buffer */ 113 | 114 | uint32_t xfer_len; /*!< Current transfer length */ 115 | 116 | uint32_t xfer_count; /*!< Partial transfer length in case of multi packet transfer */ 117 | 118 | uint32_t xfer_len_db; /*!< double buffer transfer length used with bulk double buffer in */ 119 | 120 | uint8_t xfer_fill_db; /*!< double buffer Need to Fill new buffer used with bulk_in */ 121 | } USB_EPTypeDef; 122 | 123 | /* Exported constants --------------------------------------------------------*/ 124 | 125 | /** @defgroup PCD_Exported_Constants PCD Exported Constants 126 | * @{ 127 | */ 128 | /** @defgroup USB_LL_EP0_MPS USB Low Layer EP0 MPS 129 | * @{ 130 | */ 131 | #define EP_MPS_64 0U 132 | #define EP_MPS_32 1U 133 | #define EP_MPS_16 2U 134 | #define EP_MPS_8 3U 135 | /** 136 | * @} 137 | */ 138 | 139 | /** @defgroup USB_LL_EP_Type USB Low Layer EP Type 140 | * @{ 141 | */ 142 | #define EP_TYPE_CTRL 0U 143 | #define EP_TYPE_ISOC 1U 144 | #define EP_TYPE_BULK 2U 145 | #define EP_TYPE_INTR 3U 146 | #define EP_TYPE_MSK 3U 147 | /** 148 | * @} 149 | */ 150 | 151 | /** @defgroup USB_LL Device Speed 152 | * @{ 153 | */ 154 | #define USBD_FS_SPEED 2U 155 | /** 156 | * @} 157 | */ 158 | 159 | 160 | #define BTABLE_ADDRESS 0x000U 161 | #define PMA_ACCESS 1U 162 | 163 | #ifndef USB_EP_RX_STRX 164 | #define USB_EP_RX_STRX (0x3U << 12) 165 | #endif /* USB_EP_RX_STRX */ 166 | 167 | #define EP_ADDR_MSK 0x7U 168 | 169 | #ifndef USE_USB_DOUBLE_BUFFER 170 | #define USE_USB_DOUBLE_BUFFER 1U 171 | #endif /* USE_USB_DOUBLE_BUFFER */ 172 | 173 | 174 | /** 175 | * @} 176 | */ 177 | 178 | /* Exported macro ------------------------------------------------------------*/ 179 | /** 180 | * @} 181 | */ 182 | 183 | /* Exported functions --------------------------------------------------------*/ 184 | /** @addtogroup USB_LL_Exported_Functions USB Low Layer Exported Functions 185 | * @{ 186 | */ 187 | 188 | 189 | HAL_StatusTypeDef USB_CoreInit(USB_TypeDef *USBx, USB_CfgTypeDef cfg); 190 | HAL_StatusTypeDef USB_DevInit(USB_TypeDef *USBx, USB_CfgTypeDef cfg); 191 | HAL_StatusTypeDef USB_EnableGlobalInt(USB_TypeDef *USBx); 192 | HAL_StatusTypeDef USB_DisableGlobalInt(USB_TypeDef *USBx); 193 | HAL_StatusTypeDef USB_SetCurrentMode(USB_TypeDef *USBx, USB_ModeTypeDef mode); 194 | 195 | HAL_StatusTypeDef USB_FlushRxFifo(USB_TypeDef const *USBx); 196 | HAL_StatusTypeDef USB_FlushTxFifo(USB_TypeDef const *USBx, uint32_t num); 197 | 198 | #if defined (HAL_PCD_MODULE_ENABLED) 199 | HAL_StatusTypeDef USB_ActivateEndpoint(USB_TypeDef *USBx, USB_EPTypeDef *ep); 200 | HAL_StatusTypeDef USB_DeactivateEndpoint(USB_TypeDef *USBx, USB_EPTypeDef *ep); 201 | HAL_StatusTypeDef USB_EPStartXfer(USB_TypeDef *USBx, USB_EPTypeDef *ep); 202 | HAL_StatusTypeDef USB_EPSetStall(USB_TypeDef *USBx, USB_EPTypeDef *ep); 203 | HAL_StatusTypeDef USB_EPClearStall(USB_TypeDef *USBx, USB_EPTypeDef *ep); 204 | HAL_StatusTypeDef USB_EPStopXfer(USB_TypeDef *USBx, USB_EPTypeDef *ep); 205 | #endif /* defined (HAL_PCD_MODULE_ENABLED) */ 206 | 207 | HAL_StatusTypeDef USB_SetDevAddress(USB_TypeDef *USBx, uint8_t address); 208 | HAL_StatusTypeDef USB_DevConnect(USB_TypeDef *USBx); 209 | HAL_StatusTypeDef USB_DevDisconnect(USB_TypeDef *USBx); 210 | HAL_StatusTypeDef USB_StopDevice(USB_TypeDef *USBx); 211 | uint32_t USB_ReadInterrupts(USB_TypeDef const *USBx); 212 | HAL_StatusTypeDef USB_ActivateRemoteWakeup(USB_TypeDef *USBx); 213 | HAL_StatusTypeDef USB_DeActivateRemoteWakeup(USB_TypeDef *USBx); 214 | 215 | void USB_WritePMA(USB_TypeDef const *USBx, uint8_t *pbUsrBuf, 216 | uint16_t wPMABufAddr, uint16_t wNBytes); 217 | 218 | void USB_ReadPMA(USB_TypeDef const *USBx, uint8_t *pbUsrBuf, 219 | uint16_t wPMABufAddr, uint16_t wNBytes); 220 | 221 | /** 222 | * @} 223 | */ 224 | 225 | /** 226 | * @} 227 | */ 228 | 229 | /** 230 | * @} 231 | */ 232 | 233 | /** 234 | * @} 235 | */ 236 | #endif /* defined (USB) */ 237 | 238 | #ifdef __cplusplus 239 | } 240 | #endif /* __cplusplus */ 241 | 242 | 243 | #endif /* STM32L0xx_LL_USB_H */ 244 | -------------------------------------------------------------------------------- /Inc/stm32l0xx_ll_utils.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_ll_utils.h 4 | * @author MCD Application Team 5 | * @brief Header file of UTILS LL module. 6 | @verbatim 7 | ============================================================================== 8 | ##### How to use this driver ##### 9 | ============================================================================== 10 | [..] 11 | The LL UTILS driver contains a set of generic APIs that can be 12 | used by user: 13 | (+) Device electronic signature 14 | (+) Timing functions 15 | (+) PLL configuration functions 16 | 17 | @endverbatim 18 | ****************************************************************************** 19 | * @attention 20 | * 21 | * Copyright (c) 2016 STMicroelectronics. 22 | * All rights reserved. 23 | * 24 | * This software is licensed under terms that can be found in the LICENSE file 25 | * in the root directory of this software component. 26 | * If no LICENSE file comes with this software, it is provided AS-IS. 27 | * 28 | ****************************************************************************** 29 | */ 30 | 31 | /* Define to prevent recursive inclusion -------------------------------------*/ 32 | #ifndef __STM32L0xx_LL_UTILS_H 33 | #define __STM32L0xx_LL_UTILS_H 34 | 35 | #ifdef __cplusplus 36 | extern "C" { 37 | #endif 38 | 39 | /* Includes ------------------------------------------------------------------*/ 40 | #include "stm32l0xx.h" 41 | 42 | /** @addtogroup STM32L0xx_LL_Driver 43 | * @{ 44 | */ 45 | 46 | /** @defgroup UTILS_LL UTILS 47 | * @{ 48 | */ 49 | 50 | /* Private types -------------------------------------------------------------*/ 51 | /* Private variables ---------------------------------------------------------*/ 52 | 53 | /* Private constants ---------------------------------------------------------*/ 54 | /** @defgroup UTILS_LL_Private_Constants UTILS Private Constants 55 | * @{ 56 | */ 57 | 58 | /* Max delay can be used in LL_mDelay */ 59 | #define LL_MAX_DELAY 0xFFFFFFFFU 60 | 61 | /** 62 | * @brief Unique device ID register base address 63 | */ 64 | #define UID_BASE_ADDRESS UID_BASE 65 | 66 | /** 67 | * @brief Flash size data register base address 68 | */ 69 | #define FLASHSIZE_BASE_ADDRESS FLASHSIZE_BASE 70 | 71 | 72 | /** 73 | * @} 74 | */ 75 | 76 | /* Private macros ------------------------------------------------------------*/ 77 | /** @defgroup UTILS_LL_Private_Macros UTILS Private Macros 78 | * @{ 79 | */ 80 | /** 81 | * @} 82 | */ 83 | /* Exported types ------------------------------------------------------------*/ 84 | /** @defgroup UTILS_LL_ES_INIT UTILS Exported structures 85 | * @{ 86 | */ 87 | /** 88 | * @brief UTILS PLL structure definition 89 | */ 90 | typedef struct 91 | { 92 | uint32_t PLLMul; /*!< Multiplication factor for PLL VCO input clock. 93 | This parameter can be a value of @ref RCC_LL_EC_PLL_MUL 94 | 95 | This feature can be modified afterwards using unitary function 96 | @ref LL_RCC_PLL_ConfigDomain_SYS(). */ 97 | 98 | uint32_t PLLDiv; /*!< Division factor for PLL VCO output clock. 99 | This parameter can be a value of @ref RCC_LL_EC_PLL_DIV 100 | 101 | This feature can be modified afterwards using unitary function 102 | @ref LL_RCC_PLL_ConfigDomain_SYS(). */ 103 | } LL_UTILS_PLLInitTypeDef; 104 | 105 | /** 106 | * @brief UTILS System, AHB and APB buses clock configuration structure definition 107 | */ 108 | typedef struct 109 | { 110 | uint32_t AHBCLKDivider; /*!< The AHB clock (HCLK) divider. This clock is derived from the system clock (SYSCLK). 111 | This parameter can be a value of @ref RCC_LL_EC_SYSCLK_DIV 112 | 113 | This feature can be modified afterwards using unitary function 114 | @ref LL_RCC_SetAHBPrescaler(). */ 115 | 116 | uint32_t APB1CLKDivider; /*!< The APB1 clock (PCLK1) divider. This clock is derived from the AHB clock (HCLK). 117 | This parameter can be a value of @ref RCC_LL_EC_APB1_DIV 118 | 119 | This feature can be modified afterwards using unitary function 120 | @ref LL_RCC_SetAPB1Prescaler(). */ 121 | 122 | uint32_t APB2CLKDivider; /*!< The APB2 clock (PCLK2) divider. This clock is derived from the AHB clock (HCLK). 123 | This parameter can be a value of @ref RCC_LL_EC_APB2_DIV 124 | 125 | This feature can be modified afterwards using unitary function 126 | @ref LL_RCC_SetAPB2Prescaler(). */ 127 | 128 | } LL_UTILS_ClkInitTypeDef; 129 | 130 | /** 131 | * @} 132 | */ 133 | 134 | /* Exported constants --------------------------------------------------------*/ 135 | /** @defgroup UTILS_LL_Exported_Constants UTILS Exported Constants 136 | * @{ 137 | */ 138 | 139 | /** @defgroup UTILS_EC_HSE_BYPASS HSE Bypass activation 140 | * @{ 141 | */ 142 | #define LL_UTILS_HSEBYPASS_OFF 0x00000000U /*!< HSE Bypass is not enabled */ 143 | #define LL_UTILS_HSEBYPASS_ON 0x00000001U /*!< HSE Bypass is enabled */ 144 | /** 145 | * @} 146 | */ 147 | 148 | 149 | /** 150 | * @} 151 | */ 152 | 153 | /* Exported macro ------------------------------------------------------------*/ 154 | 155 | /* Exported functions --------------------------------------------------------*/ 156 | /** @defgroup UTILS_LL_Exported_Functions UTILS Exported Functions 157 | * @{ 158 | */ 159 | 160 | /** @defgroup UTILS_EF_DEVICE_ELECTRONIC_SIGNATURE DEVICE ELECTRONIC SIGNATURE 161 | * @{ 162 | */ 163 | 164 | /** 165 | * @brief Get Word0 of the unique device identifier (UID based on 96 bits) 166 | * @retval UID[31:0] 167 | */ 168 | __STATIC_INLINE uint32_t LL_GetUID_Word0(void) 169 | { 170 | return (uint32_t)(READ_REG(*((uint32_t *)UID_BASE_ADDRESS))); 171 | } 172 | 173 | /** 174 | * @brief Get Word1 of the unique device identifier (UID based on 96 bits) 175 | * @retval UID[63:32] 176 | */ 177 | __STATIC_INLINE uint32_t LL_GetUID_Word1(void) 178 | { 179 | return (uint32_t)(READ_REG(*((uint32_t *)(UID_BASE_ADDRESS + 0x04U)))); 180 | } 181 | 182 | /** 183 | * @brief Get Word2 of the unique device identifier (UID based on 96 bits) 184 | * @retval UID[95:64] 185 | */ 186 | __STATIC_INLINE uint32_t LL_GetUID_Word2(void) 187 | { 188 | return (uint32_t)(READ_REG(*((uint32_t *)(UID_BASE_ADDRESS + 0x14U)))); 189 | } 190 | 191 | /** 192 | * @brief Get Flash memory size 193 | * @note This bitfield indicates the size of the device Flash memory expressed in 194 | * Kbytes. As an example, 0x040 corresponds to 64 Kbytes. 195 | * @retval FLASH_SIZE[15:0]: Flash memory size 196 | */ 197 | __STATIC_INLINE uint32_t LL_GetFlashSize(void) 198 | { 199 | return (uint32_t)(READ_REG(*((uint32_t *)FLASHSIZE_BASE_ADDRESS)) & 0xFFFF); 200 | } 201 | 202 | 203 | /** 204 | * @} 205 | */ 206 | 207 | /** @defgroup UTILS_LL_EF_DELAY DELAY 208 | * @{ 209 | */ 210 | 211 | /** 212 | * @brief This function configures the Cortex-M SysTick source of the time base. 213 | * @param HCLKFrequency HCLK frequency in Hz (can be calculated thanks to RCC helper macro) 214 | * @note When a RTOS is used, it is recommended to avoid changing the SysTick 215 | * configuration by calling this function, for a delay use rather osDelay RTOS service. 216 | * @param Ticks Frequency of Ticks (Hz) 217 | * @retval None 218 | */ 219 | __STATIC_INLINE void LL_InitTick(uint32_t HCLKFrequency, uint32_t Ticks) 220 | { 221 | /* Configure the SysTick to have interrupt in 1ms time base */ 222 | SysTick->LOAD = (uint32_t)((HCLKFrequency / Ticks) - 1UL); /* set reload register */ 223 | SysTick->VAL = 0UL; /* Load the SysTick Counter Value */ 224 | SysTick->CTRL = SysTick_CTRL_CLKSOURCE_Msk | 225 | SysTick_CTRL_ENABLE_Msk; /* Enable the Systick Timer */ 226 | } 227 | 228 | void LL_Init1msTick(uint32_t HCLKFrequency); 229 | void LL_mDelay(uint32_t Delay); 230 | 231 | /** 232 | * @} 233 | */ 234 | 235 | /** @defgroup UTILS_EF_SYSTEM SYSTEM 236 | * @{ 237 | */ 238 | 239 | void LL_SetSystemCoreClock(uint32_t HCLKFrequency); 240 | ErrorStatus LL_SetFlashLatency(uint32_t HCLKFrequency); 241 | ErrorStatus LL_PLL_ConfigSystemClock_HSI(LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct, 242 | LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct); 243 | ErrorStatus LL_PLL_ConfigSystemClock_HSE(uint32_t HSEFrequency, uint32_t HSEBypass, 244 | LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct, LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct); 245 | 246 | /** 247 | * @} 248 | */ 249 | 250 | /** 251 | * @} 252 | */ 253 | 254 | /** 255 | * @} 256 | */ 257 | 258 | /** 259 | * @} 260 | */ 261 | 262 | #ifdef __cplusplus 263 | } 264 | #endif 265 | 266 | #endif /* __STM32L0xx_LL_UTILS_H */ 267 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright 2017 STMicroelectronics. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation and/or 12 | other materials provided with the distribution. 13 | 14 | 3. Neither the name of the copyright holder nor the names of its contributors 15 | may be used to endorse or promote products derived from this software without 16 | specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 22 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 25 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # STM32CubeL0 HAL Driver MCU Component 2 | 3 | ![latest tag](https://img.shields.io/github/v/tag/STMicroelectronics/stm32l0xx_hal_driver.svg?color=brightgreen) 4 | 5 | ## Overview 6 | 7 | **STM32Cube** is an STMicroelectronics original initiative to ease developers' life by reducing efforts, time and cost. 8 | 9 | **STM32Cube** covers the overall STM32 products portfolio. It includes a comprehensive embedded software platform delivered for each STM32 series. 10 | * The CMSIS modules (core and device) corresponding to the ARM(tm) core implemented in this STM32 product. 11 | * The STM32 HAL-LL drivers, an abstraction layer offering a set of APIs ensuring maximized portability across the STM32 portfolio. 12 | * The BSP drivers of each evaluation, demonstration or nucleo board provided for this STM32 series. 13 | * A consistent set of middleware libraries such as RTOS, USB, FatFS, graphics, touch sensing library... 14 | * A full set of software projects (basic examples, applications, and demonstrations) for each board provided for this STM32 series. 15 | 16 | Two models of publication are proposed for the STM32Cube embedded software: 17 | * The monolithic **MCU Package**: all STM32Cube software modules of one STM32 series are present (Drivers, Middleware, Projects, Utilities) in the repository (usual name **STM32Cubexx**, xx corresponding to the STM32 series). 18 | * The **MCU component**: each STM32Cube software module being part of the STM32Cube MCU Package, is delivered as an individual repository, allowing the user to select and get only the required software functions. 19 | 20 | ## Description 21 | 22 | This **stm32l0xx_hal_driver** MCU component repo is one element of the STM32CubeL0 MCU embedded software package, providing the **HAL-LL Drivers** part. 23 | 24 | ## Release note 25 | 26 | Details about the content of this release are available in the release note [here](https://htmlpreview.github.io/?https://github.com/STMicroelectronics/stm32l0xx_hal_driver/blob/master/Release_Notes.html). 27 | 28 | ## Compatibility information 29 | 30 | It is **crucial** that you use a consistent set of versions for the CMSIS Core - CMSIS Device - HAL, as mentioned in [this](https://htmlpreview.github.io/?https://github.com/STMicroelectronics/STM32CubeL0/blob/master/Release_Notes.html) release note. 31 | 32 | The full **STM32CubeL0** MCU package is available [here](https://github.com/STMicroelectronics/STM32CubeL0). 33 | 34 | ## Troubleshooting 35 | 36 | If you have any issue with the **software content** of this repository, you can file an issue [here](https://github.com/STMicroelectronics/stm32l0xx_hal_driver/issues/new/choose). 37 | 38 | For any other question related to the product, the tools, the environment, you can submit a topic on the [ST Community/STM32 MCUs forum](https://community.st.com/s/group/0F90X000000AXsASAW/stm32-mcus). 39 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Report potential product security vulnerabilities 2 | 3 | ST places a high priority on security, and our Product Security Incident 4 | Response Team (PSIRT) is committed to rapidly addressing potential security 5 | vulnerabilities affecting our products. PSIRT's long history and vast experience 6 | in security allows ST to perform clear analyses and provide appropriate guidance 7 | on mitigations and solutions when applicable. 8 | 9 | If you wish to report potential security vulnerabilities regarding our products, 10 | **please do not report them through public GitHub issues.** Instead, we 11 | encourage you to report them to our ST PSIRT following the process described at: 12 | **https://www.st.com/content/st_com/en/security/report-vulnerabilities.html** 13 | 14 | ### IMPORTANT - READ CAREFULLY: 15 | 16 | STMicroelectronics International N.V., on behalf of itself, its affiliates and 17 | subsidiaries, (collectively “ST”) takes all potential security vulnerability 18 | reports or other related communications (“Report(s)”) seriously. In order to 19 | review Your Report (the terms “You” and “Yours” include your employer, and all 20 | affiliates, subsidiaries and related persons or entities) and take actions as 21 | deemed appropriate, ST requires that we have the rights and Your permission to 22 | do so. 23 | 24 | As such, by submitting Your Report to ST, You agree that You have the right to 25 | do so, and You grant to ST the rights to use the Report for purposes related to 26 | security vulnerability analysis, testing, correction, patching, reporting and 27 | any other related purpose or function. 28 | 29 | By submitting Your Report, You agree that ST’s 30 | [Privacy Policy](https://www.st.com/content/st_com/en/common/privacy-portal.html) 31 | applies to all related communications. 32 | -------------------------------------------------------------------------------- /Src/stm32l0xx_hal_comp_ex.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_hal_comp_ex.c 4 | * @author MCD Application Team 5 | * @brief Extended COMP HAL module driver. 6 | * @brief This file provides firmware functions to manage voltage reference 7 | * VrefInt that must be specifically controlled for comparator 8 | * instance COMP2. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * Copyright (c) 2016 STMicroelectronics. 13 | * All rights reserved. 14 | * 15 | * This software is licensed under terms that can be found in the LICENSE file 16 | * in the root directory of this software component. 17 | * If no LICENSE file comes with this software, it is provided AS-IS. 18 | * 19 | ****************************************************************************** 20 | @verbatim 21 | ============================================================================== 22 | ##### COMP peripheral Extended features ##### 23 | ============================================================================== 24 | 25 | [..] Comparing to other previous devices, the COMP interface for STM32L0XX 26 | devices contains the following additional features 27 | 28 | (+) Possibility to enable or disable the VREFINT which is used as input 29 | to the comparator. 30 | 31 | 32 | @endverbatim 33 | ****************************************************************************** 34 | */ 35 | 36 | #if !defined (STM32L010xB) && !defined (STM32L010x8) && !defined (STM32L010x6) && !defined (STM32L010x4) 37 | /* Includes ------------------------------------------------------------------*/ 38 | #include "stm32l0xx_hal.h" 39 | 40 | /** @addtogroup STM32L0xx_HAL_Driver 41 | * @{ 42 | */ 43 | 44 | #ifdef HAL_COMP_MODULE_ENABLED 45 | 46 | /** @addtogroup COMPEx 47 | * @brief Extended COMP HAL module driver 48 | * @{ 49 | */ 50 | 51 | /* Private define ------------------------------------------------------------*/ 52 | /** @addtogroup COMP_Private_Constants 53 | * @{ 54 | */ 55 | 56 | /* Delay for COMP voltage scaler stabilization time (voltage from VrefInt, */ 57 | /* delay based on VrefInt startup time). */ 58 | /* Literal set to maximum value (refer to device datasheet, */ 59 | /* parameter "TVREFINT"). */ 60 | /* Unit: us */ 61 | #define COMP_DELAY_VOLTAGE_SCALER_STAB_US (3000U) /*!< Delay for COMP voltage scaler stabilization time */ 62 | 63 | /** 64 | * @} 65 | */ 66 | 67 | /* Exported functions --------------------------------------------------------*/ 68 | /** @addtogroup COMPEx_Exported_Functions 69 | * @{ 70 | */ 71 | 72 | /** @addtogroup COMPEx_Exported_Functions_Group1 73 | * @brief Extended functions to manage VREFINT for the comparator 74 | * 75 | * @{ 76 | */ 77 | 78 | /** 79 | * @brief Enable Vrefint and path to comparator, used by comparator 80 | * instance COMP2 input based on VrefInt or subdivision of VrefInt. 81 | * @note The equivalent of this function is managed automatically when 82 | * using function "HAL_COMP_Init()". 83 | * @note VrefInt requires a startup time 84 | * (refer to device datasheet, parameter "TVREFINT"). 85 | * This function waits for the startup time 86 | * (alternative solution: poll for bit SYSCFG_CFGR3_VREFINT_RDYF set). 87 | * @note VrefInt must be disabled before entering in low-power mode. 88 | * Refer to description of bit EN_VREFINT in reference manual. 89 | * @retval None 90 | */ 91 | void HAL_COMPEx_EnableVREFINT(void) 92 | { 93 | __IO uint32_t wait_loop_index = 0U; 94 | 95 | /* Enable VrefInt voltage reference and buffer */ 96 | SYSCFG->CFGR3 |= (SYSCFG_CFGR3_ENBUFLP_VREFINT_COMP | SYSCFG_CFGR3_EN_VREFINT); 97 | 98 | /* Wait loop initialization and execution */ 99 | /* Note: Variable divided by 2 to compensate partially */ 100 | /* CPU processing cycles. */ 101 | wait_loop_index = (COMP_DELAY_VOLTAGE_SCALER_STAB_US * (SystemCoreClock / (1000000U * 2U))); 102 | while(wait_loop_index != 0U) 103 | { 104 | wait_loop_index--; 105 | } 106 | } 107 | 108 | /** 109 | * @brief Disable Vrefint and path to comparator, used by comparator 110 | * instance COMP2 input based on VrefInt or subdivision of VrefInt. 111 | * @note VrefInt must be disabled before entering in low-power mode. 112 | * Refer to description of bit EN_VREFINT in reference manual. 113 | * @retval None 114 | */ 115 | void HAL_COMPEx_DisableVREFINT(void) 116 | { 117 | /* Disable VrefInt voltage reference and buffer */ 118 | SYSCFG->CFGR3 &= (uint32_t)~((uint32_t)(SYSCFG_CFGR3_ENBUFLP_VREFINT_COMP | SYSCFG_CFGR3_EN_VREFINT)); 119 | } 120 | 121 | /** 122 | * @} 123 | */ 124 | 125 | /** 126 | * @} 127 | */ 128 | 129 | /** 130 | * @} 131 | */ 132 | 133 | #endif /* HAL_COMP_MODULE_ENABLED */ 134 | 135 | /** 136 | * @} 137 | */ 138 | #endif /* #if !defined (STM32L010xB) && !defined (STM32L010x8) && !defined (STM32L010x6) && !defined (STM32L010x4) */ 139 | -------------------------------------------------------------------------------- /Src/stm32l0xx_hal_crc_ex.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_hal_crc_ex.c 4 | * @author MCD Application Team 5 | * @brief Extended CRC HAL module driver. 6 | * This file provides firmware functions to manage the extended 7 | * functionalities of the CRC peripheral. 8 | * 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * Copyright (c) 2016 STMicroelectronics. 13 | * All rights reserved. 14 | * 15 | * This software is licensed under terms that can be found in the LICENSE file 16 | * in the root directory of this software component. 17 | * If no LICENSE file comes with this software, it is provided AS-IS. 18 | * 19 | ****************************************************************************** 20 | @verbatim 21 | ================================================================================ 22 | ##### How to use this driver ##### 23 | ================================================================================ 24 | [..] 25 | (+) Set user-defined generating polynomial through HAL_CRCEx_Polynomial_Set() 26 | (+) Configure Input or Output data inversion 27 | 28 | @endverbatim 29 | ****************************************************************************** 30 | */ 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "stm32l0xx_hal.h" 34 | 35 | /** @addtogroup STM32L0xx_HAL_Driver 36 | * @{ 37 | */ 38 | 39 | /** @defgroup CRCEx CRCEx 40 | * @brief CRC Extended HAL module driver 41 | * @{ 42 | */ 43 | 44 | #ifdef HAL_CRC_MODULE_ENABLED 45 | 46 | /* Private typedef -----------------------------------------------------------*/ 47 | /* Private define ------------------------------------------------------------*/ 48 | /* Private macro -------------------------------------------------------------*/ 49 | /* Private variables ---------------------------------------------------------*/ 50 | /* Private function prototypes -----------------------------------------------*/ 51 | /* Exported functions --------------------------------------------------------*/ 52 | 53 | /** @defgroup CRCEx_Exported_Functions CRC Extended Exported Functions 54 | * @{ 55 | */ 56 | 57 | /** @defgroup CRCEx_Exported_Functions_Group1 Extended Initialization/de-initialization functions 58 | * @brief Extended Initialization and Configuration functions. 59 | * 60 | @verbatim 61 | =============================================================================== 62 | ##### Extended configuration functions ##### 63 | =============================================================================== 64 | [..] This section provides functions allowing to: 65 | (+) Configure the generating polynomial 66 | (+) Configure the input data inversion 67 | (+) Configure the output data inversion 68 | 69 | @endverbatim 70 | * @{ 71 | */ 72 | 73 | 74 | /** 75 | * @brief Initialize the CRC polynomial if different from default one. 76 | * @param hcrc CRC handle 77 | * @param Pol CRC generating polynomial (7, 8, 16 or 32-bit long). 78 | * This parameter is written in normal representation, e.g. 79 | * @arg for a polynomial of degree 7, X^7 + X^6 + X^5 + X^2 + 1 is written 0x65 80 | * @arg for a polynomial of degree 16, X^16 + X^12 + X^5 + 1 is written 0x1021 81 | * @param PolyLength CRC polynomial length. 82 | * This parameter can be one of the following values: 83 | * @arg @ref CRC_POLYLENGTH_7B 7-bit long CRC (generating polynomial of degree 7) 84 | * @arg @ref CRC_POLYLENGTH_8B 8-bit long CRC (generating polynomial of degree 8) 85 | * @arg @ref CRC_POLYLENGTH_16B 16-bit long CRC (generating polynomial of degree 16) 86 | * @arg @ref CRC_POLYLENGTH_32B 32-bit long CRC (generating polynomial of degree 32) 87 | * @retval HAL status 88 | */ 89 | HAL_StatusTypeDef HAL_CRCEx_Polynomial_Set(CRC_HandleTypeDef *hcrc, uint32_t Pol, uint32_t PolyLength) 90 | { 91 | HAL_StatusTypeDef status = HAL_OK; 92 | uint32_t msb = 31U; /* polynomial degree is 32 at most, so msb is initialized to max value */ 93 | 94 | /* Check the parameters */ 95 | assert_param(IS_CRC_POL_LENGTH(PolyLength)); 96 | 97 | /* Ensure that the generating polynomial is odd */ 98 | if ((Pol & (uint32_t)(0x1U)) == 0U) 99 | { 100 | status = HAL_ERROR; 101 | } 102 | else 103 | { 104 | /* check polynomial definition vs polynomial size: 105 | * polynomial length must be aligned with polynomial 106 | * definition. HAL_ERROR is reported if Pol degree is 107 | * larger than that indicated by PolyLength. 108 | * Look for MSB position: msb will contain the degree of 109 | * the second to the largest polynomial member. E.g., for 110 | * X^7 + X^6 + X^5 + X^2 + 1, msb = 6. */ 111 | while ((msb-- > 0U) && ((Pol & ((uint32_t)(0x1U) << (msb & 0x1FU))) == 0U)) 112 | { 113 | } 114 | 115 | switch (PolyLength) 116 | { 117 | 118 | case CRC_POLYLENGTH_7B: 119 | if (msb >= HAL_CRC_LENGTH_7B) 120 | { 121 | status = HAL_ERROR; 122 | } 123 | break; 124 | case CRC_POLYLENGTH_8B: 125 | if (msb >= HAL_CRC_LENGTH_8B) 126 | { 127 | status = HAL_ERROR; 128 | } 129 | break; 130 | case CRC_POLYLENGTH_16B: 131 | if (msb >= HAL_CRC_LENGTH_16B) 132 | { 133 | status = HAL_ERROR; 134 | } 135 | break; 136 | 137 | case CRC_POLYLENGTH_32B: 138 | /* no polynomial definition vs. polynomial length issue possible */ 139 | break; 140 | default: 141 | status = HAL_ERROR; 142 | break; 143 | } 144 | } 145 | if (status == HAL_OK) 146 | { 147 | /* set generating polynomial */ 148 | WRITE_REG(hcrc->Instance->POL, Pol); 149 | 150 | /* set generating polynomial size */ 151 | MODIFY_REG(hcrc->Instance->CR, CRC_CR_POLYSIZE, PolyLength); 152 | } 153 | /* Return function status */ 154 | return status; 155 | } 156 | 157 | /** 158 | * @brief Set the Reverse Input data mode. 159 | * @param hcrc CRC handle 160 | * @param InputReverseMode Input Data inversion mode. 161 | * This parameter can be one of the following values: 162 | * @arg @ref CRC_INPUTDATA_INVERSION_NONE no change in bit order (default value) 163 | * @arg @ref CRC_INPUTDATA_INVERSION_BYTE Byte-wise bit reversal 164 | * @arg @ref CRC_INPUTDATA_INVERSION_HALFWORD HalfWord-wise bit reversal 165 | * @arg @ref CRC_INPUTDATA_INVERSION_WORD Word-wise bit reversal 166 | * @retval HAL status 167 | */ 168 | HAL_StatusTypeDef HAL_CRCEx_Input_Data_Reverse(CRC_HandleTypeDef *hcrc, uint32_t InputReverseMode) 169 | { 170 | /* Check the parameters */ 171 | assert_param(IS_CRC_INPUTDATA_INVERSION_MODE(InputReverseMode)); 172 | 173 | /* Change CRC peripheral state */ 174 | hcrc->State = HAL_CRC_STATE_BUSY; 175 | 176 | /* set input data inversion mode */ 177 | MODIFY_REG(hcrc->Instance->CR, CRC_CR_REV_IN, InputReverseMode); 178 | /* Change CRC peripheral state */ 179 | hcrc->State = HAL_CRC_STATE_READY; 180 | 181 | /* Return function status */ 182 | return HAL_OK; 183 | } 184 | 185 | /** 186 | * @brief Set the Reverse Output data mode. 187 | * @param hcrc CRC handle 188 | * @param OutputReverseMode Output Data inversion mode. 189 | * This parameter can be one of the following values: 190 | * @arg @ref CRC_OUTPUTDATA_INVERSION_DISABLE no CRC inversion (default value) 191 | * @arg @ref CRC_OUTPUTDATA_INVERSION_ENABLE bit-level inversion (e.g. for a 8-bit CRC: 0xB5 becomes 0xAD) 192 | * @retval HAL status 193 | */ 194 | HAL_StatusTypeDef HAL_CRCEx_Output_Data_Reverse(CRC_HandleTypeDef *hcrc, uint32_t OutputReverseMode) 195 | { 196 | /* Check the parameters */ 197 | assert_param(IS_CRC_OUTPUTDATA_INVERSION_MODE(OutputReverseMode)); 198 | 199 | /* Change CRC peripheral state */ 200 | hcrc->State = HAL_CRC_STATE_BUSY; 201 | 202 | /* set output data inversion mode */ 203 | MODIFY_REG(hcrc->Instance->CR, CRC_CR_REV_OUT, OutputReverseMode); 204 | 205 | /* Change CRC peripheral state */ 206 | hcrc->State = HAL_CRC_STATE_READY; 207 | 208 | /* Return function status */ 209 | return HAL_OK; 210 | } 211 | 212 | 213 | /** 214 | * @} 215 | */ 216 | 217 | 218 | /** 219 | * @} 220 | */ 221 | 222 | 223 | #endif /* HAL_CRC_MODULE_ENABLED */ 224 | /** 225 | * @} 226 | */ 227 | 228 | /** 229 | * @} 230 | */ 231 | -------------------------------------------------------------------------------- /Src/stm32l0xx_hal_cryp_ex.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_hal_cryp_ex.c 4 | * @author MCD Application Team 5 | * @brief CRYPEx HAL module driver. 6 | * 7 | * This file provides firmware functions to manage the following 8 | * functionalities of the Cryptography (CRYP) extension peripheral: 9 | * + Computation completed callback. 10 | * 11 | ****************************************************************************** 12 | * @attention 13 | * 14 | * Copyright (c) 2016 STMicroelectronics. 15 | * All rights reserved. 16 | * 17 | * This software is licensed under terms that can be found in the LICENSE file 18 | * in the root directory of this software component. 19 | * If no LICENSE file comes with this software, it is provided AS-IS. 20 | * 21 | ****************************************************************************** 22 | */ 23 | 24 | #if defined (STM32L021xx) || defined (STM32L041xx) || defined (STM32L062xx) || defined (STM32L063xx) || defined (STM32L081xx) || defined (STM32L082xx) || defined (STM32L083xx) 25 | /* Includes ------------------------------------------------------------------*/ 26 | #include "stm32l0xx_hal.h" 27 | 28 | /** @addtogroup STM32L0xx_HAL_Driver 29 | * @{ 30 | */ 31 | #ifdef HAL_CRYP_MODULE_ENABLED 32 | 33 | 34 | /** @addtogroup CRYPEx 35 | * @brief CRYP HAL Extended module driver. 36 | * @{ 37 | */ 38 | 39 | 40 | /* Private typedef -----------------------------------------------------------*/ 41 | /* Private define ------------------------------------------------------------*/ 42 | /* Private macro -------------------------------------------------------------*/ 43 | /* Private variables ---------------------------------------------------------*/ 44 | /* Private function prototypes -----------------------------------------------*/ 45 | /* Private functions ---------------------------------------------------------*/ 46 | 47 | /** @addtogroup CRYPEx_Exported_Functions 48 | * @{ 49 | */ 50 | 51 | 52 | /** @addtogroup CRYPEx_Exported_Functions_Group1 53 | * @brief Extended features functions. 54 | * 55 | @verbatim 56 | =============================================================================== 57 | ##### Extended features functions ##### 58 | =============================================================================== 59 | [..] This section provides callback functions: 60 | (+) Computation completed. 61 | 62 | @endverbatim 63 | * @{ 64 | */ 65 | 66 | /** 67 | * @brief Computation completed callbacks. 68 | * @param hcryp pointer to a CRYP_HandleTypeDef structure that contains 69 | * the configuration information for CRYP module 70 | * @retval None 71 | */ 72 | __weak void HAL_CRYPEx_ComputationCpltCallback(CRYP_HandleTypeDef *hcryp) 73 | { 74 | /* Prevent unused argument(s) compilation warning */ 75 | UNUSED(hcryp); 76 | 77 | /* NOTE : This function Should not be modified, when the callback is needed, 78 | the HAL_CRYP_ComputationCpltCallback could be implemented in the user file 79 | */ 80 | } 81 | 82 | /** 83 | * @} 84 | */ 85 | 86 | 87 | /** 88 | * @} 89 | */ 90 | /** 91 | * @} 92 | */ 93 | 94 | #endif /* HAL_CRYP_MODULE_ENABLED */ 95 | 96 | /** 97 | * @} 98 | */ 99 | #endif /* STM32L021xx || STM32L041xx || STM32L062xx || STM32L063xx || STM32L081xx || STM32L082xx || STM32L083xx */ 100 | -------------------------------------------------------------------------------- /Src/stm32l0xx_hal_msp_template.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_hal_msp_template.c 4 | * @author MCD Application Team 5 | * @brief HAL MSP module. 6 | * This file template is located in the HAL folder and should be copied 7 | * to the user folder. 8 | * 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * Copyright (c) 2016 STMicroelectronics. 13 | * All rights reserved. 14 | * 15 | * This software is licensed under terms that can be found in the LICENSE file 16 | * in the root directory of this software component. 17 | * If no LICENSE file comes with this software, it is provided AS-IS. 18 | * 19 | ****************************************************************************** 20 | @verbatim 21 | =============================================================================== 22 | ##### How to use this driver ##### 23 | =============================================================================== 24 | [..] 25 | This file is eventually modified by the user. 26 | 27 | @endverbatim 28 | ****************************************************************************** 29 | */ 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32l0xx_hal.h" 33 | 34 | /** @addtogroup STM32L0xx_HAL_Driver 35 | * @{ 36 | */ 37 | 38 | /** @defgroup HAL_MSP 39 | * @brief HAL MSP module. 40 | * @{ 41 | */ 42 | 43 | /* Private typedef -----------------------------------------------------------*/ 44 | /* Private define ------------------------------------------------------------*/ 45 | /* Private macro -------------------------------------------------------------*/ 46 | /* Private variables ---------------------------------------------------------*/ 47 | /* Private function prototypes -----------------------------------------------*/ 48 | /* Private functions ---------------------------------------------------------*/ 49 | 50 | /** @defgroup HAL_MSP_Private_Functions 51 | * @{ 52 | */ 53 | 54 | /** 55 | * @brief Initializes the Global BSP. 56 | * @param None 57 | * @retval None 58 | */ 59 | void HAL_MspInit(void) 60 | { 61 | /* NOTE : This function is eventually modified by the user */ 62 | } 63 | 64 | /** 65 | * @brief DeInitializes the Global MSP. 66 | * @param None 67 | * @retval None 68 | */ 69 | void HAL_MspDeInit(void) 70 | { 71 | /* NOTE : This function is eventually modified by the user */ 72 | } 73 | 74 | /** 75 | * @brief Initializes the PPP MSP. 76 | * @param None 77 | * @retval None 78 | */ 79 | void HAL_PPP_MspInit(void) 80 | { 81 | /* NOTE : This function is eventually modified by the user */ 82 | } 83 | 84 | /** 85 | * @brief DeInitializes the PPP MSP. 86 | * @param None 87 | * @retval None 88 | */ 89 | void HAL_PPP_MspDeInit(void) 90 | { 91 | /* NOTE : This function is eventually modified by the user */ 92 | } 93 | 94 | /** 95 | * @} 96 | */ 97 | 98 | /** 99 | * @} 100 | */ 101 | 102 | /** 103 | * @} 104 | */ 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /Src/stm32l0xx_hal_pcd_ex.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_hal_pcd_ex.c 4 | * @author MCD Application Team 5 | * @brief PCD Extended HAL module driver. 6 | * This file provides firmware functions to manage the following 7 | * functionalities of the USB Peripheral Controller: 8 | * + Extended features functions 9 | * 10 | ****************************************************************************** 11 | * @attention 12 | * 13 | * Copyright (c) 2016 STMicroelectronics. 14 | * All rights reserved. 15 | * 16 | * This software is licensed under terms that can be found in the LICENSE file 17 | * in the root directory of this software component. 18 | * If no LICENSE file comes with this software, it is provided AS-IS. 19 | * 20 | ****************************************************************************** 21 | */ 22 | 23 | /* Includes ------------------------------------------------------------------*/ 24 | #include "stm32l0xx_hal.h" 25 | 26 | /** @addtogroup STM32L0xx_HAL_Driver 27 | * @{ 28 | */ 29 | 30 | /** @defgroup PCDEx PCDEx 31 | * @brief PCD Extended HAL module driver 32 | * @{ 33 | */ 34 | 35 | #ifdef HAL_PCD_MODULE_ENABLED 36 | 37 | #if defined (USB) 38 | /* Private types -------------------------------------------------------------*/ 39 | /* Private variables ---------------------------------------------------------*/ 40 | /* Private constants ---------------------------------------------------------*/ 41 | /* Private macros ------------------------------------------------------------*/ 42 | /* Private functions ---------------------------------------------------------*/ 43 | /* Exported functions --------------------------------------------------------*/ 44 | 45 | /** @defgroup PCDEx_Exported_Functions PCDEx Exported Functions 46 | * @{ 47 | */ 48 | 49 | /** @defgroup PCDEx_Exported_Functions_Group1 Peripheral Control functions 50 | * @brief PCDEx control functions 51 | * 52 | @verbatim 53 | =============================================================================== 54 | ##### Extended features functions ##### 55 | =============================================================================== 56 | [..] This section provides functions allowing to: 57 | (+) Update FIFO configuration 58 | 59 | @endverbatim 60 | * @{ 61 | */ 62 | 63 | /** 64 | * @brief Configure PMA for EP 65 | * @param hpcd Device instance 66 | * @param ep_addr endpoint address 67 | * @param ep_kind endpoint Kind 68 | * USB_SNG_BUF: Single Buffer used 69 | * USB_DBL_BUF: Double Buffer used 70 | * @param pmaadress: EP address in The PMA: In case of single buffer endpoint 71 | * this parameter is 16-bit value providing the address 72 | * in PMA allocated to endpoint. 73 | * In case of double buffer endpoint this parameter 74 | * is a 32-bit value providing the endpoint buffer 0 address 75 | * in the LSB part of 32-bit value and endpoint buffer 1 address 76 | * in the MSB part of 32-bit value. 77 | * @retval HAL status 78 | */ 79 | 80 | HAL_StatusTypeDef HAL_PCDEx_PMAConfig(PCD_HandleTypeDef *hpcd, uint16_t ep_addr, 81 | uint16_t ep_kind, uint32_t pmaadress) 82 | { 83 | PCD_EPTypeDef *ep; 84 | 85 | /* initialize ep structure*/ 86 | if ((0x80U & ep_addr) == 0x80U) 87 | { 88 | ep = &hpcd->IN_ep[ep_addr & EP_ADDR_MSK]; 89 | } 90 | else 91 | { 92 | ep = &hpcd->OUT_ep[ep_addr]; 93 | } 94 | 95 | /* Here we check if the endpoint is single or double Buffer*/ 96 | if (ep_kind == PCD_SNG_BUF) 97 | { 98 | /* Single Buffer */ 99 | ep->doublebuffer = 0U; 100 | /* Configure the PMA */ 101 | ep->pmaadress = (uint16_t)pmaadress; 102 | } 103 | #if (USE_USB_DOUBLE_BUFFER == 1U) 104 | else /* USB_DBL_BUF */ 105 | { 106 | /* Double Buffer Endpoint */ 107 | ep->doublebuffer = 1U; 108 | /* Configure the PMA */ 109 | ep->pmaaddr0 = (uint16_t)(pmaadress & 0xFFFFU); 110 | ep->pmaaddr1 = (uint16_t)((pmaadress & 0xFFFF0000U) >> 16); 111 | } 112 | #endif /* (USE_USB_DOUBLE_BUFFER == 1U) */ 113 | 114 | return HAL_OK; 115 | } 116 | 117 | /** 118 | * @brief Activate BatteryCharging feature. 119 | * @param hpcd PCD handle 120 | * @retval HAL status 121 | */ 122 | HAL_StatusTypeDef HAL_PCDEx_ActivateBCD(PCD_HandleTypeDef *hpcd) 123 | { 124 | USB_TypeDef *USBx = hpcd->Instance; 125 | hpcd->battery_charging_active = 1U; 126 | 127 | /* Enable BCD feature */ 128 | USBx->BCDR |= USB_BCDR_BCDEN; 129 | 130 | /* Enable DCD : Data Contact Detect */ 131 | USBx->BCDR &= ~(USB_BCDR_PDEN); 132 | USBx->BCDR &= ~(USB_BCDR_SDEN); 133 | USBx->BCDR |= USB_BCDR_DCDEN; 134 | 135 | return HAL_OK; 136 | } 137 | 138 | /** 139 | * @brief Deactivate BatteryCharging feature. 140 | * @param hpcd PCD handle 141 | * @retval HAL status 142 | */ 143 | HAL_StatusTypeDef HAL_PCDEx_DeActivateBCD(PCD_HandleTypeDef *hpcd) 144 | { 145 | USB_TypeDef *USBx = hpcd->Instance; 146 | hpcd->battery_charging_active = 0U; 147 | 148 | /* Disable BCD feature */ 149 | USBx->BCDR &= ~(USB_BCDR_BCDEN); 150 | 151 | return HAL_OK; 152 | } 153 | 154 | /** 155 | * @brief Handle BatteryCharging Process. 156 | * @param hpcd PCD handle 157 | * @retval HAL status 158 | */ 159 | void HAL_PCDEx_BCD_VBUSDetect(PCD_HandleTypeDef *hpcd) 160 | { 161 | USB_TypeDef *USBx = hpcd->Instance; 162 | uint32_t tickstart = HAL_GetTick(); 163 | 164 | /* Wait for Min DCD Timeout */ 165 | HAL_Delay(300U); 166 | 167 | /* Data Pin Contact ? Check Detect flag */ 168 | if ((USBx->BCDR & USB_BCDR_DCDET) == USB_BCDR_DCDET) 169 | { 170 | #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) 171 | hpcd->BCDCallback(hpcd, PCD_BCD_CONTACT_DETECTION); 172 | #else 173 | HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_CONTACT_DETECTION); 174 | #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ 175 | } 176 | /* Primary detection: checks if connected to Standard Downstream Port 177 | (without charging capability) */ 178 | USBx->BCDR &= ~(USB_BCDR_DCDEN); 179 | HAL_Delay(50U); 180 | USBx->BCDR |= (USB_BCDR_PDEN); 181 | HAL_Delay(50U); 182 | 183 | /* If Charger detect ? */ 184 | if ((USBx->BCDR & USB_BCDR_PDET) == USB_BCDR_PDET) 185 | { 186 | /* Start secondary detection to check connection to Charging Downstream 187 | Port or Dedicated Charging Port */ 188 | USBx->BCDR &= ~(USB_BCDR_PDEN); 189 | HAL_Delay(50U); 190 | USBx->BCDR |= (USB_BCDR_SDEN); 191 | HAL_Delay(50U); 192 | 193 | /* If CDP ? */ 194 | if ((USBx->BCDR & USB_BCDR_SDET) == USB_BCDR_SDET) 195 | { 196 | /* Dedicated Downstream Port DCP */ 197 | #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) 198 | hpcd->BCDCallback(hpcd, PCD_BCD_DEDICATED_CHARGING_PORT); 199 | #else 200 | HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_DEDICATED_CHARGING_PORT); 201 | #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ 202 | } 203 | else 204 | { 205 | /* Charging Downstream Port CDP */ 206 | #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) 207 | hpcd->BCDCallback(hpcd, PCD_BCD_CHARGING_DOWNSTREAM_PORT); 208 | #else 209 | HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_CHARGING_DOWNSTREAM_PORT); 210 | #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ 211 | } 212 | } 213 | else /* NO */ 214 | { 215 | /* Standard Downstream Port */ 216 | #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) 217 | hpcd->BCDCallback(hpcd, PCD_BCD_STD_DOWNSTREAM_PORT); 218 | #else 219 | HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_STD_DOWNSTREAM_PORT); 220 | #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ 221 | } 222 | 223 | /* Battery Charging capability discovery finished Start Enumeration */ 224 | (void)HAL_PCDEx_DeActivateBCD(hpcd); 225 | 226 | /* Check for the Timeout, else start USB Device */ 227 | if ((HAL_GetTick() - tickstart) > 1000U) 228 | { 229 | #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) 230 | hpcd->BCDCallback(hpcd, PCD_BCD_ERROR); 231 | #else 232 | HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_ERROR); 233 | #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ 234 | } 235 | else 236 | { 237 | #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) 238 | hpcd->BCDCallback(hpcd, PCD_BCD_DISCOVERY_COMPLETED); 239 | #else 240 | HAL_PCDEx_BCD_Callback(hpcd, PCD_BCD_DISCOVERY_COMPLETED); 241 | #endif /* USE_HAL_PCD_REGISTER_CALLBACKS */ 242 | } 243 | } 244 | 245 | /** 246 | * @brief Activate LPM feature. 247 | * @param hpcd PCD handle 248 | * @retval HAL status 249 | */ 250 | HAL_StatusTypeDef HAL_PCDEx_ActivateLPM(PCD_HandleTypeDef *hpcd) 251 | { 252 | 253 | USB_TypeDef *USBx = hpcd->Instance; 254 | hpcd->lpm_active = 1U; 255 | hpcd->LPM_State = LPM_L0; 256 | 257 | USBx->LPMCSR |= USB_LPMCSR_LMPEN; 258 | USBx->LPMCSR |= USB_LPMCSR_LPMACK; 259 | 260 | return HAL_OK; 261 | } 262 | 263 | /** 264 | * @brief Deactivate LPM feature. 265 | * @param hpcd PCD handle 266 | * @retval HAL status 267 | */ 268 | HAL_StatusTypeDef HAL_PCDEx_DeActivateLPM(PCD_HandleTypeDef *hpcd) 269 | { 270 | USB_TypeDef *USBx = hpcd->Instance; 271 | 272 | hpcd->lpm_active = 0U; 273 | 274 | USBx->LPMCSR &= ~(USB_LPMCSR_LMPEN); 275 | USBx->LPMCSR &= ~(USB_LPMCSR_LPMACK); 276 | 277 | return HAL_OK; 278 | } 279 | 280 | 281 | /** 282 | * @brief Send LPM message to user layer callback. 283 | * @param hpcd PCD handle 284 | * @param msg LPM message 285 | * @retval HAL status 286 | */ 287 | __weak void HAL_PCDEx_LPM_Callback(PCD_HandleTypeDef *hpcd, PCD_LPM_MsgTypeDef msg) 288 | { 289 | /* Prevent unused argument(s) compilation warning */ 290 | UNUSED(hpcd); 291 | UNUSED(msg); 292 | 293 | /* NOTE : This function should not be modified, when the callback is needed, 294 | the HAL_PCDEx_LPM_Callback could be implemented in the user file 295 | */ 296 | } 297 | 298 | /** 299 | * @brief Send BatteryCharging message to user layer callback. 300 | * @param hpcd PCD handle 301 | * @param msg LPM message 302 | * @retval HAL status 303 | */ 304 | __weak void HAL_PCDEx_BCD_Callback(PCD_HandleTypeDef *hpcd, PCD_BCD_MsgTypeDef msg) 305 | { 306 | /* Prevent unused argument(s) compilation warning */ 307 | UNUSED(hpcd); 308 | UNUSED(msg); 309 | 310 | /* NOTE : This function should not be modified, when the callback is needed, 311 | the HAL_PCDEx_BCD_Callback could be implemented in the user file 312 | */ 313 | } 314 | 315 | /** 316 | * @} 317 | */ 318 | 319 | /** 320 | * @} 321 | */ 322 | #endif /* defined (USB) */ 323 | #endif /* HAL_PCD_MODULE_ENABLED */ 324 | 325 | /** 326 | * @} 327 | */ 328 | 329 | /** 330 | * @} 331 | */ 332 | -------------------------------------------------------------------------------- /Src/stm32l0xx_hal_pwr_ex.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_hal_pwr_ex.c 4 | * @author MCD Application Team 5 | * @brief Extended PWR HAL module driver. 6 | * This file provides firmware functions to manage the following 7 | * functionalities of the Power Controller (PWR) peripheral: 8 | * + Extended Initialization and de-initialization functions 9 | * + Extended Peripheral Control functions 10 | * 11 | ****************************************************************************** 12 | * @attention 13 | * 14 | * Copyright (c) 2016 STMicroelectronics. 15 | * All rights reserved. 16 | * 17 | * This software is licensed under terms that can be found in the LICENSE file 18 | * in the root directory of this software component. 19 | * If no LICENSE file comes with this software, it is provided AS-IS. 20 | * 21 | ****************************************************************************** 22 | */ 23 | 24 | /* Includes ------------------------------------------------------------------*/ 25 | #include "stm32l0xx_hal.h" 26 | 27 | #ifdef HAL_PWR_MODULE_ENABLED 28 | /** @addtogroup STM32L0xx_HAL_Driver 29 | * @{ 30 | */ 31 | 32 | /** @addtogroup PWREx 33 | * @{ 34 | */ 35 | 36 | /** @addtogroup PWREx_Private 37 | * @{ 38 | */ 39 | 40 | /** @defgroup PWR_Extended_TimeOut_Value PWREx Flag Setting Time Out Value 41 | * @{ 42 | */ 43 | #define PWR_FLAG_SETTING_DELAY_US 50U 44 | /** 45 | * @} 46 | */ 47 | 48 | /** 49 | * @} 50 | */ 51 | 52 | 53 | /** @addtogroup PWREx_Exported_Functions 54 | * @brief Low Power modes configuration functions 55 | * 56 | @verbatim 57 | 58 | =============================================================================== 59 | ##### Peripheral extended features functions ##### 60 | =============================================================================== 61 | @endverbatim 62 | * @{ 63 | */ 64 | 65 | /** 66 | * @brief Return Voltage Scaling Range. 67 | * @retval VOS bit field (PWR_REGULATOR_VOLTAGE_SCALE1, PWR_REGULATOR_VOLTAGE_SCALE2 or PWR_REGULATOR_VOLTAGE_SCALE3) 68 | */ 69 | uint32_t HAL_PWREx_GetVoltageRange(void) 70 | { 71 | return (PWR->CR & PWR_CR_VOS); 72 | } 73 | 74 | 75 | /** 76 | * @brief Enables the Fast WakeUp from Ultra Low Power mode. 77 | * @note This bit works in conjunction with ULP bit. 78 | * Means, when ULP = 1 and FWU = 1 :VREFINT startup time is ignored when 79 | * exiting from low power mode. 80 | * @retval None 81 | */ 82 | void HAL_PWREx_EnableFastWakeUp(void) 83 | { 84 | /* Enable the fast wake up */ 85 | SET_BIT(PWR->CR, PWR_CR_FWU); 86 | } 87 | 88 | /** 89 | * @brief Disables the Fast WakeUp from Ultra Low Power mode. 90 | * @retval None 91 | */ 92 | void HAL_PWREx_DisableFastWakeUp(void) 93 | { 94 | /* Disable the fast wake up */ 95 | CLEAR_BIT(PWR->CR, PWR_CR_FWU); 96 | } 97 | 98 | /** 99 | * @brief Enables the Ultra Low Power mode 100 | * @retval None 101 | */ 102 | void HAL_PWREx_EnableUltraLowPower(void) 103 | { 104 | /* Enable the Ultra Low Power mode */ 105 | SET_BIT(PWR->CR, PWR_CR_ULP); 106 | } 107 | 108 | /** 109 | * @brief Disables the Ultra Low Power mode 110 | * @retval None 111 | */ 112 | void HAL_PWREx_DisableUltraLowPower(void) 113 | { 114 | /* Disable the Ultra Low Power mode */ 115 | CLEAR_BIT(PWR->CR, PWR_CR_ULP); 116 | } 117 | 118 | /** 119 | * @brief Enable the Low Power Run mode. 120 | * @note Low power run mode can only be entered when VCORE is in range 2. 121 | * In addition, the dynamic voltage scaling must not be used when Low 122 | * power run mode is selected. Only Stop and Sleep modes with regulator 123 | * configured in Low power mode is allowed when Low power run mode is 124 | * selected. 125 | * @note The frequency of the system clock must be decreased to not exceed the 126 | * frequency of RCC_MSIRANGE_1. 127 | * @note In Low power run mode, all I/O pins keep the same state as in Run mode. 128 | * @retval None 129 | */ 130 | void HAL_PWREx_EnableLowPowerRunMode(void) 131 | { 132 | /* Enters the Low Power Run mode */ 133 | SET_BIT(PWR->CR, PWR_CR_LPSDSR); 134 | SET_BIT(PWR->CR, PWR_CR_LPRUN); 135 | } 136 | 137 | /** 138 | * @brief Disable the Low Power Run mode. 139 | * @note Before HAL_PWREx_DisableLowPowerRunMode() completion, the function checks that 140 | * REGLPF has been properly reset (otherwise, HAL_PWREx_DisableLowPowerRunMode 141 | * returns HAL_TIMEOUT status). The system clock frequency can then be 142 | * increased above 2 MHz. 143 | * @retval HAL_StatusTypeDef 144 | */ 145 | HAL_StatusTypeDef HAL_PWREx_DisableLowPowerRunMode(void) 146 | { 147 | uint32_t wait_loop_index = 0U; 148 | 149 | /* Exit the Low Power Run mode */ 150 | CLEAR_BIT(PWR->CR, PWR_CR_LPRUN); 151 | CLEAR_BIT(PWR->CR, PWR_CR_LPSDSR); 152 | 153 | /* Wait until REGLPF is reset */ 154 | wait_loop_index = (PWR_FLAG_SETTING_DELAY_US * (SystemCoreClock / 1000000U)); 155 | 156 | while ((wait_loop_index != 0U) && (HAL_IS_BIT_SET(PWR->CSR, PWR_CSR_REGLPF))) 157 | { 158 | wait_loop_index--; 159 | } 160 | 161 | if (HAL_IS_BIT_SET(PWR->CSR, PWR_CSR_REGLPF)) 162 | { 163 | return HAL_TIMEOUT; 164 | } 165 | 166 | return HAL_OK; 167 | } 168 | 169 | /** 170 | * @} 171 | */ 172 | 173 | /** 174 | * @} 175 | */ 176 | 177 | /** 178 | * @} 179 | */ 180 | #endif /* HAL_PWR_MODULE_ENABLED */ 181 | -------------------------------------------------------------------------------- /Src/stm32l0xx_hal_smartcard_ex.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_hal_smartcard_ex.c 4 | * @author MCD Application Team 5 | * @brief SMARTCARD HAL module driver. 6 | * This file provides extended firmware functions to manage the following 7 | * functionalities of the SmartCard. 8 | * + Initialization and de-initialization functions 9 | * + Peripheral Control functions 10 | * 11 | ****************************************************************************** 12 | * @attention 13 | * 14 | * Copyright (c) 2016 STMicroelectronics. 15 | * All rights reserved. 16 | * 17 | * This software is licensed under terms that can be found in the LICENSE file 18 | * in the root directory of this software component. 19 | * If no LICENSE file comes with this software, it is provided AS-IS. 20 | * 21 | ****************************************************************************** 22 | @verbatim 23 | ============================================================================= 24 | ##### SMARTCARD peripheral extended features ##### 25 | ============================================================================= 26 | [..] 27 | The Extended SMARTCARD HAL driver can be used as follows: 28 | 29 | (#) After having configured the SMARTCARD basic features with HAL_SMARTCARD_Init(), 30 | then program SMARTCARD advanced features if required (TX/RX pins swap, TimeOut, 31 | auto-retry counter,...) in the hsmartcard AdvancedInit structure. 32 | @endverbatim 33 | ****************************************************************************** 34 | */ 35 | 36 | #if !defined (STM32L010x4) && !defined (STM32L010x6) 37 | /* Includes ------------------------------------------------------------------*/ 38 | #include "stm32l0xx_hal.h" 39 | 40 | /** @addtogroup STM32L0xx_HAL_Driver 41 | * @{ 42 | */ 43 | 44 | /** @defgroup SMARTCARDEx SMARTCARDEx 45 | * @brief SMARTCARD Extended HAL module driver 46 | * @{ 47 | */ 48 | #ifdef HAL_SMARTCARD_MODULE_ENABLED 49 | 50 | /* Private typedef -----------------------------------------------------------*/ 51 | /* Private define ------------------------------------------------------------*/ 52 | /* Private macros ------------------------------------------------------------*/ 53 | /* Private variables ---------------------------------------------------------*/ 54 | /* Private function prototypes -----------------------------------------------*/ 55 | /* Exported functions --------------------------------------------------------*/ 56 | /** @defgroup SMARTCARDEx_Exported_Functions SMARTCARD Extended Exported Functions 57 | * @{ 58 | */ 59 | 60 | /** @defgroup SMARTCARDEx_Exported_Functions_Group1 Extended Peripheral Control functions 61 | * @brief Extended control functions 62 | * 63 | @verbatim 64 | =============================================================================== 65 | ##### Peripheral Control functions ##### 66 | =============================================================================== 67 | [..] 68 | This subsection provides a set of functions allowing to initialize the SMARTCARD. 69 | (+) HAL_SMARTCARDEx_BlockLength_Config() API allows to configure the Block Length on the fly 70 | (+) HAL_SMARTCARDEx_TimeOut_Config() API allows to configure the receiver timeout value on the fly 71 | (+) HAL_SMARTCARDEx_EnableReceiverTimeOut() API enables the receiver timeout feature 72 | (+) HAL_SMARTCARDEx_DisableReceiverTimeOut() API disables the receiver timeout feature 73 | 74 | @endverbatim 75 | * @{ 76 | */ 77 | 78 | /** @brief Update on the fly the SMARTCARD block length in RTOR register. 79 | * @param hsmartcard Pointer to a SMARTCARD_HandleTypeDef structure that contains 80 | * the configuration information for the specified SMARTCARD module. 81 | * @param BlockLength SMARTCARD block length (8-bit long at most) 82 | * @retval None 83 | */ 84 | void HAL_SMARTCARDEx_BlockLength_Config(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t BlockLength) 85 | { 86 | MODIFY_REG(hsmartcard->Instance->RTOR, USART_RTOR_BLEN, ((uint32_t)BlockLength << USART_RTOR_BLEN_Pos)); 87 | } 88 | 89 | /** @brief Update on the fly the receiver timeout value in RTOR register. 90 | * @param hsmartcard Pointer to a SMARTCARD_HandleTypeDef structure that contains 91 | * the configuration information for the specified SMARTCARD module. 92 | * @param TimeOutValue receiver timeout value in number of baud blocks. The timeout 93 | * value must be less or equal to 0x0FFFFFFFF. 94 | * @retval None 95 | */ 96 | void HAL_SMARTCARDEx_TimeOut_Config(SMARTCARD_HandleTypeDef *hsmartcard, uint32_t TimeOutValue) 97 | { 98 | assert_param(IS_SMARTCARD_TIMEOUT_VALUE(hsmartcard->Init.TimeOutValue)); 99 | MODIFY_REG(hsmartcard->Instance->RTOR, USART_RTOR_RTO, TimeOutValue); 100 | } 101 | 102 | /** @brief Enable the SMARTCARD receiver timeout feature. 103 | * @param hsmartcard Pointer to a SMARTCARD_HandleTypeDef structure that contains 104 | * the configuration information for the specified SMARTCARD module. 105 | * @retval HAL status 106 | */ 107 | HAL_StatusTypeDef HAL_SMARTCARDEx_EnableReceiverTimeOut(SMARTCARD_HandleTypeDef *hsmartcard) 108 | { 109 | if (hsmartcard->gState == HAL_SMARTCARD_STATE_READY) 110 | { 111 | /* Process Locked */ 112 | __HAL_LOCK(hsmartcard); 113 | 114 | hsmartcard->gState = HAL_SMARTCARD_STATE_BUSY; 115 | 116 | /* Set the USART RTOEN bit */ 117 | SET_BIT(hsmartcard->Instance->CR2, USART_CR2_RTOEN); 118 | 119 | hsmartcard->gState = HAL_SMARTCARD_STATE_READY; 120 | 121 | /* Process Unlocked */ 122 | __HAL_UNLOCK(hsmartcard); 123 | 124 | return HAL_OK; 125 | } 126 | else 127 | { 128 | return HAL_BUSY; 129 | } 130 | } 131 | 132 | /** @brief Disable the SMARTCARD receiver timeout feature. 133 | * @param hsmartcard Pointer to a SMARTCARD_HandleTypeDef structure that contains 134 | * the configuration information for the specified SMARTCARD module. 135 | * @retval HAL status 136 | */ 137 | HAL_StatusTypeDef HAL_SMARTCARDEx_DisableReceiverTimeOut(SMARTCARD_HandleTypeDef *hsmartcard) 138 | { 139 | if (hsmartcard->gState == HAL_SMARTCARD_STATE_READY) 140 | { 141 | /* Process Locked */ 142 | __HAL_LOCK(hsmartcard); 143 | 144 | hsmartcard->gState = HAL_SMARTCARD_STATE_BUSY; 145 | 146 | /* Clear the USART RTOEN bit */ 147 | CLEAR_BIT(hsmartcard->Instance->CR2, USART_CR2_RTOEN); 148 | 149 | hsmartcard->gState = HAL_SMARTCARD_STATE_READY; 150 | 151 | /* Process Unlocked */ 152 | __HAL_UNLOCK(hsmartcard); 153 | 154 | return HAL_OK; 155 | } 156 | else 157 | { 158 | return HAL_BUSY; 159 | } 160 | } 161 | 162 | /** 163 | * @} 164 | */ 165 | 166 | /** @defgroup SMARTCARDEx_Exported_Functions_Group2 Extended Peripheral IO operation functions 167 | * @brief SMARTCARD Transmit and Receive functions 168 | * 169 | * @{ 170 | */ 171 | 172 | /** 173 | * @} 174 | */ 175 | 176 | 177 | /** 178 | * @} 179 | */ 180 | 181 | /** @defgroup SMARTCARDEx_Private_Functions SMARTCARD Extended Private Functions 182 | * @{ 183 | */ 184 | 185 | /** 186 | * @} 187 | */ 188 | 189 | #endif /* HAL_SMARTCARD_MODULE_ENABLED */ 190 | 191 | /** 192 | * @} 193 | */ 194 | 195 | /** 196 | * @} 197 | */ 198 | #endif /* !defined (STM32L010x4) && !defined (STM32L010x6) */ 199 | 200 | -------------------------------------------------------------------------------- /Src/stm32l0xx_hal_smbus_ex.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_hal_smbus_ex.c 4 | * @author MCD Application Team 5 | * @brief SMBUS Extended HAL module driver. 6 | * This file provides firmware functions to manage the following 7 | * functionalities of SMBUS Extended peripheral: 8 | * + Extended features functions 9 | * + WakeUp Mode Functions 10 | * + FastModePlus Functions 11 | * 12 | ****************************************************************************** 13 | * @attention 14 | * 15 | * Copyright (c) 2016 STMicroelectronics. 16 | * All rights reserved. 17 | * 18 | * This software is licensed under terms that can be found in the LICENSE file 19 | * in the root directory of this software component. 20 | * If no LICENSE file comes with this software, it is provided AS-IS. 21 | * 22 | ****************************************************************************** 23 | @verbatim 24 | ============================================================================== 25 | ##### SMBUS peripheral Extended features ##### 26 | ============================================================================== 27 | 28 | [..] Comparing to other previous devices, the SMBUS interface for STM32L0xx 29 | devices contains the following additional features 30 | 31 | (+) Disable or enable wakeup from Stop mode(s) 32 | (+) Disable or enable Fast Mode Plus 33 | 34 | ##### How to use this driver ##### 35 | ============================================================================== 36 | (#) Configure the enable or disable of SMBUS Wake Up Mode using the functions : 37 | (++) HAL_SMBUSEx_EnableWakeUp() 38 | (++) HAL_SMBUSEx_DisableWakeUp() 39 | (#) Configure the enable or disable of fast mode plus driving capability using the functions : 40 | (++) HAL_SMBUSEx_EnableFastModePlus() 41 | (++) HAL_SMBUSEx_DisableFastModePlus() 42 | @endverbatim 43 | */ 44 | 45 | /* Includes ------------------------------------------------------------------*/ 46 | #include "stm32l0xx_hal.h" 47 | 48 | /** @addtogroup STM32L0xx_HAL_Driver 49 | * @{ 50 | */ 51 | 52 | /** @defgroup SMBUSEx SMBUSEx 53 | * @brief SMBUS Extended HAL module driver 54 | * @{ 55 | */ 56 | 57 | #ifdef HAL_SMBUS_MODULE_ENABLED 58 | 59 | /* Private typedef -----------------------------------------------------------*/ 60 | /* Private define ------------------------------------------------------------*/ 61 | /* Private macro -------------------------------------------------------------*/ 62 | /* Private variables ---------------------------------------------------------*/ 63 | /* Private function prototypes -----------------------------------------------*/ 64 | /* Private functions ---------------------------------------------------------*/ 65 | 66 | /** @defgroup SMBUSEx_Exported_Functions SMBUS Extended Exported Functions 67 | * @{ 68 | */ 69 | 70 | /** @defgroup SMBUSEx_Exported_Functions_Group2 WakeUp Mode Functions 71 | * @brief WakeUp Mode Functions 72 | * 73 | @verbatim 74 | =============================================================================== 75 | ##### WakeUp Mode Functions ##### 76 | =============================================================================== 77 | [..] This section provides functions allowing to: 78 | (+) Configure Wake Up Feature 79 | 80 | @endverbatim 81 | * @{ 82 | */ 83 | 84 | /** 85 | * @brief Enable SMBUS wakeup from Stop mode(s). 86 | * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains 87 | * the configuration information for the specified SMBUSx peripheral. 88 | * @retval HAL status 89 | */ 90 | HAL_StatusTypeDef HAL_SMBUSEx_EnableWakeUp(SMBUS_HandleTypeDef *hsmbus) 91 | { 92 | /* Check the parameters */ 93 | assert_param(IS_I2C_WAKEUP_FROMSTOP_INSTANCE(hsmbus->Instance)); 94 | 95 | if (hsmbus->State == HAL_SMBUS_STATE_READY) 96 | { 97 | /* Process Locked */ 98 | __HAL_LOCK(hsmbus); 99 | 100 | hsmbus->State = HAL_SMBUS_STATE_BUSY; 101 | 102 | /* Disable the selected SMBUS peripheral */ 103 | __HAL_SMBUS_DISABLE(hsmbus); 104 | 105 | /* Enable wakeup from stop mode */ 106 | hsmbus->Instance->CR1 |= I2C_CR1_WUPEN; 107 | 108 | __HAL_SMBUS_ENABLE(hsmbus); 109 | 110 | hsmbus->State = HAL_SMBUS_STATE_READY; 111 | 112 | /* Process Unlocked */ 113 | __HAL_UNLOCK(hsmbus); 114 | 115 | return HAL_OK; 116 | } 117 | else 118 | { 119 | return HAL_BUSY; 120 | } 121 | } 122 | 123 | /** 124 | * @brief Disable SMBUS wakeup from Stop mode(s). 125 | * @param hsmbus Pointer to a SMBUS_HandleTypeDef structure that contains 126 | * the configuration information for the specified SMBUSx peripheral. 127 | * @retval HAL status 128 | */ 129 | HAL_StatusTypeDef HAL_SMBUSEx_DisableWakeUp(SMBUS_HandleTypeDef *hsmbus) 130 | { 131 | /* Check the parameters */ 132 | assert_param(IS_I2C_WAKEUP_FROMSTOP_INSTANCE(hsmbus->Instance)); 133 | 134 | if (hsmbus->State == HAL_SMBUS_STATE_READY) 135 | { 136 | /* Process Locked */ 137 | __HAL_LOCK(hsmbus); 138 | 139 | hsmbus->State = HAL_SMBUS_STATE_BUSY; 140 | 141 | /* Disable the selected SMBUS peripheral */ 142 | __HAL_SMBUS_DISABLE(hsmbus); 143 | 144 | /* Disable wakeup from stop mode */ 145 | hsmbus->Instance->CR1 &= ~(I2C_CR1_WUPEN); 146 | 147 | __HAL_SMBUS_ENABLE(hsmbus); 148 | 149 | hsmbus->State = HAL_SMBUS_STATE_READY; 150 | 151 | /* Process Unlocked */ 152 | __HAL_UNLOCK(hsmbus); 153 | 154 | return HAL_OK; 155 | } 156 | else 157 | { 158 | return HAL_BUSY; 159 | } 160 | } 161 | /** 162 | * @} 163 | */ 164 | #if (defined(SYSCFG_CFGR2_I2C_PB6_FMP) || defined(SYSCFG_CFGR2_I2C_PB7_FMP)) || (defined(SYSCFG_CFGR2_I2C_PB8_FMP) || defined(SYSCFG_CFGR2_I2C_PB9_FMP)) || (defined(SYSCFG_CFGR2_I2C1_FMP)) || defined(SYSCFG_CFGR2_I2C2_FMP) || defined(SYSCFG_CFGR2_I2C3_FMP) 165 | 166 | /** @defgroup SMBUSEx_Exported_Functions_Group3 Fast Mode Plus Functions 167 | * @brief Fast Mode Plus Functions 168 | * 169 | @verbatim 170 | =============================================================================== 171 | ##### Fast Mode Plus Functions ##### 172 | =============================================================================== 173 | [..] This section provides functions allowing to: 174 | (+) Configure Fast Mode Plus 175 | 176 | @endverbatim 177 | * @{ 178 | */ 179 | 180 | /** 181 | * @brief Enable the SMBUS fast mode plus driving capability. 182 | * @param ConfigFastModePlus Selects the pin. 183 | * This parameter can be one of the @ref SMBUSEx_FastModePlus values 184 | * @note For I2C1, fast mode plus driving capability can be enabled on all selected 185 | * I2C1 pins using SMBUS_FASTMODEPLUS_I2C1 parameter or independently 186 | * on each one of the following pins PB6, PB7, PB8 and PB9. 187 | * @note For remaining I2C1 pins (PA14, PA15...) fast mode plus driving capability 188 | * can be enabled only by using SMBUS_FASTMODEPLUS_I2C1 parameter. 189 | * @note For all I2C2 pins fast mode plus driving capability can be enabled 190 | * only by using SMBUS_FASTMODEPLUS_I2C2 parameter. 191 | * @note For all I2C3 pins fast mode plus driving capability can be enabled 192 | * only by using SMBUS_FASTMODEPLUS_I2C3 parameter. 193 | * @retval None 194 | */ 195 | void HAL_SMBUSEx_EnableFastModePlus(uint32_t ConfigFastModePlus) 196 | { 197 | /* Check the parameter */ 198 | assert_param(IS_SMBUS_FASTMODEPLUS(ConfigFastModePlus)); 199 | 200 | /* Enable SYSCFG clock */ 201 | __HAL_RCC_SYSCFG_CLK_ENABLE(); 202 | 203 | /* Enable fast mode plus driving capability for selected pin */ 204 | SET_BIT(SYSCFG->CFGR2, (uint32_t)ConfigFastModePlus); 205 | } 206 | 207 | /** 208 | * @brief Disable the SMBUS fast mode plus driving capability. 209 | * @param ConfigFastModePlus Selects the pin. 210 | * This parameter can be one of the @ref SMBUSEx_FastModePlus values 211 | * @note For I2C1, fast mode plus driving capability can be disabled on all selected 212 | * I2C1 pins using SMBUS_FASTMODEPLUS_I2C1 parameter or independently 213 | * on each one of the following pins PB6, PB7, PB8 and PB9. 214 | * @note For remaining I2C1 pins (PA14, PA15...) fast mode plus driving capability 215 | * can be disabled only by using SMBUS_FASTMODEPLUS_I2C1 parameter. 216 | * @note For all I2C2 pins fast mode plus driving capability can be disabled 217 | * only by using SMBUS_FASTMODEPLUS_I2C2 parameter. 218 | * @note For all I2C3 pins fast mode plus driving capability can be disabled 219 | * only by using SMBUS_FASTMODEPLUS_I2C3 parameter. 220 | * @retval None 221 | */ 222 | void HAL_SMBUSEx_DisableFastModePlus(uint32_t ConfigFastModePlus) 223 | { 224 | /* Check the parameter */ 225 | assert_param(IS_SMBUS_FASTMODEPLUS(ConfigFastModePlus)); 226 | 227 | /* Enable SYSCFG clock */ 228 | __HAL_RCC_SYSCFG_CLK_ENABLE(); 229 | 230 | /* Disable fast mode plus driving capability for selected pin */ 231 | CLEAR_BIT(SYSCFG->CFGR2, (uint32_t)ConfigFastModePlus); 232 | } 233 | 234 | /** 235 | * @} 236 | */ 237 | 238 | #endif /* Fast Mode Plus Availability */ 239 | /** 240 | * @} 241 | */ 242 | 243 | /** 244 | * @} 245 | */ 246 | 247 | #endif /* HAL_SMBUS_MODULE_ENABLED */ 248 | /** 249 | * @} 250 | */ 251 | 252 | /** 253 | * @} 254 | */ 255 | -------------------------------------------------------------------------------- /Src/stm32l0xx_hal_timebase_tim_template.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_hal_timebase_tim_template.c 4 | * @author MCD Application Team 5 | * @brief HAL time base based on the hardware TIM Template. 6 | * 7 | * This file override the native HAL time base functions (defined as weak) 8 | * the TIM time base: 9 | * + Initializes the TIM peripheral to generate a Period elapsed Event each 1ms 10 | * + HAL_IncTick is called inside HAL_TIM_PeriodElapsedCallback ie each 1ms 11 | * 12 | ****************************************************************************** 13 | * @attention 14 | * 15 | * Copyright (c) 2016 STMicroelectronics. 16 | * All rights reserved. 17 | * 18 | * This software is licensed under terms that can be found in the LICENSE file 19 | * in the root directory of this software component. 20 | * If no LICENSE file comes with this software, it is provided AS-IS. 21 | * 22 | ****************************************************************************** 23 | @verbatim 24 | ============================================================================== 25 | ##### How to use this driver ##### 26 | ============================================================================== 27 | [..] 28 | This file must be copied to the application folder and modified as follows: 29 | (#) Rename it to 'stm32l0xx_hal_timebase_tim.c' 30 | (#) Add this file and the TIM HAL driver files to your project and make sure 31 | HAL_TIM_MODULE_ENABLED is defined in stm32l0xx_hal_conf.h 32 | 33 | [..] 34 | (@) The application needs to ensure that the time base is always set to 1 millisecond 35 | to have correct HAL operation. 36 | 37 | @endverbatim 38 | ****************************************************************************** 39 | */ 40 | 41 | /* Includes ------------------------------------------------------------------*/ 42 | #include "stm32l0xx_hal.h" 43 | 44 | /** @addtogroup STM32L0xx_HAL_Driver 45 | * @{ 46 | */ 47 | 48 | /** @addtogroup HAL_TimeBase 49 | * @{ 50 | */ 51 | 52 | /* Private typedef -----------------------------------------------------------*/ 53 | /* Private define ------------------------------------------------------------*/ 54 | /* Private macro -------------------------------------------------------------*/ 55 | /* Private variables ---------------------------------------------------------*/ 56 | TIM_HandleTypeDef TimHandle; 57 | /* Private function prototypes -----------------------------------------------*/ 58 | void TIM21_IRQHandler(void); 59 | /* Private functions ---------------------------------------------------------*/ 60 | 61 | /** 62 | * @brief This function configures the TIM21 as a time base source. 63 | * The time source is configured to have 1ms time base with a dedicated 64 | * Tick interrupt priority. 65 | * @note This function is called automatically at the beginning of program after 66 | * reset by HAL_Init() or at any time when clock is configured, by HAL_RCC_ClockConfig(). 67 | * @param TickPriority: Tick interrupt priority. 68 | * @retval HAL status 69 | */ 70 | HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) 71 | { 72 | RCC_ClkInitTypeDef clkconfig; 73 | uint32_t uwTimclock; 74 | uint32_t uwAPB2Prescaler; 75 | uint32_t uwPrescalerValue; 76 | uint32_t pFLatency; 77 | HAL_StatusTypeDef status; 78 | 79 | /* Configure the TIM21 IRQ priority */ 80 | HAL_NVIC_SetPriority(TIM21_IRQn, TickPriority, 0U); 81 | 82 | /* Enable the TIM21 global Interrupt */ 83 | HAL_NVIC_EnableIRQ(TIM21_IRQn); 84 | 85 | /* Enable TIM21 clock */ 86 | __HAL_RCC_TIM21_CLK_ENABLE(); 87 | 88 | /* Get clock configuration */ 89 | HAL_RCC_GetClockConfig(&clkconfig, &pFLatency); 90 | 91 | /* Get APB2 prescaler */ 92 | uwAPB2Prescaler = clkconfig.APB2CLKDivider; 93 | 94 | /* Compute TIM21 clock */ 95 | if (uwAPB2Prescaler == RCC_HCLK_DIV1) 96 | { 97 | uwTimclock = HAL_RCC_GetPCLK2Freq(); 98 | } 99 | else 100 | { 101 | uwTimclock = 2U * HAL_RCC_GetPCLK2Freq(); 102 | } 103 | 104 | /* Compute the prescaler value to have TIM21 counter clock equal to 1MHz */ 105 | uwPrescalerValue = (uint32_t)((uwTimclock / 1000000U) - 1U); 106 | 107 | /* Initialize TIM21 */ 108 | TimHandle.Instance = TIM21; 109 | 110 | /* Initialize TIMx peripheral as follow: 111 | + Period = [(TIM21CLK/1000) - 1]. to have a (1/1000) s time base. 112 | + Prescaler = (uwTimclock/1000000 - 1) to have a 1MHz counter clock. 113 | + ClockDivision = 0 114 | + Counter direction = Up 115 | */ 116 | TimHandle.Init.Period = (1000000U / 1000U) - 1U; 117 | TimHandle.Init.Prescaler = uwPrescalerValue; 118 | TimHandle.Init.ClockDivision = 0; 119 | TimHandle.Init.CounterMode = TIM_COUNTERMODE_UP; 120 | status = HAL_TIM_Base_Init(&TimHandle); 121 | if (status == HAL_OK) 122 | { 123 | /* Start the TIM time Base generation in interrupt mode */ 124 | status = HAL_TIM_Base_Start_IT(&TimHandle); 125 | if (status == HAL_OK) 126 | { 127 | /* Configure the SysTick IRQ priority */ 128 | if (TickPriority < (1UL << __NVIC_PRIO_BITS)) 129 | { 130 | /* Configure the TIM IRQ priority */ 131 | HAL_NVIC_SetPriority(TIM21_IRQn, TickPriority, 0U); 132 | uwTickPrio = TickPriority; 133 | } 134 | else 135 | { 136 | status = HAL_ERROR; 137 | } 138 | } 139 | } 140 | 141 | /* Return function status */ 142 | return status; 143 | } 144 | 145 | /** 146 | * @brief Suspend Tick increment. 147 | * @note Disable the tick increment by disabling TIM21 update interrupt. 148 | * @param None 149 | * @retval None 150 | */ 151 | void HAL_SuspendTick(void) 152 | { 153 | /* Disable TIM21 update interrupt */ 154 | __HAL_TIM_DISABLE_IT(&TimHandle, TIM_IT_UPDATE); 155 | } 156 | 157 | /** 158 | * @brief Resume Tick increment. 159 | * @note Enable the tick increment by enabling TIM21 update interrupt. 160 | * @param None 161 | * @retval None 162 | */ 163 | void HAL_ResumeTick(void) 164 | { 165 | /* Enable TIM21 update interrupt */ 166 | __HAL_TIM_ENABLE_IT(&TimHandle, TIM_IT_UPDATE); 167 | } 168 | 169 | /** 170 | * @brief Period elapsed callback in non blocking mode 171 | * @note This function is called when TIM21 interrupt took place, inside 172 | * HAL_TIM_IRQHandler(). It makes a direct call to HAL_IncTick() to increment 173 | * a global variable "uwTick" used as application time base. 174 | * @param htim : TIM handle 175 | * @retval None 176 | */ 177 | void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) 178 | { 179 | HAL_IncTick(); 180 | } 181 | 182 | /** 183 | * @brief This function handles TIM interrupt request. 184 | * @param None 185 | * @retval None 186 | */ 187 | void TIM21_IRQHandler(void) 188 | { 189 | HAL_TIM_IRQHandler(&TimHandle); 190 | } 191 | 192 | /** 193 | * @} 194 | */ 195 | 196 | /** 197 | * @} 198 | */ 199 | 200 | 201 | -------------------------------------------------------------------------------- /Src/stm32l0xx_ll_crc.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_ll_crc.c 4 | * @author MCD Application Team 5 | * @brief CRC LL module driver. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2016 STMicroelectronics. 10 | * All rights reserved. 11 | * 12 | * This software is licensed under terms that can be found in the LICENSE file 13 | * in the root directory of this software component. 14 | * If no LICENSE file comes with this software, it is provided AS-IS. 15 | * 16 | ****************************************************************************** 17 | */ 18 | #if defined(USE_FULL_LL_DRIVER) 19 | 20 | /* Includes ------------------------------------------------------------------*/ 21 | #include "stm32l0xx_ll_crc.h" 22 | #include "stm32l0xx_ll_bus.h" 23 | 24 | #ifdef USE_FULL_ASSERT 25 | #include "stm32_assert.h" 26 | #else 27 | #define assert_param(expr) ((void)0U) 28 | #endif /* USE_FULL_ASSERT */ 29 | 30 | /** @addtogroup STM32L0xx_LL_Driver 31 | * @{ 32 | */ 33 | 34 | #if defined (CRC) 35 | 36 | /** @addtogroup CRC_LL 37 | * @{ 38 | */ 39 | 40 | /* Private types -------------------------------------------------------------*/ 41 | /* Private variables ---------------------------------------------------------*/ 42 | /* Private constants ---------------------------------------------------------*/ 43 | /* Private macros ------------------------------------------------------------*/ 44 | /* Private function prototypes -----------------------------------------------*/ 45 | 46 | /* Exported functions --------------------------------------------------------*/ 47 | /** @addtogroup CRC_LL_Exported_Functions 48 | * @{ 49 | */ 50 | 51 | /** @addtogroup CRC_LL_EF_Init 52 | * @{ 53 | */ 54 | 55 | /** 56 | * @brief De-initialize CRC registers (Registers restored to their default values). 57 | * @param CRCx CRC Instance 58 | * @retval An ErrorStatus enumeration value: 59 | * - SUCCESS: CRC registers are de-initialized 60 | * - ERROR: CRC registers are not de-initialized 61 | */ 62 | ErrorStatus LL_CRC_DeInit(const CRC_TypeDef *CRCx) 63 | { 64 | ErrorStatus status = SUCCESS; 65 | 66 | /* Check the parameters */ 67 | assert_param(IS_CRC_ALL_INSTANCE(CRCx)); 68 | 69 | if (CRCx == CRC) 70 | { 71 | /* Force CRC reset */ 72 | LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_CRC); 73 | 74 | /* Release CRC reset */ 75 | LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_CRC); 76 | } 77 | else 78 | { 79 | status = ERROR; 80 | } 81 | 82 | return (status); 83 | } 84 | 85 | /** 86 | * @} 87 | */ 88 | 89 | /** 90 | * @} 91 | */ 92 | 93 | /** 94 | * @} 95 | */ 96 | 97 | #endif /* defined (CRC) */ 98 | 99 | /** 100 | * @} 101 | */ 102 | 103 | #endif /* USE_FULL_LL_DRIVER */ 104 | -------------------------------------------------------------------------------- /Src/stm32l0xx_ll_crs.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_ll_crs.h 4 | * @author MCD Application Team 5 | * @brief CRS LL module driver. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2016 STMicroelectronics. 10 | * All rights reserved. 11 | * 12 | * This software is licensed under terms that can be found in the LICENSE file 13 | * in the root directory of this software component. 14 | * If no LICENSE file comes with this software, it is provided AS-IS. 15 | * 16 | ****************************************************************************** 17 | */ 18 | #if defined(USE_FULL_LL_DRIVER) 19 | 20 | /* Includes ------------------------------------------------------------------*/ 21 | #include "stm32l0xx_ll_crs.h" 22 | #include "stm32l0xx_ll_bus.h" 23 | 24 | /** @addtogroup STM32L0xx_LL_Driver 25 | * @{ 26 | */ 27 | 28 | #if defined(CRS) 29 | 30 | /** @defgroup CRS_LL CRS 31 | * @{ 32 | */ 33 | 34 | /* Private types -------------------------------------------------------------*/ 35 | /* Private variables ---------------------------------------------------------*/ 36 | /* Private constants ---------------------------------------------------------*/ 37 | /* Private macros ------------------------------------------------------------*/ 38 | /* Private function prototypes -----------------------------------------------*/ 39 | 40 | /* Exported functions --------------------------------------------------------*/ 41 | /** @addtogroup CRS_LL_Exported_Functions 42 | * @{ 43 | */ 44 | 45 | /** @addtogroup CRS_LL_EF_Init 46 | * @{ 47 | */ 48 | 49 | /** 50 | * @brief De-Initializes CRS peripheral registers to their default reset values. 51 | * @retval An ErrorStatus enumeration value: 52 | * - SUCCESS: CRS registers are de-initialized 53 | * - ERROR: not applicable 54 | */ 55 | ErrorStatus LL_CRS_DeInit(void) 56 | { 57 | LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_CRS); 58 | LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_CRS); 59 | 60 | return SUCCESS; 61 | } 62 | 63 | 64 | 65 | /** 66 | * @} 67 | */ 68 | 69 | /** 70 | * @} 71 | */ 72 | 73 | /** 74 | * @} 75 | */ 76 | 77 | #endif /* defined(CRS) */ 78 | 79 | /** 80 | * @} 81 | */ 82 | 83 | #endif /* USE_FULL_LL_DRIVER */ 84 | -------------------------------------------------------------------------------- /Src/stm32l0xx_ll_exti.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_ll_exti.c 4 | * @author MCD Application Team 5 | * @brief EXTI LL module driver. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2016 STMicroelectronics. 10 | * All rights reserved. 11 | * 12 | * This software is licensed under terms that can be found in the LICENSE file 13 | * in the root directory of this software component. 14 | * If no LICENSE file comes with this software, it is provided AS-IS. 15 | * 16 | ****************************************************************************** 17 | */ 18 | #if defined(USE_FULL_LL_DRIVER) 19 | 20 | /* Includes ------------------------------------------------------------------*/ 21 | #include "stm32l0xx_ll_exti.h" 22 | #ifdef USE_FULL_ASSERT 23 | #include "stm32_assert.h" 24 | #else 25 | #define assert_param(expr) ((void)0U) 26 | #endif 27 | 28 | /** @addtogroup STM32L0xx_LL_Driver 29 | * @{ 30 | */ 31 | 32 | #if defined (EXTI) 33 | 34 | /** @defgroup EXTI_LL EXTI 35 | * @{ 36 | */ 37 | 38 | /* Private types -------------------------------------------------------------*/ 39 | /* Private variables ---------------------------------------------------------*/ 40 | /* Private constants ---------------------------------------------------------*/ 41 | /* Private macros ------------------------------------------------------------*/ 42 | /** @addtogroup EXTI_LL_Private_Macros 43 | * @{ 44 | */ 45 | 46 | #define IS_LL_EXTI_LINE_0_31(__VALUE__) (((__VALUE__) & ~LL_EXTI_LINE_ALL_0_31) == 0x00000000U) 47 | 48 | #define IS_LL_EXTI_MODE(__VALUE__) (((__VALUE__) == LL_EXTI_MODE_IT) \ 49 | || ((__VALUE__) == LL_EXTI_MODE_EVENT) \ 50 | || ((__VALUE__) == LL_EXTI_MODE_IT_EVENT)) 51 | 52 | 53 | #define IS_LL_EXTI_TRIGGER(__VALUE__) (((__VALUE__) == LL_EXTI_TRIGGER_NONE) \ 54 | || ((__VALUE__) == LL_EXTI_TRIGGER_RISING) \ 55 | || ((__VALUE__) == LL_EXTI_TRIGGER_FALLING) \ 56 | || ((__VALUE__) == LL_EXTI_TRIGGER_RISING_FALLING)) 57 | 58 | /** 59 | * @} 60 | */ 61 | 62 | /* Private function prototypes -----------------------------------------------*/ 63 | 64 | /* Exported functions --------------------------------------------------------*/ 65 | /** @addtogroup EXTI_LL_Exported_Functions 66 | * @{ 67 | */ 68 | 69 | /** @addtogroup EXTI_LL_EF_Init 70 | * @{ 71 | */ 72 | 73 | /** 74 | * @brief De-initialize the EXTI registers to their default reset values. 75 | * @retval An ErrorStatus enumeration value: 76 | * - SUCCESS: EXTI registers are de-initialized 77 | * - ERROR: not applicable 78 | */ 79 | uint32_t LL_EXTI_DeInit(void) 80 | { 81 | /* Interrupt mask register set to default reset values */ 82 | LL_EXTI_WriteReg(IMR, 0x3F840000U); 83 | /* Event mask register set to default reset values */ 84 | LL_EXTI_WriteReg(EMR, 0x00000000U); 85 | /* Rising Trigger selection register set to default reset values */ 86 | LL_EXTI_WriteReg(RTSR, 0x00000000U); 87 | /* Falling Trigger selection register set to default reset values */ 88 | LL_EXTI_WriteReg(FTSR, 0x00000000U); 89 | /* Software interrupt event register set to default reset values */ 90 | LL_EXTI_WriteReg(SWIER, 0x00000000U); 91 | /* Pending register set to default reset values */ 92 | LL_EXTI_WriteReg(PR, 0x007BFFFFU); 93 | 94 | return SUCCESS; 95 | } 96 | 97 | /** 98 | * @brief Initialize the EXTI registers according to the specified parameters in EXTI_InitStruct. 99 | * @param EXTI_InitStruct pointer to a @ref LL_EXTI_InitTypeDef structure. 100 | * @retval An ErrorStatus enumeration value: 101 | * - SUCCESS: EXTI registers are initialized 102 | * - ERROR: not applicable 103 | */ 104 | uint32_t LL_EXTI_Init(LL_EXTI_InitTypeDef *EXTI_InitStruct) 105 | { 106 | ErrorStatus status = SUCCESS; 107 | /* Check the parameters */ 108 | assert_param(IS_LL_EXTI_LINE_0_31(EXTI_InitStruct->Line_0_31)); 109 | assert_param(IS_FUNCTIONAL_STATE(EXTI_InitStruct->LineCommand)); 110 | assert_param(IS_LL_EXTI_MODE(EXTI_InitStruct->Mode)); 111 | 112 | /* ENABLE LineCommand */ 113 | if (EXTI_InitStruct->LineCommand != DISABLE) 114 | { 115 | assert_param(IS_LL_EXTI_TRIGGER(EXTI_InitStruct->Trigger)); 116 | 117 | /* Configure EXTI Lines in range from 0 to 31 */ 118 | if (EXTI_InitStruct->Line_0_31 != LL_EXTI_LINE_NONE) 119 | { 120 | switch (EXTI_InitStruct->Mode) 121 | { 122 | case LL_EXTI_MODE_IT: 123 | /* First Disable Event on provided Lines */ 124 | LL_EXTI_DisableEvent_0_31(EXTI_InitStruct->Line_0_31); 125 | /* Then Enable IT on provided Lines */ 126 | LL_EXTI_EnableIT_0_31(EXTI_InitStruct->Line_0_31); 127 | break; 128 | case LL_EXTI_MODE_EVENT: 129 | /* First Disable IT on provided Lines */ 130 | LL_EXTI_DisableIT_0_31(EXTI_InitStruct->Line_0_31); 131 | /* Then Enable Event on provided Lines */ 132 | LL_EXTI_EnableEvent_0_31(EXTI_InitStruct->Line_0_31); 133 | break; 134 | case LL_EXTI_MODE_IT_EVENT: 135 | /* Directly Enable IT & Event on provided Lines */ 136 | LL_EXTI_EnableIT_0_31(EXTI_InitStruct->Line_0_31); 137 | LL_EXTI_EnableEvent_0_31(EXTI_InitStruct->Line_0_31); 138 | break; 139 | default: 140 | status = ERROR; 141 | break; 142 | } 143 | if (EXTI_InitStruct->Trigger != LL_EXTI_TRIGGER_NONE) 144 | { 145 | switch (EXTI_InitStruct->Trigger) 146 | { 147 | case LL_EXTI_TRIGGER_RISING: 148 | /* First Disable Falling Trigger on provided Lines */ 149 | LL_EXTI_DisableFallingTrig_0_31(EXTI_InitStruct->Line_0_31); 150 | /* Then Enable Rising Trigger on provided Lines */ 151 | LL_EXTI_EnableRisingTrig_0_31(EXTI_InitStruct->Line_0_31); 152 | break; 153 | case LL_EXTI_TRIGGER_FALLING: 154 | /* First Disable Rising Trigger on provided Lines */ 155 | LL_EXTI_DisableRisingTrig_0_31(EXTI_InitStruct->Line_0_31); 156 | /* Then Enable Falling Trigger on provided Lines */ 157 | LL_EXTI_EnableFallingTrig_0_31(EXTI_InitStruct->Line_0_31); 158 | break; 159 | case LL_EXTI_TRIGGER_RISING_FALLING: 160 | LL_EXTI_EnableRisingTrig_0_31(EXTI_InitStruct->Line_0_31); 161 | LL_EXTI_EnableFallingTrig_0_31(EXTI_InitStruct->Line_0_31); 162 | break; 163 | default: 164 | status = ERROR; 165 | break; 166 | } 167 | } 168 | } 169 | } 170 | /* DISABLE LineCommand */ 171 | else 172 | { 173 | /* De-configure EXTI Lines in range from 0 to 31 */ 174 | LL_EXTI_DisableIT_0_31(EXTI_InitStruct->Line_0_31); 175 | LL_EXTI_DisableEvent_0_31(EXTI_InitStruct->Line_0_31); 176 | } 177 | return status; 178 | } 179 | 180 | /** 181 | * @brief Set each @ref LL_EXTI_InitTypeDef field to default value. 182 | * @param EXTI_InitStruct Pointer to a @ref LL_EXTI_InitTypeDef structure. 183 | * @retval None 184 | */ 185 | void LL_EXTI_StructInit(LL_EXTI_InitTypeDef *EXTI_InitStruct) 186 | { 187 | EXTI_InitStruct->Line_0_31 = LL_EXTI_LINE_NONE; 188 | EXTI_InitStruct->LineCommand = DISABLE; 189 | EXTI_InitStruct->Mode = LL_EXTI_MODE_IT; 190 | EXTI_InitStruct->Trigger = LL_EXTI_TRIGGER_FALLING; 191 | } 192 | 193 | /** 194 | * @} 195 | */ 196 | 197 | /** 198 | * @} 199 | */ 200 | 201 | /** 202 | * @} 203 | */ 204 | 205 | #endif /* defined (EXTI) */ 206 | 207 | /** 208 | * @} 209 | */ 210 | 211 | #endif /* USE_FULL_LL_DRIVER */ 212 | 213 | -------------------------------------------------------------------------------- /Src/stm32l0xx_ll_gpio.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_ll_gpio.c 4 | * @author MCD Application Team 5 | * @brief GPIO LL module driver. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2016 STMicroelectronics. 10 | * All rights reserved. 11 | * 12 | * This software is licensed under terms that can be found in the LICENSE file 13 | * in the root directory of this software component. 14 | * If no LICENSE file comes with this software, it is provided AS-IS. 15 | * 16 | ****************************************************************************** 17 | */ 18 | #if defined(USE_FULL_LL_DRIVER) 19 | 20 | /* Includes ------------------------------------------------------------------*/ 21 | #include "stm32l0xx_ll_gpio.h" 22 | #include "stm32l0xx_ll_bus.h" 23 | #ifdef USE_FULL_ASSERT 24 | #include "stm32_assert.h" 25 | #else 26 | #define assert_param(expr) ((void)0U) 27 | #endif 28 | 29 | /** @addtogroup STM32L0xx_LL_Driver 30 | * @{ 31 | */ 32 | 33 | #if defined (GPIOA) || defined (GPIOB) || defined (GPIOC) || defined (GPIOD) || defined (GPIOE) || defined (GPIOH) 34 | 35 | /** @addtogroup GPIO_LL 36 | * @{ 37 | */ 38 | 39 | /* Private types -------------------------------------------------------------*/ 40 | /* Private variables ---------------------------------------------------------*/ 41 | /* Private constants ---------------------------------------------------------*/ 42 | /* Private macros ------------------------------------------------------------*/ 43 | /** @addtogroup GPIO_LL_Private_Macros 44 | * @{ 45 | */ 46 | #define IS_LL_GPIO_PIN(__VALUE__) (((0x00000000UL) < (__VALUE__)) && ((__VALUE__) <= (LL_GPIO_PIN_ALL))) 47 | 48 | #define IS_LL_GPIO_MODE(__VALUE__) (((__VALUE__) == LL_GPIO_MODE_INPUT) ||\ 49 | ((__VALUE__) == LL_GPIO_MODE_OUTPUT) ||\ 50 | ((__VALUE__) == LL_GPIO_MODE_ALTERNATE) ||\ 51 | ((__VALUE__) == LL_GPIO_MODE_ANALOG)) 52 | 53 | #define IS_LL_GPIO_OUTPUT_TYPE(__VALUE__) (((__VALUE__) == LL_GPIO_OUTPUT_PUSHPULL) ||\ 54 | ((__VALUE__) == LL_GPIO_OUTPUT_OPENDRAIN)) 55 | 56 | #define IS_LL_GPIO_SPEED(__VALUE__) (((__VALUE__) == LL_GPIO_SPEED_FREQ_LOW) ||\ 57 | ((__VALUE__) == LL_GPIO_SPEED_FREQ_MEDIUM) ||\ 58 | ((__VALUE__) == LL_GPIO_SPEED_FREQ_HIGH) ||\ 59 | ((__VALUE__) == LL_GPIO_SPEED_FREQ_VERY_HIGH)) 60 | 61 | #define IS_LL_GPIO_PULL(__VALUE__) (((__VALUE__) == LL_GPIO_PULL_NO) ||\ 62 | ((__VALUE__) == LL_GPIO_PULL_UP) ||\ 63 | ((__VALUE__) == LL_GPIO_PULL_DOWN)) 64 | 65 | #define IS_LL_GPIO_ALTERNATE(__VALUE__) (((__VALUE__) == LL_GPIO_AF_0 ) ||\ 66 | ((__VALUE__) == LL_GPIO_AF_1 ) ||\ 67 | ((__VALUE__) == LL_GPIO_AF_2 ) ||\ 68 | ((__VALUE__) == LL_GPIO_AF_3 ) ||\ 69 | ((__VALUE__) == LL_GPIO_AF_4 ) ||\ 70 | ((__VALUE__) == LL_GPIO_AF_5 ) ||\ 71 | ((__VALUE__) == LL_GPIO_AF_6 ) ||\ 72 | ((__VALUE__) == LL_GPIO_AF_7 )) 73 | /** 74 | * @} 75 | */ 76 | 77 | /* Private function prototypes -----------------------------------------------*/ 78 | 79 | /* Exported functions --------------------------------------------------------*/ 80 | /** @addtogroup GPIO_LL_Exported_Functions 81 | * @{ 82 | */ 83 | 84 | /** @addtogroup GPIO_LL_EF_Init 85 | * @{ 86 | */ 87 | 88 | /** 89 | * @brief De-initialize GPIO registers (Registers restored to their default values). 90 | * @param GPIOx GPIO Port 91 | * @retval An ErrorStatus enumeration value: 92 | * - SUCCESS: GPIO registers are de-initialized 93 | * - ERROR: Wrong GPIO Port 94 | */ 95 | ErrorStatus LL_GPIO_DeInit(GPIO_TypeDef *GPIOx) 96 | { 97 | ErrorStatus status = SUCCESS; 98 | 99 | /* Check the parameters */ 100 | assert_param(IS_GPIO_ALL_INSTANCE(GPIOx)); 101 | 102 | /* Force and Release reset on clock of GPIOx Port */ 103 | if (GPIOx == GPIOA) 104 | { 105 | LL_IOP_GRP1_ForceReset(LL_IOP_GRP1_PERIPH_GPIOA); 106 | LL_IOP_GRP1_ReleaseReset(LL_IOP_GRP1_PERIPH_GPIOA); 107 | } 108 | else if (GPIOx == GPIOB) 109 | { 110 | LL_IOP_GRP1_ForceReset(LL_IOP_GRP1_PERIPH_GPIOB); 111 | LL_IOP_GRP1_ReleaseReset(LL_IOP_GRP1_PERIPH_GPIOB); 112 | } 113 | else if (GPIOx == GPIOC) 114 | { 115 | LL_IOP_GRP1_ForceReset(LL_IOP_GRP1_PERIPH_GPIOC); 116 | LL_IOP_GRP1_ReleaseReset(LL_IOP_GRP1_PERIPH_GPIOC); 117 | } 118 | #if defined(GPIOD) 119 | else if (GPIOx == GPIOD) 120 | { 121 | LL_IOP_GRP1_ForceReset(LL_IOP_GRP1_PERIPH_GPIOD); 122 | LL_IOP_GRP1_ReleaseReset(LL_IOP_GRP1_PERIPH_GPIOD); 123 | } 124 | #endif /* GPIOD */ 125 | #if defined(GPIOE) 126 | else if (GPIOx == GPIOE) 127 | { 128 | LL_IOP_GRP1_ForceReset(LL_IOP_GRP1_PERIPH_GPIOE); 129 | LL_IOP_GRP1_ReleaseReset(LL_IOP_GRP1_PERIPH_GPIOE); 130 | } 131 | #endif /* GPIOE */ 132 | #if defined(GPIOH) 133 | else if (GPIOx == GPIOH) 134 | { 135 | LL_IOP_GRP1_ForceReset(LL_IOP_GRP1_PERIPH_GPIOH); 136 | LL_IOP_GRP1_ReleaseReset(LL_IOP_GRP1_PERIPH_GPIOH); 137 | } 138 | #endif /* GPIOH */ 139 | else 140 | { 141 | status = ERROR; 142 | } 143 | 144 | return (status); 145 | } 146 | 147 | /** 148 | * @brief Initialize GPIO registers according to the specified parameters in GPIO_InitStruct. 149 | * @param GPIOx GPIO Port 150 | * @param GPIO_InitStruct pointer to a @ref LL_GPIO_InitTypeDef structure 151 | * that contains the configuration information for the specified GPIO peripheral. 152 | * @retval An ErrorStatus enumeration value: 153 | * - SUCCESS: GPIO registers are initialized according to GPIO_InitStruct content 154 | * - ERROR: Not applicable 155 | */ 156 | ErrorStatus LL_GPIO_Init(GPIO_TypeDef *GPIOx, LL_GPIO_InitTypeDef *GPIO_InitStruct) 157 | { 158 | uint32_t pinpos = 0x00000000U; 159 | uint32_t currentpin = 0x00000000U; 160 | 161 | /* Check the parameters */ 162 | assert_param(IS_GPIO_ALL_INSTANCE(GPIOx)); 163 | assert_param(IS_LL_GPIO_PIN(GPIO_InitStruct->Pin)); 164 | assert_param(IS_LL_GPIO_MODE(GPIO_InitStruct->Mode)); 165 | assert_param(IS_LL_GPIO_PULL(GPIO_InitStruct->Pull)); 166 | 167 | /* ------------------------- Configure the port pins ---------------- */ 168 | /* Initialize pinpos on first pin set */ 169 | /* pinpos = 0; useless as already done in default initialization */ 170 | 171 | /* Configure the port pins */ 172 | while (((GPIO_InitStruct->Pin) >> pinpos) != 0x00000000U) 173 | { 174 | /* Get current io position */ 175 | currentpin = (GPIO_InitStruct->Pin) & (0x00000001U << pinpos); 176 | 177 | if (currentpin) 178 | { 179 | if ((GPIO_InitStruct->Mode == LL_GPIO_MODE_OUTPUT) || (GPIO_InitStruct->Mode == LL_GPIO_MODE_ALTERNATE)) 180 | { 181 | /* Check Speed mode parameters */ 182 | assert_param(IS_LL_GPIO_SPEED(GPIO_InitStruct->Speed)); 183 | 184 | /* Speed mode configuration */ 185 | LL_GPIO_SetPinSpeed(GPIOx, currentpin, GPIO_InitStruct->Speed); 186 | 187 | /* Check Output mode parameters */ 188 | assert_param(IS_LL_GPIO_OUTPUT_TYPE(GPIO_InitStruct->OutputType)); 189 | 190 | /* Output mode configuration*/ 191 | LL_GPIO_SetPinOutputType(GPIOx, GPIO_InitStruct->Pin, GPIO_InitStruct->OutputType); 192 | } 193 | 194 | /* Pull-up Pull down resistor configuration*/ 195 | LL_GPIO_SetPinPull(GPIOx, currentpin, GPIO_InitStruct->Pull); 196 | 197 | if (GPIO_InitStruct->Mode == LL_GPIO_MODE_ALTERNATE) 198 | { 199 | /* Check Alternate parameter */ 200 | assert_param(IS_LL_GPIO_ALTERNATE(GPIO_InitStruct->Alternate)); 201 | 202 | /* Speed mode configuration */ 203 | if (currentpin < LL_GPIO_PIN_8) 204 | { 205 | LL_GPIO_SetAFPin_0_7(GPIOx, currentpin, GPIO_InitStruct->Alternate); 206 | } 207 | else 208 | { 209 | LL_GPIO_SetAFPin_8_15(GPIOx, currentpin, GPIO_InitStruct->Alternate); 210 | } 211 | } 212 | 213 | /* Pin Mode configuration */ 214 | LL_GPIO_SetPinMode(GPIOx, currentpin, GPIO_InitStruct->Mode); 215 | } 216 | pinpos++; 217 | } 218 | 219 | 220 | return (SUCCESS); 221 | } 222 | 223 | /** 224 | * @brief Set each @ref LL_GPIO_InitTypeDef field to default value. 225 | * @param GPIO_InitStruct: pointer to a @ref LL_GPIO_InitTypeDef structure 226 | * whose fields will be set to default values. 227 | * @retval None 228 | */ 229 | 230 | void LL_GPIO_StructInit(LL_GPIO_InitTypeDef *GPIO_InitStruct) 231 | { 232 | /* Reset GPIO init structure parameters values */ 233 | GPIO_InitStruct->Pin = LL_GPIO_PIN_ALL; 234 | GPIO_InitStruct->Mode = LL_GPIO_MODE_ANALOG; 235 | GPIO_InitStruct->Speed = LL_GPIO_SPEED_FREQ_LOW; 236 | GPIO_InitStruct->OutputType = LL_GPIO_OUTPUT_PUSHPULL; 237 | GPIO_InitStruct->Pull = LL_GPIO_PULL_NO; 238 | GPIO_InitStruct->Alternate = LL_GPIO_AF_0; 239 | } 240 | 241 | /** 242 | * @} 243 | */ 244 | 245 | /** 246 | * @} 247 | */ 248 | 249 | /** 250 | * @} 251 | */ 252 | 253 | #endif /* defined (GPIOA) || defined (GPIOB) || defined (GPIOC) || defined (GPIOD) || defined (GPIOE) || defined (GPIOH) */ 254 | 255 | /** 256 | * @} 257 | */ 258 | 259 | #endif /* USE_FULL_LL_DRIVER */ 260 | 261 | 262 | -------------------------------------------------------------------------------- /Src/stm32l0xx_ll_i2c.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_ll_i2c.c 4 | * @author MCD Application Team 5 | * @brief I2C LL module driver. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2016 STMicroelectronics. 10 | * All rights reserved. 11 | * 12 | * This software is licensed under terms that can be found in the LICENSE file 13 | * in the root directory of this software component. 14 | * If no LICENSE file comes with this software, it is provided AS-IS. 15 | * 16 | ****************************************************************************** 17 | */ 18 | #if defined(USE_FULL_LL_DRIVER) 19 | 20 | /* Includes ------------------------------------------------------------------*/ 21 | #include "stm32l0xx_ll_i2c.h" 22 | #include "stm32l0xx_ll_bus.h" 23 | #ifdef USE_FULL_ASSERT 24 | #include "stm32_assert.h" 25 | #else 26 | #define assert_param(expr) ((void)0U) 27 | #endif /* USE_FULL_ASSERT */ 28 | 29 | /** @addtogroup STM32L0xx_LL_Driver 30 | * @{ 31 | */ 32 | 33 | #if defined (I2C1) || defined (I2C2) || defined (I2C3) 34 | 35 | /** @defgroup I2C_LL I2C 36 | * @{ 37 | */ 38 | 39 | /* Private types -------------------------------------------------------------*/ 40 | /* Private variables ---------------------------------------------------------*/ 41 | /* Private constants ---------------------------------------------------------*/ 42 | /* Private macros ------------------------------------------------------------*/ 43 | /** @addtogroup I2C_LL_Private_Macros 44 | * @{ 45 | */ 46 | 47 | #define IS_LL_I2C_PERIPHERAL_MODE(__VALUE__) (((__VALUE__) == LL_I2C_MODE_I2C) || \ 48 | ((__VALUE__) == LL_I2C_MODE_SMBUS_HOST) || \ 49 | ((__VALUE__) == LL_I2C_MODE_SMBUS_DEVICE) || \ 50 | ((__VALUE__) == LL_I2C_MODE_SMBUS_DEVICE_ARP)) 51 | 52 | #define IS_LL_I2C_ANALOG_FILTER(__VALUE__) (((__VALUE__) == LL_I2C_ANALOGFILTER_ENABLE) || \ 53 | ((__VALUE__) == LL_I2C_ANALOGFILTER_DISABLE)) 54 | 55 | #define IS_LL_I2C_DIGITAL_FILTER(__VALUE__) ((__VALUE__) <= 0x0000000FU) 56 | 57 | #define IS_LL_I2C_OWN_ADDRESS1(__VALUE__) ((__VALUE__) <= 0x000003FFU) 58 | 59 | #define IS_LL_I2C_TYPE_ACKNOWLEDGE(__VALUE__) (((__VALUE__) == LL_I2C_ACK) || \ 60 | ((__VALUE__) == LL_I2C_NACK)) 61 | 62 | #define IS_LL_I2C_OWN_ADDRSIZE(__VALUE__) (((__VALUE__) == LL_I2C_OWNADDRESS1_7BIT) || \ 63 | ((__VALUE__) == LL_I2C_OWNADDRESS1_10BIT)) 64 | /** 65 | * @} 66 | */ 67 | 68 | /* Private function prototypes -----------------------------------------------*/ 69 | 70 | /* Exported functions --------------------------------------------------------*/ 71 | /** @addtogroup I2C_LL_Exported_Functions 72 | * @{ 73 | */ 74 | 75 | /** @addtogroup I2C_LL_EF_Init 76 | * @{ 77 | */ 78 | 79 | /** 80 | * @brief De-initialize the I2C registers to their default reset values. 81 | * @param I2Cx I2C Instance. 82 | * @retval An ErrorStatus enumeration value: 83 | * - SUCCESS: I2C registers are de-initialized 84 | * - ERROR: I2C registers are not de-initialized 85 | */ 86 | ErrorStatus LL_I2C_DeInit(const I2C_TypeDef *I2Cx) 87 | { 88 | ErrorStatus status = SUCCESS; 89 | 90 | /* Check the I2C Instance I2Cx */ 91 | assert_param(IS_I2C_ALL_INSTANCE(I2Cx)); 92 | 93 | if (I2Cx == I2C1) 94 | { 95 | /* Force reset of I2C clock */ 96 | LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_I2C1); 97 | 98 | /* Release reset of I2C clock */ 99 | LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_I2C1); 100 | } 101 | #if defined(I2C2) 102 | else if (I2Cx == I2C2) 103 | { 104 | /* Force reset of I2C clock */ 105 | LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_I2C2); 106 | 107 | /* Release reset of I2C clock */ 108 | LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_I2C2); 109 | 110 | } 111 | #endif /* I2C2 */ 112 | #if defined(I2C3) 113 | else if (I2Cx == I2C3) 114 | { 115 | /* Force reset of I2C clock */ 116 | LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_I2C3); 117 | 118 | /* Release reset of I2C clock */ 119 | LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_I2C3); 120 | } 121 | #endif /* I2C3 */ 122 | else 123 | { 124 | status = ERROR; 125 | } 126 | 127 | return status; 128 | } 129 | 130 | /** 131 | * @brief Initialize the I2C registers according to the specified parameters in I2C_InitStruct. 132 | * @param I2Cx I2C Instance. 133 | * @param I2C_InitStruct pointer to a @ref LL_I2C_InitTypeDef structure. 134 | * @retval An ErrorStatus enumeration value: 135 | * - SUCCESS: I2C registers are initialized 136 | * - ERROR: Not applicable 137 | */ 138 | ErrorStatus LL_I2C_Init(I2C_TypeDef *I2Cx, const LL_I2C_InitTypeDef *I2C_InitStruct) 139 | { 140 | /* Check the I2C Instance I2Cx */ 141 | assert_param(IS_I2C_ALL_INSTANCE(I2Cx)); 142 | 143 | /* Check the I2C parameters from I2C_InitStruct */ 144 | assert_param(IS_LL_I2C_PERIPHERAL_MODE(I2C_InitStruct->PeripheralMode)); 145 | assert_param(IS_LL_I2C_ANALOG_FILTER(I2C_InitStruct->AnalogFilter)); 146 | assert_param(IS_LL_I2C_DIGITAL_FILTER(I2C_InitStruct->DigitalFilter)); 147 | assert_param(IS_LL_I2C_OWN_ADDRESS1(I2C_InitStruct->OwnAddress1)); 148 | assert_param(IS_LL_I2C_TYPE_ACKNOWLEDGE(I2C_InitStruct->TypeAcknowledge)); 149 | assert_param(IS_LL_I2C_OWN_ADDRSIZE(I2C_InitStruct->OwnAddrSize)); 150 | 151 | /* Disable the selected I2Cx Peripheral */ 152 | LL_I2C_Disable(I2Cx); 153 | 154 | /*---------------------------- I2Cx CR1 Configuration ------------------------ 155 | * Configure the analog and digital noise filters with parameters : 156 | * - AnalogFilter: I2C_CR1_ANFOFF bit 157 | * - DigitalFilter: I2C_CR1_DNF[3:0] bits 158 | */ 159 | LL_I2C_ConfigFilters(I2Cx, I2C_InitStruct->AnalogFilter, I2C_InitStruct->DigitalFilter); 160 | 161 | /*---------------------------- I2Cx TIMINGR Configuration -------------------- 162 | * Configure the SDA setup, hold time and the SCL high, low period with parameter : 163 | * - Timing: I2C_TIMINGR_PRESC[3:0], I2C_TIMINGR_SCLDEL[3:0], I2C_TIMINGR_SDADEL[3:0], 164 | * I2C_TIMINGR_SCLH[7:0] and I2C_TIMINGR_SCLL[7:0] bits 165 | */ 166 | LL_I2C_SetTiming(I2Cx, I2C_InitStruct->Timing); 167 | 168 | /* Enable the selected I2Cx Peripheral */ 169 | LL_I2C_Enable(I2Cx); 170 | 171 | /*---------------------------- I2Cx OAR1 Configuration ----------------------- 172 | * Disable, Configure and Enable I2Cx device own address 1 with parameters : 173 | * - OwnAddress1: I2C_OAR1_OA1[9:0] bits 174 | * - OwnAddrSize: I2C_OAR1_OA1MODE bit 175 | */ 176 | LL_I2C_DisableOwnAddress1(I2Cx); 177 | LL_I2C_SetOwnAddress1(I2Cx, I2C_InitStruct->OwnAddress1, I2C_InitStruct->OwnAddrSize); 178 | 179 | /* OwnAdress1 == 0 is reserved for General Call address */ 180 | if (I2C_InitStruct->OwnAddress1 != 0U) 181 | { 182 | LL_I2C_EnableOwnAddress1(I2Cx); 183 | } 184 | 185 | /*---------------------------- I2Cx MODE Configuration ----------------------- 186 | * Configure I2Cx peripheral mode with parameter : 187 | * - PeripheralMode: I2C_CR1_SMBDEN and I2C_CR1_SMBHEN bits 188 | */ 189 | LL_I2C_SetMode(I2Cx, I2C_InitStruct->PeripheralMode); 190 | 191 | /*---------------------------- I2Cx CR2 Configuration ------------------------ 192 | * Configure the ACKnowledge or Non ACKnowledge condition 193 | * after the address receive match code or next received byte with parameter : 194 | * - TypeAcknowledge: I2C_CR2_NACK bit 195 | */ 196 | LL_I2C_AcknowledgeNextData(I2Cx, I2C_InitStruct->TypeAcknowledge); 197 | 198 | return SUCCESS; 199 | } 200 | 201 | /** 202 | * @brief Set each @ref LL_I2C_InitTypeDef field to default value. 203 | * @param I2C_InitStruct Pointer to a @ref LL_I2C_InitTypeDef structure. 204 | * @retval None 205 | */ 206 | void LL_I2C_StructInit(LL_I2C_InitTypeDef *I2C_InitStruct) 207 | { 208 | /* Set I2C_InitStruct fields to default values */ 209 | I2C_InitStruct->PeripheralMode = LL_I2C_MODE_I2C; 210 | I2C_InitStruct->Timing = 0U; 211 | I2C_InitStruct->AnalogFilter = LL_I2C_ANALOGFILTER_ENABLE; 212 | I2C_InitStruct->DigitalFilter = 0U; 213 | I2C_InitStruct->OwnAddress1 = 0U; 214 | I2C_InitStruct->TypeAcknowledge = LL_I2C_NACK; 215 | I2C_InitStruct->OwnAddrSize = LL_I2C_OWNADDRESS1_7BIT; 216 | } 217 | 218 | /** 219 | * @} 220 | */ 221 | 222 | /** 223 | * @} 224 | */ 225 | 226 | /** 227 | * @} 228 | */ 229 | 230 | #endif /* I2C1 || I2C2 || I2C3 */ 231 | 232 | /** 233 | * @} 234 | */ 235 | 236 | #endif /* USE_FULL_LL_DRIVER */ 237 | -------------------------------------------------------------------------------- /Src/stm32l0xx_ll_lptim.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_ll_lptim.c 4 | * @author MCD Application Team 5 | * @brief LPTIM LL module driver. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2016 STMicroelectronics. 10 | * All rights reserved. 11 | * 12 | * This software is licensed under terms that can be found in the LICENSE file 13 | * in the root directory of this software component. 14 | * If no LICENSE file comes with this software, it is provided AS-IS. 15 | * 16 | ****************************************************************************** 17 | */ 18 | #if defined(USE_FULL_LL_DRIVER) 19 | 20 | /* Includes ------------------------------------------------------------------*/ 21 | #include "stm32l0xx_ll_lptim.h" 22 | #include "stm32l0xx_ll_bus.h" 23 | #include "stm32l0xx_ll_rcc.h" 24 | 25 | 26 | #ifdef USE_FULL_ASSERT 27 | #include "stm32_assert.h" 28 | #else 29 | #define assert_param(expr) ((void)0U) 30 | #endif /* USE_FULL_ASSERT */ 31 | 32 | /** @addtogroup STM32L0xx_LL_Driver 33 | * @{ 34 | */ 35 | 36 | #if defined (LPTIM1) 37 | 38 | /** @addtogroup LPTIM_LL 39 | * @{ 40 | */ 41 | 42 | /* Private types -------------------------------------------------------------*/ 43 | /* Private variables ---------------------------------------------------------*/ 44 | /* Private constants ---------------------------------------------------------*/ 45 | /* Private macros ------------------------------------------------------------*/ 46 | /** @addtogroup LPTIM_LL_Private_Macros 47 | * @{ 48 | */ 49 | #define IS_LL_LPTIM_CLOCK_SOURCE(__VALUE__) (((__VALUE__) == LL_LPTIM_CLK_SOURCE_INTERNAL) \ 50 | || ((__VALUE__) == LL_LPTIM_CLK_SOURCE_EXTERNAL)) 51 | 52 | #define IS_LL_LPTIM_CLOCK_PRESCALER(__VALUE__) (((__VALUE__) == LL_LPTIM_PRESCALER_DIV1) \ 53 | || ((__VALUE__) == LL_LPTIM_PRESCALER_DIV2) \ 54 | || ((__VALUE__) == LL_LPTIM_PRESCALER_DIV4) \ 55 | || ((__VALUE__) == LL_LPTIM_PRESCALER_DIV8) \ 56 | || ((__VALUE__) == LL_LPTIM_PRESCALER_DIV16) \ 57 | || ((__VALUE__) == LL_LPTIM_PRESCALER_DIV32) \ 58 | || ((__VALUE__) == LL_LPTIM_PRESCALER_DIV64) \ 59 | || ((__VALUE__) == LL_LPTIM_PRESCALER_DIV128)) 60 | 61 | #define IS_LL_LPTIM_WAVEFORM(__VALUE__) (((__VALUE__) == LL_LPTIM_OUTPUT_WAVEFORM_PWM) \ 62 | || ((__VALUE__) == LL_LPTIM_OUTPUT_WAVEFORM_SETONCE)) 63 | 64 | #define IS_LL_LPTIM_OUTPUT_POLARITY(__VALUE__) (((__VALUE__) == LL_LPTIM_OUTPUT_POLARITY_REGULAR) \ 65 | || ((__VALUE__) == LL_LPTIM_OUTPUT_POLARITY_INVERSE)) 66 | /** 67 | * @} 68 | */ 69 | 70 | 71 | /* Private function prototypes -----------------------------------------------*/ 72 | /* Private functions ---------------------------------------------------------*/ 73 | /** @defgroup LPTIM_Private_Functions LPTIM Private Functions 74 | * @{ 75 | */ 76 | /** 77 | * @} 78 | */ 79 | /* Exported functions --------------------------------------------------------*/ 80 | /** @addtogroup LPTIM_LL_Exported_Functions 81 | * @{ 82 | */ 83 | 84 | /** @addtogroup LPTIM_LL_EF_Init 85 | * @{ 86 | */ 87 | 88 | /** 89 | * @brief Set LPTIMx registers to their reset values. 90 | * @param LPTIMx LP Timer instance 91 | * @retval An ErrorStatus enumeration value: 92 | * - SUCCESS: LPTIMx registers are de-initialized 93 | * - ERROR: invalid LPTIMx instance 94 | */ 95 | ErrorStatus LL_LPTIM_DeInit(const LPTIM_TypeDef *LPTIMx) 96 | { 97 | ErrorStatus result = SUCCESS; 98 | 99 | /* Check the parameters */ 100 | assert_param(IS_LPTIM_INSTANCE(LPTIMx)); 101 | 102 | if (LPTIMx == LPTIM1) 103 | { 104 | LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_LPTIM1); 105 | LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_LPTIM1); 106 | } 107 | else 108 | { 109 | result = ERROR; 110 | } 111 | 112 | return result; 113 | } 114 | 115 | /** 116 | * @brief Set each fields of the LPTIM_InitStruct structure to its default 117 | * value. 118 | * @param LPTIM_InitStruct pointer to a @ref LL_LPTIM_InitTypeDef structure 119 | * @retval None 120 | */ 121 | void LL_LPTIM_StructInit(LL_LPTIM_InitTypeDef *LPTIM_InitStruct) 122 | { 123 | /* Set the default configuration */ 124 | LPTIM_InitStruct->ClockSource = LL_LPTIM_CLK_SOURCE_INTERNAL; 125 | LPTIM_InitStruct->Prescaler = LL_LPTIM_PRESCALER_DIV1; 126 | LPTIM_InitStruct->Waveform = LL_LPTIM_OUTPUT_WAVEFORM_PWM; 127 | LPTIM_InitStruct->Polarity = LL_LPTIM_OUTPUT_POLARITY_REGULAR; 128 | } 129 | 130 | /** 131 | * @brief Configure the LPTIMx peripheral according to the specified parameters. 132 | * @note LL_LPTIM_Init can only be called when the LPTIM instance is disabled. 133 | * @note LPTIMx can be disabled using unitary function @ref LL_LPTIM_Disable(). 134 | * @param LPTIMx LP Timer Instance 135 | * @param LPTIM_InitStruct pointer to a @ref LL_LPTIM_InitTypeDef structure 136 | * @retval An ErrorStatus enumeration value: 137 | * - SUCCESS: LPTIMx instance has been initialized 138 | * - ERROR: LPTIMx instance hasn't been initialized 139 | */ 140 | ErrorStatus LL_LPTIM_Init(LPTIM_TypeDef *LPTIMx, const LL_LPTIM_InitTypeDef *LPTIM_InitStruct) 141 | { 142 | ErrorStatus result = SUCCESS; 143 | /* Check the parameters */ 144 | assert_param(IS_LPTIM_INSTANCE(LPTIMx)); 145 | assert_param(IS_LL_LPTIM_CLOCK_SOURCE(LPTIM_InitStruct->ClockSource)); 146 | assert_param(IS_LL_LPTIM_CLOCK_PRESCALER(LPTIM_InitStruct->Prescaler)); 147 | assert_param(IS_LL_LPTIM_WAVEFORM(LPTIM_InitStruct->Waveform)); 148 | assert_param(IS_LL_LPTIM_OUTPUT_POLARITY(LPTIM_InitStruct->Polarity)); 149 | 150 | /* The LPTIMx_CFGR register must only be modified when the LPTIM is disabled 151 | (ENABLE bit is reset to 0). 152 | */ 153 | if (LL_LPTIM_IsEnabled(LPTIMx) == 1UL) 154 | { 155 | result = ERROR; 156 | } 157 | else 158 | { 159 | /* Set CKSEL bitfield according to ClockSource value */ 160 | /* Set PRESC bitfield according to Prescaler value */ 161 | /* Set WAVE bitfield according to Waveform value */ 162 | /* Set WAVEPOL bitfield according to Polarity value */ 163 | MODIFY_REG(LPTIMx->CFGR, 164 | (LPTIM_CFGR_CKSEL | LPTIM_CFGR_PRESC | LPTIM_CFGR_WAVE | LPTIM_CFGR_WAVPOL), 165 | LPTIM_InitStruct->ClockSource | \ 166 | LPTIM_InitStruct->Prescaler | \ 167 | LPTIM_InitStruct->Waveform | \ 168 | LPTIM_InitStruct->Polarity); 169 | } 170 | 171 | return result; 172 | } 173 | 174 | /** 175 | * @brief Disable the LPTIM instance 176 | * @rmtoll CR ENABLE LL_LPTIM_Disable 177 | * @param LPTIMx Low-Power Timer instance 178 | * @note The following sequence is required to solve LPTIM disable HW limitation. 179 | * Please check Errata Sheet ES0335 for more details under "MCU may remain 180 | * stuck in LPTIM interrupt when entering Stop mode" section. 181 | * @retval None 182 | */ 183 | void LL_LPTIM_Disable(LPTIM_TypeDef *LPTIMx) 184 | { 185 | LL_RCC_ClocksTypeDef rcc_clock; 186 | uint32_t tmpclksource = 0; 187 | uint32_t tmpIER; 188 | uint32_t tmpCFGR; 189 | uint32_t tmpCMP; 190 | uint32_t tmpARR; 191 | uint32_t primask_bit; 192 | 193 | /* Check the parameters */ 194 | assert_param(IS_LPTIM_INSTANCE(LPTIMx)); 195 | 196 | /* Enter critical section */ 197 | primask_bit = __get_PRIMASK(); 198 | __set_PRIMASK(1) ; 199 | 200 | /********** Save LPTIM Config *********/ 201 | /* Save LPTIM source clock */ 202 | switch ((uint32_t)LPTIMx) 203 | { 204 | case LPTIM1_BASE: 205 | tmpclksource = LL_RCC_GetLPTIMClockSource(LL_RCC_LPTIM1_CLKSOURCE); 206 | break; 207 | default: 208 | break; 209 | } 210 | 211 | /* Save LPTIM configuration registers */ 212 | tmpIER = LPTIMx->IER; 213 | tmpCFGR = LPTIMx->CFGR; 214 | tmpCMP = LPTIMx->CMP; 215 | tmpARR = LPTIMx->ARR; 216 | 217 | /************* Reset LPTIM ************/ 218 | (void)LL_LPTIM_DeInit(LPTIMx); 219 | 220 | /********* Restore LPTIM Config *******/ 221 | LL_RCC_GetSystemClocksFreq(&rcc_clock); 222 | 223 | if ((tmpCMP != 0UL) || (tmpARR != 0UL)) 224 | { 225 | /* Force LPTIM source kernel clock from APB */ 226 | switch ((uint32_t)LPTIMx) 227 | { 228 | case LPTIM1_BASE: 229 | LL_RCC_SetLPTIMClockSource(LL_RCC_LPTIM1_CLKSOURCE_PCLK1); 230 | break; 231 | default: 232 | break; 233 | } 234 | 235 | if (tmpCMP != 0UL) 236 | { 237 | /* Restore CMP and ARR registers (LPTIM should be enabled first) */ 238 | LPTIMx->CR |= LPTIM_CR_ENABLE; 239 | LPTIMx->CMP = tmpCMP; 240 | 241 | /* Polling on CMP write ok status after above restore operation */ 242 | do 243 | { 244 | rcc_clock.SYSCLK_Frequency--; /* Used for timeout */ 245 | } while (((LL_LPTIM_IsActiveFlag_CMPOK(LPTIMx) != 1UL)) && ((rcc_clock.SYSCLK_Frequency) > 0UL)); 246 | 247 | LL_LPTIM_ClearFlag_CMPOK(LPTIMx); 248 | } 249 | 250 | if (tmpARR != 0UL) 251 | { 252 | LPTIMx->CR |= LPTIM_CR_ENABLE; 253 | LPTIMx->ARR = tmpARR; 254 | 255 | LL_RCC_GetSystemClocksFreq(&rcc_clock); 256 | /* Polling on ARR write ok status after above restore operation */ 257 | do 258 | { 259 | rcc_clock.SYSCLK_Frequency--; /* Used for timeout */ 260 | } while (((LL_LPTIM_IsActiveFlag_ARROK(LPTIMx) != 1UL)) && ((rcc_clock.SYSCLK_Frequency) > 0UL)); 261 | 262 | LL_LPTIM_ClearFlag_ARROK(LPTIMx); 263 | } 264 | 265 | 266 | /* Restore LPTIM source kernel clock */ 267 | LL_RCC_SetLPTIMClockSource(tmpclksource); 268 | } 269 | 270 | /* Restore configuration registers (LPTIM should be disabled first) */ 271 | LPTIMx->CR &= ~(LPTIM_CR_ENABLE); 272 | LPTIMx->IER = tmpIER; 273 | LPTIMx->CFGR = tmpCFGR; 274 | 275 | /* Exit critical section: restore previous priority mask */ 276 | __set_PRIMASK(primask_bit); 277 | } 278 | 279 | /** 280 | * @} 281 | */ 282 | 283 | /** 284 | * @} 285 | */ 286 | 287 | /** 288 | * @} 289 | */ 290 | 291 | #endif /* LPTIM1 */ 292 | 293 | /** 294 | * @} 295 | */ 296 | 297 | #endif /* USE_FULL_LL_DRIVER */ 298 | -------------------------------------------------------------------------------- /Src/stm32l0xx_ll_pwr.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_ll_pwr.c 4 | * @author MCD Application Team 5 | * @brief PWR LL module driver. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2016 STMicroelectronics. 10 | * All rights reserved. 11 | * 12 | * This software is licensed under terms that can be found in the LICENSE file 13 | * in the root directory of this software component. 14 | * If no LICENSE file comes with this software, it is provided AS-IS. 15 | * 16 | ****************************************************************************** 17 | */ 18 | #if defined(USE_FULL_LL_DRIVER) 19 | 20 | /* Includes ------------------------------------------------------------------*/ 21 | #include "stm32l0xx_ll_pwr.h" 22 | #include "stm32l0xx_ll_bus.h" 23 | 24 | /** @addtogroup STM32L0xx_LL_Driver 25 | * @{ 26 | */ 27 | 28 | #if defined(PWR) 29 | 30 | /** @defgroup PWR_LL PWR 31 | * @{ 32 | */ 33 | 34 | /* Private types -------------------------------------------------------------*/ 35 | /* Private variables ---------------------------------------------------------*/ 36 | /* Private constants ---------------------------------------------------------*/ 37 | /* Private macros ------------------------------------------------------------*/ 38 | /* Private function prototypes -----------------------------------------------*/ 39 | 40 | /* Exported functions --------------------------------------------------------*/ 41 | /** @addtogroup PWR_LL_Exported_Functions 42 | * @{ 43 | */ 44 | 45 | /** @addtogroup PWR_LL_EF_Init 46 | * @{ 47 | */ 48 | 49 | /** 50 | * @brief De-initialize the PWR registers to their default reset values. 51 | * @retval An ErrorStatus enumeration value: 52 | * - SUCCESS: PWR registers are de-initialized 53 | * - ERROR: not applicable 54 | */ 55 | ErrorStatus LL_PWR_DeInit(void) 56 | { 57 | /* Force reset of PWR clock */ 58 | LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_PWR); 59 | 60 | /* Release reset of PWR clock */ 61 | LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_PWR); 62 | 63 | return SUCCESS; 64 | } 65 | 66 | /** 67 | * @} 68 | */ 69 | 70 | /** 71 | * @} 72 | */ 73 | 74 | /** 75 | * @} 76 | */ 77 | #endif /* defined(PWR) */ 78 | /** 79 | * @} 80 | */ 81 | 82 | #endif /* USE_FULL_LL_DRIVER */ 83 | -------------------------------------------------------------------------------- /Src/stm32l0xx_ll_rng.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_ll_rng.c 4 | * @author MCD Application Team 5 | * @brief RNG LL module driver. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2016 STMicroelectronics. 10 | * All rights reserved. 11 | * 12 | * This software is licensed under terms that can be found in the LICENSE file 13 | * in the root directory of this software component. 14 | * If no LICENSE file comes with this software, it is provided AS-IS. 15 | * 16 | ****************************************************************************** 17 | */ 18 | #if defined(USE_FULL_LL_DRIVER) 19 | 20 | /* Includes ------------------------------------------------------------------*/ 21 | #include "stm32l0xx_ll_rng.h" 22 | #include "stm32l0xx_ll_bus.h" 23 | 24 | #ifdef USE_FULL_ASSERT 25 | #include "stm32_assert.h" 26 | #else 27 | #define assert_param(expr) ((void)0U) 28 | #endif /* USE_FULL_ASSERT */ 29 | 30 | /** @addtogroup STM32L0xx_LL_Driver 31 | * @{ 32 | */ 33 | 34 | #if defined (RNG) 35 | 36 | /** @addtogroup RNG_LL 37 | * @{ 38 | */ 39 | 40 | /* Private types -------------------------------------------------------------*/ 41 | /* Private variables ---------------------------------------------------------*/ 42 | /* Private constants ---------------------------------------------------------*/ 43 | /* Private macros ------------------------------------------------------------*/ 44 | /* Private function prototypes -----------------------------------------------*/ 45 | 46 | /* Exported functions --------------------------------------------------------*/ 47 | /** @addtogroup RNG_LL_Exported_Functions 48 | * @{ 49 | */ 50 | 51 | /** @addtogroup RNG_LL_EF_Init 52 | * @{ 53 | */ 54 | 55 | /** 56 | * @brief De-initialize RNG registers (Registers restored to their default values). 57 | * @param RNGx RNG Instance 58 | * @retval An ErrorStatus enumeration value: 59 | * - SUCCESS: RNG registers are de-initialized 60 | * - ERROR: not applicable 61 | */ 62 | ErrorStatus LL_RNG_DeInit(const RNG_TypeDef *RNGx) 63 | { 64 | ErrorStatus status = SUCCESS; 65 | 66 | /* Check the parameters */ 67 | assert_param(IS_RNG_ALL_INSTANCE(RNGx)); 68 | if (RNGx == RNG) 69 | { 70 | /* Enable RNG reset state */ 71 | LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_RNG); 72 | 73 | /* Release RNG from reset state */ 74 | LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_RNG); 75 | } 76 | else 77 | { 78 | status = ERROR; 79 | } 80 | 81 | return status; 82 | } 83 | 84 | /** 85 | * @} 86 | */ 87 | 88 | /** 89 | * @} 90 | */ 91 | 92 | /** 93 | * @} 94 | */ 95 | 96 | #endif /* RNG */ 97 | 98 | /** 99 | * @} 100 | */ 101 | 102 | #endif /* USE_FULL_LL_DRIVER */ 103 | 104 | -------------------------------------------------------------------------------- /_htmresc/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/stm32l0xx-hal-driver/65da4cd8a10ad859ec8d9cd71f3f6c50735bd473/_htmresc/favicon.png -------------------------------------------------------------------------------- /_htmresc/st_logo_2020.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/stm32l0xx-hal-driver/65da4cd8a10ad859ec8d9cd71f3f6c50735bd473/_htmresc/st_logo_2020.png --------------------------------------------------------------------------------