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 1:a0ac2743f855, committed 2011-04-07
- Comitter:
- nxpfan
- Date:
- Thu Apr 07 23:32:35 2011 +0000
- Parent:
- 0:a19b70a76e66
- Commit message:
Changed in this revision
| MARMEX_OB_oled.h | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r a19b70a76e66 -r a0ac2743f855 MARMEX_OB_oled.h
--- a/MARMEX_OB_oled.h Thu Apr 07 07:39:06 2011 +0000
+++ b/MARMEX_OB_oled.h Thu Apr 07 23:32:35 2011 +0000
@@ -2,8 +2,8 @@
*
* @class MARMEX_OB_oled
* @author tedd
- * @version 0.5
- * @date 07-Apr-2011
+ * @version 0.51
+ * @date 08-Apr-2011
*
* Released under the MIT License: http://mbed.org/license/mit
*
@@ -41,34 +41,36 @@
*
* Example:
* @code
- * #include "mbed.h"
- * #include "MARMEX_OB_oled.h"
- *
- * // oled1 is for MARMEX_OB_oled board on MAPLE slot 1
- * // oled2 is for MARMEX_OB_oled board on MAPLE slot 2
- *
- * //MARMEX_OB_oled oled1( p5, p7, p8, p30, p11 ); // mosi, sclk, cs, rst, power_control
- * MARMEX_OB_oled oled2( p5, p7, p26, p21, p17 ); // mosi, sclk, cs, rst, power_control
- *
- * int main() {
- * oled2.background( 0x000000 );
- * oled2.cls();
- *
- * for ( int i = 0; i < 8; i++ )
- * oled2.fill( (MARMEX_OB_oled::WIDTH / 8) * i, 0, (MARMEX_OB_oled::WIDTH / 8), 128, ((i & 0x4) ? 0xFF0000 : 0x000000) | ((i & 0x2) ? 0x00FF00 : 0x000000) |((i & 0x1) ? 0x0000FF : 0x000000) );
- *
- * oled2.fill( 50, 50, 64, 64, 0xCCCCCC );
- *
- * oled2.locate( 0, 3 );
- * oled2.printf( "Hello World!" );
- * oled2.locate( 0, 4 );
- * oled2.printf( "SPI = %s", MERMEX_OB_SPI_MODE_STR );
- *
- * for (int i = 0; i < MARMEX_OB_oled::WIDTH; i++ ) {
- * oled2.pixel( i, 80 + sin( (float)i / 5.0 ) * 10, 0x000000 );
- * }
- * }
- * @endcode
+ * #include "mbed.h"
+ * #include "MARMEX_OB_oled.h"
+ *
+ * // oled1 is for MARMEX_OB_oled board on MAPLE slot 1
+ * // oled1 is for MARMEX_OB_oled board on MAPLE slot 2
+ *
+ * MARMEX_OB_oled oled1( p5, p7, p8, p30, p11 ); // mosi, sclk, cs, rst, power_control
+ * //MARMEX_OB_oled oled2( p5, p7, p26, p21, p17 ); // mosi, sclk, cs, rst, power_control
+ *
+ *
+ * int main() {
+ * oled1.background( 0x000000 );
+ * oled1.cls();
+ *
+ * int colorbar_width = MARMEX_OB_oled::WIDTH / 8;
+ *
+ * for ( int i = 0; i < 8; i++ )
+ * oled1.fill( colorbar_width * i, 0, colorbar_width, MARMEX_OB_oled::HEIGHT, ((i & 0x4) ? 0xFF0000 : 0x000000) | ((i & 0x2) ? 0x00FF00 : 0x000000) | ((i & 0x1) ? 0x0000FF : 0x000000) );
+ *
+ * oled1.fill( 50, 50, 64, 64, 0xCCCCCC );;
+ *
+ * oled1.locate( 0, 3 );
+ * oled1.printf( "Hello World!" );
+ * oled1.locate( 0, 4 );
+ * oled1.printf( "SPI = %s", MERMEX_OB_SPI_MODE_STR );
+ *
+ * for (int i = 0; i < MARMEX_OB_oled::WIDTH; i++ ) {
+ * oled1.pixel( i, 80 + sin( (float)i / 5.0 ) * 10, 0x000000 );
+ * }
+ * } * @endcode
*/
class MARMEX_OB_oled : public NokiaLCD {
@@ -453,7 +455,7 @@
_cs = 1;
}
- void _putp( int colour ) {
+ virtual void _putp( int colour ) {
int cnv = 0;
cnv = (colour >> 8) & 0xf800;
@@ -475,8 +477,9 @@
#endif
#endif // MBED_MARMEX_OB_OLED
-
-
-
-
-
+/*
+ * history:
+ * 0.5 (2011-Apr-07) : initial published version
+ * 0.51 (2011-Apr-08) : a. "virtual" had been added on "_putp()" function definition to surpress warning when compiling (is this correct way?)
+ * b. sample code (for Doxygen) is changed from new "main.cpp (ver 0.51)"
+ */
diff -r a19b70a76e66 -r a0ac2743f855 main.cpp
--- a/main.cpp Thu Apr 07 07:39:06 2011 +0000
+++ b/main.cpp Thu Apr 07 23:32:35 2011 +0000
@@ -1,16 +1,16 @@
/** A sample app of MARMEX_OB OLED screen drawing library
*
* @author Tedd
- * @version 0.5
- * @date 07-Apr-2011
+ * @version 0.51
+ * @date 08-Apr-2011
*
* Released under the MIT License: http://mbed.org/license/mit
*
* MARMEX_OB_oled OLED screen drawing library for mbed
* This code has been written based on sample code and advises
* from Ochiai-san (Marutsu-Elec). Thank you!
- *
- * To build this code, "NokiaLCD" and "mbed" libraries are needed to be imported in a project.
+ *
+ * To build this code, "NokiaLCD" and "mbed" libraries are needed to be imported in a project.
* NokiaLCD library : http://mbed.org/users/simon/libraries/NokiaLCD/
*/
@@ -29,8 +29,10 @@
oled1.background( 0x000000 );
oled1.cls();
+ int colorbar_width = MARMEX_OB_oled::WIDTH / 8;
+
for ( int i = 0; i < 8; i++ )
- oled1.fill( (MARMEX_OB_oled::WIDTH / 8) * i, 0, (MARMEX_OB_oled::WIDTH / 8), 128, ((i & 0x4) ? 0xFF0000 : 0x000000) | ((i & 0x2) ? 0x00FF00 : 0x000000) |((i & 0x1) ? 0x0000FF : 0x000000) );
+ oled1.fill( colorbar_width * i, 0, colorbar_width, MARMEX_OB_oled::HEIGHT, ((i & 0x4) ? 0xFF0000 : 0x000000) | ((i & 0x2) ? 0x00FF00 : 0x000000) | ((i & 0x1) ? 0x0000FF : 0x000000) );
oled1.fill( 50, 50, 64, 64, 0xCCCCCC );;
@@ -44,3 +46,8 @@
}
}
+/*
+ * history:
+ * 0.5 (2011-Apr-07) : initial published version
+ * 0.51 (2011-Apr-08) : minor modification to make the source more consistent (use " MARMEX_OB_oled::HEIGHT" instead of 128)
+ */