controlsettings::controlsettings( QWidget *parent) : QWidget(parent) { ui.setupUi(this); connect(ui.keyconfigButton, SIGNAL(clicked()), this, SLOT(keyConfig())); }
SSPEC_RESOURCETABLE_END /* * These constants define keypad actions */ #define DELETE '1' #define READ '2' #define EMAIL_UP '3' #define EMAIL_DOWN '4' #define SCROLL_UP '5' #define SCROLL_DOWN '6' #define IGNORE '7' void initsystem() { auto int status; brdInit(); //initialize board for this demo dispInit(); glXFontInit(&fi6x8, 6, 8, 32, 127, Font6x8); status = TextWindowFrame(&wholewindow, &fi6x8,0, 0, LCD_XS, LCD_YS); keyConfig ( 0, EMAIL_DOWN, 0, 0, 0, 0, 0); keyConfig ( 1, SCROLL_UP, 0, 0, 0, 0, 0); keyConfig ( 2, SCROLL_DOWN, 0, 0, 0, 0, 0); keyConfig ( 3, EMAIL_UP, 0, 0, 0, 0, 0); keyConfig ( 4, READ, 0, 0, 0, 0, 0); keyConfig ( 5, DELETE, 0, 0, 0, 0, 0); keyConfig ( 6, IGNORE, 0, 0, 0, 0, 0); }
controlsettings::controlsettings(int screensettings, QWidget *parent) : QWidget(parent) { ui.setupUi(this); ui.screensettings->setCurrentIndex( screensettings); connect(ui.keyconfigButton, SIGNAL(clicked()), this, SLOT(keyConfig())); connect(ui.screensettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setScreenSettings(int))); }
void initsystem() { auto int status; brdInit(); //initialize board for this demo dispInit(); glXFontInit(&fi6x8, 6, 8, 32, 127, Font6x8); status = TextWindowFrame(&wholewindow, &fi6x8,0, 0, LCD_XS, LCD_YS); keyConfig ( 0, EMAIL_DOWN, 0, 0, 0, 0, 0); keyConfig ( 1, SCROLL_UP, 0, 0, 0, 0, 0); keyConfig ( 2, SCROLL_DOWN, 0, 0, 0, 0, 0); keyConfig ( 3, EMAIL_UP, 0, 0, 0, 0, 0); keyConfig ( 4, READ, 0, 0, 0, 0, 0); keyConfig ( 5, DELETE, 0, 0, 0, 0, 0); keyConfig ( 6, IGNORE, 0, 0, 0, 0, 0); }
void initLcdKeypad() { // Start-up the keypad driver and // Initialize the graphic driver dispInit(); // Use default key values along with a key release code keyConfig ( 0,'1', 0, 0, 0, 0, 0 ); keyConfig ( 1,'2', 0, 0, 0, 0, 0 ); keyConfig ( 2,'3', 0, 0, 0, 0, 0 ); keyConfig ( 3,'4', 0, 0, 0, 0, 0 ); keyConfig ( 4,'-', 0, 0, 0, 0, 0 ); keyConfig ( 5,'+', 0, 0, 0, 0, 0 ); keyConfig ( 6,'0', 0, 0, 0, 0, 0 ); // Initialize 6x8 font glXFontInit(&fi6x8, 6, 8, 32, 127, Font6x8); // Initialize 6x8 font TextWindowFrame(&wholewindow, &fi6x8, 0, 0, LCD_XS, LCD_YS); glBlankScreen(); TextGotoXY(&wholewindow, 0, 0); TextPrintf(&wholewindow, "Password"); }
void initsystem() { auto int status; brdInit(); glInit(); glBlankScreen(); glBackLight(1); keyInit(); keyConfig ( 0,'0',0, 1, 1, 1, 1 ); keyConfig ( 1,'1',0, 1, 1, 1, 1 ); keyConfig ( 2,'2',0, 1, 1, 1, 1 ); keyConfig ( 3,'3',0, 1, 1, 1, 1 ); keyConfig ( 4,'4',0, 1, 1, 1, 1 ); keyConfig ( 5,'5',0, 1, 1, 1, 1 ); keyConfig ( 6,'6',0, 1, 1, 1, 1 ); glXFontInit(&fi6x8, 6, 8, 32, 127, Font6x8); glBlankScreen(); glBackLight(1); TextWindowFrame(&wholewindow, &fi6x8, 0, 0, 122, 32); }
EmuSettings::EmuSettings(QWidget *parent) : QMainWindow(parent) { loadSettings(); ui.setupUi(this); showFullScreen(); saveSlotIndexChanged(gpspsettings.iLastSlot); //int audioOn, int samplerte, int stereoOn, int volume, bool enablespeedhack, QWidget *parent //TODO: read settings audiosettings = new AudioSettings(gpspsettings.iAudioOn, gpspsettings.iVolume, this ); audiosettings->setGeometry(QRect(0, 0, 640, 150)); audiosettings->hide(); antvideosettings =new videosettings( gpspsettings.iFrameSkip, gpspsettings.iShowFPS, gpspsettings.ikeepAspectRatio, this ); antvideosettings->setGeometry(QRect(0, 0, 640, 150)); antvideosettings->hide(); fileview = new filewidget( gpspsettings.iLastROM, gpspsettings.iBios, this ); fileview->setGeometry(QRect(0, 0, 640, 150)); fileview->hide(); keysettings =new controlsettings( gpspsettings.iScreenSettings, this ); keysettings->setGeometry(QRect(0, 0, 640, 150)); keysettings->hide(); currentWidget = EMainWidget; ui.saveSlotBox->setCurrentIndex(gpspsettings.iLastSlot); //connect buttons connect(ui.fileButton, SIGNAL(clicked()), this, SLOT(showFileMenu())); connect(ui.audioButton, SIGNAL(clicked()), this, SLOT(showAudioSettings())); connect(ui.videoButton, SIGNAL(clicked()), this, SLOT(showVideoSettings())); connect(ui.controlsButton, SIGNAL(clicked()), this, SLOT(showControlSettings())); connect(ui.exitButton, SIGNAL(clicked()), this, SLOT(exit())); connect(ui.loadStateButton, SIGNAL(clicked()), this, SLOT(loadStateButtonClicked())); connect(ui.saveStateButton, SIGNAL(clicked()), this, SLOT(saveStateButtonClicked())); connect(ui.resetButton, SIGNAL(clicked()), this, SLOT(resetButtonClicked())); connect(ui.ContinueButton, SIGNAL(clicked()), this, SLOT(continueClicked())); connect(ui.aboutButton, SIGNAL(clicked()), this, SLOT(aboutClicked())); connect(ui.saveSlotBox, SIGNAL(currentIndexChanged(int)), this, SLOT(saveSlotIndexChanged(int))); //connect audio settins connect( audiosettings, SIGNAL(AudioOn(int)), this, SLOT( setAudioOn(int))); connect( audiosettings, SIGNAL(Volume(int)), this, SLOT( setVolume(int))); //connect video settings connect( antvideosettings, SIGNAL(frameskip(int)), this, SLOT( frameskip(int) )); connect( antvideosettings, SIGNAL(showFPS(bool)), this, SLOT( showFPS(bool) )); connect( antvideosettings, SIGNAL(setAspectRatio(bool)), this, SLOT( setAspectRatio(bool) )); //connect filewidget connect( fileview, SIGNAL(loadROM()), this, SLOT( loadROM())); connect( fileview, SIGNAL(setBios()), this, SLOT( setBios())); //connect control settings connect( keysettings, SIGNAL(runkeyconfig()), this, SLOT( keyConfig() )); connect( keysettings, SIGNAL(screensettings(int)), this, SLOT( screensettings(int) )); romloaded = false; settingsChanged = false; errorDialog = NULL; }
void main(void) { tcp_Socket tcpSock; char *messages[12]; unsigned int key; int i, send_response, test; // Initialize flag to indicate not ready to send response send_response = FALSE; // Initialize the message array with NULL pointers for (i = 0; i < (sizeof(messages)/sizeof(char*)); i++) { messages[i] = NULL; } // Define messages here--note that you only need define the messages // you will actually use. messages[0] = "I hear ya..."; messages[1] = "Hello, there..."; messages[2] = "It's a \"Rabbit\" Kind of place..."; initsystem(); sock_init(); // Configure the upper row of keys on the keypad, in order // from left to right. for (i = 0; i < 7; i++) { // Only enable a key if there is a corresponding message if (messages[i] != NULL) { keyConfig ( i, ('0'+ i), 0, 0, 0, 0, 0 ); } else { keyConfig ( i, IGNORE, 0, 0, 0, 0, 0 ); } } while (1) { // Process Keypad Press/Hold/Release costate { keyProcess (); waitfor ( DelayMs(10) ); } costate { // Wait for a message from another device if (send_response == FALSE) { glBlankScreen(); TextGotoXY(&wholewindow, 0, 0 ); TextPrintf(&wholewindow, "Waiting for a \nmessage to be sent!"); // Function is blocking until a message is received RecvMessage(&tcpSock); // Received message, prompt user to continue TextGotoXY(&wholewindow, 0, 3 ); TextPrintf(&wholewindow, "Press key to proceed"); // Allow the keyProcess function(above costate) to execute before // checking for keypress. waitfor(DelayMs(10)); // Check if a key has been pressed waitfor ( key = keyGet() ); // Wait for Keypress // Set flag to send respond back to controller that // sent the message. send_response = TRUE; } } costate { if(send_response) { glBlankScreen(); TextGotoXY(&wholewindow, 0, 0 ); TextPrintf(&wholewindow, "Press the key that \nis setup to send \nyour response..."); waitfor ( key = keyGet() ); // Wait for Keypress // Flash Leds to indicate that a key has been pressed flashled(key - '0'); // Only handle the keypress if it corresponds to a message and if // a response is currently needed if (key != IGNORE) { SendMessage(&tcpSock, (key - '0'), messages); send_response = FALSE; } } } } }
void main(void) { char* messages[12]; int i; unsigned key; // User keypress tcp_Socket tcpSock; int respond; respond = 0; // Initialize the message array for (i = 0; i < 12; i++) { messages[i] = ""; } // Define messages here--note that you only need define the messages // you will actually use. messages[0] = "I hear ya"; messages[1] = "Hello, there"; messages[2] = "I'm here"; messages[3] = "This Rabbit is fast!"; messages[6] = "That's right, Charlie!"; messages[7] = "Daisy, Daisy, Give me your answer, do."; brdInit(); sock_init(); // Configure the upper row of keys on the keypad, in order from left // to right for (i = 0; i < 6; i++) { // Only enable a key if there is a corresponding message if (strcmp(messages[i], "") != 0) { keyConfig ( 5-i, i+1, 0, 0, 0, 0, 0 ); } else { keyConfig ( 5-i, IGNORE, 0, 0, 0, 0, 0 ); } } // Configure the lower row of keys on the keypad, in order from left // to right for (i = 6; i < 12; i++) { // Only enable a key if there is a corresponding message if (strcmp(messages[i], "") != 0) { keyConfig ( 19-i, i+1, 0, 0, 0, 0, 0 ); } else { keyConfig ( 19-i, IGNORE, 0, 0, 0, 0, 0 ); } } while (1) { costate { // Process Keypad Press/Hold/Release keyProcess (); waitfor ( DelayMs(10) ); } costate { // Process Keypad Press/Hold/Release waitfor ( key = keyGet() ); // Wait for Keypress // Only handle the keypress if it corresponds to a message and if // a response is currently needed if ((key != IGNORE) && (respond == 1)) { SendMessage(&tcpSock, key, messages); respond = 0; } } // Receive a message. RecvMessage() will block until something comes in. if (respond == 0) { RecvMessage(&tcpSock, &respond); } } }
//------------------------------------------------------------------------ // Set Date and Time //------------------------------------------------------------------------ void SetDateTime( void ) { int wKey; int col, row; char buffer[256]; fieldupdate dateTime; // Setup for FAST key repeat after holding down key for 12 ticks keyConfig ( 6,'E',0, 12, 1, 1, 1 ); keyConfig ( 2,'D',0, 12, 1, 1, 1 ); keyConfig ( 5,'+',0, 12, 1, 1, 1 ); keyConfig ( 1,'U',0, 12, 1, 1, 1 ); keyConfig ( 4,'-',0, 12, 1, 1, 1 ); date_prompt("Select \n4 digit year: ", &col, &row); dateTime.data = 2001; while(1) { sprintf(buffer, "%04d", dateTime.data); TextGotoXY(&textWindow, col, row); TextPrintf(&textWindow, "%s", buffer); while((wKey = ProcessKeyField(NUMBER, &dateTime)) == 0); if(dateTime.data < 1900 || dateTime.data > 2047) { dateTime.data = 2001; } if(wKey == 'E') { if( dateTime.data >= 1900 && dateTime.data < 2048) { CurTime.tm_year = dateTime.data - 1900; // offset from 1900 break; } } } date_prompt("Enter month: ", &col, &row); dateTime.data = 1; while(1) { sprintf(buffer, "%02d", dateTime.data); TextGotoXY(&textWindow, col, row); TextPrintf(&textWindow, "%s", buffer); while((wKey = ProcessKeyField(NUMBER, &dateTime)) == 0); if(wKey == 'E') { if( dateTime.data >= 1 && dateTime.data < 13 ) { CurTime.tm_mon = month2tm_mon(dateTime.data); break; } } if(dateTime.data < 1 || dateTime.data > 12) { dateTime.data = (dateTime.data < 1) ? 12 : 1; } } date_prompt("Enter \nday of month: ", &col, &row); dateTime.data = 1; while(1) { sprintf(buffer, "%02d", dateTime.data); TextGotoXY(&textWindow, col, row); TextPrintf(&textWindow, "%s", buffer); while((wKey = ProcessKeyField(NUMBER, &dateTime))== 0); if(wKey == 'E') { if( dateTime.data >= 1 && dateTime.data < 32) { CurTime.tm_mday = dateTime.data; break; } } if(dateTime.data < 1 || dateTime.data > 31) { dateTime.data = (dateTime.data < 1) ? 31 : 1; } } date_prompt("Enter \nhour (24hr): ", &col, &row); dateTime.data = 0; while(1) { sprintf(buffer, "%02d", dateTime.data); TextGotoXY(&textWindow, col, row); TextPrintf(&textWindow, "%s", buffer); while((wKey = ProcessKeyField(NUMBER, &dateTime)) == 0); if(wKey == 'E') { if(dateTime.data >= 0 && dateTime.data < 24) { CurTime.tm_hour = dateTime.data; break; } } if(dateTime.data < 0 || dateTime.data > 23) { dateTime.data = (dateTime.data < 0) ? 23 : 0; } } date_prompt("Enter minute: ", &col, &row); dateTime.data = 0; while(1) { sprintf(buffer, "%02d", dateTime.data); TextGotoXY(&textWindow, col, row); TextPrintf(&textWindow, "%s", buffer); while((wKey = ProcessKeyField(NUMBER, &dateTime)) == 0); if(wKey == 'E') { if( dateTime.data >= 0 && dateTime.data < 60) { CurTime.tm_min = dateTime.data; break; } if(wKey == 'E') { break; } } if(dateTime.data < 0 || dateTime.data > 59) { dateTime.data = (dateTime.data < 0) ? 59 : 0; } } CurTime.tm_sec = 0; ulTime = mktime ( &CurTime ); // get seconds from 1/1/1980 write_rtc ( ulTime ); // set the real time clock keypadDef(); glBlankScreen(); while(1) { // Get current Date/Time FormatDateTime(); // convert to text // Display Date and Time glBuffLock(); TextGotoXY(&textWindow, 0, 0); TextPrintf(&textWindow, "%s\n", szTime); // Display user exit message TextGotoXY(&textWindow, 0, 3); TextPrintf(&textWindow, "Press Key to EXIT "); glBuffUnlock(); keyProcess (); if((wKey = keyGet()) != 0) { glBlankScreen(); break; } } }
//*************************************************************************** // Message Menu used to create ASCII strings from the keypad //*************************************************************************** void enter_chars(char *p) { int i, column, len, disp_col, disp_row; int wKey; char *orig_ptr; // Initialize function parameters orig_ptr = p; i = 0; column = 0; len = 0; // Display the initial charater set for the user to choose from glBlankScreen(); TextGotoXY(&textWindow1, 0, 1); TextPrintf(&textWindow1, "-"); TextGotoXY(&textWindow1, 0, 0); TextPrintf(&textWindow1, "%s", s[i]); // Display user instructions display_help(); // Setup for FAST key repeat after holding down key for 12 ticks keyConfig ( 6,'E',0, 12, 1, 1, 1 ); keyConfig ( 2,'D',0, 12, 1, 1, 1 ); keyConfig ( 5,'+',0, 12, 1, 1, 1 ); keyConfig ( 1,'U',0, 12, 1, 1, 1 ); keyConfig ( 4,'-',0, 12, 1, 1, 1 ); keyConfig ( 0,'L',0, 12, 1, 1, 1 ); keyConfig ( 3,'R',0, 12, 1, 1, 1 ); // Clear only the bottom half of the display glSetBrushType(PIXWHITE); glBlock(0,16,122,16); glSetBrushType(PIXBLACK); // Set window2 to start at column 0 TextGotoXY(&textWindow2, 0, 0); TextPrintf(&textWindow2, "_"); TextGotoXY(&textWindow2, 0, 0); do { // Wait for a key to be pressed do { keyProcess(); msDelay(50); wKey = keyGet(); } while(wKey == 0); switch(wKey) { // Scroll-Down to select new character group case 'D': i = i < (sizeof(s)/2)-1 ? ++i : 0; clrline(1, len); TextGotoXY(&textWindow1, 0, 1); TextPrintf(&textWindow1, "-"); column = 0; clrline(0, strlen(*s)); TextGotoXY(&textWindow1, 0, 0); TextPrintf(&textWindow1, "%s", s[i]); break; // Scroll-Up to select new character group case 'U': i = i > 0 ? --i : 0; clrline(1, len); TextGotoXY(&textWindow1, 0, 1); TextPrintf(&textWindow1, "-"); column = 0; clrline(0, strlen(*s)); TextGotoXY(&textWindow1, 0, 0); TextPrintf(&textWindow1, "%s", s[i]); break; // Scroll-Right for character set case 'R': column = column < strlen(*(&s[i]))-1 ? ++column : 0; clrline(1, len = strlen(*(&s[i]))); TextGotoXY(&textWindow1, column, 1); TextPrintf(&textWindow1, "-"); break; // Scroll-Left for character set case 'L': column = column > 0 ? --column : 0; clrline(1, len = strlen(*(&s[i]))); TextGotoXY(&textWindow1, column, 1); TextPrintf(&textWindow1, "-"); break; // Add the selected character to the message case '+': // select char *p = s[i][column]; if(*p == '_' && column == strlen(*(&s[i]))-1 ) { // Change to a space *p = ' '; } TextCursorLocation(&textWindow2, &disp_col, &disp_row); TextPrintf(&textWindow2, "%c", *p++); TextPrintf(&textWindow2, "_"); TextGotoXY(&textWindow2, disp_col+1, 0); break; // Do a Backspace in the message case '-': TextGotoXY(&textWindow2, disp_col, disp_row); TextPrintf(&textWindow2, " "); TextGotoXY(&textWindow2, disp_col, disp_row); TextPrintf(&textWindow2, "_ "); if(disp_col > 0) { p--; } TextGotoXY(&textWindow2, disp_col--, disp_row); if(disp_col < 0) { disp_col = 0; p = orig_ptr; } break; } }while(wKey != 'E'); // NULL the terminate the user message *p = '\0'; // Set the keypad back to the default driver configuration keypadDef(); }
main() { static int led, channel, wKey, keypad_active, prompt_displayed; static int new_keypress_message, release_value, i; //------------------------------------------------------------------------ // Initialize the controller //------------------------------------------------------------------------ brdInit(); // Initialize the controller for this demo // Start-up the keypad driver and // Initialize the graphic driver dispInit(); // Use default key values along with a key release code keyConfig ( 3,'R', '1', 0, 0, 0, 0 ); keyConfig ( 6,'E', '2', 0, 0, 0, 0 ); keyConfig ( 2,'D', '3', 0, 0, 0, 0 ); keyConfig ( 5,'+', '4', 0, 0, 0, 0 ); keyConfig ( 1,'U', '5', 0, 0, 0, 0 ); keyConfig ( 4,'-', '6', 0, 0, 0, 0 ); keyConfig ( 0,'L', '7', 0, 0, 0, 0 ); // Initialize 6x8 font glXFontInit(&fi6x8, 6, 8, 32, 127, Font6x8); // Initialize 6x8 font glXFontInit(&fi8x10, 8, 10, 32, 127, Font8x10); // initialize 8x10 font glBlankScreen(); // Initialize control flags keypad_active = FALSE; prompt_displayed = FALSE; new_keypress_message = FALSE; for(;;) { costate { keyProcess (); waitfor ( DelayMs(10) ); } costate { // Wait for any key to be pressed waitfor((wKey = keyGet()) != 0); release_value = -1; switch(wKey) { case 'L': release_value = '7'; break; case '-': release_value = '6'; break; case 'U': release_value = '5'; break; case '+': release_value = '4'; break; case 'D': release_value = '3'; break; case 'E': release_value = '2'; break; case 'R': release_value = '1'; break; } if(release_value != -1) { keypad_active = TRUE; // Wait for the key to be released waitfor(keyGet() == release_value); keypad_active = FALSE; } } costate { if(!keypad_active) { if(!prompt_displayed) { glBlankScreen(); glPrintf (0, 0, &fi6x8, "Waiting for a Key to"); glPrintf (0, 8, &fi6x8, "be pressed on the "); glPrintf (0, 16, &fi6x8, "LCD Keypad...."); glFillPolygon(4, 115, 26, 121,26, 121,31, 115, 31); prompt_displayed = TRUE; new_keypress_message = FALSE; // Turn-Off leds on the Demo board pbLedOut(DS1, OFF); //DS1 off pbLedOut(DS2, OFF); //DS2 off } for(channel = 0; channel <= 6; channel++) { for(led = 0; led <=6; led++) { if(led != channel) dispLedOut(led, 0); } dispLedOut(channel, 1); waitfor(DelayMs(100)); if(keypad_active) { break; } } } } costate { if(keypad_active && !new_keypress_message) { glBlankScreen(); glFillPolygon(4, 113, 26, 121,26, 121,31, 113, 31); switch(wKey) { case 'L': glPrintf (0, 0, &fi8x10, "Scroll-Left key"); glPrintf (0, 16, &fi8x10, "is Active."); dispLedOut(0, 1); channel = 0; break; case '-': glPrintf (0, 0, &fi8x10, "Page-Down key"); glPrintf (0, 16, &fi8x10, "is Active."); dispLedOut(1, 1); channel = 1; pbLedOut(DS1, ON); //DS1 on break; case 'U': glPrintf (0, 0, &fi8x10, "Scroll-Up key"); glPrintf (0, 16, &fi8x10, "is Active."); dispLedOut(2, 1); channel = 2; break; case '+': glPrintf (0, 0, &fi8x10, "Page-Up key"); glPrintf (0, 16, &fi8x10, "is Active."); dispLedOut(3, 1); channel = 3; pbLedOut(DS2, ON); //DS2 on break; case 'D': glPrintf (0, 0, &fi8x10, "Scroll-Down key"); glPrintf (0, 16, &fi8x10, "is Active."); dispLedOut(4, 1); channel = 4; break; case 'E': glPrintf (0, 0, &fi8x10, "Enter key"); glPrintf (0, 16, &fi8x10, "is Active."); dispLedOut(5, 1); channel = 5; break; case 'R': glPrintf (0, 0, &fi8x10, "Scroll-Right"); glPrintf (0, 16, &fi8x10, "key is Active."); dispLedOut(6, 1); channel = 6; break; } for(led=0; led <=6; led++) { if(led != channel) { dispLedOut(led, 0); } } prompt_displayed = FALSE; new_keypress_message = TRUE; } } costate { if(keypad_active) { for(i=0; i<(LCD_XS-8); i+=4) { glHScroll(0, 26, LCD_XS, 6, -4); waitfor(DelayMs(5)); if(!keypad_active) abort; } for(i=0; i<(LCD_XS-8); i+=4) { glHScroll(0, 26, LCD_XS, 6, 4); waitfor(DelayMs(5)); if(!keypad_active) abort; } } } } }