#include <stdint.h>
#include "app_urv_regs.h"

#define SLOT 7

unsigned count;
unsigned m;

void
init (void)
{
  volatile struct app_urv_regs *regs =
    (volatile struct app_urv_regs *)0x100000;

  regs->relays[SLOT].pins = 0;
  count = 0;
  m = 0;
}

void
main (void)
{
  volatile struct app_urv_regs *regs =
    (volatile struct app_urv_regs *)0x100000;

  count++;
  if (count == 500000) {
    count = 0;

    unsigned v = regs->loops[SLOT].pins;
    m = (m | v) << 1;

    regs->relays[SLOT].pins = m;
  }
}
