Other Parts Discussed in Thread: CC2650
Hi everyone
My application needs to collect data from three different sources:
- Micophone (at the moment the light sensor on the evaluation board): I need to take a sample every 70us
- Temperature: A few (ca 5) times per second is enough
- Battery voltage: A few times per second is enough
My system:
CC2650, SmartRF06EB
At the moment, this is the code for the sensor controller:
// Power up the light sensor and wait for it to get ready
gpioSetOutput(AUXIO_O_ALS_POWER);
fwDelayUs(1000, FW_DELAY_RANGE_1_MS);
// Select ADC input
adcSelectGpioInput(AUXIO_A_SENSOR_OUTPUT);
// Enable the ADC
adcEnableAsync(ADC_REF_FIXED, ADC_TRIGGER_AUX_TIMER0);
adcStartAuxTimer0Trigger(70);
// Loop until the application sets the exit flag
while (state.exit == 0) {
// Wait for the next ADC sample and store it
U16 n = state.head;
adcReadFifo(state.newValue);
if (state.samplingEnabled == 1) {
output.pSamples[n] = state.newValue;
// Update the head index
utilIncrAndWrap(n, BUFFER_SIZE; state.head);
// Calculate the number of samples currently stored
S16 count = state.head - state.tail;
if (count < 0) {
count += BUFFER_SIZE;
}
if (count >= 760) {
state.tail = 0;
state.head = 0;
state.samplingEnabled = 0;
adcFlushFifo();
state.overflow = state.overflow + 1;
}
} else {
adcFlushFifo();
}
}
At the moment I sample only the values from the light sensor/micophone. How can I modify this code such that a few times per second I also take a sample from the temperature sensor and the battery voltage without disturbing the sampling instances of the sound/light signal?
Ideas:
- Create a second task in sensor controller studio that is responsible for the temperature/battery voltage measurement.
- I think that I am supposed to use adcSelectGpioInput(...), but won't that disturb the sound measurements?
Can anybody give me a hint how to solve this problem. I did not found an example/explaination how to handle it in the data sheet, technical reference or the sensor controller studio help.