correct date

This commit is contained in:
Michael Egger
2018-10-10 11:25:09 +02:00
parent 1962ba067e
commit 83d468adbd
5 changed files with 64 additions and 36 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE eagle SYSTEM "eagle.dtd">
<eagle version="7.5.0">
<eagle version="7.7.0">
<drawing>
<settings>
<setting alwaysvectorfont="no"/>
@@ -73,7 +73,7 @@
<wire x1="83.165" y1="43.485" x2="0" y2="43.485" width="0" layer="20"/>
<wire x1="0" y1="43.485" x2="0" y2="0" width="0" layer="20"/>
<text x="80.645" y="35.56" size="1.778" layer="1" font="vector" align="bottom-right">sk108-scabi-log
20180322</text>
20181006</text>
<polygon width="1.016" layer="41">
<vertex x="52.705" y="19.685"/>
<vertex x="54.61" y="19.685"/>
@@ -2459,7 +2459,7 @@ design rules under a new name.</description>
<wire x1="94.2975" y1="25.2875" x2="93.0225" y2="25.2875" width="0.4064" layer="1"/>
<wire x1="93.0225" y1="25.2875" x2="92.275" y2="26.035" width="0.4064" layer="1"/>
</signal>
<signal name="N$28">
<signal name="MIDI">
<contactref element="OK1" pad="5"/>
<contactref element="R2" pad="1"/>
<contactref element="U$2" pad="30"/>
@@ -18972,7 +18972,7 @@ Based on the following sources:
<wire x1="-12.7" y1="99.06" x2="-12.7" y2="101.6" width="0.1524" layer="91"/>
</segment>
</net>
<net name="N$28" class="0">
<net name="MIDI" class="0">
<segment>
<pinref part="OK1" gate="G$1" pin="COL"/>
<pinref part="R2" gate="G$1" pin="1"/>
@@ -13,41 +13,50 @@
// upload sketch with cmd-shift-U
//
//--------------------------------------------------------------------------------------------
#include <SPI.h>
#include <SoftwareSerial.h>
#include <MIDI.h>
MIDI_CREATE_DEFAULT_INSTANCE();
MIDI_CREATE_INSTANCE(HardwareSerial, Serial, MIDI);
// We will use the SoftwareSerial library instead of the Serial library, as this will let us control which pins our MIDI interface is connected to.
SoftwareSerial mySerial(2, 3); // RX, TX
int potis[16];
int potis[17];
int values[16];
const unsigned char pot_lut[4][4] = { { 16, 16, 16, 16 },
{ 16, 10, 6, 2 },
{ 16, 9, 5, 1 },
{ 16, 8, 4, 0 }
};
//---------------------------------------------------------------------------------------------
// SETUP
//---------------------------------------------------------------------------------------------
void setup() {
DDRC = 0x0F; // PC0..3 are address inputs for potentiometer mux
pinMode(7,OUTPUT); // Slave selct pins
pinMode(8,OUTPUT);
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
int cs_pin;
for ( cs_pin = 7; cs_pin < 11 ; cs_pin++) {
pinMode(cs_pin,OUTPUT); // Slave selct pins
digitalWrite(cs_pin, HIGH);
}
pinMode(4,OUTPUT); // debug output
attachInterrupt(digitalPinToInterrupt(3), vertical_blanking, CHANGE);
digitalWrite(3,LOW);
SPI.begin();
SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE2));
for(int i = 0; i < 17; i++) {potis[i] = 0; }
delay(1000);
power_on_dacs();
MIDI.setHandleControlChange(controller);
MIDI.begin(MIDI_CHANNEL_OMNI);
}
//---------------------------------------------------------------------------------------------
@@ -57,14 +66,15 @@ void setup() {
void loop() {
static int pot_idx;
//continuosly read local potentiometers
PORTC = (PORTC & 0xF0) | (pot_idx & 0x0F);
//continuosly read local potentiometers
potis[pot_idx] = analogRead(A6);
pot_idx++;
pot_idx %= 16;
MIDI.read();
pot_idx %= 16;
PORTC = (PORTC & 0xF0) | (pot_idx & 0x0F); // select next mux channel
if (MIDI.read()) { potis[16] = 0x3ff;}
}
//---------------------------------------------------------------------------------------------
@@ -78,21 +88,26 @@ void controller(byte channel, byte number, byte value)
values[number] = value << 3;
}
//---------------------------------------------------------------------------------------------
// INTERRUPT
void vertical_blanking() {
int sendval;
int cs_pin, i,n;
digitalWrite(4,HIGH); // debug out for measuring time this all takes
for (cs_pin=7; cs_pin < 11 ; cs_pin++); {
for (cs_pin=7; cs_pin < 11 ; cs_pin++) {
for (i = 0; i < 4; i++) {
digitalWrite(cs_pin,LOW);
n = (cs_pin - 7) * 4 + i;
n = pot_lut[cs_pin - 7][i];
sendval = values[n] << 2;
// sendval = (cs_pin == 9) * 0xffc;
sendval = potis[n] << 2;
// sendval = values[n] << 2;
sendval &= 1023 << 2;
sendval |= i << 12;
@@ -100,7 +115,6 @@ void vertical_blanking() {
digitalWrite(cs_pin,HIGH);
}
}
digitalWrite(4,LOW); // debug out for measuring time this all takes
}
@@ -112,15 +126,15 @@ void power_on_dacs() {
sendval = 0xf010;
for (cs_pin=7; cs_pin < 11 ; cs_pin++); {
for (cs_pin=7; cs_pin < 11 ; cs_pin++) {
digitalWrite(cs_pin,LOW);
delay(1);
SPI.transfer16(sendval);
digitalWrite(cs_pin,HIGH);
}
}
delay(100);
for (cs_pin=7; cs_pin < 11 ; cs_pin++); {
for (cs_pin=7; cs_pin < 11 ; cs_pin++) {
digitalWrite(cs_pin,LOW);
delay(1);
SPI.transfer16(sendval);
@@ -24,7 +24,7 @@
9 -Audio (PWM)
10 (SD) (PWM)
11 -Audio
12 (SD)
12 Jack Detect
13 -Audio
14 (SD) SCK
15 (-Volume)
@@ -398,7 +398,7 @@ void setup() {
SPI.setSCK(14);
SPI.begin();
pinMode(CS_Pin,OUTPUT); // slave select
pinMode(12,INPUT_PULLUP); // jack detect
input_level_l = 120;
input_level_r = 120;
@@ -407,9 +407,9 @@ void setup() {
calculate_bands();
sgtl5000_1.enable();
sgtl5000_1.volume(0.5);
//sgtl5000_1.inputSelect(AUDIO_INPUT_LINEIN);
sgtl5000_1.inputSelect(AUDIO_INPUT_MIC);
sgtl5000_1.volume(0.5);
AudioMemory(12);
@@ -432,6 +432,7 @@ void setup() {
*/
t.every(50,update_display);
t.every(10,check_Encoder);
t.every(500,check_jack);
strip.show(); // Initialize all pixels to 'off'
brightness = 16;
@@ -528,6 +529,19 @@ void loop() {
digitalWrite(32,out_trigger[3]);
//delay(2);
}
void check_jack() {
static char oldJack
char jack = digitalRead(12);
if (jack==oldJack) return;
oldJack = jack;
if (!jack) sgtl5000_1.inputSelect(AUDIO_INPUT_MIC);
else sgtl5000_1.inputSelect(AUDIO_INPUT_LINEIN);
}