diff options
author | Jenna Fox <a@creativepony.com> | 2012-09-27 00:15:00 +1000 |
---|---|---|
committer | Jenna Fox <a@creativepony.com> | 2012-09-27 00:15:00 +1000 |
commit | c235d1b8cada49a42a0f48379d127937136beeae (patch) | |
tree | e60abb41850de43e1c4f8967fae7aa61e0e0e146 | |
parent | 2bf95cd6288a5560e7f0dce144e57583674920ec (diff) | |
download | micronucleus-c235d1b8cada49a42a0f48379d127937136beeae.tar.gz micronucleus-c235d1b8cada49a42a0f48379d127937136beeae.tar.bz2 micronucleus-c235d1b8cada49a42a0f48379d127937136beeae.zip |
More comments
-rw-r--r-- | firmware/main.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/firmware/main.c b/firmware/main.c index 2f9444f..59498b7 100644 --- a/firmware/main.c +++ b/firmware/main.c @@ -274,6 +274,7 @@ static uchar usbFunctionWrite(uchar *data, uchar length) { // TODO: Isn't this always last? // if we have now reached another page boundary, we're done uchar isLast = (writeLength == 0); + // definitely need this if! seems usbFunctionWrite gets called again in future usbPoll's in the runloop! if (isLast) fireEvent(EVENT_WRITE_PAGE); // ask runloop to write our page return isLast; // let vusb know we're done with this request @@ -320,10 +321,10 @@ static inline void tiny85FlashWrites(void) { _delay_us(2000); // TODO: why is this here? - it just adds pointless two level deep loops seems like? // write page to flash, interrupts will be disabled for > 4.5ms including erase - if (currentAddress % SPM_PAGESIZE) { - fillFlashWithVectors(); + if (currentAddress % SPM_PAGESIZE) { // when we aren't perfectly aligned to a flash page boundary + fillFlashWithVectors(); // fill up the rest of the page with 0xFFFF (unprogrammed) bits } else { - writeFlashPage(); + writeFlashPage(); // otherwise just write it } } @@ -363,7 +364,7 @@ int __attribute__((noreturn)) main(void) { bootLoaderInit(); - if (bootLoaderCondition()){ + if (bootLoaderCondition()) { initForUsbConnectivity(); do { usbPoll(); |