Skip to content

Commit d26dd24

Browse files
init
0 parents  commit d26dd24

File tree

7 files changed

+652
-0
lines changed

7 files changed

+652
-0
lines changed

.clang-format

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
Language: Cpp
2+
AccessModifierOffset: -2
3+
AlignAfterOpenBracket: Align
4+
AlignArrayOfStructures: None
5+
AlignConsecutiveMacros:
6+
Enabled: true
7+
AcrossEmptyLines: true
8+
AcrossComments: true
9+
AlignConsecutiveAssignments: None
10+
AlignConsecutiveBitFields:
11+
Enabled: true
12+
AcrossEmptyLines: true
13+
AcrossComments: true
14+
AlignConsecutiveDeclarations: None
15+
AlignEscapedNewlines: Right
16+
AlignOperands: Align
17+
SortIncludes: true
18+
InsertBraces: true
19+
AlignTrailingComments: true
20+
AllowAllArgumentsOnNextLine: true
21+
AllowAllParametersOfDeclarationOnNextLine: true
22+
AllowShortEnumsOnASingleLine: true
23+
AllowShortBlocksOnASingleLine: Empty
24+
AllowShortCaseLabelsOnASingleLine: true
25+
AllowShortFunctionsOnASingleLine: All
26+
AllowShortLambdasOnASingleLine: All
27+
AllowShortIfStatementsOnASingleLine: Never
28+
AllowShortLoopsOnASingleLine: false
29+
AlwaysBreakAfterDefinitionReturnType: None
30+
AlwaysBreakAfterReturnType: None
31+
AlwaysBreakBeforeMultilineStrings: false
32+
AlwaysBreakTemplateDeclarations: Yes
33+
AttributeMacros:
34+
- __capability
35+
BinPackArguments: true
36+
BinPackParameters: true
37+
BraceWrapping:
38+
AfterCaseLabel: false
39+
AfterClass: false
40+
AfterControlStatement: Never
41+
AfterEnum: false
42+
AfterFunction: false
43+
AfterNamespace: false
44+
AfterObjCDeclaration: false
45+
AfterStruct: false
46+
AfterUnion: false
47+
AfterExternBlock: false
48+
BeforeCatch: false
49+
BeforeElse: false
50+
BeforeLambdaBody: false
51+
BeforeWhile: false
52+
IndentBraces: false
53+
SplitEmptyFunction: true
54+
SplitEmptyRecord: true
55+
SplitEmptyNamespace: true
56+
BreakBeforeBinaryOperators: NonAssignment
57+
BreakBeforeConceptDeclarations: true
58+
BreakBeforeBraces: Attach
59+
BreakBeforeInheritanceComma: false
60+
BreakInheritanceList: BeforeColon
61+
BreakBeforeTernaryOperators: true
62+
BreakConstructorInitializersBeforeComma: false
63+
BreakConstructorInitializers: BeforeColon
64+
BreakAfterJavaFieldAnnotations: false
65+
BreakStringLiterals: true
66+
ColumnLimit: 120
67+
CommentPragmas: "^ IWYU pragma:"
68+
QualifierAlignment: Leave
69+
CompactNamespaces: false
70+
ConstructorInitializerIndentWidth: 4
71+
ContinuationIndentWidth: 4
72+
Cpp11BracedListStyle: true
73+
DeriveLineEnding: true
74+
DerivePointerAlignment: false
75+
DisableFormat: false
76+
EmptyLineAfterAccessModifier: Never
77+
EmptyLineBeforeAccessModifier: LogicalBlock
78+
ExperimentalAutoDetectBinPacking: false
79+
PackConstructorInitializers: BinPack
80+
BasedOnStyle: ""
81+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
82+
AllowAllConstructorInitializersOnNextLine: true
83+
FixNamespaceComments: true
84+
ForEachMacros:
85+
- foreach
86+
- Q_FOREACH
87+
- BOOST_FOREACH
88+
IfMacros:
89+
- KJ_IF_MAYBE
90+
IncludeBlocks: Preserve
91+
IncludeCategories:
92+
- Regex: "^<(.*)>"
93+
Priority: 0
94+
- Regex: '^"(.*)"'
95+
Priority: 1
96+
- Regex: "(.*)"
97+
Priority: 2
98+
IncludeIsMainRegex: "(Test)?$"
99+
IncludeIsMainSourceRegex: ""
100+
IndentAccessModifiers: false
101+
IndentCaseLabels: true
102+
IndentCaseBlocks: false
103+
IndentGotoLabels: true
104+
IndentPPDirectives: None
105+
IndentExternBlock: AfterExternBlock
106+
IndentRequires: true
107+
IndentWidth: 4
108+
IndentWrappedFunctionNames: false
109+
InsertTrailingCommas: None
110+
JavaScriptQuotes: Leave
111+
JavaScriptWrapImports: true
112+
KeepEmptyLinesAtTheStartOfBlocks: true
113+
LambdaBodyIndentation: Signature
114+
MacroBlockBegin: ""
115+
MacroBlockEnd: ""
116+
MaxEmptyLinesToKeep: 1
117+
NamespaceIndentation: None
118+
ObjCBinPackProtocolList: Auto
119+
ObjCBlockIndentWidth: 2
120+
ObjCBreakBeforeNestedBlockParam: true
121+
ObjCSpaceAfterProperty: false
122+
ObjCSpaceBeforeProtocolList: true
123+
PenaltyBreakAssignment: 2
124+
PenaltyBreakBeforeFirstCallParameter: 19
125+
PenaltyBreakComment: 300
126+
PenaltyBreakFirstLessLess: 120
127+
PenaltyBreakOpenParenthesis: 0
128+
PenaltyBreakString: 1000
129+
PenaltyBreakTemplateDeclaration: 10
130+
PenaltyExcessCharacter: 1000000
131+
PenaltyReturnTypeOnItsOwnLine: 60
132+
PenaltyIndentedWhitespace: 0
133+
PointerAlignment: Left
134+
PPIndentWidth: -1
135+
ReferenceAlignment: Pointer
136+
ReflowComments: false
137+
RemoveBracesLLVM: false
138+
SeparateDefinitionBlocks: Always
139+
ShortNamespaceLines: 1
140+
SortJavaStaticImport: Before
141+
SortUsingDeclarations: true
142+
SpaceAfterCStyleCast: false
143+
SpaceAfterLogicalNot: false
144+
SpaceAfterTemplateKeyword: true
145+
SpaceBeforeAssignmentOperators: true
146+
SpaceBeforeCaseColon: false
147+
SpaceBeforeParens: ControlStatements
148+
SpaceBeforeParensOptions:
149+
AfterControlStatements: true
150+
AfterForeachMacros: true
151+
AfterFunctionDefinitionName: false
152+
AfterFunctionDeclarationName: false
153+
AfterIfMacros: true
154+
AfterOverloadedOperator: false
155+
BeforeNonEmptyParentheses: false
156+
SpaceAroundPointerQualifiers: Default
157+
SpaceBeforeRangeBasedForLoopColon: true
158+
SpaceInEmptyBlock: false
159+
SpaceInEmptyParentheses: false
160+
SpacesBeforeTrailingComments: 1
161+
SpacesInAngles: Never
162+
SpacesInConditionalStatement: false
163+
SpacesInContainerLiterals: true
164+
SpacesInCStyleCastParentheses: false
165+
SpacesInLineCommentPrefix:
166+
Minimum: 1
167+
Maximum: -1
168+
SpacesInParentheses: false
169+
SpacesInSquareBrackets: false
170+
SpaceBeforeSquareBrackets: false
171+
BitFieldColonSpacing: Both
172+
Standard: Latest
173+
StatementAttributeLikeMacros:
174+
- Q_EMIT
175+
StatementMacros:
176+
- Q_UNUSED
177+
- QT_REQUIRE_VERSION
178+
TabWidth: 4
179+
UseCRLF: false
180+
UseTab: Never
181+
WhitespaceSensitiveMacros:
182+
- STRINGIZE
183+
- PP_STRINGIZE
184+
- BOOST_PP_STRINGIZE
185+
- NS_SWIFT_NAME
186+
- CF_SWIFT_NAME
187+
SpaceBeforeCpp11BracedList: false
188+
SpaceBeforeCtorInitializerColon: true
189+
SpaceBeforeInheritanceColon: true
190+
InsertNewlineAtEOF: true

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.vscode
2+
**/build/

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# pico-pcd8544
2+
3+
A simple library for the PCD8544 LCD controller (Nokia 5110) for the Raspberry Pi Pico.
4+
5+
This project heavily inspired by [Adafruit's PCD8544 library](https://github.com/adafruit/Adafruit-PCD8544-Nokia-5110-LCD-library) for Arduino.
6+
7+
## Running Examples
8+
9+
### Wiring
10+
11+
| Pico Pin | PCD8544 Pin |
12+
|----------|-------------|
13+
| GP12 | RST |
14+
| GP13 | CE |
15+
| GP11 | D/C |
16+
| GP15 | DIN |
17+
| GP14 | CLK |
18+
| 3V3 | VCC |
19+
| 3v3 | BL |
20+
| GND | GND |
21+
22+
### Building and Flashing
23+
24+
```bash
25+
git clone https://github.com/mucahitkurtlar/pico-pcd8544
26+
cd pico-pcd8544/examples/circle
27+
cmake -B build -S .
28+
cmake --build build
29+
cp build/circle.uf2 /path/to/pico
30+
```
31+
32+
## License
33+
34+
This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details.

examples/circle/CMakeLists.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
cmake_minimum_required(VERSION 3.12)
2+
3+
if (NOT DEFINED PICO_SDK_PATH)
4+
if (NOT $ENV{PICO_SDK_PATH} STREQUAL "")
5+
set(PICO_SDK_PATH $ENV{PICO_SDK_PATH})
6+
else()
7+
message(FATAL_ERROR "Please set PICO_SDK_PATH")
8+
endif()
9+
include(${PICO_SDK_PATH}/external/pico_sdk_import.cmake)
10+
11+
project(circle C CXX ASM)
12+
set(CMAKE_C_STANDARD 11)
13+
set(CMAKE_CXX_STANDARD 17)
14+
15+
pico_sdk_init()
16+
17+
add_executable(${PROJECT_NAME} main.c ../../src/pcd8544.c)
18+
19+
target_link_libraries(${PROJECT_NAME} pico_stdlib hardware_spi)
20+
21+
pico_add_extra_outputs(${PROJECT_NAME})
22+
endif()

examples/circle/main.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include "../../include/pcd8544.h"
2+
#include "hardware/gpio.h"
3+
#include "hardware/spi.h"
4+
#include "pico/stdlib.h"
5+
6+
int main() {
7+
stdio_init_all();
8+
struct pcd8544 screen = {.spi = spi1, .rst = 12, .ce = 13, .dc = 11, .din = 15, .clk = 14};
9+
pcd8544_init(&screen);
10+
11+
while (true) {
12+
pcd8544_clear_buffer(&screen);
13+
pcd8544_draw_circle(&screen, PCD8544_WIDTH / 2, PCD8544_HEIGHT / 2, 20, true);
14+
pcd8544_update(&screen);
15+
sleep_ms(1000);
16+
17+
pcd8544_clear_buffer(&screen);
18+
pcd8544_draw_circle(&screen, PCD8544_WIDTH / 2, PCD8544_HEIGHT / 2, 20, false);
19+
pcd8544_update(&screen);
20+
sleep_ms(1000);
21+
}
22+
23+
return 0;
24+
}

0 commit comments

Comments
 (0)