Skip to content

Commit

Permalink
fix(i2c example): reduce scope of read_data variable
Browse files Browse the repository at this point in the history
  • Loading branch information
finger563 committed Jan 9, 2024
1 parent 30c04fd commit fb5ce9b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion components/i2c/example/main/i2c_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ extern "C" void app_main(void) {
auto task_fn = [&i2c](std::mutex &m, std::condition_variable &cv) {
static constexpr uint8_t device_address = 0x58;
static constexpr uint8_t register_address = 0x58;
uint8_t read_data[1];
bool device_found = i2c.probe_device(device_address);
if (device_found) {
fmt::print("Found device with address 0x{:#02x}\n", device_address);
uint8_t read_data[1];
bool success = i2c.read_at_register(device_address, register_address, read_data, 1);
if (success) {
fmt::print("read data: {:#04x}\n", read_data[0]);
Expand Down

0 comments on commit fb5ce9b

Please sign in to comment.