remove debug, minimize code size

This commit is contained in:
harald42 2013-02-15 14:16:36 +01:00 committed by harald
parent a2387f43af
commit 252454c016
4 changed files with 5 additions and 13 deletions

View file

@ -146,8 +146,9 @@ FUSES ={.low = 0xC2, .high = 0x99, .extended = 0xfe,};
#include "lib/sensors.h" #include "lib/sensors.h"
#include "dev/button-sensor.h" #include "dev/button-sensor.h"
#include "dev/battery-sensor.h"
#include "dev/pir-sensor.h" #include "dev/pir-sensor.h"
SENSORS(&button_sensor, &pir_sensor); SENSORS(&button_sensor, &battery_sensor, &pir_sensor);
uint8_t uint8_t
rng_get_uint8(void) { rng_get_uint8(void) {

View file

@ -54,10 +54,10 @@ int readADC(uint8_t pin)
ADMUX = _BV(REFS1) | _BV(REFS0) | ( pin & 7 ) ; ADMUX = _BV(REFS1) | _BV(REFS0) | ( pin & 7 ) ;
ADCSRA = _BV(ADEN) | _BV(ADPS0) | _BV(ADPS2) ; ADCSRA = _BV(ADEN) | _BV(ADPS0) | _BV(ADPS2) ;
sbi(ADCSRA,ADSC); sbi(ADCSRA,ADSC);
loop_until_bit_is_clear(ADCSRA,ADSC); loop_until_bit_is_clear(ADCSRA,ADSC);
result = ADC; result = ADC;
ADCSRA=0; //disable ADC ADCSRA=0; //disable ADC
@ -76,10 +76,9 @@ int readInternalTemp(void)
ADCSRB |= _BV(MUX5); ADCSRB |= _BV(MUX5);
ADMUX = _BV(REFS1) | _BV(REFS0) | 0b1001 ; ADMUX = _BV(REFS1) | _BV(REFS0) | 0b1001 ;
ADCSRA = _BV(ADEN) | _BV(ADPS0) | _BV(ADPS2) ; ADCSRA = _BV(ADEN) | _BV(ADPS0) | _BV(ADPS2) ;
sbi(ADCSRA,ADSC); sbi(ADCSRA,ADSC);
loop_until_bit_is_clear(ADCSRA,ADSC); loop_until_bit_is_clear(ADCSRA,ADSC);
reading = ADC; reading = ADC;
ADCSRA=0; //disable ADC ADCSRA=0; //disable ADC

View file

@ -46,14 +46,12 @@ value(int type)
static int static int
configure(int type, int c) configure(int type, int c)
{ {
PRINTF("Sensor Button Configure called: %d, %d\n",type,c);
switch (type) { switch (type) {
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);
PRINTF("Setup sensor started\n");
DDRE |= (0<<DDE5); // Set pin as input DDRE |= (0<<DDE5); // Set pin as input
PORTE |= (1<<PORTE5); // Set port PORTE bint 5 with pullup resistor PORTE |= (1<<PORTE5); // Set port PORTE bint 5 with pullup resistor
EICRB |= (2<<ISC50); // For falling edge EICRB |= (2<<ISC50); // For falling edge
@ -62,11 +60,9 @@ configure(int type, int c)
sei(); sei();
led1_off(); led1_off();
} }
PRINTF("Sensor EIMSK set\n");
} else { } else {
enabled = 0; enabled = 0;
EIMSK &= ~(1<<INT5); // clear int EIMSK &= ~(1<<INT5); // clear int
PRINTF("Setup sensor failed\n");
} }
return 1; return 1;
} }

View file

@ -1,5 +1,5 @@
/* Sensor routine */ /* Sensor routine */
#include "contiki.h"
#include "lib/sensors.h" #include "lib/sensors.h"
#include "dev/pir-sensor.h" #include "dev/pir-sensor.h"
@ -46,14 +46,12 @@ value(int type)
static int static int
configure(int type, int c) configure(int type, int c)
{ {
PRINTF("Sensor PIR Configure called: %d, %d\n",type,c);
switch (type) { switch (type) {
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);
PRINTF("Setup sensor started\n");
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
EICRB |= (3<<ISC60); // For rising edge EICRB |= (3<<ISC60); // For rising edge
@ -62,11 +60,9 @@ configure(int type, int c)
sei(); sei();
led1_off(); led1_off();
} }
PRINTF("Sensor EIMSK set\n");
} else { } else {
enabled = 0; enabled = 0;
EIMSK &= ~(1<<INT6); // clear int EIMSK &= ~(1<<INT6); // clear int
PRINTF("Setup sensor failed\n");
} }
return 1; return 1;
} }