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

interface ADCSingle

Commands
command adcresult_t getData() Initiates one single conversion.
command adcresult_t getDataContinuous() Initiates conversions in repeat mode, ie.
command adcresult_t reserve() Reserves the ADC for one single conversion.
command adcresult_t reserveContinuous() Reserves the ADC for continuous conversions.
command adcresult_t unreserve() Cancels a reservation made by reserve or reserveRepeat.

Events
event result_t dataReady(adcresult_t result, uint16_t data) Conversion result from call to getData or getDataRepeat is ready.

Commands - Details

getData

command adcresult_t getData()

Initiates one single conversion. The conversion result is signalled in the event dataReady.

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()

Initiates conversions in repeat mode, ie. continuously. After each conversion an event dataReady is signalled with the conversion result until the eventhandler returns FAIL.

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()

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

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

reserveContinuous

command adcresult_t reserveContinuous()

Reserves the ADC for continuous conversions. If this call succeeds the next call to getDataContinuous/code> will also succeed and the 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 result_t dataReady(adcresult_t result, uint16_t data)

Conversion result from call to getData or getDataRepeat is 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 conversion was performed successfully and data is valid, error code otherwise (see ADCHIL.h).
data - The conversion result, an uninterpreted 16-bit value.
Returns:
SUCCESS continues conversions in continuous mode, FAIL stops further conversions in continuous mode (ignored if not in continuous mode).