ci: do not error when nothing with nitunit_some
[nit.git] / contrib / wiringPi / README.md
1 # wiringPi nit wrapper
2
3 ## Installation
4
5 You need to install the [wiringPi library](http://wiringpi.com/). Refer to [download and install](http://wiringpi.com/download-and-install/) manual.
6
7 ## Compiling
8
9 Link to the library must be passed to nit compiler:
10
11         nitc myprogram.nit --cc-lib-name wiringPi
12
13 ## Usage
14
15 You first need to initialize the wiringPi library using a setup methods.
16
17 Setup methods are:
18
19 * `wiringPi_setup`: This initialises wiringPi and assumes that the calling program is going to be using the wiringPi pin numbering scheme;
20 * `wiringPi_setup_gpio`: Same as wiringPi_setup, however it allows the calling programs to use the Broadcom GPIO pin numbers directly with no re-mapping;
21 * `wiringPi_setup_phys`: Identical to wiringPi_setup, however it allows the calling programs to use the physical pin numbers on the P1 connector only;
22 * `wiringPi_setup_sys`: This initialises wiringPi but uses the /sys/class/gpio interface rather than accessing the hardware directly;
23
24 For example:
25
26         # init wiringPi lib with gpio output
27         wiringPi_set_gpio
28
29 Then you can refer to a GPIO Pin using its id:
30
31         var pin = new RPIPin(23)
32
33 Before read or write a value on a pin you need to set its mode.
34
35 Modes are:
36
37 * INPUT
38 * OUTPUT
39 * PWM_OUTPUT
40 * GPIO_CLOCK
41
42 Note that only wiringPi pin 1 (BCM\_GPIO 18) supports PWM output and only wiringPi pin 7 (BCM\_GPIO 4) supports CLOCK output modes.
43
44         pin.mode(new RPIPinMode.output_mode)
45
46 You can then `write` or `read` a value from the pin:
47
48         pin.write(true)
49         pin.read
50
51 ## Copyrigth
52
53 The wiringPi library is released under [GNU LGPLv3](http://www.gnu.org/copyleft/lesser.html) licence.
54