Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // SPI通信開始
- static void spi_flash_comm_start(void)
- {
- // SPIO SSEL2 "L"
- *pPORTFIO_CLEAR = PF8;
- ssync();
- NOP();
- NOP();
- NOP();
- NOP();
- }
- // SPI通信終了
- static void spi_flash_comm_end(void)
- {
- int32_t tim;
- // SPIO SSEL2 "H"
- *pPORTFIO_SET = PF8;
- ssync();
- for(tim = 0; tim < (100 / 2.5); tim++) NOP();
- }
- // 1バイト転送
- static uint8_t spi_flash_transfer(uint8_t trn_data)
- {
- // データ転送
- *pSPI0_TDBR = trn_data;
- ssync();
- // 転送完了まで待機
- while((*pSPI0_STAT & RXS) == 0) ssync();
- // 受信データを取得
- return *pSPI0_RDBR;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement