Пример #1
0
void sample_callback()
{
	// Send a debug string	
	QK_LOG_DEBUG("%s [called %d times]", __FUNCTION__, counter++);
	
	// Generate some data
	time += 0.01;
	wave = sin(2.0*M_PI*3.0*time)*cos(2.0*M_PI*time);

	// Fill data values
	qk_data_set_value_f(0, time);
	qk_data_set_value_f(1, sin(2.0*M_PI*2.0*time));
	qk_data_set_value_f(2, wave);
	qk_data_set_value_f(3, wave+0.5);
	qk_data_set_value_f(4, wave+0.8);
	qk_data_set_value_f(5, wave+1.0);

	dat_buf[0].value.f = time;
	dat_buf[1].value.f = 
	

	// Generate some events
	if((counter % 10) == 0)
	{
  		evt_args[0] = 123.123+(float)counter;
  		evt_args[1] = 456.456+(float)counter;
		qk_event_set_args(0, evt_args, 2);
		qk_event_generate(0, "event fired with some arguments");	
	}
Пример #2
0
void core_callback_app(qk_callback_arg *arg)
{
	char str[7] = "hello\n\0";
	if(send)
	{
		qk_uart_write(QK_UART_1, (uint8_t*)str, 7);
		send = false;
	}

	if(qk_uart_bytes_available(QK_UART_1) > 0)
	{
		char rxbuf[16];
		qk_uart_read(QK_UART_1, rxbuf, 16);
		QK_LOG_DEBUG("rx: %s\n", rxbuf);
		send = true;
	}
}