Features and usage notes
Hardware: a full color OLED built in a button
This board has a module that combines a button and a full color organic LED display, plus input/output screw terminals for connecting external electronics.
The mechanical button itself is nicely built, with a translucent black housing. When pressed, it gives satisfying tactile feedback.
The display, built in the button itself, can show 64 by 48 pixel images with up to 65k colors (16-bit depth).
With the screw terminals, you can toggle an external circuit on and off.
Software: frame buffering
The internal frame buffer on the OLED display holds 96x64 pixels with 2 bytes of 565 formatted color information for each. When displaying an image the size of the display, (64x48) the image will be displayed well, unless scrolled. To scroll an image without having random pixels from unused space in the internal frame buffer, load a 96x64 image onto the OLED Switch click with your desired image centered like the blue colored area in the picture below.
Programming
This code snippet takes a 565 formatted 16-bit bitmap and displays it on the OLED display, and then scrolls the image across the display.
1 #define BIG_IMG_SIZE 12288
2
3 void main()
4 {
5 //Local Declarations
6 scroll_t scroll; //Used for scroll settings
7
8 scroll.col_horiz_shift = 0x01; //Shift left to right
9 scroll.row_offset = 0; //No offset of rows
10 scroll.row_horiz_shift = 64; //64: BIG IMAGE, 47:SMALL ( SMALL doesn't work well, because of firmware on click side )
11 scroll.row_vert_shift = 0; //No vertical shifting
12 scroll.interval = 1; //1: 10 frames between each shift
13
14 //Setup
15 system_setup( BIG ); //Provide size of allocated space for images ( 64x48 or 96x64 )
16
17 oled_switch_deactivate_scrolling(); //Scrolling must be absolutely deactivated first
18 oled_switch_scrolling_setup( scroll ); //Next, setup scroll settings
19 oled_switch_draw_565_img( oled_switch_logo_big_bmp, BIG_IMG_SIZE ); //Draw the image to scroll
20 oled_switch_activate_scrolling(); //Activate scrolling on screen
21
22 while( 1 )//Forever
23 {
24
25 }
26 }
Code examples for OLED Switch click, written for MikroElektronika hardware and compilers are available on Libstock.
Pinout diagram
Notes |
Pin |
mikroBUStm
|
Pin |
Notes |
|
|
1 |
AN |
PWM |
16 |
D/C |
Data/Command |
|
RST |
2 |
RST |
INT |
15 |
|
|
|
CS |
3 |
CS |
RX |
14 |
|
|
|
SCK |
4 |
SCK |
TX |
13 |
|
|
|
MISO |
5 |
MISO |
SCL |
12 |
|
|
|
MOSI |
6 |
MOSI |
SDA |
11 |
|
|
|
+3.3V |
7 |
+3.3V |
+5V |
10 |
|
|
|
GND |
8 |
GND |
GND |
9 |
GND |
|