⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 slaveputsi2c2.c

📁 PIC driver for ILI9325 display
💻 C
字号:
#if defined(__PIC24F__)
#include <p24Fxxxx.h>
#endif
#include <i2c.h>

/**************************************************************************
*    Function Name:  SlaveputsI2C2
*    Description:    This routine is used to write out a string to the 
*                    I2C bus.If write collision occurs,-3 is sent.If 
*                    string is written and null char reached, 0 is returned.                 
*    Parameters:     unsigned char * : wrptr
*    Return Value:   unsigned int
****************************************************************************/


#ifdef _I2C_V2_2

unsigned int SlaveputsI2C2(unsigned char * wrptr)
{
    I2C2CONbits.STREN = 1;            /* SCL clock stretch enable bit */
    while(*wrptr)                /* transmit data until null char */
    {
        SlaveputcI2C2(*wrptr++);         /* Send a byte */
    while(I2C2STATbits.TBF);         /* wait till the transmit buffer is clear */ 
        while(!IFS3bits.SI2C2IF);     /* Wait till the ACK from master is received */
	    IFS3bits.SI2C2IF = 0;        /* Clear Flag */
    }
    return 0;                        /* null char was reached */
}



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

⌨️ 快捷键说明

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