Interface: moteiv.tos.platform.msp430.adc.ADCMultiple

interface ADCMultiple

Commands
command adcresult_t getData(uint16_t *buf, uint16_t length) Initiates a series of, i.e.
command adcresult_t getDataContinuous(uint16_t *buf, uint16_t length) Initiates a series of, i.e.
command adcresult_t reserve(uint16_t *buf, uint16_t length) Reserves the ADC for a series of conversions.
command adcresult_t reserveContinuous(uint16_t *buf, uint16_t length) Reserves the ADC for a series of conversions in repeat mode.
command adcresult_t unreserve() Cancels a reservation made by reserve or reserveRepeat.

Events
event uint16_t *dataReady(adcresult_t result, uint16_t *buf, uint16_t length) Conversion results from call to getData or getDataContinuous are ready.

Commands - Details

getData

command adcresult_t getData(uint16_t *buf, uint16_t length)

Initiates a series of, i.e. multiple successive conversions. The length of a series must match and is only bounded by the size of the buffer. An event dataReady is signalled when the buffer is filled with conversion results. Successive conversions are performed as quickly as possible.

Parameters:
buf - Buffer to store the conversion results. Ignored if reserve was called successfully before, because then those settings are applicable.
length - The size of the buffer and number of conversions. Ignored if reserve was called successfully before, because then those settings are applicable.
Returns:
ADC_SUCCESS if the ADC is free and available to accept the request, error code otherwise (see ADCHIL.h).

getDataContinuous

command adcresult_t getDataContinuous(uint16_t *buf, uint16_t length)

Initiates a series of, i.e. multiple successive conversions, in repeat mode, i.e. continuously. After each series of conversions is performed an event dataReady is signalled with the conversion results. This continues until the eventhandler returns FAIL.

Parameters:
buf - Buffer to store the conversion results. Ignored if reserveContinuous was called successfully before, because then those settings are applicable.
length - The size of the buffer and number of conversions. Ignored if reserveContinuous was called successfully before, because then those settings are applicable.
Returns:
ADC_SUCCESS if the ADC is free and available to accept the request, error code otherwise (see ADCHIL.h).

reserve

command adcresult_t reserve(uint16_t *buf, uint16_t length)

Reserves the ADC for a series of conversions. If this call succeeds the next call to getData will also succeed and the first corresponding conversion will then be started with a minimum latency.

Returns:
ADC_SUCCESS if reservation was successful, error code otherwise (see ADCHIL.h).

reserveContinuous

command adcresult_t reserveContinuous(uint16_t *buf, uint16_t length)

Reserves the ADC for a series of conversions in repeat mode. If this call succeeds the next call to getDataRepeat will also succeed and the first corresponding conversion will then be started with a minimum latency.

Returns:
ADC_SUCCESS if reservation was successful, error code otherwise (see ADCHIL.h).

unreserve

command adcresult_t unreserve()

Cancels a reservation made by reserve or reserveRepeat.

Returns:
ADC_SUCCESS if reservation was cancelled successfully, error code otherwise (see ADCHIL.h).

Events - Details

dataReady

event uint16_t *dataReady(adcresult_t result, uint16_t *buf, uint16_t length)

Conversion results from call to getData or getDataContinuous are ready. In the first case the returned value is ignored, in the second it defines whether any further conversions will be made or not.

Parameters:
result - ADC_SUCCESS if the conversions were performed successfully and the results are valid, error code otherwise (see ADCHIL.h).
buf - The address of the conversion results, identical to buf passed to getData or reserveContinuous .
length - Size of the buffer, identical to length passed to getData or reserveContinuous .
Returns:
0 (nullpointer) stops further conversions in continuous mode, otherwise the pointer points to a buffer of the same length where the next conversion results are to be stored in continuous mode (ignored if not in continuous mode).