浏览代码

Detect FAT16 partition type

main
PaulStoffregen 10 年前
父节点
当前提交
4a6c3e7f31
共有 2 个文件被更改,包括 3 次插入2 次删除
  1. +1
    -1
      SD_t3.h
  2. +2
    -1
      init_t3.cpp

+ 1
- 1
SD_t3.h 查看文件

// This Teensy 3.x optimized version is a work-in-progress. // This Teensy 3.x optimized version is a work-in-progress.
// Uncomment this line to use the Teensy version. Otherwise, // Uncomment this line to use the Teensy version. Otherwise,
// the normal SD library is used. // the normal SD library is used.
//#define USE_TEENSY3_OPTIMIZED_CODE
#define USE_TEENSY3_OPTIMIZED_CODE


/* Why reinvent the SD library wheel... /* Why reinvent the SD library wheel...
* 1: Allow reading files from within interrupts * 1: Allow reading files from within interrupts

+ 2
- 1
init_t3.cpp 查看文件

if (msec > 1500) return false; if (msec > 1500) return false;
SPI.beginTransaction(SD_SPI_SPEED); SPI.beginTransaction(SD_SPI_SPEED);
} }
//Serial.println("card is ready");
// detect high capacity cards // detect high capacity cards
if (card_type == 2) { if (card_type == 2) {
ocr = sd_cmd58(); ocr = sd_cmd58();
do { do {
uint8_t type = mbr->u8[index+4]; uint8_t type = mbr->u8[index+4];
//Serial.printf(" partition %d is type %d\n", (index-446)/16+1, type); //Serial.printf(" partition %d is type %d\n", (index-446)/16+1, type);
if (type == 11 || type == 12) {
if (type == 6 || type == 11 || type == 12) {
partition_lba = unaligned_read32_align16(mbr->u8 + index + 8); partition_lba = unaligned_read32_align16(mbr->u8 + index + 8);
//Serial.printf(" partition lba = %d\n", partition_lba); //Serial.printf(" partition lba = %d\n", partition_lba);
break; break;

正在加载...
取消
保存