Exemplo n.º 1
0
void RF_sendWOR(unsigned char addr) {

	unsigned char b[2];
	unsigned int WOR_cb;
	
	b[0]=0x01;
	b[1]=addr;
	
	VICIntEnClr = INT_EINT0;
	switch_to_idle();
	RFstatus |= WORsend;
	cc1100_write1(0x18,conf[0x18] & 0xCF);
	
	cc1100_strobe(SCAL);
	waitTX();
	WOR_cb = addTimerCB(WORsend_timeout, 101);
	startCB(WOR_cb);
	
	while (RFstatus & WORsend) {
		cc1100_write(TX_fifo | BURST,b,2);
		cc1100_strobe(STX);
		waitTX();
	}
	
	stopCB(WOR_cb);
	removeTimerCB(WOR_cb);
	
	cc1100_write1(0x18,conf[0x18]);
	waitTX();
	VICIntEnable = INT_EINT0;	
}
Exemplo n.º 2
0
void WORrx_timeout(void) {
	stopCB(WORrx_cb);
	removeTimerCB(WORrx_cb);
	RFstatus &= ~WORrxon;
	draw_ant(100,0,DRAW_ERASE);
	cc1100_write1(0x16,conf[0x16]);
	RFstatus |= WORenabled;
	
	cc1100_strobe(SIDLE);
	cc1100_strobe(SWOR);
}
Exemplo n.º 3
0
void switch_WOR_RX(void) {
	if (RFstatus & WORrxon)
		setCBIntervall(WORrx_cb,WORrx_time);
	else {
		WORrx_cb = addTimerCB(WORrx_timeout, WORrx_time);
		startCB(WORrx_cb);
		RFstatus |= WORrxon;
		RFstatus &= ~WORenabled;
		draw_ant(100,0,DRAW_PUT);
		cc1100_write1(0x16,0x07);
	}
}
Exemplo n.º 4
0
void cc1100_init(void) {
	
	unsigned long xx = 0x200;
	
	PINSEL1 &= 0xffffff00;					//GDO0 SCK1 MISO1 MOSI1 as GPIO
	FIODIR0 |= (CS1 | MOSI1 | SCK1); 		//output
	
	PCONP &= 0xfffffbff;
	PCONP |= (1<<21);	
	FIOSET0 = SCK1;
	FIOCLR0 = MOSI1;
	FIOCLR0 = CS1;
	while(xx) {
		asm volatile("nop" : :);
		xx--;
	}
	FIOSET0 = CS1;
	xx=0x200;	
	while(xx) {
		asm volatile("nop" : :);
		xx--;
	}
	FIOCLR0 = CS1;
	FIOCLR0 = SCK1;	
	while (FIOPIN0 & MISO1);
	
	PINSEL1 |= 0x000002A8;		//SCK1 MISO1 MOSI1 as SPI1
	SSPCR0 = 0x0007;
	SSPCPSR = 0x02;
	SSPCR1 = 0x02;
			
	SSPDR = SRES;
	while (FIOPIN0 & MISO1);	
	while (SSPSR & (1<<4));
	xx = SSPDR;
		
	cc1100_write((0x00 | BURST ),(unsigned char*)conf,0x2f);
	cc1100_write1(PATABLE,0xC0);
	cc1100_strobe(SIDLE);
	cc1100_strobe(SPWD);
}