#include <stdio.h>
#include "libwr2rf/host.h"
#include "libwr2rf/board.h"
#include "regs.h"
#include "oc_spi16.h"

int
main (int argc, char **argv)
{
  struct libwr2rf_dev *dev;
  uint32_t val;
  uint32_t res;

  dev = libwr2rf_host_init (argc, argv);
  if (dev == NULL)
    return 1;

  /* Simple test.  */
  libwr2rf_pll_spi_init(dev);

  val = 0x8d;
  libwr2rf_oc_spi_txrx16 (dev, PLL_BASE, PLL_CS, 8, val, &res);

  printf ("read pll reg 01: 0x%02x\n", libwr2rf_pll_read(dev, 0x01));
  printf ("spi pll: recv 0x%02x (expect 0x%02x)\n", res, val);

  return 0;
}
