├── .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 │ └── stm32l4xx_hal_can_legacy.h ├── stm32_assert_template.h ├── stm32l4xx_hal.h ├── stm32l4xx_hal_adc.h ├── stm32l4xx_hal_adc_ex.h ├── stm32l4xx_hal_can.h ├── stm32l4xx_hal_comp.h ├── stm32l4xx_hal_conf_template.h ├── stm32l4xx_hal_cortex.h ├── stm32l4xx_hal_crc.h ├── stm32l4xx_hal_crc_ex.h ├── stm32l4xx_hal_cryp.h ├── stm32l4xx_hal_cryp_ex.h ├── stm32l4xx_hal_dac.h ├── stm32l4xx_hal_dac_ex.h ├── stm32l4xx_hal_dcmi.h ├── stm32l4xx_hal_def.h ├── stm32l4xx_hal_dfsdm.h ├── stm32l4xx_hal_dfsdm_ex.h ├── stm32l4xx_hal_dma.h ├── stm32l4xx_hal_dma2d.h ├── stm32l4xx_hal_dma_ex.h ├── stm32l4xx_hal_dsi.h ├── stm32l4xx_hal_exti.h ├── stm32l4xx_hal_firewall.h ├── stm32l4xx_hal_flash.h ├── stm32l4xx_hal_flash_ex.h ├── stm32l4xx_hal_flash_ramfunc.h ├── stm32l4xx_hal_gfxmmu.h ├── stm32l4xx_hal_gpio.h ├── stm32l4xx_hal_gpio_ex.h ├── stm32l4xx_hal_hash.h ├── stm32l4xx_hal_hash_ex.h ├── stm32l4xx_hal_hcd.h ├── stm32l4xx_hal_i2c.h ├── stm32l4xx_hal_i2c_ex.h ├── stm32l4xx_hal_irda.h ├── stm32l4xx_hal_irda_ex.h ├── stm32l4xx_hal_iwdg.h ├── stm32l4xx_hal_lcd.h ├── stm32l4xx_hal_lptim.h ├── stm32l4xx_hal_ltdc.h ├── stm32l4xx_hal_ltdc_ex.h ├── stm32l4xx_hal_mmc.h ├── stm32l4xx_hal_mmc_ex.h ├── stm32l4xx_hal_nand.h ├── stm32l4xx_hal_nor.h ├── stm32l4xx_hal_opamp.h ├── stm32l4xx_hal_opamp_ex.h ├── stm32l4xx_hal_ospi.h ├── stm32l4xx_hal_pcd.h ├── stm32l4xx_hal_pcd_ex.h ├── stm32l4xx_hal_pka.h ├── stm32l4xx_hal_pssi.h ├── stm32l4xx_hal_pwr.h ├── stm32l4xx_hal_pwr_ex.h ├── stm32l4xx_hal_qspi.h ├── stm32l4xx_hal_rcc.h ├── stm32l4xx_hal_rcc_ex.h ├── stm32l4xx_hal_rng.h ├── stm32l4xx_hal_rng_ex.h ├── stm32l4xx_hal_rtc.h ├── stm32l4xx_hal_rtc_ex.h ├── stm32l4xx_hal_sai.h ├── stm32l4xx_hal_sai_ex.h ├── stm32l4xx_hal_sd.h ├── stm32l4xx_hal_sd_ex.h ├── stm32l4xx_hal_smartcard.h ├── stm32l4xx_hal_smartcard_ex.h ├── stm32l4xx_hal_smbus.h ├── stm32l4xx_hal_smbus_ex.h ├── stm32l4xx_hal_spi.h ├── stm32l4xx_hal_spi_ex.h ├── stm32l4xx_hal_sram.h ├── stm32l4xx_hal_swpmi.h ├── stm32l4xx_hal_tim.h ├── stm32l4xx_hal_tim_ex.h ├── stm32l4xx_hal_tsc.h ├── stm32l4xx_hal_uart.h ├── stm32l4xx_hal_uart_ex.h ├── stm32l4xx_hal_usart.h ├── stm32l4xx_hal_usart_ex.h ├── stm32l4xx_hal_wwdg.h ├── stm32l4xx_ll_adc.h ├── stm32l4xx_ll_bus.h ├── stm32l4xx_ll_comp.h ├── stm32l4xx_ll_cortex.h ├── stm32l4xx_ll_crc.h ├── stm32l4xx_ll_crs.h ├── stm32l4xx_ll_dac.h ├── stm32l4xx_ll_dma.h ├── stm32l4xx_ll_dma2d.h ├── stm32l4xx_ll_dmamux.h ├── stm32l4xx_ll_exti.h ├── stm32l4xx_ll_fmc.h ├── stm32l4xx_ll_gpio.h ├── stm32l4xx_ll_i2c.h ├── stm32l4xx_ll_iwdg.h ├── stm32l4xx_ll_lptim.h ├── stm32l4xx_ll_lpuart.h ├── stm32l4xx_ll_opamp.h ├── stm32l4xx_ll_pka.h ├── stm32l4xx_ll_pwr.h ├── stm32l4xx_ll_rcc.h ├── stm32l4xx_ll_rng.h ├── stm32l4xx_ll_rtc.h ├── stm32l4xx_ll_sdmmc.h ├── stm32l4xx_ll_spi.h ├── stm32l4xx_ll_swpmi.h ├── stm32l4xx_ll_system.h ├── stm32l4xx_ll_tim.h ├── stm32l4xx_ll_usart.h ├── stm32l4xx_ll_usb.h ├── stm32l4xx_ll_utils.h └── stm32l4xx_ll_wwdg.h ├── LICENSE.md ├── README.md ├── Release_Notes.html ├── SECURITY.md ├── Src ├── Legacy │ └── stm32l4xx_hal_can.c ├── stm32l4xx_hal.c ├── stm32l4xx_hal_adc.c ├── stm32l4xx_hal_adc_ex.c ├── stm32l4xx_hal_can.c ├── stm32l4xx_hal_comp.c ├── stm32l4xx_hal_cortex.c ├── stm32l4xx_hal_crc.c ├── stm32l4xx_hal_crc_ex.c ├── stm32l4xx_hal_cryp.c ├── stm32l4xx_hal_cryp_ex.c ├── stm32l4xx_hal_dac.c ├── stm32l4xx_hal_dac_ex.c ├── stm32l4xx_hal_dcmi.c ├── stm32l4xx_hal_dfsdm.c ├── stm32l4xx_hal_dfsdm_ex.c ├── stm32l4xx_hal_dma.c ├── stm32l4xx_hal_dma2d.c ├── stm32l4xx_hal_dma_ex.c ├── stm32l4xx_hal_dsi.c ├── stm32l4xx_hal_exti.c ├── stm32l4xx_hal_firewall.c ├── stm32l4xx_hal_flash.c ├── stm32l4xx_hal_flash_ex.c ├── stm32l4xx_hal_flash_ramfunc.c ├── stm32l4xx_hal_gfxmmu.c ├── stm32l4xx_hal_gpio.c ├── stm32l4xx_hal_hash.c ├── stm32l4xx_hal_hash_ex.c ├── stm32l4xx_hal_hcd.c ├── stm32l4xx_hal_i2c.c ├── stm32l4xx_hal_i2c_ex.c ├── stm32l4xx_hal_irda.c ├── stm32l4xx_hal_iwdg.c ├── stm32l4xx_hal_lcd.c ├── stm32l4xx_hal_lptim.c ├── stm32l4xx_hal_ltdc.c ├── stm32l4xx_hal_ltdc_ex.c ├── stm32l4xx_hal_mmc.c ├── stm32l4xx_hal_mmc_ex.c ├── stm32l4xx_hal_msp_template.c ├── stm32l4xx_hal_nand.c ├── stm32l4xx_hal_nor.c ├── stm32l4xx_hal_opamp.c ├── stm32l4xx_hal_opamp_ex.c ├── stm32l4xx_hal_ospi.c ├── stm32l4xx_hal_pcd.c ├── stm32l4xx_hal_pcd_ex.c ├── stm32l4xx_hal_pka.c ├── stm32l4xx_hal_pssi.c ├── stm32l4xx_hal_pwr.c ├── stm32l4xx_hal_pwr_ex.c ├── stm32l4xx_hal_qspi.c ├── stm32l4xx_hal_rcc.c ├── stm32l4xx_hal_rcc_ex.c ├── stm32l4xx_hal_rng.c ├── stm32l4xx_hal_rng_ex.c ├── stm32l4xx_hal_rtc.c ├── stm32l4xx_hal_rtc_ex.c ├── stm32l4xx_hal_sai.c ├── stm32l4xx_hal_sai_ex.c ├── stm32l4xx_hal_sd.c ├── stm32l4xx_hal_sd_ex.c ├── stm32l4xx_hal_smartcard.c ├── stm32l4xx_hal_smartcard_ex.c ├── stm32l4xx_hal_smbus.c ├── stm32l4xx_hal_smbus_ex.c ├── stm32l4xx_hal_spi.c ├── stm32l4xx_hal_spi_ex.c ├── stm32l4xx_hal_sram.c ├── stm32l4xx_hal_swpmi.c ├── stm32l4xx_hal_tim.c ├── stm32l4xx_hal_tim_ex.c ├── stm32l4xx_hal_timebase_tim_template.c ├── stm32l4xx_hal_tsc.c ├── stm32l4xx_hal_uart.c ├── stm32l4xx_hal_uart_ex.c ├── stm32l4xx_hal_usart.c ├── stm32l4xx_hal_usart_ex.c ├── stm32l4xx_hal_wwdg.c ├── stm32l4xx_ll_adc.c ├── stm32l4xx_ll_comp.c ├── stm32l4xx_ll_crc.c ├── stm32l4xx_ll_crs.c ├── stm32l4xx_ll_dac.c ├── stm32l4xx_ll_dma.c ├── stm32l4xx_ll_dma2d.c ├── stm32l4xx_ll_exti.c ├── stm32l4xx_ll_fmc.c ├── stm32l4xx_ll_gpio.c ├── stm32l4xx_ll_i2c.c ├── stm32l4xx_ll_lptim.c ├── stm32l4xx_ll_lpuart.c ├── stm32l4xx_ll_opamp.c ├── stm32l4xx_ll_pka.c ├── stm32l4xx_ll_pwr.c ├── stm32l4xx_ll_rcc.c ├── stm32l4xx_ll_rng.c ├── stm32l4xx_ll_rtc.c ├── stm32l4xx_ll_sdmmc.c ├── stm32l4xx_ll_spi.c ├── stm32l4xx_ll_swpmi.c ├── stm32l4xx_ll_tim.c ├── stm32l4xx_ll_usart.c ├── stm32l4xx_ll_usb.c └── stm32l4xx_ll_utils.c └── _htmresc ├── Add button.svg ├── Update.svg ├── 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 at 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, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /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) 2017 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((char *)__FILE__, __LINE__)) 43 | /* Exported functions ------------------------------------------------------- */ 44 | void assert_failed(char *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 | -------------------------------------------------------------------------------- /Inc/stm32l4xx_hal_crc_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_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) 2017 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 STM32L4xx_HAL_CRC_EX_H 21 | #define STM32L4xx_HAL_CRC_EX_H 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | /* Includes ------------------------------------------------------------------*/ 28 | #include "stm32l4xx_hal_def.h" 29 | 30 | /** @addtogroup STM32L4xx_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 /* STM32L4xx_HAL_CRC_EX_H */ 151 | -------------------------------------------------------------------------------- /Inc/stm32l4xx_hal_cryp_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_cryp_ex.h 4 | * @author MCD Application Team 5 | * @brief Header file of CRYPEx HAL module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2017 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 STM32L4xx_HAL_CRYP_EX_H 20 | #define STM32L4xx_HAL_CRYP_EX_H 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | #if defined(AES) 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "stm32l4xx_hal_def.h" 30 | 31 | /** @addtogroup STM32L4xx_HAL_Driver 32 | * @{ 33 | */ 34 | 35 | /** @addtogroup CRYPEx 36 | * @{ 37 | */ 38 | 39 | /* Exported types ------------------------------------------------------------*/ 40 | /* Exported constants --------------------------------------------------------*/ 41 | /* Exported functions --------------------------------------------------------*/ 42 | 43 | /** @addtogroup CRYPEx_Exported_Functions 44 | * @{ 45 | */ 46 | 47 | /** @addtogroup CRYPEx_Exported_Functions_Group1 48 | * @{ 49 | */ 50 | 51 | /* CallBack functions ********************************************************/ 52 | void HAL_CRYPEx_ComputationCpltCallback(CRYP_HandleTypeDef *hcryp); 53 | 54 | /** 55 | * @} 56 | */ 57 | 58 | /** @addtogroup CRYPEx_Exported_Functions_Group2 59 | * @{ 60 | */ 61 | 62 | /* AES encryption/decryption processing functions ****************************/ 63 | HAL_StatusTypeDef HAL_CRYPEx_AES(CRYP_HandleTypeDef *hcryp, uint8_t *pInputData, uint16_t Size, uint8_t *pOutputData, uint32_t Timeout); 64 | HAL_StatusTypeDef HAL_CRYPEx_AES_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pInputData, uint16_t Size, uint8_t *pOutputData); 65 | HAL_StatusTypeDef HAL_CRYPEx_AES_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pInputData, uint16_t Size, uint8_t *pOutputData); 66 | 67 | /* AES encryption/decryption/authentication processing functions *************/ 68 | HAL_StatusTypeDef HAL_CRYPEx_AES_Auth(CRYP_HandleTypeDef *hcryp, uint8_t *pInputData, uint64_t Size, uint8_t *pOutputData, uint32_t Timeout); 69 | HAL_StatusTypeDef HAL_CRYPEx_AES_Auth_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pInputData, uint64_t Size, uint8_t *pOutputData); 70 | HAL_StatusTypeDef HAL_CRYPEx_AES_Auth_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pInputData, uint64_t Size, uint8_t *pOutputData); 71 | 72 | /** 73 | * @} 74 | */ 75 | 76 | /** @addtogroup CRYPEx_Exported_Functions_Group3 77 | * @{ 78 | */ 79 | 80 | /* AES suspension/resumption functions ***************************************/ 81 | void HAL_CRYPEx_Read_IVRegisters(CRYP_HandleTypeDef *hcryp, uint8_t* Output); 82 | void HAL_CRYPEx_Write_IVRegisters(CRYP_HandleTypeDef *hcryp, uint8_t* Input); 83 | void HAL_CRYPEx_Read_SuspendRegisters(CRYP_HandleTypeDef *hcryp, uint8_t* Output); 84 | void HAL_CRYPEx_Write_SuspendRegisters(CRYP_HandleTypeDef *hcryp, uint8_t* Input); 85 | void HAL_CRYPEx_Read_KeyRegisters(CRYP_HandleTypeDef *hcryp, uint8_t* Output, uint32_t KeySize); 86 | void HAL_CRYPEx_Write_KeyRegisters(CRYP_HandleTypeDef *hcryp, uint8_t* Input, uint32_t KeySize); 87 | void HAL_CRYPEx_Read_ControlRegister(CRYP_HandleTypeDef *hcryp, uint8_t* Output); 88 | void HAL_CRYPEx_Write_ControlRegister(CRYP_HandleTypeDef *hcryp, uint8_t* Input); 89 | void HAL_CRYPEx_ProcessSuspend(CRYP_HandleTypeDef *hcryp); 90 | 91 | /** 92 | * @} 93 | */ 94 | 95 | 96 | /** 97 | * @} 98 | */ 99 | 100 | /* Private functions -----------------------------------------------------------*/ 101 | /** @addtogroup CRYPEx_Private_Functions CRYPEx Private Functions 102 | * @{ 103 | */ 104 | HAL_StatusTypeDef CRYP_AES_Auth_IT(CRYP_HandleTypeDef *hcryp); 105 | 106 | /** 107 | * @} 108 | */ 109 | 110 | 111 | /** 112 | * @} 113 | */ 114 | 115 | /** 116 | * @} 117 | */ 118 | 119 | #endif /* AES */ 120 | 121 | #ifdef __cplusplus 122 | } 123 | #endif 124 | 125 | #endif /* STM32L4xx_HAL_CRYP_EX_H */ 126 | -------------------------------------------------------------------------------- /Inc/stm32l4xx_hal_def.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_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) 2017 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 STM32L4xx_HAL_DEF_H 22 | #define STM32L4xx_HAL_DEF_H 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "stm32l4xx.h" 30 | #include "Legacy/stm32_hal_legacy.h" /* Aliases file for old names compatibility */ 31 | #include 32 | 33 | /* Exported types ------------------------------------------------------------*/ 34 | 35 | /** 36 | * @brief HAL Status structures definition 37 | */ 38 | typedef enum 39 | { 40 | HAL_OK = 0x00, 41 | HAL_ERROR = 0x01, 42 | HAL_BUSY = 0x02, 43 | HAL_TIMEOUT = 0x03 44 | } HAL_StatusTypeDef; 45 | 46 | /** 47 | * @brief HAL Lock structures definition 48 | */ 49 | typedef enum 50 | { 51 | HAL_UNLOCKED = 0x00, 52 | HAL_LOCKED = 0x01 53 | } HAL_LockTypeDef; 54 | 55 | /* Exported macros -----------------------------------------------------------*/ 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 = 0) 88 | 89 | #if (USE_RTOS == 1) 90 | /* Reserved for future use */ 91 | #error " USE_RTOS should be 0 in the current HAL release " 92 | #else 93 | #define __HAL_LOCK(__HANDLE__) \ 94 | do{ \ 95 | if((__HANDLE__)->Lock == HAL_LOCKED) \ 96 | { \ 97 | return HAL_BUSY; \ 98 | } \ 99 | else \ 100 | { \ 101 | (__HANDLE__)->Lock = HAL_LOCKED; \ 102 | } \ 103 | }while (0) 104 | 105 | #define __HAL_UNLOCK(__HANDLE__) \ 106 | do{ \ 107 | (__HANDLE__)->Lock = HAL_UNLOCKED; \ 108 | }while (0) 109 | #endif /* USE_RTOS */ 110 | 111 | 112 | #if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) /* ARM Compiler V6 */ 113 | #ifndef __weak 114 | #define __weak __attribute__((weak)) 115 | #endif 116 | #ifndef __packed 117 | #define __packed __attribute__((packed)) 118 | #endif 119 | #elif defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */ 120 | #ifndef __weak 121 | #define __weak __attribute__((weak)) 122 | #endif /* __weak */ 123 | #ifndef __packed 124 | #define __packed __attribute__((__packed__)) 125 | #endif /* __packed */ 126 | #endif /* __GNUC__ */ 127 | 128 | 129 | /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */ 130 | #if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) /* ARM Compiler V6 */ 131 | #ifndef __ALIGN_BEGIN 132 | #define __ALIGN_BEGIN 133 | #endif 134 | #ifndef __ALIGN_END 135 | #define __ALIGN_END __attribute__ ((aligned (4))) 136 | #endif 137 | #elif defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */ 138 | #ifndef __ALIGN_END 139 | #define __ALIGN_END __attribute__ ((aligned (4))) 140 | #endif /* __ALIGN_END */ 141 | #ifndef __ALIGN_BEGIN 142 | #define __ALIGN_BEGIN 143 | #endif /* __ALIGN_BEGIN */ 144 | #else 145 | #ifndef __ALIGN_END 146 | #define __ALIGN_END 147 | #endif /* __ALIGN_END */ 148 | #ifndef __ALIGN_BEGIN 149 | #if defined (__CC_ARM) /* ARM Compiler V5 */ 150 | #define __ALIGN_BEGIN __align(4) 151 | #elif defined (__ICCARM__) /* IAR Compiler */ 152 | #define __ALIGN_BEGIN 153 | #endif /* __CC_ARM */ 154 | #endif /* __ALIGN_BEGIN */ 155 | #endif /* __GNUC__ */ 156 | 157 | /** 158 | * @brief __RAM_FUNC definition 159 | */ 160 | #if defined ( __CC_ARM ) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) 161 | /* ARM Compiler V4/V5 and V6 162 | -------------------------- 163 | RAM functions are defined using the toolchain options. 164 | Functions that are executed in RAM should reside in a separate source module. 165 | Using the 'Options for File' dialog you can simply change the 'Code / Const' 166 | area of a module to a memory space in physical RAM. 167 | Available memory areas are declared in the 'Target' tab of the 'Options for Target' 168 | dialog. 169 | */ 170 | #define __RAM_FUNC 171 | 172 | #elif defined ( __ICCARM__ ) 173 | /* ICCARM Compiler 174 | --------------- 175 | RAM functions are defined using a specific toolchain keyword "__ramfunc". 176 | */ 177 | #define __RAM_FUNC __ramfunc 178 | 179 | #elif defined ( __GNUC__ ) 180 | /* GNU Compiler 181 | ------------ 182 | RAM functions are defined using a specific toolchain attribute 183 | "__attribute__((section(".RamFunc")))". 184 | */ 185 | #define __RAM_FUNC __attribute__((section(".RamFunc"))) 186 | 187 | #endif 188 | 189 | /** 190 | * @brief __NOINLINE definition 191 | */ 192 | #if defined ( __CC_ARM ) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) || defined ( __GNUC__ ) 193 | /* ARM V4/V5 and V6 & GNU Compiler 194 | ------------------------------- 195 | */ 196 | #define __NOINLINE __attribute__ ( (noinline) ) 197 | 198 | #elif defined ( __ICCARM__ ) 199 | /* ICCARM Compiler 200 | --------------- 201 | */ 202 | #define __NOINLINE _Pragma("optimize = no_inline") 203 | 204 | #endif 205 | 206 | 207 | #ifdef __cplusplus 208 | } 209 | #endif 210 | 211 | #endif /* STM32L4xx_HAL_DEF_H */ 212 | -------------------------------------------------------------------------------- /Inc/stm32l4xx_hal_dfsdm_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_dfsdm_ex.h 4 | * @author MCD Application Team 5 | * @brief Header file of DFSDM HAL extended module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2017 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 STM32L4xx_HAL_DFSDM_EX_H 21 | #define STM32L4xx_HAL_DFSDM_EX_H 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | #if defined(STM32L4R5xx) || defined(STM32L4R7xx) || defined(STM32L4R9xx) || defined(STM32L4S5xx) || defined(STM32L4S7xx) || defined(STM32L4S9xx) || \ 28 | defined(STM32L4P5xx) || defined(STM32L4Q5xx) 29 | 30 | /* Includes ------------------------------------------------------------------*/ 31 | #include "stm32l4xx_hal_def.h" 32 | 33 | /** @addtogroup STM32L4xx_HAL_Driver 34 | * @{ 35 | */ 36 | 37 | /** @addtogroup DFSDMEx 38 | * @{ 39 | */ 40 | 41 | /* Exported types ------------------------------------------------------------*/ 42 | /* Exported constants --------------------------------------------------------*/ 43 | /* Exported macros -----------------------------------------------------------*/ 44 | /* Exported functions --------------------------------------------------------*/ 45 | 46 | /** @addtogroup DFSDMEx_Exported_Functions DFSDM Extended Exported Functions 47 | * @{ 48 | */ 49 | 50 | /** @addtogroup DFSDMEx_Exported_Functions_Group1_Channel Extended channel operation functions 51 | * @{ 52 | */ 53 | 54 | HAL_StatusTypeDef HAL_DFDSMEx_ChannelSetPulsesSkipping(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t PulsesValue); 55 | HAL_StatusTypeDef HAL_DFDSMEx_ChannelGetPulsesSkipping(const DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t *PulsesValue); 56 | 57 | /** 58 | * @} 59 | */ 60 | 61 | /** 62 | * @} 63 | */ 64 | 65 | /* Private macros ------------------------------------------------------------*/ 66 | 67 | /** @addtogroup DFSDMEx_Private_Macros DFSDM Extended Private Macros 68 | * @{ 69 | */ 70 | 71 | #define IS_DFSDM_CHANNEL_SKIPPING_VALUE(VALUE) ((VALUE) < 64U) 72 | 73 | /** 74 | * @} 75 | */ 76 | 77 | /** 78 | * @} 79 | */ 80 | 81 | /** 82 | * @} 83 | */ 84 | 85 | #endif /* STM32L4R5xx || STM32L4R7xx || STM32L4R9xx || STM32L4S5xx || STM32L4S7xx || STM32L4S9xx || STM32L4P5xx || STM32L4Q5xx */ 86 | 87 | #ifdef __cplusplus 88 | } 89 | #endif 90 | 91 | #endif /* STM32L4xx_HAL_DFSDM_EX_H */ 92 | -------------------------------------------------------------------------------- /Inc/stm32l4xx_hal_flash_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_flash_ex.h 4 | * @author MCD Application Team 5 | * @brief Header file of FLASH HAL Extended module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2017 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 STM32L4xx_HAL_FLASH_EX_H 20 | #define STM32L4xx_HAL_FLASH_EX_H 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "stm32l4xx_hal_def.h" 28 | 29 | /** @addtogroup STM32L4xx_HAL_Driver 30 | * @{ 31 | */ 32 | 33 | /** @addtogroup FLASHEx 34 | * @{ 35 | */ 36 | 37 | /* Exported types ------------------------------------------------------------*/ 38 | 39 | /* Exported constants --------------------------------------------------------*/ 40 | #if defined (FLASH_CFGR_LVEN) 41 | /** @addtogroup FLASHEx_Exported_Constants 42 | * @{ 43 | */ 44 | /** @defgroup FLASHEx_LVE_PIN_CFG FLASHEx LVE pin configuration 45 | * @{ 46 | */ 47 | #define FLASH_LVE_PIN_CTRL 0x00000000U /*!< LVE FLASH pin controlled by power controller */ 48 | #define FLASH_LVE_PIN_FORCED FLASH_CFGR_LVEN /*!< LVE FLASH pin enforced to low (external SMPS used) */ 49 | /** 50 | * @} 51 | */ 52 | 53 | /** 54 | * @} 55 | */ 56 | #endif /* FLASH_CFGR_LVEN */ 57 | 58 | /* Exported macro ------------------------------------------------------------*/ 59 | 60 | /* Exported functions --------------------------------------------------------*/ 61 | /** @addtogroup FLASHEx_Exported_Functions 62 | * @{ 63 | */ 64 | 65 | /* Extended Program operation functions *************************************/ 66 | /** @addtogroup FLASHEx_Exported_Functions_Group1 67 | * @{ 68 | */ 69 | HAL_StatusTypeDef HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t *PageError); 70 | HAL_StatusTypeDef HAL_FLASHEx_Erase_IT(FLASH_EraseInitTypeDef *pEraseInit); 71 | HAL_StatusTypeDef HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit); 72 | void HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit); 73 | /** 74 | * @} 75 | */ 76 | 77 | #if defined (FLASH_CFGR_LVEN) 78 | /** @addtogroup FLASHEx_Exported_Functions_Group2 79 | * @{ 80 | */ 81 | HAL_StatusTypeDef HAL_FLASHEx_ConfigLVEPin(uint32_t ConfigLVE); 82 | /** 83 | * @} 84 | */ 85 | #endif /* FLASH_CFGR_LVEN */ 86 | 87 | /** 88 | * @} 89 | */ 90 | 91 | /* Private function ----------------------------------------------------------*/ 92 | /** @addtogroup FLASHEx_Private_Functions FLASHEx Private Functions 93 | * @{ 94 | */ 95 | void FLASH_PageErase(uint32_t Page, uint32_t Banks); 96 | void FLASH_FlushCaches(void); 97 | /** 98 | * @} 99 | */ 100 | 101 | /* Private macros ------------------------------------------------------------*/ 102 | /** 103 | @cond 0 104 | */ 105 | #if defined (FLASH_CFGR_LVEN) 106 | #define IS_FLASH_LVE_PIN(CFG) (((CFG) == FLASH_LVE_PIN_CTRL) || ((CFG) == FLASH_LVE_PIN_FORCED)) 107 | #endif /* FLASH_CFGR_LVEN */ 108 | /** 109 | @endcond 110 | */ 111 | 112 | /** 113 | * @} 114 | */ 115 | 116 | /** 117 | * @} 118 | */ 119 | 120 | #ifdef __cplusplus 121 | } 122 | #endif 123 | 124 | #endif /* STM32L4xx_HAL_FLASH_EX_H */ 125 | 126 | -------------------------------------------------------------------------------- /Inc/stm32l4xx_hal_flash_ramfunc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_flash_ramfunc.h 4 | * @author MCD Application Team 5 | * @brief Header file of FLASH RAMFUNC driver. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2017 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 STM32L4xx_FLASH_RAMFUNC_H 20 | #define STM32L4xx_FLASH_RAMFUNC_H 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "stm32l4xx_hal_def.h" 28 | 29 | /** @addtogroup STM32L4xx_HAL_Driver 30 | * @{ 31 | */ 32 | 33 | /** @addtogroup FLASH_RAMFUNC 34 | * @{ 35 | */ 36 | 37 | /* Exported types ------------------------------------------------------------*/ 38 | /* Exported macro ------------------------------------------------------------*/ 39 | /* Exported functions --------------------------------------------------------*/ 40 | /** @addtogroup FLASH_RAMFUNC_Exported_Functions 41 | * @{ 42 | */ 43 | 44 | /** @addtogroup FLASH_RAMFUNC_Exported_Functions_Group1 45 | * @{ 46 | */ 47 | /* Peripheral Control functions ************************************************/ 48 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_EnableRunPowerDown(void); 49 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_DisableRunPowerDown(void); 50 | #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) || defined (STM32L4R5xx) || defined (STM32L4R7xx) || defined (STM32L4R9xx) || defined (STM32L4S5xx) || defined (STM32L4S7xx) || defined (STM32L4S9xx) 51 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_OB_DBankConfig(uint32_t DBankConfig); 52 | #endif 53 | /** 54 | * @} 55 | */ 56 | 57 | /** 58 | * @} 59 | */ 60 | 61 | /** 62 | * @} 63 | */ 64 | 65 | /** 66 | * @} 67 | */ 68 | 69 | #ifdef __cplusplus 70 | } 71 | #endif 72 | 73 | #endif /* STM32L4xx_FLASH_RAMFUNC_H */ 74 | 75 | -------------------------------------------------------------------------------- /Inc/stm32l4xx_hal_hash_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_hash_ex.h 4 | * @author MCD Application Team 5 | * @brief Header file of HASH HAL module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2017 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 STM32L4xx_HAL_HASH_EX_H 21 | #define STM32L4xx_HAL_HASH_EX_H 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | /* Includes ------------------------------------------------------------------*/ 28 | #include "stm32l4xx_hal_def.h" 29 | 30 | /** @addtogroup STM32L4xx_HAL_Driver 31 | * @{ 32 | */ 33 | #if defined (HASH) 34 | /** @addtogroup HASHEx 35 | * @{ 36 | */ 37 | 38 | /* Exported types ------------------------------------------------------------*/ 39 | /* Exported constants --------------------------------------------------------*/ 40 | /* Exported macro ------------------------------------------------------------*/ 41 | 42 | 43 | /* Exported functions --------------------------------------------------------*/ 44 | 45 | /** @addtogroup HASHEx_Exported_Functions HASH Extended Exported Functions 46 | * @{ 47 | */ 48 | 49 | /** @addtogroup HASHEx_Exported_Functions_Group1 HASH extended processing functions in polling mode 50 | * @{ 51 | */ 52 | 53 | HAL_StatusTypeDef HAL_HASHEx_SHA224_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, 54 | uint8_t *pOutBuffer, uint32_t Timeout); 55 | HAL_StatusTypeDef HAL_HASHEx_SHA224_Accmlt(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 56 | HAL_StatusTypeDef HAL_HASHEx_SHA224_Accmlt_End(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, 57 | uint8_t *pOutBuffer, uint32_t Timeout); 58 | HAL_StatusTypeDef HAL_HASHEx_SHA256_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, 59 | uint8_t *pOutBuffer, uint32_t Timeout); 60 | HAL_StatusTypeDef HAL_HASHEx_SHA256_Accmlt(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 61 | HAL_StatusTypeDef HAL_HASHEx_SHA256_Accmlt_End(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, 62 | uint8_t *pOutBuffer, uint32_t Timeout); 63 | 64 | /** 65 | * @} 66 | */ 67 | 68 | /** @addtogroup HASHEx_Exported_Functions_Group2 HASH extended processing functions in interrupt mode 69 | * @{ 70 | */ 71 | 72 | HAL_StatusTypeDef HAL_HASHEx_SHA224_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, 73 | uint8_t *pOutBuffer); 74 | HAL_StatusTypeDef HAL_HASHEx_SHA224_Accmlt_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 75 | HAL_StatusTypeDef HAL_HASHEx_SHA224_Accmlt_End_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, 76 | uint8_t *pOutBuffer); 77 | HAL_StatusTypeDef HAL_HASHEx_SHA256_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, 78 | uint8_t *pOutBuffer); 79 | HAL_StatusTypeDef HAL_HASHEx_SHA256_Accmlt_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 80 | HAL_StatusTypeDef HAL_HASHEx_SHA256_Accmlt_End_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, 81 | uint8_t *pOutBuffer); 82 | 83 | /** 84 | * @} 85 | */ 86 | 87 | /** @addtogroup HASHEx_Exported_Functions_Group3 HASH extended processing functions in DMA mode 88 | * @{ 89 | */ 90 | HAL_StatusTypeDef HAL_HASHEx_SHA224_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 91 | HAL_StatusTypeDef HAL_HASHEx_SHA224_Finish(HASH_HandleTypeDef *hhash, uint8_t *pOutBuffer, uint32_t Timeout); 92 | HAL_StatusTypeDef HAL_HASHEx_SHA256_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 93 | HAL_StatusTypeDef HAL_HASHEx_SHA256_Finish(HASH_HandleTypeDef *hhash, uint8_t *pOutBuffer, uint32_t Timeout); 94 | 95 | /** 96 | * @} 97 | */ 98 | 99 | /** @addtogroup HASHEx_Exported_Functions_Group4 HMAC extended processing functions in polling mode 100 | * @{ 101 | */ 102 | HAL_StatusTypeDef HAL_HMACEx_SHA224_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, 103 | uint8_t *pOutBuffer, uint32_t Timeout); 104 | HAL_StatusTypeDef HAL_HMACEx_SHA256_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, 105 | uint8_t *pOutBuffer, uint32_t Timeout); 106 | /** 107 | * @} 108 | */ 109 | 110 | /** @addtogroup HASHEx_Exported_Functions_Group5 HMAC extended processing functions in interrupt mode 111 | * @{ 112 | */ 113 | 114 | HAL_StatusTypeDef HAL_HMACEx_SHA224_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, 115 | uint8_t *pOutBuffer); 116 | HAL_StatusTypeDef HAL_HMACEx_SHA256_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, 117 | uint8_t *pOutBuffer); 118 | 119 | /** 120 | * @} 121 | */ 122 | 123 | /** @addtogroup HASHEx_Exported_Functions_Group6 HMAC extended processing functions in DMA mode 124 | * @{ 125 | */ 126 | 127 | HAL_StatusTypeDef HAL_HMACEx_SHA224_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 128 | HAL_StatusTypeDef HAL_HMACEx_SHA256_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 129 | 130 | /** 131 | * @} 132 | */ 133 | 134 | /** @addtogroup HASHEx_Exported_Functions_Group7 Multi-buffer HMAC extended processing functions in DMA mode 135 | * @{ 136 | */ 137 | 138 | HAL_StatusTypeDef HAL_HMACEx_MD5_Step1_2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 139 | HAL_StatusTypeDef HAL_HMACEx_MD5_Step2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 140 | HAL_StatusTypeDef HAL_HMACEx_MD5_Step2_3_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 141 | 142 | HAL_StatusTypeDef HAL_HMACEx_SHA1_Step1_2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 143 | HAL_StatusTypeDef HAL_HMACEx_SHA1_Step2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 144 | HAL_StatusTypeDef HAL_HMACEx_SHA1_Step2_3_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 145 | HAL_StatusTypeDef HAL_HMACEx_SHA224_Step1_2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 146 | HAL_StatusTypeDef HAL_HMACEx_SHA224_Step2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 147 | HAL_StatusTypeDef HAL_HMACEx_SHA224_Step2_3_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 148 | 149 | HAL_StatusTypeDef HAL_HMACEx_SHA256_Step1_2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 150 | HAL_StatusTypeDef HAL_HMACEx_SHA256_Step2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 151 | HAL_StatusTypeDef HAL_HMACEx_SHA256_Step2_3_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 152 | /** 153 | * @} 154 | */ 155 | 156 | /** 157 | * @} 158 | */ 159 | 160 | /** 161 | * @} 162 | */ 163 | #endif /* HASH*/ 164 | /** 165 | * @} 166 | */ 167 | 168 | 169 | #ifdef __cplusplus 170 | } 171 | #endif 172 | 173 | 174 | #endif /* STM32L4xx_HAL_HASH_EX_H */ 175 | 176 | -------------------------------------------------------------------------------- /Inc/stm32l4xx_hal_i2c_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_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) 2017 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 STM32L4xx_HAL_I2C_EX_H 21 | #define STM32L4xx_HAL_I2C_EX_H 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | /* Includes ------------------------------------------------------------------*/ 28 | #include "stm32l4xx_hal_def.h" 29 | 30 | /** @addtogroup STM32L4xx_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 | #define I2C_FASTMODEPLUS_PB6 SYSCFG_CFGR1_I2C_PB6_FMP /*!< Enable Fast Mode Plus on PB6 */ 58 | #define I2C_FASTMODEPLUS_PB7 SYSCFG_CFGR1_I2C_PB7_FMP /*!< Enable Fast Mode Plus on PB7 */ 59 | #if defined(SYSCFG_CFGR1_I2C_PB8_FMP) 60 | #define I2C_FASTMODEPLUS_PB8 SYSCFG_CFGR1_I2C_PB8_FMP /*!< Enable Fast Mode Plus on PB8 */ 61 | #define I2C_FASTMODEPLUS_PB9 SYSCFG_CFGR1_I2C_PB9_FMP /*!< Enable Fast Mode Plus on PB9 */ 62 | #else 63 | #define I2C_FASTMODEPLUS_PB8 (uint32_t)(0x00000010U | I2C_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus PB8 not supported */ 64 | #define I2C_FASTMODEPLUS_PB9 (uint32_t)(0x00000012U | I2C_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus PB9 not supported */ 65 | #endif /* SYSCFG_CFGR1_I2C_PB8_FMP */ 66 | #define I2C_FASTMODEPLUS_I2C1 SYSCFG_CFGR1_I2C1_FMP /*!< Enable Fast Mode Plus on I2C1 pins */ 67 | #if defined(SYSCFG_CFGR1_I2C2_FMP) 68 | #define I2C_FASTMODEPLUS_I2C2 SYSCFG_CFGR1_I2C2_FMP /*!< Enable Fast Mode Plus on I2C2 pins */ 69 | #else 70 | #define I2C_FASTMODEPLUS_I2C2 (uint32_t)(0x00000200U | I2C_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus I2C2 not supported */ 71 | #endif /* SYSCFG_CFGR1_I2C2_FMP */ 72 | #define I2C_FASTMODEPLUS_I2C3 SYSCFG_CFGR1_I2C3_FMP /*!< Enable Fast Mode Plus on I2C3 pins */ 73 | #if defined(SYSCFG_CFGR1_I2C4_FMP) 74 | #define I2C_FASTMODEPLUS_I2C4 SYSCFG_CFGR1_I2C4_FMP /*!< Enable Fast Mode Plus on I2C4 pins */ 75 | #else 76 | #define I2C_FASTMODEPLUS_I2C4 (uint32_t)(0x00000800U | I2C_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus I2C4 not supported */ 77 | #endif /* SYSCFG_CFGR1_I2C4_FMP */ 78 | /** 79 | * @} 80 | */ 81 | 82 | /** 83 | * @} 84 | */ 85 | 86 | /* Exported macro ------------------------------------------------------------*/ 87 | /** @defgroup I2CEx_Exported_Macros I2C Extended Exported Macros 88 | * @{ 89 | */ 90 | 91 | /** 92 | * @} 93 | */ 94 | 95 | /* Exported functions --------------------------------------------------------*/ 96 | /** @addtogroup I2CEx_Exported_Functions I2C Extended Exported Functions 97 | * @{ 98 | */ 99 | 100 | /** @addtogroup I2CEx_Exported_Functions_Group1 Filter Mode Functions 101 | * @{ 102 | */ 103 | /* Peripheral Control functions ************************************************/ 104 | HAL_StatusTypeDef HAL_I2CEx_ConfigAnalogFilter(I2C_HandleTypeDef *hi2c, uint32_t AnalogFilter); 105 | HAL_StatusTypeDef HAL_I2CEx_ConfigDigitalFilter(I2C_HandleTypeDef *hi2c, uint32_t DigitalFilter); 106 | /** 107 | * @} 108 | */ 109 | 110 | /** @addtogroup I2CEx_Exported_Functions_Group2 WakeUp Mode Functions 111 | * @{ 112 | */ 113 | HAL_StatusTypeDef HAL_I2CEx_EnableWakeUp(I2C_HandleTypeDef *hi2c); 114 | HAL_StatusTypeDef HAL_I2CEx_DisableWakeUp(I2C_HandleTypeDef *hi2c); 115 | /** 116 | * @} 117 | */ 118 | 119 | /** @addtogroup I2CEx_Exported_Functions_Group3 Fast Mode Plus Functions 120 | * @{ 121 | */ 122 | void HAL_I2CEx_EnableFastModePlus(uint32_t ConfigFastModePlus); 123 | void HAL_I2CEx_DisableFastModePlus(uint32_t ConfigFastModePlus); 124 | /** 125 | * @} 126 | */ 127 | 128 | /** 129 | * @} 130 | */ 131 | 132 | /* Private constants ---------------------------------------------------------*/ 133 | /** @defgroup I2CEx_Private_Constants I2C Extended Private Constants 134 | * @{ 135 | */ 136 | 137 | /** 138 | * @} 139 | */ 140 | 141 | /* Private macros ------------------------------------------------------------*/ 142 | /** @defgroup I2CEx_Private_Macro I2C Extended Private Macros 143 | * @{ 144 | */ 145 | #define IS_I2C_ANALOG_FILTER(FILTER) (((FILTER) == I2C_ANALOGFILTER_ENABLE) || \ 146 | ((FILTER) == I2C_ANALOGFILTER_DISABLE)) 147 | 148 | #define IS_I2C_DIGITAL_FILTER(FILTER) ((FILTER) <= 0x0000000FU) 149 | 150 | #define IS_I2C_FASTMODEPLUS(__CONFIG__) ((((__CONFIG__) & I2C_FMP_NOT_SUPPORTED) != I2C_FMP_NOT_SUPPORTED) && \ 151 | ((((__CONFIG__) & (I2C_FASTMODEPLUS_PB6)) == I2C_FASTMODEPLUS_PB6) || \ 152 | (((__CONFIG__) & (I2C_FASTMODEPLUS_PB7)) == I2C_FASTMODEPLUS_PB7) || \ 153 | (((__CONFIG__) & (I2C_FASTMODEPLUS_PB8)) == I2C_FASTMODEPLUS_PB8) || \ 154 | (((__CONFIG__) & (I2C_FASTMODEPLUS_PB9)) == I2C_FASTMODEPLUS_PB9) || \ 155 | (((__CONFIG__) & (I2C_FASTMODEPLUS_I2C1)) == I2C_FASTMODEPLUS_I2C1) || \ 156 | (((__CONFIG__) & (I2C_FASTMODEPLUS_I2C2)) == I2C_FASTMODEPLUS_I2C2) || \ 157 | (((__CONFIG__) & (I2C_FASTMODEPLUS_I2C3)) == I2C_FASTMODEPLUS_I2C3) || \ 158 | (((__CONFIG__) & (I2C_FASTMODEPLUS_I2C4)) == I2C_FASTMODEPLUS_I2C4))) 159 | /** 160 | * @} 161 | */ 162 | 163 | /* Private Functions ---------------------------------------------------------*/ 164 | /** @defgroup I2CEx_Private_Functions I2C Extended Private Functions 165 | * @{ 166 | */ 167 | /* Private functions are defined in stm32l4xx_hal_i2c_ex.c file */ 168 | /** 169 | * @} 170 | */ 171 | 172 | /** 173 | * @} 174 | */ 175 | 176 | /** 177 | * @} 178 | */ 179 | 180 | #ifdef __cplusplus 181 | } 182 | #endif 183 | 184 | #endif /* STM32L4xx_HAL_I2C_EX_H */ 185 | -------------------------------------------------------------------------------- /Inc/stm32l4xx_hal_iwdg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_iwdg.h 4 | * @author MCD Application Team 5 | * @brief Header file of IWDG HAL module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2017 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 STM32L4xx_HAL_IWDG_H 21 | #define STM32L4xx_HAL_IWDG_H 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | /* Includes ------------------------------------------------------------------*/ 28 | #include "stm32l4xx_hal_def.h" 29 | 30 | /** @addtogroup STM32L4xx_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 /* STM32L4xx_HAL_IWDG_H */ 238 | -------------------------------------------------------------------------------- /Inc/stm32l4xx_hal_ltdc_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_ltdc_ex.h 4 | * @author MCD Application Team 5 | * @brief Header file of LTDC HAL Extension module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2017 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 STM32L4xx_HAL_LTDC_EX_H 21 | #define STM32L4xx_HAL_LTDC_EX_H 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | /* Includes ------------------------------------------------------------------*/ 28 | #include "stm32l4xx_hal_def.h" 29 | 30 | #if defined (LTDC) && defined (DSI) 31 | 32 | #include "stm32l4xx_hal_dsi.h" 33 | 34 | /** @addtogroup STM32L4xx_HAL_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup LTDCEx 39 | * @{ 40 | */ 41 | 42 | /* Exported types ------------------------------------------------------------*/ 43 | /* Exported constants --------------------------------------------------------*/ 44 | /* Exported macro ------------------------------------------------------------*/ 45 | /* Exported functions --------------------------------------------------------*/ 46 | /** @addtogroup LTDCEx_Exported_Functions 47 | * @{ 48 | */ 49 | 50 | /** @addtogroup LTDCEx_Exported_Functions_Group1 51 | * @{ 52 | */ 53 | HAL_StatusTypeDef HAL_LTDCEx_StructInitFromVideoConfig(LTDC_HandleTypeDef *hltdc, DSI_VidCfgTypeDef *VidCfg); 54 | HAL_StatusTypeDef HAL_LTDCEx_StructInitFromAdaptedCommandConfig(LTDC_HandleTypeDef *hltdc, DSI_CmdCfgTypeDef *CmdCfg); 55 | /** 56 | * @} 57 | */ 58 | 59 | /** 60 | * @} 61 | */ 62 | 63 | /* Private types -------------------------------------------------------------*/ 64 | /* Private variables ---------------------------------------------------------*/ 65 | /* Private constants ---------------------------------------------------------*/ 66 | /* Private macros ------------------------------------------------------------*/ 67 | /* Private functions ---------------------------------------------------------*/ 68 | 69 | /** 70 | * @} 71 | */ 72 | 73 | /** 74 | * @} 75 | */ 76 | 77 | #endif /* LTDC && DSI */ 78 | 79 | #ifdef __cplusplus 80 | } 81 | #endif 82 | 83 | #endif /* STM32L4xx_HAL_LTDC_EX_H */ 84 | -------------------------------------------------------------------------------- /Inc/stm32l4xx_hal_mmc_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_mmc_ex.h 4 | * @author MCD Application Team 5 | * @brief Header file of SD HAL extended module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2017 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 STM32L4xx_HAL_MMC_EX_H 21 | #define STM32L4xx_HAL_MMC_EX_H 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | #if defined(STM32L4P5xx) || defined(STM32L4Q5xx) || defined(STM32L4R5xx) || defined(STM32L4R7xx) || defined(STM32L4R9xx) || defined(STM32L4S5xx) || defined(STM32L4S7xx) || defined(STM32L4S9xx) 28 | 29 | /* Includes ------------------------------------------------------------------*/ 30 | #include "stm32l4xx_hal_def.h" 31 | 32 | /** @addtogroup STM32L4xx_HAL_Driver 33 | * @{ 34 | */ 35 | 36 | /** @addtogroup MMCEx 37 | * @brief SD HAL extended module driver 38 | * @{ 39 | */ 40 | 41 | /* Exported types ------------------------------------------------------------*/ 42 | /** @addtogroup MMCEx_Exported_Types 43 | * @{ 44 | */ 45 | 46 | /** @addtogroup MMCEx_Exported_Types_Group1 47 | * @{ 48 | */ 49 | typedef enum 50 | { 51 | MMC_DMA_BUFFER0 = 0x00U, /*!< selects MMC internal DMA Buffer 0 */ 52 | MMC_DMA_BUFFER1 = 0x01U, /*!< selects MMC internal DMA Buffer 1 */ 53 | 54 | }HAL_MMCEx_DMABuffer_MemoryTypeDef; 55 | 56 | 57 | /** 58 | * @} 59 | */ 60 | 61 | /** 62 | * @} 63 | */ 64 | /* Exported constants --------------------------------------------------------*/ 65 | /* Exported macro ------------------------------------------------------------*/ 66 | /* Exported functions --------------------------------------------------------*/ 67 | /** @defgroup MMCEx_Exported_Functions MMCEx Exported Functions 68 | * @{ 69 | */ 70 | 71 | /** @defgroup MMCEx_Exported_Functions_Group1 MultiBuffer functions 72 | * @{ 73 | */ 74 | HAL_StatusTypeDef HAL_MMCEx_ConfigDMAMultiBuffer(MMC_HandleTypeDef *hmmc, uint32_t * pDataBuffer0, uint32_t * pDataBuffer1, uint32_t BufferSize); 75 | HAL_StatusTypeDef HAL_MMCEx_ReadBlocksDMAMultiBuffer(MMC_HandleTypeDef *hmmc, uint32_t BlockAdd, uint32_t NumberOfBlocks); 76 | HAL_StatusTypeDef HAL_MMCEx_WriteBlocksDMAMultiBuffer(MMC_HandleTypeDef *hmmc, uint32_t BlockAdd, uint32_t NumberOfBlocks); 77 | HAL_StatusTypeDef HAL_MMCEx_ChangeDMABuffer(MMC_HandleTypeDef *hmmc, HAL_MMCEx_DMABuffer_MemoryTypeDef Buffer, uint32_t *pDataBuffer); 78 | 79 | void HAL_MMCEx_Read_DMADoubleBuffer0CpltCallback(MMC_HandleTypeDef *hmmc); 80 | void HAL_MMCEx_Read_DMADoubleBuffer1CpltCallback(MMC_HandleTypeDef *hmmc); 81 | void HAL_MMCEx_Write_DMADoubleBuffer0CpltCallback(MMC_HandleTypeDef *hmmc); 82 | void HAL_MMCEx_Write_DMADoubleBuffer1CpltCallback(MMC_HandleTypeDef *hmmc); 83 | 84 | /** 85 | * @} 86 | */ 87 | 88 | /** 89 | * @} 90 | */ 91 | 92 | /* Private types -------------------------------------------------------------*/ 93 | /* Private defines -----------------------------------------------------------*/ 94 | /* Private variables ---------------------------------------------------------*/ 95 | /* Private constants ---------------------------------------------------------*/ 96 | /* Private macros ------------------------------------------------------------*/ 97 | /* Private functions prototypes ----------------------------------------------*/ 98 | /* Private functions ---------------------------------------------------------*/ 99 | 100 | /** 101 | * @} 102 | */ 103 | 104 | /** 105 | * @} 106 | */ 107 | #endif /* STM32L4P5xx || STM32L4Q5xx || STM32L4R5xx || STM32L4R7xx || STM32L4R9xx || STM32L4S5xx || STM32L4S7xx || STM32L4S9xx */ 108 | 109 | #ifdef __cplusplus 110 | } 111 | #endif 112 | 113 | 114 | #endif /* STM32L4xx_HAL_MMCEx_H */ 115 | -------------------------------------------------------------------------------- /Inc/stm32l4xx_hal_opamp_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_opamp_ex.h 4 | * @author MCD Application Team 5 | * @brief Header file of OPAMP HAL Extended module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2017 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 STM32L4xx_HAL_OPAMP_EX_H 21 | #define STM32L4xx_HAL_OPAMP_EX_H 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | /* Includes ------------------------------------------------------------------*/ 28 | #include "stm32l4xx_hal_def.h" 29 | 30 | /** @addtogroup STM32L4xx_HAL_Driver 31 | * @{ 32 | */ 33 | 34 | /** @addtogroup OPAMPEx 35 | * @{ 36 | */ 37 | /* Exported types ------------------------------------------------------------*/ 38 | /* Exported constants --------------------------------------------------------*/ 39 | /* Exported macro ------------------------------------------------------------*/ 40 | /* Exported functions --------------------------------------------------------*/ 41 | /** @addtogroup OPAMPEx_Exported_Functions OPAMPEx Exported Functions 42 | * @{ 43 | */ 44 | 45 | #if defined (STM32L471xx) || defined (STM32L475xx) || defined (STM32L476xx) || defined (STM32L485xx) || defined (STM32L486xx) || \ 46 | defined (STM32L496xx) || defined (STM32L4A6xx) || \ 47 | defined (STM32L4P5xx) || defined (STM32L4Q5xx) || \ 48 | defined (STM32L4R5xx) || defined (STM32L4R7xx) || defined (STM32L4R9xx) || defined (STM32L4S5xx) || defined (STM32L4S7xx) || defined (STM32L4S9xx) 49 | 50 | 51 | /* I/O operation functions *****************************************************/ 52 | /** @addtogroup OPAMPEx_Exported_Functions_Group1 Extended Input and Output operation functions 53 | * @{ 54 | */ 55 | 56 | HAL_StatusTypeDef HAL_OPAMPEx_SelfCalibrateAll(OPAMP_HandleTypeDef *hopamp1, OPAMP_HandleTypeDef *hopamp2); 57 | 58 | /** 59 | * @} 60 | */ 61 | #endif 62 | 63 | /* Peripheral Control functions ************************************************/ 64 | /** @addtogroup OPAMPEx_Exported_Functions_Group2 65 | * @{ 66 | */ 67 | HAL_StatusTypeDef HAL_OPAMPEx_Unlock(OPAMP_HandleTypeDef *hopamp); 68 | /** 69 | * @} 70 | */ 71 | 72 | /** 73 | * @} 74 | */ 75 | 76 | /** 77 | * @} 78 | */ 79 | 80 | /** 81 | * @} 82 | */ 83 | 84 | #ifdef __cplusplus 85 | } 86 | #endif 87 | 88 | #endif /* STM32L4xx_HAL_OPAMP_EX_H */ 89 | -------------------------------------------------------------------------------- /Inc/stm32l4xx_hal_pcd_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_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) 2017 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 STM32L4xx_HAL_PCD_EX_H 21 | #define STM32L4xx_HAL_PCD_EX_H 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif /* __cplusplus */ 26 | 27 | /* Includes ------------------------------------------------------------------*/ 28 | #include "stm32l4xx_hal_def.h" 29 | 30 | #if defined (USB) || defined (USB_OTG_FS) 31 | /** @addtogroup STM32L4xx_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 | #if defined (USB_OTG_FS) 49 | HAL_StatusTypeDef HAL_PCDEx_SetTxFiFo(PCD_HandleTypeDef *hpcd, uint8_t fifo, uint16_t size); 50 | HAL_StatusTypeDef HAL_PCDEx_SetRxFiFo(PCD_HandleTypeDef *hpcd, uint16_t size); 51 | #endif /* defined (USB_OTG_FS) */ 52 | 53 | #if defined (USB) 54 | HAL_StatusTypeDef HAL_PCDEx_PMAConfig(PCD_HandleTypeDef *hpcd, uint16_t ep_addr, 55 | uint16_t ep_kind, uint32_t pmaadress); 56 | #endif /* defined (USB) */ 57 | 58 | HAL_StatusTypeDef HAL_PCDEx_ActivateLPM(PCD_HandleTypeDef *hpcd); 59 | HAL_StatusTypeDef HAL_PCDEx_DeActivateLPM(PCD_HandleTypeDef *hpcd); 60 | 61 | 62 | HAL_StatusTypeDef HAL_PCDEx_ActivateBCD(PCD_HandleTypeDef *hpcd); 63 | HAL_StatusTypeDef HAL_PCDEx_DeActivateBCD(PCD_HandleTypeDef *hpcd); 64 | void HAL_PCDEx_BCD_VBUSDetect(PCD_HandleTypeDef *hpcd); 65 | 66 | void HAL_PCDEx_LPM_Callback(PCD_HandleTypeDef *hpcd, PCD_LPM_MsgTypeDef msg); 67 | void HAL_PCDEx_BCD_Callback(PCD_HandleTypeDef *hpcd, PCD_BCD_MsgTypeDef msg); 68 | 69 | /** 70 | * @} 71 | */ 72 | 73 | /** 74 | * @} 75 | */ 76 | 77 | /** 78 | * @} 79 | */ 80 | 81 | /** 82 | * @} 83 | */ 84 | #endif /* defined (USB) || defined (USB_OTG_FS) */ 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif /* __cplusplus */ 89 | 90 | 91 | #endif /* STM32L4xx_HAL_PCD_EX_H */ 92 | -------------------------------------------------------------------------------- /Inc/stm32l4xx_hal_rng_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_rng_ex.h 4 | * @author MCD Application Team 5 | * @brief Header file of RNG HAL Extension module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2017 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 STM32L4xx_HAL_RNG_EX_H 21 | #define STM32L4xx_HAL_RNG_EX_H 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | /* Includes ------------------------------------------------------------------*/ 28 | #include "stm32l4xx_hal_def.h" 29 | 30 | /** @addtogroup STM32L4xx_HAL_Driver 31 | * @{ 32 | */ 33 | 34 | #if defined(RNG) 35 | #if defined(RNG_CR_CONDRST) 36 | 37 | /** @defgroup RNGEx RNGEx 38 | * @brief RNG Extension HAL module driver 39 | * @{ 40 | */ 41 | 42 | /* Exported types ------------------------------------------------------------*/ 43 | /** @defgroup RNGEx_Exported_Types RNGEx Exported Types 44 | * @brief RNGEx Exported types 45 | * @{ 46 | */ 47 | 48 | /** 49 | * @brief RNGEx Configuration Structure definition 50 | */ 51 | 52 | typedef struct 53 | { 54 | uint32_t Config1; /*!< Config1 must be a value between 0 and 0x3F */ 55 | uint32_t Config2; /*!< Config2 must be a value between 0 and 0x7 */ 56 | uint32_t Config3; /*!< Config3 must be a value between 0 and 0xF */ 57 | uint32_t ClockDivider; /*!< Clock Divider factor.This parameter can 58 | be a value of @ref RNGEx_Clock_Divider_Factor */ 59 | uint32_t NistCompliance; /*!< NIST compliance.This parameter can be a 60 | value of @ref RNGEx_NIST_Compliance */ 61 | } RNG_ConfigTypeDef; 62 | 63 | /** 64 | * @} 65 | */ 66 | 67 | /* Exported constants --------------------------------------------------------*/ 68 | /** @defgroup RNGEx_Exported_Constants RNGEx Exported Constants 69 | * @{ 70 | */ 71 | 72 | /** @defgroup RNGEx_Clock_Divider_Factor Value used to configure an internal 73 | * programmable divider acting on the incoming RNG clock 74 | * @{ 75 | */ 76 | #define RNG_CLKDIV_BY_1 (0x00000000UL) /*!< No clock division */ 77 | #define RNG_CLKDIV_BY_2 (RNG_CR_CLKDIV_0) 78 | /*!< 2 RNG clock cycles per internal RNG clock */ 79 | #define RNG_CLKDIV_BY_4 (RNG_CR_CLKDIV_1) 80 | /*!< 4 RNG clock cycles per internal RNG clock */ 81 | #define RNG_CLKDIV_BY_8 (RNG_CR_CLKDIV_1 | RNG_CR_CLKDIV_0) 82 | /*!< 8 RNG clock cycles per internal RNG clock */ 83 | #define RNG_CLKDIV_BY_16 (RNG_CR_CLKDIV_2) 84 | /*!< 16 RNG clock cycles per internal RNG clock */ 85 | #define RNG_CLKDIV_BY_32 (RNG_CR_CLKDIV_2 | RNG_CR_CLKDIV_0) 86 | /*!< 32 RNG clock cycles per internal RNG clock */ 87 | #define RNG_CLKDIV_BY_64 (RNG_CR_CLKDIV_2 | RNG_CR_CLKDIV_1) 88 | /*!< 64 RNG clock cycles per internal RNG clock */ 89 | #define RNG_CLKDIV_BY_128 (RNG_CR_CLKDIV_2 | RNG_CR_CLKDIV_1 | RNG_CR_CLKDIV_0) 90 | /*!< 128 RNG clock cycles per internal RNG clock */ 91 | #define RNG_CLKDIV_BY_256 (RNG_CR_CLKDIV_3) 92 | /*!< 256 RNG clock cycles per internal RNG clock */ 93 | #define RNG_CLKDIV_BY_512 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_0) 94 | /*!< 512 RNG clock cycles per internal RNG clock */ 95 | #define RNG_CLKDIV_BY_1024 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_1) 96 | /*!< 1024 RNG clock cycles per internal RNG clock */ 97 | #define RNG_CLKDIV_BY_2048 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_1 | RNG_CR_CLKDIV_0) 98 | /*!< 2048 RNG clock cycles per internal RNG clock */ 99 | #define RNG_CLKDIV_BY_4096 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_2) 100 | /*!< 4096 RNG clock cycles per internal RNG clock */ 101 | #define RNG_CLKDIV_BY_8192 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_2 | RNG_CR_CLKDIV_0) 102 | /*!< 8192 RNG clock cycles per internal RNG clock */ 103 | #define RNG_CLKDIV_BY_16384 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_2 | RNG_CR_CLKDIV_1) 104 | /*!< 16384 RNG clock cycles per internal RNG clock */ 105 | #define RNG_CLKDIV_BY_32768 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_2 | RNG_CR_CLKDIV_1 | RNG_CR_CLKDIV_0) 106 | /*!< 32768 RNG clock cycles per internal RNG clock */ 107 | /** 108 | * @} 109 | */ 110 | 111 | /** @defgroup RNGEx_NIST_Compliance NIST Compliance configuration 112 | * @{ 113 | */ 114 | #define RNG_NIST_COMPLIANT (0x00000000UL) /*!< NIST compliant configuration*/ 115 | #define RNG_CUSTOM_NIST (RNG_CR_NISTC) /*!< Custom NIST configuration */ 116 | 117 | /** 118 | * @} 119 | */ 120 | 121 | /** 122 | * @} 123 | */ 124 | 125 | /* Private types -------------------------------------------------------------*/ 126 | /** @defgroup RNGEx_Private_Types RNGEx Private Types 127 | * @{ 128 | */ 129 | 130 | /** 131 | * @} 132 | */ 133 | 134 | /* Private variables ---------------------------------------------------------*/ 135 | /** @defgroup RNGEx_Private_Variables RNGEx Private Variables 136 | * @{ 137 | */ 138 | 139 | /** 140 | * @} 141 | */ 142 | 143 | /* Private constants ---------------------------------------------------------*/ 144 | /** @defgroup RNGEx_Private_Constants RNGEx Private Constants 145 | * @{ 146 | */ 147 | 148 | /** 149 | * @} 150 | */ 151 | 152 | /* Private macros ------------------------------------------------------------*/ 153 | /** @defgroup RNGEx_Private_Macros RNGEx Private Macros 154 | * @{ 155 | */ 156 | 157 | #define IS_RNG_CLOCK_DIVIDER(__CLOCK_DIV__) (((__CLOCK_DIV__) == RNG_CLKDIV_BY_1) || \ 158 | ((__CLOCK_DIV__) == RNG_CLKDIV_BY_2) || \ 159 | ((__CLOCK_DIV__) == RNG_CLKDIV_BY_4) || \ 160 | ((__CLOCK_DIV__) == RNG_CLKDIV_BY_8) || \ 161 | ((__CLOCK_DIV__) == RNG_CLKDIV_BY_16) || \ 162 | ((__CLOCK_DIV__) == RNG_CLKDIV_BY_32) || \ 163 | ((__CLOCK_DIV__) == RNG_CLKDIV_BY_64) || \ 164 | ((__CLOCK_DIV__) == RNG_CLKDIV_BY_128) || \ 165 | ((__CLOCK_DIV__) == RNG_CLKDIV_BY_256) || \ 166 | ((__CLOCK_DIV__) == RNG_CLKDIV_BY_512) || \ 167 | ((__CLOCK_DIV__) == RNG_CLKDIV_BY_1024) || \ 168 | ((__CLOCK_DIV__) == RNG_CLKDIV_BY_2048) || \ 169 | ((__CLOCK_DIV__) == RNG_CLKDIV_BY_4096) || \ 170 | ((__CLOCK_DIV__) == RNG_CLKDIV_BY_8192) || \ 171 | ((__CLOCK_DIV__) == RNG_CLKDIV_BY_16384) || \ 172 | ((__CLOCK_DIV__) == RNG_CLKDIV_BY_32768)) 173 | 174 | 175 | #define IS_RNG_NIST_COMPLIANCE(__NIST_COMPLIANCE__) (((__NIST_COMPLIANCE__) == RNG_NIST_COMPLIANT) || \ 176 | ((__NIST_COMPLIANCE__) == RNG_CUSTOM_NIST)) 177 | 178 | #define IS_RNG_CONFIG1(__CONFIG1__) ((__CONFIG1__) <= 0x3FUL) 179 | 180 | #define IS_RNG_CONFIG2(__CONFIG2__) ((__CONFIG2__) <= 0x07UL) 181 | 182 | #define IS_RNG_CONFIG3(__CONFIG3__) ((__CONFIG3__) <= 0xFUL) 183 | 184 | 185 | /** 186 | * @} 187 | */ 188 | 189 | /* Private functions ---------------------------------------------------------*/ 190 | /** @defgroup RNGEx_Private_Functions RNGEx Private Functions 191 | * @{ 192 | */ 193 | 194 | /** 195 | * @} 196 | */ 197 | 198 | /* Exported functions --------------------------------------------------------*/ 199 | /** @addtogroup RNGEx_Exported_Functions 200 | * @{ 201 | */ 202 | 203 | /** @addtogroup RNGEx_Exported_Functions_Group1 204 | * @{ 205 | */ 206 | HAL_StatusTypeDef HAL_RNGEx_SetConfig(RNG_HandleTypeDef *hrng, const RNG_ConfigTypeDef *pConf); 207 | HAL_StatusTypeDef HAL_RNGEx_GetConfig(RNG_HandleTypeDef *hrng, RNG_ConfigTypeDef *pConf); 208 | HAL_StatusTypeDef HAL_RNGEx_LockConfig(RNG_HandleTypeDef *hrng); 209 | 210 | /** 211 | * @} 212 | */ 213 | 214 | /** @addtogroup RNGEx_Exported_Functions_Group2 215 | * @{ 216 | */ 217 | HAL_StatusTypeDef HAL_RNGEx_RecoverSeedError(RNG_HandleTypeDef *hrng); 218 | 219 | /** 220 | * @} 221 | */ 222 | 223 | /** 224 | * @} 225 | */ 226 | 227 | /** 228 | * @} 229 | */ 230 | 231 | /** 232 | * @} 233 | */ 234 | 235 | #endif /* RNG_CR_CONDRST */ 236 | #endif /* RNG */ 237 | 238 | /** 239 | * @} 240 | */ 241 | 242 | #ifdef __cplusplus 243 | } 244 | #endif 245 | 246 | 247 | #endif /* STM32L4xx_HAL_RNG_EX_H */ 248 | 249 | -------------------------------------------------------------------------------- /Inc/stm32l4xx_hal_sai_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_sai_ex.h 4 | * @author MCD Application Team 5 | * @brief Header file of SAI HAL extended module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2017 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 STM32L4xx_HAL_SAI_EX_H 21 | #define STM32L4xx_HAL_SAI_EX_H 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | #if defined(STM32L4R5xx) || defined(STM32L4R7xx) || defined(STM32L4R9xx) || defined(STM32L4S5xx) || defined(STM32L4S7xx) || defined(STM32L4S9xx) || \ 28 | defined(STM32L4P5xx) || defined(STM32L4Q5xx) 29 | 30 | /* Includes ------------------------------------------------------------------*/ 31 | #include "stm32l4xx_hal_def.h" 32 | 33 | /** @addtogroup STM32L4xx_HAL_Driver 34 | * @{ 35 | */ 36 | 37 | /** @addtogroup SAIEx 38 | * @{ 39 | */ 40 | 41 | /* Exported types ------------------------------------------------------------*/ 42 | /** @defgroup SAIEx_Exported_Types SAIEx Exported Types 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @brief PDM microphone delay structure definition 48 | */ 49 | typedef struct 50 | { 51 | uint32_t MicPair; /*!< Specifies which pair of microphones is selected. 52 | This parameter must be a number between Min_Data = 1 and Max_Data = 3. */ 53 | 54 | uint32_t LeftDelay; /*!< Specifies the delay in PDM clock unit to apply on left microphone. 55 | This parameter must be a number between Min_Data = 0 and Max_Data = 7. */ 56 | 57 | uint32_t RightDelay; /*!< Specifies the delay in PDM clock unit to apply on right microphone. 58 | This parameter must be a number between Min_Data = 0 and Max_Data = 7. */ 59 | } SAIEx_PdmMicDelayParamTypeDef; 60 | 61 | /** 62 | * @} 63 | */ 64 | 65 | /* Exported constants --------------------------------------------------------*/ 66 | /* Exported macros -----------------------------------------------------------*/ 67 | /* Exported functions --------------------------------------------------------*/ 68 | /** @addtogroup SAIEx_Exported_Functions SAIEx Extended Exported Functions 69 | * @{ 70 | */ 71 | 72 | /** @addtogroup SAIEx_Exported_Functions_Group1 Peripheral Control functions 73 | * @{ 74 | */ 75 | HAL_StatusTypeDef HAL_SAIEx_ConfigPdmMicDelay(const SAI_HandleTypeDef *hsai, 76 | const SAIEx_PdmMicDelayParamTypeDef *pdmMicDelay); 77 | /** 78 | * @} 79 | */ 80 | 81 | /** 82 | * @} 83 | */ 84 | 85 | /* Private macros ------------------------------------------------------------*/ 86 | /** @addtogroup SAIEx_Private_Macros SAIEx Extended Private Macros 87 | * @{ 88 | */ 89 | #define IS_SAI_PDM_MIC_DELAY(VALUE) ((VALUE) <= 7U) 90 | /** 91 | * @} 92 | */ 93 | 94 | /** 95 | * @} 96 | */ 97 | 98 | /** 99 | * @} 100 | */ 101 | 102 | #endif /* STM32L4R5xx || STM32L4R7xx || STM32L4R9xx || STM32L4S5xx || STM32L4S7xx || STM32L4S9xx || */ 103 | /* STM32L4P5xx || STM32L4Q5xx */ 104 | 105 | #ifdef __cplusplus 106 | } 107 | #endif 108 | 109 | #endif /* STM32L4xx_HAL_SAI_EX_H */ 110 | 111 | -------------------------------------------------------------------------------- /Inc/stm32l4xx_hal_sd_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_sd_ex.h 4 | * @author MCD Application Team 5 | * @brief Header file of SD HAL extended module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2017 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 STM32L4xx_HAL_SD_EX_H 21 | #define STM32L4xx_HAL_SD_EX_H 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | #if defined(STM32L4P5xx) || defined(STM32L4Q5xx) || defined(STM32L4R5xx) || defined(STM32L4R7xx) || defined(STM32L4R9xx) || defined(STM32L4S5xx) || defined(STM32L4S7xx) || defined(STM32L4S9xx) 28 | 29 | /* Includes ------------------------------------------------------------------*/ 30 | #include "stm32l4xx_hal_def.h" 31 | 32 | /** @addtogroup STM32L4xx_HAL_Driver 33 | * @{ 34 | */ 35 | 36 | /** @addtogroup SDEx 37 | * @brief SD HAL extended module driver 38 | * @{ 39 | */ 40 | 41 | /* Exported types ------------------------------------------------------------*/ 42 | /** @defgroup SDEx_Exported_Types SDEx Exported Types 43 | * @{ 44 | */ 45 | 46 | /** @defgroup SDEx_Exported_Types_Group1 SD Card Internal DMA Buffer structure 47 | * @{ 48 | */ 49 | typedef enum 50 | { 51 | SD_DMA_BUFFER0 = 0x00U, /*!< selects SD internal DMA Buffer 0 */ 52 | SD_DMA_BUFFER1 = 0x01U, /*!< selects SD internal DMA Buffer 1 */ 53 | 54 | }HAL_SDEx_DMABuffer_MemoryTypeDef; 55 | 56 | 57 | /** 58 | * @} 59 | */ 60 | 61 | /** 62 | * @} 63 | */ 64 | /* Exported constants --------------------------------------------------------*/ 65 | /* Exported macro ------------------------------------------------------------*/ 66 | /* Exported functions --------------------------------------------------------*/ 67 | /** @defgroup SDEx_Exported_Functions SDEx Exported Functions 68 | * @{ 69 | */ 70 | 71 | /** @defgroup SDEx_Exported_Functions_Group1 HighSpeed functions 72 | * @{ 73 | */ 74 | uint32_t HAL_SDEx_HighSpeed (SD_HandleTypeDef *hsd); 75 | 76 | void HAL_SDEx_DriveTransceiver_1_8V_Callback(FlagStatus status); 77 | 78 | /** 79 | * @} 80 | */ 81 | 82 | /** @defgroup SDEx_Exported_Functions_Group2 MultiBuffer functions 83 | * @{ 84 | */ 85 | HAL_StatusTypeDef HAL_SDEx_ConfigDMAMultiBuffer(SD_HandleTypeDef *hsd, uint32_t * pDataBuffer0, uint32_t * pDataBuffer1, uint32_t BufferSize); 86 | HAL_StatusTypeDef HAL_SDEx_ReadBlocksDMAMultiBuffer(SD_HandleTypeDef *hsd, uint32_t BlockAdd, uint32_t NumberOfBlocks); 87 | HAL_StatusTypeDef HAL_SDEx_WriteBlocksDMAMultiBuffer(SD_HandleTypeDef *hsd, uint32_t BlockAdd, uint32_t NumberOfBlocks); 88 | HAL_StatusTypeDef HAL_SDEx_ChangeDMABuffer(SD_HandleTypeDef *hsd, HAL_SDEx_DMABuffer_MemoryTypeDef Buffer, uint32_t *pDataBuffer); 89 | 90 | void HAL_SDEx_Read_DMADoubleBuffer0CpltCallback(SD_HandleTypeDef *hsd); 91 | void HAL_SDEx_Read_DMADoubleBuffer1CpltCallback(SD_HandleTypeDef *hsd); 92 | void HAL_SDEx_Write_DMADoubleBuffer0CpltCallback(SD_HandleTypeDef *hsd); 93 | void HAL_SDEx_Write_DMADoubleBuffer1CpltCallback(SD_HandleTypeDef *hsd); 94 | 95 | /** 96 | * @} 97 | */ 98 | 99 | /** 100 | * @} 101 | */ 102 | 103 | /* Private types -------------------------------------------------------------*/ 104 | /* Private defines -----------------------------------------------------------*/ 105 | /* Private variables ---------------------------------------------------------*/ 106 | /* Private constants ---------------------------------------------------------*/ 107 | /* Private macros ------------------------------------------------------------*/ 108 | /* Private functions prototypes ----------------------------------------------*/ 109 | /* Private functions ---------------------------------------------------------*/ 110 | 111 | /** 112 | * @} 113 | */ 114 | 115 | /** 116 | * @} 117 | */ 118 | 119 | #endif /* STM32L4P5xx || STM32L4Q5xx || STM32L4R5xx || STM32L4R7xx || STM32L4R9xx || STM32L4S5xx || STM32L4S7xx || STM32L4S9xx */ 120 | 121 | #ifdef __cplusplus 122 | } 123 | #endif 124 | 125 | 126 | #endif /* STM32L4xx_HAL_SDEx_H */ 127 | -------------------------------------------------------------------------------- /Inc/stm32l4xx_hal_smbus_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_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) 2017 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 STM32L4xx_HAL_SMBUS_EX_H 21 | #define STM32L4xx_HAL_SMBUS_EX_H 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | /* Includes ------------------------------------------------------------------*/ 28 | #include "stm32l4xx_hal_def.h" 29 | 30 | /** @addtogroup STM32L4xx_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 | #define SMBUS_FASTMODEPLUS_PB6 SYSCFG_CFGR1_I2C_PB6_FMP /*!< Enable Fast Mode Plus on PB6 */ 49 | #define SMBUS_FASTMODEPLUS_PB7 SYSCFG_CFGR1_I2C_PB7_FMP /*!< Enable Fast Mode Plus on PB7 */ 50 | #if defined(SYSCFG_CFGR1_I2C_PB8_FMP) 51 | #define SMBUS_FASTMODEPLUS_PB8 SYSCFG_CFGR1_I2C_PB8_FMP /*!< Enable Fast Mode Plus on PB8 */ 52 | #define SMBUS_FASTMODEPLUS_PB9 SYSCFG_CFGR1_I2C_PB9_FMP /*!< Enable Fast Mode Plus on PB9 */ 53 | #else 54 | #define SMBUS_FASTMODEPLUS_PB8 (uint32_t)(0x00000010U | SMBUS_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus PB8 not supported */ 55 | #define SMBUS_FASTMODEPLUS_PB9 (uint32_t)(0x00000012U | SMBUS_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus PB9 not supported */ 56 | #endif /* SYSCFG_CFGR1_I2C_PB8_FMP */ 57 | #define SMBUS_FASTMODEPLUS_I2C1 SYSCFG_CFGR1_I2C1_FMP /*!< Enable Fast Mode Plus on I2C1 pins */ 58 | #if defined(SYSCFG_CFGR1_I2C2_FMP) 59 | #define SMBUS_FASTMODEPLUS_I2C2 SYSCFG_CFGR1_I2C2_FMP /*!< Enable Fast Mode Plus on I2C2 pins */ 60 | #else 61 | #define SMBUS_FASTMODEPLUS_I2C2 (uint32_t)(0x00000200U | SMBUS_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus I2C2 not supported */ 62 | #endif /* SYSCFG_CFGR1_I2C2_FMP */ 63 | #define SMBUS_FASTMODEPLUS_I2C3 SYSCFG_CFGR1_I2C3_FMP /*!< Enable Fast Mode Plus on I2C3 pins */ 64 | #if defined(SYSCFG_CFGR1_I2C4_FMP) 65 | #define SMBUS_FASTMODEPLUS_I2C4 SYSCFG_CFGR1_I2C4_FMP /*!< Enable Fast Mode Plus on I2C4 pins */ 66 | #else 67 | #define SMBUS_FASTMODEPLUS_I2C4 (uint32_t)(0x00000800U | SMBUS_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus I2C4 not supported */ 68 | #endif /* SYSCFG_CFGR1_I2C4_FMP */ 69 | /** 70 | * @} 71 | */ 72 | 73 | /** 74 | * @} 75 | */ 76 | 77 | /* Exported macro ------------------------------------------------------------*/ 78 | /** @defgroup SMBUSEx_Exported_Macros SMBUS Extended Exported Macros 79 | * @{ 80 | */ 81 | 82 | /** 83 | * @} 84 | */ 85 | 86 | /* Exported functions --------------------------------------------------------*/ 87 | /** @addtogroup SMBUSEx_Exported_Functions SMBUS Extended Exported Functions 88 | * @{ 89 | */ 90 | 91 | /** @addtogroup SMBUSEx_Exported_Functions_Group2 WakeUp Mode Functions 92 | * @{ 93 | */ 94 | /* Peripheral Control functions ************************************************/ 95 | HAL_StatusTypeDef HAL_SMBUSEx_EnableWakeUp(SMBUS_HandleTypeDef *hsmbus); 96 | HAL_StatusTypeDef HAL_SMBUSEx_DisableWakeUp(SMBUS_HandleTypeDef *hsmbus); 97 | /** 98 | * @} 99 | */ 100 | 101 | /** @addtogroup SMBUSEx_Exported_Functions_Group3 Fast Mode Plus Functions 102 | * @{ 103 | */ 104 | void HAL_SMBUSEx_EnableFastModePlus(uint32_t ConfigFastModePlus); 105 | void HAL_SMBUSEx_DisableFastModePlus(uint32_t ConfigFastModePlus); 106 | /** 107 | * @} 108 | */ 109 | 110 | /** 111 | * @} 112 | */ 113 | 114 | /* Private constants ---------------------------------------------------------*/ 115 | /** @defgroup SMBUSEx_Private_Constants SMBUS Extended Private Constants 116 | * @{ 117 | */ 118 | 119 | /** 120 | * @} 121 | */ 122 | 123 | /* Private macros ------------------------------------------------------------*/ 124 | /** @defgroup SMBUSEx_Private_Macro SMBUS Extended Private Macros 125 | * @{ 126 | */ 127 | #define IS_SMBUS_FASTMODEPLUS(__CONFIG__) ((((__CONFIG__) & SMBUS_FMP_NOT_SUPPORTED) != SMBUS_FMP_NOT_SUPPORTED) && \ 128 | ((((__CONFIG__) & (SMBUS_FASTMODEPLUS_PB6)) == SMBUS_FASTMODEPLUS_PB6) || \ 129 | (((__CONFIG__) & (SMBUS_FASTMODEPLUS_PB7)) == SMBUS_FASTMODEPLUS_PB7) || \ 130 | (((__CONFIG__) & (SMBUS_FASTMODEPLUS_PB8)) == SMBUS_FASTMODEPLUS_PB8) || \ 131 | (((__CONFIG__) & (SMBUS_FASTMODEPLUS_PB9)) == SMBUS_FASTMODEPLUS_PB9) || \ 132 | (((__CONFIG__) & (SMBUS_FASTMODEPLUS_I2C1)) == SMBUS_FASTMODEPLUS_I2C1) || \ 133 | (((__CONFIG__) & (SMBUS_FASTMODEPLUS_I2C2)) == SMBUS_FASTMODEPLUS_I2C2) || \ 134 | (((__CONFIG__) & (SMBUS_FASTMODEPLUS_I2C3)) == SMBUS_FASTMODEPLUS_I2C3) || \ 135 | (((__CONFIG__) & (SMBUS_FASTMODEPLUS_I2C4)) == SMBUS_FASTMODEPLUS_I2C4))) 136 | /** 137 | * @} 138 | */ 139 | 140 | /* Private Functions ---------------------------------------------------------*/ 141 | /** @defgroup SMBUSEx_Private_Functions SMBUS Extended Private Functions 142 | * @{ 143 | */ 144 | /* Private functions are defined in stm32l4xx_hal_smbus_ex.c file */ 145 | /** 146 | * @} 147 | */ 148 | 149 | /** 150 | * @} 151 | */ 152 | 153 | /** 154 | * @} 155 | */ 156 | 157 | #ifdef __cplusplus 158 | } 159 | #endif 160 | 161 | #endif /* STM32L4xx_HAL_SMBUS_EX_H */ 162 | -------------------------------------------------------------------------------- /Inc/stm32l4xx_hal_spi_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_spi_ex.h 4 | * @author MCD Application Team 5 | * @brief Header file of SPI HAL Extended module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2017 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 STM32L4xx_HAL_SPI_EX_H 21 | #define STM32L4xx_HAL_SPI_EX_H 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | /* Includes ------------------------------------------------------------------*/ 28 | #include "stm32l4xx_hal_def.h" 29 | 30 | /** @addtogroup STM32L4xx_HAL_Driver 31 | * @{ 32 | */ 33 | 34 | /** @addtogroup SPIEx 35 | * @{ 36 | */ 37 | 38 | /* Exported types ------------------------------------------------------------*/ 39 | /* Exported constants --------------------------------------------------------*/ 40 | /* Exported macros -----------------------------------------------------------*/ 41 | /* Exported functions --------------------------------------------------------*/ 42 | /** @addtogroup SPIEx_Exported_Functions 43 | * @{ 44 | */ 45 | 46 | /* Initialization and de-initialization functions ****************************/ 47 | /* IO operation functions *****************************************************/ 48 | /** @addtogroup SPIEx_Exported_Functions_Group1 49 | * @{ 50 | */ 51 | HAL_StatusTypeDef HAL_SPIEx_FlushRxFifo(const SPI_HandleTypeDef *hspi); 52 | /** 53 | * @} 54 | */ 55 | 56 | /** 57 | * @} 58 | */ 59 | 60 | /** 61 | * @} 62 | */ 63 | 64 | /** 65 | * @} 66 | */ 67 | 68 | #ifdef __cplusplus 69 | } 70 | #endif 71 | 72 | #endif /* STM32L4xx_HAL_SPI_EX_H */ 73 | 74 | -------------------------------------------------------------------------------- /Inc/stm32l4xx_hal_sram.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_sram.h 4 | * @author MCD Application Team 5 | * @brief Header file of SRAM HAL module. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2017 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 STM32L4xx_HAL_SRAM_H 21 | #define STM32L4xx_HAL_SRAM_H 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | #if defined(FMC_BANK1) 28 | 29 | /* Includes ------------------------------------------------------------------*/ 30 | #include "stm32l4xx_ll_fmc.h" 31 | 32 | /** @addtogroup STM32L4xx_HAL_Driver 33 | * @{ 34 | */ 35 | /** @addtogroup SRAM 36 | * @{ 37 | */ 38 | 39 | /* Exported typedef ----------------------------------------------------------*/ 40 | 41 | /** @defgroup SRAM_Exported_Types SRAM Exported Types 42 | * @{ 43 | */ 44 | /** 45 | * @brief HAL SRAM State structures definition 46 | */ 47 | typedef enum 48 | { 49 | HAL_SRAM_STATE_RESET = 0x00U, /*!< SRAM not yet initialized or disabled */ 50 | HAL_SRAM_STATE_READY = 0x01U, /*!< SRAM initialized and ready for use */ 51 | HAL_SRAM_STATE_BUSY = 0x02U, /*!< SRAM internal process is ongoing */ 52 | HAL_SRAM_STATE_ERROR = 0x03U, /*!< SRAM error state */ 53 | HAL_SRAM_STATE_PROTECTED = 0x04U /*!< SRAM peripheral NORSRAM device write protected */ 54 | 55 | } HAL_SRAM_StateTypeDef; 56 | 57 | /** 58 | * @brief SRAM handle Structure definition 59 | */ 60 | #if (USE_HAL_SRAM_REGISTER_CALLBACKS == 1) 61 | typedef struct __SRAM_HandleTypeDef 62 | #else 63 | typedef struct 64 | #endif /* USE_HAL_SRAM_REGISTER_CALLBACKS */ 65 | { 66 | FMC_NORSRAM_TypeDef *Instance; /*!< Register base address */ 67 | 68 | FMC_NORSRAM_EXTENDED_TypeDef *Extended; /*!< Extended mode register base address */ 69 | 70 | FMC_NORSRAM_InitTypeDef Init; /*!< SRAM device control configuration parameters */ 71 | 72 | HAL_LockTypeDef Lock; /*!< SRAM locking object */ 73 | 74 | __IO HAL_SRAM_StateTypeDef State; /*!< SRAM device access state */ 75 | 76 | DMA_HandleTypeDef *hdma; /*!< Pointer DMA handler */ 77 | 78 | #if (USE_HAL_SRAM_REGISTER_CALLBACKS == 1) 79 | void (* MspInitCallback)(struct __SRAM_HandleTypeDef *hsram); /*!< SRAM Msp Init callback */ 80 | void (* MspDeInitCallback)(struct __SRAM_HandleTypeDef *hsram); /*!< SRAM Msp DeInit callback */ 81 | void (* DmaXferCpltCallback)(DMA_HandleTypeDef *hdma); /*!< SRAM DMA Xfer Complete callback */ 82 | void (* DmaXferErrorCallback)(DMA_HandleTypeDef *hdma); /*!< SRAM DMA Xfer Error callback */ 83 | #endif /* USE_HAL_SRAM_REGISTER_CALLBACKS */ 84 | } SRAM_HandleTypeDef; 85 | 86 | #if (USE_HAL_SRAM_REGISTER_CALLBACKS == 1) 87 | /** 88 | * @brief HAL SRAM Callback ID enumeration definition 89 | */ 90 | typedef enum 91 | { 92 | HAL_SRAM_MSP_INIT_CB_ID = 0x00U, /*!< SRAM MspInit Callback ID */ 93 | HAL_SRAM_MSP_DEINIT_CB_ID = 0x01U, /*!< SRAM MspDeInit Callback ID */ 94 | HAL_SRAM_DMA_XFER_CPLT_CB_ID = 0x02U, /*!< SRAM DMA Xfer Complete Callback ID */ 95 | HAL_SRAM_DMA_XFER_ERR_CB_ID = 0x03U /*!< SRAM DMA Xfer Complete Callback ID */ 96 | } HAL_SRAM_CallbackIDTypeDef; 97 | 98 | /** 99 | * @brief HAL SRAM Callback pointer definition 100 | */ 101 | typedef void (*pSRAM_CallbackTypeDef)(SRAM_HandleTypeDef *hsram); 102 | typedef void (*pSRAM_DmaCallbackTypeDef)(DMA_HandleTypeDef *hdma); 103 | #endif /* USE_HAL_SRAM_REGISTER_CALLBACKS */ 104 | /** 105 | * @} 106 | */ 107 | 108 | /* Exported constants --------------------------------------------------------*/ 109 | /* Exported macro ------------------------------------------------------------*/ 110 | 111 | /** @defgroup SRAM_Exported_Macros SRAM Exported Macros 112 | * @{ 113 | */ 114 | 115 | /** @brief Reset SRAM handle state 116 | * @param __HANDLE__ SRAM handle 117 | * @retval None 118 | */ 119 | #if (USE_HAL_SRAM_REGISTER_CALLBACKS == 1) 120 | #define __HAL_SRAM_RESET_HANDLE_STATE(__HANDLE__) do { \ 121 | (__HANDLE__)->State = HAL_SRAM_STATE_RESET; \ 122 | (__HANDLE__)->MspInitCallback = NULL; \ 123 | (__HANDLE__)->MspDeInitCallback = NULL; \ 124 | } while(0) 125 | #else 126 | #define __HAL_SRAM_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SRAM_STATE_RESET) 127 | #endif /* USE_HAL_SRAM_REGISTER_CALLBACKS */ 128 | 129 | /** 130 | * @} 131 | */ 132 | 133 | /* Exported functions --------------------------------------------------------*/ 134 | /** @addtogroup SRAM_Exported_Functions SRAM Exported Functions 135 | * @{ 136 | */ 137 | 138 | /** @addtogroup SRAM_Exported_Functions_Group1 Initialization and de-initialization functions 139 | * @{ 140 | */ 141 | 142 | /* Initialization/de-initialization functions ********************************/ 143 | HAL_StatusTypeDef HAL_SRAM_Init(SRAM_HandleTypeDef *hsram, FMC_NORSRAM_TimingTypeDef *Timing, 144 | FMC_NORSRAM_TimingTypeDef *ExtTiming); 145 | HAL_StatusTypeDef HAL_SRAM_DeInit(SRAM_HandleTypeDef *hsram); 146 | void HAL_SRAM_MspInit(SRAM_HandleTypeDef *hsram); 147 | void HAL_SRAM_MspDeInit(SRAM_HandleTypeDef *hsram); 148 | 149 | /** 150 | * @} 151 | */ 152 | 153 | /** @addtogroup SRAM_Exported_Functions_Group2 Input Output and memory control functions 154 | * @{ 155 | */ 156 | 157 | /* I/O operation functions ***************************************************/ 158 | HAL_StatusTypeDef HAL_SRAM_Read_8b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint8_t *pDstBuffer, 159 | uint32_t BufferSize); 160 | HAL_StatusTypeDef HAL_SRAM_Write_8b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint8_t *pSrcBuffer, 161 | uint32_t BufferSize); 162 | HAL_StatusTypeDef HAL_SRAM_Read_16b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint16_t *pDstBuffer, 163 | uint32_t BufferSize); 164 | HAL_StatusTypeDef HAL_SRAM_Write_16b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint16_t *pSrcBuffer, 165 | uint32_t BufferSize); 166 | HAL_StatusTypeDef HAL_SRAM_Read_32b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pDstBuffer, 167 | uint32_t BufferSize); 168 | HAL_StatusTypeDef HAL_SRAM_Write_32b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pSrcBuffer, 169 | uint32_t BufferSize); 170 | HAL_StatusTypeDef HAL_SRAM_Read_DMA(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pDstBuffer, 171 | uint32_t BufferSize); 172 | HAL_StatusTypeDef HAL_SRAM_Write_DMA(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pSrcBuffer, 173 | uint32_t BufferSize); 174 | 175 | void HAL_SRAM_DMA_XferCpltCallback(DMA_HandleTypeDef *hdma); 176 | void HAL_SRAM_DMA_XferErrorCallback(DMA_HandleTypeDef *hdma); 177 | 178 | #if (USE_HAL_SRAM_REGISTER_CALLBACKS == 1) 179 | /* SRAM callback registering/unregistering */ 180 | HAL_StatusTypeDef HAL_SRAM_RegisterCallback(SRAM_HandleTypeDef *hsram, HAL_SRAM_CallbackIDTypeDef CallbackId, 181 | pSRAM_CallbackTypeDef pCallback); 182 | HAL_StatusTypeDef HAL_SRAM_UnRegisterCallback(SRAM_HandleTypeDef *hsram, HAL_SRAM_CallbackIDTypeDef CallbackId); 183 | HAL_StatusTypeDef HAL_SRAM_RegisterDmaCallback(SRAM_HandleTypeDef *hsram, HAL_SRAM_CallbackIDTypeDef CallbackId, 184 | pSRAM_DmaCallbackTypeDef pCallback); 185 | #endif /* USE_HAL_SRAM_REGISTER_CALLBACKS */ 186 | 187 | /** 188 | * @} 189 | */ 190 | 191 | /** @addtogroup SRAM_Exported_Functions_Group3 Control functions 192 | * @{ 193 | */ 194 | 195 | /* SRAM Control functions ****************************************************/ 196 | HAL_StatusTypeDef HAL_SRAM_WriteOperation_Enable(SRAM_HandleTypeDef *hsram); 197 | HAL_StatusTypeDef HAL_SRAM_WriteOperation_Disable(SRAM_HandleTypeDef *hsram); 198 | 199 | /** 200 | * @} 201 | */ 202 | 203 | /** @addtogroup SRAM_Exported_Functions_Group4 Peripheral State functions 204 | * @{ 205 | */ 206 | 207 | /* SRAM State functions ******************************************************/ 208 | HAL_SRAM_StateTypeDef HAL_SRAM_GetState(const SRAM_HandleTypeDef *hsram); 209 | 210 | /** 211 | * @} 212 | */ 213 | 214 | /** 215 | * @} 216 | */ 217 | 218 | /** 219 | * @} 220 | */ 221 | 222 | /** 223 | * @} 224 | */ 225 | 226 | #endif /* FMC_BANK1 */ 227 | 228 | #ifdef __cplusplus 229 | } 230 | #endif 231 | 232 | #endif /* STM32L4xx_HAL_SRAM_H */ 233 | -------------------------------------------------------------------------------- /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 | # STM32CubeL4 HAL Driver MCU Component 2 | 3 | ![latest tag](https://img.shields.io/github/v/tag/STMicroelectronics/stm32l4xx_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 **stm32l4xx_hal_driver** MCU component repo is one element of the STM32CubeL4 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/stm32l4xx_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/STM32CubeL4/blob/master/Release_Notes.html) release note. 31 | 32 | The full **STM32CubeL4** MCU package is available [here](https://github.com/STMicroelectronics/STM32CubeL4). 33 | 34 | ## Troubleshooting 35 | 36 | Please refer to the [CONTRIBUTING.md](CONTRIBUTING.md) guide. 37 | -------------------------------------------------------------------------------- /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/stm32l4xx_hal_crc_ex.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_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) 2017 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 "stm32l4xx_hal.h" 34 | 35 | /** @addtogroup STM32L4xx_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/stm32l4xx_hal_cryp.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/stm32l4xx-hal-driver/a60c3480b58ea4f9704fd1c72ce77a6358662c5c/Src/stm32l4xx_hal_cryp.c -------------------------------------------------------------------------------- /Src/stm32l4xx_hal_dfsdm_ex.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_dfsdm_ex.c 4 | * @author MCD Application Team 5 | * @brief DFSDM Extended HAL module driver. 6 | * This file provides firmware functions to manage the following 7 | * functionality of the DFSDM Peripheral Controller: 8 | * + Set and get pulses skipping on channel. 9 | * 10 | ****************************************************************************** 11 | * @attention 12 | * 13 | * Copyright (c) 2017 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 "stm32l4xx_hal.h" 25 | 26 | /** @addtogroup STM32L4xx_HAL_Driver 27 | * @{ 28 | */ 29 | 30 | #ifdef HAL_DFSDM_MODULE_ENABLED 31 | 32 | #if defined(STM32L4R5xx) || defined(STM32L4R7xx) || defined(STM32L4R9xx) || defined(STM32L4S5xx) || defined(STM32L4S7xx) || defined(STM32L4S9xx) || \ 33 | defined(STM32L4P5xx) || defined(STM32L4Q5xx) 34 | 35 | /** @defgroup DFSDMEx DFSDMEx 36 | * @brief DFSDM Extended HAL module driver 37 | * @{ 38 | */ 39 | 40 | /* Private types -------------------------------------------------------------*/ 41 | /* Private variables ---------------------------------------------------------*/ 42 | /* Private constants ---------------------------------------------------------*/ 43 | /* Private macros ------------------------------------------------------------*/ 44 | /* Private functions ---------------------------------------------------------*/ 45 | /* Exported functions --------------------------------------------------------*/ 46 | 47 | /** @defgroup DFSDMEx_Exported_Functions DFSDM Extended Exported Functions 48 | * @{ 49 | */ 50 | 51 | /** @defgroup DFSDMEx_Exported_Functions_Group1_Channel Extended channel operation functions 52 | * @brief DFSDM extended channel operation functions 53 | * 54 | @verbatim 55 | =============================================================================== 56 | ##### Extended channel operation functions ##### 57 | =============================================================================== 58 | [..] This section provides functions allowing to: 59 | (+) Set and get value of pulses skipping on channel 60 | 61 | @endverbatim 62 | * @{ 63 | */ 64 | 65 | /** 66 | * @brief Set value of pulses skipping. 67 | * @param hdfsdm_channel DFSDM channel handle. 68 | * @param PulsesValue Value of pulses to be skipped. 69 | * This parameter must be a number between Min_Data = 0 and Max_Data = 63. 70 | * @retval HAL status. 71 | */ 72 | HAL_StatusTypeDef HAL_DFDSMEx_ChannelSetPulsesSkipping(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t PulsesValue) 73 | { 74 | HAL_StatusTypeDef status = HAL_OK; 75 | 76 | /* Check pulses value */ 77 | assert_param(IS_DFSDM_CHANNEL_SKIPPING_VALUE(PulsesValue)); 78 | 79 | /* Check DFSDM channel state */ 80 | if (hdfsdm_channel->State == HAL_DFSDM_CHANNEL_STATE_READY) 81 | { 82 | /* Set new value of pulses skipping */ 83 | hdfsdm_channel->Instance->CHDLYR = (PulsesValue & DFSDM_CHDLYR_PLSSKP); 84 | } 85 | else 86 | { 87 | status = HAL_ERROR; 88 | } 89 | return status; 90 | } 91 | 92 | /** 93 | * @brief Get value of pulses skipping. 94 | * @param hdfsdm_channel DFSDM channel handle. 95 | * @param PulsesValue Value of pulses to be skipped. 96 | * @retval HAL status. 97 | */ 98 | HAL_StatusTypeDef HAL_DFDSMEx_ChannelGetPulsesSkipping(const DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t *PulsesValue) 99 | { 100 | HAL_StatusTypeDef status = HAL_OK; 101 | 102 | /* Check DFSDM channel state */ 103 | if (hdfsdm_channel->State == HAL_DFSDM_CHANNEL_STATE_READY) 104 | { 105 | /* Get value of remaining pulses to be skipped */ 106 | *PulsesValue = (hdfsdm_channel->Instance->CHDLYR & DFSDM_CHDLYR_PLSSKP); 107 | } 108 | else 109 | { 110 | status = HAL_ERROR; 111 | } 112 | return status; 113 | } 114 | 115 | /** 116 | * @} 117 | */ 118 | 119 | /** 120 | * @} 121 | */ 122 | 123 | /** 124 | * @} 125 | */ 126 | 127 | #endif /* STM32L4R5xx || STM32L4R7xx || STM32L4R9xx || STM32L4S5xx || STM32L4S7xx || STM32L4S9xx || STM32L4P5xx || STM32L4Q5xx */ 128 | 129 | #endif /* HAL_DFSDM_MODULE_ENABLED */ 130 | 131 | /** 132 | * @} 133 | */ 134 | -------------------------------------------------------------------------------- /Src/stm32l4xx_hal_flash_ramfunc.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_flash_ramfunc.c 4 | * @author MCD Application Team 5 | * @brief FLASH RAMFUNC driver. 6 | * This file provides a Flash firmware functions which should be 7 | * executed from internal SRAM 8 | * + FLASH HalfPage Programming 9 | * + FLASH Power Down in Run mode 10 | * 11 | * @verbatim 12 | ============================================================================== 13 | ##### Flash RAM functions ##### 14 | ============================================================================== 15 | 16 | *** ARM Compiler *** 17 | -------------------- 18 | [..] RAM functions are defined using the toolchain options. 19 | Functions that are executed in RAM should reside in a separate 20 | source module. Using the 'Options for File' dialog you can simply change 21 | the 'Code / Const' area of a module to a memory space in physical RAM. 22 | Available memory areas are declared in the 'Target' tab of the 23 | Options for Target' dialog. 24 | 25 | *** ICCARM Compiler *** 26 | ----------------------- 27 | [..] RAM functions are defined using a specific toolchain keyword "__ramfunc". 28 | 29 | *** GNU Compiler *** 30 | -------------------- 31 | [..] RAM functions are defined using a specific toolchain attribute 32 | "__attribute__((section(".RamFunc")))". 33 | 34 | @endverbatim 35 | ****************************************************************************** 36 | * @attention 37 | * 38 | * Copyright (c) 2017 STMicroelectronics. 39 | * All rights reserved. 40 | * 41 | * This software is licensed under terms that can be found in the LICENSE file in 42 | * the root directory of this software component. 43 | * If no LICENSE file comes with this software, it is provided AS-IS. 44 | ****************************************************************************** 45 | */ 46 | 47 | /* Includes ------------------------------------------------------------------*/ 48 | #include "stm32l4xx_hal.h" 49 | 50 | /** @addtogroup STM32L4xx_HAL_Driver 51 | * @{ 52 | */ 53 | 54 | /** @defgroup FLASH_RAMFUNC FLASH_RAMFUNC 55 | * @brief FLASH functions executed from RAM 56 | * @{ 57 | */ 58 | 59 | #ifdef HAL_FLASH_MODULE_ENABLED 60 | 61 | /* Private typedef -----------------------------------------------------------*/ 62 | /* Private define ------------------------------------------------------------*/ 63 | /* Private macro -------------------------------------------------------------*/ 64 | /* Private variables ---------------------------------------------------------*/ 65 | /* Private function prototypes -----------------------------------------------*/ 66 | /* Exported functions -------------------------------------------------------*/ 67 | 68 | /** @defgroup FLASH_RAMFUNC_Exported_Functions FLASH in RAM function Exported Functions 69 | * @{ 70 | */ 71 | 72 | /** @defgroup FLASH_RAMFUNC_Exported_Functions_Group1 Peripheral features functions 73 | * @brief Data transfers functions 74 | * 75 | @verbatim 76 | =============================================================================== 77 | ##### ramfunc functions ##### 78 | =============================================================================== 79 | [..] 80 | This subsection provides a set of functions that should be executed from RAM. 81 | 82 | @endverbatim 83 | * @{ 84 | */ 85 | 86 | /** 87 | * @brief Enable the Power down in Run Mode 88 | * @note This function should be called and executed from SRAM memory 89 | * @retval HAL status 90 | */ 91 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_EnableRunPowerDown(void) 92 | { 93 | /* Enable the Power Down in Run mode*/ 94 | __HAL_FLASH_POWER_DOWN_ENABLE(); 95 | 96 | return HAL_OK; 97 | 98 | } 99 | 100 | /** 101 | * @brief Disable the Power down in Run Mode 102 | * @note This function should be called and executed from SRAM memory 103 | * @retval HAL status 104 | */ 105 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_DisableRunPowerDown(void) 106 | { 107 | /* Disable the Power Down in Run mode*/ 108 | __HAL_FLASH_POWER_DOWN_DISABLE(); 109 | 110 | return HAL_OK; 111 | } 112 | 113 | #if defined (STM32L4P5xx) || defined (STM32L4Q5xx) || defined (STM32L4R5xx) || defined (STM32L4R7xx) || defined (STM32L4R9xx) || defined (STM32L4S5xx) || defined (STM32L4S7xx) || defined (STM32L4S9xx) 114 | /** 115 | * @brief Program the FLASH DBANK User Option Byte. 116 | * 117 | * @note To configure the user option bytes, the option lock bit OPTLOCK must 118 | * be cleared with the call of the HAL_FLASH_OB_Unlock() function. 119 | * @note To modify the DBANK option byte, no PCROP region should be defined. 120 | * To deactivate PCROP, user should perform RDP changing 121 | * 122 | * @param DBankConfig The FLASH DBANK User Option Byte value. 123 | * This parameter can be one of the following values: 124 | * @arg OB_DBANK_128_BITS: Single-bank with 128-bits data 125 | * @arg OB_DBANK_64_BITS: Dual-bank with 64-bits data 126 | * 127 | * @retval HAL status 128 | */ 129 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_OB_DBankConfig(uint32_t DBankConfig) 130 | { 131 | uint32_t count, reg; 132 | HAL_StatusTypeDef status = HAL_ERROR; 133 | 134 | /* Process Locked */ 135 | __HAL_LOCK(&pFlash); 136 | 137 | /* Check if the PCROP is disabled */ 138 | reg = FLASH->PCROP1SR; 139 | if (reg > FLASH->PCROP1ER) 140 | { 141 | reg = FLASH->PCROP2SR; 142 | if (reg > FLASH->PCROP2ER) 143 | { 144 | /* Disable Flash prefetch */ 145 | __HAL_FLASH_PREFETCH_BUFFER_DISABLE(); 146 | 147 | if (READ_BIT(FLASH->ACR, FLASH_ACR_ICEN) != 0U) 148 | { 149 | /* Disable Flash instruction cache */ 150 | __HAL_FLASH_INSTRUCTION_CACHE_DISABLE(); 151 | 152 | /* Flush Flash instruction cache */ 153 | __HAL_FLASH_INSTRUCTION_CACHE_RESET(); 154 | } 155 | 156 | if (READ_BIT(FLASH->ACR, FLASH_ACR_DCEN) != 0U) 157 | { 158 | /* Disable Flash data cache */ 159 | __HAL_FLASH_DATA_CACHE_DISABLE(); 160 | 161 | /* Flush Flash data cache */ 162 | __HAL_FLASH_DATA_CACHE_RESET(); 163 | } 164 | 165 | /* Disable WRP zone 1 of 1st bank if needed */ 166 | reg = FLASH->WRP1AR; 167 | if (((reg & FLASH_WRP1AR_WRP1A_STRT) >> FLASH_WRP1AR_WRP1A_STRT_Pos) <= 168 | ((reg & FLASH_WRP1AR_WRP1A_END) >> FLASH_WRP1AR_WRP1A_END_Pos)) 169 | { 170 | MODIFY_REG(FLASH->WRP1AR, (FLASH_WRP1AR_WRP1A_STRT | FLASH_WRP1AR_WRP1A_END), FLASH_WRP1AR_WRP1A_STRT); 171 | } 172 | 173 | /* Disable WRP zone 2 of 1st bank if needed */ 174 | reg = FLASH->WRP1BR; 175 | if (((reg & FLASH_WRP1BR_WRP1B_STRT) >> FLASH_WRP1BR_WRP1B_STRT_Pos) <= 176 | ((reg & FLASH_WRP1BR_WRP1B_END) >> FLASH_WRP1BR_WRP1B_END_Pos)) 177 | { 178 | MODIFY_REG(FLASH->WRP1BR, (FLASH_WRP1BR_WRP1B_STRT | FLASH_WRP1BR_WRP1B_END), FLASH_WRP1BR_WRP1B_STRT); 179 | } 180 | 181 | /* Disable WRP zone 1 of 2nd bank if needed */ 182 | reg = FLASH->WRP2AR; 183 | if (((reg & FLASH_WRP2AR_WRP2A_STRT) >> FLASH_WRP2AR_WRP2A_STRT_Pos) <= 184 | ((reg & FLASH_WRP2AR_WRP2A_END) >> FLASH_WRP2AR_WRP2A_END_Pos)) 185 | { 186 | MODIFY_REG(FLASH->WRP2AR, (FLASH_WRP2AR_WRP2A_STRT | FLASH_WRP2AR_WRP2A_END), FLASH_WRP2AR_WRP2A_STRT); 187 | } 188 | 189 | /* Disable WRP zone 2 of 2nd bank if needed */ 190 | reg = FLASH->WRP2BR; 191 | if (((reg & FLASH_WRP2BR_WRP2B_STRT) >> FLASH_WRP2BR_WRP2B_STRT_Pos) <= 192 | ((reg & FLASH_WRP2BR_WRP2B_END) >> FLASH_WRP2BR_WRP2B_END_Pos)) 193 | { 194 | MODIFY_REG(FLASH->WRP2BR, (FLASH_WRP2BR_WRP2B_STRT | FLASH_WRP2BR_WRP2B_END), FLASH_WRP2BR_WRP2B_STRT); 195 | } 196 | 197 | /* Modify the DBANK user option byte */ 198 | MODIFY_REG(FLASH->OPTR, FLASH_OPTR_DBANK, DBankConfig); 199 | 200 | /* Set OPTSTRT Bit */ 201 | SET_BIT(FLASH->CR, FLASH_CR_OPTSTRT); 202 | 203 | /* Wait for last operation to be completed */ 204 | /* 8 is the number of required instruction cycles for the below loop statement (timeout expressed in ms) */ 205 | count = FLASH_TIMEOUT_VALUE * (SystemCoreClock / 8U / 1000U); 206 | do 207 | { 208 | if (count == 0U) 209 | { 210 | break; 211 | } 212 | count--; 213 | } while (__HAL_FLASH_GET_FLAG(FLASH_FLAG_BSY) != RESET); 214 | 215 | /* If the option byte program operation is completed, disable the OPTSTRT Bit */ 216 | CLEAR_BIT(FLASH->CR, FLASH_CR_OPTSTRT); 217 | 218 | /* Set the bit to force the option byte reloading */ 219 | SET_BIT(FLASH->CR, FLASH_CR_OBL_LAUNCH); 220 | } 221 | } 222 | 223 | /* Process Unlocked */ 224 | __HAL_UNLOCK(&pFlash); 225 | 226 | return status; 227 | } 228 | #endif 229 | 230 | /** 231 | * @} 232 | */ 233 | 234 | /** 235 | * @} 236 | */ 237 | #endif /* HAL_FLASH_MODULE_ENABLED */ 238 | 239 | 240 | 241 | /** 242 | * @} 243 | */ 244 | 245 | /** 246 | * @} 247 | */ 248 | 249 | 250 | 251 | 252 | -------------------------------------------------------------------------------- /Src/stm32l4xx_hal_ltdc_ex.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_ltdc_ex.c 4 | * @author MCD Application Team 5 | * @brief LTDC Extension HAL module driver. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2017 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 | /* Includes ------------------------------------------------------------------*/ 20 | #include "stm32l4xx_hal.h" 21 | 22 | /** @addtogroup STM32L4xx_HAL_Driver 23 | * @{ 24 | */ 25 | 26 | #if defined(HAL_LTDC_MODULE_ENABLED) && defined(HAL_DSI_MODULE_ENABLED) 27 | 28 | #if defined (LTDC) && defined (DSI) 29 | 30 | /** @defgroup LTDCEx LTDCEx 31 | * @brief LTDC HAL module driver 32 | * @{ 33 | */ 34 | 35 | /* Private typedef -----------------------------------------------------------*/ 36 | /* Private define ------------------------------------------------------------*/ 37 | /* Private macro -------------------------------------------------------------*/ 38 | /* Private variables ---------------------------------------------------------*/ 39 | /* Private function prototypes -----------------------------------------------*/ 40 | /* Exported functions --------------------------------------------------------*/ 41 | 42 | /** @defgroup LTDCEx_Exported_Functions LTDC Extended Exported Functions 43 | * @{ 44 | */ 45 | 46 | /** @defgroup LTDCEx_Exported_Functions_Group1 Initialization and Configuration functions 47 | * @brief Initialization and Configuration functions 48 | * 49 | @verbatim 50 | =============================================================================== 51 | ##### Initialization and Configuration functions ##### 52 | =============================================================================== 53 | [..] This section provides functions allowing to: 54 | (+) Initialize and configure the LTDC 55 | 56 | @endverbatim 57 | * @{ 58 | */ 59 | 60 | /** 61 | * @brief Retrieve common parameters from DSI Video mode configuration structure 62 | * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 63 | * the configuration information for the LTDC. 64 | * @param VidCfg pointer to a DSI_VidCfgTypeDef structure that contains 65 | * the DSI video mode configuration parameters 66 | * @note The implementation of this function is taking into account the LTDC 67 | * polarities inversion as described in the current LTDC specification 68 | * @retval HAL status 69 | */ 70 | HAL_StatusTypeDef HAL_LTDCEx_StructInitFromVideoConfig(LTDC_HandleTypeDef *hltdc, DSI_VidCfgTypeDef *VidCfg) 71 | { 72 | /* Retrieve signal polarities from DSI */ 73 | 74 | /* The following polarity is inverted: 75 | LTDC_DEPOLARITY_AL <-> LTDC_DEPOLARITY_AH */ 76 | 77 | #if !defined(POLARITIES_INVERSION_UPDATED) 78 | /* Note 1 : Code in line w/ Current LTDC specification */ 79 | hltdc->Init.DEPolarity = (VidCfg->DEPolarity == \ 80 | DSI_DATA_ENABLE_ACTIVE_HIGH) ? LTDC_DEPOLARITY_AL : LTDC_DEPOLARITY_AH; 81 | hltdc->Init.VSPolarity = (VidCfg->VSPolarity == DSI_VSYNC_ACTIVE_HIGH) ? LTDC_VSPOLARITY_AH : LTDC_VSPOLARITY_AL; 82 | hltdc->Init.HSPolarity = (VidCfg->HSPolarity == DSI_HSYNC_ACTIVE_HIGH) ? LTDC_HSPOLARITY_AH : LTDC_HSPOLARITY_AL; 83 | #else 84 | /* Note 2: Code to be used in case LTDC polarities inversion updated in the specification */ 85 | hltdc->Init.DEPolarity = VidCfg->DEPolarity << 29; 86 | hltdc->Init.VSPolarity = VidCfg->VSPolarity << 29; 87 | hltdc->Init.HSPolarity = VidCfg->HSPolarity << 29; 88 | #endif /* POLARITIES_INVERSION_UPDATED */ 89 | 90 | /* Retrieve vertical timing parameters from DSI */ 91 | hltdc->Init.VerticalSync = VidCfg->VerticalSyncActive - 1U; 92 | hltdc->Init.AccumulatedVBP = VidCfg->VerticalSyncActive + VidCfg->VerticalBackPorch - 1U; 93 | hltdc->Init.AccumulatedActiveH = VidCfg->VerticalSyncActive + VidCfg->VerticalBackPorch + \ 94 | VidCfg->VerticalActive - 1U; 95 | hltdc->Init.TotalHeigh = VidCfg->VerticalSyncActive + VidCfg->VerticalBackPorch + \ 96 | VidCfg->VerticalActive + VidCfg->VerticalFrontPorch - 1U; 97 | 98 | return HAL_OK; 99 | } 100 | 101 | /** 102 | * @brief Retrieve common parameters from DSI Adapted command mode configuration structure 103 | * @param hltdc pointer to a LTDC_HandleTypeDef structure that contains 104 | * the configuration information for the LTDC. 105 | * @param CmdCfg pointer to a DSI_CmdCfgTypeDef structure that contains 106 | * the DSI command mode configuration parameters 107 | * @note The implementation of this function is taking into account the LTDC 108 | * polarities inversion as described in the current LTDC specification 109 | * @retval HAL status 110 | */ 111 | HAL_StatusTypeDef HAL_LTDCEx_StructInitFromAdaptedCommandConfig(LTDC_HandleTypeDef *hltdc, DSI_CmdCfgTypeDef *CmdCfg) 112 | { 113 | /* Retrieve signal polarities from DSI */ 114 | 115 | /* The following polarities are inverted: 116 | LTDC_DEPOLARITY_AL <-> LTDC_DEPOLARITY_AH 117 | LTDC_VSPOLARITY_AL <-> LTDC_VSPOLARITY_AH 118 | LTDC_HSPOLARITY_AL <-> LTDC_HSPOLARITY_AH)*/ 119 | 120 | #if !defined(POLARITIES_INVERSION_UPDATED) 121 | /* Note 1 : Code in line w/ Current LTDC specification */ 122 | hltdc->Init.DEPolarity = (CmdCfg->DEPolarity == \ 123 | DSI_DATA_ENABLE_ACTIVE_HIGH) ? LTDC_DEPOLARITY_AL : LTDC_DEPOLARITY_AH; 124 | hltdc->Init.VSPolarity = (CmdCfg->VSPolarity == DSI_VSYNC_ACTIVE_HIGH) ? LTDC_VSPOLARITY_AL : LTDC_VSPOLARITY_AH; 125 | hltdc->Init.HSPolarity = (CmdCfg->HSPolarity == DSI_HSYNC_ACTIVE_HIGH) ? LTDC_HSPOLARITY_AL : LTDC_HSPOLARITY_AH; 126 | #else 127 | /* Note 2: Code to be used in case LTDC polarities inversion updated in the specification */ 128 | hltdc->Init.DEPolarity = CmdCfg->DEPolarity << 29; 129 | hltdc->Init.VSPolarity = CmdCfg->VSPolarity << 29; 130 | hltdc->Init.HSPolarity = CmdCfg->HSPolarity << 29; 131 | #endif /* POLARITIES_INVERSION_UPDATED */ 132 | return HAL_OK; 133 | } 134 | 135 | /** 136 | * @} 137 | */ 138 | 139 | /** 140 | * @} 141 | */ 142 | 143 | /** 144 | * @} 145 | */ 146 | 147 | #endif /* LTDC && DSI */ 148 | 149 | #endif /* HAL_LTCD_MODULE_ENABLED && HAL_DSI_MODULE_ENABLED */ 150 | 151 | /** 152 | * @} 153 | */ 154 | 155 | -------------------------------------------------------------------------------- /Src/stm32l4xx_hal_mmc.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/stm32l4xx-hal-driver/a60c3480b58ea4f9704fd1c72ce77a6358662c5c/Src/stm32l4xx_hal_mmc.c -------------------------------------------------------------------------------- /Src/stm32l4xx_hal_msp_template.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_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 | * @attention 10 | * 11 | * Copyright (c) 2017 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 | /* Includes ------------------------------------------------------------------*/ 22 | #include "stm32l4xx_hal.h" 23 | 24 | /** @addtogroup STM32L4xx_HAL_Driver 25 | * @{ 26 | */ 27 | 28 | /** @defgroup HAL_MSP HAL MSP module driver 29 | * @brief HAL MSP module. 30 | * @{ 31 | */ 32 | 33 | /* Private typedef -----------------------------------------------------------*/ 34 | /* Private define ------------------------------------------------------------*/ 35 | /* Private macro -------------------------------------------------------------*/ 36 | /* Private variables ---------------------------------------------------------*/ 37 | /* Private function prototypes -----------------------------------------------*/ 38 | /* Private functions ---------------------------------------------------------*/ 39 | 40 | /** @defgroup HAL_MSP_Private_Functions 41 | * @{ 42 | */ 43 | 44 | /** 45 | * @brief Initialize the Global MSP. 46 | * @param None 47 | * @retval None 48 | */ 49 | void HAL_MspInit(void) 50 | { 51 | /* NOTE : This function is generated automatically by STM32CubeMX and eventually 52 | modified by the user 53 | */ 54 | } 55 | 56 | /** 57 | * @brief DeInitialize the Global MSP. 58 | * @param None 59 | * @retval None 60 | */ 61 | void HAL_MspDeInit(void) 62 | { 63 | /* NOTE : This function is generated automatically by STM32CubeMX and eventually 64 | modified by the user 65 | */ 66 | } 67 | 68 | /** 69 | * @brief Initialize the PPP MSP. 70 | * @param None 71 | * @retval None 72 | */ 73 | void HAL_PPP_MspInit(void) 74 | { 75 | /* NOTE : This function is generated automatically by STM32CubeMX and eventually 76 | modified by the user 77 | */ 78 | } 79 | 80 | /** 81 | * @brief DeInitialize the PPP MSP. 82 | * @param None 83 | * @retval None 84 | */ 85 | void HAL_PPP_MspDeInit(void) 86 | { 87 | /* NOTE : This function is generated automatically by STM32CubeMX and eventually 88 | modified by the user 89 | */ 90 | } 91 | 92 | /** 93 | * @} 94 | */ 95 | 96 | /** 97 | * @} 98 | */ 99 | 100 | /** 101 | * @} 102 | */ 103 | -------------------------------------------------------------------------------- /Src/stm32l4xx_hal_sai_ex.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_sai_ex.c 4 | * @author MCD Application Team 5 | * @brief SAI Extended HAL module driver. 6 | * This file provides firmware functions to manage the following 7 | * functionality of the SAI Peripheral Controller: 8 | * + Modify PDM microphone delays. 9 | * 10 | ****************************************************************************** 11 | * @attention 12 | * 13 | * Copyright (c) 2017 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 "stm32l4xx_hal.h" 25 | 26 | /** @addtogroup STM32L4xx_HAL_Driver 27 | * @{ 28 | */ 29 | #ifdef HAL_SAI_MODULE_ENABLED 30 | #if defined(STM32L4R5xx) || defined(STM32L4R7xx) || defined(STM32L4R9xx) || defined(STM32L4S5xx) || defined(STM32L4S7xx) || defined(STM32L4S9xx) || \ 31 | defined(STM32L4P5xx) || defined(STM32L4Q5xx) 32 | 33 | /** @defgroup SAIEx SAIEx 34 | * @brief SAI Extended HAL module driver 35 | * @{ 36 | */ 37 | 38 | /* Private types -------------------------------------------------------------*/ 39 | /* Private variables ---------------------------------------------------------*/ 40 | /* Private constants ---------------------------------------------------------*/ 41 | /** @defgroup SAIEx_Private_Defines SAIEx Extended Private Defines 42 | * @{ 43 | */ 44 | #define SAI_PDM_DELAY_MASK 0x77U 45 | #define SAI_PDM_DELAY_OFFSET 8U 46 | #define SAI_PDM_RIGHT_DELAY_OFFSET 4U 47 | /** 48 | * @} 49 | */ 50 | 51 | /* Private macros ------------------------------------------------------------*/ 52 | /* Private functions ---------------------------------------------------------*/ 53 | /* Exported functions --------------------------------------------------------*/ 54 | /** @defgroup SAIEx_Exported_Functions SAIEx Extended Exported Functions 55 | * @{ 56 | */ 57 | 58 | /** @defgroup SAIEx_Exported_Functions_Group1 Peripheral Control functions 59 | * @brief SAIEx control functions 60 | * 61 | @verbatim 62 | =============================================================================== 63 | ##### Extended features functions ##### 64 | =============================================================================== 65 | [..] This section provides functions allowing to: 66 | (+) Modify PDM microphone delays 67 | 68 | @endverbatim 69 | * @{ 70 | */ 71 | 72 | /** 73 | * @brief Configure PDM microphone delays. 74 | * @param hsai SAI handle. 75 | * @param pdmMicDelay Microphone delays configuration. 76 | * @retval HAL status 77 | */ 78 | HAL_StatusTypeDef HAL_SAIEx_ConfigPdmMicDelay(const SAI_HandleTypeDef *hsai, 79 | const SAIEx_PdmMicDelayParamTypeDef *pdmMicDelay) 80 | { 81 | HAL_StatusTypeDef status = HAL_OK; 82 | uint32_t offset; 83 | 84 | /* Check that SAI sub-block is SAI1 sub-block A */ 85 | if (hsai->Instance != SAI1_Block_A) 86 | { 87 | status = HAL_ERROR; 88 | } 89 | else 90 | { 91 | /* Check microphone delay parameters */ 92 | assert_param(IS_SAI_PDM_MIC_PAIRS_NUMBER(pdmMicDelay->MicPair)); 93 | assert_param(IS_SAI_PDM_MIC_DELAY(pdmMicDelay->LeftDelay)); 94 | assert_param(IS_SAI_PDM_MIC_DELAY(pdmMicDelay->RightDelay)); 95 | 96 | /* Compute offset on PDMDLY register according mic pair number */ 97 | offset = SAI_PDM_DELAY_OFFSET * (pdmMicDelay->MicPair - 1U); 98 | 99 | /* Check SAI state and offset */ 100 | if ((hsai->State != HAL_SAI_STATE_RESET) && (offset <= 24U)) 101 | { 102 | /* Reset current delays for specified microphone */ 103 | SAI1->PDMDLY &= ~(SAI_PDM_DELAY_MASK << offset); 104 | 105 | /* Apply new microphone delays */ 106 | SAI1->PDMDLY |= (((pdmMicDelay->RightDelay << SAI_PDM_RIGHT_DELAY_OFFSET) | pdmMicDelay->LeftDelay) << offset); 107 | } 108 | else 109 | { 110 | status = HAL_ERROR; 111 | } 112 | } 113 | return status; 114 | } 115 | 116 | /** 117 | * @} 118 | */ 119 | 120 | /** 121 | * @} 122 | */ 123 | 124 | /** 125 | * @} 126 | */ 127 | 128 | #endif /* STM32L4R5xx || STM32L4R7xx || STM32L4R9xx || STM32L4S5xx || STM32L4S7xx || STM32L4S9xx || */ 129 | /* STM32L4P5xx || STM32L4Q5xx */ 130 | #endif /* HAL_SAI_MODULE_ENABLED */ 131 | /** 132 | * @} 133 | */ 134 | 135 | -------------------------------------------------------------------------------- /Src/stm32l4xx_hal_smbus_ex.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_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) 2017 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 STM32L4xx 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 "stm32l4xx_hal.h" 47 | 48 | /** @addtogroup STM32L4xx_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 | 165 | /** @defgroup SMBUSEx_Exported_Functions_Group3 Fast Mode Plus Functions 166 | * @brief Fast Mode Plus Functions 167 | * 168 | @verbatim 169 | =============================================================================== 170 | ##### Fast Mode Plus Functions ##### 171 | =============================================================================== 172 | [..] This section provides functions allowing to: 173 | (+) Configure Fast Mode Plus 174 | 175 | @endverbatim 176 | * @{ 177 | */ 178 | 179 | /** 180 | * @brief Enable the SMBUS fast mode plus driving capability. 181 | * @param ConfigFastModePlus Selects the pin. 182 | * This parameter can be one of the @ref SMBUSEx_FastModePlus values 183 | * @note For I2C1, fast mode plus driving capability can be enabled on all selected 184 | * I2C1 pins using SMBUS_FASTMODEPLUS_I2C1 parameter or independently 185 | * on each one of the following pins PB6, PB7, PB8 and PB9. 186 | * @note For remaining I2C1 pins (PA14, PA15...) fast mode plus driving capability 187 | * can be enabled only by using SMBUS_FASTMODEPLUS_I2C1 parameter. 188 | * @note For all I2C2 pins fast mode plus driving capability can be enabled 189 | * only by using SMBUS_FASTMODEPLUS_I2C2 parameter. 190 | * @note For all I2C3 pins fast mode plus driving capability can be enabled 191 | * only by using SMBUS_FASTMODEPLUS_I2C3 parameter. 192 | * @note For all I2C4 pins fast mode plus driving capability can be enabled 193 | * only by using SMBUS_FASTMODEPLUS_I2C4 parameter. 194 | * @retval None 195 | */ 196 | void HAL_SMBUSEx_EnableFastModePlus(uint32_t ConfigFastModePlus) 197 | { 198 | /* Check the parameter */ 199 | assert_param(IS_SMBUS_FASTMODEPLUS(ConfigFastModePlus)); 200 | 201 | /* Enable SYSCFG clock */ 202 | __HAL_RCC_SYSCFG_CLK_ENABLE(); 203 | 204 | /* Enable fast mode plus driving capability for selected pin */ 205 | SET_BIT(SYSCFG->CFGR1, (uint32_t)ConfigFastModePlus); 206 | } 207 | 208 | /** 209 | * @brief Disable the SMBUS fast mode plus driving capability. 210 | * @param ConfigFastModePlus Selects the pin. 211 | * This parameter can be one of the @ref SMBUSEx_FastModePlus values 212 | * @note For I2C1, fast mode plus driving capability can be disabled on all selected 213 | * I2C1 pins using SMBUS_FASTMODEPLUS_I2C1 parameter or independently 214 | * on each one of the following pins PB6, PB7, PB8 and PB9. 215 | * @note For remaining I2C1 pins (PA14, PA15...) fast mode plus driving capability 216 | * can be disabled only by using SMBUS_FASTMODEPLUS_I2C1 parameter. 217 | * @note For all I2C2 pins fast mode plus driving capability can be disabled 218 | * only by using SMBUS_FASTMODEPLUS_I2C2 parameter. 219 | * @note For all I2C3 pins fast mode plus driving capability can be disabled 220 | * only by using SMBUS_FASTMODEPLUS_I2C3 parameter. 221 | * @note For all I2C4 pins fast mode plus driving capability can be disabled 222 | * only by using SMBUS_FASTMODEPLUS_I2C4 parameter. 223 | * @retval None 224 | */ 225 | void HAL_SMBUSEx_DisableFastModePlus(uint32_t ConfigFastModePlus) 226 | { 227 | /* Check the parameter */ 228 | assert_param(IS_SMBUS_FASTMODEPLUS(ConfigFastModePlus)); 229 | 230 | /* Enable SYSCFG clock */ 231 | __HAL_RCC_SYSCFG_CLK_ENABLE(); 232 | 233 | /* Disable fast mode plus driving capability for selected pin */ 234 | CLEAR_BIT(SYSCFG->CFGR1, (uint32_t)ConfigFastModePlus); 235 | } 236 | 237 | /** 238 | * @} 239 | */ 240 | 241 | /** 242 | * @} 243 | */ 244 | 245 | /** 246 | * @} 247 | */ 248 | 249 | #endif /* HAL_SMBUS_MODULE_ENABLED */ 250 | /** 251 | * @} 252 | */ 253 | 254 | /** 255 | * @} 256 | */ 257 | -------------------------------------------------------------------------------- /Src/stm32l4xx_hal_spi_ex.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_spi_ex.c 4 | * @author MCD Application Team 5 | * @brief Extended SPI HAL module driver. 6 | * This file provides firmware functions to manage the following 7 | * SPI peripheral extended functionalities : 8 | * + IO operation functions 9 | * 10 | ****************************************************************************** 11 | * @attention 12 | * 13 | * Copyright (c) 2017 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 "stm32l4xx_hal.h" 25 | 26 | /** @addtogroup STM32L4xx_HAL_Driver 27 | * @{ 28 | */ 29 | 30 | /** @defgroup SPIEx SPIEx 31 | * @brief SPI Extended HAL module driver 32 | * @{ 33 | */ 34 | #ifdef HAL_SPI_MODULE_ENABLED 35 | 36 | /* Private typedef -----------------------------------------------------------*/ 37 | /* Private defines -----------------------------------------------------------*/ 38 | /** @defgroup SPIEx_Private_Constants SPIEx Private Constants 39 | * @{ 40 | */ 41 | #define SPI_FIFO_SIZE 4UL 42 | /** 43 | * @} 44 | */ 45 | 46 | /* Private macros ------------------------------------------------------------*/ 47 | /* Private variables ---------------------------------------------------------*/ 48 | /* Private function prototypes -----------------------------------------------*/ 49 | /* Exported functions --------------------------------------------------------*/ 50 | 51 | /** @defgroup SPIEx_Exported_Functions SPIEx Exported Functions 52 | * @{ 53 | */ 54 | 55 | /** @defgroup SPIEx_Exported_Functions_Group1 IO operation functions 56 | * @brief Data transfers functions 57 | * 58 | @verbatim 59 | ============================================================================== 60 | ##### IO operation functions ##### 61 | =============================================================================== 62 | [..] 63 | This subsection provides a set of extended functions to manage the SPI 64 | data transfers. 65 | 66 | (#) Rx data flush function: 67 | (++) HAL_SPIEx_FlushRxFifo() 68 | 69 | @endverbatim 70 | * @{ 71 | */ 72 | 73 | /** 74 | * @brief Flush the RX fifo. 75 | * @param hspi pointer to a SPI_HandleTypeDef structure that contains 76 | * the configuration information for the specified SPI module. 77 | * @retval HAL status 78 | */ 79 | HAL_StatusTypeDef HAL_SPIEx_FlushRxFifo(const SPI_HandleTypeDef *hspi) 80 | { 81 | __IO uint32_t tmpreg; 82 | uint8_t count = 0U; 83 | while ((hspi->Instance->SR & SPI_FLAG_FRLVL) != SPI_FRLVL_EMPTY) 84 | { 85 | count++; 86 | tmpreg = hspi->Instance->DR; 87 | UNUSED(tmpreg); /* To avoid GCC warning */ 88 | if (count == SPI_FIFO_SIZE) 89 | { 90 | return HAL_TIMEOUT; 91 | } 92 | } 93 | return HAL_OK; 94 | } 95 | 96 | /** 97 | * @} 98 | */ 99 | 100 | /** 101 | * @} 102 | */ 103 | 104 | #endif /* HAL_SPI_MODULE_ENABLED */ 105 | 106 | /** 107 | * @} 108 | */ 109 | 110 | /** 111 | * @} 112 | */ 113 | -------------------------------------------------------------------------------- /Src/stm32l4xx_hal_timebase_tim_template.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_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 overrides 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) 2017 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 'stm32l4xx_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 stm32l4xx_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 "stm32l4xx_hal.h" 43 | 44 | /** @addtogroup STM32L4xx_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 TIM6_DAC_IRQHandler(void); 59 | /* Private functions ---------------------------------------------------------*/ 60 | 61 | /** 62 | * @brief This function configures the TIM6 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, uwAPB1Prescaler; 74 | uint32_t uwPrescalerValue; 75 | uint32_t pFLatency; 76 | HAL_StatusTypeDef status = HAL_OK; 77 | 78 | /* Check uwTickFreq for MisraC 2012 (even if uwTickFreq is a enum type that don't take the value zero)*/ 79 | if ((uint32_t)uwTickFreq != 0U) 80 | { 81 | /* Enable TIM6 clock */ 82 | __HAL_RCC_TIM6_CLK_ENABLE(); 83 | 84 | /* Get clock configuration */ 85 | HAL_RCC_GetClockConfig(&clkconfig, &pFLatency); 86 | 87 | /* Get APB1 prescaler */ 88 | uwAPB1Prescaler = clkconfig.APB1CLKDivider; 89 | 90 | /* Compute TIM6 clock */ 91 | if (uwAPB1Prescaler == RCC_HCLK_DIV1) 92 | { 93 | uwTimclock = HAL_RCC_GetPCLK1Freq(); 94 | } 95 | else 96 | { 97 | uwTimclock = 2U * HAL_RCC_GetPCLK1Freq(); 98 | } 99 | 100 | /* Compute the prescaler value to have TIM6 counter clock equal to 1MHz */ 101 | uwPrescalerValue = (uint32_t) ((uwTimclock / 1000000U) - 1U); 102 | 103 | /* Initialize TIM6 */ 104 | TimHandle.Instance = TIM6; 105 | 106 | /* Initialize TIMx peripheral as follows: 107 | + Period = [(TIM6CLK/1000) - 1]. to have a (1/1000) s time base. 108 | + Prescaler = (uwTimclock/1000000 - 1) to have a 1MHz counter clock. 109 | + ClockDivision = 0 110 | + Counter direction = Up 111 | */ 112 | TimHandle.Init.Period = (1000000U / 1000U) - 1U; 113 | TimHandle.Init.Prescaler = uwPrescalerValue; 114 | TimHandle.Init.ClockDivision = 0; 115 | TimHandle.Init.CounterMode = TIM_COUNTERMODE_UP; 116 | TimHandle.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE; 117 | if (HAL_TIM_Base_Init(&TimHandle) == HAL_OK) 118 | { 119 | /* Start the TIM time Base generation in interrupt mode */ 120 | if (HAL_TIM_Base_Start_IT(&TimHandle) == HAL_OK) 121 | { 122 | /* Enable the TIM6_DAC global Interrupt */ 123 | HAL_NVIC_EnableIRQ(TIM6_DAC_IRQn); 124 | 125 | /* Configure the SysTick IRQ priority */ 126 | if (TickPriority < (1UL << __NVIC_PRIO_BITS)) 127 | { 128 | /*Configure the TIM6_DAC IRQ priority */ 129 | HAL_NVIC_SetPriority(TIM6_DAC_IRQn, TickPriority ,0U); 130 | uwTickPrio = TickPriority; 131 | } 132 | else 133 | { 134 | status = HAL_ERROR; 135 | } 136 | } 137 | else 138 | { 139 | status = HAL_ERROR; 140 | } 141 | } 142 | else 143 | { 144 | status = HAL_ERROR; 145 | } 146 | } 147 | else 148 | { 149 | status = HAL_ERROR; 150 | } 151 | 152 | /* Return function status */ 153 | return status; 154 | } 155 | 156 | /** 157 | * @brief Suspend Tick increment. 158 | * @note Disable the tick increment by disabling TIM6 update interrupt. 159 | * @retval None 160 | */ 161 | void HAL_SuspendTick(void) 162 | { 163 | /* Disable TIM6 update interrupt */ 164 | __HAL_TIM_DISABLE_IT(&TimHandle, TIM_IT_UPDATE); 165 | } 166 | 167 | /** 168 | * @brief Resume Tick increment. 169 | * @note Enable the tick increment by enabling TIM6 update interrupt. 170 | * @retval None 171 | */ 172 | void HAL_ResumeTick(void) 173 | { 174 | /* Enable TIM6 update interrupt */ 175 | __HAL_TIM_ENABLE_IT(&TimHandle, TIM_IT_UPDATE); 176 | } 177 | 178 | /** 179 | * @brief Period elapsed callback in non blocking mode 180 | * @note This function is called when TIM6 interrupt took place, inside 181 | * HAL_TIM_IRQHandler(). It makes a direct call to HAL_IncTick() to increment 182 | * a global variable "uwTick" used as application time base. 183 | * @param htim TIM handle 184 | * @retval None 185 | */ 186 | void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) 187 | { 188 | /* Prevent unused argument(s) compilation warning */ 189 | UNUSED(htim); 190 | 191 | HAL_IncTick(); 192 | } 193 | 194 | /** 195 | * @brief This function handles TIM interrupt request. 196 | * @retval None 197 | */ 198 | void TIM6_DAC_IRQHandler(void) 199 | { 200 | HAL_TIM_IRQHandler(&TimHandle); 201 | } 202 | 203 | /** 204 | * @} 205 | */ 206 | 207 | /** 208 | * @} 209 | */ 210 | -------------------------------------------------------------------------------- /Src/stm32l4xx_ll_crc.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_ll_crc.c 4 | * @author MCD Application Team 5 | * @brief CRC LL module driver. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2017 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 "stm32l4xx_ll_crc.h" 22 | #include "stm32l4xx_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 STM32L4xx_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/stm32l4xx_ll_crs.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_ll_crs.h 4 | * @author MCD Application Team 5 | * @brief CRS LL module driver. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2017 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 "stm32l4xx_ll_crs.h" 22 | #include "stm32l4xx_ll_bus.h" 23 | 24 | /** @addtogroup STM32L4xx_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/stm32l4xx_ll_i2c.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_ll_i2c.c 4 | * @author MCD Application Team 5 | * @brief I2C LL module driver. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2017 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 "stm32l4xx_ll_i2c.h" 22 | #include "stm32l4xx_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 STM32L4xx_LL_Driver 30 | * @{ 31 | */ 32 | 33 | #if defined (I2C1) || defined (I2C2) || defined (I2C3) || defined (I2C4) 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 | else if (I2Cx == I2C3) 113 | { 114 | /* Force reset of I2C clock */ 115 | LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_I2C3); 116 | 117 | /* Release reset of I2C clock */ 118 | LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_I2C3); 119 | } 120 | #if defined(I2C4) 121 | else if (I2Cx == I2C4) 122 | { 123 | /* Force reset of I2C clock */ 124 | LL_APB1_GRP2_ForceReset(LL_APB1_GRP2_PERIPH_I2C4); 125 | 126 | /* Release reset of I2C clock */ 127 | LL_APB1_GRP2_ReleaseReset(LL_APB1_GRP2_PERIPH_I2C4); 128 | } 129 | #endif /* I2C4 */ 130 | else 131 | { 132 | status = ERROR; 133 | } 134 | 135 | return status; 136 | } 137 | 138 | /** 139 | * @brief Initialize the I2C registers according to the specified parameters in I2C_InitStruct. 140 | * @param I2Cx I2C Instance. 141 | * @param I2C_InitStruct pointer to a @ref LL_I2C_InitTypeDef structure. 142 | * @retval An ErrorStatus enumeration value: 143 | * - SUCCESS: I2C registers are initialized 144 | * - ERROR: Not applicable 145 | */ 146 | ErrorStatus LL_I2C_Init(I2C_TypeDef *I2Cx, const LL_I2C_InitTypeDef *I2C_InitStruct) 147 | { 148 | /* Check the I2C Instance I2Cx */ 149 | assert_param(IS_I2C_ALL_INSTANCE(I2Cx)); 150 | 151 | /* Check the I2C parameters from I2C_InitStruct */ 152 | assert_param(IS_LL_I2C_PERIPHERAL_MODE(I2C_InitStruct->PeripheralMode)); 153 | assert_param(IS_LL_I2C_ANALOG_FILTER(I2C_InitStruct->AnalogFilter)); 154 | assert_param(IS_LL_I2C_DIGITAL_FILTER(I2C_InitStruct->DigitalFilter)); 155 | assert_param(IS_LL_I2C_OWN_ADDRESS1(I2C_InitStruct->OwnAddress1)); 156 | assert_param(IS_LL_I2C_TYPE_ACKNOWLEDGE(I2C_InitStruct->TypeAcknowledge)); 157 | assert_param(IS_LL_I2C_OWN_ADDRSIZE(I2C_InitStruct->OwnAddrSize)); 158 | 159 | /* Disable the selected I2Cx Peripheral */ 160 | LL_I2C_Disable(I2Cx); 161 | 162 | /*---------------------------- I2Cx CR1 Configuration ------------------------ 163 | * Configure the analog and digital noise filters with parameters : 164 | * - AnalogFilter: I2C_CR1_ANFOFF bit 165 | * - DigitalFilter: I2C_CR1_DNF[3:0] bits 166 | */ 167 | LL_I2C_ConfigFilters(I2Cx, I2C_InitStruct->AnalogFilter, I2C_InitStruct->DigitalFilter); 168 | 169 | /*---------------------------- I2Cx TIMINGR Configuration -------------------- 170 | * Configure the SDA setup, hold time and the SCL high, low period with parameter : 171 | * - Timing: I2C_TIMINGR_PRESC[3:0], I2C_TIMINGR_SCLDEL[3:0], I2C_TIMINGR_SDADEL[3:0], 172 | * I2C_TIMINGR_SCLH[7:0] and I2C_TIMINGR_SCLL[7:0] bits 173 | */ 174 | LL_I2C_SetTiming(I2Cx, I2C_InitStruct->Timing); 175 | 176 | /* Enable the selected I2Cx Peripheral */ 177 | LL_I2C_Enable(I2Cx); 178 | 179 | /*---------------------------- I2Cx OAR1 Configuration ----------------------- 180 | * Disable, Configure and Enable I2Cx device own address 1 with parameters : 181 | * - OwnAddress1: I2C_OAR1_OA1[9:0] bits 182 | * - OwnAddrSize: I2C_OAR1_OA1MODE bit 183 | */ 184 | LL_I2C_DisableOwnAddress1(I2Cx); 185 | LL_I2C_SetOwnAddress1(I2Cx, I2C_InitStruct->OwnAddress1, I2C_InitStruct->OwnAddrSize); 186 | 187 | /* OwnAdress1 == 0 is reserved for General Call address */ 188 | if (I2C_InitStruct->OwnAddress1 != 0U) 189 | { 190 | LL_I2C_EnableOwnAddress1(I2Cx); 191 | } 192 | 193 | /*---------------------------- I2Cx MODE Configuration ----------------------- 194 | * Configure I2Cx peripheral mode with parameter : 195 | * - PeripheralMode: I2C_CR1_SMBDEN and I2C_CR1_SMBHEN bits 196 | */ 197 | LL_I2C_SetMode(I2Cx, I2C_InitStruct->PeripheralMode); 198 | 199 | /*---------------------------- I2Cx CR2 Configuration ------------------------ 200 | * Configure the ACKnowledge or Non ACKnowledge condition 201 | * after the address receive match code or next received byte with parameter : 202 | * - TypeAcknowledge: I2C_CR2_NACK bit 203 | */ 204 | LL_I2C_AcknowledgeNextData(I2Cx, I2C_InitStruct->TypeAcknowledge); 205 | 206 | return SUCCESS; 207 | } 208 | 209 | /** 210 | * @brief Set each @ref LL_I2C_InitTypeDef field to default value. 211 | * @param I2C_InitStruct Pointer to a @ref LL_I2C_InitTypeDef structure. 212 | * @retval None 213 | */ 214 | void LL_I2C_StructInit(LL_I2C_InitTypeDef *I2C_InitStruct) 215 | { 216 | /* Set I2C_InitStruct fields to default values */ 217 | I2C_InitStruct->PeripheralMode = LL_I2C_MODE_I2C; 218 | I2C_InitStruct->Timing = 0U; 219 | I2C_InitStruct->AnalogFilter = LL_I2C_ANALOGFILTER_ENABLE; 220 | I2C_InitStruct->DigitalFilter = 0U; 221 | I2C_InitStruct->OwnAddress1 = 0U; 222 | I2C_InitStruct->TypeAcknowledge = LL_I2C_NACK; 223 | I2C_InitStruct->OwnAddrSize = LL_I2C_OWNADDRESS1_7BIT; 224 | } 225 | 226 | /** 227 | * @} 228 | */ 229 | 230 | /** 231 | * @} 232 | */ 233 | 234 | /** 235 | * @} 236 | */ 237 | 238 | #endif /* I2C1 || I2C2 || I2C3 || I2C4 */ 239 | 240 | /** 241 | * @} 242 | */ 243 | 244 | #endif /* USE_FULL_LL_DRIVER */ 245 | -------------------------------------------------------------------------------- /Src/stm32l4xx_ll_opamp.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_ll_opamp.c 4 | * @author MCD Application Team 5 | * @brief OPAMP LL module driver 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2017 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 "stm32l4xx_ll_opamp.h" 22 | 23 | #ifdef USE_FULL_ASSERT 24 | #include "stm32_assert.h" 25 | #else 26 | #define assert_param(expr) ((void)0U) 27 | #endif 28 | 29 | /** @addtogroup STM32L4xx_LL_Driver 30 | * @{ 31 | */ 32 | 33 | #if defined (OPAMP1) || defined (OPAMP2) 34 | 35 | /** @addtogroup OPAMP_LL OPAMP 36 | * @{ 37 | */ 38 | 39 | /* Private types -------------------------------------------------------------*/ 40 | /* Private variables ---------------------------------------------------------*/ 41 | /* Private constants ---------------------------------------------------------*/ 42 | /* Private macros ------------------------------------------------------------*/ 43 | 44 | /** @addtogroup OPAMP_LL_Private_Macros 45 | * @{ 46 | */ 47 | 48 | /* Check of parameters for configuration of OPAMP hierarchical scope: */ 49 | /* OPAMP instance. */ 50 | 51 | #define IS_LL_OPAMP_POWER_MODE(__POWER_MODE__) \ 52 | ( ((__POWER_MODE__) == LL_OPAMP_POWERMODE_NORMALPOWER) \ 53 | || ((__POWER_MODE__) == LL_OPAMP_POWERMODE_LOWPOWER)) 54 | 55 | #define IS_LL_OPAMP_FUNCTIONAL_MODE(__FUNCTIONAL_MODE__) \ 56 | ( ((__FUNCTIONAL_MODE__) == LL_OPAMP_MODE_STANDALONE) \ 57 | || ((__FUNCTIONAL_MODE__) == LL_OPAMP_MODE_FOLLOWER) \ 58 | || ((__FUNCTIONAL_MODE__) == LL_OPAMP_MODE_PGA) \ 59 | ) 60 | 61 | /* Note: Comparator non-inverting inputs parameters are the same on all */ 62 | /* OPAMP instances. */ 63 | /* However, comparator instance kept as macro parameter for */ 64 | /* compatibility with other STM32 families. */ 65 | #define IS_LL_OPAMP_INPUT_NONINVERTING(__OPAMPX__, __INPUT_NONINVERTING__) \ 66 | ( ((__INPUT_NONINVERTING__) == LL_OPAMP_INPUT_NONINVERT_IO0) \ 67 | || ((__INPUT_NONINVERTING__) == LL_OPAMP_INPUT_NONINV_DAC1_CH1) \ 68 | ) 69 | 70 | /* Note: Comparator non-inverting inputs parameters are the same on all */ 71 | /* OPAMP instances. */ 72 | /* However, comparator instance kept as macro parameter for */ 73 | /* compatibility with other STM32 families. */ 74 | #define IS_LL_OPAMP_INPUT_INVERTING(__OPAMPX__, __INPUT_INVERTING__) \ 75 | ( ((__INPUT_INVERTING__) == LL_OPAMP_INPUT_INVERT_IO0) \ 76 | || ((__INPUT_INVERTING__) == LL_OPAMP_INPUT_INVERT_IO1) \ 77 | || ((__INPUT_INVERTING__) == LL_OPAMP_INPUT_INVERT_CONNECT_NO) \ 78 | ) 79 | 80 | /** 81 | * @} 82 | */ 83 | 84 | 85 | /* Private function prototypes -----------------------------------------------*/ 86 | 87 | /* Exported functions --------------------------------------------------------*/ 88 | /** @addtogroup OPAMP_LL_Exported_Functions 89 | * @{ 90 | */ 91 | 92 | /** @addtogroup OPAMP_LL_EF_Init 93 | * @{ 94 | */ 95 | 96 | /** 97 | * @brief De-initialize registers of the selected OPAMP instance 98 | * to their default reset values. 99 | * @param OPAMPx OPAMP instance 100 | * @retval An ErrorStatus enumeration value: 101 | * - SUCCESS: OPAMP registers are de-initialized 102 | * - ERROR: OPAMP registers are not de-initialized 103 | */ 104 | ErrorStatus LL_OPAMP_DeInit(OPAMP_TypeDef* OPAMPx) 105 | { 106 | ErrorStatus status = SUCCESS; 107 | 108 | /* Check the parameters */ 109 | assert_param(IS_OPAMP_ALL_INSTANCE(OPAMPx)); 110 | 111 | LL_OPAMP_WriteReg(OPAMPx, CSR, 0x00000000U); 112 | 113 | return status; 114 | } 115 | 116 | /** 117 | * @brief Initialize some features of OPAMP instance. 118 | * @note This function reset bit of calibration mode to ensure 119 | * to be in functional mode, in order to have OPAMP parameters 120 | * (inputs selection, ...) set with the corresponding OPAMP mode 121 | * to be effective. 122 | * @note This function configures features of the selected OPAMP instance. 123 | * Some features are also available at scope OPAMP common instance 124 | * (common to several OPAMP instances). 125 | * Refer to functions having argument "OPAMPxy_COMMON" as parameter. 126 | * @param OPAMPx OPAMP instance 127 | * @param OPAMP_InitStruct Pointer to a @ref LL_OPAMP_InitTypeDef structure 128 | * @retval An ErrorStatus enumeration value: 129 | * - SUCCESS: OPAMP registers are initialized 130 | * - ERROR: OPAMP registers are not initialized 131 | */ 132 | ErrorStatus LL_OPAMP_Init(OPAMP_TypeDef *OPAMPx, LL_OPAMP_InitTypeDef *OPAMP_InitStruct) 133 | { 134 | /* Check the parameters */ 135 | assert_param(IS_OPAMP_ALL_INSTANCE(OPAMPx)); 136 | assert_param(IS_LL_OPAMP_POWER_MODE(OPAMP_InitStruct->PowerMode)); 137 | assert_param(IS_LL_OPAMP_FUNCTIONAL_MODE(OPAMP_InitStruct->FunctionalMode)); 138 | assert_param(IS_LL_OPAMP_INPUT_NONINVERTING(OPAMPx, OPAMP_InitStruct->InputNonInverting)); 139 | 140 | /* Note: OPAMP inverting input can be used with OPAMP in mode standalone */ 141 | /* or PGA with external capacitors for filtering circuit. */ 142 | /* Otherwise (OPAMP in mode follower), OPAMP inverting input is */ 143 | /* not used (not connected to GPIO pin). */ 144 | if(OPAMP_InitStruct->FunctionalMode != LL_OPAMP_MODE_FOLLOWER) 145 | { 146 | assert_param(IS_LL_OPAMP_INPUT_INVERTING(OPAMPx, OPAMP_InitStruct->InputInverting)); 147 | } 148 | 149 | /* Configuration of OPAMP instance : */ 150 | /* - PowerMode */ 151 | /* - Functional mode */ 152 | /* - Input non-inverting */ 153 | /* - Input inverting */ 154 | /* Note: Bit OPAMP_CSR_CALON reset to ensure to be in functional mode. */ 155 | if(OPAMP_InitStruct->FunctionalMode != LL_OPAMP_MODE_FOLLOWER) 156 | { 157 | MODIFY_REG(OPAMPx->CSR, 158 | OPAMP_CSR_OPALPM 159 | | OPAMP_CSR_OPAMODE 160 | | OPAMP_CSR_CALON 161 | | OPAMP_CSR_VMSEL 162 | | OPAMP_CSR_VPSEL 163 | , 164 | (OPAMP_InitStruct->PowerMode & OPAMP_POWERMODE_CSR_BIT_MASK) 165 | | OPAMP_InitStruct->FunctionalMode 166 | | OPAMP_InitStruct->InputNonInverting 167 | | OPAMP_InitStruct->InputInverting 168 | ); 169 | } 170 | else 171 | { 172 | MODIFY_REG(OPAMPx->CSR, 173 | OPAMP_CSR_OPALPM 174 | | OPAMP_CSR_OPAMODE 175 | | OPAMP_CSR_CALON 176 | | OPAMP_CSR_VMSEL 177 | | OPAMP_CSR_VPSEL 178 | , 179 | (OPAMP_InitStruct->PowerMode & OPAMP_POWERMODE_CSR_BIT_MASK) 180 | | LL_OPAMP_MODE_FOLLOWER 181 | | OPAMP_InitStruct->InputNonInverting 182 | | LL_OPAMP_INPUT_INVERT_CONNECT_NO 183 | ); 184 | } 185 | 186 | return SUCCESS; 187 | } 188 | 189 | /** 190 | * @brief Set each @ref LL_OPAMP_InitTypeDef field to default value. 191 | * @param OPAMP_InitStruct pointer to a @ref LL_OPAMP_InitTypeDef structure 192 | * whose fields will be set to default values. 193 | * @retval None 194 | */ 195 | void LL_OPAMP_StructInit(LL_OPAMP_InitTypeDef *OPAMP_InitStruct) 196 | { 197 | /* Set OPAMP_InitStruct fields to default values */ 198 | OPAMP_InitStruct->PowerMode = LL_OPAMP_POWERMODE_NORMALPOWER; 199 | OPAMP_InitStruct->FunctionalMode = LL_OPAMP_MODE_FOLLOWER; 200 | OPAMP_InitStruct->InputNonInverting = LL_OPAMP_INPUT_NONINVERT_IO0; 201 | /* Note: Parameter discarded if OPAMP in functional mode follower, */ 202 | /* set anyway to its default value. */ 203 | OPAMP_InitStruct->InputInverting = LL_OPAMP_INPUT_INVERT_CONNECT_NO; 204 | } 205 | 206 | /** 207 | * @} 208 | */ 209 | 210 | /** 211 | * @} 212 | */ 213 | 214 | /** 215 | * @} 216 | */ 217 | 218 | #endif /* OPAMP1 || OPAMP2 */ 219 | 220 | /** 221 | * @} 222 | */ 223 | 224 | #endif /* USE_FULL_LL_DRIVER */ 225 | -------------------------------------------------------------------------------- /Src/stm32l4xx_ll_pka.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_ll_pka.c 4 | * @author MCD Application Team 5 | * @brief PKA LL module driver. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2017 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 "stm32l4xx_ll_pka.h" 22 | #include "stm32l4xx_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 STM32L4xx_LL_Driver 31 | * @{ 32 | */ 33 | 34 | #if defined(PKA) 35 | 36 | /** @addtogroup PKA_LL 37 | * @{ 38 | */ 39 | 40 | /* Private types -------------------------------------------------------------*/ 41 | /* Private variables ---------------------------------------------------------*/ 42 | /* Private constants ---------------------------------------------------------*/ 43 | /* Private macros ------------------------------------------------------------*/ 44 | /** @defgroup PKA_LL_Private_Macros PKA Private Constants 45 | * @{ 46 | */ 47 | #define IS_LL_PKA_MODE(__VALUE__) (((__VALUE__) == LL_PKA_MODE_MONTGOMERY_PARAM_MOD_EXP) ||\ 48 | ((__VALUE__) == LL_PKA_MODE_MONTGOMERY_PARAM) ||\ 49 | ((__VALUE__) == LL_PKA_MODE_MODULAR_EXP) ||\ 50 | ((__VALUE__) == LL_PKA_MODE_MONTGOMERY_PARAM_ECC) ||\ 51 | ((__VALUE__) == LL_PKA_MODE_ECC_KP_PRIMITIVE) ||\ 52 | ((__VALUE__) == LL_PKA_MODE_ECDSA_SIGNATURE) ||\ 53 | ((__VALUE__) == LL_PKA_MODE_ECDSA_VERIFICATION) ||\ 54 | ((__VALUE__) == LL_PKA_MODE_POINT_CHECK) ||\ 55 | ((__VALUE__) == LL_PKA_MODE_RSA_CRT_EXP) ||\ 56 | ((__VALUE__) == LL_PKA_MODE_MODULAR_INV) ||\ 57 | ((__VALUE__) == LL_PKA_MODE_ARITHMETIC_ADD) ||\ 58 | ((__VALUE__) == LL_PKA_MODE_ARITHMETIC_SUB) ||\ 59 | ((__VALUE__) == LL_PKA_MODE_ARITHMETIC_MUL) ||\ 60 | ((__VALUE__) == LL_PKA_MODE_COMPARISON) ||\ 61 | ((__VALUE__) == LL_PKA_MODE_MODULAR_REDUC) ||\ 62 | ((__VALUE__) == LL_PKA_MODE_MODULAR_ADD) ||\ 63 | ((__VALUE__) == LL_PKA_MODE_MODULAR_SUB) ||\ 64 | ((__VALUE__) == LL_PKA_MODE_MONTGOMERY_MUL)) 65 | /** 66 | * @} 67 | */ 68 | 69 | /* Private function prototypes -----------------------------------------------*/ 70 | 71 | /* Exported functions --------------------------------------------------------*/ 72 | /** @addtogroup PKA_LL_Exported_Functions 73 | * @{ 74 | */ 75 | 76 | /** @addtogroup PKA_LL_EF_Init 77 | * @{ 78 | */ 79 | 80 | /** 81 | * @brief De-initialize PKA registers (Registers restored to their default values). 82 | * @param PKAx PKA Instance. 83 | * @retval ErrorStatus 84 | * - SUCCESS: PKA registers are de-initialized 85 | * - ERROR: PKA registers are not de-initialized 86 | */ 87 | ErrorStatus LL_PKA_DeInit(const PKA_TypeDef *PKAx) 88 | { 89 | ErrorStatus status = SUCCESS; 90 | 91 | /* Check the parameters */ 92 | assert_param(IS_PKA_ALL_INSTANCE(PKAx)); 93 | 94 | if (PKAx == PKA) 95 | { 96 | /* Force PKA reset */ 97 | LL_AHB2_GRP1_ForceReset(LL_AHB2_GRP1_PERIPH_PKA); 98 | 99 | /* Release PKA reset */ 100 | LL_AHB2_GRP1_ReleaseReset(LL_AHB2_GRP1_PERIPH_PKA); 101 | } 102 | else 103 | { 104 | status = ERROR; 105 | } 106 | 107 | return (status); 108 | } 109 | 110 | /** 111 | * @brief Initialize PKA registers according to the specified parameters in PKA_InitStruct. 112 | * @param PKAx PKA Instance. 113 | * @param PKA_InitStruct pointer to a @ref LL_PKA_InitTypeDef structure 114 | * that contains the configuration information for the specified PKA peripheral. 115 | * @retval ErrorStatus 116 | * - SUCCESS: PKA registers are initialized according to PKA_InitStruct content 117 | * - ERROR: Not applicable 118 | */ 119 | ErrorStatus LL_PKA_Init(PKA_TypeDef *PKAx, LL_PKA_InitTypeDef *PKA_InitStruct) 120 | { 121 | assert_param(IS_PKA_ALL_INSTANCE(PKAx)); 122 | assert_param(IS_LL_PKA_MODE(PKA_InitStruct->Mode)); 123 | 124 | LL_PKA_Config(PKAx, PKA_InitStruct->Mode); 125 | 126 | return (SUCCESS); 127 | } 128 | 129 | /** 130 | * @brief Set each @ref LL_PKA_InitTypeDef field to default value. 131 | * @param PKA_InitStruct pointer to a @ref LL_PKA_InitTypeDef structure 132 | * whose fields will be set to default values. 133 | * @retval None 134 | */ 135 | 136 | void LL_PKA_StructInit(LL_PKA_InitTypeDef *PKA_InitStruct) 137 | { 138 | /* Reset PKA init structure parameters values */ 139 | PKA_InitStruct->Mode = LL_PKA_MODE_MONTGOMERY_PARAM_MOD_EXP; 140 | } 141 | 142 | /** 143 | * @} 144 | */ 145 | 146 | /** 147 | * @} 148 | */ 149 | 150 | /** 151 | * @} 152 | */ 153 | 154 | #endif /* defined (PKA) */ 155 | 156 | /** 157 | * @} 158 | */ 159 | 160 | #endif /* USE_FULL_LL_DRIVER */ 161 | -------------------------------------------------------------------------------- /Src/stm32l4xx_ll_pwr.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_ll_pwr.c 4 | * @author MCD Application Team 5 | * @brief PWR LL module driver. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2017 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 "stm32l4xx_ll_pwr.h" 22 | #include "stm32l4xx_ll_bus.h" 23 | 24 | /** @addtogroup STM32L4xx_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/stm32l4xx_ll_rng.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_ll_rng.c 4 | * @author MCD Application Team 5 | * @brief RNG LL module driver. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2017 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 "stm32l4xx_ll_rng.h" 22 | #include "stm32l4xx_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 STM32L4xx_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 | #if defined(RNG_CR_CED) 45 | /** @defgroup RNG_LL_Private_Macros RNG Private Macros 46 | * @{ 47 | */ 48 | #define IS_LL_RNG_CED(__MODE__) (((__MODE__) == LL_RNG_CED_ENABLE) || \ 49 | ((__MODE__) == LL_RNG_CED_DISABLE)) 50 | 51 | #if defined(RNG_CR_CONDRST) 52 | #define IS_LL_RNG_CLOCK_DIVIDER(__CLOCK_DIV__) ((__CLOCK_DIV__) <=0x0Fu) 53 | 54 | 55 | #define IS_LL_RNG_NIST_COMPLIANCE(__NIST_COMPLIANCE__) (((__NIST_COMPLIANCE__) == LL_RNG_NIST_COMPLIANT) || \ 56 | ((__NIST_COMPLIANCE__) == LL_RNG_NOTNIST_COMPLIANT)) 57 | 58 | #define IS_LL_RNG_CONFIG1 (__CONFIG1__) ((__CONFIG1__) <= 0x3FUL) 59 | 60 | #define IS_LL_RNG_CONFIG2 (__CONFIG2__) ((__CONFIG2__) <= 0x07UL) 61 | 62 | #define IS_LL_RNG_CONFIG3 (__CONFIG3__) ((__CONFIG3__) <= 0xFUL) 63 | #endif /* RNG_CR_CONDRST */ 64 | /** 65 | * @} 66 | */ 67 | #endif /* RNG_CR_CED */ 68 | /* Private function prototypes -----------------------------------------------*/ 69 | 70 | /* Exported functions --------------------------------------------------------*/ 71 | /** @addtogroup RNG_LL_Exported_Functions 72 | * @{ 73 | */ 74 | 75 | /** @addtogroup RNG_LL_EF_Init 76 | * @{ 77 | */ 78 | 79 | /** 80 | * @brief De-initialize RNG registers (Registers restored to their default values). 81 | * @param RNGx RNG Instance 82 | * @retval An ErrorStatus enumeration value: 83 | * - SUCCESS: RNG registers are de-initialized 84 | * - ERROR: not applicable 85 | */ 86 | ErrorStatus LL_RNG_DeInit(const RNG_TypeDef *RNGx) 87 | { 88 | ErrorStatus status = SUCCESS; 89 | 90 | /* Check the parameters */ 91 | assert_param(IS_RNG_ALL_INSTANCE(RNGx)); 92 | if (RNGx == RNG) 93 | { 94 | /* Enable RNG reset state */ 95 | LL_AHB2_GRP1_ForceReset(LL_AHB2_GRP1_PERIPH_RNG); 96 | 97 | /* Release RNG from reset state */ 98 | LL_AHB2_GRP1_ReleaseReset(LL_AHB2_GRP1_PERIPH_RNG); 99 | } 100 | else 101 | { 102 | status = ERROR; 103 | } 104 | 105 | return status; 106 | } 107 | 108 | #if defined(RNG_CR_CED) 109 | /** 110 | * @brief Initialize RNG registers according to the specified parameters in RNG_InitStruct. 111 | * @param RNGx RNG Instance 112 | * @param RNG_InitStruct pointer to a LL_RNG_InitTypeDef structure 113 | * that contains the configuration information for the specified RNG peripheral. 114 | * @retval An ErrorStatus enumeration value: 115 | * - SUCCESS: RNG registers are initialized according to RNG_InitStruct content 116 | * - ERROR: not applicable 117 | */ 118 | ErrorStatus LL_RNG_Init(RNG_TypeDef *RNGx, const LL_RNG_InitTypeDef *RNG_InitStruct) 119 | { 120 | /* Check the parameters */ 121 | assert_param(IS_RNG_ALL_INSTANCE(RNGx)); 122 | assert_param(IS_LL_RNG_CED(RNG_InitStruct->ClockErrorDetection)); 123 | 124 | #if defined(RNG_CR_CONDRST) 125 | /* Clock Error Detection Configuration when CONDRT bit is set to 1 */ 126 | MODIFY_REG(RNGx->CR, RNG_CR_CED | RNG_CR_CONDRST, RNG_InitStruct->ClockErrorDetection | RNG_CR_CONDRST); 127 | /* Writing bits CONDRST=0*/ 128 | CLEAR_BIT(RNGx->CR, RNG_CR_CONDRST); 129 | #else 130 | /* Clock Error Detection configuration */ 131 | MODIFY_REG(RNGx->CR, RNG_CR_CED, RNG_InitStruct->ClockErrorDetection); 132 | #endif /* RNG_CR_CONDRST */ 133 | 134 | return (SUCCESS); 135 | } 136 | 137 | /** 138 | * @brief Set each @ref LL_RNG_InitTypeDef field to default value. 139 | * @param RNG_InitStruct pointer to a @ref LL_RNG_InitTypeDef structure 140 | * whose fields will be set to default values. 141 | * @retval None 142 | */ 143 | void LL_RNG_StructInit(LL_RNG_InitTypeDef *RNG_InitStruct) 144 | { 145 | /* Set RNG_InitStruct fields to default values */ 146 | RNG_InitStruct->ClockErrorDetection = LL_RNG_CED_ENABLE; 147 | 148 | } 149 | #endif /* RNG_CR_CED */ 150 | /** 151 | * @} 152 | */ 153 | 154 | /** 155 | * @} 156 | */ 157 | 158 | /** 159 | * @} 160 | */ 161 | 162 | #endif /* RNG */ 163 | 164 | /** 165 | * @} 166 | */ 167 | 168 | #endif /* USE_FULL_LL_DRIVER */ 169 | 170 | -------------------------------------------------------------------------------- /Src/stm32l4xx_ll_swpmi.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_ll_swpmi.c 4 | * @author MCD Application Team 5 | * @brief SWPMI LL module driver. 6 | ****************************************************************************** 7 | * @attention 8 | * 9 | * Copyright (c) 2017 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 "stm32l4xx_ll_swpmi.h" 22 | #include "stm32l4xx_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 STM32L4xx_LL_Driver 30 | * @{ 31 | */ 32 | 33 | #if defined(SWPMI1) 34 | 35 | /** @addtogroup SWPMI_LL 36 | * @{ 37 | */ 38 | 39 | /* Private types -------------------------------------------------------------*/ 40 | /* Private variables ---------------------------------------------------------*/ 41 | /* Private constants ---------------------------------------------------------*/ 42 | /* Private macros ------------------------------------------------------------*/ 43 | /** @addtogroup SWPMI_LL_Private_Macros 44 | * @{ 45 | */ 46 | 47 | #define IS_LL_SWPMI_BITRATE_VALUE(__VALUE__) (((__VALUE__) <= 63U)) 48 | 49 | #define IS_LL_SWPMI_SW_BUFFER_RX(__VALUE__) (((__VALUE__) == LL_SWPMI_SW_BUFFER_RX_SINGLE) \ 50 | || ((__VALUE__) == LL_SWPMI_SW_BUFFER_RX_MULTI)) 51 | 52 | #define IS_LL_SWPMI_SW_BUFFER_TX(__VALUE__) (((__VALUE__) == LL_SWPMI_SW_BUFFER_TX_SINGLE) \ 53 | || ((__VALUE__) == LL_SWPMI_SW_BUFFER_TX_MULTI)) 54 | 55 | #define IS_LL_SWPMI_VOLTAGE_CLASS(__VALUE__) (((__VALUE__) == LL_SWPMI_VOLTAGE_CLASS_C) \ 56 | || ((__VALUE__) == LL_SWPMI_VOLTAGE_CLASS_B)) 57 | 58 | /** 59 | * @} 60 | */ 61 | 62 | /* Private function prototypes -----------------------------------------------*/ 63 | 64 | /* Exported functions --------------------------------------------------------*/ 65 | /** @addtogroup SWPMI_LL_Exported_Functions 66 | * @{ 67 | */ 68 | 69 | /** @addtogroup SWPMI_LL_EF_Init 70 | * @{ 71 | */ 72 | 73 | /** 74 | * @brief De-initialize the SWPMI peripheral registers to their default reset values. 75 | * @param SWPMIx SWPMI Instance 76 | * @retval An ErrorStatus enumeration value 77 | * - SUCCESS: SWPMI registers are de-initialized 78 | * - ERROR: Not applicable 79 | */ 80 | ErrorStatus LL_SWPMI_DeInit(const SWPMI_TypeDef *SWPMIx) 81 | { 82 | ErrorStatus status = SUCCESS; 83 | 84 | /* Check the parameter */ 85 | assert_param(IS_SWPMI_INSTANCE(SWPMIx)); 86 | 87 | if (SWPMIx == SWPMI1) 88 | { 89 | LL_APB1_GRP2_ForceReset(LL_APB1_GRP2_PERIPH_SWPMI1); 90 | LL_APB1_GRP2_ReleaseReset(LL_APB1_GRP2_PERIPH_SWPMI1); 91 | } 92 | else 93 | { 94 | status = ERROR; 95 | } 96 | 97 | return status; 98 | } 99 | 100 | /** 101 | * @brief Initialize the SWPMI peripheral according to the specified parameters in the SWPMI_InitStruct. 102 | * @note As some bits in SWPMI configuration registers can only be written when the SWPMI is deactivated 103 | * (SWPMI_CR_SWPACT bit = 0), the SWPMI peripheral should be in deactivated state prior calling 104 | * this function. Otherwise, ERROR result will be returned. 105 | * @param SWPMIx SWPMI Instance 106 | * @param SWPMI_InitStruct pointer to a @ref LL_SWPMI_InitTypeDef structure that contains 107 | * the configuration information for the SWPMI peripheral. 108 | * @retval An ErrorStatus enumeration value 109 | * - SUCCESS: SWPMI registers are initialized 110 | * - ERROR: SWPMI registers are not initialized 111 | */ 112 | ErrorStatus LL_SWPMI_Init(SWPMI_TypeDef *SWPMIx, const LL_SWPMI_InitTypeDef *SWPMI_InitStruct) 113 | { 114 | ErrorStatus status = SUCCESS; 115 | 116 | /* Check the parameters */ 117 | assert_param(IS_SWPMI_INSTANCE(SWPMIx)); 118 | assert_param(IS_LL_SWPMI_BITRATE_VALUE(SWPMI_InitStruct->BitRatePrescaler)); 119 | assert_param(IS_LL_SWPMI_SW_BUFFER_TX(SWPMI_InitStruct->TxBufferingMode)); 120 | assert_param(IS_LL_SWPMI_SW_BUFFER_RX(SWPMI_InitStruct->RxBufferingMode)); 121 | assert_param(IS_LL_SWPMI_VOLTAGE_CLASS(SWPMI_InitStruct->VoltageClass)); 122 | 123 | /* SWPMI needs to be in deactivated state, in order to be able to configure some bits */ 124 | if (LL_SWPMI_IsActivated(SWPMIx) == 0U) 125 | { 126 | /* Configure the BRR register (Bitrate) */ 127 | LL_SWPMI_SetBitRatePrescaler(SWPMIx, SWPMI_InitStruct->BitRatePrescaler); 128 | 129 | /* Configure the voltage class */ 130 | LL_SWPMI_SetVoltageClass(SWPMIx, SWPMI_InitStruct->VoltageClass); 131 | 132 | /* Set the new configuration of the SWPMI peripheral */ 133 | MODIFY_REG(SWPMIx->CR, 134 | (SWPMI_CR_RXMODE | SWPMI_CR_TXMODE), 135 | (SWPMI_InitStruct->TxBufferingMode | SWPMI_InitStruct->RxBufferingMode)); 136 | } 137 | /* Else (SWPMI not in deactivated state => return ERROR) */ 138 | else 139 | { 140 | status = ERROR; 141 | } 142 | 143 | return status; 144 | } 145 | 146 | /** 147 | * @brief Set each @ref LL_SWPMI_InitTypeDef field to default value. 148 | * @param SWPMI_InitStruct pointer to a @ref LL_SWPMI_InitTypeDef structure that contains 149 | * the configuration information for the SWPMI peripheral. 150 | * @retval None 151 | */ 152 | void LL_SWPMI_StructInit(LL_SWPMI_InitTypeDef *SWPMI_InitStruct) 153 | { 154 | /* Set SWPMI_InitStruct fields to default values */ 155 | SWPMI_InitStruct->VoltageClass = LL_SWPMI_VOLTAGE_CLASS_C; 156 | SWPMI_InitStruct->BitRatePrescaler = (uint32_t)0x00000001; 157 | SWPMI_InitStruct->TxBufferingMode = LL_SWPMI_SW_BUFFER_TX_SINGLE; 158 | SWPMI_InitStruct->RxBufferingMode = LL_SWPMI_SW_BUFFER_RX_SINGLE; 159 | } 160 | 161 | /** 162 | * @} 163 | */ 164 | 165 | /** 166 | * @} 167 | */ 168 | 169 | /** 170 | * @} 171 | */ 172 | 173 | #endif /* SWPMI1 */ 174 | 175 | /** 176 | * @} 177 | */ 178 | 179 | #endif /* USE_FULL_LL_DRIVER */ 180 | -------------------------------------------------------------------------------- /_htmresc/Add button.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /_htmresc/Update.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /_htmresc/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/stm32l4xx-hal-driver/a60c3480b58ea4f9704fd1c72ce77a6358662c5c/_htmresc/favicon.png -------------------------------------------------------------------------------- /_htmresc/st_logo_2020.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/STMicroelectronics/stm32l4xx-hal-driver/a60c3480b58ea4f9704fd1c72ce77a6358662c5c/_htmresc/st_logo_2020.png --------------------------------------------------------------------------------