This commit is contained in:
lmx
2025-11-25 15:27:26 +08:00
parent 60a4e95386
commit 5c7d9ab822
28 changed files with 172032 additions and 172041 deletions

View File

@ -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");