From: Robin Krens Date: Mon, 30 May 2022 13:56:40 +0000 (+0200) Subject: cleanup: makefile, hbc and removed unused files X-Git-Url: https://robinkrens.nl/gitweb/?a=commitdiff_plain;h=HEAD;p=lra-as-sensor cleanup: makefile, hbc and removed unused files --- diff --git a/Makefile b/Makefile index 8b4955b..9012305 100644 --- a/Makefile +++ b/Makefile @@ -22,10 +22,10 @@ CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums 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) diff --git a/haptic.c b/haptic.c deleted file mode 100644 index 727c3b2..0000000 --- a/haptic.c +++ /dev/null @@ -1,28 +0,0 @@ -#include -#include -#include -#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; - } -} diff --git a/haptic.h b/haptic.h deleted file mode 100644 index ec02bd0..0000000 --- a/haptic.h +++ /dev/null @@ -1,10 +0,0 @@ -enum { - CLICK = 0, - DOUBLE_CLICK, - SWEEP, - BUZZ, -}; - -void set_lra_as_sensor(void); -void set_lra_as_actuator(void); -void play_haptic(void); diff --git a/hbc.c b/hbc.c index 38332a1..30a1769 100644 --- a/hbc.c +++ b/hbc.c @@ -7,12 +7,12 @@ #include #include #include -#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); @@ -31,9 +31,6 @@ static void init_board(void) { 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) @@ -52,11 +49,14 @@ static void config_comparator(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); @@ -68,10 +68,8 @@ int main(void) init_board(); DDRB |= (1 << DDB4); - //PORTB |= (1 << PB1); cli(); - //set_ref_voltage(); config_comparator(); sei(); switch_idle();