Reindent in a style similar to the one used by the OCaml compiler

indent -kr -i2
This commit is contained in:
Marek Kubica 2014-07-06 23:36:08 +02:00
parent 182bdb8393
commit 1be98ccdac
1 changed files with 40 additions and 39 deletions

View File

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