Skip to content
This repository was archived by the owner on Aug 27, 2023. It is now read-only.

Commit fdf6dbe

Browse files
wsowaTraumflug
authored andcommitted
Added support for MCP3008 and MCP3004 ADC for temperature read
1 parent 52e5d78 commit fdf6dbe

27 files changed

+555
-164
lines changed

config/board.3drag.h

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,17 @@
112112
*/
113113
#define SD_CARD_SELECT_PIN DIO25
114114

115+
/** \def MCP3008_SELECT_PIN
116+
117+
Chip Select pin of the MCP3008 ADC.
118+
119+
MCP3008/4 analog-digital converter works over SPI and has a Chip Select pin.
120+
Choose this pin according to where the MCP3008 is connected. Setting this
121+
pin is required only if at least one temperature sensor of type MCP3008 is
122+
configured. Else it's ignored.
123+
*/
124+
//#define MCP3008_SELECT_PIN xxxx
125+
115126

116127
/***************************************************************************\
117128
* *
@@ -124,6 +135,8 @@
124135
#endif
125136

126137
/** \def TEMP_MAX6675 TEMP_THERMISTOR TEMP_AD595 TEMP_PT100 TEMP_INTERCOM
138+
\def TEMP_MCP3008
139+
127140
Which temperature sensor types are you using? Leave all used ones
128141
uncommented, comment out all others to save binary size and enhance
129142
performance.
@@ -133,6 +146,7 @@
133146
//#define TEMP_AD595
134147
//#define TEMP_PT100
135148
//#define TEMP_INTERCOM
149+
//#define TEMP_MCP3008
136150

137151
/** \def TEMP_SENSOR_PIN
138152
Temperature sensor pins a user should be able to choose from in configtool.
@@ -151,12 +165,12 @@
151165
"noheater".
152166
153167
Types are same as TEMP_ list above - TT_MAX6675, TT_THERMISTOR, TT_AD595,
154-
TT_PT100, TT_INTERCOM. See list in temp.c.
168+
TT_PT100, TT_INTERCOM, TT_MCP3008. See list in temp.c.
155169
156-
The "additional" field is used for TT_THERMISTOR only. It defines the
157-
name of the table(s) in thermistortable.h to use. This name is arbitrary,
158-
often used names include THERMISTOR_EXTRUDER and THERMISTOR_BED. Also,
159-
several sensors can share the same table, which saves binary size.
170+
The "additional" field is used for TT_THERMISTOR and TT_MCP3008 only. It
171+
defines the name of the table(s) in thermistortable.h to use. This name is
172+
arbitrary, often used names include THERMISTOR_EXTRUDER and THERMISTOR_BED.
173+
Also, several sensors can share the same table, which saves binary size.
160174
161175
For a GEN3 set temp_type to TT_INTERCOM and temp_pin to AIO0. The pin
162176
won't be used in this case.

config/board.cnc-shield-v3.h

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,17 @@
115115
*/
116116
//#define SD_CARD_SELECT_PIN xxxx
117117

118+
/** \def MCP3008_SELECT_PIN
119+
120+
Chip Select pin of the MCP3008 ADC.
121+
122+
MCP3008/4 analog-digital converter works over SPI and has a Chip Select pin.
123+
Choose this pin according to where the MCP3008 is connected. Setting this
124+
pin is required only if at least one temperature sensor of type MCP3008 is
125+
configured. Else it's ignored.
126+
*/
127+
//#define MCP3008_SELECT_PIN xxxx
128+
118129

119130
/***************************************************************************\
120131
* *
@@ -127,6 +138,8 @@
127138
#endif
128139

129140
/** \def TEMP_MAX6675 TEMP_THERMISTOR TEMP_AD595 TEMP_PT100 TEMP_INTERCOM
141+
\def TEMP_MCP3008
142+
130143
Which temperature sensor types are you using? Leave all used ones
131144
uncommented, comment out all others to save binary size and enhance
132145
performance.
@@ -136,6 +149,7 @@
136149
//#define TEMP_AD595
137150
//#define TEMP_PT100
138151
//#define TEMP_INTERCOM
152+
//#define TEMP_MCP3008
139153

140154
/** \def TEMP_SENSOR_PIN
141155
Temperature sensor pins a user should be able to choose from in configtool.
@@ -155,12 +169,12 @@
155169
"noheater".
156170
157171
Types are same as TEMP_ list above - TT_MAX6675, TT_THERMISTOR, TT_AD595,
158-
TT_PT100, TT_INTERCOM. See list in temp.c.
172+
TT_PT100, TT_INTERCOM, TT_MCP3008. See list in temp.c.
159173
160-
The "additional" field is used for TT_THERMISTOR only. It defines the
161-
name of the table(s) in thermistortable.h to use. This name is arbitrary,
162-
often used names include THERMISTOR_EXTRUDER and THERMISTOR_BED. Also,
163-
several sensors can share the same table, which saves binary size.
174+
The "additional" field is used for TT_THERMISTOR and TT_MCP3008 only. It
175+
defines the name of the table(s) in thermistortable.h to use. This name is
176+
arbitrary, often used names include THERMISTOR_EXTRUDER and THERMISTOR_BED.
177+
Also, several sensors can share the same table, which saves binary size.
164178
165179
For a GEN3 set temp_type to TT_INTERCOM and temp_pin to AIO0. The pin
166180
won't be used in this case.

config/board.gen3.h

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,17 @@
112112
*/
113113
#define SD_CARD_SELECT_PIN DIO4
114114

115+
/** \def MCP3008_SELECT_PIN
116+
117+
Chip Select pin of the MCP3008 ADC.
118+
119+
MCP3008/4 analog-digital converter works over SPI and has a Chip Select pin.
120+
Choose this pin according to where the MCP3008 is connected. Setting this
121+
pin is required only if at least one temperature sensor of type MCP3008 is
122+
configured. Else it's ignored.
123+
*/
124+
//#define MCP3008_SELECT_PIN xxxx
125+
115126

116127
/***************************************************************************\
117128
* *
@@ -124,6 +135,8 @@
124135
#endif
125136

126137
/** \def TEMP_MAX6675 TEMP_THERMISTOR TEMP_AD595 TEMP_PT100 TEMP_INTERCOM
138+
\def TEMP_MCP3008
139+
127140
Which temperature sensor types are you using? Leave all used ones
128141
uncommented, comment out all others to save binary size and enhance
129142
performance.
@@ -133,6 +146,7 @@
133146
//#define TEMP_AD595
134147
//#define TEMP_PT100
135148
#define TEMP_INTERCOM
149+
//#define TEMP_MCP3008
136150

137151
/** \def TEMP_SENSOR_PIN
138152
Temperature sensor pins a user should be able to choose from in configtool.
@@ -150,12 +164,12 @@
150164
"noheater".
151165
152166
Types are same as TEMP_ list above - TT_MAX6675, TT_THERMISTOR, TT_AD595,
153-
TT_PT100, TT_INTERCOM. See list in temp.c.
167+
TT_PT100, TT_INTERCOM, TT_MCP3008. See list in temp.c.
154168
155-
The "additional" field is used for TT_THERMISTOR only. It defines the
156-
name of the table(s) in thermistortable.h to use. This name is arbitrary,
157-
often used names include THERMISTOR_EXTRUDER and THERMISTOR_BED. Also,
158-
several sensors can share the same table, which saves binary size.
169+
The "additional" field is used for TT_THERMISTOR and TT_MCP3008 only. It
170+
defines the name of the table(s) in thermistortable.h to use. This name is
171+
arbitrary, often used names include THERMISTOR_EXTRUDER and THERMISTOR_BED.
172+
Also, several sensors can share the same table, which saves binary size.
159173
160174
For a GEN3 set temp_type to TT_INTERCOM and temp_pin to AIO0. The pin
161175
won't be used in this case.

config/board.gen6.h

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,17 @@
112112
*/
113113
//#define SD_CARD_SELECT_PIN xxxx
114114

115+
/** \def MCP3008_SELECT_PIN
116+
117+
Chip Select pin of the MCP3008 ADC.
118+
119+
MCP3008/4 analog-digital converter works over SPI and has a Chip Select pin.
120+
Choose this pin according to where the MCP3008 is connected. Setting this
121+
pin is required only if at least one temperature sensor of type MCP3008 is
122+
configured. Else it's ignored.
123+
*/
124+
//#define MCP3008_SELECT_PIN xxxx
125+
115126

116127
/***************************************************************************\
117128
* *
@@ -124,6 +135,8 @@
124135
#endif
125136

126137
/** \def TEMP_MAX6675 TEMP_THERMISTOR TEMP_AD595 TEMP_PT100 TEMP_INTERCOM
138+
\def TEMP_MCP3008
139+
127140
Which temperature sensor types are you using? Leave all used ones
128141
uncommented, comment out all others to save binary size and enhance
129142
performance.
@@ -133,6 +146,7 @@
133146
//#define TEMP_AD595
134147
//#define TEMP_PT100
135148
//#define TEMP_INTERCOM
149+
//#define TEMP_MCP3008
136150

137151
/** \def TEMP_SENSOR_PIN
138152
Temperature sensor pins a user should be able to choose from in configtool.
@@ -150,12 +164,12 @@
150164
"noheater".
151165
152166
Types are same as TEMP_ list above - TT_MAX6675, TT_THERMISTOR, TT_AD595,
153-
TT_PT100, TT_INTERCOM. See list in temp.c.
167+
TT_PT100, TT_INTERCOM, TT_MCP3008. See list in temp.c.
154168
155-
The "additional" field is used for TT_THERMISTOR only. It defines the
156-
name of the table(s) in thermistortable.h to use. This name is arbitrary,
157-
often used names include THERMISTOR_EXTRUDER and THERMISTOR_BED. Also,
158-
several sensors can share the same table, which saves binary size.
169+
The "additional" field is used for TT_THERMISTOR and TT_MCP3008 only. It
170+
defines the name of the table(s) in thermistortable.h to use. This name is
171+
arbitrary, often used names include THERMISTOR_EXTRUDER and THERMISTOR_BED.
172+
Also, several sensors can share the same table, which saves binary size.
159173
160174
For a GEN3 set temp_type to TT_INTERCOM and temp_pin to AIO0. The pin
161175
won't be used in this case.

config/board.gen7-arm.h

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,17 @@
112112
*/
113113
//#define SD_CARD_SELECT_PIN xxxx
114114

115+
/** \def MCP3008_SELECT_PIN
116+
117+
Chip Select pin of the MCP3008 ADC.
118+
119+
MCP3008/4 analog-digital converter works over SPI and has a Chip Select pin.
120+
Choose this pin according to where the MCP3008 is connected. Setting this
121+
pin is required only if at least one temperature sensor of type MCP3008 is
122+
configured. Else it's ignored.
123+
*/
124+
//#define MCP3008_SELECT_PIN xxxx
125+
115126

116127
/***************************************************************************\
117128
* *
@@ -124,6 +135,8 @@
124135
#endif
125136

126137
/** \def TEMP_MAX6675 TEMP_THERMISTOR TEMP_AD595 TEMP_PT100 TEMP_INTERCOM
138+
\def TEMP_MCP3008
139+
127140
Which temperature sensor types are you using? Leave all used ones
128141
uncommented, comment out all others to save binary size and enhance
129142
performance.
@@ -133,6 +146,7 @@
133146
//#define TEMP_AD595
134147
//#define TEMP_PT100
135148
//#define TEMP_INTERCOM
149+
//#define TEMP_MCP3008
136150

137151
/** \def TEMP_SENSOR_PIN
138152
Temperature sensor pins a user should be able to choose from in configtool.
@@ -151,12 +165,12 @@
151165
"noheater".
152166
153167
Types are same as TEMP_ list above - TT_MAX6675, TT_THERMISTOR, TT_AD595,
154-
TT_PT100, TT_INTERCOM. See list in temp.c.
168+
TT_PT100, TT_INTERCOM, TT_MCP3008. See list in temp.c.
155169
156-
The "additional" field is used for TT_THERMISTOR only. It defines the
157-
name of the table(s) in thermistortable.h to use. This name is arbitrary,
158-
often used names include THERMISTOR_EXTRUDER and THERMISTOR_BED. Also,
159-
several sensors can share the same table, which saves binary size.
170+
The "additional" field is used for TT_THERMISTOR and TT_MCP3008 only. It
171+
defines the name of the table(s) in thermistortable.h to use. This name is
172+
arbitrary, often used names include THERMISTOR_EXTRUDER and THERMISTOR_BED.
173+
Also, several sensors can share the same table, which saves binary size.
160174
161175
For a GEN3 set temp_type to TT_INTERCOM and temp_pin to AIO0. The pin
162176
won't be used in this case.

config/board.gen7-v1.1-v1.3.h

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,17 @@
116116
*/
117117
#define SD_CARD_SELECT_PIN DIO10
118118

119+
/** \def MCP3008_SELECT_PIN
120+
121+
Chip Select pin of the MCP3008 ADC.
122+
123+
MCP3008/4 analog-digital converter works over SPI and has a Chip Select pin.
124+
Choose this pin according to where the MCP3008 is connected. Setting this
125+
pin is required only if at least one temperature sensor of type MCP3008 is
126+
configured. Else it's ignored.
127+
*/
128+
//#define MCP3008_SELECT_PIN xxxx
129+
119130

120131
/***************************************************************************\
121132
* *
@@ -128,6 +139,8 @@
128139
#endif
129140

130141
/** \def TEMP_MAX6675 TEMP_THERMISTOR TEMP_AD595 TEMP_PT100 TEMP_INTERCOM
142+
\def TEMP_MCP3008
143+
131144
Which temperature sensor types are you using? Leave all used ones
132145
uncommented, comment out all others to save binary size and enhance
133146
performance.
@@ -137,6 +150,7 @@
137150
//#define TEMP_AD595
138151
//#define TEMP_PT100
139152
//#define TEMP_INTERCOM
153+
//#define TEMP_MCP3008
140154

141155
/** \def TEMP_SENSOR_PIN
142156
Temperature sensor pins a user should be able to choose from in configtool.
@@ -155,12 +169,12 @@
155169
"noheater".
156170
157171
Types are same as TEMP_ list above - TT_MAX6675, TT_THERMISTOR, TT_AD595,
158-
TT_PT100, TT_INTERCOM. See list in temp.c.
172+
TT_PT100, TT_INTERCOM, TT_MCP3008. See list in temp.c.
159173
160-
The "additional" field is used for TT_THERMISTOR only. It defines the
161-
name of the table(s) in thermistortable.h to use. This name is arbitrary,
162-
often used names include THERMISTOR_EXTRUDER and THERMISTOR_BED. Also,
163-
several sensors can share the same table, which saves binary size.
174+
The "additional" field is used for TT_THERMISTOR and TT_MCP3008 only. It
175+
defines the name of the table(s) in thermistortable.h to use. This name is
176+
arbitrary, often used names include THERMISTOR_EXTRUDER and THERMISTOR_BED.
177+
Also, several sensors can share the same table, which saves binary size.
164178
165179
For a GEN3 set temp_type to TT_INTERCOM and temp_pin to AIO0. The pin
166180
won't be used in this case.

config/board.gen7-v1.4.h

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,17 @@
116116
*/
117117
#define SD_CARD_SELECT_PIN DIO10
118118

119+
/** \def MCP3008_SELECT_PIN
120+
121+
Chip Select pin of the MCP3008 ADC.
122+
123+
MCP3008/4 analog-digital converter works over SPI and has a Chip Select pin.
124+
Choose this pin according to where the MCP3008 is connected. Setting this
125+
pin is required only if at least one temperature sensor of type MCP3008 is
126+
configured. Else it's ignored.
127+
*/
128+
//#define MCP3008_SELECT_PIN xxxx
129+
119130

120131
/***************************************************************************\
121132
* *
@@ -128,6 +139,8 @@
128139
#endif
129140

130141
/** \def TEMP_MAX6675 TEMP_THERMISTOR TEMP_AD595 TEMP_PT100 TEMP_INTERCOM
142+
\def TEMP_MCP3008
143+
131144
Which temperature sensor types are you using? Leave all used ones
132145
uncommented, comment out all others to save binary size and enhance
133146
performance.
@@ -137,6 +150,7 @@
137150
//#define TEMP_AD595
138151
//#define TEMP_PT100
139152
//#define TEMP_INTERCOM
153+
//#define TEMP_MCP3008
140154

141155
/** \def TEMP_SENSOR_PIN
142156
Temperature sensor pins a user should be able to choose from in configtool.
@@ -156,12 +170,12 @@
156170
"noheater".
157171
158172
Types are same as TEMP_ list above - TT_MAX6675, TT_THERMISTOR, TT_AD595,
159-
TT_PT100, TT_INTERCOM. See list in temp.c.
173+
TT_PT100, TT_INTERCOM, TT_MCP3008. See list in temp.c.
160174
161-
The "additional" field is used for TT_THERMISTOR only. It defines the
162-
name of the table(s) in thermistortable.h to use. This name is arbitrary,
163-
often used names include THERMISTOR_EXTRUDER and THERMISTOR_BED. Also,
164-
several sensors can share the same table, which saves binary size.
175+
The "additional" field is used for TT_THERMISTOR and TT_MCP3008 only. It
176+
defines the name of the table(s) in thermistortable.h to use. This name is
177+
arbitrary, often used names include THERMISTOR_EXTRUDER and THERMISTOR_BED.
178+
Also, several sensors can share the same table, which saves binary size.
165179
166180
For a GEN3 set temp_type to TT_INTERCOM and temp_pin to AIO0. The pin
167181
won't be used in this case.

0 commit comments

Comments
 (0)