diff options
40 files changed, 1193 insertions, 0 deletions
diff --git a/LoLShield/Charliplexing.cpp b/LoLShield/Charliplexing.cpp new file mode 100644 index 0000000..5211a84 --- /dev/null +++ b/LoLShield/Charliplexing.cpp @@ -0,0 +1,185 @@ + /*
+ Charliplexing.h - Using timer2 with 1ms resolution
+
+ Alex Wenger <a.wenger@gmx.de> http://arduinobuch.wordpress.com/
+
+ Timer init code from MsTimer2 - Javier Valencia <javiervalencia80@gmail.com>
+
+ History:
+ 30/Dez/09 - V0.0 wrote the first version at 26C3/Berlin
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "WProgram.h"
+#include <inttypes.h>
+#include <avr/interrupt.h>
+#include "Charliplexing.h"
+
+
+volatile unsigned int LedSign::tcnt2;
+
+// Table for the LED multiplexing cycles, containing 12 cycles made out of two bytes
+uint8_t leds[24];
+
+
+// Table for LED Position in leds[] ram table
+const uint8_t ledMap[252] = {
+ 13, 5,13, 6,13, 7,13, 8,13, 9,13,10,13,11,13,12,13, 4, 4,13,13, 3, 3,13,13, 2, 2,13,
+ 12, 5,12, 6,12, 7,12, 8,12, 9,12,10,12,11,12,13,12, 4, 4,12,12, 3, 3,12,12, 2, 2,12,
+ 11, 5,11, 6,11, 7,11, 8,11, 9,11,10,11,12,11,13,11, 4, 4,11,11, 3, 3,11,11, 2, 2,11,
+ 10, 5,10, 6,10, 7,10, 8,10, 9,10,11,10,12,10,13,10, 4, 4,10,10, 3, 3,10,10, 2, 2,10,
+ 9, 5, 9, 6, 9, 7, 9, 8, 9,10, 9,11, 9,12, 9,13, 9, 4, 4, 9, 9, 3, 3, 9, 9, 2, 2, 9,
+ 8, 5, 8, 6, 8, 7, 8, 9, 8,10, 8,11, 8,12, 8,13, 8, 4, 4, 8, 8, 3, 3, 8, 8, 2, 2, 8,
+ 7, 5, 7, 6, 7, 8, 7, 9, 7,10, 7,11, 7,12, 7,13, 7, 4, 4, 7, 7, 3, 3, 7, 7, 2, 2, 7,
+ 6, 5, 6, 7, 6, 8, 6, 9, 6,10, 6,11, 6,12, 6,13, 6, 4, 4, 6, 6, 3, 3, 6, 6, 2, 2, 6,
+ 5, 6, 5, 7, 5, 8, 5, 9, 5,10, 5,11, 5,12, 5,13, 5, 4, 4, 5, 5, 3, 3, 5, 5, 2, 2, 5,
+ };
+
+
+// Constructor / init interrupt
+void LedSign::Init(void)
+{
+ float prescaler = 0.0;
+
+#if defined (__AVR_ATmega168__) || defined (__AVR_ATmega48__) || defined (__AVR_ATmega88__) || defined (__AVR_ATmega328P__) || (__AVR_ATmega1280__)
+ TIMSK2 &= ~(1<<TOIE2);
+ TCCR2A &= ~((1<<WGM21) | (1<<WGM20));
+ TCCR2B &= ~(1<<WGM22);
+ ASSR &= ~(1<<AS2);
+ TIMSK2 &= ~(1<<OCIE2A);
+
+ if ((F_CPU >= 1000000UL) && (F_CPU <= 16000000UL)) { // prescaler set to 64
+ TCCR2B |= (1<<CS22);
+ TCCR2B &= ~((1<<CS21) | (1<<CS20));
+ prescaler = 64.0;
+ } else if (F_CPU < 1000000UL) { // prescaler set to 8
+ TCCR2B |= (1<<CS21);
+ TCCR2B &= ~((1<<CS22) | (1<<CS20));
+ prescaler = 8.0;
+ } else { // F_CPU > 16Mhz, prescaler set to 128
+ TCCR2B |= ((1<<CS22) | (1<<CS20));
+ TCCR2B &= ~(1<<CS21);
+ prescaler = 128.0;
+ }
+#elif defined (__AVR_ATmega8__)
+ TIMSK &= ~(1<<TOIE2);
+ TCCR2 &= ~((1<<WGM21) | (1<<WGM20));
+ TIMSK &= ~(1<<OCIE2);
+ ASSR &= ~(1<<AS2);
+
+ if ((F_CPU >= 1000000UL) && (F_CPU <= 16000000UL)) { // prescaler set to 64
+ TCCR2 |= (1<<CS22);
+ TCCR2 &= ~((1<<CS21) | (1<<CS20));
+ prescaler = 64.0;
+ } else if (F_CPU < 1000000UL) { // prescaler set to 8
+ TCCR2 |= (1<<CS21);
+ TCCR2 &= ~((1<<CS22) | (1<<CS20));
+ prescaler = 8.0;
+ } else { // F_CPU > 16Mhz, prescaler set to 128
+ TCCR2 |= ((1<<CS22) && (1<<CS20));
+ TCCR2 &= ~(1<<CS21);
+ prescaler = 128.0;
+ }
+#elif defined (__AVR_ATmega128__)
+ TIMSK &= ~(1<<TOIE2);
+ TCCR2 &= ~((1<<WGM21) | (1<<WGM20));
+ TIMSK &= ~(1<<OCIE2);
+
+ if ((F_CPU >= 1000000UL) && (F_CPU <= 16000000UL)) { // prescaler set to 64
+ TCCR2 |= ((1<<CS21) | (1<<CS20));
+ TCCR2 &= ~(1<<CS22);
+ prescaler = 64.0;
+ } else if (F_CPU < 1000000UL) { // prescaler set to 8
+ TCCR2 |= (1<<CS21);
+ TCCR2 &= ~((1<<CS22) | (1<<CS20));
+ prescaler = 8.0;
+ } else { // F_CPU > 16Mhz, prescaler set to 256
+ TCCR2 |= (1<<CS22);
+ TCCR2 &= ~((1<<CS21) | (1<<CS20));
+ prescaler = 256.0;
+ }
+#endif
+
+ tcnt2 = 256 - (int)((float)F_CPU * 0.001 / prescaler);
+
+#if defined (__AVR_ATmega168__) || defined (__AVR_ATmega48__) || defined (__AVR_ATmega88__) || defined (__AVR_ATmega328P__) || (__AVR_ATmega1280__)
+ TCNT2 = tcnt2;
+ TIMSK2 |= (1<<TOIE2);
+#elif defined (__AVR_ATmega128__)
+ TCNT2 = tcnt2;
+ TIMSK |= (1<<TOIE2);
+#elif defined (__AVR_ATmega8__)
+ TCNT2 = tcnt2;
+ TIMSK |= (1<<TOIE2);
+#endif
+}
+
+// Function to switch on and off the leds. All the position
+// calculations are done here, so we donīt need to do in the
+// interrupt code
+void LedSign::Set(uint8_t x, uint8_t y, uint8_t c)
+{
+ uint8_t pin_low = ledMap[x*2+y*28+1];
+ uint8_t pin_high = ledMap[x*2+y*28+0];
+ // pin_low ist directly the adress in the led array (minus 2 because the
+ // first two bytes are used for RS232 communication, but
+ // as it is a two byte array we need to check pin_high also.
+ // If pin_high is bigger than 8 adress has to be increased by one
+ if (c == 1) {
+ leds[(pin_low-2)*2 + (pin_high / 8)] |= _BV(pin_high & 0x07); // ON
+ }
+ else {
+ leds[(pin_low-2)*2 + (pin_high / 8)] &= ~_BV(pin_high & 0x07); // OFF
+ }
+}
+
+
+ISR(TIMER2_OVF_vect) {
+#if defined (__AVR_ATmega168__) || defined (__AVR_ATmega48__) || defined (__AVR_ATmega88__) || defined (__AVR_ATmega328P__) || (__AVR_ATmega1280__)
+ TCNT2 = LedSign::tcnt2;
+#elif defined (__AVR_ATmega128__)
+ TCNT2 = LedSign::tcnt2;
+#elif defined (__AVR_ATmega8__)
+ TCNT2 = LedSign::tcnt2;
+#endif
+
+ // 12 Cycles of Matrix
+ static uint8_t i;
+
+ i++;
+ if (i > 12) i = 0;
+
+ if (i < 6) {
+ DDRD = _BV(i+2) | leds[i*2];
+ PORTD = leds[i*2];
+
+ DDRB = leds[i*2+1];
+ PORTB = leds[i*2+1];
+ } else {
+ DDRD = leds[i*2];
+ PORTD = leds[i*2];
+
+ DDRB = _BV(i-6) | leds[i*2+1];
+ PORTB = leds[i*2+1];
+ }
+ /*
+ PORTB = 0xff;
+ PORTD = i;
+ DDRB = 0xff;
+ DDRD = 0xff;
+ */
+}
+
diff --git a/LoLShield/Charliplexing.h b/LoLShield/Charliplexing.h new file mode 100644 index 0000000..2e1dbf3 --- /dev/null +++ b/LoLShield/Charliplexing.h @@ -0,0 +1,20 @@ +/*
+ Charliplexing.h - Library for controlling the charliplexed led board
+ from JimmiePRodgers.com
+ Created by Alex Wenger, December 30, 2009.
+ Released into the public domain.
+*/
+
+#ifndef Charliplexing_h
+#define Charliplexing_h
+
+#include <inttypes.h>
+
+namespace LedSign
+{
+ extern void Init(void);
+ extern void Set(uint8_t x, uint8_t y, uint8_t c);
+ extern volatile unsigned int tcnt2;
+};
+
+#endif
diff --git a/LoLShield/Charliplexing.o b/LoLShield/Charliplexing.o Binary files differnew file mode 100644 index 0000000..ebcfc99 --- /dev/null +++ b/LoLShield/Charliplexing.o diff --git a/LoLShield/Examples/Basic_Test/Basic_Test.pde b/LoLShield/Examples/Basic_Test/Basic_Test.pde new file mode 100644 index 0000000..a6cd4e8 --- /dev/null +++ b/LoLShield/Examples/Basic_Test/Basic_Test.pde @@ -0,0 +1,172 @@ +/* + Basic LoL Shield Test + + Writen for the LoL Shield, designed by Jimmie Rodgers: + http://jimmieprodgers.com/kits/lolshield/ + + This needs the Charliplexing library, which you can get at the + LoL Shield project page: http://code.google.com/p/lolshield/ + + Created by Jimmie Rodgers on 12/30/2009. + Adapted from: http://www.arduino.cc/playground/Code/BitMath + + History: + December 30, 2009 - V1.0 first version written at 26C3/Berlin + + This is free software; you can redistribute it and/or + modify it under the terms of the GNU Version 3 General Public + License as published by the Free Software Foundation; + or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include <avr/pgmspace.h> //AVR library for writing to ROM +#include <Charliplexing.h> //Imports the library, which needs to be + //Initialized in setup. + +int blinkdelay = 100; //Sets the time each frame is shown + +/* +The BitMap array is what contains the frame data. Each line is one full frame. +Since each number is 16 bits, we can easily fit all 14 LEDs per row into it. +The number is calculated by adding up all the bits, starting with lowest on +the left of each row. 18000 was chosen as the kill number, so make sure that +is at the end of the matrix, or the program will continue to read into memory. + +Here PROGMEM is called, which stores the array into ROM, which leaves us +with our RAM. You cannot change the array during run-time, only when you +upload to the Arduino. You will need to pull it out of ROM, which is covered +below. If you want it to stay in RAM, just delete PROGMEM +*/ +uint16_t BitMap[][9] PROGMEM = { +//Diaganal swipe across the screen +{1, 0, 0, 0, 0, 0, 0, 0, 0}, +{3, 1, 0, 0, 0, 0, 0, 0, 0}, +{7, 3, 1, 0, 0, 0, 0, 0, 0}, +{15, 7, 3, 1, 0, 0, 0, 0, 0}, +{31, 15, 7, 3, 1, 0, 0, 0, 0}, +{63, 31, 15, 7, 3, 1, 0, 0, 0}, +{127, 63, 31, 15, 7, 3, 1, 0, 0}, +{255, 127, 63, 31, 15, 7, 3, 1, 0}, +{511, 255, 127, 63, 31, 15, 7, 3, 1}, +{1023, 511, 255, 127, 63, 31, 15, 7, 3}, +{2047, 1023, 511, 255, 127, 63, 31, 15, 7}, +{4095, 2047, 1023, 511, 255, 127, 63, 31, 15}, +{8191, 4095, 2047, 1023, 511, 255, 127, 63, 31}, +{16383, 8191, 4095, 2047, 1023, 511, 255, 127, 63}, +{16383, 16383, 8191, 4095, 2047, 1023, 511, 255, 127}, +{16383, 16383, 16383, 8191, 4095, 2047, 1023, 511, 255}, +{16383, 16383, 16383, 16383, 8191, 4095, 2047, 1023, 511}, +{16383, 16383, 16383, 16383, 16383, 8191, 4095, 2047, 1023}, +{16383, 16383, 16383, 16383, 16383, 16383, 8191, 4095, 2047}, +{16383, 16383, 16383, 16383, 16383, 16383, 16383, 8191, 4095}, +{16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 8191}, +{16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383}, +{16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383}, +{16382, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383}, +{16380, 16382, 16383, 16383, 16383, 16383, 16383, 16383, 16383}, +{16376, 16380, 16382, 16383, 16383, 16383, 16383, 16383, 16383}, +{16368, 16376, 16380, 16382, 16383, 16383, 16383, 16383, 16383}, +{16352, 16368, 16376, 16380, 16382, 16383, 16383, 16383, 16383}, +{16320, 16352, 16368, 16376, 16380, 16382, 16383, 16383, 16383}, +{16256, 16320, 16352, 16368, 16376, 16380, 16382, 16383, 16383}, +{16128, 16256, 16320, 16352, 16368, 16376, 16380, 16382, 16383}, +{15872, 16128, 16256, 16320, 16352, 16368, 16376, 16380, 16382}, +{15360, 15872, 16128, 16256, 16320, 16352, 16368, 16376, 16380}, +{14336, 15360, 15872, 16128, 16256, 16320, 16352, 16368, 16376}, +{12288, 14336, 15360, 15872, 16128, 16256, 16320, 16352, 16368}, +{8192, 12288, 14336, 15360, 15872, 16128, 16256, 16320, 16352}, +{0, 8192, 12288, 14336, 15360, 15872, 16128, 16256, 16320}, +{0, 0, 8192, 12288, 14336, 15360, 15872, 16128, 16256}, +{0, 0, 0, 8192, 12288, 14336, 15360, 15872, 16128}, +{0, 0, 0, 0, 8192, 12288, 14336, 15360, 15872}, +{0, 0, 0, 0, 0, 8192, 12288, 14336, 15360}, +{0, 0, 0, 0, 0, 0, 8192, 12288, 14336}, +{0, 0, 0, 0, 0, 0, 0, 8192, 12288}, +{0, 0, 0, 0, 0, 0, 0, 0, 8192}, +{0, 0, 0, 0, 0, 0, 0, 0, 0}, + +//Horizontal swipe +{1, 1, 1, 1, 1, 1, 1, 1, 1} , +{3, 3, 3, 3, 3, 3, 3, 3, 3}, +{7, 7, 7, 7, 7, 7, 7, 7, 7}, +{15, 15, 15, 15, 15, 15, 15, 15, 15}, +{31, 31, 31, 31, 31, 31, 31, 31, 31}, +{63, 63, 63, 63, 63, 63, 63, 63, 63}, +{127, 127, 127, 127, 127, 127, 127, 127, 127}, +{255, 255, 255, 255, 255, 255, 255, 255, 255}, +{511, 511, 511, 511, 511, 511, 511, 511, 511}, +{1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023}, +{2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047}, +{4095, 4095, 4095, 4095, 4095, 4095, 4095, 4095, 4095}, +{8191, 8191, 8191, 8191, 8191, 8191, 8191, 8191, 8191}, +{16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383}, +{16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382}, +{16380, 16380, 16380, 16380, 16380, 16380, 16380, 16380, 16380}, +{16376, 16376, 16376, 16376, 16376, 16376, 16376, 16376, 16376}, +{16368, 16368, 16368, 16368, 16368, 16368, 16368, 16368, 16368}, +{16352, 16352, 16352, 16352, 16352, 16352, 16352, 16352, 16352}, +{16320, 16320, 16320, 16320, 16320, 16320, 16320, 16320, 16320}, +{16256, 16256, 16256, 16256, 16256, 16256, 16256, 16256, 16256}, +{16128, 16128, 16128, 16128, 16128, 16128, 16128, 16128, 16128}, +{15872, 15872, 15872, 15872, 15872, 15872, 15872, 15872, 15872}, +{15360, 15360, 15360, 15360, 15360, 15360, 15360, 15360, 15360}, +{14336, 14336, 14336, 14336, 14336, 14336, 14336, 14336, 14336}, +{12288, 12288, 12288, 12288, 12288, 12288, 12288, 12288, 12288}, +{8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192}, +{0, 0, 0, 0, 0, 0, 0, 0, 0}, +{18000} +}; + +void setup() { + LedSign::Init(); //Initializes the screen +} +void loop() { + DisplayBitMap(); //Displays the bitmap +} + +void DisplayBitMap() +{ + boolean run=true; //While this is true, the screen updates + byte frame = 0; //Frame counter + byte line = 0; //Row counter + unsigned long data; //Temporary storage of the row data + + while(run == true) { + for(line = 0; line < 9; line++) { + + //Here we fetch data from program memory with a pointer. + data = pgm_read_word_near (&BitMap[frame][line]); + + //Kills the loop if the kill number is found + if (data==18000){ + run=false; + } + + //This is where the bit-shifting happens to pull out + //each LED from a row. If the bit is 1, then the LED + //is turned on, otherwise it is turned off. + else for (byte led=0; led<14; ++led) { + if (data & (1<<led)) { + LedSign::Set(led, line, 1); + } + else { + LedSign::Set(led, line, 0); + } + } + + } + + //Delays the next update + delay(blinkdelay); + frame++; + } +}
diff --git a/LoLShield/Examples/Basic_Test/applet/Basic_Test.cpp b/LoLShield/Examples/Basic_Test/applet/Basic_Test.cpp new file mode 100644 index 0000000..92547f7 --- /dev/null +++ b/LoLShield/Examples/Basic_Test/applet/Basic_Test.cpp @@ -0,0 +1,190 @@ +/* + Basic LoL Shield Test + + Writen for the LoL Shield, designed by Jimmie Rodgers: + http://jimmieprodgers.com/kits/lolshield/ + + This needs the Charliplexing library, which you can get at the + LoL Shield project page: http://code.google.com/p/lolshield/ + + Created by Jimmie Rodgers on 12/30/2009. + Adapted from: http://www.arduino.cc/playground/Code/BitMath + + History: + December 30, 2009 - V1.0 first version written at 26C3/Berlin + + This is free software; you can redistribute it and/or + modify it under the terms of the GNU Version 3 General Public + License as published by the Free Software Foundation; + or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include <avr/pgmspace.h> //AVR library for writing to ROM +#include <Charliplexing.h> //Imports the library, which needs to be + //Initialized in setup. + +#include "WProgram.h" +void setup(); +void loop(); +void DisplayBitMap(); +int blinkdelay = 100; //Sets the time each frame is shown + +/* +The BitMap array is what contains the frame data. Each line is one full frame. +Since each number is 16 bits, we can easily fit all 14 LEDs per row into it. +The number is calculated by adding up all the bits, starting with lowest on +the left of each row. 18000 was chosen as the kill number, so make sure that +is at the end of the matrix, or the program will continue to read into memory. + +Here PROGMEM is called, which stores the array into ROM, which leaves us +with our RAM. You cannot change the array during run-time, only when you +upload to the Arduino. You will need to pull it out of ROM, which is covered +below. If you want it to stay in RAM, just delete PROGMEM +*/ +uint16_t BitMap[][9] PROGMEM = { +//Diaganal swipe across the screen +{1, 0, 0, 0, 0, 0, 0, 0, 0}, +{3, 1, 0, 0, 0, 0, 0, 0, 0}, +{7, 3, 1, 0, 0, 0, 0, 0, 0}, +{15, 7, 3, 1, 0, 0, 0, 0, 0}, +{31, 15, 7, 3, 1, 0, 0, 0, 0}, +{63, 31, 15, 7, 3, 1, 0, 0, 0}, +{127, 63, 31, 15, 7, 3, 1, 0, 0}, +{255, 127, 63, 31, 15, 7, 3, 1, 0}, +{511, 255, 127, 63, 31, 15, 7, 3, 1}, +{1023, 511, 255, 127, 63, 31, 15, 7, 3}, +{2047, 1023, 511, 255, 127, 63, 31, 15, 7}, +{4095, 2047, 1023, 511, 255, 127, 63, 31, 15}, +{8191, 4095, 2047, 1023, 511, 255, 127, 63, 31}, +{16383, 8191, 4095, 2047, 1023, 511, 255, 127, 63}, +{16383, 16383, 8191, 4095, 2047, 1023, 511, 255, 127}, +{16383, 16383, 16383, 8191, 4095, 2047, 1023, 511, 255}, +{16383, 16383, 16383, 16383, 8191, 4095, 2047, 1023, 511}, +{16383, 16383, 16383, 16383, 16383, 8191, 4095, 2047, 1023}, +{16383, 16383, 16383, 16383, 16383, 16383, 8191, 4095, 2047}, +{16383, 16383, 16383, 16383, 16383, 16383, 16383, 8191, 4095}, +{16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 8191}, +{16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383}, +{16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383}, +{16382, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383}, +{16380, 16382, 16383, 16383, 16383, 16383, 16383, 16383, 16383}, +{16376, 16380, 16382, 16383, 16383, 16383, 16383, 16383, 16383}, +{16368, 16376, 16380, 16382, 16383, 16383, 16383, 16383, 16383}, +{16352, 16368, 16376, 16380, 16382, 16383, 16383, 16383, 16383}, +{16320, 16352, 16368, 16376, 16380, 16382, 16383, 16383, 16383}, +{16256, 16320, 16352, 16368, 16376, 16380, 16382, 16383, 16383}, +{16128, 16256, 16320, 16352, 16368, 16376, 16380, 16382, 16383}, +{15872, 16128, 16256, 16320, 16352, 16368, 16376, 16380, 16382}, +{15360, 15872, 16128, 16256, 16320, 16352, 16368, 16376, 16380}, +{14336, 15360, 15872, 16128, 16256, 16320, 16352, 16368, 16376}, +{12288, 14336, 15360, 15872, 16128, 16256, 16320, 16352, 16368}, +{8192, 12288, 14336, 15360, 15872, 16128, 16256, 16320, 16352}, +{0, 8192, 12288, 14336, 15360, 15872, 16128, 16256, 16320}, +{0, 0, 8192, 12288, 14336, 15360, 15872, 16128, 16256}, +{0, 0, 0, 8192, 12288, 14336, 15360, 15872, 16128}, +{0, 0, 0, 0, 8192, 12288, 14336, 15360, 15872}, +{0, 0, 0, 0, 0, 8192, 12288, 14336, 15360}, +{0, 0, 0, 0, 0, 0, 8192, 12288, 14336}, +{0, 0, 0, 0, 0, 0, 0, 8192, 12288}, +{0, 0, 0, 0, 0, 0, 0, 0, 8192}, +{0, 0, 0, 0, 0, 0, 0, 0, 0}, + +//Horizontal swipe +{1, 1, 1, 1, 1, 1, 1, 1, 1} , +{3, 3, 3, 3, 3, 3, 3, 3, 3}, +{7, 7, 7, 7, 7, 7, 7, 7, 7}, +{15, 15, 15, 15, 15, 15, 15, 15, 15}, +{31, 31, 31, 31, 31, 31, 31, 31, 31}, +{63, 63, 63, 63, 63, 63, 63, 63, 63}, +{127, 127, 127, 127, 127, 127, 127, 127, 127}, +{255, 255, 255, 255, 255, 255, 255, 255, 255}, +{511, 511, 511, 511, 511, 511, 511, 511, 511}, +{1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023}, +{2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047, 2047}, +{4095, 4095, 4095, 4095, 4095, 4095, 4095, 4095, 4095}, +{8191, 8191, 8191, 8191, 8191, 8191, 8191, 8191, 8191}, +{16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383, 16383}, +{16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382, 16382}, +{16380, 16380, 16380, 16380, 16380, 16380, 16380, 16380, 16380}, +{16376, 16376, 16376, 16376, 16376, 16376, 16376, 16376, 16376}, +{16368, 16368, 16368, 16368, 16368, 16368, 16368, 16368, 16368}, +{16352, 16352, 16352, 16352, 16352, 16352, 16352, 16352, 16352}, +{16320, 16320, 16320, 16320, 16320, 16320, 16320, 16320, 16320}, +{16256, 16256, 16256, 16256, 16256, 16256, 16256, 16256, 16256}, +{16128, 16128, 16128, 16128, 16128, 16128, 16128, 16128, 16128}, +{15872, 15872, 15872, 15872, 15872, 15872, 15872, 15872, 15872}, +{15360, 15360, 15360, 15360, 15360, 15360, 15360, 15360, 15360}, +{14336, 14336, 14336, 14336, 14336, 14336, 14336, 14336, 14336}, +{12288, 12288, 12288, 12288, 12288, 12288, 12288, 12288, 12288}, +{8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192}, +{0, 0, 0, 0, 0, 0, 0, 0, 0}, +{18000} +}; + +void setup() { + LedSign::Init(); //Initializes the screen +} +void loop() { + DisplayBitMap(); //Displays the bitmap +} + +void DisplayBitMap() +{ + boolean run=true; //While this is true, the screen updates + byte frame = 0; //Frame counter + byte line = 0; //Row counter + unsigned long data; //Temporary storage of the row data + + while(run == true) { + for(line = 0; line < 9; line++) { + + //Here we fetch data from program memory with a pointer. + data = pgm_read_word_near (&BitMap[frame][line]); + + //Kills the loop if the kill number is found + if (data==18000){ + run=false; + } + + //This is where the bit-shifting happens to pull out + //each LED from a row. If the bit is 1, then the LED + //is turned on, otherwise it is turned off. + else for (byte led=0; led<14; ++led) { + if (data & (1<<led)) { + LedSign::Set(led, line, 1); + } + else { + LedSign::Set(led, line, 0); + } + } + + } + + //Delays the next update + delay(blinkdelay); + frame++; + } +} + + +int main(void) +{ + init(); + + setup(); + + for (;;) + loop(); + + return 0; +} + diff --git a/LoLShield/Examples/Basic_Test/applet/Basic_Test.cpp.eep b/LoLShield/Examples/Basic_Test/applet/Basic_Test.cpp.eep new file mode 100644 index 0000000..1996e8f --- /dev/null +++ b/LoLShield/Examples/Basic_Test/applet/Basic_Test.cpp.eep @@ -0,0 +1 @@ +:00000001FF
diff --git a/LoLShield/Examples/Basic_Test/applet/Basic_Test.cpp.elf b/LoLShield/Examples/Basic_Test/applet/Basic_Test.cpp.elf Binary files differnew file mode 100644 index 0000000..9d782ac --- /dev/null +++ b/LoLShield/Examples/Basic_Test/applet/Basic_Test.cpp.elf diff --git a/LoLShield/Examples/Basic_Test/applet/Basic_Test.cpp.hex b/LoLShield/Examples/Basic_Test/applet/Basic_Test.cpp.hex new file mode 100644 index 0000000..9de87e8 --- /dev/null +++ b/LoLShield/Examples/Basic_Test/applet/Basic_Test.cpp.hex @@ -0,0 +1,175 @@ +:100000000C94CE020C94EB020C94EB020C94EB02D9
+:100010000C94EB020C94EB020C94EB020C94EB02AC
+:100020000C94EB020C945A030C94EB020C94EB022C
+:100030000C94EB020C94EB020C94EB020C94EB028C
+:100040000C9440040C94EB020C94EB020C94EB0225
+:100050000C94EB020C94EB020C94EB020C94EB026C
+:100060000C94EB020C94EB02010000000000000075
+:10007000000000000000000000000300010000007C
+:100080000000000000000000000000000700030066
+:1000900001000000000000000000000000000F0050
+:1000A0000700030001000000000000000000000045
+:1000B0001F000F0007000300010000000000000007
+:1000C00000003F001F000F000700030001000000B8
+:1000D000000000007F003F001F000F00070003002A
+:1000E000010000000000FF007F003F001F000F0024
+:1000F0000700030001000000FF01FF007F003F0038
+:100100001F000F00070003000100FF03FF01FF00B5
+:100110007F003F001F000F0007000300FF07FF03E1
+:10012000FF01FF007F003F001F000F000700FF0FCF
+:10013000FF07FF03FF01FF007F003F001F000F00CC
+:10014000FF1FFF0FFF07FF03FF01FF007F003F00BE
+:100150001F00FF3FFF1FFF0FFF07FF03FF01FF000F
+:100160007F003F00FF3FFF3FFF1FFF0FFF07FF0321
+:10017000FF01FF007F00FF3FFF3FFF3FFF1FFF0F1B
+:10018000FF07FF03FF01FF00FF3FFF3FFF3FFF3F70
+:10019000FF1FFF0FFF07FF03FF01FF3FFF3FFF3F71
+:1001A000FF3FFF3FFF1FFF0FFF07FF03FF3FFF3F23
+:1001B000FF3FFF3FFF3FFF3FFF1FFF0FFF07FF3FD7
+:1001C000FF3FFF3FFF3FFF3FFF3FFF3FFF1FFF0F8F
+:1001D000FF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3F2F
+:1001E000FF1FFF3FFF3FFF3FFF3FFF3FFF3FFF3F3F
+:1001F000FF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3F0F
+:10020000FF3FFF3FFF3FFE3FFF3FFF3FFF3FFF3FFF
+:10021000FF3FFF3FFF3FFF3FFC3FFE3FFF3FFF3FF2
+:10022000FF3FFF3FFF3FFF3FFF3FF83FFC3FFE3FE9
+:10023000FF3FFF3FFF3FFF3FFF3FFF3FF03FF83FE4
+:10024000FC3FFE3FFF3FFF3FFF3FFF3FFF3FE03FE1
+:10025000F03FF83FFC3FFE3FFF3FFF3FFF3FFF3FC8
+:10026000C03FE03FF03FF83FFC3FFE3FFF3FFF3F16
+:10027000FF3F803FC03FE03FF03FF83FFC3FFE3F85
+:10028000FF3FFF3F003F803FC03FE03FF03FF83F70
+:10029000FC3FFE3FFF3F003E003F803FC03FE03F4E
+:1002A000F03FF83FFC3FFE3F003C003E003F803FF8
+:1002B000C03FE03FF03FF83FFC3F0038003C003ECD
+:1002C000003F803FC03FE03FF03FF83F0030003844
+:1002D000003C003E003F803FC03FE03FF03F002039
+:1002E00000300038003C003E003F803FC03FE03F10
+:1002F0000000002000300038003C003E003F803FFE
+:10030000C03F00000000002000300038003C003EEC
+:10031000003F803F00000000000000200030003857
+:10032000003C003E003F00000000000000000020F4
+:1003300000300038003C003E0000000000000000DB
+:100340000000002000300038003C000000000000E9
+:100350000000000000000020003000380000000015
+:10036000000000000000000000000020003000003D
+:10037000000000000000000000000000000000205D
+:10038000000000000000000000000000000000006D
+:100390000000010001000100010001000100010056
+:1003A0000100010003000300030003000300030039
+:1003B0000300030003000700070007000700070011
+:1003C00007000700070007000F000F000F000F00D5
+:1003D0000F000F000F000F000F001F001F001F0075
+:1003E0001F001F001F001F001F001F003F003F00D5
+:1003F0003F003F003F003F003F003F003F007F00C5
+:100400007F007F007F007F007F007F007F007F00F4
+:10041000FF00FF00FF00FF00FF00FF00FF00FF00E4
+:10042000FF00FF01FF01FF01FF01FF01FF01FF01CD
+:10043000FF01FF01FF03FF03FF03FF03FF03FF03B0
+:10044000FF03FF03FF03FF07FF07FF07FF07FF0788
+:10045000FF07FF07FF07FF07FF0FFF0FFF0FFF0F4C
+:10046000FF0FFF0FFF0FFF0FFF0FFF1FFF1FFF1FEC
+:10047000FF1FFF1FFF1FFF1FFF1FFF1FFF3FFF3F4C
+:10048000FF3FFF3FFF3FFF3FFF3FFF3FFF3FFE3F7D
+:10049000FE3FFE3FFE3FFE3FFE3FFE3FFE3FFE3F74
+:1004A000FC3FFC3FFC3FFC3FFC3FFC3FFC3FFC3F74
+:1004B000FC3FF83FF83FF83FF83FF83FF83FF83F80
+:1004C000F83FF83FF03FF03FF03FF03FF03FF03FA4
+:1004D000F03FF03FF03FE03FE03FE03FE03FE03FF4
+:1004E000E03FE03FE03FE03FC03FC03FC03FC03F94
+:1004F000C03FC03FC03FC03FC03F803F803F803FC4
+:10050000803F803F803F803F803F803F003F003FF3
+:10051000003F003F003F003F003F003F003F003EE4
+:10052000003E003E003E003E003E003E003E003EDB
+:10053000003C003C003C003C003C003C003C003CDB
+:10054000003C0038003800380038003800380038E7
+:10055000003800380030003000300030003000300B
+:10056000003000300030002000200020002000205B
+:1005700000200020002000200000000000000000FB
+:1005800000000000000000000000504600000000D5
+:1005900000000000000000000000000011241FBE49
+:1005A000CFEFD8E0DEBFCDBF11E0A0E0B1E0ECEDD1
+:1005B000F9E002C005900D92AE3FB107D9F712E005
+:1005C000AEEFB1E001C01D92A232B107E1F70E9487
+:1005D00039040C94EC040C94000020E730E0F9019D
+:1005E00080818E7F8083E0EBF0E080818C7F808350
+:1005F000A1EBB0E08C91877F8C93E6EBF0E08081FB
+:100600008F7D8083F90180818D7F80838C918460D0
+:100610008C938C918C7F8C9386E090E09093FF017B
+:100620008093FE018091FE019091FF018093B200C2
+:1006300080818160808308959EE0699FF00111248C
+:10064000E80FF11DEE0FFF1FEE5FFE4F81819081DD
+:10065000E82FF0E0892F869586958695292F30E042
+:10066000413099F43297EE0FFF1FE80FF11DE05073
+:10067000FE4F2770307081E090E002C0880F991F14
+:100680002A95E2F72081282B13C03297EE0FFF1F27
+:10069000E80FF11DE050FE4F2770307081E090E0D0
+:1006A00002C0880F991F2A95E2F7809520812823A0
+:1006B000208308951F920F920FB60F9211242F934B
+:1006C0004F935F938F939F93EF93FF938091FE01DE
+:1006D0009091FF018093B200809118028F5F809308
+:1006E00018028D3010F01092180280911802482FD5
+:1006F00050E08630B0F4FA01EE0FFF1FE050FE4FDD
+:1007000020814E5F5F4F81E090E002C0880F991F0B
+:100710004A95E2F7822B8AB92BB9818184B985B9D0
+:1007200015C0FA01EE0FFF1FE050FE4F80818AB91D
+:100730008BB921814650504081E090E002C0880F83
+:10074000991F4A95E2F7822B84B925B9FF91EF9161
+:100750009F918F915F914F912F910F900FBE0F90AE
+:100760001F9018952F923F925F926F927F928F9277
+:100770009F92AF92BF92CF92DF92EF92FF920F9330
+:100780001F93DF93CF930F92CDB7DEB7BB2429E041
+:10079000522E91E0692E712C51C0A02EF801E80D67
+:1007A000F91DEE0FFF1FE859FF4F859194916C01E1
+:1007B000EE24FF2480E5C81686E4D80680E0E8062B
+:1007C00080E0F80611F4198225C022243324C301E5
+:1007D000022C02C0880F991F0A94E2F7AA2797FDFE
+:1007E000A095BA2F8C219D21AE21BF210097A10594
+:1007F000B10521F0822D6A2D41E003C0822D6A2DC2
+:1008000040E00E941C030894211C311CEEE02E16CF
+:100810003104E9F60F5F1F4F0930110509F0BDCF14
+:100820006091000170910101882777FD8095982FD4
+:100830000E948804F981F13049F4B39481E08983FE
+:1008400000E010E0B59C40011124A7CF0F90CF919C
+:10085000DF911F910F91FF90EF90DF90CF90BF90AD
+:10086000AF909F908F907F906F905F903F902F9070
+:1008700008950E94B2040E94ED020E94B203FDCFCF
+:100880001F920F920FB60F9211242F933F938F93C5
+:100890009F93AF93BF9380911D0290911E02A091F0
+:1008A0001F02B0912002309121020196A11DB11DBD
+:1008B000232F2D5F2D3720F02D570196A11DB11D3F
+:1008C0002093210280931D0290931E02A0931F0289
+:1008D000B09320028091190290911A02A0911B02FC
+:1008E000B0911C020196A11DB11D80931902909335
+:1008F0001A02A0931B02B0931C02BF91AF919F916B
+:100900008F913F912F910F900FBE0F901F901895D0
+:10091000EF92FF920F931F937B018C018FB7F89496
+:1009200040911D0250911E0260911F0270912002A1
+:100930008FBF2FB7F89480911D0290911E02A09155
+:100940001F02B09120022FBF841B950BA60BB70B83
+:10095000E816F9060A071B0760F71F910F91FF9031
+:10096000EF900895789484B5826084BD84B58160E9
+:1009700084BD85B5826085BD85B5816085BDEEE6A7
+:10098000F0E0808181608083E1E8F0E08081826036
+:100990008083808181608083E0E8F0E080818160F5
+:1009A0008083E1EBF0E0808184608083E0EBF0E025
+:1009B000808181608083EAE7F0E0808184608083C9
+:1009C0008081826080838081816080838081806873
+:0C09D00080831092C1000895F894FFCFBE
+:1009DC0064000D050D060D070D080D090D0A0D0B14
+:1009EC000D0C0D04040D0D03030D0D02020D0C0571
+:1009FC000C060C070C080C090C0A0C0B0C0D0C0447
+:100A0C00040C0C03030C0C02020C0B050B060B075D
+:100A1C000B080B090B0A0B0C0B0D0B04040B0B0333
+:100A2C00030B0B02020B0A050A060A070A080A093D
+:100A3C000A0B0A0C0A0D0A04040A0A03030A0A0226
+:100A4C00020A0905090609070908090A090B090C14
+:100A5C00090D09040409090303090902020908051F
+:100A6C00080608070809080A080B080C080D0804F2
+:100A7C00040808030308080202080705070607080C
+:100A8C000709070A070B070C070D070404070703E0
+:100A9C000307070202070605060706080609060AE9
+:100AAC00060B060C060D06040406060303060602D6
+:100ABC0002060506050705080509050A050B050CC0
+:0E0ACC00050D050404050503030505020205DA
+:00000001FF
diff --git a/LoLShield/Examples/Basic_Test/applet/Basic_Test.cpp.o b/LoLShield/Examples/Basic_Test/applet/Basic_Test.cpp.o Binary files differnew file mode 100644 index 0000000..c2c6f0e --- /dev/null +++ b/LoLShield/Examples/Basic_Test/applet/Basic_Test.cpp.o diff --git a/LoLShield/Examples/Basic_Test/applet/HardwareSerial.cpp.o b/LoLShield/Examples/Basic_Test/applet/HardwareSerial.cpp.o Binary files differnew file mode 100644 index 0000000..392863d --- /dev/null +++ b/LoLShield/Examples/Basic_Test/applet/HardwareSerial.cpp.o diff --git a/LoLShield/Examples/Basic_Test/applet/LoLShield/Charliplexing.cpp.o b/LoLShield/Examples/Basic_Test/applet/LoLShield/Charliplexing.cpp.o Binary files differnew file mode 100644 index 0000000..8dd2a44 --- /dev/null +++ b/LoLShield/Examples/Basic_Test/applet/LoLShield/Charliplexing.cpp.o diff --git a/LoLShield/Examples/Basic_Test/applet/Print.cpp.o b/LoLShield/Examples/Basic_Test/applet/Print.cpp.o Binary files differnew file mode 100644 index 0000000..8e1cd86 --- /dev/null +++ b/LoLShield/Examples/Basic_Test/applet/Print.cpp.o diff --git a/LoLShield/Examples/Basic_Test/applet/WInterrupts.c.o b/LoLShield/Examples/Basic_Test/applet/WInterrupts.c.o Binary files differnew file mode 100644 index 0000000..3693449 --- /dev/null +++ b/LoLShield/Examples/Basic_Test/applet/WInterrupts.c.o diff --git a/LoLShield/Examples/Basic_Test/applet/WMath.cpp.o b/LoLShield/Examples/Basic_Test/applet/WMath.cpp.o Binary files differnew file mode 100644 index 0000000..c44ea10 --- /dev/null +++ b/LoLShield/Examples/Basic_Test/applet/WMath.cpp.o diff --git a/LoLShield/Examples/Basic_Test/applet/core.a b/LoLShield/Examples/Basic_Test/applet/core.a Binary files differnew file mode 100644 index 0000000..7bfdd1d --- /dev/null +++ b/LoLShield/Examples/Basic_Test/applet/core.a diff --git a/LoLShield/Examples/Basic_Test/applet/pins_arduino.c.o b/LoLShield/Examples/Basic_Test/applet/pins_arduino.c.o Binary files differnew file mode 100644 index 0000000..97f5b31 --- /dev/null +++ b/LoLShield/Examples/Basic_Test/applet/pins_arduino.c.o diff --git a/LoLShield/Examples/Basic_Test/applet/wiring.c.o b/LoLShield/Examples/Basic_Test/applet/wiring.c.o Binary files differnew file mode 100644 index 0000000..8629116 --- /dev/null +++ b/LoLShield/Examples/Basic_Test/applet/wiring.c.o diff --git a/LoLShield/Examples/Basic_Test/applet/wiring_analog.c.o b/LoLShield/Examples/Basic_Test/applet/wiring_analog.c.o Binary files differnew file mode 100644 index 0000000..83850ca --- /dev/null +++ b/LoLShield/Examples/Basic_Test/applet/wiring_analog.c.o diff --git a/LoLShield/Examples/Basic_Test/applet/wiring_digital.c.o b/LoLShield/Examples/Basic_Test/applet/wiring_digital.c.o Binary files differnew file mode 100644 index 0000000..b66890d --- /dev/null +++ b/LoLShield/Examples/Basic_Test/applet/wiring_digital.c.o diff --git a/LoLShield/Examples/Basic_Test/applet/wiring_pulse.c.o b/LoLShield/Examples/Basic_Test/applet/wiring_pulse.c.o Binary files differnew file mode 100644 index 0000000..5d4222a --- /dev/null +++ b/LoLShield/Examples/Basic_Test/applet/wiring_pulse.c.o diff --git a/LoLShield/Examples/Basic_Test/applet/wiring_shift.c.o b/LoLShield/Examples/Basic_Test/applet/wiring_shift.c.o Binary files differnew file mode 100644 index 0000000..f998551 --- /dev/null +++ b/LoLShield/Examples/Basic_Test/applet/wiring_shift.c.o diff --git a/LoLShield/Examples/Life/Life.pde b/LoLShield/Examples/Life/Life.pde new file mode 100644 index 0000000..02d4b7e --- /dev/null +++ b/LoLShield/Examples/Life/Life.pde @@ -0,0 +1,120 @@ +/* + Conway's "Life" + + Writen for the LoL Shield, designed by Jimmie Rodgers: + http://jimmieprodgers.com/kits/lolshield/ + + This needs the Charliplexing library, which you can get at the + LoL Shield project page: http://code.google.com/p/lolshield/ + + Created by Jimmie Rodgers on 12/30/2009. + Adapted from: http://www.arduino.cc/playground/Main/DirectDriveLEDMatrix + + History: + December 30, 2009 - V1.0 first version written at 26C3/Berlin + + This is free software; you can redistribute it and/or + modify it under the terms of the GNU Version 3 General Public + License as published by the Free Software Foundation; + or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include <Charliplexing.h> //Imports the library, which needs to be + //Initialized in setup. + +#define DELAY 150 //Sets the time each generation is shown +#define RESEEDRATE 5000 //Sets the rate the world is re-seeded +#define SIZEX 14 //Sets the X axis size +#define SIZEY 9 //Sets the Y axis size +byte world[SIZEX][SIZEY][2]; //Creates a double buffer world +long density = 50; //Sets density % during seeding +int geck = 0; //Counter for re-seeding + +void setup() { + LedSign::Init(); //Initilizes the LoL Shield + randomSeed(analogRead(5)); + //Builds the world with an initial seed. + for (int i = 0; i < SIZEX; i++) { + for (int j = 0; j < SIZEY; j++) { + if (random(100) < density) { + world[i][j][0] = 1; + } + else { + world[i][j][0] = 0; + } + world[i][j][1] = 0; + } + } +} + +void loop() { + // Birth and death cycle + for (int x = 0; x < SIZEX; x++) { + for (int y = 0; y < SIZEY; y++) { + // Default is for cell to stay the same + world[x][y][1] = world[x][y][0]; + int count = neighbours(x, y); + geck++; + if (count == 3 && world[x][y][0] == 0) { + // A new cell is born + world[x][y][1] = 1; + LedSign::Set(x,y,1); + } + else if ((count < 2 || count > 3) && world[x][y][0] == 1) { + // Cell dies + world[x][y][1] = 0; + LedSign::Set(x,y,0); + } + } + + } + + //Counts and then checks for re-seeding + //Otherwise the display will die out at some point + geck++; + if (geck > RESEEDRATE){ + seedWorld(); + geck = 0; + } + + // Copy next generation into place + for (int x = 0; x < SIZEX; x++) { + for (int y = 0; y < SIZEY; y++) { + world[x][y][0] = world[x][y][1]; + } + } + delay(DELAY); +} + +//Re-seeds based off of RESEEDRATE +void seedWorld(){ + randomSeed(analogRead(5)); + for (int i = 0; i < SIZEX; i++) { + for (int j = 0; j < SIZEY; j++) { + if (random(100) < density) { + world[i][j][1] = 1; + } + } + } +} + +//Runs the rule checks, including screen wrap +int neighbours(int x, int y) { + return world[(x + 1) % SIZEX][y][0] + + world[x][(y + 1) % SIZEY][0] + + world[(x + SIZEX - 1) % SIZEX][y][0] + + world[x][(y + SIZEY - 1) % SIZEY][0] + + world[(x + 1) % SIZEX][(y + 1) % SIZEY][0] + + world[(x + SIZEX - 1) % SIZEX][(y + 1) % SIZEY][0] + + world[(x + SIZEX - 1) % SIZEX][(y + SIZEY - 1) % SIZEY][0] + + world[(x + 1) % SIZEX][(y + SIZEY - 1) % SIZEY][0]; +}
diff --git a/LoLShield/Examples/charli_heart/applet/Charli/Charliplexing.cpp.o b/LoLShield/Examples/charli_heart/applet/Charli/Charliplexing.cpp.o Binary files differnew file mode 100644 index 0000000..c886fbc --- /dev/null +++ b/LoLShield/Examples/charli_heart/applet/Charli/Charliplexing.cpp.o diff --git a/LoLShield/Examples/charli_heart/applet/HardwareSerial.cpp.o b/LoLShield/Examples/charli_heart/applet/HardwareSerial.cpp.o Binary files differnew file mode 100644 index 0000000..392863d --- /dev/null +++ b/LoLShield/Examples/charli_heart/applet/HardwareSerial.cpp.o diff --git a/LoLShield/Examples/charli_heart/applet/Print.cpp.o b/LoLShield/Examples/charli_heart/applet/Print.cpp.o Binary files differnew file mode 100644 index 0000000..8e1cd86 --- /dev/null +++ b/LoLShield/Examples/charli_heart/applet/Print.cpp.o diff --git a/LoLShield/Examples/charli_heart/applet/WInterrupts.c.o b/LoLShield/Examples/charli_heart/applet/WInterrupts.c.o Binary files differnew file mode 100644 index 0000000..3693449 --- /dev/null +++ b/LoLShield/Examples/charli_heart/applet/WInterrupts.c.o diff --git a/LoLShield/Examples/charli_heart/applet/WMath.cpp.o b/LoLShield/Examples/charli_heart/applet/WMath.cpp.o Binary files differnew file mode 100644 index 0000000..c44ea10 --- /dev/null +++ b/LoLShield/Examples/charli_heart/applet/WMath.cpp.o diff --git a/LoLShield/Examples/charli_heart/applet/charli_heart.cpp b/LoLShield/Examples/charli_heart/applet/charli_heart.cpp new file mode 100644 index 0000000..4d227cc --- /dev/null +++ b/LoLShield/Examples/charli_heart/applet/charli_heart.cpp @@ -0,0 +1,99 @@ +/* + Example for Charliplexing library + + Alex Wenger <a.wenger@gmx.de> http://arduinobuch.wordpress.com/ + + History: + 30/Dez/09 - V0.0 wrote the first version at 26C3/Berlin + +*/ +#include "Charliplexing.h" + +#include "WProgram.h" +void setup(); +void heart(); +void loop(); +struct point { + uint8_t xp; // Point Position in X direction (multplied by 16) + uint8_t x_speed; // Speed + uint8_t flag; +} points[9]; + +void setup() // run once, when the sketch starts +{ + LedSign::Init(); + + for(uint8_t i = 0; i < 9; i++) + { + points[i].xp = 0; + points[i].x_speed = random(1, 16); + points[i].flag = 1; + } +} + +uint8_t heart_p[] = { + 4,5, + 3,4, + 2,4, + 5,4, + 6,4, + 7,5, + 1,5, + 7,6, + 1,6, + 6,7, + 2,7, + 5,8, + 3,8, + 4,9, +}; + +void heart() +{ + for(uint8_t y = 0; y < 9; y++) + for(uint8_t x = 3; x < 11; x++) + { + LedSign::Set(x,y,0); + } + for(uint8_t i = 0; i < 14; i++) + { + LedSign::Set(heart_p[i*2+1],heart_p[i*2],1); + } +} + +uint8_t heart_flag; + +void loop() // run over and over again +{ + for(uint8_t i = 0; i < 9; i++) + { + points[i].xp += points[i].x_speed; + if (points[i].xp >= 14*16) + { + points[i].x_speed = random(1, 16); + points[i].xp = 0; + points[i].flag ^= 1; + } + LedSign::Set(points[i].xp/16,i,points[i].flag); + } + + heart_flag++; + if (heart_flag < 20) { + heart(); + } + + delay(40); +} + +int main(void) +{ + init(); + + setup(); + + for (;;) + loop(); + + return 0; +} + diff --git a/LoLShield/Examples/charli_heart/applet/charli_heart.cpp.eep b/LoLShield/Examples/charli_heart/applet/charli_heart.cpp.eep new file mode 100644 index 0000000..1996e8f --- /dev/null +++ b/LoLShield/Examples/charli_heart/applet/charli_heart.cpp.eep @@ -0,0 +1 @@ +:00000001FF
diff --git a/LoLShield/Examples/charli_heart/applet/charli_heart.cpp.elf b/LoLShield/Examples/charli_heart/applet/charli_heart.cpp.elf Binary files differnew file mode 100644 index 0000000..ac6a500 --- /dev/null +++ b/LoLShield/Examples/charli_heart/applet/charli_heart.cpp.elf diff --git a/LoLShield/Examples/charli_heart/applet/charli_heart.cpp.hex b/LoLShield/Examples/charli_heart/applet/charli_heart.cpp.hex new file mode 100644 index 0000000..cb8a859 --- /dev/null +++ b/LoLShield/Examples/charli_heart/applet/charli_heart.cpp.hex @@ -0,0 +1,148 @@ +:100000000C9434000C9451000C9451000C94510049
+:100010000C9451000C9451000C9451000C9451001C
+:100020000C9451000C9426010C9451000C94510036
+:100030000C9451000C9451000C9451000C945100FC
+:100040000C9403020C9451000C9451000C94510038
+:100050000C9451000C9451000C9451000C945100DC
+:100060000C9451000C94510011241FBECFEFD8E026
+:10007000DEBFCDBF13E0A0E0B1E0E8E0F7E002C0F2
+:1000800005900D92A831B107D9F713E0A8E1B3E0CC
+:1000900001C01D92A835B107E1F70E94FC010C9444
+:1000A00082030C940000A0E0B0E0E9E5F0E00C94DD
+:1000B0005303EC01A880B980CA80DB80A114B1048D
+:1000C000C104D10441F484E2A82E89EDB82E8BE559
+:1000D000C82E87E0D82EC601B5012DE133EF41E0EF
+:1000E00050E00E940E0327EA31E440E050E00E9415
+:1000F000EF027B018C01C601B5012DE133EF41E038
+:1001000050E00E940E03CA01B9012CEE34EF4FEF0C
+:100110005FEF0E94EF026E0D7F1D801F911F97FF02
+:1001200004C06150704080409048688379838A831E
+:100130009B839B01AC015F77B901CA01CDB7DEB7E4
+:10014000EAE00C946F030E945300089580E091E070
+:100150000E94530008956093000170930101809301
+:10016000020190930301089520E730E0F9018081B6
+:100170008E7F8083E0EBF0E080818C7F8083A1EB39
+:10018000B0E08C91877F8C93E6EBF0E080818F7DEF
+:100190008083F90180818D7F80838C9184608C9332
+:1001A0008C918C7F8C9386E090E0909319038093E0
+:1001B000180380911803909119038093B2008081F5
+:1001C0008160808308959EE0699FF0011124E80F0B
+:1001D000F11DEE0FFF1FEE0FFF1FDF01AE5DBE4FE3
+:1001E0009C91E05EFE4F8081E92FF0E0982F96957C
+:1001F00096959695282F30E0413099F43297EE0F7E
+:10020000FF1FE90FF11DE65EFC4F2770307081E0A3
+:1002100090E002C0880F991F2A95E2F72081282BD1
+:1002200013C03297EE0FFF1FE90FF11DE65EFC4F82
+:100230002770307081E090E002C0880F991F2A95E6
+:10024000E2F7809520812823208308951F920F9242
+:100250000FB60F9211242F934F935F938F939F9319
+:10026000EF93FF9380911803909119038093B2004C
+:10027000809132038F5F809332038D3010F01092A3
+:10028000320380913203482F50E08630B0F4FA01F7
+:10029000EE0FFF1FE65EFC4F20814E5F5F4F81E057
+:1002A00090E002C0880F991F4A95E2F7822B8AB925
+:1002B0002BB9818184B985B915C0FA01EE0FFF1FF2
+:1002C000E65EFC4F80818AB98BB92181465050404F
+:1002D00081E090E002C0880F991F4A95E2F7822BD7
+:1002E00084B925B9FF91EF919F918F915F914F91C3
+:1002F0002F910F900FBE0F901F9018950F931F9383
+:10030000CF93DF9300E00BC0812F602F40E00E946D
+:10031000E3001F5F1B30C1F70F5F093011F013E0DE
+:10032000F3CFC4E0D1E08981688141E00E94E3001D
+:10033000229681E0C032D807B1F7DF91CF911F91AB
+:100340000F9108950F931F93CF93DF93C3E3D3E0EF
+:1003500010E001E089819881890F8883803E78F0E0
+:1003600061E070E080E090E020E130E040E050E0CB
+:100370000E94D102698318828A8180278A838881BA
+:1003800082958F70612F4A810E94E3001F5F239640
+:10039000193001F780914E038F5F80934E038431B3
+:1003A00010F40E947E0168E270E080E090E00E941C
+:1003B0004B02DF91CF911F910F9108951F93CF931F
+:1003C000DF930E94B400C3E3D3E011E0188261E040
+:1003D00070E080E090E020E130E040E050E00E94FA
+:1003E000D10269831A83239683E0CE34D80771F74C
+:1003F000DF91CF911F9108950E9475020E94DE0146
+:100400000E94A201FDCF1F920F920FB60F921124EE
+:100410002F933F938F939F93AF93BF9380915303F9
+:1004200090915403A0915503B09156033091570316
+:100430000196A11DB11D232F2D5F2D3720F02D57C3
+:100440000196A11DB11D20935703809353039093F0
+:100450005403A0935503B093560380914F0390919A
+:100460005003A0915103B09152030196A11DB11DFB
+:1004700080934F0390935003A0935103B093520382
+:10048000BF91AF919F918F913F912F910F900FBE90
+:100490000F901F901895EF92FF920F931F937B017F
+:1004A0008C018FB7F894409153035091540360919D
+:1004B0005503709156038FBF2FB7F8948091530363
+:1004C00090915403A0915503B09156032FBF841B04
+:1004D000950BA60BB70BE816F9060A071B0760F782
+:1004E0001F910F91FF90EF900895789484B58260EA
+:1004F00084BD84B5816084BD85B5826085BD85B5C8
+:10050000816085BDEEE6F0E0808181608083E1E876
+:10051000F0E0808182608083808181608083E0E878
+:10052000F0E0808181608083E1EBF0E08081846095
+:100530008083E0EBF0E0808181608083EAE7F0E097
+:1005400080818460808380818260808380818160FB
+:1005500080838081806880831092C1000895EF922B
+:10056000FF920F931F937B018C016115710581052B
+:10057000910529F420E030E040E050E00BC00E94FB
+:10058000A600A80197010E940E03AC01CB01DA017D
+:100590009C01AD01B901CA011F910F91FF90EF902D
+:1005A0000895EF92FF920F931F937B018C016217C6
+:1005B00073078407950764F4261B370B480B590B08
+:1005C000CA01B9010E94AF02E60EF71E081F191FEB
+:1005D000B701C8011F910F91FF90EF900895629F9E
+:1005E000D001739FF001829FE00DF11D649FE00D2B
+:1005F000F11D929FF00D839FF00D749FF00D659F8C
+:10060000F00D9927729FB00DE11DF91F639FB00D8A
+:10061000E11DF91FBD01CF011124089597FB092E9B
+:1006200005260ED057FD04D014D00AD0001C38F493
+:1006300050954095309521953F4F4F4F5F4F08950E
+:10064000F6F790958095709561957F4F8F4F9F4FEE
+:100650000895A1E21A2EAA1BBB1BFD010DC0AA1F03
+:10066000BB1FEE1FFF1FA217B307E407F50720F01B
+:10067000A21BB30BE40BF50B661F771F881F991F96
+:100680001A9469F760957095809590959B01AC01DF
+:10069000BD01CF0108952F923F924F925F926F92CA
+:1006A0007F928F929F92AF92BF92CF92DF92EF9202
+:1006B000FF920F931F93CF93DF93CDB7DEB7CA1B83
+:1006C000DB0B0FB6F894DEBF0FBECDBF09942A88AE
+:1006D000398848885F846E847D848C849B84AA8456
+:1006E000B984C884DF80EE80FD800C811B81AA81E3
+:1006F000B981CE0FD11D0FB6F894DEBF0FBECDBFAE
+:08070000ED010895F894FFCF0C
+:1007080001000000040503040204050406040705AB
+:10071800010507060106060702070508030804097C
+:100728000D0005000D0006000D0007000D00080073
+:100738000D0009000D000A000D000B000D000C0053
+:100748000D00040004000D000D00030003000D005F
+:100758000D00020002000D000C0005000C00060050
+:100768000C0007000C0008000C0009000C000A002F
+:100778000C000B000C000D000C00040004000C0021
+:100788000C00030003000C000C00020002000C0027
+:100798000B0005000B0006000B0007000B0008000B
+:1007A8000B0009000B000A000B000C000B000D00E9
+:1007B8000B00040004000B000B00030003000B00F7
+:1007C8000B00020002000B000A0005000A000600E8
+:1007D8000A0007000A0008000A0009000A000B00C6
+:1007E8000A000C000A000D000A00040004000A00B8
+:1007F8000A00030003000A000A00020002000A00BF
+:1008080009000500090006000900070009000800A2
+:1008180009000A0009000B0009000C0009000D007E
+:10082800090004000400090009000300030009008E
+:10083800090002000200090008000500080006007F
+:10084800080007000800090008000A0008000B005B
+:1008580008000C0008000D0008000400040008004F
+:100868000800030003000800080002000200080056
+:100878000700050007000600070008000700090038
+:1008880007000A0007000B0007000C0007000D0016
+:100898000700040004000700070003000300070026
+:1008A8000700020002000700060005000600070016
+:1008B800060008000600090006000A0006000B00F2
+:1008C80006000C0006000D000600040004000600E7
+:1008D80006000300030006000600020002000600EE
+:1008E80005000600050007000500080005000900CE
+:1008F80005000A0005000B0005000C0005000D00AE
+:1009080005000400040005000500030003000500BD
+:080918000500020002000500C9
+:00000001FF
diff --git a/LoLShield/Examples/charli_heart/applet/charli_heart.cpp.o b/LoLShield/Examples/charli_heart/applet/charli_heart.cpp.o Binary files differnew file mode 100644 index 0000000..866a71e --- /dev/null +++ b/LoLShield/Examples/charli_heart/applet/charli_heart.cpp.o diff --git a/LoLShield/Examples/charli_heart/applet/core.a b/LoLShield/Examples/charli_heart/applet/core.a Binary files differnew file mode 100644 index 0000000..55c27ce --- /dev/null +++ b/LoLShield/Examples/charli_heart/applet/core.a diff --git a/LoLShield/Examples/charli_heart/applet/pins_arduino.c.o b/LoLShield/Examples/charli_heart/applet/pins_arduino.c.o Binary files differnew file mode 100644 index 0000000..97f5b31 --- /dev/null +++ b/LoLShield/Examples/charli_heart/applet/pins_arduino.c.o diff --git a/LoLShield/Examples/charli_heart/applet/wiring.c.o b/LoLShield/Examples/charli_heart/applet/wiring.c.o Binary files differnew file mode 100644 index 0000000..8629116 --- /dev/null +++ b/LoLShield/Examples/charli_heart/applet/wiring.c.o diff --git a/LoLShield/Examples/charli_heart/applet/wiring_analog.c.o b/LoLShield/Examples/charli_heart/applet/wiring_analog.c.o Binary files differnew file mode 100644 index 0000000..83850ca --- /dev/null +++ b/LoLShield/Examples/charli_heart/applet/wiring_analog.c.o diff --git a/LoLShield/Examples/charli_heart/applet/wiring_digital.c.o b/LoLShield/Examples/charli_heart/applet/wiring_digital.c.o Binary files differnew file mode 100644 index 0000000..b66890d --- /dev/null +++ b/LoLShield/Examples/charli_heart/applet/wiring_digital.c.o diff --git a/LoLShield/Examples/charli_heart/applet/wiring_pulse.c.o b/LoLShield/Examples/charli_heart/applet/wiring_pulse.c.o Binary files differnew file mode 100644 index 0000000..5d4222a --- /dev/null +++ b/LoLShield/Examples/charli_heart/applet/wiring_pulse.c.o diff --git a/LoLShield/Examples/charli_heart/applet/wiring_shift.c.o b/LoLShield/Examples/charli_heart/applet/wiring_shift.c.o Binary files differnew file mode 100644 index 0000000..f998551 --- /dev/null +++ b/LoLShield/Examples/charli_heart/applet/wiring_shift.c.o diff --git a/LoLShield/Examples/charli_heart/charli_heart.pde b/LoLShield/Examples/charli_heart/charli_heart.pde new file mode 100644 index 0000000..0847dfd --- /dev/null +++ b/LoLShield/Examples/charli_heart/charli_heart.pde @@ -0,0 +1,82 @@ +/*
+ Example for Charliplexing library
+
+ Alex Wenger <a.wenger@gmx.de> http://arduinobuch.wordpress.com/
+
+ History:
+ 30/Dez/09 - V0.0 wrote the first version at 26C3/Berlin
+
+*/
+#include "Charliplexing.h"
+
+struct point {
+ uint8_t xp; // Point Position in X direction (multplied by 16)
+ uint8_t x_speed; // Speed
+ uint8_t flag;
+} points[9];
+
+void setup() // run once, when the sketch starts
+{
+ LedSign::Init();
+
+ for(uint8_t i = 0; i < 9; i++)
+ {
+ points[i].xp = 0;
+ points[i].x_speed = random(1, 16);
+ points[i].flag = 1;
+ }
+}
+
+uint8_t heart_p[] = {
+ 4,5,
+ 3,4,
+ 2,4,
+ 5,4,
+ 6,4,
+ 7,5,
+ 1,5,
+ 7,6,
+ 1,6,
+ 6,7,
+ 2,7,
+ 5,8,
+ 3,8,
+ 4,9,
+};
+
+void heart()
+{
+ for(uint8_t y = 0; y < 9; y++)
+ for(uint8_t x = 3; x < 11; x++)
+ {
+ LedSign::Set(x,y,0);
+ }
+ for(uint8_t i = 0; i < 14; i++)
+ {
+ LedSign::Set(heart_p[i*2+1],heart_p[i*2],1);
+ }
+}
+
+uint8_t heart_flag;
+
+void loop() // run over and over again
+{
+ for(uint8_t i = 0; i < 9; i++)
+ {
+ points[i].xp += points[i].x_speed;
+ if (points[i].xp >= 14*16)
+ {
+ points[i].x_speed = random(1, 16);
+ points[i].xp = 0;
+ points[i].flag ^= 1;
+ }
+ LedSign::Set(points[i].xp/16,i,points[i].flag);
+ }
+
+ heart_flag++;
+ if (heart_flag < 20) {
+ heart();
+ }
+
+ delay(40);
+}
|