+++ /dev/null
-unsigned char somestring[25];\r
-\r
-//*********************************************************************\r
-//******************** SYSTERM HEARTBEAT @ 10 ms *********************\r
-//*********************************************************************\r
-void InitSPI (void)\r
-{\r
- //set functionalite to pins:\r
- //port0.11 -> NPCS0\r
- //port0.12 -> MISO\r
- //port0.13 -> MOSI\r
- //port0.14 -> SPCK\r
- PIOA_PDR = BIT11 | BIT12 | BIT13 | BIT14;\r
- PIOA_ASR = BIT11 | BIT12 | BIT13 | BIT14;\r
- PIOA_BSR = 0;\r
-\r
-\r
- PMC_PCER |= 1 << 5; // Enable SPI timer clock.\r
-\r
- /**** Fixed mode ****/\r
- SPI_CR = 0x81; //SPI Enable, Sowtware reset\r
- SPI_CR = 0x01; //SPI Enable\r
-\r
-\r
-\r
- SPI_MR = 0x000E0011; //Master mode\r
- SPI_CSR0 = 0x01010B11; //9 bit\r
-\r
-}\r
-\r
-//*********************************************************************\r
-//*************************** Task 1 ********************************\r
-//*********************************************************************\r
-void Task_1(void *p)\r
-{\r
- char beat=0; // just flash the onboard LED for Heatbeat\r
-\r
- while(1)\r
- {\r
- if(beat)\r
- {\r
- PIOA_SODR = BIT18;\r
- beat=0;\r
- }\r
- else\r
- {\r
- PIOA_CODR = BIT18;\r
- beat=1;\r
- }\r
-\r
- ctl_timeout_wait(ctl_get_current_time()+ 150);\r
-\r
- }\r
-}\r
-//*********************************************************************\r
-//*************************** Task 2 ********************************\r
-//*********************************************************************\r
-void Task_2(void *p)\r
-{\r
- unsigned long z;\r
- unsigned int x,y;\r
- unsigned char a,b,c,d,e;\r
-\r
- char seconds,minutes,hours;\r
-\r
- unsigned int nowold,tenths;\r
-\r
-\r
- InitLCD();\r
-\r
-\r
-/******* Put smiley face up in 4096 color mode *******/\r
- LCD_Fill(0,0,132,132,Black);\r
-\r
- LCD_Set_Resolution(HIGH_RES); // set 4096 color mode\r
-\r
-// ShowImage_4096(0,0,smiley);\r
- LCD_Set_Resolution(LOW_RES); // set 256 color mode\r
-\r
- ctl_timeout_wait(ctl_get_current_time()+ 4000); // wait 4 seconds to view it\r
-\r
-/******* Do some static on screen *******/\r
-\r
- LCD_Fill(0,0,132,132,Black);\r
-\r
- for(z=0;z<100000;z++)\r
- {\r
- while( (a = rand()) > 132);\r
- while( (b = rand()) > 132);\r
- c = rand();\r
- LCD_PixelPut(a,b,c);\r
- }\r
-\r
-/******* Do some lines on screen *******/\r
- LCD_Fill(0,0,132,132,Black);\r
-\r
- for(z=1;z<300;z++)\r
- {\r
- while( (a = rand()) > 132);\r
- while( (b = rand()) > 132);\r
- while( (c = rand()) > 132);\r
- while( (d = rand()) > 132);\r
- e = rand(); // pick color\r
-\r
- LCD_Line(a,b,c,d,e);\r
- ctl_timeout_wait(ctl_get_current_time()+ 10);\r
- }\r
-\r
-/******* Do some Boxes on screen *******/\r
- LCD_Fill(0,0,132,132,Black);\r
-\r
- for(z=0;z<300;z++)\r
- {\r
-\r
- while( (a = rand()) > 132);\r
- while( (b = rand()) > 132);\r
- while( (c = rand()) > 132);\r
- while( (d = rand()) > 132);\r
-\r
- e = rand(); // pick color\r
- LCD_Box(a,b,c,d,e);\r
-\r
- ctl_timeout_wait(ctl_get_current_time()+ 10);\r
- }\r
-/******* Do some Circles on screen *******/\r
- LCD_Fill(0,0,132,132,Black);\r
-\r
- for(z=0;z<100;z++)\r
- {\r
-\r
- while( (a = rand()) > 132);\r
- while( (b = rand()) > 132);\r
- while( (c = rand()) > 127); // diameter\r
-\r
- d = rand(); // pick color\r
- LCD_Circle(a,b,c,d);\r
-\r
- ctl_timeout_wait(ctl_get_current_time()+ 10);\r
- }\r
-\r
-/******* Do some Thick Circles on screen *******/\r
- LCD_Fill(0,0,132,132,Black);\r
-\r
- for(z=0;z<25;z++)\r
- {\r
- while( (a = rand()) > 132);\r
- while( (b = rand()) > 132);\r
- while( (c = rand()) > 40); // diameter\r
- while( (d = rand()) > 10); // wall thicknes\r
- e = rand(); // pick color\r
- LCD_Thick_Circle(a,b,c,d,e);\r
-\r
- ctl_timeout_wait(ctl_get_current_time()+ 1);\r
- }\r
-\r
-/******* Do something funky to wipe screen *******/\r
- b=0;\r
-\r
- for(a=0;a<131;a++)\r
- {\r
- LCD_Line(a,b,65,65,0x62);\r
- }\r
- for(b=0;b<131;b++)\r
- {\r
- LCD_Line(a,b,65,65,0x62);\r
- }\r
- for(;a>1;a--)\r
- {\r
- LCD_Line(a,b,65,65,0x62);\r
- }\r
- for(;b>1;b--)\r
- {\r
- LCD_Line(a,b,65,65,0x62);\r
- }\r
-\r
- ctl_timeout_wait(ctl_get_current_time()+ 1000);\r
-\r
-/******* Show Image scrolling *******/\r
- LCD_Fill(0,0,132,132,Black);\r
-\r
- ShowImage(0,50,sparkfun);\r
-\r
- sprintf(somestring,"Thanks SparkFun");\r
- LCD_String(somestring,&FONT8x8F[0][0],5,10,LightGreen,Black);\r
-\r
- ctl_timeout_wait(ctl_get_current_time()+ 2000); // hold sparkfun image for a bit\r
-\r
- for(y=50;y<140;y++)\r
- {\r
- LCD_Line(0,y-1,132,y-1,Black); // wipe the white line as it moves down\r
- ShowImage(0,y,sparkfun); // move image to Y location\r
- ctl_timeout_wait(ctl_get_current_time()+ 25); // wait a bit\r
- }\r
-\r
-/******* Run radar in loop with example fonts displayed *******/\r
- LCD_Fill(0,0,132,132,Black);\r
-\r
- LCD_Thick_Circle(66,66,30,2,DarkBlue);\r
-\r
- y=0;\r
-\r
- while (1)\r
- {\r
- LCD_Circle_Line(66,66,28,0,y,LightGreen);\r
-\r
- ctl_timeout_wait(ctl_get_current_time()+ 1);\r
-\r
- tenths = ctl_current_time / 1000;\r
-\r
- if(tenths != nowold)\r
- {\r
- nowold = tenths;\r
-\r
- if(++seconds == 60)\r
- {\r
- seconds = 0;\r
-\r
- if(++minutes == 60)\r
- {\r
- minutes=0;\r
- hours++;\r
- }\r
- }\r
- }\r
-\r
-\r
- printf("a=%6lu - b=%6lu - c=%6lu - d=%6lu : Time=%lu\r\n",a,b,c,d,ctl_current_time);\r
-\r
- sprintf(somestring,"%05lu",y);\r
- LCD_String(somestring,&FONT6x8[0][0],52,25,White,Black);\r
-\r
- sprintf(somestring,"Time:%02u:%02u:%02u",hours,minutes,seconds);\r
- LCD_String(somestring,&FONT8x8F[0][0],14,10,DarkRed,Black);\r
-\r
- sprintf(somestring,"Time:%02u:%02u:%02u",hours,minutes,seconds);\r
- LCD_String(somestring,&FONT8x16[0][0],14,115,LightGreen,Black);\r
-\r
- LCD_Circle_Line(66,66,28,0,y,Black);\r
-\r
- if(++y==360)\r
- {\r
- y=0;\r
- }\r
-\r
- ctl_timeout_wait(ctl_get_current_time()+ 10);\r
-\r
- }\r
-}\r
-\r
-/*************************************************************************\r
- ********************* Main Module *************************\r
- ********************* *************************\r
- ********************* Initialize Program *************************\r
- ********************* Sequences *************************\r
- ********************* *************************\r
- *************************************************************************/\r
-int main(void)\r
-{\r
- BoardInit();\r
-\r
- InitSPI();\r
-\r
- while (1)\r
- {\r
- Idle();\r
- }\r
-\r
- return 0;\r
-}\r
if (i >= n) break;\r
}\r
}\r
- Dbprintf("read samples, dest[0]=%x dest[1]=%x", dest[0], dest[1]);\r
+ Dbprintf("buffer samples: %02x %02x %02x %02x %02x %02x %02x %02x ...",\r
+ dest[0], dest[1], dest[2], dest[3], dest[4], dest[5], dest[6], dest[7]);\r
}\r
\r
void ModThenAcquireRawAdcSamples125k(int delay_off, int period_0, int period_1, BYTE *command)\r
crc = update_crc16(crc, (shift1>>16)&0xff);\r
crc = update_crc16(crc, (shift1>>24)&0xff);\r
\r
- Dbprintf("Info: Tag data_hi=%x, data_lo=%x, crc=%x",\r
+ Dbprintf("Info: Tag data: %x%08x, crc=%x",\r
(unsigned int)shift1, (unsigned int)shift0, (unsigned int)shift2 & 0xFFFF);\r
if (crc != (shift2&0xffff)) {\r
Dbprintf("Error: CRC mismatch, expected %x", (unsigned int)crc);\r
n = TIBUFLEN*32;\r
// unpack buffer\r
for (i=TIBUFLEN-1; i>=0; i--) {\r
-// DbpIntegers(0, 0, BigBuf[i]);\r
for (j=0; j<32; j++) {\r
if(BigBuf[i] & (1 << j)) {\r
dest[--n] = 1;\r
// if not provided a valid crc will be computed from the data and written.\r
void WriteTItag(DWORD idhi, DWORD idlo, WORD crc)\r
{\r
-\r
- // WARNING the order of the bytes in which we calc crc below needs checking\r
- // i'm 99% sure the crc algorithm is correct, but it may need to eat the\r
- // bytes in reverse or something\r
-\r
if(crc == 0) {\r
crc = update_crc16(crc, (idlo)&0xff);\r
crc = update_crc16(crc, (idlo>>8)&0xff);\r
crc = update_crc16(crc, (idhi>>16)&0xff);\r
crc = update_crc16(crc, (idhi>>24)&0xff);\r
}\r
- Dbprintf("Writing the following data to tag: %x, %x, %x",\r
+ Dbprintf("Writing to tag: %x%08x, crc=%x",\r
(unsigned int) idhi, (unsigned int) idlo, crc);\r
\r
// TI tags charge at 134.2Khz\r
found=1;\r
idx+=6;\r
if (found && (hi|lo)) {\r
- Dbprintf("TAG ID: %x %x %x", \r
+ Dbprintf("TAG ID: %x%08x (%d)",\r
(unsigned int) hi, (unsigned int) lo, (unsigned int) (lo>>1) & 0xFFFF);\r
/* if we're only looking for one tag */\r
if (findone)\r
found=1;\r
idx+=6;\r
if (found && (hi|lo)) {\r
- Dbprintf("TAG ID: %x %x %x", \r
+ Dbprintf("TAG ID: %x%08x (%d)",\r
(unsigned int) hi, (unsigned int) lo, (unsigned int) (lo>>1) & 0xFFFF);\r
/* if we're only looking for one tag */\r
if (findone)\r