remove debug, minimize code size
This commit is contained in:
parent
a2387f43af
commit
252454c016
4 changed files with 5 additions and 13 deletions
|
@ -146,8 +146,9 @@ FUSES ={.low = 0xC2, .high = 0x99, .extended = 0xfe,};
|
|||
|
||||
#include "lib/sensors.h"
|
||||
#include "dev/button-sensor.h"
|
||||
#include "dev/battery-sensor.h"
|
||||
#include "dev/pir-sensor.h"
|
||||
SENSORS(&button_sensor, &pir_sensor);
|
||||
SENSORS(&button_sensor, &battery_sensor, &pir_sensor);
|
||||
|
||||
uint8_t
|
||||
rng_get_uint8(void) {
|
||||
|
|
|
@ -54,10 +54,10 @@ int readADC(uint8_t pin)
|
|||
|
||||
ADMUX = _BV(REFS1) | _BV(REFS0) | ( pin & 7 ) ;
|
||||
ADCSRA = _BV(ADEN) | _BV(ADPS0) | _BV(ADPS2) ;
|
||||
|
||||
sbi(ADCSRA,ADSC);
|
||||
loop_until_bit_is_clear(ADCSRA,ADSC);
|
||||
|
||||
|
||||
result = ADC;
|
||||
|
||||
ADCSRA=0; //disable ADC
|
||||
|
@ -76,10 +76,9 @@ int readInternalTemp(void)
|
|||
ADCSRB |= _BV(MUX5);
|
||||
ADMUX = _BV(REFS1) | _BV(REFS0) | 0b1001 ;
|
||||
ADCSRA = _BV(ADEN) | _BV(ADPS0) | _BV(ADPS2) ;
|
||||
|
||||
|
||||
sbi(ADCSRA,ADSC);
|
||||
loop_until_bit_is_clear(ADCSRA,ADSC);
|
||||
|
||||
reading = ADC;
|
||||
|
||||
ADCSRA=0; //disable ADC
|
||||
|
|
|
@ -46,14 +46,12 @@ value(int type)
|
|||
static int
|
||||
configure(int type, int c)
|
||||
{
|
||||
PRINTF("Sensor Button Configure called: %d, %d\n",type,c);
|
||||
switch (type) {
|
||||
case SENSORS_ACTIVE:
|
||||
if (c) {
|
||||
if(!status(SENSORS_ACTIVE)) {
|
||||
led1_on();
|
||||
timer_set(&debouncetimer, 0);
|
||||
PRINTF("Setup sensor started\n");
|
||||
DDRE |= (0<<DDE5); // Set pin as input
|
||||
PORTE |= (1<<PORTE5); // Set port PORTE bint 5 with pullup resistor
|
||||
EICRB |= (2<<ISC50); // For falling edge
|
||||
|
@ -62,11 +60,9 @@ configure(int type, int c)
|
|||
sei();
|
||||
led1_off();
|
||||
}
|
||||
PRINTF("Sensor EIMSK set\n");
|
||||
} else {
|
||||
enabled = 0;
|
||||
EIMSK &= ~(1<<INT5); // clear int
|
||||
PRINTF("Setup sensor failed\n");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Sensor routine */
|
||||
|
||||
#include "contiki.h"
|
||||
#include "lib/sensors.h"
|
||||
#include "dev/pir-sensor.h"
|
||||
|
||||
|
@ -46,14 +46,12 @@ value(int type)
|
|||
static int
|
||||
configure(int type, int c)
|
||||
{
|
||||
PRINTF("Sensor PIR Configure called: %d, %d\n",type,c);
|
||||
switch (type) {
|
||||
case SENSORS_ACTIVE:
|
||||
if (c) {
|
||||
if(!status(SENSORS_ACTIVE)) {
|
||||
led1_on();
|
||||
timer_set(&debouncetimer, 0);
|
||||
PRINTF("Setup sensor started\n");
|
||||
DDRE |= (0<<DDE6); // Set pin as input
|
||||
PORTE |= (1<<PORTE6); // Set port PORTE bint 6 with pullup resistor
|
||||
EICRB |= (3<<ISC60); // For rising edge
|
||||
|
@ -62,11 +60,9 @@ configure(int type, int c)
|
|||
sei();
|
||||
led1_off();
|
||||
}
|
||||
PRINTF("Sensor EIMSK set\n");
|
||||
} else {
|
||||
enabled = 0;
|
||||
EIMSK &= ~(1<<INT6); // clear int
|
||||
PRINTF("Setup sensor failed\n");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue