moberg.h 1.38 KB
Newer Older
1
2
3
#ifndef __MOBERG_H__
#define __MOBERG_H__

Anders Blomdell's avatar
Anders Blomdell committed
4
#include <stdio.h>
5

Anders Blomdell's avatar
Anders Blomdell committed
6
struct moberg;
7
8
struct moberg_config;

Anders Blomdell's avatar
Anders Blomdell committed
9
/* Creation & free */
10

Anders Blomdell's avatar
Anders Blomdell committed
11
struct moberg *moberg_new(struct moberg_config *config);
12

Anders Blomdell's avatar
Anders Blomdell committed
13
void moberg_free(struct moberg *moberg);
14

Anders Blomdell's avatar
Anders Blomdell committed
15
/* Input/output */
Anders Blomdell's avatar
Anders Blomdell committed
16

Anders Blomdell's avatar
Anders Blomdell committed
17
18
19
20
struct moberg_analog_in {
  struct moberg_channel_analog_in *context;
  int (*read)(struct moberg_channel_analog_in *, double *value);
};
Anders Blomdell's avatar
Anders Blomdell committed
21

Anders Blomdell's avatar
Anders Blomdell committed
22
23
24
25
struct moberg_analog_out {
  struct moberg_channel_analog_out *context;
  int (*write)(struct moberg_channel_analog_in *, double value);
};
Anders Blomdell's avatar
Anders Blomdell committed
26

Anders Blomdell's avatar
Anders Blomdell committed
27
28
29
30
struct moberg_digital_in {
  struct moberg_channel_digital_in *context;
  int (*read)(struct moberg_channel_digital_in *, int *value);
};
Anders Blomdell's avatar
Anders Blomdell committed
31

Anders Blomdell's avatar
Anders Blomdell committed
32
33
34
35
struct moberg_digital_out {
  struct moberg_channel_digital_out *context;
  int (*write)(struct moberg_channel_digital_out *, int value);
};
Anders Blomdell's avatar
Anders Blomdell committed
36

Anders Blomdell's avatar
Anders Blomdell committed
37
38
39
40
41
42
43
44
45
46
47
48
struct moberg_encoder_in {
  struct moberg_channel_encoder_in *context;
  int (*read)(struct moberg_channel_encoder_in *, long *value);
};

int moberg_analog_in_open(struct moberg *moberg,
                          int index,
                          struct moberg_analog_in *analog_in);

int moberg_analog_in_close(struct moberg *moberg,
                           int index,
                           struct moberg_analog_in analog_in);
Anders Blomdell's avatar
Anders Blomdell committed
49

Anders Blomdell's avatar
Anders Blomdell committed
50
/* System init functionality (systemd/init/...) */
Anders Blomdell's avatar
Anders Blomdell committed
51

Anders Blomdell's avatar
Anders Blomdell committed
52
int moberg_start(
Anders Blomdell's avatar
Anders Blomdell committed
53
54
55
  struct moberg *moberg,
  FILE *f);

Anders Blomdell's avatar
Anders Blomdell committed
56
int moberg_stop(
Anders Blomdell's avatar
Anders Blomdell committed
57
58
  struct moberg *moberg,
  FILE *f);
59
60

#endif