/**
******************************************************************************
* @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_
没有合适的资源?快使用搜索试试~ 我知道了~
STM32CUBE配置硬件IIC协议驱动MPU6050,采用DMP方法输出加速度、角速度
共202个文件
h:61个
o:32个
d:32个
4星 · 超过85%的资源 需积分: 5 140 下载量 37 浏览量
2020-04-05
20:11:08
上传
评论 18
收藏 6.54MB RAR 举报
温馨提示
STM32CUBE配置硬件IIC协议驱动MPU6050,采用DMP方法输出加速度、角速度 .
资源推荐
资源详情
资源评论
收起资源包目录
STM32CUBE配置硬件IIC协议驱动MPU6050,采用DMP方法输出加速度、角速度 (202个子文件)
8_IIC_MPUC6050.uvguix.Administrator 69KB
8_IIC_MPUC6050.axf 717KB
stm32f1xx_hal_i2c.c 234KB
stm32f1xx_hal_tim.c 213KB
stm32f1xx_hal_uart.c 110KB
stm32f1xx_hal_adc.c 92KB
inv_mpu.c 82KB
stm32f1xx_hal_tim_ex.c 64KB
inv_mpu_dmp_motion_driver.c 56KB
stm32f1xx_hal_adc_ex.c 52KB
stm32f1xx_hal_rcc.c 49KB
stm32f1xx_hal_flash_ex.c 36KB
stm32f1xx_hal_rcc_ex.c 30KB
stm32f1xx_hal_flash.c 30KB
stm32f1xx_hal_dma.c 28KB
stm32f1xx_hal_pwr.c 21KB
stm32f1xx_hal_gpio.c 21KB
stm32f1xx_hal.c 20KB
stm32f1xx_hal_cortex.c 19KB
main.c 16KB
stm32f1xx_hal_exti.c 15KB
system_stm32f1xx.c 15KB
stm32f1xx_hal_msp.c 12KB
Mpu6050.c 11KB
Oled.c 7KB
stm32f1xx_it.c 6KB
stm32f1xx_hal_gpio_ex.c 4KB
IIC.c 3KB
Moter.c 2KB
Key.c 2KB
Encoder.c 1KB
Adc.c 1KB
Printf.c 317B
inv_mpu_dmp_motion_driver.crf 549KB
stm32f1xx_hal_i2c.crf 548KB
stm32f1xx_hal_tim.crf 532KB
mpu6050.crf 525KB
inv_mpu.crf 517KB
main.crf 511KB
stm32f1xx_hal_uart.crf 505KB
stm32f1xx_hal_tim_ex.crf 502KB
stm32f1xx_hal_adc.crf 501KB
stm32f1xx_hal_rcc.crf 499KB
stm32f1xx_hal_adc_ex.crf 496KB
oled.crf 496KB
stm32f1xx_hal_dma.crf 495KB
stm32f1xx_hal_flash_ex.crf 493KB
stm32f1xx_hal_msp.crf 493KB
printf.crf 492KB
stm32f1xx_hal_flash.crf 492KB
stm32f1xx_hal_gpio.crf 491KB
stm32f1xx_hal_exti.crf 490KB
stm32f1xx_hal_pwr.crf 490KB
iic.crf 490KB
stm32f1xx_hal_rcc_ex.crf 490KB
moter.crf 489KB
key.crf 489KB
stm32f1xx_it.crf 489KB
stm32f1xx_hal.crf 489KB
encoder.crf 489KB
adc.crf 489KB
stm32f1xx_hal_cortex.crf 488KB
system_stm32f1xx.crf 488KB
stm32f1xx_hal_gpio_ex.crf 488KB
inv_mpu_dmp_motion_driver.d 4KB
stm32f1xx_hal_flash_ex.d 3KB
stm32f1xx_hal_gpio_ex.d 3KB
stm32f1xx_hal_tim_ex.d 3KB
stm32f1xx_hal_cortex.d 3KB
stm32f1xx_hal_rcc_ex.d 3KB
stm32f1xx_hal_adc_ex.d 3KB
stm32f1xx_hal_flash.d 3KB
stm32f1xx_hal_gpio.d 3KB
stm32f1xx_hal_uart.d 3KB
stm32f1xx_hal_exti.d 3KB
stm32f1xx_hal_msp.d 3KB
stm32f1xx_hal_pwr.d 3KB
stm32f1xx_hal_rcc.d 3KB
stm32f1xx_hal_dma.d 3KB
stm32f1xx_hal_adc.d 3KB
stm32f1xx_hal_tim.d 3KB
stm32f1xx_hal_i2c.d 3KB
mpu6050.d 3KB
system_stm32f1xx.d 3KB
main.d 3KB
stm32f1xx_it.d 3KB
stm32f1xx_hal.d 3KB
inv_mpu.d 3KB
printf.d 3KB
oled.d 2KB
encoder.d 2KB
moter.d 2KB
iic.d 2KB
adc.d 2KB
key.d 2KB
startup_stm32f103xb.d 61B
8_IIC_MPUC6050_8_IIC_MPUC6050.dep 85KB
stm32f103xb.h 833KB
stm32_hal_legacy.h 200KB
core_cm33.h 171KB
共 202 条
- 1
- 2
- 3
资源评论
- Mr.li❤️2020-11-19大佬能帮忙说下线路没问题 读出来全是0什么原因
- gurong602020-10-07需要调整延时时间
- wrz6662020-06-19原理还可以看
- 四氢呋喃酸钙2020-04-26读出来的角度数据全是0,没法用啊烛火飞蛾2020-05-06检查一下电路连接问题,程序经过测试,是完全没有问题的
- mkm6662020-04-16还不错嗷,谢谢
烛火飞蛾
- 粉丝: 185
- 资源: 51
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功