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.
Revision 0:326fc1762064, committed 2015-12-23
- Comitter:
- mbed_Cookbook_SE
- Date:
- Wed Dec 23 15:57:27 2015 +0000
- Commit message:
- ??????
Changed in this revision
| LedMatrix8x8Driver.cpp | Show annotated file Show diff for this revision Revisions of this file |
| LedMatrix8x8Driver.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 326fc1762064 LedMatrix8x8Driver.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/LedMatrix8x8Driver.cpp Wed Dec 23 15:57:27 2015 +0000
@@ -0,0 +1,47 @@
+/**
+ * LM61CIZ Temperature sensor library
+ *
+ * @author Junichi Katsu
+ * @version 1.0
+ * @date 02-April-2015
+ *
+ */
+
+#include "mbed.h"
+#include "LedMatrix8x8Driver.h"
+#include "Adafruit_GFX.h"
+
+LedMatrix8x8Driver::LedMatrix8x8Driver(BusOut* Col,BusOut* Row) : Adafruit_GFX(8, 8)
+{
+ _Col = Col;
+ _Row = Row;
+
+ for(int i=0;i<8;i++)
+ {
+ displaybuffer[i] = 0;
+ }
+
+ flipper.attach(this,&LedMatrix8x8Driver::flip,0.002);
+}
+
+void LedMatrix8x8Driver::drawPixel(int16_t x, int16_t y, uint16_t color) {
+ if ((y < 0) || (y >= 8)) return;
+ if ((x < 0) || (x >= 8)) return;
+
+ if (color) {
+ displaybuffer[y] |= 1 << x;
+ } else {
+ displaybuffer[y] &= ~(1 << x);
+ }
+}
+
+void LedMatrix8x8Driver::flip() {
+ static int col = 0;
+
+ _Row->write(0);
+ _Col->write(displaybuffer[col]);
+ _Row->write(1 << col);
+
+ col++;
+ col %= 8;
+}
\ No newline at end of file
diff -r 000000000000 -r 326fc1762064 LedMatrix8x8Driver.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/LedMatrix8x8Driver.h Wed Dec 23 15:57:27 2015 +0000
@@ -0,0 +1,40 @@
+/**
+ * Matrix8x8 LED library
+ *
+ * @author Junichi Katsu
+ * @version 1.0
+ * @date 15-April-2015
+ *
+ */
+
+#ifndef MBED_LED_MATRIX8X8_DRIVER_H
+#define MBED_LED_MATRIX8X8_DRIVER_H
+
+#include "mbed.h"
+#include "Adafruit_GFX.h"
+
+/** LedMatrix8x8Driver class
+ * @endcode
+ */
+
+class LedMatrix8x8Driver : public Adafruit_GFX
+{
+public:
+ /** Create a LedMatrix8x8Driver instance
+ *
+ * @param Matrix column
+ * @param Matrix row
+ */
+ LedMatrix8x8Driver(BusOut* Col,BusOut* Row);
+
+ virtual void drawPixel(int16_t x, int16_t y, uint16_t color);
+ void flip();
+
+private:
+ BusOut* _Col;
+ BusOut* _Row;
+ Ticker flipper;
+ uint8_t displaybuffer[8];
+};
+
+#endif // MBED_LED_MATRIX8X8_DRIVER_H
\ No newline at end of file