Clean up unused macros

This commit is contained in:
Rihards Skuja 2018-01-02 18:18:46 +02:00
parent 8104fbbad0
commit 404df4289d
No known key found for this signature in database
GPG Key ID: 53FA13A3F7F8571B
2 changed files with 7 additions and 17 deletions

View File

@ -27,16 +27,6 @@
#define TRIG_ERROR -1 #define TRIG_ERROR -1
#define ECHO_ERROR -2 #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 init_sonar(void);
void trigger_sonar(void); void trigger_sonar(void);

View File

@ -8,17 +8,17 @@ volatile uint32_t no_of_cycles = 0;
void init_sonar() void init_sonar()
{ {
TRIG_OUTPUT_MODE(); SET(TRIG_DDR, TRIG_BIT);
ECHO_INPUT_MODE(); CLR(ECHO_DDR, ECHO_BIT);
} }
void trigger_sonar() void trigger_sonar()
{ {
TRIG_LOW(); CLR(TRIG_PORT, TRIG_BIT);
_delay_us(1); _delay_us(1);
TRIG_HIGH(); SET(TRIG_PORT, TRIG_BIT);
_delay_us(12); _delay_us(12);
TRIG_LOW(); CLR(TRIG_PORT, TRIG_BIT);
_delay_us(1); _delay_us(1);
} }
@ -41,8 +41,8 @@ int read_sonar()
} }
TCNT1 = 0; TCNT1 = 0;
TCCR1B |= (1 << CS10); SET(TCCR1B, CS10);
TIMSK1 |= (1 << TOIE1); SET(TIMSK1, TOIE1);
overflow_counter = 0; overflow_counter = 0;
sei(); sei();