Skip to content

Instantly share code, notes, and snippets.

@xorrbit
Created November 16, 2012 03:46
Show Gist options
  • Save xorrbit/4083851 to your computer and use it in GitHub Desktop.
Save xorrbit/4083851 to your computer and use it in GitHub Desktop.
FOR THE DOCTOR
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/adc.h"
void main(void) {
unsigned long ulValue;
//
// Enable the first sample sequencer to capture the value of channel 0 when
// the processor trigger occurs.
//
ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR, 0);
ADCSequenceStepConfigure(ADC0_BASE, 0, 0,
ADC_CTL_IE | ADC_CTL_END | ADC_CTL_CH0);
ADCSequenceEnable(ADC0_BASE, 0);
//
// Trigger the sample sequence.
//
ADCProcessorTrigger(ADC0_BASE, 0);
//
// Wait until the sample sequence has completed.
//
while(!ADCIntStatus(ADC0_BASE, 0, false))
{
}
//
// Read the value from the ADC.
//
ADCSequenceDataGet(ADC0_BASE, 0, &ulValue);
for(;;); // loop forever cause WE COOL LIKE THAT
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment