Split the LCD API and the example into two files
This commit is contained in:
parent
2fcb2160f3
commit
feb2e218dc
2
_oasis
2
_oasis
|
@ -22,5 +22,5 @@ Executable "wpi-button-example"
|
|||
Executable "adafruit-lcd-example"
|
||||
Path: examples/
|
||||
BuildTools: ocamlbuild
|
||||
MainIs: lcd.ml
|
||||
MainIs: lcd_example.ml
|
||||
BuildDepends: WiringPi,unix
|
||||
|
|
|
@ -12,16 +12,6 @@ type mono_lcd = {
|
|||
d6: pin;
|
||||
d7: pin
|
||||
}
|
||||
let lcd = {
|
||||
columns = 16;
|
||||
rows = 2;
|
||||
rs = GPIO20;
|
||||
en = GPIO16;
|
||||
d4 = GPIO19;
|
||||
d5 = GPIO5;
|
||||
d6 = GPIO11;
|
||||
d7 = GPIO10;
|
||||
}
|
||||
|
||||
(** MAGIC NUMBERS *)
|
||||
(* Commands *)
|
||||
|
@ -131,9 +121,3 @@ let set_position lcd x y =
|
|||
|
||||
let write_bytes lcd bts =
|
||||
Bytes.iter (fun c -> write8 lcd c ~char_mode:true) bts
|
||||
|
||||
let _ =
|
||||
setup lcd;
|
||||
clear lcd;
|
||||
set_position lcd 0 0;
|
||||
write_bytes lcd (Bytes.of_string "Hello, world.")
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
(** An example with Adafruit character LCD, HD44780. *)
|
||||
open Gpio3
|
||||
open Lcd
|
||||
|
||||
let lcd = {
|
||||
columns = 16;
|
||||
rows = 2;
|
||||
rs = GPIO20;
|
||||
en = GPIO16;
|
||||
d4 = GPIO19;
|
||||
d5 = GPIO5;
|
||||
d6 = GPIO11;
|
||||
d7 = GPIO10;
|
||||
}
|
||||
|
||||
let _ =
|
||||
setup lcd;
|
||||
clear lcd;
|
||||
set_position lcd 0 0;
|
||||
write_bytes lcd (Bytes.of_string "Hello, world.")
|
Loading…
Reference in New Issue