Merge pull request #30 from FoamyGuy/odb_api_update
use new OnDiskBitmap API
This commit is contained in:
commit
fce4e621be
1 changed files with 11 additions and 18 deletions
|
|
@ -15,24 +15,17 @@ display = eink_gizmo.EInk_Gizmo()
|
|||
display_group = displayio.Group()
|
||||
|
||||
# Display a ruler graphic from the root directory of the CIRCUITPY drive
|
||||
with open("/display-ruler.bmp", "rb") as file:
|
||||
picture = displayio.OnDiskBitmap(file)
|
||||
# Create a Tilegrid with the bitmap and put in the displayio group
|
||||
# CircuitPython 6 & 7 compatible
|
||||
sprite = displayio.TileGrid(
|
||||
picture,
|
||||
pixel_shader=getattr(picture, "pixel_shader", displayio.ColorConverter()),
|
||||
)
|
||||
# CircuitPython 7 compatible only
|
||||
# sprite = displayio.TileGrid(picture, pixel_shader=bitmap.pixel_shader)
|
||||
display_group.append(sprite)
|
||||
picture = displayio.OnDiskBitmap("/display-ruler.bmp")
|
||||
# Create a Tilegrid with the bitmap and put in the displayio group
|
||||
sprite = displayio.TileGrid(picture, pixel_shader=picture.pixel_shader)
|
||||
display_group.append(sprite)
|
||||
|
||||
# Place the display group on the screen
|
||||
display.root_group = display_group
|
||||
# Place the display group on the screen
|
||||
display.root_group = display_group
|
||||
|
||||
# Refresh the display to have it actually show the image
|
||||
# NOTE: Do not refresh eInk displays sooner than 180 seconds
|
||||
display.refresh()
|
||||
print("refreshed")
|
||||
# Refresh the display to have it actually show the image
|
||||
# NOTE: Do not refresh eInk displays sooner than 180 seconds
|
||||
display.refresh()
|
||||
print("refreshed")
|
||||
|
||||
time.sleep(180)
|
||||
time.sleep(180)
|
||||
|
|
|
|||
Loading…
Reference in a new issue