From a88b91b3ed9eab7ec89045f93031faeb1823e1d4 Mon Sep 17 00:00:00 2001 From: dagorel <37673727+dagorel@users.noreply.github.com> Date: Wed, 8 Jan 2020 04:56:47 +0100 Subject: [PATCH] Provide some missing Arduino macros (#16497) --- Marlin/src/feature/dac/dac_mcp4728.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Marlin/src/feature/dac/dac_mcp4728.h b/Marlin/src/feature/dac/dac_mcp4728.h index 92e28ffb2b..f25310f7ca 100644 --- a/Marlin/src/feature/dac/dac_mcp4728.h +++ b/Marlin/src/feature/dac/dac_mcp4728.h @@ -29,6 +29,24 @@ #include +/** + * The following three macros are only used in this piece of code related to mcp4728. + * They are defined in the standard Arduino framework but could be undefined in 32 bits Arduino frameworks. + * (For instance not defined in Arduino lpc176x framework) + * So we have to define them if needed. + */ +#ifndef word + #define word(h, l) ((uint8_t) ((h << 8) | l)) +#endif + +#ifndef lowByte + #define lowByte(w) ((uint8_t) ((w) & 0xff)) +#endif + +#ifndef highByte + #define highByte(w) ((uint8_t) ((w) >> 8)) +#endif + #define defaultVDD DAC_STEPPER_MAX //was 5000 but differs with internal Vref #define BASE_ADDR 0x60 #define RESET 0b00000110