]> Johnzone git - FakeRadio.git/commitdiff
working, Makefile needs some love
authorJohn Janus <mail@johnzone.org>
Sat, 16 Sep 2017 21:41:43 +0000 (23:41 +0200)
committerJohn Janus <mail@johnzone.org>
Sat, 16 Sep 2017 21:41:43 +0000 (23:41 +0200)
Makefile
fakeradio [new file with mode: 0755]
ledtest [new file with mode: 0755]
mp3player.c
mp3player.h
simple_try.c
test [new file with mode: 0755]

index 66bee6aaf9a1cf75a71e6ef52210e6aace4c2cd4..3669f8cce5a4629386a42a8c785d144e31ab8a72 100644 (file)
--- 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 (executable)
index 0000000..4e75de1
Binary files /dev/null and b/fakeradio differ
diff --git a/ledtest b/ledtest
new file mode 100755 (executable)
index 0000000..6da6eba
Binary files /dev/null and b/ledtest differ
index 15339209b0de850dde27ed7d18f684316d3b63bf..954f141b21ea9fd138a978ab56def4f108fda679 100644 (file)
@@ -1,5 +1,7 @@
 #include "mp3player.h"
 #include <stdbool.h>
+#include <ao/ao.h>
+#include <mpg123.h>
 #define BITS 8
 
 pthread_t startPlayThread(const char* file)
index 546d5c70fcc7a6ccf7e87c182c6830f04e837db4..ae3dfdf36ac7616fbbe934fe72b5b68d52c1d620 100644 (file)
@@ -1,13 +1,9 @@
-#ifndef MP3PLAYER
-#define MP3PLAYER
+#ifndef _MY_MP3PLAYER
+#define _MY_MP3PLAYER
 #include <pthread.h>
-#include <mpg123.h>
-#include <ao/ao.h>
-#include <stdio.h>
-#include <stdlib.h>
 
-pthread_t startPlayThread(const char* file);
+pthread_t startPlayThread(const char*);
 
-void* playFunc(void* file);
+void* playFunc(void*);
 
 #endif
index 70269ee5c4e01f9c798adf69cfc8eb92f8351ac2..ddf1106ab670fb4dad5a5ed893136db3c62e7d52 100644 (file)
@@ -5,6 +5,7 @@
 #include <signal.h>
 #include <unistd.h>
 #include <pthread.h>
+
 #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 (executable)
index 0000000..a4ad8ff
Binary files /dev/null and b/test differ