没有合适的资源?快使用搜索试试~ 我知道了~
HAL库函数手册
1星 需积分: 0 320 下载量 43 浏览量
2017-03-05
16:53:35
上传
评论 3
收藏 3.88MB PDF 举报
温馨提示
试读
655页
HAL库函数手册(英文版)
资源推荐
资源详情
资源评论
February 2015
DOCID027328 Rev 1
1/655
www.st.com
UM1850
User manual
Description of STM32F1xx HAL drivers
Introduction
STMCube
TM
is an STMicroelectronics original initiative to ease developers life by reducing development
efforts, time and cost. STM32Cube covers STM32 portfolio.
STM32Cube Version 1.x includes:
The STM32CubeMX, a graphical software configuration tool that allows generating C initialization
code using graphical wizards.
A comprehensive embedded software platform, delivered per series (such as STM32CubeF1 for
STM32F1 series)
The STM32Cube HAL, an STM32 abstraction layer embedded software, ensuring maximized
portability across STM32 portfolio
A consistent set of middleware components such as RTOS, USB, TCP/IP, Graphics
All embedded software utilities coming with a full set of examples.
The HAL drivers layer provides a generic multi instance simple set of APIs (application programming
interfaces) to interact with the upper layer (application, libraries and stacks). It is composed of generic
and extension APIs. It is directly built around a generic architecture and allows the built-upon layers,
such as the middleware layer, to implement their functions without knowing in-depth how to use the
MCU. This structure improves the library code reusability and guarantees an easy portability on other
devices.
The HAL drivers include a complete set of ready-to-use APIs which simplify the user application
implementation. As an example, the communication peripherals contain APIs to initialize and configure
the peripheral, to manage data transfers based on polling, to handle interrupts or DMA, and to manage
communication errors.
The HAL drivers APIs are split into two categories: generic APIs which provide common and generic
functions for all the STM32 series and extension APIs which include specific and customized functions
for a given family or part number.
The HAL drivers are feature-oriented instead of IP-oriented. As an example, the timer APIs are split into
several categories following the functions offered by the IP: basic timer, capture, pulse width modulation
(PWM), etc..
The drivers source code is developed in Strict ANSI-C which makes it independent from the
development tools. It is checked with CodeSonar
TM
static analysis tool. It is fully documented and is
MISRA-C 2004 compliant.
The HAL drivers layer implements run-time failure detection by checking the input values of all
functions. Such dynamic checking contributes to enhance the firmware robustness. Run-time detection
is also suitable for user application development and debugging.
This user manual is structured as follows:
Overview of the HAL drivers
Detailed description of each peripheral driver: configuration structures, functions, and
how to use the given API to build your application.
Contents
UM1850
2/655
DOCID027328 Rev 1
Contents
1 Acronyms and definitions ............................................................. 36
2 Overview of HAL drivers ............................................................... 38
2.1 HAL and user-application files......................................................... 38
2.1.1 HAL driver files ................................................................................. 38
2.1.2 User-application files ........................................................................ 39
2.2 HAL data structures ........................................................................ 41
2.2.1 Peripheral handle structures ............................................................ 41
2.2.2 Initialization and configuration structure ........................................... 42
2.2.3 Specific process structures .............................................................. 43
2.3 API classification ............................................................................. 43
2.4 Devices supported by HAL drivers .................................................. 44
2.5 HAL drivers rules ............................................................................. 51
2.5.1 HAL API naming rules ...................................................................... 51
2.5.2 HAL general naming rules ................................................................ 52
2.5.3 HAL interrupt handler and callback functions ................................... 53
2.6 HAL generic APIs ............................................................................ 54
2.7 HAL extension APIs ........................................................................ 55
2.7.1 HAL extension model overview ........................................................ 55
2.7.2 HAL extension model cases ............................................................. 55
2.8 File inclusion model ......................................................................... 57
2.9 HAL common resources .................................................................. 58
2.10 HAL configuration ............................................................................ 59
2.11 HAL system peripheral handling ..................................................... 60
2.11.1 Clock ................................................................................................. 60
2.11.2 GPIOs ............................................................................................... 60
2.11.3 Cortex NVIC and SysTick timer ........................................................ 62
2.11.4 PWR ................................................................................................. 62
2.11.5 EXTI .................................................................................................. 62
2.11.6 DMA .................................................................................................. 64
2.12 How to use HAL drivers .................................................................. 66
2.12.1 HAL usage models ........................................................................... 66
2.12.2 HAL initialization ............................................................................... 67
2.12.3 HAL IO operation process ................................................................ 69
2.12.4 Timeout and error management ....................................................... 72
UM1850
Contents
DOCID027328 Rev 1
3/655
3 HAL System Driver ........................................................................ 76
3.1 HAL Firmware driver API description .............................................. 76
3.1.1 How to use this driver ....................................................................... 76
3.1.2 Initialization and de-initialization functions ....................................... 76
3.1.3 HAL Control functions....................................................................... 76
3.1.4 HAL_Init ............................................................................................ 77
3.1.5 HAL_DeInit ....................................................................................... 77
3.1.6 HAL_MspInit ..................................................................................... 77
3.1.7 HAL_MspDeInit ................................................................................ 78
3.1.8 HAL_InitTick ..................................................................................... 78
3.1.9 HAL_IncTick ..................................................................................... 78
3.1.10 HAL_GetTick .................................................................................... 78
3.1.11 HAL_Delay ....................................................................................... 78
3.1.12 HAL_SuspendTick ............................................................................ 78
3.1.13 HAL_ResumeTick ............................................................................. 79
3.1.14 HAL_GetHalVersion ......................................................................... 79
3.1.15 HAL_GetREVID ................................................................................ 79
3.1.16 HAL_GetDEVID ................................................................................ 79
3.1.17 HAL_DBGMCU_EnableDBGSleepMode ......................................... 79
3.1.18 HAL_DBGMCU_DisableDBGSleepMode ........................................ 79
3.1.19 HAL_DBGMCU_EnableDBGStopMode ........................................... 80
3.1.20 HAL_DBGMCU_DisableDBGStopMode .......................................... 80
3.1.21 HAL_DBGMCU_EnableDBGStandbyMode ..................................... 80
3.1.22 HAL_DBGMCU_DisableDBGStandbyMode .................................... 80
3.2 HAL Firmware driver defines ........................................................... 81
3.2.1 HAL ................................................................................................... 81
4 HAL ADC Generic Driver ............................................................... 82
4.1 ADC Firmware driver registers structures ....................................... 82
4.1.1 ADC_InitTypeDef .............................................................................. 82
4.1.2 ADC_ChannelConfTypeDef ............................................................. 83
4.1.3 ADC_AnalogWDGConfTypeDef ....................................................... 84
4.1.4 ADC_HandleTypeDef ....................................................................... 84
4.2 ADC Firmware driver API description .............................................. 85
4.2.1 ADC peripheral features ................................................................... 85
4.2.2 How to use this driver ....................................................................... 85
4.2.3 Initialization and de-initialization functions ....................................... 88
4.2.4 IO operation functions ...................................................................... 88
Contents
UM1850
4/655
DOCID027328 Rev 1
4.2.5 Peripheral Control functions ............................................................. 89
4.2.6 Peripheral State and Errors functions .............................................. 89
4.2.7 HAL_ADC_Init .................................................................................. 89
4.2.8 HAL_ADC_DeInit .............................................................................. 89
4.2.9 HAL_ADC_MspInit ........................................................................... 90
4.2.10 HAL_ADC_MspDeInit ....................................................................... 90
4.2.11 HAL_ADC_Start ............................................................................... 90
4.2.12 HAL_ADC_Stop ................................................................................ 90
4.2.13 HAL_ADC_PollForConversion ......................................................... 91
4.2.14 HAL_ADC_PollForEvent .................................................................. 91
4.2.15 HAL_ADC_Start_IT .......................................................................... 91
4.2.16 HAL_ADC_Stop_IT .......................................................................... 91
4.2.17 HAL_ADC_Start_DMA ..................................................................... 91
4.2.18 HAL_ADC_Stop_DMA...................................................................... 92
4.2.19 HAL_ADC_GetValue ........................................................................ 92
4.2.20 HAL_ADC_IRQHandler .................................................................... 92
4.2.21 HAL_ADC_ConvCpltCallback .......................................................... 92
4.2.22 HAL_ADC_ConvHalfCpltCallback .................................................... 93
4.2.23 HAL_ADC_LevelOutOfWindowCallback .......................................... 93
4.2.24 HAL_ADC_ErrorCallback ................................................................. 93
4.2.25 HAL_ADC_ConfigChannel ............................................................... 93
4.2.26 HAL_ADC_AnalogWDGConfig ........................................................ 94
4.2.27 HAL_ADC_GetState ......................................................................... 94
4.2.28 HAL_ADC_GetError ......................................................................... 94
4.3 ADC Firmware driver defines .......................................................... 94
4.3.1 ADC .................................................................................................. 94
5 HAL ADC Extension Driver ......................................................... 106
5.1 ADCEx Firmware driver registers structures ................................. 106
5.1.1 ADC_InjectionConfTypeDef ........................................................... 106
5.1.2 ADC_MultiModeTypeDef ................................................................ 107
5.2 ADCEx Firmware driver API description ....................................... 108
5.2.1 IO operation functions .................................................................... 108
5.2.2 Peripheral Control functions ........................................................... 109
5.2.3 HAL_ADCEx_Calibration_Start ...................................................... 109
5.2.4 HAL_ADCEx_InjectedStart ............................................................ 109
5.2.5 HAL_ADCEx_InjectedStop ............................................................. 109
5.2.6 HAL_ADCEx_InjectedPollForConversion ...................................... 109
5.2.7 HAL_ADCEx_InjectedStart_IT ....................................................... 110
UM1850
Contents
DOCID027328 Rev 1
5/655
5.2.8 HAL_ADCEx_InjectedStop_IT ....................................................... 110
5.2.9 HAL_ADCEx_MultiModeStart_DMA .............................................. 110
5.2.10 HAL_ADCEx_MultiModeStop_DMA ............................................... 110
5.2.11 HAL_ADCEx_InjectedGetValue ..................................................... 111
5.2.12 HAL_ADCEx_MultiModeGetValue ................................................. 111
5.2.13 HAL_ADCEx_InjectedConvCpltCallback ....................................... 111
5.2.14 HAL_ADCEx_InjectedConfigChannel ............................................ 111
5.2.15 HAL_ADCEx_MultiModeConfigChannel ........................................ 112
5.3 ADCEx Firmware driver defines .................................................... 112
5.3.1 ADCEx ............................................................................................ 112
6 HAL CAN Generic Driver ............................................................. 118
6.1 CAN Firmware driver registers structures ..................................... 118
6.1.1 CAN_InitTypeDef ............................................................................ 118
6.1.2 CanTxMsgTypeDef ......................................................................... 118
6.1.3 CanRxMsgTypeDef ........................................................................ 119
6.1.4 CAN_HandleTypeDef ..................................................................... 120
6.2 CAN Firmware driver API description ............................................ 120
6.2.1 How to use this driver ..................................................................... 120
6.2.2 Initialization and de-initialization functions ..................................... 121
6.2.3 IO operation functions .................................................................... 122
6.2.4 Peripheral State and Error functions .............................................. 122
6.2.5 HAL_CAN_Init ................................................................................ 122
6.2.6 HAL_CAN_ConfigFilter................................................................... 122
6.2.7 HAL_CAN_DeInit ............................................................................ 123
6.2.8 HAL_CAN_MspInit ......................................................................... 123
6.2.9 HAL_CAN_MspDeInit ..................................................................... 123
6.2.10 HAL_CAN_Transmit ....................................................................... 123
6.2.11 HAL_CAN_Transmit_IT .................................................................. 123
6.2.12 HAL_CAN_Receive ........................................................................ 124
6.2.13 HAL_CAN_Receive_IT ................................................................... 124
6.2.14 HAL_CAN_Sleep ............................................................................ 124
6.2.15 HAL_CAN_WakeUp ....................................................................... 124
6.2.16 HAL_CAN_IRQHandler .................................................................. 125
6.2.17 HAL_CAN_TxCpltCallback ............................................................. 125
6.2.18 HAL_CAN_RxCpltCallback ............................................................ 125
6.2.19 HAL_CAN_ErrorCallback ............................................................... 125
6.2.20 HAL_CAN_GetState ....................................................................... 126
6.2.21 HAL_CAN_GetError ....................................................................... 126
剩余654页未读,继续阅读
资源评论
- WangU_04132018-05-10st官网下的直接摆上来,还12积分,,,
暗狼天使
- 粉丝: 162
- 资源: 25
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Python语言教程1-python批量图片重命名,将后缀某几个不想要的字去除
- Space Combat Kit 太空战斗套件Unity游戏开发插件资源unitypackage C#
- Universal Device Preview 通用设备预览Unity游戏开发插件资源unitypackage
- Paladin Anim Set 圣骑士动画集Unity游戏动作动画插件资源unitypackage
- 计算机财务管理期末考报表部分题目及答案.doc
- 计算机软件维护论文.doc
- 计算机软件著作权授权书.docx
- 计算机键盘教学案例.doc
- 计算流体力学软件平台方案.pptx
- 计量自动化系统介绍.ppt
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功