Ejemplo n.º 1
0
void autoBL(unsigned int cb)
{
	switch(direction)
	{
		case 0:
			if(bl_val < bl_max)
			{
				bl_val++;
			}
			else
			{
				direction = 1;
				setCBIntervall(bl_cb, bl_timeout);
			}
			break;

		case 1:
			direction = 2;
			setCBIntervall(bl_cb, bl_speed);
			break;

		case 2:
			if(bl_val > 0x00)
			{
				bl_val--;
			}
			else
			{
				direction = 0;
				stopCB(bl_cb);
			}
			break;
	}
}
Ejemplo n.º 2
0
// set new brightness and set up fading and timout
void setBacklight(unsigned char level)
{
	if(level == BL_AUTO)
	{
		stopCB(bl_cb);
		direction = 0;
		setCBIntervall(bl_cb, bl_speed);
		startCB(bl_cb);
	}
	else if(level < BL_AUTO)
	{
		stopCB(bl_cb);
		bl_val = level;
		direction = 1;
		setCBIntervall(bl_cb, bl_timeout);
		startCB(bl_cb);
	}
}
Ejemplo n.º 3
0
void cc1100IRQ (void) {
		
	if (cc1100_read1(0x3B | READ | BURST) > 0) {
		RF_getfifo(RFbuf);
		cc1100_strobe(SIDLE);
		cc1100_strobe(SFRX);
				
		struct cc1100frame_ *RXframe;
		RXframe = (struct cc1100frame_ *)&RFbuf[0];
		
		if ((RXframe->len == 1) && ((RXframe->destAddr == cc1100Addr)  || (RXframe->destAddr == 0x00))) {
			switch_WOR_RX();
		}
		
		if(RFstatus & WORenabled)
			cc1100_strobe(SWOR);
		else
			cc1100_strobe(SRX);
			
		if (RXframe->len > 3) {
			setCBIntervall(WORrx_cb,WORrx_time);
			switch ( RXframe->packetType) {
				case 0x01:
					draw_block(0,50,128,10,3,DRAW_ERASE);
					draw_string(0, 50, (char*)&RFbuf[headerLen], 3, DRAW_PUT);
				break;
				case 0x02:
					if (RXframe->data[0] == 0x01) {
						RXframe->destAddr = RXframe->srcAddr;
						RXframe->srcAddr = cc1100Addr;
						RXframe->data[0] = 0x02;
						RXframe->len = 0x04;
						switch_to_idle();
						RF_send(RFbuf);
					}
					else if (RFbuf[headerLen] == 0x02) {
						RFstatus |= Received;
					}
				break;
				case 0x03:
					if ((RXframe->data[0] == 0x01) && (timeInfo & time_accurate)) {
						send_time(RXframe->srcAddr);
					}
					else if (RFbuf[headerLen] == 0x02) {
						memcpy((unsigned char *)&time,(unsigned char *)&RXframe->data[1],3);
						memcpy((unsigned char *)&date,(unsigned char *)&RXframe->data[4],4);
						timeInfo |=0x02;
						VICSoftInt = INT_EINT2;
					}
			}
		}
	}
	
	waitTX();
	EXTINT = 0x01;
}
Ejemplo n.º 4
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);
	}
}