ADF7023 Mbed

Dependencies:   mbed

main.cpp

Committer:
dheerajmpai23
Date:
2015-07-02
Revision:
2:3ef54f214a36
Parent:
1:8aeaa0b3c4e4
Child:
3:7d87539f959a

File content as of revision 2:3ef54f214a36:

#include "mbed.h"
#include <iostream>
using namespace std;
#include <bitset>

#define ENDL "\r" << endl;
#define START_ADDRESS 0x020;
#define PI 3.14
SPI adf(PTA16, PTA17, PTA15);
//MOSI, MISO, CLOCK

DigitalOut CS(D10);
Serial PC(USBTX, USBRX);
DigitalOut ledr(LED_RED);
InterruptIn IRQ(D8);
int src=0;
int irqsrc = 0;
int j = 0;
int k = 0;
int irq1=0;
//FF 00 Gen data FF 00
//unsigned int data[]={0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0x7E,0x7E,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0x7E,0x7E,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0x7E,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0xEB,0x3D,0x35,0x66,0xDC,0xDA,0x33,0xA1,0x80,0x62,0xB7,0xB8,0x88,0x8A,0xCE,0x99,0x18,0xFA,0x24,0x42,0xD1,0x7C,0x2D,0x0E,0x72,0x9E,0xE9,0x7C,0xF9,0xBA,0x18,0xAA,0x4B,0xEC,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0xCC,0xB3,0xB2,0x5B,0x96,0x38,0x71,0x96,0x54,0xE2,0x4A,0x7F,0xC9,0xB7,0x1E,0x56,0x09,0x30,0x18,0x5A,0x84,0xFA,0xC1,0x9D,0xA6,0x6A,0x17,0x50,0x6F,0xD4,0x34,0x1D,0xF0,0xE0,0xE2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0x78,0xC9,0x9A,0x09,0xE2,0x34,0xF9,0x39,0x61,0x36,0x9C,0xC2,0x98,0xB9,0x54,0xC0,0xDC,0xE6,0x90,0xF6,0xF6,0x88,0xD1,0xA5,0x5A,0x75,0x83,0x78,0x08,0xD6,0x9D,0xDE,0xB8,0x58,0xD4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0x13,0x3F,0x78,0xD9,0x4E,0xB7,0xE8,0xD6,0x0D,0x1E,0xF1,0xC4,0xB9,0xAB,0x90,0x39,0x6A,0x9E,0x8A,0xB8,0xC9,0xAF,0x5E,0x85,0x66,0xBF,0x4E,0xB3,0xD3,0x54,0x9B,0x7D,0xA3,0x3A,0x1A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0x81,0x83,0x7B,0x88,0x8A,0xAB,0x31,0x91,0x8F,0xA0,0x91,0x05,0x17,0xC2,0xD2,0xB9,0xC1,0xEE,0x97,0xCE,0x66,0xE9,0x8A,0xA4,0xBC,0xB1,0xFC,0xCB,0x3B,0x24,0x6E,0x5B,0x87,0x19,0x64,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x97,0x4C,0x18,0x22,0xEF,0x9F,0x34,0x59,0x97,0x4C,0x18,0x22,0xEF,0x9F,0x34,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x97,0x4C,0x18,0x22,0xEF,0x9F,0x34,0x59,0x97,0x4C,0x18,0x22,0xEF,0x9F,0x34,0x58,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7E,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0x7E,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0xEB,0x3D,0x35,0x66,0xDC,0xDA,0x33,0xA1,0x80,0x62,0xB7,0xB8,0x88,0x8A,0xCE,0x99,0x18,0xFA,0x24,0x42,0xD1,0x7C,0x2D,0x0E,0x72,0x9E,0xE9,0x7C,0xF9,0xBA,0x18,0xAA,0x4B,0xEC,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0xCC,0xB3,0xB2,0x5B,0x96,0x38,0x71,0x96,0x54,0xE2,0x4A,0x7F,0xC9,0xB7,0x1E,0x56,0x09,0x30,0x18,0x5A,0x84,0xFA,0xC1,0x9D,0xA6,0x6A,0x17,0x50,0x6F,0xD4,0x34,0x1D,0xF0,0xE0,0xE2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0x78,0xC9,0x9A,0x09,0xE2,0x34,0xF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00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
//Gen 00 Gen
unsigned int data[]={0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0xEB,0x3D,0x35,0x66,0xDC,0xDA,0x33,0xA1,0x80,0x62,0xB7,0xB8,0x88,0x8A,0xCE,0x99,0x18,0xFA,0x24,0x42,0xD1,0x7C,0x2D,0x0E,0x72,0x9E,0xE9,0x7C,0xF9,0xBA,0x18,0xAA,0x4B,0xEC,0x7C,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0xEB,0x3D,0x35,0x66,0xDC,0xDA,0x33,0xA1,0x80,0x62,0xB7,0xB8,0x88,0x8A,0xCE,0x99,0x18,0xFA,0x24,0x42,0xD1,0x7C,0x2D,0x0E,0x72,0x9E,0xE9,0x7C,0xF9,0xBA,0x18,0xAA,0x4B,0xEC,0x7C,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0xEB,0x3D,0x35,0x66,0xDC,0xDA,0x33,0xA1,0x80,0x62,0xB7,0xB8,0x88,0x8A,0xCE,0x99,0x18,0xFA,0x24,0x42,0xD1,0x7C,0x2D,0x0E,0x72,0x9E,0xE9,0x7C,0xF9,0xBA,0x18,0xAA,0x4B,0xEC,0x7C,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0xEB,0x3D,0x35,0x66,0xDC,0xDA,0x33,0xA1,0x80,0x62,0xB7,0xB8,0x88,0x8A,0xCE,0x99,0x18,0xFA,0x24,0x42,0xD1,0x7C,0x2D,0x0E,0x72,0x9E,0xE9,0x7C,0xF9,0xBA,0x18,0xAA,0x4B,0xEC,0x7C,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0xEB,0x3D,0x35,0x66,0xDC,0xDA,0x33,0xA1,0x80,0x62,0xB7,0xB8,0x88,0x8A,0xCE,0x99,0x18,0xFA,0x24,0x42,0xD1,0x7C,0x2D,0x0E,0x72,0x9E,0xE9,0x7C,0xF9,0xBA,0x18,0xAA,0x4B,0xEC,0x7C,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0xEB,0x3D,0x35,0x66,0xDC,0xDA,0x33,0xA1,0x80,0x62,0xB7,0xB8,0x88,0x8A,0xCE,0x99,0x18,0xFA,0x24,0x42,0xD1,0x7C,0x2D,0x0E,0x72,0x9E,0xE9,0x7C,0xF9,0xBA,0x18,0xAA,0x4B,0xEC,0x7C,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0xEB,0x3D,0x35,0x66,0xDC,0xDA,0x33,0xA1,0x80,0x62,0xB7,0xB8,0x88,0x8A,0xCE,0x99,0x18,0xFA,0x24,0x42,0xD1,0x7C,0x2D,0x0E,0x72,0x9E,0xE9,0x7C,0xF9,0xBA,0x18,0xAA,0x4B,0xEC,0x7C,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0xEB,0x3D,0x35,0x66,0xDC,0xDA,0x33,0xA1,0x80,0x62,0xB7,0xB8,0x88,0x8A,0xCE,0x99,0x18,0xFA,0x24,0x42,0xD1,0x7C,0x2D,0x0E,0x72,0x9E,0xE9,0x7C,0xF9,0xBA,0x18,0xAA,0x4B,0xEC,0x7C,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0xEB,0x3D,0x35,0x66,0xDC,0xDA,0x33,0xA1,0x80,0x62,0xB7,0xB8,0x88,0x8A,0xCE,0x99,0x18,0xFA,0x24,0x42,0xD1,0x7C,0x2D,0x0E,0x72,0x9E,0xE9,0x7C,0xF9,0xBA,0x18,0xAA,0x4B,0xEC,0x7C,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0xEB,0x3D,0x35,0x66,0xDC,0xDA,0x33,0xA1,0x80,0x62,0xB7,0xB8,0x88,0x8A,0xCE,0x99,0x18,0xFA,0x24,0x42,0xD1,0x7C,0x2D,0x0E,0x72,0x9E,0xE9,0x7C,0xF9,0xBA,0x18,0xAA,0x4B,0xEC,0x7C,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0xEB,0x3D,0x35,0x66,0xDC,0xDA,0x33,0xA1,0x80,0x62,0xB7,0xB8,0x88,0x8A,0xCE,0x99,0x18,0xFA,0x24,0x42,0xD1,0x7C,0x2D,0x0E,0x72,0x9E,0xE9,0x7C,0xF9,0xBA,0x18,0xAA,0x4B,0xEC,0x7C,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0xEB,0x3D,0x35,0x66,0xDC,0xDA,0x33,0xA1,0x80,0x62,0xB7,0xB8,0x88,0x8A,0xCE,0x99,0x18,0xFA,0x24,0x42,0xD1,0x7C,0x2D,0x0E,0x72,0x9E,0xE9,0x7C,0xF9,0xBA,0x18,0xAA,0x4B,0xEC,0x7C,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0xEB,0x3D,0x35,0x66,0xDC,0xDA,0x33,0xA1,0x80,0x62,0xB7,0xB8,0x88,0x8A,0xCE,0x99,0x18,0xFA,0x24,0x42,0xD1,0x7C,0x2D,0x0E,0x72,0x9E,0xE9,0x7C,0xF9,0xBA,0x18,0xAA,0x4B,0xEC,0x7C,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0xEB,0x3D,0x35,0x66,0xDC,0xDA,0x33,0xA1,0x80,0x62,0xB7,0xB8,0x88,0x8A,0xCE,0x99,0x18,0xFA,0x24,0x42,0xD1,0x7C,0x2D,0x0E,0x72,0x9E,0xE9,0x7C,0xF9,0xBA,0x18,0xAA,0x4B,0xEC,0x7C,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0xEB,0x3D,0x35,0x66,0xDC,0xDA,0x33,0xA1,0x80,0x62,0xB7,0xB8,0x88,0x8A,0xCE,0x99,0x18,0xFA,0x24,0x42,0xD1,0x7C,0x2D,0x0E,0x72,0x9E,0xE9,0x7C,0xF9,0xBA,0x18,0xAA,0x4B,0xEC,0x7C,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0xEB,0x3D,0x35,0x66,0xDC,0xDA,0x33,0xA1,0x80,0x62,0xB7,0xB8,0x88,0x8A,0xCE,0x99,0x18,0xFA,0x24,0x42,0xD1,0x7C,0x2D,0x0E,0x72,0x9E,0xE9,0x7C,0xF9,0xBA,0x18,0xAA,0x4B,0xEC,0x7C,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0xEB,0x3D,0x35,0x66,0xDC,0xDA,0x33,0xA1,0x80,0x62,0xB7,0xB8,0x88,0x8A,0xCE,0x99,0x18,0xFA,0x24,0x42,0xD1,0x7C,0x2D,0x0E,0x72,0x9E,0xE9,0x7C,0xF9,0xBA,0x18,0xAA,0x4B,0xEC,0x7C,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0xEB,0x3D,0x35,0x66,0xDC,0xDA,0x33,0xA1,0x80,0x62,0xB7,0xB8,0x88,0x8A,0xCE,0x99,0x18,0xFA,0x24,0x42,0xD1,0x7C,0x2D,0x0E,0x72,0x9E,0xE9,0x7C,0xF9,0xBA,0x18,0xAA,0x4B,0xEC,0x7C,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x20,0xE5,0xEE,0x00,0xEB,0x3D,0x35,0x66,0xDC,0xDA,0x33,0xA1,0x80,0x62,0xB7,0xB8,0x88,0x8A,0xCE,0x99,0x18,0xFA,0x24,0x42,0xD1,0x7C,0x2D,0x0E,0x72,0x9E,0xE9,0x7C,0xF9,0xBA,0x18,0xAA,0x4B,0xEC,0x7C,};
//Total Gen Data without FF 00
//unsigned int data[]={0x01,0x97,0x4C,0x18,0x22,0xEF,0x9F,0x34,0x59,0x97,0x4C,0x18,0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x34,0x58,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x0F,0x20,0xE5,0xEE,0x00,0x7C,0xA8,0xFA,0xF8,0x20,0x65,0xE7,0xFD,0x2E,0xFE,0x19,0xB8,0x3B,0x73,0xFE,0x78,0x8D,0x40,0xF0,0xC2,0x46,0xE5,0xA0,0x73,0x2A,0x0C,0x8B,0x02,0x7F,0xD4,0xD2,0x96,0x37,0x05,0x0F,0x20,0xE5,0xEE,0x00,0xD7,0x22,0x9C,0xDD,0xCC,0x79,0xF2,0x70,0xDE,0x38,0x8E,0x08,0x68,0xBD,0x88,0x1B,0xBC,0x40,0xE7,0x14,0x3B,0xD0,0x9A,0x1F,0x62,0xAA,0xD8,0x53,0x67,0x10,0x89,0x0F,0xDF,0x43,0x01,0x97,0x4C,0x18,0x22,0xEF,0x9F,0x34,0x59,0x97,0x4C,0x18,0x22,0xEF,0x9F,0x34,0x58,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x0F,0x20,0xE5,0xEE,0x00,0x7C,0xA8,0xFA,0xF8,0x20,0x65,0xE7,0xFD,0x2E,0xFE,0x19,0xB8,0x3B,0x73,0xFE,0x78,0x8D,0x40,0xF0,0xC2,0x46,0xE5,0xA0,0x73,0x2A,0x0C,0x8B,0x02,0x7F,0xD4,0xD2,0x96,0x37,0x05,0x0F,0x20,0xE5,0xEE,0x00,0xD7,0x22,0x9C,0xDD,0xCC,0x79,0xF2,0x70,0xDE,0x38,0x8E,0x08,0x68,0xBD,0x88,0x1B,0xBC,0x40,0xE7,0x14,0x3B,0xD0,0x9A,0x1F,0x62,0xAA,0xD8,0x53,0x67,0x10,0x89,0x0F,0xDF,0x43,0x01,0x97,0x4C,0x18,0x22,0xEF,0x9F,0x34,0x59,0x97,0x4C,0x18,0x22,0xEF,0x9F,0x34,0x58,0x65,0xD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0x00,0x7C,0xA8,0xFA,0xF8,0x20,0x65,0xE7,0xFD,0x2E,0xFE,0x19,0xB8,0x3B,0x73,0xFE,0x78,0x8D,0x40,0xF0,0xC2,0x46,0xE5,0xA0,0x73,0x2A,0x0C,0x8B,0x02,0x7F,0xD4,0xD2,0x96,0x37,0x05,0x0F,0x20,0xE5,0xEE,0x00,0xD7,0x22,0x9C,0xDD,0xCC,0x79,0xF2,0x70,0xDE,0x38,0x8E,0x08,0x68,0xBD,0x88,0x1B,0xBC,0x40,0xE7,0x14,0x3B,0xD0,0x9A,0x1F,0x62,0xAA,0xD8,0x53,0x67,0x10,0x89,0x0F,0xDF,0x43,0x01,0x97,0x4C,0x18,0x22,0xEF,0x9F,0x34,0x59,0x97,0x4C,0x18,0x22,0xEF,0x9F,0x34,0x58,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x65,0xD3,0x06,0x08,0xBB,0xE7,0xCD,0x16,0x0F,0x20,0xE5,0xEE,0x00,0x7C,0xA8,0xFA,0xF8,0x20,0x65,0xE7,0xFD,0x2E,0xFE,0x19,0xB8,0x3B,0x73,0xFE,0x78,0x8D,0x40,0xF0,0xC2,0x46,0xE5,0xA0,0x73,0x2A,0x0C,0x8B,0x02,0x7F,0xD4,0xD2,0x96,0x37,0x05,0x0F,0x20,0xE5,0xEE,0x00,0xD7,0x22,0x9C,0xDD,0xCC,0x79,0xF2,0x70,0xDE,0x38,0x8E,0x08,0x68,0xBD,0x88,0x1B,0xBC,0x40,0xE7,0x14,0x3B,0xD0,0x9A,0x1F,0x62,0xAA,0xD8,0x53,0x67,0x10,0x89,0x0F,0xDF,0x43};
#define SPI_NOP 0xFF
/***********************************************************************************/
void bbram_write()
{   
    CS=0;
    adf.write(0xB0);//PHY_OFF
    wait_ms(2);
    CS=1;
    
    // Write bbram
    CS=0;
    adf.write(0x19);
    adf.write(0x00);
    adf.write(0x60);
    adf.write(0x00);
    
    adf.write(0x00);    
    adf.write(0x00);
    adf.write(0x00);
    adf.write(0x00);
    
    adf.write(0x00);
    adf.write(0x33);
    adf.write(0x00);
    adf.write(0xF4);//Frequency Register F9 = 435.802 MHz F4 = 435.800 MHz
    
    adf.write(0xC2);
    adf.write(0x10);
    adf.write(0xC0);    
    adf.write(0x00);
    
    adf.write(0x30);
    adf.write(0x31);
    adf.write(0x07);    
    adf.write(0x00);
        
    adf.write(0x01);
    adf.write(0x00);
    adf.write(0x7F);
    adf.write(0x00);
    
    adf.write(0x0B);
    adf.write(0x37);
    adf.write(0x00);    
    adf.write(0x00);
    
    adf.write(0x40);
    adf.write(0x0C);
    adf.write(0x00);
    adf.write(0x05);
    
    adf.write(0x00);
    adf.write(0x00);
    adf.write(0x18);
    adf.write(0x12);
    
    adf.write(0x34);
    adf.write(0x56);
    adf.write(0x10);
    adf.write(0x10);
    
    adf.write(0xC4); // Different
    adf.write(0x14);
    adf.write(0x00);
    adf.write(0x00);
    
    adf.write(0x00);
    adf.write(0x00);
    adf.write(0x00);
    adf.write(0x00);
    
    adf.write(0x00);
    adf.write(0x00);
    adf.write(0x00);
    adf.write(0x00);
    
    adf.write(0x00);
    adf.write(0x00);
    adf.write(0x00);
    adf.write(0x00);
    
    adf.write(0x00);
    adf.write(0x00);
    adf.write(0x00);
    adf.write(0x00);
    
    adf.write(0x04);
    adf.write(0x00);
    adf.write(0x00);
    adf.write(0x00);
    
    adf.write(0x00);
    adf.write(0x00);
    CS=1;
    wait(1);
    
}


/******************************************************************************************/

void initiate(void){
    
    CS=0;
    adf.write(0xFF);
    adf.write(0xFF);
    CS=1;
    wait_ms(2);

    CS=0;
    adf.write(0x08);    // TRANSMIT_DATA LENGTH
    adf.write(0x14);
    adf.write(0x99);
    CS=1;
    wait_ms(2);
    CS=0;
    adf.write(0x08);        // TRANSMIT_DATA LENGTH
    adf.write(0x15);
    adf.write(0x99);
    CS=1;
    wait_ms(2);
    
    CS=0;
    adf.write(0x09);
    adf.write(0x24);   // TX_BASE ADDRESS   0x20(starting Tx Byte)
    adf.write(0x20);
    CS=1;
    wait_ms(2);
    
    CS=0;
    adf.write(0x09);
    adf.write(0x37);// BUFFER SIZE 0xE0=224 Bytes 0x137 is adress of buffer size
    adf.write(0xE0);
    CS=1;
    wait_ms(2);
    
    CS=0;
    adf.write(0x09);
    adf.write(0x36);//BB_Tx_Buffer Signal when Buffer is half filled
    adf.write(0x70);//0x70 = 112 >> When Half buffer interrupt is given
    CS=1;
    wait_ms(2);
    
    
    CS=0;
    adf.write(0x09);
    adf.write(0x39);//BB_Tx_Buffer Signal when Buffer is half filled
    adf.write(0x10);//0x70 = 112 >> When Half buffer interrupt is given
    CS=1;
    wait_ms(2);
    
    
    
    }
    
    
/*int irq_src(void){
        
        adf.write(0x2B);
        adf.write(0x36);
        adf.write(0xFF);
        irqsrc = adf.write(0xFF);
        
        irqsrc &= 0x60;
        if (irqsrc == 0x20)
        return 1;//Buffer is almost full
        else if (irqsrc == 0x40)
        return 2;// Buffer is Full
        else
        return 0;
        }
  */  
void write_data(void){
//    cout<<"3"<<ENDL;
//    cout<<"irq detected"<<ENDL;
//    src = irq_src();
    wait_ms(5);
    CS=0;
    adf.write(0x0B);//IRQ_SOURCE_Random write //To read CMD = 2B 36 FF FF
    adf.write(0x36);//Address : 0x336
    adf.write(0xFF);//Put Low
    CS=1;
    wait_us(80);
    CS=0;
    
    
    CS=0;
    k=0;
    
    if(!j){
        adf.write(0x18);
        adf.write(0x20);
        while(k<=223){
          
          adf.write(data[k]);  
          k++;
            }
        
         }       
    
    else{
//                if(src == 1){
                if(j%2){  //src==  Buffer Half Full src == 1
                adf.write(0x18);
                adf.write(0x20);
                }
            
//            else if(src==2){
            else{               //src==   Buffer is Full src==2
                adf.write(0x18);
                adf.write(0x90);
                }
            
            
            while(k<=111){
                adf.write(data[(j+1)*112+k]);
                k++;
                        
            }
            
        
        
     }
     j++;
     CS=1;
     wait_us(1);
}     
     
        
    
    
    
    
void send_data(void){
        
    CS=0;
    adf.write(0xBB);
    CS=1;
    wait_ms(2); 
    
    CS=0;
    adf.write(0xFF);
    adf.write(0xFF);
    CS=1;
    wait_ms(2); 
    
    write_data();
    
    CS=0;
    adf.write(0xB1);
    CS=1;
    wait_ms(2); 
    
    CS=0;
    adf.write(0xFF);
    adf.write(0xFF);
    CS=1;
    wait_ms(2);  
    
    CS=0;
    adf.write(0xB5);
    CS=1;
    wait_ms(2);  
    
    CS=0;
    adf.write(0xFF);
    adf.write(0xFF);
    CS=1;
    wait_ms(2);
    int x = IRQ;
    while(1){
        x=IRQ;
//     cout<<"in While Loop"<<ENDL;
//     cout<<x<<ENDL;       
     if(x){
         
         write_data();
         
         }
//     IRQ.rise(&write_data);
//     IRQ.fall(&print);
     
     } 
     
     
    }
    
    
    int main()
{   
//    cout<<"in MAin"<<ENDL;
    adf.format(8,0);
    adf.frequency(1000000);
    bbram_write();
//    cout<<"bbram written"<<ENDL;
    initiate();
//    cout<<"Initiated to Rolling buffer mode"<<ENDL;
    send_data();
    
    
}