├── .github
└── workflows
│ └── mkdocs.yml
├── CONTRIBUTING.md
├── LICENSE.md
├── README.md
├── docs
├── api_arduino.md
├── api_device.md
├── api_draw.md
├── api_graphics.md
├── api_scroll.md
├── assets
│ ├── MicroMod-logo-updated.png
│ ├── Qwiic-registered-updated.png
│ └── sfe_favicon.png
├── github
│ ├── contribute.md
│ └── file_issue.md
├── hug_0p91.md
├── hug_1p3.md
├── hug_micro_view.md
├── hug_transparent.md
├── img
│ ├── OLEDLibBanner.png
│ └── sfe_logo_sm.png
├── index.md
├── introduction.md
├── javascript
│ ├── README.md
│ └── mathjax.js
├── single_page.md
├── software.md
├── stylesheet
│ └── extra.css
└── troubleshooting.md
├── examples
├── Example-01_Hello
│ └── Example-01_Hello.ino
├── Example-02_Shapes
│ └── Example-02_Shapes.ino
├── Example-03_Bitmap
│ └── Example-03_Bitmap.ino
├── Example-04_Text
│ └── Example-04_Text.ino
├── Example-05_ScrollFlip
│ └── Example-05_ScrollFlip.ino
├── Example-06_Clock
│ └── Example-06_Clock.ino
├── Example-07_Cube
│ └── Example-07_Cube.ino
├── Example-08_Multi
│ └── Example-08_Multi.ino
├── Example-09_CustomOLED
│ └── Example-09_CustomOLED.ino
├── docs
│ ├── ex_01_hello.md
│ ├── ex_02_lines.md
│ ├── ex_03_bitmaps.md
│ ├── ex_04_text.md
│ ├── ex_other.md
│ └── img
│ │ └── ex01_hello.png
└── mkdocs.yml
├── img
└── Contributing.JPG
├── keywords.txt
├── library.json
├── library.properties
├── mkdocs.yml
├── overrides
├── .icons
│ └── sfe-logo.svg
├── README.md
├── main.html
└── partials
│ ├── nav.html
│ ├── tabs.html
│ └── toc-backup.html
└── src
├── SparkFun_Qwiic_OLED.h
├── qwiic_grbuffer.cpp
├── qwiic_grbuffer.h
├── qwiic_grssd1306.cpp
├── qwiic_grssd1306.h
├── qwiic_i2c.cpp
├── qwiic_i2c.h
├── qwiic_oled_1in3.h
├── qwiic_oled_custom.h
├── qwiic_oledmicro.h
├── qwiic_olednarrow.h
├── qwiic_oledtransp.h
└── res
├── _bmp_sparkfun.h
├── _bmp_truck.h
├── _fnt_31x48.h
├── _fnt_5x7.h
├── _fnt_7segment.h
├── _fnt_8x16.h
├── _fnt_largenum.h
├── qw_bmp_sparkfun.h
├── qw_bmp_truck.h
├── qw_fnt_31x48.h
├── qw_fnt_5x7.h
├── qw_fnt_7segment.h
├── qw_fnt_8x16.h
├── qw_fnt_largenum.h
├── qw_pgm_arduino.h
└── qwiic_resdef.h
/.github/workflows/mkdocs.yml:
--------------------------------------------------------------------------------
1 | name: Run mkdocs
2 | on:
3 | push:
4 | branches:
5 | - main
6 | permissions:
7 | contents: write
8 | jobs:
9 | deploy:
10 | runs-on: ubuntu-latest
11 | steps:
12 | - name: Checkout repository
13 | uses: actions/checkout@v3
14 |
15 | - name: Set up Python runtime
16 | uses: actions/setup-python@v4
17 | with:
18 | python-version: 3.x
19 |
20 | - name: Install Python dependencies
21 | run: pip install mkdocs-monorepo-plugin mkdocs-redirects mkdocs-with-pdf weasyprint mkdocs-git-authors-plugin mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 setuptools
22 |
23 | - name: Set up build cache
24 | uses: actions/cache@v2
25 | with:
26 | key: ${{ github.ref }}
27 | path: .cache
28 |
29 | - name: Install Insiders build
30 | env:
31 | GH_TOKEN: ${{ secrets.GH_TOKEN }}
32 | run: pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git
33 | - run: mkdocs gh-deploy --force
34 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # How to Contribute
2 |
3 | Thank you so *much* for offering to help out. We truly appreciate it.
4 |
5 | If you'd like to contribute, start by searching through the [issues](https://github.com/sparkfun/SparkFun_Micro_OLED_Arduino_Library/issues) and [pull requests](https://github.com/sparkfun/SparkFun_Micro_OLED_Arduino_Library/pulls) to see whether someone else has raised a similar idea or question.
6 | Please check the [closed issues](https://github.com/sparkfun/SparkFun_Micro_OLED_Arduino_Library/issues?q=is%3Aissue+is%3Aclosed)
7 | and [closed pull requests](https://github.com/sparkfun/SparkFun_Micro_OLED_Arduino_Library/pulls?q=is%3Apr+is%3Aclosed) too - you may find that your issue or feature has already been discussed.
8 |
9 | If you decide to add a feature to this library, please create a PR and follow these best practices:
10 |
11 | * Change as little as possible. Do not submit a PR that changes 100 lines of whitespace. Break up into multiple PRs if necessary.
12 | * If you've added a new feature document it with a simple example sketch. This serves both as a test of your PR and as a quick way for users to quickly learn how to use your new feature.
13 | * If you add new functions also add them to _keywords.txt_ so that they are properly highlighted in Arduino. [Read more](https://www.arduino.cc/en/Hacking/libraryTutorial).
14 | * **Important:** Please submit your PR using the [release_candidate branch](https://github.com/sparkfun/SparkFun_Micro_OLED_Arduino_Library/tree/release_candidate). That way, we can merge and test your PR quickly without changing the _master_ branch
15 |
16 | 
17 |
18 | ## Style guide
19 |
20 | Please read and follow the [Arduino API style guide](https://www.arduino.cc/en/Reference/APIStyleGuide). Also read and consider the [Arduino style guide](https://www.arduino.cc/en/Reference/StyleGuide).
21 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | SparkFun License Information
2 | ============================
3 |
4 | SparkFun uses two different licenses for our files — one for hardware and one for code.
5 |
6 | Hardware
7 | ---------
8 |
9 | **SparkFun hardware is released under [Creative Commons Share-alike 4.0 International](http://creativecommons.org/licenses/by-sa/4.0/).**
10 |
11 | Note: This is a human-readable summary of (and not a substitute for) the [license](http://creativecommons.org/licenses/by-sa/4.0/legalcode).
12 |
13 | You are free to:
14 |
15 | Share — copy and redistribute the material in any medium or format
16 | Adapt — remix, transform, and build upon the material
17 | for any purpose, even commercially.
18 | The licensor cannot revoke these freedoms as long as you follow the license terms.
19 | Under the following terms:
20 |
21 | Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
22 | ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
23 | No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
24 | Notices:
25 |
26 | You do not have to comply with the license for elements of the material in the public domain or where your use is permitted by an applicable exception or limitation.
27 | No warranties are given. The license may not give you all of the permissions necessary for your intended use. For example, other rights such as publicity, privacy, or moral rights may limit how you use the material.
28 |
29 |
30 | Code
31 | --------
32 |
33 | **SparkFun code, firmware, and software is released under the [MIT License](http://opensource.org/licenses/MIT).**
34 |
35 | The MIT License (MIT)
36 |
37 | Copyright (c) 2015 SparkFun Electronics
38 |
39 | Permission is hereby granted, free of charge, to any person obtaining a copy
40 | of this software and associated documentation files (the "Software"), to deal
41 | in the Software without restriction, including without limitation the rights
42 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
43 | copies of the Software, and to permit persons to whom the Software is
44 | furnished to do so, subject to the following conditions:
45 |
46 | The above copyright notice and this permission notice shall be included in all
47 | copies or substantial portions of the Software.
48 |
49 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
50 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
51 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
52 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
53 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
54 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
55 | SOFTWARE.
56 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 | # SparkFun Qwiic OLED Arduino Library
4 |
32 |
33 |
34 | The SparkFun Qwiic OLED Arduino Library is a single graphics module that supports all SparkFun OLED boards based on the SSD1306 from Solomon Systech. Prior to this library, three different libraries were used to support our four different OLED boards.
35 |
36 | The SparkFun Qwiic OLED Library delivers a common implementation for all our Qwiic OLED products, delivering a unified, fast, and efficient solution that implements a familiar and easy to understand user experience.
37 |
38 | ## Key Features
39 | * Implements common graphics capabilities: pixel, line, rectangle, filled rectangle, circle, filled circle, bitmap, text and raster operators (i.e. XOR).
40 | * Smart data transfer to the device – only sends _dirty_ regions of the graphics buffer to the OLED device, not the entire buffer.
41 | * High performance – 2x faster than our previous OLED library, often much higher.
42 | * Efficient memory usage. No dynamic memory utilized. Static resources are loaded once, and only on explicit declaration.
43 | * Implements a familiar interface, making migration from older libraries straight forward
44 |
45 | ## Documentation
46 | A full library use overview, API reference guide and key example walk through are available on this repositories github page - [sparkfun.github.io/SparkFun_Qwiic_OLED_Arduino_Library](https://sparkfun.github.io/SparkFun_Qwiic_OLED_Arduino_Library/)
47 |
48 | ## How much faster?
49 |
50 | The SparkFun Qwiic OLED Library is between 40% and 450% faster. The original [Micro OLED library](https://github.com/sparkfun/SparkFun_Micro_OLED_Arduino_Library) had a max output of ~75 frames per second. This library automatically only updates *what changed* we can reach more than 300 frames per second. What does that look like?
51 |
52 | https://user-images.githubusercontent.com/117102/160000377-b2de6d3f-a90f-42da-bd95-2a301c817c80.mp4
53 |
54 | Above, the OLED on the right is running the original Micro OLED library at 75fps. On the left the display is more than 348 frames per second. In real life it's quite smooth; the camera is not able to keep up. This is at 400kHz I2C.
55 |
56 | https://user-images.githubusercontent.com/117102/160000390-47a318ac-4158-4988-8831-44f7b9d32f01.mp4
57 |
58 | Above, the OLED on the right is running the original Micro OLED library at 75fps. On the left the display is more than 107 frames per second because the clock takes up a lot of the display, but not all of it. This is at 400kHz I2C.
59 |
60 | ## Supported Products
61 |
62 | * [LCD-22495](https://www.sparkfun.com/products/22495) - SparkFun Micro OLED Breakout (Qwiic)
63 | * [LCD-14532](https://www.sparkfun.com/products/14532) - SparkFun Micro OLED Breakout (Qwiic)
64 | * [LCD-13003](https://www.sparkfun.com/products/13003) - SparkFun Micro OLED Breakout
65 | * [LCD-24606](https://www.sparkfun.com/products/24606) - SparkFun Qwiic OLED Display (0.91 in, 128x32)
66 | * [LCD-17153](https://www.sparkfun.com/products/17153) - SparkFun Qwiic OLED Display (0.91 in, 128x32)
67 | * [SPX-18996](https://www.sparkfun.com/products/18996) - smôl OLED Display (0.91 in, 128x32)
68 | * [LCD-15173](https://www.sparkfun.com/products/15173) - SparkFun Transparent Graphical OLED Breakout (Qwiic)
69 | * [LCD-23453](https://www.sparkfun.com/products/23453) - SparkFun Qwiic OLED (1.3 in., 128x64)
70 |
71 | ### Supported Microcontrollers - Arduino Environment
72 |
73 | * [Artemis](https://www.sparkfun.com/products/15574)
74 | * [SAMD51](https://www.sparkfun.com/products/14713)
75 | * [ESP32](https://www.sparkfun.com/products/15663)
76 | * [STM32](https://www.sparkfun.com/products/17712)
77 | * [SAMD21](https://www.sparkfun.com/products/14812)
78 | * [nrf5280](https://www.sparkfun.com/products/15025)
79 | * [Teensy](https://www.sparkfun.com/products/16402)
80 | * [ATMega328](https://www.sparkfun.com/products/18158)
81 |
--------------------------------------------------------------------------------
/docs/api_arduino.md:
--------------------------------------------------------------------------------
1 | # Arduino Print
2 |
3 | Methods used to support Arduino Print functionality.
4 |
5 | ### setCursor()
6 |
7 | This method is called set the "cursor" position in the device. The library supports the Arduino `Print` interface, enabling the use of a `print()` and `println()` methods. The set cursor position defines where to start text output for this functionality.
8 |
9 | ```c++
10 | void setCursor(uint8_t x, uint8_t y)
11 | ```
12 |
13 | | Parameter | Type | Description |
14 | | :--- | :--- | :--- |
15 | | x | `uint8_t` | The X coordinate of the cursor|
16 | | y | `uint8_t` | The Y coordinate of the cursor|
17 |
18 | ### setColor()
19 |
20 | This method is called to set the current color of the system. This is used by the Arduino `Print` interface functionality
21 |
22 |
23 | ```c++
24 | void setColor(uint8_t clr)
25 | ```
26 |
27 | | Parameter | Type | Description |
28 | | :--- | :--- | :--- |
29 | | `clr` | `uint8_t` | The color to set. 0 = black, > 0 = white|
30 |
31 | ### getColor()
32 |
33 | This method is called to get the current color of the system. This is used by the Arduino `Print` interface functionality
34 |
35 |
36 | ```c++
37 | uint8_t getColor(void)
38 | ```
39 |
40 | | Parameter | Type | Description |
41 | | :--- | :--- | :--- |
42 | | return value| `uint8_t` | The current color|
43 |
44 |
45 |
--------------------------------------------------------------------------------
/docs/api_device.md:
--------------------------------------------------------------------------------
1 | # Device Operations
2 |
3 | Methods to setup the device, get device information and change display options.
4 |
5 | ## Initialization
6 |
7 | ### begin()
8 | This method is called to initialize the OLED library and connection to the OLED device. This method must be called before calling any graphics methods.
9 |
10 | ```c++
11 | bool begin(TwoWire &wirePort, uint8_t address)
12 | ```
13 |
14 | | Parameter | Type | Description |
15 | | :------------ | :---------- | :---------------------------------------------- |
16 | | `wirePort` | `TwoWire` | **optional**. The Wire port. If not provided, the default port is used|
17 | | `address` | `uint8_t` | **optional**. I2C Address. If not provided, the default address is used.|
18 | | return value | `bool` | ```true``` on success, ```false``` on startup failure |
19 |
20 | ### reset()
21 | When called, this method reset the library state and OLED device to their intial state. Helpful to reset the OLED after waking up a system from a sleep state.
22 |
23 | ```C++
24 | void reset()
25 | ```
26 |
27 | | Parameter | Type | Description |
28 | | :------------ | :---------- | :---------------------------------------------- |
29 | | return value | `bool` | ```true``` on success, ```false``` on startup failure |
30 |
31 |
32 | ## Geometry
33 |
34 | ### getWidth()
35 | This method returns the width, in pixels, of the connected OLED device
36 |
37 | ```c++
38 | uint8_t getWidth(void)
39 | ```
40 |
41 | | Parameter | Type | Description |
42 | | :--- | :--- | :--- |
43 | | return value | `uint8_t` | The width in pixels of the connected OLED device |
44 |
45 | ### getHeight()
46 | This method returns the height, in pixels, of the connected OLED device
47 |
48 | ```c++
49 | uint8_t getHeight(void)
50 | ```
51 |
52 | | Parameter | Type | Description |
53 | | :--- | :--- | :--- |
54 | | return value | `uint8_t` | The height in pixels of the connected OLED device |
55 |
56 | ## Display Modes
57 |
58 | ### invert()
59 | This method inverts the current graphics on the display. This results of this command happen immediatly.
60 |
61 | ```c++
62 | void invert(bool bInvert)
63 | ```
64 |
65 | | Parameter | Type | Description |
66 | | :--- | :--- | :--- |
67 | | ```bInvert``` | `bool` | ```true``` - the screen is inverted. ```false``` - the screen is set to normal |
68 |
69 | ### flipVertical()
70 | When called, the screen contents are flipped vertically if the flip parameter is true, or restored to normal display if the flip parameter is false.
71 |
72 | ```c++
73 | void flipVertical(bool bFlip)
74 | ```
75 |
76 | | Parameter | Type | Description |
77 | | :--- | :--- | :--- |
78 | | ```bFlip``` | `bool` | ```true``` - the screen is flipped vertically. ```false``` - the screen is set to normal |
79 |
80 | ### flipHorizontal()
81 | When called, the screen contents are flipped horizontally if the flip parameter is true, or restored to normal display if the flip parameter is false.
82 |
83 | ```c++
84 | void flipHorizontal(bool bFlip)
85 | ```
86 |
87 | | Parameter | Type | Description |
88 | | :--- | :--- | :--- |
89 | | ```bFlip``` | `bool` | ```true``` - the screen is flipped horizontally. ```false``` - the screen is set to normal |
90 |
91 | ### displayPower()
92 | Used to turn the OLED display on or off.
93 |
94 | ```c++
95 | void displayPower(bool bEnable)
96 | ```
97 |
98 | | Parameter | Type | Description |
99 | | :--- | :--- | :--- |
100 | | ```bEnable``` | `bool` | ```true``` - the OLED display is powered on (default). ```false``` - the OLED dsiplay is powered off. |
101 |
102 |
--------------------------------------------------------------------------------
/docs/api_draw.md:
--------------------------------------------------------------------------------
1 | # Drawing Settings/State
2 |
3 | Methods for setting the drawing state of the library.
4 |
5 | ### setFont()
6 |
7 | This method is called to set the current font in the library. The current font is used when calling the ```text()``` method on this device.
8 |
9 | The default font for the device is `5x7`.
10 |
11 | ```c++
12 | void setFont(QwiicFont& theFont)
13 | void setFont(const QwiicFont * theFont)
14 | ```
15 |
16 | | Parameter | Type | Description |
17 | | :--- | :--- | :--- |
18 | | `theFont` | `QwiicFont` | The font to set as current in the device|
19 | | `theFont` | `QwiicFont*` | Pointer to the font to set as current in the device.|
20 |
21 | For the library, fonts are added to your program by including them via include files which are part of this library.
22 |
23 | The following fonts are included:
24 |
25 | | Font | Include File | Font Variable | Description|
26 | | :--- | :--- | :--- | :--- |
27 | | 5x7 | `` | `QW_FONT_5X7`| A full, 5 x 7 font|
28 | | 31x48 | `` |`QW_FONT_31X48`| A full, 31 x 48 font|
29 | | Seven Segment | `` |`QW_FONT_7SEGMENT`| Numbers only|
30 | | 8x16 | `` | `QW_FONT_8X16`| A full, 8 x 16 font|
31 | | Large Numbers | `` |`QW_FONT_LARGENUM`| Numbers only|
32 |
33 | For each font, the font variables are objects with the following attributes:
34 |
35 | | Attribute | Value |
36 | | :--- | :--- |
37 | | `width` | The font width in pixels|
38 | | `height` | The font height in pixels|
39 | | `start` | The font start character offset|
40 | | `n_chars` | The number of characters|
41 | | `map_width` | The width of the font map|
42 |
43 | Example use of a font object attribute:
44 | ```C++
45 | #include
46 |
47 | int myFontWidth = QW_FONT_31X48.width;
48 | ```
49 |
50 | ### getFont()
51 | This method returns the current font for the device.
52 |
53 | ```c++
54 | QwiicFont * getFont(void)
55 | ```
56 |
57 | | Parameter | Type | Description |
58 | | :--- | :--- | :--- |
59 | | return value | `QwiicFont*` | A pointer to the current font. See `setFont()` for font object details.|
60 |
61 | ### getFontName()
62 |
63 | This method returns the height in pixels of a provided String based on the current device font.
64 |
65 | ```c++
66 | String getFontName(void)
67 | ```
68 |
69 | | Parameter | Type | Description |
70 | | :--- | :--- | :--- |
71 | | return value | String | The name of the current font.|
72 |
73 | ### getStringWidth()
74 |
75 | This method returns the width in pixels of a provided String based on the current device font.
76 |
77 | ```c++
78 | unsigned int getStringWidth(String text)
79 | ```
80 |
81 | | Parameter | Type | Description |
82 | | :--- | :--- | :--- |
83 | | text | `String` | The string used to determine width |
84 | | return value | `unsigned int` | The width of the provide string, as determined using the current font.|
85 |
86 | ### getStringHeight()
87 |
88 | This method returns the height in pixels of a provided String based on the current device font.
89 |
90 | ```c++
91 | unsigned int getStringHeight(String text)
92 | ```
93 |
94 | | Parameter | Type | Description |
95 | | :--- | :--- | :--- |
96 | | text | `String` | The string used to determine height |
97 | | return value | `unsigned int` | The height of the provide string, as determined using the current font.|
98 |
99 | ### setDrawMode()
100 | This method sets the current draw mode for the library. The draw mode determines how pixels are set on the screen during drawing operations.
101 |
102 | ```c++
103 | void setDrawMode(grRasterOp_t rop)
104 | ```
105 |
106 | | Parameter | Type | Description |
107 | | :--- | :--- | :--- |
108 | | rop | `grRasterOp_t` | The raster operation (ROP) to set the graphics system to.|
109 |
110 | Raster operations device how source (pixels to draw) are represented on the destination device. The available Raster Operation (ROP) codes are:
111 |
112 | | ROP Code | Description|
113 | | :--- | :--- |
114 | | grROPCopy | **default** Drawn pixel values are copied to the device screen|
115 | | grROPNotCopy | A not operation is applied to the source value before copying to screen|
116 | | grROPNot | A not operation is applied to the destination (screen) value |
117 | | grROPXOR | A XOR operation is performed between the source and destination values|
118 | | grROPBlack | A value of 0, or black is drawn to the destination |
119 | | grROPWhite | A value of 1, or black is drawn to the destination |
120 |
121 |
122 | ### getDrawMode()
123 | This method returns the current draw mode for the library. The draw mode determines how pixels are set on the screen during drawing operations.
124 |
125 | ```c++
126 | grRasterOp_t getDrawMode(void)
127 | ```
128 |
129 | | Parameter | Type | Description |
130 | | :--- | :--- | :--- |
131 | | return value | `grRasterOp_t` | The current aster operation (ROP) of the graphics system.|
132 |
--------------------------------------------------------------------------------
/docs/api_graphics.md:
--------------------------------------------------------------------------------
1 | # Graphics Methods
2 |
3 | Methods used to draw and display graphics.
4 |
5 | ### display()
6 | When called, any pending display updates are sent to the connected OLED device. This includes drawn graphics and erase commands.
7 |
8 | ```c++
9 | void display(void)
10 | ```
11 |
12 | | Parameter | Type | Description |
13 | | :--- | :--- | :--- |
14 | | NONE| | |
15 |
16 | ### erase()
17 | Erases all graphics on the device, placing the display in a blank state. The erase update isn't sent to the device until the next ```display()``` call on the device.
18 |
19 | ```c++
20 | void erase(void)
21 | ```
22 |
23 | | Parameter | Type | Description |
24 | | :--- | :--- | :--- |
25 | | NONE| | |
26 |
27 | ### pixel()
28 |
29 | Set the value of a pixel on the screen.
30 |
31 | ```c++
32 | void pixel(uint8_t x, uint8_t y, uint8_t clr)
33 | ```
34 |
35 | | Parameter | Type | Description |
36 | | :--- | :--- | :--- |
37 | | x | `uint8_t` | The X coordinate of the pixel to set|
38 | | y | `uint8_t` | The Y coordinate of the pixel to set|
39 | | clr | `uint8_t` | **optional** The color value to set the pixel. This defaults to white (1).|
40 |
41 | ### line()
42 |
43 | Draw a line on the screen.
44 |
45 | Note: If a line is horizontal (y0 = y1) or vertical (x0 = x1), optimized draw algorithms are used by the library.
46 |
47 | ```c++
48 | void line(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, uint8_t clr)
49 | ```
50 |
51 | | Parameter | Type | Description |
52 | | :--- | :--- | :--- |
53 | | x0 | `uint8_t` | The start X coordinate of the line|
54 | | y0 | `uint8_t` | The start Y coordinate of the line|
55 | | x1 | `uint8_t` | The end X coordinate of the line|
56 | | y1 | `uint8_t` | The end Y coordinate of the line|
57 | | clr | `uint8_t` | **optional** The color value to draw the line. This defaults to white (1).|
58 |
59 | ### rectangle()
60 |
61 | Draw a rectangle on the screen.
62 |
63 | ```c++
64 | void rectangle(uint8_t x0, uint8_t y0, uint8_t width, uint8_t height, uint8_t clr)
65 | ```
66 |
67 | | Parameter | Type | Description |
68 | | :--- | :--- | :--- |
69 | | x0 | `uint8_t` | The start X coordinate of the rectangle - upper left corner|
70 | | y0 | `uint8_t` | The start Y coordinate of the rectangle - upper left corner|
71 | | width | `uint8_t` | The width of the rectangle|
72 | | height | `uint8_t` | The height of the rectangle|
73 | | clr | `uint8_t` | **optional** The color value to draw the line. This defaults to white (1).|
74 |
75 | ### rectangleFill()
76 |
77 | Draw a filled rectangle on the screen.
78 |
79 | ```c++
80 | void rectangleFill(uint8_t x0, uint8_t y0, uint8_t width, uint8_t height, uint8_t clr)
81 | ```
82 |
83 | | Parameter | Type | Description |
84 | | :--- | :--- | :--- |
85 | | x0 | `uint8_t` | The start X coordinate of the rectangle - upper left corner|
86 | | y0 | `uint8_t` | The start Y coordinate of the rectangle - upper left corner|
87 | | width | `uint8_t` | The width of the rectangle|
88 | | height | `uint8_t` | The height of the rectangle|
89 | | clr | `uint8_t` | **optional** The color value to draw the line. This defaults to white (1).|
90 |
91 | ### circle()
92 |
93 | Draw a circle on the screen.
94 |
95 | ```c++
96 | void circle(uint8_t x0, uint8_t y0, uint8_t radius, uint8_t clr)
97 | ```
98 |
99 | | Parameter | Type | Description |
100 | | :--- | :--- | :--- |
101 | | x0 | `uint8_t` | The X coordinate of the circle center|
102 | | y0 | `uint8_t` | The Y coordinate of the circle center|
103 | | radius | `uint8_t` | The radius of the circle|
104 | | clr | `uint8_t` | **optional** The color value to draw the circle. This defaults to white (1).|
105 |
106 | ### circleFill()
107 |
108 | Draw a filled circle on the screen.
109 |
110 | ```c++
111 | void circleFill(uint8_t x0, uint8_t y0, uint8_t radius, uint8_t clr)
112 | ```
113 |
114 | | Parameter | Type | Description |
115 | | :--- | :--- | :--- |
116 | | x0 | `uint8_t` | The X coordinate of the circle center|
117 | | y0 | `uint8_t` | The Y coordinate of the circle center|
118 | | radius | `uint8_t` | The radius of the circle|
119 | | clr | `uint8_t` | **optional** The color value to draw the circle. This defaults to white (1).|
120 |
121 | ### bitmap()
122 |
123 | Draws a bitmap on the screen.
124 |
125 | The bitmap should be 8 bit encoded - each pixel contains 8 y values.
126 |
127 | ```c++
128 | void bitmap(uint8_t x0, uint8_t y0, uint8_t *pBitmap, uint8_t bmp_width, uint8_t bmp_height )
129 | ```
130 |
131 | | Parameter | Type | Description |
132 | | :--- | :--- | :--- |
133 | | x0 | `uint8_t` | The X coordinate to place the bitmap - upper left corner|
134 | | y0 | `uint8_t` | The Y coordinate to place the bitmap - upper left corner|
135 | | pBitmap | `uint8_t *` | A pointer to the bitmap array|
136 | | bmp_width | `uint8_t` | The width of the bitmap|
137 | | bmp_height | `uint8_t` | The height of the bitmap|
138 |
139 | ### bitmap()
140 |
141 | Draws a bitmap on the screen.
142 |
143 | The bitmap should be 8 bit encoded - each pixel contains 8 y values.
144 |
145 | The coordinate [x1,y1] allows for only a portion of bitmap to be drawn.
146 |
147 | ```c++
148 | void bitmap(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1,
149 | uint8_t *pBitmap, uint8_t bmp_width, uint8_t bmp_height )
150 | ```
151 |
152 | | Parameter | Type | Description |
153 | | :--- | :--- | :--- |
154 | | x0 | `uint8_t` | The X coordinate to place the bitmap - upper left corner|
155 | | y0 | `uint8_t` | The Y coordinate to place the bitmap - upper left corner|
156 | | x1 | `uint8_t` | The end X coordinate of the bitmap - lower right corner|
157 | | y1 | `uint8_t` | The end Y coordinate of the bitmap - lower right corner|
158 | | pBitmap | `uint8_t *` | A pointer to the bitmap array|
159 | | bmp_width | `uint8_t` | The width of the bitmap|
160 | | bmp_height | `uint8_t` | The height of the bitmap|
161 |
162 | ### bitmap()
163 |
164 | Draws a bitmap on the screen using a Bitmap object for the bitmap data.
165 |
166 | ```c++
167 | void bitmap(uint8_t x0, uint8_t y0, QwiicBitmap& bitmap)
168 | ```
169 |
170 | | Parameter | Type | Description |
171 | | :--- | :--- | :--- |
172 | | x0 | `uint8_t` | The X coordinate to place the bitmap - upper left corner|
173 | | y0 | `uint8_t` | The Y coordinate to place the bitmap - upper left corner|
174 | | Bitmap | `QwiicBitmap` | A bitmap object|
175 |
176 | ### text()
177 |
178 | Draws a string using the current font on the screen.
179 |
180 | ```c++
181 | void text(uint8_t x0, uint8_t y0, const char * text, uint8_t clr)
182 | ```
183 |
184 | | Parameter | Type | Description |
185 | | :--- | :--- | :--- |
186 | | x0 | `uint8_t` | The X coordinate to start drawing the text|
187 | | y0 | `uint8_t` | The Y coordinate to start drawing the text|
188 | | text | `const char*` | The string to draw on the screen |
189 | | text | `String` | The Arduino string to draw on the screen |
190 | | clr | `uint8_t` | **optional** The color value to draw the circle. This defaults to white (1).|
191 |
--------------------------------------------------------------------------------
/docs/api_scroll.md:
--------------------------------------------------------------------------------
1 | # Scrolling
2 |
3 | Methods for device scrolling
4 |
5 | ### scrollStop()
6 | If the device is in a scrolling mode, calling this method stops the scroll, and restores the device to normal display operation. This action is performed immediately.
7 |
8 | ```c++
9 | void scrollStop(void)
10 | ```
11 |
12 | | Parameter | Type | Description |
13 | | :--- | :--- | :--- |
14 | | NONE| | |
15 |
16 |
17 |
18 | ### scrollRight()
19 | This method is called to start the device scrolling the displayed graphics to the right. This action is performed immediately.
20 |
21 | The screen will scroll until the ```scrollStop()``` method is called.
22 |
23 | ```c++
24 | void scrollRight(uint8_t start, uint8_t stop, uint8_t interval)
25 | ```
26 |
27 | | Parameter | Type | Description |
28 | | :--- | :--- | :--- |
29 | | `start` | `uint8_t` | The start page address of the scroll - valid values are 0 thru 7|
30 | | `stop` | `uint8_t` | The stop/end page address of the scroll - valid values are 0 thru 7|
31 | | `interval` | `uint8_t` | The time interval between scroll step - values listed below |
32 |
33 | Defined values for the `interval` parameter:
34 |
35 | | Defined Symbol | Time Interval Between Steps |
36 | | :--- | :---|
37 | |`SCROLL_INTERVAL_2_FRAMES` | 2 |
38 | |`SCROLL_INTERVAL_3_FRAMES` | 3 |
39 | |`SCROLL_INTERVAL_4_FRAMES` | 4 |
40 | |`SCROLL_INTERVAL_5_FRAMES` | 5 |
41 | |`SCROLL_INTERVAL_25_FRAMES` | 25 |
42 | |`SCROLL_INTERVAL_64_FRAMES` | 64 |
43 | |`SCROLL_INTERVAL_128_FRAMES` | 128 |
44 | |`SCROLL_INTERVAL_256_FRAMES` | 256 |
45 |
46 | ### scrollVertRight()
47 | This method is called to start the device scrolling the displayed graphics vertically and to the right. This action is performed immediately.
48 |
49 | The screen will scroll until the ```scrollStop()``` method is called.
50 |
51 | ```c++
52 | void scrolVertlRight(uint8_t start, uint8_t stop, uint8_t interval)
53 | ```
54 |
55 | | Parameter | Type | Description |
56 | | :--- | :--- | :--- |
57 | | `start` | `uint8_t` | The start page address of the scroll - valid values are 0 thru 7|
58 | | `stop` | `uint8_t` | The stop/end page address of the scroll - valid values are 0 thru 7|
59 | | `interval` | `uint8_t` | The time interval between scroll step - values listed in ```scrollRight``` |
60 |
61 | ### scrollLeft()
62 | This method is called start to the device scrolling the displayed graphics to the left. This action is performed immediately.
63 |
64 | The screen will scroll until the ```scrollStop()``` method is called.
65 |
66 | ```c++
67 | void scrollLeft(uint8_t start, uint8_t stop, uint8_t interval)
68 | ```
69 |
70 | | Parameter | Type | Description |
71 | | :--- | :--- | :--- |
72 | | `start` | `uint8_t` | The start page address of the scroll - valid values are 0 thru 7|
73 | | `stop` | `uint8_t` | The stop/end page address of the scroll - valid values are 0 thru 7|
74 | | `interval` | `uint8_t` | The time interval between scroll step - values listed in ```scrollRight``` |
75 |
76 | ### scrollVertLeft()
77 | This method is called to start the device scrolling the displayed graphics vertically and to the left. This action is performed immediately.
78 |
79 | The screen will scroll until the ```scrollStop()``` method is called.
80 |
81 | ```c++
82 | void scrolVertlLeft(uint8_t start, uint8_t stop, uint8_t interval)
83 | ```
84 |
85 | | Parameter | Type | Description |
86 | | :--- | :--- | :--- |
87 | | `start` | `uint8_t` | The start page address of the scroll - valid values are 0 thru 7|
88 | | `stop` | `uint8_t` | The stop/end page address of the scroll - valid values are 0 thru 7|
89 | | `interval` | `uint8_t` | The time interval between scroll step - values listed in ```scrollRight``` |
90 |
--------------------------------------------------------------------------------
/docs/assets/MicroMod-logo-updated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library/b8bdcf5ef2fd8d49e49b2a9d0f44d809ea078951/docs/assets/MicroMod-logo-updated.png
--------------------------------------------------------------------------------
/docs/assets/Qwiic-registered-updated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library/b8bdcf5ef2fd8d49e49b2a9d0f44d809ea078951/docs/assets/Qwiic-registered-updated.png
--------------------------------------------------------------------------------
/docs/assets/sfe_favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library/b8bdcf5ef2fd8d49e49b2a9d0f44d809ea078951/docs/assets/sfe_favicon.png
--------------------------------------------------------------------------------
/docs/github/contribute.md:
--------------------------------------------------------------------------------
1 | # Contribute: Help Fix our Mistake!
2 | Spot something wrong? Feel free to contribute our open-source design and documentation.
3 |
4 | ## Improve our Documentation
5 | All of this documentation can be modified by you! Please help us make it better.
6 |
7 | * These pages are contained in the [`docs` folder of the SparkFun Qwiic OLED Arduino Library repository](https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library/tree/main/docs).
8 |
9 | ### Submit a Correction
10 | 1. Fork this repo
11 | 2. Add your corrections or improvements to the markdown file
12 | 3. File a pull request with your changes, and enjoy making the ~~words~~ ~~worlds~~ world a better place.
13 | * Once received, the documentation specialist will automatically be notified.
14 | * We will review your suggested improvements to make sure they are correct and fit within our documentation standards.
15 |
16 | ## Improve our Hardware Design
17 | All of our designs are open-source! Please help us make it better.
18 |
19 | * Our board design files are contained in the `Hardware` folder of their respective repositories:
20 |
21 | * [SparkFun Micro OLED Breakout (Qwiic)](https://github.com/sparkfun/Qwiic_Micro_OLED/tree/main/Hardware)
22 | * [SparkFun Qwiic OLED Display (0.91 in, 128x32)](https://github.com/sparkfun/SparkFun_Qwiic_OLED-0.91/tree/main/Hardware)
23 | * [SparkFun Transparent Graphical OLED Breakout (Qwiic)](https://github.com/sparkfun/Qwiic_Transparent_Graphical_OLED/tree/main/Hardware)
24 | * [SparkFun Qwiic OLED - (1.3in., 128x64)](https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library/tree/main/Hardware)
25 |
26 | ### Submit a Design Improvement
27 | 1. Fork this repo
28 | 2. Add your design improvements
29 | 3. File a pull request with your changes, and enjoy making the ~~words~~ ~~worlds~~ world a better place.
30 | * Once received, the engineer in charge of the original design will automatically be notified.
31 | * We will review your suggested improvements, if they are within our board design standards and meet our product design requirements, we will flag these changes for our next board revision. *(Please note, that even if your suggestion is accepted, these changes may not be immediate. We may have to cycle through our current product inventory first.)*
32 |
33 | ## Contributors
34 | Let's provided some recognition to the contributors for this project!
35 |
36 | 
37 |
38 |
39 |
--------------------------------------------------------------------------------
/docs/github/file_issue.md:
--------------------------------------------------------------------------------
1 | # Did we make a mistake?
2 |
3 | Spot something wrong? Please let us know.
4 |
5 | !!! attention
6 | This is not where customers should seek assistance on a product. If you require technical assistance or have questions about a product that is not working as expected, please head over to the [SparkFun Technical Assistance](https://www.sparkfun.com/technical_assistance) page for some initial troubleshooting.
7 |
10 |
11 | If you can't find what you need there, you'll need a [Forum Account](https://forum.sparkfun.com/ucp.php?mode=register) to search product forums and post questions.
12 |
13 | ## Discrepancies in the Documentation
14 |
15 | All of this documentation can be modified by you! Please help us make it better.
16 |
17 | * The documentation files for these pages are contained in the [`docs` folder of the SparkFun Qwiic OLED Arduino Library repository](https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library/tree/main/docs).
18 |
19 | ### Spot something wrong?
20 | If a section of the documentation is incorrect, please [open an issue](https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library/issues) and let us know.
21 |
22 | ### Do you have a suggested correction?
23 | 1. With a GitHub account, fork this repo
24 | 2. Add your correction(s) or improvement(s) to the markdown file(s)
25 | 3. File a pull request with your changes, and enjoy making the ~~words~~ ~~worlds~~ world a better place.
26 | * Once received, the documentation specialist will automatically be notified.
27 | * We will review your suggested improvement(s) to make sure they are correct and fit within our documentation standards.
28 |
29 | ## Problems in the Hardware Design
30 |
31 | All of our designs are open-source! Please help us make it better.
32 |
33 | Our board design files are contained in the `Hardware` folder of their respective repositories:
34 |
35 | * [SparkFun Micro OLED Breakout (Qwiic)](https://github.com/sparkfun/Qwiic_Micro_OLED/tree/main/Hardware)
36 | * [SparkFun Qwiic OLED Display (0.91 in, 128x32)](https://github.com/sparkfun/SparkFun_Qwiic_OLED-0.91/tree/main/Hardware)
37 | * [SparkFun Transparent Graphical OLED Breakout (Qwiic)](https://github.com/sparkfun/Qwiic_Transparent_Graphical_OLED/tree/main/Hardware)
38 | * [SparkFun Qwiic OLED - (1.3in., 128x64)](https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library/tree/main/Hardware)
39 |
40 | ### Does something not make sense?
41 | If part of the design is confusing, please [open an issue](https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library/issues) and let us know.
42 |
43 | ### Did we forget to include an important function of the board?
44 | * Please keep in mind that we may intentionally exclude certain functions of the board to meet our product design requirements. *(For example, our Qwiic Micro boards are intended to fit on a small board layout and only use I2C communication; therefore, we may not have the SPI and interrupt pins available for users.)*
45 | * If part of the board's functionality is missing, please [open an issue](https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library/issues) and file a feature request.
46 |
47 | ### Do you wish to contribute directly to improving the board design?
48 | 1. With a GitHub account, Fork this repo
49 | 2. Add your design improvement(s)
50 | 3. File a pull request with your changes, and enjoy making the ~~words~~ ~~worlds~~ world a better place.
51 | * Once received, the engineer in charge of the original design will automatically be notified.
52 | * We will review your suggested improvement(s), if they are within our board design standards and meet our product design requirements, we will flag these changes for our next board revision. *(Please note, that even if your suggestion is accepted, these changes may not be immediate. We may have to cycle through our current product inventory first.)*
53 |
--------------------------------------------------------------------------------
/docs/hug_1p3.md:
--------------------------------------------------------------------------------
1 | The Qwiic OLED 1.3in has its own [hook-up guide](https://docs.sparkfun.com/SparkFun_Qwiic_OLED_1.3in/).
2 |
--------------------------------------------------------------------------------
/docs/img/OLEDLibBanner.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library/b8bdcf5ef2fd8d49e49b2a9d0f44d809ea078951/docs/img/OLEDLibBanner.png
--------------------------------------------------------------------------------
/docs/img/sfe_logo_sm.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library/b8bdcf5ef2fd8d49e49b2a9d0f44d809ea078951/docs/img/sfe_logo_sm.png
--------------------------------------------------------------------------------
/docs/index.md:
--------------------------------------------------------------------------------
1 | Placeholder file for index redirect functionality.
2 |
--------------------------------------------------------------------------------
/docs/javascript/README.md:
--------------------------------------------------------------------------------
1 | javascript directory
2 | ====================
3 | This folder should contain the files for the custom javascript that is enabled in the product documentation
--------------------------------------------------------------------------------
/docs/javascript/mathjax.js:
--------------------------------------------------------------------------------
1 | window.MathJax = {
2 | tex: {
3 | inlineMath: [["\\(", "\\)"]],
4 | displayMath: [["\\[", "\\]"]],
5 | processEscapes: true,
6 | processEnvironments: true,
7 | // No Equation Numbering
8 | tags: 'none'
9 | },
10 | options: {
11 | ignoreHtmlClass: ".*|",
12 | processHtmlClass: "arithmatex"
13 | }
14 | };
15 |
16 | document$.subscribe(() => {
17 | MathJax.typesetPromise()
18 | })
19 |
--------------------------------------------------------------------------------
/docs/single_page.md:
--------------------------------------------------------------------------------
1 | ---
2 | hide:
3 | - navigation
4 | - toc
5 | icon: fontawesome/solid/scroll
6 | ---
7 |
8 | # Getting Started
9 |
10 | ## Introduction
11 | --8<-- "./docs/introduction.md"
12 |
13 | ## Qwiic Micro OLED (0.66", 64x48)
14 | --8<-- "./docs/hug_micro_view.md"
15 |
16 | ## Qwiic Transparent Graphical OLED (1.51", 128x56)
17 | --8<-- "./docs/hug_transparent.md"
18 |
19 | ## Qwiic OLED (0.91", 128x32)
20 | --8<-- "./docs/hug_0p91.md"
21 |
22 | ## Qwiic OLED (1.3", 128x64)
23 | --8<-- "./docs/hug_1p3.md"
24 |
25 | # Software Setup
26 | --8<-- "./docs/software.md"
27 |
28 | # API Reference
29 |
30 | ## Device
31 | --8<-- "./docs/api_device.md"
32 |
33 | ## Scrolling
34 | --8<-- "./docs/api_scroll.md"
35 |
36 | ## Drawing State
37 | --8<-- "./docs/api_draw.md"
38 |
39 | ## Graphics
40 | --8<-- "./docs/api_graphics.md"
41 |
42 | ## Arduino Print
43 | --8<-- "./docs/api_arduino.md"
44 |
45 | # Arduino Examples
46 |
47 | ## Example 1 - Hello
48 | --8<-- "./docs/ex_01_hello.md
49 |
50 | ## Example 2 - Shapes
51 | --8<-- "./docs/ex_02_lines.md
52 |
53 | ## Example 3 - Bitmaps
54 | --8<-- "./docs/ex_03_bitmaps.md
55 |
56 | ## Example 4 - Text
57 | --8<-- "./docs/ex_04_text.md
58 |
59 | ## Other Examples
60 | --8<-- "./docs/ex_other.md
61 |
62 | # Troubleshooting
63 | --8<-- "./docs/troubleshooting.md"
64 |
--------------------------------------------------------------------------------
/docs/software.md:
--------------------------------------------------------------------------------
1 | # Software Setup
2 |
3 |
4 | ## Installation
5 |
6 | !!! arduino
7 | This guide assumes you are using the latest version of the Arduino IDE on your desktop. The following resources available at [SparkFun](https://www.sparkfun.com) provide the details on setting up and configuring Arduino to use this library.
8 |
9 | - [Installing the Arduino IDE](https://learn.sparkfun.com/tutorials/installing-arduino-ide)
10 | - [Installing Board Definitions in the Arduino IDE](https://learn.sparkfun.com/tutorials/installing-board-definitions-in-the-arduino-ide)
11 | - [Installing an Arduino Library](https://learn.sparkfun.com/tutorials/installing-an-arduino-library)
12 |
13 | The SparkFun Qwiic OLED Arduino Library is available within in the Arduino library manager, which is launched via the **Sketch** > **Include Libraries** > **Manage Libraries …** menu option in the Arduino IDE. Just search for ***SparkFun Qwiic OLED Library***.
14 |
15 |
16 | !!! note
17 | If you've never connected a USB-to-serial converter to your computer before, you may need to install drivers. The drivers will depend on what is populated on your Arduino development board. Check out the following tutorials for help with the installation.
18 |
19 | * [How to Install CH340 Drivers](https://learn.sparkfun.com/tutorials/how-to-install-ch340-drivers)
20 | * [How to Install FTDI Drivers](https://learn.sparkfun.com/tutorials/how-to-install-ftdi-drivers)
21 | * [How to Install CP2104 Drivers](https://learn.sparkfun.com/tutorials/esp32-thing-plus-hookup-guide#CP2104)
22 |
23 |
24 | ## General Use Pattern
25 |
26 | After installing this library in your local Arduino environment, begin with a standard Arduino sketch, and include the header file for this library.
27 |
28 | ```C++
29 | // Include the SparkFun qwiic OLED Library
30 | #include
31 | ```
32 |
33 | The next step is to declare the object for the SparkFun qwiic OLED device used. Like most Arduino sketches, this is done at a global scope (after the include file declaration), not within the ```setup()``` or ```loop()``` functions.
34 |
35 | The user selects from one of the following classes:
36 |
37 | | Class | Qwiic OLED Device |
38 | | :--- | :--- |
39 | | `QwiicMicroOLED` | [SparkFun Qwiic Micro OLED ]( https://www.sparkfun.com/products/14532)|
40 | | `QwiicNarrowOLED` | [SparkFun Qwiic OLED Display (128x32) ]( https://www.sparkfun.com/products/17153)|
41 | | `QwiicTransparentOLED` | [SparkFun Transparent Graphical OLED]( https://www.sparkfun.com/products/15173)|
42 | | `Qwiic1in3OLED` | [SparkFun Qwiic OLED 1.3" Display (128x32) ]( https://www.sparkfun.com/products/23453)|
43 |
44 | For this example, the Qwiic Micro OLED is used.
45 |
46 | ```C++
47 | QwiicMicroOLED myOLED;
48 | ```
49 |
50 | In the ```setup()``` function of this sketch, like all of the SparkFun qwiic libraries, the device is initialized by calling the ```begin()``` method. This method returns a value of ```true``` on success, or ```false``` on failure.
51 |
52 | ```C++
53 | int width, height; // global variables for use in the sketch
54 | void setup()
55 | {
56 | Serial.begin(115200);
57 | if(!myOLED.begin()){
58 | Serial.println("Device failed to initialize");
59 | while(1); // halt execution
60 | }
61 | Serial.println("Device is initialized");
62 |
63 | }
64 | ```
65 |
66 | Now that the library is initialized, the desired graphics are drawn. Here we erase the screen and draw simple series of lines that originate at the screen origin and fan out across the height of the display.
67 |
68 | !!! note
69 | Graphics are not send to the OLED device when drawn. Updates are only sent to the device when the `display()` method is called. This minimizes data transfers to the OLED device, delivering a responsive display response.
70 |
71 | ```C++
72 |
73 | myOLED.erase(); // Erase the screen
74 | myOLED.display(); // Send erase to device
75 |
76 | delay(1000); // Slight pause
77 |
78 | // Draw our lines from point (0,0) to (i, screen height)
79 |
80 | for(int i=0; i < width; i+= 6){
81 | myOLED.line(0, 0, i, height-1); // draw the line
82 | myOLED.display(); // Send the new line to the device for display
83 | }
84 | ```
85 |
86 |
87 |
88 | ## Library Provided Examples
89 |
90 | The SparkFun Qwiic OLED Arduino Library, includes a wide variety of examples. These are available from the Examples menu of the Arduino IDE, and in the [`examples`](https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library/blob/main/examples)folder of this repository.
91 |
92 | For a detailed description of the examples, see the Examples section of the documentation.
93 |
--------------------------------------------------------------------------------
/docs/troubleshooting.md:
--------------------------------------------------------------------------------
1 | ### General Troubleshooting Help
2 |
3 | !!! note
4 |
5 | Not working as expected and need help?
6 |
7 | If you need technical assistance and more information on a product that is not working as you expected, we recommend heading on over to the SparkFun Technical Assistance page for some initial troubleshooting.
10 |
11 | If you don't find what you need there, the SparkFun Forums are a great place to find and ask for help. If this is your first visit, you'll need to create a Forum Account to search product forums and post questions.
64 |
65 |
66 |
67 | The example code supports all of the SparkFun Qwiic OLED boards. By default, the Qwiic Micro OLED is selected. To select a different board being used, add a single line comment (i.e. `//`) in front of "`QwiicMicroOLED myOLED;`" and uncomment the device being used for the demo board.
68 |
69 |
70 | ```C++
71 | QwiicMicroOLED myOLED;
72 | //QwiicTransparentOLED myOLED;
73 | //QwiicNarrowOLED myOLED;
74 | //Qwiic1in3OLED myOLED;
75 |
76 | ```
77 |
78 |
79 | !!! note
80 | As of version 1.0.2+, users will need to use the class as explained above instead of using a `#define`.
81 |
82 | ```C++
83 | #define MICRO
84 | //#define NARROW
85 | //#define TRANSPARENT
86 | ```
87 |
88 |
89 | ## Initialization
90 |
91 | In the ```setup()``` function of this sketch, like all of the SparkFun Qwiic Arduino libraries, the device is initialized by calling the ```begin()``` method. This method returns a value of ```true``` on success, or ```false``` on failure.
92 |
93 | ```C++
94 | void setup()
95 | {
96 |
97 | delay(500); //Give display time to power on
98 |
99 | // Serial on!
100 | Serial.begin(115200);
101 |
102 | Serial.println("\n\r-----------------------------------");
103 |
104 | Serial.print("Running Example 01 on: ");
105 | Serial.println(String(deviceName));
106 |
107 | // Initalize the OLED device and related graphics system
108 | if(!myOLED.begin()){
109 |
110 | Serial.println(" - Device Begin Failed");
111 | while(1);
112 | }
113 |
114 | Serial.println("- Begin Success");
115 |
116 | // Do a simple test - fill a rectangle on the screen and then print hello!...
117 |
118 | }
119 | ```
120 |
121 |
122 |
123 | ## Drawing Graphics
124 |
125 | Once the device is enabled, the rest of the `setup()` function is devoted to drawing a simple graphic on the target device.
126 |
127 |
128 |
129 | ### Filled Rectangle
130 |
131 | First, draw a filled rectangle on the screen - leave a 4 pixel boarder at the end of the screen. Note that the `getWidth()` and `getHeight()` method are used to get the devices screen size.
132 |
133 | ```C++
134 | // Fill a rectangle on the screen that has a 4 pixel board
135 | myOLED.rectangleFill(4, 4, myOLED.getWidth() - 8, myOLED.getHeight() - 8);
136 | ```
137 |
138 |
139 |
140 | ### Centered Text
141 |
142 | The next part of our graphic is a message centered in the drawn rectangle. To do the centering, the current font is accessed from the device, and the size of a character in the font is used to calculate the text position on the screen. Once the position is determined, the message is drawn on the display in black (0 for a color value).
143 |
144 | ```C++
145 | String hello = "hello"; // our message
146 |
147 | // Center our message on the screen. Get the screen size of the "hello" string,
148 | // calling the getStringWidth() and getStringHeight() methods on the oled
149 |
150 | // starting x position - screen width minus string width / 2
151 | int x0 = (myOLED.getWidth() - myOLED.getStringWidth(hello)) / 2;
152 |
153 | // starting y position - screen height minus string height / 2
154 | int y0 = (myOLED.getHeight() - myOLED.getStringHeight(hello)) / 2;
155 |
156 | // Draw the text - color of black (0)
157 | myOLED.text(x0, y0, hello, 0);
158 | ```
159 |
160 |
161 |
162 | ### Displaying the Graphics
163 |
164 | The last step is sending the graphics to the device. This is accomplished by calling the `display()` method.
165 |
166 | ```C++
167 | // There's nothing on the screen yet - Now send the graphics to the device
168 | myOLED.display();
169 | ```
170 |
171 |
172 | ### What You Should See
173 |
174 | And that's it! Select the board and COM port for your development board. Then upload the code! The graphic should display on the OLED device.
175 |
176 | 
177 |
--------------------------------------------------------------------------------
/examples/docs/ex_02_lines.md:
--------------------------------------------------------------------------------
1 | # Example 2 - Shapes
2 |
3 | An example that shows drawing simple shapes using the SparkFun Qwiic OLED Library.
4 |
5 | **Key Demo Features**
6 |
7 | * Drawing lines, rectangles and circles
8 | * Demonstrating how graphics size impacts display speed
9 | * Drawing and erasing graphics quickly
10 | * XOR operations using raster operators
11 |
12 |
13 |
14 | ## Setup
15 |
16 | After installing this library in your local Arduino environment, begin with a standard Arduino sketch, and include the header file for this library.
17 |
18 |
19 | ```C++
20 | // Include the SparkFun Qwiic OLED Library
21 | #include
22 | ```
23 |
24 |
25 | The next step is to declare the object for the SparkFun Qwiic OLED device used. Like most Arduino sketches, this is done at a global scope (after the include file declaration), not within the ```setup()``` or ```loop()``` functions.
26 |
27 | The user selects from one of the following classes:
28 |
29 |
63 |
64 |
65 |
66 | The example code supports all of the SparkFun Qwiic OLED boards. By default, the Qwiic Micro OLED is selected. To select a different board being used, add a single line comment (i.e. `//`) in front of "`QwiicMicroOLED myOLED;`" and uncomment the device being used for the demo board.
67 |
68 |
69 | ```C++
70 | QwiicMicroOLED myOLED;
71 | //QwiicTransparentOLED myOLED;
72 | //QwiicNarrowOLED myOLED;
73 | //Qwiic1in3OLED myOLED;
74 |
75 | ```
76 |
77 |
78 | !!! note
79 | As of version 1.0.2+, users will need to use the class as explained above instead of using a `#define`.
80 |
81 | ```C++
82 | #define MICRO
83 | //#define NARROW
84 | //#define TRANSPARENT
85 | ```
86 |
87 |
88 |
89 | ## Drawing Shapes
90 |
91 | !!! note
92 | As of version 1.0.2+, the modular functions have a slightly different name. Some functions defined in the example code will have the `_` removed or words spelled out. For example, version v1.0.1 and below defined the function to test the line as `line_test_1()` while version v1.0.2+ defined the function as `lineTest1()`.
93 |
94 | The shapes drawn are broken into a set of functions that perform one test, which is part of the overall example.
95 |
96 |
97 |
98 | ###Lines
99 |
100 | This test starts with a short, horizontal line that is animated from the top to bottom of the display. After each iteration, the line size is increased and the animating sequence repeated.
101 |
102 | To animate the line, the display is erased, then the line drawn. Once the line is draw, the updated graphics is sent to the OLED device by calling the `display()` method.
103 |
104 | !!! note
105 | When `display()` is called, only the range of modified pixels is sent to the OLED device, greatly reducing the data transferred for small graphic changes.
106 |
107 | This is demonstrated by this test. When small lines are drawn, the update rate is fast, but as the line length increases, the update rate of the device is noticeably slower. A longer line requires more data to be sent to the device.
108 |
109 | ```C++
110 | void lineTest1(void)
111 | {
112 | int x, y, i;
113 |
114 | int mid = width / 2;
115 | int delta = mid / 8;
116 |
117 | for (int j = 1; j < 8; j++)
118 | {
119 |
120 | x = delta * j;
121 |
122 | for (i = 0; i < height * 2; i++)
123 | {
124 |
125 | y = i % height;
126 | myOLED.erase();
127 | myOLED.line(mid - x, y, mid + x, y);
128 | myOLED.display();
129 | }
130 | }
131 | }
132 | ```
133 |
134 |
135 |
136 | This test is followed up with a series of lines that span from a single point to the bottom of the screen, showing the flexibility of the line to raster algorithm used by the library.
137 |
138 | ```C++
139 | void lineTest2(void)
140 | {
141 | for (int i = 0; i < width; i += 6)
142 | {
143 | myOLED.line(0, 0, i, height - 1);
144 | myOLED.display();
145 | }
146 | delay(200);
147 | myOLED.erase();
148 | for (int i = width - 1; i >= 0; i -= 6)
149 | {
150 | myOLED.line(width - 1, 0, i, height - 1);
151 | myOLED.display();
152 | }
153 | }
154 | ```
155 |
156 |
157 |
158 | And the last line test draws a series of lines to test all three internal line drawing algorithms. Specifically:
159 |
160 | * Angled lines drawn by the general purpose line algorithm
161 | * Vertical lines drawn by an optimized line routine
162 | * Horizontal lines draw by an optimized line routine
163 |
164 | The test animates to show a growing box, giving an idea of the speed and flexibility of the system.
165 |
166 | ```C++
167 | void lineTestVerticalIterative(uint8_t y0, uint8_t y1)
168 | {
169 | for (int i = 0; i < width; i += 8)
170 | myOLED.line(i, y0, i, y1);
171 |
172 | // end off the vertical lines
173 | myOLED.line(width - 1, y0, width - 1, y1);
174 |
175 | // End lines and cross lines
176 | myOLED.line(0, y0, width - 1, y0);
177 | myOLED.line(0, y1, width - 1, y1);
178 | myOLED.line(0, y0, width - 1, y1);
179 | myOLED.line(0, y1, width - 1, y0);
180 | }
181 |
182 | // Entry point for test
183 | void lineTestVertical(void)
184 | {
185 | int mid = height / 2;
186 |
187 | for (int i = 0; i < height; i += 4)
188 | {
189 |
190 | myOLED.erase();
191 | lineTestVerticalIterative(mid - i / 2, mid + i / 2);
192 | myOLED.display();
193 | delay(10);
194 | }
195 | }
196 | ```
197 |
198 |
199 |
200 | ### Rectangles
201 |
202 | Several rectangle routines are shown in this example. A key test is a fast drawing routine which animates a small rectangle being drawn diagonally across the screen.
203 |
204 | In this test, the rectangle is drawn, sent to the device via using `display()`, then the rectangle is drawn again, but this time in black. This effectively erases the rectangle. The position is incremented and the process loops, causing the rectangle to appear to fly across the screen.
205 |
206 | The animation is quick, since only the portions of the screen that need updated are actually updated.
207 |
208 | The animation algorithm is listed in the `rectangleTestMove() function.
209 |
210 | ```C++
211 | void rectangleTestMove(void)
212 | {
213 | float steps = height;
214 | float xinc = width / steps;
215 | float yinc = height / steps;
216 | int side = 10;
217 | float x = 0;
218 | float y = 0;
219 |
220 | for (int i = 0; i < steps; i++)
221 | {
222 | // Draw the rectangle and send it to device
223 | myOLED.rectangle(x, y, side, side);
224 | myOLED.display(); // sends erased rect and new rect pixels to device
225 |
226 | // Erase the that rect, increment and loop
227 | myOLED.rectangle(x, y, side, side, 0);
228 |
229 | x += xinc;
230 | y += yinc;
231 | }
232 | }
233 | ```
234 |
235 |
236 |
237 | The next rectangle test draws a series of filled rectangles on the screen. The unique aspect of this test is that is uses the XOR functionally to overlay a rectangle on the device, presenting a alternating color pattern.
238 |
239 | The XOR raster operation is set by calling the `setDrawMode()` method on the OLED device, and providing the `grROPXOR` code. This switch the device into a XOR drawing mode. Graphic operations are restored to normal by calling `setDrawMode()` and providing the `grROPCopy` code, which copies the new pixel value to the destination.
240 |
241 | Filled rectangles and XOR operations:
242 |
243 | ```C++
244 | void rectangleFillTest(void)
245 | {
246 | myOLED.rectangleFill(4, 4, width / 2 - 8, height - 8);
247 |
248 | myOLED.rectangleFill(width / 2 + 4, 4, width / 2 - 8, height - 8);
249 |
250 | myOLED.setDrawMode(grROPXOR); // xor
251 | myOLED.rectangleFill(width / 4, 8, width / 2, height - 16);
252 | myOLED.setDrawMode(grROPCopy); // back to copy op (default)
253 | }
254 | ```
255 |
256 |
257 |
258 | ### Circles
259 |
260 | The final shape drawn by this example is a series of circles and filled circles. Using the geometry of the screen, a set of circles are drawn and displayed.
261 |
262 | ```C++
263 | void circleTest(void)
264 | {
265 | // Let's draw some circles that fit on the device
266 | myOLED.circle(width / 4, height / 2, height / 3);
267 |
268 | myOLED.circleFill(width - width / 4, height / 2, height / 3);
269 |
270 | myOLED.circle(4, height / 2, height / 3);
271 |
272 | myOLED.circleFill(width - width / 2, height / 2, height / 4);
273 | }
274 | ```
275 |
--------------------------------------------------------------------------------
/examples/docs/ex_03_bitmaps.md:
--------------------------------------------------------------------------------
1 | # Example 3 - Bitmaps
2 |
3 | An example that shows drawing bitmaps using the SparkFun Qwiic OLED Library.
4 |
5 | **Key Demo Features**
6 |
7 | * Understanding bitmap structure
8 | * Bitmap objects
9 | * Drawing Bitmap
10 |
11 |
12 | ## Setup
13 |
14 | After installing this library in your local Arduino environment, begin with a standard Arduino sketch, and include the header file for this library.
15 | ```C++
16 | // Include the SparkFun qwiic OLED Library
17 | #include
18 | ```
19 | The next step is to declare the object for the SparkFun qwiic OLED device used. Like most Arduino sketches, this is done at a global scope (after the include file declaration), not within the ```setup()``` or ```loop()``` functions.
20 |
21 | The user selects from one of the following classes:
22 |
23 | | Class | Qwiic OLED Device |
24 | | :--- | :--- |
25 | | `QwiicMicroOLED` | [SparkFun Qwiic Micro OLED ]( https://www.sparkfun.com/products/14532)|
26 | | `QwiicNarrowOLED` | [SparkFun Qwiic OLED Display (128x32) ]( https://www.sparkfun.com/products/17153)|
27 | | `QwiicTransparentOLED` | [SparkFun Transparent Graphical OLED]( https://www.sparkfun.com/products/15173)|
28 | | `Qwiic1in3OLED` | [SparkFun Qwiic OLED 1.3" Display (128x32) ]( https://www.sparkfun.com/products/23453)|
29 |
30 | The Example code supports all of the SparkFun Qwiic OLED boards. To select the board being used, uncomment the `#define` for the demo board.
31 |
32 | For this example, the Qwiic Micro OLED is used.
33 |
34 | ```C++
35 | #define MICRO
36 | //#define NARROW
37 | //#define TRANSPARENT
38 | ```
39 | Which results in myOLED being declared as:
40 |
41 | ```C++
42 | QwiicMicroOLED myOLED;
43 | ```
44 | ## Initialization
45 |
46 | In the ```setup()``` function of this sketch, like all of the SparkFun qwiic libraries, the device is initialized by calling the ```begin()``` method. This method returns a value of ```true``` on success, or ```false``` on failure.
47 |
48 | ```C++
49 | void setup()
50 | {
51 |
52 | delay(500); //Give display time to power on
53 |
54 | // Serial on!
55 | Serial.begin(115200);
56 |
57 | Serial.println("\n\r-----------------------------------");
58 |
59 | Serial.print("Running Example 01 on: ");
60 | Serial.println(String(deviceName));
61 |
62 | // Initalize the OLED device and related graphics system
63 | if(!myOLED.begin()){
64 |
65 | Serial.println(" - Device Begin Failed");
66 | while(1);
67 | }
68 |
69 | Serial.println("- Begin Success");
70 |
71 | ```
72 | ## Drawing Bitmaps
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/examples/docs/ex_04_text.md:
--------------------------------------------------------------------------------
1 | # Example 4 - Text
2 |
3 | An example that shows drawing bitmaps using the SparkFun Qwiic OLED Library.
4 |
5 | **Key Demo Features**
6 |
7 | * Understanding font structure and use
8 | * Drawing text
9 | * Using the Arduino `Print` functionality
10 |
11 |
12 | ## Setup
13 |
14 | After installing this library in your local Arduino environment, begin with a standard Arduino sketch, and include the header file for this library.
15 | ```C++
16 | // Include the SparkFun qwiic OLED Library
17 | #include
18 | ```
19 | The next step is to declare the object for the SparkFun qwiic OLED device used. Like most Arduino sketches, this is done at a global scope (after the include file declaration), not within the ```setup()``` or ```loop()``` functions.
20 |
21 | The user selects from one of the following classes:
22 |
23 | | Class | Qwiic OLED Device |
24 | | :--- | :--- |
25 | | `QwiicMicroOLED` | [SparkFun Qwiic Micro OLED ]( https://www.sparkfun.com/products/14532)|
26 | | `QwiicNarrowOLED` | [SparkFun Qwiic OLED Display (128x32) ]( https://www.sparkfun.com/products/17153)|
27 | | `QwiicTransparentOLED` | [SparkFun Transparent Graphical OLED]( https://www.sparkfun.com/products/15173)|
28 | | `Qwiic1in3OLED` | [SparkFun Qwiic OLED 1.3" Display (128x32) ]( https://www.sparkfun.com/products/23453)|
29 |
30 | The Example code supports all of the SparkFun Qwiic OLED boards. To select the board being used, uncomment the `#define` for the demo board.
31 |
32 | For this example, the Qwiic Micro OLED is used.
33 |
34 | ```C++
35 | #define MICRO
36 | //#define NARROW
37 | //#define TRANSPARENT
38 | ```
39 | Which results in myOLED being declared as:
40 |
41 | ```C++
42 | QwiicMicroOLED myOLED;
43 | ```
44 | ## Initialization
45 |
46 | In the ```setup()``` function of this sketch, like all of the SparkFun qwiic libraries, the device is initialized by calling the ```begin()``` method. This method returns a value of ```true``` on success, or ```false``` on failure.
47 |
48 | ```C++
49 | void setup()
50 | {
51 |
52 | delay(500); //Give display time to power on
53 |
54 | // Serial on!
55 | Serial.begin(115200);
56 |
57 | Serial.println("\n\r-----------------------------------");
58 |
59 | Serial.print("Running Example 01 on: ");
60 | Serial.println(String(deviceName));
61 |
62 | // Initalize the OLED device and related graphics system
63 | if(!myOLED.begin()){
64 |
65 | Serial.println(" - Device Begin Failed");
66 | while(1);
67 | }
68 |
69 | Serial.println("- Begin Success");
70 |
71 | ```
72 | ## Drawing Text
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/examples/docs/ex_other.md:
--------------------------------------------------------------------------------
1 | # Other Examples
2 |
3 | Descriptions of the other demos that are provided as part of the SparkFun Qwiic OLED Library.
4 |
5 | ## Scroll-Flip
6 |
7 |
8 |
9 | ## Clock
10 |
11 |
12 | ## Cube
13 |
14 |
15 | ## Multi
16 |
17 |
--------------------------------------------------------------------------------
/examples/docs/img/ex01_hello.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library/b8bdcf5ef2fd8d49e49b2a9d0f44d809ea078951/examples/docs/img/ex01_hello.png
--------------------------------------------------------------------------------
/examples/mkdocs.yml:
--------------------------------------------------------------------------------
1 | site_name: SparkFun Qwiic OLED Arduino Library - Examples
2 |
3 | nav:
4 | - Example 1 - Hello: "ex_01_hello.md"
5 | - Example 2 - Shapes: "ex_02_lines.md"
6 | - Example 3 - Bitmaps: "ex_03_bitmaps.md"
7 | - Example 4 - Text: "ex_04_text.md"
8 | - Other Examples: "ex_other.md"
--------------------------------------------------------------------------------
/img/Contributing.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library/b8bdcf5ef2fd8d49e49b2a9d0f44d809ea078951/img/Contributing.JPG
--------------------------------------------------------------------------------
/keywords.txt:
--------------------------------------------------------------------------------
1 | #######################################
2 | # Syntax Coloring Map Quick OLED Library
3 | #######################################
4 |
5 | #######################################
6 | # Datatypes (KEYWORD1)
7 | #######################################
8 |
9 | QwiicTransparentOLED KEYWORD1
10 | QwiicNarrowOLED KEYWORD1
11 | QwiicMicroOLED KEYWORD1
12 | Qwiic1in3OLED KEYWORD1
13 | QwiicCustomOLED KEYWORD1
14 | QwiicFont KEYWORD1
15 | grRasterOp_t KEYWORD1
16 |
17 |
18 | #######################################
19 | # Methods and Functions (KEYWORD2)
20 | #######################################
21 |
22 | begin KEYWORD2
23 | reset KEYWORD2
24 | getWidth KEYWORD2
25 | getHeight KEYWORD2
26 | display KEYWORD2
27 | displayPower KEYWORD2
28 | erase KEYWORD2
29 | invert KEYWORD2
30 | scrollRight KEYWORD2
31 | scrollLeft KEYWORD2
32 | scrollVertRight KEYWORD2
33 | scrollVertLeft KEYWORD2
34 | scrollStop KEYWORD2
35 | flipVertical KEYWORD2
36 | flipHorizontal KEYWORD2
37 | setFont KEYWORD2
38 | getFont KEYWORD2
39 | setDrawMode KEYWORD2
40 | getDrawMode KEYWORD2
41 | pixel KEYWORD2
42 | line KEYWORD2
43 | rectangle KEYWORD2
44 | rectangleFill KEYWORD2
45 | circle KEYWORD2
46 | circleFill KEYWORD2
47 | bitmap KEYWORD2
48 | text KEYWORD2
49 | setCursor KEYWORD2
50 | setColor KEYWORD2
51 | getColor KEYWORD2
52 | write KEYWORD2
53 |
54 | #######################################
55 | # Constants (LITERAL1)
56 | #######################################
57 |
58 | grROPCopy LITERAL1
59 | grROPNotCopy LITERAL1
60 | grROPNot LITERAL1
61 | grROPXOR LITERAL1
62 | grROPBlack LITERAL1
63 | grROPWhite LITERAL1
64 |
65 | SCROLL_INTERVAL_5_FRAMES LITERAL1
66 | SCROLL_INTERVAL_64_FRAMES LITERAL1
67 | SCROLL_INTERVAL_128_FRAMES LITERAL1
68 | SCROLL_INTERVAL_256_FRAMES LITERAL1
69 | SCROLL_INTERVAL_3_FRAMES LITERAL1
70 | SCROLL_INTERVAL_4_FRAMES LITERAL1
71 | SCROLL_INTERVAL_25_FRAMES LITERAL1
72 | SCROLL_INTERVAL_2_FRAMES LITERAL1
73 |
--------------------------------------------------------------------------------
/library.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "SparkFun Qwiic OLED Arduino Library",
3 | "version": "1.0",
4 | "keywords": "display oled graphics",
5 | "description": "Library for all SparkFun Qwiic OLED boards",
6 | "repository":
7 | {
8 | "type": "git",
9 | "url": "https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library.git"
10 | },
11 | "frameworks": "arduino",
12 | "platforms": "*"
13 | }
14 |
--------------------------------------------------------------------------------
/library.properties:
--------------------------------------------------------------------------------
1 | name=SparkFun Qwiic OLED Arduino Library
2 | version=1.0.13
3 | author=SparkFun Electronics
4 | maintainer=SparkFun Electronics
5 | sentence=Library for SparkFun SSD1306 based OLED display products.
6 | paragraph=A very fast and efficient Arduino library for the SSD1306 driver IC. Transfer rates are up to 400% faster than alternative libraries; only dirty regions of the graphics buffer are sent to the display. Efficient memory usage. No dynamic memory utilized. Static resources are loaded once, and only on explicit declaration. This library supports the SparkFun Qwiic Micro OLED, 0.91in OLED, Transparent Graphical OLED, smôl OLED Display, and any other board using the SSD1306 IC.
7 | category=Display
8 | url=https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library
9 | architectures=*
10 |
--------------------------------------------------------------------------------
/mkdocs.yml:
--------------------------------------------------------------------------------
1 | # Documentation page information
2 | site_name: SparkFun Qwiic OLED Arduino Library - Hookup Guide
3 | site_description: SparkFun Arduino Library for Qwiic OLED Boards
4 | site_url: https://sparkfun.github.io/SparkFun_Qwiic_OLED_Arduino_Library
5 | site_author: SparkFun Electronics
6 |
7 | repo_url: https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library
8 | repo_name: sparkfun/SparkFun_Qwiic_OLED_Arduino_Library
9 |
10 | copyright:
11 | Copyright 2023 - SparkFun Electronics®
12 | 6333 Dry Creek Parkway, Niwot, Colorado 80503
13 |
14 | # Default edit/view actions to "main" branch, instead of "master"
15 | edit_uri: blob/main/docs/
16 |
17 | #logo: img/sfe_logo_sm.png
18 |
19 | # Configuration for webpage theme
20 | theme:
21 | # Theme: https://squidfunk.github.io/mkdocs-material/
22 | name: material
23 |
24 | # Icon in Browser Tab (must be square img - i.e. 32x32 pixels)
25 | favicon: assets/sfe_favicon.png
26 |
27 | # Page Font
28 | font:
29 | text: Roboto
30 | code: Roboto Mono
31 |
32 | # Features to Include (ref. theme documentation)
33 | features:
34 |
35 | # Enable copy button on code blocks
36 | - content.code.copy
37 |
38 | # Enable annotations in code blocks
39 | - content.code.annotate
40 |
41 | # Enable "view source" and "edit this page" buttons
42 | - content.action.edit
43 | # - content.action.view
44 |
45 | # Enable Navigation buttons in the footer (i.e. previous/next)
46 | - navigation.footer
47 |
48 | # Enables anchor tracking (updates page url with the section user is on)
49 | # i.e. https://docs.sparkfun.com//#
50 | - navigation.tracking
51 | - navigation.tabs.sticky
52 |
53 | # Enables tabs for navigating the website
54 | - navigation.tabs
55 | # Keeps tabs visible in the header when scrolling
56 | - navigation.tabs.sticky
57 |
58 | # Adds pop-up button just below the header (when the user starts to scroll up)
59 | # Allows users to easily jump to the beginning of the page
60 | - navigation.top
61 |
62 | # Renders path for page navigation at top of the page (makes page navigation more mobile friendly)
63 | - navigation.path
64 |
65 |
66 | # Adds light/dark theme to the webpage
67 | palette:
68 | # Palette toggle for automatic mode
69 | - media: "(prefers-color-scheme)"
70 | primary: grey
71 | accent: red
72 | toggle:
73 | icon: material/brightness-auto
74 | name: Switch to dark mode
75 |
76 | # Palette toggle for light mode
77 | - media: "(prefers-color-scheme: light)"
78 | primary: grey
79 | accent: red
80 | scheme: default
81 | toggle:
82 | icon: material/brightness-7
83 | name: Switch to system preference
84 |
85 | # Palette toggle for dark mode
86 | - media: "(prefers-color-scheme: dark)"
87 | primary: grey
88 | accent: red
89 | scheme: slate
90 | toggle:
91 | icon: material/weather-night
92 | name: Switch to light mode
93 |
94 | # Configures icons
95 | icon:
96 | # Sets homepage icon
97 | logo: sfe-logo
98 |
99 | # Sets repo icon to GitHub icon
100 | repo: fontawesome/brands/github
101 |
102 | # Sets icons for "view source" (commented out) and "edit this page" buttons
103 | edit: material/file-document-edit-outline
104 | # view: material/file-code-outline
105 |
106 | # Admonition Icons (callout boxes)
107 | admonition:
108 | note: octicons/tag-16
109 | abstract: octicons/checklist-16
110 | info: octicons/info-16
111 | tip: simple/sparkfun
112 | success: octicons/check-16
113 | question: octicons/question-16
114 | warning: octicons/alert-16
115 | failure: octicons/x-circle-16
116 | danger: octicons/zap-16
117 | bug: octicons/bug-16
118 | example: octicons/beaker-16
119 | quote: octicons/quote-16
120 | # Add custom admonitions
121 | github: simple/github
122 | arduino: simple/arduino
123 | python: simple/python
124 | code: fontawesome/regular/file-code
125 | terminal: octicons/terminal-16
126 | serial: fontawesome/solid/display
127 | hot: material/fire-alert
128 | # Permalink icon
129 | link: octicons/link-16
130 |
131 | # Adds overrides for stylesheets, html, etc.
132 | custom_dir: overrides
133 |
134 |
135 | # Included MkDocs plugins
136 | # Add the installation of any new plugins to the ./github/workflows/mkdocs.yml file also
137 | plugins:
138 | - search
139 | - typeset
140 | - redirects:
141 | redirect_maps:
142 | 'index.md': 'introduction.md'
143 | # Add revision date
144 | - git-revision-date-localized:
145 | enable_creation_date: true
146 | type: timeago
147 | # Add git committers at bottom of the page
148 | - git-committers:
149 | repository: sparkfun/SparkFun_Qwiic_Buzzer
150 | branch: main
151 | # Add git authors at bottom of the page
152 | - git-authors
153 | # Enables use of Git submodules and larger code base
154 | - monorepo
155 | # For PDF rendering
156 | # - with-pdf:
157 | # author: SparkFun Electronics®
158 | # copyright: Copyright 2023 - SparkFun Electronics®
159 | # cover_subtitle: none
160 | # cover_logo: img/sfe_logo_sm.png
161 | # exclude_pages: [ "hard_copy", "single_page", "file_issue", "contribute" ]
162 | # render_js: true
163 | # headless_chrome_path: headless-chromium
164 | # output_path: board_files/hookup_guide.pdf
165 |
166 |
167 | # Included Markdown extensions
168 | markdown_extensions:
169 | - pymdownx.highlight:
170 | anchor_linenums: true
171 | - pymdownx.inlinehilite
172 | - pymdownx.snippets:
173 | # base_path: ['./docs']
174 | url_download: true
175 | url_max_size: 0
176 | url_timeout: 0
177 | url_request_headers: {}
178 | - pymdownx.superfences
179 | - pymdownx.details
180 | - pymdownx.tabbed:
181 | alternate_style: true
182 | - pymdownx.betterem:
183 | smart_enable: all
184 | - pymdownx.mark
185 | - pymdownx.caret
186 | - pymdownx.tilde
187 | - pymdownx.keys
188 | - tables
189 | - admonition
190 | - md_in_html
191 | - attr_list
192 | - pymdownx.emoji:
193 | emoji_index: !!python/name:materialx.emoji.twemoji
194 | emoji_generator: !!python/name:materialx.emoji.to_svg
195 | options:
196 | custom_icons:
197 | - overrides/.icons
198 | - pymdownx.arithmatex:
199 | generic: true
200 | - toc:
201 | permalink: ''
202 | # Link: 🔗 🔗
203 | # Chain: ⛓ ⛓
204 |
205 |
206 |
207 | extra:
208 | # Configures the hyperlink for the logo in the header
209 | homepage: https://www.sparkfun.com/
210 |
211 | # Configures social icons in the footer
212 | social:
213 | - icon: sfe-logo
214 | link: https://www.sparkfun.com/
215 | - icon: fontawesome/brands/youtube
216 | link: https://www.youtube.com/sparkfun
217 | - icon: fontawesome/brands/instagram
218 | link: https://www.instagram.com/sparkfun
219 | - icon: fontawesome/brands/github
220 | link: https://www.github.com/sparkfun
221 | - icon: fontawesome/brands/facebook
222 | link: https://www.facebook.com/SparkFun
223 | - icon: fontawesome/brands/x-twitter
224 | link: https://twitter.com/sparkfun
225 | - icon: fontawesome/solid/cookie-bite
226 | link: ./#__consent
227 | name: Change cookie settings
228 |
229 | # Configures Google Analytics
230 | analytics:
231 | provider: google
232 | property: G-7Y7EYCZVC1
233 |
234 | consent:
235 | cookies:
236 | analytics:
237 | name: Google Analytics
238 | checked: true
239 | title: Cookie consent
240 | description:
241 | We use cookies to recognize your repeated visits and preferences, as well as to measure the effectiveness of our documentation and whether users find what they're searching for. With your consent, you're helping us to make our documentation better.
242 | actions:
243 | - accept
244 | - manage
245 | - reject
246 |
247 | # Configures styling for PDF rendering and webpage layout
248 | extra_css:
249 | - stylesheet/extra.css
250 |
251 | # Enables support for rendering block and inline block equations through MathJax
252 | extra_javascript:
253 | # # Enables support for rendering block and inline block equations through MathJax
254 | - javascript/mathjax.js
255 | - https://polyfill.io/v3/polyfill.min.js?features=es6
256 | - https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
257 |
258 | # Configures webpage navigation
259 | nav:
260 | - Getting Started:
261 | - Introduction: introduction.md
262 | - Qwiic Micro OLED (0.66", 64x48): hug_micro_view.md
263 | - Qwiic OLED (0.91", 128x32): hug_0p91.md
264 | - Qwiic Transparent Graphical OLED (1.51", 128x56): hug_transparent.md
265 | - Qwiic OLED (1.3", 128x64): hug_1p3.md
266 | - Software Setup: software.md
267 | - API Reference:
268 | - Device: api_device.md
269 | - Scrolling: api_scroll.md
270 | - Drawing State: api_draw.md
271 | - Graphics: api_graphics.md
272 | - Arduino Print: api_arduino.md
273 | - Examples: '!include ./examples/mkdocs.yml'
274 | - Support:
275 | - Troubleshooting: troubleshooting.md
276 | - Submit Issues: github/file_issue.md
277 | - Contribute: github/contribute.md
278 |
--------------------------------------------------------------------------------
/overrides/.icons/sfe-logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/overrides/README.md:
--------------------------------------------------------------------------------
1 | overrides directory
2 | ====================
3 | This folder should contain the files used for the webpage customizations of the product documentation
4 |
--------------------------------------------------------------------------------
/overrides/main.html:
--------------------------------------------------------------------------------
1 | {% extends "base.html" %}
2 |
3 | {% block content %}
4 |
5 |
6 | {% if "single_page.md" %}
7 |
8 | {% include ".icons/material/file-eye-outline.svg" %}
9 |
10 |
11 | {% endif %}
12 |
13 |
14 | {{ super() }}
15 | {% endblock content %}
16 |
--------------------------------------------------------------------------------
/overrides/partials/nav.html:
--------------------------------------------------------------------------------
1 |
22 |
23 | {% import "partials/nav-item.html" as item with context %}
24 |
25 |
26 | {% set class = "md-nav md-nav--primary" %}
27 | {% if "navigation.tabs" in features %}
28 | {% set class = class ~ " md-nav--lifted" %}
29 | {% endif %}
30 | {% if "toc.integrate" in features %}
31 | {% set class = class ~ " md-nav--integrated" %}
32 | {% endif %}
33 |
34 |
35 |
80 |
--------------------------------------------------------------------------------
/overrides/partials/tabs.html:
--------------------------------------------------------------------------------
1 |
22 |
23 | {% import "partials/tabs-item.html" as item with context %}
24 |
25 |
26 |
52 |
--------------------------------------------------------------------------------
/overrides/partials/toc-backup.html:
--------------------------------------------------------------------------------
1 |
22 |
23 |
24 | {% set title = lang.t("toc") %}
25 | {% if config.mdx_configs.toc and config.mdx_configs.toc.title %}
26 | {% set title = config.mdx_configs.toc.title %}
27 | {% endif %}
28 |
29 |
30 |
67 |
--------------------------------------------------------------------------------
/src/qwiic_i2c.cpp:
--------------------------------------------------------------------------------
1 | // qwiic_i2c.cpp
2 | //
3 | // This is a library written for SparkFun Qwiic OLED boards that use the SSD1306.
4 | //
5 | // SparkFun sells these at its website: www.sparkfun.com
6 | //
7 | // Do you like this library? Help support SparkFun. Buy a board!
8 | //
9 | // Micro OLED https://www.sparkfun.com/products/14532
10 | // Transparent OLED https://www.sparkfun.com/products/15173
11 | // "Narrow" OLED https://www.sparkfun.com/products/17153
12 | //
13 | //
14 | // Written by Kirk Benell @ SparkFun Electronics, March 2022
15 | //
16 | // This library configures and draws graphics to OLED boards that use the
17 | // SSD1306 display hardware. The library only supports I2C.
18 | //
19 | // Repository:
20 | // https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library
21 | //
22 | // Documentation:
23 | // https://sparkfun.github.io/SparkFun_Qwiic_OLED_Arduino_Library/
24 | //
25 | //
26 | // SparkFun code, firmware, and software is released under the MIT License(http://opensource.org/licenses/MIT).
27 | //
28 | // SPDX-License-Identifier: MIT
29 | //
30 | // The MIT License (MIT)
31 | //
32 | // Copyright (c) 2022 SparkFun Electronics
33 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
34 | // associated documentation files (the "Software"), to deal in the Software without restriction,
35 | // including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
36 | // and/or sell copies of the Software, and to permit persons to whom the Software is furnished to
37 | // do so, subject to the following conditions:
38 | // The above copyright notice and this permission notice shall be included in all copies or substantial
39 | // portions of the Software.
40 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
41 | // NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
42 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
43 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
44 | // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
45 |
46 | // Class provide an abstract interface to the I2C device
47 |
48 | #include "qwiic_i2c.h"
49 |
50 |
51 | // What is the max buffer size for this platform.
52 |
53 | #if defined(SERIAL_BUFFER_SIZE)
54 | #define kMaxTransferBuffer SERIAL_BUFFER_SIZE
55 |
56 | #elif defined(I2C_BUFFER_LENGTH)
57 | #define kMaxTransferBuffer I2C_BUFFER_LENGTH
58 |
59 | #elif defined(BUFFER_LENGTH)
60 | #define kMaxTransferBuffer BUFFER_LENGTH
61 |
62 | #else // just the standard Arduino value
63 | #define kMaxTransferBuffer 32
64 |
65 | #endif
66 |
67 | // What we use for transfer chunk size
68 |
69 | const static uint16_t kChunkSize = kMaxTransferBuffer - 1;
70 |
71 | //////////////////////////////////////////////////////////////////////////////////////////////////
72 | // Constructor
73 |
74 | QwI2C::QwI2C(void)
75 | {
76 | m_i2cPort = nullptr;
77 | }
78 | //////////////////////////////////////////////////////////////////////////////////////////////////
79 | // init()
80 | //
81 | // Methods to init/setup this device. The caller can provide a Wire Port, or this class
82 | // will use the default
83 |
84 | bool QwI2C::init(TwoWire& wirePort)
85 | {
86 | // if we don't have a wire port already
87 | if (!m_i2cPort)
88 | m_i2cPort = &wirePort;
89 |
90 | return true;
91 | }
92 | //////////////////////////////////////////////////////////////////////////////////////////////////
93 | //
94 |
95 | bool QwI2C::init(void)
96 | {
97 | // do we already have a wire port?
98 | if (!m_i2cPort)
99 | return init(Wire); // no wire, send in Wire
100 |
101 | return true;
102 | }
103 |
104 | //////////////////////////////////////////////////////////////////////////////////////////////////
105 | // ping()
106 | //
107 | // Is a device connected?
108 | bool QwI2C::ping(uint8_t i2c_address)
109 | {
110 | m_i2cPort->beginTransmission(i2c_address);
111 | return m_i2cPort->endTransmission() == 0;
112 | }
113 |
114 | //////////////////////////////////////////////////////////////////////////////////////////////////
115 | // writeRegisterByte()
116 | //
117 | // Write a byte to a register
118 |
119 | bool QwI2C::writeRegisterByte(uint8_t i2c_address, uint8_t offset, uint8_t dataToWrite)
120 | {
121 | m_i2cPort->beginTransmission(i2c_address);
122 | m_i2cPort->write(offset);
123 | m_i2cPort->write(dataToWrite);
124 | return m_i2cPort->endTransmission() == 0;
125 | }
126 | //////////////////////////////////////////////////////////////////////////////////////////////////
127 | // writeRegisterRegion()
128 | //
129 | // Write a block of data to a device. This routine will chunk over the data if needed
130 |
131 | int QwI2C::writeRegisterRegion(uint8_t i2c_address, uint8_t offset, uint8_t* data, uint16_t length)
132 | {
133 | uint16_t nSent;
134 | uint16_t nRemaining = length;
135 | uint16_t nToWrite;
136 |
137 | while (nRemaining > 0) {
138 |
139 | m_i2cPort->beginTransmission(i2c_address);
140 | m_i2cPort->write(offset);
141 |
142 | nToWrite = (nRemaining > kChunkSize ? kChunkSize : nRemaining);
143 | nSent = m_i2cPort->write(data, nToWrite);
144 |
145 | nRemaining -= nToWrite; // Note - use nToWrite, not nSent, or lock on esp32
146 | data += nSent; // move up to remaining data in buffer
147 |
148 | #if defined(ARDUINO_ARCH_ESP32)
149 | // if we are on ESP32, release bus no matter what
150 | if (m_i2cPort->endTransmission())
151 | #else
152 | // only release bus if we've sent all data
153 | if (m_i2cPort->endTransmission(nRemaining <= 0))
154 | #endif
155 | return -1; // the client didn't ACK
156 | }
157 |
158 | return length - nRemaining;
159 | }
160 |
--------------------------------------------------------------------------------
/src/qwiic_i2c.h:
--------------------------------------------------------------------------------
1 | // qwiic_i2c.h
2 | //
3 | // This is a library written for SparkFun Qwiic OLED boards that use the SSD1306.
4 | //
5 | // SparkFun sells these at its website: www.sparkfun.com
6 | //
7 | // Do you like this library? Help support SparkFun. Buy a board!
8 | //
9 | // Micro OLED https://www.sparkfun.com/products/14532
10 | // Transparent OLED https://www.sparkfun.com/products/15173
11 | // "Narrow" OLED https://www.sparkfun.com/products/17153
12 | //
13 | //
14 | // Written by Kirk Benell @ SparkFun Electronics, March 2022
15 | //
16 | // This library configures and draws graphics to OLED boards that use the
17 | // SSD1306 display hardware. The library only supports I2C.
18 | //
19 | // Repository:
20 | // https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library
21 | //
22 | // Documentation:
23 | // https://sparkfun.github.io/SparkFun_Qwiic_OLED_Arduino_Library/
24 | //
25 | //
26 | // SparkFun code, firmware, and software is released under the MIT License(http://opensource.org/licenses/MIT).
27 | //
28 | // SPDX-License-Identifier: MIT
29 | //
30 | // The MIT License (MIT)
31 | //
32 | // Copyright (c) 2022 SparkFun Electronics
33 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
34 | // associated documentation files (the "Software"), to deal in the Software without restriction,
35 | // including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
36 | // and/or sell copies of the Software, and to permit persons to whom the Software is furnished to
37 | // do so, subject to the following conditions:
38 | // The above copyright notice and this permission notice shall be included in all copies or substantial
39 | // portions of the Software.
40 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
41 | // NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
42 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
43 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
44 | // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
45 |
46 | // Header for I2C driver object
47 |
48 | #pragma once
49 |
50 | // Simple object to encapsulate basic I2C operations.
51 | //
52 | // This is following a pattern for future implementations
53 | //
54 | // This class is focused on Aurduino..
55 |
56 | #include
57 | #include
58 |
59 | class QwI2C {
60 |
61 | public:
62 | QwI2C(void);
63 |
64 | bool init(void);
65 | bool init(TwoWire& wirePort);
66 |
67 | // see if a device exists
68 | bool ping(uint8_t address);
69 |
70 | bool writeRegisterByte(uint8_t address, uint8_t offset, uint8_t data);
71 |
72 | // Write a block of bytes to the device --
73 | int writeRegisterRegion(uint8_t address, uint8_t offset, uint8_t* data, uint16_t length);
74 |
75 | private:
76 | TwoWire* m_i2cPort;
77 | };
--------------------------------------------------------------------------------
/src/qwiic_oled_1in3.h:
--------------------------------------------------------------------------------
1 | // qwiic_oled_1in3.h
2 | //
3 | // This is a library written for SparkFun Qwiic OLED boards that use the SSD1306.
4 | //
5 | // SparkFun sells these at its website: www.sparkfun.com
6 | //
7 | // Do you like this library? Help support SparkFun. Buy a board!
8 | //
9 | // Micro OLED https://www.sparkfun.com/products/14532
10 | // Transparent OLED https://www.sparkfun.com/products/15173
11 | // "Narrow" OLED https://www.sparkfun.com/products/17153
12 | // 1.3" OLED https://www.sparkfun.com/products/23453
13 | //
14 | //
15 | // Written by Kirk Benell @ SparkFun Electronics, March 2022
16 | //
17 | // This library configures and draws graphics to OLED boards that use the
18 | // SSD1306 display hardware. The library only supports I2C.
19 | //
20 | // Repository:
21 | // https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library
22 | //
23 | // Documentation:
24 | // https://sparkfun.github.io/SparkFun_Qwiic_OLED_Arduino_Library/
25 | //
26 | //
27 | // SparkFun code, firmware, and software is released under the MIT License(http://opensource.org/licenses/MIT).
28 | //
29 | // SPDX-License-Identifier: MIT
30 | //
31 | // The MIT License (MIT)
32 | //
33 | // Copyright (c) 2022 SparkFun Electronics
34 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
35 | // associated documentation files (the "Software"), to deal in the Software without restriction,
36 | // including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
37 | // and/or sell copies of the Software, and to permit persons to whom the Software is furnished to
38 | // do so, subject to the following conditions:
39 | // The above copyright notice and this permission notice shall be included in all copies or substantial
40 | // portions of the Software.
41 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
42 | // NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
43 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
44 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
45 | // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
46 |
47 | // Implementation for the 1.3" OLED device
48 |
49 | #pragma once
50 |
51 | #include "qwiic_grssd1306.h"
52 |
53 | //////////////////////////////////////////////////////////////////
54 | // Set the defaults for the SparkFun Qwiic MicroOLED
55 |
56 | #define kOLED1in3Width 128
57 | #define kOLED1in3Height 64
58 |
59 | #define kOLED1in3XOffset 0
60 | #define kOLED1in3YOffset 0
61 |
62 | // Parameters for this device
63 | #define kOLED1in3PinConfig 0x12
64 | #define kOLED1in3PreCharge 0xF1
65 | #define kOLED1in3VCOM 0x40
66 | #define kOLED1in3Contrast 0xCF
67 |
68 | #define kOLED1in3DefaultAddress 0x3D
69 | #define kOLED1in3AltAddress 0x3C
70 |
71 | class QwOLED1in3 : public QwGrSSD1306 {
72 |
73 | public:
74 | // Constructor - setup the viewport and default address for this device.
75 | QwOLED1in3()
76 | : QwGrSSD1306(kOLED1in3XOffset, kOLED1in3YOffset, kOLED1in3Width, kOLED1in3Height)
77 | {
78 | default_address = kOLED1in3DefaultAddress;
79 | };
80 |
81 | // set up the specific device settings
82 | bool init(void)
83 | {
84 |
85 | setBuffer(m_graphicsBuffer); // The buffer to use
86 |
87 | setCommPins(kOLED1in3PinConfig);
88 | setPreCharge(kOLED1in3PreCharge);
89 | setVcomDeselect(kOLED1in3VCOM);
90 | setContrast(kOLED1in3Contrast);
91 |
92 | // Call the super class to do all the work
93 | return this->QwGrSSD1306::init();
94 | };
95 |
96 | private:
97 | // Graphics buffer for this device.
98 | uint8_t m_graphicsBuffer[kOLED1in3Width * kOLED1in3Height / 8];
99 | };
--------------------------------------------------------------------------------
/src/qwiic_oled_custom.h:
--------------------------------------------------------------------------------
1 | // qwiic_oled_custom.h
2 | //
3 | // This is a library written for SparkFun Qwiic OLED boards that use the SSD1306.
4 | //
5 | // SparkFun sells these at its website: www.sparkfun.com
6 | //
7 | // Do you like this library? Help support SparkFun. Buy a board!
8 | //
9 | // Micro OLED https://www.sparkfun.com/products/14532
10 | // Transparent OLED https://www.sparkfun.com/products/15173
11 | // "Narrow" OLED https://www.sparkfun.com/products/17153
12 | // 1.3" OLED https://www.sparkfun.com/products/23453
13 | //
14 | //
15 | // Written by Kirk Benell @ SparkFun Electronics, March 2022
16 | //
17 | // This library configures and draws graphics to OLED boards that use the
18 | // SSD1306 display hardware. The library only supports I2C.
19 | //
20 | // Repository:
21 | // https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library
22 | //
23 | // Documentation:
24 | // https://sparkfun.github.io/SparkFun_Qwiic_OLED_Arduino_Library/
25 | //
26 | //
27 | // SparkFun code, firmware, and software is released under the MIT License(http://opensource.org/licenses/MIT).
28 | //
29 | // SPDX-License-Identifier: MIT
30 | //
31 | // The MIT License (MIT)
32 | //
33 | // Copyright (c) 2022 SparkFun Electronics
34 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
35 | // associated documentation files (the "Software"), to deal in the Software without restriction,
36 | // including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
37 | // and/or sell copies of the Software, and to permit persons to whom the Software is furnished to
38 | // do so, subject to the following conditions:
39 | // The above copyright notice and this permission notice shall be included in all copies or substantial
40 | // portions of the Software.
41 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
42 | // NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
43 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
44 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
45 | // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
46 |
47 | // Implementation for the 1.3" OLED device
48 |
49 | #pragma once
50 |
51 | #include "qwiic_grssd1306.h"
52 |
53 | //////////////////////////////////////////////////////////////////
54 | // Set the defaults for the SparkFun Qwiic MicroOLED
55 |
56 | #define kOLEDCustomDefaultWidth 128
57 | #define kOLEDCustomDefaultHeight 64
58 |
59 | #define kOLEDCustomDefaultXOffset 0
60 | #define kOLEDCustomDefaultYOffset 0
61 |
62 | // Parameters for this device
63 | #define kOLEDCustomDefaultPinConfig 0x12
64 | #define kOLEDCustomDefaultPreCharge 0xF1
65 | #define kOLEDCustomDefaultVCOM 0x40
66 | #define kOLEDCustomDefaultContrast 0xCF
67 |
68 | #define kOLEDCustomDefaultDefaultAddress 0x3D
69 | #define kOLEDCustomDefaultAltAddress 0x3C
70 |
71 | class QwOLEDCustom : public QwGrSSD1306 {
72 |
73 | public:
74 | // Constructor - setup the viewport and default address for this device.
75 | QwOLEDCustom()
76 | : QwGrSSD1306(kOLEDCustomDefaultXOffset, kOLEDCustomDefaultYOffset, kOLEDCustomDefaultWidth, kOLEDCustomDefaultHeight)
77 | {
78 | default_address = kOLEDCustomDefaultDefaultAddress;
79 | };
80 |
81 | ~QwOLEDCustom()
82 | {
83 | if (m_graphicsBuffer != nullptr)
84 | {
85 | delete[] m_graphicsBuffer;
86 | m_graphicsBuffer = nullptr;
87 | }
88 | };
89 |
90 | // set up the specific device settings
91 | bool init(void)
92 | {
93 | this->QwGrSSD1306::setViewport(m_xOffset, m_yOffset, m_displayWidth, m_displayHeight);
94 |
95 | this->QwGrSSD1306::setCommPins(m_pinConfig);
96 | this->QwGrSSD1306::setPreCharge(m_preCharge);
97 | this->QwGrSSD1306::setVcomDeselect(m_vcomDeselect);
98 | this->QwGrSSD1306::setContrast(m_contrast);
99 |
100 | if (m_graphicsBuffer != nullptr)
101 | delete[] m_graphicsBuffer;
102 | m_graphicsBuffer = new uint8_t[(uint16_t)m_displayWidth * (uint16_t)m_displayHeight / 8];
103 | this->QwGrSSD1306::setBuffer(m_graphicsBuffer); // The buffer to use
104 |
105 | // Call the super class to do all the work
106 | return this->QwGrSSD1306::init();
107 | };
108 |
109 | void setXOffset(uint8_t xOffset){ m_xOffset = xOffset; }
110 | void setYOffset(uint8_t yOffset){ m_yOffset = yOffset; }
111 | void setDisplayWidth(uint8_t displayWidth){ m_displayWidth = displayWidth; }
112 | void setDisplayHeight(uint8_t displayHeight){ m_displayHeight = displayHeight; }
113 | void setPinConfig(uint8_t pinConfig){ m_pinConfig = pinConfig; }
114 | void setPreCharge(uint8_t preCharge){ m_preCharge = preCharge; }
115 | void setVcomDeselect(uint8_t vcomDeselect){ m_vcomDeselect = vcomDeselect; }
116 | void setContrast(uint8_t contrast){ m_contrast = contrast; }
117 |
118 | private:
119 | uint8_t m_xOffset = kOLEDCustomDefaultXOffset;
120 | uint8_t m_yOffset = kOLEDCustomDefaultYOffset;
121 | uint8_t m_displayWidth = kOLEDCustomDefaultWidth;
122 | uint8_t m_displayHeight = kOLEDCustomDefaultHeight;
123 | uint8_t m_pinConfig = kOLEDCustomDefaultPinConfig;
124 | uint8_t m_preCharge = kOLEDCustomDefaultPreCharge;
125 | uint8_t m_vcomDeselect = kOLEDCustomDefaultVCOM;
126 | uint8_t m_contrast = kOLEDCustomDefaultContrast;
127 |
128 | // Graphics buffer for this device.
129 | uint8_t *m_graphicsBuffer = nullptr;
130 | };
--------------------------------------------------------------------------------
/src/qwiic_oledmicro.h:
--------------------------------------------------------------------------------
1 | // qwiic_oledmicro.h
2 | //
3 | // This is a library written for SparkFun Qwiic OLED boards that use the SSD1306.
4 | //
5 | // SparkFun sells these at its website: www.sparkfun.com
6 | //
7 | // Do you like this library? Help support SparkFun. Buy a board!
8 | //
9 | // Micro OLED https://www.sparkfun.com/products/14532
10 | // Transparent OLED https://www.sparkfun.com/products/15173
11 | // "Narrow" OLED https://www.sparkfun.com/products/17153
12 | //
13 | //
14 | // Written by Kirk Benell @ SparkFun Electronics, March 2022
15 | //
16 | // This library configures and draws graphics to OLED boards that use the
17 | // SSD1306 display hardware. The library only supports I2C.
18 | //
19 | // Repository:
20 | // https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library
21 | //
22 | // Documentation:
23 | // https://sparkfun.github.io/SparkFun_Qwiic_OLED_Arduino_Library/
24 | //
25 | //
26 | // SparkFun code, firmware, and software is released under the MIT License(http://opensource.org/licenses/MIT).
27 | //
28 | // SPDX-License-Identifier: MIT
29 | //
30 | // The MIT License (MIT)
31 | //
32 | // Copyright (c) 2022 SparkFun Electronics
33 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
34 | // associated documentation files (the "Software"), to deal in the Software without restriction,
35 | // including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
36 | // and/or sell copies of the Software, and to permit persons to whom the Software is furnished to
37 | // do so, subject to the following conditions:
38 | // The above copyright notice and this permission notice shall be included in all copies or substantial
39 | // portions of the Software.
40 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
41 | // NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
42 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
43 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
44 | // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
45 |
46 | // Implementation for the Qwiic Micro OLED Device
47 |
48 | #pragma once
49 |
50 | #include "qwiic_grssd1306.h"
51 |
52 | //////////////////////////////////////////////////////////////////
53 | // Set the defaults for the SparkFun Qwiic MicroOLED
54 |
55 | #define kOLEDMicroWidth 64
56 | #define kOLEDMicroHeight 48
57 |
58 | // The viewport x is off by 2 on this device - starts at value 2
59 | #define kOLEDMicroXOffset 2
60 | #define kOLEDMicroYOffset 0
61 |
62 | // Parameters for this device
63 | #define kOLEDMicroPinConfig 0x12
64 | #define kOLEDMicroPreCharge 0xF1
65 | #define kOLEDMicroVCOM 0x40
66 |
67 | #define kOLEDMicroDefaultAddress 0x3D
68 | #define kOLEDMicroAltAddress 0x3C
69 |
70 | class QwOLEDMicro : public QwGrSSD1306 {
71 |
72 | public:
73 | // Constructor - setup the viewport and default address for this device.
74 | QwOLEDMicro()
75 | : QwGrSSD1306(kOLEDMicroXOffset, kOLEDMicroYOffset, kOLEDMicroWidth, kOLEDMicroHeight)
76 | {
77 | default_address = kOLEDMicroDefaultAddress;
78 | };
79 |
80 | // set up the specific device settings
81 | bool init(void)
82 | {
83 | setBuffer(m_graphicsBuffer); // The buffer to use
84 |
85 | setCommPins(kOLEDMicroPinConfig);
86 | setPreCharge(kOLEDMicroPreCharge);
87 | setVcomDeselect(kOLEDMicroVCOM);
88 |
89 | // Call the super class to do all the work
90 | return this->QwGrSSD1306::init();
91 | };
92 |
93 | private:
94 | // Graphics buffer for this device.
95 | uint8_t m_graphicsBuffer[kOLEDMicroWidth * kOLEDMicroHeight / 8];
96 | };
--------------------------------------------------------------------------------
/src/qwiic_olednarrow.h:
--------------------------------------------------------------------------------
1 | // qwiic_olednarrow.h
2 | //
3 | // This is a library written for SparkFun Qwiic OLED boards that use the SSD1306.
4 | //
5 | // SparkFun sells these at its website: www.sparkfun.com
6 | //
7 | // Do you like this library? Help support SparkFun. Buy a board!
8 | //
9 | // Micro OLED https://www.sparkfun.com/products/14532
10 | // Transparent OLED https://www.sparkfun.com/products/15173
11 | // "Narrow" OLED https://www.sparkfun.com/products/17153
12 | //
13 | //
14 | // Written by Kirk Benell @ SparkFun Electronics, March 2022
15 | //
16 | // This library configures and draws graphics to OLED boards that use the
17 | // SSD1306 display hardware. The library only supports I2C.
18 | //
19 | // Repository:
20 | // https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library
21 | //
22 | // Documentation:
23 | // https://sparkfun.github.io/SparkFun_Qwiic_OLED_Arduino_Library/
24 | //
25 |
26 | // SparkFun code, firmware, and software is released under the MIT License(http://opensource.org/licenses/MIT).
27 | //
28 | // SPDX-License-Identifier: MIT
29 | //
30 | // The MIT License (MIT)
31 | //
32 | // Copyright (c) 2022 SparkFun Electronics
33 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
34 | // associated documentation files (the "Software"), to deal in the Software without restriction,
35 | // including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
36 | // and/or sell copies of the Software, and to permit persons to whom the Software is furnished to
37 | // do so, subject to the following conditions:
38 | // The above copyright notice and this permission notice shall be included in all copies or substantial
39 | // portions of the Software.
40 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
41 | // NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
42 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
43 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
44 | // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
45 |
46 | // Implementation for the Qwiic Narrow OLED Device (128x32)
47 |
48 | #pragma once
49 |
50 | #include "qwiic_grssd1306.h"
51 |
52 | //////////////////////////////////////////////////////////////////
53 | // Set the defaults for the SparkFun Qwiic "Narrow" OLED
54 |
55 | #define kOLEDNarrowWidth 128
56 | #define kOLEDNarrowHeight 32
57 |
58 | // Parameters for this device
59 | #define kOLEDNarrowPinConfig 0x02
60 | #define kOLEDNarrowPreCharge 0xF1
61 | #define kOLEDNarrowVCOM 0x40
62 |
63 | #define kOLEDNarrowDefaultAddress 0x3C
64 |
65 | class QwOLEDNarrow : public QwGrSSD1306 {
66 |
67 | public:
68 | // Constructor - setup the viewport and default address for this device.
69 | QwOLEDNarrow()
70 | : QwGrSSD1306(kOLEDNarrowWidth, kOLEDNarrowHeight)
71 | {
72 | default_address = kOLEDNarrowDefaultAddress;
73 | };
74 |
75 | // set up the specific values
76 | bool init(void)
77 | {
78 |
79 | setBuffer(m_graphicsBuffer);
80 |
81 | setCommPins(kOLEDNarrowPinConfig);
82 | setPreCharge(kOLEDNarrowPreCharge);
83 | setVcomDeselect(kOLEDNarrowVCOM);
84 |
85 | // Call the super class to do all the work
86 | return this->QwGrSSD1306::init();
87 | };
88 |
89 | private:
90 | // Graphics buffer for this device.
91 | uint8_t m_graphicsBuffer[kOLEDNarrowWidth * kOLEDNarrowHeight / 8];
92 | };
--------------------------------------------------------------------------------
/src/qwiic_oledtransp.h:
--------------------------------------------------------------------------------
1 | // qwiic_oledtransp.h
2 | //
3 | // This is a library written for SparkFun Qwiic OLED boards that use the SSD1306.
4 | //
5 | // SparkFun sells these at its website: www.sparkfun.com
6 | //
7 | // Do you like this library? Help support SparkFun. Buy a board!
8 | //
9 | // Micro OLED https://www.sparkfun.com/products/14532
10 | // Transparent OLED https://www.sparkfun.com/products/15173
11 | // "Narrow" OLED https://www.sparkfun.com/products/17153
12 | //
13 | //
14 | // Written by Kirk Benell @ SparkFun Electronics, March 2022
15 | //
16 | // This library configures and draws graphics to OLED boards that use the
17 | // SSD1306 display hardware. The library only supports I2C.
18 | //
19 | // Repository:
20 | // https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library
21 | //
22 | // Documentation:
23 | // https://sparkfun.github.io/SparkFun_Qwiic_OLED_Arduino_Library/
24 | //
25 | //
26 | // SparkFun code, firmware, and software is released under the MIT License(http://opensource.org/licenses/MIT).
27 | //
28 | // SPDX-License-Identifier: MIT
29 | //
30 | // The MIT License (MIT)
31 | //
32 | // Copyright (c) 2022 SparkFun Electronics
33 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
34 | // associated documentation files (the "Software"), to deal in the Software without restriction,
35 | // including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
36 | // and/or sell copies of the Software, and to permit persons to whom the Software is furnished to
37 | // do so, subject to the following conditions:
38 | // The above copyright notice and this permission notice shall be included in all copies or substantial
39 | // portions of the Software.
40 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
41 | // NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
42 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
43 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
44 | // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
45 |
46 | // Implementation for the Transparent OLED device
47 |
48 | #pragma once
49 |
50 | #include "qwiic_grssd1306.h"
51 |
52 | //////////////////////////////////////////////////////////////////
53 | // Set the defaults for the SparkFun Qwiic MicroOLED
54 |
55 | #define kOLEDTransWidth 128
56 | #define kOLEDTransHeight 64
57 |
58 | // The viewport x is off by 2 on this device - starts at value 2
59 | #define kOLEDTransXOffset 0
60 | #define kOLEDTransYOffset 0
61 |
62 | // Parameters for this device
63 | #define kOLEDTransPinConfig 0x12
64 | #define kOLEDTransPreCharge 0x25
65 | #define kOLEDTransVCOM 0x40
66 |
67 | #define kOLEDTransDefaultAddress 0x3C
68 |
69 | class QwOLEDTransparent : public QwGrSSD1306 {
70 |
71 | public:
72 | // Constructor - setup the viewport and default address for this device.
73 | QwOLEDTransparent()
74 | : QwGrSSD1306(kOLEDTransXOffset, kOLEDTransYOffset, kOLEDTransWidth, kOLEDTransHeight)
75 | {
76 | default_address = kOLEDTransDefaultAddress;
77 | };
78 |
79 | // set up the specific device settings
80 | bool init(void)
81 | {
82 |
83 | setBuffer(m_graphicsBuffer); // The buffer to use
84 |
85 | setCommPins(kOLEDTransPinConfig);
86 | setPreCharge(kOLEDTransPreCharge);
87 | setVcomDeselect(kOLEDTransVCOM);
88 |
89 | // Call the super class to do all the work
90 | return this->QwGrSSD1306::init();
91 | };
92 |
93 | private:
94 | // Graphics buffer for this device.
95 | uint8_t m_graphicsBuffer[kOLEDTransWidth * kOLEDTransHeight / 8];
96 | };
--------------------------------------------------------------------------------
/src/res/_bmp_sparkfun.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | font5x7.h
3 | Definition for small font
4 |
5 | This file was imported from the MicroView library, written by GeekAmmo
6 | (https://github.com/geekammo/MicroView-Arduino-Library), and released under
7 | the terms of the GNU General Public License as published by the Free Software
8 | Foundation, either version 3 of the License, or (at your option) any later
9 | version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 |
19 | Modified by:
20 | Emil Varughese @ Edwin Robotics Pvt. Ltd.
21 | July 27, 2015
22 | https://github.com/emil01/SparkFun_Micro_OLED_Arduino_Library/
23 |
24 | ******************************************************************************/
25 | #pragma once
26 |
27 | /*
28 | #if defined(ARDUINO_ARCH_MBED)
29 | // ARDUINO_ARCH_MBED (APOLLO3 v2) does not support or require pgmspace.h / PROGMEM
30 | static const uint8_t bmp_truck[] = {
31 | #elif defined(__AVR__) || defined(__arm__) || defined(__ARDUINO_ARC__)
32 | #include
33 | static const uint8_t bmp_truck[] PROGMEM = {
34 | #else
35 | #include
36 | static const uint8_t bmp_truck[] PROGMEM = {
37 | #endif
38 | */
39 |
40 | #define BMP_SPARKFUN_WIDTH 64
41 | #define BMP_SPARKFUN_HEIGHT 48
42 |
43 | // SparkFun Electronics LOGO
44 | static const uint8_t bmp_sparkfun_data[] = {
45 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
46 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xF8, 0xFC, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF,
47 | 0xFF, 0xFF, 0xFF, 0x0F, 0x07, 0x07, 0x06, 0x06, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
48 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
49 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
50 | 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x81, 0x07, 0x0F, 0x3F, 0x3F, 0xFF, 0xFF, 0xFF,
51 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFE, 0xFC, 0xFC, 0xFC, 0xFE, 0xFF, 0xFF, 0xFF, 0xFC, 0xF8, 0xE0,
52 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
53 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFC,
54 | 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF1, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xF0, 0xFD, 0xFF,
55 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
56 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
57 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
58 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
59 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x3F, 0x1F, 0x07, 0x01,
60 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
61 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
62 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x3F, 0x1F, 0x1F, 0x0F, 0x0F, 0x0F, 0x0F,
63 | 0x0F, 0x0F, 0x0F, 0x0F, 0x07, 0x07, 0x07, 0x03, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
64 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
65 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
66 | 0x7F, 0x3F, 0x1F, 0x0F, 0x07, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
67 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
68 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
69 |
70 |
71 |
--------------------------------------------------------------------------------
/src/res/_bmp_truck.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | font5x7.h
3 | Definition for small font
4 |
5 | This file was imported from the MicroView library, written by GeekAmmo
6 | (https://github.com/geekammo/MicroView-Arduino-Library), and released under
7 | the terms of the GNU General Public License as published by the Free Software
8 | Foundation, either version 3 of the License, or (at your option) any later
9 | version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 |
19 | Modified by:
20 | Emil Varughese @ Edwin Robotics Pvt. Ltd.
21 | July 27, 2015
22 | https://github.com/emil01/SparkFun_Micro_OLED_Arduino_Library/
23 |
24 | ******************************************************************************/
25 | #pragma once
26 |
27 | /*
28 | #if defined(ARDUINO_ARCH_MBED)
29 | // ARDUINO_ARCH_MBED (APOLLO3 v2) does not support or require pgmspace.h / PROGMEM
30 | static const uint8_t bmp_truck[] = {
31 | #elif defined(__AVR__) || defined(__arm__) || defined(__ARDUINO_ARC__)
32 | #include
33 | static const uint8_t bmp_truck[] PROGMEM = {
34 | #else
35 | #include
36 | static const uint8_t bmp_truck[] PROGMEM = {
37 | #endif
38 | */
39 |
40 | #define BMP_TRUCK_WIDTH 19
41 | #define BMP_TRUCK_HEIGHT 16
42 |
43 | static const uint8_t bmp_truck_data[] = {
44 | 0xFF,
45 | 0x01,
46 | 0xC1,
47 | 0x41,
48 | 0x41,
49 | 0x41,
50 | 0x71,
51 | 0x11,
52 | 0x11,
53 | 0x11,
54 | 0x11,
55 | 0x11,
56 | 0x71,
57 | 0x41,
58 | 0x41,
59 | 0xC1,
60 | 0x81,
61 | 0x01,
62 | 0xFF,
63 | 0xFF,
64 | 0x80,
65 | 0x83,
66 | 0x82,
67 | 0x86,
68 | 0x8F,
69 | 0x8F,
70 | 0x86,
71 | 0x82,
72 | 0x82,
73 | 0x82,
74 | 0x86,
75 | 0x8F,
76 | 0x8F,
77 | 0x86,
78 | 0x83,
79 | 0x81,
80 | 0x80,
81 | 0xFF,
82 | };
83 |
--------------------------------------------------------------------------------
/src/res/_fnt_7segment.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | 7segment.h
3 | Definition for 7-segment font
4 |
5 | This file was imported from the MicroView library, written by GeekAmmo
6 | (https://github.com/geekammo/MicroView-Arduino-Library), and released under
7 | the terms of the GNU General Public License as published by the Free Software
8 | Foundation, either version 3 of the License, or (at your option) any later
9 | version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 |
19 | Modified by:
20 | Emil Varughese @ Edwin Robotics Pvt. Ltd.
21 | July 27, 2015
22 | https://github.com/emil01/SparkFun_Micro_OLED_Arduino_Library/
23 |
24 | ******************************************************************************/
25 |
26 | #pragma once
27 |
28 | // Define the font attributes
29 | #define FONT_7SEG_WIDTH 10
30 | #define FONT_7SEG_HEIGHT 16
31 | #define FONT_7SEG_START 46
32 | #define FONT_7SEG_NCHAR 13
33 | #define FONT_7SEG_MAP_WIDTH 130
34 | #define FONT_7SEG_NAME "7 Segment"
35 |
36 | #if defined(ARDUINO_ARCH_MBED)
37 | // ARDUINO_ARCH_MBED (APOLLO3 v2) does not support or require pgmspace.h / PROGMEM
38 | static const uint8_t segment7_data [] = {
39 | #elif defined(__AVR__) || defined(__arm__) || defined(__ARDUINO_ARC__)
40 | static const uint8_t segment7_data [] PROGMEM = {
41 | #else
42 | static const uint8_t segment7_data [] PROGMEM = {
43 | #endif
44 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
45 | 0x00, 0x00, 0x00, 0x00, 0x78, 0xFC, 0x02, 0x03, 0x03, 0x03, 0x03, 0x02, 0xFC, 0x78, 0x00, 0x00,
46 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x7E, 0x00, 0x00, 0x02, 0x83, 0x83, 0x83, 0x83, 0x02,
47 | 0xFC, 0x78, 0x00, 0x00, 0x02, 0x83, 0x83, 0x83, 0x83, 0x02, 0xFC, 0x78, 0x7E, 0xFF, 0x00, 0x80,
48 | 0x80, 0x80, 0x80, 0x00, 0xFF, 0x7E, 0x78, 0xFC, 0x02, 0x83, 0x83, 0x83, 0x83, 0x02, 0x00, 0x00,
49 | 0x78, 0xFC, 0x02, 0x83, 0x83, 0x83, 0x83, 0x02, 0x00, 0x00, 0x00, 0x02, 0x03, 0x03, 0x03, 0x03,
50 | 0x03, 0x02, 0xFC, 0x78, 0x78, 0xFC, 0x02, 0x83, 0x83, 0x83, 0x83, 0x02, 0xFC, 0x78, 0x78, 0xFC,
51 | 0x02, 0x83, 0x83, 0x83, 0x83, 0x02, 0xFC, 0x78, 0x00, 0x00, 0x00, 0X00, 0x18, 0x3C, 0x3C, 0x18,
52 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xF0, 0xF0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
53 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x3F, 0x40, 0xC0, 0xC0, 0xC0, 0xC0, 0x40, 0x3F, 0x1E,
54 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x7E, 0x1C, 0x3E, 0x41, 0xC1, 0xC1, 0xC1,
55 | 0xC1, 0x41, 0x00, 0x00, 0x00, 0x00, 0x41, 0xC1, 0xC1, 0xC1, 0xC1, 0x41, 0x3E, 0x1C, 0x00, 0x00,
56 | 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0xFF, 0x7E, 0x00, 0x00, 0x41, 0xC1, 0xC1, 0xC1, 0xC1, 0x41,
57 | 0x3E, 0x1C, 0x1C, 0x3E, 0x41, 0xC1, 0xC1, 0xC1, 0xC1, 0x41, 0x3E, 0x1C, 0x00, 0x00, 0x00, 0x00,
58 | 0x00, 0x00, 0x00, 0x00, 0xFF, 0x7E, 0x1C, 0x3E, 0x41, 0xC1, 0xC1, 0xC1, 0xC1, 0x41, 0x3E, 0x1C,
59 | 0x00, 0x00, 0x41, 0xC1, 0xC1, 0xC1, 0xC1, 0x41, 0x3E, 0x1C, 0x00, 0x00, 0x00, 0X00, 0x18, 0x3C,
60 | 0x3C, 0x18, 0x00, 0x00
61 |
62 | };
63 |
64 |
65 |
--------------------------------------------------------------------------------
/src/res/_fnt_largenum.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | fontlargenumber.h
3 | Definition for large font
4 |
5 | This file was imported from the MicroView library, written by GeekAmmo
6 | (https://github.com/geekammo/MicroView-Arduino-Library), and released under
7 | the terms of the GNU General Public License as published by the Free Software
8 | Foundation, either version 3 of the License, or (at your option) any later
9 | version.
10 |
11 | This program is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with this program. If not, see .
18 |
19 | Modified by:
20 | Emil Varughese @ Edwin Robotics Pvt. Ltd.
21 | July 27, 2015
22 | https://github.com/emil01/SparkFun_Micro_OLED_Arduino_Library/
23 |
24 | ******************************************************************************/
25 | #pragma once
26 |
27 |
28 | // Define the font attributes
29 | #define FONT_LARGENUM_WIDTH 12
30 | #define FONT_LARGENUM_HEIGHT 48
31 | #define FONT_LARGENUM_START 48
32 | #define FONT_LARGENUM_NCHAR 11
33 | #define FONT_LARGENUM_MAP_WIDTH 132
34 | #define FONT_LARGENUM_NAME "Large Number"
35 |
36 | #if defined(ARDUINO_ARCH_MBED)
37 | // ARDUINO_ARCH_MBED (APOLLO3 v2) does not support or require pgmspace.h / PROGMEM
38 | static const uint8_t fontlargenum_data[] = {
39 | #elif defined(__AVR__) || defined(__arm__) || defined(__ARDUINO_ARC__)
40 | static const uint8_t fontlargenum_data[] PROGMEM = {
41 | #else
42 | static const uint8_t fontlargenum_data[] PROGMEM = {
43 | #endif
44 | 0x00, 0xC0, 0xF8, 0x7C, 0x3E, 0x3E, 0xFC, 0xF8, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xE0,
45 | 0x78, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x7C, 0x3C, 0x3E, 0x3E, 0xFE, 0xFC,
46 | 0xE0, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x3E, 0x3E, 0x3E, 0xFE, 0xF8, 0xC0, 0x00, 0x00, 0x00, 0x00,
47 | 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFE, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFE, 0x3E,
48 | 0x3E, 0x3E, 0x3E, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xF0, 0xFC, 0x3E, 0x3E, 0x3E,
49 | 0xFC, 0x00, 0x00, 0x00, 0x00, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0xFE, 0xFE, 0x00, 0x00,
50 | 0x00, 0x00, 0xC0, 0xF8, 0xFE, 0x3E, 0x7E, 0xFC, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFC,
51 | 0x7E, 0x3E, 0xFE, 0xF8, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xE0, 0xC0, 0x00,
52 | 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0xF9, 0xFF, 0xFF, 0xF0, 0x00, 0x00,
53 | 0x00, 0x00, 0x07, 0x03, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
54 | 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,
55 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x1F, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
56 | 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFF, 0x3F,
57 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFC,
58 | 0x7F, 0x03, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00,
59 | 0x00, 0xFE, 0xFF, 0x03, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
60 | 0x3F, 0x7F, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xE0, 0xFF, 0x1F, 0x00,
61 | 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00,
62 | 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFE, 0x1F, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xF8,
63 | 0xFC, 0xFF, 0xC7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFE, 0x3F, 0x03, 0x00, 0xFF, 0xFF,
64 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x3F, 0x3E, 0x7E, 0xFC, 0xF8, 0xE0, 0x00, 0x00, 0x00, 0x00,
65 | 0x00, 0xFF, 0xFF, 0x80, 0xF0, 0x7C, 0x7C, 0xF8, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
66 | 0x80, 0xF8, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x9F, 0xFF, 0xF8, 0xFE, 0x1F,
67 | 0x01, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
68 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xC0, 0xFC,
69 | 0x7F, 0x03, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00,
70 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFE, 0x0F, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
71 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0F, 0xFF, 0xF8, 0x00, 0x00, 0x00, 0xF8, 0xFF, 0xE7, 0xE0,
72 | 0xE0, 0xE0, 0xFF, 0xFF, 0xE0, 0xE0, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xFF,
73 | 0xFE, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0x00, 0x00,
74 | 0x00, 0x00, 0x00, 0xF0, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFC, 0x3F,
75 | 0x03, 0x03, 0x1F, 0xFF, 0xFC, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x1F, 0x3E, 0x3E, 0x0F, 0x01,
76 | 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
77 | 0x07, 0xFF, 0xFF, 0x07, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
78 | 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xFE, 0x0F, 0x00, 0x00, 0x00, 0x00,
79 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xFF, 0x7F, 0x00, 0x00, 0x00,
80 | 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0xFF, 0xFF, 0x03, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
81 | 0x00, 0x00, 0xC0, 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0x80, 0x00, 0x00, 0x80,
82 | 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
83 | 0x00, 0xFF, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
84 | 0x00, 0x00, 0x80, 0xFC, 0xFF, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00,
85 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x1F, 0x3F, 0x7C, 0x7C, 0x3F, 0x1F, 0x03, 0x00, 0x00, 0x00,
86 | 0x00, 0x00, 0x7C, 0x7C, 0x7C, 0x7F, 0x7F, 0x7C, 0x7C, 0x7C, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x7C,
87 | 0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x7E, 0x7C, 0x7C, 0x7E, 0x1F, 0x07,
88 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x00, 0x00, 0x00, 0x00,
89 | 0x00, 0x1F, 0x3E, 0x7C, 0x7C, 0x3E, 0x1F, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x1F,
90 | 0x7F, 0x7C, 0x7C, 0x3F, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x00, 0x00, 0x00, 0x00,
91 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x1F, 0x3F, 0x7E, 0x7C, 0x7E, 0x3F, 0x1F, 0x01, 0x00, 0x00,
92 | 0x00, 0x00, 0x3E, 0x7C, 0x7C, 0x7E, 0x3F, 0x0F, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
93 | 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
94 | };
95 |
96 |
97 |
--------------------------------------------------------------------------------
/src/res/qw_bmp_sparkfun.h:
--------------------------------------------------------------------------------
1 | // qw_bmp_sparkun.h
2 | //
3 | // This is a library written for SparkFun Qwiic OLED boards that use the SSD1306.
4 | //
5 | // SparkFun sells these at its website: www.sparkfun.com
6 | //
7 | // Do you like this library? Help support SparkFun. Buy a board!
8 | //
9 | // Micro OLED https://www.sparkfun.com/products/14532
10 | // Transparent OLED https://www.sparkfun.com/products/15173
11 | // "Narrow" OLED https://www.sparkfun.com/products/17153
12 | //
13 | //
14 | // Written by Kirk Benell @ SparkFun Electronics, March 2022
15 | //
16 | // This library configures and draws graphics to OLED boards that use the
17 | // SSD1306 display hardware. The library only supports I2C.
18 | //
19 | // Repository:
20 | // https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library
21 | //
22 | // Documentation:
23 | // https://sparkfun.github.io/SparkFun_Qwiic_OLED_Arduino_Library/
24 | //
25 | //
26 | // SparkFun code, firmware, and software is released under the MIT License(http://opensource.org/licenses/MIT).
27 | //
28 | // SPDX-License-Identifier: MIT
29 | //
30 | // The MIT License (MIT)
31 | //
32 | // Copyright (c) 2022 SparkFun Electronics
33 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
34 | // associated documentation files (the "Software"), to deal in the Software without restriction,
35 | // including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
36 | // and/or sell copies of the Software, and to permit persons to whom the Software is furnished to
37 | // do so, subject to the following conditions:
38 | // The above copyright notice and this permission notice shall be included in all copies or substantial
39 | // portions of the Software.
40 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
41 | // NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
42 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
43 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
44 | // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
45 |
46 | #pragma once
47 |
48 | #include "qwiic_resdef.h"
49 |
50 | class QwBMPSparkFun final : public bmpSingleton {
51 |
52 | public:
53 | const uint8_t* data(void)
54 | {
55 |
56 | #include "_bmp_sparkfun.h"
57 |
58 | return bmp_sparkfun_data;
59 | }
60 |
61 | QwBMPSparkFun()
62 | : bmpSingleton(BMP_SPARKFUN_WIDTH, BMP_SPARKFUN_HEIGHT)
63 | {
64 | }
65 | };
66 |
67 | #define QW_BMP_SPARKFUN QwBMPSparkFun::instance()
--------------------------------------------------------------------------------
/src/res/qw_bmp_truck.h:
--------------------------------------------------------------------------------
1 | // qw_bmp_truck.h
2 | //
3 | // This is a library written for SparkFun Qwiic OLED boards that use the SSD1306.
4 | //
5 | // SparkFun sells these at its website: www.sparkfun.com
6 | //
7 | // Do you like this library? Help support SparkFun. Buy a board!
8 | //
9 | // Micro OLED https://www.sparkfun.com/products/14532
10 | // Transparent OLED https://www.sparkfun.com/products/15173
11 | // "Narrow" OLED https://www.sparkfun.com/products/17153
12 | //
13 | //
14 | // Written by Kirk Benell @ SparkFun Electronics, March 2022
15 | //
16 | // This library configures and draws graphics to OLED boards that use the
17 | // SSD1306 display hardware. The library only supports I2C.
18 | //
19 | // Repository:
20 | // https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library
21 | //
22 | // Documentation:
23 | // https://sparkfun.github.io/SparkFun_Qwiic_OLED_Arduino_Library/
24 | //
25 | //
26 | // SparkFun code, firmware, and software is released under the MIT License(http://opensource.org/licenses/MIT).
27 | //
28 | // SPDX-License-Identifier: MIT
29 | //
30 | // The MIT License (MIT)
31 | //
32 | // Copyright (c) 2022 SparkFun Electronics
33 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
34 | // associated documentation files (the "Software"), to deal in the Software without restriction,
35 | // including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
36 | // and/or sell copies of the Software, and to permit persons to whom the Software is furnished to
37 | // do so, subject to the following conditions:
38 | // The above copyright notice and this permission notice shall be included in all copies or substantial
39 | // portions of the Software.
40 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
41 | // NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
42 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
43 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
44 | // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
45 |
46 | #pragma once
47 |
48 | #include "qwiic_resdef.h"
49 |
50 | class QwBMPTruck final : public bmpSingleton {
51 |
52 | public:
53 | const uint8_t* data(void)
54 | {
55 |
56 | #include "_bmp_truck.h"
57 |
58 | return bmp_truck_data;
59 | }
60 |
61 | QwBMPTruck()
62 | : bmpSingleton(BMP_TRUCK_WIDTH, BMP_TRUCK_HEIGHT)
63 | {
64 | }
65 | };
66 |
67 | #define QW_BMP_TRUCK QwBMPTruck::instance()
--------------------------------------------------------------------------------
/src/res/qw_fnt_31x48.h:
--------------------------------------------------------------------------------
1 | // qw_fnt_31x48.h
2 | //
3 | // This is a library written for SparkFun Qwiic OLED boards that use the SSD1306.
4 | //
5 | // SparkFun sells these at its website: www.sparkfun.com
6 | //
7 | // Do you like this library? Help support SparkFun. Buy a board!
8 | //
9 | // Micro OLED https://www.sparkfun.com/products/14532
10 | // Transparent OLED https://www.sparkfun.com/products/15173
11 | // "Narrow" OLED https://www.sparkfun.com/products/17153
12 | //
13 | //
14 | // Written by Kirk Benell @ SparkFun Electronics, March 2022
15 | //
16 | // This library configures and draws graphics to OLED boards that use the
17 | // SSD1306 display hardware. The library only supports I2C.
18 | //
19 | // Repository:
20 | // https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library
21 | //
22 | // Documentation:
23 | // https://sparkfun.github.io/SparkFun_Qwiic_OLED_Arduino_Library/
24 | //
25 | //
26 | // SparkFun code, firmware, and software is released under the MIT License(http://opensource.org/licenses/MIT).
27 | //
28 | // SPDX-License-Identifier: MIT
29 | //
30 | // The MIT License (MIT)
31 | //
32 | // Copyright (c) 2022 SparkFun Electronics
33 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
34 | // associated documentation files (the "Software"), to deal in the Software without restriction,
35 | // including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
36 | // and/or sell copies of the Software, and to permit persons to whom the Software is furnished to
37 | // do so, subject to the following conditions:
38 | // The above copyright notice and this permission notice shall be included in all copies or substantial
39 | // portions of the Software.
40 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
41 | // NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
42 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
43 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
44 | // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
45 |
46 | #pragma once
47 |
48 | #include "qwiic_resdef.h"
49 |
50 | class QwFont31x48 final : public fontSingleton {
51 |
52 | public:
53 | const uint8_t* data(void)
54 | {
55 | // include font data (static const), and attribute defines.
56 | // Doing this here makes the data variable a static (aka only one instance ever)
57 | // variable in this method.
58 | #include "_fnt_31x48.h"
59 |
60 | return font31x48_data;
61 | }
62 |
63 | QwFont31x48()
64 | : fontSingleton(FONT_31X48_WIDTH,
65 | FONT_31X48_HEIGHT,
66 | FONT_31X48_START,
67 | FONT_31X48_NCHAR,
68 | FONT_31X48_MAP_WIDTH,
69 | FONT_31X48_NAME)
70 | {
71 | }
72 | };
73 |
74 | #define QW_FONT_31X48 QwFont31x48::instance()
--------------------------------------------------------------------------------
/src/res/qw_fnt_5x7.h:
--------------------------------------------------------------------------------
1 | // qw_fnt_5x7.h
2 | //
3 | // This is a library written for SparkFun Qwiic OLED boards that use the SSD1306.
4 | //
5 | // SparkFun sells these at its website: www.sparkfun.com
6 | //
7 | // Do you like this library? Help support SparkFun. Buy a board!
8 | //
9 | // Micro OLED https://www.sparkfun.com/products/14532
10 | // Transparent OLED https://www.sparkfun.com/products/15173
11 | // "Narrow" OLED https://www.sparkfun.com/products/17153
12 | //
13 | //
14 | // Written by Kirk Benell @ SparkFun Electronics, March 2022
15 | //
16 | // This library configures and draws graphics to OLED boards that use the
17 | // SSD1306 display hardware. The library only supports I2C.
18 | //
19 | // Repository:
20 | // https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library
21 | //
22 | // Documentation:
23 | // https://sparkfun.github.io/SparkFun_Qwiic_OLED_Arduino_Library/
24 | //
25 | //
26 | // SparkFun code, firmware, and software is released under the MIT License(http://opensource.org/licenses/MIT).
27 | //
28 | // SPDX-License-Identifier: MIT
29 | //
30 | // The MIT License (MIT)
31 | //
32 | // Copyright (c) 2022 SparkFun Electronics
33 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
34 | // associated documentation files (the "Software"), to deal in the Software without restriction,
35 | // including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
36 | // and/or sell copies of the Software, and to permit persons to whom the Software is furnished to
37 | // do so, subject to the following conditions:
38 | // The above copyright notice and this permission notice shall be included in all copies or substantial
39 | // portions of the Software.
40 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
41 | // NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
42 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
43 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
44 | // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
45 |
46 | #pragma once
47 |
48 | #include "qwiic_resdef.h"
49 |
50 | class QwFont5x7 final : public fontSingleton {
51 |
52 | public:
53 | const uint8_t* data(void)
54 | {
55 | // include font data (static const), and attribute defines.
56 | // Doing this here makes the data variable a static (aka only one instance ever)
57 | // variable in this method.
58 | #include "_fnt_5x7.h"
59 |
60 | return font5x7_data;
61 | }
62 |
63 | QwFont5x7()
64 | : fontSingleton(FONT_5X7_WIDTH,
65 | FONT_5X7_HEIGHT,
66 | FONT_5X7_START,
67 | FONT_5X7_NCHAR,
68 | FONT_5X7_MAP_WIDTH,
69 | FONT_5X7_NAME)
70 | {
71 | }
72 | };
73 |
74 | #define QW_FONT_5X7 QwFont5x7::instance()
--------------------------------------------------------------------------------
/src/res/qw_fnt_7segment.h:
--------------------------------------------------------------------------------
1 | // qw_fnt_7segment.h
2 | //
3 | // This is a library written for SparkFun Qwiic OLED boards that use the SSD1306.
4 | //
5 | // SparkFun sells these at its website: www.sparkfun.com
6 | //
7 | // Do you like this library? Help support SparkFun. Buy a board!
8 | //
9 | // Micro OLED https://www.sparkfun.com/products/14532
10 | // Transparent OLED https://www.sparkfun.com/products/15173
11 | // "Narrow" OLED https://www.sparkfun.com/products/17153
12 | //
13 | //
14 | // Written by Kirk Benell @ SparkFun Electronics, March 2022
15 | //
16 | // This library configures and draws graphics to OLED boards that use the
17 | // SSD1306 display hardware. The library only supports I2C.
18 | //
19 | // Repository:
20 | // https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library
21 | //
22 | // Documentation:
23 | // https://sparkfun.github.io/SparkFun_Qwiic_OLED_Arduino_Library/
24 | //
25 | //
26 | // SparkFun code, firmware, and software is released under the MIT License(http://opensource.org/licenses/MIT).
27 | //
28 | // SPDX-License-Identifier: MIT
29 | //
30 | // The MIT License (MIT)
31 | //
32 | // Copyright (c) 2022 SparkFun Electronics
33 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
34 | // associated documentation files (the "Software"), to deal in the Software without restriction,
35 | // including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
36 | // and/or sell copies of the Software, and to permit persons to whom the Software is furnished to
37 | // do so, subject to the following conditions:
38 | // The above copyright notice and this permission notice shall be included in all copies or substantial
39 | // portions of the Software.
40 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
41 | // NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
42 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
43 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
44 | // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
45 |
46 | #pragma once
47 |
48 | #include "qwiic_resdef.h"
49 |
50 | class QwFont7Segment final : public fontSingleton {
51 |
52 | public:
53 | const uint8_t* data(void)
54 | {
55 | // include font data (static const), and attribute defines.
56 | // Doing this here makes the data variable a static (aka only one instance ever)
57 | // variable in this method.
58 | #include "_fnt_7segment.h"
59 |
60 | return segment7_data;
61 | }
62 |
63 | QwFont7Segment()
64 | : fontSingleton(FONT_7SEG_WIDTH,
65 | FONT_7SEG_HEIGHT,
66 | FONT_7SEG_START,
67 | FONT_7SEG_NCHAR,
68 | FONT_7SEG_MAP_WIDTH,
69 | FONT_7SEG_NAME)
70 | {
71 | }
72 | };
73 |
74 | #define QW_FONT_7SEGMENT QwFont7Segment::instance()
--------------------------------------------------------------------------------
/src/res/qw_fnt_8x16.h:
--------------------------------------------------------------------------------
1 | // qw_fnt_8x16.h
2 | //
3 | // This is a library written for SparkFun Qwiic OLED boards that use the SSD1306.
4 | //
5 | // SparkFun sells these at its website: www.sparkfun.com
6 | //
7 | // Do you like this library? Help support SparkFun. Buy a board!
8 | //
9 | // Micro OLED https://www.sparkfun.com/products/14532
10 | // Transparent OLED https://www.sparkfun.com/products/15173
11 | // "Narrow" OLED https://www.sparkfun.com/products/17153
12 | //
13 | //
14 | // Written by Kirk Benell @ SparkFun Electronics, March 2022
15 | //
16 | // This library configures and draws graphics to OLED boards that use the
17 | // SSD1306 display hardware. The library only supports I2C.
18 | //
19 | // Repository:
20 | // https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library
21 | //
22 | // Documentation:
23 | // https://sparkfun.github.io/SparkFun_Qwiic_OLED_Arduino_Library/
24 | //
25 | //
26 | // SparkFun code, firmware, and software is released under the MIT License(http://opensource.org/licenses/MIT).
27 | //
28 | // SPDX-License-Identifier: MIT
29 | //
30 | // The MIT License (MIT)
31 | //
32 | // Copyright (c) 2022 SparkFun Electronics
33 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
34 | // associated documentation files (the "Software"), to deal in the Software without restriction,
35 | // including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
36 | // and/or sell copies of the Software, and to permit persons to whom the Software is furnished to
37 | // do so, subject to the following conditions:
38 | // The above copyright notice and this permission notice shall be included in all copies or substantial
39 | // portions of the Software.
40 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
41 | // NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
42 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
43 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
44 | // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
45 |
46 | #pragma once
47 |
48 | #include "qwiic_resdef.h"
49 |
50 | class QwFont8x16 final : public fontSingleton {
51 |
52 | public:
53 | const uint8_t* data(void)
54 | {
55 | // include font data (static const), and attribute defines.
56 | // Doing this here makes the data variable a static (aka only one instance ever)
57 | // variable in this method.
58 | #include "_fnt_8x16.h"
59 |
60 | return font8x16_data;
61 | }
62 |
63 | QwFont8x16()
64 | : fontSingleton(FONT_8X16_WIDTH,
65 | FONT_8X16_HEIGHT,
66 | FONT_8X16_START,
67 | FONT_8X16_NCHAR,
68 | FONT_8X16_MAP_WIDTH,
69 | FONT_8X16_NAME)
70 | {
71 | }
72 | };
73 |
74 | #define QW_FONT_8X16 QwFont8x16::instance()
--------------------------------------------------------------------------------
/src/res/qw_fnt_largenum.h:
--------------------------------------------------------------------------------
1 | // qw_fnt_largenum.h
2 | //
3 | // This is a library written for SparkFun Qwiic OLED boards that use the SSD1306.
4 | //
5 | // SparkFun sells these at its website: www.sparkfun.com
6 | //
7 | // Do you like this library? Help support SparkFun. Buy a board!
8 | //
9 | // Micro OLED https://www.sparkfun.com/products/14532
10 | // Transparent OLED https://www.sparkfun.com/products/15173
11 | // "Narrow" OLED https://www.sparkfun.com/products/17153
12 | //
13 | //
14 | // Written by Kirk Benell @ SparkFun Electronics, March 2022
15 | //
16 | // This library configures and draws graphics to OLED boards that use the
17 | // SSD1306 display hardware. The library only supports I2C.
18 | //
19 | // Repository:
20 | // https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library
21 | //
22 | // Documentation:
23 | // https://sparkfun.github.io/SparkFun_Qwiic_OLED_Arduino_Library/
24 | //
25 | //
26 | // SparkFun code, firmware, and software is released under the MIT License(http://opensource.org/licenses/MIT).
27 | //
28 | // SPDX-License-Identifier: MIT
29 | //
30 | // The MIT License (MIT)
31 | //
32 | // Copyright (c) 2022 SparkFun Electronics
33 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
34 | // associated documentation files (the "Software"), to deal in the Software without restriction,
35 | // including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
36 | // and/or sell copies of the Software, and to permit persons to whom the Software is furnished to
37 | // do so, subject to the following conditions:
38 | // The above copyright notice and this permission notice shall be included in all copies or substantial
39 | // portions of the Software.
40 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
41 | // NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
42 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
43 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
44 | // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
45 |
46 | #pragma once
47 |
48 | #include "qwiic_resdef.h"
49 |
50 | class QwFontLargeNum final : public fontSingleton {
51 |
52 | public:
53 | const uint8_t* data(void)
54 | {
55 | // include font data (static const), and attribute defines.
56 | // Doing this here makes the data variable a static (aka only one instance ever)
57 | // variable in this method.
58 | #include "_fnt_largenum.h"
59 |
60 | return fontlargenum_data;
61 | }
62 |
63 | QwFontLargeNum()
64 | : fontSingleton(FONT_LARGENUM_WIDTH,
65 | FONT_LARGENUM_HEIGHT,
66 | FONT_LARGENUM_START,
67 | FONT_LARGENUM_NCHAR,
68 | FONT_LARGENUM_MAP_WIDTH,
69 | FONT_LARGENUM_NAME)
70 | {
71 | }
72 | };
73 |
74 | #define QW_FONT_LARGENUM QwFontLargeNum::instance()
--------------------------------------------------------------------------------
/src/res/qw_pgm_arduino.h:
--------------------------------------------------------------------------------
1 |
2 | // qw_pgm_arduino.h
3 | //
4 | // This is a library written for SparkFun Qwiic OLED boards that use the SSD1306.
5 | //
6 | // SparkFun sells these at its website: www.sparkfun.com
7 | //
8 | // Do you like this library? Help support SparkFun. Buy a board!
9 | //
10 | // Micro OLED https://www.sparkfun.com/products/14532
11 | // Transparent OLED https://www.sparkfun.com/products/15173
12 | // "Narrow" OLED https://www.sparkfun.com/products/17153
13 | //
14 | //
15 | // Written by Kirk Benell @ SparkFun Electronics, March 2022
16 | //
17 | // This library configures and draws graphics to OLED boards that use the
18 | // SSD1306 display hardware. The library only supports I2C.
19 | //
20 | // Repository:
21 | // https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library
22 | //
23 | // Documentation:
24 | // https://sparkfun.github.io/SparkFun_Qwiic_OLED_Arduino_Library/
25 | //
26 | //
27 | // SparkFun code, firmware, and software is released under the MIT License(http://opensource.org/licenses/MIT).
28 | //
29 | // SPDX-License-Identifier: MIT
30 | //
31 | // The MIT License (MIT)
32 | //
33 | // Copyright (c) 2022 SparkFun Electronics
34 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
35 | // associated documentation files (the "Software"), to deal in the Software without restriction,
36 | // including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
37 | // and/or sell copies of the Software, and to permit persons to whom the Software is furnished to
38 | // do so, subject to the following conditions:
39 | // The above copyright notice and this permission notice shall be included in all copies or substantial
40 | // portions of the Software.
41 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
42 | // NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
43 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
44 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
45 | // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
46 |
47 | // File to declare pgmspace in a platform abstract (sort of ) way
48 |
49 | #pragma once
50 |
51 | #if defined(TARGET_Apollo3)
52 | // do nothing
53 | #elif defined(__AVR__) || defined(__arm__) || defined(__ARDUINO_ARC__)
54 | #include
55 |
56 | #else
57 | #include
58 | #endif
59 |
60 |
--------------------------------------------------------------------------------
/src/res/qwiic_resdef.h:
--------------------------------------------------------------------------------
1 | // qwiic_resdef.h
2 | //
3 | // This is a library written for SparkFun Qwiic OLED boards that use the SSD1306.
4 | //
5 | // SparkFun sells these at its website: www.sparkfun.com
6 | //
7 | // Do you like this library? Help support SparkFun. Buy a board!
8 | //
9 | // Micro OLED https://www.sparkfun.com/products/14532
10 | // Transparent OLED https://www.sparkfun.com/products/15173
11 | // "Narrow" OLED https://www.sparkfun.com/products/17153
12 | //
13 | //
14 | // Written by Kirk Benell @ SparkFun Electronics, March 2022
15 | //
16 | // This library configures and draws graphics to OLED boards that use the
17 | // SSD1306 display hardware. The library only supports I2C.
18 | //
19 | // Repository:
20 | // https://github.com/sparkfun/SparkFun_Qwiic_OLED_Arduino_Library
21 | //
22 | // Documentation:
23 | // https://sparkfun.github.io/SparkFun_Qwiic_OLED_Arduino_Library/
24 | //
25 | //
26 | // SparkFun code, firmware, and software is released under the MIT License(http://opensource.org/licenses/MIT).
27 | //
28 | // SPDX-License-Identifier: MIT
29 | //
30 | // The MIT License (MIT)
31 | //
32 | // Copyright (c) 2022 SparkFun Electronics
33 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
34 | // associated documentation files (the "Software"), to deal in the Software without restriction,
35 | // including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
36 | // and/or sell copies of the Software, and to permit persons to whom the Software is furnished to
37 | // do so, subject to the following conditions:
38 | // The above copyright notice and this permission notice shall be included in all copies or substantial
39 | // portions of the Software.
40 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
41 | // NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
42 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
43 | // WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
44 | // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
45 |
46 | //
47 | // Define resource objects/structures to manage fonts and bitmaps
48 |
49 | //
50 | #pragma once
51 |
52 | // NOTE: The way I'm including the font/resource defines, some platforms have
53 | // include file issues
54 |
55 | #include "qw_pgm_arduino.h"
56 |
57 | #include
58 |
59 | ////////////////////////////////////////////////////////////////////////
60 | // Notes Template singletons for managing resources
61 | ////////////////////////////////////////////////////////////////////////
62 | //
63 | // The common use/storage of bitmap and font data is creating a static
64 | // array and placing it in a header file.
65 | //
66 | // This pattern is fine for simple uses, where the bitmap is only included
67 | // in a single file. BUT if the bitmap header is included in multiple files,
68 | // multiple copies of the bitmap are created.
69 | //
70 | // You could just make the bitmap array a const - but then multiple includes
71 | // will lead to symbol collision at link time - confusing the user.
72 | //
73 | // These simple classes help place the bitmap data in a singleton class AND
74 | // only create one copy/instance of the bitmap data no matter how many times a
75 | // resource header file is included.
76 | //
77 | // The Plan:
78 | // - Define a base resource class
79 | // - attributes as public instance vars
80 | // - Define a constructor that init's the instance vars
81 | // - Resource data access via virtual accessor - make it const
82 | //
83 | // - Create a template that subclasses the resource class, and defines a singleton
84 | // - It ensures only once of these classes is ever created.
85 | //
86 | // - In a seperate header file - one for each resource, define the resource
87 | // - For example - for a bitmap - the data array, #defines for width and height
88 | // - The data array is declard as const static
89 | //
90 | // - In another header file - create a subclass of our singleton
91 | // ex:
92 | // class QwBMPTruck final : public bitmapSingleton {
93 | //
94 | // - Override the base class data accessor method
95 | // - In the body of this method, include the resource defined header file
96 | // - This defines the resource data as a static in this method. So only one copy is made
97 | // ex:
98 | // const uint8_t * bitmap(void){
99 | // #include "bmp_truck.h"
100 | // return bmp_truck_data;
101 | // }
102 | //
103 | // - After this resource access method, define the constructor of this class
104 | // - This is done after so it can use the attribute #defines of the included resource def header
105 | // - Have the constructor call it's superclass constructor, passing in resource attributes
106 | // ex:
107 | // QwBMPTruck(): bitmapSingleton(BMP_TRUCK_WIDTH, BMP_TRUCK_HEIGHT){}
108 | //
109 | // - Lastly, define a macro that makes the syntax of access easy. This macro calls the instance
110 | // method of the singleton, getting access to the object that contains the data of the resource
111 | // ex:
112 | // #define QW_BMP_TRUCK QwBMPTruck::instance()
113 | //
114 | // To the user, they just have a bitmap, referenced as QW_BMP_TRUCK and can do the following
115 | // ex:
116 | // uint8_t width = QW_BMP_TRUCK.width;
117 | // uint8_t height = QW_BMP_TRUCK.height;
118 | //
119 | // And internal methods get the data of this bitmap object using the bitmap() method
120 | // ex:
121 | // const uint8_t * pData = QW_BMP_TRUCK.data();
122 | //
123 | // It shoulds complicated - it isn't. Just look at examples in ths folder and copy when
124 | // adding new resources.
125 | //
126 | ///////////////////////////////////////////////////////////////////////////////////////////////////
127 | // Simple Bitmap class definition
128 |
129 | class QwBitmap {
130 |
131 | public:
132 | uint8_t width;
133 | uint8_t height;
134 | virtual const uint8_t* data(void) { return nullptr; };
135 |
136 | protected:
137 | QwBitmap(uint8_t w, uint8_t h)
138 | : width { w }
139 | , height { h }
140 | {
141 | }
142 | };
143 |
144 | // Template that creates a singleton for bitmaps.
145 | template
146 | class bmpSingleton : public QwBitmap {
147 | public:
148 | static T& instance(void)
149 | {
150 | static T instance;
151 | return instance;
152 | }
153 |
154 | bmpSingleton(const bmpSingleton&) = delete;
155 | bmpSingleton& operator=(const bmpSingleton) = delete;
156 |
157 | protected:
158 | bmpSingleton() { }
159 | using QwBitmap::QwBitmap; // inherit contructor
160 | };
161 |
162 | ///////////////////////////////////////////////////////////////////////////////////////////////////
163 | // Font things - class to hold font attributes
164 |
165 | class QwFont {
166 |
167 | public:
168 | uint8_t width;
169 | uint8_t height;
170 | uint8_t start;
171 | uint8_t n_chars;
172 | uint16_t map_width;
173 | const char* name;
174 |
175 | virtual const uint8_t* data(void) { return nullptr; };
176 |
177 | protected:
178 | QwFont(uint8_t w, uint8_t h, uint8_t st_chr, uint8_t n_chr, uint16_t m_w, const char* f_name)
179 | : width { w }
180 | , height { h }
181 | , start { st_chr }
182 | , n_chars { n_chr }
183 | , map_width { m_w }
184 | , name { f_name }
185 | {
186 | }
187 | };
188 |
189 | // Template that creates a singleton for bitmaps.
190 | template
191 | class fontSingleton : public QwFont {
192 | public:
193 | static T& instance(void)
194 | {
195 | static T instance;
196 | return instance;
197 | }
198 |
199 | fontSingleton(const fontSingleton&) = delete;
200 | fontSingleton& operator=(const fontSingleton) = delete;
201 |
202 | protected:
203 | fontSingleton() { }
204 | using QwFont::QwFont; // inherit constructor
205 | };
206 |
--------------------------------------------------------------------------------