//搜寻指纹 void Find_Finger(void) { if(Find_Finger_And_Save_ImageBuffer() == 0){ if(Get_Finger_Feature_Save_To_CharBuffer1() == 0){ if(Search_Finger_In_Finlib(0x01,0x0000,0x0050) == 0){ usRegHoldingBuf[0] = FINGER_FOUND; sprintf((char *)Show_find_man_num,"Find man %d!",Person_num); Gui_DrawFont_GBK16(15,80,BLACK,GREEN,(uint8_t *)" "); Gui_DrawFont_GBK16(15,80,BLACK,GREEN,Show_find_man_num); TIP_SUCCESS(); } else { usRegHoldingBuf[0] = FINGER_NOT_FIND; Gui_DrawFont_GBK16(15,80,BLACK,GREEN,(uint8_t *)" "); Gui_DrawFont_GBK16(18,80,BLACK,GREEN,(uint8_t *)"Can`t Find!"); TIP_FAILED(); } } } else { usRegHoldingBuf[0] = NO_FINGER; } }
//检测并录入指纹 void Write_Finger(void) { buffer1: while(Find_Finger_And_Save_ImageBuffer() != 0); while(Get_Finger_Feature_Save_To_CharBuffer1() != 0){goto buffer1;} buffer2: while(Find_Finger_And_Save_ImageBuffer() != 0); while(Get_Finger_Feature_Save_To_CharBuffer2() != 0){goto buffer2;} while(Combine_Finger_Feature() != 0); if(Save_Finger_Form_To_Flash_Position(0x01,ReadEffectiveTemplate()) == 0) { usRegHoldingBuf[0] = FINGER_WRITE_OK; #if DEBUG printf("指纹录入成功\n"); #endif Gui_DrawFont_GBK16(15,80,BLACK,GREEN,(uint8_t *)" "); Gui_DrawFont_GBK16(15,80,BLACK,GREEN,(uint8_t *)"Finger In OK!"); TIP_WRITE_SUCCESS(); } else { usRegHoldingBuf[0] = FINGER_WRITE_FAILD; #if DEBUG printf("指纹录入失败\n"); #endif TIP_WRITE_FAILED(); } }
//删除指纹模板 void Delate_Finger(void) { while(Empty_The_FinLib() != 0); Gui_DrawFont_GBK16(15,80,BLACK,GREEN,(uint8_t *)" "); Gui_DrawFont_GBK16(18,80,BLACK,GREEN,(uint8_t *)"Delate All!"); TIP_DELATE_ALL(); }
/* ********************************************************************************************************* * 函 数 名: DispChInfo * 功能说明: 显示通道信息 * 形 参:无 * 返 回 值: 无 ********************************************************************************************************* */ static void ChInfoDisp(void) { char buf[32]; /* 字符显示缓冲区 */ FONT_T tFont; /* 定义一个字体结构体变量,用于设置字体参数 */ // float tTem; /* 设置字体属性 */ tFont.usFontCode = FC_ST_16X16; /* 字体选择宋体16点阵,高16x宽15) */ tFont.usTextColor = CL_WHITE; /* 字体颜色设置为白色 */ tFont.usBackColor = CL_BLUE; /* 文字背景颜色,蓝色 */ tFont.usSpace = 0; /* 字符水平间距, 单位 = 像素 */ /* 显示示波器程序版本 */ Gui_DrawFont_GBK16(10, 2, "v.0", &tFont); strcpy(buf, "CH1 DC"); sprintf(&buf[7], "3.6V"); tFont.usTextColor = CL_YELLOW; /* 设置字体颜色,黄色 */ tFont.usBackColor = CL_MAGENTA; /* 文字背景颜色,紫色 */ Gui_DrawFont_GBK16(10, 224, buf, &tFont); sprintf(buf, "%.2f",tTemp[3]); Gui_DrawFont_GBK16(100, 224, buf, &tFont); /* 显示时基 */ // tFont.usTextColor = CL_WHITE; /* 设置字体颜色,白色 */ // tFont.usBackColor = CL_BLUE; /* 文字背景颜色,蓝色 */ /* 显示每格多长时间,即时间分度 */ // sprintf(buf, "t:%.1fus", Simple_Tim[g_DsoA.SimpleNum]); // Gui_DrawFont_GBK16(230, 224, buf, &tFont); /* 显示采样频率 */ //sprintf(buf, "f:%7dHz", Simple_Tim[g_DsoA->SimpleNum]); //Gui_DrawFont_GBK16(75, 2, buf, &tFont); }
void TFT_Test() { Color_Test(); Num_Test(); Gui_DrawFont_GBK16(10,50,BLUE,GRAY0,"Test ok."); delay_ms(1000); }
// Digital Compass int main(void) { uint8_t Res; int16_t Com_Data[3]; uint16_t x0, y0; unsigned long angle = 0; double radian; /* Setup the microcontroller system. Initialize the Embedded Flash Interface, initialize the PLL and update the SystemFrequency variable. */ xSysCtlClockSet(72000000, xSYSCTL_OSC_MAIN | xSYSCTL_XTAL_8MHZ); xSysCtlDelay(10000); delay_init(72); Lcd_Init(); HMC5883L_Init(); HMC5883L_Cfg(MODE_SIG | GAIN_1090 | SAMPLE_8 | DATA_RATE_15); Lcd_Clear(GRAY0); // Gui_Circle(64, 80, 50, BLUE); Gui_DrawFont_GBK16(64,14,BLUE,GRAY0,"N"); Gui_DrawFont_GBK16(64,132,BLUE,GRAY0,"S"); Gui_DrawFont_GBK16(5,80,BLUE,GRAY0,"W"); Gui_DrawFont_GBK16(116,80,BLUE,GRAY0,"E"); while(1){ Res = HMC5883L_DataGet(&Com_Data[0], &Com_Data[1], &Com_Data[2]); if(Res) break; angle = (unsigned long) (atan2((double)Com_Data[0],(double)Com_Data[1])*(180/3.14159265)+180); //angle = rand()%360; radian = angle * 3.1415926 / 180; if(angle <= 180){ x0 = 64 + (int16_t)(40 * sin(radian)); y0 = 80 - (int16_t)(40 * cos(radian)); } else { x0 = 64 + (int16_t)(40 * sin(radian)); y0 = 80 - (int16_t)(40 * cos(radian)); } Gui_DrawLine(64, 80, x0, y0, BLUE); delay_ms(500); Gui_DrawLine(64, 80, x0, y0, GRAY0); } return 0; }
//相关初始化 void Init_sth(void) { Lcd_Init(); __HAL_UART_ENABLE_IT(&huart2, UART_IT_IDLE); HAL_GPIO_WritePin(GPIOA,GPIO_PIN_0,GPIO_PIN_SET); Lcd_Clear(GREEN); showimage_farsight(gImage_logo); Gui_DrawFont_GBK16(28,40,BLUE,GREEN,(uint8_t *)"Touch ID"); }
//show clock int main() { /* Setup the microcontroller system. Initialize the Embedded Flash Interface, initialize the PLL and update the SystemFrequency variable. */ xSysCtlClockSet(72000000, xSYSCTL_OSC_MAIN | xSYSCTL_XTAL_8MHZ); xSysCtlDelay(10000); delay_init(72); Lcd_Init(); Lcd_Clear(GRAY0); Gui_DrawFont_GBK16(30,50,BLUE,GRAY0,"Show Clock"); Gui_DrawFont_GBK16(36,70,BLUE,GRAY0,"@ CooCox"); delay_ms(2000); Lcd_Clear(GRAY0); while(1){ Show_Clock(); } }
void Redraw_Mainmenu(void) { Lcd_Clear(GRAY0); Gui_DrawFont_GBK16(16,0,BLUE,GRAY0,"EPI @ CooCox"); Gui_DrawFont_GBK16(16,120,BLUE,GRAY0,"S1:Move. "); Gui_DrawFont_GBK16(16,140,RED,GRAY0, "S2:Sellect "); Gui_DrawFont_Num32(100,125,RED,GRAY0,Num[5]); delay_ms(1000); Gui_DrawFont_Num32(100,125,RED,GRAY0,Num[4]); delay_ms(1000); Gui_DrawFont_Num32(100,125,RED,GRAY0,Num[3]); delay_ms(1000); Gui_DrawFont_Num32(100,125,RED,GRAY0,Num[2]); delay_ms(1000); Gui_DrawFont_Num32(100,125,RED,GRAY0,Num[1]); delay_ms(1000); Gui_DrawFont_Num32(100,125,RED,GRAY0,Num[0]); }
void Num_Test(void) { uint8_t i=0; Lcd_Clear(GRAY0); Gui_DrawFont_GBK16(16,20,RED,GRAY0,"Num Test"); delay_ms(1000); Lcd_Clear(GRAY0); for(i=0;i<10;i++){ Gui_DrawFont_Num32((i%3)*40,32*(i/3)+30,RED,GRAY0,Num[i+1]); delay_ms(100); } }
void Color_Test(void) { uint8_t i = 2; Lcd_Clear(GRAY0); Gui_DrawFont_GBK16(20,10,BLUE,GRAY0,"Color Test"); delay_ms(1000); while(i--){ Lcd_Clear(WHITE); Lcd_Clear(BLACK); Lcd_Clear(RED); Lcd_Clear(GREEN); Lcd_Clear(BLUE); } }