void i2c_int_handler() { #ifdef I2CMASTER i2c_master_int_handler(); #else i2c_slave_int_handler(); #endif }
interrupt #else #pragma code #pragma interrupt InterruptHandlerHigh #endif void InterruptHandlerHigh() { // We need to check the interrupt flag of each enabled high-priority interrupt to // see which device generated this interrupt. Then we can call the correct handler. // check to see if we have an I2C interrupt if (PIR1bits.SSPIF) { // clear the interrupt flag PIR1bits.SSPIF = 0; // call the handler i2c_master_int_handler(); } // check to see if we have an interrupt on timer 0 if (INTCONbits.TMR0IF) { INTCONbits.TMR0IF = 0; // clear this interrupt flag // call whatever handler you want (this is "user" defined) timer0_int_handler(); } // here is where you would check other interrupt flags. // The *last* thing I do here is check to see if we can // allow the processor to go to sleep // This code *DEPENDS* on the code in messages.c being // initialized using "init_queues()" -- if you aren't using // this, then you shouldn't have this call here SleepIfOkay(); }
void i2c_int_handler() { switch (i2c_mode){ case I2C_MODE_MASTER: { i2c_master_int_handler(); break; } case I2C_MODE_SLAVE: { i2c_slave_int_handler(); break; } default: { // mode was not set, ERROR break; } } }
/** * Handle an interrupt on the specified controller. * * @param controller I2C controller generating interrupt */ void handle_interrupt(int controller) { i2c_master_int_handler(controller); }