/* Get a frame from the camera. Serial protocol char: I */ void get_frame () { unsigned char ch; move_image((unsigned char *)DMA_BUF1, (unsigned char *)DMA_BUF2, (unsigned char *)FRAME_BUF, imgWidth, imgHeight); if (overlay_flag) { frame[9] = (framecount % 10) + 0x30; frame[8] = ((framecount/10)% 10) + 0x30; frame[7] = ((framecount/100)% 10) + 0x30; set_caption(frame, imgWidth); } output_start = (unsigned char *)JPEG_BUF; output_end = encode_image((unsigned char *)FRAME_BUF, output_start, quality, FOUR_TWO_TWO, imgWidth, imgHeight); image_size = (unsigned int)(output_end - output_start); led1_on(); framecount++; uart0SendString(imgHead); uart0SendChar((unsigned char)(image_size & 0x000000FF)); uart0SendChar((unsigned char)((image_size & 0x0000FF00) >> 8)); uart0SendChar((unsigned char)((image_size & 0x00FF0000) >> 16)); uart0SendChar(0x00); cp = (unsigned char *)JPEG_BUF; for (i=0; i<image_size; i++) { while (*pPORTHIO & 0x0001) { continue; } uart0SendChar(*cp++); } while (uart0GetChar(&ch)) { // flush input continue; } }
int input() { char ch; start_check(); uart0GetChar(&ch); finish_check(); return (unsigned int)ch; }
static int uart0GetCharStd(FILE *stream) { if (uart0IsChar()) return uart0GetChar(); return EOF; }