works pretty well... integration time actually works.. need to work on the analog read stuff.. need to also work on data compression.... need to also work on making a continuous read and data dump......should be possible since the threads don't conflict..
Diff: main.cpp
- Revision:
- 1:37f04be9c0fa
- Parent:
- 0:e5d6563899d5
- Child:
- 2:75c8a8b6b872
--- a/main.cpp Thu Oct 23 00:08:09 2014 +0000 +++ b/main.cpp Thu Oct 23 01:03:49 2014 +0000 @@ -43,14 +43,14 @@ #define transition_5 2 // rise of sh for t3 0010 -- stretch here to increase integration time (must cycle masterClock) #define transition_6 10 // t3 masterHigh 1010 -- stretch here to increase integration time (must cycle masterClock) #define transition_7 2 // t3 masterLow 0010 -#define transition_8 8 // t1 masterHigh 1000 -#define transition_9 0 // t2 masterLow 0000 +#define transition_8 8 // t1 masterHigh 1000 -- repeat +#define transition_9 0 // t1 masterLow 0000 -- repeat #define transition_10 12 // t4 masterHigh 1100 #define transition_11 4 // t4 masterLow 0100 -- repeat from here //define variables int pixelCount; -int sensitivity = 1; +int sensitivity = 10000; double pixelData; float firmwareVersion = 0.5; double pixelValue[signalElements] = { 0 }; @@ -86,28 +86,53 @@ void dataXfer_thread(void const *args){ while(1){ - osSignalWait(0x1, osWaitForever); - redLED = 1; + osSignalWait(0x2, osWaitForever); +// if (trigger == 1){ + blueLED = 1; // for (int pixelNumber=0; pixelNumber<signalElements; pixelNumber++) { // raspi.printf("%i\t%4.12f\r\n", pixelNumber, 5 - ((pixelValue[pixelNumber - 1] * 5) / 4096.0)); // osDelay(100); // } - printInfo(); + printf("Done.\r\n"); + blueLED = 0; +// } osDelay(1000); - redLED = 0; } } void imaging_thread(void const *args){ while(1){ - osSignalWait(0x1, osWaitForever); - blueLED = !blueLED; - osDelay(30); + osSignalWait(0x1, osWaitForever);// m icg sh trg + tcd1304dg_clocks = transition_1; // | | | | + tcd1304dg_clocks = transition_2; // | | | | + tcd1304dg_clocks = transition_3; // | | | | + tcd1304dg_clocks = transition_4; // | | | | + for(int mcInc = 1; mcInc < sensitivity; mcInc++ ){ + tcd1304dg_clocks = transition_5; // | | | | + tcd1304dg_clocks = transition_6; // | | | | + } + tcd1304dg_clocks = transition_7; // | | | | + for(int mcInc = 1; mcInc < 80; mcInc++ ){ + tcd1304dg_clocks = transition_8; // | | | | + tcd1304dg_clocks = transition_9; // | | | | + } + for(int mcInc = 1; mcInc < pixelTotal; mcInc++ ){ +// pixelCount++; + tcd1304dg_clocks = transition_10; // | | | | + tcd1304dg_clocks = transition_11; // | | | | +// pixelValue[pixelCount] = pixelIn.read_u16(); + tcd1304dg_clocks = transition_10; // | | | | + tcd1304dg_clocks = transition_11; // | | | | + } +// osDelay(30); + tcd1304dg_clocks = 13; +// osDelay(100); } } //define threads for imaging and data transfer osThreadDef(imaging_thread, osPriorityRealtime, DEFAULT_STACK_SIZE); +//osThreadDef(imaging_thread, osPriorityAboveNormal, DEFAULT_STACK_SIZE); osThreadDef(dataXfer_thread, osPriorityNormal, DEFAULT_STACK_SIZE); void init(){ @@ -131,18 +156,18 @@ //command interpreter while(true){ - led =!led; + redLED =!redLED; char c = raspi.getc(); switch (c) { case 'r': osSignalSet(img, 0x1); break; case 'i': - osSignalSet(xfr, 0x1); + osSignalSet(xfr, 0x2); break; default: break; } - osDelay(10); +// osDelay(10); } } \ No newline at end of file