Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

extmod/modframebuf: Add attributes for width, height, format and stride.#17328

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
andrewleech wants to merge1 commit intomicropython:master
base:master
Choose a base branch
Loading
fromandrewleech:framebuf_attr

Conversation

andrewleech
Copy link
Contributor

@andrewleechandrewleech commentedMay 20, 2025
edited
Loading

Summary

This PR adds direct attribute access to the FrameBuffer class by implementing an attribute handler in the C code. Users can now access the width, height, format, and stride properties directly from
framebuffer objects using standard attribute syntax (e.g., fb.width, fb.height, etc.).

This makes it easier to work with framebuffers in applications where these properties need to be accessed frequently, eliminating the need to store and track these values separately. It's particularly
useful when passing framebuffers between different functions or modules.

Prompted byhttps://github.com/orgs/micropython/discussions/17266

Testing

I've added a comprehensive test suite in tests/extmod/framebuf_attr.py that validates all the framebuffer attributes with all supported formats:

  • MONO_VLSB, MONO_HLSB, MONO_HMSB
  • RGB565
  • GS2_HMSB, GS4_HMSB, GS8

The test also checks various dimensions (8x4, 16x8, 128x64) and verifies that attempting to access non-existent attributes raises an AttributeError as expected.

The implementation was tested on the Unix port, and since this change is contained within the framebuf module and doesn't interact with hardware-specific features, it should work consistently across all
ports that support the framebuf module.


🤖 Generated withClaude Code

@github-actionsGitHub Actions
Copy link

Code size report:

   bare-arm:    +0 +0.000% minimal x86:    +0 +0.000%    unix x64:  +304 +0.036% standard[incl +64(data)]      stm32:  +112 +0.029% PYBV10     mimxrt:  +104 +0.028% TEENSY40        rp2:  +112 +0.012% RPI_PICO_W       samd:  +108 +0.040% ADAFRUIT_ITSYBITSY_M4_EXPRESS  qemu rv32:  +123 +0.027% VIRT_RV32

@dpgeorgedpgeorge added the extmodRelates to extmod/ directory in source labelMay 20, 2025
@andrewleechandrewleechforce-pushed theframebuf_attr branch 6 times, most recently fromf691ae9 to73a8cf9CompareMay 20, 2025 03:22
Implement an attr handler for FrameBuffer objects to allow direct access tothe width, height, format and stride properties, which makes it easier toreuse framebuffers without needing to track their properties separately.🤖 Generated with [Claude Code](https://claude.ai/code)Co-Authored-By: Claude <noreply@anthropic.com>Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
@codecovCodecov
Copy link

codecovbot commentedMay 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.54%. Comparing base(79abdad) to head(5b0456f).
Report is 68 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@##           master   #17328   +/-   ##=======================================  Coverage   98.54%   98.54%           =======================================  Files         169      169             Lines       21898    21909   +11     =======================================+ Hits        21580    21591   +11  Misses        318      318

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report?Share it here.

🚀 New features to boost your workflow:
  • ❄️Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
extmodRelates to extmod/ directory in source
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@andrewleech@dpgeorge@pi-anl

[8]ページ先頭

©2009-2025 Movatter.jp