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)
--- /dev/null
+#include <stdio.h>
+#include <stdlib.h>
+#include <avr/io.h>
+#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;
+ }
+}
--- /dev/null
+enum {
+ CLICK = 0,
+ DOUBLE_CLICK,
+ SWEEP,
+ BUZZ,
+};
+
+void set_lra_as_sensor(void);
+void set_lra_as_actuator(void);
+void play_haptic(void);
+#include <stdio.h>
+#include <stdlib.h>
#include <avr/io.h>
+#include <avr/wdt.h>
+#include <avr/sleep.h>
+#include <avr/power.h>
#include <avr/interrupt.h>
+#include <util/delay.h>
+#include "haptic.h"
-#include <stdio.h>
-#include <stdlib.h>
+/* wake up on interrupt */
+static void switch_idle(void)
+{
+ sei();
+ set_sleep_mode(SLEEP_MODE_IDLE);
+ sleep_mode();
+}
-#include <util/delay.h>
+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);