Skip to content

ESP32: i2c simtests and fixes#2302

Merged
bettio merged 2 commits into
atomvm:release-0.7from
petermm:esp32-i2c-simtests
May 28, 2026
Merged

ESP32: i2c simtests and fixes#2302
bettio merged 2 commits into
atomvm:release-0.7from
petermm:esp32-i2c-simtests

Conversation

@petermm
Copy link
Copy Markdown
Contributor

@petermm petermm commented May 12, 2026

Adds i2c simtest on esp32, this in preparation for adding the newer i2c esp-idf driver soon.

Includes fixes for various issues surfaced:

  • fix i2c resource cleanup after close
  • fix i2c half-closed state when driver delete fails
  • reject i2c close during active transmission
  • fix i2c cmd handle leaks on error paths

These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).

SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later

petermm added 2 commits May 12, 2026 12:37
Track open/closed I2C NIF resource state, clean up command handles on error paths, and reject closes while a transmission is active.

Ensure driver-delete failures do not leave the resource half-closed, and document the ESP32 I2C fixes in the changelog.

Signed-off-by: Peter M <petermm@gmail.com>
Wire a BMP180 into the ESP32 Wokwi simulator and add an Erlang test that exercises I2C through both port-driver and NIF paths.

Cover successful sensor reads, NACK recovery, split transactions, and ownership-contention errors.

Signed-off-by: Peter M <petermm@gmail.com>
@bettio bettio changed the title Esp32 i2c simtests and fixes ESP32: i2c simtests and fixes May 28, 2026
@bettio bettio merged commit 6379869 into atomvm:release-0.7 May 28, 2026
46 checks passed
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