|
@@ -464,7 +464,7 @@ int main(void) {
|
|
|
// If not, uncomment the following instructions:
|
|
|
// cli();
|
|
|
asm volatile ("clr __zero_reg__");
|
|
|
-#if defined(__AVR_ATmega8__) || defined (__AVR_ATmega32__)
|
|
|
+#if defined(__AVR_ATmega8__) || defined (__AVR_ATmega32__) || defined (__AVR_ATmega16__)
|
|
|
SP=RAMEND; // This is done by hardware reset
|
|
|
#endif
|
|
|
|
|
@@ -474,8 +474,13 @@ int main(void) {
|
|
|
* can leave multiple reset flags set; we only want the bootloader to
|
|
|
* run on an 'external reset only' status
|
|
|
*/
|
|
|
+#if !defined(__AVR_ATmega16__)
|
|
|
ch = MCUSR;
|
|
|
MCUSR = 0;
|
|
|
+#else
|
|
|
+ ch = MCUCSR;
|
|
|
+ MCUCSR = 0;
|
|
|
+#endif
|
|
|
if (ch & (_BV(WDRF) | _BV(BORF) | _BV(PORF)))
|
|
|
appStart(ch);
|
|
|
|
|
@@ -485,7 +490,7 @@ int main(void) {
|
|
|
#endif
|
|
|
|
|
|
#ifndef SOFT_UART
|
|
|
-#if defined(__AVR_ATmega8__) || defined (__AVR_ATmega32__)
|
|
|
+#if defined(__AVR_ATmega8__) || defined (__AVR_ATmega32__) || defined (__AVR_ATmega16__)
|
|
|
UCSRA = _BV(U2X); //Double speed mode USART
|
|
|
UCSRB = _BV(RXEN) | _BV(TXEN); // enable Rx & Tx
|
|
|
UCSRC = _BV(URSEL) | _BV(UCSZ1) | _BV(UCSZ0); // config USART; 8N1
|
|
@@ -711,7 +716,7 @@ uint8_t getch(void) {
|
|
|
uint8_t ch;
|
|
|
|
|
|
#ifdef LED_DATA_FLASH
|
|
|
-#if defined(__AVR_ATmega8__) || defined (__AVR_ATmega32__)
|
|
|
+#if defined(__AVR_ATmega8__) || defined (__AVR_ATmega32__) || defined (__AVR_ATmega16__)
|
|
|
LED_PORT ^= _BV(LED);
|
|
|
#else
|
|
|
LED_PIN |= _BV(LED);
|
|
@@ -762,7 +767,7 @@ uint8_t getch(void) {
|
|
|
#endif
|
|
|
|
|
|
#ifdef LED_DATA_FLASH
|
|
|
-#if defined(__AVR_ATmega8__) || defined (__AVR_ATmega32__)
|
|
|
+#if defined(__AVR_ATmega8__) || defined (__AVR_ATmega32__) || defined (__AVR_ATmega16__)
|
|
|
LED_PORT ^= _BV(LED);
|
|
|
#else
|
|
|
LED_PIN |= _BV(LED);
|
|
@@ -811,7 +816,7 @@ void flash_led(uint8_t count) {
|
|
|
TCNT1 = -(F_CPU/(1024*16));
|
|
|
TIFR1 = _BV(TOV1);
|
|
|
while(!(TIFR1 & _BV(TOV1)));
|
|
|
-#if defined(__AVR_ATmega8__) || defined (__AVR_ATmega32__)
|
|
|
+#if defined(__AVR_ATmega8__) || defined (__AVR_ATmega32__) || defined (__AVR_ATmega16__)
|
|
|
LED_PORT ^= _BV(LED);
|
|
|
#else
|
|
|
LED_PIN |= _BV(LED);
|