53 lines
1.1 KiB
C
53 lines
1.1 KiB
C
#pragma once
|
|
|
|
// --- debug config
|
|
|
|
#define DEBUG_I2C 0
|
|
#define DEBUG_PRINT_EVENTS 1
|
|
#define DEBUG_DISABLE_SPINDLE 0
|
|
|
|
// --- pinout
|
|
|
|
#define LED_PIN LED_BUILTIN
|
|
|
|
#define BUZZER_PIN 3
|
|
|
|
// rotary encoder
|
|
#define CLK_PIN 5
|
|
#define DT_PIN 4
|
|
#define SW_PIN 2
|
|
|
|
// --- LCD config
|
|
|
|
#define LCD_I2C_ADDR 0x27
|
|
#define LCD_COLS 16
|
|
#define LCD_ROWS 2
|
|
|
|
// --- Keyboard config
|
|
|
|
#define KBD_I2C_ADDR 0x21
|
|
|
|
// Used by keyboard and encoder switch
|
|
#define DEBOUNCE_MS 5
|
|
|
|
// --- Z axis motor
|
|
|
|
#define STEPPER_ENABLE 7
|
|
#define STEPPER_STEP A2
|
|
#define STEPPER_STEP_PORT PORTC
|
|
#define STEPPER_STEP_BIT 1 << 2
|
|
#define STEPPER_DIR A3
|
|
|
|
#define STEPPER_MS1 6
|
|
#define STEPPER_MS2 A0
|
|
#define STEPPER_MS3 A1
|
|
|
|
#define STEPPER_STEPS_PER_REV 200
|
|
#define STEPPER_MICROSTEPS 2
|
|
#define STEPPER_MM_PER_REV 0.5 // TODO: measure this
|
|
|
|
#define MICROS_PER_TICK 16 // 16MHz / 256 = 62.5kHz = 16us per tick
|
|
#define STEPPER_MIN_CADANCE 50 // speed measured in timer ticks per step (less is faster)
|
|
#define STEPPER_MAX_CADANCE 12
|
|
#define STEPPER_CADENCE_ACCEL_MS 3 // acceleration measured in ms per cadence increment/decrement
|