//--------------------------------------------------------- const CSG_Rect & CSG_PointCloud::Get_Selection_Extent(void) { if( m_nSelected > 0 && Set_Cursor(m_Selected[0]) ) { TSG_Rect r; r.xMin = r.xMax = Get_X(); r.yMin = r.yMax = Get_Y(); for(int i=1; i<m_nSelected; i++) { if( Set_Cursor(m_Selected[i]) ) { if( Get_X() < r.xMin ) r.xMin = Get_X(); else if( Get_X() > r.xMax ) r.xMax = Get_X(); if( Get_Y() < r.yMin ) r.yMin = Get_Y(); else if( Get_Y() > r.yMax ) r.yMax = Get_Y(); } } m_Extent_Selected.Assign(r); } else { m_Extent_Selected.Assign(0.0, 0.0, 0.0, 0.0); } return( m_Extent_Selected ); }
//--------------------------------------------------------- const CSG_Rect & CSG_PointCloud::Get_Selection_Extent(void) { if( Get_Selection_Count() > 0 && Set_Cursor(Get_Selection_Index(0)) ) { TSG_Rect r; r.xMin = r.xMax = Get_X(); r.yMin = r.yMax = Get_Y(); for(size_t i=1; i<Get_Selection_Count(); i++) { if( Set_Cursor(Get_Selection_Index(i)) ) { if( Get_X() < r.xMin ) r.xMin = Get_X(); else if( Get_X() > r.xMax ) r.xMax = Get_X(); if( Get_Y() < r.yMin ) r.yMin = Get_Y(); else if( Get_Y() > r.yMax ) r.yMax = Get_Y(); } } m_Extent_Selected.Assign(r); } else { m_Extent_Selected.Assign(0.0, 0.0, 0.0, 0.0); } return( m_Extent_Selected ); }
/*------------------------------------------------------------------ ----------------TEST FUNCTION-------------------------------------- -----------------------------------------------------------------*/ void test(void) { int len, i; // set up length variable and index for topstring char topstring[] = { "This is a test" }; // this is the string that will be written on the top row char bottomstring[] = { "This is line 2" }; // this is the string that will be written on the bottom row Init_Lcd(); // Run Init_Lcd function which sets up LCD with your preferences len = strlen(topstring); // measure the length of topstring using strlen() and store the into in len1 variable { // lets write topstring to the LCD for (i = 0; i < len; i++) // the for loop steps through the string sending each letter Lcd_Send(topstring[i]); // the Lcd_Send function is run for the given letter of the topstring at index i } delay(50); // a quick delay in ms to allow LCD to display the value for a little bit before refreshing len = strlen(bottomstring); // measure length of the bottom string using strlen() from string.h Set_Cursor(0xC0); //set cursor to the beginning of the second line for (i = 0; i < len; i++) { Lcd_Send(bottomstring[i]); // Display the winner string on the LCD } delay(5000); // wait 5000ms so you can enjoy the feeling of victory Clear_LCD(); } // end test
//--------------------------------------------------------- CSG_Shape * CSG_PointCloud::Get_Shape(TSG_Point Point, double Epsilon) { CSG_Rect r(Point.x - Epsilon, Point.y - Epsilon, Point.x + Epsilon, Point.y + Epsilon); if( r.Intersects(Get_Extent()) != INTERSECTION_None ) { int iPoint = -1; double iDistance = -1.0; for(int iRecord=0; iRecord<Get_Count(); iRecord++) { Set_Cursor(iRecord); if( r.Contains(Get_X(), Get_Y()) ) { if( iPoint < 0 || iDistance > SG_Get_Distance(Point.x, Point.y, Get_X(), Get_Y()) ) { iPoint = iRecord; iDistance = SG_Get_Distance(Point.x, Point.y, Get_X(), Get_Y()); } } } if( iPoint >= 0 ) { return( CSG_Shapes::Get_Shape(iPoint) ); } } return( NULL ); }
/************************************************************** * 函数说明:目录显示函数 * **************************************************************/ void ShowMenu(void) { unsigned char n = 0; MaxItems = MenuPoint[0].MenuCount; DisplayPoint = DisplayStart; for(n = 0;n<MaxItems;n++) { Disp_Str(n,0,MenuPoint[DisplayPoint++].DisplayString); } Set_Cursor(1,1); }
//--------------------------------------------------------- bool CSG_PointCloud::Select(int iRecord, bool bInvert) { if( !bInvert ) { for(int i=0; i<m_nSelected; i++) { m_Points[m_Selected[i]][0] &= ~SG_TABLE_REC_FLAG_Selected; } m_Array_Selected.Destroy(); m_Selected = NULL; m_nSelected = 0; } if( Set_Cursor(iRecord) ) { if( (m_Cursor[0] & SG_TABLE_REC_FLAG_Selected) == 0 ) // select { if( m_Array_Selected.Set_Array(m_nSelected + 1, (void **)&m_Selected) ) { m_Cursor[0] |= SG_TABLE_REC_FLAG_Selected; m_Selected[m_nSelected++] = iRecord; return( true ); } } else // deselect { m_Cursor[0] &= ~SG_TABLE_REC_FLAG_Selected; m_nSelected--; for(int i=0; i<m_nSelected; i++) { if( m_Points[iRecord] == m_Points[m_Selected[i]] ) { for(; i<m_nSelected; i++) { m_Selected[i] = m_Selected[i + 1]; } } } m_Array_Selected.Set_Array(m_nSelected, (void **)&m_Selected); return( true ); } } return( false ); }
void Show_KeyMap(void)//»Êý×Ö¼üÅÌ { touch.PID=1; LCD_Clear(2,20,236,99,BLACK); LCD_Clear(0,160,240,300,BLUE); LCD_DrawTitleBar(title); LCD_DrawEdit(input); LCD_DrawHLine(0,160,240,BLACK); LCD_DrawHLine(0,220,240,BLACK); LCD_DrawHLine(0,280,240,BLACK); LCD_DrawHLine(0,340,180,BLACK); LCD_DrawHLine(0,399,240,BLACK); LCD_DrawVLine(60,160,180,BLACK); LCD_DrawVLine(120,160,240,BLACK); LCD_DrawVLine(180,160,180,BLACK); Set_Color(BLUE,WHITE); LCD_DrawKeyNum(1,0,160); LCD_DrawKeyNum(2,60,160); LCD_DrawKeyNum(3,120,160); LCD_DrawKeyNum(0,180,160); LCD_DrawKeyNum(4,0,220); LCD_DrawKeyNum(5,60,220); LCD_DrawKeyNum(6,120,220); LCD_DrawKeyNum(10,180,220); LCD_DrawKeyNum(7,0,280); LCD_DrawKeyNum(8,60,280); LCD_DrawKeyNum(9,120,280); LCD_DrawKeyDel(0,340); LCD_DrawKeyOK(120,340); Set_Cursor(8,132); }
//--------------------------------------------------------- bool CSG_PointCloud::Select(TSG_Rect Extent, bool bInvert) { if( !bInvert ) // clear selection { Select(-1, false); } if( Get_Extent().Intersects(Extent) != INTERSECTION_None ) { for(int i=0; i<Get_Count(); i++) { Set_Cursor(i); if( Extent.xMin <= Get_X() && Get_X() <= Extent.xMax && Extent.yMin <= Get_Y() && Get_Y() <= Extent.yMax ) { Select(i, true); } } } return( Get_Selection_Count() > 0 ); }
//--------------------------------------------------------- bool CSG_PointCloud::Select(int iRecord, bool bInvert) { if( !bInvert && Get_Selection_Count() > 0 ) { for(size_t i=0; i<Get_Selection_Count(); i++) { m_Points[Get_Selection_Index(i)][0] &= ~SG_TABLE_REC_FLAG_Selected; } m_Selection.Destroy(); } if( Set_Cursor(iRecord) ) { if( (m_Cursor[0] & SG_TABLE_REC_FLAG_Selected) == 0 ) // select { if( _Add_Selection(iRecord) ) { m_Cursor[0] |= SG_TABLE_REC_FLAG_Selected; return( true ); } } else // deselect { if( _Del_Selection(iRecord) ) { m_Cursor[0] &= ~SG_TABLE_REC_FLAG_Selected; return( true ); } } } return( false ); }
void Touch_Test(void) { #define X_OFFSET 0 #define Y_OFFSET 10 float r = 4; // Brush size char str[8]; Cursor strCursor1, strCursor2, strCursor3, strCursor4, strCursor5, strCursor6, buttonCursor;// String cursor touchscreen_data ts_data; Lcd_ClearScr(320,240,0xFFFF); strCursor1 = Set_Cursor(16 + X_OFFSET,0 + Y_OFFSET); strCursor2 = Set_Cursor(16 + X_OFFSET,16 + Y_OFFSET); strCursor3 = Set_Cursor(16 + X_OFFSET,32 + Y_OFFSET); strCursor4 = Set_Cursor(0 + X_OFFSET,0 + Y_OFFSET); strCursor5 = Set_Cursor(0 + X_OFFSET,16 + Y_OFFSET); strCursor6 = Set_Cursor(0 + X_OFFSET,32 + Y_OFFSET); GLCD_printf("x:", 0x0000, 0xffff, strCursor4); GLCD_printf("y:", 0x0000, 0xffff, strCursor5); GLCD_printf("p:", 0x0000, 0xffff, strCursor6); GLCD_RoundRect(10,90,80,110,5,LIGHT_BLUE); GLCD_RoundRect(10,90,120,150,5,LIGHT_BLUE); GLCD_RoundRect(10,90,160,190,5,LIGHT_BLUE); GLCD_RoundRect(10,90,200,230,5,LIGHT_BLUE); buttonCursor = Set_Cursor(46,87); GLCD_printf("+", WHITE, LIGHT_BLUE, buttonCursor); buttonCursor = Set_Cursor(46,127); GLCD_printf("-", WHITE, LIGHT_BLUE, buttonCursor); buttonCursor = Set_Cursor(22,167); GLCD_printf("Refresh", WHITE, LIGHT_BLUE, buttonCursor); buttonCursor = Set_Cursor(34,207); GLCD_printf("Back", WHITE, LIGHT_BLUE, buttonCursor); while(1) { ts_data = GetTS_Fast(); GLCD_Ellipsoid(75-r,75+r,35-r,35+r,BLACK); putarea(91,105,0,239,WHITE); myItoa(ts_data.xvalue,str,10); GLCD_printf_window(str,0x0000, 0xffff, strCursor1, 4); myItoa(ts_data.yvalue,str,10); GLCD_printf_window(str,0x0000, 0xffff, strCursor2, 4); myItoa(ts_data.pvalue,str,10); GLCD_printf_window(str,0x0000, 0xffff, strCursor3, 4); if(ts_data.pvalue == 1024 && ts_data.xvalue > 105) { GLCD_Ellipsoid(ts_data.xvalue-r,ts_data.xvalue+r,ts_data.yvalue-r,ts_data.yvalue+r, BLACK); } else if(r < 15 && ts_data.pvalue == 1024 && ts_data.xvalue > 10 && ts_data.xvalue < 90 && ts_data.yvalue > 80 && ts_data.yvalue < 110) { r++; putarea(75-r,75+r,35-r,35+r,WHITE); } else if(r > 4 && ts_data.pvalue == 1024 && ts_data.xvalue > 10 && ts_data.xvalue < 90 && ts_data.yvalue > 120 && ts_data.yvalue < 150) { r--; putarea(50,90,20,50,WHITE); } else if(ts_data.pvalue == 1024 && ts_data.xvalue > 10 && ts_data.xvalue < 90 && ts_data.yvalue > 160 && ts_data.yvalue < 190) { putarea(106,319,0,239,WHITE); } else if(ts_data.pvalue == 1024 && ts_data.xvalue > 10 && ts_data.xvalue < 90 && ts_data.yvalue > 200 && ts_data.yvalue < 230) { return; } } }
void main(void) { sys_init(); //初始化电机控制信号 //subdiv = 16; moto_set(int_speed,subdiv); //Shutter = 0; //Focus = 0; //moto_run(100); // Global enable interrupts #asm("sei") Lcd_Init(); delay_ms(5); Init_BH1750(); //初始化BH1750 Clear_Scr(); MenuInitialation(); ShowMenu(); UserChooseR = 1; while(1) { if(time_10ms) //10ms定时扫描键盘 { time_10ms = 0; *pRockValue=No_rock; rocker_type = Read_Rocker(pRockValue); if(rocker_type == keyPressed) { switch(*pRockValue) { case Down: UserChooseR ++; if(UserChooseR == 3) { UserChooseR = 1; } break; case Enter: TempMenu = MenuPoint; Clear_Scr(); if(MenuPoint[UserChooseR].ChildrenMenus != NULL) { MenuPoint = MenuPoint[UserChooseR].ChildrenMenus; //UserChooseR = 0; //DisplayStart = 0; } ShowMenu(); if(TempMenu[UserChooseR].Subs != NULLSubs) { (*TempMenu[UserChooseR].Subs)(); } //Clear_Scr(); break; } Set_Cursor(UserChooseR,1); //ShowMenu(); } key_value= Read_keyboard(); if(key_value != No_key) { switch(key_value) { case Esc: work_mode = 0; work_state = idle_state; //TIMSK &= ~(1<<OCIE2); break; case OK: work_mode = 1; //TIMSK |= (1<<OCIE2); break; case 0: moto_zero('A'); break; case 1: moto_zero('B'); break; default: break; } } } switch(work_state) { case idle_state: if(work_mode) { work_state = step_run; } break; case step_run: moto_run(Int_step); work_state = start_expos; break; case start_expos: if(run_finish) { if( expos_mode == camera ) { expos_value = def_tv; } else if( expos_mode == sensor ) { expos_value = Get_TV();} else { expos_value = (long)1000*Str2Int(TV);} flag_1ms = 0; Shutter = 1; Focus = 1; work_state = stop_expos; } break; case stop_expos: if(expos_finish) { expos_finish = 0; photo_taken++; photo_left = exp_photos - photo_taken; work_state = delay_state; cnt_10ms = 0; } break; case delay_state: if(photo_taken == exp_photos) { work_mode = 0; } if(delay_finish) { delay_finish = 0; work_state = idle_state; } break; default: break; } } }
void Input_Task(void *parg) { u8 err; u8 OK=0; u8 buffer[4]={0}; u8 LEN=0; u8 flag=0; u16 e=0; OS_CPU_SR cpu_sr; (void)parg; for(;;) { OSSemPend(PENIRQ,0,&err); Exti_Set(0); OS_ENTER_CRITICAL(); touch.FLAG=Read_XY_2(&touch.AD_X,&touch.AD_Y); OS_EXIT_CRITICAL(); if(touch.FLAG) { Led_On(1); touch.FLAG=0; touch.LCD_X=CalcXY(touch.AD_X,0); touch.LCD_Y=CalcXY(touch.AD_Y,1); touch.KEY=Get_Key(touch.PID,touch.LCD_X,touch.LCD_Y); if(touch.KEY<=10) { OS_ENTER_CRITICAL(); Set_Color(WHITE,BLACK); if(touch.KEY==10) Show_Char('.',cursor.x,cursor.y); else { Show_Dec(touch.KEY,1,cursor.x,cursor.y); if(LEN<4) { buffer[LEN]=touch.KEY; LEN++; } } if(cursor.x<224) { cursor.x+=8; if(cursor.x>=224) cursor.x=224; } OS_EXIT_CRITICAL(); } else if(touch.KEY==11) { OK++; if(OK==1) { VALUE1=CalcDec(buffer,LEN); Set_Color(BLACK,GREEN); Show_String(">>VALUE1:",2,22); Show_Dec(VALUE1,LEN,82,22); OS_ENTER_CRITICAL(); LCD_Clear(4,121,232,38,WHITE); cursor.x=8; cursor.y=132; OS_EXIT_CRITICAL(); buffer[0]=0; buffer[1]=0; buffer[2]=0; buffer[3]=0; LEN=0; } else if(OK==2) { VALUE2=CalcDec(buffer,LEN); Set_Color(BLACK,GREEN); Show_String(">>VALUE2:",2,38); Show_Dec(VALUE2,LEN,82,38); OS_ENTER_CRITICAL(); LCD_Clear(4,121,232,38,WHITE); cursor.x=8; cursor.y=132; OS_EXIT_CRITICAL(); buffer[0]=0; buffer[1]=0; buffer[2]=0; buffer[3]=0; LEN=0; } else if(OK==3) { VALUE3=CalcDec(buffer,LEN); Set_Color(BLACK,GREEN); Show_String(">>VALUE3:",2,54); Show_Dec(VALUE3,LEN,82,54); OS_ENTER_CRITICAL(); LCD_Clear(4,121,232,38,WHITE); cursor.x=8; cursor.y=132; OS_EXIT_CRITICAL(); buffer[0]=0; buffer[1]=0; buffer[2]=0; buffer[3]=0; LEN=0; } else if(OK==4) { if(VALUE2>0&&VALUE2<=5000) { if(VALUE1<VALUE2&&VALUE1>0) { if(VALUE3>0&&VALUE3<10000) { e=0; Set_Color(BLACK,GREEN); Show_String(">>OK!",2,70); } else { e=1; } } else { e=1; } } else { e=1; } if(e) { Set_Color(BLACK,GREEN); Show_String(">>ERROR!",2,70); } } else if(OK==5) { if(!e) { OK=0; OSTaskSuspend(CURSOR_TASK_PRIO); Show_Main(VALUE1,VALUE2,VALUE3,1); } else { OK=0; e=0; LCD_Clear(2,20,236,100,BLACK); LCD_DrawEdit(input); Set_Cursor(8,132); } VALUE1=0; VALUE2=0; VALUE3=0; } else; } else if(touch.KEY==12) { OS_ENTER_CRITICAL(); if(LEN>0) { LEN--; } if(cursor.x>=8) { LCD_Clear(cursor.x,cursor.y,8,16,WHITE); cursor.x-=8; if(cursor.x<8) { cursor.x=8; } } OS_EXIT_CRITICAL(); } else if(touch.KEY==13) { if(flag==0) { flag=1; button1.str="stop"; button1.len=4; button1.line_color=GREEN; LCD_DrawButton(button1); OSTaskResume(TIMER_TASK_PRIO); } else { flag=0; button1.str="start"; button1.len=5; button1.line_color=BLACK; LCD_DrawButton(button1); OSTaskSuspend(TIMER_TASK_PRIO); } } else if(touch.KEY==14) { OSTaskSuspend(TIMER_TASK_PRIO); Show_KeyMap(); OSTaskResume(CURSOR_TASK_PRIO); } else if(touch.KEY==99)//無效輸入 {} else; OSTimeDlyHMSM(0,0,0,50); Led_Off(1); } Exti_Set(1); } }
/************************************************************** * 函数说明:电机参数设置函数 * **************************************************************/ void SetMotor(void) { uint8 esc_flag = 0; uint8 count = 0; Disp_Str_eeprom(1,3,str_speed); Disp_Str_eeprom(2,3,divid); if(run_type == Horizon) { Disp_Str(3,3,"水平"); } else { Disp_Str(3,3,"垂直"); } UserChooseR = 1; UserChooseC = 4; Set_Cursor(UserChooseR,UserChooseC); while(!esc_flag) { if(time_10ms) //10ms定时扫描键盘 { time_10ms = 0; *pRockValue=No_rock; rocker_type = Read_Rocker(pRockValue); if(rocker_type & keyPressed) { switch(*pRockValue) { case Down: UserChooseR ++; if(UserChooseR == 4) { UserChooseR = 1; } break; case Left: UserChooseC --; if(UserChooseC == 2) { UserChooseC = 4; } break; } Set_Cursor(UserChooseR,UserChooseC); } key_value= Read_keyboard(); if(key_value != No_key) { switch(key_value) { case Esc: if(MenuPoint[UserChooseR].ParentMenus != NULL) { MenuPoint = MenuPoint[UserChooseR].ParentMenus; UserChooseR = 0; UserChooseC = 0; //DisplayStart = 0; } esc_flag = 1; break; case OK: //Set_Mode(); break; default: switch(UserChooseR) { case 1: if(UserChooseC==3) { if(count==0) str_speed[0] = key_value + 0x30; else str_speed[1] = key_value + 0x30; } if(UserChooseC==4) { if(count==0) str_speed[2] = key_value + 0x30; else str_speed[3] = key_value + 0x30; } Disp_Str_eeprom(0,3,str_speed); int_speed = Str2Int(str_speed); break; case 2: if(UserChooseC==3) { if(count==0) divid[0] = key_value + 0x30; else divid[1] = key_value + 0x30; } if(UserChooseC==4) { if(count==0) divid[2] = key_value + 0x30; else divid[3] = key_value + 0x30; } Disp_Str_eeprom(2,3,divid); subdiv = Str2Int(divid); break; case 3: //待添加功能 break; } } count = count + 1; if(count==2) count = 0; } } } moto_set(int_speed,subdiv); Clear_Scr(); ShowMenu(); }
/************************************************************** * 函数说明:曝光设置函数 * **************************************************************/ void SetExposure(void) { uint8 esc_flag = 0; Disp_Char(0,5,expos_mode); UserChooseR = 1; Set_Cursor(1,0); while(!esc_flag) { if(time_10ms) //10ms定时扫描键盘 { time_10ms = 0; *pRockValue=No_rock; rocker_type = Read_Rocker(pRockValue); if(rocker_type & keyPressed) { switch(*pRockValue) { case Down: UserChooseR ++; if(UserChooseR == 4) { UserChooseR = 1; } break; case Enter: TempMenu = MenuPoint; Clear_Scr(); if(MenuPoint[UserChooseR].ChildrenMenus != NULL) { MenuPoint = MenuPoint[UserChooseR].ChildrenMenus; //UserChooseR = 0; //DisplayStart = 0; } ShowMenu(); if(TempMenu[UserChooseR].Subs != NULLSubs) { (*TempMenu[UserChooseR].Subs)(); Disp_Char(0,5,expos_mode); } //Clear_Scr(); break; } Set_Cursor(UserChooseR,0); } key_value= Read_keyboard(); if(key_value != No_key) { switch(key_value) { case Esc: if(MenuPoint[UserChooseR].ParentMenus != NULL) { MenuPoint = MenuPoint[UserChooseR].ParentMenus; UserChooseR = 0; UserChooseC = 0; } esc_flag = 1; break; case OK: //Set_Mode(); switch(UserChooseR) { case 1: expos_mode = camera; break; case 2: expos_mode = sensor; break; case 3: expos_mode = fixed; break; } break; } Disp_Char(0,5,expos_mode); Set_Cursor(UserChooseR,0); } } } Clear_Scr(); ShowMenu(); }
/************************************************************** * 函数说明:拍摄设置函数 * **************************************************************/ void SetShootPlan(void) { uint8 esc_flag = 0; uint8 count = 0; Disp_Str_eeprom(0,5,images); Disp_Str_eeprom(1,5,interval); Disp_Str_eeprom(2,5,step); Disp_Str_eeprom(3,5,dist); UserChooseR = 0; UserChooseC = 6; Set_Cursor(UserChooseR,UserChooseC); while(!esc_flag) { if(time_10ms) //10ms定时扫描键盘 { time_10ms = 0; *pRockValue=No_rock; rocker_type = Read_Rocker(pRockValue); if(rocker_type & keyPressed) { switch(*pRockValue) { case Down: UserChooseR ++; if(UserChooseR == 4) { UserChooseR = 0; } break; case Left: UserChooseC --; if(UserChooseC == 4) { UserChooseC = 6; } break; } Set_Cursor(UserChooseR,UserChooseC); } key_value= Read_keyboard(); if(key_value != No_key) { switch(key_value) { case Esc: if(MenuPoint[UserChooseR].ParentMenus != NULL) { MenuPoint = MenuPoint[UserChooseR].ParentMenus; UserChooseR = 0; UserChooseC = 0; //DisplayStart = 0; } esc_flag = 1; break; case OK: //Set_Mode(); break; default: switch(UserChooseR) { case 0: if(UserChooseC==5) { if(count==0) images[0] = key_value + 0x30; else images[1] = key_value + 0x30; } if(UserChooseC==6) { if(count==0) images[2] = key_value + 0x30; else images[3] = key_value + 0x30; } Disp_Str_eeprom(0,5,images); exp_photos = Str2Int(images); break; case 1: if(UserChooseC==5) { if(count==0) interval[0] = key_value + 0x30; else interval[1] = key_value + 0x30; } if(UserChooseC==6) { if(count==0) interval[2] = key_value + 0x30; else interval[3] = key_value + 0x30; } Disp_Str_eeprom(1,5,interval); delay_value = Str2Int(interval); break; case 2: if(UserChooseC==5) { if(count==0) step[0] = key_value + 0x30; else step[1] = key_value + 0x30; } if(UserChooseC==6) { if(count==0) step[2] = key_value + 0x30; else step[3] = key_value + 0x30; } Disp_Str_eeprom(2,5,step); Int_step = Str2Int(step); break; case 3: if(UserChooseC==5) { if(count==0) dist[0] = key_value + 0x30; else dist[1] = key_value + 0x30; } if(UserChooseC==6) { if(count==0) dist[2] = key_value + 0x30; else dist[3] = key_value + 0x30; } Disp_Str_eeprom(3,5,dist); break; } } count = count + 1; if(count==2) count = 0; } } } photo_taken = 0; photo_left = exp_photos; Clear_Scr(); ShowMenu(); }
/************************************************************** * 函数说明:自定义快门设置函数 * **************************************************************/ void SetShutter(void) { uint8 esc_flag = 0; uint8 count = 0; Disp_Str_eeprom(0,5,TV); UserChooseR = 0; UserChooseC = 5; Set_Cursor(UserChooseR,UserChooseC); while(!esc_flag) { if(time_10ms) //10ms定时扫描键盘 { time_10ms = 0; *pRockValue=No_rock; rocker_type = Read_Rocker(pRockValue); if(rocker_type & keyPressed) { switch(*pRockValue) { case Down: UserChooseR ++; if(UserChooseR == 3) { UserChooseR = 0; } break; case Left: UserChooseC --; if(UserChooseC == 4) { UserChooseC = 6; } break; } Set_Cursor(UserChooseR,UserChooseC); } key_value= Read_keyboard(); if(key_value != No_key) { switch(key_value) { case Esc: if(MenuPoint[UserChooseR].ParentMenus != NULL) { MenuPoint = MenuPoint[UserChooseR].ParentMenus; UserChooseR = 1; UserChooseC = 0; //DisplayStart = 0; } esc_flag = 1; break; case OK: Disp_Str(0,7," S"); break; default: switch(UserChooseR) { case 0: if(UserChooseC==5) { if(count==0) TV[0] = key_value + 0x30; else TV[1] = key_value + 0x30; } if(UserChooseC==6) { if(count==0) TV[2] = key_value + 0x30; else TV[3] = key_value + 0x30; } Disp_Str_eeprom(0,5,TV); break; case 1: // break; case 2: // break; } } count = count + 1; if(count==2) count = 0; } } } //expos_value = Str2Int(TV); Clear_Scr(); ShowMenu(); }