#ifndef ULTRASONIC_H
#define ULTRASONIC_H

#include <Arduino.h>
#include <inttypes.h>

#define US_RX_0_PIN 2
#define US_RX_1_PIN 3
#define US_TX_0_PIN 4

enum usState_t {
  idle,
  rxPending,
  counting,
  finished
};

struct usData_t {
  uint16_t pulseStart;
  uint16_t duration;
  enum usState_t state;
};

void us_init();
void us_transmit();
long us_get_duration(byte sensor);

#endif