Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add event handling methods #2140

Merged
merged 7 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/devices/Mcp23xxx/Mcp23x1x.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,27 @@ protected Mcp23x1x(BusAdapter device, int reset, int interruptA, int interruptB,
/// Reads the interrupt pin for the given port if configured.
/// </summary>
public PinValue ReadInterrupt(Port port) => InternalReadInterrupt(port);

/// <summary>
/// Reads all bits of port A in a single operation.
/// </summary>
/// <returns>In the low byte: A bit field of the value of the first 8 GPIO ports
/// (Bit 0: GPIO 0, Bit 1: GPIO 1 etc.). Only the bits of input ports are defined.</returns>
public int ReadPortA()
{
int value = ReadByte(Register.GPIO, Port.PortA);
return value;
}

/// <summary>
/// Reads all bits of port B in a single operation.
/// </summary>
/// <returns>In the low byte: A bit field of the value of the second 8 GPIO ports
/// (Bit 0: GPIO 8, Bit 1: GPIO 9 etc.). Only the bits of input ports are defined.</returns>
public int ReadPortB()
{
int value = ReadByte(Register.GPIO, Port.PortB);
return value;
}
}
}
Loading