/**
******************************************************************************
* @file stm32f4xx_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 stream
(+++) Enable the DMAx interface clock using
(+++) Configure the DMA handle parameters
(+++) Configure the DMA Tx or Rx stream
(+++) 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 stream
(#) 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 option I
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
<项目介绍> - 基于STM32和ESP8266的万年历电子时钟 - 不懂运行,下载完可以私聊问,可远程教学 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.md文件(如有),仅供学习参考, 切勿用于商业用途。 --------
资源推荐
资源详情
资源评论
收起资源包目录
基于STM32和ESP8266的万年历电子时钟+项目源码+文档说明 (339个子文件)
RTC.axf 943KB
stm32f4xx_hal_i2c.c 223KB
stm32f4xx_hal_fmpi2c.c 222KB
stm32f4xx_hal_tim.c 206KB
stm32f4xx_hal_cryp.c 204KB
stm32f4xx_hal_dfsdm.c 150KB
stm32f4xx_hal_rcc_ex.c 149KB
stm32f4xx_hal_spi.c 118KB
stm32f4xx_hal_hash.c 111KB
stm32f4xx_hal_uart.c 105KB
stm32f4xx_hal_sd.c 100KB
stm32f4xx_hal_usart.c 94KB
stm32f4xx_hal_smbus.c 94KB
stm32f4xx_hal_qspi.c 91KB
stm32f4xx_hal_irda.c 91KB
stm32f4xx_hal_mmc.c 90KB
stm32f4xx_hal_dsi.c 85KB
stm32f4xx_hal_smartcard.c 83KB
stm32f4xx_hal_can.c 79KB
stm32f4xx_hal_sai.c 79KB
stm32f4xx_hal_eth.c 79KB
stm32f4xx_hal_adc.c 75KB
stm32f4xx_hal_ltdc.c 69KB
stm32f4xx_hal_nand.c 66KB
stm32f4xx_hal_dma2d.c 65KB
stm32f4xx_hal_lptim.c 65KB
stm32f4xx_hal_tim_ex.c 64KB
stm32f4xx_hal_i2s.c 63KB
stm32f4xx_hal_rtc.c 61KB
stm32f4xx_hal_pcd.c 59KB
stm32f4xx_ll_fmc.c 58KB
stm32f4xx_ll_usb.c 56KB
stm32f4xx_hal_rtc_ex.c 54KB
stm32f4xx_hal_can.c 52KB
stm32f4xx_hal_spdifrx.c 52KB
stm32f4xx_ll_rcc.c 50KB
stm32f4xx_hal_flash_ex.c 49KB
stm32f4xx_ll_sdmmc.c 47KB
stm32f4xx_hal_hcd.c 45KB
stm32f4xx_hal_dac.c 44KB
stm32f4xx_ll_tim.c 44KB
stm32f4xx_ll_adc.c 42KB
stm32f4xx_hal_hash_ex.c 41KB
stm32f4xx_hal_adc_ex.c 41KB
stm32f4xx_hal_rcc.c 40KB
stm32f4xx_hal_dma.c 39KB
stm32f4xx_hal_i2s_ex.c 37KB
stm32f4xx_hal_nor.c 37KB
stm32f4xx_ll_fsmc.c 36KB
stm32f4xx_hal_dcmi.c 36KB
stm32f4xx_hal_sdram.c 34KB
stm32f4xx_hal_cec.c 31KB
stm32f4xx_ll_utils.c 31KB
stm32f4xx_ll_rtc.c 31KB
stm32f4xx_hal_pccard.c 30KB
stm32f4xx_hal_sram.c 29KB
lcd.c 26KB
stm32f4xx_hal_rng.c 25KB
stm32f4xx_hal_flash.c 23KB
stm32f4xx_ll_spi.c 23KB
stm32f4xx_ll_dma2d.c 23KB
stm32f4xx_hal_pwr_ex.c 22KB
stm32f4xx_hal_cryp_ex.c 21KB
stm32f4xx_hal_pwr.c 19KB
stm32f4xx_hal_gpio.c 19KB
stm32f4xx_ll_usart.c 18KB
stm32f4xx_hal.c 18KB
stm32f4xx_hal_cortex.c 18KB
stm32f4xx_ll_dma.c 18KB
stm32f4xx_hal_dac_ex.c 15KB
stm32f4xx_hal_wwdg.c 14KB
stm32f4xx_hal_exti.c 12KB
stm32f4xx_hal_timebase_rtc_alarm_template.c 11KB
stm32f4xx_ll_gpio.c 11KB
stm32f4xx_hal_sai_ex.c 11KB
stm32f4xx_ll_dac.c 10KB
stm32f4xx_hal_pcd_ex.c 10KB
stm32f4xx_hal_timebase_rtc_wakeup_template.c 10KB
stm32f4xx_hal_dma_ex.c 10KB
stm32f4xx_hal_crc.c 10KB
system_stm32f4xx.c 9KB
stm32f4xx_ll_lptim.c 9KB
common.c 9KB
stm32f4xx_ll_i2c.c 8KB
stm32f4xx_hal_iwdg.c 8KB
rtc.c 8KB
stm32f4xx_hal_fmpi2c_ex.c 8KB
main.c 7KB
stm32f4xx_ll_exti.c 7KB
stm32f4xx_hal_dcmi_ex.c 7KB
stm32f4xx_hal_flash_ramfunc.c 6KB
stm32f4xx_hal_ltdc_ex.c 6KB
stm32f4xx_hal_i2c_ex.c 5KB
stm32f4xx_it.c 5KB
stm32f4xx_hal_timebase_tim_template.c 5KB
key.c 4KB
DHT11.c 4KB
usart2.c 4KB
stm32f4xx_hal_msp.c 4KB
usart1.c 3KB
共 339 条
- 1
- 2
- 3
- 4
资源评论
程序员无锋
- 粉丝: 3678
- 资源: 2181
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 西南山区植被对水文气候变化的非线性响应量化研究(包括MODIS、GLDAS、Rs数据的预处理以及CNN-LSTM模型的搭建、训练和特征重要性分析)
- node-v12.22.12-x64.7z
- AntDesign 3.9x -Axure 组件库,一套精美的 Axure组件
- 这篇文章的摘录及部分章节内容涉及车牌识别技术的研究与实现 以下是一些主要的内容概述与分析: 摘要 随着交通量的增加,交通管理系统面临着巨大的压力 车牌识别技术作为智能交通系统中的核心技术,能够有效地
- 基于 YOLOv5 和 PyTorch 的 ROS 实时对象检测(基于 YOLOv5 的 ROS 实时对象检测).zip
- 计算机视觉开发资源指南-OpenCV工具箱
- 基于 YOLOv3 和 PyTorch,使用 ROS 进行实时物体检测.zip
- 基于 YOLO 的车牌检测应用.zip
- ENVI IDL上机实验,包括IDL基本语法、OMI产品读取、MODIS04-GRID最近邻站点提取、MODIS-SWATH重投影、插值算法、FY4A定标提取、ERA5再分析资料等等相关遥感大数据处理
- 在此存储库中,我展示了使用 YOLOv5 的零售店商品检测器.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功