From a29cccd3ea5cbc98054b6a7a2771927f8aae51c2 Mon Sep 17 00:00:00 2001 From: Daniel Meiburg Date: Wed, 15 May 2024 00:43:00 +0200 Subject: [PATCH] Update README, init 04_intro_to_sockets --- 04_intro_to_sockets/Makefile | 39 +++++++++++++++++++++++++++++++ 04_intro_to_sockets/README.md | 11 +++++++++ 04_intro_to_sockets/lib/sockets.c | 0 04_intro_to_sockets/lib/sockets.h | 5 ++++ 04_intro_to_sockets/src/main.c | 4 ++++ README.md | 5 ---- 6 files changed, 59 insertions(+), 5 deletions(-) create mode 100644 04_intro_to_sockets/Makefile create mode 100644 04_intro_to_sockets/README.md create mode 100644 04_intro_to_sockets/lib/sockets.c create mode 100644 04_intro_to_sockets/lib/sockets.h create mode 100644 04_intro_to_sockets/src/main.c diff --git a/04_intro_to_sockets/Makefile b/04_intro_to_sockets/Makefile new file mode 100644 index 0000000..393b7ba --- /dev/null +++ b/04_intro_to_sockets/Makefile @@ -0,0 +1,39 @@ +CC = gcc +CFLAGS = -Wall -Ilib +#LDFLAGS = -lgpiod + +# Directories +SRCDIR = src +LIBDIR = lib +OBJDIR = obj + +# Source files +LIB_SOURCES = $(wildcard $(LIBDIR)/*.c) +SRC_SOURCES = $(wildcard $(SRCDIR)/*.c) + +# Object files +LIB_OBJECTS = $(LIB_SOURCES:$(LIBDIR)/%.c=$(OBJDIR)/%.o) +SRC_OBJECTS = $(SRC_SOURCES:$(SRCDIR)/%.c=$(OBJDIR)/%.o) + +# Target executable +TARGET = sockets + +# Create obj directory if it doesn't exist +$(shell mkdir -p $(OBJDIR)) + +# Rules +all: $(TARGET) + +$(TARGET): $(LIB_OBJECTS) $(SRC_OBJECTS) + $(CC) $(LIB_OBJECTS) $(SRC_OBJECTS) -o $@ $(LDFLAGS) + +$(OBJDIR)/%.o: $(LIBDIR)/%.c + $(CC) $(CFLAGS) -c $< -o $@ + +$(OBJDIR)/%.o: $(SRCDIR)/%.c + $(CC) $(CFLAGS) -c $< -o $@ + +clean: + rm -f $(OBJDIR)/*.o $(TARGET) + +.PHONY: all clean diff --git a/04_intro_to_sockets/README.md b/04_intro_to_sockets/README.md new file mode 100644 index 0000000..efc3305 --- /dev/null +++ b/04_intro_to_sockets/README.md @@ -0,0 +1,11 @@ +# IO Access + +This program demonstrates how to access the GPIO pins on the Raspberry Pi using +a LED, a button and a temperature sensor. + +## Usage + +```bash +$ make +$ ./io +``` diff --git a/04_intro_to_sockets/lib/sockets.c b/04_intro_to_sockets/lib/sockets.c new file mode 100644 index 0000000..e69de29 diff --git a/04_intro_to_sockets/lib/sockets.h b/04_intro_to_sockets/lib/sockets.h new file mode 100644 index 0000000..ab5885f --- /dev/null +++ b/04_intro_to_sockets/lib/sockets.h @@ -0,0 +1,5 @@ +#ifndef SOCKETS_LIB_H +#define SOCKETS_LIB_H + + +#endif // SOCKETS_H diff --git a/04_intro_to_sockets/src/main.c b/04_intro_to_sockets/src/main.c new file mode 100644 index 0000000..2b8c6ac --- /dev/null +++ b/04_intro_to_sockets/src/main.c @@ -0,0 +1,4 @@ + +int main() { + return 0; +} diff --git a/README.md b/README.md index 2f87e24..87eb775 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,3 @@ # Distributed Embedded Systems This repo contains my code for the Distributed Embedded Systems course at the University of Rostock. - -```bash -make -./io -```