Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.81 KB | None | 0 0
  1. void processFrame() {
  2.   startNewFrame(uartPixelFormat);
  3.  
  4.   camera.waitForVsync();
  5.  
  6.   for (uint16_t y = 0; y < lineCount; y++) {
  7.     lineBufferIndex = 0;
  8.     uint8_t sendWhileReadCounter = 0;
  9.  
  10.     lineBuffer[0] = 0; // first byte from Camera is half a pixel
  11.  
  12.     for (uint16_t x = 1; x < lineLength * 2 + 1; x++) {
  13.       // start sending first bytes while reading pixels from camera
  14.       if (uartSendWhileReadingCount > 0) {
  15.         if (sendWhileReadCounter) {
  16.           sendWhileReadCounter--;
  17.         } else {
  18.           sendNextPixelByte();
  19.           sendWhileReadCounter = uartSendWhileReadingCount;
  20.         }
  21.       }
  22.       camera.waitForPixelClockRisingEdge();
  23.       camera.readPixelByte(lineBuffer[x]);
  24.     }
  25.  
  26.     while (lineBufferIndex < lineLength * 2) {
  27.       sendNextPixelByte();
  28.     }
  29.   }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement