Skip to content

Conversation

@unicab369
Copy link
Contributor

No description provided.

@cnlohr
Copy link
Owner

cnlohr commented Dec 1, 2025

Please reference the moved place for the i2c_lib.h, in that one example can reference another.

This example demonstrates I2C communication with an I2C slave device.
You can use this with (one or the other):
- BH1750 light sensor (actual hardware)
- Another CH32X035 running i2c_slave_test firmware
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct? (This runs on a ch32v30x?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only have the slave example working for Ch32x035, so technically, this code should be able to communicate with a Ch32x035 slave. I haven't test it with v30x.

- BH1750 light sensor (actual hardware)
- Another CH32X035 running i2c_slave_test firmware

if you are connecting a CH32X03X to a BH1750, the default slave address for the sensor is 0x23
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would really like a schematic.

return raw * 12 / 10; // Convert to lux
}

void onHandle_ping(u8 i2cAddress) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PLEASE stop using tight type specifiers. like u8 when it can just be an int.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

XD

@cnlohr
Copy link
Owner

cnlohr commented Dec 3, 2025

My comments are in. Also if you can fix the compile.

@cnlohr
Copy link
Owner

cnlohr commented Dec 29, 2025

@unicab369 one of your other PRs conflicts with this one, can you fix the merge issue?

@unicab369
Copy link
Contributor Author

@cnlohr ok, I will

@cnlohr
Copy link
Owner

cnlohr commented Dec 31, 2025

To be clear the issue is with uart_send_receive, you can do this by running git merge master in your branch.

@unicab369
Copy link
Contributor Author

oh I see.

@cnlohr
Copy link
Owner

cnlohr commented Jan 6, 2026

Mind fixing the conflict? If you can rebase off of master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants