Beispiel #1
0
int main(void)
{
	power_on_delay();
	timer0_init();
	rfm70_init(RFM70_MODE_PTX, addr);
	RED_LED_OUT();
	RED_LED_OFF();	
	sei();   // enable interrupts globally
	
	while(1)
	{
		sub_program_1hz();
	}
}
Beispiel #2
0
int main(void)
{
	power_on_delay();  
 	timer0_init();
	RED_LED_OUT();
	RED_LED_OFF();

	if(rfm70_init(RFM70_MODE_PRX, addr) != 0) {
		RED_LED_ON();
	}

	sei();   // enable interrupts globally
	rfm70_set_ack_payload(RFM70_PIPE0, ack_pld, sizeof(ack_pld));
	while(1)
	{
		Receive_Packet();
	}
}
Beispiel #3
0
int main(void)
{
	int8_t i;
	
	rc_init();
	rfm70_init(RFM70_MODE_PTX, rfm70_addr);
	RED_LED_OUT();
	RED_LED_OFF();
	sei();
	
	while(1) {
		rc_get_code(&code);
		//RED_LED_TOGGLE();
		
		tx_buf[0] = code.addr;
		tx_buf[1] = code.data;
#if 0		
		for(i = 7; i >= 0; i--)
		{
			if(code.data & (1 << i)) {
				RED_LED_ON();
				_delay_ms(50);
				RED_LED_OFF();
				_delay_ms(50);
			}
			RED_LED_ON();
			_delay_ms(50);
			RED_LED_OFF();
			_delay_ms(50);
				
			_delay_ms(500);
		}
#endif
	
		if(0 == rfm70_transmit_packet(tx_buf,sizeof(tx_buf))) {
			RED_LED_TOGGLE();
		}	

	
		_delay_ms(70);
	
	}
}
Beispiel #4
0
int main (void) {
	uint8_t j;

	aes128_ctx_t ctx; /* the context where the round keys are stored */
	aes128_init(key, &ctx); /* generating the round keys from the 128 bit key */

	wakeup_init();

	sei(); //Activate interrupts

	rfm70_init();

	j = 0;

	while(1) {
		set_sleep_mode(SLEEP_MODE_IDLE);
		sleep_mode();

		if (interrupt_flag == 1) {
			interrupt_flag = 0;
			rfm70_mode_transmit();
			rfm70_power(3);
			_delay_ms(50);
			read_vcc(); //setup the ADC
			data.info.type = 1;
			data.info.vcc = vcc;
			data.info.vcc_factor = VCC_SCALE_FACTOR;
			data.info.tempreture = 0;
			for (uint8_t i=0;i<11;i++) {
				data.info.data[i] = 0;
			}
			aes128_enc(data.raw, &ctx); /* encrypting the data block */
			rfm70_transmit_message( data.raw, 16 );
			_delay_ms(100);
			rfm70_mode_powerdown();
		}
	}
   
	return 0;
}
Beispiel #5
0
int main(void)
{	
	uint8_t 	i;
	
	power_on_delay();  
	rfm70_init(RFM70_MODE_PRX, addr);
	RED_LED_OUT();
	RED_LED_OFF();
	
	usbInit();
	usbDeviceDisconnect();  /* Disconnect for some time to enforce reenumeration */
	i = 0;
	while(--i) {
		_delay_ms(1);
	}
	usbDeviceConnect();
	sei();   // enable interrupts globally
	
	while(1)
	{
		usbPoll();
		Receive_Packet();
	}
}