forked from AllYarnsAreBeautiful/ayab-firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.h
142 lines (113 loc) · 3.08 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
// settings.h
/*
This file is part of AYAB.
AYAB is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
AYAB is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with AYAB. If not, see <http://www.gnu.org/licenses/>.
Copyright 2013-2015 Christian Obersteiner, Andreas Müller
http://ayab-knitting.com
*/
#ifndef SETTINGS_H_
#define SETTINGS_H_
/*
* USERSETTINGS
*/
// #define DBG_NOMACHINE // Turn on to use DBG_BTN as EOL Trigger
#ifdef KH910
#warning USING MACHINETYPE KH910
#else
#ifdef KH930
#warning USING MACHINETYPE KH930
#else
#error KH910 or KH930 has the be defined as preprocessor variable!
#endif
#endif
// Should be calibrated to each device
// These values are for the K carriage
#ifdef KH910
#define FILTER_L_MIN 200 // below: L Carriage
#define FILTER_L_MAX 600 // above: K Carriage
#define FILTER_R_MIN 200
#define FILTER_R_MAX 1023
#endif
#ifdef KH930
#define FILTER_L_MIN 200 // below: L Carriage
#define FILTER_L_MAX 600 // above: K Carriage
#define FILTER_R_MIN 0
#define FILTER_R_MAX 600
#endif
/*
* END OF USERSETTINGS
*/
// DO NOT TOUCH
#define FW_VERSION_MAJ 0
#define FW_VERSION_MIN 95
#define API_VERSION 5 // for message description, see below
#define SERIAL_BAUDRATE 115200
#define BEEPDELAY 50 // ms
// Pin Assignments
#define EOL_PIN_R 0 // Analog
#define EOL_PIN_L 1 // Analog
#define ENC_PIN_A 2
#define ENC_PIN_B 3
#define ENC_PIN_C 4
#define LED_PIN_A 5 // green LED
#define LED_PIN_B 6 // yellow LED
#define PIEZO_PIN 9
#define DBG_BTN_PIN 7 // DEBUG BUTTON
#define LED_COLOR_PIN_A 10
#define LED_COLOR_PIN_B 11
#define LED_COLOR_PIN_C 12
#define LED_COLOR_PIN_D 13
// Machine constants
#define NUM_NEEDLES 200
#define END_LEFT 0
#define END_RIGHT 255
#define END_OF_LINE_OFFSET_L 12
#define END_OF_LINE_OFFSET_R 12
// Typedefs
#define uint16 unsigned int
typedef enum AYAB_API {
reqStart_msgid = 0x01,
cnfStart_msgid = 0xC1,
reqLine_msgid = 0x82,
cnfLine_msgid = 0x42,
reqInfo_msgid = 0x03,
cnfInfo_msgid = 0xC3,
reqTest_msgid = 0x04,
cnfTest_msgid = 0xC4,
indState_msgid = 0x84,
debug_msgid = 0xFF
} AYAB_API_t;
typedef enum Direction {
NoDirection = 0,
Left = 1,
Right = 2
} Direction_t;
typedef enum Carriage {
NoCarriage = 0,
K = 1,
L = 2,
G = 3
} Carriage_t;
typedef enum Beltshift {
Unknown = 0,
Regular = 1,
Shifted = 2,
Lace_Regular = 3,
Lace_Shifted = 4
} Beltshift_t;
typedef enum OpState {
s_init = 0,
s_ready = 1,
s_operate = 2,
s_test = 3
} OpState_t;
#endif // SETTINGS_H_