From dddd07d60e00b67e9696f5a0f0a0f729341090b7 Mon Sep 17 00:00:00 2001 From: Chiranth Siddappa Date: Fri, 18 Apr 2014 06:12:08 -0600 Subject: [PATCH] All current calls replicated with instruction call --- AD9912_sketch/AD9912.cpp | 20 ++++++++++++++++++++ AD9912_sketch/AD9912.h | 4 ++++ 2 files changed, 24 insertions(+) diff --git a/AD9912_sketch/AD9912.cpp b/AD9912_sketch/AD9912.cpp index 42e7cb1..14eeeb7 100644 --- a/AD9912_sketch/AD9912.cpp +++ b/AD9912_sketch/AD9912.cpp @@ -59,3 +59,23 @@ uint64_t AD9912::instruction(short command, uint16_t address, char bytes, uint64 pinMode(_SPIMOSI, OUTPUT); return return_data; } + +uint16_t AD9912::DAC_read() { + uint16_t data; + data = AD9912::instruction(0x1, 0x40C, 2, 0x0); + return data; +} + +void AD9912::DAC_write(uint16_t DAC_val) { + AD9912::instruction(0x0, 0x40C, 2, DAC_val); +} + +uint64_t AD9912::FTW_read() { + uint64_t FTW; + FTW = AD9912::instruction(0x1, 0x1AB, 6, 0x0); + return FTW; +} + +void AD9912::FTW_write(uint64_t FTW) { + AD9912::instruction(0x0, 0x1AB, 6, FTW); +} diff --git a/AD9912_sketch/AD9912.h b/AD9912_sketch/AD9912.h index 9ec1793..3d1d4fd 100644 --- a/AD9912_sketch/AD9912.h +++ b/AD9912_sketch/AD9912.h @@ -34,6 +34,10 @@ class AD9912 { void init(uint SPICS, uint SPISCK, uint SPIMOSI, uint SPIMISO, uint IO_update ); uint16_t read_PartID(); uint64_t instruction(short command, uint16_t address, char bytes, uint64_t data); + uint16_t DAC_read(); + void DAC_write(uint16_t DAC_val); + uint64_t FTW_read(); + void FTW_write(uint64_t FTW); private: // global type variables uint _SPISCK;