Chris Taylor / SignalCapture
Embed: (wiki syntax)

« Back to documentation index

DigitalPinCapture Class Reference

DigitalPinCapture Class Reference

Captures the digital wave form of a pin into a timing buffer. More...

#include <DigitalPinCapture.h>

Public Member Functions

 DigitalPinCapture (PinName pin, PinMode mode)
 Create an instance of DigitalPinCapture connected to the specified pin.
void setReadTimeout (uint32_t us)
 Maximum time to wait for waveform data to arrive or completely fill the timing buffer.
int read (bool triggerState, uint32_t *pReadings, int count)
 Waits for the pin to transition to the trigger state and proceeds to capture the pins transition timing into the timing buffer.
int read (bool *pInitialState, uint32_t *pReadings, int count)
 Immediately start capturing the pin transition timing into the timing buffer.

Detailed Description

Captures the digital wave form of a pin into a timing buffer.

Definition at line 8 of file DigitalPinCapture.h.


Constructor & Destructor Documentation

DigitalPinCapture ( PinName  pin,
PinMode  mode 
)

Create an instance of DigitalPinCapture connected to the specified pin.

Note:
The DigitalPinCapture class polls the state of the pin and therefore might be less accurate than using InterruptPinCapture. However, it has the advantage that it does not require an interrupt capable pin.

Definition at line 7 of file DigitalPinCapture.cpp.


Member Function Documentation

int read ( bool  triggerState,
uint32_t *  pReadings,
int  count 
)

Waits for the pin to transition to the trigger state and proceeds to capture the pins transition timing into the timing buffer.

Parameters:
triggerStateState that the pin must transistion to before the readings are captured
pReadingsPointer to the timing buffer that will contain the readings in microseconds
countThe maximum number of readings that can be held in the buffer
Returns:
The number of timings captured in the buffer.

Definition at line 19 of file DigitalPinCapture.cpp.

int read ( bool *  pInitialState,
uint32_t *  pReadings,
int  count 
)

Immediately start capturing the pin transition timing into the timing buffer.

Parameters:
pInitialStatePointer to a bool that will have the initial state of the pin at the time the capture started.
pReadingsPointer to the timing buffer that will contain the readings in microseconds
countThe maximum number of readings that can be held in the buffer
Returns:
The number of timings captured in the buffer.

Definition at line 24 of file DigitalPinCapture.cpp.

void setReadTimeout ( uint32_t  us )

Maximum time to wait for waveform data to arrive or completely fill the timing buffer.

Parameters:
usTimeout specified in microseconds

Definition at line 14 of file DigitalPinCapture.cpp.