mirror of
https://github.com/vimagick/dockerfiles.git
synced 2024-11-28 09:08:36 +02:00
add oled-arm
This commit is contained in:
parent
f389f1d19e
commit
d8c5610696
27
oled/Dockerfile
Normal file
27
oled/Dockerfile
Normal file
@ -0,0 +1,27 @@
|
||||
#
|
||||
# Dockerfile for oled
|
||||
#
|
||||
|
||||
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
|
||||
|
||||
ENTRYPOINT ["python"]
|
22
oled/README.md
Normal file
22
oled/README.md
Normal file
@ -0,0 +1,22 @@
|
||||
oled
|
||||
====
|
||||
|
||||
## Demo
|
||||
|
||||
```
|
||||
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
|
||||
# Show "hello world" on oled display module
|
||||
$ cat demo.py | docker-compose run --rm oled
|
||||
```
|
||||
|
||||
## Todo
|
||||
|
||||
- [ ] Implement RESTful API
|
13
oled/demo.py
Normal file
13
oled/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/docker-compose.yml
Normal file
4
oled/docker-compose.yml
Normal file
@ -0,0 +1,4 @@
|
||||
oled:
|
||||
image: easypi/oled-arm
|
||||
devices:
|
||||
- /dev/i2c-1
|
Loading…
Reference in New Issue
Block a user