aboutsummaryrefslogtreecommitdiff
path: root/Projects/AVRISP-MKII/Lib/Timeout.S
diff options
context:
space:
mode:
authorDean Camera <[email protected]>2010-05-02 05:16:34 +0000
committerDean Camera <[email protected]>2010-05-02 05:16:34 +0000
commit3d28d53c3e2ae529933283e63a8b05f2ab1ce2be (patch)
treef395bb297884750d54614b941f2bda0727cc2796 /Projects/AVRISP-MKII/Lib/Timeout.S
parent9a1560dc050f79fd189838a87ce623e79ff48677 (diff)
downloadqmk_firmware-3d28d53c3e2ae529933283e63a8b05f2ab1ce2be.tar.gz
qmk_firmware-3d28d53c3e2ae529933283e63a8b05f2ab1ce2be.zip
Change AVRISP project's timeout to be interrupt based again, but make the interrupt itself interruptable and use a seperate assembly file to hand-optimize the ISR code.
Removed the cast to uint16_t on the set baud rate in the USBtoSerial project, so that the higher >1M baud rates can be selected (thanks to Steffan).
Diffstat (limited to 'Projects/AVRISP-MKII/Lib/Timeout.S')
-rw-r--r--Projects/AVRISP-MKII/Lib/Timeout.S23
1 files changed, 23 insertions, 0 deletions
diff --git a/Projects/AVRISP-MKII/Lib/Timeout.S b/Projects/AVRISP-MKII/Lib/Timeout.S
new file mode 100644
index 0000000000..ad56d1d215
--- /dev/null
+++ b/Projects/AVRISP-MKII/Lib/Timeout.S
@@ -0,0 +1,23 @@
+#include <avr/io.h>
+#include "V2Protocol.h"
+
+.global TIMER0_COMPA_vect
+TIMER0_COMPA_vect:
+ sei
+ push r24
+ in r24, 0x3f
+ push r24
+
+ in r24, TimeoutMSRemaining
+ and r24, r24
+ breq Epilogue
+ subi r24, 0x01
+ out TimeoutMSRemaining, r24
+
+Epilogue:
+ pop r24
+ out 0x3f, r24
+ pop r24
+ reti
+
+ \ No newline at end of file