Exemplo n.º 1
0
Arquivo: da.c Projeto: fantasea/APRS
static void DA_ISR()
{
	TIM_ClearITPendingBit(TIM2, TIM_IT_Update);

	DAC->DHR8R1 = afsk_dac_isr(dac_afsk);
	DAC->SWTRIGR |= 1;
}
Exemplo n.º 2
0
Arquivo: da.c Projeto: fantasea/APRS
static void DA_ISR()
{
	static uint8_t dac;
	
	TIM_ClearITPendingBit(TIM2, TIM_IT_Update);

	dac = afsk_dac_isr(dac_afsk);

	stm32_gpioPinWrite(DAC_GPIO_BASE, BV(1), dac & 0x80);
	stm32_gpioPinWrite(DAC_GPIO_BASE, BV(2), dac & 0x40);
	stm32_gpioPinWrite(DAC_GPIO_BASE, BV(5), dac & 0x20);
	stm32_gpioPinWrite(DAC_GPIO_BASE, BV(6), dac & 0x10);
}
Exemplo n.º 3
0
int afsk_testRun(void)
{
	int c;
	while ((c = fgetc(fp_adc)) != EOF)
	{
		afsk_adc_isr (&afsk_fd, (uint8_t) c);

		ax25_poll(&ax25);
	}
	kprintf("Messages correctly received: %d\n", msg_cnt);
	ASSERT(msg_cnt >= 15);

	char buf[256];
	// start from 1 and then wrap round to 0 otherwise null termination prevents display of data
	for (unsigned i = 0; i < sizeof (buf); i++)
		buf[i] = i + 1;

	ax25_send(&ax25, AX25_CALL("abcdef", 0), AX25_CALL("123456", 1), buf, sizeof(buf));

	do
	{
		int8_t val = afsk_dac_isr(&afsk_fd) - 128;
		ASSERT(fwrite(&val, 1, sizeof(val), fp_dac) == sizeof(val));
		data_written++;
	}
	while (afsk_fd.sending);

	#define SND_DATASIZE_OFF 8
	#if CPU_AVR
		#warning TODO: fseek?
	#else
		ASSERT(fseek(fp_dac, SND_DATASIZE_OFF, SEEK_SET) == 0);
	#endif
	data_written = cpu_to_be32(data_written);
	ASSERT(fwrite(&data_written, 1, sizeof(data_written), fp_dac) == sizeof(data_written));
	ASSERT(fclose(fp_adc) + fclose(fp_dac) == 0);

	fp_adc = afsk_fileOpen("test/afsk_test_out.au");
	ax25_init(&ax25, &afsk_fd.fd, messageout_hook);

	while ((c = fgetc(fp_adc)) != EOF)
	{
		afsk_adc_isr(&afsk_fd, (int8_t)c);

		ax25_poll(&ax25);
	}

	return 0;
}