Browse Source

Detect FAT16 partition type

main
PaulStoffregen 9 years ago
parent
commit
4a6c3e7f31
2 changed files with 3 additions and 2 deletions
  1. +1
    -1
      SD_t3.h
  2. +2
    -1
      init_t3.cpp

+ 1
- 1
SD_t3.h View File

// 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 View File

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;

Loading…
Cancel
Save