Skip to content
Browse files

Fixed ADC channel handling.

ADC pin is not the same as ADC channel in atmega1280/2560.
  • Loading branch information...
1 parent d967ad1 commit bfe5e6f2fc1fa1dee1420e03ed4a7851ce2b31b5 @sivu sivu committed with
View
2 analog.c
@@ -12,7 +12,7 @@
/* OR-combined mask of all channels */
#undef DEFINE_TEMP_SENSOR
//! automagically generate analog_mask from DEFINE_TEMP_SENSOR entries in config.h
-#define DEFINE_TEMP_SENSOR(name, type, pin, additional) | (((type == TT_THERMISTOR) || (type == TT_AD595)) ? 1 << (pin) : 0)
+#define DEFINE_TEMP_SENSOR(name, type, pin, additional) | (((type == TT_THERMISTOR) || (type == TT_AD595)) ? (1 << (pin ## _ADC)) : 0)
#ifdef AIO8_PIN
static const uint16_t analog_mask = 0
View
16 arduino_1280.h
@@ -364,96 +364,112 @@ pins
#define AIO0_WPORT PORTF
#define AIO0_DDR DDRF
#define AIO0_PWM NULL
+#define AIO0_ADC 0
#define AIO1_PIN PINF1
#define AIO1_RPORT PINF
#define AIO1_WPORT PORTF
#define AIO1_DDR DDRF
#define AIO1_PWM NULL
+#define AIO1_ADC 1
#define AIO2_PIN PINF2
#define AIO2_RPORT PINF
#define AIO2_WPORT PORTF
#define AIO2_DDR DDRF
#define AIO2_PWM NULL
+#define AIO2_ADC 2
#define AIO3_PIN PINF3
#define AIO3_RPORT PINF
#define AIO3_WPORT PORTF
#define AIO3_DDR DDRF
#define AIO3_PWM NULL
+#define AIO3_ADC 3
#define AIO4_PIN PINF4
#define AIO4_RPORT PINF
#define AIO4_WPORT PORTF
#define AIO4_DDR DDRF
#define AIO4_PWM NULL
+#define AIO4_ADC 4
#define AIO5_PIN PINF5
#define AIO5_RPORT PINF
#define AIO5_WPORT PORTF
#define AIO5_DDR DDRF
#define AIO5_PWM NULL
+#define AIO5_ADC 5
#define AIO6_PIN PINF6
#define AIO6_RPORT PINF
#define AIO6_WPORT PORTF
#define AIO6_DDR DDRF
#define AIO6_PWM NULL
+#define AIO6_ADC 6
#define AIO7_PIN PINF7
#define AIO7_RPORT PINF
#define AIO7_WPORT PORTF
#define AIO7_DDR DDRF
#define AIO7_PWM NULL
+#define AIO7_ADC 7
#define AIO8_PIN PINK0
#define AIO8_RPORT PINK
#define AIO8_WPORT PORTK
#define AIO8_DDR DDRK
#define AIO8_PWM NULL
+#define AIO8_ADC 8
#define AIO9_PIN PINK1
#define AIO9_RPORT PINK
#define AIO9_WPORT PORTK
#define AIO9_DDR DDRK
#define AIO9_PWM NULL
+#define AIO9_ADC 9
#define AIO10_PIN PINK2
#define AIO10_RPORT PINK
#define AIO10_WPORT PORTK
#define AIO10_DDR DDRK
#define AIO10_PWM NULL
+#define AIO10_ADC 10
#define AIO11_PIN PINK3
#define AIO11_RPORT PINK
#define AIO11_WPORT PORTK
#define AIO11_DDR DDRK
#define AIO11_PWM NULL
+#define AIO11_ADC 11
#define AIO12_PIN PINK4
#define AIO12_RPORT PINK
#define AIO12_WPORT PORTK
#define AIO12_DDR DDRK
#define AIO12_PWM NULL
+#define AIO12_ADC 12
#define AIO13_PIN PINK5
#define AIO13_RPORT PINK
#define AIO13_WPORT PORTK
#define AIO13_DDR DDRK
#define AIO13_PWM NULL
+#define AIO13_ADC 13
#define AIO14_PIN PINK6
#define AIO14_RPORT PINK
#define AIO14_WPORT PORTK
#define AIO14_DDR DDRK
#define AIO14_PWM NULL
+#define AIO14_ADC 14
#define AIO15_PIN PINK7
#define AIO15_RPORT PINK
#define AIO15_WPORT PORTK
#define AIO15_DDR DDRK
#define AIO15_PWM NULL
+#define AIO15_ADC 15
View
8 arduino_168_328p.h
@@ -116,48 +116,56 @@ pins
#define AIO0_WPORT PORTC
#define AIO0_DDR DDRC
#define AIO0_PWM NULL
+#define AIO0_ADC 0
#define AIO1_PIN PINC1
#define AIO1_RPORT PINC
#define AIO1_WPORT PORTC
#define AIO1_DDR DDRC
#define AIO1_PWM NULL
+#define AIO1_ADC 1
#define AIO2_PIN PINC2
#define AIO2_RPORT PINC
#define AIO2_WPORT PORTC
#define AIO2_DDR DDRC
#define AIO2_PWM NULL
+#define AIO2_ADC 2
#define AIO3_PIN PINC3
#define AIO3_RPORT PINC
#define AIO3_WPORT PORTC
#define AIO3_DDR DDRC
#define AIO3_PWM NULL
+#define AIO3_ADC 3
#define AIO4_PIN PINC4
#define AIO4_RPORT PINC
#define AIO4_WPORT PORTC
#define AIO4_DDR DDRC
#define AIO4_PWM NULL
+#define AIO4_ADC 4
#define AIO5_PIN PINC5
#define AIO5_RPORT PINC
#define AIO5_WPORT PORTC
#define AIO5_DDR DDRC
#define AIO5_PWM NULL
+#define AIO5_ADC 5
#define AIO6_PIN PINC6
#define AIO6_RPORT PINC
#define AIO6_WPORT PORTC
#define AIO6_DDR DDRC
#define AIO6_PWM NULL
+#define AIO6_ADC 6
#define AIO7_PIN PINC7
#define AIO7_RPORT PINC
#define AIO7_WPORT PORTC
#define AIO7_DDR DDRC
#define AIO7_PWM NULL
+#define AIO7_ADC 7
View
8 arduino_644.h
@@ -227,48 +227,56 @@ pins
#define AIO0_WPORT PORTA
#define AIO0_DDR DDRA
#define AIO0_PWM NULL
+#define AIO0_ADC 0
#define AIO1_PIN PINA1
#define AIO1_RPORT PINA
#define AIO1_WPORT PORTA
#define AIO1_DDR DDRA
#define AIO1_PWM NULL
+#define AIO1_ADC 1
#define AIO2_PIN PINA2
#define AIO2_RPORT PINA
#define AIO2_WPORT PORTA
#define AIO2_DDR DDRA
#define AIO2_PWM NULL
+#define AIO2_ADC 2
#define AIO3_PIN PINA3
#define AIO3_RPORT PINA
#define AIO3_WPORT PORTA
#define AIO3_DDR DDRA
#define AIO3_PWM NULL
+#define AIO3_ADC 3
#define AIO4_PIN PINA4
#define AIO4_RPORT PINA
#define AIO4_WPORT PORTA
#define AIO4_DDR DDRA
#define AIO4_PWM NULL
+#define AIO4_ADC 4
#define AIO5_PIN PINA5
#define AIO5_RPORT PINA
#define AIO5_WPORT PORTA
#define AIO5_DDR DDRA
#define AIO5_PWM NULL
+#define AIO5_ADC 5
#define AIO6_PIN PINA6
#define AIO6_RPORT PINA
#define AIO6_WPORT PORTA
#define AIO6_DDR DDRA
#define AIO6_PWM NULL
+#define AIO6_ADC 6
#define AIO7_PIN PINA7
#define AIO7_RPORT PINA
#define AIO7_WPORT PORTA
#define AIO7_DDR DDRA
#define AIO7_PWM NULL
+#define AIO7_ADC 7
View
8 arduino_usb1287.h
@@ -256,48 +256,56 @@ pins
#define AIO0_WPORT PORTF
#define AIO0_PWM NULL
#define AIO0_DDR DDRF
+#define AIO0_ADC 0
#define AIO1_PIN PINF1
#define AIO1_RPORT PINF
#define AIO1_WPORT PORTF
#define AIO1_PWM NULL
#define AIO1_DDR DDRF
+#define AIO1_ADC 1
#define AIO2_PIN PINF2
#define AIO2_RPORT PINF
#define AIO2_WPORT PORTF
#define AIO2_PWM NULL
#define AIO2_DDR DDRF
+#define AIO2_ADC 2
#define AIO3_PIN PINF3
#define AIO3_RPORT PINF
#define AIO3_WPORT PORTF
#define AIO3_PWM NULL
#define AIO3_DDR DDRF
+#define AIO3_ADC 3
#define AIO4_PIN PINF4
#define AIO4_RPORT PINF
#define AIO4_WPORT PORTF
#define AIO4_PWM NULL
#define AIO4_DDR DDRF
+#define AIO4_ADC 4
#define AIO5_PIN PINF5
#define AIO5_RPORT PINF
#define AIO5_WPORT PORTF
#define AIO5_PWM NULL
#define AIO5_DDR DDRF
+#define AIO5_ADC 5
#define AIO6_PIN PINF6
#define AIO6_RPORT PINF
#define AIO6_WPORT PORTF
#define AIO6_PWM NULL
#define AIO6_DDR DDRF
+#define AIO6_ADC 6
#define AIO7_PIN PINF7
#define AIO7_RPORT PINF
#define AIO7_WPORT PORTF
#define AIO7_PWM NULL
#define AIO7_DDR DDRF
+#define AIO7_ADC 7
#define DIO40_PIN PINF0
#define DIO40_RPORT PINF
View
4 config.default.h
@@ -280,8 +280,8 @@
#endif
// name type pin additional
-DEFINE_TEMP_SENSOR(extruder, TT_THERMISTOR, 0, THERMISTOR_EXTRUDER)
-DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, 1, THERMISTOR_EXTRUDER)
+DEFINE_TEMP_SENSOR(extruder, TT_THERMISTOR, AIO0, THERMISTOR_EXTRUDER)
+DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO1, THERMISTOR_EXTRUDER)
// "noheater" is a special name for a sensor which doesn't have a heater.
// Use "M105 P#" to read it, where # is a zero-based index into this list.
// DEFINE_TEMP_SENSOR(noheater, TT_THERMISTOR, 1, 0)
View
2 config.gen6.h
@@ -280,7 +280,7 @@
#endif
// name type pin additional
-DEFINE_TEMP_SENSOR(extruder, TT_THERMISTOR, PINA5, THERMISTOR_EXTRUDER)
+DEFINE_TEMP_SENSOR(extruder, TT_THERMISTOR, AIO5, THERMISTOR_EXTRUDER)
View
4 config.gen7-v1.1-v1.3.h
@@ -288,8 +288,8 @@
#endif
// name type pin additional
-DEFINE_TEMP_SENSOR(extruder, TT_THERMISTOR, PINA1, THERMISTOR_EXTRUDER)
-DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, PINA2, THERMISTOR_BED)
+DEFINE_TEMP_SENSOR(extruder, TT_THERMISTOR, AIO1, THERMISTOR_EXTRUDER)
+DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO2, THERMISTOR_BED)
View
4 config.gen7-v1.4.h
@@ -288,8 +288,8 @@
#endif
// name type pin additional
-DEFINE_TEMP_SENSOR(extruder, TT_THERMISTOR, PINA1, THERMISTOR_EXTRUDER)
-DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, PINA0, THERMISTOR_BED)
+DEFINE_TEMP_SENSOR(extruder, TT_THERMISTOR, AIO1, THERMISTOR_EXTRUDER)
+DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO0, THERMISTOR_BED)
View
4 config.ramps-v1.2.h
@@ -283,8 +283,8 @@ temperature is "achieved" for purposes of M109 and friends when actual temperatu
#endif
// name type pin additional
-DEFINE_TEMP_SENSOR(extruder, TT_THERMISTOR, AIO2_PIN, THERMISTOR_EXTRUDER)
-DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO1_PIN, THERMISTOR_EXTRUDER)
+DEFINE_TEMP_SENSOR(extruder, TT_THERMISTOR, AIO2, THERMISTOR_EXTRUDER)
+DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO1, THERMISTOR_EXTRUDER)
View
4 config.ramps-v1.3.h
@@ -287,8 +287,8 @@ temperature is "achieved" for purposes of M109 and friends when actual temperatu
#endif
// name type pin additional
-DEFINE_TEMP_SENSOR(extruder, TT_THERMISTOR, AIO13_PIN, THERMISTOR_EXTRUDER)
-// DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO14_PIN, THERMISTOR_EXTRUDER)
+DEFINE_TEMP_SENSOR(extruder, TT_THERMISTOR, AIO13, THERMISTOR_EXTRUDER)
+// DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO14, THERMISTOR_EXTRUDER)
View
4 config.sanguinololu-v1.1.h
@@ -284,8 +284,8 @@
#endif
// name type pin additional
-DEFINE_TEMP_SENSOR(extruder, TT_THERMISTOR, AIO7_PIN, THERMISTOR_EXTRUDER)
-DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO6_PIN, THERMISTOR_EXTRUDER)
+DEFINE_TEMP_SENSOR(extruder, TT_THERMISTOR, AIO7, THERMISTOR_EXTRUDER)
+DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO6, THERMISTOR_EXTRUDER)
View
4 config.sanguinololu-v1.2.h
@@ -284,8 +284,8 @@
#endif
// name type pin additional
-DEFINE_TEMP_SENSOR(extruder, TT_THERMISTOR, AIO7_PIN, THERMISTOR_EXTRUDER)
-DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO6_PIN, THERMISTOR_BED)
+DEFINE_TEMP_SENSOR(extruder, TT_THERMISTOR, AIO7, THERMISTOR_EXTRUDER)
+DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO6, THERMISTOR_BED)
View
2 temp.c
@@ -52,7 +52,7 @@ typedef struct {
#undef DEFINE_TEMP_SENSOR
/// help build list of sensors from entries in config.h
-#define DEFINE_TEMP_SENSOR(name, type, pin, additional) { (type), (pin), (HEATER_ ## name), (additional) },
+#define DEFINE_TEMP_SENSOR(name, type, pin, additional) { (type), (pin ## _ADC), (HEATER_ ## name), (additional) },
static const temp_sensor_definition_t temp_sensors[NUM_TEMP_SENSORS] =
{
#include "config.h"

0 comments on commit bfe5e6f

Please sign in to comment.
Something went wrong with that request. Please try again.