#include "t89c51cc02.h"
#include "datatypes.h"
#include "adc.h"
#include "sharp.h"
Go to the source code of this file.
Functions | |
void | Sharp_init () |
initializes GP2D120 subsystem | |
void | Sharp_TimerInit () |
initializes an ISR to signal that the Sharp GP2D120 is ready to be read. | |
void | Sharp_Timer_interrupt (void) |
Timer ISR for delaying the Sharp GP2D120. | |
WORD | Sharp_read () |
read Sharp GP2D120 sensor if it is active | |
Variables | |
volatile bit | sharp_ready |
volatile bit | wait_bit |
Definition in file sharp.c.
|
read Sharp GP2D120 sensor if it is active
Definition at line 86 of file sharp.c. References ADC(), SHARP_PWRCTL, and sharp_ready. Referenced by main(). |
|
Timer ISR for delaying the Sharp GP2D120.
This Timer ISR delays the Sharp GP2D120 and signals its readiness after 50ms via the sharp_ready semaphore. The interrupt is triggered every 25ms. Therefor the routine uses a flag (wait_bit) to signal its second run. The sensor readiness is signalled in the second run of the ISR. The ISR deactivates itself after its second execution. Definition at line 64 of file sharp.c. References sharp_ready, SHARP_TIMER_RELOAD_H, SHARP_TIMER_RELOAD_L, and wait_bit. |
|
initializes an ISR to signal that the Sharp GP2D120 is ready to be read. Initializes an ISR to signal that the Sharp GP2D120 is ready to output a valid distance reading. Activates Timer 1 which counts for 25ms twice and sets a readiness signal upon 2nd ISR invocation. (
Definition at line 39 of file sharp.c. References sharp_ready, SHARP_TIMER_RELOAD_H, SHARP_TIMER_RELOAD_L, and wait_bit. |
|
A semaphore that signals whether the GP2D120 is ready to be read Definition at line 19 of file sharp.c. Referenced by Sharp_read(), Sharp_Timer_interrupt(), and Sharp_TimerInit(). |
|
A semaphore that signals the second run of the Sharp delaying Timer interrupt if 0 Definition at line 21 of file sharp.c. Referenced by Sharp_Timer_interrupt(), and Sharp_TimerInit(). |