Browse Source

add USEABLE_HARDWARE_PWM & clear up some compiler warnings

Bob-the-Kuhn 6 years ago
parent
commit
ab709ccac1

+ 7
- 7
Marlin/src/HAL/HAL_DUE/HAL_spi_Due.cpp View File

@@ -130,7 +130,7 @@
130 130
     register uint32_t MOSI_MASK = PIN_MASK(MOSI_PIN);
131 131
     register uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SCK_PIN)) + 0x30;    /* SODR of port */
132 132
     register uint32_t SCK_MASK = PIN_MASK(SCK_PIN);
133
-    register uint32_t idx;
133
+    register uint32_t idx = 0;
134 134
 
135 135
     /* Negate bout, as the assembler requires a negated value */
136 136
     bout = ~bout;
@@ -209,8 +209,8 @@
209 209
 
210 210
   // run at ~8 .. ~10Mhz - Rx version (Tx line not altered)
211 211
   static uint8_t spiTransferRx0(uint8_t bout) { // using Mode 0
212
-    register uint32_t bin;
213
-    register uint32_t work;
212
+    register uint32_t bin = 0;
213
+    register uint32_t work = 0;
214 214
     register uint32_t BITBAND_MISO_PORT = BITBAND_ADDRESS( ((uint32_t)PORT(MISO_PIN))+0x3C, PIN_SHIFT(MISO_PIN));  /* PDSR of port in bitband area */
215 215
     register uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SCK_PIN)) + 0x30;    /* SODR of port */
216 216
     register uint32_t SCK_MASK = PIN_MASK(SCK_PIN);
@@ -327,8 +327,8 @@
327 327
     register uint32_t MOSI_MASK = PIN_MASK(MOSI_PIN);
328 328
     register uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SCK_PIN)) + 0x30;    /* SODR of port */
329 329
     register uint32_t SCK_MASK = PIN_MASK(SCK_PIN);
330
-    register uint32_t work;
331
-    register uint32_t txval;
330
+    register uint32_t work = 0;
331
+    register uint32_t txval = 0;
332 332
 
333 333
     /* The software SPI routine */
334 334
     __asm__ __volatile__(
@@ -402,8 +402,8 @@
402 402
   }
403 403
 
404 404
   static void spiRxBlock0(uint8_t* ptr, uint32_t todo) {
405
-    register uint32_t bin;
406
-    register uint32_t work;
405
+    register uint32_t bin = 0;
406
+    register uint32_t work = 0;
407 407
     register uint32_t BITBAND_MISO_PORT = BITBAND_ADDRESS( ((uint32_t)PORT(MISO_PIN))+0x3C, PIN_SHIFT(MISO_PIN));  /* PDSR of port in bitband area */
408 408
     register uint32_t SCK_PORT_PLUS30 = ((uint32_t) PORT(SCK_PIN)) + 0x30;    /* SODR of port */
409 409
     register uint32_t SCK_MASK = PIN_MASK(SCK_PIN);

+ 4
- 0
Marlin/src/HAL/HAL_DUE/fastio_Due.h View File

@@ -43,6 +43,10 @@
43 43
  * Utility functions
44 44
  */
45 45
 
46
+// Due has 12 PWMs assigned to logical pins 2-13.
47
+// 6, 7, 8 & 9 come from the PWM controller. The others come from the timers.
48
+#define USEABLE_HARDWARE_PWM(p) ((2 >= p) && (p <= 13))
49
+
46 50
 #ifndef MASK
47 51
   #define MASK(PIN)  (1 << PIN)
48 52
 #endif

+ 5
- 5
Marlin/src/HAL/HAL_DUE/usb/compiler.h View File

@@ -105,7 +105,7 @@
105 105
  * \brief Marking \a v as a unused parameter or value.
106 106
  */
107 107
 #ifndef UNUSED
108
-#define UNUSED(v)          (void)(v)
108
+#define UNUSED(x) (void) (x)
109 109
 #endif
110 110
 
111 111
 /**
@@ -444,8 +444,8 @@ typedef struct
444 444
 #define ENABLE    1
445 445
 #ifndef __cplusplus
446 446
 #if !defined(__bool_true_false_are_defined)
447
-#define false     0
448
-#define true      1
447
+#define false 0
448
+#define true 1
449 449
 #endif
450 450
 #endif
451 451
 #ifndef PASS
@@ -455,10 +455,10 @@ typedef struct
455 455
 #define FAIL      1
456 456
 #endif
457 457
 #ifndef LOW
458
-#define LOW       0
458
+#define LOW  0x0
459 459
 #endif
460 460
 #ifndef HIGH
461
-#define HIGH      1
461
+#define HIGH 0x1
462 462
 #endif
463 463
 //! @}
464 464
 

Loading…
Cancel
Save