Skip to content

Align abstract interfaces, teardown attributes, and moved-from docs#57

Merged
cleishm merged 1 commit into
mainfrom
lcd/nvi-and-api-consistency
Jun 11, 2026
Merged

Align abstract interfaces, teardown attributes, and moved-from docs#57
cleishm merged 1 commit into
mainfrom
lcd/nvi-and-api-consistency

Conversation

@cleishm

@cleishm cleishm commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Summary

API-consistency pass across the released components, following the conventions established in the LoRa work (#56):

Non-virtual interface for abstract bases (breaking — 2.0.0):

  • lcd::panel and lcd::touch now expose public non-virtual try_*/throwing method pairs with protected do_* hooks that concrete drivers override privately (matching lora::radio and std::pmr::memory_resource), with protected move operations.
  • ili9341 and stmpe610 updated to private do_* overrides; their public surfaces now show only what is driver-specific.

Flattened lcd config structs (breaking — same 2.0.0):

  • panel::config: nested single-field flags struct replaced by a top-level reset_active_level.
  • touch::config: nested levels/flags structs replaced by flat reset_level, interrupt_level, swap_xy, mirror_x, mirror_y fields.
  • The nesting mirrored the underlying C structs but bought nothing: the C++ configs are not layout-compatible with them, and it forced awkward .flags = {...} spellings at call sites.
  • idfxx_lcd, idfxx_lcd_touch, idfxx_lcd_ili9341, idfxx_lcd_touch_stmpe6102.0.0, with ^2.0.0 dependency ranges in dependent components and example projects. (panel_io::config::flags is left as-is — it holds eight genuine bitfields.)

[[nodiscard]] teardown sweep (non-breaking):
Removed from five deregister/teardown operations where callers reasonably ignore the result, per the documented convention: event_loop::try_listener_remove, http::client::try_close, http::server::try_unregister_handler, ota::update::try_abort, try_unregister_shutdown_handler. Kept on try_close_session and try_disable_pmf_config, which are operational rather than teardown.

Moved-from contract documented as UB (non-breaking doc change):
All move-only types now document that using a moved-from object (other than destruction or assignment) is undefined behavior, replacing per-class guarantees of errc::invalid_state returns. Implementations still attempt to fail safely; that behaviour is just no longer API surface. Applied to console, event_group, i2c, lcd panel_io, nvs, onewire, ota, queue, spi, task, and timer; datagram_socket drops its moved-from @retval promises. The net socket types keep their deliberate narrow allowance (destroy, move-assign, is_open()/native_handle() queries).

Versions: components with non-breaking changes are bumped one patch above their last published registry version. Components whose in-repo version is already ahead of the registry (idfxx_core 1.1.0, idfxx_event_group 1.0.1, idfxx_task 1.0.1, and the never-published idfxx_net) keep their pending version — the unreleased increment already covers these changes.

@cleishm cleishm force-pushed the lcd/nvi-and-api-consistency branch 3 times, most recently from 771fd31 to f95bb26 Compare June 11, 2026 07:49
Convert the lcd::panel and lcd::touch abstract bases to the non-virtual
interface pattern: public non-virtual try_*/throwing method pairs with
protected do_* hooks that concrete drivers (ili9341, stmpe610) override
privately, and protected move operations. This matches the shape of
lora::radio and std::pmr::memory_resource.

Flatten the lcd config structs: panel::config gains a top-level
reset_active_level field (replacing the single-field nested flags
struct), and touch::config gains reset_level, interrupt_level, swap_xy,
mirror_x, and mirror_y fields (replacing the nested levels and flags
structs). idfxx_lcd, idfxx_lcd_touch, idfxx_lcd_ili9341, and
idfxx_lcd_touch_stmpe610 move to 2.0.0 for these breaking changes.

Remove [[nodiscard]] from teardown operations where callers reasonably
ignore the result, per the documented convention:
event_loop::try_listener_remove, http::client::try_close,
http::server::try_unregister_handler, ota::update::try_abort, and
try_unregister_shutdown_handler.

Document moved-from object use as undefined behavior across all
move-only types (console, event_group, i2c, lcd panel_io, nvs, onewire,
ota, queue, spi, task, timer), replacing the previous per-class
guarantees that methods return errc::invalid_state. Implementations
still attempt to fail safely, but the safe failure is no longer API
surface. The net socket types keep their explicit narrow allowance
(destroy, move-assign, and is_open()/native_handle() queries);
datagram_socket drops its moved-from @RetVal promises.

Components with non-breaking changes receive patch version bumps.
@cleishm cleishm force-pushed the lcd/nvi-and-api-consistency branch from f95bb26 to 407077f Compare June 11, 2026 07:51
@cleishm cleishm merged commit dda24f0 into main Jun 11, 2026
107 of 108 checks passed
@cleishm cleishm deleted the lcd/nvi-and-api-consistency branch June 11, 2026 14:20
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.

1 participant