Код: Выделить всё
#include <avr/wdt.h>
volatile uint8_t &portd = PIND; //interrupts port
const uint8_t pinint0 = 1 << INT0; //pin INT0
void soft_reset(const uint8_t wdt_prescale, const uint8_t &port = 1, const uint8_t pin = 1){
wdt_enable(wdt_prescale);
while(port & pin);
wdt_reset();
wdt_disable();
}
void isPIRHigh(const uint8_t &port, const uint8_t pin){
soft_reset(WDTO_8S, ~port, pin); //finish when PD0 high
}
void isPIRLow(const uint8_t &port, const uint8_t pin){
soft_reset(WDTO_8S, port, pin); //finish when PD0 low
}
void isPIRAlive(){
isPIRHigh(portd, pinint0);
isPIRLow(portd, pinint0);
}
void setup(){isPIRAlive();}если убираю uint8_t &port = 1 то выдает ошибку invalid initialization of non-const reference of type 'uint8_t& {aka unsigned char&}' from an rvalue of type 'uint8_t {aka unsigned char}'
есть идеи?




