short invert_state()
{
    if (config_state == 1) {
	stonycam.clearTestConfig();
	return 0;
    } else {
	stonycam.setTestConfig();
	return 1;
    }
}
void subsampleCaptureAndTx()
{
   const int NUM_SUBSAMPLE = 69;
   const int PIN_FLAG = 1;
   short i;
   short pixels[NUM_SUBSAMPLE];

   unsigned char rowlocs[] = { 1 , 2 , 2 , 3 , 4 , 4 , 7 , 9 , 14 , 16 , 16 , 19 , 21 , 23 , 30 , 31 , 32 , 32 , 33 , 34 , 34 , 37 , 38 , 41 , 43 , 44 , 49 , 49 , 49 , 51 , 52 , 56 , 56 , 58 , 65 , 68 , 69 , 69 , 70 , 71 , 74 , 75 , 77 , 77 , 78 , 81 , 83 , 83 , 83 , 85 , 87 , 87 , 88 , 88 , 91 , 92 , 93 , 95 , 97 , 101 , 101 , 102 , 102 , 104 , 104 , 108 , 108 , 109 , 111 };
   unsigned char collocs[] = { 54 , 36 , 68 , 54 , 24 , 74 , 54 , 81 , 101 , 3 , 67 , 54 , 93 , 47 , 1 , 101 , 55 , 69 , 54 , 48 , 68 , 54 , 34 , 15 , 22 , 50 , 39 , 67 , 90 , 68 , 22 , 27 , 42 , 54 , 88 , 90 , 7 , 32 , 54 , 60 , 75 , 57 , 12 , 55 , 54 , 85 , 1 , 28 , 64 , 68 , 7 , 69 , 54 , 73 , 54 , 7 , 94 , 50 , 69 , 50 , 84 , 54 , 90 , 52 , 54 , 54 , 72 , 54 , 56 };
   
   digitalWriteFast(PIN_FLAG,1);
   stonycam.getPixelList( pixels, rowlocs, collocs, NUM_SUBSAMPLE );
   digitalWriteFast(PIN_FLAG,0);

   for (i = 0; i < NUM_SUBSAMPLE; i++)
	Serial.print((char)(pixels[i]));
}
void frameCaptureAndTx()
{
   short ii,jj,mm;
   short imrow[112];
   char  imrowsc[112];

   digitalWriteFast(PIN_FLAG,1);
   // russ: for debugging
   //for(ii=0; ii<112*112; ++ii) Serial.print((char)0);
   for(ii = 0; ii < 56; ++ii)
   {
      for(mm = 0; mm < 112; ++mm)
      {
      	imrow[mm] = 0;
      }
      stonycam.getImage(imrow,ii,1,1,0,112,1);
      // FIXME russ: not efficient
      for(jj = 0; jj < 56; ++jj)
      {
         //imrowsc[jj]=255-imrow[jj]+stonymask[(112*ii)+jj];
         //imrowsc[jj]=imrow[jj]-stonymask[(112*ii)+jj];
         // russ: try this if the masked version is not working
         //imrowsc[jj]=128-imrow[jj];
         
	// addison: use this one!
	//if ((char)(imrow[jj]) == '\n')
	//	Serial.print((char)1);
	//else
		//if(imrow[jj]>255){
		//	delay(500);
		//	digitalWrite(PIN_LED,1);
		//	delay(500);
		//	digitalWrite(PIN_LED,0);
		//}
//		Serial.print((char)(imrow[jj]));
//		Serial.print((char)(imrow[jj]>>8));
//		imrow[jj] = 0;
        Serial.print((char)1);
        Serial.print((char)1);
      }
      //Serial.print((char)ii);
   }
   digitalWriteFast(PIN_FLAG,0);
}
示例#4
0
void setup()
{
   DataConn.begin(BAUDRATE);
   gFlagCaptureRunning = 0;
   pinMode(13,OUTPUT);
   digitalWriteFast(PIN_LED,1);

   // raw: for 5v0
   //(void)stonycam.init( PIN_RESP, PIN_INCP, PIN_RESV, PIN_INCV, PIN_INPHI, PIN_ANALOG1, PIN_ANALOG2,
   //                     Stonyman::DEFAULT_VREF_5V0, Stonyman::DEFAULT_NBIAS_5V0,
   //                     Stonyman::DEFAULT_AOBIAS_5V0, Stonyman::DEFAULT_GAIN_5V0,
   //                     Stonyman::DEFAULT_SELAMP_5V0 );
   // amp: for 3v3
   //(void)stonycam.init( PIN_RESP, PIN_INCP, PIN_RESV, PIN_INCV, PIN_INPHI, PIN_ANALOG1, PIN_ANALOG2,
   //                     37,48,48,1,1);
   // russ: Boyan's values
   (void)stonycam.init( PIN_RESP, PIN_INCP, PIN_RESV, PIN_INCV, PIN_INPHI, PIN_ANALOG1, PIN_ANALOG2,
                        SMH_VREF_3V3,SMH_NBIAS_3V3,SMH_AOBIAS_3V3,SMH_GAIN_3V3,
                        SMH_SELAMP_3V3);
}
void setup()
{
   Serial.begin(BAUDRATE);
   pinMode(13,OUTPUT);
   pinMode(1,OUTPUT);
   digitalWrite(1,0);
   digitalWrite(PIN_LED,1);

   // raw: for 5v0
   //(void)stonycam.init( PIN_RESP, PIN_INCP, PIN_RESV, PIN_INCV, PIN_INPHI, PIN_ANALOG,
   //                     Stonyman::DEFAULT_VREF_5V0, Stonyman::DEFAULT_NBIAS_5V0,
   //                     Stonyman::DEFAULT_AOBIAS_5V0, Stonyman::DEFAULT_GAIN_5V0,
   //                     Stonyman::DEFAULT_SELAMP_5V0 );
   // amp: for 3v3
   //(void)stonycam.init( PIN_RESP, PIN_INCP, PIN_RESV, PIN_INCV, PIN_INPHI, PIN_ANALOG,
   //                     35,50,50,1,1); // amp: for 3v3
   // russ: Boyan's values
   (void)stonycam.init( PIN_RESP, PIN_INCP, PIN_RESV, PIN_INCV, PIN_INPHI, PIN_ANALOG,
                        SMH_VREF_3V3,SMH_NBIAS_3V3,SMH_AOBIAS_3V3,SMH_GAIN_3V3,
                        SMH_SELAMP_3V3);
}
示例#6
0
void frameCaptureAndTx()
{
   short ii,jj;
   short imrow1[112];
   char  imrowsc1[112];
   short imrow2[112];
   char  imrowsc2[112];

   DataConn.print(SYMBOL_SOF);
   DataConn.print(OPCODE_FRAME);

   // russ: for debugging
   //for(ii=0; ii<112*112*2; ++ii) DataConn.print(0);
   for(ii = 0; ii < 112; ++ii)
   {
      //if(ii == (112/2-1)) DataConn.print(OPCODE_FRAME);
      stonycam.getDualImages(imrow1,imrow2,ii,1,1,0,112,1);
      // FIXME russ: not efficient
      for(jj = 0; jj < 112; ++jj)
      {
         //imrowsc1[jj]=255-imrow1[jj]+stonymask1[(112*ii)+jj];
         imrowsc1[jj]=imrow1[jj]-stonymask1[(112*ii)+jj];
         // russ: try this if the masked version is not working
         //imrowsc2[jj]=imrow2[jj]-128;
         DataConn.print((char)(imrowsc1[jj]));
      }
      for(jj = 0; jj < 112; ++jj)
      {
         //imrowsc2[jj]=255-imrow2[jj]+stonymask2[(112*ii)+jj];
         imrowsc2[jj]=imrow2[jj]-stonymask2[(112*ii)+jj];
         // russ: try this if the masked version is not working
         //imrowsc2[jj]=imrow2[jj]-128;
         DataConn.print((char)(imrowsc2[jj]));
      }
   }
}