adafruit / adafruit/Adafruit_Wippersnapper_Arduino

Support graceful i2c timeout for stuck bus etc. #ifdef WIRE_HAS_TIMEOUT Wire.setWireTimeout

Open
#924 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
54
Forks
56
Avg merge
2d 12h
Merged PRs (30d)
11

Description

See https://github.com/adafruit/Adafruit_SSD1306/commit/4d19dfb747d9b0ef0d2b5a4a438650d0d6973263 which has a very helpful commit message.

> Add Wire.setWireTimeout to avoid I2C bus hangs (closes https://github.com/adafruit/Adafruit_SSD1306/issues/288)
If the I2C bus stops responding mid-transaction (noise, the display
becomes disconnected, etc.), the underlying Wire library spins in
an indefinite loop and the host MCU effectively hangs. The Arduino
AVR core fixed this in ArduinoCore-avr@deea929 by exposing
setWireTimeout(); cores that implement it define WIRE_HAS_TIMEOUT
so callers can detect the feature at compile time.

> Use that detection: when periphBegin owns the wire->begin() call,
follow it with a 25 ms timeout + reset on timeout.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the periphBegin implementation and the Wire.begin() call, then read the referenced Adafruit_SSD1306 commit for the intended behavior. When periphBegin owns wire-begin, done means conditionally applying a 25 ms Wire timeout with reset-on-timeout support under WIRE_HAS_TIMEOUT, while preserving builds for cores without it.

Written by the indexing model from the issue text.

Assessment

Tech stack
arduino, cpp
Domain
embedded-iot
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.