Interface: tos.chips.atm128.adc.HplAtm128Adc
interface HplAtm128Adc
HPL interface to the Atmega128 A/D conversion subsystem. Please see the
Atmega128 manual for full details on the functioning of this subsystem.
A word of warning: the Atmega128 SLEEP instruction initiates an A/D
conversion when the ADC and ADC interrupt are enabled.
- Author:
-
Martin Turon <mturon@xbow.com>
-
Hu Siquan <husq@xbow.com>
-
David Gay
Commands
command bool cancel()
command Atm128Adcsra_t getAdcsra()
command Atm128Admux_t getAdmux()
command uint16_t getValue()
command bool isComplete()
command bool isStarted()
command void setAdcsra(Atm128Adcsra_t adcsra)
command void setAdmux(Atm128Admux_t admux)
command void setPrescaler(uint8_t scale)
command void setSingle()
Events
event void dataReady(uint16_t data)
Commands - Details
cancel
command bool cancel()
- Returns:
-
TRUE if an A/D conversion was in progress or an A/D interrupt
was pending, FALSE otherwise. In single conversion mode, a return
of TRUE implies that the dataReady event will not be signaled.
disableAdc
command void disableAdc()
disableInterruption
command void disableInterruption()
enableAdc
command void enableAdc()
enableInterruption
command void enableInterruption()
getAdcsra
command Atm128Adcsra_t getAdcsra()
- Returns:
-
Current ADCSRA value
getAdmux
command Atm128Admux_t getAdmux()
- Returns:
-
Current ADMUX value
getValue
command uint16_t getValue()
- Returns:
-
A/D value
isComplete
command bool isComplete()
- Returns:
-
TRUE if the A/D conversion is complete, FALSE otherwise
isEnabled
command bool isEnabled()
- Returns:
-
TRUE if the ADC is enabled, FALSE otherwise
isStarted
command bool isStarted()
- Returns:
-
TRUE if the A/D conversion is in progress, FALSE otherwise
resetInterrupt
command void resetInterrupt()
setAdcsra
command void setAdcsra(Atm128Adcsra_t adcsra)
- Parameters:
-
adcsra - New ADCSRA value
setAdmux
command void setAdmux(Atm128Admux_t admux)
- Parameters:
-
admux - New ADMUX value
setContinuous
command void setContinuous()
setPrescaler
command void setPrescaler(uint8_t scale)
- Parameters:
-
scale - New ADC prescaler. Must be one of the ATM128_ADC_PRESCALE_xxx
values from Atm128Adc.h
setSingle
command void setSingle()
startConversion
command void startConversion()
Events - Details
dataReady
event void dataReady(uint16_t data)
- Parameters:
-
data - Latest A/D conversion result