oops
This commit is contained in:
parent
010c1e3e40
commit
7e9a8b8216
|
@ -1 +0,0 @@
|
|||
Subproject commit 852bcbb35134d515fa85c28a36daf8a93beeb717
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<appSettings>
|
||||
<add key="port" value="COM3"/>
|
||||
<add key="baud" value="115200"/>
|
||||
</appSettings>
|
||||
</configuration>
|
|
@ -0,0 +1,61 @@
|
|||
using System.IO.Ports;
|
||||
using System.Configuration;
|
||||
|
||||
namespace SendEPROM
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static int Main(string[] args)
|
||||
{
|
||||
if(args.Length != 3 && args.Length != 2)
|
||||
return Usage();
|
||||
|
||||
string port = ConfigurationManager.AppSettings["port"];
|
||||
int baud = int.Parse(ConfigurationManager.AppSettings["baud"]);
|
||||
string file = string.Empty;
|
||||
byte mode = 0;
|
||||
|
||||
if(args.Length == 2)
|
||||
{
|
||||
mode = byte.Parse(args[0]);
|
||||
file = args[1];
|
||||
}
|
||||
else if(args.Length == 3)
|
||||
{
|
||||
port = args[0];
|
||||
baud = int.Parse(args[1]);
|
||||
file = args[2];
|
||||
}
|
||||
|
||||
Console.WriteLine($"Reading {file}");
|
||||
byte[] buff = File.ReadAllBytes(file);
|
||||
|
||||
Console.WriteLine($"Opening {port} at {baud}");
|
||||
var sp = new SerialPort(port)
|
||||
{
|
||||
BaudRate = baud
|
||||
};
|
||||
sp.Open();
|
||||
|
||||
if(mode != 0)
|
||||
{
|
||||
Console.WriteLine($"Sending mode {mode}");
|
||||
byte[] modeBuff = { mode };
|
||||
sp.Write(modeBuff, 0, 1);
|
||||
}
|
||||
|
||||
Console.WriteLine($"Sending {buff.Length} bytes");
|
||||
sp.Write(buff, 0, buff.Length);
|
||||
sp.Close();
|
||||
Console.WriteLine("Done!");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static int Usage()
|
||||
{
|
||||
Console.WriteLine("Usage: SendEPROM [COMX] [baud] [EPROM mode] filename");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>disable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" />
|
||||
<PackageReference Include="System.IO.Ports" Version="6.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.0.32014.148
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SendEPROM", "SendEPROM.csproj", "{1B795DA1-604C-44C9-8306-BE3E84743BA2}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{1B795DA1-604C-44C9-8306-BE3E84743BA2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1B795DA1-604C-44C9-8306-BE3E84743BA2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1B795DA1-604C-44C9-8306-BE3E84743BA2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1B795DA1-604C-44C9-8306-BE3E84743BA2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {C5F74E1C-5293-43CD-9F71-72BC2BEB69B5}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
Loading…
Reference in New Issue