예제 #1
0
void MENU :: MAIN_MENU(void)
{
	char ch ;
	LINES line ;
	do
	{
		textmode(C40) ;
		clrscr() ;
		line.BOX(2,1,39,25,219) ;
		line.BOX(6,5,35,21,218) ;
		line.BOX(12,7,26,9,218) ;
		gotoxy(13,8) ;
		cout <<"VIDEO LIBRARY" ;
		gotoxy(11,11) ;
		cout <<"1: ADD NEW CASSETTE" ;
		gotoxy(11,12) ;
		cout <<"2: ISSUE CASSETTE" ;
		gotoxy(11,13) ;
		cout <<"3: RETURN CASSETTE" ;
		gotoxy(11,14) ;
		cout <<"4: DISPLAY" ;
		gotoxy(11,15) ;
		cout <<"5: EDIT" ;
		gotoxy(11,16) ;
		cout <<"0: QUIT" ;
		gotoxy(11,19) ;
		cout <<"Enter your choice:" ;
		ch = getch() ;
		textmode(C80) ;
		clrscr() ;
		CASSETTE cas ;
		ISSUE_RETURN ir ;
		switch(ch)
		{
			case 27,'0' : break ;
			case '1' :
					cas.ADDITION() ;
					break ;
			case '2' :
					ir.ISSUE() ;
					break ;
			case '3' :
					ir.RETURN() ;
					break ;
			case '4' :
					DISPLAY_MENU() ;
					break ;
			case '5' :
					EDIT_MENU() ;
					break ;
		}
	} while (ch != 27 && ch != '0') ;
}
예제 #2
0
void getNewPassword(char recv)
{
	uartTxOneChar(UART0, '*');
	password[string_index++] = recv;
	if (recv == '\r')
	{
		password[string_index - 1] = 0;
		os_memcpy(&wifi_config.password, password, 64);
		menuState = IDLE;
		DISPLAY_MENU();
		display_now = true;
		string_index = 0;
//  	system_os_post(USER_TASK_PRIO_0, 1, 0); // Display menu
	}
	if (recv == '\n')
		string_index--;
}
예제 #3
0
void getNewSSID(char recv)
{
	uartTxOneChar(UART0, recv);
	ssid[string_index++] = recv;
	if (recv == '\r')
	{
		ssid[string_index - 1] = 0;
		os_memcpy(&wifi_config.ssid, ssid, 32);
		menuState = IDLE;
		DISPLAY_MENU();
		string_index = 0;
		display_now = true;

		//		system_os_post(USER_TASK_PRIO_0, 1, 0); // Display menu
	}
	if (recv == '\n')
		string_index--;
}
예제 #4
0
void receiveNext(char recvd)
{
	static int string_index = 0;
	switch (recvd)
	{
	case 's': //ssid
	case 'S': //ssid
		uart0SendStr("Enter SSID \n\r");
		menuState = SSID;
		string_index = 0; // start at the beginning of the string
		break;
	case 'p':
	case 'P':
		uart0SendStr("Enter Password \n\r");
		menuState = PWD;
		string_index = 0; // start at the beginning of the string
		break;
	case 'c':
	case 'C':
		if (ssid != "")
		{ // Only set up connection if firmware has connection Information
			wifi_config.bssid_set = 0;
			wifi_set_opmode(STATION_MODE);
			wifi_station_set_config(&wifi_config);
			uart0SendStr("Connecting... \n\r");
			wifi_station_connect();
		}
		menuState = IDLE;
		string_index = 0; // start at the beginning of the string
		break;
	case 'r':
	case 'R':
		menuState = IDLE;
		DISPLAY_MENU_W_ADC();
		//system_os_post(USER_TASK_PRIO_0, 1, 1); // Display menu and ADC Value
		break;
	case 't':
	case 'T': // simple test of gpio output with microsecond timing.
		menuState = IDLE;
		system_os_post(USER_TASK_PRIO_0, 2, 0); // toggle outputs
		break;
	case 'b':
	case 'B':
		menuState = IDLE;
		DISPLAY_MENU();
		gpio16_state = !gpio16_state;
		// Enable Voltage Boost circuit
		gpio16OutputSet(gpio16_state); // Enable voltage boost circuit
		break;
	case '0':
//		writeRam("Hello World", 11);
//		break;
	case '1':
	case '2':
	case '3':
	case '4':
	case '5':
	case '6':
	case '7':
	case '8':
	case '9':
		setSigmaDeltaDuty(((uint8) recvd - 0x30) * 256 / 10);
		sdDuty =((uint8) recvd - 0x30) * 256 / 10;
		menuState = IDLE;
		DISPLAY_MENU_W_SIGMA_DELTA();
		break;
	case '[':
		sdDuty--;
		setSigmaDeltaDuty(sdDuty);
//			set_sigma_delta_prescaler((unsigned char)(get_sigma_delta_prescaler()+1));
		menuState = IDLE;
		DISPLAY_MENU_W_SIGMA_DELTA();
		break;
	case ']':
		sdDuty++;
		setSigmaDeltaDuty(sdDuty);
		menuState = IDLE;
		DISPLAY_MENU_W_SIGMA_DELTA();
		break;
	case '+':
		prescaler++;
		setSigmaDeltaPrescaler(prescaler);
//			set_sigma_delta_prescaler((unsigned char)(get_sigma_delta_prescaler()+1));
		menuState = IDLE;
		DISPLAY_MENU_W_SIGMA_DELTA();
		break;
	case '-':
		prescaler--;
		setSigmaDeltaPrescaler(prescaler);
		menuState = IDLE;
		DISPLAY_MENU_W_SIGMA_DELTA();
		break;
	case '<': // select Vt
		ADC_SELECT_TARGET();
		//Select Vpp for ADC
		menuState = IDLE;
//		DISPLAY_MENU_W_ADC();
		DISPLAY_MENU();
		break;
	case '>': //Select Vpp
		ADC_SELECT_VPP();
		//Select Vt for ADC
		menuState = IDLE;
//		DISPLAY_MENU_W_ADC();
		DISPLAY_MENU();
		break;
	case 'M': //Increase Vpp Target Voltage
	case 'm':
		set_target_voltage(get_target_voltage()+1);
		menuState = IDLE;
		break;
	case 'N': //Decrease Vpp Target Voltage
	case 'n':
		set_target_voltage(get_target_voltage()-1);
		menuState = IDLE;
		break;
	default:
		DISPLAY_MENU();
		break;
	}
}