remove debug code

This commit is contained in:
harald42 2013-04-17 13:44:17 +02:00 committed by harald
parent cdf4da8461
commit 32d077790f
5 changed files with 23 additions and 23 deletions

View file

@ -14,22 +14,22 @@ static int enabled = 0;
struct sensors_sensor *sensors[1]; struct sensors_sensor *sensors[1];
unsigned char sensors_flags[1]; unsigned char sensors_flags[1];
#define BUTTON_BIT INTF5 #define BUTTON_BIT INTF4
#define BUTTON_CHECK_IRQ() (EIFR & BUTTON_BIT) ? 0 : 1 #define BUTTON_CHECK_IRQ() (EIFR & BUTTON_BIT) ? 0 : 1
#define PRINTF(...) printf(__VA_ARGS__) #define PRINTF(...) printf(__VA_ARGS__)
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
ISR(INT5_vect) ISR(INT4_vect)
{ {
// leds_toggle(LEDS_YELLOW); // leds_toggle(LEDS_RED);
if(BUTTON_CHECK_IRQ()) { if(BUTTON_CHECK_IRQ()) {
if(timer_expired(&debouncetimer)) { if(timer_expired(&debouncetimer)) {
led1_on(); // led1_on();
timer_set(&debouncetimer, CLOCK_SECOND / 4); timer_set(&debouncetimer, CLOCK_SECOND / 4);
sensors_changed(&button_sensor); sensors_changed(&button_sensor);
led1_off(); // led1_off();
} }
} }
@ -39,7 +39,7 @@ ISR(INT5_vect)
static int static int
value(int type) value(int type)
{ {
return (PORTE & _BV(PE5) ? 0 : 1) || !timer_expired(&debouncetimer); return (PORTE & _BV(PE4) ? 0 : 1) || !timer_expired(&debouncetimer);
//return 0; //return 0;
} }
@ -50,19 +50,19 @@ configure(int type, int c)
case SENSORS_ACTIVE: case SENSORS_ACTIVE:
if (c) { if (c) {
if(!status(SENSORS_ACTIVE)) { if(!status(SENSORS_ACTIVE)) {
led1_on(); // led1_on();
timer_set(&debouncetimer, 0); timer_set(&debouncetimer, 0);
DDRE |= (0<<DDE5); // Set pin as input DDRE |= (0<<DDE4); // Set pin as input
PORTE |= (1<<PORTE5); // Set port PORTE bint 5 with pullup resistor PORTE |= (1<<PORTE4); // Set port PORTE bint 5 with pullup resistor
EICRB |= (2<<ISC50); // For falling edge EICRB |= (1<<ISC40); // For falling edge
EIMSK |= (1<<INT5); // Set int EIMSK |= (1<<INT4); // Set int
enabled = 1; enabled = 1;
sei(); sei();
led1_off(); // led1_off();
} }
} else { } else {
enabled = 0; enabled = 0;
EIMSK &= ~(1<<INT5); // clear int EIMSK &= ~(1<<INT4); // clear int
} }
return 1; return 1;
} }

View file

@ -83,16 +83,16 @@ uint8_t DHT_Read_Data(uint8_t select){
//Shift data[] value 1 position left //Shift data[] value 1 position left
//Example. 01010100 if we shift it left one time it will be //Example. 01010100 if we shift it left one time it will be
//10101000 //10101000
led1_on(); // led1_on();
data[j/8]<<=1; data[j/8]<<=1;
if (counter >= 15) { //If it was high for more than 40uS if (counter >= 15) { //If it was high for more than 40uS
led1_off(); // led1_off();
data[j/8]|=1; //it means it is bit '1' so make a logic data[j/8]|=1; //it means it is bit '1' so make a logic
led1_on(); // led1_on();
} //OR with the value (save it) } //OR with the value (save it)
j++; //making an OR by 1 to this value 10101000 j++; //making an OR by 1 to this value 10101000
led1_off(); // led1_off();
} //we will have the resault 10101001 } //we will have the resault 10101001
//1 in 8-bit binary is 00000001 //1 in 8-bit binary is 00000001

View file

@ -50,7 +50,7 @@
void void
leds_arch_init(void) leds_arch_init(void)
{ {
DDRE|=(1<<DDE2) | (1<<DDE3) | (1<<DDE4); // Set pins as output since leds are mounted on the VDD bus DDRE|=(1<<DDE2) | (1<<DDE3) | (1<<DDE5); // Set pins as output since leds are mounted on the VDD bus
LEDS_OFF(); LEDS_OFF();
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/

View file

@ -5,7 +5,7 @@
#define BIT_GREEN _BV(PE2) #define BIT_GREEN _BV(PE2)
#define BIT_YELLOW _BV(PE3) #define BIT_YELLOW _BV(PE3)
#define BIT_RED _BV(PE4) #define BIT_RED _BV(PE5)
#define BIT_BLUE BIT_YELLOW #define BIT_BLUE BIT_YELLOW
#define LED_GREEN_ON() LED_OUT &= ~BIT_GREEN #define LED_GREEN_ON() LED_OUT &= ~BIT_GREEN

View file

@ -26,10 +26,10 @@ ISR(INT6_vect)
if(PIR_CHECK_IRQ()) { if(PIR_CHECK_IRQ()) {
if(timer_expired(&debouncetimer)) { if(timer_expired(&debouncetimer)) {
led1_on(); // led1_on();
timer_set(&debouncetimer, CLOCK_SECOND / 4); timer_set(&debouncetimer, CLOCK_SECOND / 4);
sensors_changed(&pir_sensor); sensors_changed(&pir_sensor);
led1_off(); // led1_off();
} }
} }
@ -50,7 +50,7 @@ configure(int type, int c)
case SENSORS_ACTIVE: case SENSORS_ACTIVE:
if (c) { if (c) {
if(!status(SENSORS_ACTIVE)) { if(!status(SENSORS_ACTIVE)) {
led1_on(); // led1_on();
timer_set(&debouncetimer, 0); timer_set(&debouncetimer, 0);
DDRE |= (0<<DDE6); // Set pin as input DDRE |= (0<<DDE6); // Set pin as input
PORTE |= (1<<PORTE6); // Set port PORTE bint 6 with pullup resistor PORTE |= (1<<PORTE6); // Set port PORTE bint 6 with pullup resistor
@ -58,7 +58,7 @@ configure(int type, int c)
EIMSK |= (1<<INT6); // Set int EIMSK |= (1<<INT6); // Set int
enabled = 1; enabled = 1;
sei(); sei();
led1_off(); // led1_off();
} }
} else { } else {
enabled = 0; enabled = 0;