Explorar el Código

add USEABLE_HARDWARE_PWM & clear up some compiler warnings

Bob-the-Kuhn hace 7 años
padre
commit
ab709ccac1

+ 7
- 7
Marlin/src/HAL/HAL_DUE/HAL_spi_Due.cpp Ver fichero

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

+ 4
- 0
Marlin/src/HAL/HAL_DUE/fastio_Due.h Ver fichero

43
  * Utility functions
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
 #ifndef MASK
50
 #ifndef MASK
47
   #define MASK(PIN)  (1 << PIN)
51
   #define MASK(PIN)  (1 << PIN)
48
 #endif
52
 #endif

+ 5
- 5
Marlin/src/HAL/HAL_DUE/usb/compiler.h Ver fichero

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

Loading…
Cancelar
Guardar