minor tweaks for mingw.
This commit is contained in:
parent
d3322ccded
commit
82075627b3
@ -15,13 +15,14 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Grbl. If not, see <http://www.gnu.org/licenses/>.
|
# along with Grbl. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
PLATFORM = LINUX
|
PLATFORM = WINDOWS
|
||||||
|
|
||||||
OBJECTS = main.o simulator.o serial.o ../main.o ../protocol.o ../planner.o ../settings.o ../print.o ../nuts_bolts.o eeprom.o ../serial.o avr/pgmspace.o avr/interrupt.o avr/io.o util/delay.o util/floatunsisf.o ../stepper.o ../gcode.o ../spindle_control.o ../motion_control.o ../limits.o ../report.o ../coolant_control.o ../probe.o ../system.o platform_$(PLATFORM).o
|
OBJECTS = main.o simulator.o serial.o ../main.o ../protocol.o ../planner.o ../settings.o ../print.o ../nuts_bolts.o eeprom.o ../serial.o avr/pgmspace.o avr/interrupt.o avr/io.o util/delay.o util/floatunsisf.o ../stepper.o ../gcode.o ../spindle_control.o ../motion_control.o ../limits.o ../report.o ../coolant_control.o ../probe.o ../system.o platform_$(PLATFORM).o
|
||||||
CLOCK = 16000000
|
CLOCK = 16000000
|
||||||
EXE_NAME = grbl_sim.exe
|
EXE_NAME = grbl_sim.exe
|
||||||
COMPILE = $(CC) -Wall -g -DF_CPU=$(CLOCK) -include config.h -I. -DPLAT_$(PLATFORM)
|
COMPILE = $(CC) -Wall -g -DF_CPU=$(CLOCK) -include config.h -I. -DPLAT_$(PLATFORM)
|
||||||
LINUX_LIBRARIES = -lrt -pthread
|
LINUX_LIBRARIES = -lrt -pthread
|
||||||
|
WINDOWS_LIBRARIES =
|
||||||
# symbolic targets:
|
# symbolic targets:
|
||||||
all: main
|
all: main
|
||||||
|
|
||||||
@ -32,7 +33,7 @@ clean:
|
|||||||
|
|
||||||
# file targets:
|
# file targets:
|
||||||
main: $(OBJECTS)
|
main: $(OBJECTS)
|
||||||
$(COMPILE) -o $(EXE_NAME) $(OBJECTS) -lm -lrt $($(PLATFORM)_LIBRARIES)
|
$(COMPILE) -o $(EXE_NAME) $(OBJECTS) -lm $($(PLATFORM)_LIBRARIES)
|
||||||
|
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
$(COMPILE) -c $< -o $@
|
$(COMPILE) -c $< -o $@
|
||||||
|
@ -14,7 +14,7 @@ double ns_per_perfcount;
|
|||||||
void platform_init()
|
void platform_init()
|
||||||
{
|
{
|
||||||
__int64 counts_per_sec;
|
__int64 counts_per_sec;
|
||||||
QueryPerformanceFrequency((LARGE_INTEGER*)&countsPerSec);
|
QueryPerformanceFrequency((LARGE_INTEGER*)&counts_per_sec);
|
||||||
ns_per_perfcount = (float)NS_PER_SEC / counts_per_sec;
|
ns_per_perfcount = (float)NS_PER_SEC / counts_per_sec;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ void platform_sleep(long microsec)
|
|||||||
//create a thread
|
//create a thread
|
||||||
plat_thread_t* platform_start_thread(plat_threadfunc_t threadfunc) {
|
plat_thread_t* platform_start_thread(plat_threadfunc_t threadfunc) {
|
||||||
plat_thread_t* th = malloc(sizeof(plat_thread_t));
|
plat_thread_t* th = malloc(sizeof(plat_thread_t));
|
||||||
th->tid = CreateThread(NULL,0,threadfunc,&th->exit,0);
|
th->tid = CreateThread(NULL,0,threadfunc,&th->exit,0,NULL);
|
||||||
if (!th->tid){
|
if (!th->tid){
|
||||||
free(th);
|
free(th);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -63,10 +63,13 @@ void platform_stop_thread(plat_thread_t* th){
|
|||||||
//force-kill thread
|
//force-kill thread
|
||||||
void platform_kill_thread(plat_thread_t* th){
|
void platform_kill_thread(plat_thread_t* th){
|
||||||
th->exit = 1;
|
th->exit = 1;
|
||||||
TerminateThread(th->tid);
|
TerminateThread(th->tid, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//return char if one available.
|
//return char if one available.
|
||||||
uint8_t platform_poll_stdin() {
|
uint8_t platform_poll_stdin() {
|
||||||
return _kbhit();
|
if (_kbhit()) {
|
||||||
|
return getch();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user