/*
 *Do what ever you want with this code...
 */


#include <avr/io.h>
#include <util/delay.h>
#include "uart.h"
#include "wtv020.h"

#define CR "\n\r"

int main(void){

	uart_init(9600);
	uart_puts(CR"WTV020 Voice Module Test"CR);
	wtv020_init();
	uart_puts("INIT done"CR);


	while(1){

		uart_puts(CR"PLAY 0 async"CR);
		wtv020_sendCommand(0);
		_delay_ms(2000);

		uart_puts("PAUSE 3 sec."CR);
		wtv020_sendCommand(PLAY_PAUSE);
		_delay_ms(3000);

		uart_puts("PLAY"CR);
		wtv020_sendCommand(PLAY_PAUSE);;
		_delay_ms(3000);

		uart_puts("MUTE 3 sec."CR);
		wtv020_sendCommand(VOLUME_MIN);
		_delay_ms(3000);

		uart_puts("UNMUTE"CR);
		wtv020_sendCommand(VOLUME_MAX);
		_delay_ms(3000);


/*
 * Volume control doesn't really work for me.
 * Just try it your self.
 */
//		uart_puts("VOLUME 1"CR);
//		wtv020_sendCommand(VOLUME_1);
//		_delay_ms(3000);

//		uart_puts("VOLUME 2"CR);
//		wtv020_sendCommand(VOLUME_2);
//		_delay_ms(3000);

//		uart_puts("VOLUME 3"CR);
//		wtv020_sendCommand(VOLUME_3);
//		_delay_ms(3000);

//		uart_puts("VOLUME 4"CR);
//		wtv020_sendCommand(VOLUME_4);
//		_delay_ms(3000);

//		uart_puts("VOLUME 5"CR);
//		wtv020_sendCommand(VOLUME_5);
//		_delay_ms(3000);

//		uart_puts("VOLUME 6"CR);
//		wtv020_sendCommand(VOLUME_6);
//		_delay_ms(3000);

//		uart_puts("VOLUME 7"CR);
//		wtv020_sendCommand(VOLUME_7);
//		_delay_ms(3000);

		uart_puts("STOP"CR);
		wtv020_sendCommand(STOP);
		_delay_ms(20);

		uart_puts(CR"PLAY 1 till end"CR);
		wtv020_playVoice(1);


	}
	//Here will be dragons
	return 0;
}

