watterott / ATmega328PB-Testing

Atmel/Microchip ATmega328PB support for Arduino IDE
https://learn.watterott.com
76 stars 61 forks source link

__AVR_HAVE_PRR0_PRTWI0 not correctly defined #51

Closed chaveiro closed 4 years ago

chaveiro commented 4 years ago

If selectring ATmega328PB board the follow code fails :

#include <avr/power.h>

void setup() {
  power_twi0_disable();
  power_spi0_disable();
}

void loop() {

}

Error:

In function 'void setup()':

sketch_may03a:4: error: 'power_twi_disable' was not declared in this scope

power_twi0_disable();

                 ^

exit status 1 'power_twi0_disable' was not declared in this scope

File hardware\tools\avr\avr\include\avr\power.h should have this entry:

#if defined(__AVR_HAVE_PRR0_PRTWI0)
#define power_twi0_enable()              (PRR0 &= (uint8_t)~(1 << PRTWI0))
#define power_twi0_disable()             (PRR0 |= (uint8_t)(1 << PRTWI0))
#endif

#if defined(__AVR_HAVE_PRR0_PRSPI0)
#define power_spi0_enable()      (PRR0 &= (uint8_t)~(1 << PRSPI0))
#define power_spi0_disable()     (PRR0 |= (uint8_t)(1 << PRSPI0))
#endif

#if defined(__AVR_HAVE_PRR1_PRSPI1)
#define power_spi1_enable()      (PRR1 &= (uint8_t)~(1 << PRSPI1))
#define power_spi1_disable()     (PRR1 |= (uint8_t)(1 << PRSPI1))
#endif
awatterott commented 4 years ago

It is an issue from the toolchain: https://github.com/arduino/toolchain-avr/issues/66