Interface: tos.interfaces.ADCControl

interface ADCControl

Controls various aspects of the ADC.

Author:
Alec Woo
David Gay
Philip Levis

Commands
command result_t bindPort(uint8_t port, uint8_t adcPort) Remaps a port in the ADC portmap TOSH_adc_portmap.
command result_t init() Initializes the ADCControl structures.
command result_t setSamplingRate(uint8_t rate) Sets the sampling rate of the ADC.

Commands - Details

bindPort

command 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

init

command result_t init()

Initializes the ADCControl structures.

Returns:
SUCCESS if successful

setSamplingRate

command 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