Beispiel #1
0
int main(void)
{
    char strClearLine[15] = "ID:            ";
    /* Init System, IP clock and multi-function I/O */
    SYS_Init();     

    /* Init UART0 for printf */
    UART0_Init();   

    printf("CPU @ %dHz\n", SystemCoreClock);

    /* Init SPI0 and LCD */
    LCD_Init();
    LCD_EnableBackLight();
    LCD_ClearScreen();


    LCD_Print(0, "SPI Sample Code ");
    LCD_Print(1, "For Flash Test");
    LCD_Print(2, "Press INT button");

    /* Init P3.2 */
    GPIO_Init();

    SPIFLASH_Init();
    sprintf(g_strBuf, "ID:%x         ", SPIFLASH_ReadId()&0xFFFFUL);
    LCD_Print(3, strClearLine);
    LCD_Print(3, g_strBuf);

    while (!g_isPress);

    SpiTest();

    return 1;
}
Beispiel #2
0
void SPIFLASH_Test(void)
{
    uint8_t ret;
    ret = SPIFLASH_Init();
    if(ret == TRUE)
    {
        UART_printf("spiflash init succ.\r\n");
        UART_printf("begin self test\r\n");
        ret = SPI_FLASH_SelfTest();
        if(ret == TRUE)
        {
            UART_printf("spiflash test succ\r\n");
        }
        else
        {
            UART_printf("spiflash test err\r\n");
        }
    }
    else
    {
        UART_printf("spiflash init err\r\n");
    }
}