I2C Examples (Blocking API)
Overview
The blocking I2C examples are available for both C and C++:
C:
examples/blocking_api/i2c/c/C++:
examples/blocking_api/i2c/cpp/
These examples are intended for Supernova and Pulsar USB host adapters.
Hardware Setup
Required hardware:
One Binho Supernova or Pulsar
One I2C target device with 7-bit address
0x50(EEPROM-like/register-based target)
What The I2C Examples Do
The C and C++ examples implement the same workflow:
Connect to the device.
Read adapter information.
Configure I2C bus voltage to
3300 mV.Initialize I2C controller on
I2C_BUS_Aat200 kHzwithI2C_PULLUP_330Ohm.Re-apply I2C parameters and pull-up resistor configuration.
Perform a non-stop write/read transfer to target
0x50and verify readback.Perform a standard write/read transfer to target
0x50and verify readback.Scan the I2C bus and print discovered 7-bit and 10-bit addresses.
Transfer Notes
- The examples exercise both transfer styles:
Non-stop transfer (repeated start style).
Standard transfer (normal stop behavior).
Readback verification is done after each write/read stage.
The target subaddress used in both examples is
{0x01, 0x00}.
Build and Run (I2C C/C++)
I2C example directories build binaries with the following names:
- C (
examples/blocking_api/i2c/c/): example_c_dynamicexample_c_static
- C (
- C++ (
examples/blocking_api/i2c/cpp/): example_cpp_dynamicexample_cpp_static
- C++ (
See: