Browse Source

Provide some missing Arduino macros (#16497)

dagorel 4 years ago
parent
commit
a88b91b3ed
1 changed files with 18 additions and 0 deletions
  1. 18
    0
      Marlin/src/feature/dac/dac_mcp4728.h

+ 18
- 0
Marlin/src/feature/dac/dac_mcp4728.h View File

@@ -29,6 +29,24 @@
29 29
 
30 30
 #include <Wire.h>
31 31
 
32
+/**
33
+ * The following three macros are only used in this piece of code related to mcp4728.
34
+ * They are defined in the standard Arduino framework but could be undefined in 32 bits Arduino frameworks.
35
+ * (For instance not defined in Arduino lpc176x framework)
36
+ * So we have to define them if needed.
37
+ */
38
+#ifndef word
39
+  #define word(h, l)  ((uint8_t) ((h << 8) | l))
40
+#endif
41
+
42
+#ifndef lowByte
43
+  #define lowByte(w)  ((uint8_t) ((w) & 0xff))
44
+#endif
45
+
46
+#ifndef highByte
47
+  #define highByte(w) ((uint8_t) ((w) >> 8))
48
+#endif
49
+
32 50
 #define defaultVDD     DAC_STEPPER_MAX //was 5000 but differs with internal Vref
33 51
 #define BASE_ADDR      0x60
34 52
 #define RESET          0b00000110

Loading…
Cancel
Save