Commit 445acda4 authored by Snorre Nilssen Vestli's avatar Snorre Nilssen Vestli
Browse files

Initial add, Tesla IO mostly done

parents
Loading
Loading
Loading
Loading

TeslaMidi.atsln

0 → 100644
+20 −0
Original line number Diff line number Diff line

Microsoft Visual Studio Solution File, Format Version 11.00
# Atmel Studio Solution File, Format Version 11.00
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "TeslaMidi", "TeslaMidi\TeslaMidi.cproj", "{E2ECC8A3-D5C6-44F6-BEE0-23A8D5846B0A}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|AVR = Debug|AVR
		Release|AVR = Release|AVR
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{E2ECC8A3-D5C6-44F6-BEE0-23A8D5846B0A}.Debug|AVR.ActiveCfg = Debug|AVR
		{E2ECC8A3-D5C6-44F6-BEE0-23A8D5846B0A}.Debug|AVR.Build.0 = Debug|AVR
		{E2ECC8A3-D5C6-44F6-BEE0-23A8D5846B0A}.Release|AVR.ActiveCfg = Release|AVR
		{E2ECC8A3-D5C6-44F6-BEE0-23A8D5846B0A}.Release|AVR.Build.0 = Release|AVR
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal

TeslaMidi/MIDI.c

0 → 100644
+10 −0
Original line number Diff line number Diff line
/*
 * MIDI.c
 *
 * Created: 19.08.2014 23:32:07
 *  Author: Snorre
 */ 



void midi_init();
 No newline at end of file

TeslaMidi/MIDI.h

0 → 100644
+18 −0
Original line number Diff line number Diff line
/*
 * MIDI.h
 *
 * Created: 19.08.2014 23:34:37
 *  Author: Snorre
 */ 


#ifndef MIDI_H_
#define MIDI_H_


void midi_init();




#endif /* MIDI_H_ */
 No newline at end of file

TeslaMidi/TeslaMidi.c

0 → 100644
+59 −0
Original line number Diff line number Diff line
/*
 * TeslaMidi.c
 *
 * Created: 18.08.2014 21:05:01
 *  Author: SNV
 */ 


#include <avr/io.h>
#include "MIDI.h"
#include "tesla_io.h"
#include "panel_io.h"
#include "watchdog.h"


int main(void)
{
	uint8_t error;
	//TESLA IO SAFE
	tesla_init();
	
	//PANEL IO INIT
	panel_init();
	
	//WATCHDOG INIT
	error = watchdog_init();
	if (error){
		//watchdog tripped, set IO appropriately and hold.
	}
	
	//MIDI INIT
	midi_init();
	
	//WAIT FOR READY
	panel_wait_run();
	
	//WATCHDOG_START
	watchdog_start();
	
	//CARRIER_START
	for (uint8_t i = 0; i < 2 ; i++){
		tesla_channel_enable(i);
	}
	tesla_carrier_enable();
	
    while(1)
    {
		//POLL MIDI USART
			//PARSE MIDI
			//HANDLE MIDI OUT
		//READ PANEL IO
			//PANEL STATE
			
		//HANDLE WAVE IO
		
		
		//PET DOG
    }
}
 No newline at end of file

TeslaMidi/miditable.h

0 → 100644
+282 −0
Original line number Diff line number Diff line
/*
 * miditable.h
 *
 * Created: 24.08.2014 15:35:37
 *  Author: Snorre
 */ 


#ifndef MIDITABLE_H_
#define MIDITABLE_H_

const uint16_t midi_per[128] = {
61156, 
57724,
54484,
51426,
48540,
45815,
43244,
40817,
38526,
36364,
34323,
32396,
30578,
28862,
27242,
25713,
24270,
22908,
21622,
20408,
19263,
18182,
17161,
16198,
15289,
14431,
13621,
12856,
12135,
11454,
10811,
10204,
9631,
9091,
8581,
8099,
7645,
7215,
6810,
6428,
6067,
5727,
5405,
5102,
4816,
4545,
4290,
4050,
3822,
3608,
3405,
3214,
3034,
2863,
2703,
2551,
2408,
2273,
2145,
2025,
1911,
1804,
1703,
1607,
1517,
1432,
1351,
1276,
1204,
1136,
1073,
1012,
956,
902,
851,
804,
758,
716,
676,
638,
602,
568,
536,
506,
478,
451,
426,
402,
379,
358,
338,
319,
301,
284,
268,
253,
239,
225,
213,
201,
190,
179,
169,
159,
150,
142,
134,
127,
119,
113,
106,
100,
95,
89,
84,
80,
75,
71,
67,
63,
60,
56,
53,
50,
47,
45,
42,
40
};

/* Table giving max CC values for note channels given (T_on < 700us) and (T_on < per/2), 
 * and given 500khz timer clock
 *
 */
const uint16_t midi_note_max[128]= {
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
350,
338,
319,
301,
284,
268,
253,
239,
226,
213,
201,
190,
179,
169,
160,
151,
142,
134,
127,
120,
113,
107,
101,
95,
90,
85,
80,
75,
71,
67,
64,
60,
57,
53,
50,
48,
45,
42,
40,
38,
36,
34,
32,
30,
28,
27,
25,
24,
23,
21,
20
};


// should be in flash
// isn't.

#endif /* MIDITABLE_H_ */
 No newline at end of file
Loading