有问题

This commit is contained in:
2024-12-24 19:25:27 +08:00
parent 2d273efef5
commit fa7f364bdb
5 changed files with 85 additions and 63 deletions

View File

@@ -158,7 +158,7 @@ uint8_t i2c_write_16bits(uint8_t slave_addr, uint8_t reg_addr, uint8_t data[2])
} else {
timeout = 0;
state = I2C_START;
#ifdef DEBUG_VERBOES:
#ifdef DEBUG_VERBOES
printf("i2c bus is busy in WRITE BYTE!\n");
#endif
}
@@ -175,7 +175,7 @@ uint8_t i2c_write_16bits(uint8_t slave_addr, uint8_t reg_addr, uint8_t data[2])
} else {
timeout = 0;
state = I2C_START;
#ifdef DEBUG_VERBOES:
#ifdef DEBUG_VERBOES
printf("i2c master sends start signal timeout in WRITE BYTE!\n");
#endif
}
@@ -192,7 +192,7 @@ uint8_t i2c_write_16bits(uint8_t slave_addr, uint8_t reg_addr, uint8_t data[2])
} else {
timeout = 0;
state = I2C_START;
#ifdef DEBUG_VERBOES:
#ifdef DEBUG_VERBOES
printf("i2c master clears address flag timeout in WRITE BYTE!\n");
#endif
}
@@ -209,7 +209,7 @@ uint8_t i2c_write_16bits(uint8_t slave_addr, uint8_t reg_addr, uint8_t data[2])
} else {
timeout = 0;
state = I2C_START;
#ifdef DEBUG_VERBOES:
#ifdef DEBUG_VERBOES
printf("i2c master sends data timeout in WRITE BYTE!\n");
#endif
}
@@ -225,7 +225,7 @@ uint8_t i2c_write_16bits(uint8_t slave_addr, uint8_t reg_addr, uint8_t data[2])
} else {
timeout = 0;
state = I2C_START;
#ifdef DEBUG_VERBOES:
#ifdef DEBUG_VERBOES
printf("i2c master sends MSB data timeout in WRITE BYTE!\n");
#endif
}
@@ -242,7 +242,7 @@ uint8_t i2c_write_16bits(uint8_t slave_addr, uint8_t reg_addr, uint8_t data[2])
} else {
timeout = 0;
state = I2C_START;
#ifdef DEBUG_VERBOES:
#ifdef DEBUG_VERBOES
printf("i2c master sends LSB data timeout in WRITE BYTE!\n");
#endif
}
@@ -257,7 +257,7 @@ uint8_t i2c_write_16bits(uint8_t slave_addr, uint8_t reg_addr, uint8_t data[2])
} else {
timeout = 0;
state = I2C_START;
#ifdef DEBUG_VERBOES:
#ifdef DEBUG_VERBOES
printf("i2c master sends data timeout in WRITE BYTE!\n");
#endif
}
@@ -276,7 +276,7 @@ uint8_t i2c_write_16bits(uint8_t slave_addr, uint8_t reg_addr, uint8_t data[2])
} else {
timeout = 0;
state = I2C_START;
#ifdef DEBUG_VERBOES:
#ifdef DEBUG_VERBOES
printf("i2c master sends stop signal timeout in WRITE BYTE!\n");
#endif
}
@@ -285,7 +285,7 @@ uint8_t i2c_write_16bits(uint8_t slave_addr, uint8_t reg_addr, uint8_t data[2])
state = I2C_START;
i2c_timeout_flag = I2C_OK;
timeout = 0;
#ifdef DEBUG_VERBOES:
#ifdef DEBUG_VERBOES
printf("i2c master sends start signal in WRITE BYTE.\n");
#endif
break;
@@ -319,7 +319,7 @@ uint8_t i2c_read_16bits(uint8_t slave_addr, uint8_t reg_addr, uint8_t *data) {
// i2c_bus_reset();
timeout = 0;
state = I2C_START;
#ifdef DEBUG_VERBOES:
#ifdef DEBUG_VERBOES
printf("i2c bus is busy in READ!\n");
#endif
}
@@ -348,7 +348,7 @@ uint8_t i2c_read_16bits(uint8_t slave_addr, uint8_t reg_addr, uint8_t *data) {
timeout = 0;
state = I2C_START;
read_cycle = RESET;
#ifdef DEBUG_VERBOES:
#ifdef DEBUG_VERBOES
printf("i2c master sends start signal timeout in READ!\n");
#endif
}
@@ -370,7 +370,7 @@ uint8_t i2c_read_16bits(uint8_t slave_addr, uint8_t reg_addr, uint8_t *data) {
timeout = 0;
state = I2C_START;
read_cycle = RESET;
#ifdef DEBUG_VERBOES:
#ifdef DEBUG_VERBOES
printf("i2c master clears address flag timeout in READ!\n");
#endif
}
@@ -389,7 +389,7 @@ uint8_t i2c_read_16bits(uint8_t slave_addr, uint8_t reg_addr, uint8_t *data) {
timeout = 0;
state = I2C_START;
read_cycle = RESET;
#ifdef DEBUG_VERBOES:
#ifdef DEBUG_VERBOES
printf("i2c master wait data buffer is empty timeout in READ!\n");
#endif
}
@@ -405,7 +405,7 @@ uint8_t i2c_read_16bits(uint8_t slave_addr, uint8_t reg_addr, uint8_t *data) {
timeout = 0;
state = I2C_START;
read_cycle = RESET;
#ifdef DEBUG_VERBOES:
#ifdef DEBUG_VERBOES
printf("i2c master sends register address timeout in READ!\n");
#endif
}
@@ -432,7 +432,7 @@ uint8_t i2c_read_16bits(uint8_t slave_addr, uint8_t reg_addr, uint8_t *data) {
timeout = 0;
state = I2C_START;
read_cycle = 0;
#ifdef DEBUG_VERBOES:
#ifdef DEBUG_VERBOES
printf("i2c master sends data timeout in READ!\n");
#endif
}
@@ -454,7 +454,7 @@ uint8_t i2c_read_16bits(uint8_t slave_addr, uint8_t reg_addr, uint8_t *data) {
timeout = 0;
state = I2C_START;
read_cycle = 0;
#ifdef DEBUG_VERBOES:
#ifdef DEBUG_VERBOES
printf("i2c master sends stop signal timeout in READ!\n");
#endif
}
@@ -464,7 +464,7 @@ uint8_t i2c_read_16bits(uint8_t slave_addr, uint8_t reg_addr, uint8_t *data) {
read_cycle = 0;
i2c_timeout_flag = I2C_OK;
timeout = 0;
#ifdef DEBUG_VERBOES:
#ifdef DEBUG_VERBOES
printf("i2c master sends start signal in READ.\n");
#endif
break;