Clare Coleman
/
UTCSBootcamp
Wrapped Freescale Cup code for the UT CS summer boot camp.
Diff: TFC.cpp
- Revision:
- 4:4233d072b5af
- Parent:
- 0:2010bcffbae0
--- a/TFC.cpp Thu Aug 22 21:52:21 2013 +0000 +++ b/TFC.cpp Fri Aug 23 00:38:23 2013 +0000 @@ -370,7 +370,7 @@ TFC_InitLineScanCamera(); TFC_InitServos(SERVO_MIN_PULSE_WIDTH_DEFAULT , SERVO_MAX_PULSE_WIDTH_DEFAULT, SERVO_DEFAULT_PERIOD); - + TFC_ServoTicker = 0; TFC_InitMotorPWM(FTM0_DEFAULT_SWITCHING_FREQUENCY); @@ -756,7 +756,7 @@ //The pump will be primed with the TPM1 interrupt. upon timeout/interrupt it will set the SI signal high //for the camera and then start the conversions for the pots. - // NVIC_SetVector(ADC0_IRQn,(uint32_t)ADC0_Handler); + // NVIC_SetVector(ADC0_IRQn,(uint32_t)ADC0_Handler); NVIC_EnableIRQ(ADC0_IRQn); } @@ -909,9 +909,9 @@ //1st, set the clock mux //See Page 124 of f the KL25 Sub-Family Reference Manual, Rev. 3, September 2012 - // SIM->SOPT2 |= SIM_SOPT2_PLLFLLSEL_MASK;// We Want MCGPLLCLK/2 (See Page 196 of the KL25 Sub-Family Reference Manual, Rev. 3, September 2012) - // SIM->SOPT2 &= ~(SIM_SOPT2_TPMSRC_MASK); - // SIM->SOPT2 |= SIM_SOPT2_TPMSRC(1); //We want the MCGPLLCLK/2 (See Page 196 of the KL25 Sub-Family Reference Manual, Rev. 3, September 2012) + // SIM->SOPT2 |= SIM_SOPT2_PLLFLLSEL_MASK;// We Want MCGPLLCLK/2 (See Page 196 of the KL25 Sub-Family Reference Manual, Rev. 3, September 2012) + // SIM->SOPT2 &= ~(SIM_SOPT2_TPMSRC_MASK); + // SIM->SOPT2 |= SIM_SOPT2_TPMSRC(1); //We want the MCGPLLCLK/2 (See Page 196 of the KL25 Sub-Family Reference Manual, Rev. 3, September 2012) //Enable the Clock to the FTM0 Module @@ -986,3 +986,41 @@ { return (((float)BatSenseADC_Value/(float)(ADC_MAX_CODE)) * 3.0);// * ((47000.0+10000.0)/10000.0); } + +extern volatile uint8_t TFC_LineScanCameraDataReady; + +Serial pc2(USBTX,USBRX); +float init2() +{ + pc2.baud(38400); + return 0; +} + +float getLine() +{ +// if (TFC_LineScanCameraDataReady != 0) +// return -1; + static int count = 0; +// count++; + int channel = TFC_PUSH_BUTTON_0_PRESSED ? 1 : 0; + int flip = TFC_PUSH_BUTTON_1_PRESSED ? 1 : 0; +// uint8_t* parray = TFC_LineScanCameraData(array); + for (int i=0; i<128; i++) { + uint8_t n = TFC_LineScanCameraData[0][i]; + if (n==2) + pc2.printf(" ") ; + else + pc2.printf("%d",n) ; + } + pc2.printf("\r\n"); + for (int i=0; i<128; i++) { + uint8_t n = TFC_LineScanCameraData[0][i]; + if (n==2) + pc2.printf(" ") ; + else + pc2.printf("%d",n) ; + } + pc2.printf("\r\n"); + + return 0; +} \ No newline at end of file