ADC10 sensors reading. More...
Modules | |
Flags indicating ADC10 done reading | |
Files | |
file | adc.h |
ADC10 connected sensors reading interface. | |
Functions | |
void | adc_init () |
This function initializes the ADC variables. More... | |
UInt16 | adc_proccess () |
This function processes the tasks of the ADC. More... | |
void | adc_getTemp (UInt16 *temp, clock_timeStamp *tempTime) |
This function get current stored temperature. More... | |
void | adc_getVolt (UInt16 *volt, clock_timeStamp *voltTime) |
This function get current stored voltage. More... | |
void | adc_getLux (UInt16 *lux, clock_timeStamp *luxTime) |
This function get current stored luminescence. More... | |
void | ADC10_ISR () |
ADC10 Interrupt Service Request. More... | |
ADC10 sensors reading.
Reading of ADC10 sensors is done regularly and can be retrieved any time. The last registered value will be returned.
void ADC10_ISR | ( | ) |
ADC10 Interrupt Service Request.
The value read from the ADC10 is stored on a variable depending on the adc_currentState, and the corresponding flag of reading done is set. If adc_currentState is not a reading state, the ISR is ignored
Definition at line 340 of file adc.c.
References adc_currentState, ADC_FLAGLUXDONE, adc_flags, ADC_FLAGTEMPDONE, ADC_FLAGVOLTDONE, adc_lux, ADC_S_READING_L, ADC_S_READING_T, ADC_S_READING_V, adc_temp, adc_voltage, and clock_getTime().
void adc_getLux | ( | UInt16 * | lux, |
clock_timeStamp * | luxTime | ||
) |
This function get current stored luminescence.
[out] | lux | Pointer to destination address for illuminance value. |
[out] | luxTime | Pointer to destination address for timestamp. |
Definition at line 324 of file adc.c.
References adc_lux.
Referenced by rep_proccess().
void adc_getTemp | ( | UInt16 * | temp, |
clock_timeStamp * | tempTime | ||
) |
This function get current stored temperature.
[out] | temp | Pointer to destination address for temperature value. |
[out] | tempTime | Pointer to destination address for timestamp. |
Definition at line 294 of file adc.c.
References adc_temp.
Referenced by rep_proccess().
void adc_getVolt | ( | UInt16 * | volt, |
clock_timeStamp * | voltTime | ||
) |
This function get current stored voltage.
[out] | volt | Pointer to destination address for voltage value. |
[out] | voltTime | Pointer to destination address for timestamp. |
Definition at line 309 of file adc.c.
References adc_voltage.
Referenced by rep_proccess().
void adc_init | ( | ) |
This function initializes the ADC variables.
The value of luminance sensor feed is set to 1, so it is turned on/off by the direction of the bit, in or out. All values and time stamps of readings are set to 0.
Definition at line 171 of file adc.c.
References adc_currentState, adc_flags, adc_lux, ADC_LUXSENSFEEDBIT, ADC_S_IDLE, adc_temp, and adc_voltage.
Referenced by main().
UInt16 adc_proccess | ( | ) |
This function processes the tasks of the ADC.
The tasks are based on the value of adc_currentState variable. On ech state a check is done, if state have to change, actions are executed and the state changes. The actions of each task on changing to the next are:
The return value depends on current state, when state changes to charging for any sensor, the return value is 10ms, when it goes to IDLE, the return value is 955ms, all others are 5ms this gives 1s for each measurement cycle if no delay occurs and ADC10 stays read under 5ms after the reading is requested.
Definition at line 218 of file adc.c.
References adc_currentState, ADC_FLAGLUXDONE, adc_flags, ADC_FLAGTEMPDONE, ADC_FLAGVOLTDONE, ADC_LUXSENSFEEDBIT, ADC_S_CHARGING_L, ADC_S_CHARGING_T, ADC_S_CHARGING_V, ADC_S_IDLE, ADC_S_READING_L, ADC_S_READING_T, and ADC_S_READING_V.
Referenced by main().