LDFLAGS = -Wl,-Map,hbc.map
TARGET_ARCH = -mmcu=$(MCU)
-DEPS = haptic.h
+DEPS =
ODIR = obj
-_OBJ = hbc.o haptic.o
+_OBJ = hbc.o
OBJ = $(patsubst %, $(ODIR)/%,$(_OBJ))
$(ODIR)/%.o: %.c $(DEPS)
+++ /dev/null
-#include <stdio.h>
-#include <stdlib.h>
-#include <avr/io.h>
-#include "haptic.h"
-
-void set_lra_as_sensor(void)
-{
- /* enable interrupt routine and
- * set correct PINs */
-}
-
-void set_lra_as_actuator(void)
-{
- /* set correct PINs */
-}
-
-/* play random haptic effect on lra
- * lra is used as an actuator*/
-void play_haptic(void)
-{
- int c = CLICK;
- switch(c) {
- case CLICK:
- break;
- default:
- break;
- }
-}
#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();