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:
- 26:08387521c994
- Parent:
- 17:69536d02cb3c
- Child:
- 33:cc84b10e6c67
--- a/fll.cpp Mon Feb 16 17:56:58 2015 +0000
+++ b/fll.cpp Mon Feb 16 18:06:40 2015 +0000
@@ -35,6 +35,21 @@
}
}
+void Sink::reset()
+{
+ mutex->lock();
+ osEvent e;
+ do {
+ e = mail_box->get(0);
+ if(e.status == osEventMail) {
+ mail_box->free((button_t*)e.value.p);
+ }
+ } while (e.status == osEventMail);
+ // reset source
+ source->reset();
+ mutex->unlock();
+}
+
void Sink::reset(Producer* src)
{
mutex->lock();
@@ -149,19 +164,14 @@
Mutex* mutex = new Mutex();
Sink* sink = new Sink(producer, mail_box, mutex);
+ InterruptIn reset_pin(p20);
+ reset_pin.fall(sink, &Sink::reset);
Ticker ticker;
Output* output = new Output(mail_box);
Thread th(invoke_sinkrun, (void *)sink);
- DigitalIn pin20(p20);
- wait(1);
- while (1) {
- // pc.printf("pin20: %d\r\n", pin20.read());
- if (pin20.read() == 1) {
- break;
- }
- }
+
ticker.attach(output, &Output::run, FRAME);
Thread::wait(osWaitForever);
