Skip to content

Commit

Permalink
fixed Power off problem
Browse files Browse the repository at this point in the history
  • Loading branch information
sstefanov committed Dec 10, 2014
1 parent 5d00d6a commit 434ff0d
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 17 deletions.
29 changes: 13 additions & 16 deletions DAC_Control.ino
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
#include "EEPROM_circular.h"

//#include "IR_Packard_Bell.h"
#include "IR_Uni088.h"
//#include "IR_Uni088.h"
#include "IR_Uni.h"
#include "commands.h"

#include "TCA6424A/TCA6424A.h"
Expand All @@ -33,20 +34,15 @@
//#define DEBUGSERIAL
//#define DEBUGSERIALCMD
//#define DEBUGSERIAL2
#define DEBUGIR
#define DEBUGCMD
//#define DEBUGIR
//#define DEBUGCMD
//#define DEBUGPWR
//#define DEBUGEEPROM
//#define DEBUGIR
//#define DEBUGENC
//#define DEBUGRELAY
//#define DEBUGINPUTS



// delay 62.5ns on a 16MHz AtMega
#define NOP __asm__ __volatile__ ("nop\n\t")
#define pulse_pin(x) delayMicroseconds(1); digitalWrite(x, HIGH); delayMicroseconds(1); digitalWrite(x, LOW);

// constants

// EEPROM structure
Expand Down Expand Up @@ -187,9 +183,9 @@ void LCD_Light(bool f=true) { // light LCD

void IRLED_Blink() {
#ifdef DEBUGCMD
Serial.println("IRLED_Blink IR_Pressed IR_Recv");
Serial.println("IRLED_Blink IR_Pressed IR_Recv");
Serial.print("^");
#endif
Serial.print("^");
IR_TimerCount=0;
IR_Recv=true;
IR_Pressed=true;
Expand Down Expand Up @@ -1193,7 +1189,7 @@ void setup() {
PWR_STAT=false;
inputString.reserve(40);
eec.FindPtr();
encoder = new ClickEncoder(A1, A2, 11);
encoder = new ClickEncoder(ENC_PIN1, ENC_PIN2, ENC_BTN);
encoder->setAccelerationEnabled(false);
Timer1.initialize(1000);
Timer1.attachInterrupt(timerIsr); //,10000); // 10 ms
Expand Down Expand Up @@ -1222,11 +1218,12 @@ void loop() {
if (fade) {
fade=false;
Timer1.pwm(LCD_BL_PIN, fader<<2);

// analogWrite(LCD_BL_PIN, fader);
//#ifdef DEBUGSERIAL
// Serial.print("fader=");
// Serial.println(fader);
//#endif
#ifdef DEBUGSERIAL3
Serial.print("fader=");
Serial.println(fader);
#endif
}

#ifdef DEBUGCMD0
Expand Down
4 changes: 4 additions & 0 deletions IR_Uni.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#include <Arduino.h>
#include "commands.h"

#include "IR_Uni.h"
//#include "IR_UniDVR.h"
#include "IR_Uni088.h"

// 088
//static unsigned int lastKey;

Expand Down
17 changes: 17 additions & 0 deletions IR_Uni.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ifndef IR_Uni_h
#define IR_Uni_h

#include <IRremote.h>
#include "commands.h"

#define IRNone 0xffff
#define IR_RPT_MSG 0xFFFFFFFF

// keys to cmd
bool IR_check_RPT(unsigned long value);
bool IR_check_PROTO(unsigned long value);
bool IR_check_ADDRESS(unsigned long value);
unsigned int IR_checkCMD(unsigned long value);
_COMMAND IR_decode(unsigned int value);

#endif
55 changes: 55 additions & 0 deletions IR_UniDVR.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#ifndef IR_Uni_AUX3_h
#define IR_Uni_AUX3_h

// DVR Remote control

#include <IRremote.h>
#include "commands.h"

#define IRADDR 0x80ff
// NEC
#define IRPROTO 1


// keys
#define IR_KB_POWER 0xcf
#define IR_KB_PLAY 0x0f // ENTER
#define IR_KB_STOP 0xbd
#define IR_KB_PAUSE 0xfd
#define IR_KB_REC 0x27
#define IR_KB_TV_VCR 0x07 //DEV
#define IR_KB_CH_PC 0x87 // A
#define IR_KB_I_II 0x57 // VOIP/mon
#define IR_KB_REW 0xaf
#define IR_KB_FF 0x2f
#define IR_KB_R 0x6d // IRIS -
#define IR_KB_G 0xad // FOCUS -
#define IR_KB_Y 0x2d // ZOOM -
#define IR_KB_B 0xcd // F2
#define IR_KB_Mute 0xc7 // PTZ
#define IR_KB_Ch_Up 0xa7 // PLAY
#define IR_KB_Vol_Up 0x3d
#define IR_KB_Ch_Down 0x47 // PREV
#define IR_KB_Vol_Dn 0xdd
#define IR_KB_1 0x7f
#define IR_KB_2 0xbf
#define IR_KB_3 0x3f
#define IR_KB_4 0xdf
#define IR_KB_5 0x5f
#define IR_KB_6 0x9f
#define IR_KB_7 0x1f
#define IR_KB_8 0xef
#define IR_KB_9 0x6f
#define IR_KB_0 0xff
#define IR_KB_11 0x37 // EDIT
#define IR_KB_12 0xd7 // ESC

// keys to cmd
bool IR_check_RPT(unsigned long value);
bool IR_check_PROTO(unsigned long value);
bool IR_check_ADDRESS(unsigned long value);
unsigned int IR_checkCMD(unsigned long value);
_COMMAND IR_decode(unsigned int value);


#endif
3 changes: 2 additions & 1 deletion I_O.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ Arduino
#define ENC_PIN1 A1
#define ENC_PIN2 A2
#define ENC_BTN 11

#define SELINDELAY 3000
#define LED_INP 12
//#define LED_INP 13

#endif

0 comments on commit 434ff0d

Please sign in to comment.