openspi2.c

来自「PIC driver for ILI9325 display」· C语言 代码 · 共 34 行

C
34
字号
#if defined(__PIC24F__)
#include <p24Fxxxx.h>
#endif
#include "spi.h"

/********************************************************************************
*   Function Name :  OpenSPI2                                                   *
*   Description   :  This function Initializes the SPI module and Also enables  *
*                    SPI module                                                 *
*   Parameters    :  unsigned int config1,unsigned int config2                  *
*   Return Value  :  None                                                       *
*   Note:            Config1 contains information about framed SPI support,     *
*                    frame sync pulse,Disable SDO pin, Word/byte communication  *  
*                    data input sample phase bit, clock edge select bit,slave   *
*                    select ,clock polarity select bit ,Master enable bit       *
*                    secondary prescale bit, Primary prescale bit               *
*                    Config2 contains information about Enable/Disable SPI,SPI  *
*                    Operation during CPU IDLE mode                             *
********************************************************************************/
#ifdef _SPI_V2_2

/* The following devices support SPI2 */

void OpenSPI2(unsigned int config1,unsigned int config2,unsigned int config3)
{   
     SPI2CON1 = config1;   /* Initalizes the spi module */ 
     SPI2CON2 = config2;
     SPI2STAT = config3;  /* Enable/Disable the spi module */ 
}

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

⌨️ 快捷键说明

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