master_clock/include/globals.h
2026-02-22 17:28:34 -05:00

46 lines
1.4 KiB
C++

#ifndef GLOBALS_H
#define GLOBALS_H
#include "pico/stdlib.h"
#include <cstdint>
#include <array>
#include <string>
static constexpr uint8_t OUT_1_PIN = 0;
static constexpr uint8_t OUT_2_PIN = 2;
static constexpr uint8_t OUT_3_PIN = 4;
static constexpr uint8_t OUT_4_PIN = 6;
static constexpr uint8_t OUT_5_PIN = 8;
static constexpr uint8_t OUT_6_PIN = 10;
static constexpr uint8_t OUT_7_PIN = 12;
static constexpr uint8_t OUT_8_PIN = 14;
static constexpr uint8_t SCREEN_SCL_PIN = 18;
static constexpr uint8_t SCREEN_SDA_PIN = 19;
static constexpr uint8_t ENCODER_CLK_PIN = 20;
static constexpr uint8_t ENCODER_DT_PIN = 21;
static constexpr uint8_t ENCODER_SW_PIN = 22;
extern volatile uint8_t BPM;
static constexpr uint32_t MINUTE_US = 60000000;
static constexpr uint8_t PPQN = 96;
static uint32_t MASTER_TICK = 0;
// Modifiers in UI order
static std::array<uint8_t, 10> MODIFIERS = {8, 4, 2, 0, 1, 2, 3, 4, 8, 16};
// Modifier type; 0 = multiplicaton, 1 = division; matched with MODIFIERS
static std::array<uint8_t, 10> MOD_TYPES = {0, 0, 0, 0, 1, 1, 1, 1, 1, 1};
// Modifier string
static std::array<std::string, 10> MODIFIER_STRINGS = {"x8", "x4", "x2", "x0", "/1", "/2", "/3", "/4", "/8", "/16"};
inline uint32_t millis() {
return to_ms_since_boot(get_absolute_time());
}
inline uint32_t micros() {
return to_us_since_boot(get_absolute_time());
}
#endif // GLOBALS_H