Skip to content

feat: create upload_reset binary for linux (64-bit) #95

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

Merged
merged 2 commits into from
Mar 25, 2024
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
Binary file modified linux/upload_reset
Binary file not shown.
73 changes: 38 additions & 35 deletions src/upload_reset/unix/upload_reset.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,44 +118,47 @@ int setDTR(unsigned short level)
* Maple and Maple mini boards
*/

main(int argc, char *argv[])
int main(int argc, char *argv[])
{

int ret = 0;
if (argc<2 || argc >3)
{
printf("Usage upload-reset <serial_device> <Optional_delay_in_milliseconds>\n\r");
return;
}

if (openserial(argv[1]))
{
// Send magic sequence of DTR and RTS followed by the magic word "1EAF"
setRTS(false);
setDTR(false);
setDTR(true);

usleep(50000L);

setDTR(false);
setRTS(true);
setDTR(true);

usleep(50000L);

setDTR(false);

usleep(50000L);

write(fd,"1EAF",4);

closeserial();
if (argc==3)
{
usleep(atol(argv[2])*1000L);
}
}
else
{
printf("Failed to open serial device.\n\r");
ret = 1;
}
else {
if (openserial(argv[1]))
{
// Send magic sequence of DTR and RTS followed by the magic word "1EAF"
setRTS(false);
setDTR(false);
setDTR(true);

usleep(50000L);

setDTR(false);
setRTS(true);
setDTR(true);

usleep(50000L);

setDTR(false);

usleep(50000L);

write(fd,"1EAF",4);

closeserial();
if (argc==3)
{
usleep(atol(argv[2])*1000L);
}
}
else
{
printf("Failed to open serial device.\n\r");
ret = 2;
}
}
return ret;
}