sonar.c File Reference
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include "usart.h"
#include "common.h"
#include "lcdproxima.h"
Go to the source code of this file.
Define Documentation
| #define LED_OFF LED_PORT &= ~(1 << LED_PIN) |
| #define LED_ON LED_PORT |= (1 << LED_PIN) |
| #define LED_TOGGLE LED_PORT ^= (1 << LED_PIN) |
| #define MAX_DELAY (100000) |
Maximum delay to wait to the end of measurement.
Definition at line 54 of file sonar.c.
| #define SONAR_CLEAR_INIT SONAR_INIT_PORT &= ~(1 << SONAR_INIT_PIN) |
| #define SONAR_ECHO_DDR (DDRB) |
| #define SONAR_ECHO_PIN (PB0) |
| #define SONAR_ECHO_PORT (PINB) |
| #define SONAR_GET_ECHO (SONAR_ECHO_PORT & (1 << SONAR_ECHO_PIN)) |
| #define SONAR_INIT_DDR (DDRC) |
| #define SONAR_INIT_PIN (PC1) |
| #define SONAR_INIT_PORT (PORTC) |
| #define SONAR_POWER_DDR (DDRD) |
| #define SONAR_POWER_OFF SONAR_POWER_PORT |= (1 << SONAR_POWER_PIN) |
| #define SONAR_POWER_ON SONAR_POWER_PORT &= ~(1 << SONAR_POWER_PIN) |
| #define SONAR_POWER_PIN (PD6) |
| #define SONAR_POWER_PORT (PORTD) |
| #define SONAR_SET_INIT SONAR_INIT_PORT |= (1 << SONAR_INIT_PIN) |
| #define TOSTR |
( |
s |
|
) |
XSTR(s) |
Function Documentation
Timer1 capture interrupt service subroutine.
It is called at rising edge on ICP1.
Definition at line 72 of file sonar.c.
Overflow counter interrupts service routine.
Definition at line 63 of file sonar.c.
Entry point of program.
It is an infinite loop.
Definition at line 81 of file sonar.c.
Variable Documentation
Sonar echo received.
Definition at line 58 of file sonar.c.
| volatile uint16_t icr1 = 0 |
Copy of ICR1.
Definition at line 57 of file sonar.c.
Overflow counter.
Definition at line 56 of file sonar.c.