Пример #1
0
Файл: mp3.c Проект: mick909/ncnl
FRESULT play(FIL *fp)
{
	UINT bytesread;
	FRESULT res;
	prepare_decoder();

	do {
		WORD idx;
		res = f_read(fp, buf, 256, &bytesread);

		if ( res ) {
			usart_write_string("f_read failed :");
			usart_write( (res / 10) + '0' );
			usart_write( (res % 10) + '0' );
			usart_write_cr();
			return res;
		}

		if ( bytesread == 0 ) break;

//		usart_write_string("set 256 bytes...");
		PORTD &= ~XDCS;
		idx = 0;
		do {
			do {} while (! (PIND & DREQ));
			xchg_spi(buf[idx++]);
		} while (--bytesread);
		PORTD |= XDCS;
//		usart_write_string("done\r\n");
	} while (1);

	usart_write_string("play done, reset vs1011e\r\n");
	PORTD &= ~XRESET;
	return FR_OK;
}
Пример #2
0
} END_TEST

START_TEST(check_tfi_decoder_syncloss_expire) {
  prepare_decoder(FORD_TFI);
  validate_decoder_sequence(tfi_startup_events, 6);
  ck_assert_int_eq(config.decoder.expiration, 162500);

  set_current_time(170000);
  check_handle_decoder_expire(&config.decoder);
  ck_assert_int_eq(0, config.decoder.current_triggers_rpm);
  ck_assert_int_eq(0, config.decoder.valid);
  ck_assert_int_eq(DECODER_EXPIRED, config.decoder.loss);
} END_TEST
Пример #3
0
} END_TEST

START_TEST(check_tfi_decoder_syncloss_variation) {

  prepare_decoder(FORD_TFI);
  validate_decoder_sequence(tfi_startup_events, 6);

  struct decoder_event ev[] = {
    {1, 0, 150000, DECODER_SYNC, 1, 0},
    {1, 0, 155000, DECODER_NOSYNC, 0, DECODER_VARIATION},
  };
  validate_decoder_sequence(ev, 2);
  ck_assert_int_eq(0, config.decoder.current_triggers_rpm);
} END_TEST
Пример #4
0
Файл: mp3.c Проект: mick909/ncnl
void test()
{
	prepare_decoder();

	do {} while (! (PIND & DREQ) );

	PORTD &= ~XDCS;

	xchg_spi(0x53);
	xchg_spi(0xef);
	xchg_spi(0x6e);
	xchg_spi(0x7d);
	xchg_spi(0x00);
	xchg_spi(0x00);
	xchg_spi(0x00);
	xchg_spi(0x00);

	PORTD |= XDCS;
}