From bdae3d430ffe822b97382ca2eb4c8a34bee75004 Mon Sep 17 00:00:00 2001 From: cpldcpu Date: Sun, 16 Mar 2014 09:29:12 +0100 Subject: commandline: Update to 2.0a4 to accomodate for new device configuration reply for attiny841 --- commandline/builds/Windows/micronucleus.exe | Bin 27150 -> 27150 bytes commandline/library/micronucleus_lib.c | 18 +++++++++++++----- commandline/library/micronucleus_lib.h | 6 ++++-- commandline/micronucleus.c | 8 +++++--- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/commandline/builds/Windows/micronucleus.exe b/commandline/builds/Windows/micronucleus.exe index e52115e..4f17f99 100644 Binary files a/commandline/builds/Windows/micronucleus.exe and b/commandline/builds/Windows/micronucleus.exe differ diff --git a/commandline/library/micronucleus_lib.c b/commandline/library/micronucleus_lib.c index e2497c2..4961703 100644 --- a/commandline/library/micronucleus_lib.c +++ b/commandline/library/micronucleus_lib.c @@ -1,8 +1,10 @@ /* Created: September 2012 - by ihsan Kehribar - + (c) 2012 by ihsan Kehribar + Changes for Micronucleus protocol version V2.x + (c) 2014 T. Bo"scke + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to @@ -74,10 +76,16 @@ micronucleus* micronucleus_connect(int fast_mode) { if ((nucleus->version.major>=2)&&(!fast_mode)) { // firmware v2 reports more aggressive write times. Add 2ms if fast mode is not used. - nucleus->write_sleep = buffer[3]+2; - nucleus->erase_sleep = nucleus->write_sleep * nucleus->pages; + nucleus->write_sleep = (buffer[3] & 127) + 2; + if (buffer[3]&128) { + // if bit 7 of write sleep time is set, divide the erase time by four to + // accomodate to the 4*page erase of the ATtiny841/441 + nucleus->erase_sleep = nucleus->write_sleep * nucleus->pages / 4; + } else { + nucleus->erase_sleep = nucleus->write_sleep * nucleus->pages; + } } else { - nucleus->write_sleep = buffer[3]; + nucleus->write_sleep = (buffer[3] & 127); nucleus->erase_sleep = nucleus->write_sleep * nucleus->pages; } } diff --git a/commandline/library/micronucleus_lib.h b/commandline/library/micronucleus_lib.h index 9031d2f..5bab8b4 100644 --- a/commandline/library/micronucleus_lib.h +++ b/commandline/library/micronucleus_lib.h @@ -3,7 +3,9 @@ /* Created: September 2012 - by ihsan Kehribar + (c) 2012 by ihsan Kehribar + Changes for Micronucleus protocol version V2.x + (c) 2014 T. Bo"scke Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in @@ -58,7 +60,7 @@ typedef struct _micronucleus_version { unsigned char minor; } micronucleus_version; -#define MICRONUCLEUS_COMMANDLINE_VERSION "Commandline tool version: 2.0a3" +#define MICRONUCLEUS_COMMANDLINE_VERSION "Commandline tool version: 2.0a4" // handle representing one micronucleus device typedef struct _micronucleus { diff --git a/commandline/micronucleus.c b/commandline/micronucleus.c index 5bef829..9e875db 100644 --- a/commandline/micronucleus.c +++ b/commandline/micronucleus.c @@ -1,7 +1,9 @@ /* - Created: September 2012 - by ihsan Kehribar - +Created: September 2012 + (c) 2012 by ihsan Kehribar + Changes for Micronucleus protocol version V2.x + (c) 2014 T. Bo"scke + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to -- cgit v1.2.3