Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
163 commits
Select commit Hold shift + click to select a range
3bedfc1
my changes
justcop Jan 30, 2021
fef55c6
Update README.md
justcop Jan 30, 2021
82dd278
Update infowindow.py
justcop Jan 30, 2021
f611435
Update infowindow.py
justcop Jan 30, 2021
5ccc9da
Update infowindow.py
justcop Jan 30, 2021
b8a752c
Update infowindow.py
justcop Jan 30, 2021
aae02ea
Update infowindow.py
justcop Jan 30, 2021
3148dc8
Update infowindow.py
justcop Jan 30, 2021
5f02209
Update infowindow.py
justcop Jan 30, 2021
27db359
Update infowindow.py
justcop Jan 30, 2021
9a324ce
Update infowindow.py
justcop Jan 30, 2021
5d2ed82
Update screensaver.py
justcop Jan 30, 2021
eb2a7b4
Update screensaver.py
justcop Jan 30, 2021
0dfd1dc
Update screensaver.py
justcop Jan 30, 2021
e370c1c
Update screensaver.py
justcop Jan 30, 2021
a0b721e
Update screensaver.py
justcop Jan 30, 2021
7eed118
Update screensaver.py
justcop Jan 30, 2021
795f963
Update screensaver.py
justcop Jan 30, 2021
69e7315
Update screensaver.py
justcop Jan 30, 2021
229d814
Update screensaver.py
justcop Jan 30, 2021
6a1ebe5
Update screensaver.py
justcop Jan 30, 2021
65c62cb
Update screensaver.py
justcop Jan 30, 2021
a4a8c5f
Update mod_todoist.py
justcop Jan 31, 2021
505d3bb
Update mod_todoist.py
justcop Jan 31, 2021
ad53ebd
Update infowindow.py
justcop Jan 31, 2021
11db9e8
Update infowindow.py
justcop Jan 31, 2021
125cad1
Update infowindow.py
justcop Jan 31, 2021
f3f2a19
Update infowindow.py
justcop Jan 31, 2021
3ac9c49
Update infowindow.py
justcop Jan 31, 2021
a91051f
Update mod_todoist.py
justcop Jan 31, 2021
c97d998
Update infowindow.py
justcop Jan 31, 2021
c43b68f
Update infowindow.py
justcop Jan 31, 2021
3edacce
Update infowindow.py
justcop Jan 31, 2021
56178cc
Update infowindow.py
justcop Jan 31, 2021
0bdf383
Update infowindow.py
justcop Jan 31, 2021
0079fd5
Update infowindow.py
justcop Jan 31, 2021
26bc99e
Update infowindow.py
justcop Jan 31, 2021
ba628dc
Update infowindow.py
justcop Jan 31, 2021
814821a
Update infowindow.py
justcop Jan 31, 2021
88ced3b
Update infowindow.py
justcop Jan 31, 2021
166a451
Update infowindow.py
justcop Jan 31, 2021
70946ec
Update infowindow.py
justcop Jan 31, 2021
ff9851a
Update infowindow.py
justcop Jan 31, 2021
c603c52
Update infowindow.py
justcop Jan 31, 2021
dfe812c
Update infowindow.py
justcop Jan 31, 2021
c6b7960
Update infowindow.py
justcop Jan 31, 2021
39cbac8
Update infowindow.py
justcop Jan 31, 2021
b573e4b
Update infowindow.py
justcop Jan 31, 2021
3b03290
Update mod_grocy.py
justcop Jan 31, 2021
ceafb32
Update infowindow.py
justcop Jan 31, 2021
664b2bd
Update infowindow.py
justcop Jan 31, 2021
2ea0632
Update infowindow.py
justcop Jan 31, 2021
c5a6a90
Update infowindow.py
justcop Jan 31, 2021
22c2686
Update infowindow.py
justcop Jan 31, 2021
4e8ccb6
Update infowindow.py
justcop Jan 31, 2021
97e06d5
Update infowindow.py
justcop Jan 31, 2021
29328b5
Update infowindow.py
justcop Jan 31, 2021
47f103f
Update infowindow.py
justcop Jan 31, 2021
b8a8191
Update infowindow.py
justcop Jan 31, 2021
73ddc43
Update infowindow.py
justcop Jan 31, 2021
1bfe438
Update infowindow.py
justcop Jan 31, 2021
e63d081
Update infowindow.py
justcop Jan 31, 2021
b115bc0
Update infowindow.py
justcop Feb 1, 2021
0a03654
Update infowindow.py
justcop Feb 1, 2021
7438f85
Update infowindow.py
justcop Feb 1, 2021
85e763b
Update infowindow.py
justcop Feb 1, 2021
3d6e2d6
Update infowindow.py
justcop Feb 1, 2021
6a97e82
Update infowindow.py
justcop Feb 1, 2021
41092f9
Delete infowindow.jpg
justcop Feb 1, 2021
d47e1fb
Update infowindow.py
justcop Feb 1, 2021
78175d6
Update infowindow.py
justcop Feb 1, 2021
e5455ab
Update infowindow.py
justcop Feb 1, 2021
3291925
Update infowindow.py
justcop Feb 1, 2021
06bbc3f
Update infowindow.py
justcop Feb 1, 2021
d802f18
Update infowindow.py
justcop Feb 1, 2021
3c051a1
Update infowindow.py
justcop Feb 1, 2021
a3a9b40
Update mod_todoist.py
justcop Feb 1, 2021
5d1e10b
Update mod_todoist.py
justcop Feb 1, 2021
9afcfd0
Update mod_todoist.py
justcop Feb 1, 2021
2e6a709
Update mod_todoist.py
justcop Feb 1, 2021
f1e6c92
Delete mod_infowindow/resources directory
justcop Feb 1, 2021
93262b0
Delete mod_infowindow/mod_weather directory
justcop Feb 1, 2021
9f5be13
Delete mod_infowindow/mod_utils directory
justcop Feb 1, 2021
8c4a486
Delete mod_infowindow/mod_calendar directory
justcop Feb 1, 2021
87e43f1
Delete mod_infowindow/mod_infowindow directory
justcop Feb 1, 2021
67cf905
Update mod_todoist.py
justcop Feb 1, 2021
2fc8f5d
Update mod_todoist.py
justcop Feb 1, 2021
56bd0a4
Update mod_todoist.py
justcop Feb 1, 2021
15bf0f7
Update mod_todoist.py
justcop Feb 1, 2021
ef005ab
Update mod_todoist.py
justcop Feb 1, 2021
1ab0110
Update mod_todoist.py
justcop Feb 1, 2021
6e7311d
Update mod_todoist.py
justcop Feb 1, 2021
d245a90
Delete mod_infowindow/mod_todo directory
justcop Feb 1, 2021
de1854b
Update infowindow.py
justcop Feb 1, 2021
ae5c633
Update infowindow.py
justcop Feb 1, 2021
56ec3d1
Update infowindow.py
justcop Feb 1, 2021
8c04132
Update infowindow.py
justcop Feb 1, 2021
4f6291a
Update infowindow.py
justcop Feb 1, 2021
d7ba604
Update infowindow.py
justcop Feb 1, 2021
6317461
Update infowindow.py
justcop Feb 1, 2021
4c14325
Update infowindow.py
justcop Feb 1, 2021
6bf9daa
Update infowindow.py
justcop Feb 2, 2021
0bc9963
Update infowindow.py
justcop Feb 2, 2021
47da46b
Update infowindow.py
justcop Feb 2, 2021
b93e5d9
Update mod_google.py
justcop Feb 2, 2021
705a162
Update mod_google.py
justcop Feb 2, 2021
5a74749
Update mod_google.py
justcop Feb 2, 2021
bde823d
Update mod_google.py
justcop Feb 2, 2021
99a97f9
Update mod_google.py
justcop Feb 2, 2021
b7dab42
Update mod_google.py
justcop Feb 2, 2021
6d0baba
Update mod_google.py
justcop Feb 2, 2021
42776be
Update mod_google.py
justcop Feb 2, 2021
d85fe50
Update infowindow.py
justcop Feb 2, 2021
74104a1
Update config.json-sample
justcop Feb 6, 2021
8c85dfd
Update infowindow.py
justcop Feb 6, 2021
f7303d3
Update infowindow.py
justcop Feb 6, 2021
ccb5e54
Update infowindow.py
justcop Feb 6, 2021
cd3e73e
Update infowindow.py
justcop Feb 6, 2021
cd8859b
Update mod_grocy.py
justcop Feb 6, 2021
922958c
Update infowindow.py
justcop Mar 11, 2021
362522d
Update infowindow.py
justcop Mar 11, 2021
059a81c
Update infowindow.py
justcop Mar 11, 2021
345caa1
Update infowindow.py
justcop Mar 11, 2021
33b0818
Update infowindow.py
justcop Mar 11, 2021
8127ed7
Update infowindow.py
justcop Mar 11, 2021
ea99c51
Update infowindow.py
justcop Mar 11, 2021
c0f1c71
Update infowindow.py
justcop Apr 12, 2021
9c69441
Update infowindow.py
justcop Apr 12, 2021
179267c
Update mod_google.py
justcop May 10, 2021
d250926
Update mod_google.py
justcop May 10, 2021
ec0b3c1
Update infowindow.py
justcop Jul 9, 2021
0885029
Update infowindow.py
justcop Jul 14, 2021
6d1a5f1
Update infowindow.py
justcop Jul 14, 2021
7081f77
Update infowindow.py
justcop Jul 14, 2021
56f2243
Update infowindow.py
justcop Jul 14, 2021
7a094e0
Update infowindow.py
justcop Jul 14, 2021
f809a27
Update infowindow.py
justcop Jul 14, 2021
dd5b182
Update infowindow.py
justcop Jul 14, 2021
060c036
Update infowindow.py
justcop Jul 14, 2021
817429d
Update infowindow.py
justcop Jul 14, 2021
88dda06
Update infowindow.py
justcop Jul 14, 2021
b4fee13
Update infowindow.py
justcop Jul 14, 2021
d48263f
Update infowindow.py
justcop Jul 14, 2021
ed26b22
Update infowindow.py
justcop Jul 14, 2021
f66b169
Update infowindow.py
justcop Jul 14, 2021
98ecf83
Update infowindow.py
justcop Jul 14, 2021
743f1f7
Update infowindow.py
justcop Oct 23, 2021
31f0019
Update infowindow.py
justcop Oct 23, 2021
ee56181
Update infowindow.py
justcop Oct 24, 2021
f8f4a69
Update infowindow.py
justcop Oct 24, 2021
0a1f480
Update infowindow.py
justcop Oct 24, 2021
81e11f9
Update infowindow.py
justcop Oct 24, 2021
8b47903
Update infowindow.py
justcop Oct 24, 2021
a329bee
Update infowindow.py
justcop Oct 24, 2021
a022cc1
Update infowindow.py
justcop Oct 24, 2021
28296b7
Update infowindow.py
justcop Oct 23, 2021
95857ae
Revert "Update infowindow.py"
justcop Oct 24, 2021
c68ba48
Update infowindow.py
justcop Oct 24, 2021
27d262b
Merge branch 'master' of https://github.com/justcop/InfoWindow
justcop Oct 24, 2021
8c2dffd
-
justcop Oct 24, 2021
6c1b12e
Update infowindow.py
justcop Oct 24, 2021
760d305
Update infowindow.py
justcop Oct 24, 2021
3703d4a
Update infowindow.py
justcop Oct 24, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified .gitignore
100644 → 100755
Empty file.
102 changes: 6 additions & 96 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,100 +1,10 @@
![alt text](infowindow.jpg)
I've personalised the project for my own use.

I'm using the HD version of the screen, the existing code did not work for this.
I've therefore updated to use with the latest drivers

# Infowindow
Rapsberry pi powered e-ink display for displaying information in an always on state. There are several other iterations
of this project online, but they didnt do quite what I wanted them to. This is my version. Also keeping up my python
skills as they dont get used as much as they used to!
I've removed the weather functions as these were not useful to me.

The functionality is not meant to be an "end all solution for calendaring and Todo lists" The intent is to provide an
*always on* display to show me what is coming up next. I can then check in browser, phone, etc for details and updates
to the data. In your face reminder.
<div align="center">
<a href="#features">Features</a> |
<a href="#installation">Installation</a> |
<a href="#configuration">Configuration</a> |
<a href="#running">Running</a> |
</div>

## Features
* **Calendar**
* Google Calendar is the only calendar currently supported
* **Todo List**
* Todoist
* Teamwork.com
* **Weather**
* Open Weather Map current data only. Future plan for forecast data.

## Installation
### Raspberry Pi setup
Activate SPI on your Raspberry Pi by using the `raspi-config` tool under Interface Options and reboot.

### Get software
Clone this repo onto your raspberry pi. Does not really matter where it is, but good option is in the `pi` users home
directory: `/home/pi/InfoWindow`

### Setup python modules
Run `pip install -r requirements.txt`. This should install all required modules. I stuck to basic standard modules for
ease of installation.

## Configuration
You will need to configure a few things such as API Keys and location. Copy config.json-sample to config.json. Edit
config.json to add your api keys and other information.

## Optional: Increase lifetime of your SD-Card
If you want to increase the lifetime of the SD-Card, add the following line to `/etc/fstab` and reboot:

`tmpfs /tmp tmpfs defaults,noatime,nosuid,size=100m 0 0`

With this line, the `/tmp` folder will be held in RAM and will not be written to the SD-Card.

## Optional: Screen saver
Always displaying the same colors at the same spots might have some negative effect on your E-Ink screen. To remedy
this, there is a simple additional script, which displays all three colors on the whole screen: I recommend to let
this run once every night, i.e. at 1 minute past 5 with:
* Run `crontab -e`
* insert `1 5 * * * /usr/bin/python /home/pi/InfoWindow/screensaver.py > /dev/null 2>&1`

### General
* rotation: 0 - This is the rotation of the display in degrees. Leave at zero if you use it as a desktop display. Change
to 180 if you have it mounted and hanging from a shelf.
* timeformat: 12h / 24h
* charset: utf-8 (or something else). I.e. to get äöü working, use latin1

### Todo (Module)
Todoist is the current active module in this code. It only requires `api_key`. Teamwork also requires a 'site' key. If
using google tasks, leave this as null `todo: null`
* api_key: Enter your todoist API key.

### Weather (Module)
Open Weather Map is where the data is coming from in the default module. This requires a few keys.
* api_key: Get your api key from OWM website.
* city: Look at OWM docs to figure what your city name is. Mine is "Sacramento,US"
* units: This can either be `imperial` or `metric`

### Google calendar and ToDo list (Modules)
To use the google APIs, you first have to login to the [google cloud console](https://console.cloud.google.com/apis/).
In the google cloud console, do the following things:
1) Create a project and give it a name, i.e. `infowindow` and switch to the context of this project if not already
active.
2) Create a [new oauth consent screen](https://console.cloud.google.com/apis/credentials/consent) (just enter a name
should be enough).
3) Create a [new oauth 2.0 client id](https://console.cloud.google.com/apis/credentials). Choosing type `other` should
work just fine. Finally, download the json file provided by the google cloud console and store it in the repo
directory (i.e. `/home/pi/InfoWindow/google_secret.json`) on the Raspberry Pi.

#### Calendar
There are are additional sections in the config for this module:
* additional: A list of additional calendar names (summary) to fetch. To use i.e. birthdays, add "Contacts" (also if
you use google in german.
* ignored: A list of events to be removed from the calendar display.

## Running
### First Run
You should run the script manually the first time so that Googles auth modules can run interactivly. Once that has
completed you will want to add this to CRON so it runs every few minutes automatically.

### Cron Run (Normal use)
* Run `crontab -e`
* insert `*/6 * * * * /usr/bin/python /home/pi/InfoWindow/infowindow.py --cron`
I have added in a todo module to work with "Grocy"

I've left 3 columns each to be used with any todo or calendar app
27 changes: 24 additions & 3 deletions clearScreen.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
from mod_infowindow import infowindow
iw = infowindow.InfoWindow()
iw.display()
#!/usr/bin/python
# -*- coding:utf-8 -*-
import sys
import os
picdir = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), 'pic')
libdir = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), 'lib')
if os.path.exists(libdir):
sys.path.append(libdir)

import logging
from driver import epd7in5b
import time
from PIL import Image,ImageDraw,ImageFont
import traceback

logging.basicConfig(level=logging.DEBUG)

logging.info("epd7in5b_HD Demo")

epd = epd7in5b.EPD()

logging.info("init and Clear")
epd.init()
epd.Clear()
20 changes: 10 additions & 10 deletions config.json-sample
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"general": {
"rotation": 180,
"rotation": 0,
"timeformat": "12h",
"charset": "latin1",
"charset": "utf-8",
"cell_spacing": 2
},
"todo": {
"api_key": "1234"
"api_key": ""
},
"calendar": {
"additional": ["Contacts", "Birthdays"],
"ignored": ["Buy ticket!"],
"today_text_color": "red",
"include": [""],
"ignored": [""],
"today_text_color": "black",
"today_background_color": "white"
},
"weather": {
"api_key": "1234",
"city": "Sacramento,US",
"units": "imperial"
"grocy": {
"api_key": "",
"server": "",
"port": ""
}
}
212 changes: 212 additions & 0 deletions driver/epd7in5b-old.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
##
# @filename : epd7in5.py
# @brief : Implements for Dual-color e-paper library
# @author : Yehui from Waveshare
#
# Copyright (C) Waveshare July 10 2017
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documnetation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#

import epdif
from PIL import Image
import RPi.GPIO as GPIO
import logging

# Display resolution
EPD_WIDTH = 640
EPD_HEIGHT = 384

# EPD7IN5 commands
PANEL_SETTING = 0x00
POWER_SETTING = 0x01
POWER_OFF = 0x02
POWER_OFF_SEQUENCE_SETTING = 0x03
POWER_ON = 0x04
POWER_ON_MEASURE = 0x05
BOOSTER_SOFT_START = 0x06
DEEP_SLEEP = 0x07
DATA_START_TRANSMISSION_1 = 0x10
DATA_STOP = 0x11
DISPLAY_REFRESH = 0x12
IMAGE_PROCESS = 0x13
LUT_FOR_VCOM = 0x20
LUT_BLUE = 0x21
LUT_WHITE = 0x22
LUT_GRAY_1 = 0x23
LUT_GRAY_2 = 0x24
LUT_RED_0 = 0x25
LUT_RED_1 = 0x26
LUT_RED_2 = 0x27
LUT_RED_3 = 0x28
LUT_XON = 0x29
PLL_CONTROL = 0x30
TEMPERATURE_SENSOR_COMMAND = 0x40
TEMPERATURE_CALIBRATION = 0x41
TEMPERATURE_SENSOR_WRITE = 0x42
TEMPERATURE_SENSOR_READ = 0x43
VCOM_AND_DATA_INTERVAL_SETTING = 0x50
LOW_POWER_DETECTION = 0x51
TCON_SETTING = 0x60
TCON_RESOLUTION = 0x61
SPI_FLASH_CONTROL = 0x65
REVISION = 0x70
GET_STATUS = 0x71
AUTO_MEASUREMENT_VCOM = 0x80
READ_VCOM_VALUE = 0x81
VCM_DC_SETTING = 0x82

class EPD:
def __init__(self):
self.reset_pin = epdif.RST_PIN
self.dc_pin = epdif.DC_PIN
self.busy_pin = epdif.BUSY_PIN
self.width = EPD_WIDTH
self.height = EPD_HEIGHT

def digital_write(self, pin, value):
epdif.epd_digital_write(pin, value)

def digital_read(self, pin):
return epdif.epd_digital_read(pin)

def delay_ms(self, delaytime):
epdif.epd_delay_ms(delaytime)

def send_command(self, command):
self.digital_write(self.dc_pin, GPIO.LOW)
# the parameter type is list but not int
# so use [command] instead of command
epdif.spi_transfer([command])

def send_data(self, data):
self.digital_write(self.dc_pin, GPIO.HIGH)
# the parameter type is list but not int
# so use [data] instead of data
epdif.spi_transfer([data])

def init(self):
if (epdif.epd_init() != 0):
return -1
self.reset()
self.send_command(POWER_SETTING)
self.send_data(0x37)
self.send_data(0x00)
self.send_command(PANEL_SETTING)
self.send_data(0xCF)
self.send_data(0x08)
self.send_command(BOOSTER_SOFT_START)
self.send_data(0xc7)
self.send_data(0xcc)
self.send_data(0x28)
self.send_command(POWER_ON)
self.wait_until_idle()
self.send_command(PLL_CONTROL)
self.send_data(0x3c)
self.send_command(TEMPERATURE_CALIBRATION)
self.send_data(0x00)
self.send_command(VCOM_AND_DATA_INTERVAL_SETTING)
self.send_data(0x77)
self.send_command(TCON_SETTING)
self.send_data(0x22)
self.send_command(TCON_RESOLUTION)
self.send_data(0x02) #source 640
self.send_data(0x80)
self.send_data(0x01) #gate 384
self.send_data(0x80)
self.send_command(VCM_DC_SETTING)
self.send_data(0x1E) #decide by LUT file
self.send_command(0xe5) #FLASH MODE
self.send_data(0x03)

def wait_until_idle(self):
while(self.digital_read(self.busy_pin) == 0): # 0: busy, 1: idle
#logging.debug("DRIVER: (wait_until_idle)")
#self.delay_ms(100)
self.delay_ms(50)

def reset(self):
self.digital_write(self.reset_pin, GPIO.LOW) # module reset
self.delay_ms(200)
self.digital_write(self.reset_pin, GPIO.HIGH)
self.delay_ms(200)

def get_frame_buffer(self, image):
buf = [0x00] * int(self.width * self.height / 4)
# Set buffer to value of Python Imaging Library image.
# Image must be in mode L.
image_grayscale = image.convert('L')
imwidth, imheight = image_grayscale.size
if imwidth != self.width or imheight != self.height:
raise ValueError('Image must be same dimensions as display \
({0}x{1}).' .format(self.width, self.height))

pixels = image_grayscale.load()
for y in range(self.height):
for x in range(self.width):
# Set the bits for the column of pixels at the current position.
if pixels[x, y] < 64: # black
buf[int((x + y * self.width) / 4)] &= ~(0xC0 >> (x % 4 * 2))
elif pixels[x, y] < 192: # convert gray to red
buf[int((x + y * self.width) / 4)] &= ~(0xC0 >> (x % 4 * 2))
buf[int((x + y * self.width) / 4)] |= 0x40 >> (x % 4 * 2)
else: # white
buf[int((x + y * self.width) / 4)] |= 0xC0 >> (x % 4 * 2)
return buf

def display_frame(self, frame_buffer):
self.send_command(DATA_START_TRANSMISSION_1)
logging.debug("DRIVER: ENTERING FOR LOOP")
for i in range(0, int(self.width / 4 * self.height)):
temp1 = frame_buffer[i]
j = 0
while (j < 4):
if ((temp1 & 0xC0) == 0xC0):
temp2 = 0x03
elif ((temp1 & 0xC0) == 0x00):
temp2 = 0x00
else:
temp2 = 0x04
temp2 = (temp2 << 4) & 0xFF
temp1 = (temp1 << 2) & 0xFF
j += 1
if((temp1 & 0xC0) == 0xC0):
temp2 |= 0x03
elif ((temp1 & 0xC0) == 0x00):
temp2 |= 0x00
else:
temp2 |= 0x04
temp1 = (temp1 << 2) & 0xFF
self.send_data(temp2)
j += 1
logging.debug("SENDING DISPLAY_REFRESH COMMAND")
self.send_command(DISPLAY_REFRESH)
logging.debug("DELAY 100 MS")
self.delay_ms(100)
logging.debug("WAIT UNTIL IDLE")
self.wait_until_idle()

def sleep(self):
self.send_command(POWER_OFF)
self.wait_until_idle()
self.send_command(DEEP_SLEEP)
self.send_data(0xa5)

### END OF FILE ###

Loading