upload ignore file, and added love eyes
This commit is contained in:
parent
f7ed30cafa
commit
9db52065d9
8 changed files with 111 additions and 64 deletions
92
.gitignore
vendored
Normal file
92
.gitignore
vendored
Normal file
|
@ -0,0 +1,92 @@
|
|||
rpi2/c-example.c
|
||||
rpi2/CMakeLists.txt
|
||||
rpi2/build/cmake_install.cmake
|
||||
rpi2/build/CMakeCache.txt
|
||||
rpi2/build/cproot
|
||||
rpi2/build/Makefile
|
||||
rpi2/build/CMakeFiles/cmake.check_cache
|
||||
rpi2/build/CMakeFiles/CMakeDirectoryInformation.cmake
|
||||
rpi2/build/CMakeFiles/CMakeOutput.log
|
||||
rpi2/build/CMakeFiles/Makefile.cmake
|
||||
rpi2/build/CMakeFiles/Makefile2
|
||||
rpi2/build/CMakeFiles/progress.marks
|
||||
rpi2/build/CMakeFiles/TargetDirectories.txt
|
||||
rpi2/build/CMakeFiles/3.18.4/CMakeCCompiler.cmake
|
||||
rpi2/build/CMakeFiles/3.18.4/CMakeCXXCompiler.cmake
|
||||
rpi2/build/CMakeFiles/3.18.4/CMakeDetermineCompilerABI_C.bin
|
||||
rpi2/build/CMakeFiles/3.18.4/CMakeDetermineCompilerABI_CXX.bin
|
||||
rpi2/build/CMakeFiles/3.18.4/CMakeSystem.cmake
|
||||
rpi2/build/CMakeFiles/3.18.4/CompilerIdC/a.out
|
||||
rpi2/build/CMakeFiles/3.18.4/CompilerIdC/CMakeCCompilerId.c
|
||||
rpi2/build/CMakeFiles/3.18.4/CompilerIdCXX/a.out
|
||||
rpi2/build/CMakeFiles/3.18.4/CompilerIdCXX/CMakeCXXCompilerId.cpp
|
||||
rpi2/build/CMakeFiles/cproot.dir/build.make
|
||||
rpi2/build/CMakeFiles/cproot.dir/C.includecache
|
||||
rpi2/build/CMakeFiles/cproot.dir/cmake_clean.cmake
|
||||
rpi2/build/CMakeFiles/cproot.dir/CXX.includecache
|
||||
rpi2/build/CMakeFiles/cproot.dir/depend.internal
|
||||
rpi2/build/CMakeFiles/cproot.dir/depend.make
|
||||
rpi2/build/CMakeFiles/cproot.dir/DependInfo.cmake
|
||||
rpi2/build/CMakeFiles/cproot.dir/flags.make
|
||||
rpi2/build/CMakeFiles/cproot.dir/link.txt
|
||||
rpi2/build/CMakeFiles/cproot.dir/progress.make
|
||||
rpi2/build/CMakeFiles/cproot.dir/src/bdf-font.cc.o
|
||||
rpi2/build/CMakeFiles/cproot.dir/src/c-example.c.o
|
||||
rpi2/build/CMakeFiles/cproot.dir/src/content-streamer.cc.o
|
||||
rpi2/build/CMakeFiles/cproot.dir/src/framebuffer.cc.o
|
||||
rpi2/build/CMakeFiles/cproot.dir/src/gpio.cc.o
|
||||
rpi2/build/CMakeFiles/cproot.dir/src/graphics.cc.o
|
||||
rpi2/build/CMakeFiles/cproot.dir/src/hardware-mapping.c.o
|
||||
rpi2/build/CMakeFiles/cproot.dir/src/led-matrix-c.cc.o
|
||||
rpi2/build/CMakeFiles/cproot.dir/src/led-matrix.cc.o
|
||||
rpi2/build/CMakeFiles/cproot.dir/src/multiplex-mappers.cc.o
|
||||
rpi2/build/CMakeFiles/cproot.dir/src/options-initialize.cc.o
|
||||
rpi2/build/CMakeFiles/cproot.dir/src/pixel-mapper.cc.o
|
||||
rpi2/build/CMakeFiles/cproot.dir/src/thread.cc.o
|
||||
rpi2/lib/.gitignore
|
||||
rpi2/lib/bdf-font.o
|
||||
rpi2/lib/content-streamer.o
|
||||
rpi2/lib/framebuffer.o
|
||||
rpi2/lib/gpio.o
|
||||
rpi2/lib/graphics.o
|
||||
rpi2/lib/hardware-mapping.o
|
||||
rpi2/lib/led-matrix-c.o
|
||||
rpi2/lib/led-matrix.o
|
||||
rpi2/lib/Makefile
|
||||
rpi2/lib/multiplex-mappers.o
|
||||
rpi2/lib/options-initialize.o
|
||||
rpi2/lib/pixel-mapper.o
|
||||
rpi2/lib/thread.o
|
||||
rpi2/src/bdf-font.cc
|
||||
rpi2/src/c-example.c
|
||||
rpi2/src/canvas.h
|
||||
rpi2/src/content-streamer.cc
|
||||
rpi2/src/content-streamer.h
|
||||
rpi2/src/framebuffer-internal.h
|
||||
rpi2/src/framebuffer.cc
|
||||
rpi2/src/gpio-bits.h
|
||||
rpi2/src/gpio.cc
|
||||
rpi2/src/gpio.h
|
||||
rpi2/src/graphics.cc
|
||||
rpi2/src/graphics.h
|
||||
rpi2/src/hardware-mapping.c
|
||||
rpi2/src/hardware-mapping.h
|
||||
rpi2/src/led-matrix-c.cc
|
||||
rpi2/src/led-matrix-c.h
|
||||
rpi2/src/led-matrix.cc
|
||||
rpi2/src/led-matrix.h
|
||||
rpi2/src/multiplex-mappers-internal.h
|
||||
rpi2/src/multiplex-mappers.cc
|
||||
rpi2/src/options-initialize.cc
|
||||
rpi2/src/pixel-mapper.cc
|
||||
rpi2/src/pixel-mapper.h
|
||||
rpi2/src/thread.cc
|
||||
rpi2/src/thread.h
|
||||
rpi2/src/threaded-canvas-manipulator.h
|
||||
rpi2/src/utf8-internal.h
|
||||
rpi2/utils/.gitignore
|
||||
rpi2/utils/Makefile
|
||||
rpi2/utils/README.md
|
||||
rpi/__pycache__/Point2D.cpython-39.pyc
|
||||
rpi/__pycache__/ProotState.cpython-39.pyc
|
||||
rpi/__pycache__/State.cpython-39.pyc
|
BIN
animations/loaded.png
Normal file
BIN
animations/loaded.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 428 B |
BIN
faces/eyeLeftLove.png
Normal file
BIN
faces/eyeLeftLove.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 348 B |
BIN
my_object.pickle
Executable file
BIN
my_object.pickle
Executable file
Binary file not shown.
File diff suppressed because one or more lines are too long
15
rpi/State.py
15
rpi/State.py
|
@ -11,7 +11,8 @@ class StateSingleton:
|
|||
0: "open",
|
||||
1: "blink",
|
||||
2: "stun",
|
||||
3: "angry"}
|
||||
3: "angry",
|
||||
4: "love"}
|
||||
cls._instance.matrix = False
|
||||
cls._instance.current_expression = cls._instance.states[0]
|
||||
cls._instance.desired_expression = cls._instance.states[0]
|
||||
|
@ -22,6 +23,7 @@ class StateSingleton:
|
|||
cls._instance.blink_animation_FrameCanvases = []
|
||||
cls._instance.angry_animation_FrameCanvases = []
|
||||
cls._instance.stun_animation_FrameCanvases = []
|
||||
cls._instance.love_animation_FrameCanvases = []
|
||||
|
||||
|
||||
|
||||
|
@ -43,6 +45,10 @@ class StateSingleton:
|
|||
print("angry animations set")
|
||||
|
||||
|
||||
def set_love_animation_frames(self, love_animation_FrameCanvases):
|
||||
self.love_animation_FrameCanvases = love_animation_FrameCanvases
|
||||
print("love animations set")
|
||||
|
||||
def set_desired_expression(self, state):
|
||||
if state in self.states:
|
||||
print("Set desired state to: " + self.states[state])
|
||||
|
@ -100,6 +106,13 @@ class StateSingleton:
|
|||
elif self.current_expression == self.states[3] or self.desired_expression == self.states[3]:
|
||||
self.matrix.SwapOnVSync(self.angry_animation_FrameCanvases[self.transition_count])
|
||||
|
||||
# love faces
|
||||
elif self.current_expression == self.desired_expression == self.states[4]:
|
||||
self.matrix.SwapOnVSync(self.love_animation_FrameCanvases[10])
|
||||
|
||||
elif self.current_expression == self.states[4] or self.desired_expression == self.states[4]:
|
||||
self.matrix.SwapOnVSync(self.love_animation_FrameCanvases[self.transition_count])
|
||||
|
||||
|
||||
def update(self):
|
||||
if not self.get_animations_ready():
|
||||
|
|
|
@ -95,11 +95,13 @@ def animate():
|
|||
blink_animation_FrameCanvases = []
|
||||
angry_animation_FrameCanvases = []
|
||||
stun_animation_FrameCanvases = []
|
||||
love_animation_FrameCanvases = []
|
||||
|
||||
for emote_FrameCanvasses, emote_eye_png, emote_mouth_png, emote_nose_png in [
|
||||
(blink_animation_FrameCanvases, "faces/eyeLeftClosed.png", "faces/mouthLeft.png", "faces/noseLeft.png"),
|
||||
(angry_animation_FrameCanvases, "faces/eyeLeftAngry.png", "faces/mouthLeft.png", "faces/noseLeft.png"),
|
||||
(stun_animation_FrameCanvases, "faces/eyeLeftStunned.png", "faces/mouthLeftSad.png", "faces/noseLeft.png")
|
||||
(stun_animation_FrameCanvases, "faces/eyeLeftStunned.png", "faces/mouthLeftSad.png", "faces/noseLeft.png"),
|
||||
(love_animation_FrameCanvases, "faces/eyeLeftLove.png", "faces/mouthLeft.png", "faces/noseLeft.png")
|
||||
]:
|
||||
|
||||
print("start generating ten face frames for " + emote_eye_png)
|
||||
|
@ -116,6 +118,7 @@ def animate():
|
|||
state.set_blink_animation_frames(blink_animation_FrameCanvases)
|
||||
state.set_angry_animation_frames(angry_animation_FrameCanvases)
|
||||
state.set_stun_animation_frames(stun_animation_FrameCanvases)
|
||||
state.set_love_animation_frames(love_animation_FrameCanvases)
|
||||
|
||||
state.set_animations_ready()
|
||||
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
/* -*- mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
||||
*
|
||||
* Using the C-API of this library.
|
||||
*
|
||||
*/
|
||||
#include "led-matrix-c.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
struct RGBLedMatrixOptions options;
|
||||
struct RGBLedMatrix *matrix;
|
||||
struct LedCanvas *offscreen_canvas;
|
||||
int width, height;
|
||||
int x, y, i;
|
||||
|
||||
memset(&options, 0, sizeof(options));
|
||||
options.rows = 64;
|
||||
options.chain_length = 2;
|
||||
|
||||
/* This supports all the led commandline options. Try --led-help */
|
||||
matrix = led_matrix_create_from_options(&options, &argc, &argv);
|
||||
if (matrix == NULL)
|
||||
return 1;
|
||||
|
||||
/* Let's do an example with double-buffering. We create one extra
|
||||
* buffer onto which we draw, which is then swapped on each refresh.
|
||||
* This is typically a good aproach for animations and such.
|
||||
*/
|
||||
offscreen_canvas = led_matrix_create_offscreen_canvas(matrix);
|
||||
|
||||
led_canvas_get_size(offscreen_canvas, &width, &height);
|
||||
|
||||
fprintf(stderr, "Size: %dx%d. Hardware gpio mapping: %s\n",
|
||||
width, height, options.hardware_mapping);
|
||||
|
||||
for (i = 0; i < 1000; ++i) {
|
||||
for (y = 0; y < height; ++y) {
|
||||
for (x = 0; x < width; ++x) {
|
||||
led_canvas_set_pixel(offscreen_canvas, x, y, i & 0xff, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
/* Now, we swap the canvas. We give swap_on_vsync the buffer we
|
||||
* just have drawn into, and wait until the next vsync happens.
|
||||
* we get back the unused buffer to which we'll draw in the next
|
||||
* iteration.
|
||||
*/
|
||||
offscreen_canvas = led_matrix_swap_on_vsync(matrix, offscreen_canvas);
|
||||
}
|
||||
|
||||
/*
|
||||
* Make sure to always call led_matrix_delete() in the end to reset the
|
||||
* display. Installing signal handlers for defined exit is a good idea.
|
||||
*/
|
||||
led_matrix_delete(matrix);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue