/**
******************************************************************************
* @file stm32f1xx_hal_i2c.c
* @author MCD Application Team
* @brief I2C HAL module driver.
* This file provides firmware functions to manage the following
* functionalities of the Inter Integrated Circuit (I2C) peripheral:
* + Initialization and de-initialization functions
* + IO operation functions
* + Peripheral State, Mode and Error functions
*
@verbatim
==============================================================================
##### How to use this driver #####
==============================================================================
[..]
The I2C HAL driver can be used as follows:
(#) Declare a I2C_HandleTypeDef handle structure, for example:
I2C_HandleTypeDef hi2c;
(#)Initialize the I2C low level resources by implementing the @ref HAL_I2C_MspInit() API:
(##) Enable the I2Cx interface clock
(##) I2C pins configuration
(+++) Enable the clock for the I2C GPIOs
(+++) Configure I2C pins as alternate function open-drain
(##) NVIC configuration if you need to use interrupt process
(+++) Configure the I2Cx interrupt priority
(+++) Enable the NVIC I2C IRQ Channel
(##) DMA Configuration if you need to use DMA process
(+++) Declare a DMA_HandleTypeDef handle structure for the transmit or receive channel
(+++) Enable the DMAx interface clock using
(+++) Configure the DMA handle parameters
(+++) Configure the DMA Tx or Rx channel
(+++) Associate the initialized DMA handle to the hi2c DMA Tx or Rx handle
(+++) Configure the priority and enable the NVIC for the transfer complete interrupt on
the DMA Tx or Rx channel
(#) Configure the Communication Speed, Duty cycle, Addressing mode, Own Address1,
Dual Addressing mode, Own Address2, General call and Nostretch mode in the hi2c Init structure.
(#) Initialize the I2C registers by calling the @ref HAL_I2C_Init(), configures also the low level Hardware
(GPIO, CLOCK, NVIC...etc) by calling the customized @ref HAL_I2C_MspInit() API.
(#) To check if target device is ready for communication, use the function @ref HAL_I2C_IsDeviceReady()
(#) For I2C IO and IO MEM operations, three operation modes are available within this driver :
*** Polling mode IO operation ***
=================================
[..]
(+) Transmit in master mode an amount of data in blocking mode using @ref HAL_I2C_Master_Transmit()
(+) Receive in master mode an amount of data in blocking mode using @ref HAL_I2C_Master_Receive()
(+) Transmit in slave mode an amount of data in blocking mode using @ref HAL_I2C_Slave_Transmit()
(+) Receive in slave mode an amount of data in blocking mode using @ref HAL_I2C_Slave_Receive()
*** Polling mode IO MEM operation ***
=====================================
[..]
(+) Write an amount of data in blocking mode to a specific memory address using @ref HAL_I2C_Mem_Write()
(+) Read an amount of data in blocking mode from a specific memory address using @ref HAL_I2C_Mem_Read()
*** Interrupt mode IO operation ***
===================================
[..]
(+) Transmit in master mode an amount of data in non-blocking mode using @ref HAL_I2C_Master_Transmit_IT()
(+) At transmission end of transfer, @ref HAL_I2C_MasterTxCpltCallback() is executed and user can
add his own code by customization of function pointer @ref HAL_I2C_MasterTxCpltCallback()
(+) Receive in master mode an amount of data in non-blocking mode using @ref HAL_I2C_Master_Receive_IT()
(+) At reception end of transfer, @ref HAL_I2C_MasterRxCpltCallback() is executed and user can
add his own code by customization of function pointer @ref HAL_I2C_MasterRxCpltCallback()
(+) Transmit in slave mode an amount of data in non-blocking mode using @ref HAL_I2C_Slave_Transmit_IT()
(+) At transmission end of transfer, @ref HAL_I2C_SlaveTxCpltCallback() is executed and user can
add his own code by customization of function pointer @ref HAL_I2C_SlaveTxCpltCallback()
(+) Receive in slave mode an amount of data in non-blocking mode using @ref HAL_I2C_Slave_Receive_IT()
(+) At reception end of transfer, @ref HAL_I2C_SlaveRxCpltCallback() is executed and user can
add his own code by customization of function pointer @ref HAL_I2C_SlaveRxCpltCallback()
(+) In case of transfer Error, @ref HAL_I2C_ErrorCallback() function is executed and user can
add his own code by customization of function pointer @ref HAL_I2C_ErrorCallback()
(+) Abort a master I2C process communication with Interrupt using @ref HAL_I2C_Master_Abort_IT()
(+) End of abort process, @ref HAL_I2C_AbortCpltCallback() is executed and user can
add his own code by customization of function pointer @ref HAL_I2C_AbortCpltCallback()
*** Interrupt mode or DMA mode IO sequential operation ***
==========================================================
[..]
(@) These interfaces allow to manage a sequential transfer with a repeated start condition
when a direction change during transfer
[..]
(+) A specific option field manage the different steps of a sequential transfer
(+) Option field values are defined through @ref I2C_XferOptions_definition and are listed below:
(++) I2C_FIRST_AND_LAST_FRAME: No sequential usage, functionnal is same as associated interfaces in no sequential mode
(++) I2C_FIRST_FRAME: Sequential usage, this option allow to manage a sequence with start condition, address
and data to transfer without a final stop condition
(++) I2C_FIRST_AND_NEXT_FRAME: Sequential usage (Master only), this option allow to manage a sequence with start condition, address
and data to transfer without a final stop condition, an then permit a call the same master sequential interface
several times (like @ref HAL_I2C_Master_Seq_Transmit_IT() then @ref HAL_I2C_Master_Seq_Transmit_IT()
or @ref HAL_I2C_Master_Seq_Transmit_DMA() then @ref HAL_I2C_Master_Seq_Transmit_DMA())
(++) I2C_NEXT_FRAME: Sequential usage, this option allow to manage a sequence with a restart condition, address
and with new data to transfer if the direction change or manage only the new data to transfer
if no direction change and without a final stop condition in both cases
(++) I2C_LAST_FRAME: Sequential usage, this option allow to manage a sequance with a restart condition, address
and with new data to transfer if the direction change or manage only the new data to transfer
if no direction change and with a final stop condition in both cases
(++) I2C_LAST_FRAME_NO_STOP: Sequential usage (Master only), this option allow to manage a restart condition after several call of the same master sequential
interface several times (link with option I2C_FIRST_AND_NEXT_FRAME).
Usage can, transfer several bytes one by one using HAL_I2C_Master_Seq_Transmit_IT(option I2C_FIRST_AND_NEXT_FRAME then I2C_NEXT_FRAME)
or HAL_I2C_Master_Seq_Receive_IT(option I2C_FIRST_AND_NEXT_FRAME then I2C_NEXT_FRAME)
or HAL_I2C_Master_Seq_Transmit_DMA(option I2C_FIRST_AND_NEXT_FRAME then I2C_NEXT_FRAME)
or HAL_I2C_Master_Seq_Receive_DMA(option I2C_FIRST_AND_NEXT_FRAME then I2C_NEXT_FRAME).
Then usage of this optio
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
单片机设计,工具源码,适合毕业设计、课程设计作业,所有源码均经过严格测试,可以直接运行,可以放心下载使用。有任何使用问题欢迎随时与博主沟通,第一时间进行解答! 软件开发设计:PHP、QT、应用软件开发、系统软件开发、移动应用开发、网站开发C++、Java、python、web、C#等语言的项目开发与学习资料 硬件与设备:单片机、EDA、proteus、RTOS、包括计算机硬件、服务器、网络设备、存储设备、移动设备等 操作系统:LInux、IOS、树莓派、安卓开发、微机操作系统、网络操作系统、分布式操作系统等。此外,还有嵌入式操作系统、智能操作系统等。 云计算与大数据:数据集、包括云计算平台、大数据分析、人工智能、机器学习等,云计算是一种基于互联网的计算方式,通过这种方式,共享的软硬件资源和信息可以按需提供给计算机和其他设备。
资源推荐
资源详情
资源评论
收起资源包目录
基于stm32的gy-91数据收集,通过蓝牙传递上位机.zip (85个子文件)
cm
.gitignore 319B
stm32c8t6_gy91
Drivers
CMSIS
Include
core_armv8mbl.h 94KB
core_cm1.h 41KB
core_cm0plus.h 48KB
cmsis_armcc.h 27KB
core_cm0.h 40KB
cmsis_version.h 2KB
mpu_armv8.h 10KB
core_cm4.h 119KB
core_sc300.h 106KB
cmsis_iccarm.h 27KB
core_cm3.h 107KB
core_armv8mml.h 162KB
mpu_armv7.h 11KB
cmsis_gcc.h 59KB
core_cm23.h 100KB
core_cm7.h 142KB
core_sc000.h 45KB
core_cm33.h 169KB
tz_context.h 3KB
cmsis_compiler.h 9KB
cmsis_armclang.h 53KB
Device
ST
STM32F1xx
Include
stm32f1xx.h 7KB
stm32f103xb.h 823KB
system_stm32f1xx.h 2KB
STM32F1xx_HAL_Driver
Src
stm32f1xx_hal_exti.c 15KB
stm32f1xx_hal_i2c.c 227KB
stm32f1xx_hal_flash_ex.c 35KB
stm32f1xx_hal_dma.c 27KB
stm32f1xx_hal_pwr.c 20KB
stm32f1xx_hal_tim_ex.c 62KB
stm32f1xx_hal_rcc.c 48KB
stm32f1xx_hal_tim.c 207KB
stm32f1xx_hal_gpio.c 20KB
stm32f1xx_hal_rcc_ex.c 29KB
stm32f1xx_hal_cortex.c 18KB
stm32f1xx_hal_gpio_ex.c 4KB
stm32f1xx_hal.c 20KB
stm32f1xx_hal_uart.c 107KB
stm32f1xx_hal_flash.c 29KB
Inc
stm32f1xx_hal_flash.h 9KB
stm32f1xx_hal_gpio_ex.h 35KB
stm32f1xx_hal_pwr.h 11KB
stm32f1xx_hal_gpio.h 11KB
stm32f1xx_hal_def.h 7KB
stm32f1xx_hal_tim.h 111KB
Legacy
stm32_hal_legacy.h 196KB
stm32f1xx_hal_rcc_ex.h 97KB
stm32f1xx_hal_uart.h 42KB
stm32f1xx_hal_flash_ex.h 35KB
stm32f1xx_hal_dma_ex.h 12KB
stm32f1xx_hal_rcc.h 65KB
stm32f1xx_hal.h 11KB
stm32f1xx_hal_i2c.h 34KB
stm32f1xx_hal_dma.h 17KB
stm32f1xx_hal_cortex.h 17KB
stm32f1xx_hal_tim_ex.h 9KB
stm32f1xx_hal_exti.h 12KB
Src
system_stm32f1xx.c 14KB
mpu9250.h 2KB
bmp280.c 10KB
i2c.c 3KB
stm32f1xx_hal_msp.c 2KB
dma.c 3KB
bmp280.h 5KB
stm32f1xx_it.c 7KB
gpio.c 2KB
main.c 6KB
mpu9250.c 10KB
usart.c 4KB
.mxproject 6KB
stm32c8t6_gy91.ioc 6KB
Inc
gpio.h 1KB
usart.h 1KB
i2c.h 1KB
main.h 2KB
stm32f1xx_hal_conf.h 15KB
dma.h 2KB
stm32f1xx_it.h 2KB
MDK-ARM
stm32c8t6_gy91.uvoptx 17KB
RTE
_stm32c8t6_gy91
RTE_Components.h 331B
stm32c8t6_gy91.uvguix.wind 90KB
startup_stm32f103xb.lst 37KB
startup_stm32f103xb.s 12KB
stm32c8t6_gy91.uvprojx 20KB
共 85 条
- 1
资源评论
妄北y
- 粉丝: 2w+
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- RK3588 demo板原理图
- html+css 圣诞树代码html
- GaAs限幅器芯片:LCLM0002P1,工作频段DC-3Ghz
- 仓库管理系统:用户界面与交互体验
- NSFileReadError如何解决.md
- NSFileWriteError如何解决.md
- StopAsyncIteration.md
- ScopedSlotError解决办法.md
- StackOverflowError(解决方案).md
- AsyncComponentError解决办法.md
- StringIndexOutOfBoundsException(解决方案).md
- NSURLConnectionError如何解决.md
- LifecycleHookError解决办法.md
- MissingResourceException(解决方案).md
- NSURLError如何解决.md
- IndentationError.md
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功