generated from hulk/gd32e23x_template
format
This commit is contained in:
26
src/main.c
26
src/main.c
@@ -79,36 +79,36 @@ int main(void) {
|
||||
soft_i2c_config();
|
||||
printf("111\n");
|
||||
|
||||
i2c_start();
|
||||
i2c_send_byte((0x2B << 1));
|
||||
if (!i2c_wait_ack())
|
||||
soft_i2c_start();
|
||||
soft_i2c_send_byte((0x2B << 1));
|
||||
if (!soft_i2c_wait_ack())
|
||||
{
|
||||
printf("NACK\n");
|
||||
}
|
||||
|
||||
|
||||
i2c_send_byte(0x7E);
|
||||
if (!i2c_wait_ack())
|
||||
soft_i2c_send_byte(0x7E);
|
||||
if (!soft_i2c_wait_ack())
|
||||
{
|
||||
printf("NACK\n");
|
||||
}
|
||||
|
||||
i2c_delay();
|
||||
i2c_start();
|
||||
soft_i2c_delay();
|
||||
soft_i2c_start();
|
||||
|
||||
i2c_send_byte((0x2B << 1) + 1);
|
||||
if (!i2c_wait_ack())
|
||||
soft_i2c_send_byte((0x2B << 1) + 1);
|
||||
if (!soft_i2c_wait_ack())
|
||||
{
|
||||
printf("NACK\n");
|
||||
}
|
||||
|
||||
i2c_delay();
|
||||
soft_i2c_delay();
|
||||
|
||||
data[0] = i2c_receive_byte(1);
|
||||
data[1] = i2c_receive_byte(0);
|
||||
data[0] = soft_i2c_receive_byte(1);
|
||||
data[1] = soft_i2c_receive_byte(0);
|
||||
|
||||
delay_us(5);
|
||||
i2c_stop();
|
||||
soft_i2c_stop();
|
||||
|
||||
printf("0x%x 0x%x\n", data[0], data[1]);
|
||||
|
||||
|
Reference in New Issue
Block a user