forked from art103/LasaurGrbl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sense_control.h
47 lines (36 loc) · 1.69 KB
/
sense_control.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
/*
sense_control.h - sensing and controlling inputs and outputs
Part of LasaurGrbl
Copyright (c) 2011 Stefan Hechenberger
LasaurGrbl 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.
LasaurGrbl 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.
*/
#ifndef sense_control_h
#define sense_control_h
#include <stdbool.h>
#include "config.h"
extern uint8_t sense_ignore;
void sense_init();
#define SENSE_X_LIMIT (GPIOPinRead(LIMIT_PORT, (1 << X_LIMIT_BIT)) != 0)
#define SENSE_Y_LIMIT (GPIOPinRead(LIMIT_PORT, (1 << Y_LIMIT_BIT)) != 0)
#define SENSE_Z_LIMIT (GPIOPinRead(LIMIT_PORT, (1 << Z_LIMIT_BIT)) == 0)
#define SENSE_E_LIMIT (GPIOPinRead(LIMIT_PORT, (1 << E_LIMIT_BIT)) != 0)
#define SENSE_DOOR_OPEN (GPIOPinRead(SENSE_PORT, (1 << DOOR_BIT)) != 0)
#define SENSE_CHILLER_OFF (temperature_read(0) > (20 * 16))
// invert door, remove power, add z_limits
//#define SENSE_LIMITS (SENSE_X_LIMIT || SENSE_Y_LIMIT || SENSE_Z_LIMIT || SENSE_E_LIMIT)
#define SENSE_LIMITS ((sense_ignore == 0) && (SENSE_X_LIMIT || SENSE_Y_LIMIT))
#define SENSE_SAFETY (/*SENSE_CHILLER_OFF ||*/ SENSE_DOOR_OPEN)
void control_init();
void control_laser_intensity(uint8_t intensity); //0-255 is 0-100%
void control_laser(uint8_t on_off, uint32_t pulse_length);
uint8_t control_get_intensity(void);
void control_air_assist(bool enable);
void control_aux1_assist(bool enable);
#endif