/
ports.h
98 lines (83 loc) · 2.33 KB
/
ports.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
/*
* ports.h Ports control
*/
#ifndef ports_h
#define ports_h
uint8_t ports_manage(char *line); // Manage protocol for ports usages
uint8_t waintForPinSync(char *line); // Implements waint for pin Sync
uint8_t waintForPinAsync(char *line); // Implements waint for pin Async
void alarmsInit(); // Initialize alarms
void alarmsDisable(); // Initialize alarms
void alarmDisable(char port,uint8_t bit); // Disable alarm
void alarmEnable(char port,uint8_t bit); // Enable alarm
void movementRestore(); // Restore movement
void stepperDisable(char *line); // Disable stepepr motor
void stepperEnable(char *line); // Enable stepepr motor
#endif
// Port interruptions
#define POWER_SOURCE_FAULT_BIT 5
#define ALARM_TOURCH_SIGNAL_BIT 6
#define ALARM_OUT_SERVO_X1_BIT 7
#define ALARM_OUT_SERVO_X2_BIT 5
#define ALARM_OUT_SERVO_Y_BIT 6
#define PORTB_PCINTERRUPT_STATE_MASK 0b10111000
bool alarmTriggered;
char activeAlarmPort;
uint8_t activeAlarmBit;
// Maping work pins
#define STEP_X 54
#define STEP_Y 60
#define STEP_Z 46
#define STEP_A 26
#define DIR_X 55
#define DIR_Y 61
#define DIR_Z 48
#define DIR_A 28
#define ENABLE 40
#define RELAY_1 38
#define RELAY_2 39
#define OUT_1 41
#define OUT_2 42
#define OUT_3 43
#define OUT_4 44
#define OUT_5 45
#define OUT_6 47
#define OUT_7 49
#define MAX_X 3
#define MAX_Y 15
#define MAX_Z 19
#define MIN_X 2
#define MIN_Y 14
#define MIN_Z 18
#define IN_1 30
#define IN_2 29
#define IN_3 27
#define IN_4 25
#define IN_5 24
#define IN_6 32
#define IN_7 33
#define IN_8 34
#define IN_9 35
#define IN_10 36
#define IN_11 37
#define PROBE 31
#define PAUSE 23
#define STOP 22
#define PLAY 13
#define JOP_VEL_1 10
#define JOP_VEL_2 11
#define JOP_VEL_3 12
#define JOP_XA 4
#define JOP_XB 5
#define JOP_YA 6
#define JOP_YB 7
#define JOP_ZA 8
#define JOP_ZB 9
#define ANALOG_1 94
#define ANALOG_2 95
#define ANALOG_3 92
#define ANALOG_4 93
#define MISO 50
#define MOSI 51
#define SCK 52
#define CS 53