PropWare  3.0.0.229
C++ objects and CMake build system for Parallax Propeller
oled_asmfast.c
1 //
2 // automatically generated by spin2cpp v1.93 on Tue Aug 11 09:49:47 2015
3 // spin2cpp --ccode --main demo.spin
4 //
5 
6 // * charlieplexing driver for LEDs
7 // oled : "jm_ssd1306_spi_ez" ' OLED display driver
8 /*
9 ************************************************
10 * screen (well, faster) *
11 * Thomas P. Sullivan *
12 * Copyright (c) 2012 *
13 * Some original comments left/modified *
14 * See end of file for terms of use. *
15 ************************************************
16 Revision History:
17  V1.0 - Original program 12-2-2012
18  V1.1 - Changes to comments and modification
19  of a few commands.
20  V1.2 - Added support for the 128x64 display 12-16-2012
21 
22 This is a Propeller driver object for the Adafruit
23 SSDD1306 OLED Display. It has functions to draw
24 individual pixels, lines, and rectangles. It also
25 has character functions to print 16x32 characters
26 derived from the Propeller's internal fonts.
27 
28 
29  ┌─────────────────────────┐
30  │ SSD1306 │
31  │ Adafruit │
32  │ 128x32 │
33  │ OLED Display │
34  │ │
35  │ RST CLK VIN GND │
36  │ CS D/C DATA 3.3 │
37  └─┬──┬──┬──┬──┬──┬──┬──┬──┘
38  │ │ │ │ │ │ │ │
39 
40 
41 This file is based on the following code sources:
42 ************************************************
43 * Propeller SPI Engine v1.2 *
44 * Author: Beau Schwabe *
45 * Copyright (c) 2009 Parallax *
46 * See end of file for terms of use. *
47 ************************************************
48 
49 ...and this code:
50 
51 *********************************************************************
52 This is a library for our Monochrome OLEDs based on SSD1306 drivers
53 
54  Pick one up today in the adafruit shop!
55  ------> http://www.adafruit.com/category/63_98
56 
57 These displays use SPI to communicate, 4 or 5 pins are required to
58 interface
59 
60 Adafruit invests time and resources providing this open source code,
61 please support Adafruit and open-source hardware by purchasing
62 products from Adafruit!
63 
64 Written by Limor Fried/Ladyada for Adafruit Industries.
65 BSD license, check license.txt for more information
66 All text above, and the splash screen below must be included in
67 any redistribution
68 *********************************************************************
69 Note: The splash screen is way down in the DAT section of this file.
70 
71  */
72 #include <stdlib.h>
73 #include <propeller.h>
74 #include "badgetools.h"
75 
76 screen *screen_dataAddr(); // Added 8/23 5:12 PM
77 
78 //int screen_string8x1( char *str, int len);
79 //int screen_string8x2v2(char *str, int32_t len, int32_t row, int32_t col);
80 
81 
82 uint8_t oleddat[] = {
83  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
84  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
85  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
86  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
87  0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
88  0x00, 0x80, 0x80, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
89  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
90  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
91  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
92  0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xf8, 0xe0, 0x00, 0x00, 0x00, 0x00,
93  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80,
94  0x80, 0x80, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0xff,
95  0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00,
96  0x80, 0xff, 0xff, 0x80, 0x80, 0x00, 0x80, 0x80, 0x00, 0x80, 0x80, 0x80, 0x80, 0x00, 0x80, 0x80,
97  0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x8c, 0x8e, 0x84, 0x00, 0x00, 0x80, 0xf8,
98  0xf8, 0xf8, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
99  0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xe0, 0xe0, 0xc0, 0x80,
100  0x00, 0xe0, 0xfc, 0xfe, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
101  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xc7, 0x01, 0x01,
102  0x01, 0x01, 0x83, 0xff, 0xff, 0x00, 0x00, 0x7c, 0xfe, 0xc7, 0x01, 0x01, 0x01, 0x01, 0x83, 0xff,
103  0xff, 0xff, 0x00, 0x38, 0xfe, 0xc7, 0x83, 0x01, 0x01, 0x01, 0x83, 0xc7, 0xff, 0xff, 0x00, 0x00,
104  0x01, 0xff, 0xff, 0x01, 0x01, 0x00, 0xff, 0xff, 0x07, 0x01, 0x01, 0x01, 0x00, 0x00, 0x7f, 0xff,
105  0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x7f, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x01, 0xff,
106  0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
107  0x03, 0x0f, 0x3f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xc7, 0xc7, 0x8f,
108  0x8f, 0x9f, 0xbf, 0xff, 0xff, 0xc3, 0xc0, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xfc, 0xfc,
109  0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xf8, 0xf8, 0xf0, 0xf0, 0xe0, 0xc0, 0x00, 0x01, 0x03, 0x03, 0x03,
110  0x03, 0x03, 0x01, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03, 0x03, 0x01, 0x01,
111  0x03, 0x01, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x03, 0x03, 0x01, 0x01, 0x03, 0x03, 0x00, 0x00,
112  0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
113  0x03, 0x03, 0x03, 0x03, 0x03, 0x01, 0x00, 0x00, 0x00, 0x01, 0x03, 0x01, 0x00, 0x00, 0x00, 0x03,
114  0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
115  0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x1f, 0x0f,
116  0x87, 0xc7, 0xf7, 0xff, 0xff, 0x1f, 0x1f, 0x3d, 0xfc, 0xf8, 0xf8, 0xf8, 0xf8, 0x7c, 0x7d, 0xff,
117  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x3f, 0x0f, 0x07, 0x00, 0x30, 0x30, 0x00, 0x00,
118  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
119  0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
120  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xc0, 0x00,
121  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00,
122  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
123  0x00, 0xc0, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x7f, 0x3f, 0x1f,
124  0x0f, 0x07, 0x1f, 0x7f, 0xff, 0xff, 0xf8, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xf8, 0xe0,
125  0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00,
126  0x00, 0xfc, 0xfe, 0xfc, 0x0c, 0x06, 0x06, 0x0e, 0xfc, 0xf8, 0x00, 0x00, 0xf0, 0xf8, 0x1c, 0x0e,
127  0x06, 0x06, 0x06, 0x0c, 0xff, 0xff, 0xff, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 0xfc,
128  0xfe, 0xfc, 0x00, 0x18, 0x3c, 0x7e, 0x66, 0xe6, 0xce, 0x84, 0x00, 0x00, 0x06, 0xff, 0xff, 0x06,
129  0x06, 0xfc, 0xfe, 0xfc, 0x0c, 0x06, 0x06, 0x06, 0x00, 0x00, 0xfe, 0xfe, 0x00, 0x00, 0xc0, 0xf8,
130  0xfc, 0x4e, 0x46, 0x46, 0x46, 0x4e, 0x7c, 0x78, 0x40, 0x18, 0x3c, 0x76, 0xe6, 0xce, 0xcc, 0x80,
131  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
132  0x00, 0x00, 0x00, 0x00, 0x01, 0x07, 0x0f, 0x1f, 0x1f, 0x3f, 0x3f, 0x3f, 0x3f, 0x1f, 0x0f, 0x03,
133  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00,
134  0x00, 0x0f, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x03, 0x07, 0x0e, 0x0c,
135  0x18, 0x18, 0x0c, 0x06, 0x0f, 0x0f, 0x0f, 0x00, 0x00, 0x01, 0x0f, 0x0e, 0x0c, 0x18, 0x0c, 0x0f,
136  0x07, 0x01, 0x00, 0x04, 0x0e, 0x0c, 0x18, 0x0c, 0x0f, 0x07, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00,
137  0x00, 0x0f, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x00, 0x07,
138  0x07, 0x0c, 0x0c, 0x18, 0x1c, 0x0c, 0x06, 0x06, 0x00, 0x04, 0x0e, 0x0c, 0x18, 0x0c, 0x0f, 0x07,
139  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
140  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
141  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
142  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
143  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
144  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
145  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
146  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
147  0xf0, 0xab, 0xbc, 0x0a, 0x00, 0x00, 0x68, 0x5c, 0x5d, 0x0a, 0xfc, 0x54, 0x55, 0xac, 0xbc, 0xa0,
148  0x05, 0xae, 0xfc, 0xa0, 0x56, 0xba, 0xbc, 0x08, 0x53, 0x0a, 0xbc, 0x80, 0x04, 0xac, 0xfc, 0x80,
149  0x05, 0xae, 0xfc, 0xe4, 0x10, 0xaa, 0xfc, 0x28, 0x01, 0xaa, 0x7c, 0x86, 0x10, 0x00, 0x68, 0x5c,
150  0x02, 0xaa, 0x7c, 0x86, 0x2e, 0x00, 0x68, 0x5c, 0xf0, 0xa5, 0x3c, 0x08, 0x00, 0x00, 0x7c, 0x5c,
151  0x01, 0xaa, 0xfc, 0xa0, 0x5d, 0xaa, 0xbc, 0x2c, 0x55, 0xaa, 0x3c, 0x61, 0x55, 0xec, 0xbf, 0x70,
152  0x55, 0xe8, 0xbf, 0x70, 0x01, 0xac, 0xfc, 0xa0, 0x5e, 0xac, 0xbc, 0x2c, 0x56, 0xac, 0x3c, 0x61,
153  0x56, 0xec, 0xbf, 0x70, 0x56, 0xe8, 0xbf, 0x70, 0x01, 0xb4, 0xfc, 0xa0, 0x5f, 0xb4, 0xbc, 0x2c,
154  0x5a, 0xb4, 0x3c, 0x61, 0x5a, 0xec, 0xbf, 0x70, 0x5a, 0xe8, 0xbf, 0x74, 0x61, 0xae, 0xbc, 0xa0,
155  0x80, 0xb2, 0xfc, 0xa0, 0x08, 0xb0, 0xfc, 0xa0, 0x59, 0xae, 0x3c, 0x61, 0x55, 0xe8, 0xbf, 0x70,
156  0x01, 0xb2, 0xfc, 0x28, 0x56, 0xac, 0x3c, 0x61, 0x56, 0xe8, 0xbf, 0x74, 0x56, 0xac, 0x3c, 0x61,
157  0x56, 0xe8, 0xbf, 0x70, 0x22, 0xb0, 0xfc, 0xe4, 0x5a, 0xb4, 0x3c, 0x61, 0x5a, 0xe8, 0xbf, 0x70,
158  0xf0, 0xa5, 0x3c, 0x08, 0x00, 0x00, 0x7c, 0x5c, 0x01, 0xaa, 0xfc, 0xa0, 0x5d, 0xaa, 0xbc, 0x2c,
159  0x55, 0xaa, 0x3c, 0x61, 0x55, 0xec, 0xbf, 0x70, 0x55, 0xe8, 0xbf, 0x70, 0x01, 0xac, 0xfc, 0xa0,
160  0x5e, 0xac, 0xbc, 0x2c, 0x56, 0xac, 0x3c, 0x61, 0x56, 0xec, 0xbf, 0x70, 0x56, 0xe8, 0xbf, 0x70,
161  0x01, 0xb4, 0xfc, 0xa0, 0x5f, 0xb4, 0xbc, 0x2c, 0x5a, 0xb4, 0x3c, 0x61, 0x5a, 0xec, 0xbf, 0x70,
162  0x5a, 0xe8, 0xbf, 0x70, 0x61, 0xb6, 0xbc, 0xa0, 0x54, 0xb8, 0xbc, 0xa0, 0x5b, 0xae, 0xbc, 0x00,
163  0x01, 0xb6, 0xfc, 0x80, 0x5a, 0xb4, 0x3c, 0x61, 0x5a, 0xe8, 0xbf, 0x74, 0x80, 0xb2, 0xfc, 0xa0,
164  0x08, 0xb0, 0xfc, 0xa0, 0x59, 0xae, 0x3c, 0x61, 0x55, 0xe8, 0xbf, 0x70, 0x01, 0xb2, 0xfc, 0x28,
165  0x56, 0xac, 0x3c, 0x61, 0x56, 0xe8, 0xbf, 0x74, 0x56, 0xac, 0x3c, 0x61, 0x56, 0xe8, 0xbf, 0x70,
166  0x45, 0xb0, 0xfc, 0xe4, 0x5a, 0xb4, 0x3c, 0x61, 0x5a, 0xe8, 0xbf, 0x70, 0x3f, 0xb8, 0xfc, 0xe4,
167  0xf0, 0xa5, 0x3c, 0x08, 0x00, 0x00, 0x7c, 0x5c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
168  0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
169  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
170  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
171  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
172  0xff, 0xfc, 0xf8, 0xe0, 0xc0, 0x80, 0x00, 0x00, 0xff, 0xa5, 0x99, 0xa5, 0xff, 0x00, 0x00, 0x00,
173  0x01, 0x07, 0x0f, 0x3f, 0xff, 0x00, 0x00, 0x00, 0x81, 0x42, 0x24, 0x18, 0x18, 0x00, 0x00, 0x00,
174  0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
175  0xff, 0x81, 0x81, 0x81, 0xff, 0x00, 0x00, 0x00, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x00, 0x00, 0x00,
176  0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x00, 0x00, 0x00, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x00, 0x00, 0x00,
177  0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x00, 0x00, 0x00, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x00, 0x00, 0x00,
178  0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x00, 0x00, 0x00, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x00, 0x00, 0x00,
179  0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
180  0x7e, 0xbd, 0xdb, 0xe7, 0xe7, 0x00, 0x00, 0x00, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x00, 0x00, 0x00,
181  0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, 0xe7, 0x99, 0xe7, 0xff, 0x00, 0x00, 0x00,
182  0xff, 0xff, 0x81, 0x81, 0xff, 0x00, 0x00, 0x00, 0xff, 0x81, 0x81, 0xff, 0xff, 0x00, 0x00, 0x00,
183  0xff, 0x81, 0x81, 0x81, 0xff, 0x00, 0x00, 0x00, 0xff, 0x81, 0x81, 0x81, 0xff, 0x00, 0x00, 0x00,
184  0xff, 0x81, 0x81, 0x81, 0xff, 0x00, 0x00, 0x00, 0xff, 0x81, 0x81, 0x81, 0xff, 0x00, 0x00, 0x00,
185  0xff, 0x81, 0x81, 0x81, 0xff, 0x00, 0x00, 0x00, 0xff, 0x81, 0x81, 0x81, 0xff, 0x00, 0x00, 0x00,
186  0xff, 0x81, 0x81, 0x81, 0xff, 0x00, 0x00, 0x00, 0xff, 0x81, 0x81, 0x81, 0xff, 0x00, 0x00, 0x00,
187  0xff, 0x81, 0x81, 0x81, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
188  0x5f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x05, 0x00, 0x03, 0x05, 0x00, 0x00, 0x00,
189  0x14, 0x3e, 0x14, 0x3e, 0x14, 0x00, 0x00, 0x00, 0x24, 0x2a, 0x7f, 0x2a, 0x12, 0x00, 0x00, 0x00,
190  0x63, 0x10, 0x08, 0x04, 0x63, 0x00, 0x00, 0x00, 0x36, 0x49, 0x56, 0x20, 0x50, 0x00, 0x00, 0x00,
191  0x00, 0x00, 0x05, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x22, 0x41, 0x00, 0x00, 0x00,
192  0x41, 0x22, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x18, 0x7e, 0x18, 0x24, 0x00, 0x00, 0x00,
193  0x08, 0x08, 0x3e, 0x08, 0x08, 0x00, 0x00, 0x00, 0xa0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
194  0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
195  0x60, 0x10, 0x08, 0x04, 0x03, 0x00, 0x00, 0x00, 0x3e, 0x51, 0x49, 0x45, 0x3e, 0x00, 0x00, 0x00,
196  0x00, 0x42, 0x7f, 0x40, 0x00, 0x00, 0x00, 0x00, 0x62, 0x51, 0x51, 0x49, 0x46, 0x00, 0x00, 0x00,
197  0x22, 0x49, 0x49, 0x49, 0x36, 0x00, 0x00, 0x00, 0x18, 0x14, 0x12, 0x7f, 0x10, 0x00, 0x00, 0x00,
198  0x27, 0x45, 0x45, 0x45, 0x39, 0x00, 0x00, 0x00, 0x3c, 0x4a, 0x49, 0x49, 0x30, 0x00, 0x00, 0x00,
199  0x01, 0x71, 0x09, 0x05, 0x03, 0x00, 0x00, 0x00, 0x36, 0x49, 0x49, 0x49, 0x36, 0x00, 0x00, 0x00,
200  0x06, 0x49, 0x49, 0x29, 0x1e, 0x00, 0x00, 0x00, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
201  0xb6, 0x76, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x14, 0x22, 0x41, 0x00, 0x00, 0x00,
202  0x14, 0x14, 0x14, 0x14, 0x14, 0x00, 0x00, 0x00, 0x41, 0x22, 0x14, 0x08, 0x00, 0x00, 0x00, 0x00,
203  0x02, 0x01, 0x51, 0x09, 0x06, 0x00, 0x00, 0x00, 0x3e, 0x41, 0x5d, 0x51, 0x4e, 0x00, 0x00, 0x00,
204  0x7c, 0x12, 0x11, 0x12, 0x7c, 0x00, 0x00, 0x00, 0x7f, 0x49, 0x49, 0x49, 0x36, 0x00, 0x00, 0x00,
205  0x1c, 0x22, 0x41, 0x41, 0x22, 0x00, 0x00, 0x00, 0x7f, 0x41, 0x41, 0x22, 0x1c, 0x00, 0x00, 0x00,
206  0x7f, 0x49, 0x49, 0x49, 0x41, 0x00, 0x00, 0x00, 0x7f, 0x09, 0x09, 0x09, 0x01, 0x00, 0x00, 0x00,
207  0x3e, 0x41, 0x41, 0x51, 0x32, 0x00, 0x00, 0x00, 0x7f, 0x08, 0x08, 0x08, 0x7f, 0x00, 0x00, 0x00,
208  0x41, 0x41, 0x7f, 0x41, 0x41, 0x00, 0x00, 0x00, 0x20, 0x40, 0x40, 0x40, 0x3f, 0x00, 0x00, 0x00,
209  0x7f, 0x08, 0x14, 0x22, 0x41, 0x00, 0x00, 0x00, 0x7f, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00,
210  0x7f, 0x02, 0x0c, 0x02, 0x7f, 0x00, 0x00, 0x00, 0x7f, 0x04, 0x08, 0x10, 0x7f, 0x00, 0x00, 0x00,
211  0x3e, 0x41, 0x41, 0x41, 0x3e, 0x00, 0x00, 0x00, 0x7f, 0x09, 0x09, 0x09, 0x06, 0x00, 0x00, 0x00,
212  0x3e, 0x41, 0x51, 0x21, 0x5e, 0x00, 0x00, 0x00, 0x7f, 0x09, 0x19, 0x29, 0x46, 0x00, 0x00, 0x00,
213  0x26, 0x49, 0x49, 0x49, 0x32, 0x00, 0x00, 0x00, 0x01, 0x01, 0x7f, 0x01, 0x01, 0x00, 0x00, 0x00,
214  0x3f, 0x40, 0x40, 0x40, 0x3f, 0x00, 0x00, 0x00, 0x07, 0x18, 0x60, 0x18, 0x07, 0x00, 0x00, 0x00,
215  0x3f, 0x40, 0x38, 0x40, 0x3f, 0x00, 0x00, 0x00, 0x63, 0x14, 0x08, 0x14, 0x63, 0x00, 0x00, 0x00,
216  0x03, 0x04, 0x78, 0x04, 0x03, 0x00, 0x00, 0x00, 0x61, 0x51, 0x49, 0x45, 0x43, 0x00, 0x00, 0x00,
217  0x7f, 0x7f, 0x41, 0x41, 0x41, 0x00, 0x00, 0x00, 0x03, 0x04, 0x08, 0x10, 0x60, 0x00, 0x00, 0x00,
218  0x41, 0x41, 0x41, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x10, 0x08, 0x04, 0x08, 0x10, 0x00, 0x00, 0x00,
219  0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x05, 0x00, 0x00, 0x00, 0x00,
220  0x20, 0x54, 0x54, 0x54, 0x78, 0x00, 0x00, 0x00, 0x7f, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00,
221  0x38, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x7f, 0x00, 0x00, 0x00,
222  0x38, 0x54, 0x54, 0x54, 0x58, 0x00, 0x00, 0x00, 0x08, 0x7e, 0x09, 0x09, 0x02, 0x00, 0x00, 0x00,
223  0x18, 0xa4, 0xa4, 0xa4, 0x78, 0x00, 0x00, 0x00, 0x7f, 0x04, 0x04, 0x04, 0x78, 0x00, 0x00, 0x00,
224  0x00, 0x44, 0x7d, 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x84, 0x7d, 0x00, 0x00, 0x00, 0x00,
225  0x6f, 0x10, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x41, 0x7f, 0x40, 0x00, 0x00, 0x00, 0x00,
226  0x7c, 0x04, 0x38, 0x04, 0x7c, 0x00, 0x00, 0x00, 0x7c, 0x04, 0x04, 0x04, 0x78, 0x00, 0x00, 0x00,
227  0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, 0xfc, 0x24, 0x24, 0x24, 0x18, 0x00, 0x00, 0x00,
228  0x18, 0x24, 0x24, 0x24, 0xfc, 0x00, 0x00, 0x00, 0x7c, 0x08, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00,
229  0x48, 0x54, 0x54, 0x54, 0x24, 0x00, 0x00, 0x00, 0x04, 0x3f, 0x44, 0x44, 0x20, 0x00, 0x00, 0x00,
230  0x3c, 0x40, 0x40, 0x20, 0x7c, 0x00, 0x00, 0x00, 0x1c, 0x20, 0x40, 0x20, 0x1c, 0x00, 0x00, 0x00,
231  0x7c, 0x40, 0x30, 0x40, 0x7c, 0x00, 0x00, 0x00, 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, 0x00, 0x00,
232  0x1c, 0xa0, 0xa0, 0xa0, 0x7c, 0x00, 0x00, 0x00, 0x44, 0x64, 0x54, 0x4c, 0x44, 0x00, 0x00, 0x00,
233  0x08, 0x3e, 0x77, 0x41, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
234  0x41, 0x41, 0x77, 0x3e, 0x08, 0x00, 0x00, 0x00, 0x04, 0x02, 0x06, 0x04, 0x02, 0x00, 0x00, 0x00,
235  0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00,
236 };
237 
238 volatile screen badgeScreen;
239 volatile screen *self;
240 volatile int screenLock = 0;
241 
242 //static int32_t screen_setcommand( int32_t cmd, int32_t argptr);
243 int32_t screen_setcommand( int32_t cmd, int32_t argptr);
244 
245 // ------------------------------------------------------------------------------------------------------------------------------
246 
247 int32_t screen_SHIFTOUT(int32_t Dpin, int32_t Cpin, int32_t CSpin, int32_t Bits, int32_t Value)
248 {
249  int32_t _parm__0012[5];
250  _parm__0012[0] = Dpin;
251  _parm__0012[1] = Cpin;
252  _parm__0012[2] = CSpin;
253  _parm__0012[3] = Bits;
254  _parm__0012[4] = Value;
255  screen_setcommand(1, (int32_t)(&_parm__0012[0]));
256  return 0;
257 }
258 
259 int32_t screen_WRITEBUFF(int32_t Dpin, int32_t Cpin, int32_t CSpin, int32_t Bits, int32_t Addr)
260 {
261  int32_t _parm__0013[5];
262  _parm__0013[0] = Dpin;
263  _parm__0013[1] = Cpin;
264  _parm__0013[2] = CSpin;
265  _parm__0013[3] = Bits;
266  _parm__0013[4] = Addr;
267  screen_setcommand(2, (int32_t)(&_parm__0013[0]));
268  return 0;
269 }
270 
271 int32_t screen_start(void)
272 {
273  self = &badgeScreen;
274  int32_t okay = 0;
275  // Start SPI Engine - starts a cog
276  // returns false if no cog available
277  screen_stop();
278  okay = (self->cog = cognew((int32_t)(&(*(int32_t *)&oleddat[1024])), (int32_t)(&self->command)) + 1);
279  screenLock = locknew();
280  lockclr(screenLock);
281  return okay;
282 }
283 
284 int32_t screen_setcommand(int32_t cmd, int32_t argptr)
285 {
286  // Write command and pointer
287 
288 // while(lockset(screenLock));
289  self->command = (cmd << 16) + argptr;
290  while (self->command)
291  {
292  Yield__();
293  }
294 // lockclr(screenLock);
295  return 0;
296 }
297 
298 // Wait for command to be cleared, signifying receipt
299 int32_t screen_init(int32_t ChipSelect, int32_t DataCommand, int32_t TheData, int32_t TheClock, int32_t Reset, int32_t VCC_state, int32_t Type)
300 {
301  // Startup the SPI system
302  screen_start();
303  // Initialize variables and initialize the display
304  self->CS = ChipSelect;
305  self->DC = DataCommand;
306  self->DATA = TheData;
307  self->CLK = TheClock;
308  self->RST = Reset;
309  self->vccstate = VCC_state;
310  self->displayType = Type;
311  if (self->displayType == TYPE_128X32) {
312  self->displayWidth = SSD1306_LCDWIDTH;
313  self->displayHeight = SSD1306_LCDHEIGHT32;
314  } else {
315  self->displayWidth = SSD1306_LCDWIDTH;
316  self->displayHeight = SSD1306_LCDHEIGHT64;
317  }
318  // Setup reset and pin direction
319  screen_HIGH(self->RST);
320  // VDD (3.3V) goes high at start; wait for a ms
321  waitcnt(((CLKFREQ / 100000) + CNT));
322  // force reset low
323  screen_LOW(self->RST);
324  // wait 10ms
325  waitcnt(((CLKFREQ / 100000) + CNT));
326  // remove reset
327  screen_HIGH(self->RST);
328  if (self->displayType == TYPE_128X32) {
329  // ************************************
330  // Init sequence for 128x32 OLED module
331  // ************************************
332  screen_ssd1306_Command(SSD1306_DISPLAYOFF);
333  screen_ssd1306_Command(SSD1306_SETDISPLAYCLOCKDIV);
334  screen_ssd1306_Command(128);
335  screen_ssd1306_Command(SSD1306_SETMULTIPLEX);
336  screen_ssd1306_Command(31);
337  screen_ssd1306_Command(SSD1306_SETDISPLAYOFFSET);
338  screen_ssd1306_Command(0);
339  screen_ssd1306_Command((SSD1306_SETSTARTLINE | 0x0));
340  screen_ssd1306_Command(SSD1306_CHARGEPUMP);
341  if (self->vccstate == SSD1306_EXTERNALVCC) {
342  screen_ssd1306_Command(16);
343  } else {
344  screen_ssd1306_Command(20);
345  }
346  screen_ssd1306_Command(SSD1306_MEMORYMODE);
347  screen_ssd1306_Command(0);
348  screen_ssd1306_Command((SSD1306_SEGREMAP | 0x1));
349  screen_ssd1306_Command(SSD1306_COMSCANDEC);
350  screen_ssd1306_Command(SSD1306_SETCOMPINS);
351  screen_ssd1306_Command(2);
352  screen_ssd1306_Command(SSD1306_SETCONTRAST);
353  screen_ssd1306_Command(143);
354  screen_ssd1306_Command(SSD1306_SETPRECHARGE);
355  if (self->vccstate == SSD1306_EXTERNALVCC) {
356  screen_ssd1306_Command(34);
357  } else {
358  // SSD1306_SWITCHCAPVCC
359  screen_ssd1306_Command(241);
360  }
361  screen_ssd1306_Command(SSD1306_SETVCOMDETECT);
362  screen_ssd1306_Command(64);
363  screen_ssd1306_Command(SSD1306_DISPLAYALLON_RESUME);
364  screen_ssd1306_Command(SSD1306_NORMALDISPLAY);
365  // --turn on oled panel
366  screen_ssd1306_Command(SSD1306_DISPLAYON);
367  } else {
368  // ************************************
369  // Init sequence for 128x64 OLED module
370  // ************************************
371  screen_ssd1306_Command(SSD1306_DISPLAYOFF);
372  // low col = 0
373  screen_ssd1306_Command(SSD1306_SETLOWCOLUMN);
374  // hi col = 0
375  screen_ssd1306_Command(SSD1306_SETHIGHCOLUMN);
376  // line #0
377  screen_ssd1306_Command(SSD1306_SETSTARTLINE);
378  screen_ssd1306_Command(SSD1306_SETCONTRAST);
379  if (self->vccstate == SSD1306_EXTERNALVCC) {
380  screen_ssd1306_Command(159);
381  } else {
382  screen_ssd1306_Command(207);
383  }
384  screen_ssd1306_Command(161);
385  screen_ssd1306_Command(SSD1306_NORMALDISPLAY);
386  screen_ssd1306_Command(SSD1306_DISPLAYALLON_RESUME);
387  screen_ssd1306_Command(SSD1306_SETMULTIPLEX);
388  screen_ssd1306_Command(63);
389  screen_ssd1306_Command(SSD1306_SETDISPLAYOFFSET);
390  // No offset
391  screen_ssd1306_Command(0);
392  screen_ssd1306_Command(SSD1306_SETDISPLAYCLOCKDIV);
393  screen_ssd1306_Command(128);
394  screen_ssd1306_Command(SSD1306_SETPRECHARGE);
395  if (self->vccstate == SSD1306_EXTERNALVCC) {
396  screen_ssd1306_Command(34);
397  } else {
398  screen_ssd1306_Command(241);
399  }
400  screen_ssd1306_Command(SSD1306_SETVCOMDETECT);
401  screen_ssd1306_Command(64);
402  screen_ssd1306_Command(SSD1306_SETCOMPINS);
403  screen_ssd1306_Command(18);
404  screen_ssd1306_Command(SSD1306_MEMORYMODE);
405  screen_ssd1306_Command(0);
406  screen_ssd1306_Command((SSD1306_SEGREMAP | 0x1));
407  screen_ssd1306_Command(SSD1306_COMSCANDEC);
408  screen_ssd1306_Command(SSD1306_CHARGEPUMP);
409  if (self->vccstate == SSD1306_EXTERNALVCC) {
410  screen_ssd1306_Command(16);
411  } else {
412  screen_ssd1306_Command(20);
413  }
414  // --turn on oled panel
415  screen_ssd1306_Command(SSD1306_DISPLAYON);
416  }
417  self->crsrX = 0;
418  self->crsrY = 0;
419  self->charSize = LARGE;
420  invert(0);
421  //screen_AutoUpdateOff(); // commented 8/23 5:26 PM
422  //clear();
423  return 0;
424 }
425 
426 int32_t screen_update(void)
427 {
428  while(lockset(screenLock));
429  int32_t _local__0014[2] = {0, 0};
430  // Writes the screen buffer to the memory of the display
431  // low col = 0
432  screen_ssd1306_Command(SSD1306_SETLOWCOLUMN);
433  // hi col = 0
434  screen_ssd1306_Command(SSD1306_SETHIGHCOLUMN);
435  // line #0
436  screen_ssd1306_Command(SSD1306_SETSTARTLINE);
437  screen_HIGH(self->DC);
438  screen_WRITEBUFF(self->DATA, self->CLK, self->CS, (int32_t)(&_local__0014[1]), (int32_t)(&self->buffer[0]));
439  //screen_WRITEBUFF(self->DATA, self->CLK, self->CS, 8192, (int32_t)(&self->buffer[0]));
440  screen_LOW(self->DC);
441  lockclr(screenLock);
442  return 0;
443 }
444 
445 int32_t screen_HIGH(int32_t Pin)
446 {
447  // Make a pin an output and drives it high
448  DIRA = ((DIRA & (~(1 << Pin))) | (1 << Pin));
449  OUTA = ((OUTA & (~(1 << Pin))) | (1 << Pin));
450  return 0;
451 }
452 
453 int32_t screen_LOW(int32_t Pin)
454 {
455  // Make a pin an output and drives it low
456  DIRA = ((DIRA & (~(1 << Pin))) | (1 << Pin));
457  OUTA &= ~(1<<Pin);
458  return 0;
459 }
460 
461 int32_t screen_ssd1306_Command(int32_t thecmd)
462 {
463  int32_t _local__0016[1];
464  // Send a byte as a command to the display
465  // Write SPI command to the OLED
466  screen_LOW(self->DC);
467  screen_SHIFTOUT(self->DATA, self->CLK, self->CS, (int32_t)(&_local__0016[0]), thecmd);
468  return 0;
469 }
470 
471 int32_t screen_ssd1306_Data(int32_t thedata)
472 {
473  int32_t _local__0017[1];
474  // Send a byte as data to the display
475  // Write SPI data to the OLED
476  screen_HIGH(self->DC);
477  screen_SHIFTOUT(self->DATA, self->CLK, self->CS, (int32_t)(&_local__0017[0]), thedata);
478  return 0;
479 }
480 
481 
482 //
483 //
484 
485 
486 
487 // $7F
488 /*
489 ┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
490 │ TERMS OF USE: MIT License │
491 ├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
492 │Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation │
493 │files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, │
494 │modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software│
495 │is furnished to do so, subject to the following conditions: │
496 │ │
497 │The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.│
498 │ │
499 │THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE │
500 │WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR │
501 │COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, │
502 │ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. │
503 └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
504  */
505 
506 
invert
void invert(int i)
Invert (or not) the pixel colors in the display. Use invert(0) for white pixels on a black background...
Definition: oled_invert.c:7
OUTA
#define OUTA
Use to set output pin states when corresponding DIRA bits are 1.
Definition: propeller1.h:157
LARGE
#define LARGE
For setting oLED character size to 32x16 pixels. Example: text_size(LARGE).
Definition: badgetools.h:192
cognew
#define cognew(code, param)
Start a new Propeller PASM COG.
Definition: propeller.h:94
lockset
#define lockset(lockid)
Set a lock.
Definition: propeller.h:163
CLKFREQ
#define CLKFREQ
Returns the current clock frequency.
Definition: propeller.h:46
lockclr
#define lockclr(lockid)
Clear lock.
Definition: propeller.h:170
badgetools.h
This library provides convenient functions for a variety of Parallax eBadge operations.
waitcnt
#define waitcnt(a)
Wait until system counter reaches a value.
Definition: propeller.h:176
screen_update
int screen_update(void)
Manually update the screen image after. Typically used after multiple oLED function calls after scree...
Definition: oled_asmfast.c:426
CNT
#define CNT
The system clock count.
Definition: propeller1.h:151
locknew
#define locknew()
Get a new lock from the pool of Propeller hardware locks.
Definition: propeller.h:147
DIRA
#define DIRA
Use to set pins to input (0) or output (1).
Definition: propeller1.h:161
screen
Definition: badgetools.h:1709