remove dynamic sample speed change
This commit is contained in:
parent
15a478c9aa
commit
f798fd6d03
3 changed files with 0 additions and 47 deletions
23
main.c
23
main.c
|
@ -90,20 +90,6 @@ const float gVoltageScale[VOLTAGE_SCALES] = {
|
|||
0.1, 0.2, 0.5, 1., 2.
|
||||
};
|
||||
|
||||
#define TIME_SCALES 6
|
||||
const char * const gTimeScaleStr[TIME_SCALES] = {
|
||||
"100 ms", "50 ms", "20 ms", " 10 ms", "50 us", "20 us"
|
||||
};
|
||||
|
||||
const uint64_t gTImeScale[TIME_SCALES] = {
|
||||
100 * 1000 / PIXELS_PER_DIV,
|
||||
50 * 1000 / PIXELS_PER_DIV,
|
||||
20 * 1000 / PIXELS_PER_DIV,
|
||||
10 * 1000 / PIXELS_PER_DIV,
|
||||
50 / PIXELS_PER_DIV,
|
||||
20 / PIXELS_PER_DIV,
|
||||
};
|
||||
|
||||
int Trigger(bool rising);
|
||||
|
||||
// start a pwm test signal
|
||||
|
@ -283,14 +269,6 @@ void handle_user_input() {
|
|||
case Down: // previous scale
|
||||
local_options.voltage_scale = (local_options.voltage_scale + VOLTAGE_SCALES - 1) % VOLTAGE_SCALES;
|
||||
break;
|
||||
case Right: // next scale
|
||||
local_options.time_scale = (local_options.time_scale + 1) % TIME_SCALES;
|
||||
set_frequency(gTImeScale[local_options.time_scale]);
|
||||
break;
|
||||
case Left: // previous scale
|
||||
local_options.time_scale = (local_options.time_scale + TIME_SCALES - 1) % TIME_SCALES;
|
||||
set_frequency(gTImeScale[local_options.time_scale]);
|
||||
break;
|
||||
}
|
||||
|
||||
Semaphore_pend(options_sem, BIOS_WAIT_FOREVER);
|
||||
|
@ -336,7 +314,6 @@ void display_waveform(UArg arg1, UArg arg2)
|
|||
// info
|
||||
GrContextForegroundSet(&sContext, ClrWheat);
|
||||
GrStringDraw(&sContext, gVoltageScaleStr[local_options.voltage_scale], /*length*/ -1, /*x*/ 0, /*y*/ 0, /*opaque*/ false);
|
||||
GrStringDraw(&sContext, gTimeScaleStr[local_options.time_scale], /*length*/ -1, /*x*/ 60, /*y*/ 0, /*opaque*/ false);
|
||||
snprintf(str, sizeof(str), "CPU Load %.1f%%", usage_percent);
|
||||
GrStringDraw(&sContext, str, /*length*/ -1, /*x*/ 0, /*y*/ HEIGHT - 10, /*opaque*/ false);
|
||||
|
||||
|
|
24
sampling.c
24
sampling.c
|
@ -119,8 +119,6 @@ void start_sampler() {
|
|||
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
|
||||
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC1);
|
||||
|
||||
// timer for low-speed
|
||||
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER2);
|
||||
// ADC clock
|
||||
uint32_t pll_frequency = SysCtlFrequencyGet(CRYSTAL_FREQUENCY);
|
||||
uint32_t pll_divisor =
|
||||
|
@ -145,25 +143,3 @@ void start_sampler() {
|
|||
ADCSequenceDMAEnable(ADC1_BASE, 0); // enable DMA for ADC1 sequence 0
|
||||
ADCIntEnableEx(ADC1_BASE, ADC_INT_DMA_SS0); // enable ADC1 sequence 0 DMA interrupt
|
||||
}
|
||||
|
||||
void set_frequency(uint64_t microseconds) {
|
||||
if (microseconds == 1) {
|
||||
ADCSequenceDisable(ADC1_BASE, 0);
|
||||
// don't use a timer for high speed
|
||||
ADCSequenceConfigure(ADC1_BASE, 0, ADC_TRIGGER_ALWAYS, 0);
|
||||
ADCSequenceEnable(ADC1_BASE, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
// initialize timer 2 in periodic mode
|
||||
TimerDisable(TIMER2_BASE, TIMER_BOTH);
|
||||
TimerConfigure(TIMER2_BASE, TIMER_CFG_PERIODIC);
|
||||
#define MICROSECONDS_PER_SECOND 1000000
|
||||
TimerLoadSet(TIMER2_BASE, TIMER_A, (uint32_t) ((uint64_t) gSystemClock * microseconds / MICROSECONDS_PER_SECOND) - 1);
|
||||
TimerControlTrigger(TIMER2_BASE, TIMER_A, true);
|
||||
TimerEnable(TIMER2_BASE, TIMER_A);
|
||||
|
||||
ADCSequenceDisable(ADC1_BASE, 0);
|
||||
ADCSequenceConfigure(ADC1_BASE, 0, ADC_TRIGGER_TIMER, 0);
|
||||
ADCSequenceEnable(ADC1_BASE, 0);
|
||||
}
|
||||
|
|
Binary file not shown.
Loading…
Reference in a new issue