+#define IBUS_SERVO_FRAME_SIZE 32
+#define IBUS_SERVO_FRAME_ID 0x40 // first byte after the length
+
+/* ---------- LEDs for debugging ---------- */
+
+void led_init(void)
+{
+ PORTB &= ~_BV(PB5);
+ DDRB |= _BV(PB5);
+}
+
+void led1_off(void)
+{
+ PORTB &= ~_BV(PB5);
+}
+
+void led1_on(void)
+{
+ PORTB |= _BV(PB5);
+}
+
+/* ----------------- Timer ----------------- */
+
+typedef uint16_t time_t;
+
+static void timer_init(void)
+{
+ TCCR1A = 0; // no PWM or WGM output
+ TCCR1B = _BV(CS11); // clk/8
+
+ DDRD |= _BV(PD2) | _BV(PD3) | _BV(PD4) | _BV(PD5);
+ PORTD &= ~_BV(PD2);
+}
+
+static time_t inline get_time(void)
+{
+ time_t rv;
+
+ ATOMIC_BLOCK(ATOMIC_FORCEON) {
+ rv = TCNT1;
+ };
+
+ return rv;
+}
+