Move configuration to config.h.dist
This commit is contained in:
parent
b76f59193f
commit
e78381c56d
3
analog.c
3
analog.c
|
|
@ -2,9 +2,6 @@
|
|||
|
||||
#include <avr/interrupt.h>
|
||||
|
||||
#include "arduino.h"
|
||||
#include "machine.h"
|
||||
|
||||
#ifndef ANALOG_MASK
|
||||
#warning define ANALOG_MASK as a bitmask of all the analog channels you wish to use
|
||||
#error ANALOG_MASK not defined
|
||||
|
|
|
|||
4
analog.h
4
analog.h
|
|
@ -7,12 +7,12 @@
|
|||
#define REFERENCE_AVCC 64
|
||||
#define REFERENCE_1V1 192
|
||||
|
||||
#include "machine.h"
|
||||
#include "config.h"
|
||||
|
||||
#ifndef REFERENCE
|
||||
#warning define REFERENCE as one of
|
||||
#warning REFERENCE_AREF, REFERENCE_AVCC or REFERENCE_1V1
|
||||
#warning in your machine.h
|
||||
#warning in your config.h
|
||||
#error REFERENCE undefined
|
||||
#endif
|
||||
|
||||
|
|
|
|||
3
clock.c
3
clock.c
|
|
@ -9,8 +9,7 @@
|
|||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
|
||||
#include "arduino.h"
|
||||
#include "pinout.h"
|
||||
#include "config.h"
|
||||
|
||||
// global clock
|
||||
#ifdef GLOBAL_CLOCK
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _MACHINE_H
|
||||
#define _MACHINE_H
|
||||
#ifndef _CONFIG_H
|
||||
#define _CONFIG_H
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// values reflecting the gearing of your machine
|
||||
|
|
@ -98,10 +98,71 @@ firmware build options
|
|||
ANALOG_MASK - which analog inputs we will be using, bitmask. eg; #define ANALOG_MASK MASK(AIO0_PIN) | MASK(3) for AIN0 and AIN3
|
||||
*/
|
||||
#define REFERENCE REFERENCE_AREF
|
||||
|
||||
#ifndef ANALOG_MASK
|
||||
#define ANALOG_MASK 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
Machine Pin Definitions
|
||||
*/
|
||||
|
||||
#include "arduino.h"
|
||||
|
||||
/*
|
||||
RESERVED pins
|
||||
we NEED these for communication
|
||||
*/
|
||||
|
||||
#define RESERVED_RXD DIO0
|
||||
#define RESERVED_TXD DIO1
|
||||
|
||||
/*
|
||||
these pins are used for the MAX6675
|
||||
*/
|
||||
#define RESERVED_SCK DIO13
|
||||
#define RESERVED_MISO DIO12
|
||||
#define RESERVED_MOSI DIO11
|
||||
#define RESERVED_SS DIO10
|
||||
|
||||
/*
|
||||
user defined pins
|
||||
adjust to suit your electronics,
|
||||
or adjust your electronics to suit this
|
||||
*/
|
||||
|
||||
#define X_STEP_PIN AIO0
|
||||
#define X_DIR_PIN AIO1
|
||||
#define X_MIN_PIN AIO2
|
||||
|
||||
#define Y_STEP_PIN AIO3
|
||||
#define Y_DIR_PIN AIO4
|
||||
#define Y_MIN_PIN AIO5
|
||||
|
||||
#define Z_STEP_PIN DIO2
|
||||
#define Z_DIR_PIN DIO3
|
||||
#define Z_MIN_PIN DIO4
|
||||
|
||||
#define E_STEP_PIN DIO7
|
||||
#define E_DIR_PIN DIO8
|
||||
|
||||
#define STEPPER_ENABLE_PIN DIO9
|
||||
|
||||
// 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 HEATER_PIN DIO6
|
||||
#define HEATER_PWM OCR0A
|
||||
|
||||
#define FAN_PIN DIO5
|
||||
#define FAN_PWM OCR0B
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// you shouldn't need to edit anything below this line
|
||||
|
||||
|
|
@ -117,4 +178,107 @@ firmware build options
|
|||
#define UM_PER_STEP_Z ((uint32_t) ((1000.0 / STEPS_PER_MM_Z) + 0.5))
|
||||
#define UM_PER_STEP_E ((uint32_t) ((1000.0 / STEPS_PER_MM_E) + 0.5))
|
||||
|
||||
#endif /* _MACHINE_H */
|
||||
|
||||
/*
|
||||
X Stepper
|
||||
*/
|
||||
|
||||
#define _x_step(st) WRITE(X_STEP_PIN, st)
|
||||
#define x_step() _x_step(1);
|
||||
#define x_direction(dir) WRITE(X_DIR_PIN, dir)
|
||||
#define x_min() READ(X_MIN_PIN)
|
||||
#ifdef X_MAX_PIN
|
||||
#define x_max() READ(X_MAX_PIN)
|
||||
#else
|
||||
#define x_max() (0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
Y Stepper
|
||||
*/
|
||||
|
||||
#define _y_step(st) WRITE(Y_STEP_PIN, st)
|
||||
#define y_step() _y_step(1);
|
||||
#define y_direction(dir) WRITE(Y_DIR_PIN, dir)
|
||||
#define y_min() READ(Y_MIN_PIN)
|
||||
#ifdef Y_MAX_PIN
|
||||
#define y_max() READ(Y_MAX_PIN)
|
||||
#else
|
||||
#define y_max() (0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
Z Stepper
|
||||
*/
|
||||
|
||||
#define _z_step(st) WRITE(Z_STEP_PIN, st)
|
||||
#define z_step() _z_step(1);
|
||||
#define z_direction(dir) WRITE(Z_DIR_PIN, dir)
|
||||
#define z_min() READ(Z_MIN_PIN)
|
||||
#ifdef Z_MAX_PIN
|
||||
#define z_max() READ(Z_MAX_PIN)
|
||||
#else
|
||||
#define z_max() (0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
Extruder
|
||||
*/
|
||||
|
||||
#define _e_step(st) WRITE(E_STEP_PIN, st)
|
||||
#define e_step() _e_step(1);
|
||||
#define e_direction(dir) WRITE(E_DIR_PIN, dir)
|
||||
|
||||
/*
|
||||
Heater
|
||||
*/
|
||||
|
||||
#ifdef HEATER_PWM
|
||||
#define enable_heater() do { TCCR0A |= MASK(COM0A1); } while (0)
|
||||
#define disable_heater() do { TCCR0A &= ~MASK(COM0A1); } while (0)
|
||||
#else
|
||||
#define enable_heater() WRITE(HEATER_PIN, 1)
|
||||
#define disable_heater() WRITE(HEATER_PIN, 0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
fan
|
||||
*/
|
||||
|
||||
#ifdef FAN_PIN
|
||||
#ifdef FAN_PWM
|
||||
#define enable_fan() do { TCCR0A |= MASK(COM0B1); } while (0)
|
||||
#define disable_fan() do { TCCR0A &= ~MASK(COM0B1); } while (0)
|
||||
#else
|
||||
#define enable_fan() WRITE(FAN_PIN, 1)
|
||||
#define disable_fan() WRITE(FAN_PIN, 0);
|
||||
#endif
|
||||
#else
|
||||
#define enable_fan() if (0) {}
|
||||
#define disable_fan() if (0) {}
|
||||
#endif
|
||||
|
||||
/*
|
||||
Stepper Enable (ATX PSU pwr_good signal?)
|
||||
*/
|
||||
|
||||
#ifdef STEPPER_ENABLE_PIN
|
||||
// for connection to stepper driver ENABLE pins (negative asserted)
|
||||
// #define power_on() WRITE(STEPPER_ENABLE_PIN, 0)
|
||||
// #define power_off() WRITE(STEPPER_ENABLE_PIN, 1)
|
||||
// for connection to ATX PSU PWR_ON signal
|
||||
#define power_on() do { WRITE(STEPPER_ENABLE_PIN, 0); SET_OUTPUT(STEPPER_ENABLE_PIN); } while (0)
|
||||
#define power_off() SET_INPUT(STEPPER_ENABLE_PIN)
|
||||
#else
|
||||
#define power_on() if (0) {}
|
||||
#define power_off() if (0) {}
|
||||
#endif
|
||||
|
||||
/*
|
||||
End Step - All Steppers
|
||||
(so we don't have to delay in interrupt context)
|
||||
*/
|
||||
|
||||
#define unstep() do { _x_step(0); _y_step(0); _z_step(0); _e_step(0); } while (0)
|
||||
|
||||
#endif /* _CONFIG_H */
|
||||
3
dda.h
3
dda.h
|
|
@ -3,8 +3,7 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "pinout.h"
|
||||
#include "machine.h"
|
||||
#include "config.h"
|
||||
|
||||
/*
|
||||
enums
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#include <string.h>
|
||||
#include <avr/interrupt.h>
|
||||
|
||||
#include "machine.h" // for XONXOFF
|
||||
#include "config.h" // for XONXOFF
|
||||
#include "timer.h"
|
||||
#include "serial.h"
|
||||
#include "sermsg.h"
|
||||
|
|
|
|||
2
gcode.c
2
gcode.c
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#include "machine.h"
|
||||
#include "config.h"
|
||||
#include "serial.h"
|
||||
#include "sermsg.h"
|
||||
#include "temp.h"
|
||||
|
|
|
|||
3
heater.c
3
heater.c
|
|
@ -3,8 +3,7 @@
|
|||
#include <avr/eeprom.h>
|
||||
|
||||
#include "sersendf.h"
|
||||
#include "machine.h"
|
||||
#include "pinout.h"
|
||||
#include "config.h"
|
||||
#include "debug.h"
|
||||
#include "arduino.h"
|
||||
|
||||
|
|
|
|||
4
mendel.c
4
mendel.c
|
|
@ -2,7 +2,7 @@
|
|||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
|
||||
#include "machine.h"
|
||||
#include "config.h"
|
||||
|
||||
#include "serial.h"
|
||||
#include "dda_queue.h"
|
||||
|
|
@ -98,7 +98,7 @@ void init(void) {
|
|||
// set up default feedrate
|
||||
current_position.F = startpoint.F = next_target.target.F = SEARCH_FEEDRATE_Z;
|
||||
|
||||
// start up analog read interrupt loop, if anything uses analog as determined by ANALOG_MASK in your machine.h
|
||||
// start up analog read interrupt loop, if anything uses analog as determined by ANALOG_MASK in your config.h
|
||||
analog_init();
|
||||
|
||||
// enable interrupts
|
||||
|
|
|
|||
162
pinout.h
162
pinout.h
|
|
@ -1,162 +0,0 @@
|
|||
#ifndef _PINOUT_H
|
||||
#define _PINOUT_H
|
||||
|
||||
#include "arduino.h"
|
||||
|
||||
/*
|
||||
Machine Pin Definitions
|
||||
*/
|
||||
|
||||
/*
|
||||
RESERVED pins
|
||||
we NEED these for communication
|
||||
*/
|
||||
|
||||
#define RESERVED_RXD DIO0
|
||||
#define RESERVED_TXD DIO1
|
||||
#define RESERVED_SCK DIO13
|
||||
#define RESERVED_MISO DIO12
|
||||
#define RESERVED_MOSI DIO11
|
||||
#define RESERVED_SS DIO10
|
||||
|
||||
/*
|
||||
user defined pins
|
||||
adjust to suit your electronics,
|
||||
or adjust your electronics to suit this
|
||||
*/
|
||||
|
||||
#define X_STEP_PIN AIO0
|
||||
#define X_DIR_PIN AIO1
|
||||
#define X_MIN_PIN AIO2
|
||||
|
||||
#define Y_STEP_PIN AIO3
|
||||
#define Y_DIR_PIN AIO4
|
||||
#define Y_MIN_PIN AIO5
|
||||
|
||||
#define Z_STEP_PIN DIO2
|
||||
#define Z_DIR_PIN DIO3
|
||||
#define Z_MIN_PIN DIO4
|
||||
|
||||
#define E_STEP_PIN DIO7
|
||||
#define E_DIR_PIN DIO8
|
||||
|
||||
#define STEPPER_ENABLE_PIN DIO9
|
||||
|
||||
// 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 HEATER_PIN DIO6
|
||||
#define HEATER_PWM OCR0A
|
||||
|
||||
#define FAN_PIN DIO5
|
||||
#define FAN_PWM OCR0B
|
||||
|
||||
/*
|
||||
X Stepper
|
||||
*/
|
||||
|
||||
#define _x_step(st) WRITE(X_STEP_PIN, st)
|
||||
#define x_step() _x_step(1);
|
||||
#define x_direction(dir) WRITE(X_DIR_PIN, dir)
|
||||
#define x_min() READ(X_MIN_PIN)
|
||||
#ifdef X_MAX_PIN
|
||||
#define x_max() READ(X_MAX_PIN)
|
||||
#else
|
||||
#define x_max() (0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
Y Stepper
|
||||
*/
|
||||
|
||||
#define _y_step(st) WRITE(Y_STEP_PIN, st)
|
||||
#define y_step() _y_step(1);
|
||||
#define y_direction(dir) WRITE(Y_DIR_PIN, dir)
|
||||
#define y_min() READ(Y_MIN_PIN)
|
||||
#ifdef Y_MAX_PIN
|
||||
#define y_max() READ(Y_MAX_PIN)
|
||||
#else
|
||||
#define y_max() (0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
Z Stepper
|
||||
*/
|
||||
|
||||
#define _z_step(st) WRITE(Z_STEP_PIN, st)
|
||||
#define z_step() _z_step(1);
|
||||
#define z_direction(dir) WRITE(Z_DIR_PIN, dir)
|
||||
#define z_min() READ(Z_MIN_PIN)
|
||||
#ifdef Z_MAX_PIN
|
||||
#define z_max() READ(Z_MAX_PIN)
|
||||
#else
|
||||
#define z_max() (0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
Extruder
|
||||
*/
|
||||
|
||||
#define _e_step(st) WRITE(E_STEP_PIN, st)
|
||||
#define e_step() _e_step(1);
|
||||
#define e_direction(dir) WRITE(E_DIR_PIN, dir)
|
||||
|
||||
/*
|
||||
Heater
|
||||
*/
|
||||
|
||||
#ifdef HEATER_PWM
|
||||
#define enable_heater() do { TCCR0A |= MASK(COM0A1); } while (0)
|
||||
#define disable_heater() do { TCCR0A &= ~MASK(COM0A1); } while (0)
|
||||
#else
|
||||
#define enable_heater() WRITE(HEATER_PIN, 1)
|
||||
#define disable_heater() WRITE(HEATER_PIN, 0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
fan
|
||||
*/
|
||||
|
||||
#ifdef FAN_PIN
|
||||
#ifdef FAN_PWM
|
||||
#define enable_fan() do { TCCR0A |= MASK(COM0B1); } while (0)
|
||||
#define disable_fan() do { TCCR0A &= ~MASK(COM0B1); } while (0)
|
||||
#else
|
||||
#define enable_fan() WRITE(FAN_PIN, 1)
|
||||
#define disable_fan() WRITE(FAN_PIN, 0);
|
||||
#endif
|
||||
#else
|
||||
#define enable_fan() if (0) {}
|
||||
#define disable_fan() if (0) {}
|
||||
#endif
|
||||
|
||||
/*
|
||||
Stepper Enable (ATX PSU pwr_good signal?)
|
||||
*/
|
||||
|
||||
#ifdef STEPPER_ENABLE_PIN
|
||||
// for connection to stepper driver ENABLE pins (negative asserted)
|
||||
// #define power_on() WRITE(STEPPER_ENABLE_PIN, 0)
|
||||
// #define power_off() WRITE(STEPPER_ENABLE_PIN, 1)
|
||||
// for connection to ATX PSU PWR_ON signal
|
||||
#define power_on() do { WRITE(STEPPER_ENABLE_PIN, 0); SET_OUTPUT(STEPPER_ENABLE_PIN); } while (0)
|
||||
#define power_off() SET_INPUT(STEPPER_ENABLE_PIN)
|
||||
#else
|
||||
#define power_on() if (0) {}
|
||||
#define power_off() if (0) {}
|
||||
#endif
|
||||
|
||||
/*
|
||||
End Step - All Steppers
|
||||
(so we don't have to delay in interrupt context)
|
||||
*/
|
||||
|
||||
#define unstep() do { _x_step(0); _y_step(0); _z_step(0); _e_step(0); } while (0)
|
||||
|
||||
#endif /* _PINOUT_H */
|
||||
2
serial.h
2
serial.h
|
|
@ -5,7 +5,7 @@
|
|||
#include <avr/io.h>
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
#include "machine.h" // for XONXOFF
|
||||
#include "config.h" // for XONXOFF
|
||||
|
||||
// initialise serial subsystem
|
||||
void serial_init(void);
|
||||
|
|
|
|||
2
temp.c
2
temp.c
|
|
@ -20,8 +20,6 @@
|
|||
|
||||
#include <avr/eeprom.h>
|
||||
|
||||
#include "machine.h"
|
||||
#include "pinout.h"
|
||||
#include "clock.h"
|
||||
#include "serial.h"
|
||||
#include "sermsg.h"
|
||||
|
|
|
|||
2
temp.h
2
temp.h
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "machine.h"
|
||||
#include "config.h"
|
||||
|
||||
// RepRap host software isn't exactly tolerant on what it ready back.
|
||||
#define REPRAP_HOST_COMPATIBILITY
|
||||
|
|
|
|||
Loading…
Reference in New Issue