-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathhal.h
80 lines (77 loc) · 1.53 KB
/
hal.h
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
* BRS-tester by Anders Sandahl 2023-2024
*
* License GPL 2.0
*
*/
/*
* Definition of PIN vs number
*/
enum fc_pin {
AA = 0,
AB = 1,
AC = 2,
AD = 3,
AE = 4,
AF = 5,
AH = 6,
AJ = 7,
AK = 8,
AL = 9,
AM = 10,
AN = 11,
AP = 12,
AR = 13,
AS = 14,
AT = 15,
AU = 16,
AV = 17,
BA = 18,
BB = 19,
BC = 20,
BD = 21,
BE = 22,
BF = 23,
BH = 24,
BJ = 25,
BK = 26,
BL = 27,
BM = 28,
BN = 29,
BP = 30,
BR = 31,
BS = 32,
BT = 33,
BU = 34,
BV = 35,
LAST_PIN = 36,
};
/*
* Valid functions of a pin
*/
enum pinFunction {
PIN_POWER = 0,
PIN_GND = 1,
PIN_INPUT = 2,
PIN_OUTPUT = 3,
PIN_DISABLED = 4
};
int hal_powerEnable(int on);
int hal_measureCurrent(float *iMeas);
int hal_measureVoltage(float *uMeas);
int hal_measureVoltageRef(float *uMeas);
int hal_getInputs (int *data);
int hal_setup(void);
void hal_teardown(void);
int hal_setDefault(void);
int hal_enableLoad(int current, bool relayOn);
int pin_setFunction(enum fc_pin pin, enum pinFunction function);
int pin_getFunction(enum fc_pin pin, enum pinFunction *function);
int pin_setMeasure(enum fc_pin pin, int enable);
int pin_enablePullDown(enum fc_pin pin, int enable);
int pin_setDataOut(enum fc_pin pin, int data);
int pin_toggleData(enum fc_pin pin, int toggles);
int pin_setGnd(enum fc_pin pin, int data);
int pin_getValue(enum fc_pin pin, int *val);
int pin_getName(enum fc_pin pin, char **str);
enum fc_pin pin_getIndex(char *str);