Disable serial port if building for Windows
This commit is contained in:
parent
08e7168b1d
commit
f98a9a255f
2
Makefile
2
Makefile
|
@ -7,7 +7,7 @@ LDFLAGS += `$(SDL2_CONFIG) --libs`
|
|||
else
|
||||
ifeq ($(TARGET),mingw)
|
||||
CC = x86_64-w64-mingw32-gcc
|
||||
CFLAGS += -g -Ofast -std=c99 -Wall -Wextra
|
||||
CFLAGS += -g -Ofast -std=c99 -Wall -Wextra -DWINDOWS
|
||||
LDFLAGS += -lmingw32 -lSDL2main -lSDL2
|
||||
TARGET_FILE_EXTENSION = .exe
|
||||
else
|
||||
|
|
|
@ -30,10 +30,12 @@ extern mouse_t mouse;
|
|||
int bus_io_read(void *user, uint32_t *value, uint32_t port) {
|
||||
(void) user;
|
||||
switch (port) {
|
||||
#ifndef WINDOWS
|
||||
case 0x00000000: { // serial port
|
||||
*value = serial_get();
|
||||
break;
|
||||
};
|
||||
#endif
|
||||
|
||||
case 0x80000000 ... 0x8000031F: { // overlay port
|
||||
uint8_t overlay_number = port & 0x000000FF;
|
||||
|
|
|
@ -119,7 +119,9 @@ int main(int argc, char *argv[]) {
|
|||
ScreenDraw();
|
||||
}
|
||||
|
||||
#ifndef WINDOWS
|
||||
serial_init();
|
||||
#endif
|
||||
|
||||
tick_start = SDL_GetTicks();
|
||||
tick_end = SDL_GetTicks();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <stdio.h>
|
||||
#ifndef WINDOWS
|
||||
#include <sys/select.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <termios.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -50,6 +51,8 @@ int serial_get(void) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void serial_put(int value) {
|
||||
putchar((int) value);
|
||||
fflush(stdout);
|
||||
|
|
Loading…
Reference in New Issue
Block a user