Commit 83af887
fix: restore board-agnostic I2C device selection for OLED display
The recent OLED display inversion fixes inadvertently hard-coded
DT_NODELABEL(i2c1) which only exists on XIAO board, breaking
Adafruit Feather builds which use i2c0.
Changes:
- Restored get_i2c_device() helper function that tries both I2C interfaces
- Uses DEVICE_DT_GET_OR_NULL() for runtime I2C device detection
- Tries i2c1 first (XIAO board), then falls back to i2c0 (Feather board)
- Used DEVICE_DT_GET_OR_NULL() for display device to handle missing aliases
- Replaced all hard-coded DT_NODELABEL(i2c1) calls with helper function
Both boards now build successfully:
- XIAO: Uses i2c1 and oled_display alias when available
- Feather: Uses i2c0 and gracefully handles missing display
This maintains the OLED display inversion fixes for XIAO while ensuring
cross-board compatibility for the codebase.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 69b1cab commit 83af887
1 file changed
Lines changed: 31 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
23 | 43 | | |
24 | 44 | | |
25 | 45 | | |
| |||
52 | 72 | | |
53 | 73 | | |
54 | 74 | | |
55 | | - | |
56 | | - | |
| 75 | + | |
| 76 | + | |
57 | 77 | | |
58 | 78 | | |
59 | 79 | | |
| |||
335 | 355 | | |
336 | 356 | | |
337 | 357 | | |
338 | | - | |
339 | | - | |
| 358 | + | |
| 359 | + | |
340 | 360 | | |
341 | 361 | | |
342 | 362 | | |
| |||
367 | 387 | | |
368 | 388 | | |
369 | 389 | | |
370 | | - | |
371 | | - | |
| 390 | + | |
| 391 | + | |
372 | 392 | | |
373 | 393 | | |
374 | 394 | | |
| |||
400 | 420 | | |
401 | 421 | | |
402 | 422 | | |
403 | | - | |
404 | | - | |
| 423 | + | |
| 424 | + | |
405 | 425 | | |
406 | 426 | | |
407 | 427 | | |
| |||
510 | 530 | | |
511 | 531 | | |
512 | 532 | | |
513 | | - | |
514 | | - | |
| 533 | + | |
| 534 | + | |
515 | 535 | | |
516 | 536 | | |
517 | 537 | | |
| |||
550 | 570 | | |
551 | 571 | | |
552 | 572 | | |
553 | | - | |
| 573 | + | |
554 | 574 | | |
555 | 575 | | |
556 | 576 | | |
| |||
0 commit comments