Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // フラッシュメモリからデータ読み出し
- static void spi_flash_read_data(uint32_t f_addr, void* sf_buf, int32_t e_count)
- {
- int32_t count;
- uint8_t* r_buf = (uint8_t*)sf_buf;
- if(e_count <= 0)
- return;
- // SPI通信開始
- spi_flash_comm_start();
- // コマンド送信
- spi_flash_transfer(FCMD_RD_BYTE);
- // メモリアドレス送信
- spi_flash_transfer(f_addr >> 16);
- spi_flash_transfer(f_addr >> 8);
- spi_flash_transfer(f_addr);
- // 読み出し
- for(count = 0; count < e_count; count++)
- {
- r_buf[count] = spi_flash_transfer(0);
- }
- // SPI通信終了
- spi_flash_comm_end();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement