
#include <stdint.h>

#include "nrf_delay.h"
#include "mcp3425.h"
#include "twi.h"

void mcp_init(void)
{
  mcp_wr(MCP_INIT);
}

void mcp_wr(uint8_t input)
{
  twi_write(MCP_ADDR,input);
}

uint32_t mcp_rd()
{
  uint32_t sample;
  twi_write(MCP_ADDR, MCP_READ_1);
  //nrf_delay_ms(100);
  twi_read_multi(MCP_ADDR, (uint8_t*)(&sample), sizeof(sample));
  return sample;
}