From: Robin Krens Date: Wed, 18 May 2022 21:27:04 +0000 (+0200) Subject: hbc: added stub files X-Git-Url: https://robinkrens.nl/gitweb/?a=commitdiff_plain;h=b5003bc24fecbcdf437ddb7d8ef2b54f3649c6c2;p=lra-as-sensor hbc: added stub files --- diff --git a/Makefile b/Makefile index 6b3bf06..f8cbf9e 100644 --- a/Makefile +++ b/Makefile @@ -19,10 +19,10 @@ CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums LDFLAGS = -Wl,-Map,hbc.map TARGET_ARCH = -mmcu=$(MCU) -DEPS = +DEPS = haptic.h ODIR = obj -_OBJ = hbc.o +_OBJ = hbc.o haptic.o OBJ = $(patsubst %, $(ODIR)/%,$(_OBJ)) $(ODIR)/%.o: %.c $(DEPS) diff --git a/haptic.c b/haptic.c new file mode 100644 index 0000000..73a87d3 --- /dev/null +++ b/haptic.c @@ -0,0 +1,27 @@ +#include +#include +#include +#include "haptic.h" + +void set_lra_as_sensor(void) +{ + +} + +void set_lra_as_actuator(void) +{ + +} + +/* 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 new file mode 100644 index 0000000..ec02bd0 --- /dev/null +++ b/haptic.h @@ -0,0 +1,10 @@ +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 0cca0dc..a0e77e0 100644 --- a/hbc.c +++ b/hbc.c @@ -1,14 +1,34 @@ +#include +#include #include +#include +#include +#include #include +#include +#include "haptic.h" -#include -#include +/* wake up on interrupt */ +static void switch_idle(void) +{ + sei(); + set_sleep_mode(SLEEP_MODE_IDLE); + sleep_mode(); +} -#include +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). */ +} -int main(void) { - +int main(void) +{ + init_board(); DDRB |= (1 << DDB3); PORTB = (1 << PB3);