{"id":16253565,"url":"https://github.com/pleft/omega-python-oled","last_synced_at":"2025-07-22T03:34:07.553Z","repository":{"id":75633768,"uuid":"110166261","full_name":"pleft/omega-python-oled","owner":"pleft","description":"Onion Omega OledExpansion Graphics Library","archived":false,"fork":false,"pushed_at":"2017-11-19T21:40:17.000Z","size":66,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-08T12:50:47.701Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pleft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-09T21:05:57.000Z","updated_at":"2021-11-28T21:44:41.000Z","dependencies_parsed_at":"2023-06-07T04:45:19.845Z","dependency_job_id":null,"html_url":"https://github.com/pleft/omega-python-oled","commit_stats":{"total_commits":30,"total_committers":2,"mean_commits":15.0,"dds":"0.033333333333333326","last_synced_commit":"6d340f7bf2105cd134af5511f66aa63ceaaed85e"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pleft/omega-python-oled","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pleft%2Fomega-python-oled","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pleft%2Fomega-python-oled/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pleft%2Fomega-python-oled/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pleft%2Fomega-python-oled/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pleft","download_url":"https://codeload.github.com/pleft/omega-python-oled/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pleft%2Fomega-python-oled/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265233753,"owners_count":23731825,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T15:17:48.117Z","updated_at":"2025-07-14T02:37:53.180Z","avatar_url":"https://github.com/pleft.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OledLib\nOnion Omega OledExpansion Graphics Library in Python\n\n## Intro\n`OledLib` is a small graphics library for the OledExpansion module for Onion Omega IoT devices.\n\nWhile the `oledExp` Python module mainly deals with writing text on screen, `OledLib` dives deeper into pixel precise graphics.\n`OledLib` breaks the limit of 8 pages and 128 columns, giving access to all 128x64 pixels of the screen. It is also faster since it uses the `i2c` interface which is capable of sending 32 bytes of data simultaneously instead of only 1 byte (`oledExp.write(byte)`). \n\nWith `OledLib`'s ability to address each pixel individually, `OledExpansion` becomes much more versatile and capable of rendering complex graphics.\n\n## Features\n- 128x64 framebuffer, pixel-level precision.\n- Up to 32 bytes sent to screen simultaneously.\n- 1-bit bitmap rendering.\n- DMA (Direct Memory Access) functionality to fast render a portion of the screen only.\n- Special effects: rotation and scaling.\n\n## Prerequisites\nRequires [oledExp](https://docs.onion.io/omega2-docs/oled-expansion-python-module.html) and [onionI2C](https://docs.onion.io/omega2-docs/i2c-python-module.html) \nPython modules to be installed on the Onion Omega IoT device.\n\n## Demonstration\nBelow is a video showcasing most features of the `OledLib` library.\n\n[![IMAGE ALT TEXT](http://img.youtube.com/vi/tv8f6IBPjpM/0.jpg)](https://www.youtube.com/watch?v=tv8f6IBPjpM \"OledLib Graphics Library Demonstration\")\n\n## Performance\n`OledLib` has an almost fixed rate of rendering a full screen at between `0.1` and `0.2` seconds. This yields to `5` `FPS` (frames per second). This is the outcome of the `blit()` method. Although it seems rather small, it is a huge optimization against trying to render a whole screen with `oledExp.writeByte()` method which renders at `1` `FPS`. Much higher `FPS` can be achieved using the `DMA` (Direct Memory Access) technique when rendering bitmaps. This technique is used in `bitmapBlit()` method.\n\n`bitmapBlit(x, y, translatedBitmap)` method uses the `DMA` technique and renders the exact portion of the screen that the `translatedBitmap` needs. All the rest part of the screen remains untouched. This results in very fast rates of screen refreshing since only a small part of the screen is rendered each time. For example rendering a `32x32` bitmap at various positions of the screen can be as fast as `20` `FPS`! Smaller bitmaps will achieve even higher `FPS`! A demonstration of this technique can be found in the [BatmanDemoDMA.py](https://github.com/pleft/omega-python-oled/blob/master/BatmanDemoDMA.py)\n\n### DMA Tests\nA `DMA` performance test against `bitmap` size and `FPS` count is included in [PerformanceDMADemo.py](https://github.com/pleft/omega-python-oled/blob/master/PerformanceDMADemo.py). Small bitmaps can achieve impressive refresh frame rates.\n\n| Bitmap size (in pixels) | FPS           |\n| :---------------------: | ------------: |\n| 64x64                   | 8.38996560114 |\n| 32x32                   | 27.0965993768 |\n| 24x24                   | 41.8497593639 |\n| 16x16                   | 74.5712155108 |\n| 8x8                     | 180.342651037 |\n| 4x4                     | 204.498977505 |\n| 2x2                     | 219.538968167 |\n| 1x1                     | 226.500566251 |\n\n\n## API\n- `clearBuffers`: Clears the framebuffer (all elements to `0`).\n- `putPixel(x, y, value)`: Puts the `value` (`0` or `1`) at `x`, `y` coordinates.\n- `putRectangle(x, y, width, height, fill)`: Puts a rectangle (`width` x `height`) at the specified `x`, `y` coordinates. Setting `fill` to `True` will fill the rectangle, where `False` will draw just the borders.\n- `putBitmap(x, y, bitmap)`: Puts a `bitmap` MxN array of `0`s and `1`s to `x`, `y` coordinates.\n- `translateBitmap(bitmap)`: Converts a MxN `bitmap` array where each element is a `bit` (`0` or `1`), to a `byte` array MxL where each element is a `byte` (8 `bits`). Bitmap array sizes can be: `0\u003cM\u003c128` and `0\u003cN\u003c64`, and the translated bitmap will have sizes: `0\u003cM\u003c128` and `0\u003cL\u003c8`. Useful for achieving faster rendering rates. Use before calling `bitmapBlit()`.\n- `scaleBitmap(bitmap, scaleX, scaleY)`: Scales down the given `bitmap`. Each axis can scale differently by setting `scaleX`, `scaleY`. Positive integer values only.\n- `rotateBitmap90(bitmap)`: Rotates the `bitmap` 90 degrees.\n- `rotateBitmap180(bitmap)`: Rotates the `bitmap` 180 degrees.\n- `rotateBitmap270(bitmap)`: Rotates the `bitmap` 270 degrees.\n- `blit()`: Renders the whole `framebuffer` to screen at maximum fast rate.\n- `pageBlit(pageNo, x, length)`: Renders portion of a page, (row) with `length` starting from `x`, to screen at maximum fast rate. Does not clear the `framebuffer` after.\n- `bitmapBlit(x, y, translatedBitmap)`: Instead of filling the whole 128x64 framebuffer it renders only the region of a `translatedBitmap` on the screen at `x`, `y` location, sort of Direct Memory Access (DMA). Requires the `translatedBitmap` from `translateBitmap()` as input. Does not clear the `framebuffer` after.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpleft%2Fomega-python-oled","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpleft%2Fomega-python-oled","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpleft%2Fomega-python-oled/lists"}