Skip to content

Commit

Permalink
Merge pull request #2 from sheltonyu/master
Browse files Browse the repository at this point in the history
[windows] add support ArteryTek device
  • Loading branch information
ArteryTek committed Aug 13, 2024
2 parents 0d08658 + 6644db1 commit 6de562b
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 2 deletions.
14 changes: 12 additions & 2 deletions windows/QMK Toolbox/QMK Toolbox.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>
<TargetFramework>net6.0-windows10.0.18362.0</TargetFramework>
<OutputType>WinExe</OutputType>
<AssemblyName>qmk_toolbox</AssemblyName>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<UseWindowsForms>true</UseWindowsForms>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<PublishSingleFile>true</PublishSingleFile>
<PublishSingleFile>FALSE</PublishSingleFile>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
<Platforms>AnyCPU;x86</Platforms>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Resources\output.ico</ApplicationIcon>
Expand All @@ -26,6 +27,8 @@
<Description>A flashing/debug utility for devices running QMK Firmware</Description>
<Version>0.3.3</Version>
<Product>QMK Toolbox</Product>
<PackAsTool>True</PackAsTool>
<GeneratePackageOnBuild>False</GeneratePackageOnBuild>
</PropertyGroup>
<ItemGroup>
<Compile Update="BetterComboBox.cs">
Expand Down Expand Up @@ -90,6 +93,10 @@
<Version>5.7.0</Version>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Fody" Version="6.5.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="hidlibrary">
<Version>3.3.40</Version>
</PackageReference>
Expand All @@ -111,4 +118,7 @@
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<None Include="FodyWeavers.xsd" />
</ItemGroup>
</Project>
1 change: 1 addition & 0 deletions windows/QMK Toolbox/Resources/drivers.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ winusb,STM32 Bootloader,0483,DF11,6d98a87f-4ecf-464d-89ed-8c684d857a75
winusb,APM32 Bootloader,314B,0106,9ff3cc31-6772-4a3f-a492-a80d91f7a853
winusb,WB32 Bootloader,342D,DFA0,89b0fdf0-3d22-4408-8393-32147ba508ce
winusb,GD32V Bootloader,28E9,0189,e1421fd6-f799-4b6c-97e6-39e87d37f858
winusb,AT32 Bootloader,2E3C,DF11,d70683b3-0498-4979-9a17-e1c62fa6b85d
winusb,STM32duino Bootloader,1EAF,0003,746915ec-99d8-4a90-a722-3c85ba31e4fe
libusbk,USBaspLoader,16C0,05DC,e69affdc-0ef0-427c-aefb-4e593c9d2724
winusb,Kiibohd DFU Bootloader,1C11,B007,aa5a3f86-b81e-4416-89ad-0c1ea1ed63af
Expand Down
30 changes: 30 additions & 0 deletions windows/QMK Toolbox/Usb/Bootloader/AT32DfuDevice.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System.IO;
using System.Threading.Tasks;

namespace QMK_Toolbox.Usb.Bootloader
{
class AT32DfuDevice : BootloaderDevice
{
public AT32DfuDevice(UsbDevice d) : base(d)
{
Type = BootloaderType.AT32Dfu;
Name = "AT32 DFU";
PreferredDriver = "WinUSB";
IsResettable = true;
}

public async override Task Flash(string mcu, string file)
{
if (Path.GetExtension(file)?.ToLower() == ".bin")
{
await RunProcessAsync("dfu-util.exe", $"-a 0 -d 2E3C:DF11 -s 0x08000000:leave -D \"{file}\"");
}
else
{
PrintMessage("Only firmware files in .bin format can be flashed with dfu-util!", MessageType.Error);
}
}

public async override Task Reset(string mcu) => await RunProcessAsync("dfu-util.exe", "-a 0 -d 2E3C:DF11 -s 0x08000000:leave");
}
}
1 change: 1 addition & 0 deletions windows/QMK Toolbox/Usb/Bootloader/BootloaderType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public enum BootloaderType
UsbAsp,
UsbTinyIsp,
Wb32Dfu,
AT32Dfu,
None
}
}
8 changes: 8 additions & 0 deletions windows/QMK Toolbox/Usb/UsbListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ private static IUsbDevice CreateDevice(ManagementBaseObject d)
return new UsbTinyIspDevice(usbDevice);
case BootloaderType.Wb32Dfu:
return new Wb32DfuDevice(usbDevice);
case BootloaderType.AT32Dfu:
return new AT32DfuDevice(usbDevice);
default:
break;
}
Expand Down Expand Up @@ -315,6 +317,12 @@ private static BootloaderType GetDeviceType(ushort vendorId, ushort productId, u
return BootloaderType.Wb32Dfu;
}
break;
case 0x2E3C: // ArteryTech
if (productId == 0xDF11)
{
return BootloaderType.AT32Dfu;
}
break;
}

return BootloaderType.None;
Expand Down

0 comments on commit 6de562b

Please sign in to comment.