Clean up unused macros
This commit is contained in:
parent
8104fbbad0
commit
404df4289d
@ -27,16 +27,6 @@
|
||||
#define TRIG_ERROR -1
|
||||
#define ECHO_ERROR -2
|
||||
|
||||
#define TRIG_INPUT_MODE() CLR(TRIG_DDR, TRIG_BIT)
|
||||
#define TRIG_OUTPUT_MODE() SET(TRIG_DDR, TRIG_BIT)
|
||||
#define TRIG_LOW() CLR(TRIG_PORT, TRIG_BIT)
|
||||
#define TRIG_HIGH() SET(TRIG_PORT, TRIG_BIT)
|
||||
|
||||
#define ECHO_INPUT_MODE() CLR(ECHO_DDR, ECHO_BIT)
|
||||
#define ECHO_OUTPUT_MODE() SET(ECHO_DDR, ECHO_BIT)
|
||||
#define ECHO_LOW() CLR(ECHO_PORT, ECHO_BIT)
|
||||
#define ECHO_HIGH() SET(ECHO_PORT, ECHO_BIT)
|
||||
|
||||
|
||||
void init_sonar(void);
|
||||
void trigger_sonar(void);
|
||||
|
14
src/sonar.c
14
src/sonar.c
@ -8,17 +8,17 @@ volatile uint32_t no_of_cycles = 0;
|
||||
|
||||
void init_sonar()
|
||||
{
|
||||
TRIG_OUTPUT_MODE();
|
||||
ECHO_INPUT_MODE();
|
||||
SET(TRIG_DDR, TRIG_BIT);
|
||||
CLR(ECHO_DDR, ECHO_BIT);
|
||||
}
|
||||
|
||||
void trigger_sonar()
|
||||
{
|
||||
TRIG_LOW();
|
||||
CLR(TRIG_PORT, TRIG_BIT);
|
||||
_delay_us(1);
|
||||
TRIG_HIGH();
|
||||
SET(TRIG_PORT, TRIG_BIT);
|
||||
_delay_us(12);
|
||||
TRIG_LOW();
|
||||
CLR(TRIG_PORT, TRIG_BIT);
|
||||
_delay_us(1);
|
||||
}
|
||||
|
||||
@ -41,8 +41,8 @@ int read_sonar()
|
||||
}
|
||||
|
||||
TCNT1 = 0;
|
||||
TCCR1B |= (1 << CS10);
|
||||
TIMSK1 |= (1 << TOIE1);
|
||||
SET(TCCR1B, CS10);
|
||||
SET(TIMSK1, TOIE1);
|
||||
overflow_counter = 0;
|
||||
sei();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user