-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.h
102 lines (73 loc) · 2.93 KB
/
settings.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// Copyright (c) 2021 Mathema GmbH
// SPDX-License-Identifier: BSD-3-Clause
// Author: Günter Woigk (Kio!)
// Copyright (c) 2021 [email protected]
// BSD 2-clause license
#pragma once
#include "standard_types.h"
// our float type is float32:
using FLOAT = float;
// clocks:
constexpr uint32 MAIN_CLOCK = 125 * 1000000;
constexpr uint32 XY2_DATA_CLOCK = 100 * 1000;
// LEDs:
constexpr uint LED_PIN = 25; // on-board LED
constexpr uint LED_BEAT = 18; // xy2 heart beat
constexpr uint LED_CORE0_IDLE = 19; // idle indicator core 0
constexpr uint LED_CORE1_IDLE = 20; // idle indicator core 1
constexpr uint LED_ERROR = 21; // error happened
// XY2 data lines:
constexpr uint PIN_XY2_CLOCK = 8;
constexpr uint PIN_XY2_CLOCK_NEG = PIN_XY2_CLOCK + 1;
constexpr uint PIN_XY2_SYNC = PIN_XY2_CLOCK + 2;
constexpr uint PIN_XY2_SYNC_NEG = PIN_XY2_CLOCK + 3;
constexpr uint PIN_XY2_Y = 12;
constexpr uint PIN_XY2_Y_NEG = PIN_XY2_Y + 1;
constexpr uint PIN_XY2_X = 14;
constexpr uint PIN_XY2_X_NEG = PIN_XY2_X + 1;
constexpr uint PIN_XY2_SYNC_XY = 16; // 30 or 31 geht nicht
constexpr uint PIN_XY2_SYNC_XY_READBACK = 17; // externally connected to PIN_XY2_SYNC_XY for PWM input
constexpr uint PIN_XY2_LASER = 22; // laser on/off
// PIO settings:
#define PIO_XY2 pio0
// Scanner data:
constexpr FLOAT SCANNER_MAX_SWIVELS = 15000/120; // data sheet: 15m/s @ 12cm
constexpr int32 SCANNER_MIN = 0;
constexpr int32 SCANNER_MAX = 0xffff;
constexpr int32 SCANNER_WIDTH = 0x10000u;
constexpr FLOAT SCANNER_MAX_SPEED = SCANNER_MAX_SWIVELS * SCANNER_WIDTH / XY2_DATA_CLOCK;
// Laser settings
constexpr uint LASER_QUEUE_DELAY = 14; // delay for laser power values
constexpr uint LASER_ON_DELAY = 0; // how many steps before switching laser ON
constexpr uint LASER_OFF_DELAY = 0; // how many steps before switching laser OFF
constexpr uint LASER_MIDDLE_DELAY = 6; // how many steps to wait at poly line corners
constexpr uint LASER_JUMP_DELAY = 20; // after jump
#define XY2_IMPLEMENT_ANALOGUE_CLOCK_DEMO
#define XY2_IMPLEMENT_CHECKER_BOARD_DEMO
#define XY2_IMPLEMENT_LISSAJOUS_DEMO
// ADC settings
extern class AdcLoadSensor load_sensor;
#define ADC_PIN_CORE0_IDLE 26
#define ADC_PIN_CORE1_IDLE 27
#define ADC_CORE0_IDLE 0
#define ADC_CORE1_IDLE 1
#define ADC_TEMPERATURE 4
// OLED settings
extern class OledDisplay oled;
#define OLED_I2C_ADDR 0x3C
#define OLED_I2C_PIN_SDA 2
#define OLED_I2C_PIN_SCK 3
#define OLED_I2C_PORT i2c1
#define OLED_WIDTH 128
#define OLED_HEIGHT 64
#define OLED_EXTERNAL_VCC false
// RTC settings
#define RTC_I2C_ADDR 0x68
#define RTC_I2C_PIN_SDA 2
#define RTC_I2C_PIN_SCK 3
#define RTC_I2C_PORT i2c1
// AT24C32 Flash (on RTC module)
#define AT24C32_I2C_ADDR 0x57
#define AT24C32_I2C_PIN_SDA RTC_I2C_PIN_SDA
#define AT24C32_I2C_PIN_SCK RTC_I2C_PIN_SCK
#define AT24C32_I2C_PORT RTC_I2C_PORT