diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/Changelog.txt b/Changelog.txt new file mode 100644 index 0000000..af0b19f --- /dev/null +++ b/Changelog.txt @@ -0,0 +1,25 @@ +/** +* @file Changelog.txt +* @author Benjamin Marty (bmarty@kochag.ch) +* @date 09.03.2014 +* @brief Changelog File +* @bug No known bugs. +* @version 1.1.0 +* +*/ + +V1.0.0 +- + +V1.0.1 - 24.02.2015 +-Include von Header File in Header File entfernt +-Neue Funktion taste_1, taste_2, taste_3 und potentiometer. Tastenfunktionen geben 0 bzw. 1 zurück, potentiometer einen Wert zwischen 0-1023 + + +V1.1.0 - 09.03.2015 +!-Es darf keine Instanz mehr im Sketch gebildet werden, wird nun direkt in der Library erledigt! + +-Funktion taste_1...taste_3 entfernt. +-Neue Funktion matrix.read_io() um die matrix.taste_1...matrix.taste_3 variablen zu aktualisieren, gleichzeitig wird auch matrix.potentiometer_0 aktualisiert. +-Neue Funktion matrix.write_array um Array direkt auf Matrix ausgeben zu können +-Examples angepasst Library V1.1 diff --git a/Matrix_RKAG.cpp b/Matrix_RKAG.cpp new file mode 100644 index 0000000..f09d9f9 --- /dev/null +++ b/Matrix_RKAG.cpp @@ -0,0 +1,276 @@ +/** +* @file Matrix_RKAG.cpp +* @author Benjamin Marty (bmarty@kochag.ch) +* @date 09.03.2014 +* @brief cpp File of Matrix_RKAG Library +* @bug No known bugs. +* @version 1.1.0 +* +*/ + + +// include this library's description file +#include "Matrix_RKAG.h" + +#include +#include + +#include + +#include "font.h" +#include "acc_register.h" + +#define RCK A3 //RCK Pin von SR +#define SRCLR A2 //'' + +#define PCF_ADRESS 0x38 //Portexpander Adresse + + +//Zwischenspeicher (Array) für die nächste Ãœbertragung auf die Matrix +int data[8] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; + +//Pin RCK, SRCLR, SS konfiguieren sobald Instanz gebildet wird +matrix_class::matrix_class() +{ + pinMode(RCK, OUTPUT); //Register Clock high Pegel sensitive + pinMode(SRCLR, OUTPUT); //SRClear low Pegel sensitive + pinMode(SS, OUTPUT); + + digitalWrite(RCK, 0); + digitalWrite(SRCLR, 1); + digitalWrite(SS, 1); +} + +//Schlaufe die auf den Hardware Timer angebunden ist +void matrix_timer() +{ + static int zaehler; + + //SR Speicher Reset + digitalWrite(SRCLR, 1); + digitalWrite(SRCLR, 0); + digitalWrite(SRCLR, 1); + + //Zeile + SPI.transfer(0x80 >> zaehler); + + //Daten aus Matrix Array rüberschiben + SPI.transfer(data[zaehler]); + + //Puls generieren -> Schieberegister auf Output Buffer schalten + digitalWrite(RCK, 0); + digitalWrite(RCK, 1); + digitalWrite(RCK, 0); + + if (zaehler == 7) + { + //Zaehler auf 0 stellen um erneut wieder 8 Bit zu uebetragen + zaehler = 0; + } + else + { + //Zaehler hochzaehlen da noch nicht 8 Bit erreicht + zaehler++; + } +} + +//Initalisierung (Timer konfiguieren, SPI initalisieren) +void matrix_class::init() +{ + Wire.begin(); //I2C Interface starten und Bus als Master betreten + //pcf_write(0x00); //PCF reseten + + Timer1.initialize(800); //1000000 = 1 Sekunde - 80000 = 8ms = ca. 15.6Hz Updaterate des kompletten Bild + Timer1.attachInterrupt(matrix_timer); //Funktion matrix_timer bei jedem Timerueberlauf ausführen + + SPI.begin(); //SPI Starten + SPI.setClockDivider(SPI_CLOCK_DIV128); //16Mhz/128 = 125kHz + SPI.setBitOrder(LSBFIRST); //MSB zuerst senden + +} + +//Updateroutine für I/O Hardware an der Matrix +int matrix_class::read_io() +{ + char counter_value = 2; + char pcf_state; + + microseconds_now = micros(); //Aktuellen us Wert speichern + pcf_state = pcf_read(); //Aktuellen Wert aus PCF Portexpander speichern + potentiometer_0 = 1023-(analogRead(A0)); //Potentiometer lesen und in potentiometer_0 schreiben + + //Werte der drei Tasten reseten + taste_1 = 0; + taste_2 = 0; + taste_3 = 0; + + //Prüfen ob seit dem letzten mal bereits 5ms vergangen sind. + if((microseconds_now - microseconds_saved) > 5000) + { + //Prüfen ob Taste gedrückt, wenn ja Zähler hochzählen, wenn nicht Zähler auf 0 + if(pcf_state & 0x01) + { + counter_taste_1++; + } + + if(pcf_state & 0x02) + { + counter_taste_2++; + } + + if(pcf_state & 0x04) + { + counter_taste_3++; + } + + //Aktuelle micros speichern für nächsten Durchgang + microseconds_saved = micros(); + } + + //Wenn der Counter höher als counter_value ist & das Bit des entsprechenden Taster Low ist dann taste gedrückt worden + if(counter_taste_1 > counter_value && (!(pcf_state & 0x01))) + { + taste_1 = 1; + counter_taste_1 = 0; + } + + + if(counter_taste_2 > counter_value && (!(pcf_state & 0x02))) + { + taste_2 = 1; + counter_taste_2 = 0; + } + + + if(counter_taste_3 > counter_value && (!(pcf_state & 0x04))) + { + taste_3 = 1; + counter_taste_3 = 0; + } +} + +//Matrix Schreibfunktion um Daten auf die Matrix zu schreiben +void matrix_class::write(char byte1, char byte2, char byte3, char byte4, char byte5, char byte6, char byte7, char byte8) +{ + //Vom Nutzer stammende Daten Byte für Byte ins Data Array kopieren + data[0] = byte1; + data[1] = byte2; + data[2] = byte3; + data[3] = byte4; + data[4] = byte5; + data[5] = byte6; + data[6] = byte7; + data[7] = byte8; +} + +//Matrix Schreibfunktion um Daten von einem Array auf die Matrix zu schreiben +void matrix_class::write_array(char matrix[]) +{ + //Vom Nutzer stammende Daten Byte für Byte ins Data Array kopieren + data[0] = matrix[0]; + data[1] = matrix[1]; + data[2] = matrix[2]; + data[3] = matrix[3]; + data[4] = matrix[4]; + data[5] = matrix[5]; + data[6] = matrix[6]; + data[7] = matrix[7]; +} + +//Matrix Löschfunktion +void matrix_class::clear(void) +{ + //Alle 8 Byte löschen + for(int x = 0; x < 8; x++) + { + data[x] = 0; + } +} + +//Matrix Sample/Muster Funktion +void matrix_class::sample(int number) +{ + //Prüfen welches Muster, danach entsprechende Muster in Data Array kopieren + switch(number) + { + case 0: + data[0] = 0b10101010; + data[1] = 0b01010101; + data[2] = 0b10101010; + data[3] = 0b01010101; + data[4] = 0b10101010; + data[5] = 0b01010101; + data[6] = 0b10101010; + data[7] = 0b01010101; + break; + case 1: + data[0] = ~0b10101010; + data[1] = ~0b01010101; + data[2] = ~0b10101010; + data[3] = ~0b01010101; + data[4] = ~0b10101010; + data[5] = ~0b01010101; + data[6] = ~0b10101010; + data[7] = ~0b01010101; + break; + } +} + +//Matrix Font Funktion +void matrix_class::font_write(int numb) +{ + //Buffer um Font aus Flash in SRAM zwischenzuspeichern + char buffer[8]; + + matrix_class::write(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); + + //Font Daten aus Flash Speicher holen und in Matrix Array schreiben + for(int x = 0; x <= 7; x++) + { + buffer[x] = pgm_read_byte(&font[numb][x]); + } + + for(int x = 0; x <= 7; x++) + { + for(int z = 0; z <= 7; z++) + { + if(buffer[x] & (0x01 << z)) + { + data[x] |= (0x80 >> z) << 1; + } + + } + } +} + +//PCF Ausgabe Funktion +void matrix_class::pcf_write(int data) +{ + Wire.beginTransmission(PCF_ADRESS); + + Wire.write((~(0x07) & data )); //Daten schreiben, hinterste 3 Bit ignorieren da daran die Taster sind. Diese Zeile kommentieren falls untere Zeile auskommentiert wird. + + //Wire.write(data); //Diese Zeile auskommentieren falls auch die 3 "gesperrten" Bits am Ende genutzt werden wollen. + + Wire.endTransmission(); + +} + +//PCF Eingabe Funktion +int matrix_class::pcf_read() +{ + int pcf_buffer; + + Wire.beginTransmission(PCF_ADRESS); + + Wire.requestFrom(PCF_ADRESS, 1); + + while(Wire.available() == 0); + + pcf_buffer = Wire.read(); + + return pcf_buffer; +} + +matrix_class matrix; + diff --git a/Matrix_RKAG.h b/Matrix_RKAG.h new file mode 100644 index 0000000..298c883 --- /dev/null +++ b/Matrix_RKAG.h @@ -0,0 +1,58 @@ +/** +* @file Matrix_RKAG.h +* @author Benjamin Marty (bmarty@kochag.ch) +* @date 09.03.2014 +* @brief Header File of Matrix_RKAG Library +* @bug No known bugs. +* @version 1.1.0 +* +*/ + + +// ensure this library description is only included once +#ifndef Matrix_RKAG_h +#define Matrix_RKAG_h + +#include "Arduino.h" + +#include +#include + +// library interface description +class matrix_class +{ + // user-accessible "public" interface + public: + matrix_class(); + + void init(); + int read_io(); + + void write(char byte1, char byte2, char byte3, char byte4, char byte5, char byte6, char byte7, char byte8); + void write_array(char matrix[]); + void clear(); + void sample(int numb); + void font_write(int numb); + + void pcf_write(int data); + int pcf_read(); + + int taste_1; + int taste_2; + int taste_3; + + int potentiometer_0; + + private: + unsigned long microseconds_now; + unsigned long microseconds_saved; + + int counter_taste_1; + int counter_taste_2; + int counter_taste_3; +}; + +extern matrix_class matrix; + +#endif + diff --git a/TimerOne.cpp b/TimerOne.cpp new file mode 100644 index 0000000..7a52ae0 --- /dev/null +++ b/TimerOne.cpp @@ -0,0 +1,101 @@ +/* + * Interrupt and PWM utilities for 16 bit Timer1 on ATmega168/328 + * Original code by Jesse Tane for http://labs.ideo.com August 2008 + * Modified March 2009 by Jérôme Despatis and Jesse Tane for ATmega328 support + * Modified June 2009 by Michael Polli and Jesse Tane to fix a bug in setPeriod() which caused the timer to stop + * + * This is free software. You can redistribute it and/or modify it under + * the terms of Creative Commons Attribution 3.0 United States License. + * To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/us/ + * or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. + * + */ + +#include "TimerOne.h" + +TimerOne Timer1; // preinstatiate + +ISR(TIMER1_OVF_vect) // interrupt service routine that wraps a user defined function supplied by attachInterrupt +{ + Timer1.isrCallback(); +} + +void TimerOne::initialize(long microseconds) +{ + TCCR1A = 0; // clear control register A + TCCR1B = _BV(WGM13); // set mode as phase and frequency correct pwm, stop the timer + setPeriod(microseconds); +} + +void TimerOne::setPeriod(long microseconds) +{ + long cycles = (F_CPU * microseconds) / 2000000; // the counter runs backwards after TOP, interrupt is at BOTTOM so divide microseconds by 2 + if(cycles < RESOLUTION) clockSelectBits = _BV(CS10); // no prescale, full xtal + else if((cycles >>= 3) < RESOLUTION) clockSelectBits = _BV(CS11); // prescale by /8 + else if((cycles >>= 3) < RESOLUTION) clockSelectBits = _BV(CS11) | _BV(CS10); // prescale by /64 + else if((cycles >>= 2) < RESOLUTION) clockSelectBits = _BV(CS12); // prescale by /256 + else if((cycles >>= 2) < RESOLUTION) clockSelectBits = _BV(CS12) | _BV(CS10); // prescale by /1024 + else cycles = RESOLUTION - 1, clockSelectBits = _BV(CS12) | _BV(CS10); // request was out of bounds, set as maximum + ICR1 = pwmPeriod = cycles; // ICR1 is TOP in p & f correct pwm mode + TCCR1B &= ~(_BV(CS10) | _BV(CS11) | _BV(CS12)); + TCCR1B |= clockSelectBits; // reset clock select register +} + +void TimerOne::setPwmDuty(char pin, int duty) +{ + unsigned long dutyCycle = pwmPeriod; + dutyCycle *= duty; + dutyCycle >>= 10; + if(pin == 1 || pin == 9) OCR1A = dutyCycle; + else if(pin == 2 || pin == 10) OCR1B = dutyCycle; +} + +void TimerOne::pwm(char pin, int duty, long microseconds) // expects duty cycle to be 10 bit (1024) +{ + if(microseconds > 0) setPeriod(microseconds); + if(pin == 1 || pin == 9) { + DDRB |= _BV(PORTB1); // sets data direction register for pwm output pin + TCCR1A |= _BV(COM1A1); // activates the output pin + } + else if(pin == 2 || pin == 10) { + DDRB |= _BV(PORTB2); + TCCR1A |= _BV(COM1B1); + } + setPwmDuty(pin, duty); + start(); +} + +void TimerOne::disablePwm(char pin) +{ + if(pin == 1 || pin == 9) TCCR1A &= ~_BV(COM1A1); // clear the bit that enables pwm on PB1 + else if(pin == 2 || pin == 10) TCCR1A &= ~_BV(COM1B1); // clear the bit that enables pwm on PB2 +} + +void TimerOne::attachInterrupt(void (*isr)(), long microseconds) +{ + if(microseconds > 0) setPeriod(microseconds); + isrCallback = isr; // register the user's callback with the real ISR + TIMSK1 = _BV(TOIE1); // sets the timer overflow interrupt enable bit + sei(); // ensures that interrupts are globally enabled + start(); +} + +void TimerOne::detachInterrupt() +{ + TIMSK1 &= ~_BV(TOIE1); // clears the timer overflow interrupt enable bit +} + +void TimerOne::start() +{ + TCCR1B |= clockSelectBits; +} + +void TimerOne::stop() +{ + TCCR1B &= ~(_BV(CS10) | _BV(CS11) | _BV(CS12)); // clears all clock selects bits +} + +void TimerOne::restart() +{ + TCNT1 = 0; +} diff --git a/TimerOne.h b/TimerOne.h new file mode 100644 index 0000000..174a745 --- /dev/null +++ b/TimerOne.h @@ -0,0 +1,46 @@ +/* + * Interrupt and PWM utilities for 16 bit Timer1 on ATmega168/328 + * Original code by Jesse Tane for http://labs.ideo.com August 2008 + * Modified March 2009 by Jérôme Despatis and Jesse Tane for ATmega328 support + * Modified June 2009 by Michael Polli and Jesse Tane to fix a bug in setPeriod() which caused the timer to stop + * + * This is free software. You can redistribute it and/or modify it under + * the terms of Creative Commons Attribution 3.0 United States License. + * To view a copy of this license, visit http://creativecommons.org/licenses/by/3.0/us/ + * or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA. + * + */ + +#ifndef TimerOne_H +#define TimerOne_H + +#include +#include + +#define RESOLUTION 65536 // Timer1 is 16 bit + +class TimerOne +{ + public: + + // properties + unsigned int pwmPeriod; + unsigned char clockSelectBits; + + // methods + void initialize(long microseconds=1000000); + void start(); + void stop(); + void restart(); + void pwm(char pin, int duty, long microseconds=-1); + void disablePwm(char pin); + void attachInterrupt(void (*isr)(), long microseconds=-1); + void detachInterrupt(); + void setPeriod(long microseconds); + void setPwmDuty(char pin, int duty); + void (*isrCallback)(); +}; + +extern TimerOne Timer1; + +#endif diff --git a/acc_register.h b/acc_register.h new file mode 100644 index 0000000..4305d22 --- /dev/null +++ b/acc_register.h @@ -0,0 +1,46 @@ +//Registernamen für ACC +enum acc_register +{ + STATUS = 0x00, + OUT_X_MSB = 0x01, + OUT_X_LSB = 0x02, + OUT_Y_MSB = 0x03, + OUT_Y_LSB = 0x04, + OUT_Z_MSB = 0x05, + OUT_Z_LSB = 0x06, + SYSMOD = 0x0B, + INT_SOURCE = 0x0C, + WHO_AM_I = 0x0D, + XYZ_DATA_CFG = 0x0E, + HP_FILTER_CUTOFF = 0x0F, + PL_STATUS = 0x10, + PL_CFG = 0x11, + PL_COUNT = 0x12, + PL_BF_ZCOMP = 0x13, + P_L_THS_REG = 0x14, + FF_MT_CFG = 0x15, + FF_MT_SRC = 0x16, + FF_MT_THS = 0x17, + FF_MT_COUNT = 0x18, + TRANSIENT_CFG = 0x1D, + TRANSIENT_SRC = 0x1E, + TRANSIENT_THS = 0x1F, + TRANSIENT_COUNT = 0x20, + PULSE_CFG = 0x21, + PULSE_SRC = 0x22, + PULSE_THSX = 0x23, + PULSE_THSY = 0x24, + PULSE_THSZ = 0x25, + PULSE_TMLT = 0x26, + PULSE_LTCY = 0x27, + PULSE_WIND = 0x28, + ASLP_COUNT = 0x29, + CTRL_REG1 = 0x2A, + CTRL_REG2 = 0x2B, + CTRL_REG3 = 0x2C, + CTRL_REG4 = 0x2D, + CTRL_REG5 = 0x2E, + OFF_X = 0x2F, + OFF_Y = 0x30, + OFF_Z = 0x31 +}; \ No newline at end of file diff --git a/examples/ACC_DEMO/ACC_DEMO.atsuo b/examples/ACC_DEMO/ACC_DEMO.atsuo new file mode 100644 index 0000000..047c160 Binary files /dev/null and b/examples/ACC_DEMO/ACC_DEMO.atsuo differ diff --git a/examples/ACC_DEMO/ACC_DEMO.ino b/examples/ACC_DEMO/ACC_DEMO.ino new file mode 100644 index 0000000..fd379fb --- /dev/null +++ b/examples/ACC_DEMO/ACC_DEMO.ino @@ -0,0 +1,211 @@ +/** +* @file ACC_DEMO.ino +* @author Benjamin Marty (bmarty@kochag.ch) +* @date 25.2.2015 +* @brief +* @bug No known bugs. +* +*/ + +#include "Matrix_RKAG.h" + +#include "SPI.h" +#include "Wire.h" + +int MMA8452_ADDRESS = 0x1D; //Definition von I2C Adresse von Accelerometer + + +//Variable for the left and right move +int move = 0; + +//Define a few of the registers that we will be accessing on the MMA8452 +#define OUT_X_MSB 0x01 +#define XYZ_DATA_CFG 0x0E +#define WHO_AM_I 0x0D +#define CTRL_REG1 0x2A + +#define GSCALE 2 // Sets full-scale range to +/-2, 4, or 8g. Used to calc real g values. + + + +void setup() +{ + //Initalisierung der Matrix HW Komponenten + matrix.init(); + + //Test and intialize the MMA8452 + initMMA8452(); +} + +void loop() +{ + int accelCount[3]; // Stores the 12-bit signed value + readAccelData(accelCount); // Read the x/y/z adc values + + // Now we'll calculate the accleration value into actual g's + float accelG[3]; // Stores the real accel value in g's + for (int i = 0 ; i < 3 ; i++) + { + accelG[i] = (float) accelCount[i] / ((1<<12)/(2*GSCALE)); // get actual g value, this depends on scale being set + } + + /* + // Print out values + for (int i = 0 ; i < 3 ; i++) + { + Serial.print(accelG[i], 4); // Print g values + Serial.print("\t"); // tabs in between axes + } + Serial.println(); + + */ + + move = ((accelG[0] + 1) * 4); + + if((accelG[1] >= 0.8) && (accelG[1] <= 0.95)) + { + matrix.write((0x80 >> move), 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); + } + if((accelG[1] >= 0.5) && (accelG[1] <= 0.7)) + { + matrix.write(0x00, (0x80 >> move), 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); + } + if((accelG[1] >= 0.2) && (accelG[1] <= 0.4)) + { + matrix.write(0x00, 0x00, (0x80 >> move), 0x00, 0x00, 0x00, 0x00, 0x00); + } + if((accelG[1] >= 0) && (accelG[1] <= 0.2)) + { + matrix.write(0x00, 0x00, 0x00, (0x80 >> move), 0x00, 0x00, 0x00, 0x00); + } + + if((accelG[1] >= -0.2) && (accelG[1] <= -0)) + { + matrix.write(0x00, 0x00, 0x00, 0x00, (0x80 >> move), 0x00, 0x00, 0x00); + } + if((accelG[1] >= -0.4) && (accelG[1] <= -0.2)) + { + matrix.write(0x00, 0x0, 0x00, 0x00, 0x00, (0x80 >> move), 0x00, 0x00); + } + if((accelG[1] >= -0.7) && (accelG[1] <= -0.5)) + { + matrix.write(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (0x80 >> move), 0x00); + } + if((accelG[1] >= -0.95) && (accelG[1] <= -0.8)) + { + matrix.write(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (0x80 >> move)); + } + + //20ms warten + delay(10); +} + + + + +//Accelerometer Functions got from Sparkfun Library + +// Read bytesToRead sequentially, starting at addressToRead into the dest byte array +void readRegisters(byte addressToRead, int bytesToRead, byte * dest) +{ + Wire.beginTransmission(MMA8452_ADDRESS); + Wire.write(addressToRead); + Wire.endTransmission(false); //endTransmission but keep the connection active + + Wire.requestFrom(MMA8452_ADDRESS, bytesToRead); //Ask for bytes, once done, bus is released by default + + while(Wire.available() < bytesToRead); //Hang out until we get the # of bytes we expect + + for(int x = 0 ; x < bytesToRead ; x++) + dest[x] = Wire.read(); +} + +// Read a single byte from addressToRead and return it as a byte +byte readRegister(byte addressToRead) +{ + Wire.beginTransmission(MMA8452_ADDRESS); + Wire.write(addressToRead); + Wire.endTransmission(false); //endTransmission but keep the connection active + + Wire.requestFrom(MMA8452_ADDRESS, 1); //Ask for 1 byte, once done, bus is released by default + + while(!Wire.available()) ; //Wait for the data to come back + return Wire.read(); //Return this one byte +} + +// Writes a single byte (dataToWrite) into addressToWrite +void writeRegister(byte addressToWrite, byte dataToWrite) +{ + Wire.beginTransmission(MMA8452_ADDRESS); + Wire.write(addressToWrite); + Wire.write(dataToWrite); + Wire.endTransmission(); //Stop transmitting +} + +// Sets the MMA8452 to standby mode. It must be in standby to change most register settings +void MMA8452Standby() +{ + byte c = readRegister(CTRL_REG1); + writeRegister(CTRL_REG1, c & ~(0x01)); //Clear the active bit to go into standby +} + +// Sets the MMA8452 to active mode. Needs to be in this mode to output data +void MMA8452Active() +{ + byte c = readRegister(CTRL_REG1); + writeRegister(CTRL_REG1, c | 0x01); //Set the active bit to begin detection +} + +// Initialize the MMA8452 registers +// See the many application notes for more info on setting all of these registers: +// http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=MMA8452Q +void initMMA8452() +{ + byte c = readRegister(WHO_AM_I); // Read WHO_AM_I register + /* + if (c == 0x2A) // WHO_AM_I should always be 0x2A + { + Serial.println("MMA8452Q is online..."); + } + else + { + Serial.print("Could not connect to MMA8452Q: 0x"); + Serial.println(c, HEX); + while(1) ; // Loop forever if communication doesn't happen + } + */ + MMA8452Standby(); // Must be in standby to change registers + + // Set up the full scale range to 2, 4, or 8g. + byte fsr = GSCALE; + if(fsr > 8) fsr = 8; //Easy error check + fsr >>= 2; // Neat trick, see page 22. 00 = 2G, 01 = 4A, 10 = 8G + writeRegister(XYZ_DATA_CFG, fsr); + + //The default data rate is 800Hz and we don't modify it in this example code + + MMA8452Active(); // Set to active to start reading +} + +void readAccelData(int *destination) +{ + byte rawData[6]; // x/y/z accel register data stored here + + readRegisters(OUT_X_MSB, 6, rawData); // Read the six raw data registers into data array + + // Loop to calculate 12-bit ADC and g value for each axis + for(int i = 0; i < 3 ; i++) + { + int gCount = (rawData[i*2] << 8) | rawData[(i*2)+1]; //Combine the two 8 bit registers into one 12-bit number + gCount >>= 4; //The registers are left align, here we right align the 12-bit integer + + // If the number is negative, we have to make it so manually (no 12-bit data type) + if (rawData[i*2] > 0x7F) + { + gCount = ~gCount + 1; + gCount *= -1; // Transform into negative 2's complement # + } + + destination[i] = gCount; //Record this gCount into the 3 int array + } +} diff --git a/examples/ACC_DEMO/ACC_TOOL.atsuo b/examples/ACC_DEMO/ACC_TOOL.atsuo new file mode 100644 index 0000000..cae3c89 Binary files /dev/null and b/examples/ACC_DEMO/ACC_TOOL.atsuo differ diff --git a/examples/BINAERZAEHLER/BINAERZAEHLER.ino b/examples/BINAERZAEHLER/BINAERZAEHLER.ino new file mode 100644 index 0000000..609a041 --- /dev/null +++ b/examples/BINAERZAEHLER/BINAERZAEHLER.ino @@ -0,0 +1,49 @@ +/** +* @file BINAERZAEHLER.ino +* @author Benjamin Marty (bmarty@kochag.ch) +* @date 14.12.2014 +* @date 14.01.2015 +* @brief Main File of BINAERZAEHLER Example +* @bug No known bugs. +* +*/ + +#include "Matrix_RKAG.h" + +#include "SPI.h" +#include "Wire.h" + + +//Zahlvariabel fuer innerhalb vom Main +int x = 0; + +void setup() +{ + //Initalisierung der Matrix HW Komponenten + matrix.init(); + + +} + +void loop() +{ + + + //Wenn x 255 entspricht + if(x == 255) + { + //x auf null setzen da 8Bit = maximal Dezimal 255 + x = 0; + } + else + { + //x inkrementieren + x++; + } + + //oberste Zeile entsprechend x in Binaer ausgeben, restliche Zeilen 0 + matrix.write(x, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); + + //20ms warten + delay(20); +} diff --git a/examples/EIN_AUS_DEMO/EIN_AUS_DEMO.ino b/examples/EIN_AUS_DEMO/EIN_AUS_DEMO.ino new file mode 100644 index 0000000..456c147 --- /dev/null +++ b/examples/EIN_AUS_DEMO/EIN_AUS_DEMO.ino @@ -0,0 +1,36 @@ +/** +* @file EIN_AUS_DEMO.ino +* @author Benjamin Marty (bmarty@kochag.ch) +* @date 17.12.2014 +* @brief Main File of EIN_AUS_DEMO Example +* @bug No known bugs. +* +*/ + +#include "Matrix_RKAG.h" + +#include +#include + + +void setup() +{ + //Initalisierung der Matrix HW Komponenten + matrix.init(); +} + + +void loop() +{ + //Speicher von Matrix leeren + matrix.clear(); + + //1s warten + delay(1000); + + //Die 8 angegebenen Bytes in Matrix Speicher übernehmen + matrix.write(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF); + + //1s warten + delay(1000); +} diff --git a/examples/EIN_AUS_DEMO/EIN_AUS_DEMO_Struktogramm_V1.pdf b/examples/EIN_AUS_DEMO/EIN_AUS_DEMO_Struktogramm_V1.pdf new file mode 100644 index 0000000..38e72be Binary files /dev/null and b/examples/EIN_AUS_DEMO/EIN_AUS_DEMO_Struktogramm_V1.pdf differ diff --git a/examples/EIN_AUS_DEMO/EIN_AUS_DEMO_Struktogramm_V1.stg b/examples/EIN_AUS_DEMO/EIN_AUS_DEMO_Struktogramm_V1.stg new file mode 100644 index 0000000..e720299 Binary files /dev/null and b/examples/EIN_AUS_DEMO/EIN_AUS_DEMO_Struktogramm_V1.stg differ diff --git a/examples/FONT_WRITER/FONT_WRITER.ino b/examples/FONT_WRITER/FONT_WRITER.ino new file mode 100644 index 0000000..2343b0b --- /dev/null +++ b/examples/FONT_WRITER/FONT_WRITER.ino @@ -0,0 +1,49 @@ +/** +* @file FONT_WRITER.ino +* @author Benjamin Marty (bmarty@kochag.ch) +* @date 20.12.2014 +* @brief Main File of FONT_WRITER Example +* @bug No known bugs. +* +*/ + +#include "Matrix_RKAG.h" + +#include "SPI.h" +#include "Wire.h" + + + +void setup() +{ + //Initalisierung der Matrix HW Komponenten + matrix.init(); +} + + +void loop() +{ + + //Speicher von Matrix leeren + matrix.clear(); + + for(int x = 65; x <= 90; x++) + { + matrix.font_write(x); + + delay(500); + } + + matrix.font_write(142); + + delay(500); + + matrix.font_write(153); + + delay(500); + + matrix.font_write(154); + + delay(500); + +} diff --git a/examples/FONT_WRITER_KEY/FONT_WRITER_KEY.ino b/examples/FONT_WRITER_KEY/FONT_WRITER_KEY.ino new file mode 100644 index 0000000..9a5115a --- /dev/null +++ b/examples/FONT_WRITER_KEY/FONT_WRITER_KEY.ino @@ -0,0 +1,48 @@ +/** +* @file FONT_WRITER_KEY.ino +* @author Benjamin Marty (bmarty@kochag.ch) +* @date 20.12.2014 +* @brief Main File of FONT_WRITER_KEY Example +* @bug No known bugs. +* +*/ + +#include "Matrix_RKAG.h" + +#include "SPI.h" +#include "Wire.h" + +void setup() +{ + //Initalisierung der Matrix HW Komponenten + matrix.init(); +} + + +void loop() +{ + //Eingänge (Potentiometer + 3Taster abfragen und aktualisieren + matrix.read_io(); + + //Prüfen ob Taste 1 gedrückt + if(matrix.taste_1) + { + //Ascii Zeichen ausgeben + matrix.font_write(49); + } + + //Prüfen ob Taste 2 gedrückt + if(matrix.taste_2) + { + //Ascii Zeichen ausgeben + matrix.font_write(50); + } + + //Prüfen ob Taste 3 gedrückt + if(matrix.taste_3) + { + //Ascii Zeichen ausgeben + matrix.font_write(51); + } +} + diff --git a/examples/FONT_WRITER_POTI/FONT_WRITER_KEY.ino b/examples/FONT_WRITER_POTI/FONT_WRITER_KEY.ino new file mode 100644 index 0000000..79c7d4e --- /dev/null +++ b/examples/FONT_WRITER_POTI/FONT_WRITER_KEY.ino @@ -0,0 +1,41 @@ +/** +* @file FONT_WRITER_KEY.ino +* @author Benjamin Marty (bmarty@kochag.ch) +* @date 20.12.2014 +* @brief Main File of FONT_WRITER_KEY Example +* @bug No known bugs. +* +*/ + +#include "Matrix_RKAG.h" + +#include "SPI.h" +#include "Wire.h" + +void setup() +{ + //Initalisierung der Matrix HW Komponenten + matrix.init(); + + //attachInterrupt(0, taster, FALLING); +} + + +void loop() +{ + switch(matrix.key()) + { + case 1: + matrix.font_write(49); + break; + + case 2: + matrix.font_write(50); + break; + + case 3: + matrix.font_write(51); + break; + } +} + diff --git a/examples/FONT_WRITER_POTI/FONT_WRITER_POTI.ino b/examples/FONT_WRITER_POTI/FONT_WRITER_POTI.ino new file mode 100644 index 0000000..cfae6b6 --- /dev/null +++ b/examples/FONT_WRITER_POTI/FONT_WRITER_POTI.ino @@ -0,0 +1,30 @@ +/** +* @file FONT_WRITER_POTI.ino +* @author Benjamin Marty (bmarty@kochag.ch) +* @date 20.12.2014 +* @brief Main File of FONT_WRITER_POTI Example +* @bug No known bugs. +* +*/ + +#include "Matrix_RKAG.h" + +#include "SPI.h" +#include "Wire.h" + +void setup() +{ + //Initalisierung der Matrix HW Komponenten + matrix.init(); + +} + + +void loop() +{ + matrix.read_io(); + + matrix.font_write(matrix.potentiometer_0/40+65); + + delay(20); +} diff --git a/examples/MUSTER_DEMO/MUSTER_DEMO.ino b/examples/MUSTER_DEMO/MUSTER_DEMO.ino new file mode 100644 index 0000000..05dd24a --- /dev/null +++ b/examples/MUSTER_DEMO/MUSTER_DEMO.ino @@ -0,0 +1,34 @@ +/** +* @file EIN_AUS_DEMO.ino +* @author Benjamin Marty (bmarty@kochag.ch) +* @date 17.12.2014 +* @brief Main File of EIN_AUS_DEMO Example +* @bug No known bugs. +* +*/ + +#include "Matrix_RKAG.h" + +#include "SPI.h" +#include "Wire.h" + +void setup() +{ + //Initalisierung der Matrix HW Komponenten + matrix.init(); +} + +void loop() +{ + //Speicher von Matrix leeren + matrix.clear(); + + //1s warten + delay(1000); + + //Matrix Muster 1 in Speicher schreiben + matrix.sample(1); + + //1s warten + delay(1000); +} diff --git a/examples/Scrolldemo/Scroll_Demo.pdf b/examples/Scrolldemo/Scroll_Demo.pdf new file mode 100644 index 0000000..e848a0a Binary files /dev/null and b/examples/Scrolldemo/Scroll_Demo.pdf differ diff --git a/examples/Scrolldemo/Scroll_Demo.stg b/examples/Scrolldemo/Scroll_Demo.stg new file mode 100644 index 0000000..713af7c Binary files /dev/null and b/examples/Scrolldemo/Scroll_Demo.stg differ diff --git a/examples/Scrolldemo/Scrolldemo.atsuo b/examples/Scrolldemo/Scrolldemo.atsuo new file mode 100644 index 0000000..9afdf87 Binary files /dev/null and b/examples/Scrolldemo/Scrolldemo.atsuo differ diff --git a/examples/Scrolldemo/Scrolldemo.ino b/examples/Scrolldemo/Scrolldemo.ino new file mode 100644 index 0000000..0ee108d --- /dev/null +++ b/examples/Scrolldemo/Scrolldemo.ino @@ -0,0 +1,98 @@ +/** +* @file Scrolldemo.ino +* @author Benjamin Marty (bmarty@kochag.ch) +* @date 2.2.2015 +* @brief Main File for the Matrix +* @bug Why so much Ram Usage?! +* +*/ + +#include + +#include +#include "SPI.h" +#include + +#include "font.h" + + +//Allgemeine Variabeln für den Scroller +boolean space[8][180]; +char buffer2[8]; +char screen[8]; + +void writer(int numb, int stell) +{ + int pos; + + pos = (stell * 6) - 8; + + //Font Daten aus Flash Speicher holen und in Matrix Array schreiben + for(int x = 0; x <= 7; x++) + { + buffer2[x] = pgm_read_byte(&font[numb][x]); + } + + //Buffer (Zeichenbuffer/Eigentliche Zeichen) in Space schreiben + for(int x = 0; x <= 7; x++) //Zeile wählen + { + for(int c = 1; c <= 8; c++) //Hilfszahl/Spalte wählen + { + if(buffer2[x] & (0x01 << (c - 1))) //Prüfen ob entsprechendes Bit gesetzt ist (Anhand kopierten Bits aus dem Flash PGM) + { + space[x][(c-1)+pos] = 1; //Bit im Space setzen + } + else + { + if(c > 2) //Hintersten 3 Spalten ignorieren da im normalfall leer und überlappend + { + space[x][(c-1)+pos] = 0; //Bit löschen + } + } + } + } +} + +void cutscreen(int offset) +{ + //Space in einen 8x8 Auschnitt schneiden um diesen danach ausgeben zu können + for(int y = 0; y <= 7; y++) //Zeile wählen + { + for(int d = 0; d <= 7; d++) //Spalte wählen + { + if(space[y][d+offset] == 1) //Prüfen ob Bit im Space gesetzt ist und entsprechend auf Screen verfahren. Offset wird übergeben beim Aufruf -> Position + { + screen[y] |= (0x80 >> d); + } + else + { + screen[y] &= ~((0x80 >> d)); + } + } + } + + //Die 8 angegebenen geschnittenen Bytes ausgeben + matrix.write(screen[0], screen[1], screen[2], screen[3], screen[4], screen[5], screen[6], screen[7]); + +} + +void setup() +{ + //Initalisierung der Matrix HW Komponenten + matrix.init(); + + //Writer um Buchstaben in den Space zu hauen + for(int x = 0; x <= 25; x++) + { + writer(x+65,x+1); + } +} + + +void loop() +{ + matrix.read_io(); + + //Offset von 0-63 + cutscreen((matrix.potentiometer_0/8)); +} diff --git a/examples/Scrolldemo_key/Scrolldemo_key.ino b/examples/Scrolldemo_key/Scrolldemo_key.ino new file mode 100644 index 0000000..684dc44 --- /dev/null +++ b/examples/Scrolldemo_key/Scrolldemo_key.ino @@ -0,0 +1,117 @@ +/** +* @file Scrolldemo.ino +* @author Benjamin Marty (bmarty@kochag.ch) +* @date 2.2.2015 +* @brief Main File for the Matrix +* @bug Why so much Ram Usage?! +* +*/ + +#include + +#include +#include "SPI.h" +#include + +#include "font.h" + + +//Allgemeine Variabeln für den Scroller +boolean space[8][180]; +char buffer2[8]; +char screen[8]; + +int counter = 0; + +void writer(int numb, int stell) +{ + int pos; + + pos = (stell * 6) - 8; + + //Font Daten aus Flash Speicher holen und in Matrix Array schreiben + for(int x = 0; x <= 7; x++) + { + buffer2[x] = pgm_read_byte(&font[numb][x]); + } + + //Buffer (Zeichenbuffer/Eigentliche Zeichen) in Space schreiben + for(int x = 0; x <= 7; x++) //Zeile wählen + { + for(int c = 1; c <= 8; c++) //Hilfszahl/Spalte wählen + { + if(buffer2[x] & (0x01 << (c - 1))) //Prüfen ob entsprechendes Bit gesetzt ist (Anhand kopierten Bits aus dem Flash PGM) + { + space[x][(c-1)+pos] = 1; //Bit im Space setzen + } + else + { + if(c > 3) //Hintersten 3 Spalten ignorieren da im normalfall leer und überlappend + { + space[x][(c-1)+pos] = 0; //Bit löschen + } + } + } + } +} + +void cutscreen(int offset) +{ + //Space in einen 8x8 Auschnitt schneiden um diesen danach ausgeben zu können + for(int y = 0; y <= 7; y++) //Zeile wählen + { + for(int d = 0; d <= 7; d++) //Spalte wählen + { + if(space[y][d+offset] == 1) //Prüfen ob Bit im Space gesetzt ist und entsprechend auf Screen verfahren. Offset wird übergeben beim Aufruf -> Position + { + screen[y] |= (0x80 >> d); + } + else + { + screen[y] &= ~((0x80 >> d)); + } + } + } + + //Die 8 angegebenen geschnittenen Bytes ausgeben + matrix.write(screen[0], screen[1], screen[2], screen[3], screen[4], screen[5], screen[6], screen[7]); + +} + +void setup() +{ + //Initalisierung der Matrix HW Komponenten + matrix.init(); + + //attachInterrupt(0, swcheck, FALLING); + + Serial.begin(9600); + + //Writer um Buchstaben in den Space zu schreiben + for(int x = 0; x <= 25; x++) + { + writer(x+65,x+1); + } +} + + +void loop() +{ + matrix.read_io(); + + //Offset von 0-63 + cutscreen(counter); + + + if(matrix.taste_1) + { + counter++; + } + + if(matrix.taste_3) + { + counter--; + } + + +} diff --git a/examples/TEST_ARRAY_KEY_POTI_SERIAL/KEY_POTI_TEST_SERIAL.ino b/examples/TEST_ARRAY_KEY_POTI_SERIAL/KEY_POTI_TEST_SERIAL.ino new file mode 100644 index 0000000..e208fdf --- /dev/null +++ b/examples/TEST_ARRAY_KEY_POTI_SERIAL/KEY_POTI_TEST_SERIAL.ino @@ -0,0 +1,66 @@ +/** +* @file FONT_WRITER_KEY.ino +* @author Benjamin Marty (bmarty@kochag.ch) +* @date 03.03.2014 +* @brief Main File of FONT_WRITER_KEY Example +* @bug No known bugs. +* +*/ + +#include "Matrix_RKAG.h" + +#include "SPI.h" +#include "Wire.h" + +//Instanz der Klasse bilden +//matrix matrix; + +int potentiometer_vorher; + +char bla[8] = { 0b10101010, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0b01010101 }; + +void setup() +{ + //Initalisierung der Matrix HW Komponenten + matrix.init(); + + //attachInterrupt(0, taster, FALLING); + + Serial.begin(9600); + + matrix.write_array(bla); +} + + +void loop() +{ + matrix.read_io(); + + if(matrix.taste_1) + { + Serial.print("Taste1"); + Serial.print("\n"); + } + + if(matrix.taste_2) + { + Serial.print("Taste2"); + Serial.print("\n"); + } + + if(matrix.taste_3) + { + Serial.print("Taste3"); + Serial.print("\n"); + } + + if(matrix.potentiometer_0 != potentiometer_vorher) + { + Serial.print("Potentiometer aendert sich"); + Serial.print("\n"); + + potentiometer_vorher = matrix.potentiometer_0; + } + +} + diff --git a/font.h b/font.h new file mode 100644 index 0000000..77bffab --- /dev/null +++ b/font.h @@ -0,0 +1,260 @@ +#include + +char const font[256][8] PROGMEM ={ +{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x00 +{0x70,0x88,0xD8,0x88,0xA8,0x88,0x70,0x00}, // 0x01 +{0x70,0xF8,0xA8,0xF8,0x88,0xF8,0x70,0x00}, // 0x02 +{0x00,0x50,0xF8,0xF8,0xF8,0x70,0x20,0x00}, // 0x03 +{0x00,0x20,0x70,0xF8,0xF8,0x70,0x20,0x00}, // 0x04 +{0x20,0x70,0x70,0x20,0xF8,0xF8,0x20,0x00}, // 0x05 +{0x00,0x20,0x70,0xF8,0xF8,0x20,0x70,0x00}, // 0x06 +{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x07 +{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x08 +{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x09 +{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x0A +{0x00,0xE0,0xC0,0xB0,0x48,0x48,0x30,0x00}, // 0x0B +{0x70,0x88,0x88,0x70,0x20,0x70,0x20,0x00}, // 0x0C +{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x0D +{0xC0,0xB0,0xD0,0xB0,0xD0,0xD8,0x18,0x00}, // 0x0E +{0x00,0xA8,0x70,0xD8,0x70,0xA8,0x00,0x00}, // 0x0F +{0x10,0x30,0x70,0xF0,0x70,0x30,0x10,0x00}, // 0x10 +{0x40,0x60,0x70,0x78,0x70,0x60,0x40,0x00}, // 0x11 +{0x20,0x70,0xF8,0x20,0xF8,0x70,0x20,0x00}, // 0x12 +{0x50,0x50,0x50,0x50,0x50,0x00,0x50,0x00}, // 0x13 +{0xF0,0xA8,0xA8,0xB0,0xA0,0xA0,0xA0,0x00}, // 0x14 +{0x70,0x88,0x30,0x50,0x60,0x88,0x70,0x00}, // 0x15 +{0x00,0x00,0x00,0x00,0x00,0x78,0x78,0x00}, // 0x16 +{0x20,0x70,0xF8,0x20,0xF8,0x70,0x20,0x70}, // 0x17 +{0x20,0x70,0xF8,0x20,0x20,0x20,0x20,0x00}, // 0x18 +{0x20,0x20,0x20,0x20,0xF8,0x70,0x20,0x00}, // 0x19 +{0x00,0x20,0x60,0xF8,0x60,0x20,0x00,0x00}, // 0x1A +{0x00,0x20,0x30,0xF8,0x30,0x20,0x00,0x00}, // 0x1B +{0x00,0x00,0x00,0x08,0x08,0x08,0xF8,0x00}, // 0x1C +{0x00,0x50,0x50,0xF8,0x50,0x50,0x00,0x00}, // 0x1D +{0x20,0x20,0x70,0x70,0xF8,0xF8,0x00,0x00}, // 0x1E +{0xF8,0xF8,0x70,0x70,0x20,0x20,0x00,0x00}, // 0x1F +{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x20 +{0x20,0x70,0x70,0x20,0x20,0x00,0x20,0x00}, // 0x21 +{0xD8,0xD8,0x48,0x00,0x00,0x00,0x00,0x00}, // 0x22 +{0x00,0x50,0xF8,0x50,0x50,0xF8,0x50,0x00}, // 0x23 +{0x10,0x70,0x08,0x30,0x40,0x38,0x20,0x00}, // 0x24 +{0x98,0x98,0x40,0x20,0x10,0xC8,0xC8,0x00}, // 0x25 +{0x10,0x28,0x28,0x10,0xA8,0x48,0xB0,0x00}, // 0x26 +{0x30,0x30,0x10,0x00,0x00,0x00,0x00,0x00}, // 0x27 +{0x20,0x10,0x10,0x10,0x10,0x10,0x20,0x00}, // 0x28 +{0x10,0x20,0x20,0x20,0x20,0x20,0x10,0x00}, // 0x29 +{0x00,0x50,0x70,0xF8,0x70,0x50,0x00,0x00}, // 0x2A +{0x00,0x20,0x20,0xF8,0x20,0x20,0x00,0x00}, // 0x2B +{0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x10}, // 0x2C +{0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00}, // 0x2D +{0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00}, // 0x2E +{0x00,0x80,0x40,0x20,0x10,0x08,0x00,0x00}, // 0x2F +{0x70,0x88,0xC8,0xA8,0x98,0x88,0x70,0x00}, // 0x30 +{0x20,0x30,0x20,0x20,0x20,0x20,0x70,0x00}, // 0x31 +{0x70,0x88,0x80,0x60,0x10,0x08,0xF8,0x00}, // 0x32 +{0x70,0x88,0x80,0x70,0x80,0x88,0x70,0x00}, // 0x33 +{0x40,0x60,0x50,0x48,0xF8,0x40,0x40,0x00}, // 0x34 +{0xF8,0x08,0x08,0x78,0x80,0x88,0x70,0x00}, // 0x35 +{0x60,0x10,0x08,0x78,0x88,0x88,0x70,0x00}, // 0x36 +{0xF8,0x80,0x40,0x20,0x10,0x10,0x10,0x00}, // 0x37 +{0x70,0x88,0x88,0x70,0x88,0x88,0x70,0x00}, // 0x38 +{0x70,0x88,0x88,0xF0,0x80,0x40,0x30,0x00}, // 0x39 +{0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x00}, // 0x3A +{0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x10}, // 0x3B +{0x40,0x20,0x10,0x08,0x10,0x20,0x40,0x00}, // 0x3C +{0x00,0x00,0xF8,0x00,0x00,0xF8,0x00,0x00}, // 0x3D +{0x10,0x20,0x40,0x80,0x40,0x20,0x10,0x00}, // 0x3E +{0x70,0x88,0x80,0x60,0x20,0x00,0x20,0x00}, // 0x3F +{0x70,0x88,0xE8,0xA8,0xE8,0x08,0x70,0x00}, // 0x40 +{0x70,0x88,0x88,0x88,0xF8,0x88,0x88,0x00}, // 0x41 65 +{0x78,0x88,0x88,0x78,0x88,0x88,0x78,0x00}, // 0x42 66 +{0x70,0x88,0x08,0x08,0x08,0x88,0x70,0x00}, // 0x43 67 +{0x78,0x88,0x88,0x88,0x88,0x88,0x78,0x00}, // 0x44 +{0xF8,0x08,0x08,0x78,0x08,0x08,0xF8,0x00}, // 0x45 +{0xF8,0x08,0x08,0x78,0x08,0x08,0x08,0x00}, // 0x46 +{0x70,0x88,0x08,0xE8,0x88,0x88,0xF0,0x00}, // 0x47 +{0x88,0x88,0x88,0xF8,0x88,0x88,0x88,0x00}, // 0x48 +{0x70,0x20,0x20,0x20,0x20,0x20,0x70,0x00}, // 0x49 +{0x80,0x80,0x80,0x80,0x88,0x88,0x70,0x00}, // 0x4A +{0x88,0x48,0x28,0x18,0x28,0x48,0x88,0x00}, // 0x4B +{0x08,0x08,0x08,0x08,0x08,0x08,0xF8,0x00}, // 0x4C +{0x88,0xD8,0xA8,0x88,0x88,0x88,0x88,0x00}, // 0x4D +{0x88,0x98,0xA8,0xC8,0x88,0x88,0x88,0x00}, // 0x4E 78 +{0x70,0x88,0x88,0x88,0x88,0x88,0x70,0x00}, // 0x4F 79 +{0x78,0x88,0x88,0x78,0x08,0x08,0x08,0x00}, // 0x50 +{0x70,0x88,0x88,0x88,0xA8,0x48,0xB0,0x00}, // 0x51 +{0x78,0x88,0x88,0x78,0x48,0x88,0x88,0x00}, // 0x52 +{0x70,0x88,0x08,0x70,0x80,0x88,0x70,0x00}, // 0x53 +{0xF8,0x20,0x20,0x20,0x20,0x20,0x20,0x00}, // 0x54 +{0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00}, // 0x55 +{0x88,0x88,0x88,0x88,0x88,0x50,0x20,0x00}, // 0x56 +{0x88,0x88,0xA8,0xA8,0xA8,0xA8,0x50,0x00}, // 0x57 +{0x88,0x88,0x50,0x20,0x50,0x88,0x88,0x00}, // 0x58 +{0x88,0x88,0x88,0x50,0x20,0x20,0x20,0x00}, // 0x59 +{0x78,0x40,0x20,0x10,0x08,0x08,0x78,0x00}, // 0x5A +{0x70,0x10,0x10,0x10,0x10,0x10,0x70,0x00}, // 0x5B +{0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00}, // 0x5C +{0x70,0x40,0x40,0x40,0x40,0x40,0x70,0x00}, // 0x5D +{0x20,0x50,0x88,0x00,0x00,0x00,0x00,0x00}, // 0x5E +{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC}, // 0x5F +{0x30,0x30,0x20,0x00,0x00,0x00,0x00,0x00}, // 0x60 +{0x00,0x00,0x70,0x80,0xF0,0x88,0xF0,0x00}, // 0x61 +{0x08,0x08,0x78,0x88,0x88,0x88,0x78,0x00}, // 0x62 +{0x00,0x00,0x70,0x88,0x08,0x88,0x70,0x00}, // 0x63 +{0x80,0x80,0xF0,0x88,0x88,0x88,0xF0,0x00}, // 0x64 +{0x00,0x00,0x70,0x88,0x78,0x08,0x70,0x00}, // 0x65 +{0x60,0x10,0x10,0x78,0x10,0x10,0x10,0x00}, // 0x66 +{0x00,0x00,0xF0,0x88,0x88,0xF0,0x80,0x70}, // 0x67 +{0x08,0x08,0x38,0x48,0x48,0x48,0x48,0x00}, // 0x68 +{0x20,0x00,0x20,0x20,0x20,0x20,0x60,0x00}, // 0x69 +{0x40,0x00,0x60,0x40,0x40,0x40,0x48,0x30}, // 0x6A +{0x08,0x08,0x48,0x28,0x18,0x28,0x48,0x00}, // 0x6B +{0x20,0x20,0x20,0x20,0x20,0x20,0x60,0x00}, // 0x6C +{0x00,0x00,0x58,0xA8,0xA8,0x88,0x88,0x00}, // 0x6D +{0x00,0x00,0x38,0x48,0x48,0x48,0x48,0x00}, // 0x6E +{0x00,0x00,0x70,0x88,0x88,0x88,0x70,0x00}, // 0x6F +{0x00,0x00,0x78,0x88,0x88,0x88,0x78,0x08}, // 0x70 +{0x00,0x00,0xF0,0x88,0x88,0x88,0xF0,0x80}, // 0x71 +{0x00,0x00,0x68,0x90,0x10,0x10,0x38,0x00}, // 0x72 +{0x00,0x00,0x70,0x08,0x70,0x80,0x70,0x00}, // 0x73 +{0x00,0x10,0x78,0x10,0x10,0x50,0x20,0x00}, // 0x74 +{0x00,0x00,0x48,0x48,0x48,0x68,0x50,0x00}, // 0x75 +{0x00,0x00,0x88,0x88,0x88,0x50,0x20,0x00}, // 0x76 +{0x00,0x00,0x88,0x88,0xA8,0xF8,0x50,0x00}, // 0x77 +{0x00,0x00,0x48,0x48,0x30,0x48,0x48,0x00}, // 0x78 +{0x00,0x00,0x48,0x48,0x48,0x70,0x20,0x18}, // 0x79 +{0x00,0x00,0x78,0x40,0x30,0x08,0x78,0x00}, // 0x7A +{0x60,0x10,0x10,0x18,0x10,0x10,0x60,0x00}, // 0x7B +{0x20,0x20,0x20,0x00,0x20,0x20,0x20,0x00}, // 0x7C +{0x30,0x40,0x40,0xC0,0x40,0x40,0x30,0x00}, // 0x7D +{0x50,0x28,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x7E +{0x20,0x70,0xD8,0x88,0x88,0xF8,0x00,0x00}, // 0x7F +{0x70,0x88,0x08,0x08,0x88,0x70,0x20,0x30}, // 0x80 +{0x48,0x00,0x48,0x48,0x48,0x68,0x50,0x00}, // 0x81 +{0xC0,0x00,0x70,0x88,0x78,0x08,0x70,0x00}, // 0x82 +{0x70,0x00,0x70,0x80,0xF0,0x88,0xF0,0x00}, // 0x83 +{0x50,0x00,0x70,0x80,0xF0,0x88,0xF0,0x00}, // 0x84 +{0x30,0x00,0x70,0x80,0xF0,0x88,0xF0,0x00}, // 0x85 +{0x70,0x50,0x70,0x80,0xF0,0x88,0xF0,0x00}, // 0x86 +{0x00,0x70,0x88,0x08,0x88,0x70,0x20,0x30}, // 0x87 +{0x70,0x00,0x70,0x88,0x78,0x08,0x70,0x00}, // 0x88 +{0x50,0x00,0x70,0x88,0x78,0x08,0x70,0x00}, // 0x89 +{0x30,0x00,0x70,0x88,0x78,0x08,0x70,0x00}, // 0x8A +{0x50,0x00,0x20,0x20,0x20,0x20,0x60,0x00}, // 0x8B +{0x70,0x00,0x20,0x20,0x20,0x20,0x60,0x00}, // 0x8C +{0x10,0x00,0x20,0x20,0x20,0x20,0x60,0x00}, // 0x8D +{0x50,0x00,0x20,0x50,0x88,0xF8,0x88,0x00}, // 0x8E +{0x70,0x50,0x70,0xD8,0x88,0xF8,0x88,0x00}, // 0x8F +{0xC0,0x00,0xF8,0x08,0x78,0x08,0xF8,0x00}, // 0x90 +{0x00,0x00,0x78,0xA0,0xF8,0x28,0xF0,0x00}, // 0x91 +{0xF0,0x28,0x28,0xF8,0x28,0x28,0xE8,0x00}, // 0x92 +{0x70,0x00,0x30,0x48,0x48,0x48,0x30,0x00}, // 0x93 +{0x50,0x00,0x30,0x48,0x48,0x48,0x30,0x00}, // 0x94 +{0x18,0x00,0x30,0x48,0x48,0x48,0x30,0x00}, // 0x95 +{0x70,0x00,0x48,0x48,0x48,0x68,0x50,0x00}, // 0x96 +{0x18,0x00,0x48,0x48,0x48,0x68,0x50,0x00}, // 0x97 +{0x50,0x00,0x48,0x48,0x48,0x70,0x20,0x18}, // 0x98 +{0x48,0x30,0x48,0x48,0x48,0x48,0x30,0x00}, // 0x99 +{0x48,0x00,0x48,0x48,0x48,0x48,0x30,0x00}, // 0x9A +{0x00,0x00,0x80,0x70,0x68,0x58,0x38,0x04}, // 0x9B +{0x60,0x90,0x10,0x78,0x10,0x90,0xE8,0x00}, // 0x9C +{0xF0,0xC8,0xA8,0xA8,0xA8,0x98,0x78,0x00}, // 0x9D +{0x00,0x88,0x50,0x20,0x50,0x88,0x00,0x00}, // 0x9E +{0x40,0xA0,0x20,0x70,0x20,0x20,0x28,0x10}, // 0x9F +{0x60,0x00,0x70,0x80,0xF0,0x88,0xF0,0x00}, // 0xA0 +{0x60,0x00,0x20,0x20,0x20,0x20,0x60,0x00}, // 0xA1 +{0x60,0x00,0x30,0x48,0x48,0x48,0x30,0x00}, // 0xA2 +{0x60,0x00,0x48,0x48,0x48,0x68,0x50,0x00}, // 0xA3 +{0x50,0x28,0x00,0x38,0x48,0x48,0x48,0x00}, // 0xA4 +{0x50,0x28,0x00,0x48,0x58,0x68,0x48,0x00}, // 0xA5 +{0x70,0x80,0xF0,0x88,0xF0,0x00,0xF0,0x00}, // 0xA6 +{0x30,0x48,0x48,0x48,0x30,0x00,0x78,0x00}, // 0xA7 +{0x20,0x00,0x20,0x30,0x08,0x88,0x70,0x00}, // 0xA8 +{0x78,0xA4,0xD4,0xB4,0xD4,0x84,0x78,0x00}, // 0xA9 +{0x00,0x00,0xFC,0x80,0x80,0x00,0x00,0x00}, // 0xAA +{0x08,0x48,0x28,0x70,0x88,0x40,0xE0,0x00}, // 0xAB +{0x08,0x48,0x28,0xD0,0xA8,0xE0,0x80,0x00}, // 0xAC +{0x20,0x00,0x20,0x20,0x70,0x70,0x20,0x00}, // 0xAD +{0x00,0x00,0x90,0x48,0x90,0x00,0x00,0x00}, // 0xAE +{0x00,0x00,0x48,0x90,0x48,0x00,0x00,0x00}, // 0xAF +{0xA8,0x00,0x54,0x00,0xA8,0x00,0x54,0x00}, // 0xB0 +{0xA8,0x54,0xA8,0x54,0xA8,0x54,0xA8,0x54}, // 0xB1 +{0x54,0xFC,0xA8,0xFC,0x54,0xFC,0xA8,0xFC}, // 0xB2 +{0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20}, // 0xB3 +{0x20,0x20,0x20,0x3C,0x20,0x20,0x20,0x20}, // 0xB4 +{0x60,0x00,0x20,0x50,0x88,0xF8,0x88,0x00}, // 0xB5 +{0x70,0x00,0x20,0x50,0x88,0xF8,0x88,0x00}, // 0xB6 +{0x30,0x00,0x20,0x50,0x88,0xF8,0x88,0x00}, // 0xB7 +{0x78,0x84,0xB4,0x94,0xB4,0x84,0x78,0x00}, // 0xB8 +{0x28,0x2C,0x20,0x2C,0x28,0x28,0x28,0x28}, // 0xB9 +{0x28,0x28,0x28,0x28,0x28,0x28,0x28,0x28}, // 0xBA +{0x00,0x3C,0x20,0x2C,0x28,0x28,0x28,0x28}, // 0xBB +{0x28,0x2C,0x20,0x3C,0x00,0x00,0x00,0x00}, // 0xBC +{0x00,0x20,0x70,0x08,0x08,0x70,0x20,0x00}, // 0xBD +{0x88,0x50,0x20,0xF8,0x20,0xF8,0x20,0x00}, // 0xBE +{0x00,0x00,0x00,0x3C,0x20,0x20,0x20,0x20}, // 0xBF +{0x20,0x20,0x20,0xE0,0x00,0x00,0x00,0x00}, // 0xC0 +{0x20,0x20,0x20,0xFC,0x00,0x00,0x00,0x00}, // 0xC1 +{0x00,0x00,0x00,0xFC,0x20,0x20,0x20,0x20}, // 0xC2 +{0x20,0x20,0x20,0xE0,0x20,0x20,0x20,0x20}, // 0xC3 +{0x00,0x00,0x00,0xFC,0x00,0x00,0x00,0x00}, // 0xC4 +{0x20,0x20,0x20,0xFC,0x20,0x20,0x20,0x20}, // 0xC5 +{0xA0,0x50,0x70,0x80,0xF0,0x88,0xF0,0x00}, // 0xC6 +{0xA0,0x50,0x20,0x50,0x88,0xF8,0x88,0x00}, // 0xC7 +{0x28,0xE8,0x08,0xF8,0x00,0x00,0x00,0x00}, // 0xC8 +{0x00,0xF8,0x08,0xE8,0x28,0x28,0x28,0x28}, // 0xC9 +{0x28,0xEC,0x00,0xFC,0x00,0x00,0x00,0x00}, // 0xCA +{0x00,0xFC,0x00,0xEC,0x28,0x28,0x28,0x28}, // 0xCB +{0x28,0xE8,0x08,0xE8,0x28,0x28,0x28,0x28}, // 0xCC +{0x00,0xFC,0x00,0xFC,0x00,0x00,0x00,0x00}, // 0xCD +{0x28,0xEC,0x00,0xEC,0x28,0x28,0x28,0x28}, // 0xCE +{0x88,0x70,0x88,0x88,0x88,0x70,0x88,0x00}, // 0xCF +{0x30,0x08,0x10,0x20,0x70,0x48,0x30,0x00}, // 0xD0 +{0x70,0x90,0x90,0xB8,0x90,0x90,0x70,0x00}, // 0xD1 +{0x70,0x00,0xF8,0x08,0x78,0x08,0xF8,0x00}, // 0xD2 +{0x50,0x00,0xF8,0x08,0x78,0x08,0xF8,0x00}, // 0xD3 +{0x30,0x00,0xF8,0x08,0x78,0x08,0xF8,0x00}, // 0xD4 +{0x20,0x20,0x20,0x00,0x00,0x00,0x00,0x00}, // 0xD5 +{0x60,0x00,0x70,0x20,0x20,0x20,0x70,0x00}, // 0xD6 +{0x70,0x00,0x70,0x20,0x20,0x20,0x70,0x00}, // 0xD7 +{0x50,0x00,0x70,0x20,0x20,0x20,0x70,0x00}, // 0xD8 +{0x20,0x20,0x20,0x3C,0x00,0x00,0x00,0x00}, // 0xD9 +{0x00,0x00,0x00,0xE0,0x20,0x20,0x20,0x20}, // 0xDA +{0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC,0xFC}, // 0xDB +{0x00,0x00,0x00,0x00,0xFC,0xFC,0xFC,0xFC}, // 0xDC +{0x20,0x20,0x20,0x00,0x20,0x20,0x20,0x00}, // 0xDD +{0x30,0x00,0x70,0x20,0x20,0x20,0x70,0x00}, // 0xDE +{0xFC,0xFC,0xFC,0xFC,0x00,0x00,0x00,0x00}, // 0xDF +{0x60,0x30,0x48,0x48,0x48,0x48,0x30,0x00}, // 0xE0 +{0x00,0x38,0x48,0x38,0x48,0x48,0x38,0x08}, // 0xE1 +{0x70,0x30,0x48,0x48,0x48,0x48,0x30,0x00}, // 0xE2 +{0x18,0x30,0x48,0x48,0x48,0x48,0x30,0x00}, // 0xE3 +{0x50,0x28,0x00,0x30,0x48,0x48,0x30,0x00}, // 0xE4 +{0x50,0x28,0x30,0x48,0x48,0x48,0x30,0x00}, // 0xE5 +{0x00,0x00,0x48,0x48,0x48,0x38,0x08,0x08}, // 0xE6 +{0x00,0x18,0x08,0x38,0x48,0x38,0x08,0x18}, // 0xE7 +{0x18,0x08,0x38,0x48,0x48,0x38,0x08,0x18}, // 0xE8 +{0x60,0x00,0x48,0x48,0x48,0x48,0x30,0x00}, // 0xE9 +{0x70,0x00,0x48,0x48,0x48,0x48,0x30,0x00}, // 0xEA +{0x18,0x00,0x48,0x48,0x48,0x48,0x30,0x00}, // 0xEB +{0x60,0x00,0x48,0x48,0x48,0x70,0x20,0x18}, // 0xEC +{0x60,0x00,0x88,0x50,0x20,0x20,0x20,0x00}, // 0xED +{0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00}, // 0xEE +{0x30,0x30,0x10,0x00,0x00,0x00,0x00,0x00}, // 0xEF +{0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00}, // 0xF0 +{0x00,0x20,0x70,0x20,0x00,0x70,0x00,0x00}, // 0xF1 +{0x00,0x00,0xF8,0x00,0x00,0xF8,0x00,0x00}, // 0xF2 +{0x0C,0x58,0x2C,0xD0,0xA8,0xE0,0x80,0x00}, // 0xF3 +{0xF0,0xA8,0xA8,0xB0,0xA0,0xA0,0xA0,0x00}, // 0xF4 +{0x70,0x88,0x30,0x50,0x60,0x88,0x70,0x00}, // 0xF5 +{0x00,0x20,0x00,0xF8,0x00,0x20,0x00,0x00}, // 0xF6 +{0x00,0x00,0x00,0x70,0x60,0x00,0x00,0x00}, // 0xF7 +{0x30,0x48,0x48,0x30,0x00,0x00,0x00,0x00}, // 0xF8 +{0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x00}, // 0xF9 +{0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00}, // 0xFA +{0x10,0x18,0x10,0x10,0x00,0x00,0x00,0x00}, // 0xFB +{0x38,0x10,0x30,0x18,0x00,0x00,0x00,0x00}, // 0xFC +{0x18,0x20,0x10,0x38,0x00,0x00,0x00,0x00}, // 0xFD +{0x00,0x00,0x78,0x78,0x78,0x78,0x00,0x00}, // 0xFE +{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} // 0xFF +}; \ No newline at end of file diff --git a/library.properties_deactivated b/library.properties_deactivated new file mode 100644 index 0000000..4f1c4a3 --- /dev/null +++ b/library.properties_deactivated @@ -0,0 +1,7 @@ +name=Matrix_RKAG +version=1.1 +author=Benjamin Marty +maintainer=Benjamin Marty +sentence=This is a complete Library to use the Matrix Project. +url=www.kochag.ch +architectures=avr diff --git a/readme.txt b/readme.txt new file mode 100644 index 0000000..6da36f6 --- /dev/null +++ b/readme.txt @@ -0,0 +1,17 @@ +This is a complete Library to use the Matrix Project. + + +Installation +-------------------------------------------------------------------------------- + +To install this library, just use the Library Import Feature in Arduino + + +Description +-------------------------------------------------------------------------------- + +font.h is used to get the Bit Positions of the ASCII Code +Matrix_RKAG.cpp is the main Library File +Matrix_RKAG.h is the header File of the main Library +TimerOne.cpp is a Arduino Library for using the Atmega Timers +TimerOne.h is the header File for the Timer Library \ No newline at end of file