GpioChangeReader GpioChangeReader GpioChangeReader GpioChangeReader GpioChangeReader Class

Definition

Represents a shared circular buffer between kernel mode and user mode into which high-resolution timestamps are placed when a general-purpose I/O (GPIO) pin changes value.

public : sealed class GpioChangeReader : IClosable
struct winrt::Windows::Devices::Gpio::GpioChangeReader : IClosable
public sealed class GpioChangeReader : IDisposable
Public NotInheritable Class GpioChangeReader Implements IDisposable
var gpioChangeReader = new gpioChangeReader(pin);
Attributes

Windows 10 requirements

Device family
Windows 10 Creators Update (introduced v10.0.15063.0)
API contract
Windows.Devices.DevicesLowLevelContract (introduced v3)

Remarks

Kernel mode places a timestamp into the buffer when a pin changes value, and user mode removes items from the buffer. An overflow occurs when there is no longer sufficient room in the buffer to place additional timestamps. Upon overflow, further events are not recorded, and the IsOverflowed property will return true.

This class is not thread-safe. Calling functions of this class concurrently from multiple threads will have unpredictable results.

Constructors

GpioChangeReader(GpioPin) GpioChangeReader(GpioPin) GpioChangeReader(GpioPin) GpioChangeReader(GpioPin) GpioChangeReader(GpioPin)

Creates a new GpioChangeReader associated with the specified pin. Only a single GpioChangeReader may be associated with a pin at any given time.

GpioChangeReader(GpioPin, Int32) GpioChangeReader(GpioPin, Int32) GpioChangeReader(GpioPin, Int32) GpioChangeReader(GpioPin, Int32) GpioChangeReader(GpioPin, Int32)

Creates a new GpioChangeReader associated with the specified pin and with the specified minimum capacity for change records. Only a single GpioChangeReader may be associated with a pin at any given time.

Properties

Capacity Capacity Capacity Capacity Capacity

Gets the maximum number of change records that the GpioChangeReader can store at one time.

IsEmpty IsEmpty IsEmpty IsEmpty IsEmpty

Gets whether there are currently zero change records in the reader.

IsOverflowed IsOverflowed IsOverflowed IsOverflowed IsOverflowed

Gets whether an attempt to place a change record into the reader's buffer has failed due to the buffer being full.

IsStarted IsStarted IsStarted IsStarted IsStarted

Gets whether pin change recording is currently active.

Length Length Length Length Length

Gets the number of records currently in the change reader.

Polarity Polarity Polarity Polarity Polarity

Gets or sets the polarity of transitions that will be recorded. The polarity may only be changed when pin change recording is not started.

Methods

Clear() Clear() Clear() Clear() Clear()

Discards all change records from the reader's buffer.

Close() Close() Close() Close() Close()

Closes the change reader, releasing the associated memory buffer and disassociating the reader from its pin.

Dispose() Dispose() Dispose() Dispose() Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

GetAllItems() GetAllItems() GetAllItems() GetAllItems() GetAllItems()

Removes and returns all items current in the reader's buffer.

GetNextItem() GetNextItem() GetNextItem() GetNextItem() GetNextItem()

Retrieves and removes the earliest inserted change record from the reader's buffer.

PeekNextItem() PeekNextItem() PeekNextItem() PeekNextItem() PeekNextItem()

Retrieves the earlier inserted change record from the reader's buffer, without removing it.

Start() Start() Start() Start() Start()

Starts recording changes in pin polarity. This method may only be called when change recording is not already active.

Stop() Stop() Stop() Stop() Stop()

Stop recording changes in pin polarity. This method may only be called when change recording is currently active.

WaitForItemsAsync(Int32) WaitForItemsAsync(Int32) WaitForItemsAsync(Int32) WaitForItemsAsync(Int32) WaitForItemsAsync(Int32)

Waits for the buffer to fill with at least count number of items, at which point the async action will complete. This action is cancelable.