summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcpldcpu <cpldcpu@gmail.com>2014-03-16 09:29:12 +0100
committercpldcpu <cpldcpu@gmail.com>2014-03-16 09:29:12 +0100
commitbdae3d430ffe822b97382ca2eb4c8a34bee75004 (patch)
tree1f4f8a822a2991e9e37c08da2d9208f4c5e83f4b
parent8773da4c5ff13ced369e8bc169956dd36a613918 (diff)
downloadmicronucleus-bdae3d430ffe822b97382ca2eb4c8a34bee75004.tar.gz
micronucleus-bdae3d430ffe822b97382ca2eb4c8a34bee75004.tar.bz2
micronucleus-bdae3d430ffe822b97382ca2eb4c8a34bee75004.zip
commandline: Update to 2.0a4 to accomodate for new device configuration reply for attiny841
-rw-r--r--commandline/builds/Windows/micronucleus.exebin27150 -> 27150 bytes
-rw-r--r--commandline/library/micronucleus_lib.c18
-rw-r--r--commandline/library/micronucleus_lib.h6
-rw-r--r--commandline/micronucleus.c8
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
--- a/commandline/builds/Windows/micronucleus.exe
+++ b/commandline/builds/Windows/micronucleus.exe
Binary files 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 <ihsan@kehribar.me>
-
+ (c) 2012 by ihsan Kehribar <ihsan@kehribar.me>
+ 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 <ihsan@kehribar.me>
+ (c) 2012 by ihsan Kehribar <ihsan@kehribar.me>
+ 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 <ihsan@kehribar.me>
-
+Created: September 2012
+ (c) 2012 by ihsan Kehribar <ihsan@kehribar.me>
+ 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