This is a part of the Kinetiszer project.

Dependencies:   inc

Dependents:   kinetisizer

Committer:
Clemo
Date:
Tue Oct 28 12:19:42 2014 +0000
Revision:
0:cb80470434eb
Error & warning free.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Clemo 0:cb80470434eb 1 /*
Clemo 0:cb80470434eb 2 Copyright 2013 Paul Soulsby www.soulsbysynths.com
Clemo 0:cb80470434eb 3 This file is part of Atmegatron.
Clemo 0:cb80470434eb 4
Clemo 0:cb80470434eb 5 Atmegatron is free software: you can redistribute it and/or modify
Clemo 0:cb80470434eb 6 it under the terms of the GNU General Public License as published by
Clemo 0:cb80470434eb 7 the Free Software Foundation, either version 3 of the License, or
Clemo 0:cb80470434eb 8 (at your option) any later version.
Clemo 0:cb80470434eb 9
Clemo 0:cb80470434eb 10 Atmegatron is distributed in the hope that it will be useful,
Clemo 0:cb80470434eb 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
Clemo 0:cb80470434eb 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Clemo 0:cb80470434eb 13 GNU General Public License for more details.
Clemo 0:cb80470434eb 14
Clemo 0:cb80470434eb 15 You should have received a copy of the GNU General Public License
Clemo 0:cb80470434eb 16 along with Atmegatron. If not, see <http://www.gnu.org/licenses/>.
Clemo 0:cb80470434eb 17 */
Clemo 0:cb80470434eb 18 //local vars - uncomment all this is test mode is ever needed again.
Clemo 0:cb80470434eb 19
Clemo 0:cb80470434eb 20 #include "atmegatron.h"
Clemo 0:cb80470434eb 21
Clemo 0:cb80470434eb 22
Clemo 0:cb80470434eb 23 #define SEQLEN 7
Clemo 0:cb80470434eb 24
Clemo 0:cb80470434eb 25
Clemo 0:cb80470434eb 26 //****test mode - automatically triggers midi notes every second*******
Clemo 0:cb80470434eb 27 byte test_pos = 0; //position in test sequence
Clemo 0:cb80470434eb 28 const byte test_seq[7] =
Clemo 0:cb80470434eb 29 {
Clemo 0:cb80470434eb 30 21, 33, 45, 57, 69, 81, 93
Clemo 0:cb80470434eb 31 };
Clemo 0:cb80470434eb 32
Clemo 0:cb80470434eb 33
Clemo 0:cb80470434eb 34 //lets and gets
Clemo 0:cb80470434eb 35 unsigned long testmode_nexttick = 0;
Clemo 0:cb80470434eb 36
Clemo 0:cb80470434eb 37
Clemo 0:cb80470434eb 38 void Testmode_Let_NextTick(long newtick)
Clemo 0:cb80470434eb 39 {
Clemo 0:cb80470434eb 40 testmode_nexttick=newtick;
Clemo 0:cb80470434eb 41 }
Clemo 0:cb80470434eb 42
Clemo 0:cb80470434eb 43
Clemo 0:cb80470434eb 44 long Testmode_Get_NextTick(void)
Clemo 0:cb80470434eb 45 {
Clemo 0:cb80470434eb 46 return testmode_nexttick;
Clemo 0:cb80470434eb 47 }
Clemo 0:cb80470434eb 48
Clemo 0:cb80470434eb 49
Clemo 0:cb80470434eb 50 void Testmode_ProcessNext(void)
Clemo 0:cb80470434eb 51 {
Clemo 0:cb80470434eb 52 byte i;
Clemo 0:cb80470434eb 53 MIDI_NoteOn(test_seq[test_pos]); //fire note
Clemo 0:cb80470434eb 54 test_pos++; //increment pos
Clemo 0:cb80470434eb 55 if (test_pos>=SEQLEN)
Clemo 0:cb80470434eb 56 {
Clemo 0:cb80470434eb 57 //if hit end of seq
Clemo 0:cb80470434eb 58 test_pos=0; //reset pos
Clemo 0:cb80470434eb 59 for (i=0;i<SEQLEN;i++)
Clemo 0:cb80470434eb 60 {
Clemo 0:cb80470434eb 61 //turn all notes off
Clemo 0:cb80470434eb 62 MIDI_NoteOff(test_seq[i]);
Clemo 0:cb80470434eb 63 }
Clemo 0:cb80470434eb 64 }
Clemo 0:cb80470434eb 65 testmode_nexttick += 1000; //set tick for next trigger
Clemo 0:cb80470434eb 66 }