|
|
|
@ -1,9 +1,9 @@
|
|
|
|
|
/*
|
|
|
|
|
HiFiLOGIX EEPROM BETA (0.1.8 Base)
|
|
|
|
|
|
|
|
|
|
dewdude@gmail.com - 08-JAN-2019
|
|
|
|
|
HiFiLOGIX EEROM BETA 0.1.9
|
|
|
|
|
|
|
|
|
|
!!! IMPORTANT !!!
|
|
|
|
|
dewdude@gmail.com - 09-JAN-2019
|
|
|
|
|
|
|
|
|
|
!!! IMPORTANT !!!
|
|
|
|
|
|
|
|
|
|
IF YOU HAVE DATA AT ADDRESSES 1020 - 1023, THIS SKETCH WILL CHANGE IT.
|
|
|
|
|
|
|
|
|
@ -31,15 +31,25 @@
|
|
|
|
|
#include <Wire.h>
|
|
|
|
|
#include <U8g2lib.h>
|
|
|
|
|
#include <IRremote.h>
|
|
|
|
|
#include <avr/pgmspace.h>
|
|
|
|
|
#include <EEPROM.h>
|
|
|
|
|
#define di 1022
|
|
|
|
|
#define dx 1021
|
|
|
|
|
#define db 1020
|
|
|
|
|
#define dt 1023
|
|
|
|
|
#include "logo.h" // XBMP data for logo.
|
|
|
|
|
|
|
|
|
|
U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0, U8X8_PIN_NONE);
|
|
|
|
|
|
|
|
|
|
const char *inputs[] = {"TAPE-2","TAPE-1","AUX","TUNER","PHONO-2","PHONO-1"};
|
|
|
|
|
const char in0[] PROGMEM = "TAPE-2";
|
|
|
|
|
const char in1[] PROGMEM = "TAPE-1";
|
|
|
|
|
const char in2[] PROGMEM = "AUX";
|
|
|
|
|
const char in3[] PROGMEM = "TUNER";
|
|
|
|
|
const char in4[] PROGMEM = "PHONO-1";
|
|
|
|
|
const char in5[] PROGMEM = "PHONO-2";
|
|
|
|
|
|
|
|
|
|
const char * const inputs[] PROGMEM ={in0,in1,in2,in3,in4,in5}; // Drop the entire array in to program space.
|
|
|
|
|
|
|
|
|
|
int latchPin = 11;
|
|
|
|
|
int clockPin = 9;
|
|
|
|
|
int dataPin = 12;
|
|
|
|
@ -48,29 +58,33 @@ int blanking = 5;
|
|
|
|
|
int matrix = A0;
|
|
|
|
|
IRrecv remote(IRin);
|
|
|
|
|
decode_results ircode;
|
|
|
|
|
char txt[8];
|
|
|
|
|
|
|
|
|
|
void DontCrossTheStreams(byte op, int x, int i) // There's something very important I forgot to tell you.
|
|
|
|
|
{ // Don't cross the streams.
|
|
|
|
|
strcpy_P(txt, (char*)pgm_read_word(&(inputs[i]))); // Why?
|
|
|
|
|
digitalWrite(latchPin, LOW); // It would be bad.
|
|
|
|
|
shiftOut(dataPin, clockPin, LSBFIRST, op); // What do you mean, bad?
|
|
|
|
|
digitalWrite(latchPin, HIGH); // Imagine all life as you know
|
|
|
|
|
u8g2.clearBuffer(); // it stopping instaneously
|
|
|
|
|
u8g2.drawStr(x,30,txt); // and every molecule in
|
|
|
|
|
u8g2.sendBuffer(); // your body exploding
|
|
|
|
|
EEPROM.update(db, op); // at the speed of light.
|
|
|
|
|
EEPROM.update(dx, x); // Total protonic reversal.
|
|
|
|
|
EEPROM.update(di, i); // That's bad.
|
|
|
|
|
} // Important safety tip, thanks Egon.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void DontCrossTheStreams(byte op, int x, int i) // There's something very important I forgot to tell you.
|
|
|
|
|
{// Don't cross the streams. // Why?
|
|
|
|
|
digitalWrite(latchPin, LOW); // It would be bad.
|
|
|
|
|
shiftOut(dataPin, clockPin, LSBFIRST, op); // What do you mean, bad?
|
|
|
|
|
digitalWrite(latchPin, HIGH); // Imagine all life as you know
|
|
|
|
|
u8g2.clearBuffer(); // it stopping instaneously
|
|
|
|
|
u8g2.drawStr(x,30,inputs[i]); // and every molecule in
|
|
|
|
|
u8g2.sendBuffer(); // your body exploding
|
|
|
|
|
EEPROM.update(db, op); // at the speed of light.
|
|
|
|
|
EEPROM.update(dx, x); // Total protonic reversal.
|
|
|
|
|
EEPROM.update(di, i); // That's bad.
|
|
|
|
|
// Important safety tip, thanks Egon.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void eeprominit() {
|
|
|
|
|
if (EEPROM.read(1023) == 'T') {
|
|
|
|
|
void eeprominit() { // This checks the EEPROM to see if it's
|
|
|
|
|
// been initialized by the code before.
|
|
|
|
|
if (EEPROM.read(dt) == 'T') { // Check address 1023 for init flag "T"
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
EEPROM.write(db, 16);
|
|
|
|
|
EEPROM.write(dx, 32);
|
|
|
|
|
EEPROM.write(di, 2);
|
|
|
|
|
EEPROM.write(1023, 'T');
|
|
|
|
|
EEPROM.write(dt, 'T');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -88,8 +102,9 @@ void setup()
|
|
|
|
|
u8g2.drawXBMP(14,4,hifilogix_width,hifilogix_height,hifilogix_bits);
|
|
|
|
|
} while ( u8g2.nextPage() );
|
|
|
|
|
delay(2000); // It takes the Denon about 4.5 seconds to kick speakers on.
|
|
|
|
|
u8g2.setFont(u8g2_font_logisoso28_tr); // Moved here since logo is bitmap.
|
|
|
|
|
DontCrossTheStreams(EEPROM.read(db),EEPROM.read(dx),EEPROM.read(di)); // THIS IS NO LONGER STATIC IN THE BETA! (yay.)
|
|
|
|
|
u8g2.setFont(u8g2_font_logisoso28_tr);
|
|
|
|
|
DontCrossTheStreams(EEPROM.read(db),EEPROM.read(dx),EEPROM.read(di)); // THIS IS NO LONGER STATIC IN THE BETA! (yay.)
|
|
|
|
|
//DontCrossTheStreams(16,32,2);
|
|
|
|
|
digitalWrite(blanking,HIGH); // Now drives a logic inverter.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|