PINSEL_ConfigPin(0, 7, 2); PINSEL_ConfigPin(0, 8, 2); PINSEL_ConfigPin(0, 9, 2); SSP_CFG_Type t_Config; t_Config.Databit = SSP_DATABIT_8; t_Config.CPHA = SSP_CPHA_FIRST; t_Config.CPOL = SSP_CPOL_HI; t_Config.Mode = SSP_MASTER_MODE; t_Config.FrameFormat = SSP_FRAME_SPI; t_Config.ClockRate = freq; SSP_Init(LPC_SSP1, &t_Config); SSP_Cmd(LPC_SSP1, ENABLE); |
u32 freq = 15000000; FsSpiInit(freq); u8 data = 0; const u8 dataPat = 0xaa; for( ;; ) { LPC_SSP1->DR = dataPat; while (LPC_SSP1->SR & 0x10) {} data = LPC_SSP1->DR; if (data != dataPat) { Led2On(); RtosDelayMs(100); Led2Off(); } else { Led1On(); RtosDelayMs(100); Led1Off(); } if (JP0GetState() == 0) { if (freq == 30000000) { freq = 5000000; } else { freq += 5000000; } FsSpiInit(freq); } RtosDelayMs(5); } |