projects
/
lra-as-sensor
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cleanup: makefile, hbc and removed unused files
[lra-as-sensor]
/
hbc.c
diff --git
a/hbc.c
b/hbc.c
index
38332a1
..
30a1769
100644
(file)
--- a/
hbc.c
+++ b/
hbc.c
@@
-7,12
+7,12
@@
#include <avr/power.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#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);
ISR(SIG_COMPARATOR)
{
if (ACSR & (1 << ACO)) {
PORTB |= (1 << PB4);
+ /* turn of comparator on detection */
ACSR &= ~(1 << ACIE);
} else {
PORTB &= ~(1 << PB4);
ACSR &= ~(1 << ACIE);
} else {
PORTB &= ~(1 << PB4);
@@
-31,9
+31,6
@@
static void init_board(void)
{
power_adc_disable();
wdt_disable();
{
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)
}
static void set_ref_voltage(void)
@@
-52,11
+49,14
@@
static void config_comparator(void)
ADCSRA = 0;
ADCSRB |= (1 << ACME); /* multiplex enable */
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 << ACD); /* enable comparator */
ACSR |= (1 << ACBG);
- //ACSR |= (1 << ACIS1) | (1 << ACIS0);
DIDR0 |= (1 << AIN1D) | (1 << AIN0D);
DIDR0 |= (1 << AIN1D) | (1 << AIN0D);
@@
-68,10
+68,8
@@
int main(void)
init_board();
DDRB |= (1 << DDB4);
init_board();
DDRB |= (1 << DDB4);
- //PORTB |= (1 << PB1);
cli();
cli();
- //set_ref_voltage();
config_comparator();
sei();
switch_idle();
config_comparator();
sei();
switch_idle();