Bläddra i källkod

Change some hex case

Scott Lahteine 7 år sedan
förälder
incheckning
8b12371e45

+ 5
- 5
Marlin/src/HAL/HAL_AVR/HAL_spi_AVR.cpp Visa fil

97
   //------------------------------------------------------------------------------
97
   //------------------------------------------------------------------------------
98
   /** SPI receive a byte */
98
   /** SPI receive a byte */
99
   uint8_t spiRec(void) {
99
   uint8_t spiRec(void) {
100
-    SPDR = 0XFF;
100
+    SPDR = 0xFF;
101
     while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
101
     while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
102
     return SPDR;
102
     return SPDR;
103
   }
103
   }
105
   /** SPI read data  */
105
   /** SPI read data  */
106
   void spiRead(uint8_t* buf, uint16_t nbyte) {
106
   void spiRead(uint8_t* buf, uint16_t nbyte) {
107
     if (nbyte-- == 0) return;
107
     if (nbyte-- == 0) return;
108
-    SPDR = 0XFF;
108
+    SPDR = 0xFF;
109
     for (uint16_t i = 0; i < nbyte; i++) {
109
     for (uint16_t i = 0; i < nbyte; i++) {
110
       while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
110
       while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
111
       buf[i] = SPDR;
111
       buf[i] = SPDR;
112
-      SPDR = 0XFF;
112
+      SPDR = 0xFF;
113
     }
113
     }
114
     while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
114
     while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
115
     buf[nbyte] = SPDR;
115
     buf[nbyte] = SPDR;
150
     uint8_t data = 0;
150
     uint8_t data = 0;
151
     // no interrupts during byte receive - about 8 us
151
     // no interrupts during byte receive - about 8 us
152
     cli();
152
     cli();
153
-    // output pin high - like sending 0XFF
153
+    // output pin high - like sending 0xFF
154
     WRITE(MOSI_PIN, HIGH);
154
     WRITE(MOSI_PIN, HIGH);
155
 
155
 
156
     for (uint8_t i = 0; i < 8; i++) {
156
     for (uint8_t i = 0; i < 8; i++) {
184
     for (uint8_t i = 0; i < 8; i++) {
184
     for (uint8_t i = 0; i < 8; i++) {
185
       WRITE(SCK_PIN, LOW);
185
       WRITE(SCK_PIN, LOW);
186
 
186
 
187
-      WRITE(MOSI_PIN, data & 0X80);
187
+      WRITE(MOSI_PIN, data & 0x80);
188
 
188
 
189
       data <<= 1;
189
       data <<= 1;
190
 
190
 

+ 3
- 3
Marlin/src/HAL/HAL_TEENSY35_36/HAL_spi_Teensy.cpp Visa fil

56
   uint8_t returnByte = SPI.transfer(0xFF);
56
   uint8_t returnByte = SPI.transfer(0xFF);
57
   SPI.endTransaction();
57
   SPI.endTransaction();
58
   return returnByte;
58
   return returnByte;
59
-//  SPDR = 0XFF;
59
+//  SPDR = 0xFF;
60
 //  while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
60
 //  while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
61
 //  return SPDR;
61
 //  return SPDR;
62
 }
62
 }
67
   SPI.transfer(buf, nbyte);
67
   SPI.transfer(buf, nbyte);
68
   SPI.endTransaction();
68
   SPI.endTransaction();
69
 //if (nbyte-- == 0) return;
69
 //if (nbyte-- == 0) return;
70
-//  SPDR = 0XFF;
70
+//  SPDR = 0xFF;
71
 //for (uint16_t i = 0; i < nbyte; i++) {
71
 //for (uint16_t i = 0; i < nbyte; i++) {
72
 //  while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
72
 //  while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
73
 //  buf[i] = SPDR;
73
 //  buf[i] = SPDR;
74
-//  SPDR = 0XFF;
74
+//  SPDR = 0xFF;
75
 //}
75
 //}
76
 //while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
76
 //while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ }
77
 //buf[nbyte] = SPDR;
77
 //buf[nbyte] = SPDR;

+ 4
- 4
Marlin/src/sd/Sd2Card.cpp Visa fil

342
 bool Sd2Card::readData(uint8_t* dst, uint16_t count) {
342
 bool Sd2Card::readData(uint8_t* dst, uint16_t count) {
343
   // wait for start block token
343
   // wait for start block token
344
   uint16_t t0 = millis();
344
   uint16_t t0 = millis();
345
-  while ((status_ = spiRec()) == 0XFF) {
345
+  while ((status_ = spiRec()) == 0xFF) {
346
     if (((uint16_t)millis() - t0) > SD_READ_TIMEOUT) {
346
     if (((uint16_t)millis() - t0) > SD_READ_TIMEOUT) {
347
       error(SD_CARD_ERROR_READ_TIMEOUT);
347
       error(SD_CARD_ERROR_READ_TIMEOUT);
348
       goto FAIL;
348
       goto FAIL;
372
 #endif
372
 #endif
373
   chipSelectHigh();
373
   chipSelectHigh();
374
   // Send an additional dummy byte, required by Toshiba Flash Air SD Card
374
   // Send an additional dummy byte, required by Toshiba Flash Air SD Card
375
-  spiSend(0XFF);
375
+  spiSend(0xFF);
376
   return true;
376
   return true;
377
   FAIL:
377
   FAIL:
378
   chipSelectHigh();
378
   chipSelectHigh();
379
   // Send an additional dummy byte, required by Toshiba Flash Air SD Card
379
   // Send an additional dummy byte, required by Toshiba Flash Air SD Card
380
-  spiSend(0XFF);
380
+  spiSend(0xFF);
381
   return false;
381
   return false;
382
 }
382
 }
383
 
383
 
453
 // wait for card to go not busy
453
 // wait for card to go not busy
454
 bool Sd2Card::waitNotBusy(uint16_t timeoutMillis) {
454
 bool Sd2Card::waitNotBusy(uint16_t timeoutMillis) {
455
   uint16_t t0 = millis();
455
   uint16_t t0 = millis();
456
-  while (spiRec() != 0XFF)
456
+  while (spiRec() != 0xFF)
457
     if (((uint16_t)millis() - t0) >= timeoutMillis) return false;
457
     if (((uint16_t)millis() - t0) >= timeoutMillis) return false;
458
 
458
 
459
   return true;
459
   return true;

+ 15
- 15
Marlin/src/sd/Sd2Card.h Visa fil

46
                SD_WRITE_TIMEOUT = 600;    // write time out ms
46
                SD_WRITE_TIMEOUT = 600;    // write time out ms
47
 
47
 
48
 // SD card errors
48
 // SD card errors
49
-uint8_t const SD_CARD_ERROR_CMD0 = 0X1,                 // timeout error for command CMD0 (initialize card in SPI mode)
50
-              SD_CARD_ERROR_CMD8 = 0X2,                 // CMD8 was not accepted - not a valid SD card
51
-              SD_CARD_ERROR_CMD12 = 0X3,                // card returned an error response for CMD12 (write stop)
52
-              SD_CARD_ERROR_CMD17 = 0X4,                // card returned an error response for CMD17 (read block)
53
-              SD_CARD_ERROR_CMD18 = 0X5,                // card returned an error response for CMD18 (read multiple block)
54
-              SD_CARD_ERROR_CMD24 = 0X6,                // card returned an error response for CMD24 (write block)
55
-              SD_CARD_ERROR_CMD25 = 0X7,                // WRITE_MULTIPLE_BLOCKS command failed
56
-              SD_CARD_ERROR_CMD58 = 0X8,                // card returned an error response for CMD58 (read OCR)
57
-              SD_CARD_ERROR_ACMD23 = 0X9,               // SET_WR_BLK_ERASE_COUNT failed
58
-              SD_CARD_ERROR_ACMD41 = 0XA,               // ACMD41 initialization process timeout
59
-              SD_CARD_ERROR_BAD_CSD = 0XB,              // card returned a bad CSR version field
60
-              SD_CARD_ERROR_ERASE = 0XC,                // erase block group command failed
61
-              SD_CARD_ERROR_ERASE_SINGLE_BLOCK = 0XD,   // card not capable of single block erase
62
-              SD_CARD_ERROR_ERASE_TIMEOUT = 0XE,        // Erase sequence timed out
63
-              SD_CARD_ERROR_READ = 0XF,                 // card returned an error token instead of read data
49
+uint8_t const SD_CARD_ERROR_CMD0 = 0x01,                // timeout error for command CMD0 (initialize card in SPI mode)
50
+              SD_CARD_ERROR_CMD8 = 0x02,                // CMD8 was not accepted - not a valid SD card
51
+              SD_CARD_ERROR_CMD12 = 0x03,               // card returned an error response for CMD12 (write stop)
52
+              SD_CARD_ERROR_CMD17 = 0x04,               // card returned an error response for CMD17 (read block)
53
+              SD_CARD_ERROR_CMD18 = 0x05,               // card returned an error response for CMD18 (read multiple block)
54
+              SD_CARD_ERROR_CMD24 = 0x06,               // card returned an error response for CMD24 (write block)
55
+              SD_CARD_ERROR_CMD25 = 0x07,               // WRITE_MULTIPLE_BLOCKS command failed
56
+              SD_CARD_ERROR_CMD58 = 0x08,               // card returned an error response for CMD58 (read OCR)
57
+              SD_CARD_ERROR_ACMD23 = 0x09,              // SET_WR_BLK_ERASE_COUNT failed
58
+              SD_CARD_ERROR_ACMD41 = 0x0A,              // ACMD41 initialization process timeout
59
+              SD_CARD_ERROR_BAD_CSD = 0x0B,             // card returned a bad CSR version field
60
+              SD_CARD_ERROR_ERASE = 0x0C,               // erase block group command failed
61
+              SD_CARD_ERROR_ERASE_SINGLE_BLOCK = 0x0D,  // card not capable of single block erase
62
+              SD_CARD_ERROR_ERASE_TIMEOUT = 0x0E,       // Erase sequence timed out
63
+              SD_CARD_ERROR_READ = 0x0F,                // card returned an error token instead of read data
64
               SD_CARD_ERROR_READ_REG = 0x10,            // read CID or CSD failed
64
               SD_CARD_ERROR_READ_REG = 0x10,            // read CID or CSD failed
65
               SD_CARD_ERROR_READ_TIMEOUT = 0x11,        // timeout while waiting for start of read data
65
               SD_CARD_ERROR_READ_TIMEOUT = 0x11,        // timeout while waiting for start of read data
66
               SD_CARD_ERROR_STOP_TRAN = 0x12,           // card did not accept STOP_TRAN_TOKEN
66
               SD_CARD_ERROR_STOP_TRAN = 0x12,           // card did not accept STOP_TRAN_TOKEN

+ 4
- 4
Marlin/src/sd/SdBaseFile.cpp Visa fil

601
   // search for file
601
   // search for file
602
 
602
 
603
   while (dirFile->curPosition_ < dirFile->fileSize_) {
603
   while (dirFile->curPosition_ < dirFile->fileSize_) {
604
-    index = 0XF & (dirFile->curPosition_ >> 5);
604
+    index = 0xF & (dirFile->curPosition_ >> 5);
605
     p = dirFile->readDirCache();
605
     p = dirFile->readDirCache();
606
     if (!p) return false;
606
     if (!p) return false;
607
 
607
 
705
     return false;
705
     return false;
706
   }
706
   }
707
   // open cached entry
707
   // open cached entry
708
-  return openCachedEntry(index & 0XF, oflag);
708
+  return openCachedEntry(index & 0xF, oflag);
709
 }
709
 }
710
 
710
 
711
 // open a cached directory entry. Assumes vol_ is initialized
711
 // open a cached directory entry. Assumes vol_ is initialized
775
   vol_ = dirFile->vol_;
775
   vol_ = dirFile->vol_;
776
 
776
 
777
   while (1) {
777
   while (1) {
778
-    index = 0XF & (dirFile->curPosition_ >> 5);
778
+    index = 0xF & (dirFile->curPosition_ >> 5);
779
 
779
 
780
     // read entry into cache
780
     // read entry into cache
781
     p = dirFile->readDirCache();
781
     p = dirFile->readDirCache();
1100
   if (!isDir()) return 0;
1100
   if (!isDir()) return 0;
1101
 
1101
 
1102
   // index of entry in cache
1102
   // index of entry in cache
1103
-  i = (curPosition_ >> 5) & 0XF;
1103
+  i = (curPosition_ >> 5) & 0xF;
1104
 
1104
 
1105
   // use read to locate and cache block
1105
   // use read to locate and cache block
1106
   if (read() < 0) return 0;
1106
   if (read() < 0) return 0;

+ 1
- 1
Marlin/src/sd/SdVolume.cpp Visa fil

207
     index &= 0x1FF;
207
     index &= 0x1FF;
208
     uint8_t tmp = value;
208
     uint8_t tmp = value;
209
     if (cluster & 1) {
209
     if (cluster & 1) {
210
-      tmp = (cacheBuffer_.data[index] & 0XF) | tmp << 4;
210
+      tmp = (cacheBuffer_.data[index] & 0xF) | tmp << 4;
211
     }
211
     }
212
     cacheBuffer_.data[index] = tmp;
212
     cacheBuffer_.data[index] = tmp;
213
     index++;
213
     index++;

Laddar…
Avbryt
Spara