Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
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:
-
triggerState State that the pin must transistion to before the readings are captured pReadings Pointer to the timing buffer that will contain the readings in microseconds count The 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:
-
pInitialState Pointer to a bool that will have the initial state of the pin at the time the capture started. pReadings Pointer to the timing buffer that will contain the readings in microseconds count The 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:
-
us Timeout specified in microseconds
Definition at line 14 of file DigitalPinCapture.cpp.
Generated on Fri Jul 15 2022 02:11:20 by
1.7.2