mirror of
https://github.com/vimagick/dockerfiles.git
synced 2026-01-04 20:14:56 +01:00
update oled-arm
This commit is contained in:
34
oled-arm/Dockerfile
Normal file
34
oled-arm/Dockerfile
Normal file
@@ -0,0 +1,34 @@
|
||||
#
|
||||
# Dockerfile for oled-arm
|
||||
#
|
||||
|
||||
FROM easypi/alpine-arm
|
||||
MAINTAINER EasyPi Software Foundation
|
||||
|
||||
RUN set -xe \
|
||||
&& apk add --no-cache build-base \
|
||||
curl \
|
||||
linux-headers \
|
||||
python \
|
||||
python-dev \
|
||||
freetype \
|
||||
freetype-dev \
|
||||
jpeg \
|
||||
jpeg-dev \
|
||||
&& curl https://bootstrap.pypa.io/get-pip.py | python \
|
||||
&& pip install luma.oled \
|
||||
&& apk del --purge build-base \
|
||||
curl \
|
||||
linux-headers \
|
||||
python-dev \
|
||||
freetype-dev \
|
||||
jpeg-dev
|
||||
|
||||
WORKDIR /code
|
||||
|
||||
RUN set -xe \
|
||||
&& apk add --no-cache curl tar \
|
||||
&& curl -sSL https://github.com/rm-hull/luma.examples/archive/master.tar.gz | tar xz --strip 2 luma.examples-master/examples \
|
||||
&& apk del --purge curl tar
|
||||
|
||||
ENTRYPOINT ["python"]
|
||||
36
oled-arm/README.md
Normal file
36
oled-arm/README.md
Normal file
@@ -0,0 +1,36 @@
|
||||
oled
|
||||
====
|
||||
|
||||
## Setup
|
||||
|
||||
```
|
||||
OLED Pin | Name | Remarks | RPi Pin | RPi Function
|
||||
---------+------+---------+---------+--------------
|
||||
1 | GND | Ground | P01-6 | GND
|
||||
2 | VCC | +3.3V | P01-1 | 3V3
|
||||
3 | SCL | Clock | P01-5 | GPIO 3 (SCL)
|
||||
4 | SDA | Data | P01-3 | GPIO 2 (SDA)
|
||||
```
|
||||
|
||||
```bash
|
||||
# hello world
|
||||
$ docker-compose run --rm oled < demo.py
|
||||
```
|
||||
|
||||
```
|
||||
# list all examples
|
||||
$ docker-compose run --rm --entrypoint ls oled
|
||||
|
||||
# clock
|
||||
$ docker-compose run --rm oled clock.py
|
||||
|
||||
# pi logo
|
||||
$ docker-compose run --rm oled pi_logo.py
|
||||
|
||||
# game of life
|
||||
$ docker-compose run --rm game_of_life.py
|
||||
```
|
||||
|
||||
## Todo
|
||||
|
||||
- [ ] Implement RESTful api as default CMD.
|
||||
13
oled-arm/demo.py
Normal file
13
oled-arm/demo.py
Normal file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from luma.core.interface.serial import i2c
|
||||
from luma.core.render import canvas
|
||||
from luma.oled.device import ssd1306
|
||||
|
||||
serial = i2c(port=1, address=0x3C)
|
||||
device = ssd1306(serial)
|
||||
device.cleanup = lambda _: None
|
||||
|
||||
with canvas(device) as draw:
|
||||
draw.rectangle(device.bounding_box, outline="white", fill="black")
|
||||
draw.text((30, 40), "Hello World", fill="white")
|
||||
4
oled-arm/docker-compose.yml
Normal file
4
oled-arm/docker-compose.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
oled:
|
||||
image: easypi/oled-arm
|
||||
devices:
|
||||
- /dev/i2c-1
|
||||
Reference in New Issue
Block a user