Skip to content

Commit 07a3dc3

Browse files
committed
Add skeleton of docs
1 parent 6126b91 commit 07a3dc3

14 files changed

+1222
-0
lines changed

.github/workflows/mkdocs.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Used to run mkdocs on the repo
2+
3+
name: ci
4+
on:
5+
push:
6+
branches:
7+
- main
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: actions/setup-python@v2
14+
with:
15+
python-version: 3.x
16+
- run: pip install mkdocs-material mkdocs-monorepo-plugin
17+
- run: mkdocs gh-deploy --force

docs/api_arduino.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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|

docs/api_device.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
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+

docs/api_draw.md

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
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 | `<res/qw_fnt_5x7.h>` | `QW_FONT_5X7`| A full, 5 x 7 font|
28+
| 31x48 | `<res/qw_fnt_31x48.h>` |`QW_FONT_31X48`| A full, 31 x 48 font|
29+
| Seven Segment | `<res/qw_fnt_7segment.h>` |`QW_FONT_7SEGMENT`| Numbers only|
30+
| 8x16 | `<res/qw_fnt_8x16.h>` | `QW_FONT_8X16`| A full, 8 x 16 font|
31+
| Large Numbers | `<res/qw_fnt_largenum.h>` |`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 <res/qw_fnt_31x48.h>
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.|

0 commit comments

Comments
 (0)