#!/usr/bin/python

import sys
import rr
import time
import spi
import csr

class CAD5662:


    def __init__(self, spi, slave):
        self.spi = spi
        self.slave = slave
        #self.config = config

    # offset = value to write to the DAC (2 bytes)
    def set_offset(self, offset):
    	#print "DAC offset chose %X " %offset
    	#tx = [0xFF, 0xFF, 0xF0]
    	tx = [(offset & 0xFF), ((offset & 0xFF00)>>8), 0x00]  # need to check order
       	#print tx
        self.spi.transaction(self.slave, tx)

