Apps     Components     Interfaces     All Files     Source Tree     source: tos.interfaces.ADCControl.nc

Interface: ADCControl

Controls various aspects of the ADC.

Components providing this interface:
tos.system.ADCC
tos.system.ADCM

Components requiring this interface:
tos.sensorboards.micasb.AccelM
tos.sensorboards.micasb.MagM
tos.sensorboards.micasb.MicM
tos.sensorboards.micasb.PhotoTempM
tos.system.VoltageM

Commands

Commands - Details

init

result_t init(void)

Initializes the ADCControl structures.
Returns: SUCCESS if successful

setSamplingRate

result_t setSamplingRate(uint8_t rate)

Sets the sampling rate of the ADC. These are the lower three bits in the ADCSR register of the microprocessor. The rate parameter may use the following macros or its own value from the description below.

  TOS_ADCSample3750ns = 0 
  TOS_ADCSample7500ns = 1
  TOS_ADCSample15us =   2
  TOS_ADCSample30us =   3
  TOS_ADCSample60us =   4
  TOS_ADCSample120us =  5
  TOS_ADCSample240us =  6
  TOS_ADCSample480us =  7
 

Parameters:

rate - 2^rate is the prescaler factor to the ADC. The rate of the ADC is the crystal frequency times the prescaler, or XTAL * 2^rate = 32kHz * 2^rate.

Returns: SUCCESS if successful

bindPort

result_t bindPort(uint8_t port, uint8_t adcPort)

Remaps a port in the ADC portmap TOSH_adc_portmap. See platform/mica/HPLADCC.td for implementation.

Parameters:

port - The port in the portmap you wish to modify

adcPort - The ADC destination port that port binds to

Returns: SUCCESS if successful