예제 #1
0
파일: c.c 프로젝트: rv1/GuitarPedal
/****************************************************************************************
 * Subroutine to write The instructions on the LCD cursor
 * x = x coordinate, int y = y coordinate
****************************************************************************************/
void VGA_Description(int x,int y)
{
	char text[50] = "Make sure that the input and output is connected to DE2\0";
	VGA_text (x, y++, text);
	y=y+1;
	VGA_text (x, y++,"Steps to get this thing working\0");
	VGA_text (x, y++, "1)Use `s` for next\0");
	VGA_text (x, y++, "2)Use `a` for previous\0");
	VGA_text (x, y++, "3)Activate/Deactivate sound using KEY[3]\0");
	
	VGA_text (x, 25, "Distortion \0");
	VGA_text (x, 32, "    Echo   \0");
	VGA_text (x, 40, "Kill Switch\0");
	VGA_text (x, 47, "Bit Crusher\0");
	VGA_text (x, 55, "  Regular  \0");
	
	VGA_text (35, 24, "Works with High input volume and low \0");
	VGA_text (35, 25, "output volume\0");
	VGA_text (35, 31, "Press KEY[1] to start and stop recording\0");
	VGA_text (35, 33, "Press KEY[2] to terminate loop and resume\0");
	VGA_text (35, 34, "normal playback\0");
	VGA_text (35, 39, "Keep KEY[2] pressed to kill audio\0");
	VGA_text (35, 46, "No instructions here :)\0");
	VGA_text (35, 54, "Plain audio without any processing  \0");
	
	
	
	LCD_cursor (0,0);										// set LCD cursor location to top row
	LCD_text ("whats up        \0");
	LCD_cursor (0,1);										// set LCD cursor location to top row
	LCD_text ("Lets Get Started\0");
	LCD_cursor_off ();									// turn off the LCD cursor 

}
예제 #2
0
파일: menu.c 프로젝트: robots/reflow-oven
static void halt_tc_open()
{
	pwm_set2(0);
	pwm_set1(0);

	LCD_cursor(0, 0);
	LCD_text(" FATAL! ");
	LCD_cursor(1, 0);
	LCD_text("TC open!");
	while(1) {
		wdt_reset();
		BL_OFF;
		_delay_ms(100);
		BL_ON;
		_delay_ms(100);
	}

}
예제 #3
0
파일: menu.c 프로젝트: robots/reflow-oven
static void menu_value_u16(uint16_t *x)
{
	uint16_t val; 
	char buf[9];

	uint8_t done = 0;
	uint8_t update = 1;

	val = *x;

	sprintf(buf, "O: %05u", val);
	LCD_cursor(0, 0);
	LCD_text(buf);

	_delay_ms(100);

	while (done==0) {
		if (update == 1) {
			update = 0;
			sprintf(buf, "N: %05u", val);
			LCD_cursor(1, 0);
			LCD_text(buf);
		}

		uint8_t event = enc_read();
		
		// check encoder
		if (event == ENC_UP) {
				val++;
				update = 1; 
		} else if (event == ENC_DOWN) {
				val--;
				update = 1;
		}

		// check button
		if (!(BUTTONS & _BV(BUT))) {
				done = 1;
		}
	}

	*x = val;
}
예제 #4
0
파일: c.c 프로젝트: rv1/GuitarPedal
/****************************************************************************************
 * Subroutine to check r10 and display accordingly
 * x = x coordinate, y = y coordinate, val = r10's value
****************************************************************************************/
void VGA_Polling(int x,int y, int val){
	/* output text message to the LCD */
	LCD_cursor (0,0);										// set LCD cursor location to top row
	LCD_text ("Selected Effect :-\0");
	VGA_box(0, 60, 319, 179, 0);
	if (val == 1){
		hollow_rect(20,90,100,20,0x7777);
		hollow_rect(20,120,100,20,0x2222);
		hollow_rect(20,150,100,20,0x2222);
		hollow_rect(20,180,100,20,0x2222);
		hollow_rect(20,210,100,20,0x2222);
		
		LCD_cursor (0,1);										// set LCD cursor location to bottom row
		LCD_text ("Distortion      \0");
		LCD_cursor_off ();
		VGA_text (10, 20, "Active effect is Distortion \0");
	} else if (val == 2){
		hollow_rect(20,90,100,20,0x2222);
		hollow_rect(20,120,100,20,0x7777);
		hollow_rect(20,150,100,20,0x2222);
		hollow_rect(20,180,100,20,0x2222);
		hollow_rect(20,210,100,20,0x2222);
		VGA_text (10, 20, "Active effect is Echo       \0");
		LCD_cursor (0,1);										// set LCD cursor location to bottom row
		LCD_text ("Echo            \0");
		LCD_cursor_off ();
	} else if (val == 3){
		hollow_rect(20,90,100,20,0x2222);
		hollow_rect(20,120,100,20,0x2222);
		hollow_rect(20,150,100,20,0x7777);
		hollow_rect(20,180,100,20,0x2222);
		hollow_rect(20,210,100,20,0x2222);
		VGA_text (10, 20, "Active effect is Kill Switch\0");
		LCD_cursor (0,1);										// set LCD cursor location to bottom row
		LCD_text ("Kill Switch     \0");
		LCD_cursor_off ();
	}else if (val == 4){
		hollow_rect(20,90,100,20,0x2222);
		hollow_rect(20,120,100,20,0x2222);
		hollow_rect(20,150,100,20,0x2222);
		hollow_rect(20,180,100,20,0x7777);
		hollow_rect(20,210,100,20,0x2222);
		VGA_text (10, 20, "Active effect is Bit Crusher\0");
		LCD_cursor (0,1);										// set LCD cursor location to bottom row
		LCD_text ("Bit Crusher     \0");
		LCD_cursor_off ();
	} else if (val == 5){
		hollow_rect(20,90,100,20,0x2222);
		hollow_rect(20,120,100,20,0x2222);
		hollow_rect(20,150,100,20,0x2222);
		hollow_rect(20,180,100,20,0x2222);
		hollow_rect(20,210,100,20,0x7777);
		VGA_text (10, 20, "Plain output activated      \0");
		LCD_cursor (0,1);										// set LCD cursor location to bottom row
		LCD_text ("Plain Audio     \0");
		LCD_cursor_off ();
	}
}
예제 #5
0
파일: menu.c 프로젝트: robots/reflow-oven
void menu_redraw()
{
	const struct menuitem_t *menu;
	uint8_t pos;

	char *text1;
	char *text2;

	menu = menu_item_stack[menu_depth];
	pos = menu_pos_stack[menu_depth];

	text1 = (char *)pgm_read_word(&menu[pos].text1);
	text2 = (char *)pgm_read_word(&menu[pos].text2);

	LCD_cursor(0, 0);
	LCD_text(text1);

	LCD_cursor(1, 0);
	if (text2) {
		LCD_text(text2);
	} else {
		LCD_text("        ");
	}
}
예제 #6
0
파일: menu.c 프로젝트: robots/reflow-oven
static void run_reflow(uint8_t mode)
{
	uint16_t temp = 0;
	int16_t target = 30;
	uint16_t pid_out;
	uint8_t done = 0;
	char buf[9];

	pid_init();

	_delay_ms(200);
	wdt_enable(WDTO_2S);
	global_time = 0;

	pwm_set2(255);
	while(done == 0) {

		if (max6675_ready) {
			max6675_ready = 0;
		
			wdt_reset();

			if ((max6675_data == 0) || (max6675_data & MAX6675_TC_OPEN)) {
				halt_tc_open();
				break;
			}

			// convert data to temp in degrees
			temp = MAX6675_TEMP(max6675_data);
			temp = temp / 4;

			if (mode == 0) {
				target = ramp_get(global_time);
				if (target == -1000) {
					done = 1;
					LCD_cursor(1, 0);
					LCD_text("        ");
					LCD_cursor(0, 0);
					LCD_text("DONE !!!");
					break;
				}
			}

			pid_out = pid_do(temp, target);

			// apply new pwm, pidout limit is 4096 scale to 256
			pwm_set1(pid_out >> 4);


			serial_write('0');
			serial_write('x');
			serial_write_hex(global_time >> 8);
			serial_write_hex(global_time& 0xff);
/*			serial_write(' ');
			serial_write('0');
			serial_write('x');
			serial_write_hex(max6675_data >> 8);
			serial_write_hex(max6675_data & 0xff);*/
			serial_write(' ');
			serial_write('0');
			serial_write('x');
			serial_write_hex(temp >> 8);
			serial_write_hex(temp & 0xff);
			serial_write(' ');
			serial_write('0');
			serial_write('x');
			serial_write_hex(target >> 8);
			serial_write_hex(target & 0xff);
			serial_write(' ');
			serial_write('0');
			serial_write('x');
			serial_write_hex(pid_out >> 8);
			serial_write_hex(pid_out & 0xff);
			serial_write('\n');

		}

		if (mode == 1) {
			uint8_t tmp = enc_read();
			if (tmp == ENC_UP) {
				if (target != 0xffff)
					target ++;
			} else if (tmp == ENC_DOWN) {
				if (target > 20)
					target --;
			}
		}

		if (!(BUTTONS & _BV(BUT))) {
			LCD_cursor(0, 0);
			LCD_text(" USER   ");
			LCD_cursor(1, 0);
			LCD_text("ABORT !!");
			break;
		}

		LCD_cursor(0, 0);
		snprintf(buf, 9, "C:  %04d", temp);
		LCD_text(buf);
		LCD_cursor(1, 0);
		snprintf(buf, 9, "T:  %04d", target);
		LCD_text(buf);

	}

	// pwm to zero
	pwm_set1(0);
	pwm_set2(0);
	wdt_disable();
	wait_blink();
}