1. rfPacketTx工程上添加IIC功能,在调用sleep(PACKET_INTERVAL);后测得DIO4和DIO5的管脚为0.63V,不是高电平。
2. 想在调用sleep(PACKET_INTERVAL);后DIO4和DIO5的管脚保持高电平需要怎么配置?
3. 相关代码:
I2C_init();
// initialize optional I2C bus parameters
I2C_Params params;
I2C_Params_init(¶ms);
params.bitRate = I2C_100kHz;
// Open I2C bus for usage
I2C_Handle i2cHandle = I2C_open(0, ¶ms);
// Initialize slave address of transaction
I2C_Transaction transaction = {0};
transaction.slaveAddress = 0x44;
uint8_t iic_write_data[] = {0xCC,0x44};
uint8_t iic_read_data[3];
// Write to I2C slave device
transaction.writeBuf = iic_write_data;
transaction.writeCount = sizeof(iic_write_data);
transaction.readCount = 0;
I2C_transfer(i2cHandle, &transaction);
usleep(10000);
// Read from I2C slave device
transaction.readBuf = iic_read_data;
transaction.readCount = sizeof(iic_read_data);
transaction.writeCount = 0;
I2C_transfer(i2cHandle, &transaction);
//。。。
sleep(PACKET_INTERVAL);