-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPiGpio.hx
executable file
·95 lines (73 loc) · 3.14 KB
/
PiGpio.hx
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
package;
#if cpp
import cpp.Lib;
#elseif neko
import neko.Lib;
#end
class PiGpio {
public static function sampleMethod (inputValue:Int):Int {
return pigpio_sample_method(inputValue);
}
public static function wiringPiSetupGpio ():Void{
pigpio_wiringPiSetupGpio();
}
public static function pinMode ( pin:Int, mode:Int ):Void {
pigpio_pinMode(pin,mode);
}
public static function pinModeAlt ( pin:Int, mode:Int ):Void {
pigpio_pinModeAlt(pin,mode);
}
public static function pullUpDnControl ( pin:Int, mode:Int ):Void {
pigpio_pullUpDnControl(pin,mode);
}
public static function digitalRead( pin:Int):Int{
return pigpio_digitalRead(pin);
}
public static function digitalWrite ( pin:Int, value:Int ):Void {
pigpio_digitalWrite(pin,value);
}
public static function pwmWrite ( pin:Int, value:Int ):Void {
pigpio_pwmWrite(pin,value);
}
public static function analogRead( pin:Int):Int{
return pigpio_analogRead(pin);
}
public static function analogWrite ( pin:Int, value:Int ):Void {
pigpio_analogWrite(pin,value);
}
public static function setupMcp300x(base:Int, spiChan:Int):Void{
pigpio_setupMcp300x(base,spiChan);
}
public static function setupTtp229(base:Int):Int{
return pigpio_setupTtp229(base);
}
private static var pigpio_sample_method = Lib.load ("pigpio", "pigpio_sample_method", 1);
private static var pigpio_wiringPiSetup = Lib.load ("pigpio", "pigpio_wiringPiSetup", 0);
private static var pigpio_wiringPiSetupSys = Lib.load ("pigpio", "pigpio_wiringPiSetupSys", 0);
private static var pigpio_wiringPiSetupGpio = Lib.load ("pigpio", "pigpio_wiringPiSetupGpio", 0);
private static var pigpio_wiringPiSetupPhys = Lib.load ("pigpio", "pigpio_wiringPiSetupPhys", 0);
private static var pigpio_pinMode = Lib.load ("pigpio", "pigpio_pinMode", 2);
private static var pigpio_pinModeAlt = Lib.load ("pigpio", "pigpio_pinModeAlt", 2);
private static var pigpio_pullUpDnControl = Lib.load ("pigpio", "pigpio_pullUpDnControl", 2);
private static var pigpio_digitalRead = Lib.load ("pigpio", "pigpio_digitalRead", 1);
private static var pigpio_digitalWrite = Lib.load ("pigpio", "pigpio_digitalWrite", 2);
private static var pigpio_pwmWrite = Lib.load ("pigpio", "pigpio_pwmWrite", 2);
private static var pigpio_analogRead = Lib.load ("pigpio", "pigpio_analogRead", 1);
private static var pigpio_analogWrite = Lib.load ("pigpio", "pigpio_analogWrite", 2);
private static var pigpio_setupMcp300x = Lib.load ("pigpio", "pigpio_setupMcp300x", 2);
private static var pigpio_setupTtp229 = Lib.load ("pigpio", "pigpio_setupTtp229", 1);
public static var INPUT :Int = 0;
public static var OUTPUT :Int = 1;
public static var PWM_OUTPUT :Int = 2;
public static var GPIO_CLOCK :Int = 3;
public static var SOFT_PWM_OUTPUT :Int = 4;
public static var SOFT_TONE_OUTPUT :Int = 5;
public static var PWM_TONE_OUTPUT :Int = 6;
public static var LOW :Int = 0;
public static var HIGH :Int = 1;
public static var PUD_OFF :Int = 0;
public static var PUD_DOWN :Int = 1;
public static var PUD_UP :Int = 2;
public static var PWM_MODE_MS :Int = 0;
public static var PWM_MODE_BAL :Int = 1;
}