Commit Graph

38 Commits

Author SHA1 Message Date
Scott Shawcroft 7089ea4d65
Add address_little_endian for displayio
Add address_little_endian for epaper displays with little endian
(low byte first) addresses.

Also clears allocated display and display bus memory so it has a
known state. The acep member wasn't always set so it varied
accidentally.

Fixes #7560. May fix #7778. Fixes #5119.
2023-04-21 12:19:29 -07:00
Scott Shawcroft 931c7c1c51
Add Bangle.js 2, JDI memory displays and ACeP epd
This 2-in-1 PR started with the goal of support the Bangle.js 2
smartwatch with *no USB*.
* Adds "secure" DFU build support with a committed private key.
* Adds 3-bit color support with one dummy bit for the JDI memory display
* Allows nrf boards to have a board_background_task() run in RUN_BACKGROUND_TASK.
  This is needed because the Bangle.js 2 uses the watchdog to reset.
* Renamed port_background_task() to port_background_tick() to indicate it
  runs on tick, not RUN_BACKGROUND_TASK.
* Marks serial connected when the display terminal is inited. This means
  that safe mode messages show up on the display.

ACep, 7-color epaper displays also pack 3 bits in 4. So, I added that
support as well.
* Adds 3-bit ACeP color support for 7-color e-paper displays. (Not
  watch related but similar due to color depth.)
* Allows a refresh sequence instead of a single int command. The 7" ACeP
  display requires a data byte for refresh.
* Adds optional delay after resetting the display. The ACeP displays
  need this. (Probably to load LUTs from flash.)
* Adds a cleaning phase for ACeP displays before the real refresh.

For both:
* Add dither support to Palette.
* Palette no longer converts colors when set. Instead, it caches
  converted colors at each index.
* ColorConverter now caches the last converted color. It should make
  conversions faster for repeated colors (not dithering.)
2023-02-15 15:03:40 -08:00
foamyguy 57462092b5 return None instead of NULL for framebuffer and epaper 2022-12-01 17:34:43 -06:00
foamyguy 42f1d50acc remove extra function call. handle show(None) for framebuffer and epaper 2022-12-01 17:25:36 -06:00
foamyguy ef3398422a allow set_root_group for FrameBufferDisplay instead of show() 2022-11-19 11:41:48 -06:00
foamyguy 403e3ef430 change to CIRCUITPYTHON_TERMINAL. change internal API to use set_root_group 2022-11-18 16:53:18 -06:00
Dan Halbert 41bcd7b260 Remove support for auto-brightness 2022-08-09 22:40:21 -04:00
Neradoc 626296b613 implement root_group in framebufferio.FramebufferDisplay 2022-07-14 11:47:36 +02:00
Dan Halbert a01dec1df9 message consolidation and more use of validators 2022-05-19 15:38:37 -04:00
Timon a1052d5f73
Initial broadcom port for Raspberry Pi
This targets the 64-bit CPU Raspberry Pis. The BCM2711 on the Pi 4
and the BCM2837 on the Pi 3 and Zero 2W. There are 64-bit fixes
outside of the ports directory for it.

There are a couple other cleanups that were incidental:
* Use const mcu_pin_obj_t instead of omitting the const. The structs
  themselves are const because they are in ROM.
* Use PTR <-> OBJ conversions in more places. They were found when
  mp_obj_t was set to an integer type rather than pointer.
* Optimize submodule checkout because the Pi submodules are heavy
  and unnecessary for the vast majority of builds.

Fixes #4314
2021-11-22 14:54:44 -08:00
microDev 3da86b0ac2
add initial esp32c3 support 2021-09-26 09:39:40 +05:30
Scott Shawcroft 3fda0c0a1b
Fix board builds and use MP_ERROR_TEXT in py and extmod 2021-05-05 17:51:52 -07:00
microDev a52eb88031
run code formatting script 2021-03-15 19:27:36 +05:30
Jeff Epler 88d07ef35b displayio: further ensure just one start_terminal call
@cwalther determined that for boards with 2 displays (monster m4sk),
start_terminal would be called for each one, leaking supervisor heap
entries.

Determine, by comparing addresses, whether the display being acted on
is the first display (number zero) and do (or do not) call start_terminal.

stop_terminal can safely be called multiple times, so there's no need
to guard against calling it more than once.

Slight behavioral change: The terminal size would follow the displays[0]
size, not the displays[1] size
2020-10-15 15:24:19 -05:00
Jeff Epler 774f2e16ba displayio, framebufferio: Remove spurious call to supervisor_start_terminal
A call to supervisor_start_terminal remained in
common_hal_displayio_display_construct and was copied to other display
_construct functions, even though it was also being done in
displayio_display_core_construct when that was factored out.

Originally, this was harmless, except it created an extra allocation.
When investigating #3482, I found that this bug became harmful,
especially for displays that were created in Python code, because it
caused a supervisor allocation to leak.

I believe that it is safe to merge #3482 after this PR is merged.
2020-10-11 21:09:08 -05:00
Jeff Epler 71c63c2812 FramebufferDisplay: Don't set rotation via core_construct
The expectations of displayio.Display and frambufferio.FramebufferDisplay
are different when it comes to rotation.

In displayio.Display, if you call core_construct with a WxH = 64x32
and rotation=90, you get something that is 32 pixels wide and 64 pixels
tall in the LCD's coordinate system.

This is fine, as the existing definitions were written to work like this.
With framebuffer displays, however, the underlying framebuffer (such as
RGBMatrix) says "I am WxH pixels wide in my coordinate system" and the
constructor is given a rotation; when the rotation indicates a transpose
that means "exchange rows and columns, so that to the Groups displayed
on it, there is an effectively HxW pixel region for use".

Happily, we already have a set_rotation method.  Thus (modulo the time
spent debugging things anyway:) the fix is simple: Always request no
rotation from core_construct, then immediately fix up the rotation
to match what was requested.

Testing performed: 32x16 RGBMatrix on Metro M4 Express (but using
the Airlift firmware, as this is the configuration the error was reported
on):
 * initially construct display at 0, 90, 180, 270 degrees
 * later change angle to 0, 90, 180, 270 degrees
 * no garbled display
 * no safe mode crashes
2020-09-01 11:00:22 -05:00
Scott Shawcroft 6857f98426
Split pulseio.PWMOut into pwmio
This gives us better granularity when implementing new ports because
PWMOut is commonly implemented before PulseIn and PulseOut.

Fixes #3211
2020-08-18 13:08:33 -07:00
Jeff Epler d61f66d173
Update shared-module/framebufferio/FramebufferDisplay.h
Co-authored-by: Scott Shawcroft <scott@tannewt.org>
2020-08-12 12:50:08 -05:00
Jeff Epler c1400bae9b sharpmemory: Implement support for Sharp Memory Displays in framebufferio 2020-08-12 07:32:18 -05:00
Jeff Epler 9c4f644641 framebufferio: add dirty row tracking 2020-08-12 07:32:18 -05:00
Jeff Epler 5e4ed93415 framebufferio: Add getters for remaining displayio_display_core_construct arguments
.. and introduce a convenience macro that helps many of them be required
(if their values match defaults or are inapplicable)
2020-08-12 07:32:18 -05:00
Jeff Epler 1ee2062c1b framebufferio: Check early if framebuffer is big enough 2020-08-12 07:32:18 -05:00
Jeff Epler a33e48c065 framebufferio: add "first pixel offset" and "row stride" 2020-08-12 07:32:18 -05:00
Jeff Epler 8021f3b4cb framebufferio: handle sharp memory displays
A bit of cheating; we need to add a protocol getter for
reverse_bytes_in_word
2020-08-12 07:32:18 -05:00
Jeff Epler a84cc19499 framebufferio: Handle 1 (tested), 2, and 4 bpp displays 2020-08-12 07:32:18 -05:00
Jeff Epler 6d19a09888 framebufferio: Set type to none when releasing
This avoids the message "Too many displays in use" when they are released
directly, rather than via release_displays().
2020-08-12 07:32:18 -05:00
Jeff Epler 5a7b2a2038 framebufferio: Don't call swapbuffers unnecessarily 2020-08-12 07:32:18 -05:00
Jeff Epler ffc488e748 framebufferio: Fix crash calling unimplemented get_brightness
If set_brightness was implemented but get_brightness wasn't, this
would hard fault
2020-08-12 07:32:18 -05:00
Jeff Epler c243c13f02 framebufferio: Handle auto refresh flag at reset
if we don't set the flag via accessor fn the tick enable might become wrong
2020-07-20 08:52:35 -05:00
Jeff Epler af520729fe displayio, framebufferio: Enable supervisor tick when a display is auto-refresh
This is a step towards restoring the efficiency of the background
tasks
2020-07-15 09:26:47 -05:00
Diego Elio Pettenò dd5d7c86d2 Fix up end of file and trailing whitespace.
This can be enforced by pre-commit, but correct it separately to make it easier to review.
2020-06-03 10:56:35 +01:00
Scott Shawcroft bebf27e733
Merge remote-tracking branch 'adafruit/master' into lower_power
This isn't perfect and needs a bit more testing.
2020-04-20 18:25:13 -07:00
Jeff Epler 9bfe6b7197 framebufferio: update copyright information 2020-04-17 18:44:07 -05:00
Jeff Epler 57ce2d1f41 framebufferio: get width, etc., from protocol, not object property 2020-04-17 18:43:57 -05:00
Scott Shawcroft abd340a8e4
Remove tick.h from merged file. 2020-04-16 11:35:19 -07:00
Jeff Epler ba20bc8b43 framebufferio: move backlight down to the underlying framebuffer 2020-04-14 18:24:58 -05:00
Jeff Epler baf04b7738 FramebufferDisplay: remove probably not needed constructor arguments 2020-04-14 18:24:58 -05:00
Jeff Epler 09dc46a984 Add Protomatter and FramebufferDisplay 2020-04-14 18:24:54 -05:00