示例#1
0
/************************************************************************
* Function: SST25Init                                                  
*                                                                       
* Overview: this function setup SPI and IOs connected to SST25
*                                                                       
* Input: none                                                          
*                                                                       
* Output: none
*                                                                       
************************************************************************/
void SST25Init(void)
{

    // Initialize SPI2

/*   
    SPI2STAT = 0;
    SPI2CON1 = 0x001b;
    SPI2CON1bits.MSTEN = 1;
    SPI2CON2 = 0;
    SPI2CON1bits.MODE16 = 0;
    SPI2CON1bits.CKE = 0;
    SPI2CON1bits.CKP = 1;
    SPI2CON1bits.SMP = 1;
    SPI2STATbits.SPIEN = 1;
*/
    // Set IOs directions for EEPROM SPI
    SST25_SS_TRIS = 0;
    SST25_SS_PORT = 1;
	Nop();
    Nop();
	Nop();
    EEPROM_SCK_TRIS = 0;
	Nop();
    EEPROM_SDO_TRIS = 0;
    Nop();
	Nop();
    EEPROM_SDI_TRIS = 1;

    SST25ResetWriteProtection();
}
示例#2
0
/************************************************************************
* Function: SST25Init                                                  
*                                                                       
* Overview: this function setup SPI and IOs connected to SST25
*                                                                       
* Input: none                                                          
*                                                                       
* Output: none
*                                                                       
************************************************************************/
void SST25Init(DRV_SPI_INIT_DATA *pInitData)
{
    // initialize the SPI channel to be used
    // SPI_CHANNEL_USED is defined in the hardware profile
    DRV_SPI_Initialize(pInitData->channel, pInitData);
    memcpy(&spiInitData, pInitData, sizeof(DRV_SPI_INIT_DATA));

    SST25ResetWriteProtection();
}
示例#3
0
/************************************************************************
* Function: SST25Init                                                  
*                                                                       
* Overview: this function setup SPI and IOs connected to SST25
*                                                                       
* Input: none                                                          
*                                                                       
* Output: none
*                                                                       
************************************************************************/
void SST25Init( DRV_SPI_INIT *pInitData )
{
    // initialize the SPI channel to be used
    // SPI_CHANNEL_USED is defined in the hardware profile
    //Set IOs directions for SST25 SPI

    SST25_CS_LAT = 1;
    SST25_CS_TRIS = 0;

    memcpy(&spiInitData, pInitData, sizeof(DRV_SPI_INIT));

    SST25ResetWriteProtection();
}