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: Adafruit_GFX MODSERIAL mbed-rtos mbed
Diff: display.cpp
- Revision:
- 6:506b703a8acf
diff -r 0b229ba8ede5 -r 506b703a8acf display.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/display.cpp Thu May 01 09:29:29 2014 +0000
@@ -0,0 +1,51 @@
+#include "display.h"
+
+Display::SPI2::SPI2(PinName mosi, PinName miso, PinName clk)
+: SPI(mosi, miso, clk)
+{
+ format(8,3);
+ frequency(2000000);
+};
+
+
+Display::Display()
+: m_spi(p5, NC, p7)
+, m_oled(m_spi, p18, p19, p20)
+{
+}
+
+
+void Display::clear()
+{
+ m_oled.clearDisplay();
+}
+
+void Display::display()
+{
+ m_oled.display();
+}
+
+void Display::sendTo(const char* text)
+{
+ uint8_t line = 0;
+ if (strstr(text, "RPM"))
+ {
+ line = 1;
+ }
+ else if (strstr(text, "Oil"))
+ {
+ line = 2;
+ }
+ else if (strstr(text, "Coolant"))
+ {
+ line = 3;
+ }
+ else if (strstr(text, "Speed"))
+ {
+ return;
+ }
+
+ m_oled.setCursor(0, line * 8);
+ m_oled.printf("%s", text);
+
+}
\ No newline at end of file