Main Page | Modules | Data Structures | File List | Data Fields | Globals

ptapulse.h File Reference

PTAPULSE TPU functions. More...

#include <68332/types.h>
#include <68332/tpu.h>

Go to the source code of this file.

Functions

void ptapulse_init (TPUChannel *handle, bool pulseLevel)
uint32 ptapulse_result (TPUChannel *handle)


Detailed Description

This file contains the global function prototypes and data structures for the Programmable Time Accumulator Pulse (PTAPULSE) functionality of the libtpu library.

To use the functions defined in this file, include <68332/ptapulse.h> and link libtpu.a.


Function Documentation

void ptapulse_init TPUChannel handle,
bool  pulseLevel
 

Starts pulse width measurement of square wave pulses input to a TPU channel pin. The first call to this function initializes the pin for pulse width measurement using PTA. Should only be called once; the PTA function will measure every pulse thereafter and set the channel interrupt status bit after every pulse.

Parameters:
handle The pointer to a TPUChannel returned from tpu_request_channel().
pulseLevel The logic level of the pulse to measure.

uint32 ptapulse_result TPUChannel handle  ) 
 

Returns the result of the pulse width measurements started by ptapulse_init(). Must be called after ptapulse_init(). Valid only when the channel interrupt status bit is set. NOTE: Must be called before the next pulse measurement accumulates more than 65535 counts of TCR1, or else the result will be corrupted.

Parameters:
handle The pointer to a TPUChannel returned from tpu_request_channel().
Returns:
The total accumulated time for the pulse, measured in TCR1 counts.


Generated on Wed Sep 6 03:02:22 2006 for MotoRobots by doxygen 1.3.6