mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-09-09 23:54:32 +00:00
turn of ADC12 during reconfiguration
This commit is contained in:
parent
9438981e4d
commit
ce5b45da48
@ -28,7 +28,7 @@
|
|||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* 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 "contiki-esb.h"
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
@ -118,10 +118,10 @@ irq_adc12_activate(const struct sensors_sensor *sensor,
|
|||||||
{
|
{
|
||||||
/* stop converting */
|
/* stop converting */
|
||||||
ADC12CTL0 &= ~ENC;
|
ADC12CTL0 &= ~ENC;
|
||||||
ADC12IE = 0;
|
|
||||||
|
|
||||||
/* wait for conversion to stop */
|
/* wait for conversion to stop */
|
||||||
while(ADC12CTL0 & ADC12BUSY);
|
while(ADC12CTL0 & ADC12BUSY);
|
||||||
|
ADC12CTL0 &= ~(ADC12ON | REFON);
|
||||||
|
ADC12IE = 0;
|
||||||
|
|
||||||
/* clear any pending interrupts */
|
/* clear any pending interrupts */
|
||||||
ADC12IFG = 0;
|
ADC12IFG = 0;
|
||||||
@ -147,10 +147,10 @@ irq_adc12_deactivate(const struct sensors_sensor *sensor, unsigned char adcno)
|
|||||||
{
|
{
|
||||||
/* stop converting */
|
/* stop converting */
|
||||||
ADC12CTL0 &= ~ENC;
|
ADC12CTL0 &= ~ENC;
|
||||||
ADC12IE = 0;
|
|
||||||
|
|
||||||
/* wait for conversion to stop */
|
/* wait for conversion to stop */
|
||||||
while(ADC12CTL0 & ADC12BUSY);
|
while(ADC12CTL0 & ADC12BUSY);
|
||||||
|
ADC12CTL0 &= ~(ADC12ON | REFON);
|
||||||
|
ADC12IE = 0;
|
||||||
|
|
||||||
/* clear any pending interrupts */
|
/* clear any pending interrupts */
|
||||||
ADC12IFG = 0;
|
ADC12IFG = 0;
|
||||||
@ -163,11 +163,13 @@ irq_adc12_deactivate(const struct sensors_sensor *sensor, unsigned char adcno)
|
|||||||
|
|
||||||
sensors_remove_irq(sensor, IRQ_ADC);
|
sensors_remove_irq(sensor, IRQ_ADC);
|
||||||
|
|
||||||
if(!adcflags) {
|
if(adcflags) {
|
||||||
/* Turn off the ADC12 */
|
/* Turn on the ADC12 */
|
||||||
ADC12CTL0 &= ~(ADC12ON | REFON);
|
ADC12CTL0 |= (ADC12ON | REFON);
|
||||||
|
|
||||||
|
/* Delay */
|
||||||
|
clock_delay(20000);
|
||||||
|
|
||||||
} else {
|
|
||||||
/* Still active. Turn on the conversion. */
|
/* Still active. Turn on the conversion. */
|
||||||
ADC12CTL0 |= ENC | ADC12SC;
|
ADC12CTL0 |= ENC | ADC12SC;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user