From 24d371d5e75bf55a70a412a9f544a19614ff56f4 Mon Sep 17 00:00:00 2001 From: cpldcpu Date: Sat, 13 Feb 2016 21:35:02 +0100 Subject: firmware: v2.03 release --- firmware/main.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'firmware/main.c') diff --git a/firmware/main.c b/firmware/main.c index bcfa91e..8221105 100644 --- a/firmware/main.c +++ b/firmware/main.c @@ -1,7 +1,7 @@ /* - * Project: Micronucleus - v2.1 + * Project: Micronucleus - v2.3 * - * Micronucleus V2.1 (c) 2015 Tim Bo"scke - cpldcpu@gmail.com + * Micronucleus V2.3 (c) 2016 Tim Bo"scke - cpldcpu@gmail.com * (c) 2014 Shay Green * Original Micronucleus (c) 2012 Jenna Fox * @@ -12,7 +12,7 @@ */ #define MICRONUCLEUS_VERSION_MAJOR 2 -#define MICRONUCLEUS_VERSION_MINOR 2 +#define MICRONUCLEUS_VERSION_MINOR 3 #include #include @@ -175,6 +175,12 @@ static uint8_t usbFunctionSetup(uint8_t data[8]) { if ( currentAddress.w != 0 ) { currentAddress.b[0]=rq->wIndex.bytes[0] & (~ (SPM_PAGESIZE-1)); currentAddress.b[1]=rq->wIndex.bytes[1]; + + // clear page buffer as a precaution before filling the buffer in case + // a previous write operation failed and there is still something in the buffer. + __SPM_REG=(_BV(CTPB)|_BV(__SPM_ENABLE)); + asm volatile("spm"); + } } else if (rq->bRequest == cmd_write_data) { // Write data writeWordToPageBuffer(rq->wValue.word); -- cgit v1.2.3