主题中讨论的其他器件: HDC1080
工具/软件:Code Composer Studio
您好!
这是 Harish 我要使用 cc2640r2f launchpad 进行 i2c 通信。 launchpad 内置一个温度传感器、您可以通过读取任何代码来读取内置温度传感器。 此处的主程序 i2c 不是 workinge2e.ti.com/.../i2ctmp.c
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
工具/软件:Code Composer Studio
您好!
这是 Harish 我要使用 cc2640r2f launchpad 进行 i2c 通信。 launchpad 内置一个温度传感器、您可以通过读取任何代码来读取内置温度传感器。 此处的主程序 i2c 不是 workinge2e.ti.com/.../i2ctmp.c
不确定您在这里要问什么。
CC2640R2F 没有外部 I2C 温度传感器。
对于内置温度传感器、请查看 API 文档 hre :http://dev.ti.com/tirex/content/simplelink_cc2640r2_sdk_4_10_00_10/docs/driverlib_cc13xx_cc26xx/cc26x0r2/driverlib/group__aonbatmon__api.html
您好!
实际上、我使用 cc2640r2f 为 i2c 编写了代码。 我希望从温度传感器读取数据
但它无法识别 i2c。
我 在该函数中遇到问题(status = I2C_transfer (g_i2cHandle、&i2cTrans);)该函数状态始终为0值
如何识别从 i2c??
/*
* i2ccomm.c
*
* 创建日期:2020年6月3日
作者:Harish
*
//#include
//#include
//#include
/*驱动程序头文件*/
#include "i2ccomm.h"
#include
#include
#include
#include
#include
#include
/*示例/板头文件*/
#include "Board.h"
UART_Params g_params;
UART_Handle g_handle;
I2C_Params g_i2cparams;
I2C_Handle g_i2cHandle;
I2C_Transaction i2cTrans;
bool 状态;
静态 Display_Handle 显示;
uint8_t i2cInit()
{
I2C_init();
I2C_Params_init (&g_i2cparams);
G_i2cparams.transferMode = I2C_MODE_BLOCKING;
G_i2cparams.transferCallbackFxn =空;
G_i2cparams.custom=空;
G_i2cparams.bitrate = I2C_100kHz;
// g_i2cHandle = I2C_open (Board_I2C0、&g_i2cparams);
返回0;
}
uint8_t i2cScanner ()
{
uint8_t nDevices = 0;
for (uint8_t address = 1;address < 127;address++)
{
status = i2cReadData (address);
如果(status == true)
{
nDevices++;
}
}
返回 nDevices;
}
uint8_t i2cReadData (uint8_t 地址)
{
i2cTrans.slaveAddress =地址;
i2cTrans.writeBuf =空;
i2cTrans.writeCount = 0;
i2cTrans.readBuf =空;
i2cTrans.ReadCount = 0;
// iparams.transferMode = I2C_MODE_BLOCKING;
G_i2cHandle = I2C_open (Board_I2C0、&g_i2cparams);
STATUS = I2C_TRANSF传输(g_i2cHandle、&i2cTrans);
if (status == NULL)
{
Display_printf (display、0、0、"Error Initializing I2C\n");
}
I2C_Close (g_i2cHandle);
退货状态;
}
uint8_t checkdata ()
{
返回0;
}