cun
This commit is contained in:
@ -213,7 +213,7 @@ void write_gsensor_data_handle(void)
|
||||
}
|
||||
|
||||
// 临时的设备扫描诊断函数
|
||||
void i2c_scanner_probe(void)
|
||||
void i2c_scanner_probe(u8* device_addr, u8* found_number)
|
||||
{
|
||||
printf("Starting I2C bus scan...\n");
|
||||
int devices_found = 0;
|
||||
@ -230,6 +230,7 @@ void i2c_scanner_probe(void)
|
||||
// iic_tx_byte 返回 1 表示收到了 ACK
|
||||
if (iic_tx_byte(gSensor_info->iic_hdl, write_addr_8bit))
|
||||
{
|
||||
device_addr[devices_found] = addr_7bit;
|
||||
printf("=====================================================================\n");
|
||||
printf("I2C device found at 7-bit address: 0x%02X\n", addr_7bit);
|
||||
printf("I2C device found at 8-bit address: 0x%02X\n", write_addr_8bit);
|
||||
@ -240,6 +241,7 @@ void i2c_scanner_probe(void)
|
||||
iic_stop(gSensor_info->iic_hdl);
|
||||
delay(gSensor_info->iic_delay); // 短暂延时
|
||||
}
|
||||
*found_number = devices_found;
|
||||
|
||||
if (devices_found == 0) {
|
||||
printf("Scan finished. No I2C devices found.\n");
|
||||
|
||||
Reference in New Issue
Block a user