TP3 RTOS
1.0
Implémentation d'un RTOS sur une jetson nano
include
utils.h
Aller à la documentation de ce fichier.
1
12
#ifndef UTILS_H
13
#define UTILS_H
14
15
#include <stdio.h>
16
#include <stdlib.h>
17
18
#include <dirent.h>
19
#include <errno.h>
20
21
#include <sys/types.h>
22
#include <sys/stat.h>
23
#include <fcntl.h>
24
#include <poll.h>
25
#include <unistd.h>
26
27
struct
GPIO
28
{
29
int
pin;
30
int
gpio;
31
char
gpio_s[7];
32
33
int
fd_value;
34
char
str_value[200];
35
36
int
fd_direction;
37
char
str_direction[200];
38
39
int
locked;
40
int
direction;
41
int
value;
42
43
// ISR Like behavior
44
struct
pollfd poll_gpio;
45
};
46
47
#define HIGH '1'
48
#define LOW '0'
49
50
#define INPUT 1
51
#define OUTPUT 0
52
53
void
test();
54
void
fatal_error(
int
error_code,
char
*msg);
55
void
init_GPIOs();
56
void
digital_write(
int
port,
char
);
57
int
digital_read(
int
port);
58
int
pin_mode(
int
pin,
int
direction);
59
void
set_direction(
struct
GPIO
*pin,
int
direction);
60
void
open_value(
struct
GPIO
*pin);
61
void
export_pin(
struct
GPIO
*pin);
62
void
display(
const
struct
GPIO
*pin);
63
void
unpin_mode(
int
pin);
64
int
is_gpio(
int
pin);
65
void
destroy_gpios();
66
int
wait_for_toggle(
int
pin,
int
timeout,
void
*(func)(
void
*),
void
*args);
67
#endif
GPIO
Definition:
utils.h:28
Généré par
1.9.1