Hi everyone,
Could you please answer me a question about
interface
Msp430Adc12MultiChannel?
"buffer" appears in both command
configure and event dataReady, what is the relationship between these
two "buffer"s, same or not?
Thanks a lot.
PS: Could someone kindly help solve another
problem: I use the following codes to sample two channels, what is the
relationship between buf in command configure and buffer in event
dataReady? why if I use buf to assign values to local.readings, only the
first two entries have values and others are all zeros?
implementation
{
const msp430adc12_channel_config_t config =
{INPUT_CHANNEL_A3, REFERENCE_AVcc_AVss, REFVOLT_LEVEL_NONE,
SHT_SOURCE_SMCLK, SHT_CLOCK_DIV_1, SAMPLE_HOLD_4_CYCLES,
SAMPCON_SOURCE_ACLK, SAMPCON_CLOCK_DIV_1};
adc12memctl_t memctl = {SUPPLY_VOLTAGE_HALF_CHANNEL,
REFERENCE_AVcc_AVss};
#define NUM_SAMPLES 48
uint8_t
nummemctl = 1;
uint16_t buf[NUM_SAMPLES];
uint16_t i;
void task getData();
oscilloscope_t local;
event void Boot.booted() {
post getData();
}
void task getData()
{
call
Resource.request();
}
event void Resource.granted()
{
if (call MultiChannel.configure(&config, &memctl,
nummemctl, buf, NUM_SAMPLES, 1024) == SUCCESS)
{
if (call MultiChannel.getData() != SUCCESS)
report_problem();
}
}
async event void
MultiChannel.dataReady(uint16_t *buffer, uint16_t numSamples)
{
if (numSamples != NUM_SAMPLES)
report_problem();
atomic
{
for (i = 0;
i < numSamples; i++) {
local.readings[i] = buf[i];
}
}
if (call MultiChannel.getData() != SUCCESS)
report_problem();
}
--
Sincerely,
Shane
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help