-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.c
More file actions
55 lines (42 loc) · 1.12 KB
/
Copy pathmain.c
File metadata and controls
55 lines (42 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <stdio.h>
#include <string.h>
#include "tusb.h"
#include "pdnd/pdnd.h"
#include "pdnd/pdnd_display.h"
#include "hello.h"
void display_inputs() {
cls(false);
pprintf("Hello World\nInputs:");
char inputs[32] = "";
// Iterate all inputs and display them.
for(int i=7; i >= 0; i--) {
if(pdnd_in(i)) {
strcat(inputs, "1 ");
} else {
strcat(inputs, "0 ");
}
}
pprintfxy(0, 40, inputs);
}
int main() {
// Initialize USB-UART as STDIO
stdio_init_all();
// Initialize pico-debug-n-dump lib
pdnd_initialize();
// Initialize display
pdnd_display_initialize();
// At this point in time, the buffers are off:
// Both outputs and inputs are in high-impedance mode.
// Display an image on the screen
// hello comes from hello.h and was created using make_screen
// (part of pdnd-lib)
pdnd_display_screen(pdnd_global_display, &hello);
sleep_ms(3000);
// Next, we enable the buffers.
pdnd_enable_buffers(1);
while(1) {
display_inputs();
sleep_ms(1000);
}
return 0;
}