Shohei Yasutake / Mbed 2 deprecated koibumi2000

Dependencies:   fll mbed-rtos mbed

Revision:
6:d0348b7a2f05
Parent:
5:130721ce29f7
Child:
7:61b4825304e2
Child:
29:2f3d6d09eaac
--- a/fll.cpp	Sat Feb 14 07:25:27 2015 +0000
+++ b/fll.cpp	Sat Feb 14 08:02:21 2015 +0000
@@ -10,35 +10,34 @@
 Serial pc(USBTX, USBRX);
 
 // ------
-// Source
+// RepeaterSource
 // ------
-Source::Source(button_t *bs, int s, bool l)
+RepeaterSource::RepeaterSource(button_t *bs, int s)
 {
-    button_t_seq = bs;
+    button_seq = bs;
     size = s;
-    loop = l;
     i = 0;
 }
 
-// TODO: without loop
-button_t Source::await()
+button_t RepeaterSource::await()
 {
-    if (size == 0) {
+    if(size == 0) {
         return 0;
+    } else if(size <= i) {
+        i = 0;
     }
-    i = i % size;
-    return button_t_seq[i++];
+    return button_seq[i++];
 }
 
 // ----
-// Pipe
+// FoldFlow
 // ----
-Pipe::Pipe(Source **srcs, int srcs_size) : Source(NULL, 0, 1) {
+FoldFlow::FoldFlow(Producer **srcs, int srcs_size) {
     sources = srcs;
     sources_size = srcs_size;
 }
 
-button_t Pipe::await()
+button_t FoldFlow::await()
 {
     button_t *bs = (button_t*) malloc(sizeof(button_t) * sources_size);
     for (int i = 0; i < sources_size; i++) {
@@ -53,7 +52,7 @@
 // ----
 // Sink
 // ----
-Sink::Sink(Source* src, rtos::Mail<button_t, MAIL_BOX_SIZE>* box, Mutex* mut)
+Sink::Sink(Producer* src, rtos::Mail<button_t, MAIL_BOX_SIZE>* box, Mutex* mut)
 {
     source = src;
     mail_box = box;
@@ -76,7 +75,7 @@
     }
 }
 
-void Sink::reset(Source* src)
+void Sink::reset(Producer* src)
 {
     mutex->lock();
     // queue を空にする