cewkomator/firmware/src/constants.h

49 lines
1016 B
C

#pragma once
// --- debug config
#define DEBUG_I2C 0
#define DEBUG_PRINT_EVENTS 1
#define DEBUG_DISABLE_SPINDLE 1
// --- pinout
#define LED_PIN LED_BUILTIN
#define BUZZER_PIN 11
// rotary encoder
#define CLK_PIN 7
#define DT_PIN 6
#define SW_PIN 5
// --- 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 A0
#define STEPPER_STEP A1
#define STEPPER_STEP_PORT PORTC
#define STEPPER_STEP_BIT 1 << 1
#define STEPPER_DIR A2
#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