Skip to content

Commit

Permalink
Improve naming + update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
EsbenVis committed Feb 3, 2021
1 parent 1e685fa commit 01703a4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions src/devices/QwiicButton/QwiicButton.ButtonStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Iot.Device.QwiicButton
public sealed partial class QwiicButton
{
/// <summary>
/// Returns whether the button is pressed.
/// Returns whether the button is pressed, i.e. pushed in.
/// </summary>
public bool IsPressed()
{
Expand All @@ -19,7 +19,7 @@ public bool IsPressed()
}

/// <summary>
/// Returns whether the button is clicked.
/// Returns whether the button is clicked, i.e. pressed and released.
/// </summary>
public bool HasBeenClicked()
{
Expand All @@ -30,20 +30,20 @@ public bool HasBeenClicked()
/// <summary>
/// Returns whether a new button status event has occurred.
/// </summary>
public bool EventAvailable()
public bool IsEventAvailable()
{
var status = new StatusRegisterBitField(_registerAccess.ReadRegister<byte>(Register.ButtonStatus));
return status.EventAvailable;
return status.IsEventAvailable;
}

/// <summary>
/// Sets <see cref="IsPressed"/>, <see cref="HasBeenClicked"/> and <see cref="EventAvailable"/> to false.
/// Sets <see cref="IsPressed"/>, <see cref="HasBeenClicked"/> and <see cref="IsEventAvailable"/> to false.
/// </summary>
public void ClearEventBits()
{
var status = new StatusRegisterBitField(_registerAccess.ReadRegister<byte>(Register.ButtonStatus))
{
EventAvailable = false,
IsEventAvailable = false,
HasBeenClicked = false,
IsPressed = false
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void ResetInterruptConfig()

var status = new StatusRegisterBitField
{
EventAvailable = false
IsEventAvailable = false
};
_registerAccess.WriteRegister(Register.ButtonStatus, status.StatusRegisterValue);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ internal struct StatusRegisterBitField
[Flags]
private enum StatusRegisterBits
{
EventAvailable = 1,
IsEventAvailable = 1,
HasBeenClicked = 2,
IsPressed = 4,
}
Expand All @@ -29,14 +29,14 @@ public StatusRegisterBitField(byte statusRegisterValue)
/// Gets set to true when a new event occurs.
/// Must be manually set to false to clear the flag.
/// </summary>
public bool EventAvailable
public bool IsEventAvailable
{
get { return FlagsHelper.IsSet(_statusRegisterValue, StatusRegisterBits.EventAvailable); }
set { FlagsHelper.SetValue(ref _statusRegisterValue, StatusRegisterBits.EventAvailable, value); }
get { return FlagsHelper.IsSet(_statusRegisterValue, StatusRegisterBits.IsEventAvailable); }
set { FlagsHelper.SetValue(ref _statusRegisterValue, StatusRegisterBits.IsEventAvailable, value); }
}

/// <summary>
/// Gets set to true if button is pushed.
/// Gets set to true if button is pressed, i.e. pushed in.
/// </summary>
public bool IsPressed
{
Expand All @@ -45,7 +45,7 @@ public bool IsPressed
}

/// <summary>
/// Gets set to true when the button gets clicked.
/// Gets set to true when the button gets clicked, i.e. pressed and released.
/// Must be manually set to false to clear the flag.
/// </summary>
public bool HasBeenClicked
Expand Down

0 comments on commit 01703a4

Please sign in to comment.