Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
grbl.h
00001 /* 00002 grbl.h - main Grbl include file 00003 Part of Grbl 00004 00005 Copyright (c) 2015-2016 Sungeun K. Jeon for Gnea Research LLC 00006 00007 Grbl is free software: you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation, either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 Grbl is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with Grbl. If not, see <http://www.gnu.org/licenses/>. 00019 */ 00020 00021 #ifndef grbl_h 00022 #define grbl_h 00023 00024 // Grbl versioning system 00025 #define GRBL_VERSION "1.1f" 00026 #define GRBL_VERSION_BUILD "20170324" 00027 00028 #if !defined(STM32F103C8) && !defined(WIN32) 00029 #define AVRTARGET 00030 #endif 00031 00032 // Define standard libraries used by Grbl. 00033 #ifdef AVRTARGET 00034 #include <avr/io.h> 00035 #include <avr/pgmspace.h> 00036 #include <avr/interrupt.h> 00037 #include <avr/wdt.h> 00038 #include <util/delay.h> 00039 #include <inttypes.h> 00040 #include <stdbool.h> 00041 #define PORTPINDEF uint8_t 00042 #endif 00043 #include <math.h> 00044 #ifdef WIN32 00045 #include <Windows.h> 00046 typedef signed char int8_t; 00047 typedef signed short int16_t; 00048 typedef signed int int32_t; 00049 typedef unsigned char uint8_t; 00050 typedef unsigned short uint16_t; 00051 typedef unsigned int uint32_t; 00052 typedef signed long long int64_t; 00053 typedef unsigned long long uint64_t; 00054 typedef int bool; 00055 #define false 0 00056 #define true 1 00057 #define truncf(x) (int32_t)x 00058 #define PSTR(x) x 00059 #define pgm_read_byte_near(x) *(x) 00060 #define _delay_ms(x) Sleep(x) 00061 #define M_PI 3.1415926f 00062 #define LOG(x,y) 00063 #define PORTPINDEF uint8_t 00064 #define printPgmString printString 00065 //#define NOEEPROMSUPPORT 00066 #endif 00067 #ifdef STM32F103C8 00068 #include "stm32f10x.h" 00069 #include "stm32f10x_gpio.h" 00070 #include "stm32f10x_exti.h" 00071 #include "stm32f10x_tim.h" 00072 #include "misc.h" 00073 #define PSTR(x) x 00074 #define pgm_read_byte_near(x) *(x) 00075 void _delay_ms(uint32_t x); 00076 void _delay_us(uint32_t x); 00077 #define false 0 00078 #define true 1 00079 #define PORTPINDEF uint16_t 00080 typedef int bool; 00081 //#define NOEEPROMSUPPORT 00082 #define printPgmString printString 00083 #endif 00084 #include <string.h> 00085 #include <stdlib.h> 00086 #include <stdint.h> 00087 00088 // Define the Grbl system include files. NOTE: Do not alter organization. 00089 #include "config.h" 00090 #include "nuts_bolts.h" 00091 #include "settings.h" 00092 #include "system.h" 00093 #include "defaults.h" 00094 #include "cpu_map.h" 00095 #include "planner.h" 00096 #include "coolant_control.h" 00097 #include "eeprom.h" 00098 #include "gcode.h" 00099 #include "limits.h" 00100 #include "motion_control.h" 00101 #include "planner.h" 00102 #include "print.h" 00103 #include "probe.h" 00104 #include "protocol.h" 00105 #include "report.h" 00106 #include "serial.h" 00107 #include "spindle_control.h" 00108 #include "stepper.h" 00109 #include "jog.h" 00110 00111 // --------------------------------------------------------------------------------------- 00112 // COMPILE-TIME ERROR CHECKING OF DEFINE VALUES: 00113 00114 #ifndef HOMING_CYCLE_0 00115 #error "Required HOMING_CYCLE_0 not defined." 00116 #endif 00117 00118 #if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && !defined(VARIABLE_SPINDLE) 00119 #error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with VARIABLE_SPINDLE enabled" 00120 #endif 00121 00122 #if defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && !defined(CPU_MAP_ATMEGA328P) 00123 #error "USE_SPINDLE_DIR_AS_ENABLE_PIN may only be used with a 328p processor" 00124 #endif 00125 00126 #if !defined(USE_SPINDLE_DIR_AS_ENABLE_PIN) && defined(SPINDLE_ENABLE_OFF_WITH_ZERO_SPEED) 00127 #error "SPINDLE_ENABLE_OFF_WITH_ZERO_SPEED may only be used with USE_SPINDLE_DIR_AS_ENABLE_PIN enabled" 00128 #endif 00129 00130 #if defined(PARKING_ENABLE) 00131 #if defined(HOMING_FORCE_SET_ORIGIN) 00132 #error "HOMING_FORCE_SET_ORIGIN is not supported with PARKING_ENABLE at this time." 00133 #endif 00134 #endif 00135 00136 #if defined(ENABLE_PARKING_OVERRIDE_CONTROL) 00137 #if !defined(PARKING_ENABLE) 00138 #error "ENABLE_PARKING_OVERRIDE_CONTROL must be enabled with PARKING_ENABLE." 00139 #endif 00140 #endif 00141 00142 #if defined(SPINDLE_PWM_MIN_VALUE) 00143 #if !(SPINDLE_PWM_MIN_VALUE > 0) 00144 #error "SPINDLE_PWM_MIN_VALUE must be greater than zero." 00145 #endif 00146 #endif 00147 00148 #if (REPORT_WCO_REFRESH_BUSY_COUNT < REPORT_WCO_REFRESH_IDLE_COUNT) 00149 #error "WCO busy refresh is less than idle refresh." 00150 #endif 00151 #if (REPORT_OVR_REFRESH_BUSY_COUNT < REPORT_OVR_REFRESH_IDLE_COUNT) 00152 #error "Override busy refresh is less than idle refresh." 00153 #endif 00154 #if (REPORT_WCO_REFRESH_IDLE_COUNT < 2) 00155 #error "WCO refresh must be greater than one." 00156 #endif 00157 #if (REPORT_OVR_REFRESH_IDLE_COUNT < 1) 00158 #error "Override refresh must be greater than zero." 00159 #endif 00160 // --------------------------------------------------------------------------------------- 00161 00162 #endif
Generated on Tue Jul 12 2022 20:45:31 by
1.7.2