projects
/
pub
/
USBaspLoader.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
improve bootloader-exit logik
[pub/USBaspLoader.git]
/
firmware
/
main.c
diff --git
a/firmware/main.c
b/firmware/main.c
index
b3f1470
..
5e38af5
100644
(file)
--- a/
firmware/main.c
+++ b/
firmware/main.c
@@
-222,12
+222,14
@@
static uchar replyBuffer[4];
}
}else if(rq->bRequest == USBASP_FUNC_DISCONNECT){
}
}else if(rq->bRequest == USBASP_FUNC_DISCONNECT){
- stayinloader
= 0
;
+ stayinloader
&= (0x7f)
;
#if BOOTLOADER_CAN_EXIT
requestBootLoaderExit = 1; /* allow proper shutdown/close of connection */
#endif
#if BOOTLOADER_CAN_EXIT
requestBootLoaderExit = 1; /* allow proper shutdown/close of connection */
#endif
+ }else if(rq->bRequest == USBASP_FUNC_CONNECT){
+ stayinloader |= (0x80);
}else{
}else{
- /* ignore:
USBASP_FUNC_CONNECT
*/
+ /* ignore:
others
*/
}
return len;
}
}
return len;
}
@@
-366,7
+368,17
@@
int __attribute__((noreturn)) main(void)
}
}
#endif
}
}
#endif
- }while ((stayinloader) || (!bootLoaderCondition())); /* main event loop */
+ if (stayinloader & 0x1) {
+ if (!bootLoaderCondition()) {
+ stayinloader = (stayinloader & 0xfc) | 0x2;
+ }
+ } else {
+ if (bootLoaderCondition()) {
+ stayinloader &= 0xfc;
+ }
+ }
+
+ }while (stayinloader); /* main event loop */
}
leaveBootloader();
}
}
leaveBootloader();
}