diff --git a/Makefile b/Makefile index bd347bf..90138bf 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,4 @@ +# This Makefile is really not optimized... CC=ocamlc OPT=-custom diff --git a/README.org b/README.org index cd6c62d..9f83b02 100644 --- a/README.org +++ b/README.org @@ -5,8 +5,8 @@ and then : sudo ./sapin_noel.bin * Goal -This script uses the wiringPi library http://wiringpi.com/ (thank you for your job) and adapt it in order to make it usable in Ocaml. Must common functions are implemented (see wiringPiOcaml.ml) but lot's a function aren't present for the moment. It's very simple to add these functions, so you can add them and if you want I can add your modifications. +This script uses the wiringPi library http://wiringpi.com/ (thank you for your job) and adapts it in order to make it usable in Ocaml. Most common functions are implemented (see wiringPiOcaml.ml) but lot's of functions aren't present for the moment. It's very simple to add these functions, so you can add them and if you want I can add your modifications. -There is too a little script to use shift registers. +There is too a little script to use shift registers, and an example file named sapin_noel.ml. Enjoy ! diff --git a/sapin_noel.bin b/sapin_noel.bin index d28e796..ac72ea0 100755 Binary files a/sapin_noel.bin and b/sapin_noel.bin differ diff --git a/sapin_noel.ml b/sapin_noel.ml index 9f6c3f9..94c95e9 100644 --- a/sapin_noel.ml +++ b/sapin_noel.ml @@ -1,6 +1,10 @@ open WiringPiOcaml;; open ShiftReg;; +let g_invert = false +and g_pulse = false +and g_nb_reg = 2 + (* Ici on utilise des fonctions plus souples mais moins agréables pour les tests. Pour voir les fonctions classiques, cf anim_01 *) let test reg leds = lightLeds leds; @@ -60,17 +64,17 @@ let anim_02 reg leds n = done let _ = + let t = true + and f = false in (* On choisit le mode d'affichage Phys *) ignore(setupPhys ()); (* reg : pin_value = p_v, pin_shift = p_s, pin_apply = p_a *) (* On crée le register *) (* En mode pulse : *) (* let reg = genReg 11 13 15 ~pulse:true in *) - let reg = genReg 11 13 15 ~invert:false in + let reg = genReg 11 13 15 ~invert:g_invert ~pulse:g_pulse in (* On initialise *) - let leds = initReg reg ~nb_reg:2 in - let t = true - and f = false in + let leds = initReg reg ~nb_reg:g_nb_reg in Printf.printf "Début\n%!"; (* And a pretty animation *) anim_01 reg leds max_int;