From: Jérémie D. <Ba...@us...> - 2010-03-07 22:46:30
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "krobot". The branch, master has been updated via ea6ee177b5f55f2c5c1c62c647962596786000a0 (commit) from 6c4e8c5630ad64620ea8228a0a4c56d50b02571f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ea6ee177b5f55f2c5c1c62c647962596786000a0 Author: Jérémie Dimino <je...@di...> Date: Sun Mar 7 23:45:43 2010 +0100 High level command for controlling the LCD ----------------------------------------------------------------------- Changes: diff --git a/PC_Mainboard/driver/driver.ml b/PC_Mainboard/driver/driver.ml index 82b5d48..e1472f0 100644 --- a/PC_Mainboard/driver/driver.ml +++ b/PC_Mainboard/driver/driver.ml @@ -79,6 +79,26 @@ struct module Unsafe = DBus_exports.LCD(OBus)(struct let get dev = dev.card end) + OL_interface(OBus) "fr.krobot.Device.LCD" + + OL_method SetLCD : string list -> unit = fun dev lines -> + if List.length lines > 4 || List.exists (fun line -> String.length line > 20) lines then + invalid_arg "SetLCD" + else + match lines with + | [] -> + return () + | line :: lines -> + lwt () = Unsafe.send dev ("\x1b\x43\x1b\x73" ^ line) in + let rec loop i = function + | [] -> + return () + | line :: lines -> + lwt () = Unsafe.send dev (String.make 1 (char_of_int i) ^ line) in + loop (i + 1) lines + in + loop 2 lines + let make card path = let dev = { obus = OBus.make ~interfaces:[Unsafe.interface] path; diff --git a/PC_Mainboard/lib_krobot/krobot.ml b/PC_Mainboard/lib_krobot/krobot.ml index 800683e..7f3940d 100644 --- a/PC_Mainboard/lib_krobot/krobot.ml +++ b/PC_Mainboard/lib_krobot/krobot.ml @@ -157,6 +157,15 @@ let jack krobot = React.S.map (fun ls -> ls.(15)) krobot.logic_sensors (* +-----------------------------------------------------------------+ + | LCD | + +-----------------------------------------------------------------+ *) + +module LCD = Make_device(struct let name = "LCD" end) +OP_interface(LCD) "fr.krobot.Device.LCD" + +OP_method SetLCD : string list -> unit + +(* +-----------------------------------------------------------------+ | Range finders | +-----------------------------------------------------------------+ *) diff --git a/PC_Mainboard/lib_krobot/krobot.mli b/PC_Mainboard/lib_krobot/krobot.mli index b5a56bf..3dc8a9a 100644 --- a/PC_Mainboard/lib_krobot/krobot.mli +++ b/PC_Mainboard/lib_krobot/krobot.mli @@ -29,6 +29,12 @@ val create : ?peer : OBus_peer.t -> unit -> t Lwt.t val peer : t -> OBus_peer.t (** Returns the driver peer *) +(** {6 LCD} *) + +val set_lcd : t -> string list -> unit Lwt.t + (** [set_lcd lines] set the lines displayed on the LCD. [lines] may + contains at most 4 lines, of maximum length 20. *) + (** {6 Compass} *) val compass : t -> int React.signal hooks/post-receive -- krobot |