configinti2c2.c

来自「基於 c51/8051 的 nand Flash Memory HY27US08」· C语言 代码 · 共 30 行

C
30
字号
#if defined(__PIC24F__)
#include <p24Fxxxx.h>
#endif
#include <i2c.h>

/*********************************************************************
*    Function Name:  ConfigIntI2C2                                      
*    Description:    This routine enables/disables the SI2C & MI2C  
*                    interrupts and sets their priorities
*    Parameters:     unsigned int : config  
*    Return Value:   void
*********************************************************************/
#ifdef _I2C_V2_2

void ConfigIntI2C2(unsigned int config)
{
     IFS3bits.SI2C2IF = 0;                       /* clear the MI2C & SI2C Interrupts */
     IFS3bits.MI2C2IF = 0;

     IPC12bits.SI2C2P = (config & 0x0007);       /* set the SI2C priority */
     IPC12bits.MI2C2P = (config & 0x0070) >> 4;    /* set the MI2C priority */

     IEC3bits.SI2C2IE = (config & 0x0008)>> 3;   /* enable/disable the SI2C Interrupt */
     IEC3bits.MI2C2IE = (config & 0x0080) >> 7;    /* enable/disable the MI2C Interrupt */
}

#else
#warning "Does not build on this target"
#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?