/* Notice to developers: this file is intentionally included twice. */ /* CPU clock rate */ #ifndef F_CPU #define F_CPU 16000000L #endif /* other fallbacks for the Arduino IDE */ #define EXTRUDER #define GEN3 #include "arduino.h" // controller index- bus is multidrop after all #define THIS_CONTROLLER_NUM 0 //RS485 Interface pins #define RX_ENABLE_PIN DIO4 #define TX_ENABLE_PIN AIO2 // Control pins for the A3949 chips #define H1D DIO7 #define H1E DIO5 #define H2D DIO8 #define H2E DIO6 // PWM versions of the enable_pins #define H1E_PWM OCR0B #define H2E_PWM OCR0A //Step/Dir Pins from motherboard to extruder //IMPORTANT: Assumes that the step pin is on PCIE0 #define E_STEP_PIN DIO10 #define E_DIR_PIN DIO9 //Trimpot is on AIO0, pin 23 #define TRIM_POT AIO0 #define TRIM_POT_CHANNEL 0 //Read analog voltage from thermistor #define TEMP_PIN AIO3 #define TEMP_PIN_CHANNEL 3 //Read analog voltage from thermistor #define TEMP_BED_PIN AIO6 #define TEMP_BED_PIN_CHANNEL 6 #define REFERENCE REFERENCE_AVCC #define ANALOG_MASK (MASK(TRIM_POT_CHANNEL) | MASK(TEMP_PIN_CHANNEL) | MASK(TEMP_BED_PIN_CHANNEL)) #define TEMP_THERMISTOR #define HEATER_PIN DIO11 #define BED_PIN AIO1 #define FAN_PIN DIO12 // extruder settings #define TEMP_HYSTERESIS 5 #define TEMP_RESIDENCY_TIME 60 #ifdef DEFINE_TEMP_SENSOR DEFINE_TEMP_SENSOR(extruder, TT_THERMISTOR, TEMP_PIN_CHANNEL, THERMISTOR_EXTRUDER) DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, TEMP_BED_PIN_CHANNEL, THERMISTOR_EXTRUDER) #endif #ifdef DEFINE_HEATER DEFINE_HEATER(extruder, DIO11) DEFINE_HEATER(bed, AIO1) #endif // list of PWM-able pins and corresponding timers // timer1 is used for step timing so don't use OC1A/OC1B (DIO9/DIO10) // OC0A DIO6 // OC0B DIO5 // OC1A DIO9 // OC1B DIO10 // OC2A DIO11 // OC2B DIO3 #define TH_COUNT 8 #define PID_SCALE 1024L /* Motors */ #define enable_motors() do { TCCR0A |= MASK(COM0A1) | MASK(COM0B1); } while (0) #define disable_motors() do { TCCR0A &= ~MASK(COM0A1) & ~MASK(COM0B1); } while (0)