Преглед изворни кода

✏️ MAX31856 => MAX31865

Scott Lahteine пре 3 година
родитељ
комит
63d73bfafc
2 измењених фајлова са 32 додато и 32 уклоњено
  1. 14
    14
      Marlin/src/libs/MAX31865.cpp
  2. 18
    18
      Marlin/src/libs/MAX31865.h

+ 14
- 14
Marlin/src/libs/MAX31865.cpp Прегледај датотеку

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

45
 #include "../HAL/shared/Delay.h"
45
 #include "../HAL/shared/Delay.h"
46
 #include HAL_PATH(../HAL, MarlinSPI.h)
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
 #define MAX31865_FAULT_HIGHTHRESH 0x80  // D7
67
 #define MAX31865_FAULT_HIGHTHRESH 0x80  // D7
68
 #define MAX31865_FAULT_LOWTHRESH 0x40   // D6
68
 #define MAX31865_FAULT_LOWTHRESH 0x40   // D6

Loading…
Откажи
Сачувај