-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLedCubeFill.ino
90 lines (85 loc) · 5.62 KB
/
LedCubeFill.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
//###############################################################################
//# LEDCube - "Fill" Animation #
//###############################################################################
//# Copyright 2015 - 2016 Dirk Heisswolf #
//# This file is part of the LEDCube project. #
//# #
//# LEDCube is free software: you can redistribute it and/or modify #
//# it under the terms of the GNU General Public License as published by #
//# the Free Software Foundation, either version 3 of the License, or #
//# (at your option) any later version. #
//# #
//# LEDCube is distributed in the hope that it will be useful, #
//# but WITHOUT ANY WARRANTY; without even the implied warranty of #
//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
//# GNU General Public License for more details. #
//# #
//# You should have received a copy of the GNU General Public License #
//# along with LEDCube. If not, see <http://www.gnu.org/licenses/>. #
//###############################################################################
//# Description: #
//# #
//# Y #
//# / C3---C7---C11--C15 Anode connections: #
//# --X / / / / | C0-C15: Q outputs of 74HC595s #
//# | C2---C6---C10--C14 @ #
//# Z / / / / |/| 74HC595 control: #
//# C1---C5---C9---C13 @ @ DS (serial data input): 3 (PD3) #
//# / / / / |/|/| OE (output enable, active low): 2 (PD2) #
//# L0 C0---C4---C8---C12 @ @ @ ST (storage clock): 1 (PD1) #
//# | | | | /|/|/ SH (shift clock): 0 (PD0) #
//# L1 C0---C4---C8---C12 @ @ #
//# | | | | /|/ Cathode connections: #
//# L2 C0---C4---C8---C12 @ L0: 4 (PD4) #
//# | | | | / L1: 5 (PD5) #
//# L3 C0---C4---C8---C12 L2: 6 (PD6) #
//# L3: 7 (PD7) #
//# #
//# LED state format (unsigned 64-bit integer): #
//# #
//# C15 C14 C13 C12 #
//# +-----------+-----------+-----------+-----------+ #
//# |L3 L2 L1 L0|L3 L2 L1 L0|L3 L2 L1 L0|L3 L2 L1 L0| #
//# +-----------+-----------+-----------+-----------+ #
//# 63 60 59 56 55 52 51 48 #
//# C11 C10 C9 C8 #
//# +-----------+-----------+-----------+-----------+ #
//# |L3 L2 L1 L0|L3 L2 L1 L0|L3 L2 L1 L0|L3 L2 L1 L0| #
//# +-----------+-----------+-----------+-----------+ #
//# 47 44 43 40 39 36 35 32 #
//# C7 C6 C5 C4 #
//# +-----------+-----------+-----------+-----------+ #
//# |L3 L2 L1 L0|L3 L2 L1 L0|L3 L2 L1 L0|L3 L2 L1 L0| #
//# +-----------+-----------+-----------+-----------+ #
//# 31 28 27 24 23 20 19 16 #
//# C3 C2 C1 C0 #
//# +-----------+-----------+-----------+-----------+ #
//# |L3 L2 L1 L0|L3 L2 L1 L0|L3 L2 L1 L0|L3 L2 L1 L0| #
//# +-----------+-----------+-----------+-----------+ #
//# 15 12 11 8 7 4 3 0 #
//# #
//###############################################################################
//# Version History: #
//# November 30, 2015 #
//# - Initial release #
//###############################################################################
#include "LEDCube.h"
// Animation
//==========
ledState fillAnimation(ledState frame) {
//Set all LEDs
for (int i=0; i<64; i++) {
//Show frame
dispQueueFrames(frame, FRAMERATE>>2);
//Shift frame
frame = (frame << 1) | 1;
}
//Clear all LEDs
for (int i=0; i<64; i++) {
//Show frame
dispQueueFrames(frame, FRAMERATE>>2);
//Shift frame
frame = (frame << 1);
}
return frame;
}