turn of ADC12 during reconfiguration

This commit is contained in:
nifi 2006-08-30 07:45:56 +00:00
parent 9438981e4d
commit ce5b45da48

View file

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* @(#)$Id: irq.c,v 1.1 2006/06/18 07:49:33 adamdunkels Exp $
* @(#)$Id: irq.c,v 1.2 2006/08/30 07:45:56 nifi Exp $
*/
#include "contiki-esb.h"
#include <signal.h>
@ -118,10 +118,10 @@ irq_adc12_activate(const struct sensors_sensor *sensor,
{
/* stop converting */
ADC12CTL0 &= ~ENC;
ADC12IE = 0;
/* wait for conversion to stop */
while(ADC12CTL0 & ADC12BUSY);
ADC12CTL0 &= ~(ADC12ON | REFON);
ADC12IE = 0;
/* clear any pending interrupts */
ADC12IFG = 0;
@ -147,10 +147,10 @@ irq_adc12_deactivate(const struct sensors_sensor *sensor, unsigned char adcno)
{
/* stop converting */
ADC12CTL0 &= ~ENC;
ADC12IE = 0;
/* wait for conversion to stop */
while(ADC12CTL0 & ADC12BUSY);
ADC12CTL0 &= ~(ADC12ON | REFON);
ADC12IE = 0;
/* clear any pending interrupts */
ADC12IFG = 0;
@ -163,11 +163,13 @@ irq_adc12_deactivate(const struct sensors_sensor *sensor, unsigned char adcno)
sensors_remove_irq(sensor, IRQ_ADC);
if(!adcflags) {
/* Turn off the ADC12 */
ADC12CTL0 &= ~(ADC12ON | REFON);
if(adcflags) {
/* Turn on the ADC12 */
ADC12CTL0 |= (ADC12ON | REFON);
/* Delay */
clock_delay(20000);
} else {
/* Still active. Turn on the conversion. */
ADC12CTL0 |= ENC | ADC12SC;
}