JNIEXPORT int JNICALL Java_com_technegames_insectoiddefense_RendererWrapper_get_1wave(JNIEnv* env, jclass cls)
{
	UNUSED(env);
	UNUSED(cls);

	return get_wave();
}
Exemple #2
0
int main(void)
{
uint16_t cnt=0;
uint8_t c,div;
	DDRA = 0;
	PORTA = 0xff;
	DDRB = (1 << 4);	//TXD
	DDRC = 0xff;
	PORTC = 0;
	DDRD = 0xfe;

	USART_Init(8);		// 115.2K
	ADCSRA = 0x87;		// init ADC

//	TCCR0 = 1;
//	TIMSK = 1;
//	sei();

	for( ; ; ) {
		_WDR();

		if(USART_Ready()) {
			c = USART_Receive(STD_TIMEOUT);
			switch(c) {
				case 'g':
					div = rhex();
					if(USART_Timeout()) break;
					ADCSRA = 0x80 | div;
					div = rhex();
					if(USART_Timeout()) break;
					PORTC = div;	// gain
					get_wave();
					send_wave();
					break;

				case 'q':
					div = rhex();
					if(USART_Timeout()) break;
					ADCSRA = 0x80 | div;
					div = rhex();
					if(USART_Timeout()) break;
					PORTC = div;	// gain
					div = rhex();	// ch
					if(USART_Timeout()) break;
					get_sync_wave(div);
					send_wave();
					break;

				default:;
			}
		}

		if(++cnt > 1000) {
			PORTB = PINB ^ (1<<4); // blink
			cnt = 0;
		}
	}

	return 0;
}