Esempio n. 1
0
int main(int argc, char *argv[]) {
	puts(MESSAGE);

	inicjalizacja();

	pthread_t threads[10];
	for (int i = 0; i < 10; ++i) {
		pthread_create(&threads[i], NULL, (i % 2)? pisarz : czytelnik, NULL);
	}

	for (int i = 0; i < 10; ++i) {
		pthread_join(threads[i], NULL);
	}

	deinicjalizacja();

	return 0;
}
Esempio n. 2
0
int main(void)
{
	//uint8_t i=0;
	inicjalizacja();
	_delay_ms(500);
	spi_write(0x07, 0x80);
	while (_RFM_NIRQ);
	//while (!(0x02&spi_read(INTERRUPT_STATUS_2)));
	//_delay_ms(200);
	RF23B_init_parameter();
	//while (_RFM_NIRQ);
	while (!((1<<ICHIPRDY)&spi_read(INTERRUPT_STATUS_2)));



	uint8_t temp8;
	uint16_t temp16;
	setup();


	czasomierz=0;
	sei();



		_delay_ms(500);
	_LED_Z;
	to_ready_mode();
	_delay_ms(100);
	_LED_OFF;
	_LED_C;
	_delay_ms(100);
	_LED_OFF;
	_delay_ms(500);

	uint8_t led_stan=0;
	to_rx_mode();

	while (1)
	{


		if (!_RFM_NIRQ)
		{
			if (led_stan)
						{
							_LED_Z;
							led_stan=0;
						}
						else
						{
							_LED_OFF;
							led_stan=1;
						}
			if(rxBufTab[0]==R_STOP)
				{f.ARMED=0;


				}else if (rxBufTab[0]==R_ARMUJ)
				{
					f.ARMED=1;
					headFreeModeHold = heading;
				}else if (rxBufTab[0]==R_SILNIKI)
				{
					temp16=0;
					temp16|=rxBufTab[2];
					temp16=temp16<<8;
					temp8=rxBufTab[1];
					temp16|=temp8;
					rfmRcData[THROTTLE]=500;//temp16;
					rfmRcData[ROLL]=500;
					rfmRcData[PITCH]=500;
					rfmRcData[YAW]=500;

				}
			to_rx_mode();
		}
		loop();
	}
	return 0;
}