generated from hulk/gd32e23x_template
Compare commits
No commits in common. "d6f3ea33b1fc5562f40722bb6e76dac3dc3401d4" and "44cf0426e5598bfe200f12326b910181147d696e" have entirely different histories.
d6f3ea33b1
...
44cf0426e5
@ -181,7 +181,7 @@ int LDC1612_IIC_read_16bits(void) {
|
||||
return -8; // 超时返回错误
|
||||
}
|
||||
|
||||
// i2c_ack_config(I2C0, I2C_ACK_DISABLE); // 关闭发送ACK,它会在下一个字节完成后发送NAK
|
||||
i2c_ack_config(I2C0, I2C_ACK_DISABLE); // 关闭发送ACK,它会在下一个字节完成后发送NAK
|
||||
|
||||
// 读取第二个字节的数据
|
||||
while (!i2c_flag_get(I2C0, I2C_FLAG_RBNE) && (timeout < I2C_TIME_OUT)) {
|
||||
|
30
src/main.c
30
src/main.c
@ -106,9 +106,9 @@ int main(void)
|
||||
|
||||
// uint16_t data[3] = {0};
|
||||
|
||||
// I2C_scan();
|
||||
// I2C _scan();
|
||||
|
||||
delay_ms(1000);
|
||||
delay_ms(200);
|
||||
|
||||
// while (i2c_flag_get(I2C0, I2C_FLAG_I2CBSY));
|
||||
// i2c_start_on_bus(I2C0);
|
||||
@ -133,24 +133,24 @@ int main(void)
|
||||
|
||||
|
||||
// i2c_stop_on_bus(I2C0);
|
||||
//
|
||||
// i2c_ack_config(I2C0, I2C_ACK_ENABLE);
|
||||
|
||||
// iicSendData();
|
||||
// iicReceiveData();
|
||||
iicSendData();
|
||||
iicReceiveData();
|
||||
|
||||
// int result = 0;
|
||||
// result = LDC1612_IIC_read_16bits();
|
||||
// printf("result = %d\r\n", result);
|
||||
|
||||
|
||||
|
||||
|
||||
int result = 0;
|
||||
result = LDC1612_IIC_read_16bits();
|
||||
printf("result = %d\r\n", result);
|
||||
|
||||
while(1){
|
||||
|
||||
|
||||
delay_ms(1000);
|
||||
printf("OK!!!\r\n");
|
||||
// iicSendData();
|
||||
|
||||
// i2c_flag_clear(I2C0, I2C_FLAG_I2CBSY);
|
||||
|
||||
// printf("OK!!!\r\n");
|
||||
//
|
||||
// delay_ms(1000);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user