From: John Janus Date: Sat, 16 Sep 2017 21:41:43 +0000 (+0200) Subject: working, Makefile needs some love X-Git-Url: https://git.johnzone.org/?a=commitdiff_plain;h=3f7ffa2069bb1ede22738e622411a48fb3ebb148;p=FakeRadio.git working, Makefile needs some love --- diff --git a/Makefile b/Makefile index 66bee6a..3669f8c 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,12 @@ CC = gcc CFLAGS = -std=gnu11 -Wall -LDFLAGS = -lpthread -lao -lmpg123 -fakeradio: simple_try.c - $(CC) $(CFLAGS) -o ledtest simple_try.c $(LDFLAGS) +LDFLAGS = -lpthread -lao -lmpg123 -lwiringPi +fakeradio: main.o mp3player.o + $(CC) $(CFLAGS) -o fakeradio main.o mp3player.o $(LDFLAGS) + +main.o: simple_try.c + $(CC) $(CFLAGS) -o main.o simple_try.c $(LDFLAGS) mp3player.o: mp3player.h mp3player.c $(CC) $(CFLAGS) -o mp3player.o mp3player.c $(LDFLAGS) -mp3test: mp3player.o - $(CC) $(CFLAGS) -o mp3test mp3player.o $(LDFLAGS) diff --git a/fakeradio b/fakeradio new file mode 100755 index 0000000..4e75de1 Binary files /dev/null and b/fakeradio differ diff --git a/ledtest b/ledtest new file mode 100755 index 0000000..6da6eba Binary files /dev/null and b/ledtest differ diff --git a/mp3player.c b/mp3player.c index 1533920..954f141 100644 --- a/mp3player.c +++ b/mp3player.c @@ -1,5 +1,7 @@ #include "mp3player.h" #include +#include +#include #define BITS 8 pthread_t startPlayThread(const char* file) diff --git a/mp3player.h b/mp3player.h index 546d5c7..ae3dfdf 100644 --- a/mp3player.h +++ b/mp3player.h @@ -1,13 +1,9 @@ -#ifndef MP3PLAYER -#define MP3PLAYER +#ifndef _MY_MP3PLAYER +#define _MY_MP3PLAYER #include -#include -#include -#include -#include -pthread_t startPlayThread(const char* file); +pthread_t startPlayThread(const char*); -void* playFunc(void* file); +void* playFunc(void*); #endif diff --git a/simple_try.c b/simple_try.c index 70269ee..ddf1106 100644 --- a/simple_try.c +++ b/simple_try.c @@ -5,6 +5,7 @@ #include #include #include + #include "mp3player.h" #define PWRLED 8 @@ -78,7 +79,7 @@ int main(void) { pinMode(CHNL1LED, OUTPUT); pinMode(CHNL2LED, OUTPUT); - printf("initialize mutex and condition variable"); + printf("initialize mutex and condition variable\n"); mut = malloc (sizeof(pthread_mutex_t)); pthread_mutex_init(mut, NULL); wakeup = malloc(sizeof(pthread_cond_t)); @@ -110,6 +111,7 @@ int main(void) { playThread = startPlayThread("dansk01.mp3"); } } + delay(500); pthread_mutex_unlock(mut); } diff --git a/test b/test new file mode 100755 index 0000000..a4ad8ff Binary files /dev/null and b/test differ