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: mbed SimpleRGB mbed-rtos 4DGL-uLCD-SE SDFileSystem wave_player
Revision 8:38419fb4e242, committed 2016-10-11
- Comitter:
- kswanson31
- Date:
- Tue Oct 11 03:30:07 2016 +0000
- Parent:
- 7:f3eb2b2c295d
- Child:
- 9:d6343146d23e
- Commit message:
- Edits to status and reboot threads
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Oct 11 02:47:49 2016 +0000
+++ b/main.cpp Tue Oct 11 03:30:07 2016 +0000
@@ -7,8 +7,7 @@
#define SECOND 1000 // used with threads
DigitalOut led(LED1); // test led
-uLCD_4DGL lcd(p9,p10,p11);
-Mutex stdio_mutex;
+
/* 1 init/declare
Ticker first;
@@ -41,6 +40,9 @@
/* 2 init/declare */
+uLCD_4DGL lcd(p9, p10, p11); // lcd used by the following threads
+Mutex stdio_mutex; // mutex lock, ensure safe use of lcd
+
// lcd thread
void uLCD_reboot_thread(void const *args) {
// show reboot process, associated with clip of apple restart
@@ -66,7 +68,9 @@
stdio_mutex.unlock();
Thread::wait(52 * SECOND);
// clear screen
+ stdio_mutex.lock();
lcd.cls();
+ stdio_mutex.unlock();
}
}
@@ -96,21 +100,24 @@
lcd.text_string(":-(", 1, 1, FONT_7X8, WHITE);
// unlock, wait for 20 sec
stdio_mutex.unlock();
- Thread::wait(20 * SECOND);
- lcd.cls();
+ Thread::wait(20 * SECOND);
}
}
+
+/* extra credit - video */
void uLCD_video_thread(void const *args) {
- uLCD.media_init();
- uLCD.set_sector_address(0x001D, 0x4C42);
- uLCD.display_video(0,0);
+ lcd.media_init();
+ lcd.set_sector_address(0x001D, 0x4C42);
+ lcd.display_video(0,0);
}
+// - extra
+
RGBLed rgbLED(p21, p22, p23); // object to use the RGB LED
-const LightColor green(0.0, 0.8, 0.0); // adjust brightness for green
-const LightColor yellow(1.0, 0.8, 0.0);
-const LightColor orange(1.0, 0.4, 0.0);
+const LightColor green(0.0, 1.0, 0.0);
+const LightColor yellow(1.0, 1.0, 0.0);
+const LightColor orange(1.0, 0.6, 0.0);
const LightColor red(1.0,0.0,0.0);
const LightColor violet(1.0, 0.0, 0.8);
const LightColor blue(0.0, 0.0, 1.0);
@@ -157,8 +164,8 @@
/* 2 calls */
Thread thread2(uLCD_reboot_thread);
- //Thread thread3(uLCD_status_thread);
- Thread thread4(rainbow_led_thread);
+ Thread thread3(uLCD_status_thread);
+ //Thread thread4(rainbow_led_thread);
//Thread thread5(uLCD_video_thread);
// - 2
