Other Parts Discussed in Thread: CC1310, CC1350STK, LAUNCHXL-CC1310
主题中讨论的其他器件:CC1310、 CC1350STK、
工具/软件:TI-RTOS
您好!
我尝试更改 CC1310示例 i2ctmp007代码以读取 bmp280数据。
我已经将 slaveAddress 从 tmp007 (0x40)更改为0x77、但仍然无法获取任何数据。
函数 i2c_transfer()返回 bool 始终为 false。
我需要做什么吗?
提前感谢您、
此致、
Youyun
以下是我的代码。
#define BMP280_ADDR 0x77 #define BMP280_REG_PRESSURE 0xf5
/*创建 I2C 以供使用*/ I2C_Params_init (&i2cParams); i2cParams.bitrate = I2C_400kHz; /i2cParams.transferMode = I2C_MODE_callback;//I2C_MODE_callback I2C_MODE_Blocking //i2cParams.transferCallbackFxn = NULL; i2C_OPENO = NULL;i2C_OPENO //(0、&i2cParams) if (i2c = NULL){ PUT ("初始化 I2C"时出错); while (1); } else{ 将("i2c 打开"); } while (1){ //I2C 读取 //BMP280 //txBuffer[0]= BMP280_REG_ID; i2cTransaction.writeBuf =空; i2cTransaction.writeCount = 0; i2cTransaction.readBuf = rxBuffer; i2cTransaction.ReadCount = 1; i2cTransaction.slaveAddress = Board_BMP_ADDR; if (I2C_transfer (i2c、&i2cTransaction)){ //bmpValue = sensorBmp280Convert (rxBuffer); PUT ("I2C 函数工作"); //sprintf (bmpData、"%f"、bmpValue); //puts (bmpData); } 否则{ PUT ("I2C 函数失败。"); } }
这是 reslut。
