Parcourir la source

✏️ MAX31856 => MAX31865

Scott Lahteine il y a 2 ans
Parent
révision
63d73bfafc
2 fichiers modifiés avec 32 ajouts et 32 suppressions
  1. 14
    14
      Marlin/src/libs/MAX31865.cpp
  2. 18
    18
      Marlin/src/libs/MAX31865.h

+ 14
- 14
Marlin/src/libs/MAX31865.cpp Voir le fichier

@@ -166,7 +166,7 @@ void MAX31865::begin(max31865_numwires_t wires, float zero, float ref) {
166 166
       " _miso: ", _miso,
167 167
       " _sclk: ", _sclk,
168 168
       " _mosi: ", _mosi,
169
-      " config: ", readRegister8(MAX31856_CONFIG_REG)
169
+      " config: ", readRegister8(MAX31865_CONFIG_REG)
170 170
     );
171 171
   #endif
172 172
 }
@@ -177,14 +177,14 @@ void MAX31865::begin(max31865_numwires_t wires, float zero, float ref) {
177 177
  * @return The raw unsigned 8-bit FAULT status register
178 178
  */
179 179
 uint8_t MAX31865::readFault() {
180
-  return readRegister8(MAX31856_FAULTSTAT_REG);
180
+  return readRegister8(MAX31865_FAULTSTAT_REG);
181 181
 }
182 182
 
183 183
 /**
184 184
  * Clear all faults in FAULTSTAT.
185 185
  */
186 186
 void MAX31865::clearFault() {
187
-  setConfig(MAX31856_CONFIG_FAULTSTAT, 1);
187
+  setConfig(MAX31865_CONFIG_FAULTSTAT, 1);
188 188
 }
189 189
 
190 190
 /**
@@ -193,7 +193,7 @@ void MAX31865::clearFault() {
193 193
  * @param b  If true, auto conversion is enabled
194 194
  */
195 195
 void MAX31865::autoConvert(bool b) {
196
-  setConfig(MAX31856_CONFIG_MODEAUTO, b);
196
+  setConfig(MAX31865_CONFIG_MODEAUTO, b);
197 197
 }
198 198
 
199 199
 /**
@@ -202,7 +202,7 @@ void MAX31865::autoConvert(bool b) {
202 202
  * @param b  If true, 50Hz noise is filtered, else 60Hz(default)
203 203
  */
204 204
 void MAX31865::enable50HzFilter(bool b) {
205
-  setConfig(MAX31856_CONFIG_FILT50HZ, b);
205
+  setConfig(MAX31865_CONFIG_FILT50HZ, b);
206 206
 }
207 207
 
208 208
 /**
@@ -211,7 +211,7 @@ void MAX31865::enable50HzFilter(bool b) {
211 211
  * @param b  If true bias is enabled, else disabled
212 212
  */
213 213
 void MAX31865::enableBias(bool b) {
214
-  setConfig(MAX31856_CONFIG_BIAS, b);
214
+  setConfig(MAX31865_CONFIG_BIAS, b);
215 215
 
216 216
   // From the datasheet:
217 217
   // Note that if VBIAS is off (to reduce supply current between conversions), any filter
@@ -226,7 +226,7 @@ void MAX31865::enableBias(bool b) {
226 226
  * Start a one-shot temperature reading.
227 227
  */
228 228
 void MAX31865::oneShot() {
229
-  setConfig(MAX31856_CONFIG_1SHOT, 1);
229
+  setConfig(MAX31865_CONFIG_1SHOT, 1);
230 230
 
231 231
   // From the datasheet:
232 232
   // Note that a single conversion requires approximately 52ms in 60Hz filter
@@ -242,12 +242,12 @@ void MAX31865::oneShot() {
242 242
  * @param wires The number of wires in enum format
243 243
  */
244 244
 void MAX31865::setWires(max31865_numwires_t wires) {
245
-  uint8_t t = readRegister8(MAX31856_CONFIG_REG);
245
+  uint8_t t = readRegister8(MAX31865_CONFIG_REG);
246 246
   if (wires == MAX31865_3WIRE)
247
-    t |= MAX31856_CONFIG_3WIRE;
247
+    t |= MAX31865_CONFIG_3WIRE;
248 248
   else // 2 or 4 wire
249
-    t &= ~MAX31856_CONFIG_3WIRE;
250
-  writeRegister8(MAX31856_CONFIG_REG, t);
249
+    t &= ~MAX31865_CONFIG_3WIRE;
250
+  writeRegister8(MAX31865_CONFIG_REG, t);
251 251
 }
252 252
 
253 253
 /**
@@ -261,7 +261,7 @@ uint16_t MAX31865::readRaw() {
261 261
   enableBias(true);
262 262
 
263 263
   oneShot();
264
-  uint16_t rtd = readRegister16(MAX31856_RTDMSB_REG);
264
+  uint16_t rtd = readRegister16(MAX31865_RTDMSB_REG);
265 265
 
266 266
   #ifdef MAX31865_DEBUG
267 267
     SERIAL_ECHOLNPGM("RTD MSB:", (rtd >> 8), "  RTD LSB:", (rtd & 0x00FF));
@@ -352,12 +352,12 @@ float MAX31865::temperature(float Rrtd) {
352 352
  * @param enable  whether to enable or disable the value
353 353
  */
354 354
 void MAX31865::setConfig(uint8_t config, bool enable) {
355
-  uint8_t t = readRegister8(MAX31856_CONFIG_REG);
355
+  uint8_t t = readRegister8(MAX31865_CONFIG_REG);
356 356
   if (enable)
357 357
     t |= config;
358 358
   else
359 359
     t &= ~config; // disable
360
-  writeRegister8(MAX31856_CONFIG_REG, t);
360
+  writeRegister8(MAX31865_CONFIG_REG, t);
361 361
 }
362 362
 
363 363
 /**

+ 18
- 18
Marlin/src/libs/MAX31865.h Voir le fichier

@@ -45,24 +45,24 @@
45 45
 #include "../HAL/shared/Delay.h"
46 46
 #include HAL_PATH(../HAL, MarlinSPI.h)
47 47
 
48
-#define MAX31856_CONFIG_REG 0x00
49
-#define MAX31856_CONFIG_BIAS 0x80
50
-#define MAX31856_CONFIG_MODEAUTO 0x40
51
-#define MAX31856_CONFIG_MODEOFF 0x00
52
-#define MAX31856_CONFIG_1SHOT 0x20
53
-#define MAX31856_CONFIG_3WIRE 0x10
54
-#define MAX31856_CONFIG_24WIRE 0x00
55
-#define MAX31856_CONFIG_FAULTSTAT 0x02
56
-#define MAX31856_CONFIG_FILT50HZ 0x01
57
-#define MAX31856_CONFIG_FILT60HZ 0x00
58
-
59
-#define MAX31856_RTDMSB_REG 0x01
60
-#define MAX31856_RTDLSB_REG 0x02
61
-#define MAX31856_HFAULTMSB_REG 0x03
62
-#define MAX31856_HFAULTLSB_REG 0x04
63
-#define MAX31856_LFAULTMSB_REG 0x05
64
-#define MAX31856_LFAULTLSB_REG 0x06
65
-#define MAX31856_FAULTSTAT_REG 0x07
48
+#define MAX31865_CONFIG_REG 0x00
49
+#define MAX31865_CONFIG_BIAS 0x80
50
+#define MAX31865_CONFIG_MODEAUTO 0x40
51
+#define MAX31865_CONFIG_MODEOFF 0x00
52
+#define MAX31865_CONFIG_1SHOT 0x20
53
+#define MAX31865_CONFIG_3WIRE 0x10
54
+#define MAX31865_CONFIG_24WIRE 0x00
55
+#define MAX31865_CONFIG_FAULTSTAT 0x02
56
+#define MAX31865_CONFIG_FILT50HZ 0x01
57
+#define MAX31865_CONFIG_FILT60HZ 0x00
58
+
59
+#define MAX31865_RTDMSB_REG 0x01
60
+#define MAX31865_RTDLSB_REG 0x02
61
+#define MAX31865_HFAULTMSB_REG 0x03
62
+#define MAX31865_HFAULTLSB_REG 0x04
63
+#define MAX31865_LFAULTMSB_REG 0x05
64
+#define MAX31865_LFAULTLSB_REG 0x06
65
+#define MAX31865_FAULTSTAT_REG 0x07
66 66
 
67 67
 #define MAX31865_FAULT_HIGHTHRESH 0x80  // D7
68 68
 #define MAX31865_FAULT_LOWTHRESH 0x40   // D6

Chargement…
Annuler
Enregistrer