对于INA226的使用,首先需要确定从机地址和所需寄存器地址。该模块共有10个寄存器,其中0x0用于配置芯片的采样速度、采样模式、采样滤波周期等,0x5是校准寄存器,其他寄存器用于测量电压、功率和电流。通过I2C读取这些寄存器即可获取所需的数据。在实际应用中,可以参考Arduino和STM32CubeMX的相关示例代码实现I...
代码部分: I2C总线的初始化工作,因为本文是基于HAL库的,所以初始化工作我是在cubemx中完成的 可以看到在初始化IO口的时候我选择了PC4和PA7做作为I2C的引脚。其中需要关注的是这俩个引脚都被我设置为了开漏输出模式,同时引脚上拉。对于这部分的设置可以参考我上篇文章。 我们现在看keil代码部分: 首先是I2C协议的STA...
usb接口大家可以修改自己喜欢的,我是大多用的闲置的物料。 上传者:tianqiquan时间:2023-02-28 STM32Fx+cubeMX+硬件IIC+INA219(同一个I2C挂载两个芯片) 见博客:https://blog.csdn.net/qq_28455253/article/details/123396324?spm=1001.2014.3001.5501 上传者:qq_28455253时间:2022-03-10...
Version: 2.14.0 (2019-07-24) Keil.STM32F4xx_DFP.2.14.0.pack Warning: --C99 is no longer enforced via the device description. Enable 'C99 Mode' in 'Options for Target' dialog's 'C/C++' tab. Updated Pack to include subset of STM32Cube_FW_F4 Firmware Package version V1.24.1 using...
When I wanted to re-use this library on an STM32 using ST's CubeMX development tools I found that I needed to convert it to C only (there's a C++ workaround but it didn't suit me). Both the C++ and C source files are in the same folder - but you only need one or the ...