diff options
author | cpldcpu <cpldcpu@gmail.com> | 2015-05-30 18:39:45 +0200 |
---|---|---|
committer | cpldcpu <cpldcpu@gmail.com> | 2015-05-30 18:39:45 +0200 |
commit | 616f5810f1ba98f3f963e4e8b947ad3c6bd9ea57 (patch) | |
tree | cfab3078f83d8d6e52d91ad8d55939854863a7ae /firmware/main.c | |
parent | a7aa590a8965516ad0f0865be2c87b794127a8e0 (diff) | |
download | micronucleus-616f5810f1ba98f3f963e4e8b947ad3c6bd9ea57.tar.gz micronucleus-616f5810f1ba98f3f963e4e8b947ad3c6bd9ea57.tar.bz2 micronucleus-616f5810f1ba98f3f963e4e8b947ad3c6bd9ea57.zip |
firmware: added OSCCAL_SLOW_PROGRAMMING
Diffstat (limited to 'firmware/main.c')
-rw-r--r-- | firmware/main.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/firmware/main.c b/firmware/main.c index a6bb8c6..fdf22e4 100644 --- a/firmware/main.c +++ b/firmware/main.c @@ -229,6 +229,8 @@ static inline void leaveBootloader(void) { void USB_INTR_VECTOR(void); int main(void) { + uint8_t osccal_tmp; + bootLoaderInit(); /* save default OSCCAL calibration */ @@ -286,12 +288,22 @@ int main(void) { } while(--fastctr); wdr(); - + + #if OSCCAL_SLOW_PROGRAMMING + osccal_tmp = OSCCAL; + OSCCAL = osccal_default; + #endif // commands are only evaluated after next USB transmission or after 5 ms passed if (command==cmd_erase_application) eraseApplication(); if (command==cmd_write_page) writeFlashPage(); + #if OSCCAL_SLOW_PROGRAMMING + OSCCAL = osccal_tmp; + #endif + + + if (command==cmd_exit) { if (!fastctr) break; // Only exit after 5 ms timeout } else { |