#include <avr/power.h>
#include <avr/interrupt.h>
#include <util/delay.h>
-#include "haptic.h"
ISR(SIG_COMPARATOR)
{
if (ACSR & (1 << ACO)) {
PORTB |= (1 << PB4);
+ /* turn of comparator on detection */
ACSR &= ~(1 << ACIE);
} else {
PORTB &= ~(1 << PB4);
{
power_adc_disable();
wdt_disable();
- /* enable interal reference for
- * comparator
- * When the bandgap reference is connected to the Analog Comparator (by setting the ACBG bit in ACSR). */
}
static void set_ref_voltage(void)
ADCSRA = 0;
ADCSRB |= (1 << ACME); /* multiplex enable */
- //ADMUX |= (1 << MUX0); /* ADC1 as negative input */
+ /* Use admux to set alternative negative pin */
+ //ADMUX |= (1 << MUX0);
+ /* enable interal reference for
+ * comparator
+ * When the bandgap reference is connected to the Analog Comparator (by setting the ACBG bit in ACSR). */
ACSR &= ~(1 << ACD); /* enable comparator */
ACSR |= (1 << ACBG);
- //ACSR |= (1 << ACIS1) | (1 << ACIS0);
DIDR0 |= (1 << AIN1D) | (1 << AIN0D);
init_board();
DDRB |= (1 << DDB4);
- //PORTB |= (1 << PB1);
cli();
- //set_ref_voltage();
config_comparator();
sei();
switch_idle();