Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: fll mbed-rtos mbed
Diff: fll.cpp
- Revision:
- 2:165723d41023
- Parent:
- 1:1abcd83947bf
- Child:
- 3:edbf31a8589f
--- a/fll.cpp Fri Feb 13 14:41:00 2015 +0000
+++ b/fll.cpp Sat Feb 14 04:49:28 2015 +0000
@@ -48,57 +48,57 @@
// ----
// Sink
// ----
-Sink::Sink(Source* src, rtos::Mail<button, QUEUE_SIZE>* q, Mutex* mut)
+Sink::Sink(Source* src, rtos::Mail<button, MAIL_BOX_SIZE>* box, Mutex* mut)
{
source = src;
- queue = q;
- queueMutex = mut;
+ mail_box = box;
+ mutex = mut;
}
// 何ミリ秒かごとに呼ばれる
void Sink::run()
{
for (int i = 0; i < 8; i++) { // FIXME: 8?
- queueMutex->lock();
- button* btn = queue->alloc();
+ mutex->lock();
+ button* btn = mail_box->alloc();
if(!btn) break;
*btn = source->await();
- queue->put(btn);
- queueMutex->unlock();
+ mail_box->put(btn);
+ mutex->unlock();
}
}
void Sink::reset(Source* src)
{
- queueMutex->lock();
+ mutex->lock();
// queue を空にする
osEvent e;
do {
- e = queue->get(0);
+ e = mail_box->get(0);
if(e.status == osEventMail) {
- queue->free((button*)e.value.p);
+ mail_box->free((button*)e.value.p);
}
} while (e.status == osEventMail);
// source の更新
source = src;
- queueMutex->unlock();
+ mutex->unlock();
}
// ------
// Output
// ------
-Output::Output(rtos::Mail<button, QUEUE_SIZE>* q)
+Output::Output(rtos::Mail<button, MAIL_BOX_SIZE>* box)
{
- queue = q;
+ mail_box = box;
}
void Output::run()
{
- osEvent e = queue->get(0);
+ osEvent e = mail_box->get(0);
if (e.status == osEventMail) {
button b = *(button*)(e.value.p);
press(b);
- queue->free((button*)e.value.p);
+ mail_box->free((button*)e.value.p);
} else {
press(0); // Mail になかった
}
