54 #define ADC_FLAGTEMPDONE BIT0
58 #define ADC_FLAGVOLTDONE BIT1
62 #define ADC_FLAGLUXDONE BIT2
70 #define ADC_LUXSENSFEEDBIT BIT1
182 adc_tempTime.seconds.secondsLow = 0;
183 adc_tempTime.seconds.secondsHigh = 0;
184 adc_tempTime.nanoSeconds = 0;
186 adc_voltageTime.seconds.secondsLow = 0;
187 adc_voltageTime.seconds.secondsHigh = 0;
188 adc_voltageTime.nanoSeconds = 0;
190 adc_luxTime.seconds.secondsLow = 0;
191 adc_luxTime.seconds.secondsHigh = 0;
192 adc_luxTime.nanoSeconds = 0;
224 ADC10CTL1 = INCH_10 + ADC10DIV_4;
227 ADC10CTL0 = SREF_1 + ADC10SHT_3 + REFON + ADC10ON + ADC10IE + ADC10SR;
232 ADC10CTL0 |= ENC | ADC10SC;
242 ADC10CTL1 = INCH_11 + ADC10DIV_3;
245 ADC10CTL0 = SREF_1 + ADC10SHT_2 + REFON + ADC10ON + ADC10IE;
250 ADC10CTL0 |= ENC | ADC10SC;
261 ADC10CTL1 = INCH_0 + ADC10DIV_4;
264 ADC10CTL0 = SREF_1 + ADC10SHT_3 + REFON + REF2_5V + ADC10ON + ADC10IE
270 ADC10CTL0 |= ENC | ADC10SC;
296 tempTime->seconds.secondsLow = adc_tempTime.seconds.secondsLow;
297 tempTime->seconds.secondsHigh = adc_tempTime.seconds.secondsHigh;
298 tempTime->nanoSeconds = adc_tempTime.nanoSeconds;
311 voltTime->seconds.secondsLow = adc_voltageTime.seconds.secondsLow;
312 voltTime->seconds.secondsHigh = adc_voltageTime.seconds.secondsHigh;
313 voltTime->nanoSeconds = adc_voltageTime.nanoSeconds;
326 luxTime->seconds.secondsLow = adc_luxTime.seconds.secondsLow;
327 luxTime->seconds.secondsHigh = adc_luxTime.seconds.secondsHigh;
328 luxTime->nanoSeconds = adc_luxTime.nanoSeconds;
347 ADC10CTL0 &= ~(ADC10IE & ENC);
357 ADC10CTL0 &= ~(ADC10IE & ENC);
378 ADC10CTL0 &= ~(ADC10IE & ENC);
#define ADC_FLAGTEMPDONE
Flag to indicate temperature reading done.
#define ADC_FLAGVOLTDONE
Flag to indicate voltage reading done.
UInt16 adc_voltage
Value of last voltage reading.
#define ADC_LUXSENSFEEDBIT
Feed bit of the luminance sensor, on port 2 (P2.1).
UInt16 adc_temp
Value of last temperature reading.
void adc_getLux(UInt16 *lux, clock_timeStamp *luxTime)
This function get current stored luminescence.
void adc_init()
This function initializes the ADC variables.
adc_state
States of the ADC10.
clock_timeStamp adc_voltageTime
Time of last voltage reading.
Charging ADC for luminance reading.
ADC10 connected sensors reading interface.
UInt8 adc_flags
Internal flags for controlling ADC10.
#define ADC_FLAGLUXDONE
Flag to indicate luminance reading done.
clock_timeStamp adc_tempTime
Time of last temperature reading.
Charging ADC for voltage reading.
Waiting for next time of measurements.
adc_state adc_currentState
Current state of the ADC10.
void adc_getVolt(UInt16 *volt, clock_timeStamp *voltTime)
This function get current stored voltage.
UInt16 adc_lux
Value of last luminance reading.
void ADC10_ISR()
ADC10 Interrupt Service Request.
void adc_getTemp(UInt16 *temp, clock_timeStamp *tempTime)
This function get current stored temperature.
Charging ADC for temperature reading.
clock_timeStamp adc_luxTime
Time of last luminance reading.
Reading temperature value.
UInt16 adc_proccess()
This function processes the tasks of the ADC.
void clock_getTime(clock_timeStamp *destTime)
Get time.