Merge pull request #782 from ejoerns/pull-req/avr-mcucsrfix
[avr] Removed usage of deprecated MCUSR
This commit is contained in:
commit
03a923b6b9
@ -9,10 +9,12 @@
|
|||||||
#include <avr/interrupt.h>
|
#include <avr/interrupt.h>
|
||||||
#include <avr/eeprom.h>
|
#include <avr/eeprom.h>
|
||||||
|
|
||||||
/* Not all AVR toolchains alias MCUSR to the older MSUSCR name */
|
/* MCUSR is a deprecated name but older avr-libc versions may define it */
|
||||||
#if !defined (MCUSR) && defined (MCUCSR)
|
#if !defined (MCUCSR)
|
||||||
#warning *** MCUSR not defined, using MCUCSR instead ***
|
# if defined (MCUSR)
|
||||||
#define MCUSR MCUCSR
|
# warning *** MCUCSR not defined, using MCUSR instead ***
|
||||||
|
# define MCUCSR MCUSR
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef EEPROM_MAGIC_BYTE_ADDR
|
#ifndef EEPROM_MAGIC_BYTE_ADDR
|
||||||
@ -69,8 +71,8 @@ Bootloader_Jump_Check(void)
|
|||||||
/* If the reset source was the bootloader and the key is correct,
|
/* If the reset source was the bootloader and the key is correct,
|
||||||
* clear it and jump to the bootloader
|
* clear it and jump to the bootloader
|
||||||
*/
|
*/
|
||||||
if(MCUSR & (1 << WDRF)) {
|
if(MCUCSR & (1 << WDRF)) {
|
||||||
MCUSR = 0;
|
MCUCSR = 0;
|
||||||
if(Boot_Key == MAGIC_BOOT_KEY) {
|
if(Boot_Key == MAGIC_BOOT_KEY) {
|
||||||
Boot_Key = 0;
|
Boot_Key = 0;
|
||||||
wdt_disable();
|
wdt_disable();
|
||||||
|
@ -64,11 +64,12 @@
|
|||||||
#include <avr/wdt.h>
|
#include <avr/wdt.h>
|
||||||
#include <avr/interrupt.h>
|
#include <avr/interrupt.h>
|
||||||
|
|
||||||
//Not all AVR toolchains alias MCUSR to the older MSUSCR name
|
/* MCUSR is a deprecated name but older avr-libc versions may define it */
|
||||||
//#if defined (__AVR_ATmega8__) || defined (__AVR_ATmega8515__) || defined (__AVR_ATmega16__)
|
#if !defined (MCUCSR)
|
||||||
#if !defined (MCUSR) && defined (MCUCSR)
|
# if defined (MCUSR)
|
||||||
#warning *** MCUSR not defined, using MCUCSR instead ***
|
# warning *** MCUCSR not defined, using MCUSR instead ***
|
||||||
#define MCUSR MCUCSR
|
# define MCUCSR MCUSR
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if WATCHDOG_CONF_BALANCE && WATCHDOG_CONF_TIMEOUT >= 0
|
#if WATCHDOG_CONF_BALANCE && WATCHDOG_CONF_TIMEOUT >= 0
|
||||||
@ -82,7 +83,7 @@ watchdog_init(void)
|
|||||||
/* Clear startup bit and disable the wdt, whether or not it will be used.
|
/* Clear startup bit and disable the wdt, whether or not it will be used.
|
||||||
Random code may have caused the last reset.
|
Random code may have caused the last reset.
|
||||||
*/
|
*/
|
||||||
MCUSR&=~(1<<WDRF);
|
MCUCSR&=~(1<<WDRF);
|
||||||
wdt_disable();
|
wdt_disable();
|
||||||
#if WATCHDOG_CONF_BALANCE && WATCHDOG_CONF_TIMEOUT >= 0
|
#if WATCHDOG_CONF_BALANCE && WATCHDOG_CONF_TIMEOUT >= 0
|
||||||
stopped = 1;
|
stopped = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user