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

Fix fore async method. #184

Merged
merged 1 commit into from
Jan 7, 2025
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
2 changes: 1 addition & 1 deletion src/01/KSociety.SharpCubeProgrammer/CubeProgrammerApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public CubeProgrammerError Reset(DebugResetMode rstMode)
return output;
}

public async ValueTask<CubeProgrammerError> Reset(DebugResetMode rstMode, CancellationToken cancellationToken = default)
public async ValueTask<CubeProgrammerError> ResetAsync(DebugResetMode rstMode, CancellationToken cancellationToken = default)
{
return await Task.Run(() => this.Reset(rstMode), cancellationToken).ConfigureAwait(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public interface ICubeProgrammerApiAsync : IAsyncDisposable
/// <summary>
/// This routine used to apply a target reset, use only with ST-LINK!.
/// </summary>
ValueTask<CubeProgrammerError> Reset(DebugResetMode rstMode, CancellationToken cancellationToken = default);
ValueTask<CubeProgrammerError> ResetAsync(DebugResetMode rstMode, CancellationToken cancellationToken = default);

#endregion

Expand Down
2 changes: 1 addition & 1 deletion src/01/Samples/Programming/Bindings/ProgrammerApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class ProgrammerApi : Module
{
protected override void Load(ContainerBuilder builder)
{
builder.RegisterType<CubeProgrammerApi>().As<ICubeProgrammerApi>().SingleInstance();
builder.RegisterType<CubeProgrammerApi>().As<ICubeProgrammerApi>().As<ICubeProgrammerApiAsync>().SingleInstance();
}
}
}
2 changes: 2 additions & 0 deletions src/01/Samples/Programming/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ internal class Program
private static IConfigurationRoot? Configuration;
private static ILogger<Program>? Logger;
private static ICubeProgrammerApi? CubeProgrammerApi;
private static ICubeProgrammerApiAsync? CubeProgrammerApiAsync;

private static void Main(string[] args)
{
Expand All @@ -33,6 +34,7 @@ private static void Main(string[] args)
Logger.LogDebug("Resolve ICubeProgrammerApi...");

CubeProgrammerApi = container.Resolve<ICubeProgrammerApi>();
CubeProgrammerApiAsync = container.Resolve<ICubeProgrammerApiAsync>();

Console.WriteLine("Press a button to continue.");
Console.ReadLine();
Expand Down