This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
tutorials:library:arduino:bootloader.html [2011/04/14 21:15] daigo |
tutorials:library:arduino:bootloader.html [2016/01/28 18:05] (current) |
||
---|---|---|---|
Line 29: | Line 29: | ||
uint8_t ch,ch2; | uint8_t ch,ch2; | ||
uint16_t w; | uint16_t w; | ||
- | <strong> | + | |
ch = MCUSR; | ch = MCUSR; | ||
MCUSR = 0; | MCUSR = 0; | ||
Line 49: | Line 49: | ||
else if(ch=='Q') { | else if(ch=='Q') { | ||
nothing_response(); | nothing_response(); | ||
- | <strong> | + | |
// autoreset via watchdog (sneaky!) | // autoreset via watchdog (sneaky!) | ||
WDTCSR = _BV(WDE); | WDTCSR = _BV(WDE); | ||
Line 89: | Line 89: | ||
uint8_t ch,ch2; | uint8_t ch,ch2; | ||
uint16_t w; | uint16_t w; | ||
- | **uint8_t firstchar = 0;** | + | uint8_t firstchar = 0; |
..... | ..... | ||
Line 95: | Line 95: | ||
/* Hello is anyone home ? */ | /* Hello is anyone home ? */ | ||
if(ch=='0') { | if(ch=='0') { | ||
- | fi**rstchar = 1; // we got an appropriate bootloader instruction** | + | firstchar = 1; // we got an appropriate bootloader instruction |
nothing_response(); | nothing_response(); | ||
- | } <strong>else if (firstchar == 0) { | + | }else if (firstchar == 0) { |
// the first character we got is not '0', lets bail! | // the first character we got is not '0', lets bail! | ||
// autoreset via watchdog (sneaky!) | // autoreset via watchdog (sneaky!) | ||
WDTCSR = _BV(WDE); | WDTCSR = _BV(WDE); | ||
while (1); // 16 ms | while (1); // 16 ms | ||
- | }</strong> | + | } |
</code> | </code> | ||
\\ | \\ | ||
- | You can also just replace the last two lines with <strong class="style2">app_start()</strong> | + | You can also just replace the last two lines with **app_start()** |