Skip to content

Instantly share code, notes, and snippets.

View merdok's full-sized avatar
🎯
Focusing

Marcin merdok

🎯
Focusing
View GitHub Profile
@merdok
merdok / SSD1331.py
Created February 4, 2018 19:30 — forked from TheRayTracer/SSD1331.py
The below Python source files control an OLED display (size 96 x 64, 65K colours) using a SSD1331 chipset and the SPI interface. The source code initialises the chipset and includes hardware accelerated functions for drawing primitive shapes and a non-hardware accelerated full ASCII set. Examples include a basic Space Invaders game, and a clock.
import struct
import spidev
import sys
import time
import random
import RPi.GPIO as gpio
ascii = [
[ 0x55, 0x00, 0x55, 0x00, 0x55 ],
[ 0x55, 0x00, 0x55, 0x00, 0x55 ],
__attribute__((constructor)) static void init() {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
if ([[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.springboard"]) {
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, RunCleanCallback, CFSTR("com.merdok.runclean"), NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
}
[pool release];
}