void kbd_hit(char key) { set_active(); switch (key) { case 'd': dump_screen(0); break; case 'w': case 'W': save_image(); break; case 'q': case 'Q': case 'x': case 'X': /* exit the program */ end_display(); exit(0); case 'v': show_video_settings = !show_video_settings; refresh_screen = 1; break; case 'h': set_hue(get_hue() - 1); refresh_screen = 1; break; case 'H': set_hue(get_hue() + 1); refresh_screen = 1; break; case 's': set_saturation(get_saturation() - 1); refresh_screen = 1; break; case 'S': set_saturation(get_saturation() + 1); refresh_screen = 1; break; case 'b': set_brightness(get_brightness() - 1); refresh_screen = 1; break; case 'B': set_brightness(get_brightness() + 1); refresh_screen = 1; break; case 'c': set_contrast(get_contrast() - 1); refresh_screen = 1; break; case 'C': set_contrast(get_contrast() + 1); refresh_screen = 1; break; } }
static void v4l_picture_controls(struct context *cnt, struct video_dev *viddev) { int dev = viddev->fd_bktr; if ((cnt->conf.contrast) && (cnt->conf.contrast != viddev->contrast)) { set_contrast(dev, cnt->conf.contrast); viddev->contrast = cnt->conf.contrast; } if ((cnt->conf.hue) && (cnt->conf.hue != viddev->hue)) { set_hue(dev, cnt->conf.hue); viddev->hue = cnt->conf.hue; } if ((cnt->conf.brightness) && (cnt->conf.brightness != viddev->brightness)) { set_brightness(dev, cnt->conf.brightness); viddev->brightness = cnt->conf.brightness; } if ((cnt->conf.saturation) && (cnt->conf.saturation != viddev->saturation)) { set_saturation(dev, cnt->conf.saturation); viddev->saturation = cnt->conf.saturation; } }
/* ARGSUSED1 */ void key(unsigned char key, int x, int y) { switch (key) { case 'b': set_brighten(); break; case 's': set_saturate(); break; case 'c': set_contrast(); break; case 'z': set_sharpen(); break; case 'a': set_balance(); break; case 'h': help(); break; case '\033': exit(0); break; default: return; } glutPostRedisplay(); }
int me_cb_scale_1_7(menu_t *menu, const me_t *me, uint8_t msg) { u8g2_uint_t x; uint8_t val = *(uint8_t *)(me->val); if ( val <= 0 ) val = 1; x = me->x+(val-1)*5; switch(msg) { case ME_MSG_IS_FOCUS: return 1; case ME_MSG_DRAW_FOCUS: /* u8g2_SetFont(menu->u8g2, MENU_BIG_NUM); menu_DrawBoxFocus(menu, me->x+MENU_BIG_NUM_FOCUS_XO, me->y - u8g2_GetAscent(menu->u8g2)-1, u8g2_GetGlyphWidth(menu->u8g2, '0')+MENU_BIG_NUM_FOCUS_EXTRAX, u8g2_GetAscent(menu->u8g2) + 2); */ u8g2_DrawBox(menu->u8g2, x-2 , me->y-2, 5, 5); return 1; case ME_MSG_SELECT: { val++; if ( val > 7 ) val = 1; *(uint8_t *)(me->val) = val; } return 1; case ME_MSG_DRAW: set_contrast(); /* give user feedback... not so nice: We assume *(uint8_t *)(me->val) points to gui_data.contrast */ //u8g2_SetFont(menu->u8g2, MENU_NORMAL_FONT); //u8g2_DrawGlyph(menu->u8g2, me->x, me->y-2, *(uint8_t *)(me->val) + '0'); u8g2_DrawHLine(menu->u8g2, me->x, me->y, 6*5+1); u8g2_DrawVLine(menu->u8g2, me->x, me->y-2, 5); //u8g2_DrawVLine(menu->u8g2, me->x+1*5, me->y-1, 3); //u8g2_DrawVLine(menu->u8g2, me->x+2*5, me->y-1, 3); u8g2_DrawVLine(menu->u8g2, me->x+3*5, me->y-2, 5); //u8g2_DrawVLine(menu->u8g2, me->x+4*5, me->y-1, 3); //u8g2_DrawVLine(menu->u8g2, me->x+5*5, me->y-1, 3); u8g2_DrawVLine(menu->u8g2, me->x+6*5, me->y-2, 5); u8g2_DrawFrame(menu->u8g2, x-3 , me->y-3, 7, 7); u8g2_SetDrawColor(menu->u8g2, 0); u8g2_DrawBox(menu->u8g2, x-2 , me->y-2, 5, 5); /* draw color is set to 1 in the following function */ menu_ClearEdgePixel(menu, x-3 , me->y-3, 7, 7); menu_DrawEdgePixel(menu, x-2 , me->y-3+1, 5, 5); return 1; } return 0; }
/* Set status of additional camera capabilities */ static int gc0329_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) { struct gc0329_priv *priv = to_gc0329(sd); struct i2c_client *client = (struct i2c_client *) v4l2_get_subdevdata(sd); switch (ctrl->id) { case V4L2_CID_VFLIP: priv->flag_vflip = ctrl->value; return set_flip(client, priv->flag_vflip); break; case V4L2_CID_HFLIP: priv->flag_hflip = ctrl->value; PDBG("set H-FLIP:%d\n", priv->flag_hflip); return set_mirror(client, priv->flag_hflip); break; case V4L2_CID_BRIGHTNESS: if (ctrl->value < -4 || ctrl->value > 4) { return -EINVAL; } priv->brightness = ctrl->value; return set_brightness(client, priv->brightness); break; case V4L2_CID_CONTRAST: if (ctrl->value < -3 || ctrl->value > 3) { return -EINVAL; } priv->contrast = ctrl->value; return set_contrast(client, priv->contrast); break; case V4L2_CID_SATURATION: if (ctrl->value < -3 || ctrl->value > 3) { return -EINVAL; } priv->sat = ctrl->value; return set_sat(client, priv->sat); break; case V4L2_CID_CAMERA_SPECIAL_EFFECT: if (ctrl->value < 0 || ctrl->value > 8) { return -EINVAL; } priv->effect = ctrl->value; return set_effect(client, priv->effect); break; case V4L2_CID_DO_WHITE_BALANCE: if (ctrl->value < 0 || ctrl->value > 4) { return -EINVAL; } priv->wh_bal = ctrl->value; return set_wh_bal(client, priv->wh_bal); break; default: return -EINVAL; } return 0; }
/* Start/Stop streaming from the device */ static int gc0309_s_stream(struct v4l2_subdev *sd, int enable) { struct i2c_client *client = v4l2_get_subdevdata(sd); struct gc0309_priv *priv = to_gc0309(sd); int ret = 0; /* Program orientation register. */ ret = set_flip(client, priv->flag_vflip); if (ret < 0) return ret; ret = set_brightness(client, priv->brightness); if (ret < 0) return ret; ret = set_contrast(client, priv->contrast); if (ret < 0) return ret; ret = set_sat(client, priv->sat); if (ret < 0) return ret; ret = set_effect(client, priv->effect); if (ret < 0) return ret; ret = set_wh_bal(client, priv->wh_bal); if (ret < 0) return ret; ret = set_mirror(client, priv->flag_hflip); if (ret < 0) return ret; if (enable) { PDBG("Enabling Streaming\n"); /* Start Streaming */ ret = gc0309_write(client, 0x25, 0x0f); if (ret) goto out; } else { PDBG( "Disabling Streaming\n"); ret = gc0309_write(client, 0x25, 0x00); } out: return ret; }
void do_menu(uint8_t func_number) { // lcd_MEM2_string(DoMenu_str); // "do menu " // u2lcd(func_number); if (func_number == MODE_FREQ) GetFrequency(0); #if PROCESSOR_TYP == 644 if (func_number == MODE_HFREQ) GetFrequency(1); // measure high frequency with 16:1 divider if (func_number == MODE_H_CRYSTAL) GetFrequency(5); // HF crystal input + 16:1 divider if (func_number == MODE_L_CRYSTAL) GetFrequency(6); // LF crystal input, 1:1 divider #endif if (func_number == MODE_FGEN) { make_frequency(); // make some sample frequencies } if (func_number == MODE_PWM) { do_10bit_PWM(); // generate 10bit PWM } if (func_number == MODE_ESR) { show_C_ESR(); // measure capacity and ESR at TP1 and TP3 } if (func_number == MODE_RESIS) { show_Resis13(); // measure resistor at TP1 and TP3 } if (func_number == MODE_CAP13) { lcd_clear(); show_Cap13(); // measure capacitor at TP1 and TP3 } #ifdef WITH_ROTARY_CHECK if (func_number == MODE_ROTARY) { CheckRotaryEncoder(); // check rotary encoder } #endif if (func_number == MODE_BIG_CAP_CORR) { set_big_cap_corr(); } #ifdef WITH_SELFTEST if (func_number == MODE_SELFTEST) AutoCheck(0x11); // Full selftest with calibration #endif if (func_number == MODE_VEXT) show_vext(); #if ((LCD_ST_TYPE == 7565) || (LCD_ST_TYPE == 1306) || (LCD_ST_TYPE == 8812) || (LCD_ST_TYPE == 8814) || defined(LCD_DOGM)) if (func_number == MODE_CONTRAST) set_contrast(); #endif if (func_number == MODE_SHOW) { ShowData(); // Show Calibration Data } if (func_number == MODE_OFF) { ON_PORT &= ~(1<<ON_PIN); //switch off power wait_for_key_ms(0); //never ending loop } }
/** * @brief Low level GDISP driver initialization. * * @notapi */ bool_t gdisp_lld_init(void) { // Initialize your display init_board(); // Hardware reset. setpin_reset(TRUE); delay_ms(10); setpin_reset(FALSE); delay_ms(1); write_cmd(ST7565_LCD_BIAS_7); write_cmd(ST7565_ADC_NORMAL); write_cmd(ST7565_COM_SCAN_INC); set_display_start_line(0); set_contrast(32); write_cmd(ST7565_RESISTOR_RATIO | 0x3); // turn on voltage converter (VC=1, VR=0, VF=0) write_cmd(ST7565_POWER_CONTROL | 0x04); delay_ms(50); // turn on voltage regulator (VC=1, VR=1, VF=0) write_cmd(ST7565_POWER_CONTROL | 0x06); delay_ms(50); // turn on voltage follower (VC=1, VR=1, VF=1) write_cmd(ST7565_POWER_CONTROL | 0x07); delay_ms(50); display_on(); write_cmd(ST7565_ALLON_NORMAL); invert_display(0);// Disable Inversion of display. write_cmd(ST7565_RMW); gdisp_lld_display(); // Initialize the GDISP structure GDISP.Width = GDISP_SCREEN_WIDTH; GDISP.Height = GDISP_SCREEN_HEIGHT; GDISP.Orientation = GDISP_ROTATE_0; GDISP.Powermode = powerOn; GDISP.Contrast = 50; #if GDISP_NEED_VALIDATION || GDISP_NEED_CLIP GDISP.clipx0 = 0; GDISP.clipy0 = 0; GDISP.clipx1 = GDISP.Width; GDISP.clipy1 = GDISP.Height; #endif return TRUE; }
/* Start/Stop streaming from the device */ static int gc0329_s_stream(struct v4l2_subdev *sd, int enable) { struct i2c_client *client = v4l2_get_subdevdata(sd); struct gc0329_priv *priv = to_gc0329(sd); int ret = 0; u8 val; /* Program orientation register. */ ret = set_flip(client, priv->flag_vflip); if (ret < 0) return ret; ret = set_brightness(client, priv->brightness); if (ret < 0) return ret; ret = set_contrast(client, priv->contrast); if (ret < 0) return ret; ret = set_sat(client, priv->sat); if (ret < 0) return ret; ret = set_effect(client, priv->effect); if (ret < 0) return ret; ret = set_wh_bal(client, priv->wh_bal); if (ret < 0) return ret; ret = set_mirror(client, priv->flag_hflip); if (ret < 0) return ret; if (enable) { dev_dbg(&client->dev, "Enabling Streaming\n"); /* Start Streaming */ } else { dev_dbg(&client->dev, "Disabling Streaming\n"); } out: return ret; }
static int gc0311_s_stream(struct v4l2_subdev *sd, int enable) { struct i2c_client *client = v4l2_get_subdevdata(sd); struct gc0311_priv *priv = to_gc0311(sd); int ret = 0; ret = set_flip(client, priv->flag_vflip); if (ret < 0) return ret; ret = set_brightness(client, priv->brightness); if (ret < 0) return ret; ret = set_contrast(client, priv->contrast); if (ret < 0) return ret; ret = set_sat(client, priv->sat); if (ret < 0) return ret; ret = set_effect(client, priv->effect); if (ret < 0) return ret; ret = set_wh_bal(client, priv->wh_bal); if (ret < 0) return ret; ret = set_mirror(client, priv->flag_hflip); if (ret < 0) return ret; if (enable) { ret = gc0311_write(client, 0x25, 0x0f); if (ret) goto out; } else { ret = gc0311_write(client, 0x25, 0x00); } out: return ret; }
void CameraSettings::setup(MMAL_COMPONENT_T *camera_) { camera = camera_; set_saturation(saturation); set_sharpness(sharpness); set_contrast(contrast); set_brightness(brightness); //set_ISO(ISO); TODO Not working for some reason set_video_stabilisation(videoStabilisation); set_exposure_compensation(exposureCompensation); set_exposure_mode(exposureMode); set_metering_mode(exposureMeterMode); set_awb_mode(awbMode); set_imageFX(imageEffect); set_colourFX(&colourEffects); //set_thumbnail_parameters(camera, ¶ms->thumbnailConfig); TODO Not working for some reason set_rotation(rotation); set_flips(hflip, vflip); }
/** * @brief Driver Control * @details Unsupported control codes are ignored. * @note The value parameter should always be typecast to (void *). * @note There are some predefined and some specific to the low level driver. * @note GDISP_CONTROL_POWER - Takes a gdisp_powermode_t * GDISP_CONTROL_ORIENTATION - Takes a gdisp_orientation_t * GDISP_CONTROL_BACKLIGHT - Takes an int from 0 to 100. For a driver * that only supports off/on anything other * than zero is on. * GDISP_CONTROL_CONTRAST - Takes an int from 0 to 100. * GDISP_CONTROL_LLD - Low level driver control constants start at * this value. * * @param[in] what What to do. * @param[in] value The value to use (always cast to a void *). * * @notapi */ void gdisp_lld_control(unsigned what, void *value) { switch(what) { case GDISP_CONTROL_POWER: if (GDISP.Powermode == (gdisp_powermode_t)value) return; switch((gdisp_powermode_t)value) { case powerOff: display_off(); break; case powerSleep: display_off(); break; case powerDeepSleep: display_off(); break; case powerOn: display_on(); break; default: return; } GDISP.Powermode = (gdisp_powermode_t)value; return; case GDISP_CONTROL_BACKLIGHT: set_backlight((uint8_t)(size_t)value); return; case GDISP_CONTROL_CONTRAST: if ((unsigned)value > 100) value = (void*)100; if (GDISP.Contrast == (uint8_t)((float)((size_t)value) * 63.0/100.0)) return; set_contrast((uint8_t)((float)((size_t)value) * 63.0/100.0) ); GDISP.Contrast = (unsigned)value; return; case GDISP_CONTROL_LLD_FLUSH: gdisp_lld_display(); return; } }
static int ipod_fb_ioctl(struct inode *inode, struct file *file, u_int cmd, u_long arg, int con, struct fb_info *info) { int val; switch (cmd) { case FBIOGET_CONTRAST: val = get_contrast(); if (put_user(val, (int *)arg)) return -EFAULT; break; case FBIOPUT_CONTRAST: val = (int)arg; if (val < IPOD_MIN_CONTRAST || val > IPOD_MAX_CONTRAST) return -EINVAL; set_contrast(val); break; case FBIOGET_BACKLIGHT: val = get_backlight(); if (put_user(val, (int *)arg)) return -EFAULT; break; case FBIOPUT_BACKLIGHT: val = (int)arg; set_backlight(val); break; default: return -EINVAL; } return 0; }
/* ****************************************************************** */ void function_menu() { uint8_t ii; uint8_t func_number; #ifdef PAGE_MODE uint8_t page_nr; uint8_t p_nr; uint8_t ff; page_nr = MODE_LAST; #ifdef WITH_ROTARY_SWITCH rotary.count = 0; #endif #endif func_number = 0; #ifdef POWER_OFF uint8_t ll; for (ll=0;ll<((MODE_LAST+1)*10);ll++) #else while (1) /* without end, if no power off specified */ #endif { if (func_number > MODE_LAST) func_number -= (MODE_LAST + 1); message_key_released(SELECTION_str); #ifdef FOUR_LINE_LCD #ifdef PAGE_MODE ff = 0; if (func_number == page_nr) ff = 1; // number is found p_nr = page_nr + 1; if (p_nr > MODE_LAST) p_nr -= (MODE_LAST + 1); if (func_number == p_nr) ff = 1; // number is found p_nr = page_nr + 2; if (p_nr > MODE_LAST) p_nr -= (MODE_LAST + 1); if (func_number == p_nr) ff = 1; // number is found if (ff == 0) { // func_number is not in page list #ifdef WITH_ROTARY_SWITCH if (rotary.count >= 0) { page_nr = (func_number + MODE_LAST -1); // page_nr = func_number - 2 } else { page_nr = func_number; // for backward, set page_nr to func_number } if (page_nr > MODE_LAST) page_nr -= (MODE_LAST + 1); #else page_nr = func_number; #endif } if (ff == 0) { lcd_line2(); lcd_clear_line(); // clear line 2 } lcd_line2(); // reset cursor to begin of line 2 if (func_number == page_nr) { lcd_data('>'); } else { lcd_space(); // put a blank to 1. row of line 2 } message2line(page_nr); // show first page function if (ff == 0) { lcd_line3(); lcd_clear_line(); // clear line 3 } lcd_line3(); // reset cursor to begin of line 3 p_nr = page_nr + 1; if (p_nr > MODE_LAST) p_nr -= (MODE_LAST + 1); if (func_number == p_nr) { lcd_data('>'); } else { lcd_space(); // put a blank to 1. row of line 3 } message2line(p_nr); // show 2. page function if (ff == 0) { lcd_line4(); lcd_clear_line(); // clear line 4 } lcd_line4(); // reset cursor to begin of line 4 p_nr = page_nr + 2; if (p_nr > MODE_LAST) p_nr -= (MODE_LAST + 1); if (func_number == p_nr) { lcd_data('>'); } else { lcd_space(); // put a blank to 1. row of line 4 } message2line(p_nr); // show 3. page function #else /* no PAGE_MODE */ lcd_line2(); lcd_clear_line(); // clear line 2 lcd_line2(); // reset cursor to begin of line 2 lcd_space(); // put a blank to 1. row of line 2 message2line(func_number + MODE_LAST); // show lower (previous) function lcd_line3(); lcd_clear_line(); // clear line 3 lcd_line3(); // reset cursor to begin of line 3 lcd_data('>'); // put a '>' marker to row 1 of line 3 message2line(func_number); // show selectable function lcd_line4(); lcd_clear_line(); // clear line 4 lcd_line4(); // reset cursor to begin of line 4 lcd_space(); // put a blank to 1. row of line 4 message2line(func_number + 1); // show higher (next) function #endif /* PAGE_MODE */ #else /* no FOUR_LINE_LCD */ lcd_line2(); lcd_clear_line(); // clear line 2 lcd_line2(); // reset cursor to begin of line 2 message2line(func_number); #endif /* FOUR_LINE_LCD */ #ifdef POWER_OFF ii = wait_for_key_ms(SHORT_WAIT_TIME); // wait about 5 seconds if (ii > 0) ll = 0; // reset timer, operator present #else ii = wait_for_key_ms(0); // wait endless #endif #ifdef WITH_ROTARY_SWITCH if ((ii >= MIN_SELECT_TIME) || ((rotary_switch_present != 0) && (ii > 0))) #else if (ii >= MIN_SELECT_TIME) #endif { // selection only with key-press if (func_number == MODE_TRANS) break; // return to TransistorTester if (func_number == MODE_FREQ) GetFrequency(0); #if PROCESSOR_TYP == 644 if (func_number == MODE_HFREQ) GetFrequency(1); // measure high frequency with 16:1 divider if (func_number == MODE_H_CRYSTAL) GetFrequency(5); // HF crystal input + 16:1 divider if (func_number == MODE_L_CRYSTAL) GetFrequency(6); // LF crystal input, 1:1 divider #endif if (func_number == MODE_FGEN) { make_frequency(); // make some sample frequencies } if (func_number == MODE_PWM) { do_10bit_PWM(); // generate 10bit PWM } if (func_number == MODE_ESR) { show_C_ESR(); // measure capacity and ESR at TP1 and TP3 } if (func_number == MODE_ROTARY) { CheckRotaryEncoder(); // check rotary encoder } #ifdef WITH_SELFTEST if (func_number == MODE_SELFTEST) AutoCheck(0x11); // Full selftest with calibration #endif if (func_number == MODE_VEXT) show_vext(); #if (LCD_ST_TYPE == 7565) if (func_number == MODE_CONTRAST) set_contrast(); #endif if (func_number == MODE_SHOW) { ShowData(); // Show Calibration Data } if (func_number == MODE_OFF) { ON_PORT &= ~(1<<ON_PIN); //switch off power wait_for_key_ms(0); //never ending loop } // don't increase function number for easier selection the same function ii = 0; // function was executed before, do not increase func_number #ifdef WITH_ROTARY_SWITCH rotary.incre = 0; // reset all rotary information rotary.count = 0; #endif } /* end if (ii >= MIN_SELECT_TIME) */ #ifdef WITH_ROTARY_SWITCH if (rotary.incre >= FAST_ROTATION) break; // to much rotation #ifdef POWER_OFF if (rotary.count != 0) ll = 0; // someone is working, reset timer #endif if (rotary.count >= 0) { func_number += rotary.count; // function number is increased by rotary steps } else { func_number += (MODE_LAST + 1 + rotary.count); // function is decreased by rotary steps } #endif if (ii > 0) func_number++; // increase the function number with key press } /* end for ll */ return; } // end function_menu()
/* ****************************************************************** */ void function_menu() { uint8_t ii; uint8_t func_number; #ifdef PAGE_MODE uint8_t page_nr; uint8_t p_nr; uint8_t ff; page_nr = MODE_LAST; #ifdef WITH_ROTARY_SWITCH rotary.count = 0; #endif #endif func_number = 0; message_key_released(SELECTION_str); #ifdef POWER_OFF uint8_t ll; for (ll=0;ll<((MODE_LAST+1)*10);ll++) #else while (1) /* without end, if no power off specified */ #endif { if (func_number > MODE_LAST) func_number -= (MODE_LAST + 1); #if (LCD_LINES > 3) uint8_t mm; #ifdef PAGE_MODE ff = 0; mm = 0; do { p_nr = page_nr + mm; if (p_nr > MODE_LAST) p_nr -= (MODE_LAST + 1); if (func_number == p_nr) ff = 1; // number is found } while (++mm < MENU_LINES); if (ff == 0) { // func_number is not in page list #ifdef WITH_ROTARY_SWITCH if (rotary.count >= 0) { page_nr = (func_number + MODE_LAST -1); // page_nr = func_number - 2 } else { page_nr = func_number; // for backward, set page_nr to func_number } if (page_nr > MODE_LAST) page_nr -= (MODE_LAST + 1); #else page_nr = func_number; #endif } mm= 0; do { p_nr = page_nr + mm; if (p_nr > MODE_LAST) p_nr -= (MODE_LAST + 1); lcd_set_cursor((mm+1)*PAGES_PER_LINE,0); if (func_number == p_nr) { lcd_data('>'); } else { lcd_space(); // put a blank to 1. row of line 2 } message2line(p_nr); // show page function } while (++mm < MENU_LINES); #else /* no PAGE_MODE */ uint8_t f_nr; mm = 0; do { lcd_set_cursor((mm+1)*PAGES_PER_LINE,0); if (mm == MENU_MIDDLE) { lcd_data('>'); // put a '>' marker to row 1 of line 4 } else { lcd_space(); // put a blank to 1. row of line 2 } f_nr = func_number + MODE_LAST + 1 - MENU_MIDDLE + mm; if (f_nr > MODE_LAST) f_nr -= (MODE_LAST +1); message2line(f_nr); // show function for this line } while (++mm < MENU_LINES); #endif /* PAGE_MODE */ #else /* not LCD_LINES > 3 */ lcd_line2(); message2line(func_number); #endif /* (LCD_LINES > 3) */ #ifdef POWER_OFF ii = wait_for_key_ms(SHORT_WAIT_TIME); // wait about 5 seconds if (ii > 0) ll = 0; // reset timer, operator present if (DC_Pwr_mode == 1) ll = 0; #else ii = wait_for_key_ms(0); // wait endless #endif #ifdef WITH_ROTARY_SWITCH if ((ii >= MIN_SELECT_TIME) || ((rotary_switch_present != 0) && (ii > 0))) #else if (ii >= MIN_SELECT_TIME) #endif { // selection only with key-press if (func_number == MODE_TRANS) break; // return to TransistorTester if (func_number == MODE_FREQ) GetFrequency(0); #if PROCESSOR_TYP == 644 if (func_number == MODE_HFREQ) GetFrequency(1); // measure high frequency with 16:1 divider if (func_number == MODE_H_CRYSTAL) GetFrequency(5); // HF crystal input + 16:1 divider if (func_number == MODE_L_CRYSTAL) GetFrequency(6); // LF crystal input, 1:1 divider #endif if (func_number == MODE_FGEN) { make_frequency(); // make some sample frequencies } if (func_number == MODE_PWM) { do_10bit_PWM(); // generate 10bit PWM } if (func_number == MODE_ESR) { show_C_ESR(); // measure capacity and ESR at TP1 and TP3 } if (func_number == MODE_RESIS) { show_Resis13(); // measure resistor at TP1 and TP3 } if (func_number == MODE_CAP13) { lcd_clear(); show_Cap13(); // measure capacitor at TP1 and TP3 } if (func_number == MODE_ROTARY) { CheckRotaryEncoder(); // check rotary encoder } if (func_number == MODE_BIG_CAP_CORR) { set_big_cap_corr(); } #ifdef WITH_SELFTEST if (func_number == MODE_SELFTEST) AutoCheck(0x11); // Full selftest with calibration #endif if (func_number == MODE_VEXT) show_vext(); #if ((LCD_ST_TYPE == 7565) || (LCD_ST_TYPE == 1306) || (LCD_ST_TYPE == 8812) || (LCD_ST_TYPE == 8814) || defined(LCD_DOGM)) if (func_number == MODE_CONTRAST) set_contrast(); #endif if (func_number == MODE_SHOW) { ShowData(); // Show Calibration Data } if (func_number == MODE_OFF) { ON_PORT &= ~(1<<ON_PIN); //switch off power wait_for_key_ms(0); //never ending loop } // don't increase function number for easier selection the same function ii = 0; // function was executed before, do not increase func_number #ifdef WITH_ROTARY_SWITCH rotary.incre = 0; // reset all rotary information rotary.count = 0; #endif message_key_released(SELECTION_str); //write Line 1 with Selection: } /* end if (ii >= MIN_SELECT_TIME) */ #ifdef WITH_ROTARY_SWITCH if (rotary.incre >= FAST_ROTATION) break; // to much rotation #ifdef POWER_OFF if (rotary.count != 0) ll = 0; // someone is working, reset timer #endif if (rotary.count >= 0) { func_number += rotary.count; // function number is increased by rotary steps } else { func_number += (MODE_LAST + 1 + rotary.count); // function is decreased by rotary steps } #endif if (ii > 0) func_number++; // increase the function number with key press } /* end for ll */ return; } // end function_menu()