void lcdMenu() { lcdInit(uart1); lcdClear(uart1); lcdSetBacklight(uart1, true); while (true) { if (!isEnabled()) lcdSetBacklight(uart1, false); lcdClear(uart1); lcdSetText(uart1, 1, "< Auton Select"); lcdSetText(uart1, 2, " Robot Status >"); button = getLcdButtons(); if (button == LCD_BTN_LEFT) { autonSelectMenu(); } else if (button == LCD_BTN_RIGHT) { robotStatusMenu(); } taskDelay(10); } }
void initLCDLList() { //char *strg; lcdInit(uart1); lcdClear(uart1); lcdSetBacklight(uart1, true); LCDTask = taskCreate(LCDRun, TASK_DEFAULT_STACK_SIZE,NULL,TASK_PRIORITY_DEFAULT); // strg = strcenter("test", 16); //printf("|%s| ",strg/*,strcenter("Test", 16)*/); }
void robotStatusMenu() { int screen = 0; int maxScreen = 6; int minScreen = 0; lcdSetBacklight(uart1, true); while (button != LCD_BTN_CENTER) { switch (screen) { case 0: lcdSetText(uart1, 1, " Main Battery"); lcdPrint(uart1, 2, "%d mV", powerLevelMain()); break; case 1: lcdSetText(uart1, 1, " Backup Battery"); lcdPrint(uart1, 2, "%d mV", powerLevelBackup()); break; case 2: lcdSetText(uart1, 1, " Joystick"); lcdSetText(uart1, 2, isJoystickConnected(1) ? " Connected" : " Not Connected"); break; case 3: lcdSetText(uart1, 1, "Field Controller"); lcdSetText(uart1, 2, isOnline() ? " Connected" : " Not Connected"); break; case 4: lcdSetText(uart1, 1, " IMEs Connected"); lcdSetText(uart1, 2, "xxxxxxxxxxxxxxxx"); break; case 5: lcdPrint(uart1, 1, "Left Pot %d", analogRead(potLiftLeft)); lcdPrint(uart1, 2, "Left Mtr %d", motorGet(liftLeft)); break; case 6: lcdPrint(uart1, 1, "Right Pot %d", analogRead(potLiftRight)); lcdPrint(uart1, 2, "Right Mtr %d", motorGet(liftRight)); break; } button = getLcdButtons(); if (button == LCD_BTN_RIGHT) { if (++screen > maxScreen) screen = minScreen; } else if (button == LCD_BTN_LEFT) { if (--screen < minScreen) screen = maxScreen; } taskDelay(10); } }
void initialize() { //initialize base encoders yellowDriveEncoder = encoderInit(8, 9, true); greenDriveEncoder = encoderInit(6, 7, false); //initialize flywheel encoders yellowFlywheelEncoder = encoderInit(3, 4, false); greenFlywheelEncoder = encoderInit(11, 12, false); tbhStarted = 0; //initialize lcd screen lcdInit(uart1 ); lcdClear(uart1 ); lcdSetBacklight(uart1, true); //run autonomous selection menu when we are done initializing lcdAutoSelection(); }
void initLcdPresets() { currentPage = 0; leftPressed = false; centerPressed = false; rightPressed = false; currentMotorNum = 1; currentMotorSpeed = 0; currentGroupNum = 0; currentGroupIndex = 0; currentGroupSpeed = 0; groups[0] = (Group){ "Base", 4, {2, 3, 8, 9, 0} }; groups[1] = (Group){ "In", 2, {1, 10, 0, 0, 0} }; groups[2] = (Group){ "Shoot", 2, {5, 6, 0, 0, 0} }; groups[3] = (Group){ "rotor", 2, {2, 9, 0, 0, 0} }; lcdSetBacklight(uart1, true); }
void autonSelectMenu() { lcdSetBacklight(uart1, true); while (button != LCD_BTN_CENTER) { lcdClear(uart1); lcdSetText(uart1, 1, "Alliance Color?"); lcdSetText(uart1, 2, "< Red Blue >"); button = getLcdButtons(); if (button == LCD_BTN_LEFT) { lcdClear(uart1); lcdSetText(uart1, 1, "Starting Side?"); lcdSetText(uart1, 2, "< Middle Hang >"); while (button != LCD_BTN_LEFT || button != LCD_BTN_RIGHT) { button = getLcdButtons(); // Red Middle if (button == LCD_BTN_LEFT) { int screen = 0; int minScreen = 0; int maxScreen = 4; lcdClear(uart1); while (button != LCD_BTN_CENTER) { switch (screen) { case 0: lcdSetText(uart1, 1, "auton one"); break; case 1: lcdSetText(uart1, 1, "auton two"); break; case 2: lcdSetText(uart1, 1, "auton three"); break; case 3: lcdSetText(uart1, 1, "auton four"); break; } button = getLcdButtons(); if (button == LCD_BTN_RIGHT) { if (++screen > maxScreen) screen = minScreen; } else if (button == LCD_BTN_LEFT) { if (--screen < minScreen) screen = maxScreen; } } autonSelection = screen; lcdSetText(uart1, 1, " AUTONOMOUS"); lcdSetText(uart1, 2, " SET"); taskDelay(400); return; } // Red Hang if (button == LCD_BTN_RIGHT) { int screen = 0; int minScreen = 0; int maxScreen = 4; lcdClear(uart1); while (button != LCD_BTN_CENTER) { switch (screen) { case 0: lcdSetText(uart1, 1, "auton one"); break; case 1: lcdSetText(uart1, 1, "auton two"); break; case 2: lcdSetText(uart1, 1, "auton three"); break; case 3: lcdSetText(uart1, 1, "auton four"); break; } button = getLcdButtons(); if (button == LCD_BTN_RIGHT) { if (++screen > maxScreen) screen = minScreen; } else if (button == LCD_BTN_LEFT) { if (--screen < minScreen) screen = maxScreen; } } autonSelection = screen; lcdSetText(uart1, 1, " AUTONOMOUS"); lcdSetText(uart1, 2, " SET"); taskDelay(400); return; } } } if (button == LCD_BTN_RIGHT) { lcdClear(uart1); lcdSetText(uart1, 1, "Starting Side?"); lcdSetText(uart1, 2, "< Middle Hang >"); while (button != LCD_BTN_LEFT || button != LCD_BTN_RIGHT) { button = getLcdButtons(); // Blue Middle if (button == LCD_BTN_LEFT) { int screen = 0; int minScreen = 0; int maxScreen = 4; lcdClear(uart1); while (button != LCD_BTN_CENTER) { switch (screen) { case 0: lcdSetText(uart1, 1, "auton one"); break; case 1: lcdSetText(uart1, 1, "auton two"); break; case 2: lcdSetText(uart1, 1, "auton three"); break; case 3: lcdSetText(uart1, 1, "auton four"); break; } button = getLcdButtons(); if (button == LCD_BTN_RIGHT) { if (++screen > maxScreen) screen = minScreen; } else if (button == LCD_BTN_LEFT) { if (--screen < minScreen) screen = maxScreen; } } autonSelection = screen; lcdSetText(uart1, 1, " AUTONOMOUS"); lcdSetText(uart1, 2, " SET"); taskDelay(400); return; } // Blue Hang if (button == LCD_BTN_RIGHT) { int screen = 0; int minScreen = 0; int maxScreen = 4; lcdClear(uart1); while (button != LCD_BTN_CENTER) { switch (screen) { case 0: lcdSetText(uart1, 1, "auton one"); break; case 1: lcdSetText(uart1, 1, "auton two"); break; case 2: lcdSetText(uart1, 1, "auton three"); break; case 3: lcdSetText(uart1, 1, "auton four"); break; } button = getLcdButtons(); if (button == LCD_BTN_RIGHT) { if (++screen > maxScreen) screen = minScreen; } else if (button == LCD_BTN_LEFT) { if (--screen < minScreen) screen = maxScreen; } } autonSelection = screen; lcdSetText(uart1, 1, " AUTONOMOUS"); lcdSetText(uart1, 2, " SET"); taskDelay(400); return; } } } } }
void lcdInitiate(){// must be done in opcontrol, before while loop lcdInit(uart1); lcdClear(uart1); lcdSetBacklight(uart1, true); }
void operatorControl() { lcdInit(uart1); lcdClear(uart1); lcdSetBacklight(uart1, true); liftTaskCreate(); bool hookButtonPressed = false; int imeLeft; int imeRight; while (true) { imeGet(0, &imeLeft); imeGet(1, &imeRight); lcdPrint(uart1, 1, "IME Left %d", imeLeft); lcdPrint(uart1, 2, "IME Right %d", imeRight); // toggle hook bool hookButtonPressedNow = joystickGetDigital(1, 7, JOY_UP); if (hookButtonPressedNow && hookButtonPressedNow != hookButtonPressed) { if (isHookDeployed()) { retractHook(); } else { deployHook(); } } hookButtonPressed = hookButtonPressedNow; if (joystickGetDigital(1, 8, JOY_UP)) { hang(); } if (joystickGetDigital(1, 8, JOY_DOWN)) { unhang(); } // Drive int leftY = ramp(joystickGetAnalog(1, 3)); int rightY = ramp(joystickGetAnalog(1, 2)); motorSet(driveFrontRight, -rightY); motorSet(driveMiddleRight, -rightY); motorSet(driveBackRight, -rightY); motorSet(driveFrontLeft, leftY); motorSet(driveMiddleLeft, leftY); motorSet(driveBackLeft, leftY); // Lift int liftUp = joystickGetDigital(1, 6, JOY_UP); int liftDown = joystickGetDigital(1, 6, JOY_DOWN); if (liftUp && liftDown) { //motorSet(liftLeft, 40); //motorSet(liftRight, -40); } else if (liftUp) { liftManual(LIFT_SPEED); //motorSet(liftLeft, 127); //motorSet(liftRight, -127); } else if (liftDown) { liftManual(-LIFT_SPEED); //motorSet(liftLeft, -127); //motorSet(liftRight, 127); } else { //motorSet(liftLeft, 0); //motorSet(liftRight, 0); } // Manipulator int manipulatorIn = joystickGetDigital(1, 5, JOY_DOWN); int manipulatorOut = joystickGetDigital(1, 5, JOY_UP); if (manipulatorIn) { motorSet(intakeLeft, -127); motorSet(intakeRight, 127); } else if (manipulatorOut) { motorSet(intakeLeft, 60); motorSet(intakeRight, -60); } else { motorSet(intakeLeft, 0); motorSet(intakeRight, 0); } delay(50); } }
/** * Runs the user operator control code. * * This function will be started in its own task with the default priority and stack size whenever the robot is enabled via the Field Management System or the VEX Competition Switch in the operator control mode. If the robot is disabled or communications is lost, the operator control task will be stopped by the kernel. Re-enabling the robot will restart the task, not resume it from where it left off. * * If no VEX Competition Switch or Field Management system is plugged in, the VEX Cortex will run the operator control task. Be warned that this will also occur if the VEX Cortex is tethered directly to a computer via the USB A to A cable without any VEX Joystick attached. * * Code running in this task can take almost any action, as the VEX Joystick is available and the scheduler is operational. However, proper use of delay() or taskDelayUntil() is highly recommended to give other tasks (including system tasks such as updating LCDs) time to run. * * This task should never exit; it should end with some kind of infinite loop, even if empty. */ void operatorControl() { int lastIncrement = 0; int lastDecrement = 0; int lastIntake1InButton = 0; int intake1RunningIn = 0; int lastIntake1OutButton = 0; int intake1RunningOut = 0; while (true) { tankDrive(robotDrive, OIGetDriveLeft(), OIGetDriveRight()); if(OIGetIntake1In() && !lastIntake1InButton) { intake1RunningIn = !intake1RunningIn; intake1RunningOut = 0; if(intake1RunningIn) { intake1In(robotIntake); } else { intake1Stop(robotIntake); } } else if(OIGetIntake1Out() && !lastIntake1OutButton) { intake1RunningIn = 0; intake1RunningOut = !intake1RunningOut; if(intake1RunningOut) { intake1Out(robotIntake); } else { intake1Stop(robotIntake); } } lastIntake1InButton = OIGetIntake1In(); lastIntake1OutButton = OIGetIntake1Out(); if(OIGetIntake2In()) { intake2In(robotIntake); } else if(OIGetIntake2Out()) { intake2Out(robotIntake); } else { intake2Stop(robotIntake); } if(OIShooterOn()) { turnShooterOn(&robotShooter); } else if(OIShooterOff()) { turnShooterOff(&robotShooter); } if(OIShooterUp() && !lastIncrement) { incrementShooterSP(&robotShooter, 100); } else if(OIShooterDown() && !lastDecrement) { incrementShooterSP(&robotShooter, -100); } lastIncrement = OIShooterUp(); lastDecrement = OIShooterDown(); updateShooter(&robotShooter); runShooter(&robotShooter); lcdPrint(uart1, 2, "SP: %d", robotShooter.SP); puts("6"); lcdPrint(uart1, 1, "PV: %d", robotShooter.processVariable); if(isShooterUpToSpeed(&robotShooter)) { lcdSetBacklight(uart1, true); } else { lcdSetBacklight(uart1, false); } delay(25); puts("hi"); } }
int_t main(void) { error_t error; NetInterface *interface; OsTask *task; MacAddr macAddr; #if (APP_USE_DHCP == DISABLED) Ipv4Addr ipv4Addr; #endif #if (APP_USE_SLAAC == DISABLED) Ipv6Addr ipv6Addr; #endif //System initialization systemInit(); //Initialize kernel osInitKernel(); //Configure I/Os ioInit(); //Configure debug UART debugInit(115200); //Start-up message TRACE_INFO("\r\n"); TRACE_INFO("**********************************\r\n"); TRACE_INFO("*** CycloneTCP Web Server Demo ***\r\n"); TRACE_INFO("**********************************\r\n"); TRACE_INFO("Copyright: 2010-2015 Oryx Embedded SARL\r\n"); TRACE_INFO("Compiled: %s %s\r\n", __DATE__, __TIME__); TRACE_INFO("Target: STR912\r\n"); TRACE_INFO("\r\n"); //Initialize LCD display lcdInit(); //Turn on backlight lcdSetBacklight(TRUE); //Set foreground and background colors lcdSetForegroundColor(WHITE); lcdSetBackgroundColor(BLUE); //Clear display lcdClear(); //Welcome message lcdSetCursor(0, 0); printf("Web Server Demo\r\n"); //TCP/IP stack initialization error = netInit(); //Any error to report? if(error) { //Debug message TRACE_ERROR("Failed to initialize TCP/IP stack!\r\n"); } //Configure the first Ethernet interface interface = &netInterface[0]; //Set interface name netSetInterfaceName(interface, "eth0"); //Set host name netSetHostname(interface, "WebServerDemo"); //Select the relevant network adapter netSetDriver(interface, &str912EthDriver); netSetPhyDriver(interface, &ksz8721PhyDriver); //Set external interrupt line driver netSetExtIntDriver(interface, &extIntDriver); //Set host MAC address macStringToAddr(APP_MAC_ADDR, &macAddr); netSetMacAddr(interface, &macAddr); //Initialize network interface error = netConfigInterface(interface); //Any error to report? if(error) { //Debug message TRACE_ERROR("Failed to configure interface %s!\r\n", interface->name); } #if (IPV4_SUPPORT == ENABLED) #if (APP_USE_DHCP == ENABLED) //Get default settings dhcpClientGetDefaultSettings(&dhcpClientSettings); //Set the network interface to be configured by DHCP dhcpClientSettings.interface = interface; //Disable rapid commit option dhcpClientSettings.rapidCommit = FALSE; //DHCP client initialization error = dhcpClientInit(&dhcpClientContext, &dhcpClientSettings); //Failed to initialize DHCP client? if(error) { //Debug message TRACE_ERROR("Failed to initialize DHCP client!\r\n"); } //Start DHCP client error = dhcpClientStart(&dhcpClientContext); //Failed to start DHCP client? if(error) { //Debug message TRACE_ERROR("Failed to start DHCP client!\r\n"); } #else //Set IPv4 host address ipv4StringToAddr(APP_IPV4_HOST_ADDR, &ipv4Addr); ipv4SetHostAddr(interface, ipv4Addr); //Set subnet mask ipv4StringToAddr(APP_IPV4_SUBNET_MASK, &ipv4Addr); ipv4SetSubnetMask(interface, ipv4Addr); //Set default gateway ipv4StringToAddr(APP_IPV4_DEFAULT_GATEWAY, &ipv4Addr); ipv4SetDefaultGateway(interface, ipv4Addr); //Set primary and secondary DNS servers ipv4StringToAddr(APP_IPV4_PRIMARY_DNS, &ipv4Addr); ipv4SetDnsServer(interface, 0, ipv4Addr); ipv4StringToAddr(APP_IPV4_SECONDARY_DNS, &ipv4Addr); ipv4SetDnsServer(interface, 1, ipv4Addr); #endif #endif #if (IPV6_SUPPORT == ENABLED) #if (APP_USE_SLAAC == ENABLED) //Get default settings slaacGetDefaultSettings(&slaacSettings); //Set the network interface to be configured slaacSettings.interface = interface; //SLAAC initialization error = slaacInit(&slaacContext, &slaacSettings); //Failed to initialize SLAAC? if(error) { //Debug message TRACE_ERROR("Failed to initialize SLAAC!\r\n"); } //Start IPv6 address autoconfiguration process error = slaacStart(&slaacContext); //Failed to start SLAAC process? if(error) { //Debug message TRACE_ERROR("Failed to start SLAAC!\r\n"); } #else //Set link-local address ipv6StringToAddr(APP_IPV6_LINK_LOCAL_ADDR, &ipv6Addr); ipv6SetLinkLocalAddr(interface, &ipv6Addr); //Set IPv6 prefix ipv6StringToAddr(APP_IPV6_PREFIX, &ipv6Addr); ipv6SetPrefix(interface, &ipv6Addr, APP_IPV6_PREFIX_LENGTH); //Set global address ipv6StringToAddr(APP_IPV6_GLOBAL_ADDR, &ipv6Addr); ipv6SetGlobalAddr(interface, &ipv6Addr); //Set router ipv6StringToAddr(APP_IPV6_ROUTER, &ipv6Addr); ipv6SetRouter(interface, &ipv6Addr); //Set primary and secondary DNS servers ipv6StringToAddr(APP_IPV6_PRIMARY_DNS, &ipv6Addr); ipv6SetDnsServer(interface, 0, &ipv6Addr); ipv6StringToAddr(APP_IPV6_SECONDARY_DNS, &ipv6Addr); ipv6SetDnsServer(interface, 1, &ipv6Addr); #endif #endif //Get default settings httpServerGetDefaultSettings(&httpServerSettings); //Bind HTTP server to the desired interface httpServerSettings.interface = &netInterface[0]; //Listen to port 80 httpServerSettings.port = HTTP_PORT; //Client connections httpServerSettings.maxConnections = APP_HTTP_MAX_CONNECTIONS; httpServerSettings.connections = httpConnections; //Specify the server's root directory strcpy(httpServerSettings.rootDirectory, "/www/"); //Set default home page strcpy(httpServerSettings.defaultDocument, "index.shtm"); //Callback functions httpServerSettings.cgiCallback = httpServerCgiCallback; httpServerSettings.uriNotFoundCallback = httpServerUriNotFoundCallback; //HTTP server initialization error = httpServerInit(&httpServerContext, &httpServerSettings); //Failed to initialize HTTP server? if(error) { //Debug message TRACE_ERROR("Failed to initialize HTTP server!\r\n"); } //Start HTTP server error = httpServerStart(&httpServerContext); //Failed to start HTTP server? if(error) { //Debug message TRACE_ERROR("Failed to start HTTP server!\r\n"); } //Create user task task = osCreateTask("User Task", userTask, NULL, 500, 1); //Failed to create the task? if(task == OS_INVALID_HANDLE) { //Debug message TRACE_ERROR("Failed to create task!\r\n"); } //Start the execution of tasks osStartKernel(); //This function should never return return 0; }
/** * Open main editor interface windows */ void openEditor(struct options_values *options, struct editor *e) { char title[100]; int i; struct panelw *p0, *p1, *p2; FIELD *f[2]; openI2LCD2(&e->lcd, options->bus, options->address, options->columns, options->rows); lcdPower(&e->lcd, POWERON); lcdSetBacklight(&e->lcd, 0x3f); lcdSetContrast(&e->lcd, 0x17); lcdBlink(&e->lcd, 1); lcdCursor(&e->lcd, 1); lcdClear(&e->lcd); lcdPrintf(&e->lcd, "LCDEd v1.0\x01"); e->brght = 0x3f; e->contr = 0x17; snprintf(title, 100, "LCD %dx%d:", e->lcd.cols, e->lcd.rows); p0 = openWindow(1, 1, e->lcd.cols, e->lcd.rows, COLOR_PAIR(1), title, "LCD Content editor\n" "\tCursor keys to move cursor around\n" "\t'PgUp'\tmoves cursor to the top row\n" "\t'PgDown'\tmoves cursor to the bottom row\n" "\t'Home'\tmoves cursor to the first column in row\n" "\t'End'\tmoves cursor to the last column in row\n\n" "\t'F1'\tto clear LCD screen\n" "\t'F3'/'F4'\tto decrease/increase contrast\n" "\t'F5'/'F6'\tto decrease/increase brightness\n", lcdWindowHandler, lcdActivateHandler); lcdSetCursor(&e->lcd, p0->col, p0->row); p0->lcd = &e->lcd; p1 = openWindow((p0->x + (p0->width < 20 ? 20 : p0->width)) + 1, 1, 5, 8, COLOR_PAIR(1), "C-1:", "Graphic character editor\n" "\tCursor keys to move cursor around\n" "\t'Space' to toggle pixel under the cursor\n" "\t'PgUp'\tPrevious character\n" "\t'PgDown'\tNext character\n" "\t'F1'\tto wipe character\n" "\t'F2'\tto reverse colors\n" "\t'S'\tTo save GC to header file\n", gcWindowHandler, gcActivateHandler); p1->lcd = &e->lcd; p1->gcn = 0; p2 = openWindow((p1->x + p1->width), 1, 2, 8, COLOR_PAIR(3), "Hex", "Hex editor for graphic character\n" "\tCursor keys to move cursor around\n" "\tSet value 0-f for value under cursor\n" "\t'PgUp'\tPrevious character\n" "\t'PgDown'\tNext character\n" "\t's'\tTo save GC to header file\n", gchWindowHandler, NULL); p2->lcd = &e->lcd; e->_actw = p0; joinWindows(p0, p1); joinWindows(p1, p2); joinWindows(p2, p0); e->potss = openWindow(p0->x, p0->y + p0->height + 1, 20, 3, COLOR_PAIR(3), "Potentiometers:", "", NULL, NULL); mvwprintw(e->potss->win, 1, 1, "Brightness:\t0x%02X", e->brght); mvwprintw(e->potss->win, 2, 1, "Contrast:\t0x%02X", e->contr); refresh(); }
int main(int argc, char **argv) { int c, i; struct panelw *actw; MEVENT event; const char *cb; args.address = 0x20; args.bus = 0x02; args.columns = 16; args.rows = 2; do { i = 0; c = getopt_long(argc, argv, "abc::r::h", options, &i); switch(c) { case 'a': if (optarg) { args.address = strtoul(optarg, NULL, 0); if (args.address == 0x00) help(argv, "Address of a chip must be a number!"); } break; case 'b': if (optarg) { args.bus = strtoul(optarg, NULL, 0); if (args.bus == 0x00) help(argv, "Bus number must be a number!"); } break; case 'c': if (optarg) { args.columns = strtoul(optarg, NULL, 0); if (args.columns == 0x00) help(argv, "The display is not in the list below:"); } break; case 'r': if (optarg) { args.rows = strtoul(optarg, NULL, 0); if (args.rows == 0x00) help(argv, "The display is not in the list below:"); } break; case 'f': if (optarg) strncpy(args.headername, optarg, 32); else strncpy(args.headername, "./gcbitmap.h", 32); break; case 'h': help(argv, ""); case -1: break; case '?': help(argv, "Unknown option"); break; default: help(argv, "No options given"); break; } }while(c != -1); initscr(); refresh(); keypad(stdscr, TRUE); nonl(); cbreak(); noecho(); curs_set(1); if (has_colors()) { start_color(); init_pair(1, COLOR_BLACK, COLOR_GREEN); init_pair(2, COLOR_WHITE, COLOR_BLACK); init_pair(3, COLOR_WHITE, COLOR_BLUE); init_pair(4, COLOR_GREEN, COLOR_BLACK); wattron(stdscr, COLOR_PAIR(4)); wbkgd(stdscr, COLOR_PAIR(4)); } openEditor(&args, &ed); actw = ed._actw; for(i=0; i < 8; i++) lcdSetGC(&ed.lcd, i, gcbitmap[i]); setWindowState(actw, 1); gcActivateHandler(actw->next); while(((c = wgetch(actw->win)) != KEY_F(10))) { // switch(c) { case KEY_F(5): ed.brght -= ed.brght > 0 ? 1 : 0; lcdSetBacklight(&ed.lcd, ed.brght); mvwprintw(ed.potss->win, 1, 1, "Brightness:\t0x%02X", ed.brght); update_panels(); doupdate(); refresh(); continue; case KEY_F(6): ed.brght += ed.brght < 0x3f ? 1 : 0; lcdSetBacklight(&ed.lcd, ed.brght); mvwprintw(ed.potss->win, 1, 1, "Brightness:\t0x%02X", ed.brght); update_panels(); doupdate(); refresh(); continue; case KEY_F(4): ed.contr -= ed.contr > 0 ? 1 : 0; lcdSetContrast(&ed.lcd, ed.contr); mvwprintw(ed.potss->win, 2, 1, "Contrast:\t0x%02X", ed.contr); update_panels(); doupdate(); refresh(); continue; case KEY_F(3): ed.contr += ed.contr < 0x3f ? 1 : 0; lcdSetContrast(&ed.lcd, ed.contr); mvwprintw(ed.potss->win, 2, 1, "Contrast:\t0x%02X", ed.contr); update_panels(); doupdate(); refresh(); continue; case 9: setWindowState(actw, 0); actw = returnNextWindow(&ed); setWindowState(actw, 1); continue; case KEY_MOUSE: if(getmouse(&event) == OK) { printf("%d %d\n", event.x, event.y); } continue; default: if(actw->handler) actw->handler(actw, c); continue; } } closeEditor(&ed); clear(); endwin(); return 0; }