Skip to content

Commit

Permalink
🎨 Serial works
Browse files Browse the repository at this point in the history
  • Loading branch information
SydneyOwl committed Aug 11, 2024
1 parent d812ec2 commit 6cbfb0c
Show file tree
Hide file tree
Showing 11 changed files with 1,465 additions and 13 deletions.
7 changes: 7 additions & 0 deletions Constants/Shx8800Pro/OP_TYPE.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace SenhaixFreqWriter.Constants.Shx8800Pro;

public enum OpType
{
Read,
Write
}
13 changes: 13 additions & 0 deletions Constants/Shx8800Pro/STEP.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace SenhaixFreqWriter.Constants.Shx8800Pro;

public enum Step
{
StepHandshake1,
StepHandshake2,
StepHandshake3,
StepHandshake4,
StepRead1,
StepRead2,
StepWrite1,
StepWrite2
}
13 changes: 13 additions & 0 deletions DataModels/Shx8800Pro/ProgressBarValue.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace SenhaixFreqWriter.DataModels.Shx8800Pro;

public class ProgressBarValue
{
public string Content;
public int Value;

public ProgressBarValue(int value, string content)
{
Value = value;
Content = content;
}
}
28 changes: 28 additions & 0 deletions Utils/Serial/DataHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
namespace SenhaixFreqWriter.Utils.Serial;

public class DataHelper
{
private byte command;

private ushort args;

public byte[] payload = new byte[68];

public byte[] LoadPackage(byte cmd, ushort address, byte[] dat, byte len)
{
byte[] array = new byte[68];
for (int i = 0; i < 64; i++)
{
array[4 + i] = 0;
}
array[0] = cmd;
array[1] = (byte)(address >> 8);
array[2] = (byte)address;
array[3] = len;
for (int j = 0; j < len; j++)
{
array[4 + j] = dat[j];
}
return array;
}
}
10 changes: 5 additions & 5 deletions Utils/Serial/WriBootImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ public WriBootImage(SHX_DEVICE device, SKBitmap img)
image = img;
comStep = State.HandShakeStep1;
NComStep = NImgStep.Step_HandShake;
if (device != SHX_DEVICE.SHX8600PRO)
if (device is SHX_DEVICE.SHX8600PRO or SHX_DEVICE.SHX8800PRO)
{
TimerInit();
_sp.OpenSerial();
TimerInitPro();
_sp.OpenSerialPro();
}
else
{
TimerInitPro();
_sp.OpenSerialPro();
TimerInit();
_sp.OpenSerial();
}
}

Expand Down
Loading

0 comments on commit 6cbfb0c

Please sign in to comment.