// // Arguments : void // Return Type : void // static void c_main_makeHistFutTablewithRear() { emxArray_real_T *y; emxArray_uint8_T *testm; double range; double dims; emxArray_real_T *rmat; emxInitArray_real_T(&y, 2); // Initialize function 'makeHistFutTablewithRearrange' input arguments. // Initialize function input argument 'testm'. testm = argInit_1xUnbounded_uint8_T(); range = argInit_real_T(); dims = argInit_real_T(); // Initialize function input argument 'rmat'. rmat = argInit_Unboundedx1_real_T(); // Call the entry-point 'makeHistFutTablewithRearrange'. makeHistFutTablewithRearrange(testm, range, dims, rmat, y); emxDestroyArray_real_T(y); emxDestroyArray_real_T(rmat); emxDestroyArray_uint8_T(testm); }
// Main function int main (void) { // Local variable definations emxArray_uint8_T *xaxis; emxArray_uint8_T *yaxis; emxArray_uint8_T *norm_xaxis_filt; emxArray_uint8_T *norm_yaxis_filt; uint16_T count; uint8_T xaxis2,yaxis2; long j = 0; int again = 1; char letter; char letterstr[10]; int i=0; letterstr[i] = '\0'; // Variable Initialisation for(j=0;j<MAX_VALUE;j++) { xdata[j] = 0; ydata[j] = 0; } // Function Initialisation PINSEL2 &= ~((1<<2)|(1<<3)); GLCD_Initalize(); //Initialize the LCD Init_UART(); InitADC(); // Welcome message GLCD_ClearScreen(); GLCD_GoTo(10,4); GLCD_WriteString("Intelligent e-book"); // for(j=0;j<999999;j++); delay_ms(2000); // Calibration //Left bottom GLCD_ClearScreen(); GLCD_GoTo(10,0); GLCD_WriteString("Calibration"); GLCD_GoTo(10,4); GLCD_WriteString("Touch the point"); GLCD_GoTo(0,7); GLCD_WriteString("o"); do { xaxis1 = Read_xaxis(); yaxis1 = Read_yaxis(); if(xaxis1<10) xaxis1 = 0; if(yaxis1<10) yaxis1 = 0; }while(xaxis1==0 && yaxis1==0); for(j=0;j<25;j++) capture(); x1 = xaxis1; y1 = yaxis1; GLCD_GoTo(10,5); GLCD_WriteString("Stored"); delay_ms(1000); //Right top GLCD_ClearScreen(); GLCD_GoTo(10,0); GLCD_WriteString("Calibration"); GLCD_GoTo(10,4); GLCD_WriteString("Touch the point"); GLCD_GoTo(120,0); GLCD_WriteString("o"); do { xaxis1 = Read_xaxis(); yaxis1 = Read_yaxis(); if(xaxis1<10) xaxis1 = 0; if(yaxis1<10) yaxis1 = 0; }while(xaxis1==0 && yaxis1==0); for(j=0;j<25;j++) capture(); x2 = xaxis1; y2 = yaxis1; GLCD_GoTo(10,5); GLCD_WriteString("Stored"); delay_ms(1000); while(again==1) { again = 0; // Capturing xaxis and yaxis GLCD_ClearScreen(); GLCD_GoTo(10,0); GLCD_WriteString("Intelligent e-book"); GLCD_GoTo(12,4); GLCD_WriteString("Waiting for input"); do { xaxis1 = Read_xaxis(); yaxis1 = Read_yaxis(); if(xaxis1<10) xaxis1 = 0; if(yaxis1<10) yaxis1 = 0; }while(xaxis1==0 && yaxis1==0); xyelem = 0; count = 0; GLCD_ClearScreen(); GLCD_GoTo(0,0); // Eliminate first 25 samples for(j=0;j<25;j++) capture(); while(count!=250) { capture(); if(xaxis1!=0 && yaxis1!=0 && count==0) { // xaxis2 = (uint8_T)(((xaxis1-80)*255)/730); // yaxis2 = (uint8_T)(((yaxis1-100)*255)/650); xaxis2 = (uint8_T)(((xaxis1-x1)*255)/(x2-x1)); yaxis2 = (uint8_T)(((yaxis1-y1)*255)/(y2-y1)); count = 0; xdata[xyelem] = xaxis2; ydata[xyelem] = yaxis2; xyelem = xyelem + 1; GLCD_SetPixel(xaxis2/2,255-(yaxis2/4),1); if(xyelem>MAX_VALUE - 1) { GLCD_ClearScreen(); GLCD_GoTo(10,0); GLCD_WriteString("Intelligent e-book"); GLCD_GoTo(10,4); GLCD_WriteString("Overflow!!!"); while(1); } } else if(xaxis1!=0 && yaxis1!=0) { xyelem = xyelem - 2; // Eliminate first 25 samples for(j=0;j<25;j++) capture(); count = 0; } else { count = count + 1; } // delay(1000); } GLCD_ClearScreen(); GLCD_GoTo(10,0); GLCD_WriteString("Intelligent e-book"); GLCD_GoTo(0,1); GLCD_WriteString(letterstr); //GLCD_GoTo(10,4); //GLCD_WriteString("Scanning ended"); //delay_ms(500); // Transmitting data to PC // transmit(); // Remove noise remove_noise(); // Allocating space for pointers xaxis = emxCreateWrapper_uint8_T(xdata,1,xyelem); //xdata1 yaxis = emxCreateWrapper_uint8_T(ydata,1,xyelem); //ydata1 emxInit_uint8_T(&norm_xaxis_filt, 2); emxInit_uint8_T(&norm_yaxis_filt, 2); /* GLCD_ClearScreen(); GLCD_GoTo(10,0); GLCD_WriteString("Intelligent e-book"); GLCD_GoTo(0,2); GLCD_WriteString("Step1"); GLCD_GoTo(37,2); GLCD_WriteString("In"); */ // for(j=0;j<999999;j++); step1(xaxis, yaxis, norm_xaxis_filt, norm_yaxis_filt); // GLCD_ClearScreen(); // GLCD_GoTo(10,0); // GLCD_WriteString("Intelligent e-book"); // GLCD_GoTo(54,2); // GLCD_WriteString("Out"); // for(j=0;j<999999;j++); emxDestroyArray_uint8_T(xaxis); emxDestroyArray_uint8_T(yaxis); // GLCD_ClearScreen(); // GLCD_GoTo(10,0); // GLCD_WriteString("Intelligent e-book"); // GLCD_GoTo(0,3); // GLCD_WriteString("Step2"); // GLCD_GoTo(37,3); // GLCD_WriteString("In"); // for(j=0;j<999999;j++); // char_bin is stored in column first fashion... each column vector are concatenated step2(norm_xaxis_filt, norm_yaxis_filt, char_bin); // GLCD_ClearScreen(); // GLCD_GoTo(10,0); // GLCD_WriteString("Intelligent e-book"); // GLCD_GoTo(54,3); // GLCD_WriteString("Out"); // for(j=0;j<999999;j++); emxFree_uint8_T(&norm_xaxis_filt); emxFree_uint8_T(&norm_yaxis_filt); // GLCD_ClearScreen(); // GLCD_GoTo(10,0); // GLCD_WriteString("Intelligent e-book"); // GLCD_GoTo(0,4); // GLCD_WriteString("Step3"); // GLCD_GoTo(37,4); // GLCD_WriteString("In"); // for(j=0;j<999999;j++); for(j=0;j<10;j++) char_vec[j] = 1; step3(char_bin, char_vec); // GLCD_ClearScreen(); // GLCD_GoTo(10,0); // GLCD_WriteString("Intelligent e-book"); // GLCD_GoTo(54,4); // GLCD_WriteString("Out"); // for(j=0;j<999999;j++); for(j=0;j<26;j++) char_vec1[j] = char_vec[j]; // Feeding char_vec to trained neural network char_recog_nn(char_vec1,Y); letter = character(); letterstr[i] = letter; letterstr[i+1] = '\0'; // GLCD_ClearScreen(); // GLCD_GoTo(10,0); // GLCD_WriteString("Intelligent e-book"); // GLCD_GoTo(0,6); // GLCD_WriteString("Letter is: "); GLCD_GoTo(0,1); GLCD_WriteString(letterstr); GLCD_GoTo(0,7); GLCD_WriteString("Continue"); do { xaxis1 = Read_xaxis(); yaxis1 = Read_yaxis(); if(xaxis1<10) xaxis1 = 0; if(yaxis1<10) yaxis1 = 0; }while(xaxis1==0 && yaxis1==0); again = 1; i = i + 1; /* GLCD_ClearScreen(); GLCD_GoTo(10,0); GLCD_WriteString("Intelligent e-book"); GLCD_GoTo(20,4); GLCD_WriteString("Restarting."); delay_ms(200); GLCD_WriteString("."); delay_ms(200); GLCD_WriteString("."); delay_ms(200); GLCD_WriteString("."); */ delay_ms(400); } while(1); }