Same as mallet... but distance
Dependencies: EthernetInterface NetworkAPI mbed-rtos mbed
Fork of MalletFirmware by
Revision 30:1da0bb9c31a6, committed 2014-12-09
- Comitter:
- willange
- Date:
- Tue Dec 09 17:37:12 2014 +0000
- Parent:
- 29:e6309316c35d
- Commit message:
- a basic timer
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r e6309316c35d -r 1da0bb9c31a6 main.cpp --- a/main.cpp Tue Dec 09 16:36:50 2014 +0000 +++ b/main.cpp Tue Dec 09 17:37:12 2014 +0000 @@ -99,9 +99,9 @@ DigitalIn AMT20_B(PTC1); // input for quadrature encoding from angle encoder // Analog sampling -//Ticker Sampler; -//Timer timer; -//Timer timeStamp; +Ticker Sampler; +Timer timer; +Timer timeStamp; AnalogIn A0_pin(A0); AnalogIn A2_pin(A2); @@ -197,7 +197,7 @@ // Start the sampling loop current_sample_index = WAITING_TO_BEGIN; - //Sampler.attach_us(&timed_sampling, SAMPLING_RATE); + Sampler.attach_us(&timed_sampling, SAMPLING_RATE); //NVIC_SetPriority(TIMER3_IRQn,0); //pc.printf("Ticker IRQ: %i\r\n", Sampler.irq()); @@ -355,10 +355,10 @@ for(int i = 0; i < TOTAL_SAMPLES; i++) { SampleInd = !SampleInd; - sample_array1[i] = adc_hal_get_conversion_value(0, 0); - sample_array2[i] = adc_hal_get_conversion_value(1, 0); - BW_ADC_SC1n_ADCH(0, 0, kAdcChannel12); // This corresponds to starting an ADC conversion on channel 12 of ADC 0 - which is A0 (PTB2) - BW_ADC_SC1n_ADCH(1, 0, kAdcChannel14); // This corresponds to starting an ADC conversion on channel 14 of ADC 1 - which is A2 (PTB10) + //sample_array1[i] = adc_hal_get_conversion_value(0, 0); + //sample_array2[i] = adc_hal_get_conversion_value(1, 0); + //BW_ADC_SC1n_ADCH(0, 0, kAdcChannel12); // This corresponds to starting an ADC conversion on channel 12 of ADC 0 - which is A0 (PTB2) + //BW_ADC_SC1n_ADCH(1, 0, kAdcChannel14); // This corresponds to starting an ADC conversion on channel 14 of ADC 1 - which is A2 (PTB10) // The following updates the rotary counter for the AMT20 sensor // Put A on PTC0 @@ -459,6 +459,7 @@ void timed_sampling() { SampleInd = 1; + pc.printf("TICKER!\n"); //__disable_irq(); // Disable Interrupts //timeStamp.start(); /*