From 0bf09186773f8b0e8a8abd20dc500683cfc770d4 Mon Sep 17 00:00:00 2001 From: Karolis Stasaitis Date: Tue, 6 Feb 2024 12:36:00 +0530 Subject: [PATCH] reorganising files --- Makefile | 17 ++++++++++----- src/host.c | 2 +- .../nuphy-air60/layouts/default/indicators.c | 4 ++-- src/{ => lib/sh68f90a}/clock.c | 0 src/{ => lib/sh68f90a}/clock.h | 0 src/{ => lib/sh68f90a}/delay.c | 2 +- src/{ => lib/sh68f90a}/delay.h | 0 src/{ => lib/sh68f90a}/gpio.c | 0 src/{ => lib/sh68f90a}/gpio.h | 0 src/{ => lib/sh68f90a}/isp.c | 0 src/{ => lib/sh68f90a}/isp.h | 0 src/{ => lib/sh68f90a}/keyboard.c | 4 ++-- src/{ => lib/sh68f90a}/ldo.c | 0 src/{ => lib/sh68f90a}/ldo.h | 0 src/{ => lib/sh68f90a}/pwm.c | 2 +- src/{ => lib/sh68f90a}/pwm.h | 0 src/{ => lib/sh68f90a}/sh68f90a.h | 0 src/{ => lib/sh68f90a}/uart.c | 0 src/{ => lib/sh68f90a}/uart.h | 0 src/{ => lib/sh68f90a}/usb.c | 10 ++++----- src/{ => lib/sh68f90a}/usb.h | 2 +- src/{ => lib/sh68f90a}/usbregs.h | 0 src/{ => lib/sh68f90a}/watchdog.h | 0 src/main.c | 21 ++++++++++--------- src/matrix.c | 6 +++--- src/{lib => overridable}/indicators.c | 0 src/{lib => overridable}/layout.c | 0 27 files changed, 39 insertions(+), 31 deletions(-) rename src/{ => lib/sh68f90a}/clock.c (100%) rename src/{ => lib/sh68f90a}/clock.h (100%) rename src/{ => lib/sh68f90a}/delay.c (96%) rename src/{ => lib/sh68f90a}/delay.h (100%) rename src/{ => lib/sh68f90a}/gpio.c (100%) rename src/{ => lib/sh68f90a}/gpio.h (100%) rename src/{ => lib/sh68f90a}/isp.c (100%) rename src/{ => lib/sh68f90a}/isp.h (100%) rename src/{ => lib/sh68f90a}/keyboard.c (94%) rename src/{ => lib/sh68f90a}/ldo.c (100%) rename src/{ => lib/sh68f90a}/ldo.h (100%) rename src/{ => lib/sh68f90a}/pwm.c (99%) rename src/{ => lib/sh68f90a}/pwm.h (100%) rename src/{ => lib/sh68f90a}/sh68f90a.h (100%) rename src/{ => lib/sh68f90a}/uart.c (100%) rename src/{ => lib/sh68f90a}/uart.h (100%) rename src/{ => lib/sh68f90a}/usb.c (99%) rename src/{ => lib/sh68f90a}/usb.h (88%) rename src/{ => lib/sh68f90a}/usbregs.h (100%) rename src/{ => lib/sh68f90a}/watchdog.h (100%) rename src/{lib => overridable}/indicators.c (100%) rename src/{lib => overridable}/layout.c (100%) diff --git a/Makefile b/Makefile index 6774a04..60d80fc 100644 --- a/Makefile +++ b/Makefile @@ -47,8 +47,11 @@ MAIN_SOURCES := $(SRCDIR)/main.c \ $(LAYOUT_SOURCES) MAIN_OBJECTS := $(MAIN_SOURCES:$(SRCDIR)/%.c=$(OBJDIR)/%.rel) -LIB_SOURCES := $(wildcard $(SRCDIR)/lib/*.c) -LIB_OBJECTS := $(LIB_SOURCES:$(SRCDIR)/lib/%.c=$(OBJDIR)/lib/%.rel) +LIBSINO8051_SOURCES := $(wildcard $(SRCDIR)/lib/sh68f90a/*.c) +LIBSINO8051_OBJECTS := $(LIBSINO8051_SOURCES:$(SRCDIR)/lib/sh68f90a/%.c=$(OBJDIR)/lib/sh68f90a/%.rel) + +OVERRIDABLE_SOURCES := $(wildcard $(SRCDIR)/overridable/*.c) +OVERRIDABLE_OBJECTS := $(OVERRIDABLE_SOURCES:$(SRCDIR)/overridable/%.c=$(OBJDIR)/overridable/%.rel) .PHONY: all clean flash @@ -64,13 +67,17 @@ $(OBJDIR)/%.rel: $(SRCDIR)/%.c @mkdir -p $(@D) $(CC) -m$(FAMILY) -l$(PROC) $(CFLAGS) -c $< -o $@ -$(BINDIR)/smk.lib: $(LIB_OBJECTS) +$(BINDIR)/overridable.lib: $(OVERRIDABLE_OBJECTS) + @mkdir -p $(@D) + $(SDAR) $@ $^ + +$(BINDIR)/sino8051.lib: $(LIBSINO8051_OBJECTS) @mkdir -p $(@D) $(SDAR) $@ $^ -$(BINDIR)/main.ihx: $(MAIN_OBJECTS) $(BINDIR)/smk.lib +$(BINDIR)/main.ihx: $(MAIN_OBJECTS) $(BINDIR)/sino8051.lib $(BINDIR)/overridable.lib @mkdir -p $(@D) - $(CC) -m$(FAMILY) -l$(PROC) $(LFLAGS) -o $@ $(MAIN_OBJECTS) -L$(BINDIR) -lsmk + $(CC) -m$(FAMILY) -l$(PROC) $(LFLAGS) -o $@ $(MAIN_OBJECTS) -L$(BINDIR) -loverridable -lsino8051 $(BINDIR)/%.hex: $(BINDIR)/%.ihx ${PACKIHX} < $< > $@ diff --git a/src/host.c b/src/host.c index 04f7cb4..aba6297 100644 --- a/src/host.c +++ b/src/host.c @@ -1,6 +1,6 @@ #include "host.h" #include "debug.h" -#include "usb.h" +#include "lib/sh68f90a/usb.h" /* send report */ void host_keyboard_send(report_keyboard_t *report) diff --git a/src/keyboards/nuphy-air60/layouts/default/indicators.c b/src/keyboards/nuphy-air60/layouts/default/indicators.c index 5ddfe90..6b79d55 100644 --- a/src/keyboards/nuphy-air60/layouts/default/indicators.c +++ b/src/keyboards/nuphy-air60/layouts/default/indicators.c @@ -1,6 +1,6 @@ #include "../../../../indicators.h" -#include "../../../../sh68f90a.h" -#include "../../../../pwm.h" +#include "../../../../lib/sh68f90a/sh68f90a.h" +#include "../../../../lib/sh68f90a/pwm.h" #include bool indicators_update_step(keyboard_state_t *keyboard, uint8_t current_step) diff --git a/src/clock.c b/src/lib/sh68f90a/clock.c similarity index 100% rename from src/clock.c rename to src/lib/sh68f90a/clock.c diff --git a/src/clock.h b/src/lib/sh68f90a/clock.h similarity index 100% rename from src/clock.h rename to src/lib/sh68f90a/clock.h diff --git a/src/delay.c b/src/lib/sh68f90a/delay.c similarity index 96% rename from src/delay.c rename to src/lib/sh68f90a/delay.c index 07c3495..94e31e4 100644 --- a/src/delay.c +++ b/src/lib/sh68f90a/delay.c @@ -1,6 +1,6 @@ #include "delay.h" #include "watchdog.h" -#include "utils.h" +#include "../../utils.h" #include // very naive implementation, not very accurate or optimized diff --git a/src/delay.h b/src/lib/sh68f90a/delay.h similarity index 100% rename from src/delay.h rename to src/lib/sh68f90a/delay.h diff --git a/src/gpio.c b/src/lib/sh68f90a/gpio.c similarity index 100% rename from src/gpio.c rename to src/lib/sh68f90a/gpio.c diff --git a/src/gpio.h b/src/lib/sh68f90a/gpio.h similarity index 100% rename from src/gpio.h rename to src/lib/sh68f90a/gpio.h diff --git a/src/isp.c b/src/lib/sh68f90a/isp.c similarity index 100% rename from src/isp.c rename to src/lib/sh68f90a/isp.c diff --git a/src/isp.h b/src/lib/sh68f90a/isp.h similarity index 100% rename from src/isp.h rename to src/lib/sh68f90a/isp.h diff --git a/src/keyboard.c b/src/lib/sh68f90a/keyboard.c similarity index 94% rename from src/keyboard.c rename to src/lib/sh68f90a/keyboard.c index ea2f1d9..27a2738 100644 --- a/src/keyboard.c +++ b/src/lib/sh68f90a/keyboard.c @@ -1,6 +1,6 @@ -#include "keyboard.h" +#include "../../keyboard.h" #include "sh68f90a.h" -#include "debug.h" +#include "../../debug.h" __xdata keyboard_state_t keyboard_state; diff --git a/src/ldo.c b/src/lib/sh68f90a/ldo.c similarity index 100% rename from src/ldo.c rename to src/lib/sh68f90a/ldo.c diff --git a/src/ldo.h b/src/lib/sh68f90a/ldo.h similarity index 100% rename from src/ldo.h rename to src/lib/sh68f90a/ldo.h diff --git a/src/pwm.c b/src/lib/sh68f90a/pwm.c similarity index 99% rename from src/pwm.c rename to src/lib/sh68f90a/pwm.c index 314f5d1..db8e224 100644 --- a/src/pwm.c +++ b/src/lib/sh68f90a/pwm.c @@ -1,5 +1,5 @@ #include "pwm.h" -#include "matrix.h" +#include "../../matrix.h" #include #include diff --git a/src/pwm.h b/src/lib/sh68f90a/pwm.h similarity index 100% rename from src/pwm.h rename to src/lib/sh68f90a/pwm.h diff --git a/src/sh68f90a.h b/src/lib/sh68f90a/sh68f90a.h similarity index 100% rename from src/sh68f90a.h rename to src/lib/sh68f90a/sh68f90a.h diff --git a/src/uart.c b/src/lib/sh68f90a/uart.c similarity index 100% rename from src/uart.c rename to src/lib/sh68f90a/uart.c diff --git a/src/uart.h b/src/lib/sh68f90a/uart.h similarity index 100% rename from src/uart.h rename to src/lib/sh68f90a/uart.h diff --git a/src/usb.c b/src/lib/sh68f90a/usb.c similarity index 99% rename from src/usb.c rename to src/lib/sh68f90a/usb.c index db4d55b..e04d15f 100644 --- a/src/usb.c +++ b/src/lib/sh68f90a/usb.c @@ -1,12 +1,12 @@ #include "usb.h" #include "watchdog.h" #include "isp.h" -#include "usbdef.h" +#include "../../usbdef.h" #include "usbregs.h" -#include "debug.h" -#include "utils.h" -#include "usbhidreport.h" -#include "keyboard.h" +#include "../../debug.h" +#include "../../utils.h" +#include "../../usbhidreport.h" +#include "../../keyboard.h" #include #include diff --git a/src/usb.h b/src/lib/sh68f90a/usb.h similarity index 88% rename from src/usb.h rename to src/lib/sh68f90a/usb.h index faef226..098f800 100644 --- a/src/usb.h +++ b/src/lib/sh68f90a/usb.h @@ -2,7 +2,7 @@ #define USB_H #include "sh68f90a.h" -#include "report.h" +#include "../../report.h" #include void usb_init(); diff --git a/src/usbregs.h b/src/lib/sh68f90a/usbregs.h similarity index 100% rename from src/usbregs.h rename to src/lib/sh68f90a/usbregs.h diff --git a/src/watchdog.h b/src/lib/sh68f90a/watchdog.h similarity index 100% rename from src/watchdog.h rename to src/lib/sh68f90a/watchdog.h diff --git a/src/main.c b/src/main.c index a3c6c6d..c678932 100644 --- a/src/main.c +++ b/src/main.c @@ -1,18 +1,19 @@ -#include "clock.h" -#include "ldo.h" -#include "watchdog.h" -#include "delay.h" -#include "isp.h" -#include "uart.h" -#include "stdio.h" -#include "gpio.h" +#include "lib/sh68f90a/clock.h" +#include "lib/sh68f90a/ldo.h" +#include "lib/sh68f90a/watchdog.h" +#include "lib/sh68f90a/delay.h" +#include "lib/sh68f90a/isp.h" +#include "lib/sh68f90a/uart.h" +#include "lib/sh68f90a/gpio.h" #include "matrix.h" -#include "pwm.h" -#include "usb.h" +#include "lib/sh68f90a/pwm.h" +#include "lib/sh68f90a/usb.h" #include "debug.h" #include "utils.h" #include "keyboard.h" +#include + void init() { ldo_init(); diff --git a/src/matrix.c b/src/matrix.c index dd00a02..237283a 100644 --- a/src/matrix.c +++ b/src/matrix.c @@ -1,7 +1,7 @@ #include "matrix.h" -#include "sh68f90a.h" -#include "pwm.h" -#include "delay.h" +#include "lib/sh68f90a/sh68f90a.h" +#include "lib/sh68f90a/pwm.h" +#include "lib/sh68f90a/delay.h" #include "layout.h" #include "report.h" #include "debug.h" diff --git a/src/lib/indicators.c b/src/overridable/indicators.c similarity index 100% rename from src/lib/indicators.c rename to src/overridable/indicators.c diff --git a/src/lib/layout.c b/src/overridable/layout.c similarity index 100% rename from src/lib/layout.c rename to src/overridable/layout.c