Yuji Notsu / Mbed 2 deprecated MARMEX_Oled_GPS_3

Dependencies:   TextLCD mbed

Embed: (wiki syntax)

« Back to documentation index

MARMEX_OB_oled Class Reference

MARMEX_OB_oled Class Reference

MARMEX_OB_oled OLED screen drawing class. More...

#include <MARMEX_OB_oled.h>

Inherits NokiaLCD.

Public Types

enum  {
  ROWS = 15, COLS = 16, WIDTH = 128, HEIGHT = 128,
  SPI_FREQUENCY = 20000000
}
 

General parameters for MARMEX_OB_oled.

More...
enum  { OFF = 0, ON }
 

Constants for power() function.

More...
enum  LCDType { LCD6100, LCD6610 }
 

LCD panel format.

More...

Public Member Functions

 MARMEX_OB_oled (PinName mosi, PinName sclk, PinName cs, PinName rst, PinName power_pin)
 Create a MARMEX_OB_oled object connected to specified SPI and DigitalOut pins.
int putc (int c)
 Write a character to the LCD.
int printf (const char *format,...)
 Write a formated string to the LCD.
void foreground (int c)
 Set the foreground colour.
void background (int c)
 Set the background colour.
void reset (void)
 reset MARMEX_OB_oled
void cls (void)
 Clear the screen and locate to 0,0.
virtual void pixel (int x, int y, int colour)
 Set a pixel on te screen.
void fill (int x, int y, int width, int height, int colour)
 Fill an area of the screen.
int width ()
 Screen width.
int height ()
 Screen height.
int columns ()
 Columns.
int rows ()
 Rows.
void power (unsigned char sw)
 Power switch for OLED backlight.
void locate (int column, int row)
 Locate to a screen column and row.

Detailed Description

MARMEX_OB_oled OLED screen drawing class.

MARMEX_OB OLED screen drawing library.

This is a driver code for MARMEX_OB_oled board OLED screen. This class inherits NokiaLCD class of mbed.org. To use this class, import the NokiaLCD class from here.. http://mbed.org/users/simon/libraries/NokiaLCD/

Example:

  #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 );
      }
  } *  
Author:
tedd
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!

SPI mode: 9bit or 8bit SPI mode can be selected by disabling/enabling "#define MARMEX_OB_SPI_8BIT_MODE". See source code in this (MARMEX_OB_oled.h) file.

Definition at line 76 of file MARMEX_OB_oled.h.


Member Enumeration Documentation

anonymous enum

General parameters for MARMEX_OB_oled.

Enumerator:
ROWS 

# of rows (lines) for displaying characters

COLS 

# of columns (width) for displaying characters

WIDTH 

screen width [pixels]

HEIGHT 

screen height [pixels]

SPI_FREQUENCY 

SPI (sclk) SPI_FREQUENCY.

Definition at line 81 of file MARMEX_OB_oled.h.

anonymous enum

Constants for power() function.

Enumerator:
OFF 

: to turning-OFF

ON 

: to turning-ON

Definition at line 90 of file MARMEX_OB_oled.h.

enum LCDType [inherited]

LCD panel format.

Enumerator:
LCD6100 

Nokia 6100, as found on sparkfun board (default)

LCD6610 

Nokia 6610, as found on olimex board.

Definition at line 45 of file NokiaLCD.h.


Constructor & Destructor Documentation

MARMEX_OB_oled ( PinName  mosi,
PinName  sclk,
PinName  cs,
PinName  rst,
PinName  power_pin 
)

Create a MARMEX_OB_oled object connected to specified SPI and DigitalOut pins.

Parameters:
mosiSPI-MOSI pin (for MAPLE board, use p5)
sclkSPI-SCLK pin (for MAPLE board, use p8)
cschip select signal (for MAPLE board, use p8(slot1), p26(slot2))
rstreset signal (for MAPLE board, use p30(slot1), p21(slot2))
power_pinbacklight power control signal (for MAPLE board, use p11(slot1), p17(slot2))

Example of MARMEX_OB_oled on MAPLE board:

  #include "mbed.h"
  #include "MARMEX_OB_oled.h"

  MARMEX_OB_oled   oled_on_maple_slot1( p5, p7,  p8, p30, p11 ); // mosi, sclk, cs, rst, power_control
  MARMEX_OB_oled   oled_on_maple_slot2( p5, p7, p26, p21, p17 ); // mosi, sclk, cs, rst, power_control
  ...
  ..

Definition at line 115 of file MARMEX_OB_oled.h.


Member Function Documentation

void background ( int  c )

Set the background colour.

Parameters:
c24-bit colour

Reimplemented from NokiaLCD.

void cls ( void   )

Clear the screen and locate to 0,0.

Reimplemented from NokiaLCD.

Definition at line 271 of file MARMEX_OB_oled.h.

int columns (  )

Columns.

Returns:
screen columns

Reimplemented from NokiaLCD.

Definition at line 356 of file MARMEX_OB_oled.h.

void fill ( int  x,
int  y,
int  width,
int  height,
int  colour 
)

Fill an area of the screen.

Parameters:
xhorizontal position from left
yvertical position from top
widthwidth in pixels
heightheight in pixels
colour24-bit colour in format 0x00RRGGBB

Reimplemented from NokiaLCD.

Definition at line 300 of file MARMEX_OB_oled.h.

void foreground ( int  c )

Set the foreground colour.

Parameters:
c24-bit colour

Reimplemented from NokiaLCD.

int height (  )

Screen height.

Returns:
screen height [pixel]

Reimplemented from NokiaLCD.

Definition at line 349 of file MARMEX_OB_oled.h.

void locate ( int  column,
int  row 
) [inherited]

Locate to a screen column and row.

Parameters:
columnThe horizontal position from the left, indexed from 0
rowThe vertical position from the top, indexed from 0

Definition at line 254 of file NokiaLCD.cpp.

virtual void pixel ( int  x,
int  y,
int  colour 
) [virtual]

Set a pixel on te screen.

Parameters:
xhorizontal position from left
yvertical position from top
colour24-bit colour in format 0x00RRGGBB

Reimplemented from NokiaLCD.

Definition at line 284 of file MARMEX_OB_oled.h.

void power ( unsigned char  sw )

Power switch for OLED backlight.

Parameters:
swargument can be MARMEX_OB_oled::ON or MARMEX_OB_oled::OFF

Definition at line 373 of file MARMEX_OB_oled.h.

int printf ( const char *  format,
  ... 
)

Write a formated string to the LCD.

Parameters:
formatA printf-style format string, followed by the variables to use in formating the string.

!!! 16th character in the string will be disappeared !!! This problem is due to difference of screen size NokiaLCD library and its internal mechanism...

Reimplemented from NokiaLCD.

int putc ( int  c )

Write a character to the LCD.

Parameters:
cThe character to write to the display

Reimplemented from NokiaLCD.

void reset ( void   )

reset MARMEX_OB_oled

Executes hardware reset and initialize. See MARMEX_OB_oled manual for the initialization sequence and values For gamma correction table, using math function to make the code simple

Reimplemented from NokiaLCD.

Definition at line 158 of file MARMEX_OB_oled.h.

int rows (  )

Rows.

Returns:
screen rows

Reimplemented from NokiaLCD.

Definition at line 364 of file MARMEX_OB_oled.h.

int width (  )

Screen width.

Returns:
screen width [pixel]

Reimplemented from NokiaLCD.

Definition at line 341 of file MARMEX_OB_oled.h.