Преглед на файлове

Fix hexadecimal number formatting

Scott Lahteine преди 7 години
родител
ревизия
75e6f72c89
променени са 10 файла, в които са добавени 122 реда и са изтрити 122 реда
  1. 14
    14
      Marlin/Sd2Card.cpp
  2. 11
    11
      Marlin/Sd2Card.h
  3. 7
    7
      Marlin/SdBaseFile.cpp
  4. 13
    13
      Marlin/SdBaseFile.h
  5. 36
    36
      Marlin/SdFatStructs.h
  6. 26
    26
      Marlin/SdInfo.h
  7. 10
    10
      Marlin/SdVolume.cpp
  8. 1
    1
      Marlin/SdVolume.h
  9. 1
    1
      Marlin/pca9632.cpp
  10. 3
    3
      Marlin/softspi.h

+ 14
- 14
Marlin/Sd2Card.cpp Целия файл

@@ -55,7 +55,7 @@
55 55
   //------------------------------------------------------------------------------
56 56
   /** SPI receive a byte */
57 57
   static uint8_t spiRec() {
58
-    SPDR = 0XFF;
58
+    SPDR = 0xFF;
59 59
     while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
60 60
     return SPDR;
61 61
   }
@@ -64,11 +64,11 @@
64 64
   static inline __attribute__((always_inline))
65 65
   void spiRead(uint8_t* buf, uint16_t nbyte) {
66 66
     if (nbyte-- == 0) return;
67
-    SPDR = 0XFF;
67
+    SPDR = 0xFF;
68 68
     for (uint16_t i = 0; i < nbyte; i++) {
69 69
       while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
70 70
       buf[i] = SPDR;
71
-      SPDR = 0XFF;
71
+      SPDR = 0xFF;
72 72
     }
73 73
     while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
74 74
     buf[nbyte] = SPDR;
@@ -103,7 +103,7 @@
103 103
     uint8_t data = 0;
104 104
     // no interrupts during byte receive - about 8 us
105 105
     cli();
106
-    // output pin high - like sending 0XFF
106
+    // output pin high - like sending 0xFF
107 107
     WRITE(SPI_MOSI_PIN, HIGH);
108 108
 
109 109
     for (uint8_t i = 0; i < 8; i++) {
@@ -137,7 +137,7 @@
137 137
     for (uint8_t i = 0; i < 8; i++) {
138 138
       WRITE(SPI_SCK_PIN, LOW);
139 139
 
140
-      WRITE(SPI_MOSI_PIN, data & 0X80);
140
+      WRITE(SPI_MOSI_PIN, data & 0x80);
141 141
 
142 142
       data <<= 1;
143 143
 
@@ -177,16 +177,16 @@ uint8_t Sd2Card::cardCommand(uint8_t cmd, uint32_t arg) {
177 177
   for (int8_t s = 24; s >= 0; s -= 8) spiSend(arg >> s);
178 178
 
179 179
   // send CRC
180
-  uint8_t crc = 0XFF;
181
-  if (cmd == CMD0) crc = 0X95;  // correct crc for CMD0 with arg 0
182
-  if (cmd == CMD8) crc = 0X87;  // correct crc for CMD8 with arg 0X1AA
180
+  uint8_t crc = 0xFF;
181
+  if (cmd == CMD0) crc = 0x95;  // correct crc for CMD0 with arg 0
182
+  if (cmd == CMD8) crc = 0x87;  // correct crc for CMD8 with arg 0x1AA
183 183
   spiSend(crc);
184 184
 
185 185
   // skip stuff byte for stop read
186 186
   if (cmd == CMD12) spiRec();
187 187
 
188 188
   // wait for response
189
-  for (uint8_t i = 0; ((status_ = spiRec()) & 0X80) && i != 0XFF; i++) { /* Intentionally left empty */ }
189
+  for (uint8_t i = 0; ((status_ = spiRec()) & 0x80) && i != 0xFF; i++) { /* Intentionally left empty */ }
190 190
   return status_;
191 191
 }
192 192
 //------------------------------------------------------------------------------
@@ -329,7 +329,7 @@ bool Sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin) {
329 329
   #endif  // SOFTWARE_SPI
330 330
 
331 331
   // must supply min of 74 clock cycles with CS high.
332
-  for (uint8_t i = 0; i < 10; i++) spiSend(0XFF);
332
+  for (uint8_t i = 0; i < 10; i++) spiSend(0xFF);
333 333
 
334 334
   // command to go idle in SPI mode
335 335
   while ((status_ = cardCommand(CMD0, 0)) != R1_IDLE_STATE) {
@@ -345,14 +345,14 @@ bool Sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin) {
345 345
   else {
346 346
     // only need last byte of r7 response
347 347
     for (uint8_t i = 0; i < 4; i++) status_ = spiRec();
348
-    if (status_ != 0XAA) {
348
+    if (status_ != 0xAA) {
349 349
       error(SD_CARD_ERROR_CMD8);
350 350
       goto fail;
351 351
     }
352 352
     type(SD_CARD_TYPE_SD2);
353 353
   }
354 354
   // initialize card and send host supports SDHC if SD2
355
-  arg = type() == SD_CARD_TYPE_SD2 ? 0X40000000 : 0;
355
+  arg = type() == SD_CARD_TYPE_SD2 ? 0x40000000 : 0;
356 356
 
357 357
   while ((status_ = cardAcmd(ACMD41, arg)) != R1_READY_STATE) {
358 358
     // check for timeout
@@ -367,7 +367,7 @@ bool Sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin) {
367 367
       error(SD_CARD_ERROR_CMD58);
368 368
       goto fail;
369 369
     }
370
-    if ((spiRec() & 0XC0) == 0XC0) type(SD_CARD_TYPE_SDHC);
370
+    if ((spiRec() & 0xC0) == 0xC0) type(SD_CARD_TYPE_SDHC);
371 371
     // discard rest of ocr - contains allowed voltage range
372 372
     for (uint8_t i = 0; i < 3; i++) spiRec();
373 373
   }
@@ -473,7 +473,7 @@ static const uint16_t crctab[] PROGMEM = {
473 473
 static uint16_t CRC_CCITT(const uint8_t* data, size_t n) {
474 474
   uint16_t crc = 0;
475 475
   for (size_t i = 0; i < n; i++) {
476
-    crc = pgm_read_word(&crctab[(crc >> 8 ^ data[i]) & 0XFF]) ^ (crc << 8);
476
+    crc = pgm_read_word(&crctab[(crc >> 8 ^ data[i]) & 0xFF]) ^ (crc << 8);
477 477
   }
478 478
   return crc;
479 479
 }

+ 11
- 11
Marlin/Sd2Card.h Целия файл

@@ -92,27 +92,27 @@ uint8_t const SD_CARD_ERROR_ERASE_TIMEOUT = 0XE;
92 92
 /** card returned an error token instead of read data */
93 93
 uint8_t const SD_CARD_ERROR_READ = 0XF;
94 94
 /** read CID or CSD failed */
95
-uint8_t const SD_CARD_ERROR_READ_REG = 0X10;
95
+uint8_t const SD_CARD_ERROR_READ_REG = 0x10;
96 96
 /** timeout while waiting for start of read data */
97
-uint8_t const SD_CARD_ERROR_READ_TIMEOUT = 0X11;
97
+uint8_t const SD_CARD_ERROR_READ_TIMEOUT = 0x11;
98 98
 /** card did not accept STOP_TRAN_TOKEN */
99
-uint8_t const SD_CARD_ERROR_STOP_TRAN = 0X12;
99
+uint8_t const SD_CARD_ERROR_STOP_TRAN = 0x12;
100 100
 /** card returned an error token as a response to a write operation */
101
-uint8_t const SD_CARD_ERROR_WRITE = 0X13;
101
+uint8_t const SD_CARD_ERROR_WRITE = 0x13;
102 102
 /** attempt to write protected block zero */
103
-uint8_t const SD_CARD_ERROR_WRITE_BLOCK_ZERO = 0X14;  // REMOVE - not used
103
+uint8_t const SD_CARD_ERROR_WRITE_BLOCK_ZERO = 0x14;  // REMOVE - not used
104 104
 /** card did not go ready for a multiple block write */
105
-uint8_t const SD_CARD_ERROR_WRITE_MULTIPLE = 0X15;
105
+uint8_t const SD_CARD_ERROR_WRITE_MULTIPLE = 0x15;
106 106
 /** card returned an error to a CMD13 status check after a write */
107
-uint8_t const SD_CARD_ERROR_WRITE_PROGRAMMING = 0X16;
107
+uint8_t const SD_CARD_ERROR_WRITE_PROGRAMMING = 0x16;
108 108
 /** timeout occurred during write programming */
109
-uint8_t const SD_CARD_ERROR_WRITE_TIMEOUT = 0X17;
109
+uint8_t const SD_CARD_ERROR_WRITE_TIMEOUT = 0x17;
110 110
 /** incorrect rate selected */
111
-uint8_t const SD_CARD_ERROR_SCK_RATE = 0X18;
111
+uint8_t const SD_CARD_ERROR_SCK_RATE = 0x18;
112 112
 /** init() not called */
113
-uint8_t const SD_CARD_ERROR_INIT_NOT_CALLED = 0X19;
113
+uint8_t const SD_CARD_ERROR_INIT_NOT_CALLED = 0x19;
114 114
 /** crc check error */
115
-uint8_t const SD_CARD_ERROR_CRC = 0X20;
115
+uint8_t const SD_CARD_ERROR_CRC = 0x20;
116 116
 //------------------------------------------------------------------------------
117 117
 // card types
118 118
 /** Standard capacity V1 SD card */

+ 7
- 7
Marlin/SdBaseFile.cpp Целия файл

@@ -57,7 +57,7 @@ bool SdBaseFile::addCluster() {
57 57
 bool SdBaseFile::addDirCluster() {
58 58
   uint32_t block;
59 59
   // max folder size
60
-  if (fileSize_ / sizeof(dir_t) >= 0XFFFF) goto fail;
60
+  if (fileSize_ / sizeof(dir_t) >= 0xFFFF) goto fail;
61 61
 
62 62
   if (!addCluster()) goto fail;
63 63
   if (!vol_->cacheFlush()) goto fail;
@@ -510,7 +510,7 @@ bool SdBaseFile::mkdir(SdBaseFile* parent, const uint8_t dname[11]) {
510 510
     d.firstClusterHigh = 0;
511 511
   }
512 512
   else {
513
-    d.firstClusterLow = parent->firstCluster_ & 0XFFFF;
513
+    d.firstClusterLow = parent->firstCluster_ & 0xFFFF;
514 514
     d.firstClusterHigh = parent->firstCluster_ >> 16;
515 515
   }
516 516
   // copy '..' to block
@@ -1063,7 +1063,7 @@ int16_t SdBaseFile::read(void* buf, uint16_t nbyte) {
1063 1063
   // amount left to read
1064 1064
   toRead = nbyte;
1065 1065
   while (toRead > 0) {
1066
-    offset = curPosition_ & 0X1FF;  // offset in block
1066
+    offset = curPosition_ & 0x1FF;  // offset in block
1067 1067
     if (type_ == FAT_FILE_TYPE_ROOT_FIXED) {
1068 1068
       block = vol_->rootDirStart() + (curPosition_ >> 9);
1069 1069
     }
@@ -1120,7 +1120,7 @@ fail:
1120 1120
 int8_t SdBaseFile::readDir(dir_t* dir, char* longFilename) {
1121 1121
   int16_t n;
1122 1122
   // if not a directory file or miss-positioned return an error
1123
-  if (!isDir() || (0X1F & curPosition_)) return -1;
1123
+  if (!isDir() || (0x1F & curPosition_)) return -1;
1124 1124
 
1125 1125
   //If we have a longFilename buffer, mark it as invalid. If we find a long filename it will be filled automaticly.
1126 1126
   if (longFilename != NULL) longFilename[0] = '\0';
@@ -1513,7 +1513,7 @@ bool SdBaseFile::sync() {
1513 1513
     if (!isDir()) d->fileSize = fileSize_;
1514 1514
 
1515 1515
     // update first cluster fields
1516
-    d->firstClusterLow = firstCluster_ & 0XFFFF;
1516
+    d->firstClusterLow = firstCluster_ & 0xFFFF;
1517 1517
     d->firstClusterHigh = firstCluster_ >> 16;
1518 1518
 
1519 1519
     // set modify time if user supplied a callback date/time function
@@ -1738,7 +1738,7 @@ int16_t SdBaseFile::write(const void* buf, uint16_t nbyte) {
1738 1738
 
1739 1739
   while (nToWrite > 0) {
1740 1740
     uint8_t blockOfCluster = vol_->blockOfCluster(curPosition_);
1741
-    uint16_t blockOffset = curPosition_ & 0X1FF;
1741
+    uint16_t blockOffset = curPosition_ & 0x1FF;
1742 1742
     if (blockOfCluster == 0 && blockOffset == 0) {
1743 1743
       // start of new cluster
1744 1744
       if (curCluster_ == 0) {
@@ -1774,7 +1774,7 @@ int16_t SdBaseFile::write(const void* buf, uint16_t nbyte) {
1774 1774
       // full block - don't need to use cache
1775 1775
       if (vol_->cacheBlockNumber() == block) {
1776 1776
         // invalidate cache if block is in cache
1777
-        vol_->cacheSetBlockNumber(0XFFFFFFFF, false);
1777
+        vol_->cacheSetBlockNumber(0xFFFFFFFF, false);
1778 1778
       }
1779 1779
       if (!vol_->writeBlock(block, src)) goto fail;
1780 1780
     }

+ 13
- 13
Marlin/SdBaseFile.h Целия файл

@@ -54,11 +54,11 @@ struct filepos_t {
54 54
 
55 55
 // use the gnu style oflag in open()
56 56
 /** open() oflag for reading */
57
-uint8_t const O_READ = 0X01;
57
+uint8_t const O_READ = 0x01;
58 58
 /** open() oflag - same as O_IN */
59 59
 uint8_t const O_RDONLY = O_READ;
60 60
 /** open() oflag for write */
61
-uint8_t const O_WRITE = 0X02;
61
+uint8_t const O_WRITE = 0x02;
62 62
 /** open() oflag - same as O_WRITE */
63 63
 uint8_t const O_WRONLY = O_WRITE;
64 64
 /** open() oflag for reading and writing */
@@ -66,17 +66,17 @@ uint8_t const O_RDWR = (O_READ | O_WRITE);
66 66
 /** open() oflag mask for access modes */
67 67
 uint8_t const O_ACCMODE = (O_READ | O_WRITE);
68 68
 /** The file offset shall be set to the end of the file prior to each write. */
69
-uint8_t const O_APPEND = 0X04;
69
+uint8_t const O_APPEND = 0x04;
70 70
 /** synchronous writes - call sync() after each write */
71
-uint8_t const O_SYNC = 0X08;
71
+uint8_t const O_SYNC = 0x08;
72 72
 /** truncate the file to zero length */
73
-uint8_t const O_TRUNC = 0X10;
73
+uint8_t const O_TRUNC = 0x10;
74 74
 /** set the initial position at the end of the file */
75
-uint8_t const O_AT_END = 0X20;
75
+uint8_t const O_AT_END = 0x20;
76 76
 /** create the file if nonexistent */
77
-uint8_t const O_CREAT = 0X40;
77
+uint8_t const O_CREAT = 0x40;
78 78
 /** If O_CREAT and O_EXCL are set, open() shall fail if the file exists */
79
-uint8_t const O_EXCL = 0X80;
79
+uint8_t const O_EXCL = 0x80;
80 80
 
81 81
 // SdBaseFile class static and const definitions
82 82
 // flags for ls()
@@ -141,7 +141,7 @@ static inline uint8_t FAT_MONTH(uint16_t fatDate) {
141 141
  * \return Extracted day [1,31]
142 142
  */
143 143
 static inline uint8_t FAT_DAY(uint16_t fatDate) {
144
-  return fatDate & 0X1F;
144
+  return fatDate & 0x1F;
145 145
 }
146 146
 /** time field for FAT directory entry
147 147
  * \param[in] hour [0,23]
@@ -167,7 +167,7 @@ static inline uint8_t FAT_HOUR(uint16_t fatTime) {
167 167
  * \return Extracted minute [0,59]
168 168
  */
169 169
 static inline uint8_t FAT_MINUTE(uint16_t fatTime) {
170
-  return (fatTime >> 5) & 0X3F;
170
+  return (fatTime >> 5) & 0x3F;
171 171
 }
172 172
 /** second part of FAT directory time field
173 173
  * Note second/2 is stored in packed time.
@@ -177,7 +177,7 @@ static inline uint8_t FAT_MINUTE(uint16_t fatTime) {
177 177
  * \return Extracted second [0,58]
178 178
  */
179 179
 static inline uint8_t FAT_SECOND(uint16_t fatTime) {
180
-  return 2 * (fatTime & 0X1F);
180
+  return 2 * (fatTime & 0x1F);
181 181
 }
182 182
 /** Default date for file timestamps is 1 Jan 2000 */
183 183
 uint16_t const FAT_DEFAULT_DATE = ((2000 - 1980) << 9) | (1 << 5) | 1;
@@ -338,10 +338,10 @@ class SdBaseFile {
338 338
   // data time callback function
339 339
   static void (*dateTime_)(uint16_t* date, uint16_t* time);
340 340
   // bits defined in flags_
341
-  // should be 0X0F
341
+  // should be 0x0F
342 342
   static uint8_t const F_OFLAG = (O_ACCMODE | O_APPEND | O_SYNC);
343 343
   // sync of directory entry required
344
-  static uint8_t const F_FILE_DIR_DIRTY = 0X80;
344
+  static uint8_t const F_FILE_DIR_DIRTY = 0x80;
345 345
 
346 346
   // private data
347 347
   uint8_t   flags_;         // See above for definition of flags_ bits

+ 36
- 36
Marlin/SdFatStructs.h Целия файл

@@ -43,11 +43,11 @@
43 43
  */
44 44
 //------------------------------------------------------------------------------
45 45
 /** Value for byte 510 of boot block or MBR */
46
-uint8_t const BOOTSIG0 = 0X55;
46
+uint8_t const BOOTSIG0 = 0x55;
47 47
 /** Value for byte 511 of boot block or MBR */
48
-uint8_t const BOOTSIG1 = 0XAA;
48
+uint8_t const BOOTSIG1 = 0xAA;
49 49
 /** Value for bootSignature field int FAT/FAT32 boot sector */
50
-uint8_t const EXTENDED_BOOT_SIG = 0X29;
50
+uint8_t const EXTENDED_BOOT_SIG = 0x29;
51 51
 //------------------------------------------------------------------------------
52 52
 /**
53 53
  * \struct partitionTable
@@ -59,8 +59,8 @@ uint8_t const EXTENDED_BOOT_SIG = 0X29;
59 59
 struct partitionTable {
60 60
           /**
61 61
            * Boot Indicator . Indicates whether the volume is the active
62
-           * partition.  Legal values include: 0X00. Do not use for booting.
63
-           * 0X80 Active partition.
62
+           * partition.  Legal values include: 0x00. Do not use for booting.
63
+           * 0x80 Active partition.
64 64
            */
65 65
   uint8_t  boot;
66 66
           /**
@@ -126,9 +126,9 @@ struct masterBootRecord {
126 126
   uint16_t usuallyZero;
127 127
            /** Partition tables. */
128 128
   part_t   part[4];
129
-           /** First MBR signature byte. Must be 0X55 */
129
+           /** First MBR signature byte. Must be 0x55 */
130 130
   uint8_t  mbrSig0;
131
-           /** Second MBR signature byte. Must be 0XAA */
131
+           /** Second MBR signature byte. Must be 0xAA */
132 132
   uint8_t  mbrSig1;
133 133
 } PACKED;
134 134
 /** Type name for masterBootRecord */
@@ -234,7 +234,7 @@ struct fat_boot {
234 234
   uint8_t  driveNumber;
235 235
            /** used by Windows NT - should be zero for FAT */
236 236
   uint8_t  reserved1;
237
-           /** 0X29 if next three fields are valid */
237
+           /** 0x29 if next three fields are valid */
238 238
   uint8_t  bootSignature;
239 239
            /**
240 240
             * A random serial number created when formatting a disk,
@@ -254,9 +254,9 @@ struct fat_boot {
254 254
   char     fileSystemType[8];
255 255
            /** X86 boot code */
256 256
   uint8_t  bootCode[448];
257
-           /** must be 0X55 */
257
+           /** must be 0x55 */
258 258
   uint8_t  bootSectorSig0;
259
-           /** must be 0XAA */
259
+           /** must be 0xAA */
260 260
   uint8_t  bootSectorSig1;
261 261
 } PACKED;
262 262
 /** Type name for FAT Boot Sector */
@@ -389,7 +389,7 @@ struct fat32_boot {
389 389
   uint8_t  driveNumber;
390 390
            /** used by Windows NT - should be zero for FAT */
391 391
   uint8_t  reserved1;
392
-           /** 0X29 if next three fields are valid */
392
+           /** 0x29 if next three fields are valid */
393 393
   uint8_t  bootSignature;
394 394
            /**
395 395
             * A random serial number created when formatting a disk,
@@ -408,9 +408,9 @@ struct fat32_boot {
408 408
   char     fileSystemType[8];
409 409
            /** X86 boot code */
410 410
   uint8_t  bootCode[420];
411
-           /** must be 0X55 */
411
+           /** must be 0x55 */
412 412
   uint8_t  bootSectorSig0;
413
-           /** must be 0XAA */
413
+           /** must be 0xAA */
414 414
   uint8_t  bootSectorSig1;
415 415
 } PACKED;
416 416
 /** Type name for FAT32 Boot Sector */
@@ -427,11 +427,11 @@ uint32_t const FSINFO_STRUCT_SIG = 0x61417272;
427 427
  *
428 428
  */
429 429
 struct fat32_fsinfo {
430
-           /** must be 0X52, 0X52, 0X61, 0X41 */
430
+           /** must be 0x52, 0x52, 0x61, 0x41 */
431 431
   uint32_t  leadSignature;
432 432
            /** must be zero */
433 433
   uint8_t  reserved1[480];
434
-           /** must be 0X72, 0X72, 0X41, 0X61 */
434
+           /** must be 0x72, 0x72, 0x41, 0x61 */
435 435
   uint32_t  structSignature;
436 436
           /**
437 437
            * Contains the last known free cluster count on the volume.
@@ -450,7 +450,7 @@ struct fat32_fsinfo {
450 450
   uint32_t nextFree;
451 451
            /** must be zero */
452 452
   uint8_t  reserved2[12];
453
-           /** must be 0X00, 0X00, 0X55, 0XAA */
453
+           /** must be 0x00, 0x00, 0x55, 0xAA */
454 454
   uint8_t  tailSignature[4];
455 455
 } PACKED;
456 456
 /** Type name for FAT32 FSINFO Sector */
@@ -458,19 +458,19 @@ typedef struct fat32_fsinfo fat32_fsinfo_t;
458 458
 //------------------------------------------------------------------------------
459 459
 // End Of Chain values for FAT entries
460 460
 /** FAT12 end of chain value used by Microsoft. */
461
-uint16_t const FAT12EOC = 0XFFF;
461
+uint16_t const FAT12EOC = 0xFFF;
462 462
 /** Minimum value for FAT12 EOC.  Use to test for EOC. */
463
-uint16_t const FAT12EOC_MIN = 0XFF8;
463
+uint16_t const FAT12EOC_MIN = 0xFF8;
464 464
 /** FAT16 end of chain value used by Microsoft. */
465
-uint16_t const FAT16EOC = 0XFFFF;
465
+uint16_t const FAT16EOC = 0xFFFF;
466 466
 /** Minimum value for FAT16 EOC.  Use to test for EOC. */
467
-uint16_t const FAT16EOC_MIN = 0XFFF8;
467
+uint16_t const FAT16EOC_MIN = 0xFFF8;
468 468
 /** FAT32 end of chain value used by Microsoft. */
469
-uint32_t const FAT32EOC = 0X0FFFFFFF;
469
+uint32_t const FAT32EOC = 0x0FFFFFFF;
470 470
 /** Minimum value for FAT32 EOC.  Use to test for EOC. */
471
-uint32_t const FAT32EOC_MIN = 0X0FFFFFF8;
471
+uint32_t const FAT32EOC_MIN = 0x0FFFFFF8;
472 472
 /** Mask a for FAT32 entry. Entries are 28 bits. */
473
-uint32_t const FAT32MASK = 0X0FFFFFFF;
473
+uint32_t const FAT32MASK = 0x0FFFFFFF;
474 474
 //------------------------------------------------------------------------------
475 475
 /**
476 476
  * \struct directoryEntry
@@ -590,31 +590,31 @@ struct directoryVFATEntry {
590 590
 typedef struct directoryEntry dir_t;
591 591
 /** Type name for directoryVFATEntry */
592 592
 typedef struct directoryVFATEntry vfat_t;
593
-/** escape for name[0] = 0XE5 */
594
-uint8_t const DIR_NAME_0XE5 = 0X05;
593
+/** escape for name[0] = 0xE5 */
594
+uint8_t const DIR_NAME_0xE5 = 0x05;
595 595
 /** name[0] value for entry that is free after being "deleted" */
596
-uint8_t const DIR_NAME_DELETED = 0XE5;
596
+uint8_t const DIR_NAME_DELETED = 0xE5;
597 597
 /** name[0] value for entry that is free and no allocated entries follow */
598
-uint8_t const DIR_NAME_FREE = 0X00;
598
+uint8_t const DIR_NAME_FREE = 0x00;
599 599
 /** file is read-only */
600
-uint8_t const DIR_ATT_READ_ONLY = 0X01;
600
+uint8_t const DIR_ATT_READ_ONLY = 0x01;
601 601
 /** File should hidden in directory listings */
602
-uint8_t const DIR_ATT_HIDDEN = 0X02;
602
+uint8_t const DIR_ATT_HIDDEN = 0x02;
603 603
 /** Entry is for a system file */
604
-uint8_t const DIR_ATT_SYSTEM = 0X04;
604
+uint8_t const DIR_ATT_SYSTEM = 0x04;
605 605
 /** Directory entry contains the volume label */
606
-uint8_t const DIR_ATT_VOLUME_ID = 0X08;
606
+uint8_t const DIR_ATT_VOLUME_ID = 0x08;
607 607
 /** Entry is for a directory */
608
-uint8_t const DIR_ATT_DIRECTORY = 0X10;
608
+uint8_t const DIR_ATT_DIRECTORY = 0x10;
609 609
 /** Old DOS archive bit for backup support */
610
-uint8_t const DIR_ATT_ARCHIVE = 0X20;
610
+uint8_t const DIR_ATT_ARCHIVE = 0x20;
611 611
 /** Test value for long name entry.  Test is
612 612
   (d->attributes & DIR_ATT_LONG_NAME_MASK) == DIR_ATT_LONG_NAME. */
613
-uint8_t const DIR_ATT_LONG_NAME = 0X0F;
613
+uint8_t const DIR_ATT_LONG_NAME = 0x0F;
614 614
 /** Test mask for long name entry */
615
-uint8_t const DIR_ATT_LONG_NAME_MASK = 0X3F;
615
+uint8_t const DIR_ATT_LONG_NAME_MASK = 0x3F;
616 616
 /** defined attribute bits */
617
-uint8_t const DIR_ATT_DEFINED_BITS = 0X3F;
617
+uint8_t const DIR_ATT_DEFINED_BITS = 0x3F;
618 618
 /** Directory entry is part of a long name
619 619
  * \param[in] dir Pointer to a directory entry.
620 620
  *

+ 26
- 26
Marlin/SdInfo.h Целия файл

@@ -45,59 +45,59 @@
45 45
 //------------------------------------------------------------------------------
46 46
 // SD card commands
47 47
 /** GO_IDLE_STATE - init card in spi mode if CS low */
48
-uint8_t const CMD0 = 0X00;
48
+uint8_t const CMD0 = 0x00;
49 49
 /** SEND_IF_COND - verify SD Memory Card interface operating condition.*/
50
-uint8_t const CMD8 = 0X08;
50
+uint8_t const CMD8 = 0x08;
51 51
 /** SEND_CSD - read the Card Specific Data (CSD register) */
52
-uint8_t const CMD9 = 0X09;
52
+uint8_t const CMD9 = 0x09;
53 53
 /** SEND_CID - read the card identification information (CID register) */
54
-uint8_t const CMD10 = 0X0A;
54
+uint8_t const CMD10 = 0x0A;
55 55
 /** STOP_TRANSMISSION - end multiple block read sequence */
56
-uint8_t const CMD12 = 0X0C;
56
+uint8_t const CMD12 = 0x0C;
57 57
 /** SEND_STATUS - read the card status register */
58
-uint8_t const CMD13 = 0X0D;
58
+uint8_t const CMD13 = 0x0D;
59 59
 /** READ_SINGLE_BLOCK - read a single data block from the card */
60
-uint8_t const CMD17 = 0X11;
60
+uint8_t const CMD17 = 0x11;
61 61
 /** READ_MULTIPLE_BLOCK - read a multiple data blocks from the card */
62
-uint8_t const CMD18 = 0X12;
62
+uint8_t const CMD18 = 0x12;
63 63
 /** WRITE_BLOCK - write a single data block to the card */
64
-uint8_t const CMD24 = 0X18;
64
+uint8_t const CMD24 = 0x18;
65 65
 /** WRITE_MULTIPLE_BLOCK - write blocks of data until a STOP_TRANSMISSION */
66
-uint8_t const CMD25 = 0X19;
66
+uint8_t const CMD25 = 0x19;
67 67
 /** ERASE_WR_BLK_START - sets the address of the first block to be erased */
68
-uint8_t const CMD32 = 0X20;
68
+uint8_t const CMD32 = 0x20;
69 69
 /** ERASE_WR_BLK_END - sets the address of the last block of the continuous
70 70
     range to be erased*/
71
-uint8_t const CMD33 = 0X21;
71
+uint8_t const CMD33 = 0x21;
72 72
 /** ERASE - erase all previously selected blocks */
73
-uint8_t const CMD38 = 0X26;
73
+uint8_t const CMD38 = 0x26;
74 74
 /** APP_CMD - escape for application specific command */
75
-uint8_t const CMD55 = 0X37;
75
+uint8_t const CMD55 = 0x37;
76 76
 /** READ_OCR - read the OCR register of a card */
77
-uint8_t const CMD58 = 0X3A;
77
+uint8_t const CMD58 = 0x3A;
78 78
 /** SET_WR_BLK_ERASE_COUNT - Set the number of write blocks to be
79 79
      pre-erased before writing */
80
-uint8_t const ACMD23 = 0X17;
80
+uint8_t const ACMD23 = 0x17;
81 81
 /** SD_SEND_OP_COMD - Sends host capacity support information and
82 82
     activates the card's initialization process */
83
-uint8_t const ACMD41 = 0X29;
83
+uint8_t const ACMD41 = 0x29;
84 84
 //------------------------------------------------------------------------------
85 85
 /** status for card in the ready state */
86
-uint8_t const R1_READY_STATE = 0X00;
86
+uint8_t const R1_READY_STATE = 0x00;
87 87
 /** status for card in the idle state */
88
-uint8_t const R1_IDLE_STATE = 0X01;
88
+uint8_t const R1_IDLE_STATE = 0x01;
89 89
 /** status bit for illegal command */
90
-uint8_t const R1_ILLEGAL_COMMAND = 0X04;
90
+uint8_t const R1_ILLEGAL_COMMAND = 0x04;
91 91
 /** start data token for read or write single block*/
92
-uint8_t const DATA_START_BLOCK = 0XFE;
92
+uint8_t const DATA_START_BLOCK = 0xFE;
93 93
 /** stop token for write multiple blocks*/
94
-uint8_t const STOP_TRAN_TOKEN = 0XFD;
94
+uint8_t const STOP_TRAN_TOKEN = 0xFD;
95 95
 /** start data token for write multiple blocks*/
96
-uint8_t const WRITE_MULTIPLE_TOKEN = 0XFC;
96
+uint8_t const WRITE_MULTIPLE_TOKEN = 0xFC;
97 97
 /** mask for data response tokens after a write block operation */
98
-uint8_t const DATA_RES_MASK = 0X1F;
98
+uint8_t const DATA_RES_MASK = 0x1F;
99 99
 /** write data accepted token */
100
-uint8_t const DATA_RES_ACCEPTED = 0X05;
100
+uint8_t const DATA_RES_ACCEPTED = 0x05;
101 101
 //------------------------------------------------------------------------------
102 102
 /** Card IDentification (CID) register */
103 103
 typedef struct CID {
@@ -203,7 +203,7 @@ typedef struct CSDV2 {
203 203
   unsigned char reserved1 : 6;
204 204
   unsigned char csd_ver : 2;
205 205
   // byte 1
206
-  /** fixed to 0X0E */
206
+  /** fixed to 0x0E */
207 207
   unsigned char taac;
208 208
   // byte 2
209 209
   /** fixed to 0 */

+ 10
- 10
Marlin/SdVolume.cpp Целия файл

@@ -167,7 +167,7 @@ bool SdVolume::fatGet(uint32_t cluster, uint32_t* value) {
167 167
     index += index >> 1;
168 168
     lba = fatStartBlock_ + (index >> 9);
169 169
     if (!cacheRawBlock(lba, CACHE_FOR_READ)) goto fail;
170
-    index &= 0X1FF;
170
+    index &= 0x1FF;
171 171
     uint16_t tmp = cacheBuffer_.data[index];
172 172
     index++;
173 173
     if (index == 512) {
@@ -175,7 +175,7 @@ bool SdVolume::fatGet(uint32_t cluster, uint32_t* value) {
175 175
       index = 0;
176 176
     }
177 177
     tmp |= cacheBuffer_.data[index] << 8;
178
-    *value = cluster & 1 ? tmp >> 4 : tmp & 0XFFF;
178
+    *value = cluster & 1 ? tmp >> 4 : tmp & 0xFFF;
179 179
     return true;
180 180
   }
181 181
   if (fatType_ == 16) {
@@ -191,10 +191,10 @@ bool SdVolume::fatGet(uint32_t cluster, uint32_t* value) {
191 191
     if (!cacheRawBlock(lba, CACHE_FOR_READ)) goto fail;
192 192
   }
193 193
   if (fatType_ == 16) {
194
-    *value = cacheBuffer_.fat16[cluster & 0XFF];
194
+    *value = cacheBuffer_.fat16[cluster & 0xFF];
195 195
   }
196 196
   else {
197
-    *value = cacheBuffer_.fat32[cluster & 0X7F] & FAT32MASK;
197
+    *value = cacheBuffer_.fat32[cluster & 0x7F] & FAT32MASK;
198 198
   }
199 199
   return true;
200 200
 fail:
@@ -217,7 +217,7 @@ bool SdVolume::fatPut(uint32_t cluster, uint32_t value) {
217 217
     if (!cacheRawBlock(lba, CACHE_FOR_WRITE)) goto fail;
218 218
     // mirror second FAT
219 219
     if (fatCount_ > 1) cacheMirrorBlock_ = lba + blocksPerFat_;
220
-    index &= 0X1FF;
220
+    index &= 0x1FF;
221 221
     uint8_t tmp = value;
222 222
     if (cluster & 1) {
223 223
       tmp = (cacheBuffer_.data[index] & 0XF) | tmp << 4;
@@ -233,7 +233,7 @@ bool SdVolume::fatPut(uint32_t cluster, uint32_t value) {
233 233
     }
234 234
     tmp = value >> 4;
235 235
     if (!(cluster & 1)) {
236
-      tmp = ((cacheBuffer_.data[index] & 0XF0)) | tmp >> 4;
236
+      tmp = ((cacheBuffer_.data[index] & 0xF0)) | tmp >> 4;
237 237
     }
238 238
     cacheBuffer_.data[index] = tmp;
239 239
     return true;
@@ -250,10 +250,10 @@ bool SdVolume::fatPut(uint32_t cluster, uint32_t value) {
250 250
   if (!cacheRawBlock(lba, CACHE_FOR_WRITE)) goto fail;
251 251
   // store entry
252 252
   if (fatType_ == 16) {
253
-    cacheBuffer_.fat16[cluster & 0XFF] = value;
253
+    cacheBuffer_.fat16[cluster & 0xFF] = value;
254 254
   }
255 255
   else {
256
-    cacheBuffer_.fat32[cluster & 0X7F] = value;
256
+    cacheBuffer_.fat32[cluster & 0x7F] = value;
257 257
   }
258 258
   // mirror second FAT
259 259
   if (fatCount_ > 1) cacheMirrorBlock_ = lba + blocksPerFat_;
@@ -344,7 +344,7 @@ bool SdVolume::init(Sd2Card* dev, uint8_t part) {
344 344
   allocSearchStart_ = 2;
345 345
   cacheDirty_ = 0;  // cacheFlush() will write block if true
346 346
   cacheMirrorBlock_ = 0;
347
-  cacheBlockNumber_ = 0XFFFFFFFF;
347
+  cacheBlockNumber_ = 0xFFFFFFFF;
348 348
 
349 349
   // if part == 0 assume super floppy with FAT boot sector in block zero
350 350
   // if part > 0 assume mbr volume with partition table
@@ -352,7 +352,7 @@ bool SdVolume::init(Sd2Card* dev, uint8_t part) {
352 352
     if (part > 4)goto fail;
353 353
     if (!cacheRawBlock(volumeStartBlock, CACHE_FOR_READ)) goto fail;
354 354
     part_t* p = &cacheBuffer_.mbr.part[part - 1];
355
-    if ((p->boot & 0X7F) != 0  ||
355
+    if ((p->boot & 0x7F) != 0  ||
356 356
         p->totalSectors < 100 ||
357 357
         p->firstSector == 0) {
358 358
       // not a valid partition

+ 1
- 1
Marlin/SdVolume.h Целия файл

@@ -76,7 +76,7 @@ class SdVolume {
76 76
    */
77 77
   cache_t* cacheClear() {
78 78
     if (!cacheFlush()) return 0;
79
-    cacheBlockNumber_ = 0XFFFFFFFF;
79
+    cacheBlockNumber_ = 0xFFFFFFFF;
80 80
     return &cacheBuffer_;
81 81
   }
82 82
   /** Initialize a FAT volume.  Try partition one first then try super

+ 1
- 1
Marlin/pca9632.cpp Целия файл

@@ -45,7 +45,7 @@
45 45
 #define PCA9632_PWM3        0x05
46 46
 #define PCA9632_GRPPWM      0x06
47 47
 #define PCA9632_GRPFREQ     0x07
48
-#define PCA9632_LEDOUT      0X08
48
+#define PCA9632_LEDOUT      0x08
49 49
 #define PCA9632_SUBADR1     0x09
50 50
 #define PCA9632_SUBADR2     0x0A
51 51
 #define PCA9632_SUBADR3     0x0B

+ 3
- 3
Marlin/softspi.h Целия файл

@@ -455,7 +455,7 @@ void badPinCheck(uint8_t pin) {
455 455
 static inline __attribute__((always_inline))
456 456
 void fastBitWriteSafe(volatile uint8_t* address, uint8_t bit, bool level) {
457 457
   uint8_t oldSREG;
458
-  if (address > (uint8_t*)0X5F) {
458
+  if (address > (uint8_t*)0x5F) {
459 459
     oldSREG = SREG;
460 460
     cli();
461 461
   }
@@ -464,7 +464,7 @@ void fastBitWriteSafe(volatile uint8_t* address, uint8_t bit, bool level) {
464 464
   } else {
465 465
     *address &= ~(1 << bit);
466 466
   }
467
-  if (address > (uint8_t*)0X5F) {
467
+  if (address > (uint8_t*)0x5F) {
468 468
     SREG = oldSREG;
469 469
   }
470 470
 }
@@ -488,7 +488,7 @@ bool fastDigitalRead(uint8_t pin) {
488 488
 static inline __attribute__((always_inline))
489 489
 void fastDigitalToggle(uint8_t pin) {
490 490
   badPinCheck(pin);
491
-    if (pinMap[pin].pin > (uint8_t*)0X5F) {
491
+    if (pinMap[pin].pin > (uint8_t*)0x5F) {
492 492
       // must write bit to high address port
493 493
       *pinMap[pin].pin = 1 << pinMap[pin].bit;
494 494
     } else {

Loading…
Отказ
Запис