-
Notifications
You must be signed in to change notification settings - Fork 106
Expand file tree
/
Copy pathmain.c
More file actions
34 lines (24 loc) · 816 Bytes
/
main.c
File metadata and controls
34 lines (24 loc) · 816 Bytes
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
#include <stdio.h>
#include <libtock-sync/peripherals/gpio.h>
#include <libtock/interface/console.h>
#include <libtock/tock.h>
int main(void) {
returncode_t ret;
printf("[Test] GPIO Sync Interrupt\n");
printf("Jump GPIO pin 0 low to start test.\n");
printf("Then move the jumper to VCC\n");
ret = libtocksync_gpio_wait_until_high(0, libtock_pull_down);
if (ret != RETURNCODE_SUCCESS) {
printf("[ERROR] %s\n", tock_strrcode(ret));
return -1;
}
printf("Pin 0 went high\n");
printf("Now jumper back to ground\n");
libtocksync_gpio_wait_until_low(0, libtock_pull_up);
printf("Pin 0 went low\n");
printf("Now jumper back to high\n");
libtocksync_gpio_wait_until_changed(0, libtock_pull_down);
printf("Pin 0 went back high\n");
printf("Success! Test done\n");
return 0;
}