first save

This commit is contained in:
tiijay
2025-10-19 18:29:10 +02:00
commit b5a30adb27
1303 changed files with 234711 additions and 0 deletions

0
app/display/__init__.py Normal file
View File

View File

@@ -0,0 +1,337 @@
# Emoji symbols for LED matrix (16x16)
emoji_16x16 = {
# Basic Smileys
'😀': [
0x07E0,
0x1FF8,
0x3FFC,
0x7FFE,
0x7FFE,
0xFFFF,
0xFFFF,
0xFFFF,
0xFFFF,
0xFFFF,
0x7FFE,
0x7FFE,
0x3FFC,
0x1FF8,
0x07E0,
0x0000,
], # Grinning face (circle outline)
'😊': [
0x07E0,
0x1FF8,
0x3FFC,
0x7FFE,
0x7C3E,
0xF81F,
0xF00F,
0xF00F,
0xF00F,
0xF00F,
0xF81F,
0x7C3E,
0x7FFE,
0x3FFC,
0x1FF8,
0x07E0,
], # Smiling face
'😂': [
0x07E0,
0x1FF8,
0x3FFC,
0x7FFE,
0x7C3E,
0xF99F,
0xF3CF,
0xF3CF,
0xF3CF,
0xF3CF,
0xF99F,
0x7C3E,
0x7FFE,
0x3FFC,
0x1FF8,
0x07E0,
], # Laughing with tears
'😍': [
0x07E0,
0x1FF8,
0x3FFC,
0x7FFE,
0x7C3E,
0xF81F,
0xF3CF,
0xE7E7,
0xE7E7,
0xF3CF,
0xF81F,
0x7C3E,
0x7FFE,
0x3FFC,
0x1FF8,
0x07E0,
], # Heart eyes
'😎': [
0x07E0,
0x1FF8,
0x3FFC,
0x7FFE,
0x7FFE,
0xFFFF,
0xF00F,
0xF00F,
0xF00F,
0xF00F,
0xFFFF,
0x7FFE,
0x7FFE,
0x3FFC,
0x1FF8,
0x07E0,
], # Cool sunglasses
# Hearts
'❤️': [
0x0000,
0x0000,
0x0C30,
0x1E78,
0x3FFC,
0x7FFE,
0x7FFE,
0xFFFE,
0xFFFC,
0x7FF8,
0x7FF0,
0x3FE0,
0x1FC0,
0x0F80,
0x0700,
0x0000,
], # Red heart
# Weather & Nature
'☀️': [
0x8001,
0x4002,
0x2004,
0x1188,
0x0DB0,
0x07E0,
0x03C0,
0xFFFF,
0xFFFF,
0x03C0,
0x07E0,
0x0DB0,
0x1188,
0x2004,
0x4002,
0x8001,
], # Sun with detailed rays
'🌙': [
0x0000,
0x1F80,
0x3FC0,
0x7FE0,
0xFFF0,
0xFFF8,
0xFFF8,
0xFFF0,
0xFFE0,
0xFFC0,
0xFF80,
0xFF00,
0xFE00,
0xFC00,
0xF800,
0x0000,
], # Crescent moon
'': [
0x0180,
0x0180,
0x03C0,
0x03C0,
0x07E0,
0x0FF0,
0x1FF8,
0x3FFC,
0x3FFC,
0x1FF8,
0x0FF0,
0x07E0,
0x03C0,
0x03C0,
0x0180,
0x0180,
], # Star
# Objects
'📱': [
0xFFFF,
0x8001,
0x8001,
0x9FF9,
0x9009,
0x9009,
0x9009,
0x9009,
0x9009,
0x9009,
0x9009,
0x9009,
0x9FF9,
0x8001,
0x8001,
0xFFFF,
], # Smartphone
'💻': [
0x0000,
0x7FFE,
0x4002,
0x4002,
0x4002,
0x4002,
0x4002,
0x4002,
0x4002,
0x4002,
0x4002,
0x4002,
0x7FFE,
0x3FFC,
0x1FF8,
0x0000,
], # Laptop
# Animals
'🐱': [
0x07E0,
0x1FF8,
0x3FFC,
0x7FFE,
0x7FFE,
0x6FF6,
0x6FF6,
0x6FF6,
0x6FF6,
0x6FF6,
0x7FFE,
0x7FFE,
0x3FFC,
0x1FF8,
0x07E0,
0x0000,
], # Cat face
'🐶': [
0x07E0,
0x1FF8,
0x3FFC,
0x7FFE,
0x7FFE,
0x6FF6,
0x6FF6,
0x6FF6,
0x6FF6,
0x6FF6,
0x7FFE,
0x7FFE,
0x3FFC,
0x1FF8,
0x07E0,
0x0000,
], # Dog face
# Food
'🍕': [
0x07E0,
0x1FF8,
0x3FFC,
0x7FFE,
0x7FFE,
0x7FFE,
0x7FFE,
0x7FFE,
0x7FFE,
0x7FFE,
0x7FFE,
0x7FFE,
0x3FFC,
0x1FF8,
0x07E0,
0x0000,
], # Pizza
# Technology
'🔒': [
0x0FC0,
0x1FE0,
0x3FF0,
0x3FF0,
0x3FF0,
0x3FF0,
0x3FF0,
0x3FF0,
0x3FF0,
0x3FF0,
0x3FF0,
0x3FF0,
0x3FF0,
0x3FF0,
0x3FF0,
0x3FF0,
], # Lock
# Vehicles
'🚗': [
0x0000,
0x0000,
0x0FC0,
0x1FE0,
0x3FF0,
0x3FF0,
0x3FF0,
0x3FF0,
0x3FF0,
0x3FF0,
0x3FF0,
0x3FF0,
0x1FE0,
0x0FC0,
0x0000,
0x0000,
], # Car
# Sports
'': [
0x07E0,
0x1FF8,
0x3FFC,
0x7FFE,
0x7FFE,
0x7FFE,
0x7FFE,
0x7FFE,
0x7FFE,
0x7FFE,
0x7FFE,
0x7FFE,
0x3FFC,
0x1FF8,
0x07E0,
0x0000,
], # Soccer ball
# Holidays
'🎄': [
0x0180,
0x03C0,
0x03C0,
0x07E0,
0x07E0,
0x0FF0,
0x0FF0,
0x1FF8,
0x1FF8,
0x3FFC,
0x3FFC,
0x03C0,
0x03C0,
0x03C0,
0x03C0,
0x03C0,
], # Christmas tree
}

View File

@@ -0,0 +1,81 @@
# Emoji symbols for LED matrix (5x7)
emoji_5x7 = {
# Basic Smileys
'😀': [0x0A, 0x00, 0x11, 0x11, 0x00, 0x11, 0x0E], # Grinning face
'😊': [0x0A, 0x00, 0x11, 0x11, 0x00, 0x0A, 0x04], # Smiling face
'😂': [0x0A, 0x00, 0x1F, 0x11, 0x00, 0x0A, 0x04], # Laughing with tears
'😍': [0x0A, 0x00, 0x15, 0x0E, 0x04, 0x0A, 0x11], # Heart eyes
'😎': [0x0A, 0x00, 0x11, 0x11, 0x0E, 0x1F, 0x00], # Cool sunglasses
'😢': [0x0A, 0x00, 0x11, 0x11, 0x00, 0x0A, 0x04], # Crying face
'😠': [0x0A, 0x00, 0x11, 0x11, 0x00, 0x15, 0x0A], # Angry face
'😴': [0x0A, 0x00, 0x11, 0x11, 0x00, 0x0E, 0x1F], # Sleeping face
# Hearts
'❤️': [0x00, 0x0A, 0x1F, 0x1F, 0x0E, 0x04, 0x00], # Red heart
'💙': [0x00, 0x0A, 0x1F, 0x1F, 0x0E, 0x04, 0x00], # Blue heart
'💚': [0x00, 0x0A, 0x1F, 0x1F, 0x0E, 0x04, 0x00], # Green heart
'💛': [0x00, 0x0A, 0x1F, 0x1F, 0x0E, 0x04, 0x00], # Yellow heart
'💜': [0x00, 0x0A, 0x1F, 0x1F, 0x0E, 0x04, 0x00], # Purple heart
# Hands & Gestures
'👍': [0x04, 0x04, 0x04, 0x04, 0x15, 0x0E, 0x04], # Thumbs up
'👎': [0x04, 0x0E, 0x15, 0x04, 0x04, 0x04, 0x04], # Thumbs down
'👏': [0x00, 0x15, 0x15, 0x15, 0x15, 0x0A, 0x0A], # Clapping hands
'🙌': [0x11, 0x0A, 0x04, 0x04, 0x04, 0x0A, 0x11], # Raising hands
# Common Symbols
'': [0x04, 0x04, 0x1F, 0x0E, 0x1F, 0x04, 0x04], # Star
'🌟': [0x04, 0x15, 0x0E, 0x1F, 0x0E, 0x15, 0x04], # Glowing star
'🎉': [0x04, 0x1F, 0x04, 0x1F, 0x04, 0x0A, 0x11], # Party popper
'🎂': [0x0E, 0x11, 0x1F, 0x1F, 0x1F, 0x0A, 0x1F], # Birthday cake
# Weather & Nature
'☀️': [0x11, 0x0A, 0x1F, 0x0E, 0x1F, 0x0A, 0x11], # Sun
'🌙': [0x0C, 0x12, 0x12, 0x0C, 0x00, 0x00, 0x00], # Crescent moon
'☁️': [0x00, 0x0E, 0x1F, 0x1F, 0x1F, 0x00, 0x00], # Cloud
'🌧️': [0x0E, 0x1F, 0x1F, 0x0A, 0x04, 0x0A, 0x04], # Cloud with rain
'': [0x04, 0x04, 0x06, 0x1C, 0x04, 0x04, 0x04], # Lightning
'❄️': [0x0A, 0x1F, 0x0A, 0x04, 0x0A, 0x1F, 0x0A], # Snowflake
# Objects
'📱': [0x1F, 0x11, 0x15, 0x15, 0x15, 0x11, 0x1F], # Mobile phone
'💻': [0x1F, 0x11, 0x11, 0x11, 0x11, 0x11, 0x1F], # Laptop
'': [0x0E, 0x11, 0x15, 0x15, 0x15, 0x11, 0x0E], # Watch
'🔑': [0x04, 0x0E, 0x04, 0x0E, 0x15, 0x15, 0x0E], # Key
# Arrows
'⬆️': [0x04, 0x0E, 0x15, 0x04, 0x04, 0x04, 0x04], # Up arrow
'⬇️': [0x04, 0x04, 0x04, 0x04, 0x15, 0x0E, 0x04], # Down arrow
'⬅️': [0x04, 0x08, 0x1F, 0x08, 0x04, 0x00, 0x00], # Left arrow
'➡️': [0x04, 0x02, 0x1F, 0x02, 0x04, 0x00, 0x00], # Right arrow
# Status Indicators
'': [0x00, 0x01, 0x02, 0x14, 0x08, 0x00, 0x00], # Check mark button
'': [0x11, 0x0A, 0x04, 0x0A, 0x11, 0x00, 0x00], # Cross mark
'⚠️': [0x04, 0x04, 0x04, 0x15, 0x0E, 0x04, 0x04], # Warning
'🚨': [0x04, 0x0E, 0x1F, 0x04, 0x1F, 0x04, 0x04], # Alarm
# Food & Drink
'🍕': [0x0E, 0x1F, 0x1F, 0x15, 0x1F, 0x1F, 0x0E], # Pizza
'🍎': [0x04, 0x0A, 0x11, 0x1F, 0x1F, 0x0E, 0x04], # Apple
'': [0x0E, 0x11, 0x1F, 0x11, 0x0E, 0x04, 0x04], # Coffee
# Animals
'🐱': [0x0E, 0x0A, 0x0E, 0x1F, 0x15, 0x11, 0x0A], # Cat face
'🐶': [0x0E, 0x0A, 0x0E, 0x1F, 0x15, 0x15, 0x0A], # Dog face
'🐭': [0x0C, 0x12, 0x0C, 0x1E, 0x0B, 0x0B, 0x06], # Mouse face
# Holidays
'🎄': [0x04, 0x04, 0x0E, 0x0E, 0x1F, 0x04, 0x04], # Christmas tree
'🎃': [0x0E, 0x15, 0x1F, 0x1B, 0x1F, 0x15, 0x0E], # Jack-o-lantern
'🎅': [0x04, 0x0E, 0x04, 0x0E, 0x1F, 0x0A, 0x04], # Santa Claus
# Technology
'🔒': [0x0E, 0x11, 0x11, 0x1F, 0x1B, 0x1B, 0x1F], # Locked
'🔓': [0x0E, 0x10, 0x10, 0x1F, 0x1B, 0x1B, 0x1F], # Unlocked
'🔋': [0x1F, 0x11, 0x15, 0x15, 0x15, 0x11, 0x1F], # Battery
'🔍': [0x00, 0x0E, 0x01, 0x0D, 0x15, 0x15, 0x0D], # Magnifying glass
# Music
'🎵': [0x02, 0x03, 0x02, 0x0E, 0x1E, 0x0C, 0x00], # Music note
'🎶': [0x0A, 0x0A, 0x0A, 0x0A, 0x0E, 0x0E, 0x04], # Multiple music notes
# Sports
'': [0x0E, 0x11, 0x15, 0x15, 0x15, 0x11, 0x0E], # Soccer ball
'🏀': [0x0E, 0x11, 0x17, 0x15, 0x17, 0x11, 0x0E], # Basketball
# Time
'🕐': [0x0E, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0E], # One o'clock
'🕒': [0x0E, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0E], # Three o'clock
'🕔': [0x0E, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0E], # Five o'clock
# Miscellaneous
'💡': [0x04, 0x0A, 0x0A, 0x0A, 0x1F, 0x0E, 0x04], # Light bulb
'💰': [0x00, 0x1F, 0x15, 0x1F, 0x15, 0x1F, 0x00], # Money bag
'🎁': [0x1F, 0x11, 0x1F, 0x1F, 0x0A, 0x0A, 0x0A], # Wrapped gift
}

View File

@@ -0,0 +1,52 @@
# Emoji symbols for LED matrix (8x8)
emoji_8x8 = {
# Basic Smileys
'😀': [0x3C, 0x42, 0xA5, 0x81, 0xA5, 0x99, 0x42, 0x3C], # Grinning face
'😊': [0x3C, 0x42, 0xA5, 0x81, 0x81, 0x99, 0x42, 0x3C], # Smiling face
'😂': [0x3C, 0x42, 0xA5, 0x89, 0x89, 0x95, 0x42, 0x3C], # Laughing with tears
'😍': [0x3C, 0x42, 0xA5, 0x81, 0x99, 0x66, 0x42, 0x3C], # Heart eyes
'😎': [0x3C, 0x42, 0xA5, 0x81, 0x81, 0xFF, 0x7E, 0x3C], # Cool sunglasses
'😢': [0x3C, 0x42, 0xA5, 0x81, 0x81, 0x99, 0x52, 0x3C], # Crying face
'😠': [0x3C, 0x42, 0xA5, 0x81, 0x81, 0x99, 0x5A, 0x3C], # Angry face
'😴': [0x3C, 0x42, 0xA5, 0x81, 0x81, 0x81, 0x7E, 0x3C], # Sleeping face
# Hearts
'💙': [0x00, 0x66, 0xFF, 0xFF, 0xFF, 0x7E, 0x3C, 0x18], # Blue heart
'💚': [0x00, 0x66, 0xFF, 0xFF, 0xFF, 0x7E, 0x3C, 0x18], # Green heart
'❤️': [0x00, 0x66, 0xFF, 0xFF, 0xFF, 0x7E, 0x3C, 0x18], # Red heart !!! NOT WORKING !!!
'💛': [0x00, 0x66, 0xFF, 0xFF, 0xFF, 0x7E, 0x3C, 0x18], # Yellow heart
# Hands & Gestures
'👍': [0x18, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x3C, 0x18], # Thumbs up
'👎': [0x18, 0x3C, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x18], # Thumbs down
'👏': [0x00, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x3C, 0x18], # Clapping hands
# Common Symbols
'': [0x18, 0x18, 0x3C, 0xFF, 0xFF, 0x3C, 0x18, 0x18], # Star
'🌟': [0x18, 0x3C, 0x7E, 0xFF, 0xFF, 0x7E, 0x3C, 0x18], # Glowing star
'🎉': [0x18, 0x3C, 0x7E, 0x18, 0x18, 0x7E, 0x3C, 0x18], # Party popper
# Weather & Nature
'☀️': [0x42, 0x81, 0x5A, 0x3C, 0x3C, 0x5A, 0x81, 0x42], # Sun with rays
'🌙': [0x3C, 0x42, 0x84, 0x84, 0x84, 0x84, 0x42, 0x3C], # Crescent moon
'☁️': [0x00, 0x3C, 0x7E, 0xFF, 0xFF, 0x7E, 0x3C, 0x00], # Cloud
'🌧️': [0x3C, 0x7E, 0xFF, 0xFF, 0x24, 0x48, 0x24, 0x48], # Cloud with rain
'': [0x08, 0x0C, 0x0E, 0xFF, 0x0E, 0x0C, 0x08, 0x00], # Lightning
# Objects
'📱': [0xFF, 0x81, 0xBD, 0xA5, 0xA5, 0xBD, 0x81, 0xFF], # Mobile phone
'💻': [0xFF, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xFF], # Laptop
# Arrows
'⬆️': [0x18, 0x3C, 0x7E, 0xFF, 0x18, 0x18, 0x18, 0x18], # Up arrow
'⬇️': [0x18, 0x18, 0x18, 0x18, 0xFF, 0x7E, 0x3C, 0x18], # Down arrow
# Status Indicators
'': [0x00, 0x01, 0x03, 0x16, 0x6C, 0xD8, 0x70, 0x20], # Check mark
'': [0x81, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x81], # Cross mark
# Food & Drink
'🍕': [0x3C, 0x7E, 0xFF, 0xDB, 0xFF, 0x7E, 0x3C, 0x00], # Pizza
'🍎': [0x18, 0x3C, 0x7E, 0xFF, 0xFF, 0x7E, 0x3C, 0x18], # Apple
# Animals
'🐱': [0x3C, 0x42, 0x99, 0xA5, 0xA5, 0x99, 0x5A, 0x3C], # Cat face
'🐶': [0x3C, 0x42, 0x99, 0xA5, 0xA5, 0x99, 0x42, 0x3C], # Dog face
# Music
'🎵': [0x00, 0x03, 0x0F, 0x3F, 0x3F, 0x0F, 0x03, 0x00], # Music note
# Sports
'': [0x3C, 0x42, 0x81, 0x81, 0x81, 0x81, 0x42, 0x3C], # Soccer ball
# Miscellaneous
'💡': [0x18, 0x3C, 0x7E, 0xFF, 0xFF, 0x7E, 0x3C, 0x18], # Light bulb
}

View File

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,90 @@
font_3x5 = {
# Uppercase Letters
'A': [0x07, 0x05, 0x07],
'B': [0x07, 0x07, 0x07],
'C': [0x07, 0x01, 0x07],
'D': [0x06, 0x05, 0x06],
'E': [0x07, 0x03, 0x07],
'F': [0x07, 0x03, 0x01],
'G': [0x07, 0x05, 0x07],
'H': [0x05, 0x07, 0x05],
'I': [0x07, 0x02, 0x07],
'J': [0x04, 0x05, 0x07],
'K': [0x05, 0x03, 0x05],
'L': [0x01, 0x01, 0x07],
'M': [0x07, 0x07, 0x05],
'N': [0x07, 0x05, 0x05],
'O': [0x07, 0x05, 0x07],
'P': [0x07, 0x07, 0x01],
'Q': [0x07, 0x05, 0x07],
'R': [0x07, 0x07, 0x05],
'S': [0x07, 0x07, 0x07],
'T': [0x07, 0x02, 0x02],
'U': [0x05, 0x05, 0x07],
'V': [0x05, 0x05, 0x02],
'W': [0x05, 0x07, 0x07],
'X': [0x05, 0x02, 0x05],
'Y': [0x05, 0x07, 0x02],
'Z': [0x07, 0x02, 0x07],
# Numbers
'0': [0x07, 0x05, 0x07],
'1': [0x02, 0x02, 0x02],
'2': [0x07, 0x07, 0x07],
'3': [0x07, 0x07, 0x07],
'4': [0x05, 0x07, 0x04],
'5': [0x07, 0x07, 0x07],
'6': [0x07, 0x07, 0x07],
'7': [0x07, 0x04, 0x04],
'8': [0x07, 0x07, 0x07],
'9': [0x07, 0x07, 0x07],
# Lowercase (limited)
'a': [0x06, 0x07, 0x07],
'b': [0x01, 0x07, 0x07],
'c': [0x07, 0x01, 0x07],
'd': [0x04, 0x07, 0x07],
'e': [0x07, 0x07, 0x03],
'f': [0x06, 0x07, 0x02],
'g': [0x07, 0x07, 0x06],
'h': [0x01, 0x07, 0x05],
'i': [0x02, 0x00, 0x02],
'j': [0x04, 0x00, 0x06],
'k': [0x01, 0x06, 0x05],
'l': [0x02, 0x02, 0x02],
'm': [0x07, 0x07, 0x05],
'n': [0x07, 0x05, 0x05],
'o': [0x07, 0x05, 0x07],
'p': [0x07, 0x07, 0x01],
'q': [0x07, 0x07, 0x04],
'r': [0x07, 0x01, 0x01],
's': [0x07, 0x07, 0x07],
't': [0x02, 0x07, 0x02],
'u': [0x05, 0x05, 0x07],
'v': [0x05, 0x05, 0x02],
'w': [0x05, 0x07, 0x07],
'x': [0x05, 0x02, 0x05],
'y': [0x05, 0x07, 0x02],
'z': [0x07, 0x02, 0x07],
# Punctuation
' ': [0x00, 0x00, 0x00],
'.': [0x00, 0x00, 0x02],
',': [0x00, 0x00, 0x02],
'!': [0x02, 0x02, 0x00],
'?': [0x07, 0x06, 0x02],
':': [0x00, 0x02, 0x00],
';': [0x00, 0x02, 0x02],
'-': [0x00, 0x07, 0x00],
'_': [0x00, 0x00, 0x07],
'+': [0x02, 0x07, 0x02],
'=': [0x07, 0x00, 0x07],
'(': [0x02, 0x01, 0x02],
')': [0x02, 0x04, 0x02],
'[': [0x03, 0x01, 0x03],
']': [0x06, 0x04, 0x06],
'/': [0x04, 0x02, 0x01],
'\\': [0x01, 0x02, 0x04],
'*': [0x05, 0x02, 0x05],
'"': [0x05, 0x00, 0x00],
"'": [0x02, 0x00, 0x00],
'°': [0x02, 0x05, 0x02], # Degree symbol
'|': [0x02, 0x02, 0x02], # Vertical bar
}

View File

@@ -0,0 +1,109 @@
# fonts.py - Ready-to-use fonts for LED matrix
# 5x7 Font (Medium)
font_5x7 = {
# Uppercase letters (A-Z)
'A': [0x0E, 0x11, 0x11, 0x1F, 0x11, 0x11, 0x11],
'B': [0x1E, 0x11, 0x11, 0x1E, 0x11, 0x11, 0x1E],
'C': [0x0E, 0x11, 0x10, 0x10, 0x10, 0x11, 0x0E],
'D': [0x1E, 0x11, 0x11, 0x11, 0x11, 0x11, 0x1E],
'E': [0x1F, 0x10, 0x10, 0x1E, 0x10, 0x10, 0x1F],
'F': [0x1F, 0x10, 0x10, 0x1E, 0x10, 0x10, 0x10],
'G': [0x0E, 0x11, 0x10, 0x13, 0x11, 0x11, 0x0F],
'H': [0x11, 0x11, 0x11, 0x1F, 0x11, 0x11, 0x11],
'I': [0x0E, 0x04, 0x04, 0x04, 0x04, 0x04, 0x0E],
'J': [0x07, 0x02, 0x02, 0x02, 0x02, 0x12, 0x0C],
'K': [0x11, 0x12, 0x14, 0x18, 0x14, 0x12, 0x11],
'L': [0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1F],
'M': [0x11, 0x1B, 0x15, 0x15, 0x11, 0x11, 0x11],
'N': [0x11, 0x19, 0x19, 0x15, 0x13, 0x13, 0x11],
'O': [0x0E, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0E],
'P': [0x1E, 0x11, 0x11, 0x1E, 0x10, 0x10, 0x10],
'Q': [0x0E, 0x11, 0x11, 0x11, 0x15, 0x12, 0x0D],
'R': [0x1E, 0x11, 0x11, 0x1E, 0x14, 0x12, 0x11],
'S': [0x0F, 0x10, 0x10, 0x0E, 0x01, 0x01, 0x1E],
'T': [0x1F, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04],
'U': [0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0E],
'V': [0x11, 0x11, 0x11, 0x11, 0x11, 0x0A, 0x04],
'W': [0x11, 0x11, 0x11, 0x15, 0x15, 0x15, 0x0A],
'X': [0x11, 0x11, 0x0A, 0x04, 0x0A, 0x11, 0x11],
'Y': [0x11, 0x11, 0x0A, 0x04, 0x04, 0x04, 0x04],
'Z': [0x1F, 0x01, 0x02, 0x04, 0x08, 0x10, 0x1F],
# Lowercase letters (a-z)
'a': [0x00, 0x00, 0x0E, 0x01, 0x0F, 0x11, 0x0F],
'b': [0x10, 0x10, 0x16, 0x19, 0x11, 0x11, 0x1E],
'c': [0x00, 0x00, 0x0E, 0x11, 0x10, 0x11, 0x0E],
'd': [0x01, 0x01, 0x0D, 0x13, 0x11, 0x11, 0x0F],
'e': [0x00, 0x00, 0x0E, 0x11, 0x1F, 0x10, 0x0E],
'f': [0x06, 0x09, 0x08, 0x1C, 0x08, 0x08, 0x08],
'g': [0x00, 0x0F, 0x11, 0x11, 0x0F, 0x01, 0x0E],
'h': [0x10, 0x10, 0x16, 0x19, 0x11, 0x11, 0x11],
'i': [0x04, 0x00, 0x0C, 0x04, 0x04, 0x04, 0x0E],
'j': [0x02, 0x00, 0x06, 0x02, 0x02, 0x12, 0x0C],
'k': [0x10, 0x10, 0x12, 0x14, 0x18, 0x14, 0x12],
'l': [0x0C, 0x04, 0x04, 0x04, 0x04, 0x04, 0x0E],
'm': [0x00, 0x00, 0x1A, 0x15, 0x15, 0x15, 0x15],
'n': [0x00, 0x00, 0x16, 0x19, 0x11, 0x11, 0x11],
'o': [0x00, 0x00, 0x0E, 0x11, 0x11, 0x11, 0x0E],
'p': [0x00, 0x00, 0x1E, 0x11, 0x1E, 0x10, 0x10],
'q': [0x00, 0x00, 0x0D, 0x13, 0x0F, 0x01, 0x01],
'r': [0x00, 0x00, 0x16, 0x19, 0x10, 0x10, 0x10],
's': [0x00, 0x00, 0x0E, 0x10, 0x0E, 0x01, 0x1E],
't': [0x08, 0x08, 0x1C, 0x08, 0x08, 0x09, 0x06],
'u': [0x00, 0x00, 0x11, 0x11, 0x11, 0x13, 0x0D],
'v': [0x00, 0x00, 0x11, 0x11, 0x11, 0x0A, 0x04],
'w': [0x00, 0x00, 0x11, 0x11, 0x15, 0x15, 0x0A],
'x': [0x00, 0x00, 0x11, 0x0A, 0x04, 0x0A, 0x11],
'y': [0x00, 0x00, 0x11, 0x11, 0x0F, 0x01, 0x0E],
'z': [0x00, 0x00, 0x1F, 0x02, 0x04, 0x08, 0x1F],
# Numbers (0-9)
'0': [0x0E, 0x11, 0x13, 0x15, 0x19, 0x11, 0x0E],
'1': [0x04, 0x0C, 0x04, 0x04, 0x04, 0x04, 0x0E],
'2': [0x0E, 0x11, 0x01, 0x02, 0x04, 0x08, 0x1F],
'3': [0x1F, 0x02, 0x04, 0x02, 0x01, 0x11, 0x0E],
'4': [0x02, 0x06, 0x0A, 0x12, 0x1F, 0x02, 0x02],
'5': [0x1F, 0x10, 0x1E, 0x01, 0x01, 0x11, 0x0E],
'6': [0x06, 0x08, 0x10, 0x1E, 0x11, 0x11, 0x0E],
'7': [0x1F, 0x01, 0x02, 0x04, 0x08, 0x08, 0x08],
'8': [0x0E, 0x11, 0x11, 0x0E, 0x11, 0x11, 0x0E],
'9': [0x0E, 0x11, 0x11, 0x0F, 0x01, 0x02, 0x0C],
# Punctuation and symbols
' ': [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00],
'!': [0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x04],
'?': [0x0E, 0x11, 0x02, 0x04, 0x04, 0x00, 0x04],
'.': [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04],
',': [0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x08],
':': [0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x00],
';': [0x00, 0x00, 0x04, 0x00, 0x00, 0x04, 0x08],
"'": [0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00],
'"': [0x0A, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00],
'-': [0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00],
'_': [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F],
'+': [0x00, 0x04, 0x04, 0x1F, 0x04, 0x04, 0x00],
'=': [0x00, 0x00, 0x1F, 0x00, 0x1F, 0x00, 0x00],
'*': [0x00, 0x0A, 0x04, 0x1F, 0x04, 0x0A, 0x00],
'/': [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x00],
'\\': [0x00, 0x10, 0x08, 0x04, 0x02, 0x01, 0x00],
'(': [0x02, 0x04, 0x08, 0x08, 0x08, 0x04, 0x02],
')': [0x08, 0x04, 0x02, 0x02, 0x02, 0x04, 0x08],
'[': [0x0E, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0E],
']': [0x0E, 0x02, 0x02, 0x02, 0x02, 0x02, 0x0E],
'{': [0x06, 0x04, 0x04, 0x08, 0x04, 0x04, 0x06],
'}': [0x0C, 0x04, 0x04, 0x02, 0x04, 0x04, 0x0C],
'<': [0x00, 0x01, 0x02, 0x04, 0x02, 0x01, 0x00],
'>': [0x00, 0x08, 0x04, 0x02, 0x04, 0x08, 0x00],
'@': [0x0E, 0x11, 0x17, 0x15, 0x17, 0x10, 0x0E],
'#': [0x0A, 0x0A, 0x1F, 0x0A, 0x1F, 0x0A, 0x0A],
'$': [0x04, 0x0F, 0x14, 0x0E, 0x05, 0x1E, 0x04],
'%': [0x18, 0x19, 0x02, 0x04, 0x08, 0x13, 0x03],
'&': [0x0C, 0x12, 0x14, 0x08, 0x15, 0x12, 0x0D],
'^': [0x04, 0x0A, 0x11, 0x00, 0x00, 0x00, 0x00],
'~': [0x00, 0x00, 0x00, 0x0D, 0x12, 0x00, 0x00],
# Special characters
'°': [0x0E, 0x0A, 0x0E, 0x00, 0x00, 0x00, 0x00], # Degree symbol
'|': [0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04], # Vertical bar
'`': [0x08, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00], # Backtick
'': [0x1E, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A, 0x1A], # Paragraph symbol
'': [0x00, 0x00, 0x04, 0x0E, 0x04, 0x00, 0x00], # Bullet point
}

View File

@@ -0,0 +1,109 @@
font_8x8 = {
# Uppercase Letters
'A': [0x18, 0x3C, 0x66, 0x66, 0x7E, 0x66, 0x66, 0x00],
'B': [0x7C, 0x66, 0x66, 0x7C, 0x66, 0x66, 0x7C, 0x00],
'C': [0x3C, 0x66, 0x60, 0x60, 0x60, 0x66, 0x3C, 0x00],
'D': [0x78, 0x6C, 0x66, 0x66, 0x66, 0x6C, 0x78, 0x00],
'E': [0x7E, 0x60, 0x60, 0x78, 0x60, 0x60, 0x7E, 0x00],
'F': [0x7E, 0x60, 0x60, 0x78, 0x60, 0x60, 0x60, 0x00],
'G': [0x3C, 0x66, 0x60, 0x6E, 0x66, 0x66, 0x3C, 0x00],
'H': [0x66, 0x66, 0x66, 0x7E, 0x66, 0x66, 0x66, 0x00],
'I': [0x3C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00],
'J': [0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0x6C, 0x38, 0x00],
'K': [0x66, 0x6C, 0x78, 0x70, 0x78, 0x6C, 0x66, 0x00],
'L': [0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7E, 0x00],
'M': [0x63, 0x77, 0x7F, 0x6B, 0x63, 0x63, 0x63, 0x00],
'N': [0x66, 0x76, 0x7E, 0x7E, 0x6E, 0x66, 0x66, 0x00],
'O': [0x3C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00],
'P': [0x7C, 0x66, 0x66, 0x7C, 0x60, 0x60, 0x60, 0x00],
'Q': [0x3C, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x0E, 0x00],
'R': [0x7C, 0x66, 0x66, 0x7C, 0x78, 0x6C, 0x66, 0x00],
'S': [0x3C, 0x66, 0x60, 0x3C, 0x06, 0x66, 0x3C, 0x00],
'T': [0x7E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00],
'U': [0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00],
'V': [0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x00],
'W': [0x63, 0x63, 0x63, 0x6B, 0x7F, 0x77, 0x63, 0x00],
'X': [0x66, 0x66, 0x3C, 0x18, 0x3C, 0x66, 0x66, 0x00],
'Y': [0x66, 0x66, 0x66, 0x3C, 0x18, 0x18, 0x18, 0x00],
'Z': [0x7E, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x7E, 0x00],
# Lowercase Letters
'a': [0x00, 0x00, 0x3C, 0x06, 0x3E, 0x66, 0x3E, 0x00],
'b': [0x60, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x7C, 0x00],
'c': [0x00, 0x00, 0x3C, 0x66, 0x60, 0x66, 0x3C, 0x00],
'd': [0x06, 0x06, 0x3E, 0x66, 0x66, 0x66, 0x3E, 0x00],
'e': [0x00, 0x00, 0x3C, 0x66, 0x7E, 0x60, 0x3C, 0x00],
'f': [0x1C, 0x36, 0x30, 0x78, 0x30, 0x30, 0x30, 0x00],
'g': [0x00, 0x00, 0x3E, 0x66, 0x66, 0x3E, 0x06, 0x7C],
'h': [0x60, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x66, 0x00],
'i': [0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x3C, 0x00],
'j': [0x06, 0x00, 0x06, 0x06, 0x06, 0x06, 0x66, 0x3C],
'k': [0x60, 0x60, 0x66, 0x6C, 0x78, 0x6C, 0x66, 0x00],
'l': [0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00],
'm': [0x00, 0x00, 0x66, 0x7F, 0x7F, 0x6B, 0x63, 0x00],
'n': [0x00, 0x00, 0x7C, 0x66, 0x66, 0x66, 0x66, 0x00],
'o': [0x00, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x00],
'p': [0x00, 0x00, 0x7C, 0x66, 0x66, 0x7C, 0x60, 0x60],
'q': [0x00, 0x00, 0x3E, 0x66, 0x66, 0x3E, 0x06, 0x06],
'r': [0x00, 0x00, 0x7C, 0x66, 0x60, 0x60, 0x60, 0x00],
's': [0x00, 0x00, 0x3E, 0x60, 0x3C, 0x06, 0x7C, 0x00],
't': [0x30, 0x30, 0x7C, 0x30, 0x30, 0x30, 0x1C, 0x00],
'u': [0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3E, 0x00],
'v': [0x00, 0x00, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x00],
'w': [0x00, 0x00, 0x63, 0x6B, 0x7F, 0x3E, 0x36, 0x00],
'x': [0x00, 0x00, 0x66, 0x3C, 0x18, 0x3C, 0x66, 0x00],
'y': [0x00, 0x00, 0x66, 0x66, 0x66, 0x3E, 0x0C, 0x78],
'z': [0x00, 0x00, 0x7E, 0x0C, 0x18, 0x30, 0x7E, 0x00],
# Numbers
'0': [0x3C, 0x66, 0x6E, 0x76, 0x66, 0x66, 0x3C, 0x00],
'1': [0x18, 0x38, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x00],
'2': [0x3C, 0x66, 0x06, 0x0C, 0x18, 0x30, 0x7E, 0x00],
'3': [0x3C, 0x66, 0x06, 0x1C, 0x06, 0x66, 0x3C, 0x00],
'4': [0x0C, 0x1C, 0x3C, 0x6C, 0x7E, 0x0C, 0x0C, 0x00],
'5': [0x7E, 0x60, 0x7C, 0x06, 0x06, 0x66, 0x3C, 0x00],
'6': [0x3C, 0x66, 0x60, 0x7C, 0x66, 0x66, 0x3C, 0x00],
'7': [0x7E, 0x06, 0x0C, 0x18, 0x18, 0x18, 0x18, 0x00],
'8': [0x3C, 0x66, 0x66, 0x3C, 0x66, 0x66, 0x3C, 0x00],
'9': [0x3C, 0x66, 0x66, 0x3E, 0x06, 0x66, 0x3C, 0x00],
# Punctuation and Symbols
' ': [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00],
'!': [0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x18, 0x00],
'?': [0x3C, 0x66, 0x0C, 0x18, 0x18, 0x00, 0x18, 0x00],
'.': [0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00],
',': [0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30],
':': [0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00],
';': [0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x30],
"'": [0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00],
'"': [0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00],
'-': [0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00],
'_': [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E],
'+': [0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x00],
'=': [0x00, 0x00, 0x7E, 0x00, 0x7E, 0x00, 0x00, 0x00],
'*': [0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00],
'/': [0x00, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x00, 0x00],
'\\': [0x00, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x00, 0x00],
'(': [0x0C, 0x18, 0x30, 0x30, 0x30, 0x18, 0x0C, 0x00],
')': [0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x18, 0x30, 0x00],
'[': [0x3C, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3C, 0x00],
']': [0x3C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x3C, 0x00],
'{': [0x0E, 0x18, 0x18, 0x70, 0x18, 0x18, 0x0E, 0x00],
'}': [0x70, 0x18, 0x18, 0x0E, 0x18, 0x18, 0x70, 0x00],
'<': [0x00, 0x06, 0x0C, 0x18, 0x0C, 0x06, 0x00, 0x00],
'>': [0x00, 0x60, 0x30, 0x18, 0x30, 0x60, 0x00, 0x00],
'@': [0x3C, 0x42, 0x99, 0xA5, 0xA5, 0x9E, 0x40, 0x3C],
'#': [0x6C, 0x6C, 0xFE, 0x6C, 0xFE, 0x6C, 0x6C, 0x00],
'$': [0x18, 0x3E, 0x60, 0x3C, 0x06, 0x7C, 0x18, 0x00],
'%': [0x62, 0x66, 0x0C, 0x18, 0x30, 0x66, 0x46, 0x00],
'&': [0x3C, 0x66, 0x3C, 0x38, 0x67, 0x66, 0x3F, 0x00],
'^': [0x18, 0x3C, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00],
'~': [0x00, 0x00, 0x00, 0x36, 0x6C, 0x00, 0x00, 0x00],
# Special Characters
'°': [0x1C, 0x22, 0x22, 0x1C, 0x00, 0x00, 0x00, 0x00], # Degree
'|': [0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00], # Vertical bar
'`': [0x18, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], # Backtick
'': [0x3E, 0x7A, 0x7A, 0x7A, 0x3A, 0x0A, 0x0A, 0x00], # Paragraph
'': [0x00, 0x00, 0x18, 0x3C, 0x3C, 0x18, 0x00, 0x00], # Bullet
'': [0x36, 0x7F, 0x7F, 0x7F, 0x3E, 0x1C, 0x08, 0x00], # Heart
'': [0x08, 0x1C, 0x3E, 0x7F, 0x3E, 0x1C, 0x08, 0x00], # Diamond
'': [0x1C, 0x1C, 0x3E, 0x7F, 0x36, 0x1C, 0x3E, 0x00], # Club
'': [0x1C, 0x3E, 0x7F, 0x7F, 0x1C, 0x1C, 0x3E, 0x00], # Spade
}

View File

@@ -0,0 +1,33 @@
from .font_3x5 import font_3x5
from .font_5x7 import font_5x7
from .font_8x8 import font_8x8
from .font_16x16 import font_16x16
from ..emoji.emoji_5x7 import emoji_5x7
from ..emoji.emoji_8x8 import emoji_8x8
from ..emoji.emoji_16x16 import emoji_16x16
fonts_meta_ = {
3: {'w': 3, 'h': 5},
5: {'w': 5, 'h': 7},
8: {'w': 8, 'h': 8},
16: {'w': 16, 'h': 16},
}
def fonts_meta(font):
if font == font_3x5:
return fonts_meta_[3]
elif font == font_5x7:
return fonts_meta_[5]
elif font == font_8x8:
return fonts_meta_[8]
elif font == font_16x16:
return fonts_meta_[16]
elif font == emoji_5x7:
return fonts_meta_[5]
elif font == emoji_8x8:
return fonts_meta_[8]
elif font == emoji_16x16:
return fonts_meta_[16]
else:
return None

View File

@@ -0,0 +1,323 @@
from machine import Pin, RTC
from neopixel import NeoPixel
from .fonts.fonts_utils import fonts_meta
from .fonts.font_5x7 import font_5x7
from ..utils.colors import RAINBOW, BLACK
from ..utils.utils import (
get_german_timestamp_short,
get_datetime_string,
get_german_time_ticks,
get_german_date_ticks,
)
import time
import math
class NeoPixel_64x64(NeoPixel):
MATRIX_WIDTH = 64
MATRIX_HEIGHT = 64
def __init__(self, pin=28):
"""
Initialize LED Display
Args:
width: Matrix width in pixels
height: Matrix height in pixels
pin: NeoPixel data pin
"""
super().__init__(Pin(pin), self.MATRIX_WIDTH * self.MATRIX_HEIGHT)
# Font configuration
self.set_font(font_5x7)
def set_font(self, font):
"""
Set the current font for text rendering
Args:
font: Font dictionary from fonts_array
"""
self.selected_font = font
self.selected_font_meta = fonts_meta(font)
self.font_width = self.selected_font_meta['w']
self.font_height = self.selected_font_meta['h']
print(f'Font set: width: {self.font_width}; height: {self.font_height}')
def set_pixel(self, x, y, color):
"""
Set a single pixel to the specified color
Args:
x: X coordinate
y: Y coordinate
color: RGB color tuple
"""
index = y * self.MATRIX_WIDTH + x
if 0 <= x < self.MATRIX_WIDTH and 0 <= y < self.MATRIX_HEIGHT:
self[index] = color
def clear(self):
"""Clear the entire display (turn off all pixels)"""
for i in range(len(self)):
self[i] = BLACK
self.write()
def clear_row(self, row: int, effect: bool = False) -> None:
"""
Clear one row of the display (turn off all pixels)\n
PRESUMING: font_5x7\n
rows: range(0,3) [row-height: 8 pixels, row-length: MATRIX_WIDTH(64)]\n
\n
row-0: 0 - 511 (Pixel 0 bis Pixel 8 * MATRIX_WIDTH(64)-1)\n
row-1: 512 - 1023\n
row-2: 1024 - 1535\n
row-3: 1536 - 2047\n
etc. ...
"""
start = row * 8 * self.MATRIX_WIDTH
ende = start + 8 * self.MATRIX_WIDTH - 1
print(f'clear row: {row} --> pixels {start} to {ende}')
for i in range(start, ende):
self[i] = BLACK
if effect and i % self.MATRIX_WIDTH == 0:
self.write()
self.write()
def draw_letter(self, letter, x, y, color):
"""
Draw a single letter using current font
Args:
letter: Character to draw
x: X position
y: Y position
color: RGB color tuple
"""
if letter in self.selected_font:
char_data = self.selected_font[letter]
for row in range(self.font_height):
row_data = char_data[row]
for col in range(self.font_width):
# Check if pixel should be lit (MSB first)
if row_data & (1 << ((self.font_width - 1) - col)):
self.set_pixel(x + col, y + row, color)
else:
print(f'oops, letter does not exist in the font -> {letter}')
def draw_text(self, text, x, y, color=RAINBOW[2], spacing=1):
"""
Draw text string at specified position
Args:
text: String to display
x: Starting X position
y: Starting Y position
color: RGB color tuple
spacing: Pixels between characters
"""
for idx, char in enumerate(text):
char_x = x + (idx * (self.font_width + spacing))
self.draw_letter(char, char_x, y, color)
def show_hello(self):
"""Display HELLO with timestamp"""
self.clear()
# Draw HELLO in rainbow colors
self.draw_text('HELLO!', 6, 4, RAINBOW[2])
# Show timestamp
datetimestr = get_german_timestamp_short()
self.draw_text(datetimestr, 2, 15, RAINBOW[4])
self.write()
def vertical_floating_text(
self, text, x, color=RAINBOW[0], float_range=3, speed=0.2, duration=10
):
"""
Vertical floating text animation
Args:
text: Text to display
x: X position (fixed)
color: Text color
float_range: How many pixels to float up/down
speed: Animation speed
duration: How long to run animation in seconds
"""
start_time = time.time()
while time.time() - start_time < duration:
# Calculate floating offset using sine wave
offset = math.sin(time.time() * speed) * float_range
current_y = int(self.MATRIX_HEIGHT // 2 + offset - (len(text) * self.font_height) // 2)
self.clear()
# Draw each letter vertically
for i, char in enumerate(text):
char_y = current_y + (i * self.font_height)
# Keep text within matrix bounds
if 0 <= char_y < self.MATRIX_HEIGHT - self.font_height:
self.draw_letter(char, x, char_y, color)
self.write()
time.sleep(0.05)
def horizontal_floating_text(
self, text, y, color=RAINBOW[0], float_range=3, speed=0.2, duration=10
):
"""
Horizontal floating text animation
Args:
text: Text to display
y: Y position (fixed)
color: Text color
float_range: How many pixels to float left/right
speed: Animation speed
duration: How long to run animation in seconds
"""
start_time = time.time()
text_width = len(text) * (self.font_width + 1)
counter = 0
while time.time() - start_time < duration:
# Calculate floating offset using sine wave
offset = math.sin(counter) * float_range
current_x = int(offset) # to right
self.clear()
# Draw text at floating position
for i, char in enumerate(text):
char_x = current_x + (i * (self.font_width + 1))
# Keep text within matrix bounds
if 0 <= char_x < self.MATRIX_WIDTH - self.font_width:
self.draw_letter(char, char_x, y, color)
self.write()
counter += speed
time.sleep(0.05)
def rotate_text_left_continuous(self, text, y, color=RAINBOW[0], speed=1.0, duration=10):
"""
Continuous left rotation - text wraps around seamlessly
Args:
text: Text to display
y: Y position (fixed)
color: Text color
speed: Movement speed
duration: How long to run animation in seconds
"""
start_time = time.time()
text_width = len(text) * (self.font_width + 1)
position = 0
while time.time() - start_time < duration:
self.clear()
# Draw text at current position
for i, char in enumerate(text):
char_x = int(position + (i * (self.font_width + 1)))
# Handle wrapping
if char_x < -self.font_width:
char_x += self.MATRIX_WIDTH + text_width
if 0 <= char_x < self.MATRIX_WIDTH:
self.draw_letter(char, char_x, y, color)
self.write()
# Move left and wrap around
position -= speed
if position < -text_width:
position = self.MATRIX_WIDTH
time.sleep(0.05)
def draw_rectangle(self, x, y, width, height, color, fill=False):
"""
Draw a rectangle
Args:
x: Top-left X position
y: Top-left Y position
width: Rectangle width
height: Rectangle height
color: RGB color tuple
fill: Whether to fill the rectangle
"""
if fill:
for i in range(height):
for j in range(width):
self.set_pixel(x + j, y + i, color)
else:
# Top and bottom edges
for i in range(width):
self.set_pixel(x + i, y, color)
self.set_pixel(x + i, y + height - 1, color)
# Left and right edges
for i in range(height):
self.set_pixel(x, y + i, color)
self.set_pixel(x + width - 1, y + i, color)
def draw_line(self, x1, y1, x2, y2, color):
"""
Draw a line using Bresenham's algorithm
Args:
x1, y1: Start coordinates
x2, y2: End coordinates
color: RGB color tuple
"""
dx = abs(x2 - x1)
dy = abs(y2 - y1)
sx = 1 if x1 < x2 else -1
sy = 1 if y1 < y2 else -1
err = dx - dy
while True:
self.set_pixel(x1, y1, color)
if x1 == x2 and y1 == y2:
break
e2 = 2 * err
if e2 > -dy:
err -= dy
x1 += sx
if e2 < dx:
err += dx
y1 += sy
# Example usage
if __name__ == '__main__':
# Create display instance
display = NeoPixel_64x64()
print('LED Matrix Display Initialized')
print(get_datetime_string())
print(f'German time: {get_german_time_ticks()}')
print(f'German date: {get_german_date_ticks()}')
# Demo various functions
display.show_hello()
time.sleep(3)
display.vertical_floating_text('HELLO', 30, RAINBOW[0], 5, 0.15, 5)
display.horizontal_floating_text('FLOAT', 28, RAINBOW[1], 10, 0.1, 5)
display.rotate_text_left_continuous('ROTATE FLOAT', 28, speed=8.0, duration=5)
# Draw some shapes
display.clear()
display.draw_rectangle(5, 5, 10, 10, RAINBOW[0])
display.draw_rectangle(20, 20, 15, 8, RAINBOW[2], fill=True)
display.draw_line(0, 0, 63, 63, RAINBOW[4])
display.write()