Skip to content

Instantly share code, notes, and snippets.

@emmanuel-nwogu
Last active March 29, 2023 23:17
Show Gist options
  • Save emmanuel-nwogu/bd4d12074cd4173031980d8276dbd035 to your computer and use it in GitHub Desktop.
Save emmanuel-nwogu/bd4d12074cd4173031980d8276dbd035 to your computer and use it in GitHub Desktop.
makefile for continuously saving images taken with an OV5642 connected to a Pi 4B to a text file
NAME=run_Save_To_Pi
# NAME=run_Arducam_Demo
CC=gcc
CFLAGS=-Wall -pthread
ODIR=obj
SDIR=src
_DEPS=ArduCAM.h bcm283x_board_driver.h sccb_bus.h ov2640_regs.h ov5640_regs.h ov5642_regs.h
DEPS=$(patsubst %,$(SDIR)/%,$(_DEPS))
_OBJ=SaveToPi.o ArduCAM.o bcm283x_board_driver.o sccb_bus.o
# _OBJ=ArducamDemo.o ArduCAM.o bcm283x_board_driver.o sccb_bus.o
OBJ=$(patsubst %,$(ODIR)/%,$(_OBJ))
$(ODIR)/%.o: src/%.c $(DEPS)
@mkdir -p $(@D)
$(CC) -c -o $@ $< $(CFLAGS)
$(NAME): $(OBJ)
$(CC) -o $@ $^ $(CFLAGS)
.PHONY: run
run: $(NAME)
sudo ./$(NAME)
.PHONY: clean
clean:
rm $(NAME) $(ODIR)/*.o
@emmanuel-nwogu
Copy link
Author

I think it's a good idea to leave the run_Arducam_Demo target in as a comment so u can easily uncomment it to test that your cam actually works. There's probably a much better way to do this but I'm way too busy to find out right now. If you do know, feel free to chime in :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment