src/pcint.cpp
//these are likely all 0 at the start
these are likely all 0 at the start
these are likely all 0 at the start
void attachPCInt(uint8_t pcInt, void (*pcisr)(void))
{
    cli();
    PCICR = (1 << PCIE0);   
    PCMSK0 |= (1 << pcInt); 
    pcISR[pcInt] = pcisr;   
    PCIFR = (1 << PCIF0);   
    lastB &= ~(1 << pcInt);             
    lastB |= PINB & (1 << pcInt);      
    sei();
}
void attachPCInt ( uint8_t pcInt , void ( * pcisr ) ( void ) ) { cli ( ) ; PCICR = ( 1 << PCIE0 ) ; PCMSK0 |= ( 1 << pcInt ) ; pcISR [ pcInt ] = pcisr ; PCIFR = ( 1 << PCIF0 ) ; lastB &= ~ ( 1 << pcInt ) ; lastB |= PINB & ( 1 << pcInt ) ; sei ( ) ; }
these are likely all 0 at the start
these are likely all 0 at the start
//enable PC interrupts (not a problem to set repeatedly) //enable PCInt on the specific pin //register the ISR //clear any pending interrupt before we get started //make sure we start with the current state, but don't clobber other pins //clear the affected pin in lastB //then set it to the current state