Reindent in a style similar to the one used by the OCaml compiler
indent -kr -i2
This commit is contained in:
parent
182bdb8393
commit
1be98ccdac
|
@ -9,70 +9,71 @@
|
|||
#include <wiringPi.h>
|
||||
#include <wiringShift.h>
|
||||
|
||||
value caml_hello(value unit) {
|
||||
CAMLparam1(unit);
|
||||
printf("Hello world!\n");
|
||||
CAMLreturn(Val_unit);
|
||||
value caml_hello(value unit)
|
||||
{
|
||||
CAMLparam1(unit);
|
||||
printf("Hello world!\n");
|
||||
CAMLreturn(Val_unit);
|
||||
}
|
||||
|
||||
value caml_wiringPiSetup(value unit)
|
||||
{
|
||||
CAMLparam1(unit);
|
||||
CAMLreturn(Val_int(wiringPiSetup()));
|
||||
CAMLparam1(unit);
|
||||
CAMLreturn(Val_int(wiringPiSetup()));
|
||||
}
|
||||
|
||||
value caml_wiringPiSetupGpio(value unit)
|
||||
{
|
||||
CAMLparam1(unit);
|
||||
CAMLreturn(Val_int(wiringPiSetupGpio()));
|
||||
CAMLparam1(unit);
|
||||
CAMLreturn(Val_int(wiringPiSetupGpio()));
|
||||
}
|
||||
|
||||
value caml_wiringPiSetupPhys(value unit)
|
||||
{
|
||||
CAMLparam1(unit);
|
||||
CAMLreturn(Val_int(wiringPiSetupPhys()));
|
||||
CAMLparam1(unit);
|
||||
CAMLreturn(Val_int(wiringPiSetupPhys()));
|
||||
}
|
||||
|
||||
value caml_wiringPiSetupSys(value unit)
|
||||
{
|
||||
CAMLparam1(unit);
|
||||
CAMLreturn(Val_int(wiringPiSetupSys()));
|
||||
CAMLparam1(unit);
|
||||
CAMLreturn(Val_int(wiringPiSetupSys()));
|
||||
}
|
||||
|
||||
// Core functions
|
||||
|
||||
value caml_pinMode(value pin, value mode)
|
||||
{
|
||||
CAMLparam2(pin, mode);
|
||||
pinMode(Int_val(pin), Int_val(mode));
|
||||
CAMLreturn(Val_unit);
|
||||
CAMLparam2(pin, mode);
|
||||
pinMode(Int_val(pin), Int_val(mode));
|
||||
CAMLreturn(Val_unit);
|
||||
}
|
||||
|
||||
value caml_pullUpDnControl(value pin, value pud)
|
||||
{
|
||||
CAMLparam2(pin, pud);
|
||||
pullUpDnControl(Int_val(pin), Int_val(pin));
|
||||
CAMLreturn(Val_unit);
|
||||
CAMLparam2(pin, pud);
|
||||
pullUpDnControl(Int_val(pin), Int_val(pin));
|
||||
CAMLreturn(Val_unit);
|
||||
}
|
||||
|
||||
value caml_digitalWrite(value pin, value value_p)
|
||||
{
|
||||
CAMLparam2(pin, value_p);
|
||||
digitalWrite(Int_val(pin), Int_val(value_p));
|
||||
CAMLreturn(Val_unit);
|
||||
CAMLparam2(pin, value_p);
|
||||
digitalWrite(Int_val(pin), Int_val(value_p));
|
||||
CAMLreturn(Val_unit);
|
||||
}
|
||||
|
||||
value caml_pwmWrite(value pin, value value_p)
|
||||
{
|
||||
CAMLparam2(pin, value_p);
|
||||
pwmWrite(Int_val(pin), Int_val(value_p));
|
||||
CAMLreturn(Val_unit);
|
||||
CAMLparam2(pin, value_p);
|
||||
pwmWrite(Int_val(pin), Int_val(value_p));
|
||||
CAMLreturn(Val_unit);
|
||||
}
|
||||
|
||||
value caml_digitalRead(value pin)
|
||||
{
|
||||
CAMLparam1(pin);
|
||||
CAMLreturn(Val_int(digitalRead(Int_val(pin))));
|
||||
CAMLparam1(pin);
|
||||
CAMLreturn(Val_int(digitalRead(Int_val(pin))));
|
||||
}
|
||||
|
||||
// AnalogRead and AnalogWrite needs to be added (module must be added)
|
||||
|
@ -81,9 +82,9 @@ value caml_digitalRead(value pin)
|
|||
|
||||
value caml_digitalWriteByte(value value_p)
|
||||
{
|
||||
CAMLparam1(value_p);
|
||||
digitalWriteByte(Int_val(value_p));
|
||||
CAMLreturn(Val_unit);
|
||||
CAMLparam1(value_p);
|
||||
digitalWriteByte(Int_val(value_p));
|
||||
CAMLreturn(Val_unit);
|
||||
}
|
||||
|
||||
// Others can be added...
|
||||
|
@ -96,25 +97,25 @@ value caml_digitalWriteByte(value value_p)
|
|||
* program called one of the wiringPiSetup functions. */
|
||||
value caml_millis(value unit)
|
||||
{
|
||||
CAMLparam1(unit);
|
||||
CAMLreturn(Val_int(millis()));
|
||||
CAMLparam1(unit);
|
||||
CAMLreturn(Val_int(millis()));
|
||||
}
|
||||
|
||||
/* This returns a number representing the number of microseconds since your
|
||||
* program called one of the wiringPiSetup functions. */
|
||||
value caml_micros(value unit)
|
||||
{
|
||||
CAMLparam1(unit);
|
||||
CAMLreturn(Val_int(micros()));
|
||||
CAMLparam1(unit);
|
||||
CAMLreturn(Val_int(micros()));
|
||||
}
|
||||
|
||||
/* This causes program execution to pause for at least howLong milliseconds.
|
||||
* Due to the multi-tasking nature of Linux it could be longer. */
|
||||
value caml_delay(value howLong)
|
||||
{
|
||||
CAMLparam1(howLong);
|
||||
delay(Int_val(howLong));
|
||||
CAMLreturn(Val_unit);
|
||||
CAMLparam1(howLong);
|
||||
delay(Int_val(howLong));
|
||||
CAMLreturn(Val_unit);
|
||||
}
|
||||
|
||||
/* This causes program execution to pause for at least howLong microseconds.
|
||||
|
@ -126,7 +127,7 @@ value caml_delay(value howLong)
|
|||
* threads. */
|
||||
value caml_delayMicroseconds(value howLong)
|
||||
{
|
||||
CAMLparam1(howLong);
|
||||
delayMicroseconds(Int_val(howLong));
|
||||
CAMLreturn(Val_unit);
|
||||
CAMLparam1(howLong);
|
||||
delayMicroseconds(Int_val(howLong));
|
||||
CAMLreturn(Val_unit);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue