Oakrey.ASRockMotherboard 2.0.4

dotnet add package Oakrey.ASRockMotherboard --version 2.0.4
                    
NuGet\Install-Package Oakrey.ASRockMotherboard -Version 2.0.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Oakrey.ASRockMotherboard" Version="2.0.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Oakrey.ASRockMotherboard" Version="2.0.4" />
                    
Directory.Packages.props
<PackageReference Include="Oakrey.ASRockMotherboard" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Oakrey.ASRockMotherboard --version 2.0.4
                    
#r "nuget: Oakrey.ASRockMotherboard, 2.0.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Oakrey.ASRockMotherboard@2.0.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Oakrey.ASRockMotherboard&version=2.0.4
                    
Install as a Cake Addin
#tool nuget:?package=Oakrey.ASRockMotherboard&version=2.0.4
                    
Install as a Cake Tool

Oakrey.ASRockMotherboard

Managed .NET wrapper for the ASRock IMB-1222 industrial motherboard native SDK (AsrCore.dll). Targets Windows only. Provides a clean, interface-driven API for GPIO control and hardware telemetry without exposing P/Invoke details to consumers.

Main features

  • GPIO pin control for pins 71-77 and 80: read state, set input mode, set output high/low
  • Read CPU core temperature and package temperature
  • Read DC-in voltage
  • Read board serial number
  • Query native SDK version (AsrCore.dll)
  • Motherboard compatibility check at construction time (manufacturer: ASRock, model: IMB-1222)
  • Structured error model via AsrException and the Error enum covering all SDK error codes

Architecture

classDiagram
    class IAsrMotherboard {
        +GetCoreCount() int
        +GetCoreTemp() short
        +GetPackageTemp() short
        +GetDcInVoltage() double
        +GetSerialNo() string
        +GetDllVersion() Version
        +GetGpioState(pin) bool
        +IsGpioInput(pin) bool
        +SetGpioInput(pin)
        +SetGpioOutState(pin, value)
        +Dispose()
    }
    class AsrMotherboard {
        +Create() IAsrMotherboard
    }
    class ASRockNativeMethods {
        <<static>>
        P/Invoke to AsrCore.dll
    }
    class AsrException {
        +Error Error
        +ThrowIfError(bool)
        +ThrowIfError(Error)
    }
    IAsrMotherboard <|.. AsrMotherboard
    AsrMotherboard --> ASRockNativeMethods
    AsrMotherboard --> AsrException

Key types:

Type Purpose
IAsrMotherboard Public interface for all board operations
AsrMotherboard Concrete implementation; use AsrMotherboard.Create()
ASRockNativeMethods Internal P/Invoke declarations against AsrCore.dll
AvailableGPIO Enum of supported GPIO pins (71-77, 80)
AsrException Library-specific exception with structured Error code
Error SDK error code enum (e.g. DllNotInitialized, InvalidParameter)

Requirements

  • Windows (x64)
  • .NET 10
  • ASRock IMB-1222 motherboard
  • AsrCore.dll present in the application output directory (included in the NuGet package)

Installation

.NET CLI

dotnet add package Oakrey.ASRockMotherboard

Package Manager Console

Install-Package Oakrey.ASRockMotherboard

AsrCore.dll is copied to the output directory automatically via the package's content files.

Usage

using Oakrey.ASRockMotherboard;

using IAsrMotherboard board = AsrMotherboard.Create();

// Telemetry
Console.WriteLine($"Core temp    : {board.GetCoreTemp()} C");
Console.WriteLine($"Package temp : {board.GetPackageTemp()} C");
Console.WriteLine($"DC-in voltage: {board.GetDcInVoltage():F2} V");
Console.WriteLine($"Core count   : {board.GetCoreCount()}");
Console.WriteLine($"Serial no.   : {board.GetSerialNo()}");
Console.WriteLine($"SDK version  : {board.GetDllVersionString()}");

// GPIO - read
bool state = board.GetGpioState(AvailableGPIO.GPIO71);
bool isInput = board.IsGpioInput(AvailableGPIO.GPIO71);

// GPIO - configure as output and drive high
board.SetGpioOutState(AvailableGPIO.GPIO72, true);

// GPIO - configure as input
board.SetGpioInput(AvailableGPIO.GPIO72);

AsrMotherboard.Create() throws AsrException if:

  • the motherboard is not an ASRock IMB-1222
  • AsrCore.dll fails to initialize

All GPIO and telemetry methods also throw AsrException on SDK failure. Check AsrException.Error for the specific Error code.

Development notes

  • AsrMotherboard constructor sets all GPIO pins to input mode as a safe default.
  • P/Invoke uses LibraryImport (source-generated marshalling) wherever possible, falling back to DllImport only for GetSerialNumber due to array marshalling.
  • The library uses System.Management (WMI) to verify motherboard compatibility at startup.
  • unsafe blocks are enabled in the project but are not required by the public API.

Project information

Package ID Oakrey.ASRockMotherboard
Author Oakrey
License MIT
Repository https://dev.azure.com/oakrey/OpenPackages/_git/Drivers

License

MIT. See the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net10.0-windows7.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.4 104 5/22/2026
2.0.3 92 5/15/2026
2.0.2 95 5/14/2026
2.0.1 127 2/2/2026
2.0.0 276 5/28/2025
1.0.0 295 4/17/2025